!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.videojs=t()}(this,function(){function sc(n,t){return n(t={exports:{}},t.exports),t.exports}function uu(n,t){pw(n).forEach(function(i){return t(n[i],i)})}function k(n){for(var i=arguments.length,r=Array(1<i?i-1:0),t=1;t<i;t++)r[t-1]=arguments[t];return Object.assign?Object.assign.apply(Object,[n].concat(r)):(r.forEach(function(t){t&&uu(t,function(t,i){n[i]=t})}),n)}function nr(n){return!!n&&"object"===("undefined"==typeof n?"undefined":d(n))}function cf(n){return nr(n)&&"[object Object]"===not.call(n)&&n.constructor===Object}function ac(n,i){if(!n||!i)return"";if("function"==typeof t.getComputedStyle){var r=t.getComputedStyle(n);return r?r[i]:""}return""}function bw(n){return"string"==typeof n&&/\S/.test(n)}function kw(n){if(/\s/.test(n))throw new Error("class has illegal whitespace characters");}function fu(){return u===t.document}function lf(n){return nr(n)&&1===n.nodeType}function dw(){try{return t.parent!==t.self}catch(n){return!0}}function gw(n){return function(t,i){if(!bw(t))return u[n](null);bw(i)&&(i=u.querySelector(i));var r=lf(i)?i:u;return r[n]&&r[n](t)}}function g(){var f=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"div",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=arguments[3],n=u.createElement(f);return Object.getOwnPropertyNames(t).forEach(function(i){var r=t[i];-1!==i.indexOf("aria-")||"role"===i||"type"===i?(l.warn(cc(ww,i,r)),n.setAttribute(i,r)):"textContent"===i?af(n,r):n[i]=r}),Object.getOwnPropertyNames(i).forEach(function(t){n.setAttribute(t,i[t])}),r&&pc(n,r),n}function af(n,t){return"undefined"==typeof n.textContent?n.innerText=t:n.textContent=t,n}function lo(n,t){t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}function eu(n,t){return kw(t),n.classList?n.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(n.className);var i}function ar(n,t){return n.classList?n.classList.add(t):eu(n,t)||(n.className=(n.className+" "+t).trim()),n}function vf(n,t){return n.classList?n.classList.remove(t):(kw(t),n.className=n.className.split(/\s+/).filter(function(n){return n!==t}).join(" ")),n}function nb(n,t,i){var r=eu(n,t);if("function"==typeof i&&(i=i(n,t)),"boolean"!=typeof i&&(i=!r),i!==r)return i?ar(n,t):vf(n,t),n}function tb(n,t){Object.getOwnPropertyNames(t).forEach(function(i){var r=t[i];null===r||"undefined"==typeof r||!1===r?n.removeAttribute(i):n.setAttribute(i,!0===r?"":r)})}function yi(n){var f={},i,t,r,u;if(n&&n.attributes&&0<n.attributes.length)for(i=n.attributes,t=i.length-1;0<=t;t--)r=i[t].name,u=i[t].value,"boolean"!=typeof n[r]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+r+",")||(u=null!==u),f[r]=u;return f}function ib(n,t){return n.getAttribute(t)}function yf(n,t,i){n.setAttribute(t,i)}function ao(n,t){n.removeAttribute(t)}function rb(){u.body.focus();u.onselectstart=function(){return!1}}function ub(){u.onselectstart=function(){return!0}}function pf(n){if(n&&n.getBoundingClientRect&&n.parentNode){var i=n.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(function(n){void 0!==i[n]&&(t[n]=i[n])}),t.height||(t.height=parseFloat(ac(n,"height"))),t.width||(t.width=parseFloat(ac(n,"width"))),t}}function fb(n){var i=void 0;if(n.getBoundingClientRect&&n.parentNode&&(i=n.getBoundingClientRect()),!i)return{left:0,top:0};var f=u.documentElement,r=u.body,e=f.clientLeft||r.clientLeft||0,o=t.pageXOffset||r.scrollLeft,s=i.left+o-e,h=f.clientTop||r.clientTop||0,c=t.pageYOffset||r.scrollTop,l=i.top+c-h;return{left:Math.round(s),top:Math.round(l)}}function vc(n,t){var i={},r=fb(n),o=n.offsetWidth,u=n.offsetHeight,s=r.top,h=r.left,f=t.pageY,e=t.pageX;return t.changedTouches&&(e=t.changedTouches[0].pageX,f=t.changedTouches[0].pageY),i.y=Math.max(0,Math.min(1,(s-f+u)/u)),i.x=Math.max(0,Math.min(1,(e-h)/o)),i}function eb(n){return nr(n)&&3===n.nodeType}function yc(n){for(;n.firstChild;)n.removeChild(n.firstChild);return n}function ob(n){return"function"==typeof n&&(n=n()),(Array.isArray(n)?n:[n]).map(function(n){return"function"==typeof n&&(n=n()),lf(n)||eb(n)?n:"string"==typeof n&&/\S/.test(n)?u.createTextNode(n):void 0}).filter(function(n){return n})}function pc(n,t){return ob(t).forEach(function(t){return n.appendChild(t)}),n}function sb(n,t){return pc(yc(n),t)}function ou(n){return void 0===n.button&&void 0===n.buttons||0===n.button&&void 0===n.buttons||0===n.button&&1===n.buttons}function vr(){return tot++}function wf(n){var t=n[ir];return t||(t=n[ir]=vr()),su[t]||(su[t]={}),su[t]}function lb(n){var t=n[ir];return!!t&&!!Object.getOwnPropertyNames(su[t]).length}function ab(n){var t=n[ir];if(t){delete su[t];try{delete n[ir]}catch(t){n.removeAttribute?n.removeAttribute(ir):n[ir]=null}}}function vb(n,t){var i=wf(n);0===i.handlers[t].length&&(delete i.handlers[t],n.removeEventListener?n.removeEventListener(t,i.dispatcher,!1):n.detachEvent&&n.detachEvent("on"+t,i.dispatcher));Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled);0===Object.getOwnPropertyNames(i).length&&ab(n)}function wc(n,t,i,r){i.forEach(function(i){n(t,i,r)})}function vo(n){function o(){return!0}function s(){return!1}var i,r,f,e;if(!n||!n.isPropagationStopped){i=n||t.event;for(r in n={},i)"layerX"!==r&&"layerY"!==r&&"keyLocation"!==r&&"webkitMovementX"!==r&&"webkitMovementY"!==r&&("returnValue"===r&&i.preventDefault||(n[r]=i[r]));(n.target||(n.target=n.srcElement||u),n.relatedTarget||(n.relatedTarget=n.fromElement===n.target?n.toElement:n.fromElement),n.preventDefault=function(){i.preventDefault&&i.preventDefault();n.returnValue=!1;i.returnValue=!1;n.defaultPrevented=!0},n.defaultPrevented=!1,n.stopPropagation=function(){i.stopPropagation&&i.stopPropagation();n.cancelBubble=!0;i.cancelBubble=!0;n.isPropagationStopped=o},n.isPropagationStopped=s,n.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation();n.isImmediatePropagationStopped=o;n.stopPropagation()},n.isImmediatePropagationStopped=s,null!==n.clientX&&void 0!==n.clientX)&&(f=u.documentElement,e=u.body,n.pageX=n.clientX+(f&&f.scrollLeft||e&&e.scrollLeft||0)-(f&&f.clientLeft||e&&e.clientLeft||0),n.pageY=n.clientY+(f&&f.scrollTop||e&&e.scrollTop||0)-(f&&f.clientTop||e&&e.clientTop||0));n.which=n.charCode||n.keyCode;null!==n.button&&void 0!==n.button&&(n.button=1&n.button?0:4&n.button?1:2&n.button?2:0)}return n}function ii(n,t,i){var r,u;if(Array.isArray(t))return wc(ii,n,t,i);r=wf(n);(r.handlers||(r.handlers={}),r.handlers[t]||(r.handlers[t]=[]),i.guid||(i.guid=vr()),r.handlers[t].push(i),r.dispatcher||(r.disabled=!1,r.dispatcher=function(t,i){var u;if(!r.disabled&&(t=vo(t),u=r.handlers[t.type],u))for(var e=u.slice(0),f=0,o=e.length;f<o&&!t.isImmediatePropagationStopped();f++)try{e[f].call(n,t,i)}catch(t){l.error(t)}}),1===r.handlers[t].length)&&(n.addEventListener?(u=!1,bc&&-1<yb.indexOf(t)&&(u={passive:!0}),n.addEventListener(t,r.dispatcher,u)):n.attachEvent&&n.attachEvent("on"+t,r.dispatcher))}function vt(n,t,i){var r,e,u,f,o;if(lb(n)&&(r=wf(n),r.handlers)){if(Array.isArray(t))return wc(vt,n,t,i);if(e=function(n,t){r.handlers[t]=[];vb(n,t)},void 0!==t){if(u=r.handlers[t],u)if(i){if(i.guid)for(f=0;f<u.length;f++)u[f].guid===i.guid&&u.splice(f--,1);vb(n,t)}else e(n,t)}else for(o in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},o)&&e(n,o)}}function hu(n,t,i){var f=lb(n)?wf(n):{},r=n.parentNode||n.ownerDocument,u;return("string"==typeof t?t={type:t,target:n}:t.target||(t.target=n),t=vo(t),f.dispatcher&&f.dispatcher.call(n,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles)?hu.call(null,r,t,i):r||t.defaultPrevented||(u=wf(t.target),t.target[t.type]&&(u.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),u.disabled=!1)),!t.defaultPrevented}function bf(n,t,i){if(Array.isArray(t))return wc(bf,n,t,i);var r=function r(){vt(n,t,r);i.apply(this,arguments)};r.guid=i.guid=i.guid||vr();ii(n,t,r)}function gc(n,i){i&&(dc=i);t.setTimeout(rot,n)}function tl(n){var i=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).eventBusKey;if(i){if(!n[i].nodeName)throw new Error('The eventBusKey "'+i+'" does not refer to an element.');n.eventBusEl_=n[i]}else n.eventBusEl_=g("span",{className:"vjs-event-bus"});return k(n,fot),n.on("dispose",function(){n.off();t.setTimeout(function(){n.eventBusEl_=null},0)}),n}function tk(n,t){return k(n,nk),n.state=k({},n.state,t),"function"==typeof n.handleStateChanged&&yo(n)&&n.on("statechanged",n.handleStateChanged),n}function b(n){return"string"!=typeof n?n:n.charAt(0).toUpperCase()+n.slice(1)}function p(){for(var n={},i=arguments.length,r=Array(i),t=0;t<i;t++)r[t]=arguments[t];return r.forEach(function(t){t&&uu(t,function(t,i){cf(t)?(cf(n[i])||(n[i]={}),n[i]=p(n[i],t)):n[i]=t})}),n}function ck(n,t,i,r){return function(n,t,i){if("number"!=typeof t||t<0||i<t)throw new Error("Failed to execute '"+n+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").");}(n,r,i.length-1),i[r][t]}function cl(n){return void 0===n||0===n.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty");},end:function(){throw new Error("This TimeRanges object is empty");}}:{length:n.length,start:ck.bind(null,"start",0,n),end:ck.bind(null,"end",1,n)}}function pr(n,t){return Array.isArray(n)?cl(n):void 0===n||void 0===t?cl():cl([[n,t]])}function lk(n,t){var u=0,f=void 0,r=void 0,i;if(!t)return 0;for(n&&n.length||(n=pr(0,0)),i=0;i<n.length;i++)f=n.start(i),t<(r=n.end(i))&&(r=t),u+=r-f;return u/t}function ut(n){if(n instanceof ut)return n;"number"==typeof n?this.code=n:"string"==typeof n?this.message=n:nr(n)&&("number"==typeof n.code&&(this.code=n.code),k(this,n));this.message||(this.message=ut.defaultMessages[this.code]||"")}function vk(n){return null!=n&&"function"==typeof n.then}function gf(n){vk(n)&&n.then(null,function(){})}function od(n,t,i){var r=n;return td(t)?(i=t,"string"==typeof n&&(r={uri:n})):r=fst(t,{uri:n}),r.callback=i,r}function ur(n,t,i){return sd(t=od(n,t,i))}function sd(n){function s(n){return clearTimeout(h),n instanceof Error||(n=new Error(""+(n||"Unknown XMLHttpRequest Error"))),n.statusCode=0,o(n,p)}function v(){var u,i,e;if(!f)return clearTimeout(h),u=n.useXDR&&void 0===t.status?200:1223===t.status?204:t.status,i=p,e=null,0!==u?(i={body:function(){var n=void 0;if(n=t.response?t.response:t.responseText||function(n){if("document"===n.responseType)return n.responseXML;var t=n.responseXML&&"parsererror"===n.responseXML.documentElement.nodeName;return""!==n.responseType||t?null:n.responseXML}(t),y)try{n=JSON.parse(n)}catch(n){}return n}(),statusCode:u,method:r,headers:{},url:c,rawRequest:t},t.getAllResponseHeaders&&(i.headers=ust(t.getAllResponseHeaders()))):e=new Error("Internal XMLHttpRequest Error"),o(e,i,i.body)}var e,o,u,f,t;if("undefined"==typeof n.callback)throw new Error("callback argument missing");e=!1;o=function(t,i,r){e||(e=!0,n.callback(t,i,r))};t=n.xhr||null;t||(t=n.cors||n.useXDR?new ur.XDomainRequest:new ur.XMLHttpRequest);var h,c=t.url=n.uri||n.url,r=t.method=n.method||"GET",l=n.body||n.data,i=t.headers=n.headers||{},a=!!n.sync,y=!1,p={body:void 0,headers:{},statusCode:0,method:r,url:c,rawRequest:t};if("json"in n&&!1!==n.json&&(y=!0,i.accept||i.Accept||(i.Accept="application/json"),"GET"!==r&&"HEAD"!==r&&(i["content-type"]||i["Content-Type"]||(i["Content-Type"]="application/json"),l=JSON.stringify(!0===n.json?l:n.json))),t.onreadystatechange=function(){4===t.readyState&&setTimeout(v,0)},t.onload=v,t.onerror=s,t.onprogress=function(){},t.onabort=function(){f=!0},t.ontimeout=s,t.open(r,c,!a,n.username,n.password),a||(t.withCredentials=!!n.withCredentials),!a&&0<n.timeout&&(h=setTimeout(function(){if(!f){f=!0;t.abort("timeout");var n=new Error("XMLHttpRequest timeout");n.code="ETIMEDOUT";s(n)}},n.timeout)),t.setRequestHeader)for(u in i)i.hasOwnProperty(u)&&t.setRequestHeader(u,i[u]);else if(n.headers&&!function(n){for(var t in n)if(n.hasOwnProperty(t))return!1;return!0}(n.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in n&&(t.responseType=n.responseType),"beforeSend"in n&&"function"==typeof n.beforeSend&&n.beforeSend(t),t.send(l||null),t}function ri(n,t){this.name="ParsingError";this.code=n.code;this.message=t||n.message}function ta(n){function i(n,t,i,r){return 3600*(0|n)+60*(0|t)+(0|i)+(0|r)/1e3}var t=n.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return t?t[3]?i(t[1],t[2],t[3].replace(":",""),t[4]):59<t[1]?i(t[1],t[2],0,t[4]):i(0,t[1],t[2],t[4]):null}function ie(){this.values=ts(null)}function re(n,t,i,r){var f=r?n.split(r):[n],e,u;for(e in f)"string"==typeof f[e]&&(u=f[e].split(i),2===u.length&&t(u[0],u[1]))}function ost(n,t,i){function s(){var t=ta(n);if(null===t)throw new ri(ri.Errors.BadTimeStamp,"Malformed timestamp: "+o);return n=n.replace(/^[^\sa-zA-Z-]+/,""),t}function f(){n=n.replace(/^\s+/,"")}var e,u,r,o=n;if(f(),t.startTime=s(),f(),"-->"!==n.substr(0,3))throw new ri(ri.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+o);n=n.substr(3);f();t.endTime=s();f();e=n;u=t;r=new ie;re(e,function(n,t){var f,u,e;switch(n){case"region":for(f=i.length-1;0<=f;f--)if(i[f].id===t){r.set(n,i[f].region);break}break;case"vertical":r.alt(n,t,["rl","lr"]);break;case"line":u=t.split(",");e=u[0];r.integer(n,e);r.percent(n,e)&&r.set("snapToLines",!1);r.alt(n,e,["auto"]);2===u.length&&r.alt("lineAlign",u[1],["start","middle","end"]);break;case"position":u=t.split(",");r.percent(n,u[0]);2===u.length&&r.alt("positionAlign",u[1],["start","middle","end"]);break;case"size":r.percent(n,t);break;case"align":r.alt(n,t,["start","middle","end","left","right"])}},/:/,/\s/);u.region=r.get("region",null);u.vertical=r.get("vertical","");u.line=r.get("line","auto");u.lineAlign=r.get("lineAlign","start");u.snapToLines=r.get("snapToLines",!0);u.size=r.get("size",100);u.align=r.get("align","middle");u.position=r.get("position",{start:0,left:0,middle:50,end:100,right:100},u.align);u.positionAlign=r.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},u.align)}function pd(n,t){function l(){if(!t)return null;var n,i=t.match(/^([^<]*)(<[^>]*>?)?/);return n=i[1]?i[1]:i[2],t=t.substr(n.length),n}function a(n){return sst[n]}function v(n){for(;i=n.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)n=n.replace(i[0],a);return n}function y(t,i){var u=hst[t],r,f;return u?(r=n.document.createElement(u),r.localName=u,f=cst[t],f&&i&&(r[f]=i.trim()),r):null}for(var f,o,i,r,s,h,c=n.document.createElement("div"),u=c,e=[];null!==(r=l());)if("<"!==r[0])u.appendChild(n.document.createTextNode(v(r)));else{if("/"===r[1]){e.length&&e[e.length-1]===r.substr(2).replace(">","")&&(e.pop(),u=u.parentNode);continue}if(o=ta(r.substr(1,r.length-2)),o){f=n.document.createProcessingInstruction("timestamp",o);u.appendChild(f);continue}if(i=r.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/),!i)continue;if(!(f=y(i[1],i[3])))continue;if(s=u,yd[(h=f).localName]&&yd[h.localName]!==s.localName)continue;i[2]&&(f.className=i[2].substr(1).replace("."," "));e.push(i[1]);u.appendChild(f);u=f}return c}function lst(n){for(var i,t=0;t<ia.length;t++)if(i=ia[t],n>=i[0]&&n<=i[1])return!0;return!1}function is(){}function ra(n,t,i){var u,r;is.call(this);this.cue=t;this.cueDiv=pd(n,t.text);u={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(u,this.cueDiv);this.div=n.document.createElement("div");u={direction:function(n){function f(n,t){for(var i=t.childNodes.length-1;0<=i;i--)n.push(t.childNodes[i])}function r(n){var t,i,u;return!n||!n.length?null:(t=n.pop(),i=t.textContent||t.innerText,i)?(u=i.match(/^.*(\n|\r)/),u?u[n.length=0]:i):"ruby"===t.tagName?r(n):t.childNodes?(f(n,t),r(n)):void 0}var u=[],i="",t;if(!n||!n.childNodes)return"ltr";for(f(u,n);i=r(u);)for(t=0;t<i.length;t++)if(lst(i.charCodeAt(t)))return"rtl";return"ltr"}(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"};this.applyStyles(u);this.div.appendChild(this.cueDiv);r=0;switch(t.positionAlign){case"start":r=t.position;break;case"middle":r=t.position-t.size/2;break;case"end":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")});this.move=function(n){this.applyStyles({top:this.formatStyle(n.top,"px"),bottom:this.formatStyle(n.bottom,"px"),left:this.formatStyle(n.left,"px"),right:this.formatStyle(n.right,"px"),height:this.formatStyle(n.height,"px"),width:this.formatStyle(n.width,"px")})}}function ft(n){var i,r,f,u,t;n.div&&(r=n.div.offsetHeight,f=n.div.offsetWidth,u=n.div.offsetTop,t=(t=n.div.childNodes)&&(t=t[0])&&t.getClientRects&&t.getClientRects(),n=n.div.getBoundingClientRect(),i=t?Math.max(t[0]&&t[0].height||0,n.height/t.length):0);this.left=n.left;this.right=n.right;this.top=n.top||u;this.height=n.height||r;this.bottom=n.bottom||u+(n.height||r);this.width=n.width||f;this.lineHeight=void 0!==i?i:n.lineHeight}function ast(n,t,i,r){var s=new ft(t),e=t.cue,f=function(n){if("number"==typeof n.line&&(n.snapToLines||0<=n.line&&n.line<=100))return n.line;if(!n.track||!n.track.textTrackList||!n.track.textTrackList.mediaElement)return-1;for(var r=n.track,i=r.textTrackList,u=0,t=0;t<i.length&&i[t]!==r;t++)"showing"===i[t].mode&&u++;return-1*++u}(e),u=[],h,l,v;if(e.snapToLines){switch(e.vertical){case"":u=["+y","-y"];h="height";break;case"rl":u=["+x","-x"];h="width";break;case"lr":u=["-x","+x"];h="width"}var c=s.lineHeight,o=c*Math.round(f),a=i[h]+c,y=u[0];Math.abs(o)>a&&(o=o<0?-1:1,o*=Math.ceil(a/c)*c);f<0&&(o+=""===e.vertical?i.height:i.width,u=u.reverse());s.move(y,o)}else{l=s.lineHeight/i.height*100;switch(e.lineAlign){case"middle":f-=l/2;break;case"end":f-=l}switch(e.vertical){case"":t.applyStyles({top:t.formatStyle(f,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(f,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(f,"%")})}u=["+y","-x","+x","-y"];s=new ft(t)}v=function(n,t){for(var f,e,o=new ft(n),s=1,u=0;u<t.length;u++){for(;n.overlapsOppositeAxis(i,t[u])||n.within(i)&&n.overlapsAny(r);)n.move(t[u]);if(n.within(i))return n;f=n.intersectPercentage(i);f<s&&(e=new ft(n),s=f);n=new ft(o)}return e||o}(s,u);t.move(v.toCSSCompatValues(i))}function ue(){}function fa(n){return"string"==typeof n&&!!pst[n.toLowerCase()]&&n.toLowerCase()}function bd(n,t,i){this.hasBeenReset=!1;var r="",u=!1,f=n,e=t,o=i,s=null,h="",c=!0,l="auto",a="start",v=50,y="middle",p=50,w="middle";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(n){r=""+n}},pauseOnExit:{enumerable:!0,get:function(){return u},set:function(n){u=!!n}},startTime:{enumerable:!0,get:function(){return f},set:function(n){if("number"!=typeof n)throw new TypeError("Start time must be set to a number.");f=n;this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return e},set:function(n){if("number"!=typeof n)throw new TypeError("End time must be set to a number.");e=n;this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(n){o=""+n;this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return s},set:function(n){s=n;this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return h},set:function(n){var t,i="string"==typeof(t=n)&&!!yst[t.toLowerCase()]&&t.toLowerCase();if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");h=i;this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(n){c=!!n;this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return l},set:function(n){if("number"!=typeof n&&n!==vst)throw new SyntaxError("An invalid number or illegal string was specified.");l=n;this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return a},set:function(n){var t=fa(n);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");a=t;this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return v},set:function(n){if(n<0||100<n)throw new Error("Position must be between 0 and 100.");v=n;this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return y},set:function(n){var t=fa(n);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t;this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return p},set:function(n){if(n<0||100<n)throw new Error("Size must be between 0 and 100.");p=n;this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return w},set:function(n){var t=fa(n);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");w=t;this.hasBeenReset=!0}}});this.displayState=void 0}function fe(n){return"number"==typeof n&&0<=n&&n<=100}function gst(n,t,i){n.setTimeout(function(){return function i(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},h=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2],u=arguments[3],n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:[],f=5<arguments.length&&void 0!==arguments[5]&&arguments[5],s=h[0],e=h.slice(1),o;if("string"==typeof s)i(t,kr[s],r,u,n,f);else if(s){if(o=function(n,t){var r=sa[n.id()],i=null,u;if(null==r)return i=t(n),sa[n.id()]=[[t,i]],i;for(u=0;u<r.length;u++){var f=r[u],e=f[0],o=f[1];e===t&&(i=o)}return null===i&&(i=t(n),r.push([t,i])),i}(u,s),!o.setSource)return n.push(o),i(t,e,r,u,n,f);o.setSource(k({},t),function(s,h){if(s)return i(t,e,r,u,n,f);n.push(o);i(h,t.type===h.type?e:kr[h.type],r,u,n,f)})}else e.length?i(t,e,r,u,n,f):f?r(t,n):i(t,kr["*"],r,u,n,!0)}(t,kr[t.type],i,n)},1)}function gd(n,t,i){var e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,o="call"+b(i),r=n.reduce(ha(o),e),u=r===rs,f=u?null:t[i](r);return function(n,t,i,r){for(var f,u=n.length-1;0<=u;u--)f=n[u],f[t]&&f[t](r,i)}(n,i,f,u),f}function ha(n){return function(t,i){return t===rs?rs:i[n]?i[n](t):t}}function ig(n){var t=ca(n.src);return!n.type&&t&&(n.type=t),n}function la(n,t){var i=void 0;if(4===n.length)i=n[1]+n[1]+n[2]+n[2]+n[3]+n[3];else{if(7!==n.length)throw new Error("Invalid color code provided, "+n+"; must be formatted as e.g. #f0e or #f604e2.");i=n.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function aa(n,t,i){try{n.style[t]=i}catch(n){return}}function pu(n){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;return us(n,t)}function en(n,t){if(t&&(n=t(n)),n&&"none"!==n)return n}function n(t,r,f){var e=n.getPlayer(t),o,s;if(e)return r&&l.warn('Player "'+t+'" is already initialised. Options will not be applied.'),f&&e.ready(f),e;if(o="string"==typeof t?tr("#"+wv(t)):t,!lf(o))throw new TypeError("The element or ID supplied is not valid. (videojs)");return u.body.contains(o)||l.warn("The element supplied is not included in the DOM"),r=r||{},n.hooks("beforesetup").forEach(function(n){var t=n(o,p(r));nr(t)&&!Array.isArray(t)?r=p(r,t):l.error("please return an object in beforesetup hooks")}),s=i.getComponent("Player"),e=new s(o,r,f),n.hooks("setup").forEach(function(n){return n(e)}),e}function pft(n,t){return function(i){var u=this,f,r;if(!t)return new hf(n);if(hf&&!i)return f=wft(t.toString().replace(/^function.+?{/,"").slice(0,-1)),this[kp]=new hf(f),function(n,t){if(n&&t){var i=n.terminate;n.objURL=t;n.terminate=function(){n.objURL&&sf.revokeObjectURL(n.objURL);i.call(n)}}}(this[kp],f),this[kp];r={postMessage:function(n){u.onmessage&&setTimeout(function(){u.onmessage({data:n,target:r})})}};t.call(r);this.postMessage=function(n){setTimeout(function(){r.onmessage({data:n,target:u})})};this.isThisThread=!0}}function wft(n){try{return sf.createObjectURL(new Blob([n],{type:gyt}))}catch(i){var t=new npt;return t.append(n),sf.createObjectURL(t.getBlob(type))}}function eo(){}var aw="7.2.4",gi="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},so,t="undefined"!=typeof window?window:"undefined"!=typeof gi?gi:"undefined"!=typeof self?self:{},hc={},vw=Object.freeze({"default":hc}),get=vw&&hc||vw,yw="undefined"!=typeof gi?gi:"undefined"!=typeof window?window:{},ww,su,ir,bc,yb,lu,nk,i,df,wr,ak,br,pk,yt,yu,lt,ts,ia,y,tg,ca,rg,oe,ug,se,fg,eg,og,hi,va,sg,ya,pa,us,dr,fs,es,hg,os,cg,ss,lg,ag,hs,wa,he,ba,ka,vg,yg,cs,da,pg,ga,nv,ls,as,vs,wu,bu,tv,gr,iv,ys,ps,ws,bs,ks,rv,ds,uv,fv,gs,ev,ov,wg,sv,hv,on,sn,ce,yv,ln,ku,wv,le,uh,yy,wh,dp,gp,nw,uw,ht,hw,cw,ket;"undefined"!=typeof document?so=document:(so=yw["__GLOBAL_DOCUMENT_CACHE@4"])||(so=yw["__GLOBAL_DOCUMENT_CACHE@4"]=get);var u=so,bt=void 0,ho="info",ti=[],co=function(n,i){var u=bt.levels[ho],f=new RegExp("^("+u+")$"),r;("log"!==n&&i.unshift(n.toUpperCase()+":"),ti&&ti.push([].concat(i)),i.unshift("VIDEOJS:"),t.console)&&(r=t.console[n],r||"debug"!==n||(r=t.console.info||t.console.log),r&&u&&f.test(n)&&r[Array.isArray(i)?"apply":"call"](t.console,i))};(bt=function(){for(var t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];co("log",i)}).levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:ho};bt.level=function(n){if("string"==typeof n){if(!bt.levels.hasOwnProperty(n))throw new Error('"'+n+'" in not a valid log level');ho=n}return ho};bt.history=function(){return ti?[].concat(ti):[]};bt.history.clear=function(){ti&&(ti.length=0)};bt.history.disable=function(){null!==ti&&(ti.length=0,ti=null)};bt.history.enable=function(){null===ti&&(ti=[])};bt.error=function(){for(var t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];return co("error",i)};bt.warn=function(){for(var t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];return co("warn",i)};bt.debug=function(){for(var t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];return co("debug",i)};var l=bt,cc=function(n){for(var i="",t=0;t<arguments.length;t++)i+=n[t].replace(/\n\r?\s*/g,"")+(arguments[t+1]||"");return i},d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},f=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");},o=function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)},e=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?n:t},lc=function(n,t){return n.raw=t,n},not=Object.prototype.toString,pw=function(n){return nr(n)?Object.keys(n):[]};ww=lc(["Setting attributes in the second argument of createEl()\n                has been deprecated. Use the third argument instead.\n                createEl(type, properties, attributes). Attempting to set "," to ","."],["Setting attributes in the second argument of createEl()\n                has been deprecated. Use the third argument instead.\n                createEl(type, properties, attributes). Attempting to set "," to ","."]);var tr=gw("querySelector"),hb=gw("querySelectorAll"),cb=Object.freeze({isReal:fu,isEl:lf,isInFrame:dw,createEl:g,textContent:af,prependTo:lo,hasClass:eu,addClass:ar,removeClass:vf,toggleClass:nb,setAttributes:tb,getAttributes:yi,getAttribute:ib,setAttribute:yf,removeAttribute:ao,blockTextSelection:rb,unblockTextSelection:ub,getBoundingClientRect:pf,findPosition:fb,getPointerPosition:vc,isTextNode:eb,emptyEl:yc,normalizeContent:ob,appendContent:pc,insertContent:sb,isSingleLeftClick:ou,$:tr,$$:hb}),tot=1;su={};ir="vdata"+(new Date).getTime();bc=!1;!function(){try{var n=Object.defineProperty({},"passive",{get:function(){bc=!0}});t.addEventListener("test",null,n);t.removeEventListener("test",null,n)}catch(n){}}();yb=["touchstart","touchmove"];var iot=Object.freeze({fixEvent:vo,on:ii,off:vt,trigger:hu,one:bf}),kc=!1,dc=void 0,rot=function(){var i,r,n;if(fu()&&!1!==dc.options.autoSetup){var f=Array.prototype.slice.call(u.getElementsByTagName("video")),e=Array.prototype.slice.call(u.getElementsByTagName("audio")),o=Array.prototype.slice.call(u.getElementsByTagName("video-js")),t=f.concat(e,o);if(t&&0<t.length)for(i=0,r=t.length;i<r;i++){if(n=t[i],!n||!n.getAttribute){gc(1);break}void 0===n.player&&null!==n.getAttribute("data-setup")&&dc(n)}else kc||gc(1)}};fu()&&"complete"===u.readyState?kc=!0:bf(t,"load",function(){kc=!0});var pb=function(n){var t=u.createElement("style");return t.className=n,t},wb=function(n,t){n.styleSheet?n.styleSheet.cssText=t:n.textContent=t},s=function(n,t,i){t.guid||(t.guid=vr());var r=function(){return t.apply(n,arguments)};return r.guid=i?i+"_"+t.guid:t.guid,r},cu=function(n,t){var i=Date.now();return function(){var r=Date.now();t<=r-i&&(n.apply(void 0,arguments),i=r)}},uot=function(n,i,r){var f=3<arguments.length&&void 0!==arguments[3]?arguments[3]:t,u=void 0,e=function(){var t=this,e=arguments,o=function(){o=u=null;r||n.apply(t,e)};!u&&r&&n.apply(t,e);f.clearTimeout(u);u=f.setTimeout(o,i)};return e.cancel=function(){f.clearTimeout(u);u=null},e},ct=function(){};ct.prototype.allowedEvents_={};ct.prototype.addEventListener=ct.prototype.on=function(n,t){var i=this.addEventListener;this.addEventListener=function(){};ii(this,n,t);this.addEventListener=i};ct.prototype.removeEventListener=ct.prototype.off=function(n,t){vt(this,n,t)};ct.prototype.one=function(n,t){var i=this.addEventListener;this.addEventListener=function(){};bf(this,n,t);this.addEventListener=i};ct.prototype.dispatchEvent=ct.prototype.trigger=function(n){var t=n.type||n;"string"==typeof n&&(n={type:t});n=vo(n);this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](n);hu(this,n)};lu=void 0;ct.prototype.queueTrigger=function(n){var u=this,r,i,f,e;lu||(lu=new Map);r=n.type||n;i=lu.get(this);i||(i=new Map,lu.set(this,i));f=i.get(r);i.delete(r);t.clearTimeout(f);e=t.setTimeout(function(){0===i.size&&(i=null,lu.delete(u));u.trigger(n)},0);i.set(r,e)};var yo=function(n){return n instanceof ct||!!n.eventBusEl_&&["on","one","off","trigger"].every(function(t){return"function"==typeof n[t]})},bb=function(n){return"string"==typeof n&&/\S/.test(n)||Array.isArray(n)&&!!n.length},nl=function(n){if(!n.nodeName&&!yo(n))throw new Error("Invalid target; must be a DOM node or evented object.");},kb=function(n){if(!bb(n))throw new Error("Invalid event type; must be a non-empty string or array.");},db=function(n){if("function"!=typeof n)throw new Error("Invalid listener; must be a function.");},gb=function(n,t){var f=t.length<3||t[0]===n||t[0]===n.eventBusEl_,r=void 0,u=void 0,i=void 0;return f?(r=n.eventBusEl_,3<=t.length&&t.shift(),u=t[0],i=t[1]):(r=t[0],u=t[1],i=t[2]),nl(r),kb(u),db(i),{isTargetingSelf:f,target:r,type:u,listener:i=s(n,i)}},kf=function(n,t,i,r){nl(n);n.nodeName?iot[t](n,i,r):n[t](i,r)},fot={on:function(){for(var r,f,e=this,o=arguments.length,s=Array(o),n=0;n<o;n++)s[n]=arguments[n];var t=gb(this,s),c=t.isTargetingSelf,u=t.target,h=t.type,i=t.listener;(kf(u,"on",h,i),c)||(r=function(){return e.off(u,h,i)},r.guid=i.guid,f=function(){return e.off("dispose",r)},f.guid=i.guid,kf(this,"on","dispose",r),kf(u,"on","dispose",f))},one:function(){for(var e,s=this,i=arguments.length,o=Array(i),n=0;n<i;n++)o[n]=arguments[n];var t=gb(this,o),h=t.isTargetingSelf,r=t.target,u=t.type,f=t.listener;h?kf(r,"one",u,f):(e=function i(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];s.off(r,u,i);f.apply(null,e)},e.guid=f.guid,kf(r,"one",u,e))},off:function(n,t,i){if(!n||bb(n))vt(this.eventBusEl_,n,t);else{var r=n,u=t;nl(r);kb(u);db(i);i=s(this,i);this.off("dispose",i);r.nodeName?(vt(r,u,i),vt(r,"dispose",i)):yo(r)&&(r.off(u,i),r.off("dispose",i))}},trigger:function(n,t){return hu(this.eventBusEl_,n,t)}};nk={state:{},setState:function(n){var i=this,t;return"function"==typeof n&&(n=n()),t=void 0,uu(n,function(n,r){i.state[r]!==n&&((t=t||{})[r]={from:i.state[r],to:n});i.state[r]=n}),t&&yo(this)&&this.trigger({changes:t,type:"statechanged"}),t}};i=function(){function n(t,i,r){if(f(this,n),this.player_=!t&&this.play?t=this:t,this.options_=p({},this.options_),i=this.options_=p(this.options_,i),this.id_=i.id||i.el&&i.el.id,!this.id_){var u=t&&t.id&&t.id()||"no_player";this.id_=u+"_component_"+vr()}this.name_=i.name||null;i.el?this.el_=i.el:!1!==i.createEl&&(this.el_=this.createEl());!1!==i.evented&&tl(this,{eventBusKey:this.el_?"el_":null});tk(this,this.constructor.defaultState);this.children_=[];this.childIndex_={};!(this.childNameIndex_={})!==i.initChildren&&this.initChildren();this.ready(r);!1!==i.reportTouchActivity&&this.enableTouchActivity()}return n.prototype.dispose=function(){if(this.trigger({type:"dispose",bubbles:!1}),this.children_)for(var n=this.children_.length-1;0<=n;n--)this.children_[n].dispose&&this.children_[n].dispose();this.children_=null;this.childIndex_=null;this.childNameIndex_=null;this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),ab(this.el_),this.el_=null);this.player_=null},n.prototype.player=function(){return this.player_},n.prototype.options=function(n){return l.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"),n&&(this.options_=p(this.options_,n)),this.options_},n.prototype.el=function(){return this.el_},n.prototype.createEl=function(n,t,i){return g(n,t,i)},n.prototype.localize=function(n,t){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:n,u=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),f=r&&r[u],s=u&&u.split("-")[0],e=r&&r[s],i=o;return f&&f[n]?i=f[n]:e&&e[n]&&(i=e[n]),t&&(i=i.replace(/\{(\d+)\}/g,function(n,i){var r=t[i-1],u=r;return"undefined"==typeof r&&(u=n),u})),i},n.prototype.contentEl=function(){return this.contentEl_||this.el_},n.prototype.id=function(){return this.id_},n.prototype.name=function(){return this.name_},n.prototype.children=function(){return this.children_},n.prototype.getChildById=function(n){return this.childIndex_[n]},n.prototype.getChild=function(n){if(n)return n=b(n),this.childNameIndex_[n]},n.prototype.addChild=function(t){var f=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.children_.length,i=void 0,r=void 0,e,u,s;if("string"==typeof t){if(r=b(t),e=f.componentClass||r,f.name=r,u=n.getComponent(e),!u)throw new Error("Component "+e+" does not exist");if("function"!=typeof u)return null;i=new u(this.player_||this,f)}else i=t;return(this.children_.splice(o,0,i),"function"==typeof i.id&&(this.childIndex_[i.id()]=i),(r=r||i.name&&b(i.name()))&&(this.childNameIndex_[r]=i),"function"==typeof i.el&&i.el())&&(s=this.contentEl().children[o]||null,this.contentEl().insertBefore(i.el(),s)),i},n.prototype.removeChild=function(n){var i,t,r;if("string"==typeof n&&(n=this.getChild(n)),n&&this.children_){for(i=!1,t=this.children_.length-1;0<=t;t--)if(this.children_[t]===n){i=!0;this.children_.splice(t,1);break}i&&(this.childIndex_[n.id()]=null,this.childNameIndex_[n.name()]=null,r=n.el(),r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(n.el()))}},n.prototype.initChildren=function(){var i=this,t=this.options_.children;if(t){var r=this.options_,u=void 0,f=n.getComponent("Tech");(u=Array.isArray(t)?t:Object.keys(t)).concat(Object.keys(this.options_).filter(function(n){return!u.some(function(t){return"string"==typeof t?n===t:n===t.name})})).map(function(n){var r=void 0,u=void 0;return"string"==typeof n?u=t[r=n]||i.options_[r]||{}:(r=n.name,u=n),{name:r,opts:u}}).filter(function(t){var i=n.getComponent(t.opts.componentClass||b(t.name));return i&&!f.isTech(i)}).forEach(function(n){var u=n.name,t=n.opts,f;(void 0!==r[u]&&(t=r[u]),!1!==t)&&(!0===t&&(t={}),t.playerOptions=i.options_.playerOptions,f=i.addChild(u,t),f&&(i[u]=f))})}},n.prototype.buildCSSClass=function(){return""},n.prototype.ready=function(n){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(n)return this.isReady_?void(t?n.call(this):this.setTimeout(n,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(n))},n.prototype.triggerReady=function(){this.isReady_=!0;this.setTimeout(function(){var n=this.readyQueue_;this.readyQueue_=[];n&&0<n.length&&n.forEach(function(n){n.call(this)},this);this.trigger("ready")},1)},n.prototype.$=function(n,t){return tr(n,t||this.contentEl())},n.prototype.$$=function(n,t){return hb(n,t||this.contentEl())},n.prototype.hasClass=function(n){return eu(this.el_,n)},n.prototype.addClass=function(n){ar(this.el_,n)},n.prototype.removeClass=function(n){vf(this.el_,n)},n.prototype.toggleClass=function(n,t){nb(this.el_,n,t)},n.prototype.show=function(){this.removeClass("vjs-hidden")},n.prototype.hide=function(){this.addClass("vjs-hidden")},n.prototype.lockShowing=function(){this.addClass("vjs-lock-showing")},n.prototype.unlockShowing=function(){this.removeClass("vjs-lock-showing")},n.prototype.getAttribute=function(n){return ib(this.el_,n)},n.prototype.setAttribute=function(n,t){yf(this.el_,n,t)},n.prototype.removeAttribute=function(n){ao(this.el_,n)},n.prototype.width=function(n,t){return this.dimension("width",n,t)},n.prototype.height=function(n,t){return this.dimension("height",n,t)},n.prototype.dimensions=function(n,t){this.width(n,!0);this.height(t)},n.prototype.dimension=function(n,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),this.el_.style[n]=-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?t:"auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var r=this.el_.style[n],u=r.indexOf("px");return-1!==u?parseInt(r.slice(0,u),10):parseInt(this.el_["offset"+b(n)],10)},n.prototype.currentDimension=function(n){var i=0,r,u;if("width"!==n&&"height"!==n)throw new Error("currentDimension only accepts width or height value");return"function"==typeof t.getComputedStyle&&(r=t.getComputedStyle(this.el_),i=r.getPropertyValue(n)||r[n]),0===(i=parseFloat(i))&&(u="offset"+b(n),i=this.el_[u]),i},n.prototype.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},n.prototype.currentWidth=function(){return this.currentDimension("width")},n.prototype.currentHeight=function(){return this.currentDimension("height")},n.prototype.focus=function(){this.el_.focus()},n.prototype.blur=function(){this.el_.blur()},n.prototype.emitTapEvents=function(){var r=0,n=null,t=void 0,i;this.on("touchstart",function(i){1===i.touches.length&&(n={pageX:i.touches[0].pageX,pageY:i.touches[0].pageY},r=(new Date).getTime(),t=!0)});this.on("touchmove",function(i){if(1<i.touches.length)t=!1;else if(n){var r=i.touches[0].pageX-n.pageX,u=i.touches[0].pageY-n.pageY;10<Math.sqrt(r*r+u*u)&&(t=!1)}});i=function(){t=!1};this.on("touchleave",i);this.on("touchcancel",i);this.on("touchend",function(i){!(n=null)===t&&(new Date).getTime()-r<200&&(i.preventDefault(),this.trigger("tap"))})},n.prototype.enableTouchActivity=function(){var n,t,i;if(this.player()&&this.player().reportUserActivity){n=s(this.player(),this.player().reportUserActivity);t=void 0;this.on("touchstart",function(){n();this.clearInterval(t);t=this.setInterval(n,250)});i=function(){n();this.clearInterval(t)};this.on("touchmove",n);this.on("touchend",i);this.on("touchcancel",i)}},n.prototype.setTimeout=function(n,i){var r,u,f=this;return n=s(this,n),r=t.setTimeout(function(){f.off("dispose",u);n()},i),(u=function(){return f.clearTimeout(r)}).guid="vjs-timeout-"+r,this.on("dispose",u),r},n.prototype.clearTimeout=function(n){t.clearTimeout(n);var i=function(){};return i.guid="vjs-timeout-"+n,this.off("dispose",i),n},n.prototype.setInterval=function(n,i){var f=this,r,u;return n=s(this,n),r=t.setInterval(n,i),u=function(){return f.clearInterval(r)},u.guid="vjs-interval-"+r,this.on("dispose",u),r},n.prototype.clearInterval=function(n){t.clearInterval(n);var i=function(){};return i.guid="vjs-interval-"+n,this.off("dispose",i),n},n.prototype.requestAnimationFrame=function(n){var i,r,u=this;return this.supportsRaf_?(n=s(this,n),i=t.requestAnimationFrame(function(){u.off("dispose",r);n()}),(r=function(){return u.cancelAnimationFrame(i)}).guid="vjs-raf-"+i,this.on("dispose",r),i):this.setTimeout(n,1e3/60)},n.prototype.cancelAnimationFrame=function(n){if(this.supportsRaf_){t.cancelAnimationFrame(n);var i=function(){};return i.guid="vjs-raf-"+n,this.off("dispose",i),n}return this.clearTimeout(n)},n.registerComponent=function(t,i){var f,r,u,e;if("string"!=typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var o=n.getComponent("Tech"),s=o&&o.isTech(i),h=n===i||n.prototype.isPrototypeOf(i.prototype);if(s||!h){f=void 0;throw f=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+t+'"; '+f+".");}if(t=b(t),n.components_||(n.components_={}),r=n.getComponent("Player"),"Player"===t&&r&&r.players&&(u=r.players,e=Object.keys(u),u&&0<e.length&&e.map(function(n){return u[n]}).every(Boolean)))throw new Error("Can not register Player component after player has been created.");return n.components_[t]=i},n.getComponent=function(t){if(t)return t=b(t),n.components_&&n.components_[t]?n.components_[t]:void 0},n}();i.prototype.supportsRaf_="function"==typeof t.requestAnimationFrame&&"function"==typeof t.cancelAnimationFrame;i.registerComponent("Component",i);for(var il,rl,ul,fl,rt=t.navigator&&t.navigator.userAgent||"",ik=/AppleWebKit\/([\d.]+)/i.exec(rt),eot=ik?parseFloat(ik.pop()):null,el=/iPad/i.test(rt),ol=/iPhone/i.test(rt)&&!el,rk=/iPod/i.test(rt),pi=ol||el||rk,oot=(il=rt.match(/OS (\d+)_/i))&&il[1]?il[1]:null,yr=/Android/i.test(rt),sl=function(){var n=rt.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i),t,i;return n?(t=n[1]&&parseFloat(n[1]),i=n[2]&&parseFloat(n[2]),t&&i?parseFloat(n[1]+"."+n[2]):t||null):null}(),uk=yr&&sl<5&&eot<537,fk=/Firefox/i.test(rt),hl=/Edge/i.test(rt),rr=!hl&&(/Chrome/i.test(rt)||/CriOS/i.test(rt)),ek=(rl=rt.match(/(Chrome|CriOS)\/(\d+)/))&&rl[2]?parseFloat(rl[2]):null,ok=(ul=/MSIE\s(\d+)\.\d/.exec(rt),!(fl=ul&&parseFloat(ul[1]))&&/Trident\/7.0/i.test(rt)&&/rv:11.0/.test(rt)&&(fl=11),fl),sk=/Safari/i.test(rt)&&!rr&&!yr&&!hl,hk=(sk||pi)&&!rr,po=fu()&&(("ontouchstart"in t)||t.navigator.maxTouchPoints||t.DocumentTouch&&t.document instanceof t.DocumentTouch),sot=Object.freeze({IS_IPAD:el,IS_IPHONE:ol,IS_IPOD:rk,IS_IOS:pi,IOS_VERSION:oot,IS_ANDROID:yr,ANDROID_VERSION:sl,IS_NATIVE_ANDROID:uk,IS_FIREFOX:fk,IS_EDGE:hl,IS_CHROME:rr,CHROME_VERSION:ek,IE_VERSION:ok,IS_SAFARI:sk,IS_ANY_SAFARI:hk,TOUCH_ENABLED:po}),wo={},bo=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],hot=bo[0],ko=void 0,go=0;go<bo.length;go++)if(bo[go][1]in u){ko=bo[go];break}if(ko)for(df=0;df<ko.length;df++)wo[hot[df]]=ko[df];for(ut.prototype.code=0,ut.prototype.message="",ut.prototype.status=null,ut.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],ut.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."},wr=0;wr<ut.errorTypes.length;wr++)ut[ut.errorTypes[wr]]=wr,ut.prototype[ut.errorTypes[wr]]=wr;ak=function(n,t){var i,r=null;try{i=JSON.parse(n,t)}catch(n){r=n}return[r,i]};var yk=function(n){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(t,i){return n[i]&&(t[i]=n[i]),t},{cues:n.cues&&Array.prototype.map.call(n.cues,function(n){return{startTime:n.startTime,endTime:n.endTime,text:n.text,id:n.id}})})},cot=function(n){var t=n.$$("track"),i=Array.prototype.map.call(t,function(n){return n.track});return Array.prototype.map.call(t,function(n){var t=yk(n.track);return n.src&&(t.src=n.src),t}).concat(Array.prototype.filter.call(n.textTracks(),function(n){return-1===i.indexOf(n)}).map(yk))},lot=function(n,t){return n.forEach(function(n){var i=t.addRemoteTextTrack(n).track;!n.src&&n.cues&&n.cues.forEach(function(n){return i.addCue(n)})}),t.textTracks()},ll="vjs-modal-dialog",au=function(n){function i(t,r){f(this,i);var u=e(this,n.call(this,t,r));return u.opened_=u.hasBeenOpened_=u.hasBeenFilled_=!1,u.closeable(!u.options_.uncloseable),u.content(u.options_.content),u.contentEl_=g("div",{className:ll+"-content"},{role:"document"}),u.descEl_=g("p",{className:ll+"-description vjs-control-text",id:u.el().getAttribute("aria-describedby")}),af(u.descEl_,u.description()),u.el_.appendChild(u.descEl_),u.el_.appendChild(u.contentEl_),u}return o(i,n),i.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},i.prototype.dispose=function(){this.contentEl_=null;this.descEl_=null;this.previouslyActiveEl_=null;n.prototype.dispose.call(this)},i.prototype.buildCSSClass=function(){return ll+" vjs-hidden "+n.prototype.buildCSSClass.call(this)},i.prototype.handleKeyPress=function(n){27===n.which&&this.closeable()&&this.close()},i.prototype.label=function(){return this.localize(this.options_.label||"Modal Window")},i.prototype.description=function(){var n=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(n+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),n},i.prototype.open=function(){if(!this.opened_){var n=this.player();this.trigger("beforemodalopen");this.opened_=!0;(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill();this.wasPlaying_=!n.paused();this.options_.pauseOnOpen&&this.wasPlaying_&&n.pause();this.closeable()&&this.on(this.el_.ownerDocument,"keydown",s(this,this.handleKeyPress));this.hadControls_=n.controls();n.controls(!1);this.show();this.conditionalFocus_();this.el().setAttribute("aria-hidden","false");this.trigger("modalopen");this.hasBeenOpened_=!0}},i.prototype.opened=function(n){return"boolean"==typeof n&&this[n?"open":"close"](),this.opened_},i.prototype.close=function(){if(this.opened_){var n=this.player();this.trigger("beforemodalclose");this.opened_=!1;this.wasPlaying_&&this.options_.pauseOnOpen&&n.play();this.closeable()&&this.off(this.el_.ownerDocument,"keydown",s(this,this.handleKeyPress));this.hadControls_&&n.controls(!0);this.hide();this.el().setAttribute("aria-hidden","true");this.trigger("modalclose");this.conditionalBlur_();this.options_.temporary&&this.dispose()}},i.prototype.closeable=function(n){var i,t,r;return"boolean"==typeof n&&(i=this.closeable_=!!n,t=this.getChild("closeButton"),i&&!t&&(r=this.contentEl_,this.contentEl_=this.el_,t=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(t,"close",this.close)),!i&&t&&(this.off(t,"close",this.close),this.removeChild(t),t.dispose())),this.closeable_},i.prototype.fill=function(){this.fillWith(this.content())},i.prototype.fillWith=function(n){var t=this.contentEl(),i=t.parentNode,u=t.nextSibling,r;this.trigger("beforemodalfill");this.hasBeenFilled_=!0;i.removeChild(t);this.empty();sb(t,n);this.trigger("modalfill");u?i.insertBefore(t,u):i.appendChild(t);r=this.getChild("closeButton");r&&i.appendChild(r.el_)},i.prototype.empty=function(){this.trigger("beforemodalempty");yc(this.contentEl());this.trigger("modalempty")},i.prototype.content=function(n){return"undefined"!=typeof n&&(this.content_=n),this.content_},i.prototype.conditionalFocus_=function(){var n=u.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null;(t.contains(n)||t===n)&&(this.previouslyActiveEl_=n,this.focus(),this.on(u,"keydown",this.handleKeyDown))},i.prototype.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null);this.off(u,"keydown",this.handleKeyDown)},i.prototype.handleKeyDown=function(n){if(9===n.which){for(var t=this.focusableEls_(),f=this.el_.querySelector(":focus"),i=void 0,r=0;r<t.length;r++)if(f===t[r]){i=r;break}u.activeElement===this.el_&&(i=0);n.shiftKey&&0===i?(t[t.length-1].focus(),n.preventDefault()):n.shiftKey||i!==t.length-1||(t[0].focus(),n.preventDefault())}},i.prototype.focusableEls_=function(){var n=this.el_.querySelectorAll("*");return Array.prototype.filter.call(n,function(n){return(n instanceof t.HTMLAnchorElement||n instanceof t.HTMLAreaElement)&&n.hasAttribute("href")||(n instanceof t.HTMLInputElement||n instanceof t.HTMLSelectElement||n instanceof t.HTMLTextAreaElement||n instanceof t.HTMLButtonElement)&&!n.hasAttribute("disabled")||n instanceof t.HTMLIFrameElement||n instanceof t.HTMLObjectElement||n instanceof t.HTMLEmbedElement||n.hasAttribute("tabindex")&&-1!==n.getAttribute("tabindex")||n.hasAttribute("contenteditable")})},i}(i);au.prototype.options_={pauseOnOpen:!0,temporary:!0};i.registerComponent("ModalDialog",au);br=function(n){function t(){var u=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],i,r;for(f(this,t),i=e(this,n.call(this)),i.tracks_=[],Object.defineProperty(i,"length",{get:function(){return this.tracks_.length}}),r=0;r<u.length;r++)i.addTrack(u[r]);return i}return o(t,n),t.prototype.addTrack=function(n){var t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.tracks_[t]}});-1===this.tracks_.indexOf(n)&&(this.tracks_.push(n),this.trigger({track:n,type:"addtrack"}))},t.prototype.removeTrack=function(n){for(var i=void 0,t=0,r=this.length;t<r;t++)if(this[t]===n){(i=this[t]).off&&i.off();this.tracks_.splice(t,1);break}i&&this.trigger({track:i,type:"removetrack"})},t.prototype.getTrackById=function(n){for(var i,r=null,t=0,u=this.length;t<u;t++)if(i=this[t],i.id===n){r=i;break}return r},t}(ct);for(pk in br.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"},br.prototype.allowedEvents_)br.prototype["on"+pk]=null;var al=function(n,t){for(var i=0;i<n.length;i++)Object.keys(n[i]).length&&t.id!==n[i].id&&(n[i].enabled=!1)},aot=function(n){function t(){var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],r,u;for(f(this,t),r=i.length-1;0<=r;r--)if(i[r].enabled){al(i,i[r]);break}return u=e(this,n.call(this,i)),u.changing_=!1,u}return o(t,n),t.prototype.addTrack=function(t){var i=this;t.enabled&&al(this,t);n.prototype.addTrack.call(this,t);t.addEventListener&&t.addEventListener("enabledchange",function(){i.changing_||(i.changing_=!0,al(i,t),i.changing_=!1,i.trigger("change"))})},t}(br),vl=function(n,t){for(var i=0;i<n.length;i++)Object.keys(n[i]).length&&t.id!==n[i].id&&(n[i].selected=!1)},vot=function(n){function t(){var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],r,u;for(f(this,t),r=i.length-1;0<=r;r--)if(i[r].selected){vl(i,i[r]);break}return u=e(this,n.call(this,i)),u.changing_=!1,Object.defineProperty(u,"selectedIndex",{get:function(){for(var n=0;n<this.length;n++)if(this[n].selected)return n;return-1},set:function(){}}),u}return o(t,n),t.prototype.addTrack=function(t){var i=this;t.selected&&vl(this,t);n.prototype.addTrack.call(this,t);t.addEventListener&&t.addEventListener("selectedchange",function(){i.changing_||(i.changing_=!0,vl(i,t),i.changing_=!1,i.trigger("change"))})},t}(br),wk=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.addTrack=function(t){n.prototype.addTrack.call(this,t);t.addEventListener("modechange",s(this,function(){this.queueTrigger("change")}));-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",s(this,function(){this.trigger("selectedlanguagechange")}))},t}(br),yot=function(){function n(){var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t,r;for(f(this,n),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}}),t=0,r=i.length;t<r;t++)this.addTrackElement_(i[t])}return n.prototype.addTrackElement_=function(n){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}});-1===this.trackElements_.indexOf(n)&&this.trackElements_.push(n)},n.prototype.getTrackElementByTrack_=function(n){for(var i=void 0,t=0,r=this.trackElements_.length;t<r;t++)if(n===this.trackElements_[t].track){i=this.trackElements_[t];break}return i},n.prototype.removeTrackElement_=function(n){for(var t=0,i=this.trackElements_.length;t<i;t++)if(n===this.trackElements_[t]){this.trackElements_.splice(t,1);break}},n}(),bk=function(){function n(t){f(this,n);n.prototype.setCues_.call(this,t);Object.defineProperty(this,"length",{get:function(){return this.length_}})}return n.prototype.setCues_=function(n){var i=this.length||0,t=0,r=n.length,u;if(this.cues_=n,this.length_=n.length,u=function(n){""+n in this||Object.defineProperty(this,""+n,{get:function(){return this.cues_[n]}})},i<r)for(t=i;t<r;t++)u.call(this,t)},n.prototype.getCueById=function(n){for(var i,r=null,t=0,u=this.length;t<u;t++)if(i=this[t],i.id===n){r=i;break}return r},n}(),pot={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},wot={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},bot={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},kk={disabled:"disabled",hidden:"hidden",showing:"showing"},yl=function(n){function t(){var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o;f(this,t);var r=e(this,n.call(this)),u={id:i.id||"vjs_track_"+vr(),kind:i.kind||"",label:i.label||"",language:i.language||""},s=function(n){Object.defineProperty(r,n,{get:function(){return u[n]},set:function(){}})};for(o in u)s(o);return r}return o(t,n),t}(ct),pl=function(n){var o=["protocol","hostname","port","pathname","search","hash","host"],f=u.createElement("a"),s,r,i,e;for(f.href=n,s=""===f.host&&"file:"!==f.protocol,r=void 0,s&&((r=u.createElement("div")).innerHTML='<a href="'+n+'"><\/a>',f=r.firstChild,r.setAttribute("style","display:none; position:absolute;"),u.body.appendChild(r)),i={},e=0;e<o.length;e++)i[o[e]]=f[o[e]];return"http:"===i.protocol&&(i.host=i.host.replace(/:80$/,"")),"https:"===i.protocol&&(i.host=i.host.replace(/:443$/,"")),i.protocol||(i.protocol=t.location.protocol),s&&u.body.removeChild(r),i},dk=function(n){if(!n.match(/^https?:\/\//)){var t=u.createElement("div");t.innerHTML='<a href="'+n+'">x<\/a>';n=t.firstChild.href}return n},wl=function(n){if("string"==typeof n){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i.exec(n);if(t)return t.pop().toLowerCase()}return""},ns=function(n){var i=t.location,r=pl(n);return(":"===r.protocol?i.protocol:r.protocol)+r.host!==i.protocol+i.host},kot=Object.freeze({parseUrl:pl,getAbsoluteURL:dk,getFileExtension:wl,isCrossOrigin:ns}),bl=function(n){var t=dot.call(n);return"[object Function]"===t||"function"==typeof n&&"[object RegExp]"!==t||"undefined"!=typeof window&&(n===window.setTimeout||n===window.alert||n===window.confirm||n===window.prompt)},dot=Object.prototype.toString,gk=Object.freeze({"default":bl,__moduleExports:bl}),ne=sc(function(n,t){(t=n.exports=function(n){return n.replace(/^\s*|\s*$/g,"")}).left=function(n){return n.replace(/^\s*/,"")};t.right=function(n){return n.replace(/\s*$/,"")}}),got=ne.left,nst=ne.right,nd=Object.freeze({"default":ne,__moduleExports:ne,left:got,right:nst}),td=gk&&bl||gk,kl=function(n,t,i){if(!td(t))throw new TypeError("iterator must be a function");arguments.length<3&&(i=this);"[object Array]"===tst.call(n)?function(n,t,i){for(var r=0,u=n.length;r<u;r++)id.call(n,r)&&t.call(i,n[r],r,n)}(n,t,i):"string"==typeof n?function(n,t,i){for(var r=0,u=n.length;r<u;r++)t.call(i,n.charAt(r),r,n)}(n,t,i):function(n,t,i){for(var r in n)id.call(n,r)&&t.call(i,n[r],r,n)}(n,t,i)},tst=Object.prototype.toString,id=Object.prototype.hasOwnProperty,rd=Object.freeze({"default":kl,__moduleExports:kl}),dl=nd&&ne||nd,ist=rd&&kl||rd,gl=function(n){if(!n)return{};var t={};return ist(dl(n).split("\n"),function(n){var u,f=n.indexOf(":"),i=dl(n.slice(0,f)).toLowerCase(),r=dl(n.slice(f+1));"undefined"==typeof t[i]?t[i]=r:(u=t[i],"[object Array]"===Object.prototype.toString.call(u)?t[i].push(r):t[i]=[t[i],r])}),t},ud=Object.freeze({"default":gl,__moduleExports:gl}),na=function(){for(var t,i,r={},n=0;n<arguments.length;n++){t=arguments[n];for(i in t)rst.call(t,i)&&(r[i]=t[i])}return r},rst=Object.prototype.hasOwnProperty,fd=Object.freeze({"default":na,__moduleExports:na}),ust=ud&&gl||ud,fst=fd&&na||fd,ed=ur;ur.XMLHttpRequest=t.XMLHttpRequest||function(){};ur.XDomainRequest="withCredentials"in new ur.XMLHttpRequest?ur.XMLHttpRequest:t.XDomainRequest,function(n,t){for(var i=0;i<n.length;i++)t(n[i])}(["get","put","post","patch","head","delete"],function(n){ur["delete"===n?"del":n]=function(t,i,r){return(i=od(t,i,r)).method=n.toUpperCase(),sd(i)}});var hd=function(n,i){var r=new t.WebVTT.Parser(t,t.vttjs,t.WebVTT.StringDecoder()),u=[];r.oncue=function(n){i.addCue(n)};r.onparsingerror=function(n){u.push(n)};r.onflush=function(){i.trigger({type:"loadeddata",target:i})};r.parse(n);0<u.length&&(t.console&&t.console.groupCollapsed&&t.console.groupCollapsed("Text Track parsing errors for "+i.src),u.forEach(function(n){return l.error(n)}),t.console&&t.console.groupEnd&&t.console.groupEnd());r.flush()},est=function(n,i){var r={uri:n},u=ns(n);u&&(r.cors=u);ed(r,s(this,function(n,r,u){if(n)return l.error(n,r);if(i.loaded_=!0,"function"!=typeof t.WebVTT){if(i.tech_){var f=function(){return hd(u,i)};i.tech_.on("vttjsloaded",f);i.tech_.on("vttjserror",function(){l.error("vttjs failed to load, stopping trying to process "+i.src);i.tech_.off("vttjsloaded",f)})}}else hd(u,i)}))},te=function(n){function i(){var u=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t;if(f(this,i),!u.tech)throw new Error("A tech was not provided.");var r=p(u,{kind:bot[u.kind]||"subtitles",language:u.language||u.srclang||""}),h=kk[r.mode]||"disabled",a=r.default;"metadata"!==r.kind&&"chapters"!==r.kind||(h="hidden");t=e(this,n.call(this,r));t.tech_=r.tech;t.cues_=[];t.activeCues_=[];var v=new bk(t.cues_),c=new bk(t.activeCues_),o=!1,l=s(t,function(){this.activeCues=this.activeCues;o&&(this.trigger("cuechange"),o=!1)});return"disabled"!==h&&t.tech_.ready(function(){t.tech_.on("timeupdate",l)},!0),Object.defineProperties(t,{"default":{get:function(){return a},set:function(){}},mode:{get:function(){return h},set:function(n){var t=this;kk[n]&&("disabled"!==(h=n)?this.tech_.ready(function(){t.tech_.on("timeupdate",l)},!0):this.tech_.off("timeupdate",l),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?v:null},set:function(){}},activeCues:{get:function(){var n,r;if(!this.loaded_)return null;if(0===this.cues.length)return c;for(var i=this.tech_.currentTime(),t=[],u=0,f=this.cues.length;u<f;u++)n=this.cues[u],n.startTime<=i&&n.endTime>=i?t.push(n):n.startTime===n.endTime&&n.startTime<=i&&n.startTime+.5>=i&&t.push(n);if(o=!1,t.length!==this.activeCues_.length)o=!0;else for(r=0;r<t.length;r++)-1===this.activeCues_.indexOf(t[r])&&(o=!0);return this.activeCues_=t,c.setCues_(this.activeCues_),c},set:function(){}}}),r.src?(t.src=r.src,est(r.src,t)):t.loaded_=!0,t}return o(i,n),i.prototype.addCue=function(n){var i=n,u,f,r;if(t.vttjs&&!(n instanceof t.vttjs.VTTCue)){for(u in i=new t.vttjs.VTTCue(n.startTime,n.endTime,n.text),n)u in i||(i[u]=n[u]);i.id=n.id;i.originalCue_=n}for(f=this.tech_.textTracks(),r=0;r<f.length;r++)f[r]!==this&&f[r].removeCue(i);this.cues_.push(i);this.cues.setCues_(this.cues_)},i.prototype.removeCue=function(n){for(var i,t=this.cues_.length;t--;)if(i=this.cues_[t],i===n||i.originalCue_&&i.originalCue_===n){this.cues_.splice(t,1);this.cues.setCues_(this.cues_);break}},i}(yl);te.prototype.allowedEvents_={cuechange:"cuechange"};var cd=function(n){function t(){var o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};f(this,t);var r=p(o,{kind:wot[o.kind]||""}),i=e(this,n.call(this,r)),u=!1;return Object.defineProperty(i,"enabled",{get:function(){return u},set:function(n){"boolean"==typeof n&&n!==u&&(u=n,this.trigger("enabledchange"))}}),r.enabled&&(i.enabled=r.enabled),i.loaded_=!0,i}return o(t,n),t}(yl),ld=function(n){function t(){var o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};f(this,t);var i=p(o,{kind:pot[o.kind]||""}),r=e(this,n.call(this,i)),u=!1;return Object.defineProperty(r,"selected",{get:function(){return u},set:function(n){"boolean"==typeof n&&n!==u&&(u=n,this.trigger("selectedchange"))}}),i.selected&&(r.selected=i.selected),r}return o(t,n),t}(yl),ad=0,vd=2,vu=function(n){function t(){var o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};f(this,t);var i=e(this,n.call(this)),u=void 0,r=new te(o);return i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i.default=r.default,Object.defineProperties(i,{readyState:{get:function(){return u}},track:{get:function(){return r}}}),u=ad,r.addEventListener("loadeddata",function(){u=vd;i.trigger({type:"load",target:i})}),i}return o(t,n),t}(ct);vu.prototype.allowedEvents_={load:"load"};vu.NONE=ad;vu.LOADING=1;vu.LOADED=vd;vu.ERROR=3;yt={audio:{ListClass:aot,TrackClass:cd,capitalName:"Audio"},video:{ListClass:vot,TrackClass:ld,capitalName:"Video"},text:{ListClass:wk,TrackClass:te,capitalName:"Text"}};Object.keys(yt).forEach(function(n){yt[n].getterName=n+"Tracks";yt[n].privateName=n+"Tracks_"});yu={remoteText:{ListClass:wk,TrackClass:te,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:yot,TrackClass:vu,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}};lt=p(yt,yu);yu.names=Object.keys(yu);yt.names=Object.keys(yt);lt.names=[].concat(yu.names).concat(yt.names);ts=Object.create||function(){function n(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return n.prototype=t,new n}}();((ri.prototype=ts(Error.prototype)).constructor=ri).Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};ie.prototype={set:function(n,t){this.get(n)||""===t||(this.values[n]=t)},get:function(n,t,i){return i?this.has(n)?this.values[n]:t[i]:this.has(n)?this.values[n]:t},has:function(n){return n in this.values},alt:function(n,t,i){for(var r=0;r<i.length;++r)if(t===i[r]){this.set(n,t);break}},integer:function(n,t){/^-?\d+$/.test(t)&&this.set(n,parseInt(t,10))},percent:function(n,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&0<=(t=parseFloat(t))&&t<=100)&&(this.set(n,t),!0)}};var sst={"&amp;":"&","&lt;":"<","&gt;":">","&lrm;":"‎","&rlm;":"‏","&nbsp;":" "},hst={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},cst={v:"title",lang:"lang"},yd={rt:"ruby"};ia=[[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]];is.prototype.applyStyles=function(n,t){for(var i in t=t||this.div,n)n.hasOwnProperty(i)&&(t.style[i]=n[i])};is.prototype.formatStyle=function(n,t){return 0===n?0:n+t};(ra.prototype=ts(is.prototype)).constructor=ra;ft.prototype.move=function(n,t){switch(t=void 0!==t?t:this.lineHeight,n){case"+x":this.left+=t;this.right+=t;break;case"-x":this.left-=t;this.right-=t;break;case"+y":this.top+=t;this.bottom+=t;break;case"-y":this.top-=t;this.bottom-=t}};ft.prototype.overlaps=function(n){return this.left<n.right&&this.right>n.left&&this.top<n.bottom&&this.bottom>n.top};ft.prototype.overlapsAny=function(n){for(var t=0;t<n.length;t++)if(this.overlaps(n[t]))return!0;return!1};ft.prototype.within=function(n){return this.top>=n.top&&this.bottom<=n.bottom&&this.left>=n.left&&this.right<=n.right};ft.prototype.overlapsOppositeAxis=function(n,t){switch(t){case"+x":return this.left<n.left;case"-x":return this.right>n.right;case"+y":return this.top<n.top;case"-y":return this.bottom>n.bottom}};ft.prototype.intersectPercentage=function(n){return Math.max(0,Math.min(this.right,n.right)-Math.max(this.left,n.left))*Math.max(0,Math.min(this.bottom,n.bottom)-Math.max(this.top,n.top))/(this.height*this.width)};ft.prototype.toCSSCompatValues=function(n){return{top:this.top-n.top,bottom:n.bottom-this.bottom,left:this.left-n.left,right:n.right-this.right,height:this.height,width:this.width}};ft.getSimpleBoxPosition=function(n){var t=n.div?n.div.offsetHeight:n.tagName?n.offsetHeight:0,r=n.div?n.div.offsetWidth:n.tagName?n.offsetWidth:0,i=n.div?n.div.offsetTop:n.tagName?n.offsetTop:0;return{left:(n=n.div?n.div.getBoundingClientRect():n.tagName?n.getBoundingClientRect():n).left,right:n.right,top:n.top||i,height:n.height||t,bottom:n.bottom||i+(n.height||t),width:n.width||r}};ue.StringDecoder=function(){return{decode:function(n){if(!n)return"";if("string"!=typeof n)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(n))}}};ue.convertCueToDOMTree=function(n,t){return n&&t?pd(n,t):null};ue.processCues=function(n,t,i){var r,u;if(!n||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);if(r=n.document.createElement("div"),r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin="1.5%",i.appendChild(r),function(n){for(var t=0;t<n.length;t++)if(n[t].hasBeenReset||!n[t].displayState)return!0;return!1}(t)){var f=[],e=ft.getSimpleBoxPosition(r),o={font:Math.round(.05*e.height*100)/100+"px sans-serif"};!function(){for(var i,u,s=0;s<t.length;s++)u=t[s],i=new ra(n,u,o),r.appendChild(i.div),ast(0,i,e,f),u.displayState=i.div,f.push(ft.getSimpleBoxPosition(i))}()}else for(u=0;u<t.length;u++)r.appendChild(t[u].displayState)};(ue.Parser=function(n,t,i){i||(i=t,t={});t||(t={});this.window=n;this.vttjs=t;this.state="INITIAL";this.buffer="";this.decoder=i||new TextDecoder("utf8");this.regionList=[]}).prototype={reportOrThrowError:function(n){if(!(n instanceof ri))throw n;this.onparsingerror&&this.onparsingerror(n)},parse:function(n){function f(){for(var r,i=t.buffer,n=0;n<i.length&&"\r"!==i[n]&&"\n"!==i[n];)++n;return r=i.substr(0,n),"\r"===i[n]&&++n,"\n"===i[n]&&++n,t.buffer=i.substr(n),r}function o(n){n.match(/X-TIMESTAMP-MAP/)?re(n,function(n,i){switch(n){case"X-TIMESTAMP-MAP":u=i;r=new ie;re(u,function(n,t){switch(n){case"MPEGT":r.integer(n+"S",t);break;case"LOCA":r.set(n+"L",ta(t))}},/[^\d]:/,/,/);t.ontimestampmap&&t.ontimestampmap({MPEGTS:r.get("MPEGTS"),LOCAL:r.get("LOCAL")})}var u,r},/=/):re(n,function(n,i){switch(n){case"Region":!function(n){var i=new ie,r;(re(n,function(n,t){var u,r;switch(n){case"id":i.set(n,t);break;case"width":i.percent(n,t);break;case"lines":i.integer(n,t);break;case"regionanchor":case"viewportanchor":if(u=t.split(","),2!==u.length)break;if(r=new ie,r.percent("x",u[0]),r.percent("y",u[1]),!r.has("x")||!r.has("y"))break;i.set(n+"X",r.get("x"));i.set(n+"Y",r.get("y"));break;case"scroll":i.alt(n,t,["up"])}},/=/,/\s/),i.has("id"))&&(r=new(t.vttjs.VTTRegion||t.window.VTTRegion),r.width=i.get("width",100),r.lines=i.get("lines",3),r.regionAnchorX=i.get("regionanchorX",0),r.regionAnchorY=i.get("regionanchorY",100),r.viewportAnchorX=i.get("viewportanchorX",0),r.viewportAnchorY=i.get("viewportanchorY",100),r.scroll=i.get("scroll",""),t.onregion&&t.onregion(r),t.regionList.push({id:i.get("id"),region:r}))}(i)}},/:/)}var t=this,i,u,r,e;n&&(t.buffer+=t.decoder.decode(n,{stream:!0}));try{if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;if(u=(i=f()).match(/^WEBVTT([ \t].*)?$/),!u||!u[0])throw new ri(ri.Errors.BadSignature);t.state="HEADER"}for(r=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(r?r=!1:i=f(),t.state){case"HEADER":/:/.test(i)?o(i):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,""),t.state="CUE",-1===i.indexOf("-->")){t.cue.id=i;continue}case"CUE":try{ost(i,t.cue,t.regionList)}catch(n){t.reportOrThrowError(n);t.cue=null;t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":if(e=-1!==i.indexOf("-->"),!i||e&&(r=!0)){t.oncue&&t.oncue(t.cue);t.cue=null;t.state="ID";continue}t.cue.text&&(t.cue.text+="\n");t.cue.text+=i;continue;case"BADCUE":i||(t.state="ID");continue}}}catch(n){t.reportOrThrowError(n);"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue);t.cue=null;t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var n=this;try{if(n.buffer+=n.decoder.decode(),(n.cue||"HEADER"===n.state)&&(n.buffer+="\n\n",n.parse()),"INITIAL"===n.state)throw new ri(ri.Errors.BadSignature);}catch(t){n.reportOrThrowError(t)}return n.onflush&&n.onflush(),this}};var ua=ue,wd=Object.freeze({"default":ua,__moduleExports:ua}),vst="auto",yst={"":1,lr:1,rl:1},pst={start:1,middle:1,end:1,left:1,right:1};bd.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var ea=bd,kd=Object.freeze({"default":ea,__moduleExports:ea}),wst={"":!0,up:!0};var oa=function(){var n=100,t=3,i=0,r=100,u=0,f=100,e="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return n},set:function(t){if(!fe(t))throw new Error("Width must be between 0 and 100.");n=t}},lines:{enumerable:!0,get:function(){return t},set:function(n){if("number"!=typeof n)throw new TypeError("Lines must be set to a number.");t=n}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(n){if(!fe(n))throw new Error("RegionAnchorX must be between 0 and 100.");r=n}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(n){if(!fe(n))throw new Error("RegionAnchorY must be between 0 and 100.");i=n}},viewportAnchorY:{enumerable:!0,get:function(){return f},set:function(n){if(!fe(n))throw new Error("ViewportAnchorY must be between 0 and 100.");f=n}},viewportAnchorX:{enumerable:!0,get:function(){return u},set:function(n){if(!fe(n))throw new Error("ViewportAnchorX must be between 0 and 100.");u=n}},scroll:{enumerable:!0,get:function(){return e},set:function(n){var t,i="string"==typeof(t=n)&&!!wst[t.toLowerCase()]&&t.toLowerCase();if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");e=i}}})},dd=Object.freeze({"default":oa,__moduleExports:oa}),bst=wd&&ua||wd,kst=kd&&ea||kd,dst=dd&&oa||dd,ee=sc(function(n){var i=n.exports={WebVTT:bst,VTTCue:kst,VTTRegion:dst};t.vttjs=i;t.WebVTT=i.WebVTT;var r=i.VTTCue,u=i.VTTRegion,f=t.VTTCue,e=t.VTTRegion;i.shim=function(){t.VTTCue=r;t.VTTRegion=u};i.restore=function(){t.VTTCue=f;t.VTTRegion=e};t.VTTCue||i.shim()});ee.WebVTT;ee.VTTCue;ee.VTTRegion;y=function(n){function i(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},u=1<arguments.length&&void 0!==arguments[1]?arguments[1]:function(){},t;return f(this,i),r.reportTouchActivity=!1,t=e(this,n.call(this,null,r,u)),t.hasStarted_=!1,t.on("playing",function(){this.hasStarted_=!0}),t.on("loadstart",function(){this.hasStarted_=!1}),lt.names.forEach(function(n){var i=lt[n];r&&r[i.getterName]&&(t[i.privateName]=r[i.getterName])}),t.featuresProgressEvents||t.manualProgressOn(),t.featuresTimeupdateEvents||t.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(n){!1===r["native"+n+"Tracks"]&&(t["featuresNative"+n+"Tracks"]=!1)}),!1===r.nativeCaptions||!1===r.nativeTextTracks?t.featuresNativeTextTracks=!1:!0!==r.nativeCaptions&&!0!==r.nativeTextTracks||(t.featuresNativeTextTracks=!0),t.featuresNativeTextTracks||t.emulateTextTracks(),t.autoRemoteTextTracks_=new lt.text.ListClass,t.initTrackListeners(),r.nativeControlsForTouch||t.emitTapEvents(),t.constructor&&(t.name_=t.constructor.name||"Unknown Tech"),t}return o(i,n),i.prototype.triggerSourceset=function(n){var t=this;this.isReady_||this.one("ready",function(){return t.setTimeout(function(){return t.triggerSourceset(n)},1)});this.trigger({src:n,type:"sourceset"})},i.prototype.manualProgressOn=function(){this.on("durationchange",this.onDurationChange);this.manualProgress=!0;this.one("ready",this.trackProgress)},i.prototype.manualProgressOff=function(){this.manualProgress=!1;this.stopTrackingProgress();this.off("durationchange",this.onDurationChange)},i.prototype.trackProgress=function(){this.stopTrackingProgress();this.progressInterval=this.setInterval(s(this,function(){var n=this.bufferedPercent();this.bufferedPercent_!==n&&this.trigger("progress");1===(this.bufferedPercent_=n)&&this.stopTrackingProgress()}),500)},i.prototype.onDurationChange=function(){this.duration_=this.duration()},i.prototype.buffered=function(){return pr(0,0)},i.prototype.bufferedPercent=function(){return lk(this.buffered(),this.duration_)},i.prototype.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},i.prototype.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0;this.on("play",this.trackCurrentTime);this.on("pause",this.stopTrackingCurrentTime)},i.prototype.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1;this.stopTrackingCurrentTime();this.off("play",this.trackCurrentTime);this.off("pause",this.stopTrackingCurrentTime)},i.prototype.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime();this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},i.prototype.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval);this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.prototype.dispose=function(){this.clearTracks(yt.names);this.manualProgress&&this.manualProgressOff();this.manualTimeUpdates&&this.manualTimeUpdatesOff();n.prototype.dispose.call(this)},i.prototype.clearTracks=function(n){var t=this;(n=[].concat(n)).forEach(function(n){for(var u,i=t[n+"Tracks"]()||[],r=i.length;r--;)u=i[r],"text"===n&&t.removeRemoteTextTrack(u),i.removeTrack(u)})},i.prototype.cleanupAutoTextTracks=function(){for(var i,n=this.autoRemoteTextTracks_||[],t=n.length;t--;)i=n[t],this.removeRemoteTextTrack(i)},i.prototype.reset=function(){},i.prototype.error=function(n){return void 0!==n&&(this.error_=new ut(n),this.trigger("error")),this.error_},i.prototype.played=function(){return this.hasStarted_?pr(0,0):pr()},i.prototype.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.prototype.initTrackListeners=function(){var n=this;yt.names.forEach(function(t){var u=yt[t],i=function(){n.trigger(t+"trackchange")},r=n[u.getterName]();r.addEventListener("removetrack",i);r.addEventListener("addtrack",i);n.on("dispose",function(){r.removeEventListener("removetrack",i);r.removeEventListener("addtrack",i)})})},i.prototype.addWebVttScript_=function(){var i=this,n;if(!t.WebVTT)if(u.body.contains(this.el())){if(!this.options_["vtt.js"]&&cf(ee)&&0<Object.keys(ee).length)return void this.trigger("vttjsloaded");n=u.createElement("script");n.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js";n.onload=function(){i.trigger("vttjsloaded")};n.onerror=function(){i.trigger("vttjserror")};this.on("dispose",function(){n.onload=null;n.onerror=null});t.WebVTT=!0;this.el().parentNode.appendChild(n)}else this.ready(this.addWebVttScript_)},i.prototype.emulateTextTracks=function(){var e=this,n=this.textTracks(),r=this.remoteTextTracks(),u=function(t){return n.addTrack(t.track)},f=function(t){return n.removeTrack(t.track)},i,t;r.on("addtrack",u);r.on("removetrack",f);this.addWebVttScript_();i=function(){return e.trigger("texttrackchange")};t=function(){var t,r;for(i(),t=0;t<n.length;t++)r=n[t],r.removeEventListener("cuechange",i),"showing"===r.mode&&r.addEventListener("cuechange",i)};t();n.addEventListener("change",t);n.addEventListener("addtrack",t);n.addEventListener("removetrack",t);this.on("dispose",function(){r.off("addtrack",u);r.off("removetrack",f);n.removeEventListener("change",t);n.removeEventListener("addtrack",t);n.removeEventListener("removetrack",t);for(var e=0;e<n.length;e++)n[e].removeEventListener("cuechange",i)})},i.prototype.addTextTrack=function(n,t,i){if(!n)throw new Error("TextTrack kind is required but was not provided");return function(n,t,i,r){var u=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},e=n.textTracks(),f;return u.kind=t,i&&(u.label=i),r&&(u.language=r),u.tech=n,f=new lt.text.TrackClass(u),e.addTrack(f),f}(this,n,t,i)},i.prototype.createRemoteTextTrack=function(n){var t=p(n,{tech:this});return new yu.remoteTextEl.TrackClass(t)},i.prototype.addRemoteTextTrack=function(){var i=this,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1],t=this.createRemoteTextTrack(r);return!0!==n&&!1!==n&&(l.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),n=!0),this.remoteTextTrackEls().addTrackElement_(t),this.remoteTextTracks().addTrack(t.track),!0!==n&&this.ready(function(){return i.autoRemoteTextTracks_.addTrack(t.track)}),t},i.prototype.removeRemoteTextTrack=function(n){var t=this.remoteTextTrackEls().getTrackElementByTrack_(n);this.remoteTextTrackEls().removeTrackElement_(t);this.remoteTextTracks().removeTrack(n);this.autoRemoteTextTracks_.removeTrack(n)},i.prototype.getVideoPlaybackQuality=function(){return{}},i.prototype.setPoster=function(){},i.prototype.playsinline=function(){},i.prototype.setPlaysinline=function(){},i.prototype.overrideNativeAudioTracks=function(){},i.prototype.overrideNativeVideoTracks=function(){},i.prototype.canPlayType=function(){return""},i.canPlayType=function(){return""},i.canPlaySource=function(n){return i.canPlayType(n.type)},i.isTech=function(n){return n.prototype instanceof i||n instanceof i||n===i},i.registerTech=function(n,t){if(i.techs_||(i.techs_={}),!i.isTech(t))throw new Error("Tech "+n+" must be a Tech");if(!i.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!i.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return n=b(n),i.techs_[n]=t,"Tech"!==n&&i.defaultTechOrder_.push(n),t},i.getTech=function(n){if(n)return n=b(n),i.techs_&&i.techs_[n]?i.techs_[n]:t&&t.videojs&&t.videojs[n]?(l.warn("The "+n+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),t.videojs[n]):void 0},i}(i);lt.names.forEach(function(n){var t=lt[n];y.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}});y.prototype.featuresVolumeControl=!0;y.prototype.featuresMuteControl=!0;y.prototype.featuresFullscreenResize=!1;y.prototype.featuresPlaybackRate=!1;y.prototype.featuresProgressEvents=!1;y.prototype.featuresSourceset=!1;y.prototype.featuresTimeupdateEvents=!1;y.prototype.featuresNativeTextTracks=!1;y.withSourceHandlers=function(n){n.registerSourceHandler=function(t,i){var r=n.sourceHandlers;r||(r=n.sourceHandlers=[]);void 0===i&&(i=r.length);r.splice(i,0,t)};n.canPlayType=function(t){for(var r=n.sourceHandlers||[],u=void 0,i=0;i<r.length;i++)if(u=r[i].canPlayType(t))return u;return""};n.selectSourceHandler=function(t,i){for(var u=n.sourceHandlers||[],r=0;r<u.length;r++)if(u[r].canHandleSource(t,i))return u[r];return null};n.canPlaySource=function(t,i){var r=n.selectSourceHandler(t,i);return r?r.canHandleSource(t,i):""};["seekable","seeking","duration"].forEach(function(n){var t=this[n];"function"==typeof t&&(this[n]=function(){return this.sourceHandler_&&this.sourceHandler_[n]?this.sourceHandler_[n].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},n.prototype);n.prototype.setSource=function(t){var i=n.selectSourceHandler(t,this.options_);i||(n.nativeSourceHandler?i=n.nativeSourceHandler:l.error("No source handler found for the current source."));this.disposeSourceHandler();this.off("dispose",this.disposeSourceHandler);i!==n.nativeSourceHandler&&(this.currentSource_=t);this.sourceHandler_=i.handleSource(t,this,this.options_);this.on("dispose",this.disposeSourceHandler)};n.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null);this.cleanupAutoTextTracks();this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};i.registerComponent("Tech",y);y.registerTech("Tech",y);y.defaultTechOrder_=[];var kr={},sa={},rs={};var nht={buffered:1,currentTime:1,duration:1,seekable:1,played:1,paused:1},tht={setCurrentTime:1},ng={play:1,pause:1};tg={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",mp3:"audio/mpeg",aac:"audio/aac",oga:"audio/ogg",m3u8:"application/x-mpegURL"};ca=function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=wl(n);return tg[t.toLowerCase()]||""};rg=function(n){function t(r,u,o){var a,v,h,l,s,c;if(f(this,t),a=p({createEl:!1},u),v=e(this,n.call(this,r,a,o)),u.playerOptions.sources&&0!==u.playerOptions.sources.length)r.src(u.playerOptions.sources);else for(h=0,l=u.playerOptions.techOrder;h<l.length;h++)if(s=b(l[h]),c=y.getTech(s),s||(c=i.getComponent(s)),c&&c.isSupported()){r.loadTech_(s);break}return v}return o(t,n),t}(i);i.registerComponent("MediaLoader",rg);oe=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.emitTapEvents(),u.enable(),u}return o(t,n),t.prototype.createEl=function(){var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"div",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},u;return t=k({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"><\/span>',className:this.buildCSSClass(),tabIndex:0},t),"button"===i&&l.error("Creating a ClickableComponent with an HTML element of "+i+" is not supported; use a Button instead."),r=k({role:"button"},r),this.tabIndex_=t.tabIndex,u=n.prototype.createEl.call(this,i,t,r),this.createControlTextEl(u),u},t.prototype.dispose=function(){this.controlTextEl_=null;n.prototype.dispose.call(this)},t.prototype.createControlTextEl=function(n){return this.controlTextEl_=g("span",{className:"vjs-control-text"},{"aria-live":"polite"}),n&&n.appendChild(this.controlTextEl_),this.controlText(this.controlText_,n),this.controlTextEl_},t.prototype.controlText=function(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.el(),t;if(void 0===n)return this.controlText_||"Need Text";t=this.localize(n);this.controlText_=n;af(this.controlTextEl_,t);this.nonIconControl||i.setAttribute("title",t)},t.prototype.buildCSSClass=function(){return"vjs-control vjs-button "+n.prototype.buildCSSClass.call(this)},t.prototype.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur))},t.prototype.disable=function(){this.enabled_=!1;this.addClass("vjs-disabled");this.el_.setAttribute("aria-disabled","true");"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex");this.off(["tap","click"],this.handleClick);this.off("focus",this.handleFocus);this.off("blur",this.handleBlur)},t.prototype.handleClick=function(){},t.prototype.handleFocus=function(){ii(u,"keydown",s(this,this.handleKeyPress))},t.prototype.handleKeyPress=function(t){32===t.which||13===t.which?(t.preventDefault(),this.trigger("click")):n.prototype.handleKeyPress&&n.prototype.handleKeyPress.call(this,t)},t.prototype.handleBlur=function(){vt(u,"keydown",s(this,this.handleKeyPress))},t}(i);i.registerComponent("ClickableComponent",oe);ug=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.update(),i.on("posterchange",s(u,u.update)),u}return o(t,n),t.prototype.dispose=function(){this.player().off("posterchange",this.update);n.prototype.dispose.call(this)},t.prototype.createEl=function(){return g("div",{className:"vjs-poster",tabIndex:-1})},t.prototype.update=function(){var n=this.player().poster();this.setSrc(n);n?this.show():this.hide()},t.prototype.setSrc=function(n){var t="";n&&(t='url("'+n+'")');this.el_.style.backgroundImage=t},t.prototype.handleClick=function(){this.player_.controls()&&(this.player_.paused()?gf(this.player_.play()):this.player_.pause())},t}(oe);i.registerComponent("PosterImage",ug);se="#222";fg={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'};eg=function(n){function i(r,u,o){f(this,i);var h=e(this,n.call(this,r,u,o)),c=s(h,h.updateDisplay);return r.on("loadstart",s(h,h.toggleDisplay)),r.on("texttrackchange",c),r.on("loadstart",s(h,h.preselectTrack)),r.ready(s(h,function(){if(r.tech_&&r.tech_.featuresNativeTextTracks)this.hide();else{r.on("fullscreenchange",c);r.on("playerresize",c);t.addEventListener("orientationchange",c);r.on("dispose",function(){return t.removeEventListener("orientationchange",c)});for(var i=this.options_.playerOptions.tracks||[],n=0;n<i.length;n++)this.player_.addRemoteTextTrack(i[n],!0);this.preselectTrack()}})),h}return o(i,n),i.prototype.preselectTrack=function(){for(var n,o={captions:1,subtitles:1},e=this.player_.textTracks(),t=this.player_.cache_.selectedLanguage,r=void 0,u=void 0,i=void 0,f=0;f<e.length;f++)n=e[f],t&&t.enabled&&t.language===n.language?n.kind===t.kind?i=n:i||(i=n):t&&!t.enabled?u=r=i=null:n.default&&("descriptions"!==n.kind||r?n.kind in o&&!u&&(u=n):r=n);i?i.mode="showing":u?u.mode="showing":r&&(r.mode="showing")},i.prototype.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},i.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},i.prototype.clearDisplay=function(){"function"==typeof t.WebVTT&&t.WebVTT.processCues(t,[],this.el_)},i.prototype.updateDisplay=function(){var r=this.player_.textTracks(),n;this.clearDisplay();for(var t=null,i=null,u=r.length;u--;)n=r[u],"showing"===n.mode&&("descriptions"===n.kind?t=n:i=n);i?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(i)):t&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(t))},i.prototype.updateForTrack=function(n){var u,f,i,e,o,r,s;if("function"==typeof t.WebVTT&&n.activeCues){for(u=[],f=0;f<n.activeCues.length;f++)u.push(n.activeCues[f]);if(t.WebVTT.processCues(t,u,this.el_),this.player_.textTrackSettings)for(i=this.player_.textTrackSettings.getValues(),e=u.length;e--;)o=u[e],o&&(r=o.displayState,(i.color&&(r.firstChild.style.color=i.color),i.textOpacity&&aa(r.firstChild,"color",la(i.color||"#fff",i.textOpacity)),i.backgroundColor&&(r.firstChild.style.backgroundColor=i.backgroundColor),i.backgroundOpacity&&aa(r.firstChild,"backgroundColor",la(i.backgroundColor||"#000",i.backgroundOpacity)),i.windowColor&&(i.windowOpacity?aa(r,"backgroundColor",la(i.windowColor,i.windowOpacity)):r.style.backgroundColor=i.windowColor),i.edgeStyle&&("dropshadow"===i.edgeStyle?r.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px "+se:"raised"===i.edgeStyle?r.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px "+se:"depressed"===i.edgeStyle?r.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px "+se:"uniform"===i.edgeStyle&&(r.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px "+se)),i.fontPercent&&1!==i.fontPercent)&&(s=t.parseFloat(r.style.fontSize),r.style.fontSize=s*i.fontPercent+"px",r.style.height="auto",r.style.top="auto",r.style.bottom="2px"),i.fontFamily&&"default"!==i.fontFamily&&("small-caps"===i.fontFamily?r.firstChild.style.fontVariant="small-caps":r.firstChild.style.fontFamily=fg[i.fontFamily]))}},i}(i);i.registerComponent("TextTrackDisplay",eg);og=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.createEl=function(){var i=this.player_.isAudio(),r=this.localize(i?"Audio Player":"Video Player"),u=g("span",{className:"vjs-control-text",innerHTML:this.localize("{1} is loading.",[r])}),t=n.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return t.appendChild(u),t},t}(i);i.registerComponent("LoadingSpinner",og);hi=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.createEl=function(){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r;return n=k({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"><\/span>',className:this.buildCSSClass()},n),t=k({type:"button"},t),r=i.prototype.createEl.call(this,"button",n,t),this.createControlTextEl(r),r},t.prototype.addChild=function(n){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=this.constructor.name;return l.warn("Adding an actionable (user controllable) child to a Button ("+r+") is not supported; use a ClickableComponent instead."),i.prototype.addChild.call(this,n,t)},t.prototype.enable=function(){n.prototype.enable.call(this);this.el_.removeAttribute("disabled")},t.prototype.disable=function(){n.prototype.disable.call(this);this.el_.setAttribute("disabled","disabled")},t.prototype.handleKeyPress=function(t){32!==t.which&&13!==t.which&&n.prototype.handleKeyPress.call(this,t)},t}(oe);i.registerComponent("Button",hi);va=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.mouseused_=!1,u.on("mousedown",u.handleMouseDown),u}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-big-play-button"},t.prototype.handleClick=function(n){var t=this.player_.play(),i,r,u;this.mouseused_&&n.clientX&&n.clientY?gf(t):(i=this.player_.getChild("controlBar"),r=i&&i.getChild("playToggle"),r?(u=function(){return r.focus()},vk(t)?t.then(u,function(){}):this.setTimeout(u,1)):this.player_.focus())},t.prototype.handleKeyPress=function(t){this.mouseused_=!1;n.prototype.handleKeyPress.call(this,t)},t.prototype.handleMouseDown=function(){this.mouseused_=!0},t}(hi);va.prototype.controlText_="Play Video";i.registerComponent("BigPlayButton",va);sg=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.controlText(r&&r.controlText||u.localize("Close")),u}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-close-button "+n.prototype.buildCSSClass.call(this)},t.prototype.handleClick=function(){this.trigger({type:"close",bubbles:!1})},t}(hi);i.registerComponent("CloseButton",sg);ya=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.on(i,"play",u.handlePlay),u.on(i,"pause",u.handlePause),u.on(i,"ended",u.handleEnded),u}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-play-control "+n.prototype.buildCSSClass.call(this)},t.prototype.handleClick=function(){this.player_.paused()?this.player_.play():this.player_.pause()},t.prototype.handleSeeked=function(n){this.removeClass("vjs-ended");this.player_.paused()?this.handlePause(n):this.handlePlay(n)},t.prototype.handlePlay=function(){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.controlText("Pause")},t.prototype.handlePause=function(){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.controlText("Play")},t.prototype.handleEnded=function(){this.removeClass("vjs-playing");this.addClass("vjs-ended");this.controlText("Replay");this.one(this.player_,"seeked",this.handleSeeked)},t}(hi);ya.prototype.controlText_="Play";i.registerComponent("PlayToggle",ya);pa=function(n,t){n=n<0?0:n;var i=Math.floor(n%60),r=Math.floor(n/60%60),u=Math.floor(n/3600),f=Math.floor(t/60%60),e=Math.floor(t/3600);return(isNaN(n)||n===1/0)&&(u=r=i="-"),(u=0<u||0<e?u+":":"")+(r=((u||10<=f)&&r<10?"0"+r:r)+":")+(i=i<10?"0"+i:i)};us=pa;dr=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.throttledUpdateContent=cu(s(u,u.updateContent),25),u.on(i,"timeupdate",u.throttledUpdateContent),u}return o(t,n),t.prototype.createEl=function(){var t=this.buildCSSClass(),i=n.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control",innerHTML:'<span class="vjs-control-text">'+this.localize(this.labelText_)+" <\/span>"});return this.contentEl_=g("span",{className:t+"-display"},{"aria-live":"off"}),this.updateTextNode_(),i.appendChild(this.contentEl_),i},t.prototype.dispose=function(){this.contentEl_=null;this.textNode_=null;n.prototype.dispose.call(this)},t.prototype.updateTextNode_=function(){if(this.contentEl_){for(;this.contentEl_.firstChild;)this.contentEl_.removeChild(this.contentEl_.firstChild);this.textNode_=u.createTextNode(this.formattedTime_||this.formatTime_(0));this.contentEl_.appendChild(this.textNode_)}},t.prototype.formatTime_=function(n){return pu(n)},t.prototype.updateFormattedTime_=function(n){var t=this.formatTime_(n);t!==this.formattedTime_&&(this.formattedTime_=t,this.requestAnimationFrame(this.updateTextNode_))},t.prototype.updateContent=function(){},t}(i);dr.prototype.labelText_="Time";dr.prototype.controlText_="Time";i.registerComponent("TimeDisplay",dr);fs=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.on(i,"ended",u.handleEnded),u}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-current-time"},t.prototype.updateContent=function(){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(n)},t.prototype.handleEnded=function(){this.player_.duration()&&this.updateFormattedTime_(this.player_.duration())},t}(dr);fs.prototype.labelText_="Current Time";fs.prototype.controlText_="Current Time";i.registerComponent("CurrentTimeDisplay",fs);es=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.on(i,"durationchange",u.updateContent),u.on(i,"loadedmetadata",u.throttledUpdateContent),u}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-duration"},t.prototype.updateContent=function(){var n=this.player_.duration();n&&this.duration_!==n&&(this.duration_=n,this.updateFormattedTime_(n))},t}(dr);es.prototype.labelText_="Duration";es.prototype.controlText_="Duration";i.registerComponent("DurationDisplay",es);hg=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/<\/span><\/div>"})},t}(i);i.registerComponent("TimeDivider",hg);os=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.on(i,"durationchange",u.throttledUpdateContent),u.on(i,"ended",u.handleEnded),u}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-remaining-time"},t.prototype.formatTime_=function(t){return"-"+n.prototype.formatTime_.call(this,t)},t.prototype.updateContent=function(){this.player_.duration()&&(this.player_.remainingTimeDisplay?this.updateFormattedTime_(this.player_.remainingTimeDisplay()):this.updateFormattedTime_(this.player_.remainingTime()))},t.prototype.handleEnded=function(){this.player_.duration()&&this.updateFormattedTime_(0)},t}(dr);os.prototype.labelText_="Remaining Time";os.prototype.controlText_="Remaining Time";i.registerComponent("RemainingTimeDisplay",os);cg=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.updateShowing(),u.on(u.player(),"durationchange",u.updateShowing),u}return o(t,n),t.prototype.createEl=function(){var t=n.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=g("div",{className:"vjs-live-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Stream Type")+" <\/span>"+this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},t.prototype.dispose=function(){this.contentEl_=null;n.prototype.dispose.call(this)},t.prototype.updateShowing=function(){this.player().duration()===1/0?this.show():this.hide()},t}(i);i.registerComponent("LiveDisplay",cg);ss=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.bar=u.getChild(u.options_.barName),u.vertical(!!u.options_.vertical),u.enable(),u}return o(t,n),t.prototype.enabled=function(){return this.enabled_},t.prototype.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown),this.on("touchstart",this.handleMouseDown),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur),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)},t.prototype.disable=function(){if(this.enabled()){var n=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown);this.off("touchstart",this.handleMouseDown);this.off("focus",this.handleFocus);this.off("blur",this.handleBlur);this.off("click",this.handleClick);this.off(this.player_,"controlsvisible",this.update);this.off(n,"mousemove",this.handleMouseMove);this.off(n,"mouseup",this.handleMouseUp);this.off(n,"touchmove",this.handleMouseMove);this.off(n,"touchend",this.handleMouseUp);this.removeAttribute("tabindex");this.addClass("disabled");this.playerEvent&&this.off(this.player_,this.playerEvent,this.update);this.enabled_=!1}},t.prototype.createEl=function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return i.className=i.className+" vjs-slider",i=k({tabIndex:0},i),r=k({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},r),n.prototype.createEl.call(this,t,i,r)},t.prototype.handleMouseDown=function(n){var t=this.bar.el_.ownerDocument;"mousedown"===n.type&&n.preventDefault();"touchstart"!==n.type||rr||n.preventDefault();rb();this.addClass("vjs-sliding");this.trigger("slideractive");this.on(t,"mousemove",this.handleMouseMove);this.on(t,"mouseup",this.handleMouseUp);this.on(t,"touchmove",this.handleMouseMove);this.on(t,"touchend",this.handleMouseUp);this.handleMouseMove(n)},t.prototype.handleMouseMove=function(){},t.prototype.handleMouseUp=function(){var n=this.bar.el_.ownerDocument;ub();this.removeClass("vjs-sliding");this.trigger("sliderinactive");this.off(n,"mousemove",this.handleMouseMove);this.off(n,"mouseup",this.handleMouseUp);this.off(n,"touchmove",this.handleMouseMove);this.off(n,"touchend",this.handleMouseUp);this.update()},t.prototype.update=function(){var n,t,i,r;if(this.el_&&(n=this.getPercent(),t=this.bar,t))return("number"!=typeof n||n!=n||n<0||n===1/0)&&(n=0),i=(100*n).toFixed(2)+"%",r=t.el().style,this.vertical()?r.height=i:r.width=i,n},t.prototype.calculateDistance=function(n){var t=vc(this.el_,n);return this.vertical()?t.y:t.x},t.prototype.handleFocus=function(){this.on(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},t.prototype.handleKeyPress=function(n){37===n.which||40===n.which?(n.preventDefault(),this.stepBack()):38!==n.which&&39!==n.which||(n.preventDefault(),this.stepForward())},t.prototype.handleBlur=function(){this.off(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},t.prototype.handleClick=function(n){n.stopImmediatePropagation();n.preventDefault()},t.prototype.vertical=function(n){if(void 0===n)return this.vertical_||!1;this.vertical_=!!n;this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(i);i.registerComponent("Slider",ss);lg=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.partEls_=[],u.on(i,"progress",u.update),u}return o(t,n),t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Loaded")+"<\/span>: 0%<\/span>"})},t.prototype.dispose=function(){this.partEls_=null;n.prototype.dispose.call(this)},t.prototype.update=function(){var t=this.player_.buffered(),s=this.player_.duration(),f=this.player_.bufferedEnd(),i=this.partEls_,e=function(n,t){var i=n/t||0;return 100*(1<=i?1:i)+"%"},n,u;for(this.el_.style.width=e(f,s),n=0;n<t.length;n++){var o=t.start(n),h=t.end(n),r=i[n];r||(r=this.el_.appendChild(g()),i[n]=r);r.style.left=e(o,f);r.style.width=e(h-o,f)}for(u=i.length;u>t.length;u--)this.el_.removeChild(i[u-1]);i.length=t.length},t}(i);i.registerComponent("LoadProgressBar",lg);ag=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"})},t.prototype.update=function(n,t,i){var u=pf(this.el_),f=pf(this.player_.el()),e=n.width*t;if(f&&u){var o=n.left-f.left+e,s=n.width-e+(f.right-n.right),r=u.width/2;o<r?r+=r-o:s<r&&(r=s);r<0?r=0:r>u.width&&(r=u.width);this.el_.style.right="-"+r+"px";af(this.el_,i)}},t}(i);i.registerComponent("TimeTooltip",ag);hs=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Progress")+"<\/span>: 0%<\/span>"})},t.prototype.update=function(n,t){var i=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_);this.rafId_=this.requestAnimationFrame(function(){var u=pu(i.player_.scrubbing()?i.player_.getCache().currentTime:i.player_.currentTime(),i.player_.duration()),r=i.getChild("timeTooltip");r&&r.update(n,t,u)})},t}(i);hs.prototype.options_={children:[]};pi||yr||hs.prototype.options_.children.push("timeTooltip");i.registerComponent("PlayProgressBar",hs);wa=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.update=cu(s(u,u.update),25),u}return o(t,n),t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},t.prototype.update=function(n,t){var i=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_);this.rafId_=this.requestAnimationFrame(function(){var r=i.player_.duration(),u=pu(t*r,r);i.el_.style.left=n.width*t+"px";i.getChild("timeTooltip").update(n,t,u)})},t}(i);wa.prototype.options_={children:["timeTooltip"]};i.registerComponent("MouseTimeDisplay",wa);he=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.setEventHandlers_(),u}return o(t,n),t.prototype.setEventHandlers_=function(){var n=this;this.update=cu(s(this,this.update),30);this.on(this.player_,"timeupdate",this.update);this.on(this.player_,"ended",this.handleEnded);this.updateInterval=null;this.on(this.player_,["playing"],function(){n.clearInterval(n.updateInterval);n.updateInterval=n.setInterval(function(){n.requestAnimationFrame(function(){n.update()})},30)});this.on(this.player_,["ended","pause","waiting"],function(){n.clearInterval(n.updateInterval)});this.on(this.player_,["timeupdate","ended"],this.update)},t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},t.prototype.update_=function(n,t){var i=this.player_.duration();this.el_.setAttribute("aria-valuenow",(100*t).toFixed(2));this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[pu(n,i),pu(i,i)],"{1} of {2}"));this.bar.update(pf(this.el_),t)},t.prototype.update=function(){var t=n.prototype.update.call(this);return this.update_(this.getCurrentTime_(),t),t},t.prototype.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},t.prototype.handleEnded=function(){this.update_(this.player_.duration(),1)},t.prototype.getPercent=function(){var n=this.getCurrentTime_()/this.player_.duration();return 1<=n?1:n||0},t.prototype.handleMouseDown=function(t){ou(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),n.prototype.handleMouseDown.call(this,t))},t.prototype.handleMouseMove=function(n){if(ou(n)){var t=this.calculateDistance(n)*this.player_.duration();t===this.player_.duration()&&(t-=.1);this.player_.currentTime(t)}},t.prototype.enable=function(){n.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},t.prototype.disable=function(){n.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},t.prototype.handleMouseUp=function(t){n.prototype.handleMouseUp.call(this,t);t&&t.stopPropagation();this.player_.scrubbing(!1);this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0});this.videoWasPlaying&&gf(this.player_.play())},t.prototype.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},t.prototype.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},t.prototype.handleAction=function(){this.player_.paused()?this.player_.play():this.player_.pause()},t.prototype.handleKeyPress=function(t){32===t.which||13===t.which?(t.preventDefault(),this.handleAction(t)):n.prototype.handleKeyPress&&n.prototype.handleKeyPress.call(this,t)},t}(ss);he.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};pi||yr||he.prototype.options_.children.splice(1,0,"mouseTimeDisplay");he.prototype.playerEvent="timeupdate";i.registerComponent("SeekBar",he);ba=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.handleMouseMove=cu(s(u,u.handleMouseMove),25),u.throttledHandleMouseSeek=cu(s(u,u.handleMouseSeek),25),u.enable(),u}return o(t,n),t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},t.prototype.handleMouseMove=function(n){var i=this.getChild("seekBar");if(i){var r=i.getChild("mouseTimeDisplay"),u=i.el(),f=pf(u),t=vc(u,n).x;1<t?t=1:t<0&&(t=0);r&&r.update(f,t)}},t.prototype.handleMouseSeek=function(n){var t=this.getChild("seekBar");t&&t.handleMouseMove(n)},t.prototype.enabled=function(){return this.enabled_},t.prototype.disable=function(){this.children().forEach(function(n){return n.disable&&n.disable()});this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},t.prototype.enable=function(){this.children().forEach(function(n){return n.enable&&n.enable()});this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},t.prototype.handleMouseDown=function(n){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(n);this.on(t,"mousemove",this.throttledHandleMouseSeek);this.on(t,"touchmove",this.throttledHandleMouseSeek);this.on(t,"mouseup",this.handleMouseUp);this.on(t,"touchend",this.handleMouseUp)},t.prototype.handleMouseUp=function(n){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseUp(n);this.off(t,"mousemove",this.throttledHandleMouseSeek);this.off(t,"touchmove",this.throttledHandleMouseSeek);this.off(t,"mouseup",this.handleMouseUp);this.off(t,"touchend",this.handleMouseUp)},t}(i);ba.prototype.options_={children:["seekBar"]};i.registerComponent("ProgressControl",ba);ka=function(n){function t(i,r){f(this,t);var o=e(this,n.call(this,i,r));return o.on(i,"fullscreenchange",o.handleFullscreenChange),!1===u[wo.fullscreenEnabled]&&o.disable(),o}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-fullscreen-control "+n.prototype.buildCSSClass.call(this)},t.prototype.handleFullscreenChange=function(){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},t.prototype.handleClick=function(){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(hi);ka.prototype.controlText_="Fullscreen";i.registerComponent("FullscreenToggle",ka);vg=function(n,t){t.tech_&&!t.tech_.featuresVolumeControl&&n.addClass("vjs-hidden");n.on(t,"loadstart",function(){t.tech_.featuresVolumeControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")})};yg=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"><\/span>'})},t}(i);i.registerComponent("VolumeLevel",yg);cs=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.on("slideractive",u.updateLastVolume_),u.on(i,"volumechange",u.updateARIAAttributes),i.ready(function(){return u.updateARIAAttributes()}),u}return o(t,n),t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},t.prototype.handleMouseDown=function(t){ou(t)&&n.prototype.handleMouseDown.call(this,t)},t.prototype.handleMouseMove=function(n){ou(n)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(n)))},t.prototype.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},t.prototype.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},t.prototype.stepForward=function(){this.checkMuted();this.player_.volume(this.player_.volume()+.1)},t.prototype.stepBack=function(){this.checkMuted();this.player_.volume(this.player_.volume()-.1)},t.prototype.updateARIAAttributes=function(){var n=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",n);this.el_.setAttribute("aria-valuetext",n+"%")},t.prototype.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},t.prototype.updateLastVolume_=function(){var n=this,t=this.player_.volume();this.one("sliderinactive",function(){0===n.player_.volume()&&n.player_.lastVolume_(t)})},t}(ss);cs.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};cs.prototype.playerEvent="volumechange";i.registerComponent("VolumeBar",cs);da=function(n){function t(i){var u=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r;return f(this,t),u.vertical=u.vertical||!1,("undefined"==typeof u.volumeBar||cf(u.volumeBar))&&(u.volumeBar=u.volumeBar||{},u.volumeBar.vertical=u.vertical),r=e(this,n.call(this,i,u)),vg(r,i),r.throttledHandleMouseMove=cu(s(r,r.handleMouseMove),25),r.on("mousedown",r.handleMouseDown),r.on("touchstart",r.handleMouseDown),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}return o(t,n),t.prototype.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),n.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},t.prototype.handleMouseDown=function(){var n=this.el_.ownerDocument;this.on(n,"mousemove",this.throttledHandleMouseMove);this.on(n,"touchmove",this.throttledHandleMouseMove);this.on(n,"mouseup",this.handleMouseUp);this.on(n,"touchend",this.handleMouseUp)},t.prototype.handleMouseUp=function(){var n=this.el_.ownerDocument;this.off(n,"mousemove",this.throttledHandleMouseMove);this.off(n,"touchmove",this.throttledHandleMouseMove);this.off(n,"mouseup",this.handleMouseUp);this.off(n,"touchend",this.handleMouseUp)},t.prototype.handleMouseMove=function(n){this.volumeBar.handleMouseMove(n)},t}(i);da.prototype.options_={children:["volumeBar"]};i.registerComponent("VolumeControl",da);pg=function(n,t){t.tech_&&!t.tech_.featuresMuteControl&&n.addClass("vjs-hidden");n.on(t,"loadstart",function(){t.tech_.featuresMuteControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")})};ga=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return pg(u,i),u.on(i,["loadstart","volumechange"],u.update),u}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-mute-control "+n.prototype.buildCSSClass.call(this)},t.prototype.handleClick=function(){var i=this.player_.volume(),n=this.player_.lastVolume_(),t;0===i?(t=n<.1?.1:n,this.player_.volume(t),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())},t.prototype.update=function(){this.updateIcon_();this.updateControlText_()},t.prototype.updateIcon_=function(){var i=this.player_.volume(),n=3,t;for(pi&&this.player_.muted(this.player_.tech_.el_.muted),0===i||this.player_.muted()?n=0:i<.33?n=1:i<.67&&(n=2),t=0;t<4;t++)vf(this.el_,"vjs-vol-"+t);ar(this.el_,"vjs-vol-"+n)},t.prototype.updateControlText_=function(){var n=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==n&&this.controlText(n)},t}(hi);ga.prototype.controlText_="Mute";i.registerComponent("MuteToggle",ga);nv=function(n){function t(i){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},u;return f(this,t),r.inline="undefined"!=typeof r.inline?r.inline:!0,("undefined"==typeof r.volumeControl||cf(r.volumeControl))&&(r.volumeControl=r.volumeControl||{},r.volumeControl.vertical=!r.inline),u=e(this,n.call(this,i,r)),u.on(i,["loadstart"],u.volumePanelState_),u.on(u.volumeControl,["slideractive"],u.sliderActive_),u.on(u.volumeControl,["sliderinactive"],u.sliderInactive_),u}return o(t,n),t.prototype.sliderActive_=function(){this.addClass("vjs-slider-active")},t.prototype.sliderInactive_=function(){this.removeClass("vjs-slider-active")},t.prototype.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")},t.prototype.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),n.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},t}(i);nv.prototype.options_={children:["muteToggle","volumeControl"]};i.registerComponent("VolumePanel",nv);ls=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return r&&(u.menuButton_=r.menuButton),u.focusedChild_=-1,u.on("keydown",u.handleKeyPress),u}return o(t,n),t.prototype.addItem=function(n){this.addChild(n);n.on("click",s(this,function(){this.menuButton_&&(this.menuButton_.unpressButton(),"CaptionSettingsMenuItem"!==n.name()&&this.menuButton_.focus())}))},t.prototype.createEl=function(){var i=this.options_.contentElType||"ul",t;return this.contentEl_=g(i,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),t=n.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"}),t.appendChild(this.contentEl_),ii(t,"click",function(n){n.preventDefault();n.stopImmediatePropagation()}),t},t.prototype.dispose=function(){this.contentEl_=null;n.prototype.dispose.call(this)},t.prototype.handleKeyPress=function(n){37===n.which||40===n.which?(n.preventDefault(),this.stepForward()):38!==n.which&&39!==n.which||(n.preventDefault(),this.stepBack())},t.prototype.stepForward=function(){var n=0;void 0!==this.focusedChild_&&(n=this.focusedChild_+1);this.focus(n)},t.prototype.stepBack=function(){var n=0;void 0!==this.focusedChild_&&(n=this.focusedChild_-1);this.focus(n)},t.prototype.focus=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,n=this.children().slice();n.length&&n[0].className&&/vjs-menu-title/.test(n[0].className)&&n.shift();0<n.length&&(t<0?t=0:t>=n.length&&(t=n.length-1),n[this.focusedChild_=t].el_.focus())},t}(i);i.registerComponent("Menu",ls);as=function(n){function t(i){var u=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r,o;return f(this,t),r=e(this,n.call(this,i,u)),r.menuButton_=new hi(i,u),r.menuButton_.controlText(r.controlText_),r.menuButton_.el_.setAttribute("aria-haspopup","true"),o=hi.prototype.buildCSSClass(),r.menuButton_.el_.className=r.buildCSSClass()+" "+o,r.menuButton_.removeClass("vjs-control"),r.addChild(r.menuButton_),r.update(),r.enabled_=!0,r.on(r.menuButton_,"tap",r.handleClick),r.on(r.menuButton_,"click",r.handleClick),r.on(r.menuButton_,"focus",r.handleFocus),r.on(r.menuButton_,"blur",r.handleBlur),r.on("keydown",r.handleSubmenuKeyPress),r}return o(t,n),t.prototype.update=function(){var n=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu));this.menu=n;this.addChild(n);this.buttonPressed_=!1;this.menuButton_.el_.setAttribute("aria-expanded","false");this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},t.prototype.createMenu=function(){var n=new ls(this.player_,{menuButton:this}),i,t;if((this.hideThreshold_=0,this.options_.title)&&(i=g("li",{className:"vjs-menu-title",innerHTML:b(this.options_.title),tabIndex:-1}),this.hideThreshold_+=1,n.children_.unshift(i),lo(i,n.contentEl())),this.items=this.createItems(),this.items)for(t=0;t<this.items.length;t++)n.addItem(this.items[t]);return n},t.prototype.createItems=function(){},t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},t.prototype.buildWrapperCSSClass=function(){var t="vjs-menu-button";return t+=!0===this.options_.inline?"-inline":"-popup","vjs-menu-button "+t+" "+hi.prototype.buildCSSClass()+" "+n.prototype.buildCSSClass.call(this)},t.prototype.buildCSSClass=function(){var t="vjs-menu-button";return t+=!0===this.options_.inline?"-inline":"-popup","vjs-menu-button "+t+" "+n.prototype.buildCSSClass.call(this)},t.prototype.controlText=function(n){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.menuButton_.el();return this.menuButton_.controlText(n,t)},t.prototype.handleClick=function(){this.one(this.menu.contentEl(),"mouseleave",s(this,function(){this.unpressButton();this.el_.blur()}));this.buttonPressed_?this.unpressButton():this.pressButton()},t.prototype.focus=function(){this.menuButton_.focus()},t.prototype.blur=function(){this.menuButton_.blur()},t.prototype.handleFocus=function(){ii(u,"keydown",s(this,this.handleKeyPress))},t.prototype.handleBlur=function(){vt(u,"keydown",s(this,this.handleKeyPress))},t.prototype.handleKeyPress=function(n){27===n.which||9===n.which?(this.buttonPressed_&&this.unpressButton(),9!==n.which&&(n.preventDefault(),this.menuButton_.el_.focus())):38!==n.which&&40!==n.which||this.buttonPressed_||(this.pressButton(),n.preventDefault())},t.prototype.handleSubmenuKeyPress=function(n){27!==n.which&&9!==n.which||(this.buttonPressed_&&this.unpressButton(),9!==n.which&&(n.preventDefault(),this.menuButton_.el_.focus()))},t.prototype.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),pi&&dw())return;this.menu.focus()}},t.prototype.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},t.prototype.disable=function(){this.unpressButton();this.enabled_=!1;this.addClass("vjs-disabled");this.menuButton_.disable()},t.prototype.enable=function(){this.enabled_=!0;this.removeClass("vjs-disabled");this.menuButton_.enable()},t}(i);i.registerComponent("MenuButton",as);vs=function(n){function t(i,r){var o,u,h;return(f(this,t),o=r.tracks,u=e(this,n.call(this,i,r)),u.items.length<=1&&u.hide(),!o)?e(u):(h=s(u,u.update),o.addEventListener("removetrack",h),o.addEventListener("addtrack",h),u.player_.on("ready",h),u.player_.on("dispose",function(){o.removeEventListener("removetrack",h);o.removeEventListener("addtrack",h)}),u)}return o(t,n),t}(as);i.registerComponent("TrackButton",vs);wu=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.selectable=r.selectable,u.isSelected_=r.selected||!1,u.multiSelectable=r.multiSelectable,u.selected(u.isSelected_),u.selectable?u.multiSelectable?u.el_.setAttribute("role","menuitemcheckbox"):u.el_.setAttribute("role","menuitemradio"):u.el_.setAttribute("role","menuitem"),u}return o(t,n),t.prototype.createEl=function(t,i,r){return this.nonIconControl=!0,n.prototype.createEl.call(this,"li",k({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"<\/span>",tabIndex:-1},i),r)},t.prototype.handleClick=function(){this.selected(!0)},t.prototype.selected=function(n){this.selectable&&(n?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))},t}(oe);i.registerComponent("MenuItem",wu);bu=function(n){function i(r,o){var c,h,s,l,v,a;if(f(this,i),c=o.track,h=r.textTracks(),o.label=c.label||c.language||"Unknown",o.selected="showing"===c.mode,s=e(this,n.call(this,r,o)),s.track=c,l=function(){for(var t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];s.handleTracksChange.apply(s,i)},v=function(){for(var t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];s.handleSelectedLanguageChange.apply(s,i)},r.on(["loadstart","texttrackchange"],l),h.addEventListener("change",l),h.addEventListener("selectedlanguagechange",v),s.on("dispose",function(){r.off(["loadstart","texttrackchange"],l);h.removeEventListener("change",l);h.removeEventListener("selectedlanguagechange",v)}),void 0===h.onchange){a=void 0;s.on(["tap","click"],function(){if("object"!==d(t.Event))try{a=new t.Event("change")}catch(n){}a||(a=u.createEvent("Event")).initEvent("change",!0,!0);h.dispatchEvent(a)})}return s.handleTracksChange(),s}return o(i,n),i.prototype.handleClick=function(t){var e=this.track.kind,u=this.track.kinds,f=this.player_.textTracks(),r,i;if(u||(u=[e]),n.prototype.handleClick.call(this,t),f)for(r=0;r<f.length;r++)i=f[r],i===this.track&&-1<u.indexOf(i.kind)?"showing"!==i.mode&&(i.mode="showing"):"disabled"!==i.mode&&(i.mode="disabled")},i.prototype.handleTracksChange=function(){var n="showing"===this.track.mode;n!==this.isSelected_&&this.selected(n)},i.prototype.handleSelectedLanguageChange=function(){if("showing"===this.track.mode){var n=this.player_.cache_.selectedLanguage;if(n&&n.enabled&&n.language===this.track.language&&n.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},i.prototype.dispose=function(){this.track=null;n.prototype.dispose.call(this)},i}(wu);i.registerComponent("TextTrackMenuItem",bu);tv=function(n){function t(i,r){return f(this,t),r.track={player:i,kind:r.kind,kinds:r.kinds,"default":!1,mode:"disabled"},r.kinds||(r.kinds=[r.kind]),r.track.label=r.label?r.label:r.kinds.join(" and ")+" off",r.selectable=!0,r.multiSelectable=!1,e(this,n.call(this,i,r))}return o(t,n),t.prototype.handleTracksChange=function(){for(var i,r=this.player().textTracks(),n=!0,t=0,u=r.length;t<u;t++)if(i=r[t],-1<this.options_.kinds.indexOf(i.kind)&&"showing"===i.mode){n=!1;break}n!==this.isSelected_&&this.selected(n)},t.prototype.handleSelectedLanguageChange=function(){for(var t,i=this.player().textTracks(),r=!0,n=0,u=i.length;n<u;n++)if(t=i[n],-1<["captions","descriptions","subtitles"].indexOf(t.kind)&&"showing"===t.mode){r=!1;break}r&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(bu);i.registerComponent("OffTextTrackMenuItem",tv);gr=function(n){function t(i){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return f(this,t),r.tracks=i.textTracks(),e(this,n.call(this,i,r))}return o(t,n),t.prototype.createItems=function(){var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:bu,f=void 0,r,n,t,u;for(this.label_&&(f=this.label_+" off"),i.push(new tv(this.player_,{kinds:this.kinds_,kind:this.kind_,label:f})),this.hideThreshold_+=1,r=this.player_.textTracks(),Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]),n=0;n<r.length;n++)t=r[n],-1<this.kinds_.indexOf(t.kind)&&(u=new e(this.player_,{track:t,selectable:!0,multiSelectable:!1}),u.addClass("vjs-"+t.kind+"-menu-item"),i.push(u));return i},t}(vs);i.registerComponent("TextTrackButton",gr);iv=function(n){function t(i,r){var u;f(this,t);var h=r.track,o=r.cue,c=i.currentTime();return r.selectable=!0,r.multiSelectable=!1,r.label=o.text,r.selected=o.startTime<=c&&c<o.endTime,u=e(this,n.call(this,i,r)),u.track=h,u.cue=o,h.addEventListener("cuechange",s(u,u.update)),u}return o(t,n),t.prototype.handleClick=function(){n.prototype.handleClick.call(this);this.player_.currentTime(this.cue.startTime);this.update(this.cue.startTime)},t.prototype.update=function(){var n=this.cue,t=this.player_.currentTime();this.selected(n.startTime<=t&&t<n.endTime)},t}(wu);i.registerComponent("ChaptersTrackMenuItem",iv);ys=function(n){function t(i,r,u){return f(this,t),e(this,n.call(this,i,r,u))}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-chapters-button "+n.prototype.buildCSSClass.call(this)},t.prototype.buildWrapperCSSClass=function(){return"vjs-chapters-button "+n.prototype.buildWrapperCSSClass.call(this)},t.prototype.update=function(t){this.track_&&(!t||"addtrack"!==t.type&&"removetrack"!==t.type)||this.setTrack(this.findChaptersTrack());n.prototype.update.call(this)},t.prototype.setTrack=function(n){var t,i;this.track_!==n&&((this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_)&&(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_),t&&t.removeEventListener("load",this.updateHandler_),this.track_=null),(this.track_=n,this.track_)&&(this.track_.mode="hidden",i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_),i&&i.addEventListener("load",this.updateHandler_)))},t.prototype.findChaptersTrack=function(){for(var i,t=this.player_.textTracks()||[],n=t.length-1;0<=n;n--)if(i=t[n],i.kind===this.kind_)return i},t.prototype.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(b(this.kind_))},t.prototype.createMenu=function(){return this.options_.title=this.getMenuCaption(),n.prototype.createMenu.call(this)},t.prototype.createItems=function(){var i=[],n,t,r,u,f;if(!this.track_||(n=this.track_.cues,!n))return i;for(t=0,r=n.length;t<r;t++)u=n[t],f=new iv(this.player_,{track:this.track_,cue:u}),i.push(f);return i},t}(gr);ys.prototype.kind_="chapters";ys.prototype.controlText_="Chapters";i.registerComponent("ChaptersButton",ys);ps=function(n){function t(i,r,u){f(this,t);var o=e(this,n.call(this,i,r,u)),h=i.textTracks(),c=s(o,o.handleTracksChange);return h.addEventListener("change",c),o.on("dispose",function(){h.removeEventListener("change",c)}),o}return o(t,n),t.prototype.handleTracksChange=function(){for(var t,i=this.player().textTracks(),r=!1,n=0,u=i.length;n<u;n++)if(t=i[n],t.kind!==this.kind_&&"showing"===t.mode){r=!0;break}r?this.disable():this.enable()},t.prototype.buildCSSClass=function(){return"vjs-descriptions-button "+n.prototype.buildCSSClass.call(this)},t.prototype.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+n.prototype.buildWrapperCSSClass.call(this)},t}(gr);ps.prototype.kind_="descriptions";ps.prototype.controlText_="Descriptions";i.registerComponent("DescriptionsButton",ps);ws=function(n){function t(i,r,u){return f(this,t),e(this,n.call(this,i,r,u))}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-subtitles-button "+n.prototype.buildCSSClass.call(this)},t.prototype.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+n.prototype.buildWrapperCSSClass.call(this)},t}(gr);ws.prototype.kind_="subtitles";ws.prototype.controlText_="Subtitles";i.registerComponent("SubtitlesButton",ws);bs=function(n){function t(i,r){f(this,t);r.track={player:i,kind:r.kind,label:r.kind+" settings",selectable:!1,"default":!1,mode:"disabled"};r.selectable=!1;r.name="CaptionSettingsMenuItem";var u=e(this,n.call(this,i,r));return u.addClass("vjs-texttrack-settings"),u.controlText(", opens "+r.kind+" settings dialog"),u}return o(t,n),t.prototype.handleClick=function(){this.player().getChild("textTrackSettings").open()},t}(bu);i.registerComponent("CaptionSettingsMenuItem",bs);ks=function(n){function t(i,r,u){return f(this,t),e(this,n.call(this,i,r,u))}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-captions-button "+n.prototype.buildCSSClass.call(this)},t.prototype.buildWrapperCSSClass=function(){return"vjs-captions-button "+n.prototype.buildWrapperCSSClass.call(this)},t.prototype.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new bs(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),n.prototype.createItems.call(this,t)},t}(gr);ks.prototype.kind_="captions";ks.prototype.controlText_="Captions";i.registerComponent("CaptionsButton",ks);rv=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.createEl=function(t,i,r){var u='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"captions"===this.options_.track.kind&&(u+='\n        <span aria-hidden="true" class="vjs-icon-placeholder"><\/span>\n        <span class="vjs-control-text"> '+this.localize("Captions")+"<\/span>\n      "),u+="<\/span>",n.prototype.createEl.call(this,t,k({innerHTML:u},i),r)},t}(bu);i.registerComponent("SubsCapsMenuItem",rv);ds=function(n){function t(i){var u=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r;return f(this,t),r=e(this,n.call(this,i,u)),r.label_="subtitles",-1<["en","en-us","en-ca","fr-ca"].indexOf(r.player_.language_)&&(r.label_="captions"),r.menuButton_.controlText(b(r.label_)),r}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-subs-caps-button "+n.prototype.buildCSSClass.call(this)},t.prototype.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+n.prototype.buildWrapperCSSClass.call(this)},t.prototype.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new bs(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=n.prototype.createItems.call(this,t,rv)},t}(gr);ds.prototype.kinds_=["captions","subtitles"];ds.prototype.controlText_="Subtitles";i.registerComponent("SubsCapsButton",ds);uv=function(n){function t(i,r){var o,s,u,h;return f(this,t),o=r.track,s=i.audioTracks(),r.label=o.label||o.language||"Unknown",r.selected=o.enabled,u=e(this,n.call(this,i,r)),u.track=o,u.addClass("vjs-"+o.kind+"-menu-item"),h=function(){for(var t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];u.handleTracksChange.apply(u,i)},s.addEventListener("change",h),u.on("dispose",function(){s.removeEventListener("change",h)}),u}return o(t,n),t.prototype.createEl=function(t,i,r){var u='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"main-desc"===this.options_.track.kind&&(u+='\n        <span aria-hidden="true" class="vjs-icon-placeholder"><\/span>\n        <span class="vjs-control-text"> '+this.localize("Descriptions")+"<\/span>\n      "),u+="<\/span>",n.prototype.createEl.call(this,t,k({innerHTML:u},i),r)},t.prototype.handleClick=function(t){var u=this.player_.audioTracks(),i,r;for(n.prototype.handleClick.call(this,t),i=0;i<u.length;i++)r=u[i],r.enabled=r===this.track},t.prototype.handleTracksChange=function(){this.selected(this.track.enabled)},t}(wu);i.registerComponent("AudioTrackMenuItem",uv);fv=function(n){function t(i){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return f(this,t),r.tracks=i.audioTracks(),e(this,n.call(this,i,r))}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-audio-button "+n.prototype.buildCSSClass.call(this)},t.prototype.buildWrapperCSSClass=function(){return"vjs-audio-button "+n.prototype.buildWrapperCSSClass.call(this)},t.prototype.createItems=function(){var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t,n,r;for(this.hideThreshold_=1,t=this.player_.audioTracks(),n=0;n<t.length;n++)r=t[n],i.push(new uv(this.player_,{track:r,selectable:!0,multiSelectable:!1}));return i},t}(vs);fv.prototype.controlText_="Audio Track";i.registerComponent("AudioTrackButton",fv);gs=function(n){function t(i,r){var o,s,u;return f(this,t),o=r.rate,s=parseFloat(o,10),r.label=o,r.selected=1===s,r.selectable=!0,r.multiSelectable=!1,u=e(this,n.call(this,i,r)),u.label=o,u.rate=s,u.on(i,"ratechange",u.update),u}return o(t,n),t.prototype.handleClick=function(){n.prototype.handleClick.call(this);this.player().playbackRate(this.rate)},t.prototype.update=function(){this.selected(this.player().playbackRate()===this.rate)},t}(wu);gs.prototype.contentElType="button";i.registerComponent("PlaybackRateMenuItem",gs);ev=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.updateVisibility(),u.updateLabel(),u.on(i,"loadstart",u.updateVisibility),u.on(i,"ratechange",u.updateLabel),u}return o(t,n),t.prototype.createEl=function(){var t=n.prototype.createEl.call(this);return this.labelEl_=g("div",{className:"vjs-playback-rate-value",innerHTML:"1x"}),t.appendChild(this.labelEl_),t},t.prototype.dispose=function(){this.labelEl_=null;n.prototype.dispose.call(this)},t.prototype.buildCSSClass=function(){return"vjs-playback-rate "+n.prototype.buildCSSClass.call(this)},t.prototype.buildWrapperCSSClass=function(){return"vjs-playback-rate "+n.prototype.buildWrapperCSSClass.call(this)},t.prototype.createMenu=function(){var i=new ls(this.player()),t=this.playbackRates(),n;if(t)for(n=t.length-1;0<=n;n--)i.addChild(new gs(this.player(),{rate:t[n]+"x"}));return i},t.prototype.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},t.prototype.handleClick=function(){for(var r=this.player().playbackRate(),n=this.playbackRates(),i=n[0],t=0;t<n.length;t++)if(n[t]>r){i=n[t];break}this.player().playbackRate(i)},t.prototype.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},t.prototype.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0<this.playbackRates().length},t.prototype.updateVisibility=function(){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},t.prototype.updateLabel=function(){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},t}(as);ev.prototype.controlText_="Playback Rate";i.registerComponent("PlaybackRateMenuButton",ev);ov=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-spacer "+n.prototype.buildCSSClass.call(this)},t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},t}(i);i.registerComponent("Spacer",ov);wg=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-custom-control-spacer "+n.prototype.buildCSSClass.call(this)},t.prototype.createEl=function(){var t=n.prototype.createEl.call(this,{className:this.buildCSSClass()});return t.innerHTML=" ",t},t}(ov);i.registerComponent("CustomControlSpacer",wg);sv=function(n){function t(){return f(this,t),e(this,n.apply(this,arguments))}return o(t,n),t.prototype.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(i);sv.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]};i.registerComponent("ControlBar",sv);hv=function(n){function t(i,r){f(this,t);var u=e(this,n.call(this,i,r));return u.on(i,"error",u.open),u}return o(t,n),t.prototype.buildCSSClass=function(){return"vjs-error-display "+n.prototype.buildCSSClass.call(this)},t.prototype.content=function(){var n=this.player().error();return n?this.localize(n.message):""},t}(au);hv.prototype.options_=p(au.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});i.registerComponent("ErrorDisplay",hv);var cv="vjs-text-track-settings",bg=["#000","Black"],kg=["#00F","Blue"],dg=["#0FF","Cyan"],gg=["#0F0","Green"],nn=["#F0F","Magenta"],tn=["#F00","Red"],rn=["#FFF","White"],un=["#FF0","Yellow"],lv=["1","Opaque"],av=["0.5","Semi-Transparent"],fn=["0","Transparent"],nu={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[bg,rn,tn,gg,kg,un,nn,dg]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[lv,av,fn]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[rn,bg,tn,gg,kg,un,nn,dg]},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(n){return"1.00"===n?null:Number(n)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[lv,av]},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:[fn,av,lv]}};nu.windowColor.options=nu.backgroundColor.options;on=function(n){function i(t,r){f(this,i);r.temporary=!1;var u=e(this,n.call(this,t,r));return u.updateDisplay=s(u,u.updateDisplay),u.fill(),u.hasBeenOpened_=u.hasBeenFilled_=!0,u.endDialog=g("p",{className:"vjs-control-text",textContent:u.localize("End of dialog window.")}),u.el().appendChild(u.endDialog),u.setDefaults(),void 0===r.persistTextTrackSettings&&(u.options_.persistTextTrackSettings=u.options_.playerOptions.persistTextTrackSettings),u.on(u.$(".vjs-done-button"),"click",function(){u.saveSettings();u.close()}),u.on(u.$(".vjs-default-button"),"click",function(){u.setDefaults();u.updateDisplay()}),uu(nu,function(n){u.on(u.$(n.selector),"change",u.updateDisplay)}),u.options_.persistTextTrackSettings&&u.restoreSettings(),u}return o(i,n),i.prototype.dispose=function(){this.endDialog=null;n.prototype.dispose.call(this)},i.prototype.createElSelect_=function(n){var f=this,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"label",i=nu[n],r=i.id.replace("%s",this.id_),u=[e,r].join(" ").trim();return["<"+t+' id="'+r+'" class="'+("label"===t?"vjs-label":"")+'">',this.localize(i.label),"<\/"+t+">",'<select aria-labelledby="'+u+'">'].concat(i.options.map(function(n){var t=r+"-"+n[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+n[0]+'" ','aria-labelledby="'+u+" "+t+'">',f.localize(n[1]),"<\/option>"].join("")})).concat("<\/select>").join("")},i.prototype.createElFgColor_=function(){var n="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+n+'">',this.localize("Text"),"<\/legend>",this.createElSelect_("color",n),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",n),"<\/span>","<\/fieldset>"].join("")},i.prototype.createElBgColor_=function(){var n="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+n+'">',this.localize("Background"),"<\/legend>",this.createElSelect_("backgroundColor",n),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",n),"<\/span>","<\/fieldset>"].join("")},i.prototype.createElWinColor_=function(){var n="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+n+'">',this.localize("Window"),"<\/legend>",this.createElSelect_("windowColor",n),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",n),"<\/span>","<\/fieldset>"].join("")},i.prototype.createElColors_=function(){return g("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.prototype.createElFont_=function(){return g("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"<\/fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"<\/fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"<\/fieldset>"].join("")})},i.prototype.createElControls_=function(){var n=this.localize("restore all settings to the default values");return g("div",{className:"vjs-track-settings-controls",innerHTML:['<button class="vjs-default-button" title="'+n+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+n+"<\/span>","<\/button>",'<button class="vjs-done-button">'+this.localize("Done")+"<\/button>"].join("")})},i.prototype.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.prototype.label=function(){return this.localize("Caption Settings Dialog")},i.prototype.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.prototype.buildCSSClass=function(){return n.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.prototype.getValues=function(){var n=this;return function(n,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;return pw(n).reduce(function(i,r){return t(i,n[r],r)},i)}(nu,function(t,i,r){var u,f,e=(u=n.$(i.selector),f=i.parser,en(u.options[u.options.selectedIndex].value,f));return void 0!==e&&(t[r]=e),t},{})},i.prototype.setValues=function(n){var t=this;uu(nu,function(i,r){!function(n,t,i){if(t)for(var r=0;r<n.options.length;r++)if(en(n.options[r].value,i)===t){n.selectedIndex=r;break}}(t.$(i.selector),n[r],i.parser)})},i.prototype.setDefaults=function(){var n=this;uu(nu,function(t){var i=t.hasOwnProperty("default")?t.default:0;n.$(t.selector).selectedIndex=i})},i.prototype.restoreSettings=function(){var n=void 0;try{n=JSON.parse(t.localStorage.getItem(cv))}catch(n){l.warn(n)}n&&this.setValues(n)},i.prototype.saveSettings=function(){if(this.options_.persistTextTrackSettings){var n=this.getValues();try{Object.keys(n).length?t.localStorage.setItem(cv,JSON.stringify(n)):t.localStorage.removeItem(cv)}catch(n){l.warn(n)}}},i.prototype.updateDisplay=function(){var n=this.player_.getChild("textTrackDisplay");n&&n.updateDisplay()},i.prototype.conditionalBlur_=function(){this.previouslyActiveEl_=null;this.off(u,"keydown",this.handleKeyDown);var n=this.player_.controlBar,t=n&&n.subsCapsButton,i=n&&n.captionsButton;t?t.focus():i&&i.focus()},i}(au);i.registerComponent("TextTrackSettings",on);sn=function(n){function i(r,u){var s,h,o;return f(this,i),s=u.ResizeObserver||t.ResizeObserver,null===u.ResizeObserver&&(s=!1),h=p({createEl:!s,reportTouchActivity:!1},u),o=e(this,n.call(this,r,h)),o.ResizeObserver=u.ResizeObserver||t.ResizeObserver,o.loadListener_=null,o.resizeObserver_=null,o.debouncedHandler_=uot(function(){o.resizeHandler()},100,!1,o),s?(o.resizeObserver_=new o.ResizeObserver(o.debouncedHandler_),o.resizeObserver_.observe(r.el())):(o.loadListener_=function(){o.el_&&o.el_.contentWindow&&ii(o.el_.contentWindow,"resize",o.debouncedHandler_)},o.one("load",o.loadListener_)),o}return o(i,n),i.prototype.createEl=function(){return n.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager"})},i.prototype.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},i.prototype.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel();this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect());this.el_&&this.el_.contentWindow&&vt(this.el_.contentWindow,"resize",this.debouncedHandler_);this.loadListener_&&this.off("load",this.loadListener_);this.ResizeObserver=null;this.resizeObserver=null;this.debouncedHandler_=null;this.loadListener_=null},i}(i);i.registerComponent("ResizeManager",sn);var vv=function(n){var f=n.el(),i,r;if(f.hasAttribute("src"))return n.triggerSourceset(f.src),!0;var u=n.$$("source"),t=[],e="";if(!u.length)return!1;for(i=0;i<u.length;i++)r=u[i].src,r&&-1===t.indexOf(r)&&t.push(r);return!!t.length&&(1===t.length&&(e=t[0]),n.triggerSourceset(e),!0)},iht=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(n){var i=u.createElement(this.nodeName.toLowerCase()),r;for(i.innerHTML=n,r=u.createDocumentFragment();i.childNodes.length;)r.appendChild(i.childNodes[0]);return this.innerText="",t.Element.prototype.appendChild.call(this,r),this.innerHTML}}),hn=function(n,t){for(var i={},r=0;r<n.length&&!((i=Object.getOwnPropertyDescriptor(n[r],t))&&i.set&&i.get);r++);return i.enumerable=!0,i.configurable=!0,i},cn=function(n){var i=n.el();if(!i.resetSourceWatch_){var r={},u=hn([n.el(),t.HTMLMediaElement.prototype,t.Element.prototype,iht],"innerHTML"),f=function(t){return function(){for(var e,u=arguments.length,f=Array(u),r=0;r<u;r++)f[r]=arguments[r];return e=t.apply(i,f),vv(n),e}};["append","appendChild","insertAdjacentHTML"].forEach(function(n){i[n]&&(r[n]=i[n],i[n]=f(r[n]))});Object.defineProperty(i,"innerHTML",p(u,{set:f(u.set)}));i.resetSourceWatch_=function(){i.resetSourceWatch_=null;Object.keys(r).forEach(function(n){i[n]=r[n]});Object.defineProperty(i,"innerHTML",u)};n.one("sourceset",i.resetSourceWatch_)}},rht=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?dk(t.Element.prototype.getAttribute.call(this,"src")):""},set:function(n){return t.Element.prototype.setAttribute.call(this,"src",n),n}}),uht=function(n){var i;if(n.featuresSourceset&&(i=n.el(),!i.resetSourceset_)){var r=hn([n.el(),t.HTMLMediaElement.prototype,rht],"src"),u=i.setAttribute,f=i.load;Object.defineProperty(i,"src",p(r,{set:function(t){var u=r.set.call(i,t);return n.triggerSourceset(i.src),u}}));i.setAttribute=function(t,r){var f=u.call(i,t,r);return/src/i.test(t)&&n.triggerSourceset(i.src),f};i.load=function(){var t=f.call(i);return vv(n)||(n.triggerSourceset(""),cn(n)),t};i.currentSrc?n.triggerSourceset(i.currentSrc):vv(n)||cn(n);i.resetSourceset_=function(){i.resetSourceset_=null;i.load=f;i.setAttribute=u;Object.defineProperty(i,"src",r);i.resetSourceWatch_&&i.resetSourceWatch_()}}},fht=lc(["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n            This may prevent text tracks from loading."],["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n            This may prevent text tracks from loading."]),r=function(n){function i(t,r){var o,s;f(this,i);var u=e(this,n.call(this,t,r)),h=t.source,c=!1;if(h&&(u.el_.currentSrc!==h.src||t.tag&&3===t.tag.initNetworkState_)?u.setSource(h):u.handleLateInit_(u.el_),t.enableSourceset&&u.setupSourcesetHandling_(),u.el_.hasChildNodes()){for(var v=u.el_.childNodes,y=v.length,a=[];y--;)o=v[y],"track"===o.nodeName.toLowerCase()&&(u.featuresNativeTextTracks?(u.remoteTextTrackEls().addTrackElement_(o),u.remoteTextTracks().addTrack(o.track),u.textTracks().addTrack(o.track),c||u.el_.hasAttribute("crossorigin")||!ns(o.src)||(c=!0)):a.push(o));for(s=0;s<a.length;s++)u.el_.removeChild(a[s])}return u.proxyNativeTracks_(),u.featuresNativeTextTracks&&c&&l.warn(cc(fht)),u.restoreMetadataTracksInIOSNativePlayer_(),(po||ol||uk)&&!0===t.nativeControlsForTouch&&u.setControls(!0),u.proxyWebkitFullscreen_(),u.triggerReady(),u}return o(i,n),i.prototype.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_();i.disposeMediaElement(this.el_);this.options_=null;n.prototype.dispose.call(this)},i.prototype.setupSourcesetHandling_=function(){uht(this)},i.prototype.restoreMetadataTracksInIOSNativePlayer_=function(){var n=this.textTracks(),i=void 0,t=function(){var t,r;for(i=[],t=0;t<n.length;t++)r=n[t],"metadata"===r.kind&&i.push({track:r,storedMode:r.mode})},r;t();n.addEventListener("change",t);this.on("dispose",function(){return n.removeEventListener("change",t)});r=function t(){for(var r,u=0;u<i.length;u++)r=i[u],"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode);n.removeEventListener("change",t)};this.on("webkitbeginfullscreen",function(){n.removeEventListener("change",t);n.removeEventListener("change",r);n.addEventListener("change",r)});this.on("webkitendfullscreen",function(){n.removeEventListener("change",t);n.addEventListener("change",t);n.removeEventListener("change",r)})},i.prototype.overrideNative_=function(n,t){var r=this,i;t===this["featuresNative"+n+"Tracks"]&&(i=n.toLowerCase(),this[i+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach(function(n){r.el()[i+"Tracks"].removeEventListener(n,r[i+"TracksListeners_"][n])}),this["featuresNative"+n+"Tracks"]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i))},i.prototype.overrideNativeAudioTracks=function(n){this.overrideNative_("Audio",n)},i.prototype.overrideNativeVideoTracks=function(n){this.overrideNative_("Video",n)},i.prototype.proxyNativeTracksForType_=function(n){var e=this,r=yt[n],i=this.el()[r.getterName],t=this[r.getterName](),u,f;this["featuresNative"+r.capitalName+"Tracks"]&&i&&i.addEventListener&&(u={change:function(){t.trigger({type:"change",target:t,currentTarget:t,srcElement:t})},addtrack:function(n){t.addTrack(n.track)},removetrack:function(n){t.removeTrack(n.track)}},f=function(){for(var f,u,r=[],n=0;n<t.length;n++){for(f=!1,u=0;u<i.length;u++)if(i[u]===t[n]){f=!0;break}f||r.push(t[n])}for(;r.length;)t.removeTrack(r.shift())},this[r.getterName+"Listeners_"]=u,Object.keys(u).forEach(function(n){var t=u[n];i.addEventListener(n,t);e.on("dispose",function(){return i.removeEventListener(n,t)})}),this.on("loadstart",f),this.on("dispose",function(){return e.off("loadstart",f)}))},i.prototype.proxyNativeTracks_=function(){var n=this;yt.names.forEach(function(t){n.proxyNativeTracksForType_(t)})},i.prototype.createEl=function(){var n=this.options_.tag,e,o,s,r,t,f;for(n&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(n?(e=n.cloneNode(!0),n.parentNode&&n.parentNode.insertBefore(e,n),i.disposeMediaElement(n),n=e):(n=u.createElement("video"),o=p({},this.options_.tag&&yi(this.options_.tag)),po&&!0===this.options_.nativeControlsForTouch||delete o.controls,tb(n,k(o,{id:this.options_.techId,"class":"vjs-tech"}))),n.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&yf(n,"preload",this.options_.preload),s=["loop","muted","playsinline","autoplay"],r=0;r<s.length;r++)t=s[r],f=this.options_[t],"undefined"!=typeof f&&(f?yf(n,t,t):ao(n,t),n[t]=f);return n},i.prototype.handleLateInit_=function(n){var i,r,u,t;if(0!==n.networkState&&3!==n.networkState){if(0===n.readyState){i=!1;r=function(){i=!0};this.on("loadstart",r);return u=function(){i||this.trigger("loadstart")},this.on("loadedmetadata",u),void this.ready(function(){this.off("loadstart",r);this.off("loadedmetadata",u);i||this.trigger("loadstart")})}t=["loadstart"];t.push("loadedmetadata");2<=n.readyState&&t.push("loadeddata");3<=n.readyState&&t.push("canplay");4<=n.readyState&&t.push("canplaythrough");this.ready(function(){t.forEach(function(n){this.trigger(n)},this)})}},i.prototype.setCurrentTime=function(n){try{this.el_.currentTime=n}catch(n){l(n,"Video is not ready. (Video.js)")}},i.prototype.duration=function(){var n=this;return this.el_.duration===1/0&&yr&&rr&&0===this.el_.currentTime?(this.on("timeupdate",function t(){0<n.el_.currentTime&&(n.el_.duration===1/0&&n.trigger("durationchange"),n.off("timeupdate",t))}),NaN):this.el_.duration||NaN},i.prototype.width=function(){return this.el_.offsetWidth},i.prototype.height=function(){return this.el_.offsetHeight},i.prototype.proxyWebkitFullscreen_=function(){var i=this,n,t;"webkitDisplayingFullscreen"in this.el_&&(n=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},t=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",n),this.trigger("fullscreenchange",{isFullscreen:!0}))},this.on("webkitbeginfullscreen",t),this.on("dispose",function(){i.off("webkitbeginfullscreen",t);i.off("webkitendfullscreen",n)}))},i.prototype.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var n=t.navigator&&t.navigator.userAgent||"";if(/Android/.test(n)||!/Chrome|Mac OS X 10.5/.test(n))return!0}return!1},i.prototype.enterFullScreen=function(){var n=this.el_;n.paused&&n.networkState<=n.HAVE_METADATA?(this.el_.play(),this.setTimeout(function(){n.pause();n.webkitEnterFullScreen()},0)):n.webkitEnterFullScreen()},i.prototype.exitFullScreen=function(){this.el_.webkitExitFullScreen()},i.prototype.src=function(n){if(void 0===n)return this.el_.src;this.setSrc(n)},i.prototype.reset=function(){i.resetMediaElement(this.el_)},i.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.prototype.setControls=function(n){this.el_.controls=!!n},i.prototype.addTextTrack=function(t,i,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,r):n.prototype.addTextTrack.call(this,t,i,r)},i.prototype.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return n.prototype.createRemoteTextTrack.call(this,t);var i=u.createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i},i.prototype.addRemoteTextTrack=function(t,i){var r=n.prototype.addRemoteTextTrack.call(this,t,i);return this.featuresNativeTextTracks&&this.el().appendChild(r),r},i.prototype.removeRemoteTextTrack=function(t){if(n.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),r=i.length;r--;)t!==i[r]&&t!==i[r].track||this.el().removeChild(i[r])},i.prototype.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var n={};return"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(n.droppedVideoFrames=this.el().webkitDroppedFrameCount,n.totalVideoFrames=this.el().webkitDecodedFrameCount),t.performance&&"function"==typeof t.performance.now?n.creationTime=t.performance.now():t.performance&&t.performance.timing&&"number"==typeof t.performance.timing.navigationStart&&(n.creationTime=t.Date.now()-t.performance.timing.navigationStart),n},i}(y);fu()&&(r.TEST_VID=u.createElement("video"),ce=u.createElement("track"),ce.kind="captions",ce.srclang="en",ce.label="English",r.TEST_VID.appendChild(ce));r.isSupported=function(){try{r.TEST_VID.volume=.5}catch(n){return!1}return!(!r.TEST_VID||!r.TEST_VID.canPlayType)};r.canPlayType=function(n){return r.TEST_VID.canPlayType(n)};r.canPlaySource=function(n){return r.canPlayType(n.type)};r.canControlVolume=function(){try{var n=r.TEST_VID.volume;return r.TEST_VID.volume=n/2+.1,n!==r.TEST_VID.volume}catch(n){return!1}};r.canMuteVolume=function(){try{var n=r.TEST_VID.muted;return r.TEST_VID.muted=!n,r.TEST_VID.muted?yf(r.TEST_VID,"muted","muted"):ao(r.TEST_VID,"muted"),n!==r.TEST_VID.muted}catch(n){return!1}};r.canControlPlaybackRate=function(){if(yr&&rr&&ek<58)return!1;try{var n=r.TEST_VID.playbackRate;return r.TEST_VID.playbackRate=n/2+.1,n!==r.TEST_VID.playbackRate}catch(n){return!1}};r.canOverrideAttributes=function(){try{var n=function(){};Object.defineProperty(u.createElement("video"),"src",{get:n,set:n});Object.defineProperty(u.createElement("audio"),"src",{get:n,set:n});Object.defineProperty(u.createElement("video"),"innerHTML",{get:n,set:n});Object.defineProperty(u.createElement("audio"),"innerHTML",{get:n,set:n})}catch(n){return!1}return!0};r.supportsNativeTextTracks=function(){return hk||pi&&rr};r.supportsNativeVideoTracks=function(){return!(!r.TEST_VID||!r.TEST_VID.videoTracks)};r.supportsNativeAudioTracks=function(){return!(!r.TEST_VID||!r.TEST_VID.audioTracks)};r.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];r.prototype.featuresVolumeControl=r.canControlVolume();r.prototype.featuresMuteControl=r.canMuteVolume();r.prototype.featuresPlaybackRate=r.canControlPlaybackRate();r.prototype.featuresSourceset=r.canOverrideAttributes();r.prototype.movingMediaElementInDOM=!pi;r.prototype.featuresFullscreenResize=!0;r.prototype.featuresProgressEvents=!0;r.prototype.featuresTimeupdateEvents=!0;r.prototype.featuresNativeTextTracks=r.supportsNativeTextTracks();r.prototype.featuresNativeVideoTracks=r.supportsNativeVideoTracks();r.prototype.featuresNativeAudioTracks=r.supportsNativeAudioTracks();yv=r.TEST_VID&&r.TEST_VID.constructor.prototype.canPlayType;ln=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;r.patchCanPlayType=function(){4<=sl&&!fk&&!rr&&(r.TEST_VID.constructor.prototype.canPlayType=function(n){return n&&ln.test(n)?"maybe":yv.call(this,n)})};r.unpatchCanPlayType=function(){var n=r.TEST_VID.constructor.prototype.canPlayType;return r.TEST_VID.constructor.prototype.canPlayType=yv,n};r.patchCanPlayType();r.disposeMediaElement=function(n){if(n){for(n.parentNode&&n.parentNode.removeChild(n);n.hasChildNodes();)n.removeChild(n.firstChild);n.removeAttribute("src");"function"==typeof n.load&&function(){try{n.load()}catch(n){}}()}};r.resetMediaElement=function(n){if(n){for(var t=n.querySelectorAll("source"),i=t.length;i--;)n.removeChild(t[i]);n.removeAttribute("src");"function"==typeof n.load&&function(){try{n.load()}catch(n){}}()}};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(n){r.prototype[n]=function(){return this.el_[n]||this.el_.hasAttribute(n)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(n){r.prototype["set"+b(n)]=function(t){(this.el_[n]=t)?this.el_.setAttribute(n,n):this.el_.removeAttribute(n)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(n){r.prototype[n]=function(){return this.el_[n]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach(function(n){r.prototype["set"+b(n)]=function(t){this.el_[n]=t}});["pause","load","play"].forEach(function(n){r.prototype[n]=function(){return this.el_[n]()}});y.withSourceHandlers(r);r.nativeSourceHandler={};r.nativeSourceHandler.canPlayType=function(n){try{return r.TEST_VID.canPlayType(n)}catch(n){return""}};r.nativeSourceHandler.canHandleSource=function(n){if(n.type)return r.nativeSourceHandler.canPlayType(n.type);if(n.src){var t=wl(n.src);return r.nativeSourceHandler.canPlayType("video/"+t)}return""};r.nativeSourceHandler.handleSource=function(n,t){t.setSrc(n.src)};r.nativeSourceHandler.dispose=function(){};r.registerSourceHandler(r.nativeSourceHandler);y.registerTech("Html5",r);var eht=lc(["\n        Using the tech directly can be dangerous. I hope you know what you're doing.\n        See https://github.com/videojs/video.js/issues/2617 for more info.\n      "],["\n        Using the tech directly can be dangerous. I hope you know what you're doing.\n        See https://github.com/videojs/video.js/issues/2617 for more info.\n      "]),an=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],pv={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},nt=function(n){function r(t,i,u){var h,s,o,c,a,l,v;if(f(this,r),t.id=t.id||i.id||"vjs_video_"+vr(),(i=k(r.getTagSettings(t),i)).initChildren=!1,i.createEl=!1,i.evented=!1,i.reportTouchActivity=!1,!i.language)if("function"==typeof t.closest)h=t.closest("[lang]"),h&&h.getAttribute&&(i.language=h.getAttribute("lang"));else for(s=t;s&&1===s.nodeType;){if(yi(s).hasOwnProperty("lang")){i.language=s.getAttribute("lang");break}s=s.parentNode}if(o=e(this,n.call(this,null,i,u)),o.isPosterFromTech_=!1,o.queuedCallbacks_=[],o.isReady_=!1,o.hasStarted_=!1,o.userActive_=!1,!o.options_||!o.options_.techOrder||!o.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");return(o.tag=t,o.tagAttributes=t&&yi(t),o.language(o.options_.language),i.languages)?(c={},Object.getOwnPropertyNames(i.languages).forEach(function(n){c[n.toLowerCase()]=i.languages[n]}),o.languages_=c):o.languages_=r.prototype.options_.languages,o.cache_={},o.poster_=i.poster||"",o.controls_=!!i.controls,o.cache_.lastVolume=1,t.controls=!1,t.removeAttribute("controls"),t.hasAttribute("autoplay")?o.options_.autoplay=!0:o.autoplay(o.options_.autoplay),o.scrubbing_=!1,o.el_=o.createEl(),o.cache_.lastPlaybackRate=o.defaultPlaybackRate(),tl(o,{eventBusKey:"el_"}),a=p(o.options_),i.plugins&&(l=i.plugins,Object.keys(l).forEach(function(n){if("function"!=typeof this[n])throw new Error('plugin "'+n+'" does not exist');this[n](l[n])},o)),o.options_.playerOptions=a,o.middleware_=[],o.initChildren(),o.isAudio("audio"===t.nodeName.toLowerCase()),o.controls()?o.addClass("vjs-controls-enabled"):o.addClass("vjs-controls-disabled"),o.el_.setAttribute("role","region"),o.isAudio()?o.el_.setAttribute("aria-label",o.localize("Audio Player")):o.el_.setAttribute("aria-label",o.localize("Video Player")),o.isAudio()&&o.addClass("vjs-audio"),o.flexNotSupported_()&&o.addClass("vjs-no-flex"),pi||o.addClass("vjs-workinghover"),r.players[o.id_]=o,v=aw.split(".")[0],o.addClass("vjs-v"+v),o.userActive(!0),o.reportUserActivity(),o.one("play",o.listenForUserActivity_),o.on("fullscreenchange",o.handleFullscreenChange_),o.on("stageclick",o.handleStageClick_),o.changingSrc_=!1,o.playWaitingForReady_=!1,o.playOnLoadstart_=null,o}return o(r,n),r.prototype.dispose=function(){this.trigger("dispose");this.off("dispose");this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null);r.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);sa[this.id()]=null;n.prototype.dispose.call(this)},r.prototype.createEl=function(){var i=this.tag,r=void 0,s=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),e="video-js"===this.tag.tagName.toLowerCase(),f,h,c,l,o,a;if(s?r=this.el_=i.parentNode:e||(r=this.el_=n.prototype.createEl.call(this,"div")),f=yi(i),e){for(r=this.el_=i,i=this.tag=u.createElement("video");r.children.length;)i.appendChild(r.firstChild);eu(r,"video-js")||ar(r,"video-js");r.appendChild(i);s=this.playerElIngest_=r;Object.keys(r).forEach(function(n){i[n]=r[n]})}for((i.setAttribute("tabindex","-1"),f.tabindex="-1",ok&&(i.setAttribute("role","application"),f.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in f&&delete f.width,"height"in f&&delete f.height,Object.getOwnPropertyNames(f).forEach(function(n){e&&"class"===n||r.setAttribute(n,f[n]);e&&i.setAttribute(n,f[n])}),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=r.player=this,this.addClass("vjs-paused"),!0!==t.VIDEOJS_NO_DYNAMIC_STYLE)&&(this.styleEl_=pb("vjs-styles-dimensions"),h=tr(".vjs-styles-defaults"),c=tr("head"),c.insertBefore(this.styleEl_,h?h.nextSibling:c.firstChild)),this.width(this.options_.width),this.height(this.options_.height),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),l=i.getElementsByTagName("a"),o=0;o<l.length;o++)a=l.item(o),ar(a,"vjs-hidden"),a.setAttribute("hidden","hidden");return i.initNetworkState_=i.networkState,i.parentNode&&!s&&i.parentNode.insertBefore(r,i),lo(i,r),this.children_.unshift(i),this.el_.setAttribute("lang",this.language_),this.el_=r},r.prototype.width=function(n){return this.dimension("width",n)},r.prototype.height=function(n){return this.dimension("height",n)},r.prototype.dimension=function(n,t){var i=n+"_",r;if(void 0===t)return this[i]||0;if(""===t)return this[i]=void 0,void this.updateStyleEl_();r=parseFloat(t);isNaN(r)?l.error('Improper value "'+t+'" supplied for for '+n):(this[i]=r,this.updateStyleEl_())},r.prototype.fluid=function(n){if(void 0===n)return!!this.fluid_;this.fluid_=!!n;n?this.addClass("vjs-fluid"):this.removeClass("vjs-fluid");this.updateStyleEl_()},r.prototype.aspectRatio=function(n){if(void 0===n)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(n))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=n;this.fluid(!0);this.updateStyleEl_()},r.prototype.updateStyleEl_=function(){if(!0!==t.VIDEOJS_NO_DYNAMIC_STYLE){var i=void 0,f=void 0,n=void 0,e=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0<this.videoWidth()?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=e[1]/e[0];i=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300;f=void 0!==this.height_?this.height_:i*r;n=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions";this.addClass(n);wb(this.styleEl_,"\n      ."+n+" {\n        width: "+i+"px;\n        height: "+f+"px;\n      }\n\n      ."+n+".vjs-fluid {\n        padding-top: "+100*r+"%;\n      }\n    ")}else{var o="number"==typeof this.width_?this.width_:this.options_.width,s="number"==typeof this.height_?this.height_:this.options_.height,u=this.tech_&&this.tech_.el();u&&(0<=o&&(u.width=o),0<=s&&(u.height=s))}},r.prototype.loadTech_=function(n,t){var i=this,u,f,r,e;if(this.tech_&&this.unloadTech_(),u=b(n),f=n.charAt(0).toLowerCase()+n.slice(1),"Html5"!==u&&this.tag&&(y.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=u,this.isReady_=!1,r={source:t,autoplay:"string"!=typeof this.autoplay()&&this.autoplay(),nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+f+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,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},lt.names.forEach(function(n){var t=lt[n];r[t.getterName]=i[t.privateName]}),k(r,this.options_[u]),k(r,this.options_[f]),k(r,this.options_[n.toLowerCase()]),this.tag&&(r.tag=this.tag),t&&t.src===this.cache_.src&&0<this.cache_.currentTime&&(r.startTime=this.cache_.currentTime),e=y.getTech(n),!e)throw new Error("No Tech named '"+u+"' exists! '"+u+"' should be registered using videojs.registerTech()'");this.tech_=new e(r);this.tech_.ready(s(this,this.handleTechReady_),!0);lot(this.textTracksJson_||[],this.tech_);an.forEach(function(n){i.on(i.tech_,n,i["handleTech"+b(n)+"_"])});Object.keys(pv).forEach(function(n){i.on(i.tech_,n,function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+pv[n]+"_"].bind(i),event:t}):i["handleTech"+pv[n]+"_"](t)})});this.on(this.tech_,"loadstart",this.handleTechLoadStart_);this.on(this.tech_,"sourceset",this.handleTechSourceset_);this.on(this.tech_,"waiting",this.handleTechWaiting_);this.on(this.tech_,"ended",this.handleTechEnded_);this.on(this.tech_,"seeking",this.handleTechSeeking_);this.on(this.tech_,"play",this.handleTechPlay_);this.on(this.tech_,"firstplay",this.handleTechFirstPlay_);this.on(this.tech_,"pause",this.handleTechPause_);this.on(this.tech_,"durationchange",this.handleTechDurationChange_);this.on(this.tech_,"fullscreenchange",this.handleTechFullscreenChange_);this.on(this.tech_,"error",this.handleTechError_);this.on(this.tech_,"loadedmetadata",this.updateStyleEl_);this.on(this.tech_,"posterchange",this.handleTechPosterChange_);this.on(this.tech_,"textdata",this.handleTechTextData_);this.on(this.tech_,"ratechange",this.handleTechRateChange_);this.usingNativeControls(this.techGet_("controls"));this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_();this.tech_.el().parentNode===this.el()||"Html5"===u&&this.tag||lo(this.tech_.el(),this.el());this.tag&&(this.tag.player=null,this.tag=null)},r.prototype.unloadTech_=function(){var n=this;lt.names.forEach(function(t){var i=lt[t];n[i.privateName]=n[i.getterName]()});this.textTracksJson_=cot(this.tech_);this.isReady_=!1;this.tech_.dispose();this.tech_=!1;this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange"));this.isPosterFromTech_=!1},r.prototype.tech=function(n){return void 0===n&&l.warn(cc(eht)),this.tech_},r.prototype.addTechControlsListeners_=function(){this.removeTechControlsListeners_();this.on(this.tech_,"mousedown",this.handleTechClick_);this.on(this.tech_,"dblclick",this.handleTechDoubleClick_);this.on(this.tech_,"touchstart",this.handleTechTouchStart_);this.on(this.tech_,"touchmove",this.handleTechTouchMove_);this.on(this.tech_,"touchend",this.handleTechTouchEnd_);this.on(this.tech_,"tap",this.handleTechTap_)},r.prototype.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_);this.off(this.tech_,"touchstart",this.handleTechTouchStart_);this.off(this.tech_,"touchmove",this.handleTechTouchMove_);this.off(this.tech_,"touchend",this.handleTechTouchEnd_);this.off(this.tech_,"mousedown",this.handleTechClick_);this.off(this.tech_,"dblclick",this.handleTechDoubleClick_)},r.prototype.handleTechReady_=function(){this.triggerReady();this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume);this.handleTechPosterChange_();this.handleTechDurationChange_()},r.prototype.handleTechLoadStart_=function(){this.removeClass("vjs-ended");this.removeClass("vjs-seeking");this.error(null);this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay"));this.manualAutoplay_(this.autoplay())},r.prototype.manualAutoplay_=function(n){var i=this,r,t;if(this.tech_&&"string"==typeof n&&(r=function(){var t=i.muted(),n;return i.muted(!0),n=i.play(),n&&n.then&&n.catch?n.catch(function(){i.muted(t)}):void 0},t=void 0,"any"===n?(t=this.play())&&t.then&&t.catch&&t.catch(function(){return r()}):t="muted"===n?r():this.play(),t&&t.then&&t.catch))return t.then(function(){i.trigger({type:"autoplay-success",autoplay:n})}).catch(function(){i.trigger({type:"autoplay-failure",autoplay:n})})},r.prototype.updateSourceCaches_=function(){var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n=i,r="",t;if("string"!=typeof n&&(n=i.src,r=i.type),!/^blob:/.test(n)){this.cache_.source=this.cache_.source||{};this.cache_.sources=this.cache_.sources||[];n&&!r&&(r=function(n,t){var u,f,r,i;if(!t)return"";if(n.cache_.source.src===t&&n.cache_.source.type)return n.cache_.source.type;if(u=n.cache_.sources.filter(function(n){return n.src===t}),u.length)return u[0].type;for(f=n.$$("source"),r=0;r<f.length;r++)if(i=f[r],i.type&&i.src&&i.src===t)return i.type;return ca(t)}(this,n));this.cache_.source=p({},i,{src:n,type:r});for(var f=this.cache_.sources.filter(function(t){return t.src&&t.src===n}),e=[],o=this.$$("source"),s=[],u=0;u<o.length;u++)t=yi(o[u]),e.push(t),t.src&&t.src===n&&s.push(t.src);s.length&&!f.length?this.cache_.sources=e:f.length||(this.cache_.sources=[this.cache_.source]);this.cache_.src=n}},r.prototype.handleTechSourceset_=function(n){var t=this;if(!this.changingSrc_&&(this.updateSourceCaches_(n.src),!n.src))this.tech_.one(["sourceset","loadstart"],function n(i){"sourceset"!==i.type&&t.updateSourceCaches_(t.techGet_("currentSrc"));t.tech_.off(["sourceset","loadstart"],n)});this.trigger({src:n.src,type:"sourceset"})},r.prototype.hasStarted=function(n){if(void 0===n)return this.hasStarted_;n!==this.hasStarted_&&(this.hasStarted_=n,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},r.prototype.handleTechPlay_=function(){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.hasStarted(!0);this.trigger("play")},r.prototype.handleTechRateChange_=function(){0<this.tech_.playbackRate()&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(function(n){return n.callback(n.event)}),this.queuedCallbacks_=[]);this.cache_.lastPlaybackRate=this.tech_.playbackRate();this.trigger("ratechange")},r.prototype.handleTechWaiting_=function(){var n=this;this.addClass("vjs-waiting");this.trigger("waiting");this.one("timeupdate",function(){return n.removeClass("vjs-waiting")})},r.prototype.handleTechCanPlay_=function(){this.removeClass("vjs-waiting");this.trigger("canplay")},r.prototype.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting");this.trigger("canplaythrough")},r.prototype.handleTechPlaying_=function(){this.removeClass("vjs-waiting");this.trigger("playing")},r.prototype.handleTechSeeking_=function(){this.addClass("vjs-seeking");this.trigger("seeking")},r.prototype.handleTechSeeked_=function(){this.removeClass("vjs-seeking");this.trigger("seeked")},r.prototype.handleTechFirstPlay_=function(){this.options_.starttime&&(l.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")},r.prototype.handleTechPause_=function(){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.trigger("pause")},r.prototype.handleTechEnded_=function(){this.addClass("vjs-ended");this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause();this.trigger("ended")},r.prototype.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},r.prototype.handleTechClick_=function(n){ou(n)&&this.controls_&&(this.paused()?gf(this.play()):this.pause())},r.prototype.handleTechDoubleClick_=function(n){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(t){return t.contains(n.target)})||(this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},r.prototype.handleTechTap_=function(){this.userActive(!this.userActive())},r.prototype.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},r.prototype.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},r.prototype.handleTechTouchEnd_=function(n){n.preventDefault()},r.prototype.handleFullscreenChange_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},r.prototype.handleStageClick_=function(){this.reportUserActivity()},r.prototype.handleTechFullscreenChange_=function(n,t){t&&this.isFullscreen(t.isFullscreen);this.trigger("fullscreenchange")},r.prototype.handleTechError_=function(){var n=this.tech_.error();this.error(n)},r.prototype.handleTechTextData_=function(){var n=null;1<arguments.length&&(n=arguments[1]);this.trigger("textdata",n)},r.prototype.getCache=function(){return this.cache_},r.prototype.techCall_=function(n,t){this.ready(function(){if(n in tht)return i=this.middleware_,r=this.tech_,f=t,r[u=n](i.reduce(ha(u),f));if(n in ng)return gd(this.middleware_,this.tech_,n,t);var i,r,u,f;try{this.tech_&&this.tech_[n](t)}catch(i){throw l(i),i;}},!0)},r.prototype.techGet_=function(n){if(this.tech_&&this.tech_.isReady_){if(n in nht)return t=this.middleware_,r=this.tech_,i=n,t.reduceRight(ha(i),r[i]());if(n in ng)return gd(this.middleware_,this.tech_,n);var t,r,i;try{return this.tech_[n]()}catch(t){if(void 0===this.tech_[n])throw l("Video.js: "+n+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw l("Video.js: "+n+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw l(t),t;}}},r.prototype.play=function(){var i=this,n=this.options_.Promise||t.Promise;return n?new n(function(n){i.play_(n)}):this.play_()},r.prototype.play_=function(){var n=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:gf;if(this.playOnLoadstart_&&this.off("loadstart",this.playOnLoadstart_),this.isReady_){if(!this.changingSrc_&&(this.src()||this.currentSrc()))return void t(this.techGet_("play"));this.playOnLoadstart_=function(){n.playOnLoadstart_=null;t(n.play())};this.one("loadstart",this.playOnLoadstart_)}else{if(this.playWaitingForReady_)return;this.playWaitingForReady_=!0;this.ready(function(){n.playWaitingForReady_=!1;t(n.play())})}},r.prototype.pause=function(){this.techCall_("pause")},r.prototype.paused=function(){return!1!==this.techGet_("paused")},r.prototype.played=function(){return this.techGet_("played")||pr(0,0)},r.prototype.scrubbing=function(n){if("undefined"==typeof n)return this.scrubbing_;this.scrubbing_=!!n;n?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},r.prototype.currentTime=function(n){return"undefined"!=typeof n?(n<0&&(n=0),void this.techCall_("setCurrentTime",n)):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},r.prototype.duration=function(n){if(void 0===n)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(n=parseFloat(n))<0&&(n=1/0);n!==this.cache_.duration&&((this.cache_.duration=n)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),this.trigger("durationchange"))},r.prototype.remainingTime=function(){return this.duration()-this.currentTime()},r.prototype.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},r.prototype.buffered=function(){var n=this.techGet_("buffered");return n&&n.length||(n=pr(0,0)),n},r.prototype.bufferedPercent=function(){return lk(this.buffered(),this.duration())},r.prototype.bufferedEnd=function(){var t=this.buffered(),i=this.duration(),n=t.end(t.length-1);return i<n&&(n=i),n},r.prototype.volume=function(n){var t=void 0;return void 0!==n?(t=Math.max(0,Math.min(1,parseFloat(n))),this.cache_.volume=t,this.techCall_("setVolume",t),void(0<t&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},r.prototype.muted=function(n){if(void 0===n)return this.techGet_("muted")||!1;this.techCall_("setMuted",n)},r.prototype.defaultMuted=function(n){return void 0!==n?this.techCall_("setDefaultMuted",n):this.techGet_("defaultMuted")||!1},r.prototype.lastVolume_=function(n){if(void 0===n||0===n)return this.cache_.lastVolume;this.cache_.lastVolume=n},r.prototype.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},r.prototype.isFullscreen=function(n){if(void 0===n)return!!this.isFullscreen_;this.isFullscreen_=!!n},r.prototype.requestFullscreen=function(){var n=wo;this.isFullscreen(!0);n.requestFullscreen?(ii(u,n.fullscreenchange,s(this,function t(){this.isFullscreen(u[n.fullscreenElement]);!1===this.isFullscreen()&&vt(u,n.fullscreenchange,t);this.trigger("fullscreenchange")})),this.el_[n.requestFullscreen]()):this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):(this.enterFullWindow(),this.trigger("fullscreenchange"))},r.prototype.exitFullscreen=function(){var n=wo;this.isFullscreen(!1);n.requestFullscreen?u[n.exitFullscreen]():this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):(this.exitFullWindow(),this.trigger("fullscreenchange"))},r.prototype.enterFullWindow=function(){this.isFullWindow=!0;this.docOrigOverflow=u.documentElement.style.overflow;ii(u,"keydown",s(this,this.fullWindowOnEscKey));u.documentElement.style.overflow="hidden";ar(u.body,"vjs-full-window");this.trigger("enterFullWindow")},r.prototype.fullWindowOnEscKey=function(n){27===n.keyCode&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},r.prototype.exitFullWindow=function(){this.isFullWindow=!1;vt(u,"keydown",this.fullWindowOnEscKey);u.documentElement.style.overflow=this.docOrigOverflow;vf(u.body,"vjs-full-window");this.trigger("exitFullWindow")},r.prototype.canPlayType=function(n){for(var r,t,f=void 0,u=0,e=this.options_.techOrder;u<e.length;u++)if(r=e[u],t=y.getTech(r),t||(t=i.getComponent(r)),t){if(t.isSupported()&&(f=t.canPlayType(n)))return f}else l.error('The "'+r+'" tech is undefined. Skipped browser support check for that tech.');return""},r.prototype.selectSource=function(n){var t,f=this,i=this.options_.techOrder.map(function(n){return[n,y.getTech(n)]}).filter(function(n){var i=n[0],t=n[1];return t?t.isSupported():(l.error('The "'+i+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),r=function(n,t,i){var r=void 0;return n.some(function(n){return t.some(function(t){if(r=i(n,t))return!0})}),r},u=function(n,t){var i=n[0];if(n[1].canPlaySource(t,f.options_[i.toLowerCase()]))return{source:t,tech:i}};return(this.options_.sourceOrder?r(n,i,(t=u,function(n,i){return t(i,n)})):r(i,n,u))||!1},r.prototype.src=function(n){var t=this,i;if("undefined"==typeof n)return this.cache_.src||"";i=function r(n){if(Array.isArray(n)){var t=[];n.forEach(function(n){n=r(n);Array.isArray(n)?t=t.concat(n):nr(n)&&t.push(n)});n=t}else n="string"==typeof n&&n.trim()?[ig({src:n})]:nr(n)&&"string"==typeof n.src&&n.src&&n.src.trim()?[ig(n)]:[];return n}(n);i.length?(this.changingSrc_=!0,this.cache_.sources=i,this.updateSourceCaches_(i[0]),gst(this,i[0],function(n,r){var u,f;if(t.middleware_=r,t.cache_.sources=i,t.updateSourceCaches_(n),t.src_(n))return 1<i.length?t.src(i.slice(1)):(t.changingSrc_=!1,t.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0),void t.triggerReady());u=r;f=t.tech_;u.forEach(function(n){return n.setTech&&n.setTech(f)})})):this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0)},r.prototype.src_=function(n){var i,r,u=this,t=this.selectSource([n]);return!t||(i=t.tech,r=this.techName_,b(i)!==b(r)?(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(function(){u.changingSrc_=!1})):this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",n):this.techCall_("src",n.src);this.changingSrc_=!1},!0),!1)},r.prototype.load=function(){this.techCall_("load")},r.prototype.reset=function(){this.tech_&&this.tech_.clearTracks("text");this.loadTech_(this.options_.techOrder[0],null);this.techCall_("reset")},r.prototype.currentSources=function(){var n=this.currentSource(),t=[];return 0!==Object.keys(n).length&&t.push(n),this.cache_.sources||t},r.prototype.currentSource=function(){return this.cache_.source||{}},r.prototype.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},r.prototype.currentType=function(){return this.currentSource()&&this.currentSource().type||""},r.prototype.preload=function(n){return void 0!==n?(this.techCall_("setPreload",n),void(this.options_.preload=n)):this.techGet_("preload")},r.prototype.autoplay=function(n){if(void 0===n)return this.options_.autoplay||!1;var t=void 0;"string"==typeof n&&/(any|play|muted)/.test(n)?(this.options_.autoplay=n,this.manualAutoplay_(n),t=!1):this.options_.autoplay=!!n;t=t||this.options_.autoplay;this.tech_&&this.techCall_("setAutoplay",t)},r.prototype.playsinline=function(n){return void 0!==n?(this.techCall_("setPlaysinline",n),this.options_.playsinline=n,this):this.techGet_("playsinline")},r.prototype.loop=function(n){return void 0!==n?(this.techCall_("setLoop",n),void(this.options_.loop=n)):this.techGet_("loop")},r.prototype.poster=function(n){if(void 0===n)return this.poster_;n||(n="");n!==this.poster_&&(this.poster_=n,this.techCall_("setPoster",n),this.isPosterFromTech_=!1,this.trigger("posterchange"))},r.prototype.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var n=this.tech_.poster()||"";n!==this.poster_&&(this.poster_=n,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},r.prototype.controls=function(n){if(void 0===n)return!!this.controls_;n=!!n;this.controls_!==n&&(this.controls_=n,this.usingNativeControls()&&this.techCall_("setControls",n),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_()))},r.prototype.usingNativeControls=function(n){if(void 0===n)return!!this.usingNativeControls_;n=!!n;this.usingNativeControls_!==n&&(this.usingNativeControls_=n,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},r.prototype.error=function(n){return void 0===n?this.error_||null:null===n?(this.error_=n,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close())):(this.error_=new ut(n),this.addClass("vjs-error"),l.error("(CODE:"+this.error_.code+" "+ut.errorTypes[this.error_.code]+")",this.error_.message,this.error_),void this.trigger("error"))},r.prototype.reportUserActivity=function(){this.userActivity_=!0},r.prototype.userActive=function(n){if(void 0===n)return this.userActive_;if((n=!!n)!==this.userActive_){if(this.userActive_=n,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",function(n){n.stopPropagation();n.preventDefault()});this.userActivity_=!1;this.removeClass("vjs-user-active");this.addClass("vjs-user-inactive");this.trigger("userinactive")}},r.prototype.listenForUserActivity_=function(){var t=void 0,r=void 0,u=void 0,n=s(this,this.reportUserActivity),i;this.on("mousedown",function(){n();this.clearInterval(t);t=this.setInterval(n,250)});this.on("mousemove",function(t){t.screenX===r&&t.screenY===u||(r=t.screenX,u=t.screenY,n())});this.on("mouseup",function(){n();this.clearInterval(t)});this.on("keydown",n);this.on("keyup",n);i=void 0;this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1;this.userActive(!0);this.clearTimeout(i);var n=this.options_.inactivityTimeout;n<=0||(i=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},n))}},250)},r.prototype.playbackRate=function(n){if(void 0===n)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",n)},r.prototype.defaultPlaybackRate=function(n){return void 0!==n?this.techCall_("setDefaultPlaybackRate",n):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},r.prototype.isAudio=function(n){if(void 0===n)return!!this.isAudio_;this.isAudio_=!!n},r.prototype.addTextTrack=function(n,t,i){if(this.tech_)return this.tech_.addTextTrack(n,t,i)},r.prototype.addRemoteTextTrack=function(n,t){if(this.tech_)return this.tech_.addRemoteTextTrack(n,t)},r.prototype.removeRemoteTextTrack=function(){var n=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).track,t=void 0===n?arguments[0]:n;if(this.tech_)return this.tech_.removeRemoteTextTrack(t)},r.prototype.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},r.prototype.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},r.prototype.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},r.prototype.language=function(n){if(void 0===n)return this.language_;this.language_=String(n).toLowerCase()},r.prototype.languages=function(){return p(r.prototype.options_.languages,this.languages_)},r.prototype.toJSON=function(){var t=p(this.options_),r=t.tracks,n,i;for(t.tracks=[],n=0;n<r.length;n++)i=r[n],(i=p(i)).player=void 0,t.tracks[n]=i;return t},r.prototype.createModal=function(n,t){var r=this,i;return(t=t||{}).content=n||"",i=new au(this,t),this.addChild(i),i.on("dispose",function(){r.removeChild(i)}),i.open(),i},r.getTagSettings=function(n){var t={sources:[],tracks:[]},i=yi(n),e=i["data-setup"],r,f;if(eu(n,"vjs-fluid")&&(i.fluid=!0),null!==e){var o=ak(e||"{}"),s=o[0],c=o[1];s&&l.error(s);k(i,c)}if(k(t,i),n.hasChildNodes())for(var h=n.childNodes,u=0,a=h.length;u<a;u++)r=h[u],f=r.nodeName.toLowerCase(),"source"===f?t.sources.push(yi(r)):"track"===f&&t.tracks.push(yi(r));return t},r.prototype.flexNotSupported_=function(){var n=u.createElement("i");return!("flexBasis"in n.style||"webkitFlexBasis"in n.style||"mozFlexBasis"in n.style||"msFlexBasis"in n.style||"msFlexOrder"in n.style)},r}(i);lt.names.forEach(function(n){var t=lt[n];nt.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}});nt.players={};ku=t.navigator;nt.prototype.options_={techOrder:y.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:ku&&(ku.languages&&ku.languages[0]||ku.userLanguage||ku.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media."};["ended","seeking","seekable","networkState","readyState"].forEach(function(n){nt.prototype[n]=function(){return this.techGet_(n)}});an.forEach(function(n){nt.prototype["handleTech"+b(n)+"_"]=function(){return this.trigger(n)}});i.registerComponent("Player",nt);var nh="plugin",du="activePlugins_",gu={},th=function(n){return gu.hasOwnProperty(n)},ih=function(n){if(th(n))return gu[n]},vn=function(n,t){n[du]=n[du]||{};n[du][t]=!0},rh=function(n,t,i){var r=(i?"before":"")+"pluginsetup";n.trigger(r,t);n.trigger(r+":"+t.name,t)},yn=function(n,t){return t.prototype.name=n,function(){var r;rh(this,{name:n,plugin:t,instance:null},!0);for(var u=arguments.length,f=Array(u),i=0;i<u;i++)f[i]=arguments[i];return r=new(Function.prototype.bind.apply(t,[null].concat([this].concat(f)))),this[n]=function(){return r},rh(this,r.getEventHash()),r}},ci=function(){function n(t){if(f(this,n),this.constructor===n)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t;tl(this);delete this.trigger;tk(this,this.constructor.defaultState);vn(t,this.name);this.dispose=s(this,this.dispose);t.on("dispose",this.dispose)}return n.prototype.version=function(){return this.constructor.VERSION},n.prototype.getEventHash=function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return n.name=this.name,n.plugin=this.constructor,n.instance=this,n},n.prototype.trigger=function(n){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return hu(this.eventBusEl_,n,this.getEventHash(t))},n.prototype.handleStateChanged=function(){},n.prototype.dispose=function(){var n=this.name,t=this.player;this.trigger("dispose");this.off();t.off("dispose",this.dispose);t[du][n]=!1;this.player=this.state=null;t[n]=yn(n,gu[n])},n.isBasic=function(t){var i="string"==typeof t?ih(t):t;return"function"==typeof i&&!n.prototype.isPrototypeOf(i.prototype)},n.registerPlugin=function(t,i){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+("undefined"==typeof t?"undefined":d(t))+".");if(th(t))l.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(nt.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'+t+'", cannot share a name with an existing player method!');if("function"!=typeof i)throw new Error('Illegal plugin for "'+t+'", must be a function, was '+("undefined"==typeof i?"undefined":d(i))+".");var u,r,f;return gu[t]=i,t!==nh&&(nt.prototype[t]=n.isBasic(i)?(u=t,r=i,f=function(){rh(this,{name:u,plugin:r,instance:null},!0);var n=r.apply(this,arguments);return vn(this,u),rh(this,{name:u,plugin:r,instance:n}),n},Object.keys(r).forEach(function(n){f[n]=r[n]}),f):yn(t,i)),i},n.deregisterPlugin=function(n){if(n===nh)throw new Error("Cannot de-register base plugin.");th(n)&&(delete gu[n],delete nt.prototype[n])},n.getPlugins=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Object.keys(gu),n=void 0;return t.forEach(function(t){var i=ih(t);i&&((n=n||{})[t]=i)}),n},n.getPluginVersion=function(n){var t=ih(n);return t&&t.VERSION||""},n}();ci.getPlugin=ih;ci.BASE_PLUGIN_NAME=nh;ci.registerPlugin(nh,ci);nt.prototype.usingPlugin=function(n){return!!this[du]&&!0===this[du][n]};nt.prototype.hasPlugin=function(n){return!!th(n)};wv=function(n){return 0===n.indexOf("#")?n.slice(1):n};(n.hooks_={},n.hooks=function(t,i){return n.hooks_[t]=n.hooks_[t]||[],i&&(n.hooks_[t]=n.hooks_[t].concat(i)),n.hooks_[t]},n.hook=function(t,i){n.hooks(t,i)},n.hookOnce=function(t,i){n.hooks(t,[].concat(i).map(function(i){return function r(){return n.removeHook(t,r),i.apply(void 0,arguments)}}))},n.removeHook=function(t,i){var r=n.hooks(t).indexOf(i);return!(r<=-1)&&(n.hooks_[t]=n.hooks_[t].slice(),n.hooks_[t].splice(r,1),!0)},!0!==t.VIDEOJS_NO_DYNAMIC_STYLE&&fu())&&(le=tr(".vjs-styles-defaults"),le||(le=pb("vjs-styles-defaults"),uh=tr("head"),uh&&uh.insertBefore(le,uh.firstChild),wb(le,"\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid {\n        padding-top: 56.25%\n      }\n    ")));gc(1,n);n.VERSION=aw;n.options=nt.prototype.options_;n.getPlayers=function(){return nt.players};n.getPlayer=function(n){var i=nt.players,t=void 0,r,u;if("string"==typeof n){if(r=wv(n),u=i[r],u)return u;t=tr("#"+r)}else t=n;if(lf(t)){var f=t,e=f.player,o=f.playerId;if(e||i[o])return e||i[o]}};n.getAllPlayers=function(){return Object.keys(nt.players).map(function(n){return nt.players[n]}).filter(Boolean)};n.players=nt.players;n.getComponent=i.getComponent;n.registerComponent=function(n,t){y.isTech(t)&&l.warn("The "+n+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)");i.registerComponent.call(i,n,t)};n.getTech=y.getTech;n.registerTech=y.registerTech;n.use=function(n,t){kr[n]=kr[n]||[];kr[n].push(t)};Object.defineProperty(n,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(n.middleware,"TERMINATOR",{value:rs,writeable:!1,enumerable:!0});n.browser=sot;n.TOUCH_ENABLED=po;n.extend=function(n){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=function(){n.apply(this,arguments)},r={};for(var u in"object"===("undefined"==typeof t?"undefined":d(t))?(t.constructor!==Object.prototype.constructor&&(i=t.constructor),r=t):"function"==typeof t&&(i=t),function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":d(t)));n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(n.super_=t)}(i,n),r)r.hasOwnProperty(u)&&(i.prototype[u]=r[u]);return i};n.mergeOptions=p;n.bind=s;n.registerPlugin=ci.registerPlugin;n.deregisterPlugin=ci.deregisterPlugin;n.plugin=function(n,t){return l.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),ci.registerPlugin(n,t)};n.getPlugins=ci.getPlugins;n.getPlugin=ci.getPlugin;n.getPluginVersion=ci.getPluginVersion;n.addLanguage=function(t,i){var r;return t=(""+t).toLowerCase(),n.options.languages=p(n.options.languages,((r={})[t]=i,r)),n.options.languages[t]};n.log=l;n.createTimeRange=n.createTimeRanges=pr;n.formatTime=pu;n.setFormatTime=function(n){us=n};n.resetFormatTime=function(){us=pa};n.parseUrl=pl;n.isCrossOrigin=ns;n.EventTarget=ct;n.on=ii;n.one=bf;n.off=vt;n.trigger=hu;n.xhr=ed;n.TextTrack=te;n.AudioTrack=cd;n.VideoTrack=ld;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(t){n[t]=function(){return l.warn("videojs."+t+"() is deprecated; use videojs.dom."+t+"() instead"),cb[t].apply(null,arguments)}});n.computedStyle=ac;n.dom=cb;n.url=kot;var fh=sc(function(n){var i,r,u,f,t;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/;r=/^([^\/?#]*)(.*)$/;u=/(?:\/|^)\.(?=\/)/g;f=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g;t={buildAbsoluteURL:function(n,i,u){var s,f,e,h,o,c,l;if(u=u||{},n=n.trim(),!(i=i.trim())){if(!u.alwaysNormalize)return n;if(s=t.parseURL(n),!s)throw new Error("Error trying to parse base URL.");return s.path=t.normalizePath(s.path),t.buildURLFromParts(s)}if(f=t.parseURL(i),!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return u.alwaysNormalize?(f.path=t.normalizePath(f.path),t.buildURLFromParts(f)):i;if(e=t.parseURL(n),!e)throw new Error("Error trying to parse base URL.");return!e.netLoc&&e.path&&"/"!==e.path[0]&&(h=r.exec(e.path),e.netLoc=h[1],e.path=h[2]),e.netLoc&&!e.path&&(e.path="/"),o={scheme:e.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment},f.netLoc||(o.netLoc=e.netLoc,"/"===f.path[0])||(f.path?(c=e.path,l=c.substring(0,c.lastIndexOf("/")+1)+f.path,o.path=t.normalizePath(l)):(o.path=e.path,f.params||(o.params=e.params,f.query||(o.query=e.query)))),null===o.path&&(o.path=u.alwaysNormalize?t.normalizePath(f.path):f.path),t.buildURLFromParts(o)},parseURL:function(n){var t=i.exec(n);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(n){for(n=n.split("").reverse().join("").replace(u,"");n.length!==(n=n.replace(f,"")).length;);return n.split("").reverse().join("")},buildURLFromParts:function(n){return n.scheme+n.netLoc+n.path+n.params+n.query+n.fragment}};n.exports=t}),eh=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");},oht=Object.assign||function(n){for(var i,r,t=1;t<arguments.length;t++){i=arguments[t];for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])}return n},bv=function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":d(t)));n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)},kv=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":d(t))&&"function"!=typeof t?n:t},dv=function(){function n(){eh(this,n);this.listeners={}}return n.prototype.on=function(n,t){this.listeners[n]||(this.listeners[n]=[]);this.listeners[n].push(t)},n.prototype.off=function(n,t){if(!this.listeners[n])return!1;var i=this.listeners[n].indexOf(t);return this.listeners[n].splice(i,1),-1<i},n.prototype.trigger=function(n){var i=this.listeners[n],t=void 0,r=void 0,u=void 0;if(i)if(2===arguments.length)for(r=i.length,t=0;t<r;++t)i[t].call(this,arguments[1]);else for(u=Array.prototype.slice.call(arguments,1),r=i.length,t=0;t<r;++t)i[t].apply(this,u)},n.prototype.dispose=function(){this.listeners={}},n.prototype.pipe=function(n){this.on("data",function(t){n.push(t)})},n}(),sht=function(n){function t(){eh(this,t);var i=kv(this,n.call(this));return i.buffer="",i}return bv(t,n),t.prototype.push=function(n){var t=void 0;for(this.buffer+=n,t=this.buffer.indexOf("\n");-1<t;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(dv),ae=function(n){for(var i=n.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),u={},r=i.length,t=void 0;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),u[t[0]]=t[1]);return u},hht=function(n){function t(){eh(this,t);var i=kv(this,n.call(this));return i.customParsers=[],i}return bv(t,n),t.prototype.push=function(n){var i=void 0,t=void 0,f,r,u,e;if(0!==(n=n.replace(/^[\u0000\s]+|[\u0000\s]+$/g,"")).length)if("#"===n[0]){for(f=0;f<this.customParsers.length;f++)if(this.customParsers[f].call(this,n))return;if(0===n.indexOf("#EXT"))if(n=n.replace("\r",""),i=/^#EXTM3U/.exec(n))this.trigger("data",{type:"tag",tagType:"m3u"});else{if(i=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(n))return t={type:"tag",tagType:"inf"},i[1]&&(t.duration=parseFloat(i[1])),i[2]&&(t.title=i[2]),void this.trigger("data",t);if(i=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(n))return t={type:"tag",tagType:"targetduration"},i[1]&&(t.duration=parseInt(i[1],10)),void this.trigger("data",t);if(i=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(n))return t={type:"tag",tagType:"totalduration"},i[1]&&(t.duration=parseInt(i[1],10)),void this.trigger("data",t);if(i=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(n))return t={type:"tag",tagType:"version"},i[1]&&(t.version=parseInt(i[1],10)),void this.trigger("data",t);if(i=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(n))return t={type:"tag",tagType:"media-sequence"},i[1]&&(t.number=parseInt(i[1],10)),void this.trigger("data",t);if(i=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(n))return t={type:"tag",tagType:"discontinuity-sequence"},i[1]&&(t.number=parseInt(i[1],10)),void this.trigger("data",t);if(i=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(n))return t={type:"tag",tagType:"playlist-type"},i[1]&&(t.playlistType=i[1]),void this.trigger("data",t);if(i=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(n))return t={type:"tag",tagType:"byterange"},i[1]&&(t.length=parseInt(i[1],10)),i[2]&&(t.offset=parseInt(i[2],10)),void this.trigger("data",t);if(i=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(n))return t={type:"tag",tagType:"allow-cache"},i[1]&&(t.allowed=!/NO/.test(i[1])),void this.trigger("data",t);if(i=/^#EXT-X-MAP:?(.*)$/.exec(n)){if((t={type:"tag",tagType:"map"},i[1])&&(r=ae(i[1]),r.URI&&(t.uri=r.URI),r.BYTERANGE)){var o=r.BYTERANGE.split("@"),s=o[0],h=o[1];t.byterange={};s&&(t.byterange.length=parseInt(s,10));h&&(t.byterange.offset=parseInt(h,10))}this.trigger("data",t)}else if(i=/^#EXT-X-STREAM-INF:?(.*)$/.exec(n))(t={type:"tag",tagType:"stream-inf"},i[1])&&((t.attributes=ae(i[1]),t.attributes.RESOLUTION)&&(u=t.attributes.RESOLUTION.split("x"),e={},u[0]&&(e.width=parseInt(u[0],10)),u[1]&&(e.height=parseInt(u[1],10)),t.attributes.RESOLUTION=e),t.attributes.BANDWIDTH&&(t.attributes.BANDWIDTH=parseInt(t.attributes.BANDWIDTH,10)),t.attributes["PROGRAM-ID"]&&(t.attributes["PROGRAM-ID"]=parseInt(t.attributes["PROGRAM-ID"],10))),this.trigger("data",t);else{if(i=/^#EXT-X-MEDIA:?(.*)$/.exec(n))return t={type:"tag",tagType:"media"},i[1]&&(t.attributes=ae(i[1])),void this.trigger("data",t);if(i=/^#EXT-X-ENDLIST/.exec(n))this.trigger("data",{type:"tag",tagType:"endlist"});else if(i=/^#EXT-X-DISCONTINUITY/.exec(n))this.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(i=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(n))return t={type:"tag",tagType:"program-date-time"},i[1]&&(t.dateTimeString=i[1],t.dateTimeObject=new Date(i[1])),void this.trigger("data",t);if(i=/^#EXT-X-KEY:?(.*)$/.exec(n))return t={type:"tag",tagType:"key"},i[1]&&(t.attributes=ae(i[1]),t.attributes.IV&&("0x"===t.attributes.IV.substring(0,2).toLowerCase()&&(t.attributes.IV=t.attributes.IV.substring(2)),t.attributes.IV=t.attributes.IV.match(/.{8}/g),t.attributes.IV[0]=parseInt(t.attributes.IV[0],16),t.attributes.IV[1]=parseInt(t.attributes.IV[1],16),t.attributes.IV[2]=parseInt(t.attributes.IV[2],16),t.attributes.IV[3]=parseInt(t.attributes.IV[3],16),t.attributes.IV=new Uint32Array(t.attributes.IV))),void this.trigger("data",t);if(i=/^#EXT-X-START:?(.*)$/.exec(n))return t={type:"tag",tagType:"start"},i[1]&&(t.attributes=ae(i[1]),t.attributes["TIME-OFFSET"]=parseFloat(t.attributes["TIME-OFFSET"]),t.attributes.PRECISE=/YES/.test(t.attributes.PRECISE)),void this.trigger("data",t);if(i=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(n))return t={type:"tag",tagType:"cue-out-cont"},t.data=i[1]?i[1]:"",void this.trigger("data",t);if(i=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(n))return t={type:"tag",tagType:"cue-out"},t.data=i[1]?i[1]:"",void this.trigger("data",t);if(i=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n))return t={type:"tag",tagType:"cue-in"},t.data=i[1]?i[1]:"",void this.trigger("data",t);this.trigger("data",{type:"tag",data:n.slice(4)})}}}else this.trigger("data",{type:"comment",text:n.slice(1)})}else this.trigger("data",{type:"uri",uri:n})},t.prototype.addParser=function(n){var i=this,r=n.expression,u=n.customType,t=n.dataParser,f=n.segment;"function"!=typeof t&&(t=function(n){return n});this.customParsers.push(function(n){if(r.exec(n))return i.trigger("data",{type:"custom",data:t(n),customType:u,segment:f}),!0})},t}(dv),pn=function(n){function t(){var r;eh(this,t);r=kv(this,n.call(this));r.lineStream=new sht;r.parseStream=new hht;r.lineStream.pipe(r.parseStream);var s=r,e=[],i={},u=void 0,f=void 0,h={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},o=0;return r.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},r.parseStream.on("data",function(n){var r=void 0,t=void 0;({tag:function(){({"allow-cache":function(){this.manifest.allowCache=n.allowed;"allowed"in n||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in n&&((i.byterange=t).length=n.length,"offset"in n||(this.trigger("info",{message:"defaulting offset to zero"}),n.offset=0));"offset"in n&&((i.byterange=t).offset=n.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"}));"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"}));0<n.duration&&(i.duration=n.duration);0===n.duration&&(i.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"}));this.manifest.segments=e},key:function(){n.attributes?"NONE"!==n.attributes.METHOD?n.attributes.URI?(n.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),f={method:n.attributes.METHOD||"AES-128",uri:n.attributes.URI},"undefined"!=typeof n.attributes.IV&&(f.iv=n.attributes.IV)):this.trigger("warn",{message:"ignoring key declaration without URI"}):f=null:this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(n.number)?this.manifest.mediaSequence=n.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+n.number})},"discontinuity-sequence":function(){isFinite(n.number)?(this.manifest.discontinuitySequence=n.number,o=n.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+n.number})},"playlist-type":function(){/VOD|EVENT/.test(n.playlistType)?this.manifest.playlistType=n.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+n.playlist})},map:function(){u={};n.uri&&(u.uri=n.uri);n.byterange&&(u.byterange=n.byterange)},"stream-inf":function(){this.manifest.playlists=e;this.manifest.mediaGroups=this.manifest.mediaGroups||h;n.attributes?(i.attributes||(i.attributes={}),oht(i.attributes,n.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||h,n.attributes&&n.attributes.TYPE&&n.attributes["GROUP-ID"]&&n.attributes.NAME){var i=this.manifest.mediaGroups[n.attributes.TYPE];i[n.attributes["GROUP-ID"]]=i[n.attributes["GROUP-ID"]]||{};r=i[n.attributes["GROUP-ID"]];t.autoselect=(t={"default":/yes/i.test(n.attributes.DEFAULT)}).default?!0:/yes/i.test(n.attributes.AUTOSELECT);n.attributes.LANGUAGE&&(t.language=n.attributes.LANGUAGE);n.attributes.URI&&(t.uri=n.attributes.URI);n.attributes["INSTREAM-ID"]&&(t.instreamId=n.attributes["INSTREAM-ID"]);n.attributes.CHARACTERISTICS&&(t.characteristics=n.attributes.CHARACTERISTICS);n.attributes.FORCED&&(t.forced=/yes/i.test(n.attributes.FORCED));r[n.attributes.NAME]=t}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){o+=1;i.discontinuity=!0;this.manifest.discontinuityStarts.push(e.length)},"program-date-time":function(){"undefined"==typeof this.manifest.dateTimeString&&(this.manifest.dateTimeString=n.dateTimeString,this.manifest.dateTimeObject=n.dateTimeObject);i.dateTimeString=n.dateTimeString;i.dateTimeObject=n.dateTimeObject},targetduration:function(){!isFinite(n.duration)||n.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+n.duration}):this.manifest.targetDuration=n.duration},totalduration:function(){!isFinite(n.duration)||n.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+n.duration}):this.manifest.totalDuration=n.duration},start:function(){n.attributes&&!isNaN(n.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:n.attributes["TIME-OFFSET"],precise:n.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){i.cueOut=n.data},"cue-out-cont":function(){i.cueOutCont=n.data},"cue-in":function(){i.cueIn=n.data}}[n.tagType]||function(){}).call(s)},uri:function(){i.uri=n.uri;e.push(i);!this.manifest.targetDuration||"duration"in i||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),i.duration=this.manifest.targetDuration);f&&(i.key=f);i.timeline=o;u&&(i.map=u);i={}},comment:function(){},custom:function(){n.segment?(i.custom=i.custom||{},i.custom[n.customType]=n.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[n.customType]=n.data)}})[n.type].call(s)}),r}return bv(t,n),t.prototype.push=function(n){this.lineStream.push(n)},t.prototype.end=function(){this.lineStream.push("\n")},t.prototype.addParser=function(n){this.parseStream.addParser(n)},t}(dv),cht=function(n){var i,t=n.attributes,r=n.segments,u={attributes:(i={NAME:t.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:t.width,height:t.height},CODECS:t.codecs,BANDWIDTH:t.bandwidth},i["PROGRAM-ID"]=1,i),uri:"",endList:"static"===(t.type||"static"),timeline:t.periodIndex,resolvedUri:"",targetDuration:t.duration,segments:r,mediaSequence:r.length?r[0].number:1};return t.contentProtection&&(u.contentProtection=t.contentProtection),u},lht="function"==typeof Symbol&&"symbol"===d(Symbol.iterator)?function(n){return"undefined"==typeof n?"undefined":d(n)}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":"undefined"==typeof n?"undefined":d(n)},wn=function(n){return!!n&&"object"===("undefined"==typeof n?"undefined":lht(n))},pt=function hc(){for(var t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.reduce(function(n,t){return Object.keys(t).forEach(function(i){n[i]=Array.isArray(n[i])&&Array.isArray(t[i])?n[i].concat(t[i]):wn(n[i])&&wn(t[i])?hc(n[i],t[i]):t[i]}),n},{})},gv=function(n,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(n)||(n=fh.buildAbsoluteURL(t.location.href,n)),fh.buildAbsoluteURL(n,i))},ve=function(n){var t=n.baseUrl,h=void 0===t?"":t,i=n.source,r=void 0===i?"":i,u=n.range,f=void 0===u?"":u,e={uri:r,resolvedUri:gv(h||"",r)};if(f){var o=f.split("-"),s=parseInt(o[0],10),c=parseInt(o[1],10);e.byterange={length:c-s,offset:s}}return e},bn=function(n,t){for(var u,y,ct,h,r,p,w,b,k,d,c,g,l,nt,a,tt,it=n.type,lt=void 0===it?"static":it,rt=n.minimumUpdatePeriod,at=void 0===rt?0:rt,ut=n.media,vt=void 0===ut?"":ut,yt=n.sourceDuration,ft=n.timescale,et=void 0===ft?1:ft,ot=n.startNumber,st=void 0===ot?1:ot,pt=n.periodIndex,e=[],i=-1,o=0;o<t.length;o++){var v=t[o],f=v.d,ht=v.r||0,s=v.t||0;for(i<0&&(i=s),s&&i<s&&(i=s),u=void 0,ht<0?(y=o+1,y===t.length?"dynamic"===lt&&0<at&&0<vt.indexOf("$Number$")?(p=i,w=f,void 0,b=(r=n).NOW,k=r.clientOffset,d=r.availabilityStartTime,c=r.timescale,g=void 0===c?1:c,l=r.start,nt=void 0===l?0:l,a=r.minimumUpdatePeriod,tt=(b+k)/1e3+(void 0===a?0:a)-(d+nt),u=Math.ceil((tt*g-p)/w)):u=(yt*et-i)/f:u=(t[y].t-i)/f):u=ht+1,ct=st+e.length+u,h=st+e.length;h<ct;)e.push({number:h,duration:f/et,time:i,timeline:pt}),i+=f,h++}return e},oh=function(n){return n.reduce(function(n,t){return n.concat(t)},[])},kn=function(n){if(!n.length)return[];for(var i=[],t=0;t<n.length;t++)i.push(n[t]);return i},aht={static:function(n){var i=n.duration,t=n.timescale,r=void 0===t?1:t,u=n.sourceDuration;return{start:0,end:Math.ceil(u/(i/r))}},dynamic:function(n){var h=n.NOW,c=n.clientOffset,l=n.availabilityStartTime,f=n.timescale,t=void 0===f?1:f,i=n.duration,e=n.start,a=void 0===e?0:e,o=n.minimumUpdatePeriod,v=void 0===o?0:o,s=n.timeShiftBufferDepth,y=void 0===s?1/0:s,r=(h+c)/1e3,u=l+a,p=r+v-u,w=Math.ceil(p*t/i),b=Math.floor((r-u-y)*t/i),k=Math.floor((r-u)*t/i);return{start:Math.max(0,b),end:Math.min(w,k)}}},ny=function(n){var t,u=n.type,f=void 0===u?"static":u,s=n.duration,e=n.timescale,h=void 0===e?1:e,c=n.sourceDuration,o=aht[f](n),i=function(n,t){for(var r=[],i=n;i<t;i++)r.push(i);return r}(o.start,o.end).map((t=n,function(n,i){var r=t.duration,u=t.timescale,e=void 0===u?1:u,o=t.periodIndex,f=t.startNumber;return{number:(void 0===f?1:f)+n,duration:r/e,timeline:o,time:i*r}})),r;return"static"===f&&(r=i.length-1,i[r].duration=c-s/h*r),i},vht=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,dn=function(n,t){return n.replace(vht,(i=t,function(n,t,r,u){if("$$"===n)return"$";if("undefined"==typeof i[t])return n;var f=""+i[t];return"RepresentationID"===t?f:(u=r?parseInt(u,10):1)<=f.length?f:""+new Array(u-f.length+1).join("0")+f}));var i},yht=function(n,t){var i,u,r={RepresentationID:n.id,Bandwidth:n.bandwidth||0},f=n.initialization,e=void 0===f?{sourceURL:"",range:""}:f,o=ve({baseUrl:n.baseUrl,source:dn(e.sourceURL,r),range:e.range});return(u=t,(i=n).duration||u?i.duration?ny(i):bn(i,u):[{number:i.startNumber||1,duration:i.sourceDuration,time:0,timeline:i.periodIndex}]).map(function(t){r.Number=t.number;r.Time=t.time;var i=dn(n.media||"",r);return{uri:i,timeline:t.timeline,duration:t.duration,resolvedUri:gv(n.baseUrl||"",i),map:o,number:t.number}})},pht="INVALID_NUMBER_OF_PERIOD",wht="DASH_EMPTY_MANIFEST",bht="DASH_INVALID_XML",kht="NO_BASE_URL",dht="SEGMENT_TIME_UNSPECIFIED",ght="UNSUPPORTED_UTC_TIMING_SCHEME",nct=function(n,t){var r=n.duration,f=n.segmentUrls,e=void 0===f?[]:f,u,i;if(!r&&!t||r&&t)throw new Error(dht);return u=e.map(function(t){return i=t,r=(f=n).baseUrl,u=f.initialization,o=ve({baseUrl:r,source:(e=void 0===u?{}:u).sourceURL,range:e.range}),(s=ve({baseUrl:r,source:i.media,range:i.mediaRange})).map=o,s;var f,i,r,u,e,o,s}),i=void 0,r&&(i=ny(n)),t&&(i=bn(n,t)),i.map(function(n,t){if(u[t]){var i=u[t];return i.timeline=n.timeline,i.duration=n.duration,i.number=n.number,i}}).filter(function(n){return n})},tct=function(n){var i=n.baseUrl,u=n.initialization,f=void 0===u?{}:u,e=n.sourceDuration,o=n.timescale,c=void 0===o?1:o,s=n.indexRange,l=void 0===s?"":s,a=n.duration,h,t,r;if(!i)throw new Error(kht);return h=ve({baseUrl:i,source:f.sourceURL,range:f.range}),t=ve({baseUrl:i,source:i,range:l}),(t.map=h,a)?(r=ny(n),r.length&&(t.duration=r[0].duration,t.timeline=r[0].timeline)):e&&(t.duration=e/c,t.timeline=0),t.number=0,[t]},ict=function(n){var u=n.attributes,i=n.segmentInfo,t=void 0,r=void 0,f;if(i.template?(r=yht,t=pt(u,i.template)):i.base?(r=tct,t=pt(u,i.base)):i.list&&(r=nct,t=pt(u,i.list)),!r)return{attributes:u};if(f=r(t,i.timeline),t.duration){var e=t,s=e.duration,o=e.timescale,h=void 0===o?1:o;t.duration=s/h}else t.duration=f.length?f.reduce(function(n,t){return Math.max(n,Math.ceil(t.duration))},0):0;return{attributes:t,segments:f}},tt=function(n,t){return kn(n.childNodes).filter(function(n){return n.tagName===t})},gn=function(n){return n.textContent.trim()},ye=function(n){var i=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(n);if(!i)return 0;var t=i.slice(1),r=t[0],u=t[1],f=t[2],e=t[3],o=t[4],s=t[5];return 31536e3*parseFloat(r||0)+2592e3*parseFloat(u||0)+86400*parseFloat(f||0)+3600*parseFloat(e||0)+60*parseFloat(o||0)+parseFloat(s||0)},ntt={mediaPresentationDuration:function(n){return ye(n)},availabilityStartTime:function(n){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=n)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(n){return ye(n)},timeShiftBufferDepth:function(n){return ye(n)},start:function(n){return ye(n)},width:function(n){return parseInt(n,10)},height:function(n){return parseInt(n,10)},bandwidth:function(n){return parseInt(n,10)},startNumber:function(n){return parseInt(n,10)},timescale:function(n){return parseInt(n,10)},duration:function(n){var t=parseInt(n,10);return isNaN(t)?ye(n):t},d:function(n){return parseInt(n,10)},t:function(n){return parseInt(n,10)},r:function(n){return parseInt(n,10)},DEFAULT:function(n){return n}},et=function(n){return n&&n.attributes?kn(n.attributes).reduce(function(n,t){var i=ntt[t.name]||ntt.DEFAULT;return n[t.name]=i(t.value),n},{}):{}},ui,ty,c,ttt,itt,rtt,utt,ftt,ett,iy,ott,stt,htt,ctt,ltt,att,vtt,ytt,ptt,wtt,btt,ktt,ry,h,uy,dtt,gtt,nit,tit,iit,rit,uit,fit,sh,eit,oit,sit,hit,cit,lit,ait,fy,rct={"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"},hh=function(n,t){return t.length?oh(n.map(function(n){return t.map(function(t){return gv(n,gn(t))})})):n},ey=function(n){var f=tt(n,"SegmentTemplate")[0],i=tt(n,"SegmentList")[0],c=i&&tt(i,"SegmentURL").map(function(n){return pt({tag:"SegmentURL"},et(n))}),e=tt(n,"SegmentBase")[0],o=i||f,s=o&&tt(o,"SegmentTimeline")[0],h=i||e||f,r=h&&tt(h,"Initialization")[0],t=f&&et(f),u;return t&&r?t.initialization=r&&et(r):t&&t.initialization&&(t.initialization={sourceURL:t.initialization}),u={template:t,timeline:s&&tt(s,"S").map(function(n){return et(n)}),list:i&&pt(et(i),{segmentUrls:c,initialization:et(r)}),base:e&&pt(et(e),{initialization:et(r)})},Object.keys(u).forEach(function(n){u[n]||delete u[n]}),u},uct=function(n){return n.reduce(function(n,i){var e=et(i),r=rct[e.schemeIdUri],u,f,o;return r&&(n[r]={attributes:e},u=tt(i,"cenc:pssh")[0],u&&(f=gn(u),o=f&&function(n){for(var r=t.atob(n),u=new Uint8Array(r.length),i=0;i<r.length;i++)u[i]=r.charCodeAt(i);return u}(f),n[r].pssh=o)),n},{})},fct=function(n,t,i){return function(r){var h=et(r),c=hh(t,tt(r,"BaseURL")),l=tt(r,"Role")[0],a={role:et(l)},u=pt(n,h,a),f=uct(tt(r,"ContentProtection"));Object.keys(f).length&&(u=pt(u,{contentProtection:f}));var e,o,s,v=ey(r),y=tt(r,"Representation"),p=pt(i,v);return oh(y.map((e=u,o=c,s=p,function(n){var t=tt(n,"BaseURL"),i=hh(o,t),r=pt(e,et(n)),u=ey(n);return i.map(function(n){return{segmentInfo:pt(s,u),attributes:pt(r,{baseUrl:n})}})})))}},ect=function(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=i.manifestUri,c=void 0===r?"":r,u=i.NOW,l=void 0===u?Date.now():u,f=i.clientOffset,a=void 0===f?0:f,e=tt(n,"Period"),o,s,t,h;if(1!==e.length)throw new Error(pht);return t=et(n),h=hh([c],tt(n,"BaseURL")),t.sourceDuration=t.mediaPresentationDuration||0,t.NOW=l,t.clientOffset=a,oh(e.map((o=t,s=h,function(n,t){var i=hh(s,tt(n,"BaseURL")),r=et(n),u=pt(o,r,{periodIndex:t}),f=tt(n,"AdaptationSet"),e=ey(n);return oh(f.map(fct(u,i,e)))})))},vit=function(n){if(""===n)throw new Error(wht);var r=(new t.DOMParser).parseFromString(n,"application/xml"),i=r&&"MPD"===r.documentElement.tagName?r.documentElement:null;if(!i||i&&0<i.getElementsByTagName("parsererror").length)throw new Error(bht);return i},oct=function(n,t){return function(n){var t;if(!n.length)return{};var r=n[0].attributes,o=r.sourceDuration,u=r.minimumUpdatePeriod,s=void 0===u?0:u,h=n.filter(function(n){var t=n.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType}).map(cht),f=n.filter(function(n){var t=n.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType}),e=n.filter(function(n){var t=n.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType}),i={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(t={AUDIO:{},VIDEO:{}},t["CLOSED-CAPTIONS"]={},t.SUBTITLES={},t),uri:"",duration:o,playlists:h,minimumUpdatePeriod:1e3*s};return f.length&&(i.mediaGroups.AUDIO.audio=f.reduce(function(n,t){var f,e,i,r,o,s=t.attributes.role&&t.attributes.role.value||"main",h=t.attributes.lang||"",u="main";return h&&(u=t.attributes.lang+" ("+s+")"),n[u]&&n[u].playlists[0].attributes.BANDWIDTH>t.attributes.bandwidth||(n[u]={language:h,autoselect:!0,"default":"main"===s,playlists:[(f=t,i=f.attributes,r=f.segments,o={attributes:(e={NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs},e["PROGRAM-ID"]=1,e),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:r,mediaSequence:r.length?r[0].number:1},i.contentProtection&&(o.contentProtection=i.contentProtection),o)],uri:""}),n},{})),e.length&&(i.mediaGroups.SUBTITLES.subs=e.reduce(function(n,t){var u,f,i,r,e=t.attributes.lang||"text";return n[e]||(n[e]={language:e,"default":!1,autoselect:!1,playlists:[(u=t,i=u.attributes,r=u.segments,"undefined"==typeof r&&(r=[{uri:i.baseUrl,timeline:i.periodIndex,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration),{attributes:(f={NAME:i.id,BANDWIDTH:i.bandwidth},f["PROGRAM-ID"]=1,f),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:i.baseUrl||"",targetDuration:i.duration,segments:r,mediaSequence:r.length?r[0].number:1})],uri:""}),n},{})),i}(ect(vit(n),t).map(ict))},sct=function(n){return function(n){var i=tt(n,"UTCTiming")[0],t;if(!i)return null;t=et(i);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.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":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT";t.value=Date.parse(t.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(ght);}return t}(vit(n))},ch={toUnsigned:function(n){return n>>>0}},hct=ch.toUnsigned,yit=Object.freeze({"default":ch,__moduleExports:ch,toUnsigned:hct}),nf=(yit&&ch||yit).toUnsigned,fi={findBox:ui=function(n,t){var i,f,e,r,o,u=[];if(!t.length)return null;for(i=0;i<n.byteLength;)f=nf(n[i]<<24|n[i+1]<<16|n[i+2]<<8|n[i+3]),e=ty(n.subarray(i+4,i+8)),r=1<f?i+f:n.byteLength,e===t[0]&&(1===t.length?u.push(n.subarray(i+8,r)):(o=ui(n.subarray(i+8,r),t.slice(1))).length&&(u=u.concat(o))),i=r;return u},parseType:ty=function(n){var t="";return t+=String.fromCharCode(n[0]),t+=String.fromCharCode(n[1]),t+=String.fromCharCode(n[2]),t+String.fromCharCode(n[3])},timescale:function(n){return ui(n,["moov","trak"]).reduce(function(n,t){var r,f,i,e,u;return(r=ui(t,["tkhd"])[0])?(f=r[0],e=nf(r[i=0===f?12:20]<<24|r[i+1]<<16|r[i+2]<<8|r[i+3]),(u=ui(t,["mdia","mdhd"])[0])?(i=0===(f=u[0])?12:20,n[e]=nf(u[i]<<24|u[i+1]<<16|u[i+2]<<8|u[i+3]),n):null):null},{})},startTime:function(n,t){var r,u,i;return r=ui(t,["moof","traf"]),u=[].concat.apply([],r.map(function(t){return ui(t,["tfhd"]).map(function(i){var r,u;return r=nf(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),u=n[r]||9e4,(ui(t,["tfdt"]).map(function(n){var i,t;return i=n[0],t=nf(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),1===i&&(t*=Math.pow(2,32),t+=nf(n[8]<<24|n[9]<<16|n[10]<<8|n[11])),t})[0]||1/0)/u})})),i=Math.min.apply(null,u),isFinite(i)?i:0},videoTrackIds:function(n){var i=ui(n,["moov","trak"]),t=[];return i.forEach(function(n){var i=ui(n,["mdia","hdlr"]),r=ui(n,["tkhd"]);i.forEach(function(n,i){var u,e,o=ty(n.subarray(8,12)),f=r[i];"vide"===o&&(e=0===(u=new DataView(f.buffer,f.byteOffset,f.byteLength)).getUint8(0)?u.getUint32(12):u.getUint32(20),t.push(e))})}),t}},pit=Math.pow(2,32)-1;!function(){var n;if(h={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(n in h)h.hasOwnProperty(n)&&(h[n]=[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]);uy=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]);gtt=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]);dtt=new Uint8Array([0,0,0,1]);nit=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]);tit=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);iit={video:nit,audio:tit};fit=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);uit=new Uint8Array([0,0,0,0,0,0,0,0]);sh=new Uint8Array([0,0,0,0,0,0,0,0]);eit=sh;oit=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);sit=sh;rit=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}();c=function(n){for(var i,r=[],u=0,t=1;t<arguments.length;t++)r.push(arguments[t]);for(t=r.length;t--;)u+=r[t].byteLength;for(i=new Uint8Array(u+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(n,4),t=0,u=8;t<r.length;t++)i.set(r[t],u),u+=r[t].byteLength;return i};ttt=function(){return c(h.dinf,c(h.dref,fit))};itt=function(n){return c(h.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,n.audioobjecttype<<3|n.samplingfrequencyindex>>>1,n.samplingfrequencyindex<<7|n.channelcount<<3,6,1,2]))};vtt=function(n){return c(h.hdlr,iit[n])};att=function(n){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,n.duration>>>24&255,n.duration>>>16&255,n.duration>>>8&255,255&n.duration,85,196,0,0]);return n.samplerate&&(t[12]=n.samplerate>>>24&255,t[13]=n.samplerate>>>16&255,t[14]=n.samplerate>>>8&255,t[15]=255&n.samplerate),c(h.mdhd,t)};ltt=function(n){return c(h.mdia,att(n),vtt(n.type),ftt(n))};utt=function(n){return c(h.mfhd,new Uint8Array([0,0,0,0,(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n]))};ftt=function(n){return c(h.minf,"video"===n.type?c(h.vmhd,rit):c(h.smhd,uit),ttt(),ptt(n))};ett=function(n,t){for(var r=[],i=t.length;i--;)r[i]=btt(t[i]);return c.apply(null,[h.moof,utt(n)].concat(r))};iy=function(n){for(var t=n.length,i=[];t--;)i[t]=htt(n[t]);return c.apply(null,[h.moov,stt(4294967295)].concat(i).concat(ott(n)))};ott=function(n){for(var t=n.length,i=[];t--;)i[t]=ktt(n[t]);return c.apply(null,[h.mvex].concat(i))};stt=function(n){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n,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 c(h.mvhd,t)};ytt=function(n){for(var i,r=n.samples||[],u=new Uint8Array(4+r.length),t=0;t<r.length;t++)i=r[t].flags,u[t+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return c(h.sdtp,u)};ptt=function(n){return c(h.stbl,wtt(n),c(h.stts,sit),c(h.stsc,eit),c(h.stsz,oit),c(h.stco,sh))};wtt=function(n){return c(h.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===n.type?hit(n):cit(n))};hit=function(n){for(var i=n.sps||[],r=n.pps||[],u=[],f=[],t=0;t<i.length;t++)u.push((65280&i[t].byteLength)>>>8),u.push(255&i[t].byteLength),u=u.concat(Array.prototype.slice.call(i[t]));for(t=0;t<r.length;t++)f.push((65280&r[t].byteLength)>>>8),f.push(255&r[t].byteLength),f=f.concat(Array.prototype.slice.call(r[t]));return c(h.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&n.width)>>8,255&n.width,(65280&n.height)>>8,255&n.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c(h.avcC,new Uint8Array([1,n.profileIdc,n.profileCompatibility,n.levelIdc,255].concat([i.length]).concat(u).concat([r.length]).concat(f))),c(h.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))};cit=function(n){return c(h.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&n.channelcount)>>8,255&n.channelcount,(65280&n.samplesize)>>8,255&n.samplesize,0,0,0,0,(65280&n.samplerate)>>8,255&n.samplerate,0,0]),itt(n))};ctt=function(n){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&n.id)>>24,(16711680&n.id)>>16,(65280&n.id)>>8,255&n.id,0,0,0,0,(4278190080&n.duration)>>24,(16711680&n.duration)>>16,(65280&n.duration)>>8,255&n.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&n.width)>>8,255&n.width,0,0,(65280&n.height)>>8,255&n.height,0,0]);return c(h.tkhd,t)};btt=function(n){var u,f,r,e,t,i;return u=c(h.tfhd,new Uint8Array([0,0,0,58,(4278190080&n.id)>>24,(16711680&n.id)>>16,(65280&n.id)>>8,255&n.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),t=Math.floor(n.baseMediaDecodeTime/(pit+1)),i=Math.floor(n.baseMediaDecodeTime%(pit+1)),f=c(h.tfdt,new Uint8Array([1,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),"audio"===n.type?(r=ry(n,92),c(h.traf,u,f,r)):(e=ytt(n),r=ry(n,e.length+92),c(h.traf,u,f,r,e))};htt=function(n){return n.duration=n.duration||4294967295,c(h.trak,ctt(n),ltt(n))};ktt=function(n){var t=new Uint8Array([0,0,0,0,(4278190080&n.id)>>24,(16711680&n.id)>>16,(65280&n.id)>>8,255&n.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==n.type&&(t[t.length-1]=0),c(h.trex,t)};fy=function(n,t){var i=0,r=0,u=0,f=0;return n.length&&(void 0!==n[0].duration&&(i=1),void 0!==n[0].size&&(r=2),void 0!==n[0].flags&&(u=4),void 0!==n[0].compositionTimeOffset&&(f=8)),[0,0,i|r|u|f,1,(4278190080&n.length)>>>24,(16711680&n.length)>>>16,(65280&n.length)>>>8,255&n.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]};ait=function(n,t){var r,u,i,f;for(t+=20+16*(u=n.samples||[]).length,r=fy(u,t),f=0;f<u.length;f++)i=u[f],r=r.concat([(4278190080&i.duration)>>>24,(16711680&i.duration)>>>16,(65280&i.duration)>>>8,255&i.duration,(4278190080&i.size)>>>24,(16711680&i.size)>>>16,(65280&i.size)>>>8,255&i.size,i.flags.isLeading<<2|i.flags.dependsOn,i.flags.isDependedOn<<6|i.flags.hasRedundancy<<4|i.flags.paddingValue<<1|i.flags.isNonSyncSample,61440&i.flags.degradationPriority,15&i.flags.degradationPriority,(4278190080&i.compositionTimeOffset)>>>24,(16711680&i.compositionTimeOffset)>>>16,(65280&i.compositionTimeOffset)>>>8,255&i.compositionTimeOffset]);return c(h.trun,new Uint8Array(r))};lit=function(n,t){var r,u,i,f;for(t+=20+8*(u=n.samples||[]).length,r=fy(u,t),f=0;f<u.length;f++)i=u[f],r=r.concat([(4278190080&i.duration)>>>24,(16711680&i.duration)>>>16,(65280&i.duration)>>>8,255&i.duration,(4278190080&i.size)>>>24,(16711680&i.size)>>>16,(65280&i.size)>>>8,255&i.size]);return c(h.trun,new Uint8Array(r))};ry=function(n,t){return"audio"===n.type?lit(n,t):ait(n,t)};var fr={ftyp:rtt=function(){return c(h.ftyp,uy,dtt,uy,gtt)},mdat:function(n){return c(h.mdat,n)},moof:ett,moov:iy,initSegment:function(n){var t,i=rtt(),r=iy(n);return(t=new Uint8Array(i.byteLength+r.byteLength)).set(i),t.set(r,i.byteLength),t}},cct=fr.ftyp,lct=fr.mdat,act=fr.moof,vct=fr.moov,yct=fr.initSegment,wit=Object.freeze({"default":fr,__moduleExports:fr,ftyp:cct,mdat:lct,moof:act,moov:vct,initSegment:yct}),lh=function(){this.init=function(){var n={};this.on=function(t,i){n[t]||(n[t]=[]);n[t]=n[t].concat(i)};this.off=function(t,i){var r;return!!n[t]&&(r=n[t].indexOf(i),n[t]=n[t].slice(),n[t].splice(r,1),-1<r)};this.trigger=function(t){var r,i,u,f;if(r=n[t])if(2===arguments.length)for(u=r.length,i=0;i<u;++i)r[i].call(this,arguments[1]);else{for(f=[],i=arguments.length,i=1;i<arguments.length;++i)f.push(arguments[i]);for(u=r.length,i=0;i<u;++i)r[i].apply(this,f)}};this.dispose=function(){n={}}}};lh.prototype.pipe=function(n){return this.on("data",function(t){n.push(t)}),this.on("done",function(t){n.flush(t)}),n};lh.prototype.push=function(n){this.trigger("data",n)};lh.prototype.flush=function(n){this.trigger("done",n)};var oy=lh,bit=Object.freeze({"default":oy,__moduleExports:oy}),er={groupNalsIntoFrames:function(n){for(var i,t=[],r=[],u=t.byteLength=0;u<n.length;u++)"access_unit_delimiter_rbsp"===(i=n[u]).nalUnitType?(t.length&&(t.duration=i.dts-t.dts,r.push(t)),(t=[i]).byteLength=i.data.byteLength,t.pts=i.pts,t.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(t.keyFrame=!0),t.duration=i.dts-t.dts,t.byteLength+=i.data.byteLength,t.push(i));return r.length&&(!t.duration||t.duration<=0)&&(t.duration=r[r.length-1].duration),r.push(t),r},groupFramesIntoGops:function(n){var u,r,t=[],i=[];for(t.byteLength=0,t.nalCount=0,t.duration=0,t.pts=n[0].pts,t.dts=n[0].dts,i.byteLength=0,i.nalCount=0,i.duration=0,i.pts=n[0].pts,i.dts=n[0].dts,u=0;u<n.length;u++)(r=n[u]).keyFrame?(t.length&&(i.push(t),i.byteLength+=t.byteLength,i.nalCount+=t.nalCount,i.duration+=t.duration),(t=[r]).nalCount=r.length,t.byteLength=r.byteLength,t.pts=r.pts,t.dts=r.dts,t.duration=r.duration):(t.duration+=r.duration,t.nalCount+=r.length,t.byteLength+=r.byteLength,t.push(r));return i.length&&t.duration<=0&&(t.duration=i[i.length-1].duration),i.byteLength+=t.byteLength,i.nalCount+=t.nalCount,i.duration+=t.duration,i.push(t),i},extendFirstKeyFrame:function(n){var t;return!n[0][0].keyFrame&&1<n.length&&(t=n.shift(),n.byteLength-=t.byteLength,n.nalCount-=t.nalCount,n[0][0].dts=t.dts,n[0][0].pts=t.pts,n[0][0].duration+=t.duration),n},generateSampleTable:function(n,t){for(var f,o,e,s,r,i,h=t||0,c=[],u=0;u<n.length;u++)for(e=n[u],f=0;f<e.length;f++)s=e[f],r=s,i=void 0,(i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}).dataOffset=h,i.compositionTimeOffset=r.pts-r.dts,i.duration=r.duration,i.size=4*r.length,i.size+=r.byteLength,r.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),h+=(o=i).size,c.push(o);return c},concatenateNalData:function(n){for(var i,r,e,o,u,f=0,h=n.byteLength,c=n.nalCount,s=new Uint8Array(h+4*c),l=new DataView(s.buffer),t=0;t<n.length;t++)for(e=n[t],i=0;i<e.length;i++)for(o=e[i],r=0;r<o.length;r++)u=o[r],l.setUint32(f,u.data.byteLength),f+=4,s.set(u.data,f),f+=u.data.byteLength;return s}},pct=er.groupNalsIntoFrames,wct=er.groupFramesIntoGops,bct=er.extendFirstKeyFrame,kct=er.generateSampleTable,dct=er.concatenateNalData,kit=Object.freeze({"default":er,__moduleExports:er,groupNalsIntoFrames:pct,groupFramesIntoGops:wct,extendFirstKeyFrame:bct,generateSampleTable:kct,concatenateNalData:dct}),tf={clearDtsInfo:function(n){delete n.minSegmentDts;delete n.maxSegmentDts;delete n.minSegmentPts;delete n.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(n,t){var i,r=n.minSegmentDts;return t||(r-=n.timelineStartInfo.dts),i=n.timelineStartInfo.baseMediaDecodeTime,i+=r,i=Math.max(0,i),"audio"===n.type&&(i*=n.samplerate/9e4,i=Math.floor(i)),i},collectDtsInfo:function(n,t){"number"==typeof t.pts&&(void 0===n.timelineStartInfo.pts&&(n.timelineStartInfo.pts=t.pts),n.minSegmentPts=void 0===n.minSegmentPts?t.pts:Math.min(n.minSegmentPts,t.pts),n.maxSegmentPts=void 0===n.maxSegmentPts?t.pts:Math.max(n.maxSegmentPts,t.pts));"number"==typeof t.dts&&(void 0===n.timelineStartInfo.dts&&(n.timelineStartInfo.dts=t.dts),n.minSegmentDts=void 0===n.minSegmentDts?t.dts:Math.min(n.minSegmentDts,t.dts),n.maxSegmentDts=void 0===n.maxSegmentDts?t.dts:Math.max(n.maxSegmentDts,t.dts))}},gct=tf.clearDtsInfo,nlt=tf.calculateTrackBaseMediaDecodeTime,tlt=tf.collectDtsInfo,dit=Object.freeze({"default":tf,__moduleExports:tf,clearDtsInfo:gct,calculateTrackBaseMediaDecodeTime:nlt,collectDtsInfo:tlt}),or={parseSei:function(n){for(var t=0,r={payloadType:-1,payloadSize:0},u=0,i=0;t<n.byteLength&&128!==n[t];){for(;255===n[t];)u+=255,t++;for(u+=n[t++];255===n[t];)i+=255,t++;if(i+=n[t++],!r.payload&&4===u){r.payloadType=u;r.payloadSize=i;r.payload=n.subarray(t,t+i);break}t+=i;i=u=0}return r},parseUserData:function(n){return 181!==n.payload[0]?null:49!=(n.payload[1]<<8|n.payload[2])?null:"GA94"!==String.fromCharCode(n.payload[3],n.payload[4],n.payload[5],n.payload[6])?null:3!==n.payload[7]?null:n.payload.subarray(8,n.payload.length-1)},parseCaptionPackets:function(n,t){var i,e,r,u,f=[];if(!(64&t[0]))return f;for(e=31&t[0],i=0;i<e;i++)u={type:3&t[2+(r=3*i)],pts:n},4&t[r+2]&&(u.ccData=t[r+3]<<8|t[r+4],f.push(u));return f},discardEmulationPreventionBytes:function(n){for(var r,u,f,e=n.byteLength,i=[],t=1;t<e-2;)0===n[t]&&0===n[t+1]&&3===n[t+2]?(i.push(t+2),t+=2):t++;if(0===i.length)return n;for(u=e-i.length,f=new Uint8Array(u),r=0,t=0;t<u;r++,t++)r===i[0]&&(r++,i.shift()),f[t]=n[r];return f},USER_DATA_REGISTERED_ITU_T_T35:4},ilt=or.parseSei,rlt=or.parseUserData,ult=or.parseCaptionPackets,flt=or.discardEmulationPreventionBytes,elt=or.USER_DATA_REGISTERED_ITU_T_T35,git=Object.freeze({"default":or,__moduleExports:or,parseSei:ilt,parseUserData:rlt,parseCaptionPackets:ult,discardEmulationPreventionBytes:flt,USER_DATA_REGISTERED_ITU_T_T35:elt}),ot=bit&&oy||bit,pe=git&&or||git,tu=function gi(){gi.prototype.init.call(this);this.captionPackets_=[];this.ccStreams_=[new w(0,0),new w(0,1),new w(1,0),new w(1,1)];this.reset();this.ccStreams_.forEach(function(n){n.on("data",this.trigger.bind(this,"data"));n.on("done",this.trigger.bind(this,"done"))},this)};(tu.prototype=new ot).push=function(n){var t,i,r;if("sei_rbsp"===n.nalUnitType&&(t=pe.parseSei(n.escapedRBSP)).payloadType===pe.USER_DATA_REGISTERED_ITU_T_T35&&(i=pe.parseUserData(t)))if(n.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(n.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));r=pe.parseCaptionPackets(n.pts,i);this.captionPackets_=this.captionPackets_.concat(r);this.latestDts_!==n.dts&&(this.numSameDts_=0);this.numSameDts_++;this.latestDts_=n.dts}};tu.prototype.flush=function(){this.captionPackets_.length?(this.captionPackets_.forEach(function(n,t){n.presortIndex=t}),this.captionPackets_.sort(function(n,t){return n.pts===t.pts?n.presortIndex-t.presortIndex:n.pts-t.pts}),this.captionPackets_.forEach(function(n){n.type<2&&this.dispatchCea608Packet(n)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(n){n.flush()},this)):this.ccStreams_.forEach(function(n){n.flush()},this)};tu.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(n){n.reset()})};tu.prototype.dispatchCea608Packet=function(n){this.setsChannel1Active(n)?this.activeCea608Channel_[n.type]=0:this.setsChannel2Active(n)&&(this.activeCea608Channel_[n.type]=1);null!==this.activeCea608Channel_[n.type]&&this.ccStreams_[(n.type<<1)+this.activeCea608Channel_[n.type]].push(n)};tu.prototype.setsChannel1Active=function(n){return 4096==(30720&n.ccData)};tu.prototype.setsChannel2Active=function(n){return 6144==(30720&n.ccData)};var olt={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},ah=function(n){return null===n?"":(n=olt[n]||n,String.fromCharCode(n))},slt=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],iu=function(){for(var n=[],t=15;t--;)n.push("");return n},w=function gi(n,t){gi.prototype.init.call(this);this.field_=n||0;this.dataChannel_=t||0;this.name_="CC"+(1+(this.field_<<1|this.dataChannel_));this.setConstants();this.reset();this.push=function(n){var t,e,r,i,u,f;(t=32639&n.ccData)!==this.lastControlCode_?(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),r=t>>>8,i=255&t,t!==this.PADDING_)&&(t===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":t===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(n.pts),this.flushDisplayed(n.pts),e=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=e,this.startPts_=n.pts):t===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(n.pts)):t===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(n.pts)):t===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(n.pts)):t===this.CARRIAGE_RETURN_?(this.clearFormatting(n.pts),this.flushDisplayed(n.pts),this.shiftRowsUp_(),this.startPts_=n.pts):t===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1):t===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(n.pts),this.displayed_=iu()):t===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=iu():t===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(n.pts),this.displayed_=iu()),this.mode_="paintOn",this.startPts_=n.pts):this.isSpecialCharacter(r,i)?(u=ah((r=(3&r)<<8)|i),this[this.mode_](n.pts,u),this.column_++):this.isExtCharacter(r,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),u=ah((r=(3&r)<<8)|i),this[this.mode_](n.pts,u),this.column_++):this.isMidRowCode(r,i)?(this.clearFormatting(n.pts),this[this.mode_](n.pts," "),this.column_++,14==(14&i)&&this.addFormatting(n.pts,["i"]),1==(1&i)&&this.addFormatting(n.pts,["u"])):this.isOffsetControlCode(r,i)?this.column_+=3&i:this.isPAC(r,i)?(f=slt.indexOf(7968&t),"rollUp"===this.mode_&&this.setRollUp(n.pts,f),f!==this.row_&&(this.clearFormatting(n.pts),this.row_=f),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(n.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(n.pts,["i"])):this.isNormalChar(r)&&(0===i&&(i=null),u=ah(r),u+=ah(i),this[this.mode_](n.pts,u),this.column_+=u.length)):this.lastControlCode_=null}};w.prototype=new ot;w.prototype.flushDisplayed=function(n){var t=this.displayed_.map(function(n){return n.trim()}).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:n,text:t,stream:this.name_})};w.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=iu();this.nonDisplayed_=iu();this.lastControlCode_=null;this.column_=0;this.row_=14;this.rollUpRows_=2;this.formatting_=[]};w.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31);this.PADDING_=0;this.RESUME_CAPTION_LOADING_=32|this.CONTROL_;this.END_OF_CAPTION_=47|this.CONTROL_;this.ROLL_UP_2_ROWS_=37|this.CONTROL_;this.ROLL_UP_3_ROWS_=38|this.CONTROL_;this.ROLL_UP_4_ROWS_=39|this.CONTROL_;this.CARRIAGE_RETURN_=45|this.CONTROL_;this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_;this.BACKSPACE_=33|this.CONTROL_;this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_;this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_};w.prototype.isSpecialCharacter=function(n,t){return n===this.EXT_&&48<=t&&t<=63};w.prototype.isExtCharacter=function(n,t){return(n===this.EXT_+1||n===this.EXT_+2)&&32<=t&&t<=63};w.prototype.isMidRowCode=function(n,t){return n===this.EXT_&&32<=t&&t<=47};w.prototype.isOffsetControlCode=function(n,t){return n===this.OFFSET_&&33<=t&&t<=35};w.prototype.isPAC=function(n,t){return n>=this.BASE_&&n<this.BASE_+8&&64<=t&&t<=127};w.prototype.isColorPAC=function(n){return 64<=n&&n<=79||96<=n&&n<=127};w.prototype.isNormalChar=function(n){return 32<=n&&n<=127};w.prototype.setRollUp=function(n,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(n),this.nonDisplayed_=iu(),this.displayed_=iu()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_);this.topRow_=t-this.rollUpRows_+1};w.prototype.addFormatting=function(n,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce(function(n,t){return n+"<"+t+">"},"");this[this.mode_](n,i)};w.prototype.clearFormatting=function(n){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(n,t){return n+"<\/"+t+">"},"");this.formatting_=[];this[this.mode_](n,t)}};w.prototype.popOn=function(n,t){var i=this.nonDisplayed_[this.row_];i+=t;this.nonDisplayed_[this.row_]=i};w.prototype.rollUp=function(n,t){var i=this.displayed_[this.row_];i+=t;this.displayed_[this.row_]=i};w.prototype.shiftRowsUp_=function(){for(var n=0;n<this.topRow_;n++)this.displayed_[n]="";for(n=this.row_+1;n<15;n++)this.displayed_[n]="";for(n=this.topRow_;n<this.row_;n++)this.displayed_[n]=this.displayed_[n+1];this.displayed_[this.row_]=""};w.prototype.paintOn=function(n,t){var i=this.displayed_[this.row_];i+=t;this.displayed_[this.row_]=i};var we={CaptionStream:tu,Cea608Stream:w},hlt=we.CaptionStream,clt=we.Cea608Stream,nrt=Object.freeze({"default":we,__moduleExports:we,CaptionStream:hlt,Cea608Stream:clt}),rf={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},llt=rf.H264_STREAM_TYPE,alt=rf.ADTS_STREAM_TYPE,vlt=rf.METADATA_STREAM_TYPE,trt=Object.freeze({"default":rf,__moduleExports:rf,H264_STREAM_TYPE:llt,ADTS_STREAM_TYPE:alt,METADATA_STREAM_TYPE:vlt}),sy=function(n,t){var i=1;for(t<n&&(i=-1);4294967296<Math.abs(t-n);)n+=8589934592*i;return n},irt=function gi(n){var i,t;gi.prototype.init.call(this);this.type_=n;this.push=function(n){n.type===this.type_&&(void 0===t&&(t=n.dts),n.dts=sy(n.dts,t),n.pts=sy(n.pts,t),i=n.dts,this.trigger("data",n))};this.flush=function(){t=i;this.trigger("done")};this.discontinuity=function(){i=t=void 0}};irt.prototype=new ot;var hy,be={TimestampRolloverStream:irt,handleRollover:sy},ylt=be.TimestampRolloverStream,plt=be.handleRollover,rrt=Object.freeze({"default":be,__moduleExports:be,TimestampRolloverStream:ylt,handleRollover:plt}),it=trt&&rf||trt,urt=function(n,t,i){for(var u="",r=t;r<i;r++)u+="%"+("00"+n[r].toString(16)).slice(-2);return u},vh=function(n,t,i){return decodeURIComponent(urt(n,t,i))},yh=function(n){return n[0]<<21|n[1]<<14|n[2]<<7|n[3]},frt={TXXX:function(n){var t;if(3===n.data[0]){for(t=1;t<n.data.length;t++)if(0===n.data[t]){n.description=vh(n.data,1,t);n.value=vh(n.data,t+1,n.data.length).replace(/\0*$/,"");break}n.data=n.value}},WXXX:function(n){var t;if(3===n.data[0])for(t=1;t<n.data.length;t++)if(0===n.data[t]){n.description=vh(n.data,1,t);n.url=vh(n.data,t+1,n.data.length);break}},PRIV:function(n){for(var i,t=0;t<n.data.length;t++)if(0===n.data[t]){n.owner=(i=n.data,unescape(urt(i,0,t)));break}n.privateData=n.data.subarray(t+1);n.data=n.privateData}};(hy=function(n){var r,u={debug:!(!n||!n.debug),descriptor:n&&n.descriptor},i=0,t=[],f=0;if(hy.prototype.init.call(this),this.dispatchType=it.METADATA_STREAM_TYPE.toString(16),u.descriptor)for(r=0;r<u.descriptor.length;r++)this.dispatchType+=("00"+u.descriptor[r].toString(16)).slice(-2);this.push=function(n){var r,e,l,o,h,s,c;if("timed-metadata"===n.type)if(n.dataAlignmentIndicator&&(f=0,t.length=0),0===t.length&&(n.data.length<10||n.data[0]!=="I".charCodeAt(0)||n.data[1]!=="D".charCodeAt(0)||n.data[2]!=="3".charCodeAt(0)))u.debug;else if(t.push(n),f+=n.data.byteLength,1===t.length&&(i=yh(n.data.subarray(6,10)),i+=10),!(f<i)){for(r={data:new Uint8Array(i),frames:[],pts:t[0].pts,dts:t[0].dts},h=0;h<i;)r.data.set(t[0].data.subarray(0,i-h),h),h+=t[0].data.byteLength,f-=t[0].data.byteLength,t.shift();e=10;64&r.data[5]&&(e+=4,e+=yh(r.data.subarray(10,14)),i-=yh(r.data.subarray(16,20)));do{if((l=yh(r.data.subarray(e+4,e+8)))<1)return;((o={id:String.fromCharCode(r.data[e],r.data[e+1],r.data[e+2],r.data[e+3]),data:r.data.subarray(e+10,e+l+10)}).key=o.id,frt[o.id]&&(frt[o.id](o),"com.apple.streaming.transportStreamTimestamp"===o.owner))&&(s=o.data,c=(1&s[3])<<30|s[4]<<22|s[5]<<14|s[6]<<6|s[7]>>>2,c*=4,c+=3&s[7],o.timeStamp=c,void 0===r.pts&&void 0===r.dts&&(r.pts=o.timeStamp,r.dts=o.timeStamp),this.trigger("timestamp",o));r.frames.push(o);e+=10;e+=l}while(e<i);this.trigger("data",r)}}}).prototype=new ot;var cy,ph,ly,ay=hy,ert=Object.freeze({"default":ay,__moduleExports:ay}),vy=nrt&&we||nrt,ort=rrt&&be||rrt,wlt=ert&&ay||ert,blt=ort.TimestampRolloverStream;(cy=function(){var t=new Uint8Array(188),n=0;cy.prototype.init.call(this);this.push=function(i){var r,u=0,f=188;for(n?((r=new Uint8Array(i.byteLength+n)).set(t.subarray(0,n)),r.set(i,n),n=0):r=i;f<r.byteLength;)71!==r[u]||71!==r[f]?(u++,f++):(this.trigger("data",r.subarray(u,f)),u+=188,f+=188);u<r.byteLength&&(t.set(r.subarray(u),0),n=r.byteLength-u)};this.flush=function(){188===n&&71===t[0]&&(this.trigger("data",t),n=0);this.trigger("done")}}).prototype=new ot;(ph=function(){var t,i,r,n;ph.prototype.init.call(this);(n=this).packetsWaitingForPmt=[];this.programMapTable=void 0;t=function(n,t){var u=0;t.payloadUnitStartIndicator&&(u+=n[u]+1);"pat"===t.type?i(n.subarray(u),t):r(n.subarray(u),t)};i=function(t,i){i.section_number=t[7];i.last_section_number=t[8];n.pmtPid=(31&t[10])<<8|t[11];i.pmtPid=n.pmtPid};r=function(t,i){var e,r,u,f;if(1&t[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},e=3+((15&t[1])<<8|t[2])-4,r=12+((15&t[10])<<8|t[11]);r<e;)u=t[r],f=(31&t[r+1])<<8|t[r+2],u===it.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=f:u===it.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=f:u===it.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][f]=u),r+=5+((15&t[r+3])<<8|t[r+4]);i.programMapTable=n.programMapTable}};this.push=function(n){var i={},r=4;if(i.payloadUnitStartIndicator=!!(64&n[1]),i.pid=31&n[1],i.pid<<=8,i.pid|=n[2],1<(48&n[3])>>>4&&(r+=n[r]+1),0===i.pid)i.type="pat",t(n.subarray(r),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(n.subarray(r),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([n,r,i]):this.processPes_(n,r,i)};this.processPes_=function(n,t,i){i.streamType=i.pid===this.programMapTable.video?it.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?it.ADTS_STREAM_TYPE:this.programMapTable["timed-metadata"][i.pid];i.type="pes";i.data=n.subarray(t);this.trigger("data",i)}}).prototype=new ot;ph.STREAM_TYPES={h264:27,adts:15};(ly=function(){var t=this,i={data:[],size:0},r={data:[],size:0},u={data:[],size:0},n=function(n,i,r){var s,h,c=new Uint8Array(n.size),e={type:i},o=0,l=0,u,f,a;if(n.data.length&&!(n.size<9)){for(e.trackId=n.data[0].pid,o=0;o<n.data.length;o++)h=n.data[o],c.set(h.data,l),l+=h.data.byteLength;u=c;(f=e).packetLength=6+(u[4]<<8|u[5]);f.dataAlignmentIndicator=0!=(4&u[6]);192&(a=u[7])&&(f.pts=(14&u[9])<<27|(255&u[10])<<20|(254&u[11])<<12|(255&u[12])<<5|(254&u[13])>>>3,f.pts*=4,f.pts+=(6&u[13])>>>1,f.dts=f.pts,64&a&&(f.dts=(14&u[14])<<27|(255&u[15])<<20|(254&u[16])<<12|(255&u[17])<<5|(254&u[18])>>>3,f.dts*=4,f.dts+=(6&u[18])>>>1));f.data=u.subarray(9+u[8]);s="video"===i||e.packetLength<=n.size;(r||s)&&(n.size=0,n.data.length=0);s&&t.trigger("data",e)}};ly.prototype.init.call(this);this.push=function(f){({pat:function(){},pes:function(){var t,e;switch(f.streamType){case it.H264_STREAM_TYPE:case it.H264_STREAM_TYPE:t=i;e="video";break;case it.ADTS_STREAM_TYPE:t=r;e="audio";break;case it.METADATA_STREAM_TYPE:t=u;e="timed-metadata";break;default:return}f.payloadUnitStartIndicator&&n(t,e,!0);t.data.push(f);t.size+=f.data.byteLength},pmt:function(){var i={type:"metadata",tracks:[]},n=f.programMapTable;null!==n.video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+n.video,codec:"avc",type:"video"});null!==n.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+n.audio,codec:"adts",type:"audio"});t.trigger("data",i)}})[f.type]()};this.flush=function(){n(i,"video");n(r,"audio");n(u,"timed-metadata");this.trigger("done")}}).prototype=new ot;yy={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:cy,TransportParseStream:ph,ElementaryStream:ly,TimestampRolloverStream:blt,CaptionStream:vy.CaptionStream,Cea608Stream:vy.Cea608Stream,MetadataStream:wlt};for(wh in it)it.hasOwnProperty(wh)&&(yy[wh]=it[wh]);var py,wy=yy,srt=Object.freeze({"default":wy,__moduleExports:wy}),hrt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(py=function(){var n;py.prototype.init.call(this);this.push=function(t){var o,s,r,u,h,f,i=0,e=0;if("audio"===t.type)for(n?(u=n,(n=new Uint8Array(u.byteLength+t.data.byteLength)).set(u),n.set(t.data,u.byteLength)):n=t.data;i+5<n.length;)if(255===n[i]&&240==(246&n[i+1])){if(s=2*(1&~n[i+1]),o=(3&n[i+3])<<11|n[i+4]<<3|(224&n[i+5])>>5,f=9e4*(h=1024*(1+(3&n[i+6])))/hrt[(60&n[i+2])>>>2],r=i+o,n.byteLength<r)return;if(this.trigger("data",{pts:t.pts+e*f,dts:t.dts+e*f,sampleCount:h,audioobjecttype:1+(n[i+2]>>>6&3),channelcount:(1&n[i+2])<<2|(192&n[i+3])>>>6,samplerate:hrt[(60&n[i+2])>>>2],samplingfrequencyindex:(60&n[i+2])>>>2,samplesize:16,data:n.subarray(i+7+s,r)}),n.byteLength===r)return void(n=void 0);e++;n=n.subarray(r)}else i++};this.flush=function(){this.trigger("done")}}).prototype=new ot;var by,bh,crt,ky=py,lrt=Object.freeze({"default":ky,__moduleExports:ky}),dy=function(n){var i=n.byteLength,r=0,t=0;this.length=function(){return 8*i};this.bitsAvailable=function(){return 8*i+t};this.loadWord=function(){var f=n.byteLength-i,e=new Uint8Array(4),u=Math.min(4,i);if(0===u)throw new Error("no bytes available");e.set(n.subarray(f,f+u));r=new DataView(e.buffer).getUint32(0);t=8*u;i-=u};this.skipBits=function(n){var u;n<t||(n-=t,n-=8*(u=Math.floor(n/8)),i-=u,this.loadWord());r<<=n;t-=n};this.readBits=function(n){var u=Math.min(t,n),f=r>>>32-u;return 0<(t-=u)?r<<=u:0<i&&this.loadWord(),0<(u=n-u)?f<<u|this.readBits(u):f};this.skipLeadingZeros=function(){for(var n=0;n<t;++n)if(0!=(r&2147483648>>>n))return r<<=n,t-=n,n;return this.loadWord(),n+this.skipLeadingZeros()};this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())};this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())};this.readUnsignedExpGolomb=function(){var n=this.skipLeadingZeros();return this.readBits(n+1)-1};this.readExpGolomb=function(){var n=this.readUnsignedExpGolomb();return 1&n?1+n>>>1:-1*(n>>>1)};this.readBoolean=function(){return 1===this.readBits(1)};this.readUnsignedByte=function(){return this.readBits(8)};this.loadWord()},art=Object.freeze({"default":dy,__moduleExports:dy}),klt=art&&dy||art;(bh=function(){var t,n,i=0;bh.prototype.init.call(this);this.push=function(r){var u;for(n?((u=new Uint8Array(n.byteLength+r.data.byteLength)).set(n),u.set(r.data,n.byteLength),n=u):n=r.data;i<n.byteLength-3;i++)if(1===n[i+2]){t=i+5;break}for(;t<n.byteLength;)switch(n[t]){case 0:if(0!==n[t-1]){t+=2;break}if(0!==n[t-2]){t++;break}for(i+3!==t-2&&this.trigger("data",n.subarray(i+3,t-2));1!==n[++t]&&t<n.length;);i=t-2;t+=3;break;case 1:if(0!==n[t-1]||0!==n[t-2]){t+=3;break}this.trigger("data",n.subarray(i+3,t-2));i=t-2;t+=3;break;default:t+=3}n=n.subarray(i);t-=i;i=0};this.flush=function(){n&&3<n.byteLength&&this.trigger("data",n.subarray(i+3));n=null;i=0;this.trigger("done")}}).prototype=new ot;crt={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0};(by=function(){var t,r,u,f,i,e,o,n=new bh;by.prototype.init.call(this);(t=this).push=function(t){"video"===t.type&&(r=t.trackId,u=t.pts,f=t.dts,n.push(t))};n.on("data",function(n){var o={trackId:r,pts:u,dts:f,data:n};switch(31&n[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp";o.escapedRBSP=i(n.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp";o.escapedRBSP=i(n.subarray(1));o.config=e(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)});n.on("done",function(){t.trigger("done")});this.flush=function(){n.flush()};o=function(n,t){for(var u=8,i=8,r=0;r<n;r++)0!==i&&(i=(u+t.readExpGolomb()+256)%256),u=0===i?u:i};i=function(n){for(var r,u,f,e=n.byteLength,i=[],t=1;t<e-2;)0===n[t]&&0===n[t+1]&&3===n[t+2]?(i.push(t+2),t+=2):t++;if(0===i.length)return n;for(u=e-i.length,f=new Uint8Array(u),r=0,t=0;t<u;r++,t++)r===i[0]&&(r++,i.shift()),f[t]=n[r];return f};e=function(n){var t,u,f,e,s,h,c,l,a,v,y,i,r,p=0,w=0,b=0,k=0,d=1;if(u=(t=new klt(n)).readUnsignedByte(),e=t.readUnsignedByte(),f=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),crt[u]&&(3===(s=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(y=3!==s?8:12,r=0;r<y;r++)t.readBoolean()&&o(r<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(h=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===h)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),c=t.readUnsignedExpGolomb(),r=0;r<c;r++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),a=t.readUnsignedExpGolomb(),0===(v=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(p=t.readUnsignedExpGolomb(),w=t.readUnsignedExpGolomb(),b=t.readUnsignedExpGolomb(),k=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:i=[1,1];break;case 2:i=[12,11];break;case 3:i=[10,11];break;case 4:i=[16,11];break;case 5:i=[40,33];break;case 6:i=[24,11];break;case 7:i=[20,11];break;case 8:i=[32,11];break;case 9:i=[80,33];break;case 10:i=[18,11];break;case 11:i=[15,11];break;case 12:i=[64,33];break;case 13:i=[160,99];break;case 14:i=[4,3];break;case 15:i=[3,2];break;case 16:i=[2,1];break;case 255:i=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}i&&(d=i[0]/i[1])}return{profileIdc:u,levelIdc:f,profileCompatibility:e,width:Math.ceil((16*(l+1)-2*p-2*w)*d),height:(2-v)*(a+1)*16-2*b-2*k}}}).prototype=new ot;var gy,ke={H264Stream:by,NalByteStream:bh},dlt=ke.H264Stream,glt=ke.NalByteStream,vrt=Object.freeze({"default":ke,__moduleExports:ke,H264Stream:dlt,NalByteStream:glt});(gy=function(){var n=new Uint8Array,t=0;gy.prototype.init.call(this);this.setTimestamp=function(n){t=n};this.parseId3TagSize=function(n,t){var i=n[t+6]<<21|n[t+7]<<14|n[t+8]<<7|n[t+9];return(16&n[t+5])>>4?i+20:i+10};this.parseAdtsSize=function(n,t){var i=(224&n[t+5])>>5,r=n[t+4]<<3;return 6144&n[t+3]|r|i};this.push=function(i){var e,o,s,f,u=0,r=0;for(n.length?(f=n.length,(n=new Uint8Array(i.byteLength+f)).set(n.subarray(0,f)),n.set(i,f)):n=i;3<=n.length-r;)if(n[r]!=="I".charCodeAt(0)||n[r+1]!=="D".charCodeAt(0)||n[r+2]!=="3".charCodeAt(0))if(!0&n[r]&&240==(240&n[r+1])){if(n.length-r<7)break;if((u=this.parseAdtsSize(n,r))>n.length)break;s={type:"audio",data:n.subarray(r,r+u),pts:t,dts:t};this.trigger("data",s);r+=u}else r++;else{if(n.length-r<10)break;if((u=this.parseId3TagSize(n,r))>n.length)break;o={type:"timed-metadata",data:n.subarray(r,r+u)};this.trigger("data",o);r+=u}e=n.length-r;n=0<e?n.subarray(r):new Uint8Array}}).prototype=new ot;var np,yrt,prt,wrt,brt,kh,de,tp,ge,krt,ip,drt,rp=gy,grt=Object.freeze({"default":rp,__moduleExports:rp}),sr=[33,16,5,32,164,27],up=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],a=function(n){for(var t=[];n--;)t.push(0);return t},nat={96e3:[sr,[227,64],a(154),[56]],88200:[sr,[231],a(170),[56]],64e3:[sr,[248,192],a(240),[56]],48e3:[sr,[255,192],a(268),[55,148,128],a(54),[112]],44100:[sr,[255,192],a(268),[55,163,128],a(84),[112]],32e3:[sr,[255,192],a(268),[55,234],a(226),[112]],24e3:[sr,[255,192],a(268),[55,255,128],a(268),[111,112],a(126),[224]],16e3:[sr,[255,192],a(268),[55,255,128],a(268),[111,255],a(269),[223,108],a(195),[1,192]],12e3:[up,a(268),[3,127,248],a(268),[6,255,240],a(268),[13,255,224],a(268),[27,253,128],a(259),[56]],11025:[up,a(268),[3,127,248],a(268),[6,255,240],a(268),[13,255,224],a(268),[27,255,192],a(268),[55,175,128],a(108),[112]],8e3:[up,a(268),[3,121,16],a(47),[7]]},fp=(np=nat,Object.keys(np).reduce(function(n,t){return n[t]=new Uint8Array(np[t].reduce(function(n,t){return n.concat(t)},[])),n},{})),nut=Object.freeze({"default":fp,__moduleExports:fp}),wi={secondsToVideoTs:yrt=function(n){return 9e4*n},secondsToAudioTs:prt=function(n,t){return n*t},videoTsToSeconds:wrt=function(n){return n/9e4},audioTsToSeconds:brt=function(n,t){return n/t},audioTsToVideoTs:function(n,t){return yrt(brt(n,t))},videoTsToAudioTs:function(n,t){return prt(wrt(n),t)}},tat=wi.secondsToVideoTs,iat=wi.secondsToAudioTs,rat=wi.videoTsToSeconds,uat=wi.audioTsToSeconds,fat=wi.audioTsToVideoTs,eat=wi.videoTsToAudioTs,tut=Object.freeze({"default":wi,__moduleExports:wi,secondsToVideoTs:tat,secondsToAudioTs:iat,videoTsToSeconds:rat,audioTsToSeconds:uat,audioTsToVideoTs:fat,videoTsToAudioTs:eat}),uf=wit&&fr||wit,no=kit&&er||kit,li=dit&&tf||dit,ei=srt&&wy||srt,iut=lrt&&ky||lrt,oat=grt&&rp||grt,sat=nut&&fp||nut,rut=tut&&wi||tut,hat=(vrt&&ke||vrt).H264Stream,ep=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],op=["width","height","profileIdc","levelIdc","profileCompatibility"];krt=function(n){return n[0]==="I".charCodeAt(0)&&n[1]==="D".charCodeAt(0)&&n[2]==="3".charCodeAt(0)};ip=function(n,t){var i;if(n.length!==t.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==t[i])return!1;return!0};drt=function(n){for(var i=0,t=0;t<n.length;t++)i+=n[t].data.byteLength;return i};(de=function(n,t){var i=[],e=0,r=0,u=0,f=1/0;t=t||{};de.prototype.init.call(this);this.push=function(t){li.collectDtsInfo(n,t);n&&ep.forEach(function(i){n[i]=t[i]});i.push(t)};this.setEarliestDts=function(t){r=t-n.timelineStartInfo.baseMediaDecodeTime};this.setVideoBaseMediaDecodeTime=function(n){f=n};this.setAudioAppendStart=function(n){u=n};this.flush=function(){var r,u,o,f;0!==i.length&&(r=this.trimAdtsFramesByEarliestDts_(i),n.baseMediaDecodeTime=li.calculateTrackBaseMediaDecodeTime(n,t.keepOriginalTimestamps),this.prefixWithSilence_(n,r),n.samples=this.generateSampleTable_(r),o=uf.mdat(this.concatenateFrameData_(r)),i=[],u=uf.moof(e,[n]),f=new Uint8Array(u.byteLength+o.byteLength),e++,f.set(u),f.set(o,u.byteLength),li.clearDtsInfo(n),this.trigger("data",{track:n,boxes:f}));this.trigger("done","AudioSegmentStream")};this.prefixWithSilence_=function(n,t){var h,r,e,i,c=0,o=0,s=0;if(t.length&&(h=rut.audioTsToVideoTs(n.baseMediaDecodeTime,n.samplerate),r=Math.ceil(9216e4/n.samplerate),u&&f&&(c=h-Math.max(u,f),s=(o=Math.floor(c/r))*r),!(o<1||45e3<s))){for((e=sat[n.samplerate])||(e=t[0].data),i=0;i<o;i++)t.splice(i,0,{data:e});n.baseMediaDecodeTime-=Math.floor(rut.videoTsToAudioTs(s,n.samplerate))}};this.trimAdtsFramesByEarliestDts_=function(t){return n.minSegmentDts>=r?t:(n.minSegmentDts=1/0,t.filter(function(t){return t.dts>=r&&(n.minSegmentDts=Math.min(n.minSegmentDts,t.dts),n.minSegmentPts=n.minSegmentDts,!0)}))};this.generateSampleTable_=function(n){for(var i,r=[],t=0;t<n.length;t++)i=n[t],r.push({size:i.data.byteLength,duration:1024});return r};this.concatenateFrameData_=function(n){for(var i,r=0,u=new Uint8Array(drt(n)),t=0;t<n.length;t++)i=n[t],u.set(i.data,r),r+=i.data.byteLength;return u}}).prototype=new ot;(kh=function(n,t){var u,f,e=0,i=[],r=[];t=t||{};kh.prototype.init.call(this);delete n.minPTS;this.gopCache_=[];this.push=function(t){li.collectDtsInfo(n,t);"seq_parameter_set_rbsp"!==t.nalUnitType||u||(u=t.config,n.sps=[t.data],op.forEach(function(t){n[t]=u[t]},this));"pic_parameter_set_rbsp"!==t.nalUnitType||f||(f=t.data,n.pps=[t.data]);i.push(t)};this.flush=function(){for(var c,f,u,o,h,s,l;i.length&&"access_unit_delimiter_rbsp"!==i[0].nalUnitType;)i.shift();if(0===i.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(c=no.groupNalsIntoFrames(i),(u=no.groupFramesIntoGops(c))[0][0].keyFrame||((f=this.getGopForFusion_(i[0],n))?(u.unshift(f),u.byteLength+=f.byteLength,u.nalCount+=f.nalCount,u.pts=f.pts,u.dts=f.dts,u.duration+=f.duration):u=no.extendFirstKeyFrame(u)),r.length){if(!(l=t.alignGopsAtEnd?this.alignGopsAtEnd_(u):this.alignGopsAtStart_(u)))return this.gopCache_.unshift({gop:u.pop(),pps:n.pps,sps:n.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),i=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");li.clearDtsInfo(n);u=l}li.collectDtsInfo(n,u);n.samples=no.generateSampleTable(u);h=uf.mdat(no.concatenateNalData(u));n.baseMediaDecodeTime=li.calculateTrackBaseMediaDecodeTime(n,t.keepOriginalTimestamps);this.trigger("processedGopsInfo",u.map(function(n){return{pts:n.pts,dts:n.dts,byteLength:n.byteLength}}));this.gopCache_.unshift({gop:u.pop(),pps:n.pps,sps:n.sps});this.gopCache_.length=Math.min(6,this.gopCache_.length);i=[];this.trigger("baseMediaDecodeTime",n.baseMediaDecodeTime);this.trigger("timelineStartInfo",n.timelineStartInfo);o=uf.moof(e,[n]);s=new Uint8Array(o.byteLength+h.byteLength);e++;s.set(o);s.set(h,o.byteLength);this.trigger("data",{track:n,boxes:s});this.resetStream_();this.trigger("done","VideoSegmentStream")};this.resetStream_=function(){li.clearDtsInfo(n);f=u=void 0};this.getGopForFusion_=function(t){for(var i,r,u,f,o=1/0,e=0;e<this.gopCache_.length;e++)u=(f=this.gopCache_[e]).gop,n.pps&&ip(n.pps[0],f.pps[0])&&n.sps&&ip(n.sps[0],f.sps[0])&&(u.dts<n.timelineStartInfo.dts||-1e4<=(i=t.dts-u.dts-u.duration)&&i<=45e3&&(!r||i<o)&&(r=f,o=i));return r?r.gop:null};this.alignGopsAtStart_=function(n){var f,i,e,u,o,s,h,t;for(o=n.byteLength,s=n.nalCount,h=n.duration,f=i=0;f<r.length&&i<n.length&&(e=r[f],u=n[i],e.pts!==u.pts);)u.pts>e.pts?f++:(i++,o-=u.byteLength,s-=u.nalCount,h-=u.duration);return 0===i?n:i===n.length?null:((t=n.slice(i)).byteLength=o,t.duration=h,t.nalCount=s,t.pts=t[0].pts,t.dts=t[0].dts,t)};this.alignGopsAtEnd_=function(n){var u,i,s,h,f,e,c,t,o;for(u=r.length-1,i=n.length-1,f=null,e=!1;0<=u&&0<=i;){if(s=r[u],h=n[i],s.pts===h.pts){e=!0;break}s.pts>h.pts?u--:(u===r.length-1&&(f=i),i--)}return!e&&null===f?null:0===(c=e?i:f)?n:(t=n.slice(c),o=t.reduce(function(n,t){return n.byteLength+=t.byteLength,n.duration+=t.duration,n.nalCount+=t.nalCount,n},{byteLength:0,duration:0,nalCount:0}),t.byteLength=o.byteLength,t.duration=o.duration,t.nalCount=o.nalCount,t.pts=t[0].pts,t.dts=t[0].dts,t)};this.alignGopsWith=function(n){r=n}}).prototype=new ot;(ge=function(n,t){this.numberOfTracks=0;this.metadataStream=t;this.remuxTracks="undefined"!=typeof n.remux?!!n.remux:!0;this.pendingTracks=[];this.videoTrack=null;this.pendingBoxes=[];this.pendingCaptions=[];this.pendingMetadata=[];this.pendingBytes=0;this.emittedTracks=0;ge.prototype.init.call(this);this.push=function(n){return n.text?this.pendingCaptions.push(n):n.frames?this.pendingMetadata.push(n):(this.pendingTracks.push(n.track),this.pendingBoxes.push(n.boxes),this.pendingBytes+=n.boxes.byteLength,"video"===n.track.type&&(this.videoTrack=n.track),void("audio"===n.track.type&&(this.audioTrack=n.track)))}}).prototype=new ot;ge.prototype.flush=function(n){var r,f,e,t,o=0,i={captions:[],captionStreams:{},metadata:[],info:{}},u=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==n&&"AudioSegmentStream"!==n)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(u=this.videoTrack.timelineStartInfo.pts,op.forEach(function(n){i.info[n]=this.videoTrack[n]},this)):this.audioTrack&&(u=this.audioTrack.timelineStartInfo.pts,ep.forEach(function(n){i.info[n]=this.audioTrack[n]},this)),i.type=1===this.pendingTracks.length?this.pendingTracks[0].type:"combined",this.emittedTracks+=this.pendingTracks.length,e=uf.initSegment(this.pendingTracks),i.initSegment=new Uint8Array(e.byteLength),i.initSegment.set(e),i.data=new Uint8Array(this.pendingBytes),t=0;t<this.pendingBoxes.length;t++)i.data.set(this.pendingBoxes[t],o),o+=this.pendingBoxes[t].byteLength;for(t=0;t<this.pendingCaptions.length;t++)(r=this.pendingCaptions[t]).startTime=r.startPts-u,r.startTime/=9e4,r.endTime=r.endPts-u,r.endTime/=9e4,i.captionStreams[r.stream]=!0,i.captions.push(r);for(t=0;t<this.pendingMetadata.length;t++)(f=this.pendingMetadata[t]).cueTime=f.pts-u,f.cueTime/=9e4,i.metadata.push(f);i.metadata.dispatchType=this.metadataStream.dispatchType;this.pendingTracks.length=0;this.videoTrack=null;this.pendingBoxes.length=0;this.pendingCaptions.length=0;this.pendingBytes=0;this.pendingMetadata.length=0;this.trigger("data",i);this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)};(tp=function(n){var i,t,r=this,u=!0;tp.prototype.init.call(this);n=n||{};this.baseMediaDecodeTime=n.baseMediaDecodeTime||0;this.transmuxPipeline_={};this.setupAacPipeline=function(){var i={};(this.transmuxPipeline_=i).type="aac";i.metadataStream=new ei.MetadataStream;i.aacStream=new oat;i.audioTimestampRolloverStream=new ei.TimestampRolloverStream("audio");i.timedMetadataTimestampRolloverStream=new ei.TimestampRolloverStream("timed-metadata");i.adtsStream=new iut;i.coalesceStream=new ge(n,i.metadataStream);i.headOfPipeline=i.aacStream;i.aacStream.pipe(i.audioTimestampRolloverStream).pipe(i.adtsStream);i.aacStream.pipe(i.timedMetadataTimestampRolloverStream).pipe(i.metadataStream).pipe(i.coalesceStream);i.metadataStream.on("timestamp",function(n){i.aacStream.setTimestamp(n.timeStamp)});i.aacStream.on("data",function(u){"timed-metadata"!==u.type||i.audioSegmentStream||(t=t||{timelineStartInfo:{baseMediaDecodeTime:r.baseMediaDecodeTime},codec:"adts",type:"audio"},i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new de(t,n),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream))});i.coalesceStream.on("data",this.trigger.bind(this,"data"));i.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setupTsPipeline=function(){var u={};(this.transmuxPipeline_=u).type="ts";u.metadataStream=new ei.MetadataStream;u.packetStream=new ei.TransportPacketStream;u.parseStream=new ei.TransportParseStream;u.elementaryStream=new ei.ElementaryStream;u.videoTimestampRolloverStream=new ei.TimestampRolloverStream("video");u.audioTimestampRolloverStream=new ei.TimestampRolloverStream("audio");u.timedMetadataTimestampRolloverStream=new ei.TimestampRolloverStream("timed-metadata");u.adtsStream=new iut;u.h264Stream=new hat;u.captionStream=new ei.CaptionStream;u.coalesceStream=new ge(n,u.metadataStream);u.headOfPipeline=u.packetStream;u.packetStream.pipe(u.parseStream).pipe(u.elementaryStream);u.elementaryStream.pipe(u.videoTimestampRolloverStream).pipe(u.h264Stream);u.elementaryStream.pipe(u.audioTimestampRolloverStream).pipe(u.adtsStream);u.elementaryStream.pipe(u.timedMetadataTimestampRolloverStream).pipe(u.metadataStream).pipe(u.coalesceStream);u.h264Stream.pipe(u.captionStream).pipe(u.coalesceStream);u.elementaryStream.on("data",function(f){var e;if("metadata"===f.type){for(e=f.tracks.length;e--;)i||"video"!==f.tracks[e].type?t||"audio"!==f.tracks[e].type||((t=f.tracks[e]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime):(i=f.tracks[e]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime;i&&!u.videoSegmentStream&&(u.coalesceStream.numberOfTracks++,u.videoSegmentStream=new kh(i,n),u.videoSegmentStream.on("timelineStartInfo",function(n){t&&(t.timelineStartInfo=n,u.audioSegmentStream.setEarliestDts(n.dts))}),u.videoSegmentStream.on("processedGopsInfo",r.trigger.bind(r,"gopInfo")),u.videoSegmentStream.on("baseMediaDecodeTime",function(n){t&&u.audioSegmentStream.setVideoBaseMediaDecodeTime(n)}),u.h264Stream.pipe(u.videoSegmentStream).pipe(u.coalesceStream));t&&!u.audioSegmentStream&&(u.coalesceStream.numberOfTracks++,u.audioSegmentStream=new de(t,n),u.adtsStream.pipe(u.audioSegmentStream).pipe(u.coalesceStream))}});u.coalesceStream.on("data",this.trigger.bind(this,"data"));u.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;this.baseMediaDecodeTime=n;t&&(t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,li.clearDtsInfo(t),t.timelineStartInfo.baseMediaDecodeTime=n,r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity());i&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[],r.videoTimestampRolloverStream.discontinuity()),i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,li.clearDtsInfo(i),r.captionStream.reset(),i.timelineStartInfo.baseMediaDecodeTime=n);r.timedMetadataTimestampRolloverStream&&r.timedMetadataTimestampRolloverStream.discontinuity()};this.setAudioAppendStart=function(n){t&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(n)};this.alignGopsWith=function(n){i&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(n)};this.push=function(n){if(u){var t=krt(n);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline();u=!1}this.transmuxPipeline_.headOfPipeline.push(n)};this.flush=function(){u=!0;this.transmuxPipeline_.headOfPipeline.flush()};this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new ot;var at,uut,hr={Transmuxer:tp,VideoSegmentStream:kh,AudioSegmentStream:de,AUDIO_PROPERTIES:ep,VIDEO_PROPERTIES:op},cat=hr.Transmuxer,lat=hr.VideoSegmentStream,aat=hr.AudioSegmentStream,vat=hr.AUDIO_PROPERTIES,yat=hr.VIDEO_PROPERTIES,fut=Object.freeze({"default":hr,__moduleExports:hr,Transmuxer:cat,VideoSegmentStream:lat,AudioSegmentStream:aat,AUDIO_PROPERTIES:vat,VIDEO_PROPERTIES:yat}),dh=fi.parseType,kt=function(n){return new Date(1e3*n-20828448e5)},eut=function(n){return{isLeading:(12&n[0])>>>2,dependsOn:3&n[0],isDependedOn:(192&n[1])>>>6,hasRedundancy:(48&n[1])>>>4,paddingValue:(14&n[1])>>>1,isNonSyncSample:1&n[1],degradationPriority:n[2]<<8|n[3]}},ff={avc1:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:at(n.subarray(78,n.byteLength))}},avcC:function(n){for(var f,i,e=new DataView(n.buffer,n.byteOffset,n.byteLength),u={configurationVersion:n[0],avcProfileIndication:n[1],profileCompatibility:n[2],avcLevelIndication:n[3],lengthSizeMinusOne:3&n[4],sps:[],pps:[]},o=31&n[5],t=6,r=0;r<o;r++)i=e.getUint16(t),t+=2,u.sps.push(new Uint8Array(n.subarray(t,t+i))),t+=i;for(f=n[t],t++,r=0;r<f;r++)i=e.getUint16(t),t+=2,u.pps.push(new Uint8Array(n.subarray(t,t+i))),t+=i;return u},btrt:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},esds:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),esId:n[6]<<8|n[7],streamPriority:31&n[8],decoderConfig:{objectProfileIndication:n[11],streamType:n[12]>>>2&63,bufferSize:n[13]<<16|n[14]<<8|n[15],maxBitrate:n[16]<<24|n[17]<<16|n[18]<<8|n[19],avgBitrate:n[20]<<24|n[21]<<16|n[22]<<8|n[23],decoderConfigDescriptor:{tag:n[24],length:n[25],audioObjectType:n[26]>>>3&31,samplingFrequencyIndex:(7&n[26])<<1|n[27]>>>7&1,channelConfiguration:n[27]>>>3&15}}}},ftyp:function(n){for(var r=new DataView(n.buffer,n.byteOffset,n.byteLength),i={majorBrand:dh(n.subarray(0,4)),minorVersion:r.getUint32(4),compatibleBrands:[]},t=8;t<n.byteLength;)i.compatibleBrands.push(dh(n.subarray(t,t+4))),t+=4;return i},dinf:function(n){return{boxes:at(n)}},dref:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),dataReferences:at(n.subarray(8))}},hdlr:function(n){for(var i={version:new DataView(n.buffer,n.byteOffset,n.byteLength).getUint8(0),flags:new Uint8Array(n.subarray(1,4)),handlerType:dh(n.subarray(8,12)),name:""},t=8,t=24;t<n.byteLength;t++){if(0===n[t]){t++;break}i.name+=String.fromCharCode(n[t])}return i.name=decodeURIComponent(escape(i.name)),i},mdat:function(n){return{byteLength:n.byteLength,nals:function(n){for(var r,u=new DataView(n.buffer,n.byteOffset,n.byteLength),t=[],i=0;i+4<n.length;i+=r)if(r=u.getUint32(i),i+=4,r<=0)t.push("<span style='color:red;'>MALFORMED DATA<\/span>");else switch(31&n[i]){case 1:t.push("slice_layer_without_partitioning_rbsp");break;case 5:t.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:t.push("sei_rbsp");break;case 7:t.push("seq_parameter_set_rbsp");break;case 8:t.push("pic_parameter_set_rbsp");break;case 9:t.push("access_unit_delimiter_rbsp");break;default:t.push("UNKNOWN NAL - "+n[i]&31)}return t}(n)}},mdhd:function(n){var u,r=new DataView(n.buffer,n.byteOffset,n.byteLength),t=4,i={version:r.getUint8(0),flags:new Uint8Array(n.subarray(1,4)),language:""};return 1===i.version?(t+=4,i.creationTime=kt(r.getUint32(t)),t+=8,i.modificationTime=kt(r.getUint32(t)),t+=4,i.timescale=r.getUint32(t),t+=8):(i.creationTime=kt(r.getUint32(t)),t+=4,i.modificationTime=kt(r.getUint32(t)),t+=4,i.timescale=r.getUint32(t),t+=4),i.duration=r.getUint32(t),t+=4,u=r.getUint16(t),i.language+=String.fromCharCode(96+(u>>10)),i.language+=String.fromCharCode(96+((992&u)>>5)),i.language+=String.fromCharCode(96+(31&u)),i},mdia:function(n){return{boxes:at(n)}},mfhd:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),sequenceNumber:n[4]<<24|n[5]<<16|n[6]<<8|n[7]}},minf:function(n){return{boxes:at(n)}},mp4a:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength),i={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return 28<n.byteLength&&(i.streamDescriptor=at(n.subarray(28))[0]),i},moof:function(n){return{boxes:at(n)}},moov:function(n){return{boxes:at(n)}},mvex:function(n){return{boxes:at(n)}},mvhd:function(n){var i=new DataView(n.buffer,n.byteOffset,n.byteLength),t=4,r={version:i.getUint8(0),flags:new Uint8Array(n.subarray(1,4))};return 1===r.version?(t+=4,r.creationTime=kt(i.getUint32(t)),t+=8,r.modificationTime=kt(i.getUint32(t)),t+=4,r.timescale=i.getUint32(t),t+=8):(r.creationTime=kt(i.getUint32(t)),t+=4,r.modificationTime=kt(i.getUint32(t)),t+=4,r.timescale=i.getUint32(t),t+=4),r.duration=i.getUint32(t),t+=4,r.rate=i.getUint16(t)+i.getUint16(t+2)/16,t+=4,r.volume=i.getUint8(t)+i.getUint8(t+1)/8,t+=2,t+=2,t+=8,r.matrix=new Uint32Array(n.subarray(t,t+36)),t+=36,t+=24,r.nextTrackId=i.getUint32(t),r},pdin:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(n.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(n){for(var i={version:n[0],flags:new Uint8Array(n.subarray(1,4)),samples:[]},t=4;t<n.byteLength;t++)i.samples.push({dependsOn:(48&n[t])>>4,isDependedOn:(12&n[t])>>2,hasRedundancy:3&n[t]});return i},sidx:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},u=i.getUint16(22),t=24;u;t+=12,u--)r.references.push({referenceType:(128&n[t])>>>7,referencedSize:2147483647&i.getUint32(t),subsegmentDuration:i.getUint32(t+4),startsWithSap:!!(128&n[t+8]),sapType:(112&n[t+8])>>>4,sapDeltaTime:268435455&i.getUint32(t+8)});return r},smhd:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),balance:n[4]+n[5]/256}},stbl:function(n){return{boxes:at(n)}},stco:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),chunkOffsets:[]},u=i.getUint32(4),t=8;u;t+=4,u--)r.chunkOffsets.push(i.getUint32(t));return r},stsc:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r=i.getUint32(4),u={version:n[0],flags:new Uint8Array(n.subarray(1,4)),sampleToChunks:[]},t=8;r;t+=12,r--)u.sampleToChunks.push({firstChunk:i.getUint32(t),samplesPerChunk:i.getUint32(t+4),sampleDescriptionIndex:i.getUint32(t+8)});return u},stsd:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),sampleDescriptions:at(n.subarray(8))}},stsz:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]},t=12;t<n.byteLength;t+=4)r.entries.push(i.getUint32(t));return r},stts:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),timeToSamples:[]},u=i.getUint32(4),t=8;u;t+=8,u--)r.timeToSamples.push({sampleCount:i.getUint32(t),sampleDelta:i.getUint32(t+4)});return r},styp:function(n){return ff.ftyp(n)},tfdt:function(n){var t={version:n[0],flags:new Uint8Array(n.subarray(1,4)),baseMediaDecodeTime:n[4]<<24|n[5]<<16|n[6]<<8|n[7]};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=n[8]<<24|n[9]<<16|n[10]<<8|n[11]),t},tfhd:function(n){var i,r=new DataView(n.buffer,n.byteOffset,n.byteLength),t={version:n[0],flags:new Uint8Array(n.subarray(1,4)),trackId:r.getUint32(4)},u=1&t.flags[2],f=2&t.flags[2],e=8&t.flags[2],o=16&t.flags[2],s=32&t.flags[2],h=65536&t.flags[0],c=131072&t.flags[0];return i=8,u&&(i+=4,t.baseDataOffset=r.getUint32(12),i+=4),f&&(t.sampleDescriptionIndex=r.getUint32(i),i+=4),e&&(t.defaultSampleDuration=r.getUint32(i),i+=4),o&&(t.defaultSampleSize=r.getUint32(i),i+=4),s&&(t.defaultSampleFlags=r.getUint32(i)),h&&(t.durationIsEmpty=!0),!u&&c&&(t.baseDataOffsetIsMoof=!0),t},tkhd:function(n){var i=new DataView(n.buffer,n.byteOffset,n.byteLength),t=4,r={version:i.getUint8(0),flags:new Uint8Array(n.subarray(1,4))};return 1===r.version?(t+=4,r.creationTime=kt(i.getUint32(t)),t+=8,r.modificationTime=kt(i.getUint32(t)),t+=4,r.trackId=i.getUint32(t),t+=4,t+=8):(r.creationTime=kt(i.getUint32(t)),t+=4,r.modificationTime=kt(i.getUint32(t)),t+=4,r.trackId=i.getUint32(t),t+=4,t+=4),r.duration=i.getUint32(t),t+=4,t+=8,r.layer=i.getUint16(t),t+=2,r.alternateGroup=i.getUint16(t),t+=2,r.volume=i.getUint8(t)+i.getUint8(t+1)/8,t+=2,t+=2,r.matrix=new Uint32Array(n.subarray(t,t+36)),t+=36,r.width=i.getUint16(t)+i.getUint16(t+2)/16,t+=4,r.height=i.getUint16(t)+i.getUint16(t+2)/16,r},traf:function(n){return{boxes:at(n)}},trak:function(n){return{boxes:at(n)}},trex:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:3&n[20],sampleIsDependedOn:(192&n[21])>>6,sampleHasRedundancy:(48&n[21])>>4,samplePaddingValue:(14&n[21])>>1,sampleIsDifferenceSample:!!(1&n[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(n){var i,r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),samples:[]},u=new DataView(n.buffer,n.byteOffset,n.byteLength),h=1&r.flags[2],c=4&r.flags[2],e=1&r.flags[1],o=2&r.flags[1],l=4&r.flags[1],s=8&r.flags[1],f=u.getUint32(4),t=8;for(h&&(r.dataOffset=u.getInt32(t),t+=4),c&&f&&(i={flags:eut(n.subarray(t,t+4))},t+=4,e&&(i.duration=u.getUint32(t),t+=4),o&&(i.size=u.getUint32(t),t+=4),s&&(i.compositionTimeOffset=u.getUint32(t),t+=4),r.samples.push(i),f--);f--;)i={},e&&(i.duration=u.getUint32(t),t+=4),o&&(i.size=u.getUint32(t),t+=4),l&&(i.flags=eut(n.subarray(t,t+4)),t+=4),s&&(i.compositionTimeOffset=u.getUint32(t),t+=4),r.samples.push(i);return r},"url ":function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4))}},vmhd:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}},bi={inspect:at=function(n){for(var o,i,u,f,e,t=0,s=[],h=new ArrayBuffer(n.length),c=new Uint8Array(h),r=0;r<n.length;++r)c[r]=n[r];for(o=new DataView(h);t<n.byteLength;)i=o.getUint32(t),u=dh(n.subarray(t+4,t+8)),f=1<i?t+i:n.byteLength,(e=(ff[u]||function(n){return{data:n}})(n.subarray(t+8,f))).size=i,e.type=u,s.push(e),t=f;return s},textify:uut=function(n,t){var i;return t=t||0,i=new Array(2*t+1).join(" "),n.map(function(n){return i+n.type+"\n"+Object.keys(n).filter(function(n){return"type"!==n&&"boxes"!==n}).map(function(t){var f=i+"  "+t+": ",r=n[t],u;return r instanceof Uint8Array||r instanceof Uint32Array?(u=Array.prototype.slice.call(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map(function(n){return" "+("00"+n.toString(16)).slice(-2)}).join("").match(/.{1,24}/g),u?1===u.length?f+"<"+u.join("").slice(1)+">":f+"<\n"+u.map(function(n){return i+"  "+n}).join("\n")+"\n"+i+"  >":f+"<>"):f+JSON.stringify(r,null,2).split("\n").map(function(n,t){return 0===t?n:i+"  "+n}).join("\n")}).join("\n")+(n.boxes?"\n"+uut(n.boxes,t+1):"")}).join("\n")},parseTfdt:ff.tfdt,parseHdlr:ff.hdlr,parseTfhd:ff.tfhd,parseTrun:ff.trun},pat=bi.inspect,wat=bi.textify,bat=bi.parseTfdt,kat=bi.parseHdlr,dat=bi.parseTfhd,gat=bi.parseTrun,out=Object.freeze({"default":bi,__moduleExports:bi,inspect:pat,textify:wat,parseTfdt:bat,parseHdlr:kat,parseTfhd:dat,parseTrun:gat}),sp=out&&bi||out,nvt=pe.discardEmulationPreventionBytes,tvt=vy.CaptionStream,ivt=function(n,t){for(var r,u=n,i=0;i<t.length;i++){if(r=t[i],u<r.size)return r;u-=r.size}return null},rvt=function(n,t){var u=fi.findBox(n,["moof","traf"]),f=fi.findBox(n,["mdat"]),i={},r=[];return f.forEach(function(n,t){var i=u[t];r.push({mdat:n,traf:i})}),r.forEach(function(n){var s,h,e,u,c,l,a,f,w=n.mdat,o=n.traf,b=fi.findBox(o,["tfhd"]),v=sp.parseTfhd(b[0]),r=v.trackId,y=fi.findBox(o,["tfdt"]),k=0<y.length?sp.parseTfdt(y[0]).baseMediaDecodeTime:0,p=fi.findBox(o,["trun"]);t===r&&0<p.length&&(h=p,u=k,c=(e=v).defaultSampleDuration||0,l=e.defaultSampleSize||0,a=e.trackId,f=[],h.forEach(function(n){var t=sp.parseTrun(n).samples;t.forEach(function(n){void 0===n.duration&&(n.duration=c);void 0===n.size&&(n.size=l);n.trackId=a;n.dts=u;void 0===n.compositionTimeOffset&&(n.compositionTimeOffset=0);n.pts=u+n.compositionTimeOffset;u+=n.duration});f=f.concat(t)}),s=function(n,t,i){for(var u,f,o,c=new DataView(n.buffer,n.byteOffset,n.byteLength),h=[],s,e,r=0;r+4<n.length;r+=f)if(f=c.getUint32(r),r+=4,!(f<=0))switch(31&n[r]){case 6:s=n.subarray(r+1,r+1+f);e=ivt(r,t);u={nalUnitType:"sei_rbsp",size:f,data:s,escapedRBSP:nvt(s),trackId:i};e?(u.pts=e.pts,u.dts=e.dts,o=e):(u.pts=o.pts,u.dts=o.dts);h.push(u)}return h}(w,f,r),i[r]||(i[r]=[]),i[r]=i[r].concat(s))}),i},hp=function(){var r,u,n,t,i,f=!1;this.isInitialized=function(){return f};this.init=function(){r=new tvt;f=!0;r.on("data",function(n){n.startTime=n.startPts/t;n.endTime=n.endPts/t;i.captions.push(n);i.captionStreams[n.stream]=!0})};this.isNewInit=function(i,r){return!(i&&0===i.length||r&&"object"===("undefined"==typeof r?"undefined":d(r))&&0===Object.keys(r).length||n===i[0]&&t===r[n])};this.parse=function(r,f,e){var o,h,s,c,l;if(!this.isInitialized()||!f||!e)return null;if(this.isNewInit(f,e))n=f[0],t=e[n];else if(!n||!t)return u.push(r),null;for(;0<u.length;)l=u.shift(),this.parse(l,f,e);return h=r,c=t,null!==(o=(s=n)?{seiNals:rvt(h,s)[s],timescale:c}:null)&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),i):null};this.pushNals=function(n){if(!this.isInitialized()||!n||0===n.length)return null;n.forEach(function(n){r.push(n)})};this.flushStream=function(){if(!this.isInitialized())return null;r.flush()};this.clearParsedCaptions=function(){i.captions=[];i.captionStreams={}};this.resetCaptionStream=function(){if(!this.isInitialized())return null;r.reset()};this.clearAllCaptions=function(){this.clearParsedCaptions();this.resetCaptionStream()};this.reset=function(){u=[];t=n=null;i?this.clearParsedCaptions():i={captions:[],captionStreams:{}};this.resetCaptionStream()};this.reset()},sut=Object.freeze({"default":hp,__moduleExports:hp}),cp=fut&&hr||fut,uvt=sut&&hp||sut,fvt={generator:uf,probe:fi,Transmuxer:cp.Transmuxer,AudioSegmentStream:cp.AudioSegmentStream,VideoSegmentStream:cp.VideoSegmentStream,CaptionParser:uvt}.CaptionParser,hut=function(n){var t=31&n[1];return t<<=8,t|n[2]},gh=function(n){return!!(64&n[1])},nc=function(n){var t=0;return 1<(48&n[3])>>>4&&(t+=n[4]+1),t},lp=function(n){switch(n){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}},ai={parseType:function(n,t){var i=hut(n);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(n){var i=gh(n),t=4+nc(n);return i&&(t+=n[t]+1),(31&n[t+10])<<8|n[t+11]},parsePmt:function(n){var u={},e=gh(n),t=4+nc(n),f,r,i;if(e&&(t+=n[t]+1),1&n[t+5]){for(f=3+((15&n[t+1])<<8|n[t+2])-4,r=12+((15&n[t+10])<<8|n[t+11]);r<f;)i=t+r,u[(31&n[i+1])<<8|n[i+2]]=n[i],r+=5+((15&n[i+3])<<8|n[i+4]);return u}},parsePayloadUnitStartIndicator:gh,parsePesType:function(n,t){switch(t[hut(n)]){case it.H264_STREAM_TYPE:return"video";case it.ADTS_STREAM_TYPE:return"audio";case it.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(n){var t,r,i;return gh(n)?(t=4+nc(n),t>=n.byteLength)?null:(i=null,192&(r=n[t+7])&&((i={}).pts=(14&n[t+9])<<27|(255&n[t+10])<<20|(254&n[t+11])<<12|(255&n[t+12])<<5|(254&n[t+13])>>>3,i.pts*=4,i.pts+=(6&n[t+13])>>>1,i.dts=i.pts,64&r&&(i.dts=(14&n[t+14])<<27|(255&n[t+15])<<20|(254&n[t+16])<<12|(255&n[t+17])<<5|(254&n[t+18])>>>3,i.dts*=4,i.dts+=(6&n[t+18])>>>1)),i):null},videoPacketContainsKeyFrame:function(n){for(var f=4+nc(n),i=n.subarray(f),t=0,r=0,u=!1;r<i.byteLength-3;r++)if(1===i[r+2]){t=r+5;break}for(;t<i.byteLength;)switch(i[t]){case 0:if(0!==i[t-1]){t+=2;break}if(0!==i[t-2]){t++;break}for(r+3!==t-2&&"slice_layer_without_partitioning_rbsp_idr"===lp(31&i[r+3])&&(u=!0);1!==i[++t]&&t<i.length;);r=t-2;t+=3;break;case 1:if(0!==i[t-1]||0!==i[t-2]){t+=3;break}"slice_layer_without_partitioning_rbsp_idr"===lp(31&i[r+3])&&(u=!0);r=t-2;t+=3;break;default:t+=3}return i=i.subarray(r),t-=r,r=0,i&&3<i.byteLength&&"slice_layer_without_partitioning_rbsp_idr"===lp(31&i[r+3])&&(u=!0),u}},evt=ai.parseType,ovt=ai.parsePat,svt=ai.parsePmt,hvt=ai.parsePayloadUnitStartIndicator,cvt=ai.parsePesType,lvt=ai.parsePesTime,avt=ai.videoPacketContainsKeyFrame,cut=Object.freeze({"default":ai,__moduleExports:ai,parseType:evt,parsePat:ovt,parsePmt:svt,parsePayloadUnitStartIndicator:hvt,parsePesType:cvt,parsePesTime:lvt,videoPacketContainsKeyFrame:avt}),vvt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],lut=function(n){return n[0]<<21|n[1]<<14|n[2]<<7|n[3]},cr={parseId3TagSize:function(n,t){var i=n[t+6]<<21|n[t+7]<<14|n[t+8]<<7|n[t+9];return(16&n[t+5])>>4?i+20:i+10},parseAdtsSize:function(n,t){var i=(224&n[t+5])>>5,r=n[t+4]<<3;return 6144&n[t+3]|r|i},parseType:function(n,t){return n[t]==="I".charCodeAt(0)&&n[t+1]==="D".charCodeAt(0)&&n[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&n[t]&&240==(240&n[t+1])?"audio":null},parseSampleRate:function(n){for(var t=0;t+5<n.length;){if(255===n[t]&&240==(246&n[t+1]))return vvt[(60&n[t+2])>>>2];t++}return null},parseAacTimestamp:function(n){var t,f,u,r,i,e;t=10;64&n[5]&&(t+=4,t+=lut(n.subarray(10,14)));do{if((f=lut(n.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(n[t],n[t+1],n[t+2],n[t+3]))for(u=n.subarray(t+10,t+f+10),r=0;r<u.byteLength;r++)if(0===u[r]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(n,t,i){for(var u="",r=t;r<i;r++)u+="%"+("00"+n[r].toString(16)).slice(-2);return u}(u,0,r)))return i=u.subarray(r+1),e=(1&i[3])<<30|i[4]<<22|i[5]<<14|i[6]<<6|i[7]>>>2,e*=4,e+(3&i[7]);break}t+=10;t+=f}while(t<n.byteLength);return null}},yvt=cr.parseId3TagSize,pvt=cr.parseAdtsSize,wvt=cr.parseType,bvt=cr.parseSampleRate,kvt=cr.parseAacTimestamp,aut=Object.freeze({"default":cr,__moduleExports:cr,parseId3TagSize:yvt,parseAdtsSize:pvt,parseType:wvt,parseSampleRate:bvt,parseAacTimestamp:kvt}),dvt=cut&&ai||cut,gvt=aut&&cr||aut,ef=ort.handleRollover,v={};v.ts=dvt;v.aac=gvt;var st=188,nyt=function(n,t,i){for(var r,s,h,e,u=0,f=st,o=!1;f<n.byteLength;)if(71!==n[u]||71!==n[f])u++,f++;else{switch(r=n.subarray(u,f),v.ts.parseType(r,t.pid)){case"pes":s=v.ts.parsePesType(r,t.table);h=v.ts.parsePayloadUnitStartIndicator(r);"audio"===s&&h&&(e=v.ts.parsePesTime(r))&&(e.type="audio",i.audio.push(e),o=!0)}if(o)break;u+=st;f+=st}for(u=(f=n.byteLength)-st,o=!1;0<=u;)if(71!==n[u]||71!==n[f])u--,f--;else{switch(r=n.subarray(u,f),v.ts.parseType(r,t.pid)){case"pes":s=v.ts.parsePesType(r,t.table);h=v.ts.parsePayloadUnitStartIndicator(r);"audio"===s&&h&&(e=v.ts.parsePesTime(r))&&(e.type="audio",i.audio.push(e),o=!0)}if(o)break;u-=st;f-=st}},tyt=function(n,t,i){for(var r,c,h,o,l,a,y,u=0,f=st,s=!1,e={data:[],size:0};f<n.byteLength;)if(71!==n[u]||71!==n[f])u++,f++;else{switch(r=n.subarray(u,f),v.ts.parseType(r,t.pid)){case"pes":if(c=v.ts.parsePesType(r,t.table),h=v.ts.parsePayloadUnitStartIndicator(r),"video"===c&&(h&&!s&&(o=v.ts.parsePesTime(r))&&(o.type="video",i.video.push(o),s=!0),!i.firstKeyFrame)){if(h&&0!==e.size){for(l=new Uint8Array(e.size),a=0;e.data.length;)y=e.data.shift(),l.set(y,a),a+=y.byteLength;v.ts.videoPacketContainsKeyFrame(l)&&(i.firstKeyFrame=v.ts.parsePesTime(l),i.firstKeyFrame.type="video");e.size=0}e.data.push(r);e.size+=r.byteLength}}if(s&&i.firstKeyFrame)break;u+=st;f+=st}for(u=(f=n.byteLength)-st,s=!1;0<=u;)if(71!==n[u]||71!==n[f])u--,f--;else{switch(r=n.subarray(u,f),v.ts.parseType(r,t.pid)){case"pes":c=v.ts.parsePesType(r,t.table);h=v.ts.parsePayloadUnitStartIndicator(r);"video"===c&&h&&(o=v.ts.parsePesTime(r))&&(o.type="video",i.video.push(o),s=!0)}if(s)break;u-=st;f-=st}},iyt=function(n){var i={pid:null,table:null},t={};for(var r in function(n,t){for(var r,u=0,i=st;i<n.byteLength;)if(71!==n[u]||71!==n[i])u++,i++;else{switch(r=n.subarray(u,i),v.ts.parseType(r,t.pid)){case"pat":t.pid||(t.pid=v.ts.parsePat(r));break;case"pmt":t.table||(t.table=v.ts.parsePmt(r))}if(t.pid&&t.table)return;u+=st;i+=st}}(n,i),i.table)if(i.table.hasOwnProperty(r))switch(i.table[r]){case it.H264_STREAM_TYPE:t.video=[];tyt(n,i,t);0===t.video.length&&delete t.video;break;case it.ADTS_STREAM_TYPE:t.audio=[];nyt(n,i,t);0===t.audio.length&&delete t.audio}return t},ryt=function(n,t){var r,i;return(i=(r=n)[0]==="I".charCodeAt(0)&&r[1]==="D".charCodeAt(0)&&r[2]==="3".charCodeAt(0)?function(n){for(var s,f,u=!1,o=0,e=null,i=null,r=0,t=0;3<=n.length-t;){switch(v.aac.parseType(n,t)){case"timed-metadata":if(n.length-t<10){u=!0;break}if((r=v.aac.parseId3TagSize(n,t))>n.length){u=!0;break}null===i&&(f=n.subarray(t,t+r),i=v.aac.parseAacTimestamp(f));t+=r;break;case"audio":if(n.length-t<7){u=!0;break}if((r=v.aac.parseAdtsSize(n,t))>n.length){u=!0;break}null===e&&(f=n.subarray(t,t+r),e=v.aac.parseSampleRate(f));o++;t+=r;break;default:t++}if(u)return null}return null===e||null===i?null:(s=9e4/e,{audio:[{type:"audio",dts:i,pts:i},{type:"audio",dts:i+1024*o*s,pts:i+1024*o*s}]})}(n):iyt(n))&&(i.audio||i.video)?(function(n,t){var u,r,i;n.audio&&n.audio.length&&(u=t,"undefined"==typeof u&&(u=n.audio[0].dts),n.audio.forEach(function(n){n.dts=ef(n.dts,u);n.pts=ef(n.pts,u);n.dtsTime=n.dts/9e4;n.ptsTime=n.pts/9e4}));n.video&&n.video.length&&(r=t,("undefined"==typeof r&&(r=n.video[0].dts),n.video.forEach(function(n){n.dts=ef(n.dts,r);n.pts=ef(n.pts,r);n.dtsTime=n.dts/9e4;n.ptsTime=n.pts/9e4}),n.firstKeyFrame)&&(i=n.firstKeyFrame,i.dts=ef(i.dts,r),i.pts=ef(i.pts,r),i.dtsTime=i.dts/9e4,i.ptsTime=i.dts/9e4))}(i,t),i):null},tc=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");},uyt=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),fyt=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":d(t))&&"function"!=typeof t?n:t},eyt=function(){for(var h=[[[],[],[],[],[]],[[],[],[],[],[]]],f=h[0],e=h[1],l=f[4],y=e[4],n=void 0,i=void 0,t=void 0,u=[],a=[],c=void 0,v=void 0,r=void 0,o=void 0,s=void 0,n=0;n<256;n++)a[(u[n]=n<<1^283*(n>>7))^n]=n;for(i=t=0;!l[i];i^=c||1,t=a[t]||1)for(r=(r=t^t<<1^t<<2^t<<3^t<<4)>>8^255&r^99,s=16843009*u[v=u[c=u[y[l[i]=r]=i]]]^65537*v^257*c^16843008*i,o=257*u[r]^16843008*r,n=0;n<4;n++)f[n][i]=o=o<<24^o>>>8,e[n][r]=s=s<<24^s>>>8;for(n=0;n<5;n++)f[n]=f[n].slice(0),e[n]=e[n].slice(0);return h},dt=null,oyt=function(){function n(t){tc(this,n);dt||(dt=eyt());this._tables=[[dt[0][0].slice(),dt[0][1].slice(),dt[0][2].slice(),dt[0][3].slice(),dt[0][4].slice()],[dt[1][0].slice(),dt[1][1].slice(),dt[1][2].slice(),dt[1][3].slice(),dt[1][4].slice()]];var r=void 0,o=void 0,i=void 0,e=void 0,c=void 0,f=this._tables[0][4],s=this._tables[1],u=t.length,h=1;if(4!==u&&6!==u&&8!==u)throw new Error("Invalid aes key size");for(e=t.slice(0),c=[],this._key=[e,c],r=u;r<4*u+28;r++)i=e[r-1],(r%u==0||8===u&&r%u==4)&&(i=f[i>>>24]<<24^f[i>>16&255]<<16^f[i>>8&255]<<8^f[255&i],r%u==0&&(i=i<<8^i>>>24^h<<24,h=h<<1^283*(h>>7))),e[r]=e[r-u]^i;for(o=0;r;o++,r--)i=e[3&o?r:r-4],c[o]=r<=4||o<4?i:s[0][f[i>>>24]]^s[1][f[i>>16&255]]^s[2][f[i>>8&255]]^s[3][f[255&i]]}return n.prototype.decrypt=function(n,t,i,r,u,f){for(var e=this._key[1],o=n^e[0],s=r^e[1],h=i^e[2],c=t^e[3],y=void 0,g=void 0,nt=void 0,tt=e.length/4-2,l=void 0,a=4,v=this._tables[1],p=v[0],w=v[1],b=v[2],k=v[3],d=v[4],l=0;l<tt;l++)y=p[o>>>24]^w[s>>16&255]^b[h>>8&255]^k[255&c]^e[a],g=p[s>>>24]^w[h>>16&255]^b[c>>8&255]^k[255&o]^e[a+1],nt=p[h>>>24]^w[c>>16&255]^b[o>>8&255]^k[255&s]^e[a+2],c=p[c>>>24]^w[o>>16&255]^b[s>>8&255]^k[255&h]^e[a+3],a+=4,o=y,s=g,h=nt;for(l=0;l<4;l++)u[(3&-l)+f]=d[o>>>24]<<24^d[s>>16&255]<<16^d[h>>8&255]<<8^d[255&c]^e[a++],y=o,o=s,s=h,h=c,c=y},n}(),vut=function(){function n(){tc(this,n);this.listeners={}}return n.prototype.on=function(n,t){this.listeners[n]||(this.listeners[n]=[]);this.listeners[n].push(t)},n.prototype.off=function(n,t){if(!this.listeners[n])return!1;var i=this.listeners[n].indexOf(t);return this.listeners[n].splice(i,1),-1<i},n.prototype.trigger=function(n){var t=this.listeners[n],u,i;if(t)if(2===arguments.length)for(u=t.length,i=0;i<u;++i)t[i].call(this,arguments[1]);else for(var f=Array.prototype.slice.call(arguments,1),e=t.length,r=0;r<e;++r)t[r].apply(this,f)},n.prototype.dispose=function(){this.listeners={}},n.prototype.pipe=function(n){this.on("data",function(t){n.push(t)})},n}(),yut=function(n){function t(){tc(this,t);var i=fyt(this,n.call(this,vut));return i.jobs=[],i.delay=1,i.timeout_=null,i}return function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":d(t)));n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)}(t,n),t.prototype.processJob_=function(){this.jobs.shift()();this.timeout_=this.jobs.length?setTimeout(this.processJob_.bind(this),this.delay):null},t.prototype.push=function(n){this.jobs.push(n);this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(vut),gt=function(n){return n<<24|(65280&n)<<8|(16711680&n)>>8|n>>>24},put=function(n,t,i){var f=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>2),p=new oyt(Array.prototype.slice.call(t)),y=new Uint8Array(n.byteLength),u=new Int32Array(y.buffer),e=void 0,o=void 0,s=void 0,h=void 0,c=void 0,l=void 0,a=void 0,v=void 0,r=void 0;for(e=i[0],o=i[1],s=i[2],h=i[3],r=0;r<f.length;r+=4)c=gt(f[r]),l=gt(f[r+1]),a=gt(f[r+2]),v=gt(f[r+3]),p.decrypt(c,l,a,v,u,r),u[r]=gt(u[r]^e),u[r+1]=gt(u[r+1]^o),u[r+2]=gt(u[r+2]^s),u[r+3]=gt(u[r+3]^h),e=c,o=l,s=a,h=v;return y},syt=function(){function n(t,i,r,u){tc(this,n);var o=n.STEP,e=new Int32Array(t.buffer),s=new Uint8Array(t.byteLength),f=0;for(this.asyncStream_=new yut,this.asyncStream_.push(this.decryptChunk_(e.subarray(f,f+o),i,r,s)),f=o;f<e.length;f+=o)r=new Uint32Array([gt(e[f-4]),gt(e[f-3]),gt(e[f-2]),gt(e[f-1])]),this.asyncStream_.push(this.decryptChunk_(e.subarray(f,f+o),i,r,s));this.asyncStream_.push(function(){var n;u(null,(n=s).subarray(0,n.byteLength-n[n.byteLength-1]))})}return n.prototype.decryptChunk_=function(n,t,i,r){return function(){var u=put(n,t,i);r.set(u,n.byteOffset)}},uyt(n,null,[{key:"STEP",get:function(){return 32e3}}]),n}(),ki=function(n,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(n)||(n=fh.buildAbsoluteURL(t.location.href,n)),fh.buildAbsoluteURL(n,i))},ni=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");},oi=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),di=function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":d(t)));n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)},vi=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":d(t))&&"function"!=typeof t?n:t},hyt=function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return function(n,t){var r=[],u=!0,f=!1,e=void 0,o,i;try{for(i=n[Symbol.iterator]();!(u=(o=i.next()).done)&&(r.push(o.value),!t||r.length!==t);u=!0);}catch(n){f=!0;e=n}finally{try{!u&&i.return&&i.return()}finally{if(f)throw e;}}return r}(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance");},ap=n.mergeOptions,cyt=n.EventTarget,lyt=n.log,vp=function(n,t){["AUDIO","SUBTITLES"].forEach(function(i){var r,u,f;for(r in n.mediaGroups[i])for(u in n.mediaGroups[i][r])f=n.mediaGroups[i][r][u],t(f,i,r,u)})},yp=function(n,t){var r=ap(n,{}),i=r.playlists[t.uri],u,f;if(!i||i.segments&&t.segments&&i.segments.length===t.segments.length&&i.mediaSequence===t.mediaSequence)return null;for(u=ap(i,t),i.segments&&(u.segments=function(n,t,i){var u=t.slice(),f,r;for(i=i||0,f=Math.min(n.length,t.length+i),r=i;r<f;r++)u[r-i]=ap(n[r],u[r-i]);return u}(i.segments,t.segments,t.mediaSequence-i.mediaSequence)),u.segments.forEach(function(n){var t,i;t=n;i=u.resolvedUri;t.resolvedUri||(t.resolvedUri=ki(i,t.uri));t.key&&!t.key.resolvedUri&&(t.key.resolvedUri=ki(i,t.key.uri));t.map&&!t.map.resolvedUri&&(t.map.resolvedUri=ki(i,t.map.uri))}),f=0;f<r.playlists.length;f++)r.playlists[f].uri===t.uri&&(r.playlists[f]=u);return r.playlists[t.uri]=u,r},wut=function(n){for(var t,i=n.playlists.length;i--;)t=n.playlists[i],(n.playlists[t.uri]=t).resolvedUri=ki(n.uri,t.uri),t.id=i,t.attributes||(t.attributes={},lyt.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))},but=function(n){vp(n,function(t){t.uri&&(t.resolvedUri=ki(n.uri,t.uri))})},kut=function(n,t){var i=n.segments[n.segments.length-1];return t&&i&&i.duration?1e3*i.duration:500*(n.targetDuration||10)},ic=function(){function n(t,i,r){ni(this,n);var u=vi(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));if(u.srcUrl=t,u.hls_=i,u.withCredentials=r,!u.srcUrl)throw new Error("A non-empty playlist URL is required");return u.state="HAVE_NOTHING",u.on("mediaupdatetimeout",function(){"HAVE_METADATA"===u.state&&(u.state="HAVE_CURRENT_METADATA",u.request=u.hls_.xhr({uri:ki(u.master.uri,u.media().uri),withCredentials:u.withCredentials},function(n){if(u.request)return n?u.playlistRequestError(u.request,u.media().uri,"HAVE_METADATA"):void u.haveMetadata(u.request,u.media().uri)}))}),u}return di(n,cyt),oi(n,[{key:"playlistRequestError",value:function(n,t,i){this.request=null;i&&(this.state=i);this.error={playlist:this.master.playlists[t],status:n.status,message:"HLS playlist request error at URL: "+t,responseText:n.responseText,code:500<=n.status?4:2};this.trigger("error")}},{key:"haveMetadata",value:function(n,i){var f=this,r,u;this.request=null;this.state="HAVE_METADATA";r=new pn;r.push(n.responseText);r.end();r.manifest.uri=i;r.manifest.attributes=r.manifest.attributes||{};u=yp(this.master,r.manifest);this.targetDuration=r.manifest.targetDuration;u?(this.master=u,this.media_=this.master.playlists[r.manifest.uri]):this.trigger("playlistunchanged");this.media().endList||(t.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=t.setTimeout(function(){f.trigger("mediaupdatetimeout")},kut(this.media(),!!u)));this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.stopRequest();t.clearTimeout(this.mediaUpdateTimeout)}},{key:"stopRequest",value:function(){if(this.request){var n=this.request;this.request=null;n.onreadystatechange=null;n.abort()}}},{key:"media",value:function(n){var t=this,i,r;if(!n)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if(i=this.state,"string"==typeof n){if(!this.master.playlists[n])throw new Error("Unknown playlist URI: "+n);n=this.master.playlists[n]}if(r=!this.media_||n.uri!==this.media_.uri,this.master.playlists[n.uri].endList)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=n,void(r&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(r){if(this.state="SWITCHING_MEDIA",this.request){if(ki(this.master.uri,n.uri)===this.request.url)return;this.request.onreadystatechange=null;this.request.abort();this.request=null}this.media_&&this.trigger("mediachanging");this.request=this.hls_.xhr({uri:ki(this.master.uri,n.uri),withCredentials:this.withCredentials},function(r,u){if(t.request){if(r)return t.playlistRequestError(t.request,n.uri,i);t.haveMetadata(u,n.uri);"HAVE_MASTER"===i?t.trigger("loadedmetadata"):t.trigger("mediachange")}})}}},{key:"pause",value:function(){this.stopRequest();t.clearTimeout(this.mediaUpdateTimeout);"HAVE_NOTHING"===this.state&&(this.started=!1);"SWITCHING_MEDIA"===this.state?this.state=this.media_?"HAVE_METADATA":"HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}},{key:"load",value:function(n){var u=this,i,r;t.clearTimeout(this.mediaUpdateTimeout);i=this.media();n?(r=i?i.targetDuration*500:5e3,this.mediaUpdateTimeout=t.setTimeout(function(){return u.load()},r)):this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"start",value:function(){var n=this;this.started=!0;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(i,r){if(n.request){if(n.request=null,i)return n.error={status:r.status,message:"HLS playlist request error at URL: "+n.srcUrl,responseText:r.responseText,code:2},"HAVE_NOTHING"===n.state&&(n.started=!1),n.trigger("error");var u=new pn;return u.push(r.responseText),u.end(),n.state="HAVE_MASTER",u.manifest.uri=n.srcUrl,u.manifest.playlists?(n.master=u.manifest,wut(n.master),but(n.master),n.trigger("loadedplaylist"),void(n.request||n.media(u.manifest.playlists[0]))):(n.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:t.location.href,playlists:[{uri:n.srcUrl,id:0}]},n.master.playlists[n.srcUrl]=n.master.playlists[0],n.master.playlists[0].resolvedUri=n.srcUrl,n.master.playlists[0].attributes=n.master.playlists[0].attributes||{},n.haveMetadata(r,n.srcUrl),n.trigger("loadedmetadata"))}})}}]),n}(),dut=n.createTimeRange,gut=function(n,t,i){var r,u;return"undefined"==typeof t&&(t=n.mediaSequence+n.segments.length),t<n.mediaSequence?0:(r=function(n,t){var r=0,u=t-n.mediaSequence,i=n.segments[u];if(i){if("undefined"!=typeof i.start)return{result:i.start,precise:!0};if("undefined"!=typeof i.end)return{result:i.end-i.duration,precise:!0}}for(;u--;){if("undefined"!=typeof(i=n.segments[u]).end)return{result:r+i.end,precise:!0};if(r+=i.duration,"undefined"!=typeof i.start)return{result:r+i.start,precise:!0}}return{result:r,precise:!1}}(n,t)).precise?r.result:(u=function(n,t){for(var r=0,i=void 0,u=t-n.mediaSequence;u<n.segments.length;u++){if("undefined"!=typeof(i=n.segments[u]).start)return{result:i.start-r,precise:!0};if(r+=i.duration,"undefined"!=typeof i.end)return{result:i.end-r,precise:!0}}return{result:-1,precise:!1}}(n,t)).precise?u.result:r.result+i},nft=function(n,i,r){if(!n)return 0;if("number"!=typeof r&&(r=0),"undefined"==typeof i){if(n.totalDuration)return n.totalDuration;if(!n.endList)return t.Infinity}return gut(n,i,r)},to=function(n,t,i){var u=0,f,e,r;if(i<t&&(f=[i,t],t=f[0],i=f[1]),t<0){for(e=t;e<Math.min(0,i);e++)u+=n.targetDuration;t=0}for(r=t;r<i;r++)u+=n.segments[r].duration;return u},tft=function(n){if(!n.segments.length)return 0;for(var t=n.segments.length-1,i=n.segments[t].duration||n.targetDuration,r=i+2*n.targetDuration;t--&&!(r<=(i+=n.segments[t].duration)););return Math.max(0,t)},ift=function(n,t,i){if(!n||!n.segments)return null;if(n.endList)return nft(n);if(null===t)return null;t=t||0;var r=i?tft(n):n.segments.length;return gut(n,n.mediaSequence+r,t)},rft=function(n){return n-Math.floor(n)==0},uft=function(n,t){var r,i,u,f;if(rft(t))return t+.1*n;for(r=t.toString().split(".")[1].length,i=1;i<=r;i++)if(u=Math.pow(10,i),f=t*u,rft(f)||i===r)return(f+n)/u},ayt=uft.bind(null,1),vyt=uft.bind(null,-1),fft=function(n){return n.excludeUntil&&n.excludeUntil>Date.now()},pp=function(n){return n.excludeUntil&&n.excludeUntil===1/0},rc=function(n){var t=fft(n);return!n.disabled&&!t},eft=function(n,t){return t.attributes&&t.attributes[n]},wp=function(n,t){if(1===n.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===n.playlists.filter(function(n){return!!rc(n)&&(n.attributes.BANDWIDTH||0)<i}).length},wt={duration:nft,seekable:function(n,t){var r=t||0,i=ift(n,t,!0);return null===i?dut():dut(r,i)},safeLiveIndex:tft,getMediaInfoForTime:function(n,t,i,r){var u=void 0,f=void 0,o=n.segments.length,e=t-r;if(e<0){if(0<i)for(u=i-1;0<=u;u--)if(f=n.segments[u],0<(e+=vyt(f.duration)))return{mediaIndex:u,startTime:r-to(n,i,u)};return{mediaIndex:0,startTime:t}}if(i<0){for(u=i;u<0;u++)if((e-=n.targetDuration)<0)return{mediaIndex:0,startTime:t};i=0}for(u=i;u<o;u++)if(f=n.segments[u],(e-=ayt(f.duration))<0)return{mediaIndex:u,startTime:r+to(n,i,u)};return{mediaIndex:o-1,startTime:t}},isEnabled:rc,isDisabled:function(n){return n.disabled},isBlacklisted:fft,isIncompatible:pp,playlistEnd:ift,isAes:function(n){for(var t=0;t<n.segments.length;t++)if(n.segments[t].key)return!0;return!1},isFmp4:function(n){for(var t=0;t<n.segments.length;t++)if(n.segments[t].map)return!0;return!1},hasAttribute:eft,estimateSegmentRequestTime:function(n,t,i){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;return eft("BANDWIDTH",i)?(n*i.attributes.BANDWIDTH-8*r)/t:NaN},isLowestEnabledRendition:wp},yyt=n.xhr,pyt=n.mergeOptions,oft=function(){return function t(i,r){var f,e,u,o;return i=pyt({timeout:45e3},i),f=t.beforeRequest||n.Hls.xhr.beforeRequest,f&&"function"==typeof f&&(e=f(i),e&&(i=e)),u=yyt(i,function(n,t){var i=u.response;!n&&i&&(u.responseTime=Date.now(),u.roundTripTime=u.responseTime-u.requestTime,u.bytesReceived=i.byteLength||i.length,u.bandwidth||(u.bandwidth=Math.floor(u.bytesReceived/u.roundTripTime*8e3)));t.headers&&(u.responseHeaders=t.headers);n&&"ETIMEDOUT"===n.code&&(u.timedout=!0);n||u.aborted||200===t.statusCode||206===t.statusCode||0===t.statusCode||(n=new Error("XHR Failed with a response of: "+(u&&(i||u.responseText))));r(n,u)}),o=u.abort,u.abort=function(){return u.aborted=!0,o.apply(u,arguments)},u.uri=i.uri,u.requestTime=Date.now(),u}},wyt=function(n,t){var i=n.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},byt=function(n){return 32<=n&&n<126?String.fromCharCode(n):"."},sft=function(n){var t={};return Object.keys(n).forEach(function(i){var r=n[i];t[i]=ArrayBuffer.isView(r)?{bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:r}),t},uc=function(n){var t=n.byterange||{length:1/0,offset:0};return[t.length,t.offset,n.resolvedUri].join(",")},hft=function(n){for(var i=Array.prototype.slice.call(n),r="",t=0;t<i.length/16;t++)r+=i.slice(16*t,16*t+16).map(wyt).join("")+" "+i.slice(16*t,16*t+16).map(byt).join("")+"\n";return r},kyt=Object.freeze({createTransferableMessage:sft,initSegmentId:uc,hexDump:hft,tagDump:function(n){var t=n.bytes;return hft(t)},textRanges:function(n){for(var r,i,u="",t=void 0,t=0;t<n.length;t++)u+=(i=t,(r=n).start(i)+"-"+r.end(i)+" ");return u}}),io=1/30,cft=function(t,i){var u=[],r=void 0;if(t&&t.length)for(r=0;r<t.length;r++)i(t.start(r),t.end(r))&&u.push([t.start(r),t.end(r)]);return n.createTimeRanges(u)},lft=function(n,t){return cft(n,function(n,i){return n-io<=t&&t<=i+io})},aft=function(n,t){return cft(n,function(n){return t<=n-io})},bp=function(n){var i=[],t;if(!n||!n.length)return"";for(t=0;t<n.length;t++)i.push(n.start(t)+" => "+n.end(t));return i.join(", ")},vft=function(n){for(var i=[],t=0;t<n.length;t++)i.push({start:n.start(t),end:n.end(t)});return i},of=function(n,t,i){var r=void 0,u=void 0;if(i&&i.cues)for(r=i.cues.length;r--;)(u=i.cues[r]).startTime<=t&&u.endTime>=n&&i.removeCue(u)},yft=function(n){return isNaN(n)||Math.abs(n)===1/0?Number.MAX_VALUE:n},dyt=function(i,r,u){var h=t.WebKitDataCue||t.VTTCue,c,o,s;if((r&&r.forEach(function(n){var t=n.stream;this.inbandTextTracks_[t].addCue(new h(n.startTime+this.timestampOffset,n.endTime+this.timestampOffset,n.text))},i),u)&&(c=yft(i.mediaSource_.duration),u.forEach(function(t){var i=t.cueTime+this.timestampOffset;t.frames.forEach(function(t){var r,u=new h(i,i,t.value||t.url||t.data||"");u.frame=t;u.value=t;r=u;Object.defineProperties(r.frame,{id:{get:function(){return n.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),r.value.key}},value:{get:function(){return n.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),r.value.data}},privateData:{get:function(){return n.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),r.value.data}}});this.metadataTrack_.addCue(u)},this)},i),i.metadataTrack_&&i.metadataTrack_.cues&&i.metadataTrack_.cues.length)){for(var e=i.metadataTrack_.cues,l=[],f=0;f<e.length;f++)e[f]&&l.push(e[f]);o=l.reduce(function(n,t){var i=n[t.startTime]||[];return i.push(t),n[t.startTime]=i,n},{});s=Object.keys(o).sort(function(n,t){return Number(n)-Number(t)});s.forEach(function(n,t){var i=o[n],r=Number(s[t+1])||c;i.forEach(function(n){n.endTime=r})})}},ru="undefined"!=typeof window?window:{},kp="undefined"==typeof Symbol?"__target":Symbol(),gyt="application/javascript",npt=ru.BlobBuilder||ru.WebKitBlobBuilder||ru.MozBlobBuilder||ru.MSBlobBuilder,sf=ru.URL||ru.webkitURL||sf&&sf.msURL,hf=ru.Worker;if(hf){gp=wft("self.onmessage = function () {}");nw=new Uint8Array(1);try{(dp=new hf(gp)).postMessage(nw,[nw.buffer])}catch(gi){hf=null}finally{sf.revokeObjectURL(gp);dp&&dp.terminate()}}var tpt=new pft("./transmuxer-worker.worker.js",function(){var n=this;!function(){var i,pi,wi,bi,ki,di,k,at,gi,nr,tr,ir,rr,ur,fr,er,or,sr,hr,cr,vt,t,yt,lr,ar,vr,yr,pr,wr,br,kr,it,dr,gr,nu,tu,iu,ru,uu,pt,fu=Math.pow(2,32)-1,gt,ot,ni,lu,au,ti,st,ii,s,ri,ui,ht,vu,fi,yu,ei,pu;!function(){var n;if(t={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(n in t)t.hasOwnProperty(n)&&(t[n]=[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]);yt=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]);ar=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]);lr=new Uint8Array([0,0,0,1]);vr=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]);yr=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);pr={video:vr,audio:yr};kr=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);br=new Uint8Array([0,0,0,0,0,0,0,0]);it=new Uint8Array([0,0,0,0,0,0,0,0]);dr=it;gr=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);nu=it;wr=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}();i=function(n){for(var i,r=[],u=0,t=1;t<arguments.length;t++)r.push(arguments[t]);for(t=r.length;t--;)u+=r[t].byteLength;for(i=new Uint8Array(u+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(n,4),t=0,u=8;t<r.length;t++)i.set(r[t],u),u+=r[t].byteLength;return i};pi=function(){return i(t.dinf,i(t.dref,kr))};wi=function(n){return i(t.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,n.audioobjecttype<<3|n.samplingfrequencyindex>>>1,n.samplingfrequencyindex<<7|n.channelcount<<3,6,1,2]))};fr=function(n){return i(t.hdlr,pr[n])};ur=function(n){var r=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,n.duration>>>24&255,n.duration>>>16&255,n.duration>>>8&255,255&n.duration,85,196,0,0]);return n.samplerate&&(r[12]=n.samplerate>>>24&255,r[13]=n.samplerate>>>16&255,r[14]=n.samplerate>>>8&255,r[15]=255&n.samplerate),i(t.mdhd,r)};rr=function(n){return i(t.mdia,ur(n),fr(n.type),di(n))};ki=function(n){return i(t.mfhd,new Uint8Array([0,0,0,0,(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n]))};di=function(n){return i(t.minf,"video"===n.type?i(t.vmhd,wr):i(t.smhd,br),pi(),or(n))};k=function(n,r){for(var f=[],u=r.length;u--;)f[u]=hr(r[u]);return i.apply(null,[t.moof,ki(n)].concat(f))};at=function(n){for(var r=n.length,u=[];r--;)u[r]=tr(n[r]);return i.apply(null,[t.moov,nr(4294967295)].concat(u).concat(gi(n)))};gi=function(n){for(var r=n.length,u=[];r--;)u[r]=cr(n[r]);return i.apply(null,[t.mvex].concat(u))};nr=function(n){var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n,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 i(t.mvhd,r)};er=function(n){for(var u,f=n.samples||[],e=new Uint8Array(4+f.length),r=0;r<f.length;r++)u=f[r].flags,e[r+4]=u.dependsOn<<4|u.isDependedOn<<2|u.hasRedundancy;return i(t.sdtp,e)};or=function(n){return i(t.stbl,sr(n),i(t.stts,nu),i(t.stsc,dr),i(t.stsz,gr),i(t.stco,it))};sr=function(n){return i(t.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===n.type?tu(n):iu(n))};tu=function(n){for(var u=n.sps||[],f=n.pps||[],e=[],o=[],r=0;r<u.length;r++)e.push((65280&u[r].byteLength)>>>8),e.push(255&u[r].byteLength),e=e.concat(Array.prototype.slice.call(u[r]));for(r=0;r<f.length;r++)o.push((65280&f[r].byteLength)>>>8),o.push(255&f[r].byteLength),o=o.concat(Array.prototype.slice.call(f[r]));return i(t.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&n.width)>>8,255&n.width,(65280&n.height)>>8,255&n.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i(t.avcC,new Uint8Array([1,n.profileIdc,n.profileCompatibility,n.levelIdc,255].concat([u.length]).concat(e).concat([f.length]).concat(o))),i(t.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))};iu=function(n){return i(t.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&n.channelcount)>>8,255&n.channelcount,(65280&n.samplesize)>>8,255&n.samplesize,0,0,0,0,(65280&n.samplerate)>>8,255&n.samplerate,0,0]),wi(n))};ir=function(n){var r=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&n.id)>>24,(16711680&n.id)>>16,(65280&n.id)>>8,255&n.id,0,0,0,0,(4278190080&n.duration)>>24,(16711680&n.duration)>>16,(65280&n.duration)>>8,255&n.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&n.width)>>8,255&n.width,0,0,(65280&n.height)>>8,255&n.height,0,0]);return i(t.tkhd,r)};hr=function(n){var e,o,f,s,r,u;return e=i(t.tfhd,new Uint8Array([0,0,0,58,(4278190080&n.id)>>24,(16711680&n.id)>>16,(65280&n.id)>>8,255&n.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(n.baseMediaDecodeTime/(fu+1)),u=Math.floor(n.baseMediaDecodeTime%(fu+1)),o=i(t.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,u>>>24&255,u>>>16&255,u>>>8&255,255&u])),"audio"===n.type?(f=vt(n,92),i(t.traf,e,o,f)):(s=er(n),f=vt(n,s.length+92),i(t.traf,e,o,f,s))};tr=function(n){return n.duration=n.duration||4294967295,i(t.trak,ir(n),rr(n))};cr=function(n){var r=new Uint8Array([0,0,0,0,(4278190080&n.id)>>24,(16711680&n.id)>>16,(65280&n.id)>>8,255&n.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==n.type&&(r[r.length-1]=0),i(t.trex,r)};pt=function(n,t){var i=0,r=0,u=0,f=0;return n.length&&(void 0!==n[0].duration&&(i=1),void 0!==n[0].size&&(r=2),void 0!==n[0].flags&&(u=4),void 0!==n[0].compositionTimeOffset&&(f=8)),[0,0,i|r|u|f,1,(4278190080&n.length)>>>24,(16711680&n.length)>>>16,(65280&n.length)>>>8,255&n.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]};uu=function(n,r){var f,e,u,o;for(r+=20+16*(e=n.samples||[]).length,f=pt(e,r),o=0;o<e.length;o++)u=e[o],f=f.concat([(4278190080&u.duration)>>>24,(16711680&u.duration)>>>16,(65280&u.duration)>>>8,255&u.duration,(4278190080&u.size)>>>24,(16711680&u.size)>>>16,(65280&u.size)>>>8,255&u.size,u.flags.isLeading<<2|u.flags.dependsOn,u.flags.isDependedOn<<6|u.flags.hasRedundancy<<4|u.flags.paddingValue<<1|u.flags.isNonSyncSample,61440&u.flags.degradationPriority,15&u.flags.degradationPriority,(4278190080&u.compositionTimeOffset)>>>24,(16711680&u.compositionTimeOffset)>>>16,(65280&u.compositionTimeOffset)>>>8,255&u.compositionTimeOffset]);return i(t.trun,new Uint8Array(f))};ru=function(n,r){var f,e,u,o;for(r+=20+8*(e=n.samples||[]).length,f=pt(e,r),o=0;o<e.length;o++)u=e[o],f=f.concat([(4278190080&u.duration)>>>24,(16711680&u.duration)>>>16,(65280&u.duration)>>>8,255&u.duration,(4278190080&u.size)>>>24,(16711680&u.size)>>>16,(65280&u.size)>>>8,255&u.size]);return i(t.trun,new Uint8Array(f))};vt=function(n,t){return"audio"===n.type?ru(n,t):uu(n,t)};var c,wt,p={ftyp:bi=function(){return i(t.ftyp,yt,lr,yt,ar)},mdat:function(n){return i(t.mdat,n)},moof:k,moov:at,initSegment:function(n){var t,i=bi(),r=at(n);return(t=new Uint8Array(i.byteLength+r.byteLength)).set(i),t.set(r,i.byteLength),t}},w=function(n){return n>>>0},a={findBox:c=function(n,t){var i,f,e,r,o,u=[];if(!t.length)return null;for(i=0;i<n.byteLength;)f=w(n[i]<<24|n[i+1]<<16|n[i+2]<<8|n[i+3]),e=wt(n.subarray(i+4,i+8)),r=1<f?i+f:n.byteLength,e===t[0]&&(1===t.length?u.push(n.subarray(i+8,r)):(o=c(n.subarray(i+8,r),t.slice(1))).length&&(u=u.concat(o))),i=r;return u},parseType:wt=function(n){var t="";return t+=String.fromCharCode(n[0]),t+=String.fromCharCode(n[1]),t+=String.fromCharCode(n[2]),t+String.fromCharCode(n[3])},timescale:function(n){return c(n,["moov","trak"]).reduce(function(n,t){var r,f,i,e,u;return(r=c(t,["tkhd"])[0])?(f=r[0],e=w(r[i=0===f?12:20]<<24|r[i+1]<<16|r[i+2]<<8|r[i+3]),(u=c(t,["mdia","mdhd"])[0])?(i=0===(f=u[0])?12:20,n[e]=w(u[i]<<24|u[i+1]<<16|u[i+2]<<8|u[i+3]),n):null):null},{})},startTime:function(n,t){var r,u,i;return r=c(t,["moof","traf"]),u=[].concat.apply([],r.map(function(t){return c(t,["tfhd"]).map(function(i){var r,u;return r=w(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),u=n[r]||9e4,(c(t,["tfdt"]).map(function(n){var i,t;return i=n[0],t=w(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),1===i&&(t*=Math.pow(2,32),t+=w(n[8]<<24|n[9]<<16|n[10]<<8|n[11])),t})[0]||1/0)/u})})),i=Math.min.apply(null,u),isFinite(i)?i:0},videoTrackIds:function(n){var i=c(n,["moov","trak"]),t=[];return i.forEach(function(n){var i=c(n,["mdia","hdlr"]),r=c(n,["tkhd"]);i.forEach(function(n,i){var u,e,o=wt(n.subarray(8,12)),f=r[i];"vide"===o&&(e=0===(u=new DataView(f.buffer,f.byteOffset,f.byteLength)).getUint8(0)?u.getUint32(12):u.getUint32(20),t.push(e))})}),t}},rt=function(){this.init=function(){var n={};this.on=function(t,i){n[t]||(n[t]=[]);n[t]=n[t].concat(i)};this.off=function(t,i){var r;return!!n[t]&&(r=n[t].indexOf(i),n[t]=n[t].slice(),n[t].splice(r,1),-1<r)};this.trigger=function(t){var r,i,u,f;if(r=n[t])if(2===arguments.length)for(u=r.length,i=0;i<u;++i)r[i].call(this,arguments[1]);else{for(f=[],i=arguments.length,i=1;i<arguments.length;++i)f.push(arguments[i]);for(u=r.length,i=0;i<u;++i)r[i].apply(this,f)}};this.dispose=function(){n={}}}};rt.prototype.pipe=function(n){return this.on("data",function(t){n.push(t)}),this.on("done",function(t){n.flush(t)}),n};rt.prototype.push=function(n){this.trigger("data",n)};rt.prototype.flush=function(n){this.trigger("done",n)};var f=rt,ff=function(n){for(var i,t=[],r=[],u=t.byteLength=0;u<n.length;u++)"access_unit_delimiter_rbsp"===(i=n[u]).nalUnitType?(t.length&&(t.duration=i.dts-t.dts,r.push(t)),(t=[i]).byteLength=i.data.byteLength,t.pts=i.pts,t.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(t.keyFrame=!0),t.duration=i.dts-t.dts,t.byteLength+=i.data.byteLength,t.push(i));return r.length&&(!t.duration||t.duration<=0)&&(t.duration=r[r.length-1].duration),r.push(t),r},ef=function(n){var u,r,t=[],i=[];for(t.byteLength=0,t.nalCount=0,t.duration=0,t.pts=n[0].pts,t.dts=n[0].dts,i.byteLength=0,i.nalCount=0,i.duration=0,i.pts=n[0].pts,i.dts=n[0].dts,u=0;u<n.length;u++)(r=n[u]).keyFrame?(t.length&&(i.push(t),i.byteLength+=t.byteLength,i.nalCount+=t.nalCount,i.duration+=t.duration),(t=[r]).nalCount=r.length,t.byteLength=r.byteLength,t.pts=r.pts,t.dts=r.dts,t.duration=r.duration):(t.duration+=r.duration,t.nalCount+=r.length,t.byteLength+=r.byteLength,t.push(r));return i.length&&t.duration<=0&&(t.duration=i[i.length-1].duration),i.byteLength+=t.byteLength,i.nalCount+=t.nalCount,i.duration+=t.duration,i.push(t),i},of=function(n){var t;return!n[0][0].keyFrame&&1<n.length&&(t=n.shift(),n.byteLength-=t.byteLength,n.nalCount-=t.nalCount,n[0][0].dts=t.dts,n[0][0].pts=t.pts,n[0][0].duration+=t.duration),n},sf=function(n,t){for(var f,o,e,s,r,i,h=t||0,c=[],u=0;u<n.length;u++)for(e=n[u],f=0;f<e.length;f++)s=e[f],r=s,i=void 0,(i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}).dataOffset=h,i.compositionTimeOffset=r.pts-r.dts,i.duration=r.duration,i.size=4*r.length,i.size+=r.byteLength,r.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),h+=(o=i).size,c.push(o);return c},hf=function(n){for(var i,r,e,o,u,f=0,h=n.byteLength,c=n.nalCount,s=new Uint8Array(h+4*c),l=new DataView(s.buffer),t=0;t<n.length;t++)for(e=n[t],i=0;i<e.length;i++)for(o=e[i],r=0;r<o.length;r++)u=o[r],l.setUint32(f,u.data.byteLength),f+=4,s.set(u.data,f),f+=u.data.byteLength;return s},g=function(n){delete n.minSegmentDts;delete n.maxSegmentDts;delete n.minSegmentPts;delete n.maxSegmentPts},eu=function(n,t){var i,r=n.minSegmentDts;return t||(r-=n.timelineStartInfo.dts),i=n.timelineStartInfo.baseMediaDecodeTime,i+=r,i=Math.max(0,i),"audio"===n.type&&(i*=n.samplerate/9e4,i=Math.floor(i)),i},bt=function(n,t){"number"==typeof t.pts&&(void 0===n.timelineStartInfo.pts&&(n.timelineStartInfo.pts=t.pts),n.minSegmentPts=void 0===n.minSegmentPts?t.pts:Math.min(n.minSegmentPts,t.pts),n.maxSegmentPts=void 0===n.maxSegmentPts?t.pts:Math.max(n.maxSegmentPts,t.pts));"number"==typeof t.dts&&(void 0===n.timelineStartInfo.dts&&(n.timelineStartInfo.dts=t.dts),n.minSegmentDts=void 0===n.minSegmentDts?t.dts:Math.min(n.minSegmentDts,t.dts),n.maxSegmentDts=void 0===n.maxSegmentDts?t.dts:Math.max(n.maxSegmentDts,t.dts))},cf=function(n){for(var t=0,r={payloadType:-1,payloadSize:0},u=0,i=0;t<n.byteLength&&128!==n[t];){for(;255===n[t];)u+=255,t++;for(u+=n[t++];255===n[t];)i+=255,t++;if(i+=n[t++],!r.payload&&4===u){r.payloadType=u;r.payloadSize=i;r.payload=n.subarray(t,t+i);break}t+=i;i=u=0}return r},lf=function(n){return 181!==n.payload[0]?null:49!=(n.payload[1]<<8|n.payload[2])?null:"GA94"!==String.fromCharCode(n.payload[3],n.payload[4],n.payload[5],n.payload[6])?null:3!==n.payload[7]?null:n.payload.subarray(8,n.payload.length-1)},af=function(n,t){var i,e,r,u,f=[];if(!(64&t[0]))return f;for(e=31&t[0],i=0;i<e;i++)u={type:3&t[2+(r=3*i)],pts:n},4&t[r+2]&&(u.ccData=t[r+3]<<8|t[r+4],f.push(u));return f},vf=function(n){for(var r,u,f,e=n.byteLength,i=[],t=1;t<e-2;)0===n[t]&&0===n[t+1]&&3===n[t+2]?(i.push(t+2),t+=2):t++;if(0===i.length)return n;for(u=e-i.length,f=new Uint8Array(u),r=0,t=0;t<u;r++,t++)r===i[0]&&(r++,i.shift()),f[t]=n[r];return f},yf=4,v=function k(){k.prototype.init.call(this);this.captionPackets_=[];this.ccStreams_=[new u(0,0),new u(0,1),new u(1,0),new u(1,1)];this.reset();this.ccStreams_.forEach(function(n){n.on("data",this.trigger.bind(this,"data"));n.on("done",this.trigger.bind(this,"done"))},this)};(v.prototype=new f).push=function(n){var t,i,r;if("sei_rbsp"===n.nalUnitType&&(t=cf(n.escapedRBSP)).payloadType===yf&&(i=lf(t)))if(n.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(n.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));r=af(n.pts,i);this.captionPackets_=this.captionPackets_.concat(r);this.latestDts_!==n.dts&&(this.numSameDts_=0);this.numSameDts_++;this.latestDts_=n.dts}};v.prototype.flush=function(){this.captionPackets_.length?(this.captionPackets_.forEach(function(n,t){n.presortIndex=t}),this.captionPackets_.sort(function(n,t){return n.pts===t.pts?n.presortIndex-t.presortIndex:n.pts-t.pts}),this.captionPackets_.forEach(function(n){n.type<2&&this.dispatchCea608Packet(n)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(n){n.flush()},this)):this.ccStreams_.forEach(function(n){n.flush()},this)};v.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(n){n.reset()})};v.prototype.dispatchCea608Packet=function(n){this.setsChannel1Active(n)?this.activeCea608Channel_[n.type]=0:this.setsChannel2Active(n)&&(this.activeCea608Channel_[n.type]=1);null!==this.activeCea608Channel_[n.type]&&this.ccStreams_[(n.type<<1)+this.activeCea608Channel_[n.type]].push(n)};v.prototype.setsChannel1Active=function(n){return 4096==(30720&n.ccData)};v.prototype.setsChannel2Active=function(n){return 6144==(30720&n.ccData)};var pf={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},ut=function(n){return null===n?"":(n=pf[n]||n,String.fromCharCode(n))},wf=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],y=function(){for(var n=[],t=15;t--;)n.push("");return n},u=function k(n,t){k.prototype.init.call(this);this.field_=n||0;this.dataChannel_=t||0;this.name_="CC"+(1+(this.field_<<1|this.dataChannel_));this.setConstants();this.reset();this.push=function(n){var t,e,r,i,u,f;(t=32639&n.ccData)!==this.lastControlCode_?(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),r=t>>>8,i=255&t,t!==this.PADDING_)&&(t===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":t===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(n.pts),this.flushDisplayed(n.pts),e=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=e,this.startPts_=n.pts):t===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(n.pts)):t===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(n.pts)):t===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(n.pts)):t===this.CARRIAGE_RETURN_?(this.clearFormatting(n.pts),this.flushDisplayed(n.pts),this.shiftRowsUp_(),this.startPts_=n.pts):t===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1):t===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(n.pts),this.displayed_=y()):t===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=y():t===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(n.pts),this.displayed_=y()),this.mode_="paintOn",this.startPts_=n.pts):this.isSpecialCharacter(r,i)?(u=ut((r=(3&r)<<8)|i),this[this.mode_](n.pts,u),this.column_++):this.isExtCharacter(r,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),u=ut((r=(3&r)<<8)|i),this[this.mode_](n.pts,u),this.column_++):this.isMidRowCode(r,i)?(this.clearFormatting(n.pts),this[this.mode_](n.pts," "),this.column_++,14==(14&i)&&this.addFormatting(n.pts,["i"]),1==(1&i)&&this.addFormatting(n.pts,["u"])):this.isOffsetControlCode(r,i)?this.column_+=3&i:this.isPAC(r,i)?(f=wf.indexOf(7968&t),"rollUp"===this.mode_&&this.setRollUp(n.pts,f),f!==this.row_&&(this.clearFormatting(n.pts),this.row_=f),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(n.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(n.pts,["i"])):this.isNormalChar(r)&&(0===i&&(i=null),u=ut(r),u+=ut(i),this[this.mode_](n.pts,u),this.column_+=u.length)):this.lastControlCode_=null}};u.prototype=new f;u.prototype.flushDisplayed=function(n){var t=this.displayed_.map(function(n){return n.trim()}).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:n,text:t,stream:this.name_})};u.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=y();this.nonDisplayed_=y();this.lastControlCode_=null;this.column_=0;this.row_=14;this.rollUpRows_=2;this.formatting_=[]};u.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31);this.PADDING_=0;this.RESUME_CAPTION_LOADING_=32|this.CONTROL_;this.END_OF_CAPTION_=47|this.CONTROL_;this.ROLL_UP_2_ROWS_=37|this.CONTROL_;this.ROLL_UP_3_ROWS_=38|this.CONTROL_;this.ROLL_UP_4_ROWS_=39|this.CONTROL_;this.CARRIAGE_RETURN_=45|this.CONTROL_;this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_;this.BACKSPACE_=33|this.CONTROL_;this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_;this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_};u.prototype.isSpecialCharacter=function(n,t){return n===this.EXT_&&48<=t&&t<=63};u.prototype.isExtCharacter=function(n,t){return(n===this.EXT_+1||n===this.EXT_+2)&&32<=t&&t<=63};u.prototype.isMidRowCode=function(n,t){return n===this.EXT_&&32<=t&&t<=47};u.prototype.isOffsetControlCode=function(n,t){return n===this.OFFSET_&&33<=t&&t<=35};u.prototype.isPAC=function(n,t){return n>=this.BASE_&&n<this.BASE_+8&&64<=t&&t<=127};u.prototype.isColorPAC=function(n){return 64<=n&&n<=79||96<=n&&n<=127};u.prototype.isNormalChar=function(n){return 32<=n&&n<=127};u.prototype.setRollUp=function(n,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(n),this.nonDisplayed_=y(),this.displayed_=y()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_);this.topRow_=t-this.rollUpRows_+1};u.prototype.addFormatting=function(n,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce(function(n,t){return n+"<"+t+">"},"");this[this.mode_](n,i)};u.prototype.clearFormatting=function(n){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(n,t){return n+"<\/"+t+">"},"");this.formatting_=[];this[this.mode_](n,t)}};u.prototype.popOn=function(n,t){var i=this.nonDisplayed_[this.row_];i+=t;this.nonDisplayed_[this.row_]=i};u.prototype.rollUp=function(n,t){var i=this.displayed_[this.row_];i+=t;this.displayed_[this.row_]=i};u.prototype.shiftRowsUp_=function(){for(var n=0;n<this.topRow_;n++)this.displayed_[n]="";for(n=this.row_+1;n<15;n++)this.displayed_[n]="";for(n=this.topRow_;n<this.row_;n++)this.displayed_[n]=this.displayed_[n+1];this.displayed_[this.row_]=""};u.prototype.paintOn=function(n,t){var i=this.displayed_[this.row_];i+=t;this.displayed_[this.row_]=i};var kt={CaptionStream:v,Cea608Stream:u},o={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},ou=function(n,t){var i=1;for(t<n&&(i=-1);4294967296<Math.abs(t-n);)n+=8589934592*i;return n},su=function k(n){var i,t;k.prototype.init.call(this);this.type_=n;this.push=function(n){n.type===this.type_&&(void 0===t&&(t=n.dts),n.dts=ou(n.dts,t),n.pts=ou(n.pts,t),i=n.dts,this.trigger("data",n))};this.flush=function(){t=i;this.trigger("done")};this.discontinuity=function(){i=t=void 0}};su.prototype=new f;var dt,bf=su,hu=function(n,t,i){for(var u="",r=t;r<i;r++)u+="%"+("00"+n[r].toString(16)).slice(-2);return u},ft=function(n,t,i){return decodeURIComponent(hu(n,t,i))},et=function(n){return n[0]<<21|n[1]<<14|n[2]<<7|n[3]},cu={TXXX:function(n){var t;if(3===n.data[0]){for(t=1;t<n.data.length;t++)if(0===n.data[t]){n.description=ft(n.data,1,t);n.value=ft(n.data,t+1,n.data.length).replace(/\0*$/,"");break}n.data=n.value}},WXXX:function(n){var t;if(3===n.data[0])for(t=1;t<n.data.length;t++)if(0===n.data[t]){n.description=ft(n.data,1,t);n.url=ft(n.data,t+1,n.data.length);break}},PRIV:function(n){for(var i,t=0;t<n.data.length;t++)if(0===n.data[t]){n.owner=(i=n.data,unescape(hu(i,0,t)));break}n.privateData=n.data.subarray(t+1);n.data=n.privateData}};(dt=function(n){var r,u={debug:!(!n||!n.debug),descriptor:n&&n.descriptor},i=0,t=[],f=0;if(dt.prototype.init.call(this),this.dispatchType=o.METADATA_STREAM_TYPE.toString(16),u.descriptor)for(r=0;r<u.descriptor.length;r++)this.dispatchType+=("00"+u.descriptor[r].toString(16)).slice(-2);this.push=function(n){var r,e,l,o,h,s,c;if("timed-metadata"===n.type)if(n.dataAlignmentIndicator&&(f=0,t.length=0),0===t.length&&(n.data.length<10||n.data[0]!=="I".charCodeAt(0)||n.data[1]!=="D".charCodeAt(0)||n.data[2]!=="3".charCodeAt(0)))u.debug;else if(t.push(n),f+=n.data.byteLength,1===t.length&&(i=et(n.data.subarray(6,10)),i+=10),!(f<i)){for(r={data:new Uint8Array(i),frames:[],pts:t[0].pts,dts:t[0].dts},h=0;h<i;)r.data.set(t[0].data.subarray(0,i-h),h),h+=t[0].data.byteLength,f-=t[0].data.byteLength,t.shift();e=10;64&r.data[5]&&(e+=4,e+=et(r.data.subarray(10,14)),i-=et(r.data.subarray(16,20)));do{if((l=et(r.data.subarray(e+4,e+8)))<1)return;((o={id:String.fromCharCode(r.data[e],r.data[e+1],r.data[e+2],r.data[e+3]),data:r.data.subarray(e+10,e+l+10)}).key=o.id,cu[o.id]&&(cu[o.id](o),"com.apple.streaming.transportStreamTimestamp"===o.owner))&&(s=o.data,c=(1&s[3])<<30|s[4]<<22|s[5]<<14|s[6]<<6|s[7]>>>2,c*=4,c+=3&s[7],o.timeStamp=c,void 0===r.pts&&void 0===r.dts&&(r.pts=o.timeStamp,r.dts=o.timeStamp),this.trigger("timestamp",o));r.frames.push(o);e+=10;e+=l}while(e<i);this.trigger("data",r)}}}).prototype=new f;lu=dt;au=bf;(gt=function(){var t=new Uint8Array(188),n=0;gt.prototype.init.call(this);this.push=function(i){var r,u=0,f=188;for(n?((r=new Uint8Array(i.byteLength+n)).set(t.subarray(0,n)),r.set(i,n),n=0):r=i;f<r.byteLength;)71!==r[u]||71!==r[f]?(u++,f++):(this.trigger("data",r.subarray(u,f)),u+=188,f+=188);u<r.byteLength&&(t.set(r.subarray(u),0),n=r.byteLength-u)};this.flush=function(){188===n&&71===t[0]&&(this.trigger("data",t),n=0);this.trigger("done")}}).prototype=new f;(ot=function(){var t,i,r,n;ot.prototype.init.call(this);(n=this).packetsWaitingForPmt=[];this.programMapTable=void 0;t=function(n,t){var u=0;t.payloadUnitStartIndicator&&(u+=n[u]+1);"pat"===t.type?i(n.subarray(u),t):r(n.subarray(u),t)};i=function(t,i){i.section_number=t[7];i.last_section_number=t[8];n.pmtPid=(31&t[10])<<8|t[11];i.pmtPid=n.pmtPid};r=function(t,i){var e,r,u,f;if(1&t[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},e=3+((15&t[1])<<8|t[2])-4,r=12+((15&t[10])<<8|t[11]);r<e;)u=t[r],f=(31&t[r+1])<<8|t[r+2],u===o.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=f:u===o.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=f:u===o.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][f]=u),r+=5+((15&t[r+3])<<8|t[r+4]);i.programMapTable=n.programMapTable}};this.push=function(n){var i={},r=4;if(i.payloadUnitStartIndicator=!!(64&n[1]),i.pid=31&n[1],i.pid<<=8,i.pid|=n[2],1<(48&n[3])>>>4&&(r+=n[r]+1),0===i.pid)i.type="pat",t(n.subarray(r),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(n.subarray(r),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([n,r,i]):this.processPes_(n,r,i)};this.processPes_=function(n,t,i){i.streamType=i.pid===this.programMapTable.video?o.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?o.ADTS_STREAM_TYPE:this.programMapTable["timed-metadata"][i.pid];i.type="pes";i.data=n.subarray(t);this.trigger("data",i)}}).prototype=new f;ot.STREAM_TYPES={h264:27,adts:15};(ni=function(){var t=this,i={data:[],size:0},r={data:[],size:0},u={data:[],size:0},n=function(n,i,r){var s,h,c=new Uint8Array(n.size),e={type:i},o=0,l=0,u,f,a;if(n.data.length&&!(n.size<9)){for(e.trackId=n.data[0].pid,o=0;o<n.data.length;o++)h=n.data[o],c.set(h.data,l),l+=h.data.byteLength;u=c;(f=e).packetLength=6+(u[4]<<8|u[5]);f.dataAlignmentIndicator=0!=(4&u[6]);192&(a=u[7])&&(f.pts=(14&u[9])<<27|(255&u[10])<<20|(254&u[11])<<12|(255&u[12])<<5|(254&u[13])>>>3,f.pts*=4,f.pts+=(6&u[13])>>>1,f.dts=f.pts,64&a&&(f.dts=(14&u[14])<<27|(255&u[15])<<20|(254&u[16])<<12|(255&u[17])<<5|(254&u[18])>>>3,f.dts*=4,f.dts+=(6&u[18])>>>1));f.data=u.subarray(9+u[8]);s="video"===i||e.packetLength<=n.size;(r||s)&&(n.size=0,n.data.length=0);s&&t.trigger("data",e)}};ni.prototype.init.call(this);this.push=function(f){({pat:function(){},pes:function(){var t,e;switch(f.streamType){case o.H264_STREAM_TYPE:case o.H264_STREAM_TYPE:t=i;e="video";break;case o.ADTS_STREAM_TYPE:t=r;e="audio";break;case o.METADATA_STREAM_TYPE:t=u;e="timed-metadata";break;default:return}f.payloadUnitStartIndicator&&n(t,e,!0);t.data.push(f);t.size+=f.data.byteLength},pmt:function(){var i={type:"metadata",tracks:[]},n=f.programMapTable;null!==n.video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+n.video,codec:"avc",type:"video"});null!==n.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+n.audio,codec:"adts",type:"audio"});t.trigger("data",i)}})[f.type]()};this.flush=function(){n(i,"video");n(r,"audio");n(u,"timed-metadata");this.trigger("done")}}).prototype=new f;ti={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:gt,TransportParseStream:ot,ElementaryStream:ni,TimestampRolloverStream:au,CaptionStream:kt.CaptionStream,Cea608Stream:kt.Cea608Stream,MetadataStream:lu};for(st in o)o.hasOwnProperty(st)&&(ti[st]=o[st]);s=ti;ri=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(ii=function(){var n;ii.prototype.init.call(this);this.push=function(t){var o,s,r,u,h,f,i=0,e=0;if("audio"===t.type)for(n?(u=n,(n=new Uint8Array(u.byteLength+t.data.byteLength)).set(u),n.set(t.data,u.byteLength)):n=t.data;i+5<n.length;)if(255===n[i]&&240==(246&n[i+1])){if(s=2*(1&~n[i+1]),o=(3&n[i+3])<<11|n[i+4]<<3|(224&n[i+5])>>5,f=9e4*(h=1024*(1+(3&n[i+6])))/ri[(60&n[i+2])>>>2],r=i+o,n.byteLength<r)return;if(this.trigger("data",{pts:t.pts+e*f,dts:t.dts+e*f,sampleCount:h,audioobjecttype:1+(n[i+2]>>>6&3),channelcount:(1&n[i+2])<<2|(192&n[i+3])>>>6,samplerate:ri[(60&n[i+2])>>>2],samplingfrequencyindex:(60&n[i+2])>>>2,samplesize:16,data:n.subarray(i+7+s,r)}),n.byteLength===r)return void(n=void 0);e++;n=n.subarray(r)}else i++};this.flush=function(){this.trigger("done")}}).prototype=new f;fi=ii;yu=function(n){var i=n.byteLength,r=0,t=0;this.length=function(){return 8*i};this.bitsAvailable=function(){return 8*i+t};this.loadWord=function(){var f=n.byteLength-i,e=new Uint8Array(4),u=Math.min(4,i);if(0===u)throw new Error("no bytes available");e.set(n.subarray(f,f+u));r=new DataView(e.buffer).getUint32(0);t=8*u;i-=u};this.skipBits=function(n){var u;n<t||(n-=t,n-=8*(u=Math.floor(n/8)),i-=u,this.loadWord());r<<=n;t-=n};this.readBits=function(n){var u=Math.min(t,n),f=r>>>32-u;return 0<(t-=u)?r<<=u:0<i&&this.loadWord(),0<(u=n-u)?f<<u|this.readBits(u):f};this.skipLeadingZeros=function(){for(var n=0;n<t;++n)if(0!=(r&2147483648>>>n))return r<<=n,t-=n,n;return this.loadWord(),n+this.skipLeadingZeros()};this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())};this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())};this.readUnsignedExpGolomb=function(){var n=this.skipLeadingZeros();return this.readBits(n+1)-1};this.readExpGolomb=function(){var n=this.readUnsignedExpGolomb();return 1&n?1+n>>>1:-1*(n>>>1)};this.readBoolean=function(){return 1===this.readBits(1)};this.readUnsignedByte=function(){return this.readBits(8)};this.loadWord()};(ht=function(){var t,n,i=0;ht.prototype.init.call(this);this.push=function(r){var u;for(n?((u=new Uint8Array(n.byteLength+r.data.byteLength)).set(n),u.set(r.data,n.byteLength),n=u):n=r.data;i<n.byteLength-3;i++)if(1===n[i+2]){t=i+5;break}for(;t<n.byteLength;)switch(n[t]){case 0:if(0!==n[t-1]){t+=2;break}if(0!==n[t-2]){t++;break}for(i+3!==t-2&&this.trigger("data",n.subarray(i+3,t-2));1!==n[++t]&&t<n.length;);i=t-2;t+=3;break;case 1:if(0!==n[t-1]||0!==n[t-2]){t+=3;break}this.trigger("data",n.subarray(i+3,t-2));i=t-2;t+=3;break;default:t+=3}n=n.subarray(i);t-=i;i=0};this.flush=function(){n&&3<n.byteLength&&this.trigger("data",n.subarray(i+3));n=null;i=0;this.trigger("done")}}).prototype=new f;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};(ui=function(){var t,r,u,f,i,e,o,n=new ht;ui.prototype.init.call(this);(t=this).push=function(t){"video"===t.type&&(r=t.trackId,u=t.pts,f=t.dts,n.push(t))};n.on("data",function(n){var o={trackId:r,pts:u,dts:f,data:n};switch(31&n[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp";o.escapedRBSP=i(n.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp";o.escapedRBSP=i(n.subarray(1));o.config=e(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)});n.on("done",function(){t.trigger("done")});this.flush=function(){n.flush()};o=function(n,t){for(var u=8,i=8,r=0;r<n;r++)0!==i&&(i=(u+t.readExpGolomb()+256)%256),u=0===i?u:i};i=function(n){for(var r,u,f,e=n.byteLength,i=[],t=1;t<e-2;)0===n[t]&&0===n[t+1]&&3===n[t+2]?(i.push(t+2),t+=2):t++;if(0===i.length)return n;for(u=e-i.length,f=new Uint8Array(u),r=0,t=0;t<u;r++,t++)r===i[0]&&(r++,i.shift()),f[t]=n[r];return f};e=function(n){var t,u,f,e,s,h,c,l,a,v,y,i,r,p=0,w=0,b=0,k=0,d=1;if(u=(t=new yu(n)).readUnsignedByte(),e=t.readUnsignedByte(),f=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),vu[u]&&(3===(s=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(y=3!==s?8:12,r=0;r<y;r++)t.readBoolean()&&o(r<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(h=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===h)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),c=t.readUnsignedExpGolomb(),r=0;r<c;r++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),a=t.readUnsignedExpGolomb(),0===(v=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(p=t.readUnsignedExpGolomb(),w=t.readUnsignedExpGolomb(),b=t.readUnsignedExpGolomb(),k=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:i=[1,1];break;case 2:i=[12,11];break;case 3:i=[10,11];break;case 4:i=[16,11];break;case 5:i=[40,33];break;case 6:i=[24,11];break;case 7:i=[20,11];break;case 8:i=[32,11];break;case 9:i=[80,33];break;case 10:i=[18,11];break;case 11:i=[15,11];break;case 12:i=[64,33];break;case 13:i=[160,99];break;case 14:i=[4,3];break;case 15:i=[3,2];break;case 16:i=[2,1];break;case 255:i=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}i&&(d=i[0]/i[1])}return{profileIdc:u,levelIdc:f,profileCompatibility:e,width:Math.ceil((16*(l+1)-2*p-2*w)*d),height:(2-v)*(a+1)*16-2*b-2*k}}}).prototype=new f;pu={H264Stream:ui,NalByteStream:ht};(ei=function(){var n=new Uint8Array,t=0;ei.prototype.init.call(this);this.setTimestamp=function(n){t=n};this.parseId3TagSize=function(n,t){var i=n[t+6]<<21|n[t+7]<<14|n[t+8]<<7|n[t+9];return(16&n[t+5])>>4?i+20:i+10};this.parseAdtsSize=function(n,t){var i=(224&n[t+5])>>5,r=n[t+4]<<3;return 6144&n[t+3]|r|i};this.push=function(i){var e,o,s,f,u=0,r=0;for(n.length?(f=n.length,(n=new Uint8Array(i.byteLength+f)).set(n.subarray(0,f)),n.set(i,f)):n=i;3<=n.length-r;)if(n[r]!=="I".charCodeAt(0)||n[r+1]!=="D".charCodeAt(0)||n[r+2]!=="3".charCodeAt(0))if(!0&n[r]&&240==(240&n[r+1])){if(n.length-r<7)break;if((u=this.parseAdtsSize(n,r))>n.length)break;s={type:"audio",data:n.subarray(r,r+u),pts:t,dts:t};this.trigger("data",s);r+=u}else r++;else{if(n.length-r<10)break;if((u=this.parseId3TagSize(n,r))>n.length)break;o={type:"timed-metadata",data:n.subarray(r,r+u)};this.trigger("data",o);r+=u}e=n.length-r;n=0<e?n.subarray(r):new Uint8Array}}).prototype=new f;var oi,wu,bu,ku,du,ct,nt,si,tt,gu,hi,nf,kf=ei,l=[33,16,5,32,164,27],ci=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],r=function(n){for(var t=[];n--;)t.push(0);return t},df={96e3:[l,[227,64],r(154),[56]],88200:[l,[231],r(170),[56]],64e3:[l,[248,192],r(240),[56]],48e3:[l,[255,192],r(268),[55,148,128],r(54),[112]],44100:[l,[255,192],r(268),[55,163,128],r(84),[112]],32e3:[l,[255,192],r(268),[55,234],r(226),[112]],24e3:[l,[255,192],r(268),[55,255,128],r(268),[111,112],r(126),[224]],16e3:[l,[255,192],r(268),[55,255,128],r(268),[111,255],r(269),[223,108],r(195),[1,192]],12e3:[ci,r(268),[3,127,248],r(268),[6,255,240],r(268),[13,255,224],r(268),[27,253,128],r(259),[56]],11025:[ci,r(268),[3,127,248],r(268),[6,255,240],r(268),[13,255,224],r(268),[27,255,192],r(268),[55,175,128],r(108),[112]],8e3:[ci,r(268),[3,121,16],r(47),[7]]},gf=(oi=df,Object.keys(oi).reduce(function(n,t){return n[t]=new Uint8Array(oi[t].reduce(function(n,t){return n.concat(t)},[])),n},{})),ne=(wu=function(n){return 9e4*n},bu=function(n,t){return n*t},ku=function(n){return n/9e4},du=function(n,t){return n/t},function(n,t){return wu(du(n,t))}),te=function(n,t){return bu(ku(n),t)},ie=pu.H264Stream,li=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],ai=["width","height","profileIdc","levelIdc","profileCompatibility"];gu=function(n){return n[0]==="I".charCodeAt(0)&&n[1]==="D".charCodeAt(0)&&n[2]==="3".charCodeAt(0)};hi=function(n,t){var i;if(n.length!==t.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==t[i])return!1;return!0};nf=function(n){for(var i=0,t=0;t<n.length;t++)i+=n[t].data.byteLength;return i};(nt=function(n,t){var i=[],e=0,r=0,u=0,f=1/0;t=t||{};nt.prototype.init.call(this);this.push=function(t){bt(n,t);n&&li.forEach(function(i){n[i]=t[i]});i.push(t)};this.setEarliestDts=function(t){r=t-n.timelineStartInfo.baseMediaDecodeTime};this.setVideoBaseMediaDecodeTime=function(n){f=n};this.setAudioAppendStart=function(n){u=n};this.flush=function(){var r,u,o,f;0!==i.length&&(r=this.trimAdtsFramesByEarliestDts_(i),n.baseMediaDecodeTime=eu(n,t.keepOriginalTimestamps),this.prefixWithSilence_(n,r),n.samples=this.generateSampleTable_(r),o=p.mdat(this.concatenateFrameData_(r)),i=[],u=p.moof(e,[n]),f=new Uint8Array(u.byteLength+o.byteLength),e++,f.set(u),f.set(o,u.byteLength),g(n),this.trigger("data",{track:n,boxes:f}));this.trigger("done","AudioSegmentStream")};this.prefixWithSilence_=function(n,t){var h,r,e,i,c=0,o=0,s=0;if(t.length&&(h=ne(n.baseMediaDecodeTime,n.samplerate),r=Math.ceil(9216e4/n.samplerate),u&&f&&(c=h-Math.max(u,f),s=(o=Math.floor(c/r))*r),!(o<1||45e3<s))){for((e=gf[n.samplerate])||(e=t[0].data),i=0;i<o;i++)t.splice(i,0,{data:e});n.baseMediaDecodeTime-=Math.floor(te(s,n.samplerate))}};this.trimAdtsFramesByEarliestDts_=function(t){return n.minSegmentDts>=r?t:(n.minSegmentDts=1/0,t.filter(function(t){return t.dts>=r&&(n.minSegmentDts=Math.min(n.minSegmentDts,t.dts),n.minSegmentPts=n.minSegmentDts,!0)}))};this.generateSampleTable_=function(n){for(var i,r=[],t=0;t<n.length;t++)i=n[t],r.push({size:i.data.byteLength,duration:1024});return r};this.concatenateFrameData_=function(n){for(var i,r=0,u=new Uint8Array(nf(n)),t=0;t<n.length;t++)i=n[t],u.set(i.data,r),r+=i.data.byteLength;return u}}).prototype=new f;(ct=function(n,t){var u,f,e=0,i=[],r=[];t=t||{};ct.prototype.init.call(this);delete n.minPTS;this.gopCache_=[];this.push=function(t){bt(n,t);"seq_parameter_set_rbsp"!==t.nalUnitType||u||(u=t.config,n.sps=[t.data],ai.forEach(function(t){n[t]=u[t]},this));"pic_parameter_set_rbsp"!==t.nalUnitType||f||(f=t.data,n.pps=[t.data]);i.push(t)};this.flush=function(){for(var c,f,u,o,h,s,l;i.length&&"access_unit_delimiter_rbsp"!==i[0].nalUnitType;)i.shift();if(0===i.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(c=ff(i),(u=ef(c))[0][0].keyFrame||((f=this.getGopForFusion_(i[0],n))?(u.unshift(f),u.byteLength+=f.byteLength,u.nalCount+=f.nalCount,u.pts=f.pts,u.dts=f.dts,u.duration+=f.duration):u=of(u)),r.length){if(!(l=t.alignGopsAtEnd?this.alignGopsAtEnd_(u):this.alignGopsAtStart_(u)))return this.gopCache_.unshift({gop:u.pop(),pps:n.pps,sps:n.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),i=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");g(n);u=l}bt(n,u);n.samples=sf(u);h=p.mdat(hf(u));n.baseMediaDecodeTime=eu(n,t.keepOriginalTimestamps);this.trigger("processedGopsInfo",u.map(function(n){return{pts:n.pts,dts:n.dts,byteLength:n.byteLength}}));this.gopCache_.unshift({gop:u.pop(),pps:n.pps,sps:n.sps});this.gopCache_.length=Math.min(6,this.gopCache_.length);i=[];this.trigger("baseMediaDecodeTime",n.baseMediaDecodeTime);this.trigger("timelineStartInfo",n.timelineStartInfo);o=p.moof(e,[n]);s=new Uint8Array(o.byteLength+h.byteLength);e++;s.set(o);s.set(h,o.byteLength);this.trigger("data",{track:n,boxes:s});this.resetStream_();this.trigger("done","VideoSegmentStream")};this.resetStream_=function(){g(n);f=u=void 0};this.getGopForFusion_=function(t){for(var i,r,u,f,o=1/0,e=0;e<this.gopCache_.length;e++)u=(f=this.gopCache_[e]).gop,n.pps&&hi(n.pps[0],f.pps[0])&&n.sps&&hi(n.sps[0],f.sps[0])&&(u.dts<n.timelineStartInfo.dts||-1e4<=(i=t.dts-u.dts-u.duration)&&i<=45e3&&(!r||i<o)&&(r=f,o=i));return r?r.gop:null};this.alignGopsAtStart_=function(n){var f,i,e,u,o,s,h,t;for(o=n.byteLength,s=n.nalCount,h=n.duration,f=i=0;f<r.length&&i<n.length&&(e=r[f],u=n[i],e.pts!==u.pts);)u.pts>e.pts?f++:(i++,o-=u.byteLength,s-=u.nalCount,h-=u.duration);return 0===i?n:i===n.length?null:((t=n.slice(i)).byteLength=o,t.duration=h,t.nalCount=s,t.pts=t[0].pts,t.dts=t[0].dts,t)};this.alignGopsAtEnd_=function(n){var u,i,s,h,f,e,c,t,o;for(u=r.length-1,i=n.length-1,f=null,e=!1;0<=u&&0<=i;){if(s=r[u],h=n[i],s.pts===h.pts){e=!0;break}s.pts>h.pts?u--:(u===r.length-1&&(f=i),i--)}return!e&&null===f?null:0===(c=e?i:f)?n:(t=n.slice(c),o=t.reduce(function(n,t){return n.byteLength+=t.byteLength,n.duration+=t.duration,n.nalCount+=t.nalCount,n},{byteLength:0,duration:0,nalCount:0}),t.byteLength=o.byteLength,t.duration=o.duration,t.nalCount=o.nalCount,t.pts=t[0].pts,t.dts=t[0].dts,t)};this.alignGopsWith=function(n){r=n}}).prototype=new f;(tt=function(n,t){this.numberOfTracks=0;this.metadataStream=t;this.remuxTracks="undefined"!=typeof n.remux?!!n.remux:!0;this.pendingTracks=[];this.videoTrack=null;this.pendingBoxes=[];this.pendingCaptions=[];this.pendingMetadata=[];this.pendingBytes=0;this.emittedTracks=0;tt.prototype.init.call(this);this.push=function(n){return n.text?this.pendingCaptions.push(n):n.frames?this.pendingMetadata.push(n):(this.pendingTracks.push(n.track),this.pendingBoxes.push(n.boxes),this.pendingBytes+=n.boxes.byteLength,"video"===n.track.type&&(this.videoTrack=n.track),void("audio"===n.track.type&&(this.audioTrack=n.track)))}}).prototype=new f;tt.prototype.flush=function(n){var r,f,e,t,o=0,i={captions:[],captionStreams:{},metadata:[],info:{}},u=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==n&&"AudioSegmentStream"!==n)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(u=this.videoTrack.timelineStartInfo.pts,ai.forEach(function(n){i.info[n]=this.videoTrack[n]},this)):this.audioTrack&&(u=this.audioTrack.timelineStartInfo.pts,li.forEach(function(n){i.info[n]=this.audioTrack[n]},this)),i.type=1===this.pendingTracks.length?this.pendingTracks[0].type:"combined",this.emittedTracks+=this.pendingTracks.length,e=p.initSegment(this.pendingTracks),i.initSegment=new Uint8Array(e.byteLength),i.initSegment.set(e),i.data=new Uint8Array(this.pendingBytes),t=0;t<this.pendingBoxes.length;t++)i.data.set(this.pendingBoxes[t],o),o+=this.pendingBoxes[t].byteLength;for(t=0;t<this.pendingCaptions.length;t++)(r=this.pendingCaptions[t]).startTime=r.startPts-u,r.startTime/=9e4,r.endTime=r.endPts-u,r.endTime/=9e4,i.captionStreams[r.stream]=!0,i.captions.push(r);for(t=0;t<this.pendingMetadata.length;t++)(f=this.pendingMetadata[t]).cueTime=f.pts-u,f.cueTime/=9e4,i.metadata.push(f);i.metadata.dispatchType=this.metadataStream.dispatchType;this.pendingTracks.length=0;this.videoTrack=null;this.pendingBoxes.length=0;this.pendingCaptions.length=0;this.pendingBytes=0;this.pendingMetadata.length=0;this.trigger("data",i);this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)};(si=function(n){var i,t,r=this,u=!0;si.prototype.init.call(this);n=n||{};this.baseMediaDecodeTime=n.baseMediaDecodeTime||0;this.transmuxPipeline_={};this.setupAacPipeline=function(){var i={};(this.transmuxPipeline_=i).type="aac";i.metadataStream=new s.MetadataStream;i.aacStream=new kf;i.audioTimestampRolloverStream=new s.TimestampRolloverStream("audio");i.timedMetadataTimestampRolloverStream=new s.TimestampRolloverStream("timed-metadata");i.adtsStream=new fi;i.coalesceStream=new tt(n,i.metadataStream);i.headOfPipeline=i.aacStream;i.aacStream.pipe(i.audioTimestampRolloverStream).pipe(i.adtsStream);i.aacStream.pipe(i.timedMetadataTimestampRolloverStream).pipe(i.metadataStream).pipe(i.coalesceStream);i.metadataStream.on("timestamp",function(n){i.aacStream.setTimestamp(n.timeStamp)});i.aacStream.on("data",function(u){"timed-metadata"!==u.type||i.audioSegmentStream||(t=t||{timelineStartInfo:{baseMediaDecodeTime:r.baseMediaDecodeTime},codec:"adts",type:"audio"},i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new nt(t,n),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream))});i.coalesceStream.on("data",this.trigger.bind(this,"data"));i.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setupTsPipeline=function(){var u={};(this.transmuxPipeline_=u).type="ts";u.metadataStream=new s.MetadataStream;u.packetStream=new s.TransportPacketStream;u.parseStream=new s.TransportParseStream;u.elementaryStream=new s.ElementaryStream;u.videoTimestampRolloverStream=new s.TimestampRolloverStream("video");u.audioTimestampRolloverStream=new s.TimestampRolloverStream("audio");u.timedMetadataTimestampRolloverStream=new s.TimestampRolloverStream("timed-metadata");u.adtsStream=new fi;u.h264Stream=new ie;u.captionStream=new s.CaptionStream;u.coalesceStream=new tt(n,u.metadataStream);u.headOfPipeline=u.packetStream;u.packetStream.pipe(u.parseStream).pipe(u.elementaryStream);u.elementaryStream.pipe(u.videoTimestampRolloverStream).pipe(u.h264Stream);u.elementaryStream.pipe(u.audioTimestampRolloverStream).pipe(u.adtsStream);u.elementaryStream.pipe(u.timedMetadataTimestampRolloverStream).pipe(u.metadataStream).pipe(u.coalesceStream);u.h264Stream.pipe(u.captionStream).pipe(u.coalesceStream);u.elementaryStream.on("data",function(f){var e;if("metadata"===f.type){for(e=f.tracks.length;e--;)i||"video"!==f.tracks[e].type?t||"audio"!==f.tracks[e].type||((t=f.tracks[e]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime):(i=f.tracks[e]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime;i&&!u.videoSegmentStream&&(u.coalesceStream.numberOfTracks++,u.videoSegmentStream=new ct(i,n),u.videoSegmentStream.on("timelineStartInfo",function(n){t&&(t.timelineStartInfo=n,u.audioSegmentStream.setEarliestDts(n.dts))}),u.videoSegmentStream.on("processedGopsInfo",r.trigger.bind(r,"gopInfo")),u.videoSegmentStream.on("baseMediaDecodeTime",function(n){t&&u.audioSegmentStream.setVideoBaseMediaDecodeTime(n)}),u.h264Stream.pipe(u.videoSegmentStream).pipe(u.coalesceStream));t&&!u.audioSegmentStream&&(u.coalesceStream.numberOfTracks++,u.audioSegmentStream=new nt(t,n),u.adtsStream.pipe(u.audioSegmentStream).pipe(u.coalesceStream))}});u.coalesceStream.on("data",this.trigger.bind(this,"data"));u.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;this.baseMediaDecodeTime=n;t&&(t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,g(t),t.timelineStartInfo.baseMediaDecodeTime=n,r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity());i&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[],r.videoTimestampRolloverStream.discontinuity()),i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,g(i),r.captionStream.reset(),i.timelineStartInfo.baseMediaDecodeTime=n);r.timedMetadataTimestampRolloverStream&&r.timedMetadataTimestampRolloverStream.discontinuity()};this.setAudioAppendStart=function(n){t&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(n)};this.alignGopsWith=function(n){i&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(n)};this.push=function(n){if(u){var t=gu(n);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline();u=!1}this.transmuxPipeline_.headOfPipeline.push(n)};this.flush=function(){u=!0;this.transmuxPipeline_.headOfPipeline.flush()};this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new f;var e,tf,vi={Transmuxer:si,VideoSegmentStream:ct,AudioSegmentStream:nt,AUDIO_PROPERTIES:li,VIDEO_PROPERTIES:ai},lt=a.parseType,h=function(n){return new Date(1e3*n-20828448e5)},rf=function(n){return{isLeading:(12&n[0])>>>2,dependsOn:3&n[0],isDependedOn:(192&n[1])>>>6,hasRedundancy:(48&n[1])>>>4,paddingValue:(14&n[1])>>>1,isNonSyncSample:1&n[1],degradationPriority:n[2]<<8|n[3]}},b={avc1:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:e(n.subarray(78,n.byteLength))}},avcC:function(n){for(var f,i,e=new DataView(n.buffer,n.byteOffset,n.byteLength),u={configurationVersion:n[0],avcProfileIndication:n[1],profileCompatibility:n[2],avcLevelIndication:n[3],lengthSizeMinusOne:3&n[4],sps:[],pps:[]},o=31&n[5],t=6,r=0;r<o;r++)i=e.getUint16(t),t+=2,u.sps.push(new Uint8Array(n.subarray(t,t+i))),t+=i;for(f=n[t],t++,r=0;r<f;r++)i=e.getUint16(t),t+=2,u.pps.push(new Uint8Array(n.subarray(t,t+i))),t+=i;return u},btrt:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},esds:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),esId:n[6]<<8|n[7],streamPriority:31&n[8],decoderConfig:{objectProfileIndication:n[11],streamType:n[12]>>>2&63,bufferSize:n[13]<<16|n[14]<<8|n[15],maxBitrate:n[16]<<24|n[17]<<16|n[18]<<8|n[19],avgBitrate:n[20]<<24|n[21]<<16|n[22]<<8|n[23],decoderConfigDescriptor:{tag:n[24],length:n[25],audioObjectType:n[26]>>>3&31,samplingFrequencyIndex:(7&n[26])<<1|n[27]>>>7&1,channelConfiguration:n[27]>>>3&15}}}},ftyp:function(n){for(var r=new DataView(n.buffer,n.byteOffset,n.byteLength),i={majorBrand:lt(n.subarray(0,4)),minorVersion:r.getUint32(4),compatibleBrands:[]},t=8;t<n.byteLength;)i.compatibleBrands.push(lt(n.subarray(t,t+4))),t+=4;return i},dinf:function(n){return{boxes:e(n)}},dref:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),dataReferences:e(n.subarray(8))}},hdlr:function(n){for(var i={version:new DataView(n.buffer,n.byteOffset,n.byteLength).getUint8(0),flags:new Uint8Array(n.subarray(1,4)),handlerType:lt(n.subarray(8,12)),name:""},t=8,t=24;t<n.byteLength;t++){if(0===n[t]){t++;break}i.name+=String.fromCharCode(n[t])}return i.name=decodeURIComponent(escape(i.name)),i},mdat:function(n){return{byteLength:n.byteLength,nals:function(n){for(var r,u=new DataView(n.buffer,n.byteOffset,n.byteLength),t=[],i=0;i+4<n.length;i+=r)if(r=u.getUint32(i),i+=4,r<=0)t.push("<span style='color:red;'>MALFORMED DATA<\/span>");else switch(31&n[i]){case 1:t.push("slice_layer_without_partitioning_rbsp");break;case 5:t.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:t.push("sei_rbsp");break;case 7:t.push("seq_parameter_set_rbsp");break;case 8:t.push("pic_parameter_set_rbsp");break;case 9:t.push("access_unit_delimiter_rbsp");break;default:t.push("UNKNOWN NAL - "+n[i]&31)}return t}(n)}},mdhd:function(n){var u,r=new DataView(n.buffer,n.byteOffset,n.byteLength),t=4,i={version:r.getUint8(0),flags:new Uint8Array(n.subarray(1,4)),language:""};return 1===i.version?(t+=4,i.creationTime=h(r.getUint32(t)),t+=8,i.modificationTime=h(r.getUint32(t)),t+=4,i.timescale=r.getUint32(t),t+=8):(i.creationTime=h(r.getUint32(t)),t+=4,i.modificationTime=h(r.getUint32(t)),t+=4,i.timescale=r.getUint32(t),t+=4),i.duration=r.getUint32(t),t+=4,u=r.getUint16(t),i.language+=String.fromCharCode(96+(u>>10)),i.language+=String.fromCharCode(96+((992&u)>>5)),i.language+=String.fromCharCode(96+(31&u)),i},mdia:function(n){return{boxes:e(n)}},mfhd:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),sequenceNumber:n[4]<<24|n[5]<<16|n[6]<<8|n[7]}},minf:function(n){return{boxes:e(n)}},mp4a:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength),i={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return 28<n.byteLength&&(i.streamDescriptor=e(n.subarray(28))[0]),i},moof:function(n){return{boxes:e(n)}},moov:function(n){return{boxes:e(n)}},mvex:function(n){return{boxes:e(n)}},mvhd:function(n){var i=new DataView(n.buffer,n.byteOffset,n.byteLength),t=4,r={version:i.getUint8(0),flags:new Uint8Array(n.subarray(1,4))};return 1===r.version?(t+=4,r.creationTime=h(i.getUint32(t)),t+=8,r.modificationTime=h(i.getUint32(t)),t+=4,r.timescale=i.getUint32(t),t+=8):(r.creationTime=h(i.getUint32(t)),t+=4,r.modificationTime=h(i.getUint32(t)),t+=4,r.timescale=i.getUint32(t),t+=4),r.duration=i.getUint32(t),t+=4,r.rate=i.getUint16(t)+i.getUint16(t+2)/16,t+=4,r.volume=i.getUint8(t)+i.getUint8(t+1)/8,t+=2,t+=2,t+=8,r.matrix=new Uint32Array(n.subarray(t,t+36)),t+=36,t+=24,r.nextTrackId=i.getUint32(t),r},pdin:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(n.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(n){for(var i={version:n[0],flags:new Uint8Array(n.subarray(1,4)),samples:[]},t=4;t<n.byteLength;t++)i.samples.push({dependsOn:(48&n[t])>>4,isDependedOn:(12&n[t])>>2,hasRedundancy:3&n[t]});return i},sidx:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},u=i.getUint16(22),t=24;u;t+=12,u--)r.references.push({referenceType:(128&n[t])>>>7,referencedSize:2147483647&i.getUint32(t),subsegmentDuration:i.getUint32(t+4),startsWithSap:!!(128&n[t+8]),sapType:(112&n[t+8])>>>4,sapDeltaTime:268435455&i.getUint32(t+8)});return r},smhd:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),balance:n[4]+n[5]/256}},stbl:function(n){return{boxes:e(n)}},stco:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),chunkOffsets:[]},u=i.getUint32(4),t=8;u;t+=4,u--)r.chunkOffsets.push(i.getUint32(t));return r},stsc:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r=i.getUint32(4),u={version:n[0],flags:new Uint8Array(n.subarray(1,4)),sampleToChunks:[]},t=8;r;t+=12,r--)u.sampleToChunks.push({firstChunk:i.getUint32(t),samplesPerChunk:i.getUint32(t+4),sampleDescriptionIndex:i.getUint32(t+8)});return u},stsd:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),sampleDescriptions:e(n.subarray(8))}},stsz:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]},t=12;t<n.byteLength;t+=4)r.entries.push(i.getUint32(t));return r},stts:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),timeToSamples:[]},u=i.getUint32(4),t=8;u;t+=8,u--)r.timeToSamples.push({sampleCount:i.getUint32(t),sampleDelta:i.getUint32(t+4)});return r},styp:function(n){return b.ftyp(n)},tfdt:function(n){var t={version:n[0],flags:new Uint8Array(n.subarray(1,4)),baseMediaDecodeTime:n[4]<<24|n[5]<<16|n[6]<<8|n[7]};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=n[8]<<24|n[9]<<16|n[10]<<8|n[11]),t},tfhd:function(n){var i,r=new DataView(n.buffer,n.byteOffset,n.byteLength),t={version:n[0],flags:new Uint8Array(n.subarray(1,4)),trackId:r.getUint32(4)},u=1&t.flags[2],f=2&t.flags[2],e=8&t.flags[2],o=16&t.flags[2],s=32&t.flags[2],h=65536&t.flags[0],c=131072&t.flags[0];return i=8,u&&(i+=4,t.baseDataOffset=r.getUint32(12),i+=4),f&&(t.sampleDescriptionIndex=r.getUint32(i),i+=4),e&&(t.defaultSampleDuration=r.getUint32(i),i+=4),o&&(t.defaultSampleSize=r.getUint32(i),i+=4),s&&(t.defaultSampleFlags=r.getUint32(i)),h&&(t.durationIsEmpty=!0),!u&&c&&(t.baseDataOffsetIsMoof=!0),t},tkhd:function(n){var i=new DataView(n.buffer,n.byteOffset,n.byteLength),t=4,r={version:i.getUint8(0),flags:new Uint8Array(n.subarray(1,4))};return 1===r.version?(t+=4,r.creationTime=h(i.getUint32(t)),t+=8,r.modificationTime=h(i.getUint32(t)),t+=4,r.trackId=i.getUint32(t),t+=4,t+=8):(r.creationTime=h(i.getUint32(t)),t+=4,r.modificationTime=h(i.getUint32(t)),t+=4,r.trackId=i.getUint32(t),t+=4,t+=4),r.duration=i.getUint32(t),t+=4,t+=8,r.layer=i.getUint16(t),t+=2,r.alternateGroup=i.getUint16(t),t+=2,r.volume=i.getUint8(t)+i.getUint8(t+1)/8,t+=2,t+=2,r.matrix=new Uint32Array(n.subarray(t,t+36)),t+=36,r.width=i.getUint16(t)+i.getUint16(t+2)/16,t+=4,r.height=i.getUint16(t)+i.getUint16(t+2)/16,r},traf:function(n){return{boxes:e(n)}},trak:function(n){return{boxes:e(n)}},trex:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:3&n[20],sampleIsDependedOn:(192&n[21])>>6,sampleHasRedundancy:(48&n[21])>>4,samplePaddingValue:(14&n[21])>>1,sampleIsDifferenceSample:!!(1&n[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(n){var i,r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),samples:[]},u=new DataView(n.buffer,n.byteOffset,n.byteLength),h=1&r.flags[2],c=4&r.flags[2],e=1&r.flags[1],o=2&r.flags[1],l=4&r.flags[1],s=8&r.flags[1],f=u.getUint32(4),t=8;for(h&&(r.dataOffset=u.getInt32(t),t+=4),c&&f&&(i={flags:rf(n.subarray(t,t+4))},t+=4,e&&(i.duration=u.getUint32(t),t+=4),o&&(i.size=u.getUint32(t),t+=4),s&&(i.compositionTimeOffset=u.getUint32(t),t+=4),r.samples.push(i),f--);f--;)i={},e&&(i.duration=u.getUint32(t),t+=4),o&&(i.size=u.getUint32(t),t+=4),l&&(i.flags=rf(n.subarray(t,t+4)),t+=4),s&&(i.compositionTimeOffset=u.getUint32(t),t+=4),r.samples.push(i);return r},"url ":function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4))}},vmhd:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}},yi={inspect:e=function(n){for(var o,i,u,f,e,t=0,s=[],h=new ArrayBuffer(n.length),c=new Uint8Array(h),r=0;r<n.length;++r)c[r]=n[r];for(o=new DataView(h);t<n.byteLength;)i=o.getUint32(t),u=lt(n.subarray(t+4,t+8)),f=1<i?t+i:n.byteLength,(e=(b[u]||function(n){return{data:n}})(n.subarray(t+8,f))).size=i,e.type=u,s.push(e),t=f;return s},textify:tf=function(n,t){var i;return t=t||0,i=new Array(2*t+1).join(" "),n.map(function(n){return i+n.type+"\n"+Object.keys(n).filter(function(n){return"type"!==n&&"boxes"!==n}).map(function(t){var f=i+"  "+t+": ",r=n[t],u;return r instanceof Uint8Array||r instanceof Uint32Array?(u=Array.prototype.slice.call(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map(function(n){return" "+("00"+n.toString(16)).slice(-2)}).join("").match(/.{1,24}/g),u?1===u.length?f+"<"+u.join("").slice(1)+">":f+"<\n"+u.map(function(n){return i+"  "+n}).join("\n")+"\n"+i+"  >":f+"<>"):f+JSON.stringify(r,null,2).split("\n").map(function(n,t){return 0===t?n:i+"  "+n}).join("\n")}).join("\n")+(n.boxes?"\n"+tf(n.boxes,t+1):"")}).join("\n")},parseTfdt:b.tfdt,parseHdlr:b.hdlr,parseTfhd:b.tfhd,parseTrun:b.trun},re=vf,ue=kt.CaptionStream,fe=function(n,t){for(var r,u=n,i=0;i<t.length;i++){if(r=t[i],u<r.size)return r;u-=r.size}return null},ee=function(n,t){var u=a.findBox(n,["moof","traf"]),f=a.findBox(n,["mdat"]),i={},r=[];return f.forEach(function(n,t){var i=u[t];r.push({mdat:n,traf:i})}),r.forEach(function(n){var s,h,e,u,c,l,v,f,b=n.mdat,o=n.traf,k=a.findBox(o,["tfhd"]),y=yi.parseTfhd(k[0]),r=y.trackId,p=a.findBox(o,["tfdt"]),d=0<p.length?yi.parseTfdt(p[0]).baseMediaDecodeTime:0,w=a.findBox(o,["trun"]);t===r&&0<w.length&&(h=w,u=d,c=(e=y).defaultSampleDuration||0,l=e.defaultSampleSize||0,v=e.trackId,f=[],h.forEach(function(n){var t=yi.parseTrun(n).samples;t.forEach(function(n){void 0===n.duration&&(n.duration=c);void 0===n.size&&(n.size=l);n.trackId=v;n.dts=u;void 0===n.compositionTimeOffset&&(n.compositionTimeOffset=0);n.pts=u+n.compositionTimeOffset;u+=n.duration});f=f.concat(t)}),s=function(n,t,i){for(var u,f,o,c=new DataView(n.buffer,n.byteOffset,n.byteLength),h=[],s,e,r=0;r+4<n.length;r+=f)if(f=c.getUint32(r),r+=4,!(f<=0))switch(31&n[r]){case 6:s=n.subarray(r+1,r+1+f);e=fe(r,t);u={nalUnitType:"sei_rbsp",size:f,data:s,escapedRBSP:re(s),trackId:i};e?(u.pts=e.pts,u.dts=e.dts,o=e):(u.pts=o.pts,u.dts=o.dts);h.push(u)}return h}(b,f,r),i[r]||(i[r]=[]),i[r]=i[r].concat(s))}),i},oe={generator:p,probe:a,Transmuxer:vi.Transmuxer,AudioSegmentStream:vi.AudioSegmentStream,VideoSegmentStream:vi.VideoSegmentStream,CaptionParser:function(){var r,u,n,t,i,f=!1;this.isInitialized=function(){return f};this.init=function(){r=new ue;f=!0;r.on("data",function(n){n.startTime=n.startPts/t;n.endTime=n.endPts/t;i.captions.push(n);i.captionStreams[n.stream]=!0})};this.isNewInit=function(i,r){return!(i&&0===i.length||r&&"object"===("undefined"==typeof r?"undefined":d(r))&&0===Object.keys(r).length||n===i[0]&&t===r[n])};this.parse=function(r,f,e){var o,h,s,c,l;if(!this.isInitialized()||!f||!e)return null;if(this.isNewInit(f,e))n=f[0],t=e[n];else if(!n||!t)return u.push(r),null;for(;0<u.length;)l=u.shift(),this.parse(l,f,e);return h=r,c=t,null!==(o=(s=n)?{seiNals:ee(h,s)[s],timescale:c}:null)&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),i):null};this.pushNals=function(n){if(!this.isInitialized()||!n||0===n.length)return null;n.forEach(function(n){r.push(n)})};this.flushStream=function(){if(!this.isInitialized())return null;r.flush()};this.clearParsedCaptions=function(){i.captions=[];i.captionStreams={}};this.resetCaptionStream=function(){if(!this.isInitialized())return null;r.reset()};this.clearAllCaptions=function(){this.clearParsedCaptions();this.resetCaptionStream()};this.reset=function(){u=[];t=n=null;i?this.clearParsedCaptions():i={captions:[],captionStreams:{}};this.resetCaptionStream()};this.reset()}},se=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");},he=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),uf=function(){function n(t,i){se(this,n);this.options=i||{};this.self=t;this.init()}return he(n,[{key:"init",value:function(){var n,t;this.transmuxer&&this.transmuxer.dispose();this.transmuxer=new oe.Transmuxer(this.options);n=this.self;(t=this.transmuxer).on("data",function(t){var r=t.initSegment,i;t.initSegment={data:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength};i=t.data;t.data=i.buffer;n.postMessage({action:"data",segment:t,byteOffset:i.byteOffset,byteLength:i.byteLength},[t.data])});t.captionStream&&t.captionStream.on("data",function(t){n.postMessage({action:"caption",data:t})});t.on("done",function(){n.postMessage({action:"done"})});t.on("gopInfo",function(t){n.postMessage({action:"gopInfo",gopInfo:t})})}},{key:"push",value:function(n){var t=new Uint8Array(n.data,n.byteOffset,n.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(n){var t=n.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4*t))}},{key:"setAudioAppendStart",value:function(n){this.transmuxer.setAudioAppendStart(Math.ceil(9e4*n.appendStart))}},{key:"flush",value:function(){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}},{key:"alignGopsWith",value:function(n){this.transmuxer.alignGopsWith(n.gopsToAlignWith.slice())}}]),n}();new function(n){n.onmessage=function(t){"init"===t.data.action&&t.data.options?this.messageHandlers=new uf(n,t.data.options):(this.messageHandlers||(this.messageHandlers=new uf(n)),t.data&&t.data.action&&"init"!==t.data.action&&this.messageHandlers[t.data.action]&&this.messageHandlers[t.data.action](t.data))}}(n)}()}),bft={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},kft=function(n){return n.map(function(n){return n.replace(/avc1\.(\d+)\.(\d+)/i,function(n,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})})},ro=function(){var t,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n={codecCount:0};return n.codecCount=i.split(",").length,n.codecCount=n.codecCount||2,(t=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(i))&&(n.videoCodec=t[2],n.videoObjectTypeIndicator=t[3]),n.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(i),n.audioProfile=n.audioProfile&&n.audioProfile[2],n},tw=function(n,t,i){return n+"/"+t+'; codecs="'+i.filter(function(n){return!!n}).join(", ")+'"'},ipt=function(t,i){var s,v,h=(s=i).segments&&s.segments.length&&s.segments[0].map?"mp4":"mp2t",u=(v=i.attributes||{}).CODECS?ro(v.CODECS):bft,c=i.attributes||{},f=!0,l=!1,e,a,r;if(!i)return[];if(t.mediaGroups.AUDIO&&c.AUDIO&&(e=t.mediaGroups.AUDIO[c.AUDIO],e))for(a in f=!(l=!0),e)if(!e[a].uri&&!e[a].playlists){f=!0;break}l&&!u.audioProfile&&(f||(u.audioProfile=function(n,t){var i,u,r;if(!n.mediaGroups.AUDIO||!t||(i=n.mediaGroups.AUDIO[t],!i))return null;for(u in i)if(r=i[u],r.default&&r.playlists)return ro(r.playlists[0].attributes.CODECS).audioProfile;return null}(t,c.AUDIO)),u.audioProfile||(n.log.warn("Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"),u.audioProfile=bft.audioProfile));r={};u.videoCodec&&(r.video=""+u.videoCodec+u.videoObjectTypeIndicator);u.audioProfile&&(r.audio="mp4a.40."+u.audioProfile);var o=tw("audio",h,[r.audio]),p=tw("video",h,[r.video]),y=tw("video",h,[r.video,r.audio]);return l?!f&&r.video?[p,o]:f||r.video?[y,o]:[o,o]:r.video?[y]:[o]},dft=function(n){return/mp4a\.\d+.\d+/i.test(n)},gft=function(n){return/avc1\.[\da-f]+/i.test(n)},rpt=function(t,i,r){var e=null,o=null,c=0,f=[],l=[];if(!t&&!i)return n.createTimeRange();if(!t)return i.buffered;if(!i||r)return t.buffered;if(0===t.buffered.length&&0===i.buffered.length)return n.createTimeRange();for(var s=t.buffered,h=i.buffered,u=s.length;u--;)f.push({time:s.start(u),type:"start"}),f.push({time:s.end(u),type:"end"});for(u=h.length;u--;)f.push({time:h.start(u),type:"start"}),f.push({time:h.end(u),type:"end"});for(f.sort(function(n,t){return n.time-t.time}),u=0;u<f.length;u++)"start"===f[u].type?2==++c&&(e=f[u].time):"end"===f[u].type&&1==--c&&(o=f[u].time),null!==e&&null!==o&&(l.push([e,o]),o=e=null);return n.createTimeRanges(l)},upt=function(){function t(i,r){var u,f;return ni(this,t),u=vi(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,n.EventTarget)),u.timestampOffset_=0,u.pendingBuffers_=[],u.bufferUpdating_=!1,u.mediaSource_=i,u.codecs_=r,u.audioCodec_=null,u.videoCodec_=null,u.audioDisabled_=!1,u.appendAudioInitSegment_=!0,u.gopBuffer_=[],u.timeMapping_=0,u.safeAppend_=11<=n.browser.IE_VERSION,f={remux:!1,alignGopsAtEnd:u.safeAppend_},u.codecs_.forEach(function(n){dft(n)?u.audioCodec_=n:gft(n)&&(u.videoCodec_=n)}),u.transmuxer_=new tpt,u.transmuxer_.postMessage({action:"init",options:f}),u.transmuxer_.onmessage=function(n){return"data"===n.data.action?u.data_(n):"done"===n.data.action?u.done_(n):"gopInfo"===n.data.action?u.appendGopInfo_(n):void 0},Object.defineProperty(u,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(n){"number"==typeof n&&0<=n&&(this.timestampOffset_=n,this.appendAudioInitSegment_=!0,this.gopBuffer_.length=0,this.timeMapping_=0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:n}))}}),Object.defineProperty(u,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(n){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=n);this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=n)}}),Object.defineProperty(u,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(u,"buffered",{get:function(){return rpt(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),u}return di(t,n.EventTarget),oi(t,[{key:"data_",value:function(n){var t=n.data.segment;t.data=new Uint8Array(t.data,n.data.byteOffset,n.data.byteLength);t.initSegment=new Uint8Array(t.initSegment.data,t.initSegment.byteOffset,t.initSegment.byteLength),function(n,t,i){var u=t.player_,r,f;if(i.captions&&i.captions.length)for(r in n.inbandTextTracks_||(n.inbandTextTracks_={}),i.captionStreams)n.inbandTextTracks_[r]||(u.tech_.trigger({type:"usage",name:"hls-608"}),f=u.textTracks().getTrackById(r),n.inbandTextTracks_[r]=f||u.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track);i.metadata&&i.metadata.length&&!n.metadataTrack_&&(n.metadataTrack_=u.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,n.metadataTrack_.inBandMetadataTrackDispatchType=i.metadata.dispatchType)}(this,this.mediaSource_,t);this.pendingBuffers_.push(t)}},{key:"done_",value:function(){"closed"!==this.mediaSource_.readyState?this.processPendingSegments_():this.pendingBuffers_.length=0}},{key:"createRealSourceBuffers_",value:function(){var n=this,t=["audio","video"];t.forEach(function(i){var r,u;n[i+"Codec_"]&&!n[i+"Buffer_"]&&(r=null,n.mediaSource_[i+"Buffer_"]?(r=n.mediaSource_[i+"Buffer_"]).updating=!1:(u=i+'/mp4;codecs="'+n[i+"Codec_"]+'"',r=function(n,t){var i=n.addSourceBuffer(t),r=Object.create(null),u,f;r.updating=!1;r.realBuffer_=i;u=function(n){"function"==typeof i[n]?r[n]=function(){return i[n].apply(i,arguments)}:"undefined"==typeof r[n]&&Object.defineProperty(r,n,{get:function(){return i[n]},set:function(t){return i[n]=t}})};for(f in i)u(f);return r}(n.mediaSource_.nativeMediaSource_,u),n.mediaSource_[i+"Buffer_"]=r),n[i+"Buffer_"]=r,["update","updatestart","updateend"].forEach(function(u){r.addEventListener(u,function(){if("audio"!==i||!n.audioDisabled_)return"updateend"===u&&(n[i+"Buffer_"].updating=!1),t.every(function(t){return!("audio"!==t||!n.audioDisabled_)||i===t||!n[t+"Buffer_"]||!n[t+"Buffer_"].updating})?n.trigger(u):void 0})}))})}},{key:"appendBuffer",value:function(n){if(this.bufferUpdating_=!0,this.audioBuffer_&&this.audioBuffer_.buffered.length){var t=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:t.end(t.length-1)})}this.videoBuffer_&&this.transmuxer_.postMessage({action:"alignGopsWith",gopsToAlignWith:function(n,t,i){if("undefined"==typeof t||null===t||!n.length)return[];for(var u=Math.ceil(9e4*(t-i+3)),r=void 0,r=0;r<n.length&&!(n[r].pts>u);r++);return n.slice(r)}(this.gopBuffer_,this.mediaSource_.player_?this.mediaSource_.player_.currentTime():null,this.timeMapping_)});this.transmuxer_.postMessage({action:"push",data:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength},[n.buffer]);this.transmuxer_.postMessage({action:"flush"})}},{key:"appendGopInfo_",value:function(n){this.gopBuffer_=function(n,t,i){if(!t.length)return n;if(i)return t.slice();for(var u=t[0].pts,r=0;r<n.length&&!(n[r].pts>=u);r++);return n.slice(0,r).concat(t)}(this.gopBuffer_,n.data.gopInfo,this.safeAppend_)}},{key:"remove",value:function(n,t){if(this.videoBuffer_&&(this.videoBuffer_.updating=!0,this.videoBuffer_.remove(n,t),this.gopBuffer_=function(n,t,i,r){for(var u,o=Math.ceil(9e4*(t-r)),s=Math.ceil(9e4*(i-r)),e=n.slice(),f=n.length;f--&&!(n[f].pts<=s););if(-1===f)return e;for(u=f+1;u--&&!(n[u].pts<=o););return u=Math.max(u,0),e.splice(u,f-u+1),e}(this.gopBuffer_,n,t,this.timeMapping_)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(n,t)),of(n,t,this.metadataTrack_),this.inbandTextTracks_)for(var i in this.inbandTextTracks_)of(n,t,this.inbandTextTracks_[i])}},{key:"processPendingSegments_",value:function(){var n={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]},t;n=this.pendingBuffers_.reduce(function(n,t){var i=t.type,r=t.data,u=t.initSegment;return n[i].segments.push(r),n[i].bytes+=r.byteLength,n[i].initSegment=u,t.captions&&(n.captions=n.captions.concat(t.captions)),t.info&&(n[i].info=t.info),t.metadata&&(n.metadata=n.metadata.concat(t.metadata)),n},n);this.videoBuffer_||this.audioBuffer_||(0===n.video.bytes&&(this.videoCodec_=null),0===n.audio.bytes&&(this.audioCodec_=null),this.createRealSourceBuffers_());n.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:n.audio.info});n.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:n.video.info});this.appendAudioInitSegment_&&(!this.audioDisabled_&&this.audioBuffer_&&(n.audio.segments.unshift(n.audio.initSegment),n.audio.bytes+=n.audio.initSegment.byteLength),this.appendAudioInitSegment_=!1);t=!1;this.videoBuffer_&&n.video.bytes?(n.video.segments.unshift(n.video.initSegment),n.video.bytes+=n.video.initSegment.byteLength,this.concatAndAppendSegments_(n.video,this.videoBuffer_),dyt(this,n.captions,n.metadata)):!this.videoBuffer_||!this.audioDisabled_&&this.audioBuffer_||(t=!0);!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(n.audio,this.audioBuffer_);this.pendingBuffers_.length=0;t&&this.trigger("updateend");this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(n,t){var r=0,i=void 0;if(n.bytes){i=new Uint8Array(n.bytes);n.segments.forEach(function(n){i.set(n,r);r+=n.byteLength});try{t.updating=!0;t.appendBuffer(i)}catch(n){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:n.message,originalError:n})}}}},{key:"abort",value:function(){this.videoBuffer_&&this.videoBuffer_.abort();!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.abort();this.transmuxer_&&this.transmuxer_.postMessage({action:"reset"});this.pendingBuffers_.length=0;this.bufferUpdating_=!1}}]),t}(),iw=function(){function i(){ni(this,i);var r=vi(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));for(var f in r.nativeMediaSource_=new t.MediaSource,r.nativeMediaSource_)f in i.prototype||"function"!=typeof r.nativeMediaSource_[f]||(r[f]=r.nativeMediaSource_[f].bind(r.nativeMediaSource_));return r.duration_=NaN,Object.defineProperty(r,"duration",{get:function(){return this.duration_===1/0?this.duration_:this.nativeMediaSource_.duration},set:function(n){(this.duration_=n)===1/0||(this.nativeMediaSource_.duration=n)}}),Object.defineProperty(r,"seekable",{get:function(){return this.duration_===1/0?n.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(r,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(r,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),r.sourceBuffers=[],r.activeSourceBuffers_=[],r.updateActiveSourceBuffers_=function(){var n,u;if(r.activeSourceBuffers_.length=0,1===r.sourceBuffers.length)return n=r.sourceBuffers[0],n.appendAudioInitSegment_=!0,n.audioDisabled_=!n.audioCodec_,void r.activeSourceBuffers_.push(n);for(var f=!1,t=!0,i=0;i<r.player_.audioTracks().length;i++)if(u=r.player_.audioTracks()[i],u.enabled&&"main"!==u.kind){t=!(f=!0);break}r.sourceBuffers.forEach(function(n,i){if(n.appendAudioInitSegment_=!0,n.videoCodec_&&n.audioCodec_)n.audioDisabled_=f;else if(n.videoCodec_&&!n.audioCodec_)n.audioDisabled_=!0,t=!1;else if(!n.videoCodec_&&n.audioCodec_&&(n.audioDisabled_=i?t:!t,n.audioDisabled_))return;r.activeSourceBuffers_.push(n)})},r.onPlayerMediachange_=function(){r.sourceBuffers.forEach(function(n){n.appendAudioInitSegment_=!0})},r.onHlsReset_=function(){r.sourceBuffers.forEach(function(n){n.transmuxer_&&n.transmuxer_.postMessage({action:"resetCaptions"})})},r.onHlsSegmentTimeMapping_=function(n){r.sourceBuffers.forEach(function(t){return t.timeMapping_=n.mapping})},["sourceopen","sourceclose","sourceended"].forEach(function(n){this.nativeMediaSource_.addEventListener(n,this.trigger.bind(this))},r),r.on("sourceopen",function(){var t=u.querySelector('[src="'+r.url_+'"]');t&&(r.player_=n(t.parentNode),r.player_.tech_.on("hls-reset",r.onHlsReset_),r.player_.tech_.on("hls-segment-time-mapping",r.onHlsSegmentTimeMapping_),r.player_.audioTracks&&r.player_.audioTracks()&&(r.player_.audioTracks().on("change",r.updateActiveSourceBuffers_),r.player_.audioTracks().on("addtrack",r.updateActiveSourceBuffers_),r.player_.audioTracks().on("removetrack",r.updateActiveSourceBuffers_)),r.player_.on("mediachange",r.onPlayerMediachange_))}),r.on("sourceended",function(){for(var i,n,u=yft(r.duration),t=0;t<r.sourceBuffers.length;t++)i=r.sourceBuffers[t],n=i.metadataTrack_&&i.metadataTrack_.cues,n&&n.length&&(n[n.length-1].endTime=u)}),r.on("sourceclose",function(){this.sourceBuffers.forEach(function(n){n.transmuxer_&&n.transmuxer_.terminate()});this.sourceBuffers.length=0;this.player_&&(this.player_.audioTracks&&this.player_.audioTracks()&&(this.player_.audioTracks().off("change",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("addtrack",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("removetrack",this.updateActiveSourceBuffers_)),this.player_.el_&&(this.player_.off("mediachange",this.onPlayerMediachange_),this.player_.tech_.off("hls-reset",this.onHlsReset_),this.player_.tech_.off("hls-segment-time-mapping",this.onHlsSegmentTimeMapping_)))}),r}return di(i,n.EventTarget),oi(i,[{key:"addSeekableRange_",value:function(n,t){var i=void 0;if(this.duration!==1/0)throw(i=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity")).name="InvalidStateError",i.code=11,i;(t>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=t)}},{key:"addSourceBuffer",value:function(n){var r,f,i=void 0,u=(r={type:"",parameters:{}},f=n.trim().split(";"),r.type=f.shift().trim(),f.forEach(function(n){var t=n.trim().split("="),i,u;1<t.length&&(i=t[0].replace(/"/g,"").trim(),u=t[1].replace(/"/g,"").trim(),r.parameters[i]=u)}),r),t;return/^(video|audio)\/mp2t$/i.test(u.type)?(t=[],u.parameters&&u.parameters.codecs&&(t=u.parameters.codecs.split(","),t=(t=kft(t)).filter(function(n){return dft(n)||gft(n)})),0===t.length&&(t=["avc1.4d400d","mp4a.40.2"]),i=new upt(this,t),0!==this.sourceBuffers.length&&(this.sourceBuffers[0].createRealSourceBuffers_(),i.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)):i=this.nativeMediaSource_.addSourceBuffer(n),this.sourceBuffers.push(i),i}}]),i}(),net=0;n.mediaSources={};var tet=function(t,i){var r=n.mediaSources[t];if(!r)throw new Error("Media Source not found (Video.js)");r.trigger({type:"sourceopen",swfId:i})},rw=function(){return!!t.MediaSource&&!!t.MediaSource.isTypeSupported&&t.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},uo=function(){if(this.MediaSource={open:tet,supportsNativeMediaSources:rw},rw())return new iw;throw new Error("Cannot use create a virtual MediaSource for this video");};uo.open=tet;uo.supportsNativeMediaSources=rw;uw={createObjectURL:function(i){var r=void 0;return i instanceof iw?(r=t.URL.createObjectURL(i.nativeMediaSource_),i.url_=r):i instanceof iw?(r="blob:vjs-media-source/"+net,net++,n.mediaSources[r]=i,r):(r=t.URL.createObjectURL(i),i.url_=r)}};n.MediaSource=uo;n.URL=uw;var fpt=n.EventTarget,ept=n.mergeOptions,iet=function(n,t){for(var u,i=ept(n,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),r=0;r<t.playlists.length;r++)u=yp(i,t.playlists[r]),u&&(i=u);return vp(t,function(n,t,r,u){if(n.playlists&&n.playlists.length){var e=n.playlists[0].uri,f=yp(i,n.playlists[0]);f&&((i=f).mediaGroups[t][r][u].playlists[0]=i.playlists[e])}}),i},fw=function(){function n(i,r,u,f){ni(this,n);var e=vi(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));if(e.hls_=r,e.withCredentials=u,!i)throw new Error("A non-empty playlist URL or playlist is required");return e.on("minimumUpdatePeriod",function(){e.refreshXml_()}),e.on("mediaupdatetimeout",function(){e.refreshMedia_()}),"string"==typeof i?(e.srcUrl=i,e.state="HAVE_NOTHING",vi(e)):(e.masterPlaylistLoader_=f,e.state="HAVE_METADATA",e.started=!0,e.media(i),t.setTimeout(function(){e.trigger("loadedmetadata")},0),e)}return di(n,fpt),oi(n,[{key:"dispose",value:function(){this.stopRequest();t.clearTimeout(this.mediaUpdateTimeout)}},{key:"stopRequest",value:function(){if(this.request){var n=this.request;this.request=null;n.onreadystatechange=null;n.abort()}}},{key:"media",value:function(n){var t,i;if(!n)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if(t=this.state,"string"==typeof n){if(!this.master.playlists[n])throw new Error("Unknown playlist URI: "+n);n=this.master.playlists[n]}i=!this.media_||n.uri!==this.media_.uri;this.state="HAVE_METADATA";i&&(this.media_&&this.trigger("mediachanging"),this.media_=n,this.refreshMedia_(),"HAVE_MASTER"!==t&&this.trigger("mediachange"))}},{key:"pause",value:function(){this.stopRequest();"HAVE_NOTHING"===this.state&&(this.started=!1)}},{key:"load",value:function(){this.started?this.trigger("loadedplaylist"):this.start()}},{key:"parseMasterXml",value:function(){var n=oct(this.masterXml_,{manifestUri:this.srcUrl,clientOffset:this.clientOffset_}),t,i;for(n.uri=this.srcUrl,t=0;t<n.playlists.length;t++)i="placeholder-uri-"+t,n.playlists[t].uri=i,n.playlists[i]=n.playlists[t];return vp(n,function(t,i,r,u){if(t.playlists&&t.playlists.length){var f="placeholder-uri-"+i+"-"+r+"-"+u;t.playlists[0].uri=f;n.playlists[f]=t.playlists[0]}}),wut(n),but(n),n}},{key:"start",value:function(){var n=this;this.started=!0;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(t,i){if(n.request){if(n.request=null,t)return n.error={status:i.status,message:"DASH playlist request error at URL: "+n.srcUrl,responseText:i.responseText,code:2},"HAVE_NOTHING"===n.state&&(n.started=!1),n.trigger("error");n.masterXml_=i.responseText;n.masterLoaded_=i.responseHeaders&&i.responseHeaders.date?Date.parse(i.responseHeaders.date):Date.now();n.syncClientServerClock_(n.onClientServerClockSync_.bind(n))}})}},{key:"syncClientServerClock_",value:function(n){var i=this,t=sct(this.masterXml_);return null===t?(this.clientOffset_=this.masterLoaded_-Date.now(),n()):"DIRECT"===t.method?(this.clientOffset_=t.value-Date.now(),n()):void(this.request=this.hls_.xhr({uri:ki(this.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials},function(r,u){if(i.request){if(r)return i.clientOffset_=i.masterLoaded_-Date.now(),n();var f=void 0;f="HEAD"===t.method?u.responseHeaders&&u.responseHeaders.date?Date.parse(u.responseHeaders.date):i.masterLoaded_:Date.parse(u.responseText);i.clientOffset_=f-Date.now();n()}}))}},{key:"onClientServerClockSync_",value:function(){var n=this;this.master=this.parseMasterXml();this.state="HAVE_MASTER";this.trigger("loadedplaylist");this.media_||this.media(this.master.playlists[0]);t.setTimeout(function(){n.trigger("loadedmetadata")},0);this.master.minimumUpdatePeriod&&t.setTimeout(function(){n.trigger("minimumUpdatePeriod")},this.master.minimumUpdatePeriod)}},{key:"refreshXml_",value:function(){var n=this;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(i,r){if(n.request){if(n.request=null,i)return n.error={status:r.status,message:"DASH playlist request error at URL: "+n.srcUrl,responseText:r.responseText,code:2},"HAVE_NOTHING"===n.state&&(n.started=!1),n.trigger("error");n.masterXml_=r.responseText;var u=n.parseMasterXml();n.master=iet(n.master,u);t.setTimeout(function(){n.trigger("minimumUpdatePeriod")},n.master.minimumUpdatePeriod)}})}},{key:"refreshMedia_",value:function(){var u=this,i=void 0,r=void 0,n;this.masterPlaylistLoader_?(i=this.masterPlaylistLoader_.master,r=this.masterPlaylistLoader_.parseMasterXml()):(i=this.master,r=this.parseMasterXml());n=iet(i,r);n?(this.masterPlaylistLoader_?this.masterPlaylistLoader_.master=n:this.master=n,this.media_=n.playlists[this.media_.uri]):this.trigger("playlistunchanged");this.media().endList||(this.mediaUpdateTimeout=t.setTimeout(function(){u.trigger("mediaupdatetimeout")},kut(this.media(),!!n)));this.trigger("loadedplaylist")}}]),n}(),fo=function(t){return n.log.debug?n.log.debug.bind(n,"VHS:",t+" >"):function(){}};var opt=function(){function t(n,i,r,u){ni(this,t);this.callbacks_=[];this.pendingCallback_=null;this.timestampOffset_=0;this.mediaSource=n;this.processedAppend_=!1;this.type_=r;this.mimeType_=i;this.logger_=fo("SourceUpdater["+r+"]["+i+"]");"closed"===n.readyState?n.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,i,u)):this.createSourceBuffer_(i,u)}return oi(t,[{key:"createSourceBuffer_",value:function(n,t){var i=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(n);this.logger_("created SourceBuffer");t&&(t.trigger("sourcebufferadded"),this.mediaSource.sourceBuffers.length<2)?t.on("sourcebufferadded",function(){i.start_()}):this.start_()}},{key:"start_",value:function(){var n=this;this.started_=!0;this.onUpdateendCallback_=function(){var t=n.pendingCallback_;n.pendingCallback_=null;n.logger_("buffered ["+bp(n.buffered())+"]");t&&t();n.runCallback_()};this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_);this.runCallback_()}},{key:"abort",value:function(n){var t=this;this.processedAppend_&&this.queueCallback_(function(){t.sourceBuffer_.abort()},n)}},{key:"appendBuffer",value:function(n,t){var i=this;this.processedAppend_=!0;this.queueCallback_(function(){i.sourceBuffer_.appendBuffer(n)},t)}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:n.createTimeRanges()}},{key:"remove",value:function(n,t){var i=this,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:eo;this.processedAppend_&&this.queueCallback_(function(){i.logger_("remove ["+n+" => "+t+"]");i.sourceBuffer_.remove(n,t)},r)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||this.pendingCallback_}},{key:"timestampOffset",value:function(n){var t=this;return"undefined"!=typeof n&&(this.queueCallback_(function(){t.sourceBuffer_.timestampOffset=n}),this.timestampOffset_=n),this.timestampOffset_}},{key:"queueCallback_",value:function(n,t){this.callbacks_.push([n.bind(this),t]);this.runCallback_()}},{key:"runCallback_",value:function(){var n=void 0;!this.updating()&&this.callbacks_.length&&this.started_&&(n=this.callbacks_.shift(),this.pendingCallback_=n[1],n[0]())}},{key:"dispose",value:function(){this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_);this.sourceBuffer_&&"open"===this.mediaSource.readyState&&this.sourceBuffer_.abort()}}]),t}(),si={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,GOAL_BUFFER_LENGTH_RATE:1,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,BUFFER_LOW_WATER_LINE_RATE:1},fc=2,ret=-101,uet=-102,fet=function(n){var t,i,r={};return n.byterange&&(r.Range=(t=n.byterange,i=t.offset+t.length-1,"bytes="+t.offset+"-"+i)),r},eet=function(n){n.forEach(function(n){n.abort()})},ew=function(n,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:ret,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:uet,xhr:t}:n?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:fc,xhr:t}:null},spt=function(n,t,i){var r=[],u=0;return function(f,e){var h,s,o,c;if(f&&(eet(n),r.push(f)),(u+=1)===n.length)return(e.endOfAllRequests=Date.now(),0<r.length)?(h=r.reduce(function(n,t){return t.code>n.code?t:n}),i(h,e)):e.encryptedBytes?(o=e,c=i,(s=t).addEventListener("message",function f(n){if(n.data.source===o.requestId){s.removeEventListener("message",f);var t=n.data.decrypted;return o.bytes=new Uint8Array(t.bytes,t.byteOffset,t.byteLength),c(null,o)}}),void s.postMessage(sft({source:o.requestId,encrypted:o.encryptedBytes,key:o.key.bytes,iv:o.key.iv}),[o.encryptedBytes.buffer,o.key.bytes.buffer])):i(null,e)}},hpt=function(t,i){return function(r){var f,e,u;return t.stats=n.mergeOptions(t.stats,(e=(f=r).target,(u={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0}).bytesReceived=f.loaded,u.bandwidth=Math.floor(u.bytesReceived/u.roundTripTime*8e3),u)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),i(r,t)}},cpt=function(t,i,r,u,f,e,o){var c,a,h,w,v,l=[],b=spt(l,r,o),d,g,s,y,p,k;return f.key&&(d=t(n.mergeOptions(i,{uri:f.key.resolvedUri,responseType:"arraybuffer"}),(c=f,a=b,function(n,t){var r=t.response,u=ew(n,t),i;return u?a(u,c):16!==r.byteLength?a({status:t.status,message:"Invalid HLS key at URL: "+t.uri,code:fc,xhr:t},c):(i=new DataView(r),c.key.bytes=new Uint32Array([i.getUint32(0),i.getUint32(4),i.getUint32(8),i.getUint32(12)]),a(null,c))})),l.push(d)),f.map&&!f.map.bytes&&(g=t(n.mergeOptions(i,{uri:f.map.resolvedUri,responseType:"arraybuffer",headers:fet(f.map)}),(h=f,w=u,v=b,function(n,t){var r=t.response,i=ew(n,t);return i?v(i,h):0===r.byteLength?v({status:t.status,message:"Empty HLS segment content at URL: "+t.uri,code:fc,xhr:t},h):(h.map.bytes=new Uint8Array(t.response),w.isInitialized()||w.init(),h.map.timescales=fi.timescale(h.map.bytes),h.map.videoTrackIds=fi.videoTrackIds(h.map.bytes),v(null,h))})),l.push(g)),k=t(n.mergeOptions(i,{uri:f.resolvedUri,responseType:"arraybuffer",headers:fet(f)}),(s=f,y=u,p=b,function(n,t){var r,f=t.response,u=ew(n,t),i=void 0;return u?p(u,s):0===f.byteLength?p({status:t.status,message:"Empty HLS segment content at URL: "+t.uri,code:fc,xhr:t},s):(s.stats={bandwidth:(r=t).bandwidth,bytesReceived:r.bytesReceived||0,roundTripTime:r.roundTripTime||0},s.key?s.encryptedBytes=new Uint8Array(t.response):s.bytes=new Uint8Array(t.response),s.map&&s.map.bytes&&(y.isInitialized()||y.init(),(i=y.parse(s.bytes,s.map.videoTrackIds,s.map.timescales))&&i.captions&&(s.captionStreams=i.captionStreams,s.fmp4Captions=i.captions)),p(null,s))})),k.addEventListener("progress",hpt(f,e)),l.push(k),function(){return eet(l)}},oet=function(n,i){var r;return n&&(r=t.getComputedStyle(n))?r[i]:""},oo=function(n,t){var i=n.slice();n.sort(function(n,r){var u=t(n,r);return 0===u?i.indexOf(n)-i.indexOf(r):u})},ow=function(n,i){var r=void 0,u=void 0;return n.attributes.BANDWIDTH&&(r=n.attributes.BANDWIDTH),r=r||t.Number.MAX_VALUE,i.attributes.BANDWIDTH&&(u=i.attributes.BANDWIDTH),r-(u=u||t.Number.MAX_VALUE)},set=function(n,t,i){if(!n||!t)return!1;var r=i===n.segments.length;return n.endList&&"open"===t.readyState&&r},het=function(n){return"number"==typeof n&&isFinite(n)},sw=function(){function i(n){ni(this,i);var t=vi(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));if(!n)throw new TypeError("Initialization settings are required");if("function"!=typeof n.currentTime)throw new TypeError("No currentTime getter specified");if(!n.mediaSource)throw new TypeError("No MediaSource specified");return t.bandwidth=n.bandwidth,t.throughput={rate:0,count:0},t.roundTrip=NaN,t.resetStats_(),t.mediaIndex=null,t.hasPlayed_=n.hasPlayed,t.currentTime_=n.currentTime,t.seekable_=n.seekable,t.seeking_=n.seeking,t.duration_=n.duration,t.mediaSource_=n.mediaSource,t.hls_=n.hls,t.loaderType_=n.loaderType,t.startingMedia_=void 0,t.segmentMetadataTrack_=n.segmentMetadataTrack,t.goalBufferLength_=n.goalBufferLength,t.sourceType_=n.sourceType,t.inbandTextTracks_=n.inbandTextTracks,t.state_="INIT",t.checkBufferTimeout_=null,t.error_=void 0,t.currentTimeline_=-1,t.pendingSegment_=null,t.mimeType_=null,t.sourceUpdater_=null,t.xhrOptions_=null,t.activeInitSegmentId_=null,t.initSegments_={},t.captionParser_=new fvt,t.decrypter_=n.decrypter,t.syncController_=n.syncController,t.syncPoint_={segmentIndex:0,time:0},t.syncController_.on("syncinfoupdate",function(){return t.trigger("syncinfoupdate")}),t.mediaSource_.addEventListener("sourceopen",function(){return t.ended_=!1}),t.fetchAtBuffer_=!1,t.logger_=fo("SegmentLoader["+t.loaderType_+"]"),Object.defineProperty(t,"state",{get:function(){return this.state_},set:function(n){n!==this.state_&&(this.logger_(this.state_+" -> "+n),this.state_=n)}}),t}return di(i,n.EventTarget),oi(i,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0;this.mediaRequests=0;this.mediaRequestsAborted=0;this.mediaRequestsTimedout=0;this.mediaRequestsErrored=0;this.mediaTransferDuration=0;this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED";this.pause();this.abort_();this.sourceUpdater_&&this.sourceUpdater_.dispose();this.resetStats_();this.captionParser_.reset()}},{key:"abort",value:function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests();this.pendingSegment_=null}},{key:"error",value:function(n){return"undefined"!=typeof n&&(this.error_=n),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0;this.pause();this.trigger("ended")}},{key:"buffered_",value:function(){return this.sourceUpdater_?this.sourceUpdater_.buffered():n.createTimeRanges()}},{key:"initSegment",value:function(n){var r=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i,t;return n?(i=uc(n),t=this.initSegments_[i],r&&!t&&n.bytes&&(this.initSegments_[i]=t={resolvedUri:n.resolvedUri,byterange:n.byterange,bytes:n.bytes,timescales:n.timescales,videoTrackIds:n.videoTrackIds}),t||n):null}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&"INIT"===this.state)&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();this.couldBeginLoading_()&&("READY"===this.state||"INIT"===this.state)&&(this.state="READY")}}},{key:"init_",value:function(){return this.state="READY",this.sourceUpdater_=new opt(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(n){var f=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t,i,u,r;if(n){if(t=this.playlist_,i=this.pendingSegment_,this.playlist_=n,this.xhrOptions_=f,this.hasPlayed_()||(n.syncInfo={mediaSequence:n.mediaSequence,time:0}),u=t?t.id:null,this.logger_("playlist update ["+u+" => "+n.id+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();t&&t.uri===n.uri?(r=n.mediaSequence-t.mediaSequence,this.logger_("live window shift ["+r+"]"),null!==this.mediaIndex&&(this.mediaIndex-=r),i&&(i.mediaIndex-=r,0<=i.mediaIndex&&(i.segment=n.segments[i.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(t,n)):null!==this.mediaIndex&&this.resyncLoader()}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(t.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(n,t){this.mimeType_||(this.mimeType_=n,this.sourceBufferEmitter_=t,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(n){this.ended_=!1;this.resetLoader();this.remove(0,this.duration_(),n);this.captionParser_.clearAllCaptions();this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1;this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null;this.syncPoint_=null;this.abort()}},{key:"remove",value:function(n,t,i){if(this.sourceUpdater_&&this.sourceUpdater_.remove(n,t,i),of(n,t,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var r in this.inbandTextTracks_)of(n,t,this.inbandTextTracks_[r])}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&t.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=t.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_();this.checkBufferTimeout_&&t.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=t.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var n=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);n&&(set(this.playlist_,this.mediaSource_,n.mediaIndex)?this.endOfStream():(n.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())&&((n.timeline!==this.currentTimeline_||null!==n.startOfSegment&&n.startOfSegment<this.sourceUpdater_.timestampOffset())&&(this.syncController_.reset(),n.timestampOffset=n.startOfSegment,this.captionParser_.clearAllCaptions()),this.loadSegment_(n)))}}},{key:"checkBuffer_",value:function(n,t,i,r,u,f){var o=0,e=void 0,h,s,c,l;return(n.length&&(o=n.end(n.length-1)),h=Math.max(0,o-u),!t.segments.length)?null:h>=this.goalBufferLength_()?null:!r&&1<=h?null:null===f?(i=this.getSyncSegmentCandidate_(t),this.generateSegmentInfo_(t,i,null,!0)):null!==i?(s=t.segments[i],e=s&&s.end?s.end:o,this.generateSegmentInfo_(t,i+1,e,!1)):(this.fetchAtBuffer_?(c=wt.getMediaInfoForTime(t,o,f.segmentIndex,f.time),i=c.mediaIndex,e=c.startTime):(l=wt.getMediaInfoForTime(t,u,f.segmentIndex,f.time),i=l.mediaIndex,e=l.startTime),this.generateSegmentInfo_(t,i,e,!1))}},{key:"getSyncSegmentCandidate_",value:function(n){var i=this,t;return-1===this.currentTimeline_?0:(t=n.segments.map(function(n,t){return{timeline:n.timeline,segmentIndex:t}}).filter(function(n){return n.timeline===i.currentTimeline_}),t.length?t[Math.min(t.length-1,1)].segmentIndex:Math.max(n.segments.length-1,0))}},{key:"generateSegmentInfo_",value:function(n,t,i,r){if(t<0||t>=n.segments.length)return null;var u=n.segments[t];return{requestId:"segment-loader-"+Math.random(),uri:u.resolvedUri,mediaIndex:t,isSyncRequest:r,startOfSegment:i,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:u.duration,segment:u}}},{key:"abortRequestEarly_",value:function(n){var t,s,r;if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(n.firstBytesReceivedAt||Date.now())<1e3)return!1;var u=this.currentTime_(),f=n.bandwidth,e=this.pendingSegment_.duration,o=wt.estimateSegmentRequestTime(e,f,this.playlist_,n.bytesReceived),i=function(n,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return((n.length?n.end(n.length-1):0)-t)/i}(this.buffered_(),u,this.hls_.tech_.playbackRate())-1;return o<=i?!1:(t=function(n){var f=n.master,e=n.currentTime,o=n.bandwidth,s=n.duration,h=n.segmentDuration,c=n.timeUntilRebuffer,l=n.currentTimeline,a=n.syncController,u=f.playlists.filter(function(n){return!wt.isIncompatible(n)}),r=u.filter(wt.isEnabled),t,i;return r.length||(r=u.filter(function(n){return!wt.isDisabled(n)})),t=r.filter(wt.hasAttribute.bind(null,"BANDWIDTH")).map(function(n){var t=a.getSyncPoint(n,s,l,e)?1:2;return{playlist:n,rebufferingImpact:wt.estimateSegmentRequestTime(h,o,n)*t-c}}),i=t.filter(function(n){return n.rebufferingImpact<=0}),oo(i,function(n,t){return ow(t.playlist,n.playlist)}),i.length?i[0]:(oo(t,function(n,t){return n.rebufferingImpact-t.rebufferingImpact}),t[0]||null)}({master:this.hls_.playlists.master,currentTime:u,bandwidth:f,duration:this.duration_(),segmentDuration:e,timeUntilRebuffer:i,currentTimeline:this.currentTimeline_,syncController:this.syncController_}),t?(s=o-i-t.rebufferingImpact,r=.5,i<=io&&(r=1),!t.playlist||t.playlist.uri===this.playlist_.uri||s<r?!1:(this.bandwidth=t.playlist.attributes.BANDWIDTH*si.BANDWIDTH_VARIANCE+1,this.abort(),this.trigger("earlyabort"),!0)):void 0)}},{key:"handleProgress_",value:function(n,t){this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId&&!this.abortRequestEarly_(t.stats)&&this.trigger("progress")}},{key:"loadSegment_",value:function(n){this.state="WAITING";this.pendingSegment_=n;this.trimBackBuffer_(n);n.abortRequests=cpt(this.hls_.xhr,this.xhrOptions_,this.decrypter_,this.captionParser_,this.createSimplifiedSegmentObj_(n),this.handleProgress_.bind(this),this.segmentRequestFinished_.bind(this))}},{key:"trimBackBuffer_",value:function(){var n,t,r,i,u=(n=this.seekable_(),t=this.currentTime_(),r=this.playlist_.targetDuration||10,i=void 0,i=n.length&&0<n.start(0)&&n.start(0)<t?n.start(0):t-30,Math.min(i,t-r));0<u&&this.remove(0,u)}},{key:"createSimplifiedSegmentObj_",value:function(n){var t=n.segment,i={resolvedUri:t.resolvedUri,byterange:t.byterange,requestId:n.requestId},r;return t.key&&(r=t.key.iv||new Uint32Array([0,0,0,n.mediaIndex+n.playlist.mediaSequence]),i.key={resolvedUri:t.key.resolvedUri,iv:r}),t.map&&(i.map=this.initSegment(t.map)),i}},{key:"segmentRequestFinished_",value:function(n,t){if(this.mediaRequests+=1,t.stats&&(this.mediaBytesTransferred+=t.stats.bytesReceived,this.mediaTransferDuration+=t.stats.roundTripTime),this.pendingSegment_){if(t.requestId===this.pendingSegment_.requestId){if(n)return this.pendingSegment_=null,this.state="READY",n.code===uet?void(this.mediaRequestsAborted+=1):(this.pause(),n.code===ret?(this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,void this.trigger("bandwidthupdate")):(this.mediaRequestsErrored+=1,this.error(n),void this.trigger("error")));this.bandwidth=t.stats.bandwidth;this.roundTrip=t.stats.roundTripTime;t.map&&(t.map=this.initSegment(t.map,!0));this.processSegmentResponse_(t)}}else this.mediaRequestsAborted+=1}},{key:"processSegmentResponse_",value:function(n){var t=this.pendingSegment_;t.bytes=n.bytes;n.map&&(t.segment.map.bytes=n.map.bytes);t.endOfAllRequests=n.endOfAllRequests;n.fmp4Captions&&(!function(n,t,i){var r,u;for(r in i)n[r]||(t.trigger({type:"usage",name:"hls-608"}),u=t.textTracks().getTrackById(r),n[r]=u||t.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track)}(this.inbandTextTracks_,this.hls_.tech_,n.captionStreams),function(n){var t=n.inbandTextTracks,i=n.captionArray,r=n.timestampOffset,u;i&&(u=window.WebKitDataCue||window.VTTCue,i.forEach(function(n){var i=n.stream,f=n.startTime,e=n.endTime;t[i]&&(f+=r,e+=r,t[i].addCue(new u(f,e,n.text)))}))}({inbandTextTracks:this.inbandTextTracks_,captionArray:n.fmp4Captions,timestampOffset:0}),this.captionParser_.clearParsedCaptions());this.handleSegment_()}},{key:"handleSegment_",value:function(){var nt=this,v,u,r,o,f,s,y,p,e,h,w,c,b,k,d,l,a,g;if(this.pendingSegment_){var n=this.pendingSegment_,t=n.segment,i=this.syncController_.probeSegmentInfo(n);if("undefined"==typeof this.startingMedia_&&i&&(i.containsAudio||i.containsVideo)&&(this.startingMedia_={containsAudio:i.containsAudio,containsVideo:i.containsVideo}),o=(v=this.loaderType_,u=this.startingMedia_,r=i,"main"===v&&u&&r?r.containsAudio||r.containsVideo?u.containsVideo&&!r.containsVideo?"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.":!u.containsVideo&&r.containsVideo?"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:"Neither audio nor video found in segment.":null),o)return this.error({message:o,blacklistDuration:1/0}),void this.trigger("error");if(n.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");null!==n.timestampOffset&&n.timestampOffset!==this.sourceUpdater_.timestampOffset()&&(this.sourceUpdater_.timestampOffset(n.timestampOffset),this.trigger("timestampoffset"));l=this.syncController_.mappingForTimeline(n.timeline);(null!==l&&this.trigger({type:"segmenttimemapping",mapping:l}),this.state="APPENDING",t.map)&&(a=uc(t.map),this.activeInitSegmentId_&&this.activeInitSegmentId_===a||(g=this.initSegment(t.map),this.sourceUpdater_.appendBuffer(g.bytes,function(){nt.activeInitSegmentId_=a})));n.byteLength=n.bytes.byteLength;this.mediaSecondsLoaded+="number"==typeof t.start&&"number"==typeof t.end?t.end-t.start:t.duration;this.logger_((s=(f=n).segment,y=s.start,p=s.end,e=f.playlist,h=e.mediaSequence,w=e.id,c=e.segments,b=void 0===c?[]:c,k=f.mediaIndex,d=f.timeline,["appending ["+k+"] of ["+h+", "+(h+b.length)+"] from playlist ["+w+"]","["+y+" => "+p+"] in timeline ["+d+"]"].join(" ")));this.sourceUpdater_.appendBuffer(n.bytes,this.handleUpdateEnd_.bind(this))}else this.state="READY"}},{key:"handleUpdateEnd_",value:function(){if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var n=this.pendingSegment_,t=n.segment,i=null!==this.mediaIndex;(this.pendingSegment_=null,this.recordThroughput_(n),this.addSegmentMetadataCue_(n),this.state="READY",this.mediaIndex=n.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=n.timeline,this.trigger("syncinfoupdate"),t.end&&this.currentTime_()-t.end>3*n.playlist.targetDuration)?this.resetEverything():(i&&this.trigger("bandwidthupdate"),this.trigger("progress"),set(n.playlist,this.mediaSource_,n.mediaIndex+1)&&this.endOfStream(),this.paused()||this.monitorBuffer_())}},{key:"recordThroughput_",value:function(n){var t=this.throughput.rate,i=Date.now()-n.endOfAllRequests+1,r=Math.floor(n.byteLength/i*8e3);this.throughput.rate+=(r-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(n){if(this.segmentMetadataTrack_){var u=n.segment,i=u.start,r=u.end;if(het(i)&&het(r)){of(i,r,this.segmentMetadataTrack_);var o=t.WebKitDataCue||t.VTTCue,f={bandwidth:n.playlist.attributes.BANDWIDTH,resolution:n.playlist.attributes.RESOLUTION,codecs:n.playlist.attributes.CODECS,byteLength:n.byteLength,uri:n.uri,timeline:n.timeline,playlist:n.playlist.uri,start:i,end:r},e=new o(i,r,JSON.stringify(f));e.value=f;this.segmentMetadataTrack_.addCue(e)}}}}]),i}(),cet=function(n){return decodeURIComponent(escape(String.fromCharCode.apply(null,n)))},aet=new Uint8Array("\n\n".split("").map(function(n){return n.charCodeAt(0)})),lpt=function(){function i(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t;return ni(this,i),t=vi(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,n,r)),t.mediaSource_=null,t.subtitlesTrack_=null,t}return di(i,sw),oi(i,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return n.createTimeRanges();var t=this.subtitlesTrack_.cues,i=t[0].startTime,r=t[t.length-1].startTime;return n.createTimeRanges([[i,r]])}},{key:"initSegment",value:function(n){var f=1<arguments.length&&void 0!==arguments[1]&&arguments[1],r,t,u,i;return n?(r=uc(n),t=this.initSegments_[r],f&&!t&&n.bytes&&(u=aet.byteLength+n.bytes.byteLength,i=new Uint8Array(u),i.set(n.bytes),i.set(aet,n.bytes.byteLength),this.initSegments_[r]=t={resolvedUri:n.resolvedUri,byterange:n.byterange,bytes:i}),t||n):null}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(n){return"undefined"==typeof n||(this.subtitlesTrack_=n,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}},{key:"remove",value:function(n,t){of(n,t,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var t=this,n;if(this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_())),n=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_),n=this.skipEmptySegments_(n)){if(null===this.syncController_.timestampOffsetForTimeline(n.timeline))return this.syncController_.one("timestampoffset",function(){t.state="READY";t.paused()||t.monitorBuffer_()}),void(this.state="WAITING_ON_TIMELINE");this.loadSegment_(n)}}},{key:"skipEmptySegments_",value:function(n){for(;n&&n.segment.empty;)n=this.generateSegmentInfo_(n.playlist,n.mediaIndex+1,n.startOfSegment+n.duration,n.isSyncRequest);return n}},{key:"handleSegment_",value:function(){var i=this,n,r,u;if(this.pendingSegment_&&this.subtitlesTrack_){if(this.state="APPENDING",n=this.pendingSegment_,r=n.segment,"function"!=typeof t.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_)return u=function(){i.handleSegment_()},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",u),void this.subtitlesTrack_.tech_.one("vttjserror",function(){i.subtitlesTrack_.tech_.off("vttjsloaded",u);i.error({message:"Error loading vtt.js"});i.state="READY";i.pause();i.trigger("error")});r.requested=!0;try{this.parseVTTCues_(n)}catch(n){return this.error({message:n.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");n.byteLength=n.bytes.byteLength;this.mediaSecondsLoaded+=r.duration;n.cues.length&&this.remove(n.cues[0].endTime,n.cues[n.cues.length-1].endTime);n.cues.forEach(function(n){i.subtitlesTrack_.addCue(n)});this.handleUpdateEnd_()}else this.state="READY"}},{key:"parseVTTCues_",value:function(i){var e=void 0,o=!1,r,u,f;"function"==typeof t.TextDecoder?e=new t.TextDecoder("utf8"):(e=t.WebVTT.StringDecoder(),o=!0);r=new t.WebVTT.Parser(t,t.vttjs,e);(i.cues=[],i.timestampmap={MPEGTS:0,LOCAL:0},r.oncue=i.cues.push.bind(i.cues),r.ontimestampmap=function(n){return i.timestampmap=n},r.onparsingerror=function(t){n.log.warn("Error encountered when parsing cues: "+t.message)},i.segment.map)&&(u=i.segment.map.bytes,o&&(u=cet(u)),r.parse(u));f=i.bytes;o&&(f=cet(f));r.parse(f);r.flush()}},{key:"updateTimeMapping_",value:function(n,t,i){var f=n.segment,r,u,e,o;t&&(n.cues.length?(r=n.timestampmap,u=r.MPEGTS/9e4-r.LOCAL+t.mapping,(n.cues.forEach(function(n){n.startTime+=u;n.endTime+=u}),i.syncInfo)||(e=n.cues[0].startTime,o=n.cues[n.cues.length-1].startTime,i.syncInfo={mediaSequence:i.mediaSequence+n.mediaIndex,time:Math.min(e,o-f.duration)})):f.empty=!0)}}]),i}(),apt=function(n,t){for(var r,u=n.cues,i=0;i<u.length;i++)if(r=u[i],t>=r.adStartTime&&t<=r.adEndTime)return r;return null},vpt=ryt,vet=[{name:"VOD",run:function(n,t,i){return i!==1/0?{time:0,segmentIndex:0}:null}},{name:"ProgramDateTime",run:function(n,t,i,r,u){var f,o,s,h;if(!n.datetimeToDisplayTime)return null;var c=t.segments||[],l=null,e=null;for(u=u||0,f=0;f<c.length;f++)if(o=c[f],o.dateTimeObject){if(s=o.dateTimeObject.getTime()/1e3+n.datetimeToDisplayTime,h=Math.abs(u-s),null!==e&&e<h)break;e=h;l={time:s,segmentIndex:f}}return l}},{name:"Segment",run:function(n,t,i,r,u){var c=t.segments||[],h=null,f=null,e,o,s;for(u=u||0,e=0;e<c.length;e++)if(o=c[e],o.timeline===r&&"undefined"!=typeof o.start){if(s=Math.abs(u-o.start),null!==f&&f<s)break;(!h||null===f||s<=f)&&(f=s,h={time:o.start,segmentIndex:e})}return h}},{name:"Discontinuity",run:function(n,t,i,r,u){var s=null,f,e,o;if(u=u||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(f=null,e=0;e<t.discontinuityStarts.length;e++){var c=t.discontinuityStarts[e],l=t.discontinuitySequence+e+1,h=n.discontinuities[l];if(h){if(o=Math.abs(u-h.time),null!==f&&f<o)break;(!s||null===f||o<=f)&&(f=o,s={time:h.time,segmentIndex:c})}}return s}},{name:"Playlist",run:function(n,t){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence}:null}}],ypt=function(){function t(){ni(this,t);var n=vi(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.inspectCache_=void 0,n.timelines=[],n.discontinuities=[],n.datetimeToDisplayTime=null,n.logger_=fo("SyncController"),n}return di(t,n.EventTarget),oi(t,[{key:"getSyncPoint",value:function(n,t,i,r){var u=this.runStrategies_(n,t,i,r);return u.length?this.selectSyncPoint_(u,{key:"time",value:r}):null}},{key:"getExpiredTime",value:function(n,t){var r,i;return!n||!n.segments?null:(r=this.runStrategies_(n,t,n.discontinuitySequence,0),!r.length)?null:(i=this.selectSyncPoint_(r,{key:"segmentIndex",value:0}),0<i.segmentIndex&&(i.time*=-1),Math.abs(i.time+to(n,i.segmentIndex,0)))}},{key:"runStrategies_",value:function(n,t,i,r){for(var f,e,o=[],u=0;u<vet.length;u++)f=vet[u],e=f.run(this,n,t,i,r),e&&(e.strategy=f.name,o.push({strategy:f.name,syncPoint:e}));return o}},{key:"selectSyncPoint_",value:function(n,t){for(var u,r=n[0].syncPoint,f=Math.abs(n[0].syncPoint[t.key]-t.value),e=n[0].strategy,i=1;i<n.length;i++)u=Math.abs(n[i].syncPoint[t.key]-t.value),u<f&&(f=u,r=n[i].syncPoint,e=n[i].strategy);return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+e+"]: [time:"+r.time+", segmentIndex:"+r.segmentIndex+"]"),r}},{key:"saveExpiredSegmentInfo",value:function(n,t){for(var r,i=t.mediaSequence-n.mediaSequence-1;0<=i;i--)if(r=n.segments[i],r&&"undefined"!=typeof r.start){t.syncInfo={mediaSequence:n.mediaSequence+i,time:r.start};this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]");this.trigger("syncinfoupdate");break}}},{key:"setDateTimeMapping",value:function(n){if(!this.datetimeToDisplayTime&&n.segments&&n.segments.length&&n.segments[0].dateTimeObject){var t=n.segments[0].dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-t}}},{key:"reset",value:function(){this.inspectCache_=void 0}},{key:"probeSegmentInfo",value:function(n){var r=n.segment,t=n.playlist,i=void 0;return(i=r.map?this.probeMp4Segment_(n):this.probeTsSegment_(n))&&this.calculateSegmentTimeMapping_(n,i)&&(this.saveDiscontinuitySyncInfo_(n),t.syncInfo||(t.syncInfo={mediaSequence:t.mediaSequence+n.mediaIndex,time:r.start})),i}},{key:"probeMp4Segment_",value:function(n){var i=n.segment,r=fi.timescale(i.map.bytes),t=fi.startTime(r,n.bytes);return null!==n.timestampOffset&&(n.timestampOffset-=t),{start:t,end:t+i.duration}}},{key:"probeTsSegment_",value:function(n){var t=vpt(n.bytes,this.inspectCache_),i=void 0,r=void 0;return t?(t.video&&2===t.video.length?(this.inspectCache_=t.video[1].dts,i=t.video[0].dtsTime,r=t.video[1].dtsTime):t.audio&&2===t.audio.length&&(this.inspectCache_=t.audio[1].dts,i=t.audio[0].dtsTime,r=t.audio[1].dtsTime),{start:i,end:r,containsVideo:t.video&&2===t.video.length,containsAudio:t.audio&&2===t.audio.length}):null}},{key:"timestampOffsetForTimeline",value:function(n){return"undefined"==typeof this.timelines[n]?null:this.timelines[n].time}},{key:"mappingForTimeline",value:function(n){return"undefined"==typeof this.timelines[n]?null:this.timelines[n].mapping}},{key:"calculateSegmentTimeMapping_",value:function(n,t){var r=n.segment,i=this.timelines[n.timeline];if(null!==n.timestampOffset)i={time:n.startOfSegment,mapping:n.startOfSegment-t.start},this.timelines[n.timeline]=i,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+n.timeline+": [time: "+i.time+"] [mapping: "+i.mapping+"]"),r.start=n.startOfSegment,r.end=t.end+i.mapping;else{if(!i)return!1;r.start=t.start+i.mapping;r.end=t.end+i.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(n){var t=n.playlist,i=n.segment,r,e;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(r=0;r<t.discontinuityStarts.length;r++){var u=t.discontinuityStarts[r],f=t.discontinuitySequence+r+1,o=u-n.mediaIndex,s=Math.abs(o);(!this.discontinuities[f]||this.discontinuities[f].accuracy>s)&&(e=void 0,e=o<0?i.start-to(t,n.mediaIndex,u):i.end+to(t,n.mediaIndex+1,u),this.discontinuities[f]={time:e,accuracy:s})}}}]),t}(),ppt=new pft("./decrypter-worker.worker.js",function(){var i,u,f,e,n,o,r,s,t,h,c=this;i=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");};u=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();f=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":d(t))&&"function"!=typeof t?n:t};e=function(){for(var h=[[[],[],[],[],[]],[[],[],[],[],[]]],f=h[0],e=h[1],l=f[4],y=e[4],n=void 0,i=void 0,t=void 0,u=[],a=[],c=void 0,v=void 0,r=void 0,o=void 0,s=void 0,n=0;n<256;n++)a[(u[n]=n<<1^283*(n>>7))^n]=n;for(i=t=0;!l[i];i^=c||1,t=a[t]||1)for(r=(r=t^t<<1^t<<2^t<<3^t<<4)>>8^255&r^99,s=16843009*u[v=u[c=u[y[l[i]=r]=i]]]^65537*v^257*c^16843008*i,o=257*u[r]^16843008*r,n=0;n<4;n++)f[n][i]=o=o<<24^o>>>8,e[n][r]=s=s<<24^s>>>8;for(n=0;n<5;n++)f[n]=f[n].slice(0),e[n]=e[n].slice(0);return h};n=null;o=function(){function t(r){i(this,t);n||(n=e());this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];var f=void 0,c=void 0,u=void 0,h=void 0,v=void 0,s=this._tables[0][4],l=this._tables[1],o=r.length,a=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");for(h=r.slice(0),v=[],this._key=[h,v],f=o;f<4*o+28;f++)u=h[f-1],(f%o==0||8===o&&f%o==4)&&(u=s[u>>>24]<<24^s[u>>16&255]<<16^s[u>>8&255]<<8^s[255&u],f%o==0&&(u=u<<8^u>>>24^a<<24,a=a<<1^283*(a>>7))),h[f]=h[f-o]^u;for(c=0;f;c++,f--)u=h[3&c?f:f-4],v[c]=f<=4||c<4?u:l[0][s[u>>>24]]^l[1][s[u>>16&255]]^l[2][s[u>>8&255]]^l[3][s[255&u]]}return t.prototype.decrypt=function(n,t,i,r,u,f){for(var e=this._key[1],o=n^e[0],s=r^e[1],h=i^e[2],c=t^e[3],y=void 0,g=void 0,nt=void 0,tt=e.length/4-2,l=void 0,a=4,v=this._tables[1],p=v[0],w=v[1],b=v[2],k=v[3],d=v[4],l=0;l<tt;l++)y=p[o>>>24]^w[s>>16&255]^b[h>>8&255]^k[255&c]^e[a],g=p[s>>>24]^w[h>>16&255]^b[c>>8&255]^k[255&o]^e[a+1],nt=p[h>>>24]^w[c>>16&255]^b[o>>8&255]^k[255&s]^e[a+2],c=p[c>>>24]^w[o>>16&255]^b[s>>8&255]^k[255&h]^e[a+3],a+=4,o=y,s=g,h=nt;for(l=0;l<4;l++)u[(3&-l)+f]=d[o>>>24]<<24^d[s>>16&255]<<16^d[h>>8&255]<<8^d[255&c]^e[a++],y=o,o=s,s=h,h=c,c=y},t}();r=function(){function n(){i(this,n);this.listeners={}}return n.prototype.on=function(n,t){this.listeners[n]||(this.listeners[n]=[]);this.listeners[n].push(t)},n.prototype.off=function(n,t){if(!this.listeners[n])return!1;var i=this.listeners[n].indexOf(t);return this.listeners[n].splice(i,1),-1<i},n.prototype.trigger=function(n){var t=this.listeners[n],u,i;if(t)if(2===arguments.length)for(u=t.length,i=0;i<u;++i)t[i].call(this,arguments[1]);else for(var f=Array.prototype.slice.call(arguments,1),e=t.length,r=0;r<e;++r)t[r].apply(this,f)},n.prototype.dispose=function(){this.listeners={}},n.prototype.pipe=function(n){this.on("data",function(t){n.push(t)})},n}();s=function(n){function t(){i(this,t);var u=f(this,n.call(this,r));return u.jobs=[],u.delay=1,u.timeout_=null,u}return function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":d(t)));n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)}(t,n),t.prototype.processJob_=function(){this.jobs.shift()();this.timeout_=this.jobs.length?setTimeout(this.processJob_.bind(this),this.delay):null},t.prototype.push=function(n){this.jobs.push(n);this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(r);t=function(n){return n<<24|(65280&n)<<8|(16711680&n)>>8|n>>>24};h=function(){function n(r,u,f,e){i(this,n);var c=n.STEP,h=new Int32Array(r.buffer),l=new Uint8Array(r.byteLength),o=0;for(this.asyncStream_=new s,this.asyncStream_.push(this.decryptChunk_(h.subarray(o,o+c),u,f,l)),o=c;o<h.length;o+=c)f=new Uint32Array([t(h[o-4]),t(h[o-3]),t(h[o-2]),t(h[o-1])]),this.asyncStream_.push(this.decryptChunk_(h.subarray(o,o+c),u,f,l));this.asyncStream_.push(function(){var n;e(null,(n=l).subarray(0,n.byteLength-n[n.byteLength-1]))})}return n.prototype.decryptChunk_=function(n,i,r,u){return function(){var f=function(n,i,r){var e=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>2),b=new o(Array.prototype.slice.call(i)),w=new Uint8Array(n.byteLength),f=new Int32Array(w.buffer),s=void 0,h=void 0,c=void 0,l=void 0,a=void 0,v=void 0,y=void 0,p=void 0,u=void 0;for(s=r[0],h=r[1],c=r[2],l=r[3],u=0;u<e.length;u+=4)a=t(e[u]),v=t(e[u+1]),y=t(e[u+2]),p=t(e[u+3]),b.decrypt(a,v,y,p,f,u),f[u]=t(f[u]^s),f[u+1]=t(f[u+1]^h),f[u+2]=t(f[u+2]^c),f[u+3]=t(f[u+3]^l),s=a,h=v,c=y,l=p;return w}(n,i,r);u.set(f,n.byteOffset)}},u(n,null,[{key:"STEP",get:function(){return 32e3}}]),n}(),new function(n){n.onmessage=function(t){var i=t.data,r=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),u=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),f=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new h(r,u,f,function(t,r){var f,u;n.postMessage((f={source:i.source,decrypted:r},u={},Object.keys(f).forEach(function(n){var t=f[n];u[n]=ArrayBuffer.isView(t)?{bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:t}),u),[r.buffer])})}}(c)}),ec=function(n,t){n.abort();n.pause();t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},yet=function(n,t){(t.activePlaylistLoader=n).load()},oc={AUDIO:function(t,i){return function(){var o=i.segmentLoaders[t],r=i.mediaTypes[t],s=i.blacklistCurrentPlaylist,u;ec(o,r);var h=r.activeTrack(),f=r.activeGroup(),c=(f.filter(function(n){return n.default})[0]||f[0]).id,e=r.tracks[c];if(h!==e){for(u in n.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),r.tracks)r.tracks[u].enabled=r.tracks[u]===e;r.onTrackChanged()}else s({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(t,i){return function(){var f=i.segmentLoaders[t],r=i.mediaTypes[t],u;n.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");ec(f,r);u=r.activeTrack();u&&(u.mode="disabled");r.onTrackChanged()}}},pet={AUDIO:function(n,t,i){if(t){var u=i.tech,f=i.requestOptions,r=i.segmentLoaders[n];t.on("loadedmetadata",function(){var n=t.media();r.playlist(n,f);(!u.paused()||n.endList&&"none"!==u.preload())&&r.load()});t.on("loadedplaylist",function(){r.playlist(t.media(),f);u.paused()||r.load()});t.on("error",oc[n](n,i))}},SUBTITLES:function(n,t,i){var u=i.tech,f=i.requestOptions,r=i.segmentLoaders[n],e=i.mediaTypes[n];t.on("loadedmetadata",function(){var n=t.media();r.playlist(n,f);r.track(e.activeTrack());(!u.paused()||n.endList&&"none"!==u.preload())&&r.load()});t.on("loadedplaylist",function(){r.playlist(t.media(),f);u.paused()||r.load()});t.on("error",oc[n](n,i))}},wpt=function(n,t){return function(i){return i.attributes[n]===t}},bpt=function(n){return function(t){return t.resolvedUri===n}},kpt={AUDIO:function(t,i){var o,s,l=i.hls,k=i.sourceType,d=i.segmentLoaders[t],a=i.requestOptions.withCredentials,v=i.master,e=v.mediaGroups,g=v.playlists,y=i.mediaTypes[t],h=y.groups,p=y.tracks,nt=i.masterPlaylistLoader,u,w,f,r,c,b;for(u in e[t]&&0!==Object.keys(e[t]).length||(e[t]={main:{"default":{"default":!0}}}),e[t]){h[u]||(h[u]=[]);w=g.filter(wpt(t,u));for(f in e[t][u])r=e[t][u][f],w.filter(bpt(r.resolvedUri)).length&&delete r.resolvedUri,c=void 0,(c=r.resolvedUri?new ic(r.resolvedUri,l,a):r.playlists&&"dash"===k?new fw(r.playlists[0],l,a,nt):null,r=n.mergeOptions({id:f,playlistLoader:c},r),pet[t](t,r.playlistLoader,i),h[u].push(r),"undefined"==typeof p[f])&&(b=new n.AudioTrack({id:f,kind:(o=r,s=void 0,s=o.default?"main":"alternative",o.characteristics&&0<=o.characteristics.indexOf("public.accessibility.describes-video")&&(s="main-desc"),s),enabled:!1,language:r.language,"default":r.default,label:f}),p[f]=b)}d.on("error",oc[t](t,i))},SUBTITLES:function(t,i){var p=i.tech,h=i.hls,c=i.sourceType,w=i.segmentLoaders[t],l=i.requestOptions.withCredentials,e=i.master.mediaGroups,a=i.mediaTypes[t],s=a.groups,v=a.tracks,b=i.masterPlaylistLoader,f,r,u,o,y;for(f in e[t])for(r in s[f]||(s[f]=[]),e[t][f])e[t][f][r].forced||(u=e[t][f][r],o=void 0,("hls"===c?o=new ic(u.resolvedUri,h,l):"dash"===c&&(o=new fw(u.playlists[0],h,l,b)),u=n.mergeOptions({id:r,playlistLoader:o},u),pet[t](t,u.playlistLoader,i),s[f].push(u),"undefined"==typeof v[r])&&(y=p.addRemoteTextTrack({id:r,kind:"subtitles",enabled:!1,language:u.language,label:r},!1).track,v[r]=y));w.on("error",oc[t](t,i))},"CLOSED-CAPTIONS":function(t,i){var l=i.tech,e=i.master.mediaGroups,s=i.mediaTypes[t],o=s.groups,h=s.tracks,r,u,f,c;for(r in e[t])for(u in o[r]||(o[r]=[]),e[t][r])f=e[t][r][u],f.instreamId.match(/CC\d/)&&(o[r].push(n.mergeOptions({id:u},f)),"undefined"==typeof h[u])&&(c=l.addRemoteTextTrack({id:f.instreamId,kind:"captions",enabled:!1,language:f.language,label:u},!1).track,h[u]=c)}},dpt={AUDIO:function(n,t){return function(){var i=t.mediaTypes[n].tracks;for(var r in i)if(i[r].enabled)return i[r];return null}},SUBTITLES:function(n,t){return function(){var i=t.mediaTypes[n].tracks;for(var r in i)if("showing"===i[r].mode)return i[r];return null}}},gpt=function(n){var r,f,u,e;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){kpt[t](t,n)});var t=n.mediaTypes,o=n.masterPlaylistLoader,i=n.tech,s=n.hls;["AUDIO","SUBTITLES"].forEach(function(i){var r,u,f,e,o,s;t[i].activeGroup=(r=i,u=n,function(n){var e=u.masterPlaylistLoader,f=u.mediaTypes[r].groups,i=e.media(),t;return i?(t=null,i.attributes[r]&&(t=f[i.attributes[r]]),t=t||f.main,"undefined"==typeof n?t:null===n?null:t.filter(function(t){return t.id===n.id})[0]||null):null});t[i].activeTrack=dpt[i](i,n);t[i].onGroupChanged=(f=i,e=n,function(){var i=e.segmentLoaders,r=i[f],u=i.main,n=e.mediaTypes[f],o=n.activeTrack(),t=n.activeGroup(o),s=n.activePlaylistLoader;ec(r,n);t&&(t.playlistLoader?(r.resyncLoader(),yet(t.playlistLoader,n)):s&&u.resetEverything())});t[i].onTrackChanged=(o=i,s=n,function(){var r=s.segmentLoaders,t=r[o],f=r.main,n=s.mediaTypes[o],u=n.activeTrack(),i=n.activeGroup(u),e=n.activePlaylistLoader;ec(t,n);i&&(i.playlistLoader?(e!==i.playlistLoader&&(t.track&&t.track(u),t.resetEverything()),yet(i.playlistLoader,n)):f.resetEverything())})});r=t.AUDIO.activeGroup();f=(r.filter(function(n){return n.default})[0]||r[0]).id;t.AUDIO.tracks[f].enabled=!0;t.AUDIO.onTrackChanged();o.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(n){return t[n].onGroupChanged()})});u=function(){t.AUDIO.onTrackChanged();i.trigger({type:"usage",name:"hls-audio-change"})};for(e in i.audioTracks().addEventListener("change",u),i.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),s.on("dispose",function(){i.audioTracks().removeEventListener("change",u);i.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),i.clearTracks("audio"),t.AUDIO.tracks)i.audioTracks().addTrack(t.AUDIO.tracks[e])},nwt=function(){var n={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){n[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:eo,activeTrack:eo,onGroupChanged:eo,onTrackChanged:eo}}),n},lr=void 0,twt=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],iwt=function(n){return this.audioSegmentLoader_[n]+this.mainSegmentLoader_[n]},rwt=function(){function i(t){var u;ni(this,i);var r=vi(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),f=t.url,o=t.withCredentials,e=t.tech,s=t.bandwidth,h=t.externHls,c=t.useCueTags,l=t.blacklistDuration,a=t.enableLowInitialPlaylist,v=t.sourceType,y=t.seekTo;if(!f)throw new Error("A non-empty playlist URL is required");return lr=h,r.withCredentials=o,r.tech_=e,r.hls_=e.hls,r.seekTo_=y,r.sourceType_=v,r.useCueTags_=c,r.blacklistDuration=l,r.enableLowInitialPlaylist=a,r.useCueTags_&&(r.cueTagsTrack_=r.tech_.addTextTrack("metadata","ad-cues"),r.cueTagsTrack_.inBandMetadataTrackDispatchType=""),r.requestOptions_={withCredentials:r.withCredentials,timeout:null},r.mediaTypes_=nwt(),r.mediaSource=new n.MediaSource,r.mediaSource.addEventListener("sourceopen",r.handleSourceOpen_.bind(r)),r.seekable_=n.createTimeRanges(),r.hasPlayed_=function(){return!1},r.syncController_=new ypt(t),r.segmentMetadataTrack_=e.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,r.decrypter_=new ppt,r.inbandTextTracks_={},u={hls:r.hls_,mediaSource:r.mediaSource,currentTime:r.tech_.currentTime.bind(r.tech_),seekable:function(){return r.seekable()},seeking:function(){return r.tech_.seeking()},duration:function(){return r.mediaSource.duration},hasPlayed:function(){return r.hasPlayed_()},goalBufferLength:function(){return r.goalBufferLength()},bandwidth:s,syncController:r.syncController_,decrypter:r.decrypter_,sourceType:r.sourceType_,inbandTextTracks:r.inbandTextTracks_},r.masterPlaylistLoader_="dash"===r.sourceType_?new fw(f,r.hls_,r.withCredentials):new ic(f,r.hls_,r.withCredentials),r.setupMasterPlaylistLoaderListeners_(),r.mainSegmentLoader_=new sw(n.mergeOptions(u,{segmentMetadataTrack:r.segmentMetadataTrack_,loaderType:"main"}),t),r.audioSegmentLoader_=new sw(n.mergeOptions(u,{loaderType:"audio"}),t),r.subtitleSegmentLoader_=new lpt(n.mergeOptions(u,{loaderType:"vtt"}),t),r.setupSegmentLoaderListeners_(),twt.forEach(function(n){r[n+"_"]=iwt.bind(r,n)}),r.logger_=fo("MPC"),r.masterPlaylistLoader_.load(),r}return di(i,n.EventTarget),oi(i,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var t=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var i=t.masterPlaylistLoader_.media(),r=1.5*t.masterPlaylistLoader_.targetDuration*1e3;t.requestOptions_.timeout=wp(t.masterPlaylistLoader_.master,t.masterPlaylistLoader_.media())?0:r;i.endList&&"none"!==t.tech_.preload()&&(t.mainSegmentLoader_.playlist(i,t.requestOptions_),t.mainSegmentLoader_.load());gpt({sourceType:t.sourceType_,segmentLoaders:{AUDIO:t.audioSegmentLoader_,SUBTITLES:t.subtitleSegmentLoader_,main:t.mainSegmentLoader_},tech:t.tech_,requestOptions:t.requestOptions_,masterPlaylistLoader:t.masterPlaylistLoader_,hls:t.hls_,master:t.master(),mediaTypes:t.mediaTypes_,blacklistCurrentPlaylist:t.blacklistCurrentPlaylist.bind(t)});t.triggerPresenceUsage_(t.master(),i);try{t.setupSourceBuffers_()}catch(i){return n.log.warn("Failed to create SourceBuffers",i),t.mediaSource.endOfStream("decode")}t.setupFirstPlay();t.trigger("selectedinitialmedia")});this.masterPlaylistLoader_.on("loadedplaylist",function(){var n=t.masterPlaylistLoader_.media(),i,r;if(!n)return t.excludeUnsupportedVariants_(),i=void 0,t.enableLowInitialPlaylist&&(i=t.selectInitialPlaylist()),i||(i=t.selectPlaylist()),t.initialMedia_=i,void t.masterPlaylistLoader_.media(t.initialMedia_);if(t.useCueTags_&&t.updateAdCues_(n),t.mainSegmentLoader_.playlist(n,t.requestOptions_),t.updateDuration(),t.tech_.paused()||(t.mainSegmentLoader_.load(),t.audioSegmentLoader_&&t.audioSegmentLoader_.load()),!n.endList)if(r=function(){var n=t.seekable();0!==n.length&&t.mediaSource.addSeekableRange_(n.start(0),n.end(0))},t.duration()!==1/0)t.tech_.one("durationchange",function n(){t.duration()===1/0?r():t.tech_.one("durationchange",n)});else r()});this.masterPlaylistLoader_.on("error",function(){t.blacklistCurrentPlaylist(t.masterPlaylistLoader_.error)});this.masterPlaylistLoader_.on("mediachanging",function(){t.mainSegmentLoader_.abort();t.mainSegmentLoader_.pause()});this.masterPlaylistLoader_.on("mediachange",function(){var n=t.masterPlaylistLoader_.media(),i=1.5*t.masterPlaylistLoader_.targetDuration*1e3;t.requestOptions_.timeout=wp(t.masterPlaylistLoader_.master,t.masterPlaylistLoader_.media())?0:i;t.mainSegmentLoader_.playlist(n,t.requestOptions_);t.mainSegmentLoader_.load();t.tech_.trigger({type:"mediachange",bubbles:!0})});this.masterPlaylistLoader_.on("playlistunchanged",function(){var n=t.masterPlaylistLoader_.media();t.stuckAtPlaylistEnd_(n)&&(t.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),t.tech_.trigger("playliststuck"))});this.masterPlaylistLoader_.on("renditiondisabled",function(){t.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})});this.masterPlaylistLoader_.on("renditionenabled",function(){t.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})}},{key:"triggerPresenceUsage_",value:function(n,t){var i=n.mediaGroups||{},u=!0,f=Object.keys(i.AUDIO),r,e;for(r in i.AUDIO)for(e in i.AUDIO[r])i.AUDIO[r][e].uri||(u=!1);u&&this.tech_.trigger({type:"usage",name:"hls-demuxed"});Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"});lr.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"hls-aes"});lr.Playlist.isFmp4(t)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"});f.length&&1<Object.keys(i.AUDIO[f[0]]).length&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"});this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var n=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){var i=n.selectPlaylist(),r=n.masterPlaylistLoader_.media(),t=n.tech_.buffered(),u=t.length?t.end(t.length-1)-n.tech_.currentTime():0,f=n.bufferLowWaterLine();(!r.endList||n.duration()<si.MAX_BUFFER_LOW_WATER_LINE||i.attributes.BANDWIDTH<r.attributes.BANDWIDTH||f<=u)&&n.masterPlaylistLoader_.media(i);n.tech_.trigger("bandwidthupdate")});this.mainSegmentLoader_.on("progress",function(){n.trigger("progress")});this.mainSegmentLoader_.on("error",function(){n.blacklistCurrentPlaylist(n.mainSegmentLoader_.error())});this.mainSegmentLoader_.on("syncinfoupdate",function(){n.onSyncInfoUpdate_()});this.mainSegmentLoader_.on("timestampoffset",function(){n.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})});this.audioSegmentLoader_.on("syncinfoupdate",function(){n.onSyncInfoUpdate_()});this.mainSegmentLoader_.on("ended",function(){n.onEndOfStream()});this.mainSegmentLoader_.on("earlyabort",function(){n.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)});this.mainSegmentLoader_.on("reseteverything",function(){n.tech_.trigger("hls-reset")});this.mainSegmentLoader_.on("segmenttimemapping",function(t){n.tech_.trigger({type:"hls-segment-time-mapping",mapping:t.mapping})});this.audioSegmentLoader_.on("ended",function(){n.onEndOfStream()})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load();this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load();this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}},{key:"smoothQualityChange_",value:function(){var n=this.selectPlaylist();n!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(n),this.mainSegmentLoader_.resetLoader())}},{key:"fastQualityChange_",value:function(){var t=this,i=this.selectPlaylist();i!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(i),this.mainSegmentLoader_.resetEverything(function(){n.browser.IE_VERSION||n.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.seekTo_(0);this.hasPlayed_()&&this.load();var n=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<n.start(0)?this.seekTo_(n.end(n.length-1)):void 0}}},{key:"setupFirstPlay",value:function(){var i=this,r=this.masterPlaylistLoader_.media(),t;if(!r||this.tech_.paused()||this.hasPlayed_())return!1;if(!r.endList){if(t=this.seekable(),!t.length)return!1;if(n.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",function(){i.trigger("firstplay");i.seekTo_(t.end(0));i.hasPlayed_=function(){return!0}}),!1;this.trigger("firstplay");this.seekTo_(t.end(0))}return this.hasPlayed_=function(){return!0},this.load(),!0}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(t){return n.log.warn("Failed to create Source Buffers",t),this.mediaSource.endOfStream("decode")}if(this.tech_.autoplay()){var t=this.tech_.play();"undefined"!=typeof t&&"function"==typeof t.then&&t.then(null,function(){})}this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var n=this.mainSegmentLoader_.ended_;this.mediaTypes_.AUDIO.activePlaylistLoader&&(n=!this.mainSegmentLoader_.startingMedia_||this.mainSegmentLoader_.startingMedia_.containsVideo?n&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_);n&&this.mediaSource.endOfStream()}},{key:"stuckAtPlaylistEnd_",value:function(n){var t,r;if(!this.seekable().length||(t=this.syncController_.getExpiredTime(n,this.mediaSource.duration),null===t))return!1;var u=lr.Playlist.playlistEnd(n,t),f=this.tech_.currentTime(),i=this.tech_.buffered();return i.length?(r=i.end(i.length-1),r-f<=.1&&u-r<=.1):u-f<=.1}},{key:"blacklistCurrentPlaylist",value:function(){var f,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=arguments[1],r=void 0,u;if(r=t.playlist||this.masterPlaylistLoader_.media(),i=i||t.blacklistDuration||this.blacklistDuration,!r){this.error=t;try{return this.mediaSource.endOfStream("network")}catch(f){return this.trigger("error")}}return u=1===this.masterPlaylistLoader_.master.playlists.filter(rc).length,u?(n.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the final playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(u)):(r.excludeUntil=Date.now()+1e3*i,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),f=this.selectPlaylist(),n.log.warn("Problem encountered with the current HLS playlist."+(t.message?" "+t.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(f))}},{key:"pauseLoading",value:function(){this.mainSegmentLoader_.pause();this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause();this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}},{key:"setCurrentTime",value:function(n){var t=lft(this.tech_.buffered(),n);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?n:(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()),void this.load()):0}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:lr.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var t=void 0,i=void 0,r,u;if(this.masterPlaylistLoader_&&(r=this.masterPlaylistLoader_.media(),r&&(u=this.syncController_.getExpiredTime(r,this.mediaSource.duration),null!==u&&0!==(t=lr.Playlist.seekable(r,u)).length))){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(r=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(u=this.syncController_.getExpiredTime(r,this.mediaSource.duration)))return;if(0===(i=lr.Playlist.seekable(r,u)).length)return}this.seekable_=i?i.start(0)>t.end(0)||t.start(0)>i.end(0)?t:n.createTimeRanges([[i.start(0)>t.start(0)?i.start(0):t.start(0),i.end(0)<t.end(0)?i.end(0):t.end(0)]]):t;this.logger_("seekable updated ["+bp(this.seekable_)+"]");this.tech_.trigger("seekablechanged")}}},{key:"updateDuration",value:function(){var t=this,r=this.mediaSource.duration,n=lr.Playlist.duration(this.masterPlaylistLoader_.media()),i=this.tech_.buffered(),u=function r(){t.mediaSource.duration=n;t.tech_.trigger("durationchange");t.mediaSource.removeEventListener("sourceopen",r)};0<i.length&&(n=Math.max(n,i.end(i.length-1)));r!==n&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",u):u())}},{key:"dispose",value:function(){var n=this;this.decrypter_.terminate();this.masterPlaylistLoader_.dispose();this.mainSegmentLoader_.dispose();["AUDIO","SUBTITLES"].forEach(function(t){var i=n.mediaTypes_[t].groups;for(var r in i)i[r].forEach(function(n){n.playlistLoader&&n.playlistLoader.dispose()})});this.audioSegmentLoader_.dispose();this.subtitleSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var t,n=this.masterPlaylistLoader_.media();if(n&&"open"===this.mediaSource.readyState){if((t=ipt(this.masterPlaylistLoader_.master,n)).length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+n.resolvedUri,this.mediaSource.endOfStream("decode");this.configureLoaderMimeTypes_(t);this.excludeIncompatibleVariants_(n)}}},{key:"configureLoaderMimeTypes_",value:function(t){var i=1<t.length&&-1===t[0].indexOf(",")&&t[0]!==t[1]?new n.EventTarget:null;this.mainSegmentLoader_.mimeType(t[0],i);t[1]&&this.audioSegmentLoader_.mimeType(t[1],i)}},{key:"excludeUnsupportedVariants_",value:function(){this.master().playlists.forEach(function(n){n.attributes.CODECS&&t.MediaSource&&t.MediaSource.isTypeSupported&&!t.MediaSource.isTypeSupported('video/mp4; codecs="'+n.attributes.CODECS.replace(/avc1\.(\d+)\.(\d+)/i,function(n){return kft([n])[0]})+'"')&&(n.excludeUntil=1/0)})}},{key:"excludeIncompatibleVariants_",value:function(n){var i=2,r=null,t=void 0;n.attributes.CODECS&&(t=ro(n.attributes.CODECS),r=t.videoCodec,i=t.codecCount);this.master().playlists.forEach(function(n){var t={codecCount:2,videoCodec:null};n.attributes.CODECS&&(t=ro(n.attributes.CODECS));t.codecCount!==i&&(n.excludeUntil=1/0);t.videoCodec!==r&&(n.excludeUntil=1/0)})}},{key:"updateAdCues_",value:function(n){var i=0,r=this.seekable();r.length&&(i=r.start(0)),function(n,i){var l=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,f,s,h,c,o;if(n.segments)for(var u=l,r=void 0,e=0;e<n.segments.length;e++){if(f=n.segments[e],r||(r=apt(i,u+f.duration/2)),r){if("cueIn"in f){r.endTime=u;r.adEndTime=u;u+=f.duration;r=null;continue}if(u<r.endTime){u+=f.duration;continue}r.endTime+=f.duration}else("cueOut"in f&&((r=new t.VTTCue(u,u+f.duration,f.cueOut)).adStartTime=u,r.adEndTime=u+parseFloat(f.cueOut),i.addCue(r)),"cueOutCont"in f)&&(c=f.cueOutCont.split("/").map(parseFloat),o=hyt(c,2),s=o[0],h=o[1],(r=new t.VTTCue(u,u+f.duration,"")).adStartTime=u-s,r.adEndTime=r.adStartTime+h,i.addCue(r));u+=f.duration}}(n,this.cueTagsTrack_,i)}},{key:"goalBufferLength",value:function(){var t=this.tech_.currentTime(),n=si.GOAL_BUFFER_LENGTH,i=si.GOAL_BUFFER_LENGTH_RATE,r=Math.max(n,si.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+t*i,r)}},{key:"bufferLowWaterLine",value:function(){var t=this.tech_.currentTime(),n=si.BUFFER_LOW_WATER_LINE,i=si.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(n,si.MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+t*i,r)}}]),i}(),uwt=function gi(n,t,i){var r,f,e,o,u;ni(this,gi);o=n.masterPlaylistController_.fastQualityChange_.bind(n.masterPlaylistController_);t.attributes.RESOLUTION&&(u=t.attributes.RESOLUTION,this.width=u.width,this.height=u.height);this.bandwidth=t.attributes.BANDWIDTH;this.id=i;this.enabled=(r=n.playlists,f=t.uri,e=o,function(n){var t=r.master.playlists[f],u=pp(t),i=rc(t);return"undefined"==typeof n?i:(n?delete t.disabled:t.disabled=!0,n===i||u||(e(),n?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),n)})},wet=["seeking","seeked","pause","playing","error"],fwt=function(){function i(n){var r=this;ni(this,i);this.tech_=n.tech;this.seekable=n.seekable;this.seekTo=n.seekTo;this.consecutiveUpdates=0;this.lastRecordedTime=null;this.timer_=null;this.checkCurrentTimeTimeout_=null;this.logger_=fo("PlaybackWatcher");this.logger_("initialize");var u=function(){return r.monitorCurrentTime_()},f=function(){return r.techWaiting_()},e=function(){return r.cancelTimer_()},o=function(){return r.fixesBadSeeks_()};this.tech_.on("seekablechanged",o);this.tech_.on("waiting",f);this.tech_.on(wet,e);this.tech_.on("canplay",u);this.dispose=function(){r.logger_("dispose");r.tech_.off("seekablechanged",o);r.tech_.off("waiting",f);r.tech_.off(wet,e);r.tech_.off("canplay",u);r.checkCurrentTimeTimeout_&&t.clearTimeout(r.checkCurrentTimeTimeout_);r.cancelTimer_()}}return oi(i,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_();this.checkCurrentTimeTimeout_&&t.clearTimeout(this.checkCurrentTimeTimeout_);this.checkCurrentTimeTimeout_=t.setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"checkCurrentTime_",value:function(){if(this.tech_.seeking()&&this.fixesBadSeeks_())return this.consecutiveUpdates=0,void(this.lastRecordedTime=this.tech_.currentTime());if(!this.tech_.paused()&&!this.tech_.seeking()){var n=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===n&&(!t.length||n+.1>=t.end(t.length-1)))return this.techWaiting_();5<=this.consecutiveUpdates&&n===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):n===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=n)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0;this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_));this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var r=this.tech_.seeking(),n=this.seekable(),i=this.tech_.currentTime(),t=void 0;return r&&this.afterSeekableWindow_(n,i)&&(t=n.end(n.length-1)),r&&this.beforeSeekableWindow_(n,i)&&(t=n.start(0)+.1),"undefined"!=typeof t&&(this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+bp(n)+". Seeking to "+t+"."),this.seekTo(t),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var n=this.tech_.currentTime(),i=this.tech_.buffered(),t=lft(i,n);return t.length&&n+3<=t.end(0)?(this.cancelTimer_(),this.seekTo(n),this.logger_("Stopped at "+n+" while inside a buffered region ["+t.start(0)+" -> "+t.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var i=this.seekable(),n=this.tech_.currentTime(),r,u,t,f;return this.tech_.seeking()&&this.fixesBadSeeks_()?!0:this.tech_.seeking()||null!==this.timer_?!0:this.beforeSeekableWindow_(i,n)?(r=i.end(i.length-1),this.logger_("Fell out of live window at time "+n+". Seeking to live point (seekable end) "+r),this.cancelTimer_(),this.seekTo(r),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0):(u=this.tech_.buffered(),t=aft(u,n),this.videoUnderflow_(t,u,n))?(this.cancelTimer_(),this.seekTo(n),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0):0<t.length?(f=t.start(0)-n,this.logger_("Stopped at "+n+", setting timer for "+f+", seeking to "+t.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*f,n),!0):!1}},{key:"afterSeekableWindow_",value:function(n,t){return!!n.length&&t>n.end(n.length-1)+.1}},{key:"beforeSeekableWindow_",value:function(n,t){return!!(n.length&&0<n.start(0)&&t<n.start(0)-.1)}},{key:"videoUnderflow_",value:function(n,t,i){if(0===n.length){var r=this.gapFromVideoUnderflow_(t,i);if(r)return this.logger_("Encountered a gap in video from "+r.start+" to "+r.end+". Seeking to current time "+i),!0}return!1}},{key:"skipTheGap_",value:function(n){var r=this.tech_.buffered(),t=this.tech_.currentTime(),i=aft(r,t);this.cancelTimer_();0!==i.length&&t===n&&(this.logger_("skipTheGap_:","currentTime:",t,"scheduled currentTime:",n,"nextRange start:",i.start(0)),this.seekTo(i.start(0)+io),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(t,i){for(var f,e,u=function(t){var r,i,u,f;if(t.length<2)return n.createTimeRanges();for(r=[],i=1;i<t.length;i++)u=t.end(i-1),f=t.start(i),r.push([u,f]);return n.createTimeRanges(r)}(t),r=0;r<u.length;r++)if(f=u.start(r),e=u.end(r),i-f<4&&2<i-f)return{start:f,end:e};return null}}]),i}(),ewt={errorInterval:30,getSource:function(n){return n(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}},bet=function(t){!function i(t,r){var e=0,f=0,u=n.mergeOptions(ewt,r);t.ready(function(){t.trigger({type:"usage",name:"hls-error-reload-initialized"})});var o=function(){f&&t.currentTime(f)},c=function(n){null!=n&&(f=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",o),t.src(n),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},s=function(){if(Date.now()-e<1e3*u.errorInterval)t.trigger({type:"usage",name:"hls-error-reload-canceled"});else{if(u.getSource&&"function"==typeof u.getSource)return e=Date.now(),u.getSource.call(t,c);n.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},h=function r(){t.off("loadedmetadata",o);t.off("error",s);t.off("dispose",r)};t.on("error",s);t.on("dispose",h);t.reloadSourceOnError=function(n){h();i(t,n)}}(this,t)};n.use("*",function(n){return{setSource:function(n,t){t(null,n)},setCurrentTime:function(t){return n.vhs&&n.currentSource().src===n.vhs.source_.src&&n.vhs.setCurrentTime(t),t},play:function(){n.vhs&&n.currentSource().src===n.vhs.source_.src&&n.vhs.setCurrentTime(n.currentTime())}}});ht={PlaylistLoader:ic,Playlist:wt,Decrypter:syt,AsyncStream:yut,decrypt:put,utils:kyt,STANDARD_PLAYLIST_SELECTOR:function(){return function(n,i,r,u){var f=n.playlists.map(function(n){var i,r;return i=n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width,r=n.attributes.RESOLUTION&&n.attributes.RESOLUTION.height,{bandwidth:n.attributes.BANDWIDTH||t.Number.MAX_VALUE,width:i,height:r,playlist:n}}),e,h,v;oo(f,function(n,t){return n.bandwidth-t.bandwidth});e=(f=f.filter(function(n){return!wt.isIncompatible(n.playlist)})).filter(function(n){return wt.isEnabled(n.playlist)});e.length||(e=f.filter(function(n){return!wt.isDisabled(n.playlist)}));var s=e.filter(function(n){return n.bandwidth*si.BANDWIDTH_VARIANCE<i}),o=s[s.length-1],w=s.filter(function(n){return n.bandwidth===o.bandwidth})[0],l=s.filter(function(n){return n.width&&n.height});oo(l,function(n,t){return n.width-t.width});h=l.filter(function(n){return n.width===r&&n.height===u});o=h[h.length-1];var y=h.filter(function(n){return n.bandwidth===o.bandwidth})[0],a=void 0,c=void 0,p=void 0;return y||(c=(a=l.filter(function(n){return n.width>r||n.height>u})).filter(function(n){return n.width===a[0].width&&n.height===a[0].height}),o=c[c.length-1],p=c.filter(function(n){return n.bandwidth===o.bandwidth})[0]),v=p||y||w||e[0]||f[0],v?v.playlist:null}(this.playlists.master,this.systemBandwidth,parseInt(oet(this.tech_.el(),"width"),10),parseInt(oet(this.tech_.el(),"height"),10))},INITIAL_PLAYLIST_SELECTOR:function(){var n=this.playlists.master.playlists.filter(wt.isEnabled);return oo(n,function(n,t){return ow(n,t)}),n.filter(function(n){return ro(n.attributes.CODECS).videoCodec})[0]||null},comparePlaylistBandwidth:ow,comparePlaylistResolution:function(n,i){var r=void 0,u=void 0;return n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width&&(r=n.attributes.RESOLUTION.width),r=r||t.Number.MAX_VALUE,i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(u=i.attributes.RESOLUTION.width),r===(u=u||t.Number.MAX_VALUE)&&n.attributes.BANDWIDTH&&i.attributes.BANDWIDTH?n.attributes.BANDWIDTH-i.attributes.BANDWIDTH:r-u},xhr:oft()};["GOAL_BUFFER_LENGTH","MAX_GOAL_BUFFER_LENGTH","GOAL_BUFFER_LENGTH_RATE","BUFFER_LOW_WATER_LINE","MAX_BUFFER_LOW_WATER_LINE","BUFFER_LOW_WATER_LINE_RATE","BANDWIDTH_VARIANCE"].forEach(function(t){Object.defineProperty(ht,t,{get:function(){return n.log.warn("using Hls."+t+" is UNSAFE be sure you know what you are doing"),si[t]},set:function(i){n.log.warn("using Hls."+t+" is UNSAFE be sure you know what you are doing");"number"!=typeof i||i<0?n.log.warn("value of Hls."+t+" must be greater than or equal to 0"):si[t]=i}})});hw=function(n){return/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(n)?"hls":/^application\/dash\+xml/i.test(n)?"dash":null};cw=function(n,t){for(var u=t.media(),r=-1,i=0;i<n.length;i++)if(n[i].id===u.uri){r=i;break}n.selectedIndex_=r;n.trigger({selectedIndex:r,type:"change"})};ht.canPlaySource=function(){return n.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};ket=function(t){var i,r;"dash"===t.options_.sourceType&&(i=n.players[t.tech_.options_.playerId],i.eme&&(r=function(t,i,r){var f,u;if(!t)return t;f={};for(u in t)f[u]={audioContentType:'audio/mp4; codecs="'+r.attributes.CODECS+'"',videoContentType:'video/mp4; codecs="'+i.attributes.CODECS+'"'},i.contentProtection&&i.contentProtection[u]&&i.contentProtection[u].pssh&&(f[u].pssh=i.contentProtection[u].pssh),"string"==typeof t[u]&&(f[u].url=t[u]);return n.mergeOptions(t,f)}(t.source_.keySystems,t.playlists.media(),t.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader.media()),r&&(i.currentSource().keySystems=r)))};ht.supportsNativeHls=function(){var t=u.createElement("video");return n.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(n){return/maybe|probably/i.test(t.canPlayType(n))}):!1}();ht.supportsNativeDash=!!n.getTech("Html5").isSupported()&&/maybe|probably/i.test(u.createElement("video").canPlayType("application/dash+xml"));ht.supportsTypeNatively=function(n){return"hls"===n?ht.supportsNativeHls:"dash"===n&&ht.supportsNativeDash};ht.isSupported=function(){return n.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var owt=n.getComponent("Component"),det=function(){function t(i,r,f){var e,o;if(ni(this,t),e=vi(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,r,f.hls)),r.options_&&r.options_.playerId&&(o=n(r.options_.playerId),o.hasOwnProperty("hls")||Object.defineProperty(o,"hls",{get:function(){return n.log.warn("player.hls is deprecated. Use player.tech().hls instead."),r.trigger({type:"usage",name:"hls-player-access"}),e}}),o.vhs=e,o.dash=e),e.tech_=r,e.source_=i,e.stats={},e.setOptions_(),e.options_.overrideNative&&r.overrideNativeAudioTracks&&r.overrideNativeVideoTracks)r.overrideNativeAudioTracks(!0),r.overrideNativeVideoTracks(!0);else if(e.options_.overrideNative&&(r.featuresNativeVideoTracks||r.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return e.on(u,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(){var n=u.fullscreenElement||u.webkitFullscreenElement||u.mozFullScreenElement||u.msFullscreenElement;n&&n.contains(e.tech_.el())&&e.masterPlaylistController_.smoothQualityChange_()}),e.on(e.tech_,"error",function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()}),e.on(e.tech_,"play",e.play),e}return di(t,owt),oi(t,[{key:"setOptions_",value:function(){var n=this;this.options_.withCredentials=this.options_.withCredentials||!1;"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300);"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=4194304);this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&4194304===this.options_.bandwidth;["withCredentials","bandwidth"].forEach(function(t){"undefined"!=typeof n.source_[t]&&(n.options_[t]=n.source_[t])});this.bandwidth=this.options_.bandwidth}},{key:"src",value:function(t,i){var r=this;t&&(this.setOptions_(),this.options_.url=this.source_.src,this.options_.tech=this.tech_,this.options_.externHls=ht,this.options_.sourceType=hw(i),this.options_.seekTo=function(n){r.tech_.setCurrentTime(n);r.setCurrentTime(n)},this.masterPlaylistController_=new rwt(this.options_),this.playbackWatcher_=new fwt(n.mergeOptions(this.options_,{seekable:function(){return r.seekable()}})),this.masterPlaylistController_.on("error",function(){n.players[r.tech_.options_.playerId].error(r.masterPlaylistController_.error)}),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):ht.STANDARD_PLAYLIST_SELECTOR.bind(this),this.masterPlaylistController_.selectInitialPlaylist=ht.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(n){this.masterPlaylistController_.selectPlaylist=n.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(n){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=n;this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(n){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=n;this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var t=1/(this.bandwidth||1),n=void 0;return n=0<this.throughput?1/this.throughput:0,Math.floor(1/(t+n))},set:function(){n.log.error('The "systemBandwidth" property is read-only')}}}),Object.defineProperties(this.stats,{bandwidth:{get:function(){return r.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return r.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return r.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return r.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return r.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return r.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return r.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return r.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return vft(r.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return r.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return r.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return r.tech_.name_},enumerable:!0},duration:{get:function(){return r.tech_.duration()},enumerable:!0},master:{get:function(){return r.playlists.master},enumerable:!0},playerDimensions:{get:function(){return r.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return vft(r.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return r.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.masterPlaylistController_.on("selectedinitialmedia",function(){var n,t;t=(n=r).playlists;n.representations=function(){return t.master.playlists.filter(function(n){return!pp(n)}).map(function(t){return new uwt(n,t,t.uri)})};ket(r)}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.tech_.ready(function(){return r.setupQualityLevels_()}),this.tech_.el()&&this.tech_.src(n.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var t=this,i=n.players[this.tech_.options_.playerId];i&&i.qualityLevels&&(this.qualityLevels_=i.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){var n,i;n=t.qualityLevels_;(i=t).representations().forEach(function(t){n.addQualityLevel(t)});cw(n,i.playlists)}),this.playlists.on("mediachange",function(){cw(t.qualityLevels_,t.playlists)}))}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(n){this.masterPlaylistController_.setCurrentTime(n)}},{key:"duration",value:function(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value:function(){this.playbackWatcher_&&this.playbackWatcher_.dispose();this.masterPlaylistController_&&this.masterPlaylistController_.dispose();this.qualityLevels_&&this.qualityLevels_.dispose(),function n(t,i,r){var u,f,e;return(null===t&&(t=Function.prototype),u=Object.getOwnPropertyDescriptor(t,i),void 0===u)?(f=Object.getPrototypeOf(t),null===f?void 0:n(f,i,r)):"value"in u?u.value:(e=u.get,void 0!==e?e.call(r):void 0)}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"dispose",this).call(this)}}]),t}(),lw={name:"videojs-http-streaming",VERSION:"1.2.6",canHandleSource:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=n.mergeOptions(n.options,i);return lw.canPlayType(t.type,r)},handleSource:function(t,i){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},u=n.mergeOptions(n.options,r);return i.hls=new det(t,i,u),i.hls.xhr=oft(),i.hls.src(t.src,t.type),i.hls},canPlayType:function(t){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},u=n.mergeOptions(n.options,r).hls.overrideNative,i=hw(t);return i&&(!ht.supportsTypeNatively(i)||u)?"maybe":""}};return"undefined"!=typeof n.MediaSource&&"undefined"!=typeof n.URL||(n.MediaSource=uo,n.URL=uw),uo.supportsNativeMediaSources()&&n.getTech("Html5").registerSourceHandler(lw,0),n.HlsHandler=det,n.HlsSourceHandler=lw,n.Hls=ht,n.use||n.registerComponent("Hls",ht),n.options.hls=n.options.hls||{},n.registerPlugin?n.registerPlugin("reloadSourceOnError",bet):n.plugin("reloadSourceOnError",bet),n})