22 lines
502 KiB
JavaScript
22 lines
502 KiB
JavaScript
var app=function(){"use strict";function e(){}function t(e){return e()}function i(){return Object.create(null)}function n(e){e.forEach(t)}function r(e){return"function"==typeof e}function s(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function a(t,i,n){t.$$.on_destroy.push(function(t,...i){if(null==t)return e;const n=t.subscribe(...i);return n.unsubscribe?()=>n.unsubscribe():n}(i,n))}function o(e,t){e.appendChild(t)}function u(e,t,i){e.insertBefore(t,i||null)}function l(e){e.parentNode.removeChild(e)}function c(e){return document.createElement(e)}function h(e){return document.createTextNode(e)}function d(){return h(" ")}function p(e,t,i,n){return e.addEventListener(t,i,n),()=>e.removeEventListener(t,i,n)}function f(e,t,i){null==i?e.removeAttribute(t):e.getAttribute(t)!==i&&e.setAttribute(t,i)}function m(e){return Array.from(e.childNodes)}function g(e,t,i,n){for(let n=0;n<e.length;n+=1){const r=e[n];if(r.nodeName===t){let t=0;for(;t<r.attributes.length;){const e=r.attributes[t];i[e.name]?t++:r.removeAttribute(e.name)}return e.splice(n,1)[0]}}return n?function(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}(t):c(t)}function v(e,t){for(let i=0;i<e.length;i+=1){const n=e[i];if(3===n.nodeType)return n.data=""+t,e.splice(i,1)[0]}return h(t)}function y(e){return v(e," ")}function _(e,t){t=""+t,e.data!==t&&(e.data=t)}let b;function T(e){b=e}function S(e){(function(){if(!b)throw new Error("Function called outside component initialization");return b})().$$.on_mount.push(e)}const k=[],C=[],w=[],E=[],x=Promise.resolve();let A=!1;function I(e){w.push(e)}let P=!1;const L=new Set;function O(){if(!P){P=!0;do{for(let e=0;e<k.length;e+=1){const t=k[e];T(t),D(t.$$)}for(k.length=0;C.length;)C.pop()();for(let e=0;e<w.length;e+=1){const t=w[e];L.has(t)||(L.add(t),t())}w.length=0}while(k.length);for(;E.length;)E.pop()();A=!1,P=!1,L.clear()}}function D(e){if(null!==e.fragment){e.update(),n(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(I)}}const N=new Set;function R(e,t){e&&e.i&&(N.delete(e),e.i(t))}function U(e,t,i,n){if(e&&e.o){if(N.has(e))return;N.add(e),(void 0).c.push(()=>{N.delete(e),n&&(i&&e.d(1),n())}),e.o(t)}}function M(e){e&&e.c()}function B(e,t){e&&e.l(t)}function j(e,i,s){const{fragment:a,on_mount:o,on_destroy:u,after_update:l}=e.$$;a&&a.m(i,s),I(()=>{const i=o.map(t).filter(r);u?u.push(...i):n(i),e.$$.on_mount=[]}),l.forEach(I)}function F(e,t){const i=e.$$;null!==i.fragment&&(n(i.on_destroy),i.fragment&&i.fragment.d(t),i.on_destroy=i.fragment=null,i.ctx=[])}function V(e,t){-1===e.$$.dirty[0]&&(k.push(e),A||(A=!0,x.then(O)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function H(t,r,s,a,o,u,c=[-1]){const h=b;T(t);const d=r.props||{},p=t.$$={fragment:null,ctx:null,props:u,update:e,not_equal:o,bound:i(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(h?h.$$.context:[]),callbacks:i(),dirty:c};let f=!1;if(p.ctx=s?s(t,d,(e,i,...n)=>{const r=n.length?n[0]:i;return p.ctx&&o(p.ctx[e],p.ctx[e]=r)&&(p.bound[e]&&p.bound[e](r),f&&V(t,e)),i}):[],p.update(),f=!0,n(p.before_update),p.fragment=!!a&&a(p.ctx),r.target){if(r.hydrate){const e=m(r.target);p.fragment&&p.fragment.l(e),e.forEach(l)}else p.fragment&&p.fragment.c();r.intro&&R(t.$$.fragment),j(t,r.target,r.anchor),O()}T(h)}class q{$destroy(){F(this,1),this.$destroy=e}$on(e,t){const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}$set(){}}const W=[];const z=function(t,i=e){let n;const r=[];function a(e){if(s(t,e)&&(t=e,n)){const e=!W.length;for(let e=0;e<r.length;e+=1){const i=r[e];i[1](),W.push(i,t)}if(e){for(let e=0;e<W.length;e+=2)W[e][0](W[e+1]);W.length=0}}}return{set:a,update:function(e){a(e(t))},subscribe:function(s,o=e){const u=[s,o];return r.push(u),1===r.length&&(n=i(a)||e),s(t),()=>{const e=r.indexOf(u);-1!==e&&r.splice(e,1),0===r.length&&(n(),n=null)}}}}(""),$={setPlaying(e){console.log(">> setPlaying",e),z.update(t=>t===e?"":e)}};function G(t){let i,n,r,s,a,b,T,S,k,C,w,E,x;return{c(){i=c("div"),n=c("div"),r=c("div"),s=c("div"),a=d(),b=c("div"),T=h(t[1]),S=d(),k=c("iframe"),this.h()},l(e){i=g(e,"DIV",{class:!0});var o=m(i);n=g(o,"DIV",{class:!0});var u=m(n);r=g(u,"DIV",{class:!0,"data-youtube-id":!0});var c=m(r);s=g(c,"DIV",{class:!0}),m(s).forEach(l),a=y(c),b=g(c,"DIV",{class:!0});var h=m(b);T=v(h,t[1]),h.forEach(l),S=y(c),k=g(c,"IFRAME",{allow:!0,title:!0,id:!0,type:!0,frameborder:!0,width:!0,height:!0,src:!0}),m(k).forEach(l),c.forEach(l),u.forEach(l),o.forEach(l),this.h()},h(){f(s,"class","overlay"),f(b,"class","title"),f(k,"allow","autoplay"),f(k,"title",t[1]),f(k,"id",t[2]),f(k,"type","text/html"),f(k,"frameborder","0"),f(k,"width","100%"),f(k,"height","100%"),k.src!==(C=t[0])&&f(k,"src",C),f(r,"class",w="stream live youtube "+t[3]),f(r,"data-youtube-id",t[2]),f(n,"class","wrapper"),f(i,"class","quarter")},m(e,l){u(e,i,l),o(i,n),o(n,r),o(r,s),o(r,a),o(r,b),o(b,T),o(r,S),o(r,k),E||(x=p(i,"click",t[4]),E=!0)},p(e,[t]){2&t&&_(T,e[1]),2&t&&f(k,"title",e[1]),4&t&&f(k,"id",e[2]),1&t&&k.src!==(C=e[0])&&f(k,"src",C),8&t&&w!==(w="stream live youtube "+e[3])&&f(r,"class",w),4&t&&f(r,"data-youtube-id",e[2])},i:e,o:e,d(e){e&&l(i),E=!1,x()}}}function X(e,t,i){let n,r,{id:s}=t,{src:a}=t,{title:o}=t,u="";return z.subscribe(e=>{void 0!==n&&(i(3,u=""!==n&&e===n?"active":""),r&&(console.log(n+" - mute"),r.mute(),u&&(console.log(n+" - unmute"),r.unMute())))}),S(async()=>{setTimeout(async()=>{await async function(){console.log(n+" createPlayer");try{r=new YT.Player(n,{events:{onReady(e){console.log("READY!!"),e.target.mute()}}})}catch(e){console.log(e)}}()},1500)}),e.$set=e=>{"id"in e&&i(5,s=e.id),"src"in e&&i(0,a=e.src),"title"in e&&i(1,o=e.title)},e.$$.update=()=>{32&e.$$.dirty&&i(2,n=s+"-youtube")},[a,o,n,u,function(){$.setPlaying(n)},s]}class K extends q{constructor(e){super(),H(this,e,X,G,s,{id:5,src:0,title:1})}}var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Q(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var J,Z,ee="undefined"!=typeof window?window:void 0!==Y?Y:"undefined"!=typeof self?self:{},te=(J=Object.freeze({__proto__:null,default:{}}))&&J.default||J,ie=void 0!==Y?Y:"undefined"!=typeof window?window:{};"undefined"!=typeof document?Z=document:(Z=ie["__GLOBAL_DOCUMENT_CACHE@4"])||(Z=ie["__GLOBAL_DOCUMENT_CACHE@4"]=te);var ne=Z,re=Q((function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},t.apply(this,arguments)}e.exports=t}));var se=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};Q((function(e){function t(i){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(i)}e.exports=t})),Q((function(e){function t(i){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(i)}e.exports=t}));var ae=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t},oe=function(e,t){var i,n=null;try{i=JSON.parse(e,t)}catch(e){n=e}return[n,i]};var ue=Q((function(e,t){function i(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return a[e];var i,s=String(e);return(i=n[s.toLowerCase()])?i:(i=r[s.toLowerCase()])||(1===s.length?s.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){var s;if(s=n[t.toLowerCase()])return s===i;if(s=r[t.toLowerCase()])return s===i}else if("number"==typeof t)return t===i;return!1}};var n=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};
|
||
/*!
|
||
* Programatically add the following
|
||
*/
|
||
for(s=97;s<123;s++)n[String.fromCharCode(s)]=s-32;for(var s=48;s<58;s++)n[s-48]=s;for(s=1;s<13;s++)n["f"+s]=s+111;for(s=0;s<10;s++)n["numpad "+s]=s+96;var a=t.names=t.title={};for(s in n)a[n[s]]=s;for(var o in r)n[o]=r[o]})),le=(ue.code,ue.codes,ue.aliases,ue.names,ue.title,"undefined"!=typeof window?window:void 0!==Y?Y:"undefined"!=typeof self?self:{}),ce=function(e){if(!e)return!1;var t=he.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}
|
||
/**
|
||
* @license
|
||
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
|
||
* Copyright (c) 2014 David Björklund
|
||
* Available under the MIT license
|
||
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
|
||
*/,he=Object.prototype.toString;var de=me,pe=me;function fe(e,t,i){var n=e;return ce(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=re({},t,{uri:e}),n.callback=i,n}function me(e,t,i){return ge(t=fe(e,t,i))}function ge(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,n,r){t||(t=!0,e.callback(i,n,r))};function n(){var e=void 0;if(e=u.response?u.response:u.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(u),m)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(l),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,g)}function s(){if(!o){var t;clearTimeout(l),t=e.useXDR&&void 0===u.status?200:1223===u.status?204:u.status;var r=g,s=null;return 0!==t?(r={body:n(),statusCode:t,method:h,headers:{},url:c,rawRequest:u},u.getAllResponseHeaders&&(r.headers=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();void 0===t[n]?t[n]=r:Array.isArray(t[n])?t[n].push(r):t[n]=[t[n],r]})),t):t}(u.getAllResponseHeaders()))):s=new Error("Internal XMLHttpRequest Error"),i(s,r,r.body)}}var a,o,u=e.xhr||null;u||(u=e.cors||e.useXDR?new me.XDomainRequest:new me.XMLHttpRequest);var l,c=u.url=e.uri||e.url,h=u.method=e.method||"GET",d=e.body||e.data,p=u.headers=e.headers||{},f=!!e.sync,m=!1,g={body:void 0,headers:{},statusCode:0,method:h,url:c,rawRequest:u};if("json"in e&&!1!==e.json&&(m=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==h&&"HEAD"!==h&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),d=JSON.stringify(!0===e.json?d:e.json))),u.onreadystatechange=function(){4===u.readyState&&setTimeout(s,0)},u.onload=s,u.onerror=r,u.onprogress=function(){},u.onabort=function(){o=!0},u.ontimeout=r,u.open(h,c,!f,e.username,e.password),f||(u.withCredentials=!!e.withCredentials),!f&&e.timeout>0&&(l=setTimeout((function(){if(!o){o=!0,u.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),u.setRequestHeader)for(a in p)p.hasOwnProperty(a)&&u.setRequestHeader(a,p[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(u.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(u),u.send(d||null),u}me.XMLHttpRequest=le.XMLHttpRequest||function(){},me.XDomainRequest="withCredentials"in new me.XMLHttpRequest?me.XMLHttpRequest:le.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],(function(e){me["delete"===e?"del":e]=function(t,i,n){return(i=fe(t,i,n)).method=e.toUpperCase(),ge(i)}})),de.default=pe;var ve=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function ye(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function _e(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function be(){this.values=ve(null)}function Te(e,t,i,n){var r=n?e.split(n):[e];for(var s in r)if("string"==typeof r[s]){var a=r[s].split(i);if(2===a.length)t(a[0],a[1])}}function Se(e,t,i){var n=e;function r(){var t=_e(e);if(null===t)throw new ye(ye.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function s(){e=e.replace(/^\s+/,"")}if(s(),t.startTime=r(),s(),"--\x3e"!==e.substr(0,3))throw new ye(ye.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),s(),t.endTime=r(),s(),function(e,t){var n=new be;Te(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var s=t.split(","),a=s[0];n.integer(e,a),n.percent(e,a)&&n.set("snapToLines",!1),n.alt(e,a,["auto"]),2===s.length&&n.alt("lineAlign",s[1],["start","center","end"]);break;case"position":s=t.split(","),n.percent(e,s[0]),2===s.length&&n.alt("positionAlign",s[1],["start","center","end"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");try{t.line=n.get("line","auto")}catch(e){}t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100);try{t.align=n.get("align","center")}catch(e){t.align=n.get("align","middle")}try{t.position=n.get("position","auto")}catch(e){t.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}ye.prototype=ve(Error.prototype),ye.prototype.constructor=ye,ye.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},be.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var ke=ne.createElement("textarea"),Ce={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},we={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},Ee={v:"title",lang:"lang"},xe={rt:"ruby"};function Ae(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function n(e,t){return!xe[t.localName]||xe[t.localName]===e.localName}function r(t,i){var n=Ce[t];if(!n)return null;var r=e.document.createElement(n),s=Ee[t];return s&&i&&(r[s]=i.trim()),r}for(var s,a,o=e.document.createElement("div"),u=o,l=[];null!==(s=i());)if("<"!==s[0])u.appendChild(e.document.createTextNode((a=s,ke.innerHTML=a,a=ke.textContent,ke.textContent="",a)));else{if("/"===s[1]){l.length&&l[l.length-1]===s.substr(2).replace(">","")&&(l.pop(),u=u.parentNode);continue}var c,h=_e(s.substr(1,s.length-2));if(h){c=e.document.createProcessingInstruction("timestamp",h),u.appendChild(c);continue}var d=s.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!d)continue;if(!(c=r(d[1],d[3])))continue;if(!n(u,c))continue;if(d[2]){var p=d[2].split(".");p.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(we.hasOwnProperty(i)){var n=t?"background-color":"color",r=we[i];c.style[n]=r}})),c.className=p.join(" ")}l.push(d[1]),u.appendChild(c),u=c}return o}var Ie=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Pe(e){for(var t=0;t<Ie.length;t++){var i=Ie[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function Le(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var s=i.match(/^.*(\n|\r)/);return s?(e.length=0,s[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(n(e,t),r(e)):void 0}for(n(t,e);i=r(t);)for(var s=0;s<i.length;s++)if(Pe(i.charCodeAt(s)))return"rtl";return"ltr"}function Oe(){}function De(e,t,i){Oe.call(this),this.cue=t,this.cueDiv=Ae(e,t.text);var n={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(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:Le(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(n),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":r=t.position;break;case"center":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(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function Ne(e){var t,i,n,r;if(e.div){i=e.div.offsetHeight,n=e.div.offsetWidth,r=e.div.offsetTop;var s=(s=e.div.childNodes)&&(s=s[0])&&s.getClientRects&&s.getClientRects();e=e.div.getBoundingClientRect(),t=s?Math.max(s[0]&&s[0].height||0,e.height/s.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||i,this.bottom=e.bottom||r+(e.height||i),this.width=e.width||n,this.lineHeight=void 0!==t?t:e.lineHeight}function Re(e,t,i,n){var r=new Ne(t),s=t.cue,a=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&n++;return-1*++n}(s),o=[];if(s.snapToLines){var u;switch(s.vertical){case"":o=["+y","-y"],u="height";break;case"rl":o=["+x","-x"],u="width";break;case"lr":o=["-x","+x"],u="width"}var l=r.lineHeight,c=l*Math.round(a),h=i[u]+l,d=o[0];Math.abs(c)>h&&(c=c<0?-1:1,c*=Math.ceil(h/l)*l),a<0&&(c+=""===s.vertical?i.height:i.width,o=o.reverse()),r.move(d,c)}else{var p=r.lineHeight/i.height*100;switch(s.lineAlign){case"center":a-=p/2;break;case"end":a-=p}switch(s.vertical){case"":t.applyStyles({top:t.formatStyle(a,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(a,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(a,"%")})}o=["+y","-x","+x","-y"],r=new Ne(t)}var f=function(e,t){for(var r,s=new Ne(e),a=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(n);)e.move(t[o]);if(e.within(i))return e;var u=e.intersectPercentage(i);a>u&&(r=new Ne(e),a=u),e=new Ne(s)}return r||s}(r,o);t.move(f.toCSSCompatValues(i))}function Ue(){}Oe.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},Oe.prototype.formatStyle=function(e,t){return 0===e?0:e+t},De.prototype=ve(Oe.prototype),De.prototype.constructor=De,Ne.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){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}},Ne.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},Ne.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},Ne.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},Ne.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},Ne.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},Ne.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},Ne.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},Ue.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Ue.convertCueToDOMTree=function(e,t){return e&&t?Ae(e,t):null};Ue.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var r=[],s=Ne.getSimpleBoxPosition(n),a={font:Math.round(.05*s.height*100)/100+"px sans-serif"};!function(){for(var i,o,u=0;u<t.length;u++)o=t[u],i=new De(e,o,a),n.appendChild(i.div),Re(0,i,s,r),o.displayState=i.div,r.push(Ne.getSimpleBoxPosition(i))}()}else for(var o=0;o<t.length;o++)n.appendChild(t[o].displayState)},Ue.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},Ue.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof ye))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var n=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),n}function n(e){e.match(/X-TIMESTAMP-MAP/)?Te(e,(function(e,i){switch(e){case"X-TIMESTAMP-MAP":!function(e){var i=new be;Te(e,(function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",_e(t))}}),/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}(i)}}),/=/):Te(e,(function(e,i){switch(e){case"Region":!function(e){var i=new be;if(Te(e,(function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var n=t.split(",");if(2!==n.length)break;var r=new be;if(r.percent("x",n[0]),r.percent("y",n[1]),!r.has("x")||!r.has("y"))break;i.set(e+"X",r.get("x")),i.set(e+"Y",r.get("y"));break;case"scroll":i.alt(e,t,["up"])}}),/=/,/\s/),i.has("id")){var n=new(t.vttjs.VTTRegion||t.window.VTTRegion);n.width=i.get("width",100),n.lines=i.get("lines",3),n.regionAnchorX=i.get("regionanchorX",0),n.regionAnchorY=i.get("regionanchorY",100),n.viewportAnchorX=i.get("viewportanchorX",0),n.viewportAnchorY=i.get("viewportanchorY",100),n.scroll=i.get("scroll",""),t.onregion&&t.onregion(n),t.regionList.push({id:i.get("id"),region:n})}}(i)}}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var s=(r=i()).match(/^WEBVTT([ \t].*)?$/);if(!s||!s[0])throw new ye(ye.Errors.BadSignature);t.state="HEADER"}for(var a=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:r=i(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(e){t.cue.align="middle"}if(t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{Se(r,t.cue,t.regionList)}catch(e){t.reportOrThrowError(e),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(a=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(t.state="ID");continue}}}catch(e){t.reportOrThrowError(e),"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(){try{if(this.buffer+=this.decoder.decode(),(this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state)throw new ye(ye.Errors.BadSignature)}catch(e){this.reportOrThrowError(e)}return this.onflush&&this.onflush(),this}};var Me=Ue,Be={"":1,lr:1,rl:1},je={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Fe(e){return"string"==typeof e&&(!!je[e.toLowerCase()]&&e.toLowerCase())}function Ve(e,t,i){this.hasBeenReset=!1;var n="",r=!1,s=e,a=t,o=i,u=null,l="",c=!0,h="auto",d="start",p="auto",f="auto",m=100,g="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(e){n=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");s=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");a=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(e){o=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(e){u=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(e){var t=function(e){return"string"==typeof e&&(!!Be[e.toLowerCase()]&&e.toLowerCase())}(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");l=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return h},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");h=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return d},set:function(e){var t=Fe(e);t?(d=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=Fe(e);t?(f=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){var t=Fe(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Ve.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var He=Ve,qe={"":!0,up:!0};function We(e){return"number"==typeof e&&e>=0&&e<=100}var ze=function(){var e=100,t=3,i=0,n=100,r=0,s=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!We(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!We(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!We(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(e){if(!We(e))throw new Error("ViewportAnchorY must be between 0 and 100.");s=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!We(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return a},set:function(e){var t=function(e){return"string"==typeof e&&(!!qe[e.toLowerCase()]&&e.toLowerCase())}(e);!1===t?console.warn("Scroll: an invalid or illegal string was specified."):a=t}}})},$e=Q((function(e){var t=e.exports={WebVTT:Me,VTTCue:He,VTTRegion:ze};ee.vttjs=t,ee.WebVTT=t.WebVTT;var i=t.VTTCue,n=t.VTTRegion,r=ee.VTTCue,s=ee.VTTRegion;t.shim=function(){ee.VTTCue=i,ee.VTTRegion=n},t.restore=function(){ee.VTTCue=r,ee.VTTRegion=s},ee.VTTCue||t.shim()})),Ge=($e.WebVTT,$e.VTTCue,$e.VTTRegion,Q((function(e){function t(i,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(i,n)}e.exports=t})));var Xe=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}},Ke=Q((function(e){function t(i,n,r){return Xe()?e.exports=t=Reflect.construct:e.exports=t=function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&Ge(r,i.prototype),r},t.apply(null,arguments)}e.exports=t}));var Ye=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ge(e,t)},Qe=Q((function(e,t){!function(t){var i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,n=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var s=a.parseURL(t);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return i.alwaysNormalize?(s.path=a.normalizePath(s.path),a.buildURLFromParts(s)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=n.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(l.netLoc=o.netLoc,"/"!==s.path[0]))if(s.path){var c=o.path,h=c.substring(0,c.lastIndexOf("/")+1)+s.path;l.path=a.normalizePath(h)}else l.path=o.path,s.params||(l.params=o.params,s.query||(l.query=o.query));return null===l.path&&(l.path=i.alwaysNormalize?a.normalizePath(s.path):s.path),a.buildURLFromParts(l)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(s,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=a}()}));
|
||
/*! @name m3u8-parser @version 4.4.0 @license Apache-2.0 */
|
||
function Je(){return(Je=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function Ze(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var et=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t,i,n,r=this.listeners[e];if(r)if(2===arguments.length)for(i=r.length,t=0;t<i;++t)r[t].call(this,arguments[1]);else for(n=Array.prototype.slice.call(arguments,1),i=r.length,t=0;t<i;++t)r[t].apply(this,n)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}(),tt=function(e){function t(){var t;return(t=e.call(this)||this).buffer="",t}return Ze(t,e),t.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(et),it=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;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"),n[t[0]]=t[1]);return n},nt=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}Ze(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,i){var n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((function(e){for(var r=0;r<n.customParsers.length;r++)if(n.customParsers[r].call(n,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))n.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void n.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"totalduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void n.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"byterange"},t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),void n.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"map"},t[1]){var s=it(t[1]);if(s.URI&&(i.uri=s.URI),s.BYTERANGE){var a=s.BYTERANGE.split("@"),o=a[0],u=a[1];i.byterange={},o&&(i.byterange.length=parseInt(o,10)),u&&(i.byterange.offset=parseInt(u,10))}}n.trigger("data",i)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=it(t[1]),i.attributes.RESOLUTION){var l=i.attributes.RESOLUTION.split("x"),c={};l[0]&&(c.width=parseInt(l[0],10)),l[1]&&(c.height=parseInt(l[1],10)),i.attributes.RESOLUTION=c}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}n.trigger("data",i)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=it(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e))n.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))n.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=it(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void n.trigger("data",i);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return i={type:"tag",tagType:"start"},t[1]&&(i.attributes=it(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);n.trigger("data",{type:"tag",data:e.slice(4)})}}}else n.trigger("data",{type:"comment",text:e.slice(1)})})):this.trigger("data",{type:"uri",uri:e}))},i.addParser=function(e){var t=this,i=e.expression,n=e.customType,r=e.dataParser,s=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push((function(e){if(i.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:n,segment:s}),!0}))},i.addTagMapper=function(e){var t=e.expression,i=e.map;this.tagMappers.push((function(e){return t.test(e)?i(e):e}))},t}(et);function rt(e){for(var t=ee.atob(e||""),i=new Uint8Array(t.length),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i}var st=function(e){function t(){var t;(t=e.call(this)||this).lineStream=new tt,t.parseStream=new nt,t.lineStream.pipe(t.parseStream);var i,n,r=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t),s=[],a={},o=function(){},u={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},l=0;return t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},t.parseStream.on("data",(function(e){var t,c;({tag:function(){({"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&(a.byterange=t,t.length=e.length,"offset"in e||(this.trigger("info",{message:"defaulting offset to zero"}),e.offset=0)),"offset"in e&&(a.byterange=t,t.offset=e.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"})),e.duration>0&&(a.duration=e.duration),0===e.duration&&(a.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=s},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?void(this.manifest.contentProtection={"com.widevine.alpha":{attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:rt(e.attributes.URI.split(",")[1])}}):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,l=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange)},"stream-inf":function(){this.manifest.playlists=s,this.manifest.mediaGroups=this.manifest.mediaGroups||u,e.attributes?(a.attributes||(a.attributes={}),Je(a.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||u,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(c={default:/yes/i.test(e.attributes.DEFAULT)}).default?c.autoselect=!0:c.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(c.language=e.attributes.LANGUAGE),e.attributes.URI&&(c.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(c.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(c.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(c.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=c}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){l+=1,a.discontinuity=!0,this.manifest.discontinuityStarts.push(s.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),a.dateTimeString=e.dateTimeString,a.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):this.manifest.targetDuration=e.duration},totalduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration}):this.manifest.totalDuration=e.duration},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){a.cueOut=e.data},"cue-out-cont":function(){a.cueOutCont=e.data},"cue-in":function(){a.cueIn=e.data}}[e.tagType]||o).call(r)},uri:function(){a.uri=e.uri,s.push(a),this.manifest.targetDuration&&!("duration"in a)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),a.duration=this.manifest.targetDuration),n&&(a.key=n),a.timeline=l,i&&(a.map=i),a={}},comment:function(){},custom:function(){e.segment?(a.custom=a.custom||{},a.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(r)})),t}Ze(t,e);var i=t.prototype;return i.push=function(e){this.lineStream.push(e)},i.end=function(){this.lineStream.push("\n")},i.addParser=function(e){this.parseStream.addParser(e)},i.addTagMapper=function(e){this.parseStream.addTagMapper(e)},t}(et);function at(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var ot=at(Qe),ut=at(ee),lt=function(e,t){return/^[a-z]+:/i.test(t)?t:(/\/\//i.test(e)||(e=ot.buildAbsoluteURL(ut.location&&ut.location.href||"",e)),ot.buildAbsoluteURL(e,t))};var ct,ht=(ct=ee)&&"object"==typeof ct&&"default"in ct?ct.default:ct;var dt=function(e){for(var t,i=(t=e,ht.atob?ht.atob(t):Buffer.from(t,"base64").toString("binary")),n=new Uint8Array(i.length),r=0;r<i.length;r++)n[r]=i.charCodeAt(r);return n},pt=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,ft=new RegExp("[\\-\\.0-9"+pt.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),mt=new RegExp("^"+pt.source+ft.source+"*(?::"+pt.source+ft.source+"*)?$");function gt(){}function vt(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function yt(e,t,i,n,r,s){for(var a,o=++t,u=0;;){var l=e.charAt(o);switch(l){case"=":if(1===u)a=e.slice(t,o),u=3;else{if(2!==u)throw new Error("attribute equal must after attrName");u=3}break;case"'":case'"':if(3===u||1===u){if(1===u&&(s.warning('attribute value must after "="'),a=e.slice(t,o)),t=o+1,!((o=e.indexOf(l,t))>0))throw new Error("attribute value no end '"+l+"' match");c=e.slice(t,o).replace(/&#?\w+;/g,r),i.add(a,c,t-1),u=5}else{if(4!=u)throw new Error('attribute value must after "="');c=e.slice(t,o).replace(/&#?\w+;/g,r),i.add(a,c,t),s.warning('attribute "'+a+'" missed start quot('+l+")!!"),t=o+1,u=5}break;case"/":switch(u){case 0:i.setTagName(e.slice(t,o));case 5:case 6:case 7:u=7,i.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),0==u&&i.setTagName(e.slice(t,o)),o;case">":switch(u){case 0:i.setTagName(e.slice(t,o));case 5:case 6:case 7:break;case 4:case 1:"/"===(c=e.slice(t,o)).slice(-1)&&(i.closed=!0,c=c.slice(0,-1));case 2:2===u&&(c=a),4==u?(s.warning('attribute "'+c+'" missed quot(")!!'),i.add(a,c.replace(/&#?\w+;/g,r),t)):("http://www.w3.org/1999/xhtml"===n[""]&&c.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),i.add(c,c,t));break;case 3:throw new Error("attribute value missed!!")}return o;case"":l=" ";default:if(l<=" ")switch(u){case 0:i.setTagName(e.slice(t,o)),u=6;break;case 1:a=e.slice(t,o),u=2;break;case 4:var c=e.slice(t,o).replace(/&#?\w+;/g,r);s.warning('attribute "'+c+'" missed quot(")!!'),i.add(a,c,t);case 5:u=6}else switch(u){case 2:i.tagName;"http://www.w3.org/1999/xhtml"===n[""]&&a.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),i.add(a,a,t),t=o,u=1;break;case 5:s.warning('attribute space is required"'+a+'"!!');case 6:u=1,t=o;break;case 3:u=4,t=o;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}o++}}function _t(e,t,i){for(var n=e.tagName,r=null,s=e.length;s--;){var a=e[s],o=a.qName,u=a.value;if((d=o.indexOf(":"))>0)var l=a.prefix=o.slice(0,d),c=o.slice(d+1),h="xmlns"===l&&c;else c=o,l=null,h="xmlns"===o&&"";a.localName=c,!1!==h&&(null==r&&(r={},St(i,i={})),i[h]=r[h]=u,a.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(h,u))}for(s=e.length;s--;){(l=(a=e[s]).prefix)&&("xml"===l&&(a.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==l&&(a.uri=i[l||""]))}var d;(d=n.indexOf(":"))>0?(l=e.prefix=n.slice(0,d),c=e.localName=n.slice(d+1)):(l=null,c=e.localName=n);var p=e.uri=i[l||""];if(t.startElement(p,c,n,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,!0;if(t.endElement(p,c,n),r)for(l in r)t.endPrefixMapping(l)}function bt(e,t,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var s=e.indexOf("</"+i+">",t),a=e.substring(t+1,s);if(/[&<]/.test(a))return/^script$/i.test(i)?(r.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,n),r.characters(a,0,a.length),s)}return t+1}function Tt(e,t,i,n){var r=n[i];return null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),n[i]=r),r<t}function St(e,t){for(var i in e)t[i]=e[i]}function kt(e,t,i,n){switch(e.charAt(t+2)){case"-":return"-"===e.charAt(t+3)?(r=e.indexOf("--\x3e",t+4))>t?(i.comment(e,t+4,r-t-4),r+3):(n.error("Unclosed comment"),-1):-1;default:if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var s=function(e,t){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(n.push(i),i[1])return n}(e,t),a=s.length;if(a>1&&/!doctype/i.test(s[0][0])){var o=s[1][0],u=a>3&&/^public$/i.test(s[2][0])&&s[3][0],l=a>4&&s[4][0],c=s[a-1];return i.startDTD(o,u&&u.replace(/^(['"])(.*?)\1$/,"$2"),l&&l.replace(/^(['"])(.*?)\1$/,"$2")),i.endDTD(),c.index+c[0].length}}return-1}function Ct(e,t,i){var n=e.indexOf("?>",t);if(n){var r=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(r){r[0].length;return i.processingInstruction(r[1],r[2]),n+2}return-1}return-1}function wt(e){}function Et(e,t){return e.__proto__=t,e}gt.prototype={parse:function(e,t,i){var n=this.domBuilder;n.startDocument(),St(t,t={}),function(e,t,i,n,r){function s(e){var t=e.slice(1,-1);return t in i?i[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),i=56320+(1023&e);return String.fromCharCode(t,i)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function a(t){if(t>f){var i=e.substring(f,t).replace(/&#?\w+;/g,s);h&&o(f),n.characters(i,0,t-f),f=t}}function o(t,i){for(;t>=l&&(i=c.exec(e));)u=i.index,l=u+i[0].length,h.lineNumber++;h.columnNumber=t-u+1}var u=0,l=0,c=/.*(?:\r\n?|\n)|.*$/g,h=n.locator,d=[{currentNSMap:t}],p={},f=0;for(;;){try{var m=e.indexOf("<",f);if(m<0){if(!e.substr(f).match(/^\s*$/)){var g=n.doc,v=g.createTextNode(e.substr(f));g.appendChild(v),n.currentElement=v}return}switch(m>f&&a(m),e.charAt(m+1)){case"/":var y=e.indexOf(">",m+3),_=e.substring(m+2,y),b=d.pop();y<0?(_=e.substring(m+2).replace(/[\s<].*/,""),r.error("end tag name: "+_+" is not complete:"+b.tagName),y=m+1+_.length):_.match(/\s</)&&(_=_.replace(/[\s<].*/,""),r.error("end tag name: "+_+" maybe not complete"),y=m+1+_.length);var T=b.localNSMap,S=b.tagName==_;if(S||b.tagName&&b.tagName.toLowerCase()==_.toLowerCase()){if(n.endElement(b.uri,b.localName,_),T)for(var k in T)n.endPrefixMapping(k);S||r.fatalError("end tag name: "+_+" is not match the current start tagName:"+b.tagName)}else d.push(b);y++;break;case"?":h&&o(m),y=Ct(e,m,n);break;case"!":h&&o(m),y=kt(e,m,n,r);break;default:h&&o(m);var C=new wt,w=d[d.length-1].currentNSMap,E=(y=yt(e,m,C,w,s,r),C.length);if(!C.closed&&Tt(e,y,C.tagName,p)&&(C.closed=!0,i.nbsp||r.warning("unclosed xml attribute")),h&&E){for(var x=vt(h,{}),A=0;A<E;A++){var I=C[A];o(I.offset),I.locator=vt(h,{})}n.locator=x,_t(C,n,w)&&d.push(C),n.locator=h}else _t(C,n,w)&&d.push(C);"http://www.w3.org/1999/xhtml"!==C.uri||C.closed?y++:y=bt(e,y,C.tagName,s,n)}}catch(e){r.error("element parse error: "+e),y=-1}y>f?f=y:a(Math.max(m,f)+1)}}(e,t,i,n,this.errorHandler),n.endDocument()}},wt.prototype={setTagName:function(e){if(!mt.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,t,i){if(!mt.test(e))throw new Error("invalid attribute:"+e);this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},Et({},Et.prototype)instanceof Et||(Et=function(e,t){function i(){}for(t in i.prototype=t,i=new i,e)i[t]=e[t];return i});var xt={XMLReader:gt};function At(e,t){for(var i in e)t[i]=e[i]}function It(e,t){var i=e.prototype;if(Object.create){var n=Object.create(t.prototype);i.__proto__=n}if(!(i instanceof t)){function r(){}r.prototype=t.prototype,At(i,r=new r),e.prototype=i=r}i.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),i.constructor=e)}var Pt={},Lt=Pt.ELEMENT_NODE=1,Ot=Pt.ATTRIBUTE_NODE=2,Dt=Pt.TEXT_NODE=3,Nt=Pt.CDATA_SECTION_NODE=4,Rt=Pt.ENTITY_REFERENCE_NODE=5,Ut=Pt.ENTITY_NODE=6,Mt=Pt.PROCESSING_INSTRUCTION_NODE=7,Bt=Pt.COMMENT_NODE=8,jt=Pt.DOCUMENT_NODE=9,Ft=Pt.DOCUMENT_TYPE_NODE=10,Vt=Pt.DOCUMENT_FRAGMENT_NODE=11,Ht=Pt.NOTATION_NODE=12,qt={},Wt={},zt=(qt.INDEX_SIZE_ERR=(Wt[1]="Index size error",1),qt.DOMSTRING_SIZE_ERR=(Wt[2]="DOMString size error",2),qt.HIERARCHY_REQUEST_ERR=(Wt[3]="Hierarchy request error",3)),$t=(qt.WRONG_DOCUMENT_ERR=(Wt[4]="Wrong document",4),qt.INVALID_CHARACTER_ERR=(Wt[5]="Invalid character",5),qt.NO_DATA_ALLOWED_ERR=(Wt[6]="No data allowed",6),qt.NO_MODIFICATION_ALLOWED_ERR=(Wt[7]="No modification allowed",7),qt.NOT_FOUND_ERR=(Wt[8]="Not found",8)),Gt=(qt.NOT_SUPPORTED_ERR=(Wt[9]="Not supported",9),qt.INUSE_ATTRIBUTE_ERR=(Wt[10]="Attribute in use",10));qt.INVALID_STATE_ERR=(Wt[11]="Invalid state",11),qt.SYNTAX_ERR=(Wt[12]="Syntax error",12),qt.INVALID_MODIFICATION_ERR=(Wt[13]="Invalid modification",13),qt.NAMESPACE_ERR=(Wt[14]="Invalid namespace",14),qt.INVALID_ACCESS_ERR=(Wt[15]="Invalid access",15);function Xt(e,t){if(t instanceof Error)var i=t;else i=this,Error.call(this,Wt[e]),this.message=Wt[e],Error.captureStackTrace&&Error.captureStackTrace(this,Xt);return i.code=e,t&&(this.message=this.message+": "+t),i}function Kt(){}function Yt(e,t){this._node=e,this._refresh=t,Qt(this)}function Qt(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var i=e._refresh(e._node);xi(e,"length",i.length),At(i,e),e._inc=t}}function Jt(){}function Zt(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function ei(e,t,i,n){if(n?t[Zt(t,n)]=i:t[t.length++]=i,e){i.ownerElement=e;var r=e.ownerDocument;r&&(n&&oi(r,e,n),function(e,t,i){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==i.namespaceURI&&(t._nsMap[i.prefix?i.localName:""]=i.value)}(r,e,i))}}function ti(e,t,i){var n=Zt(t,i);if(!(n>=0))throw Xt($t,new Error(e.tagName+"@"+i));for(var r=t.length-1;n<r;)t[n]=t[++n];if(t.length=r,e){var s=e.ownerDocument;s&&(oi(s,e,i),i.ownerElement=null)}}function ii(e){if(this._features={},e)for(var t in e)this._features=e[t]}function ni(){}function ri(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function si(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(si(e,t))return!0}while(e=e.nextSibling)}function ai(){}function oi(e,t,i,n){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==i.namespaceURI&&delete t._nsMap[i.prefix?i.localName:""]}function ui(e,t,i){if(e&&e._inc){e._inc++;var n=t.childNodes;if(i)n[n.length++]=i;else{for(var r=t.firstChild,s=0;r;)n[s++]=r,r=r.nextSibling;n.length=s}}}function li(e,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:e.firstChild=n,n?n.previousSibling=i:e.lastChild=i,ui(e.ownerDocument,e),t}function ci(e,t,i){var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===Vt){var r=t.firstChild;if(null==r)return t;var s=t.lastChild}else r=s=t;var a=i?i.previousSibling:e.lastChild;r.previousSibling=a,s.nextSibling=i,a?a.nextSibling=r:e.firstChild=r,null==i?e.lastChild=s:i.previousSibling=s;do{r.parentNode=e}while(r!==s&&(r=r.nextSibling));return ui(e.ownerDocument||e,e),t.nodeType==Vt&&(t.firstChild=t.lastChild=null),t}function hi(){this._nsMap={}}function di(){}function pi(){}function fi(){}function mi(){}function gi(){}function vi(){}function yi(){}function _i(){}function bi(){}function Ti(){}function Si(){}function ki(){}function Ci(e,t){var i=[],n=9==this.nodeType?this.documentElement:this,r=n.prefix,s=n.namespaceURI;if(s&&null==r&&null==(r=n.lookupPrefix(s)))var a=[{namespace:s,prefix:null}];return Ei(this,i,e,t,a),i.join("")}function wi(e,t,i){var n=e.prefix||"",r=e.namespaceURI;if(!n&&!r)return!1;if("xml"===n&&"http://www.w3.org/XML/1998/namespace"===r||"http://www.w3.org/2000/xmlns/"==r)return!1;for(var s=i.length;s--;){var a=i[s];if(a.prefix==n)return a.namespace!=r}return!0}function Ei(e,t,i,n,r){if(n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case Lt:r||(r=[]);r.length;var s=e.attributes,a=s.length,o=e.firstChild,u=e.tagName;i="http://www.w3.org/1999/xhtml"===e.namespaceURI||i,t.push("<",u);for(var l=0;l<a;l++){"xmlns"==(c=s.item(l)).prefix?r.push({prefix:c.localName,namespace:c.value}):"xmlns"==c.nodeName&&r.push({prefix:"",namespace:c.value})}for(l=0;l<a;l++){var c;if(wi(c=s.item(l),0,r)){var h=c.prefix||"",d=c.namespaceURI,p=h?" xmlns:"+h:" xmlns";t.push(p,'="',d,'"'),r.push({prefix:h,namespace:d})}Ei(c,t,i,n,r)}if(wi(e,0,r)){h=e.prefix||"",d=e.namespaceURI,p=h?" xmlns:"+h:" xmlns";t.push(p,'="',d,'"'),r.push({prefix:h,namespace:d})}if(o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(t.push(">"),i&&/^script$/i.test(u))for(;o;)o.data?t.push(o.data):Ei(o,t,i,n,r),o=o.nextSibling;else for(;o;)Ei(o,t,i,n,r),o=o.nextSibling;t.push("</",u,">")}else t.push("/>");return;case jt:case Vt:for(o=e.firstChild;o;)Ei(o,t,i,n,r),o=o.nextSibling;return;case Ot:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,ri),'"');case Dt:return t.push(e.data.replace(/[<&]/g,ri));case Nt:return t.push("<![CDATA[",e.data,"]]>");case Bt:return t.push("\x3c!--",e.data,"--\x3e");case Ft:var f=e.publicId,m=e.systemId;if(t.push("<!DOCTYPE ",e.name),f)t.push(' PUBLIC "',f),m&&"."!=m&&t.push('" "',m),t.push('">');else if(m&&"."!=m)t.push(' SYSTEM "',m,'">');else{var g=e.internalSubset;g&&t.push(" [",g,"]"),t.push(">")}return;case Mt:return t.push("<?",e.target," ",e.data,"?>");case Rt:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function xi(e,t,i){e[t]=i}Xt.prototype=Error.prototype,At(qt,Xt),Kt.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var i=[],n=0;n<this.length;n++)Ei(this[n],i,e,t);return i.join("")}},Yt.prototype.item=function(e){return Qt(this),this[e]},It(Yt,Kt),Jt.prototype={length:0,item:Kt.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var i=this[t];if(i.nodeName==e)return i}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new Xt(Gt);var i=this.getNamedItem(e.nodeName);return ei(this._ownerElement,this,e,i),i},setNamedItemNS:function(e){var t,i=e.ownerElement;if(i&&i!=this._ownerElement)throw new Xt(Gt);return t=this.getNamedItemNS(e.namespaceURI,e.localName),ei(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return ti(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var i=this.getNamedItemNS(e,t);return ti(this._ownerElement,this,i),i},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var n=this[i];if(n.localName==t&&n.namespaceURI==e)return n}return null}},ii.prototype={hasFeature:function(e,t){var i=this._features[e.toLowerCase()];return!(!i||t&&!(t in i))},createDocument:function(e,t,i){var n=new ai;if(n.implementation=this,n.childNodes=new Kt,n.doctype=i,i&&n.appendChild(i),t){var r=n.createElementNS(e,t);n.appendChild(r)}return n},createDocumentType:function(e,t,i){var n=new vi;return n.name=e,n.nodeName=e,n.publicId=t,n.systemId=i,n}},ni.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return ci(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return li(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return function e(t,i,n){var r=new i.constructor;for(var s in i){var a=i[s];"object"!=typeof a&&a!=r[s]&&(r[s]=a)}i.childNodes&&(r.childNodes=new Kt);switch(r.ownerDocument=t,r.nodeType){case Lt:var o=i.attributes,u=r.attributes=new Jt,l=o.length;u._ownerElement=r;for(var c=0;c<l;c++)r.setAttributeNode(e(t,o.item(c),!0));break;case Ot:n=!0}if(n)for(var h=i.firstChild;h;)r.appendChild(e(t,h,n)),h=h.nextSibling;return r}(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==Dt&&e.nodeType==Dt?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var n in i)if(i[n]==e)return n;t=t.nodeType==Ot?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&e in i)return i[e];t=t.nodeType==Ot?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},At(Pt,ni),At(Pt,ni.prototype),ai.prototype={nodeName:"#document",nodeType:jt,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==Vt){for(var i=e.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,t),i=n}return e}return null==this.documentElement&&e.nodeType==Lt&&(this.documentElement=e),ci(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),li(this,e)},importNode:function(e,t){return function e(t,i,n){var r;switch(i.nodeType){case Lt:(r=i.cloneNode(!1)).ownerDocument=t;case Vt:break;case Ot:n=!0}r||(r=i.cloneNode(!1));if(r.ownerDocument=t,r.parentNode=null,n)for(var s=i.firstChild;s;)r.appendChild(e(t,s,n)),s=s.nextSibling;return r}(this,e,t)},getElementById:function(e){var t=null;return si(this.documentElement,(function(i){if(i.nodeType==Lt&&i.getAttribute("id")==e)return t=i,!0})),t},createElement:function(e){var t=new hi;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new Kt,(t.attributes=new Jt)._ownerElement=t,t},createDocumentFragment:function(){var e=new Ti;return e.ownerDocument=this,e.childNodes=new Kt,e},createTextNode:function(e){var t=new fi;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new mi;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new gi;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new Si;return i.ownerDocument=this,i.tagName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new di;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new bi;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new hi,n=t.split(":"),r=i.attributes=new Jt;return i.childNodes=new Kt,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,r._ownerElement=i,i},createAttributeNS:function(e,t){var i=new di,n=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,i}},It(ai,ni),hi.prototype={nodeType:Lt,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===Vt?this.insertBefore(e,null):function(e,t){var i=t.parentNode;if(i){var n=e.lastChild;i.removeChild(t);n=e.lastChild}return n=e.lastChild,t.parentNode=e,t.previousSibling=n,t.nextSibling=null,n?n.nextSibling=t:e.firstChild=t,e.lastChild=t,ui(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new Yt(this,(function(t){var i=[];return si(t,(function(n){n===t||n.nodeType!=Lt||"*"!==e&&n.tagName!=e||i.push(n)})),i}))},getElementsByTagNameNS:function(e,t){return new Yt(this,(function(i){var n=[];return si(i,(function(r){r===i||r.nodeType!==Lt||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||n.push(r)})),n}))}},ai.prototype.getElementsByTagName=hi.prototype.getElementsByTagName,ai.prototype.getElementsByTagNameNS=hi.prototype.getElementsByTagNameNS,It(hi,ni),di.prototype.nodeType=Ot,It(di,ni),pi.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(Wt[zt])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},It(pi,ni),fi.prototype={nodeName:"#text",nodeType:Dt,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},It(fi,pi),mi.prototype={nodeName:"#comment",nodeType:Bt},It(mi,pi),gi.prototype={nodeName:"#cdata-section",nodeType:Nt},It(gi,pi),vi.prototype.nodeType=Ft,It(vi,ni),yi.prototype.nodeType=Ht,It(yi,ni),_i.prototype.nodeType=Ut,It(_i,ni),bi.prototype.nodeType=Rt,It(bi,ni),Ti.prototype.nodeName="#document-fragment",Ti.prototype.nodeType=Vt,It(Ti,ni),Si.prototype.nodeType=Mt,It(Si,ni),ki.prototype.serializeToString=function(e,t,i){return Ci.call(e,t,i)},ni.prototype.toString=Ci;try{if(Object.defineProperty){Object.defineProperty(Yt.prototype,"length",{get:function(){return Qt(this),this.$$length}}),Object.defineProperty(ni.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case Lt:case Vt:var i=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&i.push(e(t)),t=t.nextSibling;return i.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case Lt:case Vt:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),xi=function(e,t,i){e["$$"+t]=i}}}catch(e){}var Ai,Ii,Pi,Li,Oi,Di,Ni,Ri={DOMImplementation:ii,XMLSerializer:ki},Ui=Q((function(e,t){function i(e){this.options=e||{locator:{}}}function n(){this.cdata=!1}function r(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function s(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function a(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function o(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}i.prototype.parseFromString=function(e,t){var i=this.options,r=new u,a=i.domBuilder||new n,o=i.errorHandler,l=i.locator,c=i.xmlns||{},h={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return l&&a.setDocumentLocator(l),r.errorHandler=function(e,t,i){if(!e){if(t instanceof n)return t;e=t}var r={},a=e instanceof Function;function o(t){var n=e[t];!n&&a&&(n=2==e.length?function(i){e(t,i)}:e),r[t]=n&&function(e){n("[xmldom "+t+"]\t"+e+s(i))}||function(){}}return i=i||{},o("warning"),o("error"),o("fatalError"),r}(o,a,l),r.domBuilder=i.domBuilder||a,/\/x?html?$/.test(t)&&(h.nbsp=" ",h.copy="©",c[""]="http://www.w3.org/1999/xhtml"),c.xml=c.xml||"http://www.w3.org/XML/1998/namespace",e?r.parse(e,c,h):r.errorHandler.error("invalid doc source"),a.doc},n.prototype={startDocument:function(){this.doc=(new l).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,n){var s=this.doc,a=s.createElementNS(e,i||t),u=n.length;o(this,a),this.currentElement=a,this.locator&&r(this.locator,a);for(var l=0;l<u;l++){e=n.getURI(l);var c=n.getValue(l),h=(i=n.getQName(l),s.createAttributeNS(e,i));this.locator&&r(n.getLocator(l),h),h.value=h.nodeValue=c,a.setAttributeNode(h)}},endElement:function(e,t,i){var n=this.currentElement;n.tagName;this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var i=this.doc.createProcessingInstruction(e,t);this.locator&&r(this.locator,i),o(this,i)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){if(e=a.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(e);else n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&r(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=a.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&r(this.locator,n),o(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(e,t,i);this.locator&&r(this.locator,s),o(this,s)}},warning:function(e){console.warn("[xmldom warning]\t"+e,s(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,s(this.locator))},fatalError:function(e){throw console.error("[xmldom fatalError]\t"+e,s(this.locator)),e}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){n.prototype[e]=function(){return null}}));var u=xt.XMLReader,l=t.DOMImplementation=Ri.DOMImplementation;t.XMLSerializer=Ri.XMLSerializer,t.DOMParser=i})),Mi=(Ui.DOMImplementation,Ui.XMLSerializer,Ui.DOMParser),Bi=function(e){return!!e&&"object"==typeof e},ji=function e(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.reduce((function(t,i){return Object.keys(i).forEach((function(n){Array.isArray(t[n])&&Array.isArray(i[n])?t[n]=t[n].concat(i[n]):Bi(t[n])&&Bi(i[n])?t[n]=e(t[n],i[n]):t[n]=i[n]})),t}),{})},Fi=function(e){return e.reduce((function(e,t){return e.concat(t)}),[])},Vi=function(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t},Hi="INVALID_NUMBER_OF_PERIOD",qi="DASH_EMPTY_MANIFEST",Wi="DASH_INVALID_XML",zi="NO_BASE_URL",$i="SEGMENT_TIME_UNSPECIFIED",Gi="UNSUPPORTED_UTC_TIMING_SCHEME",Xi=function(e){var t=e.baseUrl,i=void 0===t?"":t,n=e.source,r=void 0===n?"":n,s=e.range,a=void 0===s?"":s,o=e.indexRange,u=void 0===o?"":o,l={uri:r,resolvedUri:lt(i||"",r)};if(a||u){var c=(a||u).split("-"),h=parseInt(c[0],10),d=parseInt(c[1],10);l.byterange={length:d-h+1,offset:h}}return l},Ki={static:function(e){var t=e.duration,i=e.timescale,n=void 0===i?1:i,r=e.sourceDuration;return{start:0,end:Math.ceil(r/(t/n))}},dynamic:function(e){var t=e.NOW,i=e.clientOffset,n=e.availabilityStartTime,r=e.timescale,s=void 0===r?1:r,a=e.duration,o=e.start,u=void 0===o?0:o,l=e.minimumUpdatePeriod,c=void 0===l?0:l,h=e.timeShiftBufferDepth,d=void 0===h?1/0:h,p=(t+i)/1e3,f=n+u,m=p+c-f,g=Math.ceil(m*s/a),v=Math.floor((p-f-d)*s/a),y=Math.floor((p-f)*s/a);return{start:Math.max(0,v),end:Math.min(g,y)}}},Yi=function(e){var t=e.type,i=void 0===t?"static":t,n=e.duration,r=e.timescale,s=void 0===r?1:r,a=e.sourceDuration,o=Ki[i](e),u=function(e,t){for(var i=[],n=e;n<t;n++)i.push(n);return i}(o.start,o.end).map(function(e){return function(t,i){var n=e.duration,r=e.timescale,s=void 0===r?1:r,a=e.periodIndex,o=e.startNumber;return{number:(void 0===o?1:o)+t,duration:n/s,timeline:a,time:i*n}}}(e));if("static"===i){var l=u.length-1;u[l].duration=a-n/s*l}return u},Qi=function(e){var t=e.baseUrl,i=e.initialization,n=void 0===i?{}:i,r=e.sourceDuration,s=e.timescale,a=void 0===s?1:s,o=e.indexRange,u=void 0===o?"":o,l=e.duration;if(!t)throw new Error(zi);var c=Xi({baseUrl:t,source:n.sourceURL,range:n.range}),h=Xi({baseUrl:t,source:t,indexRange:u});if(h.map=c,l){var d=Yi(e);d.length&&(h.duration=d[0].duration,h.timeline=d[0].timeline)}else r&&(h.duration=r/a,h.timeline=0);return h.number=0,[h]},Ji=function(e,t,i){for(var n=e.sidx.map?e.sidx.map:null,r=e.sidx.duration,s=e.timeline||0,a=e.sidx.byterange,o=a.offset+a.length,u=t.timescale,l=t.references.filter((function(e){return 1!==e.referenceType})),c=[],h=o+t.firstOffset,d=0;d<l.length;d++){var p=t.references[d],f=p.referencedSize,m=p.subsegmentDuration,g=Qi({baseUrl:i,timescale:u,timeline:s,periodIndex:s,duration:m,sourceDuration:r,indexRange:h+"-"+(h+f-1)})[0];n&&(g.map=n),c.push(g),h+=f}return e.segments=c,e},Zi=function(e){var t;return(t=e.reduce((function(e,t){var i,n=t.attributes.id+(t.attributes.lang||"");return e[n]?(t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[n].segments).push.apply(i,t.segments),t.attributes.contentProtection&&(e[n].attributes.contentProtection=t.attributes.contentProtection)):e[n]=t,e}),{}),Object.keys(t).map((function(e){return t[e]}))).map((function(e){var t,i;return e.discontinuityStarts=(t=e.segments,i="discontinuity",t.reduce((function(e,t,n){return t[i]&&e.push(n),e}),[])),e}))},en=function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e){var n=e[i];if(n.sidx){var r=n.sidx.uri+"-"+(a=n.sidx.byterange,o=void 0,o=a.offset+a.length-1,a.offset+"-"+o),s=t[r]&&t[r].sidx;n.sidx&&s&&Ji(n,s,n.sidx.resolvedUri)}}var a,o;return e},tn=function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,s={attributes:(t={NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(s.contentProtection=i.contentProtection),r&&(s.sidx=r),s},nn=function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,s={attributes:(t={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(s.contentProtection=i.contentProtection),r&&(s.sidx=r),s},rn=function(e,t){var i;if(void 0===t&&(t={}),!e.length)return{};var n=e[0].attributes,r=n.sourceDuration,s=n.type,a=void 0===s?"static":s,o=n.suggestedPresentationDelay,u=n.minimumUpdatePeriod,l=void 0===u?0:u,c=Zi(e.filter((function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType}))).map(nn),h=Zi(e.filter((function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType}))),d=e.filter((function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType})),p={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(i={AUDIO:{},VIDEO:{}},i["CLOSED-CAPTIONS"]={},i.SUBTITLES={},i),uri:"",duration:r,playlists:en(c,t),minimumUpdatePeriod:1e3*l};return"dynamic"===a&&(p.suggestedPresentationDelay=o),h.length&&(p.mediaGroups.AUDIO.audio=function(e,t){var i;void 0===t&&(t={});var n=e.reduce((function(e,n){var r=n.attributes.role&&n.attributes.role.value||"",s=n.attributes.lang||"",a="main";if(s){var o=r?" ("+r+")":"";a=""+n.attributes.lang+o}return e[a]&&e[a].playlists[0].attributes.BANDWIDTH>n.attributes.bandwidth||(e[a]={language:s,autoselect:!0,default:"main"===r,playlists:en([tn(n)],t),uri:""},void 0===i&&"main"===r&&((i=n).default=!0)),e}),{});i||(n[Object.keys(n)[0]].default=!0);return n}(h,t)),d.length&&(p.mediaGroups.SUBTITLES.subs=function(e,t){return void 0===t&&(t={}),e.reduce((function(e,i){var n,r,s,a,o=i.attributes.lang||"text";return e[o]||(e[o]={language:o,default:!1,autoselect:!1,playlists:en([(n=i,s=n.attributes,a=n.segments,void 0===a&&(a=[{uri:s.baseUrl,timeline:s.periodIndex,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration),{attributes:(r={NAME:s.id,BANDWIDTH:s.bandwidth},r["PROGRAM-ID"]=1,r),uri:"",endList:"static"===(s.type||"static"),timeline:s.periodIndex,resolvedUri:s.baseUrl||"",targetDuration:s.duration,segments:a,mediaSequence:a.length?a[0].number:1})],t),uri:""}),e}),{})}(d,t)),p},sn=function(e,t,i){var n=e.NOW,r=e.clientOffset,s=e.availabilityStartTime,a=e.timescale,o=void 0===a?1:a,u=e.start,l=void 0===u?0:u,c=e.minimumUpdatePeriod,h=(n+r)/1e3+(void 0===c?0:c)-(s+l);return Math.ceil((h*o-t)/i)},an=function(e,t){for(var i=e.type,n=void 0===i?"static":i,r=e.minimumUpdatePeriod,s=void 0===r?0:r,a=e.media,o=void 0===a?"":a,u=e.sourceDuration,l=e.timescale,c=void 0===l?1:l,h=e.startNumber,d=void 0===h?1:h,p=e.periodIndex,f=[],m=-1,g=0;g<t.length;g++){var v=t[g],y=v.d,_=v.r||0,b=v.t||0;m<0&&(m=b),b&&b>m&&(m=b);var T=void 0;if(_<0){var S=g+1;T=S===t.length?"dynamic"===n&&s>0&&o.indexOf("$Number$")>0?sn(e,m,y):(u*c-m)/y:(t[S].t-m)/y}else T=_+1;for(var k=d+f.length+T,C=d+f.length;C<k;)f.push({number:C,duration:y/c,time:m,timeline:p}),m+=y,C++}return f},on=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,un=function(e,t){return e.replace(on,function(e){return function(t,i,n,r){if("$$"===t)return"$";if(void 0===e[i])return t;var s=""+e[i];return"RepresentationID"===i?s:(r=n?parseInt(r,10):1,s.length>=r?s:""+new Array(r-s.length+1).join("0")+s)}}(t))},ln=function(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,s=Xi({baseUrl:e.baseUrl,source:un(r.sourceURL,i),range:r.range});return function(e,t){return e.duration||t?e.duration?Yi(e):an(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}(e,t).map((function(t){i.Number=t.number,i.Time=t.time;var n=un(e.media||"",i);return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:lt(e.baseUrl||"",n),map:s,number:t.number}}))},cn=function(e,t){var i=e.duration,n=e.segmentUrls,r=void 0===n?[]:n;if(!i&&!t||i&&t)throw new Error($i);var s,a=r.map((function(t){return function(e,t){var i=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,s=Xi({baseUrl:i,source:r.sourceURL,range:r.range}),a=Xi({baseUrl:i,source:t.media,range:t.mediaRange});return a.map=s,a}(e,t)}));return i&&(s=Yi(e)),t&&(s=an(e,t)),s.map((function(e,t){if(a[t]){var i=a[t];return i.timeline=e.timeline,i.duration=e.duration,i.number=e.number,i}})).filter((function(e){return e}))},hn=function(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=ln,t=ji(n,r.template)):r.base?(i=Qi,t=ji(n,r.base)):r.list&&(i=cn,t=ji(n,r.list));var s={attributes:n};if(!i)return s;var a=i(t,r.timeline);if(t.duration){var o=t,u=o.duration,l=o.timescale,c=void 0===l?1:l;t.duration=u/c}else a.length?t.duration=a.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0;return s.attributes=t,s.segments=a,r.base&&t.indexRange&&(s.sidx=a[0],s.segments=[]),s},dn=function(e,t){return Vi(e.childNodes).filter((function(e){return e.tagName===t}))},pn=function(e){return e.textContent.trim()},fn=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),n=i[0],r=i[1],s=i[2],a=i[3],o=i[4],u=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(s||0)+3600*parseFloat(a||0)+60*parseFloat(o||0)+parseFloat(u||0)},mn={mediaPresentationDuration:function(e){return fn(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return fn(e)},suggestedPresentationDelay:function(e){return fn(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return fn(e)},start:function(e){return fn(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?fn(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},gn=function(e){return e&&e.attributes?Vi(e.attributes).reduce((function(e,t){var i=mn[t.name]||mn.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}},vn={"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"},yn=function(e,t){return t.length?Fi(e.map((function(e){return t.map((function(t){return lt(e,pn(t))}))}))):e},_n=function(e){var t=dn(e,"SegmentTemplate")[0],i=dn(e,"SegmentList")[0],n=i&&dn(i,"SegmentURL").map((function(e){return ji({tag:"SegmentURL"},gn(e))})),r=dn(e,"SegmentBase")[0],s=i||t,a=s&&dn(s,"SegmentTimeline")[0],o=i||r||t,u=o&&dn(o,"Initialization")[0],l=t&&gn(t);l&&u?l.initialization=u&&gn(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,timeline:a&&dn(a,"S").map((function(e){return gn(e)})),list:i&&ji(gn(i),{segmentUrls:n,initialization:gn(u)}),base:r&&ji(gn(r),{initialization:gn(u)})};return Object.keys(c).forEach((function(e){c[e]||delete c[e]})),c},bn=function(e,t,i){return function(n){var r=gn(n),s=yn(t,dn(n,"BaseURL")),a=dn(n,"Role")[0],o={role:gn(a)},u=ji(e,r,o),l=dn(n,"ContentProtection").reduce((function(e,t){var i=gn(t),n=vn[i.schemeIdUri];if(n){e[n]={attributes:i};var r=dn(t,"cenc:pssh")[0];if(r){var s=pn(r),a=s&&dt(s);e[n].pssh=a}}return e}),{});Object.keys(l).length&&(u=ji(u,{contentProtection:l}));var c=_n(n),h=dn(n,"Representation"),d=ji(i,c);return Fi(h.map(function(e,t,i){return function(n){var r=dn(n,"BaseURL"),s=yn(t,r),a=ji(e,gn(n)),o=_n(n);return s.map((function(e){return{segmentInfo:ji(i,o),attributes:ji(a,{baseUrl:e})}}))}}(u,s,d)))}},Tn=function(e,t){void 0===t&&(t={});var i=t,n=i.manifestUri,r=void 0===n?"":n,s=i.NOW,a=void 0===s?Date.now():s,o=i.clientOffset,u=void 0===o?0:o,l=dn(e,"Period");if(!l.length)throw new Error(Hi);var c=gn(e),h=yn([r],dn(e,"BaseURL"));return c.sourceDuration=c.mediaPresentationDuration||0,c.NOW=a,c.clientOffset=u,Fi(l.map(function(e,t){return function(i,n){var r=yn(t,dn(i,"BaseURL")),s=gn(i),a=parseInt(s.id,10),o=ee.isNaN(a)?n:a,u=ji(e,{periodIndex:o}),l=dn(i,"AdaptationSet"),c=_n(i);return Fi(l.map(bn(u,r,c)))}}(c,h)))},Sn=function(e){if(""===e)throw new Error(qi);var t=(new Mi).parseFromString(e,"application/xml"),i=t&&"MPD"===t.documentElement.tagName?t.documentElement:null;if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(Wi);return i},kn=function(e,t){return void 0===t&&(t={}),rn(Tn(Sn(e),t).map(hn),t.sidxMapping)},Cn=function(e){return function(e){var t=dn(e,"UTCTiming")[0];if(!t)return null;var i=gn(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.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":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.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(Gi)}return i}(Sn(e))},wn=function(e){return e>>>0},En=function(e){return("00"+e.toString(16)).slice(-2)},xn=wn,An=function(e){return new Date(1e3*e-20828448e5)},In=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Pn=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},Ln=function(e,t){var i,n,r,s,a,o=[];if(!t.length)return null;for(i=0;i<e.byteLength;)n=xn(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]),r=Pn(e.subarray(i+4,i+8)),s=n>1?i+n:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(i+8,s)):(a=Ln(e.subarray(i+8,s),t.slice(1))).length&&(o=o.concat(a))),i=s;return o},On=function(e){var t,i,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(t=0;t+4<e.length;t+=i)if(i=n.getUint32(t),t+=4,i<=0)r.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&e[t]){case 1:r.push("slice_layer_without_partitioning_rbsp");break;case 5:r.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:r.push("sei_rbsp");break;case 7:r.push("seq_parameter_set_rbsp");break;case 8:r.push("pic_parameter_set_rbsp");break;case 9:r.push("access_unit_delimiter_rbsp");break;default:r.push("UNKNOWN NAL - "+e[t]&31)}return r},Dn={avc1:function(e){var t=new DataView(e.buffer,e.byteOffset,e.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:Ai(e.subarray(78,e.byteLength))}},avcC:function(e){var t,i,n,r,s=new DataView(e.buffer,e.byteOffset,e.byteLength),a={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},o=31&e[5];for(n=6,r=0;r<o;r++)i=s.getUint16(n),n+=2,a.sps.push(new Uint8Array(e.subarray(n,n+i))),n+=i;for(t=e[n],n++,r=0;r<t;r++)i=s.getUint16(n),n+=2,a.pps.push(new Uint8Array(e.subarray(n,n+i))),n+=i;return a},btrt:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},esds:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),esId:e[6]<<8|e[7],streamPriority:31&e[8],decoderConfig:{objectProfileIndication:e[11],streamType:e[12]>>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[26]>>>3&31,samplingFrequencyIndex:(7&e[26])<<1|e[27]>>>7&1,channelConfiguration:e[27]>>>3&15}}}},ftyp:function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={majorBrand:Pn(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},n=8;n<e.byteLength;)i.compatibleBrands.push(Pn(e.subarray(n,n+4))),n+=4;return i},dinf:function(e){return{boxes:Ai(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:Ai(e.subarray(8))}},hdlr:function(e){var t={version:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0),flags:new Uint8Array(e.subarray(1,4)),handlerType:Pn(e.subarray(8,12)),name:""},i=8;for(i=24;i<e.byteLength;i++){if(0===e[i]){i++;break}t.name+=String.fromCharCode(e[i])}return t.name=decodeURIComponent(escape(t.name)),t},mdat:function(e){return{byteLength:e.byteLength,nals:On(e)}},mdhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,r={version:i.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return 1===r.version?(n+=4,r.creationTime=An(i.getUint32(n)),n+=8,r.modificationTime=An(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=8,r.duration=i.getUint32(n)):(r.creationTime=An(i.getUint32(n)),n+=4,r.modificationTime=An(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=4,r.duration=i.getUint32(n)),n+=4,t=i.getUint16(n),r.language+=String.fromCharCode(96+(t>>10)),r.language+=String.fromCharCode(96+((992&t)>>5)),r.language+=String.fromCharCode(96+(31&t)),r},mdia:function(e){return{boxes:Ai(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:Ai(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(i.streamDescriptor=Ai(e.subarray(28))[0]),i},moof:function(e){return{boxes:Ai(e)}},moov:function(e){return{boxes:Ai(e)}},mvex:function(e){return{boxes:Ai(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,n={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=An(t.getUint32(i)),i+=8,n.modificationTime=An(t.getUint32(i)),i+=4,n.timescale=t.getUint32(i),i+=8,n.duration=t.getUint32(i)):(n.creationTime=An(t.getUint32(i)),i+=4,n.modificationTime=An(t.getUint32(i)),i+=4,n.timescale=t.getUint32(i),i+=4,n.duration=t.getUint32(i)),i+=4,n.rate=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,n.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=t.getUint32(i),n},pdin:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t<e.byteLength;t++)i.samples.push({dependsOn:(48&e[t])>>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return i},sidx:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},r=i.getUint16(22);for(t=24;r;t+=12,r--)n.references.push({referenceType:(128&e[t])>>>7,referencedSize:2147483647&i.getUint32(t),subsegmentDuration:i.getUint32(t+4),startsWithSap:!!(128&e[t+8]),sapType:(112&e[t+8])>>>4,sapDeltaTime:268435455&i.getUint32(t+8)});return n},smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:Ai(e)}},stco:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},r=i.getUint32(4);for(t=8;r;t+=4,r--)n.chunkOffsets.push(i.getUint32(t));return n},stsc:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n=i.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;n;t+=12,n--)r.sampleToChunks.push({firstChunk:i.getUint32(t),samplesPerChunk:i.getUint32(t+4),sampleDescriptionIndex:i.getUint32(t+8)});return r},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:Ai(e.subarray(8))}},stsz:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(t=12;t<e.byteLength;t+=4)n.entries.push(i.getUint32(t));return n},stts:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},r=i.getUint32(4);for(t=8;r;t+=8,r--)n.timeToSamples.push({sampleCount:i.getUint32(t),sampleDelta:i.getUint32(t+4)});return n},styp:function(e){return Dn.ftyp(e)},tfdt:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:xn(e[4]<<24|e[5]<<16|e[6]<<8|e[7])};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=xn(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),t},tfhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],s=2&n.flags[2],a=8&n.flags[2],o=16&n.flags[2],u=32&n.flags[2],l=65536&n.flags[0],c=131072&n.flags[0];return t=8,r&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),s&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),a&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),u&&(n.defaultSampleFlags=i.getUint32(t)),l&&(n.durationIsEmpty=!0),!r&&c&&(n.baseDataOffsetIsMoof=!0),n},tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,n={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=An(t.getUint32(i)),i+=8,n.modificationTime=An(t.getUint32(i)),i+=4,n.trackId=t.getUint32(i),i+=4,i+=8,n.duration=t.getUint32(i)):(n.creationTime=An(t.getUint32(i)),i+=4,n.modificationTime=An(t.getUint32(i)),i+=4,n.trackId=t.getUint32(i),i+=4,i+=4,n.duration=t.getUint32(i)),i+=4,i+=8,n.layer=t.getUint16(i),i+=2,n.alternateGroup=t.getUint16(i),i+=2,n.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,n.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,n.width=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,n.height=t.getUint16(i)+t.getUint16(i+2)/16,n},traf:function(e){return{boxes:Ai(e)}},trak:function(e){return{boxes:Ai(e)}},trex:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:3&e[20],sampleIsDependedOn:(192&e[21])>>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],s=4&i.flags[2],a=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],c=n.getUint32(4),h=8;for(r&&(i.dataOffset=n.getInt32(h),h+=4),s&&c&&(t={flags:In(e.subarray(h,h+4))},h+=4,a&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),l&&(t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t),c--);c--;)t={},a&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),u&&(t.flags=In(e.subarray(h,h+4)),h+=4),l&&(t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t);return i},"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}},Nn={inspect:Ai=function(e){for(var t,i,n,r,s,a=0,o=[],u=new ArrayBuffer(e.length),l=new Uint8Array(u),c=0;c<e.length;++c)l[c]=e[c];for(t=new DataView(u);a<e.byteLength;)i=t.getUint32(a),n=Pn(e.subarray(a+4,a+8)),r=i>1?a+i:e.byteLength,(s=(Dn[n]||function(e){return{data:e}})(e.subarray(a+8,r))).size=i,s.type=n,o.push(s),a=r;return o},textify:Ii=function(e,t){var i;return t=t||0,i=new Array(2*t+1).join(" "),e.map((function(e,n){return i+e.type+"\n"+Object.keys(e).filter((function(e){return"type"!==e&&"boxes"!==e})).map((function(t){var n=i+" "+t+": ",r=e[t];if(r instanceof Uint8Array||r instanceof Uint32Array){var s=Array.prototype.slice.call(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map((function(e){return" "+("00"+e.toString(16)).slice(-2)})).join("").match(/.{1,24}/g);return s?1===s.length?n+"<"+s.join("").slice(1)+">":n+"<\n"+s.map((function(e){return i+" "+e})).join("\n")+"\n"+i+" >":n+"<>"}return n+JSON.stringify(r,null,2).split("\n").map((function(e,t){return 0===t?e:i+" "+e})).join("\n")})).join("\n")+(e.boxes?"\n"+Ii(e.boxes,t+1):"")})).join("\n")},parseType:Pn,findBox:Ln,parseTraf:Dn.traf,parseTfdt:Dn.tfdt,parseHdlr:Dn.hdlr,parseTfhd:Dn.tfhd,parseTrun:Dn.trun,parseSidx:Dn.sidx},Rn=wn,Un=En;Pi=function(e){return Nn.findBox(e,["moov","trak"]).reduce((function(e,t){var i,n,r,s,a;return(i=Nn.findBox(t,["tkhd"])[0])?(n=i[0],s=Rn(i[r=0===n?12:20]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3]),(a=Nn.findBox(t,["mdia","mdhd"])[0])?(r=0===(n=a[0])?12:20,e[s]=Rn(a[r]<<24|a[r+1]<<16|a[r+2]<<8|a[r+3]),e):null):null}),{})},Li=function(e,t){var i,n,r;return i=Nn.findBox(t,["moof","traf"]),n=[].concat.apply([],i.map((function(t){return Nn.findBox(t,["tfhd"]).map((function(i){var n,r;return n=Rn(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),r=e[n]||9e4,(Nn.findBox(t,["tfdt"]).map((function(e){var t,i;return t=e[0],i=Rn(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=Rn(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),i}))[0]||1/0)/r}))}))),r=Math.min.apply(null,n),isFinite(r)?r:0},Oi=function(e,t){var i,n=Nn.findBox(t,["moof","traf"]),r=0,s=0;if(n&&n.length)for(var a=Nn.parseTraf(n[0]),o=0;o<a.boxes.length;o++)"tfhd"===a.boxes[o].type?i=a.boxes[o].trackId:"tfdt"===a.boxes[o].type?r=a.boxes[o].baseMediaDecodeTime:"trun"===a.boxes[o].type&&a.boxes[o].samples.length&&(s=a.boxes[o].samples[0].compositionTimeOffset||0);return(r+s)/(e[i]||9e4)},Di=function(e){var t=Nn.findBox(e,["moov","trak"]),i=[];return t.forEach((function(e){var t=Nn.findBox(e,["mdia","hdlr"]),n=Nn.findBox(e,["tkhd"]);t.forEach((function(e,t){var r,s,a=Nn.parseType(e.subarray(8,12)),o=n[t];"vide"===a&&(s=0===(r=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?r.getUint32(12):r.getUint32(20),i.push(s))}))})),i},Ni=function(e){var t=Nn.findBox(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,n,r={},s=Nn.findBox(e,["tkhd"])[0];s&&(n=(t=new DataView(s.buffer,s.byteOffset,s.byteLength)).getUint8(0),r.id=0===n?t.getUint32(12):t.getUint32(20));var a=Nn.findBox(e,["mdia","hdlr"])[0];if(a){var o=Nn.parseType(a.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var u=Nn.findBox(e,["mdia","minf","stbl","stsd"])[0];if(u){var l=u.subarray(8);r.codec=Nn.parseType(l.subarray(4,8));var c,h=Nn.findBox(l,[r.codec])[0];h&&(/^[a-z]vc[1-9]$/i.test(r.codec)?(c=h.subarray(78),"avcC"===Nn.parseType(c.subarray(4,8))&&c.length>11?(r.codec+=".",r.codec+=Un(c[9]),r.codec+=Un(c[10]),r.codec+=Un(c[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)&&(c=h.subarray(28),"esds"===Nn.parseType(c.subarray(4,8))&&c.length>20&&0!==c[19]?(r.codec+="."+Un(c[19]),r.codec+="."+Un(c[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"))}var d=Nn.findBox(e,["mdia","mdhd"])[0];if(d&&s){var p=0===n?12:20;r.timescale=Rn(d[p]<<24|d[p+1]<<16|d[p+2]<<8|d[p+3])}i.push(r)})),i};var Mn={findBox:Nn.findBox,parseType:Nn.parseType,timescale:Pi,startTime:Li,compositionStartTime:Oi,videoTrackIds:Di,tracks:Ni},Bn=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}t+=r,n=0,r=0}return i},jn=function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},Fn=function(e,t){var i,n,r,s,a=[];if(!(64&t[0]))return a;for(n=31&t[0],i=0;i<n;i++)s={type:3&t[(r=3*i)+2],pts:e},4&t[r+2]&&(s.ccData=t[r+3]<<8|t[r+4],a.push(s));return a},Vn=function(e){for(var t,i,n=e.byteLength,r=[],s=1;s<n-2;)0===e[s]&&0===e[s+1]&&3===e[s+2]?(r.push(s+2),s+=2):s++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var a=0;for(s=0;s<t;a++,s++)a===r[0]&&(a++,r.shift()),i[s]=e[a];return i},Hn=4,qn=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,r,s;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(s=[],n=arguments.length,n=1;n<arguments.length;++n)s.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,s)}},this.dispose=function(){e={}}}};qn.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},qn.prototype.push=function(e){this.trigger("data",e)},qn.prototype.flush=function(e){this.trigger("done",e)},qn.prototype.partialFlush=function(e){this.trigger("partialdone",e)},qn.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},qn.prototype.reset=function(e){this.trigger("reset",e)};var Wn=qn,zn=function(){zn.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new Yn(0,0),new Yn(0,1),new Yn(1,0),new Yn(1,1)],this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this)};zn.prototype=new Wn,zn.prototype.push=function(e){var t,i,n;if("sei_rbsp"===e.nalUnitType&&(t=Bn(e.escapedRBSP)).payloadType===Hn&&(i=jn(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=Fn(e.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},zn.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},zn.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2&&this.dispatchCea608Packet(e)}),this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},zn.prototype.flush=function(){return this.flushStream("flush")},zn.prototype.partialFlush=function(){return this.flushStream("partialFlush")},zn.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},zn.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},zn.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},zn.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},zn.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var $n={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},Gn=function(e){return null===e?"":(e=$n[e]||e,String.fromCharCode(e))},Xn=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Kn=function(){for(var e=[],t=15;t--;)e.push("");return e},Yn=function(e,t){Yn.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,s;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(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);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Kn();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Kn();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Kn()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))s=Gn((n=(3&n)<<8)|r),this[this.mode_](e.pts,s),this.column_++;else if(this.isExtCharacter(n,r))"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),s=Gn((n=(3&n)<<8)|r),this[this.mode_](e.pts,s),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var a=Xn.indexOf(7968&t);"rollUp"===this.mode_&&(a-this.rollUpRows_+1<0&&(a=this.rollUpRows_-1),this.setRollUp(e.pts,a)),a!==this.row_&&(this.clearFormatting(e.pts),this.row_=a),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),s=Gn(n),s+=Gn(r),this[this.mode_](e.pts,s),this.column_+=s.length)}else this.lastControlCode_=null}};Yn.prototype=new Wn,Yn.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e){try{return e.trim()}catch(e){return console.error("Skipping malformed caption."),""}})).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},Yn.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Kn(),this.nonDisplayed_=Kn(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Yn.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_},Yn.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Yn.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Yn.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Yn.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Yn.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},Yn.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Yn.prototype.isNormalChar=function(e){return e>=32&&e<=127},Yn.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Kn(),this.displayed_=Kn()),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},Yn.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce((function(e,t){return e+"<"+t+">"}),"");this[this.mode_](e,i)},Yn.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),"");this.formatting_=[],this[this.mode_](e,t)}},Yn.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Yn.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Yn.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},Yn.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var Qn=Vn,Jn={CaptionStream:zn,Cea608Stream:Yn}.CaptionStream,Zn=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=t[n];if(i<r.size)return r;i-=r.size}return null},er=function(e,t){var i=Mn.findBox(e,["moof","traf"]),n=Mn.findBox(e,["mdat"]),r={},s=[];return n.forEach((function(e,t){var n=i[t];s.push({mdat:e,traf:n})})),s.forEach((function(e){var i,n=e.mdat,s=e.traf,a=Mn.findBox(s,["tfhd"]),o=Nn.parseTfhd(a[0]),u=o.trackId,l=Mn.findBox(s,["tfdt"]),c=l.length>0?Nn.parseTfdt(l[0]).baseMediaDecodeTime:0,h=Mn.findBox(s,["trun"]);t===u&&h.length>0&&(i=function(e,t,i){var n,r,s,a,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u=[];for(r=0;r+4<e.length;r+=s)if(s=o.getUint32(r),r+=4,!(s<=0))switch(31&e[r]){case 6:var l=e.subarray(r+1,r+1+s),c=Zn(r,t);n={nalUnitType:"sei_rbsp",size:s,data:l,escapedRBSP:Qn(l),trackId:i},c?(n.pts=c.pts,n.dts=c.dts,a=c):(n.pts=a.pts,n.dts=a.dts),u.push(n)}return u}(n,function(e,t,i){var n=t,r=i.defaultSampleDuration||0,s=i.defaultSampleSize||0,a=i.trackId,o=[];return e.forEach((function(e){var t=Nn.parseTrun(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=s),e.trackId=a,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=n+e.compositionTimeOffset,n+=e.duration})),o=o.concat(t)})),o}(h,c,o),u),r[u]||(r[u]=[]),r[u]=r[u].concat(i))})),r},tr=function(){var e,t,i,n,r,s,a=!1;this.isInitialized=function(){return a},this.init=function(t){e=new Jn,a=!0,s=!!t&&t.isPartial,e.on("data",(function(e){e.startTime=e.startPts/n,e.endTime=e.endPts/n,r.captions.push(e),r.captionStreams[e.stream]=!0}))},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length)&&(i!==e[0]||n!==t[i])},this.parse=function(e,s,a){var o;if(!this.isInitialized())return null;if(!s||!a)return null;if(this.isNewInit(s,a))i=s[0],n=a[i];else if(null===i||!n)return t.push(e),null;for(;t.length>0;){var u=t.shift();this.parse(u,s,a)}return null!==(o=function(e,t,i){return null===t?null:{seiNals:er(e,t)[t],timescale:i}}(e,i,n))&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;s?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()},ir=27,nr=15,rr=21,sr=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},ar=function(e){var t,i;ar.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=sr(e.dts,i),e.pts=sr(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){i=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};ar.prototype=new Wn;var or,ur,lr,cr,hr=function(e){var t=31&e[1];return t<<=8,t|=e[2]},dr=function(e){return!!(64&e[1])},pr=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},fr=function(e){switch(e){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}},mr={parseType:function(e,t){var i=hr(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=dr(e),i=4+pr(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=dr(e),n=4+pr(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var s=12+((15&e[n+10])<<8|e[n+11]);s<r;){var a=n+s;t[(31&e[a+1])<<8|e[a+2]]=e[a],s+=5+((15&e[a+3])<<8|e[a+4])}return t}},parsePayloadUnitStartIndicator:dr,parsePesType:function(e,t){switch(t[hr(e)]){case ir:return"video";case nr:return"audio";case rr:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!dr(e))return null;var t=4+pr(e);if(t>=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+pr(e),i=e.subarray(t),n=0,r=0,s=!1;r<i.byteLength-3;r++)if(1===i[r+2]){n=r+5;break}for(;n<i.byteLength;)switch(i[n]){case 0:if(0!==i[n-1]){n+=2;break}if(0!==i[n-2]){n++;break}r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===fr(31&i[r+3])&&(s=!0);do{n++}while(1!==i[n]&&n<i.length);r=n-2,n+=3;break;case 1:if(0!==i[n-1]||0!==i[n-2]){n+=3;break}"slice_layer_without_partitioning_rbsp_idr"===fr(31&i[r+3])&&(s=!0),r=n-2,n+=3;break;default:n+=3}return i=i.subarray(r),n-=r,r=0,i&&i.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===fr(31&i[r+3])&&(s=!0),s}},gr=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],vr=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},yr={isLikelyAacData:function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},parseId3TagSize:function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?i+20:i+10},parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return gr[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=vr(e.subarray(10,14)));do{if((i=vr(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r<n.byteLength;r++)if(0===n[r]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r}(n,0,r))){var s=n.subarray(r+1),a=(1&s[3])<<30|s[4]<<22|s[5]<<14|s[6]<<6|s[7]>>>2;return a*=4,a+=3&s[7]}break}}t+=10,t+=i}while(t<e.byteLength);return null}};var _r=9e4,br=(or=function(e){return 9e4*e},ur=function(e,t){return e*t},lr=function(e){return e/9e4},cr=function(e,t){return e/t},sr),Tr={};Tr.ts=mr,Tr.aac=yr;var Sr=_r,kr=function(e,t,i){for(var n,r,s,a,o=0,u=188,l=!1;u<=e.byteLength;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o++,u++;else{switch(n=e.subarray(o,u),Tr.ts.parseType(n,t.pid)){case"pes":r=Tr.ts.parsePesType(n,t.table),s=Tr.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&s&&(a=Tr.ts.parsePesTime(n))&&(a.type="audio",i.audio.push(a),l=!0)}if(l)break;o+=188,u+=188}for(o=(u=e.byteLength)-188,l=!1;o>=0;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o--,u--;else{switch(n=e.subarray(o,u),Tr.ts.parseType(n,t.pid)){case"pes":r=Tr.ts.parsePesType(n,t.table),s=Tr.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&s&&(a=Tr.ts.parsePesTime(n))&&(a.type="audio",i.audio.push(a),l=!0)}if(l)break;o-=188,u-=188}},Cr=function(e,t,i){for(var n,r,s,a,o,u,l,c=0,h=188,d=!1,p={data:[],size:0};h<e.byteLength;)if(71!==e[c]||71!==e[h])c++,h++;else{switch(n=e.subarray(c,h),Tr.ts.parseType(n,t.pid)){case"pes":if(r=Tr.ts.parsePesType(n,t.table),s=Tr.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(s&&!d&&(a=Tr.ts.parsePesTime(n))&&(a.type="video",i.video.push(a),d=!0),!i.firstKeyFrame)){if(s&&0!==p.size){for(o=new Uint8Array(p.size),u=0;p.data.length;)l=p.data.shift(),o.set(l,u),u+=l.byteLength;if(Tr.ts.videoPacketContainsKeyFrame(o)){var f=Tr.ts.parsePesTime(o);f?(i.firstKeyFrame=f,i.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}p.size=0}p.data.push(n),p.size+=n.byteLength}}if(d&&i.firstKeyFrame)break;c+=188,h+=188}for(c=(h=e.byteLength)-188,d=!1;c>=0;)if(71!==e[c]||71!==e[h])c--,h--;else{switch(n=e.subarray(c,h),Tr.ts.parseType(n,t.pid)){case"pes":r=Tr.ts.parsePesType(n,t.table),s=Tr.ts.parsePayloadUnitStartIndicator(n),"video"===r&&s&&(a=Tr.ts.parsePesTime(n))&&(a.type="video",i.video.push(a),d=!0)}if(d)break;c-=188,h-=188}},wr=function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=188;r<e.byteLength;)if(71!==e[n]||71!==e[r])n++,r++;else{switch(i=e.subarray(n,r),Tr.ts.parseType(i,t.pid)){case"pat":t.pid||(t.pid=Tr.ts.parsePat(i));break;case"pmt":t.table||(t.table=Tr.ts.parsePmt(i))}if(t.pid&&t.table)return;n+=188,r+=188}}(e,t),t.table){if(t.table.hasOwnProperty(n))switch(t.table[n]){case ir:i.video=[],Cr(e,t,i),0===i.video.length&&delete i.video;break;case nr:i.audio=[],kr(e,t,i),0===i.audio.length&&delete i.audio}}return i},Er=function(e,t){var i;return(i=Tr.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,s=null,a=0,o=0;e.length-o>=3;){switch(Tr.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((a=Tr.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===s&&(t=e.subarray(o,o+a),s=Tr.aac.parseAacTimestamp(t)),o+=a;break;case"audio":if(e.length-o<7){i=!0;break}if((a=Tr.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+a),r=Tr.aac.parseSampleRate(t)),n++,o+=a;break;default:o++}if(i)return null}if(null===r||null===s)return null;var u=Sr/r;return{audio:[{type:"audio",dts:s,pts:s},{type:"audio",dts:s+1024*n*u,pts:s+1024*n*u}]}}(e):wr(e))&&(i.audio||i.video)?(function(e,t){if(e.audio&&e.audio.length){var i=t;void 0===i&&(i=e.audio[0].dts),e.audio.forEach((function(e){e.dts=br(e.dts,i),e.pts=br(e.pts,i),e.dtsTime=e.dts/Sr,e.ptsTime=e.pts/Sr}))}if(e.video&&e.video.length){var n=t;if(void 0===n&&(n=e.video[0].dts),e.video.forEach((function(e){e.dts=br(e.dts,n),e.pts=br(e.pts,n),e.dtsTime=e.dts/Sr,e.ptsTime=e.pts/Sr})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=br(r.dts,n),r.pts=br(r.pts,n),r.dtsTime=r.dts/Sr,r.ptsTime=r.dts/Sr}}}(i,t),i):null};var xr=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Ar=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),Ir=null,Pr=function(){function e(t){xr(this,e),Ir||(Ir=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],n=t[4],r=i[4],s=void 0,a=void 0,o=void 0,u=[],l=[],c=void 0,h=void 0,d=void 0,p=void 0,f=void 0;for(s=0;s<256;s++)l[(u[s]=s<<1^283*(s>>7))^s]=s;for(a=o=0;!n[a];a^=c||1,o=l[o]||1)for(d=(d=o^o<<1^o<<2^o<<3^o<<4)>>8^255&d^99,n[a]=d,r[d]=a,f=16843009*u[h=u[c=u[a]]]^65537*h^257*c^16843008*a,p=257*u[d]^16843008*d,s=0;s<4;s++)t[s][a]=p=p<<24^p>>>8,i[s][d]=f=f<<24^f>>>8;for(s=0;s<5;s++)t[s]=t[s].slice(0),i[s]=i[s].slice(0);return e}()),this._tables=[[Ir[0][0].slice(),Ir[0][1].slice(),Ir[0][2].slice(),Ir[0][3].slice(),Ir[0][4].slice()],[Ir[1][0].slice(),Ir[1][1].slice(),Ir[1][2].slice(),Ir[1][3].slice(),Ir[1][4].slice()]];var i=void 0,n=void 0,r=void 0,s=void 0,a=void 0,o=this._tables[0][4],u=this._tables[1],l=t.length,c=1;if(4!==l&&6!==l&&8!==l)throw new Error("Invalid aes key size");for(s=t.slice(0),a=[],this._key=[s,a],i=l;i<4*l+28;i++)r=s[i-1],(i%l==0||8===l&&i%l==4)&&(r=o[r>>>24]<<24^o[r>>16&255]<<16^o[r>>8&255]<<8^o[255&r],i%l==0&&(r=r<<8^r>>>24^c<<24,c=c<<1^283*(c>>7))),s[i]=s[i-l]^r;for(n=0;i;n++,i--)r=s[3&n?i:i-4],a[n]=i<=4||n<4?r:u[0][o[r>>>24]]^u[1][o[r>>16&255]]^u[2][o[r>>8&255]]^u[3][o[255&r]]}return e.prototype.decrypt=function(e,t,i,n,r,s){var a=this._key[1],o=e^a[0],u=n^a[1],l=i^a[2],c=t^a[3],h=void 0,d=void 0,p=void 0,f=a.length/4-2,m=void 0,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],S=v[4];for(m=0;m<f;m++)h=y[o>>>24]^_[u>>16&255]^b[l>>8&255]^T[255&c]^a[g],d=y[u>>>24]^_[l>>16&255]^b[c>>8&255]^T[255&o]^a[g+1],p=y[l>>>24]^_[c>>16&255]^b[o>>8&255]^T[255&u]^a[g+2],c=y[c>>>24]^_[o>>16&255]^b[u>>8&255]^T[255&l]^a[g+3],g+=4,o=h,u=d,l=p;for(m=0;m<4;m++)r[(3&-m)+s]=S[o>>>24]<<24^S[u>>16&255]<<16^S[l>>8&255]<<8^S[255&c]^a[g++],h=o,o=u,u=l,l=c,c=h},e}(),Lr=function(){function e(){xr(this,e),this.listeners={}}return e.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},e.prototype.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},e.prototype.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),s=t.length,a=0;a<s;++a)t[a].apply(this,r)},e.prototype.dispose=function(){this.listeners={}},e.prototype.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}(),Or=function(e){function t(){xr(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,Lr));return i.jobs=[],i.delay=1,i.timeout_=null,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},t.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(Lr),Dr=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},Nr=function(e,t,i){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new Pr(Array.prototype.slice.call(t)),s=new Uint8Array(e.byteLength),a=new Int32Array(s.buffer),o=void 0,u=void 0,l=void 0,c=void 0,h=void 0,d=void 0,p=void 0,f=void 0,m=void 0;for(o=i[0],u=i[1],l=i[2],c=i[3],m=0;m<n.length;m+=4)h=Dr(n[m]),d=Dr(n[m+1]),p=Dr(n[m+2]),f=Dr(n[m+3]),r.decrypt(h,d,p,f,a,m),a[m]=Dr(a[m]^o),a[m+1]=Dr(a[m+1]^u),a[m+2]=Dr(a[m+2]^l),a[m+3]=Dr(a[m+3]^c),o=h,u=d,l=p,c=f;return s},Rr=function(){function e(t,i,n,r){xr(this,e);var s=e.STEP,a=new Int32Array(t.buffer),o=new Uint8Array(t.byteLength),u=0;for(this.asyncStream_=new Or,this.asyncStream_.push(this.decryptChunk_(a.subarray(u,u+s),i,n,o)),u=s;u<a.length;u+=s)n=new Uint32Array([Dr(a[u-4]),Dr(a[u-3]),Dr(a[u-2]),Dr(a[u-1])]),this.asyncStream_.push(this.decryptChunk_(a.subarray(u,u+s),i,n,o));this.asyncStream_.push((function(){var e;r(null,(e=o).subarray(0,e.byteLength-e[e.byteLength-1]))}))}return e.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=Nr(e,t,i);n.set(r,e.byteOffset)}},Ar(e,null,[{key:"STEP",get:function(){return 32e3}}]),e}(),Ur=[];var Mr=function e(t){var i,n="info",r=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i("log",n,t)};return i=function(e,t){return function(i,n,r){var s=t.levels[n],a=new RegExp("^("+s+")$");if("log"!==i&&r.unshift(i.toUpperCase()+":"),r.unshift(e+":"),Ur){Ur.push([].concat(r));var o=Ur.length-1e3;Ur.splice(0,o>0?o:0)}if(ee.console){var u=ee.console[i];u||"debug"!==i||(u=ee.console.info||ee.console.log),u&&s&&a.test(i)&&u[Array.isArray(r)?"apply":"call"](ee.console,r)}}}(t,r),r.createLogger=function(i){return e(t+": "+i)},r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},r.level=function(e){if("string"==typeof e){if(!r.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');n=e}return n},(r.history=function(){return Ur?[].concat(Ur):[]}).filter=function(e){return(Ur||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},r.history.clear=function(){Ur&&(Ur.length=0)},r.history.disable=function(){null!==Ur&&(Ur.length=0,Ur=null)},r.history.enable=function(){null===Ur&&(Ur=[])},r.error=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("error",n,t)},r.warn=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("warn",n,t)},r.debug=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("debug",n,t)},r}("VIDEOJS"),Br=Mr.createLogger,jr=Object.prototype.toString,Fr=function(e){return qr(e)?Object.keys(e):[]};function Vr(e,t){Fr(e).forEach((function(i){return t(e[i],i)}))}function Hr(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return Object.assign?re.apply(void 0,[e].concat(i)):(i.forEach((function(t){t&&Vr(t,(function(t,i){e[i]=t}))})),e)}function qr(e){return!!e&&"object"==typeof e}function Wr(e){return qr(e)&&"[object Object]"===jr.call(e)&&e.constructor===Object}function zr(e,t){if(!e||!t)return"";if("function"==typeof ee.getComputedStyle){var i=ee.getComputedStyle(e);return i?i.getPropertyValue(t)||i[t]:""}return""}function $r(e){return"string"==typeof e&&Boolean(e.trim())}function Gr(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Xr(){return ne===ee.document}function Kr(e){return qr(e)&&1===e.nodeType}function Yr(){try{return ee.parent!==ee.self}catch(e){return!0}}function Qr(e){return function(t,i){if(!$r(t))return ne[e](null);$r(i)&&(i=ne.querySelector(i));var n=Kr(i)?i:ne;return n[e]&&n[e](t)}}function Jr(e,t,i,n){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={});var r=ne.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(Mr.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+i+"."),r.setAttribute(e,i)):"textContent"===e?Zr(r,i):r[e]!==i&&(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),n&&ys(r,n),r}function Zr(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function es(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ts(e,t){return Gr(t),e.classList?e.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(e.className);var i}function is(e,t){return e.classList?e.classList.add(t):ts(e,t)||(e.className=(e.className+" "+t).trim()),e}function ns(e,t){return e.classList?e.classList.remove(t):(Gr(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e}function rs(e,t,i){var n=ts(e,t);if("function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=!n),i!==n)return i?is(e,t):ns(e,t),e}function ss(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null==n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function as(e){var t={},i=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0)for(var n=e.attributes,r=n.length-1;r>=0;r--){var s=n[r].name,a=n[r].value;"boolean"!=typeof e[s]&&-1===i.indexOf(","+s+",")||(a=null!==a),t[s]=a}return t}function os(e,t){return e.getAttribute(t)}function us(e,t,i){e.setAttribute(t,i)}function ls(e,t){e.removeAttribute(t)}function cs(){ne.body.focus(),ne.onselectstart=function(){return!1}}function hs(){ne.onselectstart=function(){return!0}}function ds(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((function(e){void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(zr(e,"height"))),i.width||(i.width=parseFloat(zr(e,"width"))),i}}function ps(e){var t;if(e.getBoundingClientRect&&e.parentNode&&(t=e.getBoundingClientRect()),!t)return{left:0,top:0};var i=ne.documentElement,n=ne.body,r=i.clientLeft||n.clientLeft||0,s=ee.pageXOffset||n.scrollLeft,a=t.left+s-r,o=i.clientTop||n.clientTop||0,u=ee.pageYOffset||n.scrollTop,l=t.top+u-o;return{left:Math.round(a),top:Math.round(l)}}function fs(e,t){var i={},n=ps(e),r=e.offsetWidth,s=e.offsetHeight,a=n.top,o=n.left,u=t.pageY,l=t.pageX;return t.changedTouches&&(l=t.changedTouches[0].pageX,u=t.changedTouches[0].pageY),i.y=Math.max(0,Math.min(1,(a-u+s)/s)),i.x=Math.max(0,Math.min(1,(l-o)/r)),i}function ms(e){return qr(e)&&3===e.nodeType}function gs(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function vs(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return"function"==typeof e&&(e=e()),Kr(e)||ms(e)?e:"string"==typeof e&&/\S/.test(e)?ne.createTextNode(e):void 0})).filter((function(e){return e}))}function ys(e,t){return vs(t).forEach((function(t){return e.appendChild(t)})),e}function _s(e,t){return ys(gs(e),t)}function bs(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}var Ts,Ss=Qr("querySelector"),ks=Qr("querySelectorAll"),Cs=Object.freeze({__proto__:null,isReal:Xr,isEl:Kr,isInFrame:Yr,createEl:Jr,textContent:Zr,prependTo:es,hasClass:ts,addClass:is,removeClass:ns,toggleClass:rs,setAttributes:ss,getAttributes:as,getAttribute:os,setAttribute:us,removeAttribute:ls,blockTextSelection:cs,unblockTextSelection:hs,getBoundingClientRect:ds,findPosition:ps,getPointerPosition:fs,isTextNode:ms,emptyEl:gs,normalizeContent:vs,appendContent:ys,insertContent:_s,isSingleLeftClick:bs,$:Ss,$$:ks}),ws=!1,Es=function(){if(Xr()&&!1!==Ts.options.autoSetup){var e=Array.prototype.slice.call(ne.getElementsByTagName("video")),t=Array.prototype.slice.call(ne.getElementsByTagName("audio")),i=Array.prototype.slice.call(ne.getElementsByTagName("video-js")),n=e.concat(t,i);if(n&&n.length>0)for(var r=0,s=n.length;r<s;r++){var a=n[r];if(!a||!a.getAttribute){xs(1);break}void 0===a.player&&null!==a.getAttribute("data-setup")&&Ts(a)}else ws||xs(1)}};function xs(e,t){t&&(Ts=t),ee.setTimeout(Es,e)}function As(){ws=!0,ee.removeEventListener("load",As)}Xr()&&("complete"===ne.readyState?As():ee.addEventListener("load",As));var Is,Ps=function(e){var t=ne.createElement("style");return t.className=e,t},Ls=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t},Os=3;function Ds(){return Os++}ee.WeakMap||(Is=function(){function e(){this.vdata="vdata"+Math.floor(ee.performance&&ee.performance.now()||Date.now()),this.data={}}var t=e.prototype;return t.set=function(e,t){var i=e[this.vdata]||Ds();return e[this.vdata]||(e[this.vdata]=i),this.data[i]=t,this},t.get=function(e){var t=e[this.vdata];if(t)return this.data[t];Mr("We have no data for this element",e)},t.has=function(e){return e[this.vdata]in this.data},t.delete=function(e){var t=e[this.vdata];t&&(delete this.data[t],delete e[this.vdata])},e}());var Ns,Rs=ee.WeakMap?new WeakMap:new Is;function Us(e,t){if(Rs.has(e)){var i=Rs.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.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&&Rs.delete(e)}}function Ms(e,t,i,n){i.forEach((function(i){e(t,i,n)}))}function Bs(e){if(e.fixed_)return e;function t(){return!0}function i(){return!1}if(!e||!e.isPropagationStopped){var n=e||ee.event;for(var r in e={},n)"layerX"!==r&&"layerY"!==r&&"keyLocation"!==r&&"webkitMovementX"!==r&&"webkitMovementY"!==r&&("returnValue"===r&&n.preventDefault||(e[r]=n[r]));if(e.target||(e.target=e.srcElement||ne),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){n.preventDefault&&n.preventDefault(),e.returnValue=!1,n.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){n.stopPropagation&&n.stopPropagation(),e.cancelBubble=!0,n.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=i,e.stopImmediatePropagation=function(){n.stopImmediatePropagation&&n.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=i,null!==e.clientX&&void 0!==e.clientX){var s=ne.documentElement,a=ne.body;e.pageX=e.clientX+(s&&s.scrollLeft||a&&a.scrollLeft||0)-(s&&s.clientLeft||a&&a.clientLeft||0),e.pageY=e.clientY+(s&&s.scrollTop||a&&a.scrollTop||0)-(s&&s.clientTop||a&&a.clientTop||0)}e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}var js=["touchstart","touchmove"];function Fs(e,t,i){if(Array.isArray(t))return Ms(Fs,e,t,i);Rs.has(e)||Rs.set(e,{});var n=Rs.get(e);if(n.handlers||(n.handlers={}),n.handlers[t]||(n.handlers[t]=[]),i.guid||(i.guid=Ds()),n.handlers[t].push(i),n.dispatcher||(n.disabled=!1,n.dispatcher=function(t,i){if(!n.disabled){t=Bs(t);var r=n.handlers[t.type];if(r)for(var s=r.slice(0),a=0,o=s.length;a<o&&!t.isImmediatePropagationStopped();a++)try{s[a].call(e,t,i)}catch(e){Mr.error(e)}}}),1===n.handlers[t].length)if(e.addEventListener){var r=!1;(function(){if("boolean"!=typeof Ns){Ns=!1;try{var e=Object.defineProperty({},"passive",{get:function(){Ns=!0}});ee.addEventListener("test",null,e),ee.removeEventListener("test",null,e)}catch(e){}}return Ns})()&&js.indexOf(t)>-1&&(r={passive:!0}),e.addEventListener(t,n.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function Vs(e,t,i){if(Rs.has(e)){var n=Rs.get(e);if(n.handlers){if(Array.isArray(t))return Ms(Vs,e,t,i);var r=function(e,t){n.handlers[t]=[],Us(e,t)};if(void 0!==t){var s=n.handlers[t];if(s)if(i){if(i.guid)for(var a=0;a<s.length;a++)s[a].guid===i.guid&&s.splice(a--,1);Us(e,t)}else r(e,t)}else for(var o in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},o)&&r(e,o)}}}function Hs(e,t,i){var n=Rs.has(e)?Rs.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=Bs(t),n.dispatcher&&n.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles)Hs.call(null,r,t,i);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){Rs.has(t.target)||Rs.set(t.target,{});var s=Rs.get(t.target);t.target[t.type]&&(s.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),s.disabled=!1)}return!t.defaultPrevented}function qs(e,t,i){if(Array.isArray(t))return Ms(qs,e,t,i);var n=function n(){Vs(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||Ds(),Fs(e,t,n)}function Ws(e,t,i){var n=function n(){Vs(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||Ds(),Fs(e,t,n)}var zs,$s=Object.freeze({__proto__:null,fixEvent:Bs,on:Fs,off:Vs,trigger:Hs,one:qs,any:Ws}),Gs=function(e,t,i){t.guid||(t.guid=Ds());var n=t.bind(e);return n.guid=i?i+"_"+t.guid:t.guid,n},Xs=function(e,t){var i=ee.performance.now();return function(){var n=ee.performance.now();n-i>=t&&(e.apply(void 0,arguments),i=n)}},Ks=function(){};Ks.prototype.allowedEvents_={},Ks.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Fs(this,e,t),this.addEventListener=i},Ks.prototype.addEventListener=Ks.prototype.on,Ks.prototype.off=function(e,t){Vs(this,e,t)},Ks.prototype.removeEventListener=Ks.prototype.off,Ks.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},qs(this,e,t),this.addEventListener=i},Ks.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Ws(this,e,t),this.addEventListener=i},Ks.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=Bs(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Hs(this,e)},Ks.prototype.dispatchEvent=Ks.prototype.trigger,Ks.prototype.queueTrigger=function(e){var t=this;zs||(zs=new Map);var i=e.type||e,n=zs.get(this);n||(n=new Map,zs.set(this,n));var r=n.get(i);n.delete(i),ee.clearTimeout(r);var s=ee.setTimeout((function(){0===n.size&&(n=null,zs.delete(t)),t.trigger(e)}),0);n.set(i,s)};var Ys=function(e){return e instanceof Ks||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"==typeof e[t]}))},Qs=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},Js=function(e){if(!e.nodeName&&!Ys(e))throw new Error("Invalid target; must be a DOM node or evented object.")},Zs=function(e){if(!Qs(e))throw new Error("Invalid event type; must be a non-empty string or array.")},ea=function(e){if("function"!=typeof e)throw new Error("Invalid listener; must be a function.")},ta=function(e,t){var i,n,r,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return s?(i=e.eventBusEl_,t.length>=3&&t.shift(),n=t[0],r=t[1]):(i=t[0],n=t[1],r=t[2]),Js(i),Zs(n),ea(r),{isTargetingSelf:s,target:i,type:n,listener:r=Gs(e,r)}},ia=function(e,t,i,n){Js(e),e.nodeName?$s[t](e,i,n):e[t](i,n)},na={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=ta(this,i),s=r.isTargetingSelf,a=r.target,o=r.type,u=r.listener;if(ia(a,"on",o,u),!s){var l=function(){return e.off(a,o,u)};l.guid=u.guid;var c=function(){return e.off("dispose",l)};c.guid=u.guid,ia(this,"on","dispose",l),ia(a,"on","dispose",c)}},one:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=ta(this,i),s=r.isTargetingSelf,a=r.target,o=r.type,u=r.listener;if(s)ia(a,"one",o,u);else{var l=function t(){e.off(a,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)};l.guid=u.guid,ia(a,"one",o,l)}},any:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=ta(this,i),s=r.isTargetingSelf,a=r.target,o=r.type,u=r.listener;if(s)ia(a,"any",o,u);else{var l=function t(){e.off(a,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)};l.guid=u.guid,ia(a,"any",o,l)}},off:function(e,t,i){if(!e||Qs(e))Vs(this.eventBusEl_,e,t);else{var n=e,r=t;Js(n),Zs(r),ea(i),i=Gs(this,i),this.off("dispose",i),n.nodeName?(Vs(n,r,i),Vs(n,"dispose",i)):Ys(n)&&(n.off(r,i),n.off("dispose",i))}},trigger:function(e,t){return Hs(this.eventBusEl_,e,t)}};function ra(e,t){void 0===t&&(t={});var i=t.eventBusKey;if(i){if(!e[i].nodeName)throw new Error('The eventBusKey "'+i+'" does not refer to an element.');e.eventBusEl_=e[i]}else e.eventBusEl_=Jr("span",{className:"vjs-event-bus"});return Hr(e,na),e.eventedCallbacks&&e.eventedCallbacks.forEach((function(e){e()})),e.on("dispose",(function(){e.off(),ee.setTimeout((function(){e.eventBusEl_=null}),0)})),e}var sa={state:{},setState:function(e){var t,i=this;return"function"==typeof e&&(e=e()),Vr(e,(function(e,n){i.state[n]!==e&&((t=t||{})[n]={from:i.state[n],to:e}),i.state[n]=e})),t&&Ys(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function aa(e,t){return Hr(e,sa),e.state=Hr({},e.state,t),"function"==typeof e.handleStateChanged&&Ys(e)&&e.on("statechanged",e.handleStateChanged),e}var oa=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toLowerCase()}))},ua=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))};function la(){for(var e={},t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.forEach((function(t){t&&Vr(t,(function(t,i){Wr(t)?(Wr(e[i])||(e[i]={}),e[i]=la(e[i],t)):e[i]=t}))})),e}var ca=function(){function e(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=la({},this.options_),t=this.options_=la(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){var n=e&&e.id&&e.id()||"no_player";this.id_=n+"_component_"+Ds()}var r;this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),!1!==t.evented&&ra(this,{eventBusKey:this.el_?"el_":null}),aa(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},ee.Set||(r=function(){function e(){this.set_={}}var t=e.prototype;return t.has=function(e){return e in this.set_},t.delete=function(e){var t=this.has(e);return delete this.set_[e],t},t.add=function(e){return this.set_[e]=1,this},t.forEach=function(e,t){for(var i in this.set_)e.call(t,i,i,this)},e}()),this.setTimeoutIds_=ee.Set?new Set:new r,this.setIntervalIds_=ee.Set?new Set:new r,this.rafIds_=ee.Set?new Set:new r,this.clearingTimersOnDispose_=!1,!1!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var t=e.prototype;return t.dispose=function(){if(!this.isDisposed_){if(this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var e=this.children_.length-1;e>=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),Rs.has(this.el_)&&Rs.delete(this.el_),this.el_=null),this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(e){return e?(this.options_=la(this.options_,e),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(e,t,i){return Jr(e,t,i)},t.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),s=r&&r[n],a=n&&n.split("-")[0],o=r&&r[a],u=i;return s&&s[e]?u=s[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,(function(e,i){var n=t[i-1],r=n;return void 0===n&&(r=e),r}))),u},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(e){return this.childIndex_[e]},t.getChild=function(e){if(e)return this.childNameIndex_[e]},t.getDescendant=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];t=t.reduce((function(e,t){return e.concat(t)}),[]);for(var n=this,r=0;r<t.length;r++)if(!(n=n.getChild(t[r]))||!n.getChild)return;return n},t.addChild=function(t,i,n){var r,s;if(void 0===i&&(i={}),void 0===n&&(n=this.children_.length),"string"==typeof t){s=ua(t);var a=i.componentClass||s;i.name=s;var o=e.getComponent(a);if(!o)throw new Error("Component "+a+" does not exist");if("function"!=typeof o)return null;r=new o(this.player_||this,i)}else r=t;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,"function"==typeof r.id&&(this.childIndex_[r.id()]=r),(s=s||r.name&&ua(r.name()))&&(this.childNameIndex_[s]=r,this.childNameIndex_[oa(s)]=r),"function"==typeof r.el&&r.el()){var u=null;this.children_[n+1]&&(this.children_[n+1].el_?u=this.children_[n+1].el_:Kr(this.children_[n+1])&&(u=this.children_[n+1])),this.contentEl().insertBefore(r.el(),u)}return r},t.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,i=this.children_.length-1;i>=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[ua(e.name())]=null,this.childNameIndex_[oa(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},t.initChildren=function(){var t=this,i=this.options_.children;if(i){var n,r=this.options_,s=e.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((function(e){var n,r;return"string"==typeof e?r=i[n=e]||t.options_[n]||{}:(n=e.name,r=e),{name:n,opts:r}})).filter((function(t){var i=e.getComponent(t.opts.componentClass||ua(t.name));return i&&!s.isTech(i)})).forEach((function(e){var i=e.name,n=e.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=t.options_.playerOptions;var s=t.addChild(i,n);s&&(t[i]=s)}}))}},t.buildCSSClass=function(){return""},t.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout((function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)},t.$=function(e,t){return Ss(e,t||this.contentEl())},t.$$=function(e,t){return ks(e,t||this.contentEl())},t.hasClass=function(e){return ts(this.el_,e)},t.addClass=function(e){is(this.el_,e)},t.removeClass=function(e){ns(this.el_,e)},t.toggleClass=function(e,t){rs(this.el_,e,t)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(e){return os(this.el_,e)},t.setAttribute=function(e,t){us(this.el_,e,t)},t.removeAttribute=function(e){ls(this.el_,e)},t.width=function(e,t){return this.dimension("width",e,t)},t.height=function(e,t){return this.dimension("height",e,t)},t.dimensions=function(e,t){this.width(e,!0),this.height(t)},t.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+ua(e)],10)},t.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=zr(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+ua(e);t=this.el_[i]}return t},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(e){this.player_&&(e.stopPropagation(),this.player_.handleKeyDown(e))},t.handleKeyPress=function(e){this.handleKeyDown(e)},t.emitTapEvents=function(){var e,t=0,i=null;this.on("touchstart",(function(n){1===n.touches.length&&(i={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=ee.performance.now(),e=!0)})),this.on("touchmove",(function(t){if(t.touches.length>1)e=!1;else if(i){var n=t.touches[0].pageX-i.pageX,r=t.touches[0].pageY-i.pageY;Math.sqrt(n*n+r*r)>10&&(e=!1)}}));var n=function(){e=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(n){(i=null,!0===e)&&(ee.performance.now()-t<200&&(n.preventDefault(),this.trigger("tap")))}))},t.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=Gs(this.player(),this.player().reportUserActivity);this.on("touchstart",(function(){t(),this.clearInterval(e),e=this.setInterval(t,250)}));var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},t.setTimeout=function(e,t){var i,n=this;return e=Gs(this,e),this.clearTimersOnDispose_(),i=ee.setTimeout((function(){n.setTimeoutIds_.has(i)&&n.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i},t.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),ee.clearTimeout(e)),e},t.setInterval=function(e,t){e=Gs(this,e),this.clearTimersOnDispose_();var i=ee.setInterval(e,t);return this.setIntervalIds_.add(i),i},t.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),ee.clearInterval(e)),e},t.requestAnimationFrame=function(e){var t,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=Gs(this,e),t=ee.requestAnimationFrame((function(){i.rafIds_.has(t)&&i.rafIds_.delete(t),e()})),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},t.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),ee.cancelAnimationFrame(e)),e):this.clearTimeout(e)},t.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(function(){[["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((function(t){var i=t[0],n=t[1];e[i].forEach(e[n],e)})),e.clearingTimersOnDispose_=!1})))},e.registerComponent=function(t,i){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var n,r=e.getComponent("Tech"),s=r&&r.isTech(i),a=e===i||e.prototype.isPrototypeOf(i.prototype);if(s||!a)throw n=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+t+'"; '+n+".");t=ua(t),e.components_||(e.components_={});var o=e.getComponent("Player");if("Player"===t&&o&&o.players){var u=o.players,l=Object.keys(u);if(u&&l.length>0&&l.map((function(e){return u[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=i,e.components_[oa(t)]=i,i},e.getComponent=function(t){if(t&&e.components_)return e.components_[t]},e}();ca.prototype.supportsRaf_="function"==typeof ee.requestAnimationFrame&&"function"==typeof ee.cancelAnimationFrame,ca.registerComponent("Component",ca);var ha,da=ee.navigator&&ee.navigator.userAgent||"",pa=/AppleWebKit\/([\d.]+)/i.exec(da),fa=pa?parseFloat(pa.pop()):null,ma=/iPod/i.test(da),ga=(ha=da.match(/OS (\d+)_/i))&&ha[1]?ha[1]:null,va=/Android/i.test(da),ya=function(){var e=da.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),_a=va&&ya<5&&fa<537,ba=/Firefox/i.test(da),Ta=/Edg/i.test(da),Sa=!Ta&&(/Chrome/i.test(da)||/CriOS/i.test(da)),ka=function(){var e=da.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Ca=function(){var e=/MSIE\s(\d+)\.\d/.exec(da),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(da)&&/rv:11.0/.test(da)&&(t=11),t}(),wa=/Safari/i.test(da)&&!Sa&&!va&&!Ta,Ea=/Windows/i.test(da),xa=Xr()&&("ontouchstart"in ee||ee.navigator.maxTouchPoints||ee.DocumentTouch&&ee.document instanceof ee.DocumentTouch),Aa=/iPad/i.test(da)||wa&&xa&&!/iPhone/i.test(da),Ia=/iPhone/i.test(da)&&!Aa,Pa=Ia||Aa||ma,La=(wa||Pa)&&!Sa,Oa=Object.freeze({__proto__:null,IS_IPOD:ma,IOS_VERSION:ga,IS_ANDROID:va,ANDROID_VERSION:ya,IS_NATIVE_ANDROID:_a,IS_FIREFOX:ba,IS_EDGE:Ta,IS_CHROME:Sa,CHROME_VERSION:ka,IE_VERSION:Ca,IS_SAFARI:wa,IS_WINDOWS:Ea,TOUCH_ENABLED:xa,IS_IPAD:Aa,IS_IPHONE:Ia,IS_IOS:Pa,IS_ANY_SAFARI:La});function Da(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function Na(e){return void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Da.bind(null,"start",0,e),end:Da.bind(null,"end",1,e)}}function Ra(e,t){return Array.isArray(e)?Na(e):void 0===e||void 0===t?Na():Na([[e,t]])}function Ua(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=Ra(0,0));for(var s=0;s<e.length;s++)i=e.start(s),(n=e.end(s))>t&&(n=t),r+=n-i;return r/t}for(var Ma,Ba={prefixed:!0},ja=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],Fa=ja[0],Va=0;Va<ja.length;Va++)if(ja[Va][1]in ne){Ma=ja[Va];break}if(Ma){for(var Ha=0;Ha<Ma.length;Ha++)Ba[Fa[Ha]]=Ma[Ha];Ba.prefixed=Ma[0]!==Fa[0]}function qa(e){if(e instanceof qa)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:qr(e)&&("number"==typeof e.code&&(this.code=e.code),Hr(this,e)),this.message||(this.message=qa.defaultMessages[this.code]||"")}qa.prototype.code=0,qa.prototype.message="",qa.prototype.status=null,qa.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],qa.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var Wa=0;Wa<qa.errorTypes.length;Wa++)qa[qa.errorTypes[Wa]]=Wa,qa.prototype[qa.errorTypes[Wa]]=Wa;function za(e){return null!=e&&"function"==typeof e.then}function $a(e){za(e)&&e.then(null,(function(e){}))}var Ga=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((function(t,i,n){return e[i]&&(t[i]=e[i]),t}),{cues:e.cues&&Array.prototype.map.call(e.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))})},Xa=function(e){var t=e.$$("track"),i=Array.prototype.map.call(t,(function(e){return e.track}));return Array.prototype.map.call(t,(function(e){var t=Ga(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(e){return-1===i.indexOf(e)})).map(Ga))},Ka=function(e,t){return e.forEach((function(e){var i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((function(e){return i.addCue(e)}))})),t.textTracks()},Ya=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1,n.closeable(!n.options_.uncloseable),n.content(n.options_.content),n.contentEl_=Jr("div",{className:"vjs-modal-dialog-content"},{role:"document"}),n.descEl_=Jr("p",{className:"vjs-modal-dialog-description vjs-control-text",id:n.el().getAttribute("aria-describedby")}),Zr(n.descEl_,n.description()),n.el_.appendChild(n.descEl_),n.el_.appendChild(n.contentEl_),n}ae(t,e);var i=t.prototype;return i.createEl=function(){return e.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.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-modal-dialog vjs-hidden "+e.prototype.buildCSSClass.call(this)},i.label=function(){return this.localize(this.options_.label||"Modal Window")},i.description=function(){var e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e},i.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},i.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},i.close=function(){if(this.opened_){var e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},i.closeable=function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,i=this.getChild("closeButton");if(t&&!i){var n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close)}!t&&i&&(this.off(i,"close",this.close),this.removeChild(i),i.dispose())}return this.closeable_},i.fill=function(){this.fillWith(this.content())},i.fillWith=function(e){var t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),_s(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);var r=this.getChild("closeButton");r&&i.appendChild(r.el_)},i.empty=function(){this.trigger("beforemodalempty"),gs(this.contentEl()),this.trigger("modalempty")},i.content=function(e){return void 0!==e&&(this.content_=e),this.content_},i.conditionalFocus_=function(){var e=ne.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())},i.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},i.handleKeyDown=function(e){if(e.stopPropagation(),ue.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(ue.isEventKey(e,"Tab")){for(var t,i=this.focusableEls_(),n=this.el_.querySelector(":focus"),r=0;r<i.length;r++)if(n===i[r]){t=r;break}ne.activeElement===this.el_&&(t=0),e.shiftKey&&0===t?(i[i.length-1].focus(),e.preventDefault()):e.shiftKey||t!==i.length-1||(i[0].focus(),e.preventDefault())}},i.focusableEls_=function(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(function(e){return(e instanceof ee.HTMLAnchorElement||e instanceof ee.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof ee.HTMLInputElement||e instanceof ee.HTMLSelectElement||e instanceof ee.HTMLTextAreaElement||e instanceof ee.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof ee.HTMLIFrameElement||e instanceof ee.HTMLObjectElement||e instanceof ee.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")}))},t}(ca);Ya.prototype.options_={pauseOnOpen:!0,temporary:!0},ca.registerComponent("ModalDialog",Ya);var Qa=function(e){function t(t){var i;void 0===t&&(t=[]),(i=e.call(this)||this).tracks_=[],Object.defineProperty(se(i),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<t.length;n++)i.addTrack(t[n]);return i}ae(t,e);var i=t.prototype;return i.addTrack=function(e){var t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.tracks_[t]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this}))},i.removeTrack=function(e){for(var t,i=0,n=this.length;i<n;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},i.getTrackById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},t}(Ks);for(var Ja in Qa.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"},Qa.prototype.allowedEvents_)Qa.prototype["on"+Ja]=null;var Za=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)},eo=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].enabled){Za(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}ae(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&Za(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,Za(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(Qa),to=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)},io=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].selected){to(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(se(i),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),i}ae(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.selected&&to(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,to(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)},t}(Qa),no=function(e){function t(){return e.apply(this,arguments)||this}ae(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;e.prototype.addTrack.call(this,t),this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},t}(Qa),ro=function(){function e(e){void 0===e&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}var t=e.prototype;return t.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)},t.getTrackElementByTrack_=function(e){for(var t,i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t},t.removeTrackElement_=function(e){for(var t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}},e}(),so=function(){function e(t){e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=e.prototype;return t.setCues_=function(e){var t=this.length||0,i=0,n=e.length;this.cues_=e,this.length_=e.length;var r=function(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})};if(t<n)for(i=t;i<n;i++)r.call(this,i)},t.getCueById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},e}(),ao={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},oo={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},uo={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},lo={disabled:"disabled",hidden:"hidden",showing:"showing"},co=function(e){function t(t){var i;void 0===t&&(t={}),i=e.call(this)||this;var n={id:t.id||"vjs_track_"+Ds(),kind:t.kind||"",label:t.label||"",language:t.language||""},r=function(e){Object.defineProperty(se(i),e,{get:function(){return n[e]},set:function(){}})};for(var s in n)r(s);return i}return ae(t,e),t}(Ks),ho=function(e){var t=["protocol","hostname","port","pathname","search","hash","host"],i=ne.createElement("a");i.href=e;var n,r=""===i.host&&"file:"!==i.protocol;r&&((n=ne.createElement("div")).innerHTML='<a href="'+e+'"></a>',i=n.firstChild,n.setAttribute("style","display:none; position:absolute;"),ne.body.appendChild(n));for(var s={},a=0;a<t.length;a++)s[t[a]]=i[t[a]];return"http:"===s.protocol&&(s.host=s.host.replace(/:80$/,"")),"https:"===s.protocol&&(s.host=s.host.replace(/:443$/,"")),s.protocol||(s.protocol=ee.location.protocol),r&&ne.body.removeChild(n),s},po=function(e){if(!e.match(/^https?:\/\//)){var t=ne.createElement("div");t.innerHTML='<a href="'+e+'">x</a>',e=t.firstChild.href}return e},fo=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},mo=function(e,t){void 0===t&&(t=ee.location);var i=ho(e);return(":"===i.protocol?t.protocol:i.protocol)+i.host!==t.protocol+t.host},go=Object.freeze({__proto__:null,parseUrl:ho,getAbsoluteURL:po,getFileExtension:fo,isCrossOrigin:mo}),vo=function(e,t){var i=new ee.WebVTT.Parser(ee,ee.vttjs,ee.WebVTT.StringDecoder()),n=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){n.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),n.length>0&&(ee.console&&ee.console.groupCollapsed&&ee.console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach((function(e){return Mr.error(e)})),ee.console&&ee.console.groupEnd&&ee.console.groupEnd()),i.flush()},yo=function(e,t){var i={uri:e},n=mo(e);n&&(i.cors=n),de(i,Gs(this,(function(e,i,n){if(e)return Mr.error(e,i);t.loaded_=!0,"function"!=typeof ee.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(function(e){if("vttjserror"!==e.type)return vo(n,t);Mr.error("vttjs failed to load, stopping trying to process "+t.src)})):vo(n,t)})))},_o=function(e){function t(t){var i;if(void 0===t&&(t={}),!t.tech)throw new Error("A tech was not provided.");var n=la(t,{kind:uo[t.kind]||"subtitles",language:t.language||t.srclang||""}),r=lo[n.mode]||"disabled",s=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=e.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var a=new so(i.cues_),o=new so(i.activeCues_),u=!1,l=Gs(se(i),(function(){this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1)}));return"disabled"!==r&&i.tech_.ready((function(){i.tech_.on("timeupdate",l)}),!0),Object.defineProperties(se(i),{default:{get:function(){return s},set:function(){}},mode:{get:function(){return r},set:function(e){var t=this;lo[e]&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||yo(this.src,this),"disabled"!==r?this.tech_.ready((function(){t.tech_.on("timeupdate",l)}),!0):this.tech_.off("timeupdate",l),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?a:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i<n;i++){var r=this.cues[i];(r.startTime<=e&&r.endTime>=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(u=!1,t.length!==this.activeCues_.length)u=!0;else for(var s=0;s<t.length;s++)-1===this.activeCues_.indexOf(t[s])&&(u=!0);return this.activeCues_=t,o.setCues_(this.activeCues_),o},set:function(){}}}),n.src?(i.src=n.src,i.preload_||(i.loaded_=!0),(i.preload_||s||"subtitles"!==n.kind&&"captions"!==n.kind)&&yo(i.src,se(i))):i.loaded_=!0,i}ae(t,e);var i=t.prototype;return i.addCue=function(e){var t=e;if(ee.vttjs&&!(e instanceof ee.vttjs.VTTCue)){for(var i in t=new ee.vttjs.VTTCue(e.startTime,e.endTime,e.text),e)i in t||(t[i]=e[i]);t.id=e.id,t.originalCue_=e}for(var n=this.tech_.textTracks(),r=0;r<n.length;r++)n[r]!==this&&n[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)},i.removeCue=function(e){for(var t=this.cues_.length;t--;){var i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}},t}(co);_o.prototype.allowedEvents_={cuechange:"cuechange"};var bo=function(e){function t(t){var i;void 0===t&&(t={});var n=la(t,{kind:oo[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(se(i),"enabled",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("enabledchange"))}}),n.enabled&&(i.enabled=n.enabled),i.loaded_=!0,i}return ae(t,e),t}(co),To=function(e){function t(t){var i;void 0===t&&(t={});var n=la(t,{kind:ao[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(se(i),"selected",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("selectedchange"))}}),n.selected&&(i.selected=n.selected),i}return ae(t,e),t}(co),So=function(e){function t(t){var i,n;void 0===t&&(t={}),i=e.call(this)||this;var r=new _o(t);return i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i.default=r.default,Object.defineProperties(se(i),{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=0,r.addEventListener("loadeddata",(function(){n=2,i.trigger({type:"load",target:se(i)})})),i}return ae(t,e),t}(Ks);So.prototype.allowedEvents_={load:"load"},So.NONE=0,So.LOADING=1,So.LOADED=2,So.ERROR=3;var ko={audio:{ListClass:eo,TrackClass:bo,capitalName:"Audio"},video:{ListClass:io,TrackClass:To,capitalName:"Video"},text:{ListClass:no,TrackClass:_o,capitalName:"Text"}};Object.keys(ko).forEach((function(e){ko[e].getterName=e+"Tracks",ko[e].privateName=e+"Tracks_"}));var Co={remoteText:{ListClass:no,TrackClass:_o,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:ro,TrackClass:So,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},wo=re({},ko,Co);Co.names=Object.keys(Co),ko.names=Object.keys(ko),wo.names=[].concat(Co.names).concat(ko.names);var Eo=function(e){function t(t,i){var n;return void 0===t&&(t={}),void 0===i&&(i=function(){}),t.reportTouchActivity=!1,(n=e.call(this,null,t,i)||this).hasStarted_=!1,n.on("playing",(function(){this.hasStarted_=!0})),n.on("loadstart",(function(){this.hasStarted_=!1})),wo.names.forEach((function(e){var i=wo[e];t&&t[i.getterName]&&(n[i.privateName]=t[i.getterName])})),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((function(e){!1===t["native"+e+"Tracks"]&&(n["featuresNative"+e+"Tracks"]=!1)})),!1===t.nativeCaptions||!1===t.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.preloadTextTracks=!1!==t.preloadTextTracks,n.autoRemoteTextTracks_=new wo.text.ListClass,n.initTrackListeners(),t.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}ae(t,e);var i=t.prototype;return i.triggerSourceset=function(e){var t=this;this.isReady_||this.one("ready",(function(){return t.setTimeout((function(){return t.triggerSourceset(e)}),1)})),this.trigger({src:e,type:"sourceset"})},i.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},i.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},i.trackProgress=function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Gs(this,(function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()})),500)},i.onDurationChange=function(e){this.duration_=this.duration()},i.buffered=function(){return Ra(0,0)},i.bufferedPercent=function(){return Ua(this.buffered(),this.duration_)},i.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},i.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},i.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},i.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval((function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}),250)},i.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.dispose=function(){this.clearTracks(ko.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),e.prototype.dispose.call(this)},i.clearTracks=function(e){var t=this;(e=[].concat(e)).forEach((function(e){for(var i=t[e+"Tracks"]()||[],n=i.length;n--;){var r=i[n];"text"===e&&t.removeRemoteTextTrack(r),i.removeTrack(r)}}))},i.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},i.reset=function(){},i.error=function(e){return void 0!==e&&(this.error_=new qa(e),this.trigger("error")),this.error_},i.played=function(){return this.hasStarted_?Ra(0,0):Ra()},i.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.initTrackListeners=function(){var e=this;ko.names.forEach((function(t){var i=ko[t],n=function(){e.trigger(t+"trackchange")},r=e[i.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),e.on("dispose",(function(){r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)}))}))},i.addWebVttScript_=function(){var e=this;if(!ee.WebVTT)if(ne.body.contains(this.el())){if(!this.options_["vtt.js"]&&Wr($e)&&Object.keys($e).length>0)return void this.trigger("vttjsloaded");var t=ne.createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=function(){e.trigger("vttjsloaded")},t.onerror=function(){e.trigger("vttjserror")},this.on("dispose",(function(){t.onload=null,t.onerror=null})),ee.WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)},i.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var s=function(){return e.trigger("texttrackchange")},a=function(){s();for(var e=0;e<t.length;e++){var i=t[e];i.removeEventListener("cuechange",s),"showing"===i.mode&&i.addEventListener("cuechange",s)}};a(),t.addEventListener("change",a),t.addEventListener("addtrack",a),t.addEventListener("removetrack",a),this.on("dispose",(function(){i.off("addtrack",n),i.off("removetrack",r),t.removeEventListener("change",a),t.removeEventListener("addtrack",a),t.removeEventListener("removetrack",a);for(var e=0;e<t.length;e++){t[e].removeEventListener("cuechange",s)}}))},i.addTextTrack=function(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,i,n,r){void 0===r&&(r={});var s=e.textTracks();r.kind=t,i&&(r.label=i),n&&(r.language=n),r.tech=e;var a=new wo.text.TrackClass(r);return s.addTrack(a),a}(this,e,t,i)},i.createRemoteTextTrack=function(e){var t=la(e,{tech:this});return new Co.remoteTextEl.TrackClass(t)},i.addRemoteTextTrack=function(e,t){var i=this;void 0===e&&(e={});var n=this.createRemoteTextTrack(e);return!0!==t&&!1!==t&&(Mr.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),t=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==t&&this.ready((function(){return i.autoRemoteTextTracks_.addTrack(n.track)})),n},i.removeRemoteTextTrack=function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)},i.getVideoPlaybackQuality=function(){return{}},i.requestPictureInPicture=function(){var e=this.options_.Promise||ee.Promise;if(e)return e.reject()},i.setPoster=function(){},i.playsinline=function(){},i.setPlaysinline=function(){},i.overrideNativeAudioTracks=function(){},i.overrideNativeVideoTracks=function(){},i.canPlayType=function(){return""},t.canPlayType=function(){return""},t.canPlaySource=function(e,i){return t.canPlayType(e.type)},t.isTech=function(e){return e.prototype instanceof t||e instanceof t||e===t},t.registerTech=function(e,i){if(t.techs_||(t.techs_={}),!t.isTech(i))throw new Error("Tech "+e+" must be a Tech");if(!t.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!t.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=ua(e),t.techs_[e]=i,t.techs_[oa(e)]=i,"Tech"!==e&&t.defaultTechOrder_.push(e),i},t.getTech=function(e){if(e)return t.techs_&&t.techs_[e]?t.techs_[e]:(e=ua(e),ee&&ee.videojs&&ee.videojs[e]?(Mr.warn("The "+e+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),ee.videojs[e]):void 0)},t}(ca);wo.names.forEach((function(e){var t=wo[e];Eo.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Eo.prototype.featuresVolumeControl=!0,Eo.prototype.featuresMuteControl=!0,Eo.prototype.featuresFullscreenResize=!1,Eo.prototype.featuresPlaybackRate=!1,Eo.prototype.featuresProgressEvents=!1,Eo.prototype.featuresSourceset=!1,Eo.prototype.featuresTimeupdateEvents=!1,Eo.prototype.featuresNativeTextTracks=!1,Eo.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){var n=e.sourceHandlers;n||(n=e.sourceHandlers=[]),void 0===i&&(i=n.length),n.splice(i,0,t)},e.canPlayType=function(t){for(var i,n=e.sourceHandlers||[],r=0;r<n.length;r++)if(i=n[r].canPlayType(t))return i;return""},e.selectSourceHandler=function(t,i){for(var n=e.sourceHandlers||[],r=0;r<n.length;r++)if(n[r].canHandleSource(t,i))return n[r];return null},e.canPlaySource=function(t,i){var n=e.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""};["seekable","seeking","duration"].forEach((function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(t){var i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:Mr.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler)},e.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)}},ca.registerComponent("Tech",Eo),Eo.registerTech("Tech",Eo),Eo.defaultTechOrder_=[];var xo={},Ao={},Io={};function Po(e,t,i){e.setTimeout((function(){return function e(t,i,n,r,s,a){void 0===t&&(t={});void 0===i&&(i=[]);void 0===s&&(s=[]);void 0===a&&(a=!1);var o=i,u=o[0],l=o.slice(1);if("string"==typeof u)e(t,xo[u],n,r,s,a);else if(u){var c=function(e,t){var i=Ao[e.id()],n=null;if(null==i)return n=t(e),Ao[e.id()]=[[t,n]],n;for(var r=0;r<i.length;r++){var s=i[r],a=s[0],o=s[1];a===t&&(n=o)}null===n&&(n=t(e),i.push([t,n]));return n}(r,u);if(!c.setSource)return s.push(c),e(t,l,n,r,s,a);c.setSource(Hr({},t),(function(i,o){if(i)return e(t,l,n,r,s,a);s.push(c),e(o,t.type===o.type?l:xo[o.type],n,r,s,a)}))}else l.length?e(t,l,n,r,s,a):a?n(t,s):e(t,xo["*"],n,r,s,!0)}(t,xo[t.type],i,e)}),1)}function Lo(e,t,i,n){void 0===n&&(n=null);var r="call"+ua(i),s=e.reduce(Ro(r),n),a=s===Io,o=a?null:t[i](s);return function(e,t,i,n){for(var r=e.length-1;r>=0;r--){var s=e[r];s[t]&&s[t](n,i)}}(e,i,o,a),o}var Oo={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1},Do={setCurrentTime:1,setMuted:1,setVolume:1},No={play:1,pause:1};function Ro(e){return function(t,i){return t===Io?Io:i[e]?i[e](t):t}}var Uo={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",oga:"audio/ogg",m3u8:"application/x-mpegURL",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Mo=function(e){void 0===e&&(e="");var t=fo(e);return Uo[t.toLowerCase()]||""};function Bo(e){if(!e.type){var t=Mo(e.src);t&&(e.type=t)}return e}var jo=function(e){function t(t,i,n){var r,s=la({createEl:!1},i);if(r=e.call(this,t,s,n)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var a=0,o=i.playerOptions.techOrder;a<o.length;a++){var u=ua(o[a]),l=Eo.getTech(u);if(u||(l=ca.getComponent(u)),l&&l.isSupported()){t.loadTech_(u);break}}return r}return ae(t,e),t}(ca);ca.registerComponent("MediaLoader",jo);var Fo=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).emitTapEvents(),n.enable(),n}ae(t,e);var i=t.prototype;return i.createEl=function(t,i,n){void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i=Hr({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass(),tabIndex:0},i),"button"===t&&Mr.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead."),n=Hr({role:"button"},n),this.tabIndex_=i.tabIndex;var r=e.prototype.createEl.call(this,t,i,n);return this.createControlTextEl(r),r},i.dispose=function(){this.controlTextEl_=null,e.prototype.dispose.call(this)},i.createControlTextEl=function(e){return this.controlTextEl_=Jr("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_},i.controlText=function(e,t){if(void 0===t&&(t=this.el()),void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,Zr(this.controlTextEl_,i),this.nonIconControl||t.setAttribute("title",i)},i.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)},i.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick),this.on("keydown",this.handleKeyDown))},i.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver),this.off("mouseout",this.handleMouseOut),this.off(["tap","click"],this.handleClick),this.off("keydown",this.handleKeyDown)},i.handleClick=function(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)},i.handleKeyDown=function(t){ue.isEventKey(t,"Space")||ue.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(ca);ca.registerComponent("ClickableComponent",Fo);var Vo=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update(),t.on("posterchange",Gs(se(n),n.update)),n}ae(t,e);var i=t.prototype;return i.dispose=function(){this.player().off("posterchange",this.update),e.prototype.dispose.call(this)},i.createEl=function(){return Jr("div",{className:"vjs-poster",tabIndex:-1})},i.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},i.setSrc=function(e){var t="";e&&(t='url("'+e+'")'),this.el_.style.backgroundImage=t},i.handleClick=function(e){if(this.player_.controls()){var t=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;!this.player_.tech(!0)||(Ca||Ta)&&t||this.player_.tech(!0).focus(),this.player_.paused()?$a(this.player_.play()):this.player_.pause()}},t}(Fo);ca.registerComponent("PosterImage",Vo);var Ho={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function qo(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Wo(e,t,i){try{e.style[t]=i}catch(e){return}}var zo=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var s=Gs(se(r),r.updateDisplay);return t.on("loadstart",Gs(se(r),r.toggleDisplay)),t.on("texttrackchange",s),t.on("loadedmetadata",Gs(se(r),r.preselectTrack)),t.ready(Gs(se(r),(function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",s),t.on("playerresize",s),ee.addEventListener("orientationchange",s),t.on("dispose",(function(){return ee.removeEventListener("orientationchange",s)}));for(var e=this.options_.playerOptions.tracks||[],i=0;i<e.length;i++)this.player_.addRemoteTextTrack(e[i],!0);this.preselectTrack()}}))),r}ae(t,e);var i=t.prototype;return i.preselectTrack=function(){for(var e,t,i,n={captions:1,subtitles:1},r=this.player_.textTracks(),s=this.player_.cache_.selectedLanguage,a=0;a<r.length;a++){var o=r[a];s&&s.enabled&&s.language&&s.language===o.language&&o.kind in n?o.kind===s.kind?i=o:i||(i=o):s&&!s.enabled?(i=null,e=null,t=null):o.default&&("descriptions"!==o.kind||e?o.kind in n&&!t&&(t=o):e=o)}i?i.mode="showing":t?t.mode="showing":e&&(e.mode="showing")},i.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},i.clearDisplay=function(){"function"==typeof ee.WebVTT&&ee.WebVTT.processCues(ee,[],this.el_)},i.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var i=[],n=0;n<e.length;++n){var r=e[n];"showing"===r.mode&&i.push(r)}this.updateForTrack(i)}else{for(var s=null,a=null,o=e.length;o--;){var u=e[o];"showing"===u.mode&&("descriptions"===u.kind?s=u:a=u)}a?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(a)):s&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(s))}},i.updateDisplayState=function(e){for(var t=this.player_.textTrackSettings.getValues(),i=e.activeCues,n=i.length;n--;){var r=i[n];if(r){var s=r.displayState;if(t.color&&(s.firstChild.style.color=t.color),t.textOpacity&&Wo(s.firstChild,"color",qo(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(s.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Wo(s.firstChild,"backgroundColor",qo(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Wo(s,"backgroundColor",qo(t.windowColor,t.windowOpacity)):s.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?s.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===t.edgeStyle?s.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===t.edgeStyle?s.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===t.edgeStyle&&(s.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),t.fontPercent&&1!==t.fontPercent){var a=ee.parseFloat(s.style.fontSize);s.style.fontSize=a*t.fontPercent+"px",s.style.height="auto",s.style.top="auto",s.style.bottom="2px"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?s.firstChild.style.fontVariant="small-caps":s.firstChild.style.fontFamily=Ho[t.fontFamily])}}},i.updateForTrack=function(e){if(Array.isArray(e)||(e=[e]),"function"==typeof ee.WebVTT&&!e.every((function(e){return!e.activeCues}))){for(var t=[],i=0;i<e.length;++i)for(var n=e[i],r=0;r<n.activeCues.length;++r)t.push(n.activeCues[r]);ee.WebVTT.processCues(ee,t,this.el_);for(var s=0;s<e.length;++s){for(var a=e[s],o=0;o<a.activeCues.length;++o){var u=a.activeCues[o].displayState;is(u,"vjs-text-track-cue"),is(u,"vjs-text-track-cue-"+(a.language?a.language:s))}this.player_.textTrackSettings&&this.updateDisplayState(a)}}},t}(ca);ca.registerComponent("TextTrackDisplay",zo);var $o=function(e){function t(){return e.apply(this,arguments)||this}return ae(t,e),t.prototype.createEl=function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player"),n=Jr("span",{className:"vjs-control-text",innerHTML:this.localize("{1} is loading.",[i])}),r=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(n),r},t}(ca);ca.registerComponent("LoadingSpinner",$o);var Go=function(e){function t(){return e.apply(this,arguments)||this}ae(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===t&&(t={}),void 0===i&&(i={}),t=Hr({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass()},t),i=Hr({type:"button"},i);var n=ca.prototype.createEl.call(this,"button",t,i);return this.createControlTextEl(n),n},i.addChild=function(e,t){void 0===t&&(t={});var i=this.constructor.name;return Mr.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),ca.prototype.addChild.call(this,e,t)},i.enable=function(){e.prototype.enable.call(this),this.el_.removeAttribute("disabled")},i.disable=function(){e.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},i.handleKeyDown=function(t){ue.isEventKey(t,"Space")||ue.isEventKey(t,"Enter")?t.stopPropagation():e.prototype.handleKeyDown.call(this,t)},t}(Fo);ca.registerComponent("Button",Go);var Xo=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).mouseused_=!1,n.on("mousedown",n.handleMouseDown),n}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-big-play-button"},i.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){var i=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;return $a(t),void(!this.player_.tech(!0)||(Ca||Ta)&&i||this.player_.tech(!0).focus())}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(r){var s=function(){return r.focus()};za(t)?t.then(s,(function(){})):this.setTimeout(s,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(Go);Xo.prototype.controlText_="Play Video",ca.registerComponent("BigPlayButton",Xo);var Ko=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){ue.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(Go);ca.registerComponent("CloseButton",Ko);var Yo=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",n.handlePlay),n.on(t,"pause",n.handlePause),i.replay&&n.on(t,"ended",n.handleEnded),n}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},t}(Go);Yo.prototype.controlText_="Play",ca.registerComponent("PlayToggle",Yo);var Qo=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),s=Math.floor(t/60%60),a=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=i="-"),(r=r>0||a>0?r+":":"")+(n=((r||s>=10)&&n<10?"0"+n:n)+":")+(i=i<10?"0"+i:i)},Jo=Qo;function Zo(e,t){return void 0===t&&(t=e),Jo(e,t)}var eu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["timeupdate","ended"],n.updateContent),n.updateTextNode_(),n}ae(t,e);var i=t.prototype;return i.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control",innerHTML:'<span class="vjs-control-text" role="presentation">'+this.localize(this.labelText_)+" </span>"});return this.contentEl_=Jr("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},i.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},i.updateTextNode_=function(e){var t=this;void 0===e&&(e=0),e=Zo(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestAnimationFrame((function(){if(t.contentEl_){var e=t.textNode_;t.textNode_=ne.createTextNode(t.formattedTime_),t.textNode_&&(e?t.contentEl_.replaceChild(t.textNode_,e):t.contentEl_.appendChild(t.textNode_))}})))},i.updateContent=function(e){},t}(ca);eu.prototype.labelText_="Time",eu.prototype.controlText_="Time",ca.registerComponent("TimeDisplay",eu);var tu=function(e){function t(){return e.apply(this,arguments)||this}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)},t}(eu);tu.prototype.labelText_="Current Time",tu.prototype.controlText_="Current Time",ca.registerComponent("CurrentTimeDisplay",tu);var iu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",n.updateContent),n.on(t,"loadstart",n.updateContent),n.on(t,"loadedmetadata",n.updateContent),n}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(eu);iu.prototype.labelText_="Duration",iu.prototype.controlText_="Duration",ca.registerComponent("DurationDisplay",iu);var nu=function(e){function t(){return e.apply(this,arguments)||this}return ae(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/</span></div>"},{"aria-hidden":!0})},t}(ca);ca.registerComponent("TimeDivider",nu);var ru=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",n.updateContent),n}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return t.insertBefore(Jr("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},t}(eu);ru.prototype.labelText_="Remaining Time",ru.prototype.controlText_="Remaining Time",ca.registerComponent("RemainingTimeDisplay",ru);var su=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",n.updateShowing),n}ae(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=Jr("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},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(ca);ca.registerComponent("LiveDisplay",su);var au=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatus),n}ae(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=Jr("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatus),this.textEl_=null,e.prototype.dispose.call(this)},t}(Go);au.prototype.controlText_="Seek to live, currently playing live",ca.registerComponent("SeekToLive",au);var ou=function(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))},uu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}ae(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown),this.on("touchstart",this.handleMouseDown),this.on("keydown",this.handleKeyDown),this.on("click",this.handleClick),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown),this.off("touchstart",this.handleMouseDown),this.off("keydown",this.handleKeyDown),this.off("click",this.handleClick),this.off(this.player_,"controlsvisible",this.update),this.off(e,"mousemove",this.handleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchmove",this.handleMouseMove),this.off(e,"touchend",this.handleMouseUp),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=Hr({tabIndex:0},i),n=Hr({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Sa||e.preventDefault(),cs(),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(e)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;hs(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchmove",this.handleMouseMove),this.off(e,"touchend",this.handleMouseUp),this.update()},i.update=function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestAnimationFrame((function(){var i=e.vertical()?"height":"width";e.bar.el().style[i]=(100*t).toFixed(2)+"%"}))),t}},i.getProgress=function(){return Number(ou(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var t=fs(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){ue.isEventKey(t,"Left")||ue.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):ue.isEventKey(t,"Right")||ue.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(ca);ca.registerComponent("Slider",uu);var lu=function(e,t){return ou(e/t*100,0,100).toFixed(2)+"%"},cu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",n.update),n}ae(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),i=Jr("span",{className:"vjs-control-text"}),n=Jr("span",{textContent:this.localize("Loaded")}),r=ne.createTextNode(": ");return this.percentageEl_=Jr("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),t},i.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this;this.requestAnimationFrame((function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),s=t.partEls_,a=lu(r,n);t.percent_!==a&&(t.el_.style.width=a,Zr(t.percentageEl_,a),t.percent_=a);for(var o=0;o<i.length;o++){var u=i.start(o),l=i.end(o),c=s[o];c||(c=t.el_.appendChild(Jr()),s[o]=c),c.dataset.start===u&&c.dataset.end===l||(c.dataset.start=u,c.dataset.end=l,c.style.left=lu(u,r),c.style.width=lu(l-u,r))}for(var h=s.length;h>i.length;h--)t.el_.removeChild(s[h-1]);s.length=i.length}))},t}(ca);ca.registerComponent("LoadProgressBar",cu);var hu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=Xs(Gs(se(n),n.update),30),n}ae(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=ds(this.el_),r=ds(this.player_.el()),s=e.width*t;if(r&&n){var a=e.left-r.left+s,o=e.width-s+(r.right-e.right),u=n.width/2;a<u?u+=u-a:o<u&&(u=o),u<0?u=0:u>n.width&&(u=n.width),this.el_.style.right="-"+u+"px",this.write(i)}},i.write=function(e){Zr(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame((function(){var s,a=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),u=o-t*o;s=(u<1?"":"-")+Zo(u,o)}else s=Zo(i,a);r.update(e,t,s),n&&n()}))},t}(ca);ca.registerComponent("TimeTooltip",hu);var du=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=Xs(Gs(se(n),n.update),30),n}ae(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(ca);du.prototype.options_={children:[]},Pa||va||du.prototype.options_.children.push("timeTooltip"),ca.registerComponent("PlayProgressBar",du);var pu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=Xs(Gs(se(n),n.update),30),n}ae(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,(function(){i.el_.style.left=e.width*t+"px"}))},t}(ca);pu.prototype.options_={children:["timeTooltip"]},ca.registerComponent("MouseTimeDisplay",pu);var fu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}ae(t,e);var i=t.prototype;return i.setEventHandlers_=function(){this.update_=Gs(this,this.update),this.update=Xs(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.on(this.player_,["playing"],this.enableInterval_),this.on(this.player_,["ended","pause","waiting"],this.disableInterval_),"hidden"in ne&&"visibilityState"in ne&&this.on(ne,"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(e){ne.hidden?this.disableInterval_(e):(this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(t){var i=this,n=e.prototype.update.call(this);return this.requestAnimationFrame((function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,r=i.player_.duration();t&&t.isLive()&&(r=i.player_.liveTracker.liveCurrentTime()),i.percent_!==n&&(i.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),i.percent_=n),i.currentTime_===e&&i.duration_===r||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[Zo(e,r),Zo(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(ds(i.el()),i.getProgress())})),n},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},i.handleMouseDown=function(t){bs(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},i.handleMouseMove=function(e){if(bs(e)){var t,i=this.calculateDistance(e),n=this.player_.liveTracker;if(n&&n.isLive()){if(i>=.99)return void n.seekToLiveEdge();var r=n.seekableStart(),s=n.liveCurrentTime();if((t=r+i*n.liveWindow())>=s&&(t=s),t<=r&&(t=r+.1),t===1/0)return}else(t=i*this.player_.duration())===this.player_.duration()&&(t-=.1);this.player_.currentTime(t)}},i.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?$a(this.player_.play()):this.update_()},i.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},i.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(t){if(ue.isEventKey(t,"Space")||ue.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(ue.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(0);else if(ue.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.duration());else if(/^[0-9]$/.test(ue(t))){t.preventDefault(),t.stopPropagation();var i=10*(ue.codes[ue(t)]-ue.codes[0])/100;this.player_.currentTime(this.player_.duration()*i)}else ue.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()-60)):ue.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableInterval_),this.off(this.player_,["ended","pause","waiting"],this.disableInterval_),"hidden"in ne&&"visibilityState"in ne&&this.off(ne,"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},t}(uu);fu.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},Pa||va||fu.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),ca.registerComponent("SeekBar",fu);var mu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=Xs(Gs(se(n),n.handleMouseMove),30),n.throttledHandleMouseSeek=Xs(Gs(se(n),n.handleMouseSeek),30),n.enable(),n}ae(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(i||n){var r=t.el(),s=ds(r),a=fs(r,e).x;a=ou(0,1,a),n&&n.update(s,a),i&&i.update(s,t.getProgress())}}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseUp(e),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}(ca);mu.prototype.options_={children:["seekBar"]},ca.registerComponent("ProgressControl",mu);var gu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["enterpictureinpicture","leavepictureinpicture"],n.handlePictureInPictureChange),ne.pictureInPictureEnabled||n.disable(),n}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture")},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}(Go);gu.prototype.controlText_="Picture-in-Picture",ca.registerComponent("PictureInPictureToggle",gu);var vu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"fullscreenchange",n.handleFullscreenChange),!1===ne[t.fsApi_.fullscreenEnabled]&&n.disable(),n}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(Go);vu.prototype.controlText_="Fullscreen",ca.registerComponent("FullscreenToggle",vu);var yu=function(e){function t(){return e.apply(this,arguments)||this}return ae(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})},t}(ca);ca.registerComponent("VolumeLevel",yu);var _u=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",n.updateLastVolume_),n.on(t,"volumechange",n.updateARIAAttributes),t.ready((function(){return n.updateARIAAttributes()})),n}ae(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){bs(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){bs(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",(function(){0===e.player_.volume()&&e.player_.lastVolume_(t)}))},t}(uu);_u.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},_u.prototype.playerEvent="volumechange",ca.registerComponent("VolumeBar",_u);var bu=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,(void 0===i.volumeBar||Wr(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),n=e.call(this,t,i)||this,function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(se(n),t),n.throttledHandleMouseMove=Xs(Gs(se(n),n.handleMouseMove),30),n.on("mousedown",n.handleMouseDown),n.on("touchstart",n.handleMouseDown),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}ae(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchend",this.handleMouseUp)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(ca);bu.prototype.options_={children:["volumeBar"]},ca.registerComponent("VolumeControl",bu);var Tu=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(se(n),t),n.on(t,["loadstart","volumechange"],n.update),n}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;Pa&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)ns(this.el_,"vjs-vol-"+i);is(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(Go);Tu.prototype.controlText_="Mute",ca.registerComponent("MuteToggle",Tu);var Su=function(e){function t(t,i){var n;return void 0===i&&(i={}),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||Wr(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).on(t,["loadstart"],n.volumePanelState_),n.on(n.muteToggle,"keyup",n.handleKeyPress),n.on(n.volumeControl,"keyup",n.handleVolumeControlKeyUp),n.on("keydown",n.handleKeyPress),n.on("mouseover",n.handleMouseOver),n.on("mouseout",n.handleMouseOut),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}ae(t,e);var i=t.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},i.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},i.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){ue.isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),Fs(ne,"keyup",Gs(this,this.handleKeyPress))},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),Vs(ne,"keyup",Gs(this,this.handleKeyPress))},i.handleKeyPress=function(e){ue.isEventKey(e,"Esc")&&this.handleMouseOut()},t}(ca);Su.prototype.options_={children:["muteToggle","volumeControl"]},ca.registerComponent("VolumePanel",Su);var ku=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",n.handleKeyDown),n.boundHandleBlur_=Gs(se(n),n.handleBlur),n.boundHandleTapClick_=Gs(se(n),n.handleTapClick),n}ae(t,e);var i=t.prototype;return i.addEventListenerForItem=function(e){e instanceof ca&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof ca&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},i.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},i.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=Jr(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),Fs(i,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),i},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},i.handleBlur=function(e){var t=e.relatedTarget||ne.activeElement;if(!this.children().some((function(e){return e.el()===t}))){var i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}},i.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter((function(t){return t.el()===e.target}))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},i.handleKeyDown=function(e){ue.isEventKey(e,"Left")||ue.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(ue.isEventKey(e,"Right")||ue.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},i.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},i.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].className&&/vjs-menu-title/.test(t[0].className)&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},t}(ca);ca.registerComponent("Menu",ku);var Cu=function(e){function t(t,i){var n;void 0===i&&(i={}),(n=e.call(this,t,i)||this).menuButton_=new Go(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=Go.prototype.buildCSSClass();return n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0,n.on(n.menuButton_,"tap",n.handleClick),n.on(n.menuButton_,"click",n.handleClick),n.on(n.menuButton_,"keydown",n.handleKeyDown),n.on(n.menuButton_,"mouseenter",(function(){n.addClass("vjs-hover"),n.menu.show(),Fs(ne,"keyup",Gs(se(n),n.handleMenuKeyUp))})),n.on("mouseleave",n.handleMouseLeave),n.on("keydown",n.handleSubmenuKeyDown),n}ae(t,e);var i=t.prototype;return i.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},i.createMenu=function(){var e=new ku(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=Jr("li",{className:"vjs-menu-title",innerHTML:ua(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;var i=new ca(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n<this.items.length;n++)e.addItem(this.items[n]);return e},i.createItems=function(){},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},i.buildWrapperCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+Go.prototype.buildCSSClass()+" "+e.prototype.buildCSSClass.call(this)},i.buildCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+e.prototype.buildCSSClass.call(this)},i.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},i.dispose=function(){this.handleMouseLeave(),e.prototype.dispose.call(this)},i.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},i.handleMouseLeave=function(e){this.removeClass("vjs-hover"),Vs(ne,"keyup",Gs(this,this.handleMenuKeyUp))},i.focus=function(){this.menuButton_.focus()},i.blur=function(){this.menuButton_.blur()},i.handleKeyDown=function(e){ue.isEventKey(e,"Esc")||ue.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),ue.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(ue.isEventKey(e,"Up")||ue.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},i.handleMenuKeyUp=function(e){(ue.isEventKey(e,"Esc")||ue.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},i.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},i.handleSubmenuKeyDown=function(e){(ue.isEventKey(e,"Esc")||ue.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),ue.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},i.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Pa&&Yr())return;this.menu.focus()}},i.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},i.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},i.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},t}(ca);ca.registerComponent("MenuButton",Cu);var wu=function(e){function t(t,i){var n,r=i.tracks;if((n=e.call(this,t,i)||this).items.length<=1&&n.hide(),!r)return se(n);var s=Gs(se(n),n.update);return r.addEventListener("removetrack",s),r.addEventListener("addtrack",s),n.player_.on("ready",s),n.player_.on("dispose",(function(){r.removeEventListener("removetrack",s),r.removeEventListener("addtrack",s)})),n}return ae(t,e),t}(Cu);ca.registerComponent("TrackButton",wu);var Eu=["Tab","Esc","Up","Down","Right","Left"],xu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).selectable=i.selectable,n.isSelected_=i.selected||!1,n.multiSelectable=i.multiSelectable,n.selected(n.isSelected_),n.selectable?n.multiSelectable?n.el_.setAttribute("role","menuitemcheckbox"):n.el_.setAttribute("role","menuitemradio"):n.el_.setAttribute("role","menuitem"),n}ae(t,e);var i=t.prototype;return i.createEl=function(t,i,n){return this.nonIconControl=!0,e.prototype.createEl.call(this,"li",Hr({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"</span>",tabIndex:-1},i),n)},i.handleKeyDown=function(t){Eu.some((function(e){return ue.isEventKey(t,e)}))||e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){this.selected(!0)},i.selected=function(e){this.selectable&&(e?(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}(Fo);ca.registerComponent("MenuItem",xu);var Au=function(e){function t(t,i){var n,r=i.track,s=t.textTracks();i.label=r.label||r.language||"Unknown",i.selected="showing"===r.mode,(n=e.call(this,t,i)||this).track=r,n.kinds=(i.kinds||[i.kind||n.track.kind]).filter(Boolean);var a,o=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(se(n),t)},u=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleSelectedLanguageChange.apply(se(n),t)};(t.on(["loadstart","texttrackchange"],o),s.addEventListener("change",o),s.addEventListener("selectedlanguagechange",u),n.on("dispose",(function(){t.off(["loadstart","texttrackchange"],o),s.removeEventListener("change",o),s.removeEventListener("selectedlanguagechange",u)})),void 0===s.onchange)&&n.on(["tap","click"],(function(){if("object"!=typeof ee.Event)try{a=new ee.Event("change")}catch(e){}a||(a=ne.createEvent("Event")).initEvent("change",!0,!0),s.dispatchEvent(a)}));return n.handleTracksChange(),n}ae(t,e);var i=t.prototype;return i.handleClick=function(t){var i=this.track,n=this.player_.textTracks();if(e.prototype.handleClick.call(this,t),n)for(var r=0;r<n.length;r++){var s=n[r];-1!==this.kinds.indexOf(s.kind)&&(s===i?"showing"!==s.mode&&(s.mode="showing"):"disabled"!==s.mode&&(s.mode="disabled"))}},i.handleTracksChange=function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)},i.handleSelectedLanguageChange=function(e){if("showing"===this.track.mode){var t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},i.dispose=function(){this.track=null,e.prototype.dispose.call(this)},t}(xu);ca.registerComponent("TextTrackMenuItem",Au);var Iu=function(e){function t(t,i){return i.track={player:t,kind:i.kind,kinds:i.kinds,default:!1,mode:"disabled"},i.kinds||(i.kinds=[i.kind]),i.label?i.track.label=i.label:i.track.label=i.kinds.join(" and ")+" off",i.selectable=!0,i.multiSelectable=!1,e.call(this,t,i)||this}ae(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var s=t[n];if(this.options_.kinds.indexOf(s.kind)>-1&&"showing"===s.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var s=t[n];if(["captions","descriptions","subtitles"].indexOf(s.kind)>-1&&"showing"===s.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(Au);ca.registerComponent("OffTextTrackMenuItem",Iu);var Pu=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return ae(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=Au),this.label_&&(i=this.label_+" off"),e.push(new Iu(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<n.length;r++){var s=n[r];if(this.kinds_.indexOf(s.kind)>-1){var a=new t(this.player_,{track:s,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});a.addClass("vjs-"+s.kind+"-menu-item"),e.push(a)}}return e},t}(wu);ca.registerComponent("TextTrackButton",Pu);var Lu=function(e){function t(t,i){var n,r=i.track,s=i.cue,a=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=s.text,i.selected=s.startTime<=a&&a<s.endTime,(n=e.call(this,t,i)||this).track=r,n.cue=s,r.addEventListener("cuechange",Gs(se(n),n.update)),n}ae(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},i.update=function(e){var t=this.cue,i=this.player_.currentTime();this.selected(t.startTime<=i&&i<t.endTime)},t}(xu);ca.registerComponent("ChaptersTrackMenuItem",Lu);var Ou=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)},i.update=function(t){this.track_&&(!t||"addtrack"!==t.type&&"removetrack"!==t.type)||this.setTrack(this.findChaptersTrack()),e.prototype.update.call(this)},i.setTrack=function(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";var i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_)}}},i.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;t>=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(ua(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i<n;i++){var r=t[i],s=new Lu(this.player_,{track:this.track_,cue:r});e.push(s)}return e},t}(Pu);Ou.prototype.kind_="chapters",Ou.prototype.controlText_="Chapters",ca.registerComponent("ChaptersButton",Ou);var Du=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var s=t.textTracks(),a=Gs(se(r),r.handleTracksChange);return s.addEventListener("change",a),r.on("dispose",(function(){s.removeEventListener("change",a)})),r}ae(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!1,n=0,r=t.length;n<r;n++){var s=t[n];if(s.kind!==this.kind_&&"showing"===s.mode){i=!0;break}}i?this.disable():this.enable()},i.buildCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(Pu);Du.prototype.kind_="descriptions",Du.prototype.controlText_="Descriptions",ca.registerComponent("DescriptionsButton",Du);var Nu=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(Pu);Nu.prototype.kind_="subtitles",Nu.prototype.controlText_="Subtitles",ca.registerComponent("SubtitlesButton",Nu);var Ru=function(e){function t(t,i){var n;return i.track={player:t,kind:i.kind,label:i.kind+" settings",selectable:!1,default:!1,mode:"disabled"},i.selectable=!1,i.name="CaptionSettingsMenuItem",(n=e.call(this,t,i)||this).addClass("vjs-texttrack-settings"),n.controlText(", opens "+i.kind+" settings dialog"),n}return ae(t,e),t.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},t}(Au);ca.registerComponent("CaptionSettingsMenuItem",Ru);var Uu=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-captions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-captions-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Ru(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t)},t}(Pu);Uu.prototype.kind_="captions",Uu.prototype.controlText_="Captions",ca.registerComponent("CaptionsButton",Uu);var Mu=function(e){function t(){return e.apply(this,arguments)||this}return ae(t,e),t.prototype.createEl=function(t,i,n){var r='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"captions"===this.options_.track.kind&&(r+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Captions")+"</span>\n "),r+="</span>",e.prototype.createEl.call(this,t,Hr({innerHTML:r},i),n)},t}(Au);ca.registerComponent("SubsCapsMenuItem",Mu);var Bu=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)>-1&&(n.label_="captions"),n.menuButton_.controlText(ua(n.label_)),n}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Ru(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=e.prototype.createItems.call(this,t,Mu)},t}(Pu);Bu.prototype.kinds_=["captions","subtitles"],Bu.prototype.controlText_="Subtitles",ca.registerComponent("SubsCapsButton",Bu);var ju=function(e){function t(t,i){var n,r=i.track,s=t.audioTracks();i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item");var a=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(se(n),t)};return s.addEventListener("change",a),n.on("dispose",(function(){s.removeEventListener("change",a)})),n}ae(t,e);var i=t.prototype;return i.createEl=function(t,i,n){var r='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"main-desc"===this.options_.track.kind&&(r+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Descriptions")+"</span>\n "),r+="</span>",e.prototype.createEl.call(this,t,Hr({innerHTML:r},i),n)},i.handleClick=function(t){var i=this.player_.audioTracks();e.prototype.handleClick.call(this,t);for(var n=0;n<i.length;n++){var r=i[n];r.enabled=r===this.track}},i.handleTracksChange=function(e){this.selected(this.track.enabled)},t}(xu);ca.registerComponent("AudioTrackMenuItem",ju);var Fu=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.audioTracks(),e.call(this,t,i)||this}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-audio-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-audio-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(e){void 0===e&&(e=[]),this.hideThreshold_=1;for(var t=this.player_.audioTracks(),i=0;i<t.length;i++){var n=t[i];e.push(new ju(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e},t}(wu);Fu.prototype.controlText_="Audio Track",ca.registerComponent("AudioTrackButton",Fu);var Vu=function(e){function t(t,i){var n,r=i.rate,s=parseFloat(r,10);return i.label=r,i.selected=1===s,i.selectable=!0,i.multiSelectable=!1,(n=e.call(this,t,i)||this).label=r,n.rate=s,n.on(t,"ratechange",n.update),n}ae(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},i.update=function(e){this.selected(this.player().playbackRate()===this.rate)},t}(xu);Vu.prototype.contentElType="button",ca.registerComponent("PlaybackRateMenuItem",Vu);var Hu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateVisibility(),n.updateLabel(),n.on(t,"loadstart",n.updateVisibility),n.on(t,"ratechange",n.updateLabel),n}ae(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this);return this.labelEl_=Jr("div",{className:"vjs-playback-rate-value",innerHTML:"1x"}),t.appendChild(this.labelEl_),t},i.dispose=function(){this.labelEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)},i.createMenu=function(){var e=new ku(this.player()),t=this.playbackRates();if(t)for(var i=t.length-1;i>=0;i--)e.addChild(new Vu(this.player(),{rate:t[i]+"x"}));return e},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){for(var t=this.player().playbackRate(),i=this.playbackRates(),n=i[0],r=0;r<i.length;r++)if(i[r]>t){n=i[r];break}this.player().playbackRate(n)},i.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},t}(Cu);Hu.prototype.controlText_="Playback Rate",ca.registerComponent("PlaybackRateMenuButton",Hu);var qu=function(e){function t(){return e.apply(this,arguments)||this}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},t}(ca);ca.registerComponent("Spacer",qu);var Wu=function(e){function t(){return e.apply(this,arguments)||this}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){var t=e.prototype.createEl.call(this,{className:this.buildCSSClass()});return t.innerHTML=" ",t},t}(qu);ca.registerComponent("CustomControlSpacer",Wu);var zu=function(e){function t(){return e.apply(this,arguments)||this}return ae(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(ca);zu.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in ne&&zu.prototype.options_.children.splice(zu.prototype.options_.children.length-1,0,"pictureInPictureToggle"),ca.registerComponent("ControlBar",zu);var $u=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",n.open),n}ae(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(Ya);$u.prototype.options_=re({},Ya.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),ca.registerComponent("ErrorDisplay",$u);var Gu=["#000","Black"],Xu=["#00F","Blue"],Ku=["#0FF","Cyan"],Yu=["#0F0","Green"],Qu=["#F0F","Magenta"],Ju=["#F00","Red"],Zu=["#FFF","White"],el=["#FF0","Yellow"],tl=["1","Opaque"],il=["0.5","Semi-Transparent"],nl=["0","Transparent"],rl={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Gu,Zu,Ju,Yu,Xu,el,Qu,Ku]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[tl,il,nl]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Zu,Gu,Ju,Yu,Xu,el,Qu,Ku]},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(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[tl,il]},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:[nl,il,tl]}};function sl(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}rl.windowColor.options=rl.backgroundColor.options;var al=function(e){function t(t,i){var n;return i.temporary=!1,(n=e.call(this,t,i)||this).updateDisplay=Gs(se(n),n.updateDisplay),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=Jr("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")}),n.el().appendChild(n.endDialog),n.setDefaults(),void 0===i.persistTextTrackSettings&&(n.options_.persistTextTrackSettings=n.options_.playerOptions.persistTextTrackSettings),n.on(n.$(".vjs-done-button"),"click",(function(){n.saveSettings(),n.close()})),n.on(n.$(".vjs-default-button"),"click",(function(){n.setDefaults(),n.updateDisplay()})),Vr(rl,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}ae(t,e);var i=t.prototype;return i.dispose=function(){this.endDialog=null,e.prototype.dispose.call(this)},i.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=rl[e],s=r.id.replace("%s",this.id_),a=[t,s].join(" ").trim();return["<"+i+' id="'+s+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"</"+i+">",'<select aria-labelledby="'+a+'">'].concat(r.options.map((function(e){var t=s+"-"+e[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+e[0]+'" ','aria-labelledby="'+a+" "+t+'">',n.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")},i.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",e),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")},i.createElBgColor_=function(){var e="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",e),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")},i.createElWinColor_=function(){var e="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",e),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")},i.createElColors_=function(){return Jr("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return Jr("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.createElControls_=function(){var e=this.localize("restore all settings to the default values");return Jr("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+e+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+e+"</span>","</button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})},i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.label=function(){return this.localize("Caption Settings Dialog")},i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.buildCSSClass=function(){return e.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e,t,i,n=this;return t=function(e,t,i){var r,s,a=(r=n.$(t.selector),s=t.parser,sl(r.options[r.options.selectedIndex].value,s));return void 0!==a&&(e[i]=a),e},void 0===(i={})&&(i=0),Fr(e=rl).reduce((function(i,n){return t(i,e[n],n)}),i)},i.setValues=function(e){var t=this;Vr(rl,(function(i,n){!function(e,t,i){if(t)for(var n=0;n<e.options.length;n++)if(sl(e.options[n].value,i)===t){e.selectedIndex=n;break}}(t.$(i.selector),e[n],i.parser)}))},i.setDefaults=function(){var e=this;Vr(rl,(function(t){var i=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=i}))},i.restoreSettings=function(){var e;try{e=JSON.parse(ee.localStorage.getItem("vjs-text-track-settings"))}catch(e){Mr.warn(e)}e&&this.setValues(e)},i.saveSettings=function(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?ee.localStorage.setItem("vjs-text-track-settings",JSON.stringify(e)):ee.localStorage.removeItem("vjs-text-track-settings")}catch(e){Mr.warn(e)}}},i.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},i.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()},t}(Ya);ca.registerComponent("TextTrackSettings",al);var ol=function(e){function t(t,i){var n,r=i.ResizeObserver||ee.ResizeObserver;null===i.ResizeObserver&&(r=!1);var s=la({createEl:!r,reportTouchActivity:!1},i);return(n=e.call(this,t,s)||this).ResizeObserver=i.ResizeObserver||ee.ResizeObserver,n.loadListener_=null,n.resizeObserver_=null,n.debouncedHandler_=function(e,t,i,n){var r;void 0===n&&(n=ee);var s=function(){var s=this,a=arguments,o=function(){r=null,o=null,i||e.apply(s,a)};!r&&i&&e.apply(s,a),n.clearTimeout(r),r=n.setTimeout(o,t)};return s.cancel=function(){n.clearTimeout(r),r=null},s}((function(){n.resizeHandler()}),100,!1,se(n)),r?(n.resizeObserver_=new n.ResizeObserver(n.debouncedHandler_),n.resizeObserver_.observe(t.el())):(n.loadListener_=function(){if(n.el_&&n.el_.contentWindow){var e=n.debouncedHandler_,t=n.unloadListener_=function(){Vs(this,"resize",e),Vs(this,"unload",t),t=null};Fs(n.el_.contentWindow,"unload",t),Fs(n.el_.contentWindow,"resize",e)}},n.one("load",n.loadListener_)),n}ae(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})},i.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},i.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,e.prototype.dispose.call(this)},t}(ca);ca.registerComponent("ResizeManager",ol);var ul={trackingThreshold:30,liveTolerance:15},ll=function(e){function t(t,i){var n,r=la(ul,i,{createEl:!1});return(n=e.call(this,t,r)||this).reset_(),n.on(n.player_,"durationchange",n.handleDurationchange),Ca&&"hidden"in ne&&"visibilityState"in ne&&n.on(ne,"visibilitychange",n.handleVisibilityChange),n}ae(t,e);var i=t.prototype;return i.handleVisibilityChange=function(){this.player_.duration()===1/0&&(ne.hidden?this.stopTracking():this.startTracking())},i.trackLive_=function(){var e=this.player_.seekable();if(e&&e.length){var t=Number(ee.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;var n=this.liveCurrentTime(),r=this.player_.currentTime(),s=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-r)>this.options_.liveTolerance;this.timeupdateSeen_&&n!==1/0||(s=!1),s!==this.behindLiveEdge_&&(this.behindLiveEdge_=s,this.trigger("liveedgechange"))}},i.handleDurationchange=function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},i.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLive_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLive_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked):(this.one(this.player_,"play",this.handlePlay),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate)))},i.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked)},i.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=!this.skipNextSeeked_&&e>2,this.skipNextSeeked_=!1,this.trackLive_()},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge)},i.reset_=function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.skipNextSeeked_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLive_),this.off(this.player_,"seeked",this.handleSeeked),this.off(this.player_,"play",this.handlePlay),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate),this.off(this.player_,"timeupdate",this.seekToLiveEdge)},i.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},i.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?1/0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return"number"==typeof this.trackingInterval_},i.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.skipNextSeeked_=!0,this.player_.currentTime(this.liveCurrentTime()))},i.dispose=function(){this.off(ne,"visibilitychange",this.handleVisibilityChange),this.stopTracking(),e.prototype.dispose.call(this)},t}(ca);ca.registerComponent("LiveTracker",ll);var cl,hl=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var s=0;s<i.length;s++){var a=i[s].src;a&&-1===n.indexOf(a)&&n.push(a)}return!!n.length&&(1===n.length&&(r=n[0]),e.triggerSourceset(r),!0)},dl=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(e){var t=ne.createElement(this.nodeName.toLowerCase());t.innerHTML=e;for(var i=ne.createDocumentFragment();t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",ee.Element.prototype.appendChild.call(this,i),this.innerHTML}}),pl=function(e,t){for(var i={},n=0;n<e.length&&!((i=Object.getOwnPropertyDescriptor(e[n],t))&&i.set&&i.get);n++);return i.enumerable=!0,i.configurable=!0,i},fl=function(e){var t=e.el();if(!t.resetSourceWatch_){var i={},n=function(e){return pl([e.el(),ee.HTMLMediaElement.prototype,ee.Element.prototype,dl],"innerHTML")}(e),r=function(i){return function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];var a=i.apply(t,r);return hl(e),a}};["append","appendChild","insertAdjacentHTML"].forEach((function(e){t[e]&&(i[e]=t[e],t[e]=r(i[e]))})),Object.defineProperty(t,"innerHTML",la(n,{set:r(n.set)})),t.resetSourceWatch_=function(){t.resetSourceWatch_=null,Object.keys(i).forEach((function(e){t[e]=i[e]})),Object.defineProperty(t,"innerHTML",n)},e.one("sourceset",t.resetSourceWatch_)}},ml=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?po(ee.Element.prototype.getAttribute.call(this,"src")):""},set:function(e){return ee.Element.prototype.setAttribute.call(this,"src",e),e}}),gl=function(e){if(e.featuresSourceset){var t=e.el();if(!t.resetSourceset_){var i=function(e){return pl([e.el(),ee.HTMLMediaElement.prototype,ml],"src")}(e),n=t.setAttribute,r=t.load;Object.defineProperty(t,"src",la(i,{set:function(n){var r=i.set.call(t,n);return e.triggerSourceset(t.src),r}})),t.setAttribute=function(i,r){var s=n.call(t,i,r);return/src/i.test(i)&&e.triggerSourceset(t.src),s},t.load=function(){var i=r.call(t);return hl(e)||(e.triggerSourceset(""),fl(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):hl(e)||fl(e),t.resetSourceset_=function(){t.resetSourceset_=null,t.load=r,t.setAttribute=n,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}}}},vl=function(e,t,i,n){void 0===n&&(n=!0);var r=function(i){return Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0})},s={configurable:!0,enumerable:!0,get:function(){var e=i();return r(e),e}};return n&&(s.set=r),Object.defineProperty(e,t,s)},yl=function(e){function t(t,i){var n;n=e.call(this,t,i)||this;var r=t.source,s=!1;if(r&&(n.el_.currentSrc!==r.src||t.tag&&3===t.tag.initNetworkState_)?n.setSource(r):n.handleLateInit_(n.el_),t.enableSourceset&&n.setupSourcesetHandling_(),n.el_.hasChildNodes()){for(var a=n.el_.childNodes,o=a.length,u=[];o--;){var l=a[o];"track"===l.nodeName.toLowerCase()&&(n.featuresNativeTextTracks?(n.remoteTextTrackEls().addTrackElement_(l),n.remoteTextTracks().addTrack(l.track),n.textTracks().addTrack(l.track),s||n.el_.hasAttribute("crossorigin")||!mo(l.src)||(s=!0)):u.push(l))}for(var c=0;c<u.length;c++)n.el_.removeChild(u[c])}return n.proxyNativeTracks_(),n.featuresNativeTextTracks&&s&&Mr.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),n.restoreMetadataTracksInIOSNativePlayer_(),(xa||Ia||_a)&&!0===t.nativeControlsForTouch&&n.setControls(!0),n.proxyWebkitFullscreen_(),n.triggerReady(),n}ae(t,e);var i=t.prototype;return i.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),t.disposeMediaElement(this.el_),this.options_=null,e.prototype.dispose.call(this)},i.setupSourcesetHandling_=function(){gl(this)},i.restoreMetadataTracksInIOSNativePlayer_=function(){var e,t=this.textTracks(),i=function(){e=[];for(var i=0;i<t.length;i++){var n=t[i];"metadata"===n.kind&&e.push({track:n,storedMode:n.mode})}};i(),t.addEventListener("change",i),this.on("dispose",(function(){return t.removeEventListener("change",i)}));var n=function i(){for(var n=0;n<e.length;n++){var r=e[n];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",(function(){t.removeEventListener("change",i),t.removeEventListener("change",n),t.addEventListener("change",n)})),this.on("webkitendfullscreen",(function(){t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",n)}))},i.overrideNative_=function(e,t){var i=this;if(t===this["featuresNative"+e+"Tracks"]){var n=e.toLowerCase();this[n+"TracksListeners_"]&&Object.keys(this[n+"TracksListeners_"]).forEach((function(e){i.el()[n+"Tracks"].removeEventListener(e,i[n+"TracksListeners_"][e])})),this["featuresNative"+e+"Tracks"]=!t,this[n+"TracksListeners_"]=null,this.proxyNativeTracksForType_(n)}},i.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},i.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},i.proxyNativeTracksForType_=function(e){var t=this,i=ko[e],n=this.el()[i.getterName],r=this[i.getterName]();if(this["featuresNative"+i.capitalName+"Tracks"]&&n&&n.addEventListener){var s={change:function(i){var n={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(n),"text"===e&&t[Co.remoteText.getterName]().trigger(n)},addtrack:function(e){r.addTrack(e.track)},removetrack:function(e){r.removeTrack(e.track)}},a=function(){for(var e=[],t=0;t<r.length;t++){for(var i=!1,s=0;s<n.length;s++)if(n[s]===r[t]){i=!0;break}i||e.push(r[t])}for(;e.length;)r.removeTrack(e.shift())};this[i.getterName+"Listeners_"]=s,Object.keys(s).forEach((function(e){var i=s[e];n.addEventListener(e,i),t.on("dispose",(function(t){return n.removeEventListener(e,i)}))})),this.on("loadstart",a),this.on("dispose",(function(e){return t.off("loadstart",a)}))}},i.proxyNativeTracks_=function(){var e=this;ko.names.forEach((function(t){e.proxyNativeTracksForType_(t)}))},i.createEl=function(){var e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){var i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),t.disposeMediaElement(e),e=i}else{e=ne.createElement("video");var n=la({},this.options_.tag&&as(this.options_.tag));xa&&!0===this.options_.nativeControlsForTouch||delete n.controls,ss(e,Hr(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&us(e,"preload",this.options_.preload);for(var r=["loop","muted","playsinline","autoplay"],s=0;s<r.length;s++){var a=r[s],o=this.options_[a];void 0!==o&&(o?us(e,a,a):ls(e,a),e[a]=o)}return e},i.handleLateInit_=function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,i=function(){t=!0};this.on("loadstart",i);var n=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",n),void this.ready((function(){this.off("loadstart",i),this.off("loadedmetadata",n),t||this.trigger("loadstart")}))}var r=["loadstart"];r.push("loadedmetadata"),e.readyState>=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready((function(){r.forEach((function(e){this.trigger(e)}),this)}))}},i.setCurrentTime=function(e){try{this.el_.currentTime=e}catch(e){Mr(e,"Video is not ready. (Video.js)")}},i.duration=function(){var e=this;if(this.el_.duration===1/0&&va&&Sa&&0===this.el_.currentTime){return this.on("timeupdate",(function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))})),NaN}return this.el_.duration||NaN},i.width=function(){return this.el_.offsetWidth},i.height=function(){return this.el_.offsetHeight},i.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",(function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)}))}},i.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var e=ee.navigator&&ee.navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},i.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)$a(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}),0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},i.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},i.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},i.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},i.reset=function(){t.resetMediaElement(this.el_)},i.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.setControls=function(e){this.el_.controls=!!e},i.addTextTrack=function(t,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,n):e.prototype.addTextTrack.call(this,t,i,n)},i.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return e.prototype.createRemoteTextTrack.call(this,t);var i=ne.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.addRemoteTextTrack=function(t,i){var n=e.prototype.addRemoteTextTrack.call(this,t,i);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},i.removeRemoteTextTrack=function(t){if(e.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),n=i.length;n--;)t!==i[n]&&t!==i[n].track||this.el().removeChild(i[n])},i.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),ee.performance&&"function"==typeof ee.performance.now?e.creationTime=ee.performance.now():ee.performance&&ee.performance.timing&&"number"==typeof ee.performance.timing.navigationStart&&(e.creationTime=ee.Date.now()-ee.performance.timing.navigationStart),e},t}(Eo);vl(yl,"TEST_VID",(function(){if(Xr()){var e=ne.createElement("video"),t=ne.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}})),yl.isSupported=function(){try{yl.TEST_VID.volume=.5}catch(e){return!1}return!(!yl.TEST_VID||!yl.TEST_VID.canPlayType)},yl.canPlayType=function(e){return yl.TEST_VID.canPlayType(e)},yl.canPlaySource=function(e,t){return yl.canPlayType(e.type)},yl.canControlVolume=function(){try{var e=yl.TEST_VID.volume;return yl.TEST_VID.volume=e/2+.1,e!==yl.TEST_VID.volume}catch(e){return!1}},yl.canMuteVolume=function(){try{var e=yl.TEST_VID.muted;return yl.TEST_VID.muted=!e,yl.TEST_VID.muted?us(yl.TEST_VID,"muted","muted"):ls(yl.TEST_VID,"muted"),e!==yl.TEST_VID.muted}catch(e){return!1}},yl.canControlPlaybackRate=function(){if(va&&Sa&&ka<58)return!1;try{var e=yl.TEST_VID.playbackRate;return yl.TEST_VID.playbackRate=e/2+.1,e!==yl.TEST_VID.playbackRate}catch(e){return!1}},yl.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(ne.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(ne.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(ne.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(ne.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},yl.supportsNativeTextTracks=function(){return La||Pa&&Sa},yl.supportsNativeVideoTracks=function(){return!(!yl.TEST_VID||!yl.TEST_VID.videoTracks)},yl.supportsNativeAudioTracks=function(){return!(!yl.TEST_VID||!yl.TEST_VID.audioTracks)},yl.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresVolumeControl","canControlVolume"],["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function(e){var t=e[0],i=e[1];vl(yl.prototype,t,(function(){return yl[i]()}),!0)})),yl.prototype.movingMediaElementInDOM=!Pa,yl.prototype.featuresFullscreenResize=!0,yl.prototype.featuresProgressEvents=!0,yl.prototype.featuresTimeupdateEvents=!0,yl.patchCanPlayType=function(){ya>=4&&!ba&&!Sa&&(cl=yl.TEST_VID&&yl.TEST_VID.constructor.prototype.canPlayType,yl.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":cl.call(this,e)})},yl.unpatchCanPlayType=function(){var e=yl.TEST_VID.constructor.prototype.canPlayType;return cl&&(yl.TEST_VID.constructor.prototype.canPlayType=cl),e},yl.patchCanPlayType(),yl.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},yl.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){yl.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){yl.prototype["set"+ua(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){yl.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","crossOrigin"].forEach((function(e){yl.prototype["set"+ua(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){yl.prototype[e]=function(){return this.el_[e]()}})),Eo.withSourceHandlers(yl),yl.nativeSourceHandler={},yl.nativeSourceHandler.canPlayType=function(e){try{return yl.TEST_VID.canPlayType(e)}catch(e){return""}},yl.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return yl.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=fo(e.src);return yl.nativeSourceHandler.canPlayType("video/"+i)}return""},yl.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},yl.nativeSourceHandler.dispose=function(){},yl.registerSourceHandler(yl.nativeSourceHandler),Eo.registerTech("Html5",yl);var _l=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],bl={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Tl=["tiny","xsmall","small","medium","large","xlarge","huge"],Sl={};Tl.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Sl[e]="vjs-layout-"+t}));var kl={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},Cl=function(e){function t(i,n,r){var s;if(i.id=i.id||n.id||"vjs_video_"+Ds(),(n=Hr(t.getTagSettings(i),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language)if("function"==typeof i.closest){var a=i.closest("[lang]");a&&a.getAttribute&&(n.language=a.getAttribute("lang"))}else for(var o=i;o&&1===o.nodeType;){if(as(o).hasOwnProperty("lang")){n.language=o.getAttribute("lang");break}o=o.parentNode}if((s=e.call(this,null,n,r)||this).boundDocumentFullscreenChange_=Gs(se(s),s.documentFullscreenChange_),s.boundFullWindowOnEscKey_=Gs(se(s),s.fullWindowOnEscKey),s.isFullscreen_=!1,s.log=Br(s.id_),s.fsApi_=Ba,s.isPosterFromTech_=!1,s.queuedCallbacks_=[],s.isReady_=!1,s.hasStarted_=!1,s.userActive_=!1,!s.options_||!s.options_.techOrder||!s.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(s.tag=i,s.tagAttributes=i&&as(i),s.language(s.options_.language),n.languages){var u={};Object.getOwnPropertyNames(n.languages).forEach((function(e){u[e.toLowerCase()]=n.languages[e]})),s.languages_=u}else s.languages_=t.prototype.options_.languages;s.resetCache_(),s.poster_=n.poster||"",s.controls_=!!n.controls,i.controls=!1,i.removeAttribute("controls"),s.changingSrc_=!1,s.playCallbacks_=[],s.playTerminatedQueue_=[],i.hasAttribute("autoplay")?s.autoplay(!0):s.autoplay(s.options_.autoplay),n.plugins&&Object.keys(n.plugins).forEach((function(e){if("function"!=typeof s[e])throw new Error('plugin "'+e+'" does not exist')})),s.scrubbing_=!1,s.el_=s.createEl(),ra(se(s),{eventBusKey:"el_"}),s.fsApi_.requestFullscreen&&(Fs(ne,s.fsApi_.fullscreenchange,s.boundDocumentFullscreenChange_),s.on(s.fsApi_.fullscreenchange,s.boundDocumentFullscreenChange_)),s.fluid_&&s.on("playerreset",s.updateStyleEl_);var l=la(s.options_);n.plugins&&Object.keys(n.plugins).forEach((function(e){s[e](n.plugins[e])})),s.options_.playerOptions=l,s.middleware_=[],s.initChildren(),s.isAudio("audio"===i.nodeName.toLowerCase()),s.controls()?s.addClass("vjs-controls-enabled"):s.addClass("vjs-controls-disabled"),s.el_.setAttribute("role","region"),s.isAudio()?s.el_.setAttribute("aria-label",s.localize("Audio Player")):s.el_.setAttribute("aria-label",s.localize("Video Player")),s.isAudio()&&s.addClass("vjs-audio"),s.flexNotSupported_()&&s.addClass("vjs-no-flex"),xa&&s.addClass("vjs-touch-enabled"),Pa||s.addClass("vjs-workinghover"),t.players[s.id_]=se(s);var c="7.8.2".split(".")[0];return s.addClass("vjs-v"+c),s.userActive(!0),s.reportUserActivity(),s.one("play",s.listenForUserActivity_),s.on("stageclick",s.handleStageClick_),s.on("keydown",s.handleKeyDown),s.breakpoints(s.options_.breakpoints),s.responsive(s.options_.responsive),s}ae(t,e);var i=t.prototype;return i.dispose=function(){var i=this;this.trigger("dispose"),this.off("dispose"),Vs(ne,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Vs(ne,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),t.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Ao[this.id()]=null,wo.names.forEach((function(e){var t=wo[e],n=i[t.getterName]();n&&n.off&&n.off()})),e.prototype.dispose.call(this)},i.createEl=function(){var t,i=this.tag,n=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),r="video-js"===this.tag.tagName.toLowerCase();n?t=this.el_=i.parentNode:r||(t=this.el_=e.prototype.createEl.call(this,"div"));var s=as(i);if(r){for(t=this.el_=i,i=this.tag=ne.createElement("video");t.children.length;)i.appendChild(t.firstChild);ts(t,"video-js")||is(t,"video-js"),t.appendChild(i),n=this.playerElIngest_=t,Object.keys(t).forEach((function(e){try{i[e]=t[e]}catch(e){}}))}if(i.setAttribute("tabindex","-1"),s.tabindex="-1",(Ca||Sa&&Ea)&&(i.setAttribute("role","application"),s.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach((function(e){r&&"class"===e||t.setAttribute(e,s[e]),r&&i.setAttribute(e,s[e])})),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=t.player=this,this.addClass("vjs-paused"),!0!==ee.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=Ps("vjs-styles-dimensions");var a=Ss(".vjs-styles-defaults"),o=Ss("head");o.insertBefore(this.styleEl_,a?a.nextSibling:o.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);for(var u=i.getElementsByTagName("a"),l=0;l<u.length;l++){var c=u.item(l);is(c,"vjs-hidden"),c.setAttribute("hidden","hidden")}return i.initNetworkState_=i.networkState,i.parentNode&&!n&&i.parentNode.insertBefore(t,i),es(i,t),this.children_.unshift(i),this.el_.setAttribute("lang",this.language_),this.el_=t,t},i.crossOrigin=function(e){if(!e)return this.techGet_("crossOrigin");"anonymous"===e||"use-credentials"===e?this.techCall_("setCrossOrigin",e):Mr.warn('crossOrigin must be "anonymous" or "use-credentials", given "'+e+'"')},i.width=function(e){return this.dimension("width",e)},i.height=function(e){return this.dimension("height",e)},i.dimension=function(e,t){var i=e+"_";if(void 0===t)return this[i]||0;if(""===t||"auto"===t)return this[i]=void 0,void this.updateStyleEl_();var n=parseFloat(t);isNaN(n)?Mr.error('Improper value "'+t+'" supplied for for '+e):(this[i]=n,this.updateStyleEl_())},i.fluid=function(e){if(void 0===e)return!!this.fluid_;var t,i;this.fluid_=!!e,Ys(this)&&this.off("playerreset",this.updateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),Ys(t=function(){this.on("playerreset",this.updateStyleEl_)})?i():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(i))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},i.fill=function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},i.aspectRatio=function(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()},i.updateStyleEl_=function(){if(!0!==ee.VIDEOJS_NO_DYNAMIC_STYLE){var e,t,i,n=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=n[1]/n[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),Ls(this.styleEl_,"\n ."+i+" {\n width: "+e+"px;\n height: "+t+"px;\n }\n\n ."+i+".vjs-fluid {\n padding-top: "+100*r+"%;\n }\n ")}else{var s="number"==typeof this.width_?this.width_:this.options_.width,a="number"==typeof this.height_?this.height_:this.options_.height,o=this.tech_&&this.tech_.el();o&&(s>=0&&(o.width=s),a>=0&&(o.height=a))}},i.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=ua(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Eo.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var s={source:t,autoplay:"string"!=typeof this.autoplay()&&this.autoplay(),nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_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,Promise:this.options_.Promise};wo.names.forEach((function(e){var t=wo[e];s[t.getterName]=i[t.privateName]})),Hr(s,this.options_[n]),Hr(s,this.options_[r]),Hr(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var a=Eo.getTech(e);if(!a)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new a(s),this.tech_.ready(Gs(this,this.handleTechReady_),!0),Ka(this.textTracksJson_||[],this.tech_),_l.forEach((function(e){i.on(i.tech_,e,i["handleTech"+ua(e)+"_"])})),Object.keys(bl).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+bl[e]+"_"].bind(i),event:t}):i["handleTech"+bl[e]+"_"](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_,"fullscreenerror",this.handleTechFullscreenError_),this.on(this.tech_,"enterpictureinpicture",this.handleTechEnterPictureInPicture_),this.on(this.tech_,"leavepictureinpicture",this.handleTechLeavePictureInPicture_),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"===n&&this.tag||es(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},i.unloadTech_=function(){var e=this;wo.names.forEach((function(t){var i=wo[t];e[i.privateName]=e[i.getterName]()})),this.textTracksJson_=Xa(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},i.tech=function(e){return void 0===e&&Mr.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},i.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"mouseup",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_)},i.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_,"mouseup",this.handleTechClick_),this.off(this.tech_,"dblclick",this.handleTechDoubleClick_)},i.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},i.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(this.autoplay())},i.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var i,n=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var n=t.play();if(za(n))return n.catch(i)};if("any"===e&&!0!==this.muted()?za(i=this.play())&&(i=i.catch(n)):i="muted"===e&&!0!==this.muted()?n():this.play(),za(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(i){t.trigger({type:"autoplay-failure",autoplay:e})}))}},i.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((function(e){return e.src===t}));if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r<n.length;r++){var s=n[r];if(s.type&&s.src&&s.src===t)return s.type}return Mo(t)}(this,t)),this.cache_.source=la({},e,{src:t,type:i});for(var n=this.cache_.sources.filter((function(e){return e.src&&e.src===t})),r=[],s=this.$$("source"),a=[],o=0;o<s.length;o++){var u=as(s[o]);r.push(u),u.src&&u.src===t&&a.push(u.src)}a.length&&!n.length?this.cache_.sources=r:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},i.handleTechSourceset_=function(e){var t=this;if(!this.changingSrc_){var i=function(e){return t.updateSourceCaches_(e)},n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(i=function(){}),i(r),e.src||this.tech_.any(["sourceset","loadstart"],(function(e){if("sourceset"!==e.type){var i=t.techGet("currentSrc");t.lastSource_.tech=i,t.updateSourceCaches_(i)}}))}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})},i.hasStarted=function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},i.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},i.handleTechRateChange_=function(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((function(e){return e.callback(e.event)})),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},i.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",(function i(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))}))},i.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},i.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},i.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},i.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},i.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},i.handleTechFirstPlay_=function(){this.options_.starttime&&(Mr.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},i.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},i.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},i.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},i.handleTechClick_=function(e){bs(e)&&this.controls_&&(this.paused()?$a(this.play()):this.pause())},i.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(function(t){return t.contains(e.target)}))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},i.handleTechTap_=function(){this.userActive(!this.userActive())},i.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},i.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},i.handleTechTouchEnd_=function(e){e.preventDefault()},i.handleStageClick_=function(){this.reportUserActivity()},i.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},i.documentFullscreenChange_=function(e){var t=e.target.player;if(!t||t===this){var i=this.el(),n=ne[this.fsApi_.fullscreenElement]===i;!n&&i.matches?n=i.matches(":"+this.fsApi_.fullscreen):!n&&i.msMatchesSelector&&(n=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}},i.handleTechFullscreenChange_=function(e,t){t&&this.isFullscreen(t.isFullscreen)},i.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},i.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},i.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},i.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},i.handleTechError_=function(){var e=this.tech_.error();this.error(e)},i.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},i.getCache=function(){return this.cache_},i.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],volume:1}},i.techCall_=function(e,t){this.ready((function(){if(e in Do)return function(e,t,i,n){return t[i](e.reduce(Ro(i),n))}(this.middleware_,this.tech_,e,t);if(e in No)return Lo(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw Mr(e),e}}),!0)},i.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in Oo)return function(e,t,i){return e.reduceRight(Ro(i),t[i]())}(this.middleware_,this.tech_,e);if(e in No)return Lo(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw Mr("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw Mr("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw Mr(t),t}}},i.play=function(){var e=this,t=this.options_.Promise||ee.Promise;return t?new t((function(t){e.play_(t)})):this.play_()},i.play_=function(e){var t=this;void 0===e&&(e=$a),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!La&&!Pa||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},i.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},i.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},i.pause=function(){this.techCall_("pause")},i.paused=function(){return!1!==this.techGet_("paused")},i.played=function(){return this.techGet_("played")||Ra(0,0)},i.scrubbing=function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},i.currentTime=function(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.applyInitTime_),void this.one("canplay",this.applyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},i.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},i.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},i.remainingTime=function(){return this.duration()-this.currentTime()},i.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},i.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=Ra(0,0)),e},i.bufferedPercent=function(){return Ua(this.buffered(),this.duration())},i.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},i.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},i.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},i.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},i.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},i.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},i.isFullscreen=function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_},i.requestFullscreen=function(e){var t=this.options_.Promise||ee.Promise;if(t){var i=this;return new t((function(t,n){function r(){i.off(i.fsApi_.fullscreenerror,a),i.off(i.fsApi_.fullscreenchange,s)}function s(){r(),t()}function a(e,t){r(),n(t)}i.one("fullscreenchange",s),i.one("fullscreenerror",a);var o=i.requestFullscreenHelper_(e);if(o)return o.then(r,r),o}))}return this.requestFullscreenHelper_()},i.requestFullscreenHelper_=function(e){var t,i=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then((function(){return i.isFullscreen(!0)}),(function(){return i.isFullscreen(!1)})),n}this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):this.enterFullWindow()},i.exitFullscreen=function(){var e=this.options_.Promise||ee.Promise;if(e){var t=this;return new e((function(e,i){function n(){t.off(t.fsApi_.fullscreenerror,s),t.off(t.fsApi_.fullscreenchange,r)}function r(){n(),e()}function s(e,t){n(),i(t)}t.one("fullscreenchange",r),t.one("fullscreenerror",s);var a=t.exitFullscreenHelper_();if(a)return a.then(n,n),a}))}return this.exitFullscreenHelper_()},i.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=ne[this.fsApi_.exitFullscreen]();return t&&t.then((function(){return e.isFullscreen(!1)})),t}this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):this.exitFullWindow()},i.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=ne.documentElement.style.overflow,Fs(ne,"keydown",this.boundFullWindowOnEscKey_),ne.documentElement.style.overflow="hidden",is(ne.body,"vjs-full-window"),this.trigger("enterFullWindow")},i.fullWindowOnEscKey=function(e){ue.isEventKey(e,"Esc")&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},i.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,Vs(ne,"keydown",this.boundFullWindowOnEscKey_),ne.documentElement.style.overflow=this.docOrigOverflow,ns(ne.body,"vjs-full-window"),this.trigger("exitFullWindow")},i.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},i.requestPictureInPicture=function(){if("pictureInPictureEnabled"in ne)return this.techGet_("requestPictureInPicture")},i.exitPictureInPicture=function(){if("pictureInPictureEnabled"in ne)return ne.exitPictureInPicture()},i.handleKeyDown=function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}},i.handleHotkeys=function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},i=t.fullscreenKey,n=void 0===i?function(e){return ue.isEventKey(e,"f")}:i,r=t.muteKey,s=void 0===r?function(e){return ue.isEventKey(e,"m")}:r,a=t.playPauseKey,o=void 0===a?function(e){return ue.isEventKey(e,"k")||ue.isEventKey(e,"Space")}:a;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();var u=ca.getComponent("FullscreenToggle");!1!==ne[this.fsApi_.fullscreenEnabled]&&u.prototype.handleClick.call(this,e)}else if(s.call(this,e)){e.preventDefault(),e.stopPropagation(),ca.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(o.call(this,e)){e.preventDefault(),e.stopPropagation(),ca.getComponent("PlayToggle").prototype.handleClick.call(this,e)}},i.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i<n.length;i++){var r=n[i],s=Eo.getTech(r);if(s||(s=ca.getComponent(r)),s){if(s.isSupported()&&(t=s.canPlayType(e)))return t}else Mr.error('The "'+r+'" tech is undefined. Skipped browser support check for that tech.')}return""},i.selectSource=function(e){var t,i=this,n=this.options_.techOrder.map((function(e){return[e,Eo.getTech(e)]})).filter((function(e){var t=e[0],i=e[1];return i?i.isSupported():(Mr.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)})),r=function(e,t,i){var n;return e.some((function(e){return t.some((function(t){if(n=i(e,t))return!0}))})),n},s=function(e,t){var n=e[0];if(e[1].canPlaySource(t,i.options_[n.toLowerCase()]))return{source:t,tech:n}};return(this.options_.sourceOrder?r(e,n,(t=s,function(e,i){return t(i,e)})):r(n,e,s))||!1},i.src=function(e){var t=this;if(void 0===e)return this.cache_.src||"";var i=function e(t){if(Array.isArray(t)){var i=[];t.forEach((function(t){t=e(t),Array.isArray(t)?i=i.concat(t):qr(t)&&i.push(t)})),t=i}else t="string"==typeof t&&t.trim()?[Bo({src:t})]:qr(t)&&"string"==typeof t.src&&t.src&&t.src.trim()?[Bo(t)]:[];return t}(e);i.length?(this.changingSrc_=!0,this.cache_.sources=i,this.updateSourceCaches_(i[0]),Po(this,i[0],(function(e,n){var r,s;if(t.middleware_=n,t.cache_.sources=i,t.updateSourceCaches_(e),t.src_(e))return i.length>1?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());r=n,s=t.tech_,r.forEach((function(e){return e.setTech&&e.setTech(s)}))}))):this.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0)},i.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,ua(t)!==ua(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready((function(){n.changingSrc_=!1})),!1):(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1))},i.load=function(){this.techCall_("load")},i.reset=function(){var e=this,t=this.options_.Promise||ee.Promise;this.paused()||!t?this.doReset_():$a(this.play().then((function(){return e.doReset_()})))},i.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),Ys(this)&&this.trigger("playerreset")},i.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},i.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar,t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},i.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},i.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},i.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},i.currentSource=function(){return this.cache_.source||{}},i.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},i.currentType=function(){return this.currentSource()&&this.currentSource().type||""},i.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},i.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)?(this.options_.autoplay=e,this.manualAutoplay_(e),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},i.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},i.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},i.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},i.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},i.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},i.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},i.error=function(e){if(void 0===e)return this.error_||null;if(this.options_.suppressNotSupportedError&&e&&4===e.code){var t=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),void this.one("loadstart",(function(){this.off(["click","touchstart"],t)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new qa(e),this.addClass("vjs-error"),Mr.error("(CODE:"+this.error_.code+" "+qa.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error")},i.reportUserActivity=function(e){this.userActivity_=!0},i.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,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(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},i.listenForUserActivity_=function(){var e,t,i,n=Gs(this,this.reportUserActivity),r=function(t){n(),this.clearInterval(e)};this.on("mousedown",(function(){n(),this.clearInterval(e),e=this.setInterval(n,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())})),this.on("mouseup",r),this.on("mouseleave",r);var s,a=this.getChild("controlBar");!a||Pa||va||(a.on("mouseenter",(function(e){this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout,this.player().options_.inactivityTimeout=0})),a.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",n),this.on("keyup",n),this.setInterval((function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(s);var e=this.options_.inactivityTimeout;e<=0||(s=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}}),250)},i.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},i.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},i.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},i.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},i.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},i.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},i.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},i.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},i.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},i.language=function(e){if(void 0===e)return this.language_;this.language_=String(e).toLowerCase()},i.languages=function(){return la(t.prototype.options_.languages,this.languages_)},i.toJSON=function(){var e=la(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var n=t[i];(n=la(n)).player=void 0,e.tracks[i]=n}return e},i.createModal=function(e,t){var i=this;(t=t||{}).content=e||"";var n=new Ya(this,t);return this.addChild(n),n.on("dispose",(function(){i.removeChild(n)})),n.open(),n},i.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),i=0;i<Tl.length;i++){var n=Tl[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(Sl[e]),this.addClass(Sl[n]),this.breakpoint_=n;break}}},i.removeCurrentBreakpoint_=function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)},i.breakpoints=function(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=Hr({},kl,e),this.updateCurrentBreakpoint_()),Hr(this.breakpoints_)},i.responsive=function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.updateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.updateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0},i.currentBreakpoint=function(){return this.breakpoint_},i.currentBreakpointClass=function(){return Sl[this.breakpoint_]||""},i.loadMedia=function(e,t){var i=this;if(e&&"object"==typeof e){this.reset(),this.cache_.media=la(e);var n=this.cache_.media,r=n.artwork,s=n.poster,a=n.src,o=n.textTracks;!r&&s&&(this.cache_.media.artwork=[{src:s,type:Mo(s)}]),a&&this.src(a),s&&this.poster(s),Array.isArray(o)&&o.forEach((function(e){return i.addRemoteTextTrack(e,!1)})),this.ready(t)}},i.getMedia=function(){if(!this.cache_.media){var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}}))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:Mo(t.poster)}]),t}return la(this.cache_.media)},t.getTagSettings=function(e){var t={sources:[],tracks:[]},i=as(e),n=i["data-setup"];if(ts(e,"vjs-fill")&&(i.fill=!0),ts(e,"vjs-fluid")&&(i.fluid=!0),null!==n){var r=oe(n||"{}"),s=r[0],a=r[1];s&&Mr.error(s),Hr(i,a)}if(Hr(t,i),e.hasChildNodes())for(var o=e.childNodes,u=0,l=o.length;u<l;u++){var c=o[u],h=c.nodeName.toLowerCase();"source"===h?t.sources.push(as(c)):"track"===h&&t.tracks.push(as(c))}return t},i.flexNotSupported_=function(){var e=ne.createElement("i");return!("flexBasis"in e.style||"webkitFlexBasis"in e.style||"mozFlexBasis"in e.style||"msFlexBasis"in e.style||"msFlexOrder"in e.style)},t}(ca);wo.names.forEach((function(e){var t=wo[e];Cl.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),Cl.prototype.crossorigin=Cl.prototype.crossOrigin,Cl.players={};var wl=ee.navigator;Cl.prototype.options_={techOrder:Eo.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:wl&&(wl.languages&&wl.languages[0]||wl.userLanguage||wl.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1},["ended","seeking","seekable","networkState","readyState"].forEach((function(e){Cl.prototype[e]=function(){return this.techGet_(e)}})),_l.forEach((function(e){Cl.prototype["handleTech"+ua(e)+"_"]=function(){return this.trigger(e)}})),ca.registerComponent("Player",Cl);var El={},xl=function(e){return El.hasOwnProperty(e)},Al=function(e){return xl(e)?El[e]:void 0},Il=function(e,t){e.activePlugins_=e.activePlugins_||{},e.activePlugins_[t]=!0},Pl=function(e,t,i){var n=(i?"before":"")+"pluginsetup";e.trigger(n,t),e.trigger(n+":"+t.name,t)},Ll=function(e,t){return t.prototype.name=e,function(){Pl(this,{name:e,plugin:t,instance:null},!0);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];var s=Ke(t,[this].concat(n));return this[e]=function(){return s},Pl(this,s.getEventHash()),s}},Ol=function(){function e(t){if(this.constructor===e)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,ra(this),delete this.trigger,aa(this,this.constructor.defaultState),Il(t,this.name),this.dispose=Gs(this,this.dispose),t.on("dispose",this.dispose)}var t=e.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(e){return void 0===e&&(e={}),e.name=this.name,e.plugin=this.constructor,e.instance=this,e},t.trigger=function(e,t){return void 0===t&&(t={}),Hs(this.eventBusEl_,e,this.getEventHash(t))},t.handleStateChanged=function(e){},t.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t.activePlugins_[e]=!1,this.player=this.state=null,t[e]=Ll(e,El[e])},e.isBasic=function(t){var i="string"==typeof t?Al(t):t;return"function"==typeof i&&!e.prototype.isPrototypeOf(i.prototype)},e.registerPlugin=function(t,i){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(xl(t))Mr.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(Cl.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 '+typeof i+".");return El[t]=i,"plugin"!==t&&(e.isBasic(i)?Cl.prototype[t]=function(e,t){var i=function(){Pl(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return Il(this,e),Pl(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(t,i):Cl.prototype[t]=Ll(t,i)),i},e.deregisterPlugin=function(e){if("plugin"===e)throw new Error("Cannot de-register base plugin.");xl(e)&&(delete El[e],delete Cl.prototype[e])},e.getPlugins=function(e){var t;return void 0===e&&(e=Object.keys(El)),e.forEach((function(e){var i=Al(e);i&&((t=t||{})[e]=i)})),t},e.getPluginVersion=function(e){var t=Al(e);return t&&t.VERSION||""},e}();Ol.getPlugin=Al,Ol.BASE_PLUGIN_NAME="plugin",Ol.registerPlugin("plugin",Ol),Cl.prototype.usingPlugin=function(e){return!!this.activePlugins_&&!0===this.activePlugins_[e]},Cl.prototype.hasPlugin=function(e){return!!xl(e)};var Dl=function(e){return 0===e.indexOf("#")?e.slice(1):e};function Nl(e,t,i){var n=Nl.getPlayer(e);if(n)return t&&Mr.warn('Player "'+e+'" is already initialised. Options will not be applied.'),i&&n.ready(i),n;var r="string"==typeof e?Ss("#"+Dl(e)):e;if(!Kr(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");r.ownerDocument.defaultView&&r.ownerDocument.body.contains(r)||Mr.warn("The element supplied is not included in the DOM"),t=t||{},Nl.hooks("beforesetup").forEach((function(e){var i=e(r,la(t));qr(i)&&!Array.isArray(i)?t=la(t,i):Mr.error("please return an object in beforesetup hooks")}));var s=ca.getComponent("Player");return n=new s(r,t,i),Nl.hooks("setup").forEach((function(e){return e(n)})),n}if(Nl.hooks_={},Nl.hooks=function(e,t){return Nl.hooks_[e]=Nl.hooks_[e]||[],t&&(Nl.hooks_[e]=Nl.hooks_[e].concat(t)),Nl.hooks_[e]},Nl.hook=function(e,t){Nl.hooks(e,t)},Nl.hookOnce=function(e,t){Nl.hooks(e,[].concat(t).map((function(t){return function i(){return Nl.removeHook(e,i),t.apply(void 0,arguments)}})))},Nl.removeHook=function(e,t){var i=Nl.hooks(e).indexOf(t);return!(i<=-1)&&(Nl.hooks_[e]=Nl.hooks_[e].slice(),Nl.hooks_[e].splice(i,1),!0)},!0!==ee.VIDEOJS_NO_DYNAMIC_STYLE&&Xr()){var Rl=Ss(".vjs-styles-defaults");if(!Rl){Rl=Ps("vjs-styles-defaults");var Ul=Ss("head");Ul&&Ul.insertBefore(Rl,Ul.firstChild),Ls(Rl,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}xs(1,Nl),Nl.VERSION="7.8.2",Nl.options=Cl.prototype.options_,Nl.getPlayers=function(){return Cl.players},Nl.getPlayer=function(e){var t,i=Cl.players;if("string"==typeof e){var n=Dl(e),r=i[n];if(r)return r;t=Ss("#"+n)}else t=e;if(Kr(t)){var s=t,a=s.player,o=s.playerId;if(a||i[o])return a||i[o]}},Nl.getAllPlayers=function(){return Object.keys(Cl.players).map((function(e){return Cl.players[e]})).filter(Boolean)},Nl.players=Cl.players,Nl.getComponent=ca.getComponent,Nl.registerComponent=function(e,t){Eo.isTech(t)&&Mr.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),ca.registerComponent.call(ca,e,t)},Nl.getTech=Eo.getTech,Nl.registerTech=Eo.registerTech,Nl.use=function(e,t){xo[e]=xo[e]||[],xo[e].push(t)},Object.defineProperty(Nl,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(Nl.middleware,"TERMINATOR",{value:Io,writeable:!1,enumerable:!0}),Nl.browser=Oa,Nl.TOUCH_ENABLED=xa,Nl.extend=function(e,t){void 0===t&&(t={});var i=function(){e.apply(this,arguments)},n={};for(var r in"object"==typeof t?(t.constructor!==Object.prototype.constructor&&(i=t.constructor),n=t):"function"==typeof t&&(i=t),Ye(i,e),e&&(i.super_=e),n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r]);return i},Nl.mergeOptions=la,Nl.bind=Gs,Nl.registerPlugin=Ol.registerPlugin,Nl.deregisterPlugin=Ol.deregisterPlugin,Nl.plugin=function(e,t){return Mr.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Ol.registerPlugin(e,t)},Nl.getPlugins=Ol.getPlugins,Nl.getPlugin=Ol.getPlugin,Nl.getPluginVersion=Ol.getPluginVersion,Nl.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),Nl.options.languages=la(Nl.options.languages,((i={})[e]=t,i)),Nl.options.languages[e]},Nl.log=Mr,Nl.createLogger=Br,Nl.createTimeRange=Nl.createTimeRanges=Ra,Nl.formatTime=Zo,Nl.setFormatTime=function(e){Jo=e},Nl.resetFormatTime=function(){Jo=Qo},Nl.parseUrl=ho,Nl.isCrossOrigin=mo,Nl.EventTarget=Ks,Nl.on=Fs,Nl.one=qs,Nl.off=Vs,Nl.trigger=Hs,Nl.xhr=de,Nl.TextTrack=_o,Nl.AudioTrack=bo,Nl.VideoTrack=To,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((function(e){Nl[e]=function(){return Mr.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead"),Cs[e].apply(null,arguments)}})),Nl.computedStyle=zr,Nl.dom=Cs,Nl.url=go,Nl.defineLazyProperty=vl;
|
||
/**
|
||
* @videojs/http-streaming
|
||
* @version 1.13.2
|
||
* @copyright 2020 Brightcove, Inc
|
||
* @license Apache-2.0
|
||
*/
|
||
var Ml=function(e,t){return/^[a-z]+:/i.test(t)?t:(/\/\//i.test(e)||(e=Qe.buildAbsoluteURL(ee.location.href,e)),Qe.buildAbsoluteURL(e,t))},Bl=function(e,t,i){return e&&i.responseURL&&t!==i.responseURL?i.responseURL:t},jl=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Fl=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),Vl=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},Hl=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},ql=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var i=[],n=!0,r=!1,s=void 0;try{for(var a,o=e[Symbol.iterator]();!(n=(a=o.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){r=!0,s=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw s}}return i}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},Wl=Nl.mergeOptions,zl=Nl.EventTarget,$l=Nl.log,Gl=function(e,t){["AUDIO","SUBTITLES"].forEach((function(i){for(var n in e.mediaGroups[i])for(var r in e.mediaGroups[i][n]){var s=e.mediaGroups[i][n][r];t(s,i,n,r)}}))},Xl=function(e,t){var i=Wl(e,{}),n=i.playlists[t.id];if(!n)return null;if(n.segments&&t.segments&&n.segments.length===t.segments.length&&n.endList===t.endList&&n.mediaSequence===t.mediaSequence)return null;var r=Wl(n,t);n.segments&&(r.segments=function(e,t,i){var n=t.slice();i=i||0;for(var r=Math.min(e.length,t.length+i),s=i;s<r;s++)n[s-i]=Wl(e[s],n[s-i]);return n}(n.segments,t.segments,t.mediaSequence-n.mediaSequence)),r.segments.forEach((function(e){!function(e,t){e.resolvedUri||(e.resolvedUri=Ml(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=Ml(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=Ml(t,e.map.uri))}(e,r.resolvedUri)}));for(var s=0;s<i.playlists.length;s++)i.playlists[s].id===t.id&&(i.playlists[s]=r);return i.playlists[t.id]=r,i.playlists[t.uri]=r,i},Kl=function(e,t){return e+"-"+t},Yl=function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];i.resolvedUri=Ml(e.uri,i.uri),i.id=Kl(t,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes||(i.attributes={},$l.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))}},Ql=function(e){Gl(e,(function(t){t.uri&&(t.resolvedUri=Ml(e.uri,t.uri))}))},Jl=function(e,t){var i=e.segments[e.segments.length-1];return t&&i&&i.duration?1e3*i.duration:500*(e.targetDuration||10)},Zl=function(e){function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};jl(this,t);var r=Hl(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),s=n.withCredentials,a=void 0!==s&&s,o=n.handleManifestRedirects,u=void 0!==o&&o;r.srcUrl=e,r.hls_=i,r.withCredentials=a,r.handleManifestRedirects=u;var l=i.options_;if(r.customTagParsers=l&&l.customTagParsers||[],r.customTagMappers=l&&l.customTagMappers||[],!r.srcUrl)throw new Error("A non-empty playlist URL is required");return r.state="HAVE_NOTHING",r.on("mediaupdatetimeout",(function(){"HAVE_METADATA"===r.state&&(r.state="HAVE_CURRENT_METADATA",r.request=r.hls_.xhr({uri:Ml(r.master.uri,r.media().uri),withCredentials:r.withCredentials},(function(e,t){if(r.request)return e?r.playlistRequestError(r.request,r.media(),"HAVE_METADATA"):void r.haveMetadata(r.request,r.media().uri,r.media().id)})))})),r}return Vl(t,e),Fl(t,[{key:"playlistRequestError",value:function(e,t,i){var n=t.uri,r=t.id;this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}},{key:"haveMetadata",value:function(e,t,i){var n=this;this.request=null,this.state="HAVE_METADATA";var r=new st;this.customTagParsers.forEach((function(e){return r.addParser(e)})),this.customTagMappers.forEach((function(e){return r.addTagMapper(e)})),r.push(e.responseText),r.end(),r.manifest.uri=t,r.manifest.id=i,r.manifest.attributes=r.manifest.attributes||{};var s=Xl(this.master,r.manifest);this.targetDuration=r.manifest.targetDuration,s?(this.master=s,this.media_=this.master.playlists[i]):this.trigger("playlistunchanged"),this.media().endList||(ee.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=ee.setTimeout((function(){n.trigger("mediaupdatetimeout")}),Jl(this.media(),!!s))),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.trigger("dispose"),this.stopRequest(),ee.clearTimeout(this.mediaUpdateTimeout),ee.clearTimeout(this.finalRenditionTimeout),this.off()}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(e,t){var i=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(ee.clearTimeout(this.finalRenditionTimeout),t){var n=e.targetDuration/2*1e3||5e3;this.finalRenditionTimeout=ee.setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state,s=!this.media_||e.id!==this.media_.id;if(this.master.playlists[e.id].endList)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(s&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(s){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.hls_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){if(e.resolvedUri=Bl(i.handleManifestRedirects,e.resolvedUri,n),t)return i.playlistRequestError(i.request,e,r);i.haveMetadata(n,e.uri,e.id),"HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}}},{key:"pause",value:function(){this.stopRequest(),ee.clearTimeout(this.mediaUpdateTimeout),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}},{key:"load",value:function(e){var t=this;ee.clearTimeout(this.mediaUpdateTimeout);var i=this.media();if(e){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=ee.setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"start",value:function(){var e=this;this.started=!0,this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"HLS playlist request error at URL: "+e.srcUrl+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");var n=new st;if(e.customTagParsers.forEach((function(e){return n.addParser(e)})),e.customTagMappers.forEach((function(e){return n.addTagMapper(e)})),n.push(i.responseText),n.end(),e.state="HAVE_MASTER",e.srcUrl=Bl(e.handleManifestRedirects,e.srcUrl,i),n.manifest.uri=e.srcUrl,n.manifest.playlists)return e.master=n.manifest,Yl(e.master),Ql(e.master),e.trigger("loadedplaylist"),void(e.request||e.media(n.manifest.playlists[0]));var r=Kl(0,e.srcUrl);return e.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:ee.location.href,playlists:[{uri:e.srcUrl,id:r,resolvedUri:e.srcUrl,attributes:{}}]},e.master.playlists[r]=e.master.playlists[0],e.master.playlists[e.srcUrl]=e.master.playlists[0],e.haveMetadata(i,e.srcUrl,r),e.trigger("loadedmetadata")}}))}}]),t}(zl),ec=Nl.createTimeRange,tc=function(e,t,i){var n,r;return void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence?0:(n=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(void 0!==(r=e.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=r.duration,void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t)).precise?n.result:(r=function(e,t){for(var i=0,n=void 0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(n=e.segments[r]).start)return{result:n.start-i,precise:!0};if(i+=n.duration,void 0!==n.end)return{result:n.end-i,precise:!0}}return{result:-1,precise:!1}}(e,t)).precise?r.result:n.result+i},ic=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return ee.Infinity}return tc(e,t,i)},nc=function(e,t,i){var n=0;if(t>i){var r=[i,t];t=r[0],i=r[1]}if(t<0){for(var s=t;s<Math.min(0,i);s++)n+=e.targetDuration;t=0}for(var a=t;a<i;a++)n+=e.segments[a].duration;return n},rc=function(e,t){if(!e.segments.length)return 0;var i=e.segments.length,n=e.segments[i-1].duration||e.targetDuration,r="number"==typeof t?t:n+2*e.targetDuration;if(0===r)return i;for(var s=0;i--&&!((s+=e.segments[i].duration)>=r););return Math.max(0,i)},sc=function(e,t,i,n){if(!e||!e.segments)return null;if(e.endList)return ic(e);if(null===t)return null;t=t||0;var r=i?rc(e,n):e.segments.length;return tc(e,e.mediaSequence+r,t)},ac=function(e){return e-Math.floor(e)==0},oc=function(e,t){if(ac(t))return t+.1*e;for(var i=t.toString().split(".")[1].length,n=1;n<=i;n++){var r=Math.pow(10,n),s=t*r;if(ac(s)||n===i)return(s+e)/r}},uc=oc.bind(null,1),lc=oc.bind(null,-1),cc=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},hc=function(e){return e.excludeUntil&&e.excludeUntil===1/0},dc=function(e){var t=cc(e);return!e.disabled&&!t},pc=function(e,t){return t.attributes&&t.attributes[e]},fc=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((function(e){return!!dc(e)&&(e.attributes.BANDWIDTH||0)<i})).length},mc={duration:ic,seekable:function(e,t,i){var n=t||0,r=sc(e,t,!0,i);return null===r?ec():ec(n,r)},safeLiveIndex:rc,getMediaInfoForTime:function(e,t,i,n){var r=void 0,s=void 0,a=e.segments.length,o=t-n;if(o<0){if(i>0)for(r=i-1;r>=0;r--)if(s=e.segments[r],(o+=lc(s.duration))>0)return{mediaIndex:r,startTime:n-nc(e,i,r)};return{mediaIndex:0,startTime:t}}if(i<0){for(r=i;r<0;r++)if((o-=e.targetDuration)<0)return{mediaIndex:0,startTime:t};i=0}for(r=i;r<a;r++)if(s=e.segments[r],(o-=uc(s.duration))<0)return{mediaIndex:r,startTime:n+nc(e,i,r)};return{mediaIndex:a-1,startTime:t}},isEnabled:dc,isDisabled:function(e){return e.disabled},isBlacklisted:cc,isIncompatible:hc,playlistEnd:sc,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},isFmp4:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].map)return!0;return!1},hasAttribute:pc,estimateSegmentRequestTime:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!pc("BANDWIDTH",i))return NaN;var r=e*i.attributes.BANDWIDTH;return(r-8*n)/t},isLowestEnabledRendition:fc},gc=Nl.xhr,vc=Nl.mergeOptions,yc=function(){return function e(t,i){t=vc({timeout:45e3},t);var n=e.beforeRequest||Nl.Hls.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var s=gc(t,(function(e,t){var n=s.response;!e&&n&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=n.byteLength||n.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),t.headers&&(s.responseHeaders=t.headers),e&&"ETIMEDOUT"===e.code&&(s.timedout=!0),e||s.aborted||200===t.statusCode||206===t.statusCode||0===t.statusCode||(e=new Error("XHR Failed with a response of: "+(s&&(n||s.responseText)))),i(e,s)})),a=s.abort;return s.abort=function(){return s.aborted=!0,a.apply(s,arguments)},s.uri=t.uri,s.requestTime=Date.now(),s}},_c=function(e){var t,i,n={};return e.byterange&&(n.Range=(t=e.byterange,i=t.offset+t.length-1,"bytes="+t.offset+"-"+i)),n},bc=function(e,t){return e.start(t)+"-"+e.end(t)},Tc=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Sc=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},kc=function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},Cc=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},wc=function(e){return e.resolvedUri},Ec=function(e){for(var t=Array.prototype.slice.call(e),i="",n=0;n<t.length/16;n++)i+=t.slice(16*n,16*n+16).map(Tc).join("")+" "+t.slice(16*n,16*n+16).map(Sc).join("")+"\n";return i},xc=Object.freeze({createTransferableMessage:kc,initSegmentId:Cc,segmentKeyId:wc,hexDump:Ec,tagDump:function(e){var t=e.bytes;return Ec(t)},textRanges:function(e){var t="",i=void 0;for(i=0;i<e.length;i++)t+=bc(e,i)+" ";return t}}),Ac=function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===n)return r({message:"getProgramTime: playlist and time must be provided"});var s=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i=0,n=void 0,r=0;r<t.segments.length&&!(e<=(i=(n=t.segments[r]).videoTimingInfo?n.videoTimingInfo.transmuxedPresentationEnd:i+n.duration));r++);var s=t.segments[t.segments.length-1];if(s.videoTimingInfo&&s.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>i){if(e>i+.25*s.duration)return null;n=s}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:i-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}}(n,t);if(!s)return r({message:"valid programTime was not found"});if("estimate"===s.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:s.estimatedStart});var a={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,s.segment);return o&&(a.programDateTime=o.toISOString()),r(null,a)},Ic=function e(t){var i=t.programTime,n=t.playlist,r=t.retryCount,s=void 0===r?2:r,a=t.seekTo,o=t.pauseAfterSeek,u=void 0===o||o,l=t.tech,c=t.callback;if(!c)throw new Error("seekToProgramTime: callback must be provided");if(void 0===i||!n||!a)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!l.hasStarted_)return c({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t<e.segments.length;t++){if(!e.segments[t].dateTimeObject)return!1}return!0}(n))return c({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri});var h=function(e,t){var i=void 0;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;var n=t.segments[0];if(i<n.dateTimeObject)return null;for(var r=0;r<t.segments.length-1;r++){if(n=t.segments[r],i<t.segments[r+1].dateTimeObject)break}var s,a=t.segments[t.segments.length-1],o=a.dateTimeObject,u=a.videoTimingInfo?(s=a.videoTimingInfo).transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds:a.duration+.25*a.duration;return i>new Date(o.getTime()+1e3*u)?null:(i>o&&(n=a),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:mc.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(i,n);if(!h)return c({message:i+" was not found in the stream"});var d=h.segment,p=function(e,t){var i=void 0,n=void 0;try{i=new Date(e),n=new Date(t)}catch(e){}var r=i.getTime();return(n.getTime()-r)/1e3}(d.dateTimeObject,i);if("estimate"===h.type)return 0===s?c({message:i+" is not buffered yet. Try again"}):(a(h.estimatedStart+p),void l.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:s-1,seekTo:a,pauseAfterSeek:u,tech:l,callback:c})})));var f=d.start+p;l.one("seeked",(function(){return c(null,l.currentTime())})),u&&l.pause(),a(f)},Pc=function(e,t){var i=[],n=void 0;if(e&&e.length)for(n=0;n<e.length;n++)t(e.start(n),e.end(n))&&i.push([e.start(n),e.end(n)]);return Nl.createTimeRanges(i)},Lc=function(e,t){return Pc(e,(function(e,i){return e-.1<=t&&i+.1>=t}))},Oc=function(e,t){return Pc(e,(function(e){return e-1/30>=t}))},Dc=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},Nc=function(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},Rc=function(e,t,i){var n=void 0,r=void 0;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime<=t&&r.endTime>=e&&i.removeCue(r)},Uc=function(e){return isNaN(e)||Math.abs(e)===1/0?Number.MAX_VALUE:e},Mc=function(e,t,i){var n=ee.WebKitDataCue||ee.VTTCue;if(t&&t.forEach((function(e){var t=e.stream;this.inbandTextTracks_[t].addCue(new n(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))}),e),i){var r=Uc(e.mediaSource_.duration);if(i.forEach((function(e){var t=e.cueTime+this.timestampOffset;!("number"!=typeof t||ee.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((function(e){var i=new n(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return Nl.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return Nl.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return Nl.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(i),this.metadataTrack_.addCue(i)}),this)}),e),e.metadataTrack_&&e.metadataTrack_.cues&&e.metadataTrack_.cues.length){for(var s=e.metadataTrack_.cues,a=[],o=0;o<s.length;o++)s[o]&&a.push(s[o]);var u=a.reduce((function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),l=Object.keys(u).sort((function(e,t){return Number(e)-Number(t)}));l.forEach((function(e,t){var i=u[e],n=Number(l[t+1])||r;i.forEach((function(e){e.endTime=n}))}))}}},Bc="undefined"!=typeof window?window:{},jc="undefined"==typeof Symbol?"__target":Symbol(),Fc=Bc.BlobBuilder||Bc.WebKitBlobBuilder||Bc.MozBlobBuilder||Bc.MSBlobBuilder,Vc=Bc.URL||Bc.webkitURL||Vc&&Vc.msURL,Hc=Bc.Worker;function qc(e,t){return function(i){var n=this;if(!t)return new Hc(e);if(Hc&&!i){var r=Gc(t.toString().replace(/^function.+?{/,"").slice(0,-1));return this[jc]=new Hc(r),function(e,t){if(!e||!t)return;var i=e.terminate;e.objURL=t,e.terminate=function(){e.objURL&&Vc.revokeObjectURL(e.objURL),i.call(e)}}(this[jc],r),this[jc]}var s={postMessage:function(e){n.onmessage&&setTimeout((function(){n.onmessage({data:e,target:s})}))}};t.call(s),this.postMessage=function(e){setTimeout((function(){s.onmessage({data:e,target:n})}))},this.isThisThread=!0}}if(Hc){var Wc,zc=Gc("self.onmessage = function () {}"),$c=new Uint8Array(1);try{(Wc=new Hc(zc)).postMessage($c,[$c.buffer])}catch(e){Hc=null}finally{Vc.revokeObjectURL(zc),Wc&&Wc.terminate()}}function Gc(e){try{return Vc.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(i){var t=new Fc;return t.append(e),Vc.createObjectURL(t.getBlob(type))}}var Xc=new qc("./transmuxer-worker.worker.js",(function(e,t){var i=this;!function(){var e=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,r,s;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(s=[],n=arguments.length,n=1;n<arguments.length;++n)s.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,s)}},this.dispose=function(){e={}}}};e.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},e.prototype.push=function(e){this.trigger("data",e)},e.prototype.flush=function(e){this.trigger("done",e)},e.prototype.partialFlush=function(e){this.trigger("partialdone",e)},e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},e.prototype.reset=function(e){this.trigger("reset",e)};var t,n,r,s,a,o,u,l,c,h,d,p,f,m,g,v,y,_,b,T,S,k,C,w,E,x,A,I,P,L,O,D,N,R,U,M,B,j,F,V,H=e,q=Math.pow(2,32)-1;!function(){var e;if(k={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in k)k.hasOwnProperty(e)&&(k[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);C=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),E=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),w=new Uint8Array([0,0,0,1]),x=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]),A=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]),I={video:x,audio:A},O=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]),D=new Uint8Array([0,0,0,0,0,0,0,0]),N=D,R=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),U=D,P=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),t=function(e){var t,i,n=[],r=0;for(t=1;t<arguments.length;t++)n.push(arguments[t]);for(t=n.length;t--;)r+=n[t].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,r=8;t<n.length;t++)i.set(n[t],r),r+=n[t].byteLength;return i},n=function(){return t(k.dinf,t(k.dref,O))},r=function(e){return t(k.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},g=function(e){return t(k.hdlr,I[e])},m=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(k.mdhd,i)},f=function(e){return t(k.mdia,m(e),g(e.type),o(e))},a=function(e){return t(k.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},o=function(e){return t(k.minf,"video"===e.type?t(k.vmhd,P):t(k.smhd,L),n(),y(e))},u=function(e,i){for(var n=[],r=i.length;r--;)n[r]=b(i[r]);return t.apply(null,[k.moof,a(e)].concat(n))},l=function(e){for(var i=e.length,n=[];i--;)n[i]=d(e[i]);return t.apply(null,[k.moov,h(4294967295)].concat(n).concat(c(e)))},c=function(e){for(var i=e.length,n=[];i--;)n[i]=T(e[i]);return t.apply(null,[k.mvex].concat(n))},h=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t(k.mvhd,i)},v=function(e){var i,n,r=e.samples||[],s=new Uint8Array(4+r.length);for(n=0;n<r.length;n++)i=r[n].flags,s[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return t(k.sdtp,s)},y=function(e){return t(k.stbl,_(e),t(k.stts,U),t(k.stsc,N),t(k.stsz,R),t(k.stco,D))},_=function(e){return t(k.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?M(e):B(e))},M=function(e){var i,n,r=e.sps||[],s=e.pps||[],a=[],o=[];for(i=0;i<r.length;i++)a.push((65280&r[i].byteLength)>>>8),a.push(255&r[i].byteLength),a=a.concat(Array.prototype.slice.call(r[i]));for(i=0;i<s.length;i++)o.push((65280&s[i].byteLength)>>>8),o.push(255&s[i].byteLength),o=o.concat(Array.prototype.slice.call(s[i]));if(n=[k.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(k.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],a,[s.length],o))),t(k.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1];n.push(t(k.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return t.apply(null,n)},B=function(e){return t(k.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),r(e))},p=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(k.tkhd,i)},b=function(e){var i,n,r,s,a,o;return i=t(k.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),a=Math.floor(e.baseMediaDecodeTime/(q+1)),o=Math.floor(e.baseMediaDecodeTime%(q+1)),n=t(k.tfdt,new Uint8Array([1,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),92,"audio"===e.type?(r=S(e,92),t(k.traf,i,n,r)):(s=v(e),r=S(e,s.length+92),t(k.traf,i,n,r,s))},d=function(e){return e.duration=e.duration||4294967295,t(k.trak,p(e),f(e))},T=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(k.trex,i)},V=function(e,t){var i=0,n=0,r=0,s=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(s=8)),[0,0,i|n|r|s,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},F=function(e,i){var n,r,s,a;for(i+=20+16*(r=e.samples||[]).length,n=V(r,i),a=0;a<r.length;a++)s=r[a],n=n.concat([(4278190080&s.duration)>>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size,s.flags.isLeading<<2|s.flags.dependsOn,s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,61440&s.flags.degradationPriority,15&s.flags.degradationPriority,(4278190080&s.compositionTimeOffset)>>>24,(16711680&s.compositionTimeOffset)>>>16,(65280&s.compositionTimeOffset)>>>8,255&s.compositionTimeOffset]);return t(k.trun,new Uint8Array(n))},j=function(e,i){var n,r,s,a;for(i+=20+8*(r=e.samples||[]).length,n=V(r,i),a=0;a<r.length;a++)s=r[a],n=n.concat([(4278190080&s.duration)>>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size]);return t(k.trun,new Uint8Array(n))},S=function(e,t){return"audio"===e.type?j(e,t):F(e,t)};s=function(){return t(k.ftyp,C,w,C,E)};var W,z,$,G,X,K,Y,Q,J=function(e){return t(k.mdat,e)},Z=u,ee=function(e){var t,i=s(),n=l(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t},te=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ie=function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,n.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n),r},ne=function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},re=function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},se=function(e,t){var i,n,r,s,a,o=t||0,u=[];for(i=0;i<e.length;i++)for(s=e[i],n=0;n<s.length;n++)a=s[n],o+=(r=te(a,o)).size,u.push(r);return u},ae=function(e){var t,i,n,r,s,a,o=0,u=e.byteLength,l=e.nalCount,c=new Uint8Array(u+4*l),h=new DataView(c.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(s=r[i],n=0;n<s.length;n++)a=s[n],h.setUint32(o,a.data.byteLength),o+=4,c.set(a.data,o),o+=a.data.byteLength;return c},oe=[33,16,5,32,164,27],ue=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],le=function(e){for(var t=[];e--;)t.push(0);return t},ce={96e3:[oe,[227,64],le(154),[56]],88200:[oe,[231],le(170),[56]],64e3:[oe,[248,192],le(240),[56]],48e3:[oe,[255,192],le(268),[55,148,128],le(54),[112]],44100:[oe,[255,192],le(268),[55,163,128],le(84),[112]],32e3:[oe,[255,192],le(268),[55,234],le(226),[112]],24e3:[oe,[255,192],le(268),[55,255,128],le(268),[111,112],le(126),[224]],16e3:[oe,[255,192],le(268),[55,255,128],le(268),[111,255],le(269),[223,108],le(195),[1,192]],12e3:[ue,le(268),[3,127,248],le(268),[6,255,240],le(268),[13,255,224],le(268),[27,253,128],le(259),[56]],11025:[ue,le(268),[3,127,248],le(268),[6,255,240],le(268),[13,255,224],le(268),[27,255,192],le(268),[55,175,128],le(108),[112]],8e3:[ue,le(268),[3,121,16],le(47),[7]]},he=(W=ce,Object.keys(W).reduce((function(e,t){return e[t]=new Uint8Array(W[t].reduce((function(e,t){return e.concat(t)}),[])),e}),{}));K=function(e,t){return z(X(e,t))},Y=function(e,t){return $(G(e),t)},Q=function(e,t,i){return G(i?e:e-t)};var de=9e4,pe=(z=function(e){return 9e4*e},$=function(e,t){return e*t},G=function(e){return e/9e4},X=function(e,t){return e/t},K),fe=Y,me=Q,ge=function(e,t,i,n){var r,s,a,o,u,l=0,c=0,h=0;if(t.length&&(r=pe(e.baseMediaDecodeTime,e.samplerate),s=Math.ceil(de/(e.samplerate/1024)),i&&n&&(l=r-Math.max(i,n),h=(c=Math.floor(l/s))*s),!(c<1||h>de/2))){for((a=he[e.samplerate])||(a=t[0].data),o=0;o<c;o++)u=t[0],t.splice(0,0,{data:a,dts:u.dts-s,pts:u.pts-s});e.baseMediaDecodeTime-=Math.floor(fe(h,e.samplerate))}},ve=function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},ye=function(e){var t,i,n=[];for(t=0;t<e.length;t++)i=e[t],n.push({size:i.data.byteLength,duration:1024});return n},_e=function(e){var t,i,n=0,r=new Uint8Array(function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i}(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,n),n+=i.data.byteLength;return r},be=de,Te=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},Se=function(e,t){var i,n=e.minSegmentDts;return t||(n-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=n,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/be,i=Math.floor(i)),i},ke=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},Ce=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}t+=r,n=0,r=0}return i},we=function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},Ee=function(e,t){var i,n,r,s,a=[];if(!(64&t[0]))return a;for(n=31&t[0],i=0;i<n;i++)s={type:3&t[(r=3*i)+2],pts:e},4&t[r+2]&&(s.ccData=t[r+3]<<8|t[r+4],a.push(s));return a},xe=4,Ae=function e(){e.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new De(0,0),new De(0,1),new De(1,0),new De(1,1)],this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this)};(Ae.prototype=new H).push=function(e){var t,i,n;if("sei_rbsp"===e.nalUnitType&&(t=Ce(e.escapedRBSP)).payloadType===xe&&(i=we(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=Ee(e.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Ae.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},Ae.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2&&this.dispatchCea608Packet(e)}),this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},Ae.prototype.flush=function(){return this.flushStream("flush")},Ae.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Ae.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},Ae.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},Ae.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Ae.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Ae.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var Ie={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},Pe=function(e){return null===e?"":(e=Ie[e]||e,String.fromCharCode(e))},Le=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Oe=function(){for(var e=[],t=15;t--;)e.push("");return e},De=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,s;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(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);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Oe();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Oe();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Oe()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))s=Pe((n=(3&n)<<8)|r),this[this.mode_](e.pts,s),this.column_++;else if(this.isExtCharacter(n,r))"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),s=Pe((n=(3&n)<<8)|r),this[this.mode_](e.pts,s),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var a=Le.indexOf(7968&t);"rollUp"===this.mode_&&(a-this.rollUpRows_+1<0&&(a=this.rollUpRows_-1),this.setRollUp(e.pts,a)),a!==this.row_&&(this.clearFormatting(e.pts),this.row_=a),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),s=Pe(n),s+=Pe(r),this[this.mode_](e.pts,s),this.column_+=s.length)}else this.lastControlCode_=null}};De.prototype=new H,De.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e){try{return e.trim()}catch(e){return console.error("Skipping malformed caption."),""}})).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},De.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Oe(),this.nonDisplayed_=Oe(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},De.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_},De.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},De.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},De.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},De.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},De.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},De.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},De.prototype.isNormalChar=function(e){return e>=32&&e<=127},De.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Oe(),this.displayed_=Oe()),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},De.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce((function(e,t){return e+"<"+t+">"}),"");this[this.mode_](e,i)},De.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),"");this.formatting_=[],this[this.mode_](e,t)}},De.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},De.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},De.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},De.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var Ne={CaptionStream:Ae,Cea608Stream:De},Re={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ue=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},Me=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=Ue(e.dts,n),e.pts=Ue(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Me.prototype=new H;var Be,je=Me,Fe=function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r},Ve=function(e,t,i){return decodeURIComponent(Fe(e,t,i))},He=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},qe={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Ve(e.data,1,t),e.value=Ve(e.data,t+1,e.data.length).replace(/\0*$/,"");break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Ve(e.data,1,t),e.url=Ve(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,i;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(i=e.data,unescape(Fe(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Be=function(e){var t,i={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},n=0,r=[],s=0;if(Be.prototype.init.call(this),this.dispatchType=Re.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,a,o,u,l;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(s=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))i.debug&&console.log("Skipping unrecognized metadata packet");else if(r.push(e),s+=e.data.byteLength,1===r.length&&(n=He(e.data.subarray(6,10)),n+=10),!(s<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<n;)t.data.set(r[0].data.subarray(0,n-l),l),l+=r[0].data.byteLength,s-=r[0].data.byteLength,r.shift();a=10,64&t.data[5]&&(a+=4,a+=He(t.data.subarray(10,14)),n-=He(t.data.subarray(16,20)));do{if((o=He(t.data.subarray(a+4,a+8)))<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if((u={id:String.fromCharCode(t.data[a],t.data[a+1],t.data[a+2],t.data[a+3]),data:t.data.subarray(a+10,a+o+10)}).key=u.id,qe[u.id]&&(qe[u.id](u),"com.apple.streaming.transportStreamTimestamp"===u.owner)){var c=u.data,h=(1&c[3])<<30|c[4]<<22|c[5]<<14|c[6]<<6|c[7]>>>2;h*=4,h+=3&c[7],u.timeStamp=h,void 0===t.pts&&void 0===t.dts&&(t.pts=u.timeStamp,t.dts=u.timeStamp),this.trigger("timestamp",u)}t.frames.push(u),a+=10,a+=o}while(a<n);this.trigger("data",t)}}}).prototype=new H;var We,ze,$e,Ge=Be,Xe=je;(We=function(){var e=new Uint8Array(188),t=0;We.prototype.init.call(this),this.push=function(i){var n,r=0,s=188;for(t?((n=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),n.set(i,t),t=0):n=i;s<n.byteLength;)71!==n[r]||71!==n[s]?(r++,s++):(this.trigger("data",n.subarray(r,s)),r+=188,s+=188);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){188===t&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}}).prototype=new H,(ze=function(){var e,t,i,n;ze.prototype.init.call(this),n=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,n){var r=0;n.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===n.type?t(e.subarray(r),n):i(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var s=e[r],a=(31&e[r+1])<<8|e[r+2];s===Re.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=a:s===Re.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=a:s===Re.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][a]=s),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=n.programMapTable}},this.push=function(t){var i={},n=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Re.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Re.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new H,ze.STREAM_TYPES={h264:27,adts:15},($e=function(){var e,t=this,i={data:[],size:0},n={data:[],size:0},r={data:[],size:0},s=function(e,i,n){var r,s,a=new Uint8Array(e.size),o={type:i},u=0,l=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,u=0;u<e.data.length;u++)s=e.data[u],a.set(s.data,l),l+=s.data.byteLength;var c,h,d;c=a,(h=o).packetLength=6+(c[4]<<8|c[5]),h.dataAlignmentIndicator=0!=(4&c[6]),192&(d=c[7])&&(h.pts=(14&c[9])<<27|(255&c[10])<<20|(254&c[11])<<12|(255&c[12])<<5|(254&c[13])>>>3,h.pts*=4,h.pts+=(6&c[13])>>>1,h.dts=h.pts,64&d&&(h.dts=(14&c[14])<<27|(255&c[15])<<20|(254&c[16])<<12|(255&c[17])<<5|(254&c[18])>>>3,h.dts*=4,h.dts+=(6&c[18])>>>1)),h.data=c.subarray(9+c[8]),r="video"===i||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};$e.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var e,t;switch(a.streamType){case Re.H264_STREAM_TYPE:case Re.H264_STREAM_TYPE:e=i,t="video";break;case Re.ADTS_STREAM_TYPE:e=n,t="audio";break;case Re.METADATA_STREAM_TYPE:e=r,t="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(a),e.size+=a.data.byteLength},pmt:function(){var i={type:"metadata",tracks:[]};null!==(e=a.programMapTable).video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",i)}})[a.type]()},this.reset=function(){i.size=0,i.data.length=0,n.size=0,n.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(i,"video"),s(n,"audio"),s(r,"timed-metadata")},this.flush=function(){this.flushStreams_(),this.trigger("done")}}).prototype=new H;var Ke={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:We,TransportParseStream:ze,ElementaryStream:$e,TimestampRolloverStream:Xe,CaptionStream:Ne.CaptionStream,Cea608Stream:Ne.Cea608Stream,MetadataStream:Ge};for(var Ye in Re)Re.hasOwnProperty(Ye)&&(Ke[Ye]=Re[Ye]);var Qe,Je=Ke,Ze=de,et=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(Qe=function(e){var t,i=0;Qe.prototype.init.call(this),this.push=function(n){var r,s,a,o,u,l,c=0;if(e||(i=0),"audio"===n.type)for(t?(o=t,(t=new Uint8Array(o.byteLength+n.data.byteLength)).set(o),t.set(n.data,o.byteLength)):t=n.data;c+5<t.length;)if(255===t[c]&&240==(246&t[c+1])){if(s=2*(1&~t[c+1]),r=(3&t[c+3])<<11|t[c+4]<<3|(224&t[c+5])>>5,l=(u=1024*(1+(3&t[c+6])))*Ze/et[(60&t[c+2])>>>2],a=c+r,t.byteLength<a)return;if(this.trigger("data",{pts:n.pts+i*l,dts:n.dts+i*l,sampleCount:u,audioobjecttype:1+(t[c+2]>>>6&3),channelcount:(1&t[c+2])<<2|(192&t[c+3])>>>6,samplerate:et[(60&t[c+2])>>>2],samplingfrequencyindex:(60&t[c+2])>>>2,samplesize:16,data:t.subarray(c+7+s,a)}),i++,t.byteLength===a)return void(t=void 0);t=t.subarray(a)}else c++},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new H;var tt,it,nt,rt=Qe,st=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,s=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");s.set(e.subarray(r,r+a)),i=new DataView(s.buffer).getUint32(0),n=8*a,t-=a},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),s=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?s<<r|this.readBits(r):s},this.skipLeadingZeros=function(){var e;for(e=0;e<n;++e)if(0!=(i&2147483648>>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(it=function(){var e,t,i=0;it.prototype.init.call(this),this.push=function(n){var r;t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;for(var s=t.byteLength;i<s-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<s;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<s);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.reset=function(){t=null,i=0,this.trigger("reset")},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new H,nt={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(tt=function(){var e,t,i,n,r,s,a,o=new it;tt.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(a){var o={trackId:t,pts:i,dts:n,data:a};switch(31&a[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(a.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(a.subarray(1)),o.config=s(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},a=function(e,t){var i,n=8,r=8;for(i=0;i<e;i++)0!==r&&(r=(n+t.readExpGolomb()+256)%256),n=0===r?n:r},r=function(e){for(var t,i,n=e.byteLength,r=[],s=1;s<n-2;)0===e[s]&&0===e[s+1]&&3===e[s+2]?(r.push(s+2),s+=2):s++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var a=0;for(s=0;s<t;a++,s++)a===r[0]&&(a++,r.shift()),i[s]=e[a];return i},s=function(e){var t,i,n,r,s,o,u,l,c,h,d,p,f,m=0,g=0,v=0,y=0,_=1;if(i=(t=new st(e)).readUnsignedByte(),r=t.readUnsignedByte(),n=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),nt[i]&&(3===(s=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(d=3!==s?8:12,f=0;f<d;f++)t.readBoolean()&&a(f<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),u=t.readUnsignedExpGolomb(),f=0;f<u;f++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(h=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb(),y=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:p=[1,1];break;case 2:p=[12,11];break;case 3:p=[10,11];break;case 4:p=[16,11];break;case 5:p=[40,33];break;case 6:p=[24,11];break;case 7:p=[20,11];break;case 8:p=[32,11];break;case 9:p=[80,33];break;case 10:p=[18,11];break;case 11:p=[15,11];break;case 12:p=[64,33];break;case 13:p=[160,99];break;case 14:p=[4,3];break;case 15:p=[3,2];break;case 16:p=[2,1];break;case 255:p=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}p&&(_=p[0]/p[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:Math.ceil((16*(l+1)-2*m-2*g)*_),height:(2-h)*(c+1)*16-2*v-2*y,sarRatio:p}}}).prototype=new H;var at,ot={H264Stream:tt,NalByteStream:it},ut=function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},lt=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?i+20:i+10},ct=function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i};(at=function(){var e=new Uint8Array,t=0;at.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var n,r,s,a,o=0,u=0;for(e.length?(a=e.length,(e=new Uint8Array(i.byteLength+a)).set(e.subarray(0,a)),e.set(i,a)):e=i;e.length-u>=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255!=(255&e[u])||240!=(240&e[u+1]))u++;else{if(e.length-u<7)break;if(u+(o=ct(e,u))>e.length)break;s={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",s),u+=o}else{if(e.length-u<10)break;if(u+(o=lt(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=n>0?e.subarray(u):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new H;var ht,dt,pt,ft,mt=at,gt=ot.H264Stream,vt=ut,yt=de,_t=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],bt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Tt=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},St=function(e,t,i,n,r,s){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(n-t),pts:e+(r-i)},prependedContentDuration:s,baseMediaDecodeTime:e}};(dt=function(e,t){var i=[],n=0,r=0,s=0,a=1/0;t=t||{},dt.prototype.init.call(this),this.push=function(t){ke(e,t),e&&_t.forEach((function(i){e[i]=t[i]})),i.push(t)},this.setEarliestDts=function(t){r=t-e.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(e){a=e},this.setAudioAppendStart=function(e){s=e},this.flush=function(){var o,u,l,c,h;0!==i.length?(o=ve(i,e,r),e.baseMediaDecodeTime=Se(e,t.keepOriginalTimestamps),ge(e,o,s,a),e.samples=ye(o),l=J(_e(o)),i=[],u=Z(n,[e]),c=new Uint8Array(u.byteLength+l.byteLength),n++,c.set(u),c.set(l,u.byteLength),Te(e),h=Math.ceil(1024*yt/e.samplerate),o.length&&this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+o.length*h}),this.trigger("data",{track:e,boxes:c}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.reset=function(){Te(e),i=[],this.trigger("reset")}}).prototype=new H,(ht=function(e,t){var i,n,r=0,s=[],a=[];t=t||{},ht.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){ke(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],bt.forEach((function(t){e[t]=i[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.data,e.pps=[t.data]),s.push(t)},this.flush=function(){for(var i,n,o,u,l,c,h,d,p=0;s.length&&"access_unit_delimiter_rbsp"!==s[0].nalUnitType;)s.shift();if(0===s.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(i=ie(s),(o=ne(i))[0][0].keyFrame||((n=this.getGopForFusion_(s[0],e))?(p=n.duration,o.unshift(n),o.byteLength+=n.byteLength,o.nalCount+=n.nalCount,o.pts=n.pts,o.dts=n.dts,o.duration+=n.duration):o=re(o)),a.length){var f;if(!(f=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),s=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");Te(e),o=f}ke(e,o),e.samples=se(o),l=J(ae(o)),e.baseMediaDecodeTime=Se(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),h=o[0],d=o[o.length-1],this.trigger("segmentTimingInfo",St(e.baseMediaDecodeTime,h.dts,h.pts,d.dts+d.duration,d.pts+d.duration,p)),this.trigger("timingInfo",{start:o[0].pts,end:o[o.length-1].pts+o[o.length-1].duration}),this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),s=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),u=Z(r,[e]),c=new Uint8Array(u.byteLength+l.byteLength),r++,c.set(u),c.set(l,u.byteLength),this.trigger("data",{track:e,boxes:c}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),s=[],this.gopCache_.length=0,a.length=0,this.trigger("reset")},this.resetStream_=function(){Te(e),i=void 0,n=void 0},this.getGopForFusion_=function(t){var i,n,r,s,a,o=1/0;for(a=0;a<this.gopCache_.length;a++)r=(s=this.gopCache_[a]).gop,e.pps&&Tt(e.pps[0],s.pps[0])&&e.sps&&Tt(e.sps[0],s.sps[0])&&(r.dts<e.timelineStartInfo.dts||(i=t.dts-r.dts-r.duration)>=-1e4&&i<=45e3&&(!n||o>i)&&(n=s,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,s,o,u,l;for(s=e.byteLength,o=e.nalCount,u=e.duration,t=i=0;t<a.length&&i<e.length&&(n=a[t],r=e[i],n.pts!==r.pts);)r.pts>n.pts?t++:(i++,s-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===i?e:i===e.length?null:((l=e.slice(i)).byteLength=s,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,i,n,r,s,o,u;for(t=a.length-1,i=e.length-1,s=null,o=!1;t>=0&&i>=0;){if(n=a[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===a.length-1&&(s=i),i--)}if(!o&&null===s)return null;if(0===(u=o?i:s))return e;var l=e.slice(u),c=l.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){a=e}}).prototype=new H,(ft=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ft.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new H,ft.prototype.flush=function(e){var t,i,n,r,s=0,a={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,bt.forEach((function(e){a.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,_t.forEach((function(e){a.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?a.type=this.pendingTracks[0].type:a.type="combined",this.emittedTracks+=this.pendingTracks.length,n=ee(this.pendingTracks),a.initSegment=new Uint8Array(n.byteLength),a.initSegment.set(n),a.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)a.data.set(this.pendingBoxes[r],s),s+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=me(t.startPts,o,this.keepOriginalTimestamps),t.endTime=me(t.endPts,o,this.keepOriginalTimestamps),a.captionStreams[t.stream]=!0,a.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=me(i.pts,o,this.keepOriginalTimestamps),a.metadata.push(i);for(a.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",a),r=0;r<a.captions.length;r++)t=a.captions[r],this.trigger("caption",t);for(r=0;r<a.metadata.length;r++)i=a.metadata[r],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},ft.prototype.setRemux=function(e){this.remuxTracks=e},(pt=function(e){var t,i,n=this,r=!0;pt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new Je.MetadataStream,r.aacStream=new mt,r.audioTimestampRolloverStream=new Je.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Je.TimestampRolloverStream("timed-metadata"),r.adtsStream=new rt,r.coalesceStream=new ft(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(s){"timed-metadata"!==s.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new dt(i,e),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Je.MetadataStream,r.packetStream=new Je.TransportPacketStream,r.parseStream=new Je.TransportParseStream,r.elementaryStream=new Je.ElementaryStream,r.timestampRolloverStream=new Je.TimestampRolloverStream,r.adtsStream=new rt,r.h264Stream=new gt,r.captionStream=new Je.CaptionStream,r.coalesceStream=new ft(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(s){var a;if("metadata"===s.type){for(a=s.tracks.length;a--;)t||"video"!==s.tracks[a].type?i||"audio"!==s.tracks[a].type||((i=s.tracks[a]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=s.tracks[a]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new ht(t,e),r.videoSegmentStream.on("timelineStartInfo",(function(e){i&&(i.timelineStartInfo=e,r.audioSegmentStream.setEarliestDts(e.dts))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new dt(i,e),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,Te(i),e.keepOriginalTimestamps||(i.timelineStartInfo.baseMediaDecodeTime=n),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,Te(t),r.captionStream.reset(),e.keepOriginalTimestamps||(t.timelineStartInfo.baseMediaDecodeTime=n)),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.push=function(e){if(r){var t=vt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new H;var kt={Transmuxer:pt,VideoSegmentStream:ht,AudioSegmentStream:dt,AUDIO_PROPERTIES:_t,VIDEO_PROPERTIES:bt,generateVideoSegmentTimingInfo:St},Ct=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),wt=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=i||{},this.self=t,this.init()}return Ct(e,[{key:"init",value:function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new kt.Transmuxer(this.options),function(e,t){t.on("data",(function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};var n=t.data;t.data=n.buffer,e.postMessage({action:"data",segment:t,byteOffset:n.byteOffset,byteLength:n.byteLength},[t.data])})),t.captionStream&&t.captionStream.on("data",(function(t){e.postMessage({action:"caption",data:t})})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}))}(this.self,this.transmuxer)}},{key:"push",value:function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4*t))}},{key:"setAudioAppendStart",value:function(e){this.transmuxer.setAudioAppendStart(Math.ceil(9e4*e.appendStart))}},{key:"flush",value:function(e){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}},{key:"alignGopsWith",value:function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}]),e}();new function(e){e.onmessage=function(t){"init"===t.data.action&&t.data.options?this.messageHandlers=new wt(e,t.data.options):(this.messageHandlers||(this.messageHandlers=new wt(e)),t.data&&t.data.action&&"init"!==t.data.action&&this.messageHandlers[t.data.action]&&this.messageHandlers[t.data.action](t.data))}}(i)}()})),Kc={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},Yc=function(e){return e.map((function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)}))}))},Qc=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t={codecCount:0},i=void 0;return t.codecCount=e.split(",").length,t.codecCount=t.codecCount||2,(i=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(e))&&(t.videoCodec=i[2],t.videoObjectTypeIndicator=i[3]),t.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(e),t.audioProfile=t.audioProfile&&t.audioProfile[2],t},Jc=function(e,t,i){return e+"/"+t+'; codecs="'+i.filter((function(e){return!!e})).join(", ")+'"'},Zc=function(e,t){var i=function(e){return e.segments&&e.segments.length&&e.segments[0].map?"mp4":"mp2t"}(t),n=function(e){var t=e.attributes||{};return t.CODECS?Qc(t.CODECS):Kc}(t),r=t.attributes||{},s=!0,a=!1;if(!t)return[];if(e.mediaGroups.AUDIO&&r.AUDIO){var o=e.mediaGroups.AUDIO[r.AUDIO];if(o)for(var u in a=!0,s=!1,o)if(!o[u].uri&&!o[u].playlists){s=!0;break}}a&&!n.audioProfile&&(s||(n.audioProfile=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return Qc(r.playlists[0].attributes.CODECS).audioProfile}return null}(e,r.AUDIO)),n.audioProfile||(Nl.log.warn("Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"),n.audioProfile=Kc.audioProfile));var l={};n.videoCodec&&(l.video=""+n.videoCodec+n.videoObjectTypeIndicator),n.audioProfile&&(l.audio="mp4a.40."+n.audioProfile);var c=Jc("audio",i,[l.audio]),h=Jc("video",i,[l.video]),d=Jc("video",i,[l.video,l.audio]);return a?!s&&l.video?[h,c]:s||l.video?[d,c]:[c,c]:l.video?[d]:[c]},eh=function(e){var t={type:"",parameters:{}},i=e.trim().split(";");return t.type=i.shift().trim(),i.forEach((function(e){var i=e.trim().split("=");if(i.length>1){var n=i[0].replace(/"/g,"").trim(),r=i[1].replace(/"/g,"").trim();t.parameters[n]=r}})),t},th=function(e){return/mp4a\.\d+.\d+/i.test(e)},ih=function(e){return/avc1\.[\da-f]+/i.test(e)},nh=function(e,t,i){if(null==t||!e.length)return[];var n=Math.ceil(9e4*(t-i+3)),r=void 0;for(r=0;r<e.length&&!(e[r].pts>n);r++);return e.slice(r)},rh=function(e){function t(e,i){jl(this,t);var n=Hl(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,Nl.EventTarget));n.timestampOffset_=0,n.pendingBuffers_=[],n.bufferUpdating_=!1,n.mediaSource_=e,n.codecs_=i,n.audioCodec_=null,n.videoCodec_=null,n.audioDisabled_=!1,n.appendAudioInitSegment_=!0,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=Nl.browser.IE_VERSION>=11;var r={remux:!1,alignGopsAtEnd:n.safeAppend_};return n.codecs_.forEach((function(e){th(e)?n.audioCodec_=e:ih(e)&&(n.videoCodec_=e)})),n.transmuxer_=new Xc,n.transmuxer_.postMessage({action:"init",options:r}),n.transmuxer_.onmessage=function(e){return"data"===e.data.action?n.data_(e):"done"===e.data.action?n.done_(e):"gopInfo"===e.data.action?n.appendGopInfo_(e):"videoSegmentTimingInfo"===e.data.action?n.videoSegmentTimingInfo_(e.data.videoSegmentTimingInfo):void 0},Object.defineProperty(n,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(e){"number"==typeof e&&e>=0&&(this.timestampOffset_=e,this.appendAudioInitSegment_=!0,this.gopBuffer_.length=0,this.timeMapping_=0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e}))}}),Object.defineProperty(n,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(e){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=e),this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=e)}}),Object.defineProperty(n,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(n,"buffered",{get:function(){return function(e,t,i){var n=null,r=null,s=0,a=[],o=[];if(!e&&!t)return Nl.createTimeRange();if(!e)return t.buffered;if(!t)return e.buffered;if(i)return e.buffered;if(0===e.buffered.length&&0===t.buffered.length)return Nl.createTimeRange();for(var u=e.buffered,l=t.buffered,c=u.length;c--;)a.push({time:u.start(c),type:"start"}),a.push({time:u.end(c),type:"end"});for(c=l.length;c--;)a.push({time:l.start(c),type:"start"}),a.push({time:l.end(c),type:"end"});for(a.sort((function(e,t){return e.time-t.time})),c=0;c<a.length;c++)"start"===a[c].type?2===++s&&(n=a[c].time):"end"===a[c].type&&1===--s&&(r=a[c].time),null!==n&&null!==r&&(o.push([n,r]),n=null,r=null);return Nl.createTimeRanges(o)}(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),n}return Vl(t,e),Fl(t,[{key:"data_",value:function(e){var t=e.data.segment;t.data=new Uint8Array(t.data,e.data.byteOffset,e.data.byteLength),t.initSegment=new Uint8Array(t.initSegment.data,t.initSegment.byteOffset,t.initSegment.byteLength),function(e,t,i){var n=t.player_;if(i.captions&&i.captions.length)for(var r in e.inbandTextTracks_||(e.inbandTextTracks_={}),i.captionStreams)if(!e.inbandTextTracks_[r]){n.tech_.trigger({type:"usage",name:"hls-608"});var s=n.textTracks().getTrackById(r);e.inbandTextTracks_[r]=s||n.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track}i.metadata&&i.metadata.length&&!e.metadataTrack_&&(e.metadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=i.metadata.dispatchType)}(this,this.mediaSource_,t),this.pendingBuffers_.push(t)}},{key:"done_",value:function(e){"closed"!==this.mediaSource_.readyState?this.processPendingSegments_():this.pendingBuffers_.length=0}},{key:"videoSegmentTimingInfo_",value:function(e){var t={start:{decode:e.start.dts/9e4,presentation:e.start.pts/9e4},end:{decode:e.end.dts/9e4,presentation:e.end.pts/9e4},baseMediaDecodeTime:e.baseMediaDecodeTime/9e4};e.prependedContentDuration&&(t.prependedContentDuration=e.prependedContentDuration/9e4),this.trigger({type:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}},{key:"createRealSourceBuffers_",value:function(){var e=this,t=["audio","video"];t.forEach((function(i){if(e[i+"Codec_"]&&!e[i+"Buffer_"]){var n=null;if(e.mediaSource_[i+"Buffer_"])(n=e.mediaSource_[i+"Buffer_"]).updating=!1;else{var r=i+'/mp4;codecs="'+e[i+"Codec_"]+'"';n=function(e,t){var i=e.addSourceBuffer(t),n=Object.create(null);n.updating=!1,n.realBuffer_=i;var r=function(e){"function"==typeof i[e]?n[e]=function(){return i[e].apply(i,arguments)}:void 0===n[e]&&Object.defineProperty(n,e,{get:function(){return i[e]},set:function(t){return i[e]=t}})};for(var s in i)r(s);return n}(e.mediaSource_.nativeMediaSource_,r),e.mediaSource_[i+"Buffer_"]=n}e[i+"Buffer_"]=n,["update","updatestart","updateend"].forEach((function(r){n.addEventListener(r,(function(){if("audio"!==i||!e.audioDisabled_)return"updateend"===r&&(e[i+"Buffer_"].updating=!1),t.every((function(t){return!("audio"!==t||!e.audioDisabled_)||(i===t||!e[t+"Buffer_"]||!e[t+"Buffer_"].updating)}))?e.trigger(r):void 0}))}))}}))}},{key:"appendBuffer",value:function(e){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:nh(this.gopBuffer_,this.mediaSource_.player_?this.mediaSource_.player_.currentTime():null,this.timeMapping_)}),this.transmuxer_.postMessage({action:"push",data:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength},[e.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"appendGopInfo_",value:function(e){this.gopBuffer_=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var n=t[0].pts,r=0;r<e.length&&!(e[r].pts>=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,e.data.gopInfo,this.safeAppend_)}},{key:"remove",value:function(e,t){if(this.videoBuffer_&&(this.videoBuffer_.updating=!0,this.videoBuffer_.remove(e,t),this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil(9e4*(t-n)),s=Math.ceil(9e4*(i-n)),a=e.slice(),o=e.length;o--&&!(e[o].pts<=s););if(-1===o)return a;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),a.splice(u,o-u+1),a}(this.gopBuffer_,e,t,this.timeMapping_)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(e,t)),Rc(e,t,this.metadataTrack_),this.inbandTextTracks_)for(var i in this.inbandTextTracks_)Rc(e,t,this.inbandTextTracks_[i])}},{key:"processPendingSegments_",value:function(){var e={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};if(!this.pendingBuffers_.length)return this.trigger("updateend"),void(this.bufferUpdating_=!1);e=this.pendingBuffers_.reduce((function(e,t){var i=t.type,n=t.data,r=t.initSegment;return e[i].segments.push(n),e[i].bytes+=n.byteLength,e[i].initSegment=r,t.captions&&(e.captions=e.captions.concat(t.captions)),t.info&&(e[i].info=t.info),t.metadata&&(e.metadata=e.metadata.concat(t.metadata)),e}),e),this.videoBuffer_||this.audioBuffer_||(0===e.video.bytes&&(this.videoCodec_=null),0===e.audio.bytes&&(this.audioCodec_=null),this.createRealSourceBuffers_()),e.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:e.audio.info}),e.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:e.video.info}),this.appendAudioInitSegment_&&(!this.audioDisabled_&&this.audioBuffer_&&(e.audio.segments.unshift(e.audio.initSegment),e.audio.bytes+=e.audio.initSegment.byteLength),this.appendAudioInitSegment_=!1);var t=!1;this.videoBuffer_&&e.video.bytes?(e.video.segments.unshift(e.video.initSegment),e.video.bytes+=e.video.initSegment.byteLength,this.concatAndAppendSegments_(e.video,this.videoBuffer_)):!this.videoBuffer_||!this.audioDisabled_&&this.audioBuffer_||(t=!0),Mc(this,e.captions,e.metadata),!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(e.audio,this.audioBuffer_),this.pendingBuffers_.length=0,t&&this.trigger("updateend"),this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(e,t){var i=0,n=void 0;if(e.bytes){n=new Uint8Array(e.bytes),e.segments.forEach((function(e){n.set(e,i),i+=e.byteLength}));try{t.updating=!0,t.appendBuffer(n)}catch(e){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:e.message,originalError:e})}}}},{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}},{key:"dispose",value:function(){this.transmuxer_&&this.transmuxer_.terminate(),this.trigger("dispose"),this.off()}}]),t}(Nl.EventTarget),sh=function(e){function t(){jl(this,t);var e=Hl(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),i=void 0;for(i in e.nativeMediaSource_=new ee.MediaSource,e.nativeMediaSource_)i in t.prototype||"function"!=typeof e.nativeMediaSource_[i]||(e[i]=e.nativeMediaSource_[i].bind(e.nativeMediaSource_));return e.duration_=NaN,Object.defineProperty(e,"duration",{get:function(){return this.duration_===1/0?this.duration_:this.nativeMediaSource_.duration},set:function(e){this.duration_=e,e===1/0||(this.nativeMediaSource_.duration=e)}}),Object.defineProperty(e,"seekable",{get:function(){return this.duration_===1/0?Nl.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(e,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(e,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),e.sourceBuffers=[],e.activeSourceBuffers_=[],e.updateActiveSourceBuffers_=function(){if(e.activeSourceBuffers_.length=0,1===e.sourceBuffers.length){var t=e.sourceBuffers[0];return t.appendAudioInitSegment_=!0,t.audioDisabled_=!t.audioCodec_,void e.activeSourceBuffers_.push(t)}for(var i=!1,n=!0,r=0;r<e.player_.audioTracks().length;r++){var s=e.player_.audioTracks()[r];if(s.enabled&&"main"!==s.kind){i=!0,n=!1;break}}e.sourceBuffers.forEach((function(t,r){if(t.appendAudioInitSegment_=!0,t.videoCodec_&&t.audioCodec_)t.audioDisabled_=i;else if(t.videoCodec_&&!t.audioCodec_)t.audioDisabled_=!0,n=!1;else if(!t.videoCodec_&&t.audioCodec_&&(t.audioDisabled_=r?n:!n,t.audioDisabled_))return;e.activeSourceBuffers_.push(t)}))},e.onPlayerMediachange_=function(){e.sourceBuffers.forEach((function(e){e.appendAudioInitSegment_=!0}))},e.onHlsReset_=function(){e.sourceBuffers.forEach((function(e){e.transmuxer_&&e.transmuxer_.postMessage({action:"resetCaptions"})}))},e.onHlsSegmentTimeMapping_=function(t){e.sourceBuffers.forEach((function(e){return e.timeMapping_=t.mapping}))},["sourceopen","sourceclose","sourceended"].forEach((function(e){this.nativeMediaSource_.addEventListener(e,this.trigger.bind(this))}),e),e.on("sourceopen",(function(t){var i=ne.querySelector('[src="'+e.url_+'"]');i&&(e.player_=Nl(i.parentNode),e.player_&&(e.player_.tech_.on("hls-reset",e.onHlsReset_),e.player_.tech_.on("hls-segment-time-mapping",e.onHlsSegmentTimeMapping_),e.player_.audioTracks&&e.player_.audioTracks()&&(e.player_.audioTracks().on("change",e.updateActiveSourceBuffers_),e.player_.audioTracks().on("addtrack",e.updateActiveSourceBuffers_),e.player_.audioTracks().on("removetrack",e.updateActiveSourceBuffers_)),e.player_.on("mediachange",e.onPlayerMediachange_)))})),e.on("sourceended",(function(t){for(var i=Uc(e.duration),n=0;n<e.sourceBuffers.length;n++){var r=e.sourceBuffers[n],s=r.metadataTrack_&&r.metadataTrack_.cues;s&&s.length&&(s[s.length-1].endTime=i)}})),e.on("sourceclose",(function(e){this.sourceBuffers.forEach((function(e){e.transmuxer_&&e.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_&&this.player_.tech_.el_&&(this.player_.tech_.off("hls-reset",this.onHlsReset_),this.player_.tech_.off("hls-segment-time-mapping",this.onHlsSegmentTimeMapping_)))})),e}return Vl(t,e),Fl(t,[{key:"addSeekableRange_",value:function(e,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(e){var t=void 0,i=eh(e);if(/^(video|audio)\/mp2t$/i.test(i.type)){var n=[];i.parameters&&i.parameters.codecs&&(n=i.parameters.codecs.split(","),n=(n=Yc(n)).filter((function(e){return th(e)||ih(e)}))),0===n.length&&(n=["avc1.4d400d","mp4a.40.2"]),t=new rh(this,n),0!==this.sourceBuffers.length&&(this.sourceBuffers[0].createRealSourceBuffers_(),t.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)}else t=this.nativeMediaSource_.addSourceBuffer(e);return this.sourceBuffers.push(t),t}},{key:"dispose",value:function(){this.trigger("dispose"),this.off(),this.sourceBuffers.forEach((function(e){e.dispose&&e.dispose()})),this.sourceBuffers.length=0}}]),t}(Nl.EventTarget),ah=0;Nl.mediaSources={};var oh=function(e,t){var i=Nl.mediaSources[e];if(!i)throw new Error("Media Source not found (Video.js)");i.trigger({type:"sourceopen",swfId:t})},uh=function(){return!!ee.MediaSource&&!!ee.MediaSource.isTypeSupported&&ee.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},lh=function(){if(this.MediaSource={open:oh,supportsNativeMediaSources:uh},uh())return new sh;throw new Error("Cannot use create a virtual MediaSource for this video")};lh.open=oh,lh.supportsNativeMediaSources=uh;var ch={createObjectURL:function(e){var t=void 0;return e instanceof sh?(t=ee.URL.createObjectURL(e.nativeMediaSource_),e.url_=t,t):e instanceof sh?(t="blob:vjs-media-source/"+ah,ah++,Nl.mediaSources[t]=e,t):(t=ee.URL.createObjectURL(e),e.url_=t,t)}};Nl.MediaSource=lh,Nl.URL=ch;var hh=Nl.EventTarget,dh=Nl.mergeOptions,ph=function(e,t){for(var i=void 0,n=dh(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),r=0;r<t.playlists.length;r++){var s=Xl(n,t.playlists[r]);s?n=s:i=!0}return Gl(t,(function(e,t,r,s){if(e.playlists&&e.playlists.length){var a=e.playlists[0].id,o=Xl(n,e.playlists[0]);o&&((n=o).mediaGroups[t][r][s].playlists[0]=n.playlists[a],i=!1)}})),i?null:n},fh=function(e){var t=e.byterange.offset+e.byterange.length-1;return e.uri+"-"+e.byterange.offset+"-"+t},mh=function(e,t){var i,n,r={};for(var s in e){var a=e[s].sidx;if(a){var o=fh(a);if(!t[o])break;var u=t[o].sidxInfo;i=u,n=a,(Boolean(!i.map&&!n.map)||Boolean(i.map&&n.map&&i.map.byterange.offset===n.map.byterange.offset&&i.map.byterange.length===n.map.byterange.length))&&i.uri===n.uri&&i.byterange.offset===n.byterange.offset&&i.byterange.length===n.byterange.length&&(r[o]=t[o])}}return r},gh=function(e,t,i,n,r){var s={uri:Bl(n.handleManifestRedirects,e.resolvedUri),byterange:e.byterange,playlist:t};return i(Nl.mergeOptions(s,{responseType:"arraybuffer",headers:_c(s)}),r)},vh=function(e){function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments[3];jl(this,t);var s=Hl(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),a=n.withCredentials,o=void 0!==a&&a,u=n.handleManifestRedirects,l=void 0!==u&&u;if(s.hls_=i,s.withCredentials=o,s.handleManifestRedirects=l,!e)throw new Error("A non-empty playlist URL or playlist is required");return s.on("minimumUpdatePeriod",(function(){s.refreshXml_()})),s.on("mediaupdatetimeout",(function(){s.refreshMedia_(s.media().id)})),s.state="HAVE_NOTHING",s.loadedPlaylists_={},"string"==typeof e?(s.srcUrl=e,s.sidxMapping_={},Hl(s)):(s.setupChildLoader(r,e),s)}return Vl(t,e),Fl(t,[{key:"setupChildLoader",value:function(e,t){this.masterPlaylistLoader_=e,this.childPlaylist_=t}},{key:"dispose",value:function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},ee.clearTimeout(this.minimumUpdatePeriodTimeout_),ee.clearTimeout(this.mediaRequest_),ee.clearTimeout(this.mediaUpdateTimeout),this.off()}},{key:"hasPendingRequest",value:function(){return this.request||this.mediaRequest_}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"sidxRequestFinished_",value:function(e,t,i,n){var r=this;return function(s,a){if(r.request){if(r.request=null,s)return r.error={status:a.status,message:"DASH playlist request error at URL: "+e.uri,response:a.response,code:2},i&&(r.state=i),r.trigger("error"),n(t,null);var o=new Uint8Array(a.response),u=Nn.parseSidx(o.subarray(8));return n(t,u)}}}},{key:"media",value:function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=this.state;if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(n)if(this.media_&&this.trigger("mediachanging"),e.sidx){var r=void 0,s=void 0;this.masterPlaylistLoader_?(r=this.masterPlaylistLoader_.master,s=this.masterPlaylistLoader_.sidxMapping_):(r=this.master,s=this.sidxMapping_);var a=fh(e.sidx);s[a]={sidxInfo:e.sidx},this.request=gh(e.sidx,e,this.hls_.xhr,{handleManifestRedirects:this.handleManifestRedirects},this.sidxRequestFinished_(e,r,i,(function(n,r){if(!n||!r)throw new Error("failed to request sidx");s[a].sidx=r,t.haveMetadata({startingState:i,playlist:n.playlists[e.id]})})))}else this.mediaRequest_=ee.setTimeout(this.haveMetadata.bind(this,{startingState:i,playlist:e}),0)}},{key:"haveMetadata",value:function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")}},{key:"pause",value:function(){this.stopRequest(),ee.clearTimeout(this.mediaUpdateTimeout),ee.clearTimeout(this.minimumUpdatePeriodTimeout_),"HAVE_NOTHING"===this.state&&(this.started=!1)}},{key:"load",value:function(e){var t=this;ee.clearTimeout(this.mediaUpdateTimeout),ee.clearTimeout(this.minimumUpdatePeriodTimeout_);var i=this.media();if(e){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=ee.setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"parseMasterXml",value:function(){var e=kn(this.masterXml_,{manifestUri:this.srcUrl,clientOffset:this.clientOffset_,sidxMapping:this.sidxMapping_});e.uri=this.srcUrl;for(var t=0;t<e.playlists.length;t++){var i="placeholder-uri-"+t;e.playlists[t].uri=i}return Gl(e,(function(t,i,n,r){if(t.playlists&&t.playlists.length){var s="placeholder-uri-"+i+"-"+n+"-"+r,a=Kl(0,s);t.playlists[0].uri=s,t.playlists[0].id=a,e.playlists[a]=t.playlists[0],e.playlists[s]=t.playlists[0]}})),Yl(e),Ql(e),e}},{key:"start",value:function(){var e=this;this.started=!0,this.masterPlaylistLoader_?this.mediaRequest_=ee.setTimeout(this.haveMaster_.bind(this),0):this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"DASH playlist request error at URL: "+e.srcUrl,responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.masterXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?e.masterLoaded_=Date.parse(i.responseHeaders.date):e.masterLoaded_=Date.now(),e.srcUrl=Bl(e.handleManifestRedirects,e.srcUrl,i),e.syncClientServerClock_(e.onClientServerClockSync_.bind(e))}}))}},{key:"syncClientServerClock_",value:function(e){var t=this,i=Cn(this.masterXml_);return null===i?(this.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.clientOffset_=i.value-Date.now(),e()):void(this.request=this.hls_.xhr({uri:Ml(this.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n)return t.clientOffset_=t.masterLoaded_-Date.now(),e();var s=void 0;s="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.clientOffset_=s-Date.now(),e()}})))}},{key:"haveMaster_",value:function(){this.state="HAVE_MASTER",this.mediaRequest_=null,this.masterPlaylistLoader_?this.media_||this.media(this.childPlaylist_):(this.master=this.parseMasterXml(),this.trigger("loadedplaylist"))}},{key:"onClientServerClockSync_",value:function(){var e=this;this.haveMaster_(),this.hasPendingRequest()||this.media_||this.media(this.master.playlists[0]),this.master&&this.master.minimumUpdatePeriod&&(this.minimumUpdatePeriodTimeout_=ee.setTimeout((function(){e.trigger("minimumUpdatePeriod")}),this.master.minimumUpdatePeriod))}},{key:"refreshXml_",value:function(){var e=this;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"DASH playlist request error at URL: "+e.srcUrl,responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.masterXml_=i.responseText,e.sidxMapping_=function(e,t,i,n){var r=kn(e,{manifestUri:t,clientOffset:i}),s=mh(r.playlists,n);return Gl(r,(function(e,t,i,r){if(e.playlists&&e.playlists.length){var a=e.playlists;s=dh(s,mh(a,n))}})),s}(e.masterXml_,e.srcUrl,e.clientOffset_,e.sidxMapping_);var n=e.parseMasterXml(),r=ph(e.master,n),s=e.media().sidx;if(r)if(s){var a=fh(s);if(!e.sidxMapping_[a]){var o=e.media();e.request=gh(o.sidx,o,e.hls_.xhr,{handleManifestRedirects:e.handleManifestRedirects},e.sidxRequestFinished_(o,n,e.state,(function(t,i){if(!t||!i)throw new Error("failed to request sidx on minimumUpdatePeriod");e.sidxMapping_[a].sidx=i,e.minimumUpdatePeriodTimeout_=ee.setTimeout((function(){e.trigger("minimumUpdatePeriod")}),e.master.minimumUpdatePeriod),e.refreshMedia_(e.media().id)})))}}else e.master=r;e.minimumUpdatePeriodTimeout_=ee.setTimeout((function(){e.trigger("minimumUpdatePeriod")}),e.master.minimumUpdatePeriod)}}))}},{key:"refreshMedia_",value:function(e){var t=this;if(!e)throw new Error("refreshMedia_ must take a media id");var i=void 0,n=void 0;this.masterPlaylistLoader_?(i=this.masterPlaylistLoader_.master,n=this.masterPlaylistLoader_.parseMasterXml()):(i=this.master,n=this.parseMasterXml());var r=ph(i,n);r?(this.masterPlaylistLoader_?this.masterPlaylistLoader_.master=r:this.master=r,this.media_=r.playlists[e]):(this.media_=n.playlists[e],this.trigger("playlistunchanged")),this.media().endList||(this.mediaUpdateTimeout=ee.setTimeout((function(){t.trigger("mediaupdatetimeout")}),Jl(this.media(),!!r))),this.trigger("loadedplaylist")}}]),t}(hh),yh=function(e){return Nl.log.debug?Nl.log.debug.bind(Nl,"VHS:",e+" >"):function(){}};function _h(){}var bh=function(){function e(t,i,n,r){jl(this,e),this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=t,this.processedAppend_=!1,this.type_=n,this.mimeType_=i,this.logger_=yh("SourceUpdater["+n+"]["+i+"]"),"closed"===t.readyState?t.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,i,r)):this.createSourceBuffer_(i,r)}return Fl(e,[{key:"createSourceBuffer_",value:function(e,t){var i=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(e),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 e=this;this.started_=!0,this.onUpdateendCallback_=function(){var t=e.pendingCallback_;e.pendingCallback_=null,e.sourceBuffer_.removing=!1,e.logger_("buffered ["+Dc(e.buffered())+"]"),t&&t(),e.runCallback_()},this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_),this.runCallback_()}},{key:"abort",value:function(e){var t=this;this.processedAppend_&&this.queueCallback_((function(){t.sourceBuffer_.abort()}),e)}},{key:"appendBuffer",value:function(e,t){var i=this;this.processedAppend_=!0,this.queueCallback_((function(){e.videoSegmentTimingInfoCallback&&i.sourceBuffer_.addEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback),i.sourceBuffer_.appendBuffer(e.bytes)}),(function(){e.videoSegmentTimingInfoCallback&&i.sourceBuffer_.removeEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback),t()}))}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:Nl.createTimeRanges()}},{key:"remove",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_h;this.processedAppend_&&this.queueCallback_((function(){i.logger_("remove ["+e+" => "+t+"]"),i.sourceBuffer_.removing=!0,i.sourceBuffer_.remove(e,t)}),n)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||!!this.pendingCallback_&&this.pendingCallback_!==_h}},{key:"timestampOffset",value:function(e){var t=this;return void 0!==e&&(this.queueCallback_((function(){t.sourceBuffer_.timestampOffset=e,t.runCallback_()})),this.timestampOffset_=e),this.timestampOffset_}},{key:"queueCallback_",value:function(e,t){this.callbacks_.push([e.bind(this),t]),this.runCallback_()}},{key:"runCallback_",value:function(){var e=void 0;!this.updating()&&this.callbacks_.length&&this.started_&&(e=this.callbacks_.shift(),this.pendingCallback_=e[1],e[0]())}},{key:"dispose",value:function(){var e=this,t=function t(){e.sourceBuffer_&&"open"===e.mediaSource.readyState&&e.sourceBuffer_.abort(),e.sourceBuffer_.removeEventListener("updateend",t)};this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_),this.sourceBuffer_.removing?this.sourceBuffer_.addEventListener("updateend",t):t()}}]),e}(),Th={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,BUFFER_LOW_WATER_LINE_RATE:1},Sh=2,kh=-101,Ch=-102,wh=function(e){e.forEach((function(e){e.abort()}))},Eh=function(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:kh,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Ch,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Sh,xhr:t}:null},xh=function(e,t,i){var n=0,r=!1;return function(s,a){if(!r)return s?(r=!0,wh(e),i(s,a)):(n+=1)===e.length?(a.endOfAllRequests=Date.now(),a.encryptedBytes?function(e,t,i){e.addEventListener("message",(function n(r){if(r.data.source===t.requestId){e.removeEventListener("message",n);var s=r.data.decrypted;return t.bytes=new Uint8Array(s.bytes,s.byteOffset,s.byteLength),i(null,t)}}));var n=void 0;n=t.key.bytes.slice?t.key.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.key.bytes)),e.postMessage(kc({source:t.requestId,encrypted:t.encryptedBytes,key:n,iv:t.key.iv}),[t.encryptedBytes.buffer,n.buffer])}(t,a,i):i(null,a)):void 0}},Ah=function(e,t){return function(i){var n,r,s;return e.stats=Nl.mergeOptions(e.stats,(r=(n=i).target,(s={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-r.requestTime||0}).bytesReceived=n.loaded,s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3),s)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)}},Ih=function(e,t,i,n,r,s,a){var o=[],u=xh(o,i,a);if(r.key&&!r.key.bytes){var l=e(Nl.mergeOptions(t,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),function(e,t){return function(i,n){var r=n.response,s=Eh(i,n);if(s)return t(s,e);if(16!==r.byteLength)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:Sh,xhr:n},e);var a=new DataView(r);return e.key.bytes=new Uint32Array([a.getUint32(0),a.getUint32(4),a.getUint32(8),a.getUint32(12)]),t(null,e)}}(r,u));o.push(l)}if(r.map&&!r.map.bytes){var c=e(Nl.mergeOptions(t,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:_c(r.map)}),function(e,t,i){return function(n,r){var s=r.response,a=Eh(n,r);return a?i(a,e):0===s.byteLength?i({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:Sh,xhr:r},e):(e.map.bytes=new Uint8Array(r.response),t&&!t.isInitialized()&&t.init(),e.map.timescales=Mn.timescale(e.map.bytes),e.map.videoTrackIds=Mn.videoTrackIds(e.map.bytes),i(null,e))}}(r,n,u));o.push(c)}var h=e(Nl.mergeOptions(t,{uri:r.resolvedUri,responseType:"arraybuffer",headers:_c(r)}),function(e,t,i){return function(n,r){var s=r.response,a=Eh(n,r),o=void 0;return a?i(a,e):0===s.byteLength?i({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:Sh,xhr:r},e):(e.stats=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}}(r),e.key?e.encryptedBytes=new Uint8Array(r.response):e.bytes=new Uint8Array(r.response),t&&e.map&&e.map.bytes&&(t.isInitialized()||t.init(),(o=t.parse(e.bytes,e.map.videoTrackIds,e.map.timescales))&&o.captions&&(e.captionStreams=o.captionStreams,e.fmp4Captions=o.captions)),i(null,e))}}(r,n,u));return h.addEventListener("progress",Ah(r,s)),o.push(h),function(){return wh(o)}},Ph=function(e,t){var i;return e&&(i=ee.getComputedStyle(e))?i[t]:""},Lh=function(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))},Oh=function(e,t){var i=void 0,n=void 0;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||ee.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),i-(n=n||ee.Number.MAX_VALUE)},Dh=function(e,t,i){if(!e||!t)return!1;var n=i===e.segments.length;return e.endList&&"open"===t.readyState&&n},Nh=function(e){return"number"==typeof e&&isFinite(e)},Rh=function(e){function t(e){jl(this,t);var i=Hl(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");return i.bandwidth=e.bandwidth,i.throughput={rate:0,count:0},i.roundTrip=NaN,i.resetStats_(),i.mediaIndex=null,i.hasPlayed_=e.hasPlayed,i.currentTime_=e.currentTime,i.seekable_=e.seekable,i.seeking_=e.seeking,i.duration_=e.duration,i.mediaSource_=e.mediaSource,i.hls_=e.hls,i.loaderType_=e.loaderType,i.startingMedia_=void 0,i.segmentMetadataTrack_=e.segmentMetadataTrack,i.goalBufferLength_=e.goalBufferLength,i.sourceType_=e.sourceType,i.inbandTextTracks_=e.inbandTextTracks,i.state_="INIT",i.checkBufferTimeout_=null,i.error_=void 0,i.currentTimeline_=-1,i.pendingSegment_=null,i.mimeType_=null,i.sourceUpdater_=null,i.xhrOptions_=null,i.activeInitSegmentId_=null,i.initSegments_={},i.cacheEncryptionKeys_=e.cacheEncryptionKeys,i.keyCache_={},"main"===i.loaderType_?i.captionParser_=new tr:i.captionParser_=null,i.decrypter_=e.decrypter,i.syncController_=e.syncController,i.syncPoint_={segmentIndex:0,time:0},i.triggerSyncInfoUpdate_=function(){return i.trigger("syncinfoupdate")},i.syncController_.on("syncinfoupdate",i.triggerSyncInfoUpdate_),i.mediaSource_.addEventListener("sourceopen",(function(){return i.ended_=!1})),i.fetchAtBuffer_=!1,i.logger_=yh("SegmentLoader["+i.loaderType_+"]"),Object.defineProperty(i,"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e)}}),i}return Vl(t,e),Fl(t,[{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.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_(),this.captionParser_&&this.captionParser_.reset(),this.checkBufferTimeout_&&ee.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}},{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(e){return void 0!==e&&(this.error_=e),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():Nl.createTimeRanges()}},{key:"initSegment",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Cc(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,timescales:e.timescales,videoTrackIds:e.videoTrackIds}),n||e}},{key:"segmentKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=wc(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r}},{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 bh(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0});var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(i&&i.uri===e.uri){var s=e.mediaSequence-i.mediaSequence;this.logger_("live window shift ["+s+"]"),null!==this.mediaIndex&&(this.mediaIndex-=s),n&&(n.mediaIndex-=s,n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(i,e)}else null!==this.mediaIndex&&this.resyncLoader()}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(ee.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(e,t){this.mimeType_||(this.mimeType_=e,this.sourceBufferEmitter_=t,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(e){this.ended_=!1,this.resetLoader(),this.remove(0,1/0,e),this.captionParser_&&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(e,t,i){if(t===1/0&&(t=this.duration_()),this.sourceUpdater_&&this.sourceUpdater_.remove(e,t,i),Rc(e,t,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var n in this.inbandTextTracks_)Rc(e,t,this.inbandTextTracks_[n])}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&ee.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=ee.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&ee.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=ee.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 e=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);e&&(this.isEndOfStream_(e.mediaIndex)?this.endOfStream():(e.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())&&(e.timeline!==this.currentTimeline_&&(this.syncController_.reset(),e.timestampOffset=e.startOfSegment,this.captionParser_&&this.captionParser_.clearAllCaptions()),this.loadSegment_(e)))}}},{key:"isEndOfStream_",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.playlist_;return Dh(t,this.mediaSource_,e)&&!this.sourceUpdater_.updating()}},{key:"checkBuffer_",value:function(e,t,i,n,r,s){var a=0,o=void 0;e.length&&(a=e.end(e.length-1));var u=Math.max(0,a-r);if(!t.segments.length)return null;if(u>=this.goalBufferLength_())return null;if(!n&&u>=1)return null;if(null===s)return i=this.getSyncSegmentCandidate_(t),this.generateSegmentInfo_(t,i,null,!0);if(null!==i){t.segments[i];return o=a,this.generateSegmentInfo_(t,i+1,o,!1)}if(this.fetchAtBuffer_){var l=mc.getMediaInfoForTime(t,a,s.segmentIndex,s.time);i=l.mediaIndex,o=l.startTime}else{var c=mc.getMediaInfoForTime(t,r,s.segmentIndex,s.time);i=c.mediaIndex,o=c.startTime}return this.generateSegmentInfo_(t,i,o,!1)}},{key:"getSyncSegmentCandidate_",value:function(e){var t=this;if(-1===this.currentTimeline_)return 0;var i=e.segments.map((function(e,t){return{timeline:e.timeline,segmentIndex:t}})).filter((function(e){return e.timeline===t.currentTimeline_}));return i.length?i[Math.min(i.length-1,1)].segmentIndex:Math.max(e.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(e,t,i,n){if(t<0||t>=e.segments.length)return null;var r=e.segments[t];return{requestId:"segment-loader-"+Math.random(),uri:r.resolvedUri,mediaIndex:t,isSyncRequest:n,startOfSegment:i,playlist:e,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:r.timeline,duration:r.duration,segment:r}}},{key:"abortRequestEarly_",value:function(e){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return!1;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return!1;var t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=mc.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),s=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=e.length?e.end(e.length-1):0;return(n-t)/i}(this.buffered_(),t,this.hls_.tech_.playbackRate())-1;if(r<=s)return!1;var a=function(e){var t=e.master,i=e.currentTime,n=e.bandwidth,r=e.duration,s=e.segmentDuration,a=e.timeUntilRebuffer,o=e.currentTimeline,u=e.syncController,l=t.playlists.filter((function(e){return!mc.isIncompatible(e)})),c=l.filter(mc.isEnabled);c.length||(c=l.filter((function(e){return!mc.isDisabled(e)})));var h=c.filter(mc.hasAttribute.bind(null,"BANDWIDTH")).map((function(e){var t=u.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:mc.estimateSegmentRequestTime(s,n,e)*t-a}})),d=h.filter((function(e){return e.rebufferingImpact<=0}));return Lh(d,(function(e,t){return Oh(t.playlist,e.playlist)})),d.length?d[0]:(Lh(h,(function(e,t){return e.rebufferingImpact-t.rebufferingImpact})),h[0]||null)}({master:this.hls_.playlists.master,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:s,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(a){var o=r-s-a.rebufferingImpact,u=.5;return s<=1/30&&(u=1),!a.playlist||a.playlist.uri===this.playlist_.uri||o<u?!1:(this.bandwidth=a.playlist.attributes.BANDWIDTH*Th.BANDWIDTH_VARIANCE+1,this.abort(),this.trigger("earlyabort"),!0)}}},{key:"handleProgress_",value:function(e,t){this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId&&!this.abortRequestEarly_(t.stats)&&this.trigger("progress")}},{key:"loadSegment_",value:function(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),e.abortRequests=Ih(this.hls_.xhr,this.xhrOptions_,this.decrypter_,this.captionParser_,this.createSimplifiedSegmentObj_(e),this.handleProgress_.bind(this),this.segmentRequestFinished_.bind(this))}},{key:"trimBackBuffer_",value:function(e){var t=function(e,t,i){var n=t-30;e.length&&(n=Math.max(n,e.start(0)));var r=t-i;return Math.min(r,n)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}},{key:"createSimplifiedSegmentObj_",value:function(e){var t=e.segment,i={resolvedUri:t.resolvedUri,byterange:t.byterange,requestId:e.requestId};if(t.key){var n=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);i.key=this.segmentKey(t.key),i.key.iv=n}return t.map&&(i.map=this.initSegment(t.map)),i}},{key:"segmentRequestFinished_",value:function(e,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(e)return this.pendingSegment_=null,this.state="READY",e.code===Ch?void(this.mediaRequestsAborted+=1):(this.pause(),e.code===kh?(this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,void this.trigger("bandwidthupdate")):(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error")));this.bandwidth=t.stats.bandwidth,this.roundTrip=t.stats.roundTripTime,t.map&&(t.map=this.initSegment(t.map,!0)),t.key&&this.segmentKey(t.key,!0),this.processSegmentResponse_(t)}}else this.mediaRequestsAborted+=1}},{key:"processSegmentResponse_",value:function(e){var t=this.pendingSegment_;t.bytes=e.bytes,e.map&&(t.segment.map.bytes=e.map.bytes),t.endOfAllRequests=e.endOfAllRequests,e.fmp4Captions&&(!function(e,t,i){for(var n in i)if(!e[n]){t.trigger({type:"usage",name:"hls-608"});var r=t.textTracks().getTrackById(n);e[n]=r||t.addRemoteTextTrack({kind:"captions",id:n,label:n},!1).track}}(this.inbandTextTracks_,this.hls_.tech_,e.captionStreams),function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var r=window.WebKitDataCue||window.VTTCue;i.forEach((function(e){var i=e.stream,s=e.startTime,a=e.endTime;t[i]&&(s+=n,a+=n,t[i].addCue(new r(s,a,e.text)))}))}}({inbandTextTracks:this.inbandTextTracks_,captionArray:e.fmp4Captions,timestampOffset:0}),this.captionParser_&&this.captionParser_.clearParsedCaptions()),this.handleSegment_()}},{key:"handleSegment_",value:function(){var e=this;if(this.pendingSegment_){var t=this.pendingSegment_,i=t.segment,n=this.syncController_.probeSegmentInfo(t);void 0===this.startingMedia_&&n&&(n.containsAudio||n.containsVideo)&&(this.startingMedia_={containsAudio:n.containsAudio,containsVideo:n.containsVideo});var r,s,a,o=(r=this.loaderType_,s=this.startingMedia_,a=n,"main"===r&&s&&a?a.containsAudio||a.containsVideo?s.containsVideo&&!a.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.":!s.containsVideo&&a.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);if(o)return this.error({message:o,blacklistDuration:1/0}),void this.trigger("error");if(t.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");if(null!==t.timestampOffset&&t.timestampOffset!==this.sourceUpdater_.timestampOffset()){if(n&&n.segmentTimestampInfo){var u=n.segmentTimestampInfo[0].ptsTime,l=n.segmentTimestampInfo[0].dtsTime;t.timestampOffset-=u-l}this.sourceUpdater_.timestampOffset(t.timestampOffset),this.trigger("timestampoffset")}var c=this.syncController_.mappingForTimeline(t.timeline);if(null!==c&&this.trigger({type:"segmenttimemapping",mapping:c}),this.state="APPENDING",i.map){var h=Cc(i.map);if(!this.activeInitSegmentId_||this.activeInitSegmentId_!==h){var d=this.initSegment(i.map);this.sourceUpdater_.appendBuffer({bytes:d.bytes},(function(){e.activeInitSegmentId_=h}))}}t.byteLength=t.bytes.byteLength,"number"==typeof i.start&&"number"==typeof i.end?this.mediaSecondsLoaded+=i.end-i.start:this.mediaSecondsLoaded+=i.duration,this.logger_(function(e){var t=e.segment,i=t.start,n=t.end,r=e.playlist,s=r.mediaSequence,a=r.id,o=r.segments,u=void 0===o?[]:o,l=e.mediaIndex,c=e.timeline;return["appending ["+l+"] of ["+s+", "+(s+u.length)+"] from playlist ["+a+"]","["+i+" => "+n+"] in timeline ["+c+"]"].join(" ")}(t)),this.sourceUpdater_.appendBuffer({bytes:t.bytes,videoSegmentTimingInfoCallback:this.handleVideoSegmentTimingInfo_.bind(this,t.requestId)},this.handleUpdateEnd_.bind(this))}else this.state="READY"}},{key:"handleVideoSegmentTimingInfo_",value:function(e,t){if(this.pendingSegment_&&e===this.pendingSegment_.requestId){var i=this.pendingSegment_.segment;i.videoTimingInfo||(i.videoTimingInfo={}),i.videoTimingInfo.transmuxerPrependedSeconds=t.videoSegmentTimingInfo.prependedContentDuration||0,i.videoTimingInfo.transmuxedPresentationStart=t.videoSegmentTimingInfo.start.presentation,i.videoTimingInfo.transmuxedPresentationEnd=t.videoSegmentTimingInfo.end.presentation,i.videoTimingInfo.baseMediaDecodeTime=t.videoSegmentTimingInfo.baseMediaDecodeTime}}},{key:"handleUpdateEnd_",value:function(){if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_,t=e.segment,i=null!==this.mediaIndex;this.pendingSegment_=null,this.recordThroughput_(e),this.addSegmentMetadataCue_(e),this.state="READY",this.mediaIndex=e.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration?this.resetEverything():(i&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.isEndOfStream_(e.mediaIndex+1,e.playlist)&&this.endOfStream(),this.paused()||this.monitorBuffer_())}},{key:"recordThroughput_",value:function(e){var t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(e){if(this.segmentMetadataTrack_){var t=e.segment,i=t.start,n=t.end;if(Nh(i)&&Nh(n)){Rc(i,n,this.segmentMetadataTrack_);var r=ee.WebKitDataCue||ee.VTTCue,s={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:n},a=new r(i,n,JSON.stringify(s));a.value=s,this.segmentMetadataTrack_.addCue(a)}}}}]),t}(Nl.EventTarget),Uh=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},Mh=new Uint8Array("\n\n".split("").map((function(e){return e.charCodeAt(0)}))),Bh=function(e){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};jl(this,t);var n=Hl(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,i));return n.mediaSource_=null,n.subtitlesTrack_=null,n.featuresNativeTextTracks_=e.featuresNativeTextTracks,n}return Vl(t,e),Fl(t,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return Nl.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return Nl.createTimeRanges([[t,i]])}},{key:"initSegment",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Cc(e),n=this.initSegments_[i];if(t&&!n&&e.bytes){var r=Mh.byteLength+e.bytes.byteLength,s=new Uint8Array(r);s.set(e.bytes),s.set(Mh,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:s}}return n||e}},{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(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}},{key:"remove",value:function(e,t){Rc(e,t,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var e=this;this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var t=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(t=this.skipEmptySegments_(t)){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline)){return this.syncController_.one("timestampoffset",(function(){e.state="READY",e.paused()||e.monitorBuffer_()})),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(t)}}},{key:"skipEmptySegments_",value:function(e){for(;e&&e.segment.empty;)e=this.generateSegmentInfo_(e.playlist,e.mediaIndex+1,e.startOfSegment+e.duration,e.isSyncRequest);return e}},{key:"handleSegment_",value:function(){var e=this;if(this.pendingSegment_&&this.subtitlesTrack_){this.state="APPENDING";var t=this.pendingSegment_,i=t.segment;if("function"!=typeof ee.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var n=void 0,r=function(){e.subtitlesTrack_.tech_.off("vttjsloaded",n),e.error({message:"Error loading vtt.js"}),e.state="READY",e.pause(),e.trigger("error")};return n=function(){e.subtitlesTrack_.tech_.off("vttjserror",r),e.handleSegment_()},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",n),void this.subtitlesTrack_.tech_.one("vttjserror",r)}i.requested=!0;try{this.parseVTTCues_(t)}catch(e){return this.error({message:e.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(t,this.syncController_.timelines[t.timeline],this.playlist_),t.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");t.byteLength=t.bytes.byteLength,this.mediaSecondsLoaded+=i.duration,t.cues.length&&this.remove(t.cues[0].endTime,t.cues[t.cues.length-1].endTime),t.cues.forEach((function(t){e.subtitlesTrack_.addCue(e.featuresNativeTextTracks_?new ee.VTTCue(t.startTime,t.endTime,t.text):t)})),this.handleUpdateEnd_()}else this.state="READY"}},{key:"parseVTTCues_",value:function(e){var t=void 0,i=!1;"function"==typeof ee.TextDecoder?t=new ee.TextDecoder("utf8"):(t=ee.WebVTT.StringDecoder(),i=!0);var n=new ee.WebVTT.Parser(ee,ee.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){return e.timestampmap=t},n.onparsingerror=function(e){Nl.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;i&&(r=Uh(r)),n.parse(r)}var s=e.bytes;i&&(s=Uh(s)),n.parse(s),n.flush()}},{key:"updateTimeMapping_",value:function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,s=r.MPEGTS/9e4-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=s,e.endTime+=s})),!i.syncInfo){var a=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(a,o-n.duration)}}}else n.empty=!0}}]),t}(Rh),jh=function(e,t){for(var i=e.cues,n=0;n<i.length;n++){var r=i[n];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null},Fh=Er,Vh=[{name:"VOD",run:function(e,t,i,n,r){if(i!==1/0){return{time:0,segmentIndex:0}}return null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!e.datetimeToDisplayTime)return null;var s=t.segments||[],a=null,o=null;r=r||0;for(var u=0;u<s.length;u++){var l=s[u];if(l.dateTimeObject){var c=l.dateTimeObject.getTime()/1e3+e.datetimeToDisplayTime,h=Math.abs(r-c);if(null!==o&&(0===h||o<h))break;o=h,a={time:c,segmentIndex:u}}}return a}},{name:"Segment",run:function(e,t,i,n,r){var s=t.segments||[],a=null,o=null;r=r||0;for(var u=0;u<s.length;u++){var l=s[u];if(l.timeline===n&&void 0!==l.start){var c=Math.abs(r-l.start);if(null!==o&&o<c)break;(!a||null===o||o>=c)&&(o=c,a={time:l.start,segmentIndex:u})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var s=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var a=null,o=0;o<t.discontinuityStarts.length;o++){var u=t.discontinuityStarts[o],l=t.discontinuitySequence+o+1,c=e.discontinuities[l];if(c){var h=Math.abs(r-c.time);if(null!==a&&a<h)break;(!s||null===a||a>=h)&&(a=h,s={time:c.time,segmentIndex:u})}}return s}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence}:null}}],Hh=function(e){function t(){jl(this,t);var e=Hl(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.inspectCache_=void 0,e.timelines=[],e.discontinuities=[],e.datetimeToDisplayTime=null,e.logger_=yh("SyncController"),e}return Vl(t,e),Fl(t,[{key:"getSyncPoint",value:function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+nc(e,n.segmentIndex,0))}},{key:"runStrategies_",value:function(e,t,i,n){for(var r=[],s=0;s<Vh.length;s++){var a=Vh[s],o=a.run(this,e,t,i,n);o&&(o.strategy=a.name,r.push({strategy:a.name,syncPoint:o}))}return r}},{key:"selectSyncPoint_",value:function(e,t){for(var i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,s=1;s<e.length;s++){var a=Math.abs(e[s].syncPoint[t.key]-t.value);a<n&&(n=a,i=e[s].syncPoint,r=e[s].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+r+"]: [time:"+i.time+", segmentIndex:"+i.segmentIndex+"]"),i}},{key:"saveExpiredSegmentInfo",value:function(e,t){for(var i=t.mediaSequence-e.mediaSequence-1;i>=0;i--){var n=e.segments[i];if(n&&void 0!==n.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:n.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMapping",value:function(e){if(!this.datetimeToDisplayTime&&e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0].dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-t}}},{key:"reset",value:function(){this.inspectCache_=void 0}},{key:"probeSegmentInfo",value:function(e){var t=e.segment,i=e.playlist,n=void 0;return(n=t.map?this.probeMp4Segment_(e):this.probeTsSegment_(e))&&this.calculateSegmentTimeMapping_(e,n)&&(this.saveDiscontinuitySyncInfo_(e),i.syncInfo||(i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:t.start})),n}},{key:"probeMp4Segment_",value:function(e){var t=e.segment,i=Mn.timescale(t.map.bytes),n=Mn.compositionStartTime(i,e.bytes);return null!==e.timestampOffset&&(e.timestampOffset-=n),{start:n,end:n+t.duration}}},{key:"probeTsSegment_",value:function(e){var t=Fh(e.bytes,this.inspectCache_),i=void 0,n=void 0,r=void 0;return t?(t.video&&2===t.video.length?(this.inspectCache_=t.video[1].dts,i=t.video[0].dtsTime,n=t.video[1].dtsTime,r=t.video):t.audio&&2===t.audio.length&&(this.inspectCache_=t.audio[1].dts,i=t.audio[0].dtsTime,n=t.audio[1].dtsTime,r=t.audio),{segmentTimestampInfo:r,start:i,end:n,containsVideo:t.video&&2===t.video.length,containsAudio:t.audio&&2===t.audio.length}):null}},{key:"timestampOffsetForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].time}},{key:"mappingForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}},{key:"calculateSegmentTimeMapping_",value:function(e,t){var i=e.segment,n=this.timelines[e.timeline];if(null!==e.timestampOffset)n={time:e.startOfSegment,mapping:e.startOfSegment-t.start},this.timelines[e.timeline]=n,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+n.time+"] [mapping: "+n.mapping+"]"),i.start=e.startOfSegment,i.end=t.end+n.mapping;else{if(!n)return!1;i.start=t.start+n.mapping,i.end=t.end+n.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var n=0;n<t.discontinuityStarts.length;n++){var r=t.discontinuityStarts[n],s=t.discontinuitySequence+n+1,a=r-e.mediaIndex,o=Math.abs(a);if(!this.discontinuities[s]||this.discontinuities[s].accuracy>o){var u=void 0;u=a<0?i.start-nc(t,e.mediaIndex,r):i.end+nc(t,e.mediaIndex+1,r),this.discontinuities[s]={time:u,accuracy:o}}}}},{key:"dispose",value:function(){this.trigger("dispose"),this.off()}}]),t}(Nl.EventTarget),qh=new qc("./decrypter-worker.worker.js",(function(e,t){var i=this;!function(){var e=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),n=null,r=function(){function t(i){e(this,t),n||(n=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],n=t[4],r=i[4],s=void 0,a=void 0,o=void 0,u=[],l=[],c=void 0,h=void 0,d=void 0,p=void 0,f=void 0;for(s=0;s<256;s++)l[(u[s]=s<<1^283*(s>>7))^s]=s;for(a=o=0;!n[a];a^=c||1,o=l[o]||1)for(d=(d=o^o<<1^o<<2^o<<3^o<<4)>>8^255&d^99,n[a]=d,r[d]=a,f=16843009*u[h=u[c=u[a]]]^65537*h^257*c^16843008*a,p=257*u[d]^16843008*d,s=0;s<4;s++)t[s][a]=p=p<<24^p>>>8,i[s][d]=f=f<<24^f>>>8;for(s=0;s<5;s++)t[s]=t[s].slice(0),i[s]=i[s].slice(0);return 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 r=void 0,s=void 0,a=void 0,o=void 0,u=void 0,l=this._tables[0][4],c=this._tables[1],h=i.length,d=1;if(4!==h&&6!==h&&8!==h)throw new Error("Invalid aes key size");for(o=i.slice(0),u=[],this._key=[o,u],r=h;r<4*h+28;r++)a=o[r-1],(r%h==0||8===h&&r%h==4)&&(a=l[a>>>24]<<24^l[a>>16&255]<<16^l[a>>8&255]<<8^l[255&a],r%h==0&&(a=a<<8^a>>>24^d<<24,d=d<<1^283*(d>>7))),o[r]=o[r-h]^a;for(s=0;r;s++,r--)a=o[3&s?r:r-4],u[s]=r<=4||s<4?a:c[0][l[a>>>24]]^c[1][l[a>>16&255]]^c[2][l[a>>8&255]]^c[3][l[255&a]]}return t.prototype.decrypt=function(e,t,i,n,r,s){var a=this._key[1],o=e^a[0],u=n^a[1],l=i^a[2],c=t^a[3],h=void 0,d=void 0,p=void 0,f=a.length/4-2,m=void 0,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],S=v[4];for(m=0;m<f;m++)h=y[o>>>24]^_[u>>16&255]^b[l>>8&255]^T[255&c]^a[g],d=y[u>>>24]^_[l>>16&255]^b[c>>8&255]^T[255&o]^a[g+1],p=y[l>>>24]^_[c>>16&255]^b[o>>8&255]^T[255&u]^a[g+2],c=y[c>>>24]^_[o>>16&255]^b[u>>8&255]^T[255&l]^a[g+3],g+=4,o=h,u=d,l=p;for(m=0;m<4;m++)r[(3&-m)+s]=S[o>>>24]<<24^S[u>>16&255]<<16^S[l>>8&255]<<8^S[255&c]^a[g++],h=o,o=u,u=l,l=c,c=h},t}(),s=function(){function t(){e(this,t),this.listeners={}}return t.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.prototype.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},t.prototype.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),s=t.length,a=0;a<s;++a)t[a].apply(this,r)},t.prototype.dispose=function(){this.listeners={}},t.prototype.pipe=function(e){this.on("data",(function(t){e.push(t)}))},t}(),a=function(t){function i(){e(this,i);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,t.call(this,s));return n.jobs=[],n.delay=1,n.timeout_=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(i,t),i.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},i}(s),o=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},u=function(){function i(t,n,r,s){e(this,i);var u=i.STEP,l=new Int32Array(t.buffer),c=new Uint8Array(t.byteLength),h=0;for(this.asyncStream_=new a,this.asyncStream_.push(this.decryptChunk_(l.subarray(h,h+u),n,r,c)),h=u;h<l.length;h+=u)r=new Uint32Array([o(l[h-4]),o(l[h-3]),o(l[h-2]),o(l[h-1])]),this.asyncStream_.push(this.decryptChunk_(l.subarray(h,h+u),n,r,c));this.asyncStream_.push((function(){var e;s(null,(e=c).subarray(0,e.byteLength-e[e.byteLength-1]))}))}return i.prototype.decryptChunk_=function(e,t,i,n){return function(){var s=function(e,t,i){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),s=new r(Array.prototype.slice.call(t)),a=new Uint8Array(e.byteLength),u=new Int32Array(a.buffer),l=void 0,c=void 0,h=void 0,d=void 0,p=void 0,f=void 0,m=void 0,g=void 0,v=void 0;for(l=i[0],c=i[1],h=i[2],d=i[3],v=0;v<n.length;v+=4)p=o(n[v]),f=o(n[v+1]),m=o(n[v+2]),g=o(n[v+3]),s.decrypt(p,f,m,g,u,v),u[v]=o(u[v]^l),u[v+1]=o(u[v+1]^c),u[v+2]=o(u[v+2]^h),u[v+3]=o(u[v+3]^d),l=p,c=f,h=m,d=g;return a}(e,t,i);n.set(s,e.byteOffset)}},t(i,null,[{key:"STEP",get:function(){return 32e3}}]),i}();new function(e){e.onmessage=function(t){var i=t.data,n=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),r=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new u(n,r,s,(function(t,n){var r,s;e.postMessage((r={source:i.source,decrypted:n},s={},Object.keys(r).forEach((function(e){var t=r[e];ArrayBuffer.isView(t)?s[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:s[e]=t})),s),[n.buffer])}))}}(i)}()})),Wh=function(e){var t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},zh=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},$h=function(e,t){t.activePlaylistLoader=e,e.load()},Gh={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;zh(i,n);var s=n.activeTrack(),a=n.activeGroup(),o=(a.filter((function(e){return e.default}))[0]||a[0]).id,u=n.tracks[o];if(s!==u){for(var l in Nl.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[l].enabled=n.tracks[l]===u;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];Nl.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),zh(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},Xh={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,s=i.segmentLoaders[e];t.on("loadedmetadata",(function(){var e=t.media();s.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&s.load()})),t.on("loadedplaylist",(function(){s.playlist(t.media(),r),n.paused()||s.load()})),t.on("error",Gh[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,s=i.segmentLoaders[e],a=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();s.playlist(e,r),s.track(a.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&s.load()})),t.on("loadedplaylist",(function(){s.playlist(t.media(),r),n.paused()||s.load()})),t.on("error",Gh[e](e,i))}},Kh={AUDIO:function(e,t){var i=t.hls,n=t.sourceType,r=t.segmentLoaders[e],s=t.requestOptions,a=t.master.mediaGroups,o=t.mediaTypes[e],u=o.groups,l=o.tracks,c=t.masterPlaylistLoader;for(var h in a[e]&&0!==Object.keys(a[e]).length||(a[e]={main:{default:{default:!0}}}),a[e])for(var d in u[h]||(u[h]=[]),a[e][h]){var p=a[e][h][d],f=void 0;if(f=p.resolvedUri?new Zl(p.resolvedUri,i,s):p.playlists&&"dash"===n?new vh(p.playlists[0],i,s,c):null,p=Nl.mergeOptions({id:d,playlistLoader:f},p),Xh[e](e,p.playlistLoader,t),u[h].push(p),void 0===l[d]){var m=new Nl.AudioTrack({id:d,kind:Wh(p),enabled:!1,language:p.language,default:p.default,label:d});l[d]=m}}r.on("error",Gh[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.hls,r=t.sourceType,s=t.segmentLoaders[e],a=t.requestOptions,o=t.master.mediaGroups,u=t.mediaTypes[e],l=u.groups,c=u.tracks,h=t.masterPlaylistLoader;for(var d in o[e])for(var p in l[d]||(l[d]=[]),o[e][d])if(!o[e][d][p].forced){var f=o[e][d][p],m=void 0;if("hls"===r?m=new Zl(f.resolvedUri,n,a):"dash"===r&&(m=new vh(f.playlists[0],n,a,h)),f=Nl.mergeOptions({id:p,playlistLoader:m},f),Xh[e](e,f.playlistLoader,t),l[d].push(f),void 0===c[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;c[p]=g}}s.on("error",Gh[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],s=r.groups,a=r.tracks;for(var o in n[e])for(var u in s[o]||(s[o]=[]),n[e][o]){var l=n[e][o][u];if(l.instreamId.match(/CC\d/)&&(s[o].push(Nl.mergeOptions({id:u},l)),void 0===a[u])){var c=i.addRemoteTextTrack({id:l.instreamId,kind:"captions",default:l.default&&l.autoselect,language:l.language,label:u},!1).track;a[u]=c}}}},Yh={AUDIO:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if(i[n].enabled)return i[n];return null}},SUBTITLES:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if("showing"===i[n].mode||"hidden"===i[n].mode)return i[n];return null}}},Qh=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){Kh[t](t,e)}));var t=e.mediaTypes,i=e.masterPlaylistLoader,n=e.tech,r=e.hls;["AUDIO","SUBTITLES"].forEach((function(i){t[i].activeGroup=function(e,t){return function(i){var n=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,s=n.media();if(!s)return null;var a=null;return s.attributes[e]&&(a=r[s.attributes[e]]),a=a||r.main,void 0===i?a:null===i?null:a.filter((function(e){return e.id===i.id}))[0]||null}}(i,e),t[i].activeTrack=Yh[i](i,e),t[i].onGroupChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,s=t.mediaTypes[e],a=s.activeTrack(),o=s.activeGroup(a),u=s.activePlaylistLoader;zh(n,s),o&&(o.playlistLoader?(n.resyncLoader(),$h(o.playlistLoader,s)):u&&r.resetEverything())}}(i,e),t[i].onTrackChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,s=t.mediaTypes[e],a=s.activeTrack(),o=s.activeGroup(a),u=s.activePlaylistLoader;zh(n,s),o&&(o.playlistLoader?u!==o.playlistLoader?(n.track&&n.track(a),n.resetEverything(),$h(o.playlistLoader,s)):$h(o.playlistLoader,s):r.resetEverything())}}(i,e)}));var s=t.AUDIO.activeGroup(),a=(s.filter((function(e){return e.default}))[0]||s[0]).id;t.AUDIO.tracks[a].enabled=!0,t.AUDIO.onTrackChanged(),i.on("mediachange",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanged()}))}));var o=function(){t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"hls-audio-change"})};for(var u in n.audioTracks().addEventListener("change",o),n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(function(){n.audioTracks().removeEventListener("change",o),n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),n.clearTracks("audio"),t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[u])},Jh=void 0,Zh=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],ed=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},td=function(e){function t(e){jl(this,t);var i,n=Hl(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),r=e.url,s=e.handleManifestRedirects,a=e.withCredentials,o=e.tech,u=e.bandwidth,l=e.externHls,c=e.useCueTags,h=e.blacklistDuration,d=e.enableLowInitialPlaylist,p=e.cacheEncryptionKeys,f=e.sourceType;if(!r)throw new Error("A non-empty playlist URL is required");Jh=l,n.withCredentials=a,n.tech_=o,n.hls_=o.hls,n.sourceType_=f,n.useCueTags_=c,n.blacklistDuration=h,n.enableLowInitialPlaylist=d,n.useCueTags_&&(n.cueTagsTrack_=n.tech_.addTextTrack("metadata","ad-cues"),n.cueTagsTrack_.inBandMetadataTrackDispatchType=""),n.requestOptions_={withCredentials:a,handleManifestRedirects:s,timeout:null},n.mediaTypes_=(i={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(e){i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:_h,activeTrack:_h,onGroupChanged:_h,onTrackChanged:_h}})),i),n.mediaSource=new Nl.MediaSource,n.mediaSource.addEventListener("sourceopen",n.handleSourceOpen_.bind(n)),n.seekable_=Nl.createTimeRanges(),n.hasPlayed_=!1,n.syncController_=new Hh(e),n.segmentMetadataTrack_=o.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,n.decrypter_=new qh,n.inbandTextTracks_={};var m={hls:n.hls_,mediaSource:n.mediaSource,currentTime:n.tech_.currentTime.bind(n.tech_),seekable:function(){return n.seekable()},seeking:function(){return n.tech_.seeking()},duration:function(){return n.mediaSource.duration},hasPlayed:function(){return n.hasPlayed_},goalBufferLength:function(){return n.goalBufferLength()},bandwidth:u,syncController:n.syncController_,decrypter:n.decrypter_,sourceType:n.sourceType_,inbandTextTracks:n.inbandTextTracks_,cacheEncryptionKeys:p};return n.masterPlaylistLoader_="dash"===n.sourceType_?new vh(r,n.hls_,n.requestOptions_):new Zl(r,n.hls_,n.requestOptions_),n.setupMasterPlaylistLoaderListeners_(),n.mainSegmentLoader_=new Rh(Nl.mergeOptions(m,{segmentMetadataTrack:n.segmentMetadataTrack_,loaderType:"main"}),e),n.audioSegmentLoader_=new Rh(Nl.mergeOptions(m,{loaderType:"audio"}),e),n.subtitleSegmentLoader_=new Bh(Nl.mergeOptions(m,{loaderType:"vtt",featuresNativeTextTracks:n.tech_.featuresNativeTextTracks}),e),n.setupSegmentLoaderListeners_(),Zh.forEach((function(e){n[e+"_"]=ed.bind(n,e)})),n.logger_=yh("MPC"),n.masterPlaylistLoader_.load(),n}return Vl(t,e),Fl(t,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;fc(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),Qh({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,masterPlaylistLoader:e.masterPlaylistLoader_,hls:e.hls_,master:e.master(),mediaTypes:e.mediaTypes_,blacklistCurrentPlaylist:e.blacklistCurrentPlaylist.bind(e)}),e.triggerPresenceUsage_(e.master(),t);try{e.setupSourceBuffers_()}catch(t){return Nl.log.warn("Failed to create SourceBuffers",t),e.mediaSource.endOfStream("decode")}e.setupFirstPlay(),!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(function(){e.trigger("selectedinitialmedia")}))})),this.masterPlaylistLoader_.on("loadedplaylist",(function(){var t=e.masterPlaylistLoader_.media();if(!t){e.excludeUnsupportedVariants_();var i=void 0;return e.enableLowInitialPlaylist&&(i=e.selectInitialPlaylist()),i||(i=e.selectPlaylist()),e.initialMedia_=i,void e.masterPlaylistLoader_.media(e.initialMedia_)}if(e.useCueTags_&&e.updateAdCues_(t),e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.updateDuration(),e.tech_.paused()||(e.mainSegmentLoader_.load(),e.audioSegmentLoader_&&e.audioSegmentLoader_.load()),!t.endList){var n=function(){var t=e.seekable();0!==t.length&&e.mediaSource.addSeekableRange_(t.start(0),t.end(0))};if(e.duration()!==1/0){e.tech_.one("durationchange",(function t(){e.duration()===1/0?n():e.tech_.one("durationchange",t)}))}else n()}})),this.masterPlaylistLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)})),this.masterPlaylistLoader_.on("mediachanging",(function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()})),this.masterPlaylistLoader_.on("mediachange",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;fc(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})})),this.masterPlaylistLoader_.on("playlistunchanged",(function(){var t=e.masterPlaylistLoader_.media();e.stuckAtPlaylistEnd_(t)&&(e.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),e.tech_.trigger("playliststuck"))})),this.masterPlaylistLoader_.on("renditiondisabled",(function(){e.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})})),this.masterPlaylistLoader_.on("renditionenabled",(function(){e.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})}))}},{key:"triggerPresenceUsage_",value:function(e,t){var i=e.mediaGroups||{},n=!0,r=Object.keys(i.AUDIO);for(var s in i.AUDIO)for(var a in i.AUDIO[s]){i.AUDIO[s][a].uri||(n=!1)}n&&this.tech_.trigger({type:"usage",name:"hls-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"}),Jh.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"hls-aes"}),Jh.Playlist.isFmp4(t)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&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 e=this;this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist(),i=e.masterPlaylistLoader_.media(),n=e.tech_.buffered();(function(e){var t=e.currentPlaylist,i=e.nextPlaylist,n=e.forwardBuffer,r=e.bufferLowWaterLine,s=e.duration;e.log;return i?!t.endList||(s<Th.MAX_BUFFER_LOW_WATER_LINE||(i.attributes.BANDWIDTH<t.attributes.BANDWIDTH||n>=r)):(Nl.log.warn("We received no playlist to switch to. Please check your stream."),!1)})({currentPlaylist:i,nextPlaylist:t,forwardBuffer:n.length?n.end(n.length-1)-e.tech_.currentTime():0,bufferLowWaterLine:e.bufferLowWaterLine(),duration:e.duration(),log:e.logger_})&&e.masterPlaylistLoader_.media(t),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")})),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("ended",(function(){e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(){e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)})),this.mainSegmentLoader_.on("reseteverything",(function(){e.tech_.trigger("hls-reset")})),this.mainSegmentLoader_.on("segmenttimemapping",(function(t){e.tech_.trigger({type:"hls-segment-time-mapping",mapping:t.mapping})})),this.audioSegmentLoader_.on("ended",(function(){e.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 e=this.selectPlaylist();e!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(e),this.mainSegmentLoader_.resetLoader())}},{key:"fastQualityChange_",value:function(){var e=this,t=this.selectPlaylist();t!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(t),this.mainSegmentLoader_.resetEverything((function(){Nl.browser.IE_VERSION||Nl.browser.IS_EDGE?e.tech_.setCurrentTime(e.tech_.currentTime()+.04):e.tech_.setCurrentTime(e.tech_.currentTime())})))}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}}},{key:"setupFirstPlay",value:function(){var e=this,t=this.masterPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_)return!1;if(!t.endList){var i=this.seekable();if(!i.length)return!1;if(Nl.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",(function(){e.trigger("firstplay"),e.tech_.setCurrentTime(i.end(0)),e.hasPlayed_=!0})),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(i.end(0))}return this.hasPlayed_=!0,this.load(),!0}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(e){return Nl.log.warn("Failed to create Source Buffers",e),this.mediaSource.endOfStream("decode")}if(this.tech_.autoplay()){var e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(function(e){}))}this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(e=!this.mainSegmentLoader_.startingMedia_||this.mainSegmentLoader_.startingMedia_.containsVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_),e){this.logger_("calling mediaSource.endOfStream()");try{this.mediaSource.endOfStream()}catch(e){Nl.log.warn("Failed to call media source endOfStream",e)}}}},{key:"stuckAtPlaylistEnd_",value:function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.mediaSource.duration);if(null===t)return!1;var i=Jh.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-n<=.1;var s=r.end(r.length-1);return s-n<=.1&&i-s<=.1}},{key:"blacklistCurrentPlaylist",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],i=void 0,n=void 0;if(i=e.playlist||this.masterPlaylistLoader_.media(),t=t||e.blacklistDuration||this.blacklistDuration,!i){this.error=e;try{return this.mediaSource.endOfStream("network")}catch(e){return this.trigger("error")}}var r=1===this.masterPlaylistLoader_.master.playlists.filter(dc).length,s=this.masterPlaylistLoader_.master.playlists;return 1===s.length?(Nl.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(r)):(r&&(Nl.log.warn("Removing all playlists from the blacklist because the last rendition is about to be blacklisted."),s.forEach((function(e){e.excludeUntil!==1/0&&delete e.excludeUntil})),this.tech_.trigger("retryplaylist")),i.excludeUntil=Date.now()+1e3*t,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),n=this.selectPlaylist(),Nl.log.warn("Problem encountered with the current HLS playlist."+(e.message?" "+e.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(n,r))}},{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(e){var t=Lc(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:Jh.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var e=void 0;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.mediaSource.duration);if(null!==i){var n=this.masterPlaylistLoader_.master.suggestedPresentationDelay,r=Jh.Playlist.seekable(t,i,n);if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.mediaSource.duration)))return;if(0===(e=Jh.Playlist.seekable(t,i,n)).length)return}var s=void 0,a=void 0;this.seekable_&&this.seekable_.length&&(s=this.seekable_.end(0),a=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=Nl.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]]):this.seekable_=r,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===s&&this.seekable_.start(0)===a||(this.logger_("seekable updated ["+Dc(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}}},{key:"updateDuration",value:function(){var e=this,t=this.mediaSource.duration,i=Jh.Playlist.duration(this.masterPlaylistLoader_.media()),n=this.tech_.buffered(),r=function t(){e.logger_("Setting duration from "+e.mediaSource.duration+" => "+i);try{e.mediaSource.duration=i}catch(e){Nl.log.warn("Failed to set media source duration",e)}e.tech_.trigger("durationchange"),e.mediaSource.removeEventListener("sourceopen",t)};n.length>0&&(i=Math.max(i,n.end(n.length-1))),t!==i&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",r):r())}},{key:"dispose",value:function(){var e=this;this.trigger("dispose"),this.decrypter_&&this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.off(),this.mediaSource.dispose&&this.mediaSource.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var e,t=this.masterPlaylistLoader_.media();if(t&&"open"===this.mediaSource.readyState){if((e=Zc(this.masterPlaylistLoader_.master,t)).length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+t.resolvedUri,this.mediaSource.endOfStream("decode");this.configureLoaderMimeTypes_(e),this.excludeIncompatibleVariants_(t)}}},{key:"configureLoaderMimeTypes_",value:function(e){var t=e.length>1&&-1===e[0].indexOf(",")&&e[0]!==e[1]?new Nl.EventTarget:null;this.mainSegmentLoader_.mimeType(e[0],t),e[1]&&this.audioSegmentLoader_.mimeType(e[1],t)}},{key:"excludeUnsupportedVariants_",value:function(){this.master().playlists.forEach((function(e){var t;e.attributes.CODECS&&ee.MediaSource&&ee.MediaSource.isTypeSupported&&!ee.MediaSource.isTypeSupported('video/mp4; codecs="'+(t=e.attributes.CODECS,t.replace(/avc1\.(\d+)\.(\d+)/i,(function(e){return Yc([e])[0]}))+'"'))&&(e.excludeUntil=1/0)}))}},{key:"excludeIncompatibleVariants_",value:function(e){var t=2,i=null,n=void 0;e.attributes.CODECS&&(n=Qc(e.attributes.CODECS),i=n.videoCodec,t=n.codecCount),this.master().playlists.forEach((function(e){var n={codecCount:2,videoCodec:null};e.attributes.CODECS&&(n=Qc(e.attributes.CODECS)),n.codecCount!==t&&(e.excludeUntil=1/0),n.videoCodec!==i&&(e.excludeUntil=1/0)}))}},{key:"updateAdCues_",value:function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(e.segments)for(var n=i,r=void 0,s=0;s<e.segments.length;s++){var a=e.segments[s];if(r||(r=jh(t,n+a.duration/2)),r){if("cueIn"in a){r.endTime=n,r.adEndTime=n,n+=a.duration,r=null;continue}if(n<r.endTime){n+=a.duration;continue}r.endTime+=a.duration}else if("cueOut"in a&&((r=new ee.VTTCue(n,n+a.duration,a.cueOut)).adStartTime=n,r.adEndTime=n+parseFloat(a.cueOut),t.addCue(r)),"cueOutCont"in a){var o=void 0,u=void 0,l=a.cueOutCont.split("/").map(parseFloat),c=ql(l,2);o=c[0],u=c[1],(r=new ee.VTTCue(n,n+a.duration,"")).adStartTime=n-o,r.adEndTime=r.adStartTime+u,t.addCue(r)}n+=a.duration}}(e,this.cueTagsTrack_,t)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=Th.GOAL_BUFFER_LENGTH,i=Th.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Th.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=Th.BUFFER_LOW_WATER_LINE,i=Th.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Th.MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,n)}}]),t}(Nl.EventTarget),id=function e(t,i,n){jl(this,e);var r,s,a,o=t.masterPlaylistController_,u=o[(t.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(o);if(i.attributes.RESOLUTION){var l=i.attributes.RESOLUTION;this.width=l.width,this.height=l.height}this.bandwidth=i.attributes.BANDWIDTH,this.id=n,this.enabled=(r=t.playlists,s=i.id,a=u,function(e){var t=r.master.playlists[s],i=hc(t),n=dc(t);return void 0===e?n:(e?delete t.disabled:t.disabled=!0,e===n||i||(a(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})},nd=["seeking","seeked","pause","playing","error"],rd=function(){function e(t){var i=this;jl(this,e),this.tech_=t.tech,this.seekable=t.seekable,this.allowSeeksWithinUnsafeLiveWindow=t.allowSeeksWithinUnsafeLiveWindow,this.media=t.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=yh("PlaybackWatcher"),this.logger_("initialize");var n=function(){return i.monitorCurrentTime_()},r=function(){return i.techWaiting_()},s=function(){return i.cancelTimer_()},a=function(){return i.fixesBadSeeks_()};this.tech_.on("seekablechanged",a),this.tech_.on("waiting",r),this.tech_.on(nd,s),this.tech_.on("canplay",n),this.dispose=function(){i.logger_("dispose"),i.tech_.off("seekablechanged",a),i.tech_.off("waiting",r),i.tech_.off(nd,s),i.tech_.off("canplay",n),i.checkCurrentTimeTimeout_&&ee.clearTimeout(i.checkCurrentTimeTimeout_),i.cancelTimer_()}}return Fl(e,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&ee.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=ee.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 e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+.1>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"fixesBadSeeks_",value:function(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime(),i=void 0;this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(i=e.end(e.length-1));this.beforeSeekableWindow_(e,t)&&(i=e.start(0)+.1);return void 0!==i&&(this.logger_("Trying to seek outside of seekable at time "+t+" with seekable range "+Dc(e)+". Seeking to "+i+"."),this.tech_.setCurrentTime(i),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),i=Lc(t,e);return i.length&&e+3<=i.end(0)?(this.cancelTimer_(),this.tech_.setCurrentTime(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+i.start(0)+" -> "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.buffered(),r=Oc(n,t);if(this.videoUnderflow_(r,n,t))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;if(r.length>0){var s=r.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+r.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1}},{key:"afterSeekableWindow_",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e.length)return!1;var r=e.end(e.length-1)+.1,s=!i.endList;return s&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r}},{key:"beforeSeekableWindow_",value:function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-.1)}},{key:"videoUnderflow_",value:function(e,t,i){if(0===e.length){var n=this.gapFromVideoUnderflow_(t,i);if(n)return this.logger_("Encountered a gap in video from "+n.start+" to "+n.end+". Seeking to current time "+i),!0}return!1}},{key:"skipTheGap_",value:function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),n=Oc(t,i);this.cancelTimer_(),0!==n.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+1/30),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(e,t){for(var i=function(e){if(e.length<2)return Nl.createTimeRanges();for(var t=[],i=1;i<e.length;i++){var n=e.end(i-1),r=e.start(i);t.push([n,r])}return Nl.createTimeRanges(t)}(e),n=0;n<i.length;n++){var r=i.start(n),s=i.end(n);if(t-r<4&&t-r>2)return{start:r,end:s}}return null}}]),e}(),sd={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}},ad=function(e){!function e(t,i){var n=0,r=0,s=Nl.mergeOptions(sd,i);t.ready((function(){t.trigger({type:"usage",name:"hls-error-reload-initialized"})}));var a=function(){r&&t.currentTime(r)},o=function(e){null!=e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",a),t.src(e),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},u=function(){if(Date.now()-n<1e3*s.errorInterval)t.trigger({type:"usage",name:"hls-error-reload-canceled"});else{if(s.getSource&&"function"==typeof s.getSource)return n=Date.now(),s.getSource.call(t,o);Nl.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},l=function e(){t.off("loadedmetadata",a),t.off("error",u),t.off("dispose",e)};t.on("error",u),t.on("dispose",l),t.reloadSourceOnError=function(i){l(),e(t,i)}}(this,e)},od={PlaylistLoader:Zl,Playlist:mc,Decrypter:Rr,AsyncStream:Or,decrypt:Nr,utils:xc,STANDARD_PLAYLIST_SELECTOR:function(){var e=this.useDevicePixelRatio&&ee.devicePixelRatio||1;return function(e,t,i,n,r){var s=e.playlists.map((function(e){var t,i;return t=e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height,{bandwidth:e.attributes.BANDWIDTH||ee.Number.MAX_VALUE,width:t,height:i,playlist:e}}));Lh(s,(function(e,t){return e.bandwidth-t.bandwidth}));var a=(s=s.filter((function(e){return!mc.isIncompatible(e.playlist)}))).filter((function(e){return mc.isEnabled(e.playlist)}));a.length||(a=s.filter((function(e){return!mc.isDisabled(e.playlist)})));var o=a.filter((function(e){return e.bandwidth*Th.BANDWIDTH_VARIANCE<t})),u=o[o.length-1],l=o.filter((function(e){return e.bandwidth===u.bandwidth}))[0];if(!1===r){var c=l||a[0]||s[0];return c?c.playlist:null}var h=o.filter((function(e){return e.width&&e.height}));Lh(h,(function(e,t){return e.width-t.width}));var d=h.filter((function(e){return e.width===i&&e.height===n}));u=d[d.length-1];var p=d.filter((function(e){return e.bandwidth===u.bandwidth}))[0],f=void 0,m=void 0,g=void 0;p||(m=(f=h.filter((function(e){return e.width>i||e.height>n}))).filter((function(e){return e.width===f[0].width&&e.height===f[0].height})),u=m[m.length-1],g=m.filter((function(e){return e.bandwidth===u.bandwidth}))[0]);var v=g||p||l||a[0]||s[0];return v?v.playlist:null}(this.playlists.master,this.systemBandwidth,parseInt(Ph(this.tech_.el(),"width"),10)*e,parseInt(Ph(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions)},INITIAL_PLAYLIST_SELECTOR:function(){var e=this.playlists.master.playlists.filter(mc.isEnabled);return Lh(e,(function(e,t){return Oh(e,t)})),e.filter((function(e){return Qc(e.attributes.CODECS).videoCodec}))[0]||null},comparePlaylistBandwidth:Oh,comparePlaylistResolution:function(e,t){var i=void 0,n=void 0;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||ee.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),i===(n=n||ee.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:yc()};["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(e){Object.defineProperty(od,e,{get:function(){return Nl.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),Th[e]},set:function(t){Nl.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?Nl.log.warn("value of Hls."+e+" must be greater than or equal to 0"):Th[e]=t}})}));var ud=function(e){if(/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e))return"hls";return/^application\/dash\+xml/i.test(e)?"dash":null},ld=function(e,t){for(var i=t.media(),n=-1,r=0;r<e.length;r++)if(e[r].id===i.id){n=r;break}e.selectedIndex_=n,e.trigger({selectedIndex:n,type:"change"})};od.canPlaySource=function(){return Nl.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var cd=function(e){var t=e.masterPlaylistController_.mainSegmentLoader_,i=e.masterPlaylistController_.audioSegmentLoader_,n=Nl.players[e.tech_.options_.playerId];if(n.eme){var r=function(e,t,i){if(!e)return e;var n=void 0,r=void 0;if(i.mimeType_)n=t.mimeType_,r=i.mimeType_;else{var s=eh(t.mimeType_),a=s.parameters.codecs.split(","),o=void 0,u=void 0;a.forEach((function(e){e=e.trim(),th(e)?o=e:ih(e)&&(u=e)})),n=s.type+'; codecs="'+u+'"',r=s.type.replace("video","audio")+'; codecs="'+o+'"'}var l={},c=t.playlist_;for(var h in e)l[h]={audioContentType:r,videoContentType:n},c.contentProtection&&c.contentProtection[h]&&c.contentProtection[h].pssh&&(l[h].pssh=c.contentProtection[h].pssh),"string"==typeof e[h]&&(l[h].url=e[h]);return Nl.mergeOptions(e,l)}(e.source_.keySystems,t,i);r&&(n.currentSource().keySystems=r,11!==Nl.browser.IE_VERSION&&n.eme.initializeMediaKeys&&n.eme.initializeMediaKeys())}},hd=function(){if(!window.localStorage)return null;var e=window.localStorage.getItem("videojs-vhs");if(!e)return null;try{return JSON.parse(e)}catch(e){return null}};od.supportsNativeHls=function(){var e=ne.createElement("video");if(!Nl.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),od.supportsNativeDash=!!Nl.getTech("Html5").isSupported()&&/maybe|probably/i.test(ne.createElement("video").canPlayType("application/dash+xml")),od.supportsTypeNatively=function(e){return"hls"===e?od.supportsNativeHls:"dash"===e&&od.supportsNativeDash},od.isSupported=function(){return Nl.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var dd=function(e){function t(e,i,n){jl(this,t);var r=Hl(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,i,n.hls));if(i.options_&&i.options_.playerId){var s=Nl(i.options_.playerId);s.hasOwnProperty("hls")||Object.defineProperty(s,"hls",{get:function(){return Nl.log.warn("player.hls is deprecated. Use player.tech().hls instead."),i.trigger({type:"usage",name:"hls-player-access"}),r},configurable:!0}),s.vhs=r,s.dash=r,r.player_=s}if(r.tech_=i,r.source_=e,r.stats={},r.ignoreNextSeekingEvent_=!1,r.setOptions_(),r.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(r.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return r.on(ne,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(function(e){var t=ne.fullscreenElement||ne.webkitFullscreenElement||ne.mozFullScreenElement||ne.msFullscreenElement;t&&t.contains(r.tech_.el())&&r.masterPlaylistController_.smoothQualityChange_()})),r.on(r.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),r.on(r.tech_,"error",(function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()})),r.on(r.tech_,"play",r.play),r}return Vl(t,e),Fl(t,[{key:"setOptions_",value:function(){var e=this;if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.handleManifestRedirects=this.options_.handleManifestRedirects||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var t=hd();t&&t.bandwidth&&(this.options_.bandwidth=t.bandwidth,this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})),t&&t.throughput&&(this.options_.throughput=t.throughput,this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=Th.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Th.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys"].forEach((function(t){void 0!==e.source_[t]&&(e.options_[t]=e.source_[t])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}},{key:"src",value:function(e,t){var i=this;e&&(this.setOptions_(),this.options_.url=this.source_.src,this.options_.tech=this.tech_,this.options_.externHls=od,this.options_.sourceType=ud(t),this.options_.seekTo=function(e){i.tech_.setCurrentTime(e)},this.masterPlaylistController_=new td(this.options_),this.playbackWatcher_=new rd(Nl.mergeOptions(this.options_,{seekable:function(){return i.seekable()},media:function(){return i.masterPlaylistController_.media()}})),this.masterPlaylistController_.on("error",(function(){Nl.players[i.tech_.options_.playerId].error(i.masterPlaylistController_.error)})),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):od.STANDARD_PLAYLIST_SELECTOR.bind(this),this.masterPlaylistController_.selectInitialPlaylist=od.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(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=e,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e=1/(this.bandwidth||1),t=void 0;return t=this.throughput>0?1/this.throughput:0,Math.floor(1/(e+t))},set:function(){Nl.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return Nc(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return Nc(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!window.localStorage)return!1;var t=hd();t=t?Nl.mergeOptions(t,e):e;try{window.localStorage.setItem("videojs-vhs",JSON.stringify(t))}catch(e){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var e,t;t=(e=i).playlists,e.representations=function(){return t&&t.master&&t.master.playlists?t.master.playlists.filter((function(e){return!hc(e)})).map((function(t,i){return new id(e,t,t.id)})):[]},cd(i)})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.masterPlaylistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&this.tech_.src(Nl.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var e=this,t=Nl.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach((function(e){t.addQualityLevel(e)})),ld(t,i.playlists)})),this.playlists.on("mediachange",(function(){ld(e.qualityLevels_,e.playlists)})))}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(e){this.masterPlaylistController_.setCurrentTime(e)}},{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(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.hls&&delete this.tech_.hls,function e(t,i,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,i);if(void 0===r){var s=Object.getPrototypeOf(t);return null===s?void 0:e(s,i,n)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"dispose",this).call(this)}},{key:"convertToProgramTime",value:function(e,t){return Ac({playlist:this.masterPlaylistController_.media(),time:e,callback:t})}},{key:"seekToProgramTime",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return Ic({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}]),t}(Nl.getComponent("Component")),pd={name:"videojs-http-streaming",VERSION:"1.13.2",canHandleSource:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Nl.mergeOptions(Nl.options,t);return pd.canPlayType(e.type,i)},handleSource:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=Nl.mergeOptions(Nl.options,i);return t.hls=new dd(e,t,n),t.hls.xhr=yc(),t.hls.src(e.src,e.type),t.hls},canPlayType:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Nl.mergeOptions(Nl.options,t),n=i.hls.overrideNative,r=ud(e),s=r&&(!od.supportsTypeNatively(r)||n);return s?"maybe":""}};function fd(t){let i,n,r,s,a,b,T,S,k,C,w,E,x,A,I;return{c(){i=c("div"),n=c("div"),r=c("div"),s=c("div"),a=d(),b=c("div"),T=h(t[1]),S=d(),k=c("video"),C=c("source"),this.h()},l(e){i=g(e,"DIV",{class:!0});var o=m(i);n=g(o,"DIV",{class:!0});var u=m(n);r=g(u,"DIV",{class:!0});var c=m(r);s=g(c,"DIV",{class:!0}),m(s).forEach(l),a=y(c),b=g(c,"DIV",{class:!0});var h=m(b);T=v(h,t[1]),h.forEach(l),S=y(c),k=g(c,"VIDEO",{id:!0,class:!0,autoplay:!0,muted:!0,preload:!0,"data-setup":!0});var d=m(k);C=g(d,"SOURCE",{src:!0,type:!0}),d.forEach(l),c.forEach(l),u.forEach(l),o.forEach(l),this.h()},h(){f(s,"class","overlay"),f(b,"class","title"),C.src!==(w=t[0])&&f(C,"src",w),f(C,"type","application/x-mpegURL"),f(k,"id",t[2]),f(k,"class","video-js vjs-16-9"),k.autoplay=!0,k.muted=!0,f(k,"preload","auto"),f(k,"data-setup",E=JSON.stringify(t[4])),f(r,"class",x="stream live "+t[3]),f(n,"class","wrapper"),f(i,"class","quarter")},m(e,l){u(e,i,l),o(i,n),o(n,r),o(r,s),o(r,a),o(r,b),o(b,T),o(r,S),o(r,k),o(k,C),A||(I=p(i,"click",t[5]),A=!0)},p(e,[t]){2&t&&_(T,e[1]),1&t&&C.src!==(w=e[0])&&f(C,"src",w),4&t&&f(k,"id",e[2]),8&t&&x!==(x="stream live "+e[3])&&f(r,"class",x)},i:e,o:e,d(e){e&&l(i),A=!1,I()}}}function md(e,t,i){let{id:n}=t,{src:r}=t,{title:s}=t,a="",o="";let u;return S(()=>{try{u=Nl(a)}catch(e){console.log(e)}z.subscribe(e=>{i(3,o=""!==a&&e===a?"active":""),u&&(console.log(a+" - mute"),u.muted(!0),o&&(console.log(a+" - unmute"),u.muted(!1)))}),console.log(`mounted ${a} player`)}),e.$set=e=>{"id"in e&&i(6,n=e.id),"src"in e&&i(0,r=e.src),"title"in e&&i(1,s=e.title)},e.$$.update=()=>{64&e.$$.dirty&&i(2,a=n+"-live")},[r,s,a,o,{youtube:{ytControls:0}},function(){$.setPlaying(a)},n]}void 0!==Nl.MediaSource&&void 0!==Nl.URL||(Nl.MediaSource=lh,Nl.URL=ch),lh.supportsNativeMediaSources()&&Nl.getTech("Html5").registerSourceHandler(pd,0),Nl.HlsHandler=dd,Nl.HlsSourceHandler=pd,Nl.Hls=od,Nl.use||Nl.registerComponent("Hls",od),Nl.options.hls=Nl.options.hls||{},Nl.registerPlugin?Nl.registerPlugin("reloadSourceOnError",ad):Nl.plugin("reloadSourceOnError",ad);class gd extends q{constructor(e){super(),H(this,e,md,fd,s,{id:6,src:0,title:1})}}function vd(t){let i,n,r,s,a,b,T,S,k,C;return{c(){i=c("div"),n=c("div"),r=c("div"),s=c("div"),a=d(),b=c("div"),T=h(t[0]),this.h()},l(e){i=g(e,"DIV",{class:!0});var o=m(i);n=g(o,"DIV",{class:!0});var u=m(n);r=g(u,"DIV",{class:!0,"data-video-id":!0,id:!0});var c=m(r);s=g(c,"DIV",{class:!0}),m(s).forEach(l),a=y(c),b=g(c,"DIV",{class:!0});var h=m(b);T=v(h,t[0]),h.forEach(l),c.forEach(l),u.forEach(l),o.forEach(l),this.h()},h(){f(s,"class","overlay"),f(b,"class","title"),f(r,"class",S="stream live twitch "+t[2]),f(r,"data-video-id","4"),f(r,"id",t[1]),f(n,"class","wrapper"),f(i,"class","quarter")},m(e,l){u(e,i,l),o(i,n),o(n,r),o(r,s),o(r,a),o(r,b),o(b,T),k||(C=p(i,"click",t[3]),k=!0)},p(e,[t]){1&t&&_(T,e[0]),4&t&&S!==(S="stream live twitch "+e[2])&&f(r,"class",S),2&t&&f(r,"id",e[1])},i:e,o:e,d(e){e&&l(i),k=!1,C()}}}function yd(e,t,i){let n,{id:r}=t,{channel:s}=t,{title:a}=t,o="",u="";return S(()=>{try{n=new Twitch.Player(o,{channel:s,muted:!0,width:"100%",height:"100%"})}catch(e){console.log(e)}z.subscribe(e=>{i(2,u=""!==o&&e===o?"active":""),n&&(console.log(o+" - mute"),n.setMuted(!0),u&&(console.log(o+" - unmute"),n.setMuted(!1)))}),console.log(`mounted ${o} player`)}),e.$set=e=>{"id"in e&&i(4,r=e.id),"channel"in e&&i(5,s=e.channel),"title"in e&&i(0,a=e.title)},e.$$.update=()=>{16&e.$$.dirty&&i(1,o=r+"-twitch")},[a,o,u,function(){console.log("click "+o),$.setPlaying(o)},r,s]}class _d extends q{constructor(e){super(),H(this,e,yd,vd,s,{id:4,channel:5,title:0})}}function bd(e){let t,i,n,r,s,a,p,b,T,S,k,C,w;const E=new gd({props:{title:"Sky News",id:"skynews",src:"http://skydvn-sn-mobile-prod.skydvn.com/skynews/1404/latest.m3u8#"+e[0]}}),x=new gd({props:{title:"BBC News",id:"bbcnews24",src:"https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_hdtv/ak/bbc_news24.m3u8#"+e[0]}}),A=new K({props:{title:"EuroNews",id:"euronews",src:"https://www.youtube.com/embed/PpOdhP4Ah0c?enablejsapi=1&autoplay=1&mute=1&controls=0&fs=0&modestbranding=1&cc_load_policy=1"}}),I=new gd({props:{title:"BBC Parliament",id:"bbcparliament",src:"https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_tv/ak/bbc_parliament.m3u8#"+e[0]}}),P=new gd({props:{title:"Bloomberg",id:"bloomberg",src:"https://liveprodeuwest.akamaized.net/eu1/Channel-EUTVqvs-AWS-ireland-1/Source-EUTVqvs-1000-1_live.m3u8#"+e[0]}}),L=new _d({props:{title:"twitch.tv/rukpolitics",id:"rukpolitics",channel:"rukpolitics"}}),O=new _d({props:{title:"twitch.tv/ukcommons",id:"ukcommons",channel:"ukcommons"}}),D=new _d({props:{title:"twitch.tv/democracylive",id:"democracylive",channel:"democracylive"}});return{c(){t=c("div"),i=h("Playing:"),n=h(e[1]),r=d(),s=c("div"),M(E.$$.fragment),a=d(),M(x.$$.fragment),p=d(),M(A.$$.fragment),b=d(),M(I.$$.fragment),T=d(),M(P.$$.fragment),S=d(),M(L.$$.fragment),k=d(),M(O.$$.fragment),C=d(),M(D.$$.fragment),this.h()},l(o){t=g(o,"DIV",{});var u=m(t);i=v(u,"Playing:"),n=v(u,e[1]),u.forEach(l),r=y(o),s=g(o,"DIV",{id:!0});var c=m(s);B(E.$$.fragment,c),a=y(c),B(x.$$.fragment,c),p=y(c),B(A.$$.fragment,c),b=y(c),B(I.$$.fragment,c),T=y(c),B(P.$$.fragment,c),S=y(c),B(L.$$.fragment,c),k=y(c),B(O.$$.fragment,c),C=y(c),B(D.$$.fragment,c),c.forEach(l),this.h()},h(){f(s,"id","container")},m(e,l){u(e,t,l),o(t,i),o(t,n),u(e,r,l),u(e,s,l),j(E,s,null),o(s,a),j(x,s,null),o(s,p),j(A,s,null),o(s,b),j(I,s,null),o(s,T),j(P,s,null),o(s,S),j(L,s,null),o(s,k),j(O,s,null),o(s,C),j(D,s,null),w=!0},p(e,[t]){(!w||2&t)&&_(n,e[1]);const i={};1&t&&(i.src="http://skydvn-sn-mobile-prod.skydvn.com/skynews/1404/latest.m3u8#"+e[0]),E.$set(i);const r={};1&t&&(r.src="https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_hdtv/ak/bbc_news24.m3u8#"+e[0]),x.$set(r);const s={};1&t&&(s.src="https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_tv/ak/bbc_parliament.m3u8#"+e[0]),I.$set(s);const a={};1&t&&(a.src="https://liveprodeuwest.akamaized.net/eu1/Channel-EUTVqvs-AWS-ireland-1/Source-EUTVqvs-1000-1_live.m3u8#"+e[0]),P.$set(a)},i(e){w||(R(E.$$.fragment,e),R(x.$$.fragment,e),R(A.$$.fragment,e),R(I.$$.fragment,e),R(P.$$.fragment,e),R(L.$$.fragment,e),R(O.$$.fragment,e),R(D.$$.fragment,e),w=!0)},o(e){U(E.$$.fragment,e),U(x.$$.fragment,e),U(A.$$.fragment,e),U(I.$$.fragment,e),U(P.$$.fragment,e),U(L.$$.fragment,e),U(O.$$.fragment,e),U(D.$$.fragment,e),w=!1},d(e){e&&l(t),e&&l(r),e&&l(s),F(E),F(x),F(A),F(I),F(P),F(L),F(O),F(D)}}}function Td(e,t,i){let n;a(e,z,e=>i(1,n=e));let r=0;return i(0,r=(new Date).getTime.toString(36)),[r,n]}return new class extends q{constructor(e){super(),H(this,e,Td,bd,s,{})}}({target:document.body,props:{}})}();
|