74 lines
476 KiB
JavaScript
74 lines
476 KiB
JavaScript
/**
|
|
* @license
|
|
* Video.js 7.4.1 <http://videojs.com/>
|
|
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
|
|
* Available under Apache License Version 2.0
|
|
* <https://github.com/videojs/video.js/blob/master/LICENSE>
|
|
*
|
|
* Includes vtt.js <https://github.com/mozilla/vtt.js>
|
|
* Available under Apache License Version 2.0
|
|
* <https://github.com/mozilla/vtt.js/blob/master/LICENSE>
|
|
*/(function(B,A){typeof exports=="object"&&typeof module!="undefined"?module.exports=A(require("global/document"),require("global/window")):typeof define=="function"&&define.amd?define(["global/document","global/window"],A):B.videojs=A(B.document,B.window)})(this,function(B,A){B=B&&B.hasOwnProperty("default")?B.default:B,A=A&&A.hasOwnProperty("default")?A.default:A;var ms="7.4.1";function F(i,r){i.prototype=Object.create(r.prototype),(i.prototype.constructor=i).__proto__=r}function gs(i,r){return(gs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(i,r)}function ys(i,r,e){return(ys=function(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,n,a){var s=[null];s.push.apply(s,n);var o=new(Function.bind.apply(t,s));return a&&gs(o,a.prototype),o}).apply(null,arguments)}function V(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Jn(i,r){return r||(r=i.slice(0)),i.raw=r,i}var Vt=[],ih=function(i,r){return function(e,t,n){var a=r.levels[t],s=new RegExp("^("+a+")$");if(e!=="log"&&n.unshift(e.toUpperCase()+":"),n.unshift(i+":"),Vt&&Vt.push([].concat(n)),A.console){var o=A.console[e];o||e!=="debug"||(o=A.console.info||A.console.log),o&&a&&s.test(e)&&o[Array.isArray(n)?"apply":"call"](A.console,n)}}},Z=function i(r){var e,t="info",n=function(){for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];e("log",t,s)};return e=ih(r,n),n.createLogger=function(a){return i(r+": "+a)},n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},n.level=function(a){if(typeof a=="string"){if(!n.levels.hasOwnProperty(a))throw new Error('"'+a+'" in not a valid log level');t=a}return t},(n.history=function(){return Vt?[].concat(Vt):[]}).filter=function(a){return(Vt||[]).filter(function(s){return new RegExp(".*"+a+".*").test(s[0])})},n.history.clear=function(){Vt&&(Vt.length=0)},n.history.disable=function(){Vt!==null&&(Vt.length=0,Vt=null)},n.history.enable=function(){Vt===null&&(Vt=[])},n.error=function(){for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e("error",t,s)},n.warn=function(){for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e("warn",t,s)},n.debug=function(){for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e("debug",t,s)},n}("VIDEOJS"),vs=Z.createLogger,Zn=function(i){for(var r="",e=0;e<arguments.length;e++)r+=i[e].replace(/\n\r?\s*/g,"")+(arguments[e+1]||"");return r},nh=Object.prototype.toString,_s=function(i){return ve(i)?Object.keys(i):[]};function Ve(i,r){_s(i).forEach(function(e){return r(i[e],e)})}function ct(i){for(var r=arguments.length,e=new Array(1<r?r-1:0),t=1;t<r;t++)e[t-1]=arguments[t];return Object.assign?Object.assign.apply(Object,[i].concat(e)):(e.forEach(function(n){n&&Ve(n,function(a,s){i[s]=a})}),i)}function ve(i){return!!i&&typeof i=="object"}function di(i){return ve(i)&&nh.call(i)==="[object Object]"&&i.constructor===Object}function tr(i,r){if(!i||!r||typeof A.getComputedStyle!="function")return"";var e=A.getComputedStyle(i);return e?e[r]:""}function bs(){var i=Jn([`Setting attributes in the second argument of createEl()
|
|
has been deprecated. Use the third argument instead.
|
|
createEl(type, properties, attributes). Attempting to set `," to ","."]);return bs=function(){return i},i}function Ts(i){return typeof i=="string"&&/\S/.test(i)}function Ss(i){if(/\s/.test(i))throw new Error("class has illegal whitespace characters")}function He(){return B===A.document}function pi(i){return ve(i)&&i.nodeType===1}function ks(){try{return A.parent!==A.self}catch(i){return!0}}function ws(i){return function(r,e){if(!Ts(r))return B[i](null);Ts(e)&&(e=B.querySelector(e));var t=pi(e)?e:B;return t[i]&&t[i](r)}}function yt(i,r,e,t){i===void 0&&(i="div"),r===void 0&&(r={}),e===void 0&&(e={});var n=B.createElement(i);return Object.getOwnPropertyNames(r).forEach(function(a){var s=r[a];a.indexOf("aria-")!==-1||a==="role"||a==="type"?(Z.warn(Zn(bs(),a,s)),n.setAttribute(a,s)):a==="textContent"?qe(n,s):n[a]=s}),Object.getOwnPropertyNames(e).forEach(function(a){n.setAttribute(a,e[a])}),t&&nr(n,t),n}function qe(i,r){return typeof i.textContent=="undefined"?i.innerText=r:i.textContent=r,i}function Ji(i,r){r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i)}function Ce(i,r){return Ss(r),i.classList?i.classList.contains(r):(e=r,new RegExp("(^|\\s)"+e+"($|\\s)")).test(i.className);var e}function Ee(i,r){return i.classList?i.classList.add(r):Ce(i,r)||(i.className=(i.className+" "+r).trim()),i}function fi(i,r){return i.classList?i.classList.remove(r):(Ss(r),i.className=i.className.split(/\s+/).filter(function(e){return e!==r}).join(" ")),i}function Cs(i,r,e){var t=Ce(i,r);if(typeof e=="function"&&(e=e(i,r)),typeof e!="boolean"&&(e=!t),e!==t)return e?Ee(i,r):fi(i,r),i}function Es(i,r){Object.getOwnPropertyNames(r).forEach(function(e){var t=r[e];t===null||typeof t=="undefined"||t===!1?i.removeAttribute(e):i.setAttribute(e,t===!0?"":t)})}function oe(i){var r={},e=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(i&&i.attributes&&0<i.attributes.length)for(var t=i.attributes,n=t.length-1;0<=n;n--){var a=t[n].name,s=t[n].value;typeof i[a]!="boolean"&&e.indexOf(","+a+",")===-1||(s=s!==null),r[a]=s}return r}function As(i,r){return i.getAttribute(r)}function mi(i,r,e){i.setAttribute(r,e)}function Zi(i,r){i.removeAttribute(r)}function Ls(){B.body.focus(),B.onselectstart=function(){return!1}}function Os(){B.onselectstart=function(){return!0}}function gi(i){if(i&&i.getBoundingClientRect&&i.parentNode){var r=i.getBoundingClientRect(),e={};return["bottom","height","left","right","top","width"].forEach(function(t){r[t]!==void 0&&(e[t]=r[t])}),e.height||(e.height=parseFloat(tr(i,"height"))),e.width||(e.width=parseFloat(tr(i,"width"))),e}}function Ps(i){var r;if(i.getBoundingClientRect&&i.parentNode&&(r=i.getBoundingClientRect()),!r)return{left:0,top:0};var e=B.documentElement,t=B.body,n=e.clientLeft||t.clientLeft||0,a=A.pageXOffset||t.scrollLeft,s=r.left+a-n,o=e.clientTop||t.clientTop||0,u=A.pageYOffset||t.scrollTop,c=r.top+u-o;return{left:Math.round(s),top:Math.round(c)}}function er(i,r){var e={},t=Ps(i),n=i.offsetWidth,a=i.offsetHeight,s=t.top,o=t.left,u=r.pageY,c=r.pageX;return r.changedTouches&&(c=r.changedTouches[0].pageX,u=r.changedTouches[0].pageY),e.y=Math.max(0,Math.min(1,(s-u+a)/a)),e.x=Math.max(0,Math.min(1,(c-o)/n)),e}function Us(i){return ve(i)&&i.nodeType===3}function ir(i){for(;i.firstChild;)i.removeChild(i.firstChild);return i}function Is(i){return typeof i=="function"&&(i=i()),(Array.isArray(i)?i:[i]).map(function(r){return typeof r=="function"&&(r=r()),pi(r)||Us(r)?r:typeof r=="string"&&/\S/.test(r)?B.createTextNode(r):void 0}).filter(function(r){return r})}function nr(i,r){return Is(r).forEach(function(e){return i.appendChild(e)}),i}function xs(i,r){return nr(ir(i),r)}function ze(i){return i.button===void 0&&i.buttons===void 0||i.button===0&&i.buttons===void 0||i.button===0&&i.buttons===1}var _e=ws("querySelector"),Ds=ws("querySelectorAll"),Rs=Object.freeze({isReal:He,isEl:pi,isInFrame:ks,createEl:yt,textContent:qe,prependTo:Ji,hasClass:Ce,addClass:Ee,removeClass:fi,toggleClass:Cs,setAttributes:Es,getAttributes:oe,getAttribute:As,setAttribute:mi,removeAttribute:Zi,blockTextSelection:Ls,unblockTextSelection:Os,getBoundingClientRect:gi,findPosition:Ps,getPointerPosition:er,isTextNode:Us,emptyEl:ir,normalizeContent:Is,appendContent:nr,insertContent:xs,isSingleLeftClick:ze,$:_e,$$:Ds}),rh=1;function Ae(){return rh++}var yi={},Le="vdata"+new Date().getTime();function vi(i){var r=i[Le];return r||(r=i[Le]=Ae()),yi[r]||(yi[r]={}),yi[r]}function Ms(i){var r=i[Le];return!!r&&!!Object.getOwnPropertyNames(yi[r]).length}function Bs(i){var r=i[Le];if(r){delete yi[r];try{delete i[Le]}catch(e){i.removeAttribute?i.removeAttribute(Le):i[Le]=null}}}function Ns(i,r){var e=vi(i);e.handlers[r].length===0&&(delete e.handlers[r],i.removeEventListener?i.removeEventListener(r,e.dispatcher,!1):i.detachEvent&&i.detachEvent("on"+r,e.dispatcher)),Object.getOwnPropertyNames(e.handlers).length<=0&&(delete e.handlers,delete e.dispatcher,delete e.disabled),Object.getOwnPropertyNames(e).length===0&&Bs(i)}function rr(i,r,e,t){e.forEach(function(n){i(r,n,t)})}function tn(i){function r(){return!0}function e(){return!1}if(!i||!i.isPropagationStopped){var t=i||A.event;for(var n in i={},t)n!=="layerX"&&n!=="layerY"&&n!=="keyLocation"&&n!=="webkitMovementX"&&n!=="webkitMovementY"&&(n==="returnValue"&&t.preventDefault||(i[n]=t[n]));if(i.target||(i.target=i.srcElement||B),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){t.preventDefault&&t.preventDefault(),i.returnValue=!1,t.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){t.stopPropagation&&t.stopPropagation(),i.cancelBubble=!0,t.cancelBubble=!0,i.isPropagationStopped=r},i.isPropagationStopped=e,i.stopImmediatePropagation=function(){t.stopImmediatePropagation&&t.stopImmediatePropagation(),i.isImmediatePropagationStopped=r,i.stopPropagation()},i.isImmediatePropagationStopped=e,i.clientX!==null&&i.clientX!==void 0){var a=B.documentElement,s=B.body;i.pageX=i.clientX+(a&&a.scrollLeft||s&&s.scrollLeft||0)-(a&&a.clientLeft||s&&s.clientLeft||0),i.pageY=i.clientY+(a&&a.scrollTop||s&&s.scrollTop||0)-(a&&a.clientTop||s&&s.clientTop||0)}i.which=i.charCode||i.keyCode,i.button!==null&&i.button!==void 0&&(i.button=1&i.button?0:4&i.button?1:2&i.button?2:0)}return i}var js=!1;(function(){try{var i=Object.defineProperty({},"passive",{get:function(){js=!0}});A.addEventListener("test",null,i),A.removeEventListener("test",null,i)}catch(r){}})();var ah=["touchstart","touchmove"];function Yt(i,r,e){if(Array.isArray(r))return rr(Yt,i,r,e);var t=vi(i);if(t.handlers||(t.handlers={}),t.handlers[r]||(t.handlers[r]=[]),e.guid||(e.guid=Ae()),t.handlers[r].push(e),t.dispatcher||(t.disabled=!1,t.dispatcher=function(a,s){if(!t.disabled){a=tn(a);var o=t.handlers[a.type];if(o)for(var u=o.slice(0),c=0,d=u.length;c<d&&!a.isImmediatePropagationStopped();c++)try{u[c].call(i,a,s)}catch(p){Z.error(p)}}}),t.handlers[r].length===1)if(i.addEventListener){var n=!1;js&&-1<ah.indexOf(r)&&(n={passive:!0}),i.addEventListener(r,t.dispatcher,n)}else i.attachEvent&&i.attachEvent("on"+r,t.dispatcher)}function Dt(i,r,e){if(Ms(i)){var t=vi(i);if(t.handlers){if(Array.isArray(r))return rr(Dt,i,r,e);var n=function(u,c){t.handlers[c]=[],Ns(u,c)};if(r!==void 0){var a=t.handlers[r];if(a)if(e){if(e.guid)for(var s=0;s<a.length;s++)a[s].guid===e.guid&&a.splice(s--,1);Ns(i,r)}else n(i,r)}else for(var o in t.handlers)Object.prototype.hasOwnProperty.call(t.handlers||{},o)&&n(i,o)}}}function We(i,r,e){var t=Ms(i)?vi(i):{},n=i.parentNode||i.ownerDocument;if(typeof r=="string"?r={type:r,target:i}:r.target||(r.target=i),r=tn(r),t.dispatcher&&t.dispatcher.call(i,r,e),n&&!r.isPropagationStopped()&&r.bubbles===!0)We.call(null,n,r,e);else if(!n&&!r.defaultPrevented){var a=vi(r.target);r.target[r.type]&&(a.disabled=!0,typeof r.target[r.type]=="function"&&r.target[r.type](),a.disabled=!1)}return!r.defaultPrevented}function _i(i,r,e){if(Array.isArray(r))return rr(_i,i,r,e);var t=function n(){Dt(i,r,n),e.apply(this,arguments)};t.guid=e.guid=e.guid||Ae(),Yt(i,r,t)}var ar,sh=Object.freeze({fixEvent:tn,on:Yt,off:Dt,trigger:We,one:_i}),sr=!1,oh=function(){if(He()&&ar.options.autoSetup!==!1){var i=Array.prototype.slice.call(B.getElementsByTagName("video")),r=Array.prototype.slice.call(B.getElementsByTagName("audio")),e=Array.prototype.slice.call(B.getElementsByTagName("video-js")),t=i.concat(r,e);if(t&&0<t.length)for(var n=0,a=t.length;n<a;n++){var s=t[n];if(!s||!s.getAttribute){or(1);break}s.player===void 0&&s.getAttribute("data-setup")!==null&&ar(s)}else sr||or(1)}};function or(i,r){r&&(ar=r),A.setTimeout(oh,i)}He()&&B.readyState==="complete"?sr=!0:_i(A,"load",function(){sr=!0});var bi,Fs=function(i){var r=B.createElement("style");return r.className=i,r},Vs=function(i,r){i.styleSheet?i.styleSheet.cssText=r:i.textContent=r},$=function(i,r,e){r.guid||(r.guid=Ae());var t=function(){return r.apply(i,arguments)};return t.guid=e?e+"_"+r.guid:r.guid,t},Ge=function(i,r){var e=Date.now();return function(){var t=Date.now();r<=t-e&&(i.apply(void 0,arguments),e=t)}},Pt=function(){};Pt.prototype.allowedEvents_={},Pt.prototype.addEventListener=Pt.prototype.on=function(i,r){var e=this.addEventListener;this.addEventListener=function(){},Yt(this,i,r),this.addEventListener=e},Pt.prototype.removeEventListener=Pt.prototype.off=function(i,r){Dt(this,i,r)},Pt.prototype.one=function(i,r){var e=this.addEventListener;this.addEventListener=function(){},_i(this,i,r),this.addEventListener=e},Pt.prototype.dispatchEvent=Pt.prototype.trigger=function(i){var r=i.type||i;typeof i=="string"&&(i={type:r}),i=tn(i),this.allowedEvents_[r]&&this["on"+r]&&this["on"+r](i),We(this,i)},Pt.prototype.queueTrigger=function(i){var r=this;bi||(bi=new Map);var e=i.type||i,t=bi.get(this);t||(t=new Map,bi.set(this,t));var n=t.get(e);t.delete(e),A.clearTimeout(n);var a=A.setTimeout(function(){t.size===0&&(t=null,bi.delete(r)),r.trigger(i)},0);t.set(e,a)};var Oe=function(i){return i instanceof Pt||!!i.eventBusEl_&&["on","one","off","trigger"].every(function(r){return typeof i[r]=="function"})},Hs=function(i){return typeof i=="string"&&/\S/.test(i)||Array.isArray(i)&&!!i.length},ur=function(i){if(!i.nodeName&&!Oe(i))throw new Error("Invalid target; must be a DOM node or evented object.")},qs=function(i){if(!Hs(i))throw new Error("Invalid event type; must be a non-empty string or array.")},zs=function(i){if(typeof i!="function")throw new Error("Invalid listener; must be a function.")},Ws=function(i,r){var e,t,n,a=r.length<3||r[0]===i||r[0]===i.eventBusEl_;return n=a?(e=i.eventBusEl_,3<=r.length&&r.shift(),t=r[0],r[1]):(e=r[0],t=r[1],r[2]),ur(e),qs(t),zs(n),{isTargetingSelf:a,target:e,type:t,listener:n=$(i,n)}},Ti=function(i,r,e,t){ur(i),i.nodeName?sh[r](i,e,t):i[r](e,t)},uh={on:function(){for(var i=this,r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var n=Ws(this,e),a=n.isTargetingSelf,s=n.target,o=n.type,u=n.listener;if(Ti(s,"on",o,u),!a){var c=function(){return i.off(s,o,u)};c.guid=u.guid;var d=function(){return i.off("dispose",c)};d.guid=u.guid,Ti(this,"on","dispose",c),Ti(s,"on","dispose",d)}},one:function(){for(var i=this,r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var n=Ws(this,e),a=n.isTargetingSelf,s=n.target,o=n.type,u=n.listener;if(a)Ti(s,"one",o,u);else{var c=function d(){i.off(s,o,d);for(var p=arguments.length,g=new Array(p),y=0;y<p;y++)g[y]=arguments[y];u.apply(null,g)};c.guid=u.guid,Ti(s,"one",o,c)}},off:function(i,r,e){if(!i||Hs(i))Dt(this.eventBusEl_,i,r);else{var t=i,n=r;ur(t),qs(n),zs(e),e=$(this,e),this.off("dispose",e),t.nodeName?(Dt(t,n,e),Dt(t,"dispose",e)):Oe(t)&&(t.off(n,e),t.off("dispose",e))}},trigger:function(i,r){return We(this.eventBusEl_,i,r)}};function lr(i,r){r===void 0&&(r={});var e=r.eventBusKey;if(e){if(!i[e].nodeName)throw new Error('The eventBusKey "'+e+'" does not refer to an element.');i.eventBusEl_=i[e]}else i.eventBusEl_=yt("span",{className:"vjs-event-bus"});return ct(i,uh),i.eventedCallbacks&&i.eventedCallbacks.forEach(function(t){t()}),i.on("dispose",function(){i.off(),A.setTimeout(function(){i.eventBusEl_=null},0)}),i}var lh={state:{},setState:function(i){var r,e=this;return typeof i=="function"&&(i=i()),Ve(i,function(t,n){e.state[n]!==t&&((r=r||{})[n]={from:e.state[n],to:t}),e.state[n]=t}),r&&Oe(this)&&this.trigger({changes:r,type:"statechanged"}),r}};function Gs(i,r){return ct(i,lh),i.state=ct({},i.state,r),typeof i.handleStateChanged=="function"&&Oe(i)&&i.on("statechanged",i.handleStateChanged),i}function ft(i){return typeof i!="string"?i:i.charAt(0).toUpperCase()+i.slice(1)}function ot(){for(var i={},r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.forEach(function(n){n&&Ve(n,function(a,s){di(a)?(di(i[s])||(i[s]={}),i[s]=ot(i[s],a)):i[s]=a})}),i}var D=function(){function i(e,t,n){if(!e&&this.play?this.player_=e=this:this.player_=e,this.options_=ot({},this.options_),t=this.options_=ot(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){var a=e&&e.id&&e.id()||"no_player";this.id_=a+"_component_"+Ae()}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.evented!==!1&&lr(this,{eventBusKey:this.el_?"el_":null}),Gs(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},!(this.childNameIndex_={})!==t.initChildren&&this.initChildren(),this.ready(n),t.reportTouchActivity!==!1&&this.enableTouchActivity()}var r=i.prototype;return r.dispose=function(){if(this.trigger({type:"dispose",bubbles:!1}),this.children_)for(var e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),Bs(this.el_),this.el_=null),this.player_=null},r.player=function(){return this.player_},r.options=function(e){return Z.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"),e&&(this.options_=ot(this.options_,e)),this.options_},r.el=function(){return this.el_},r.createEl=function(e,t,n){return yt(e,t,n)},r.localize=function(e,t,n){n===void 0&&(n=e);var a=this.player_.language&&this.player_.language(),s=this.player_.languages&&this.player_.languages(),o=s&&s[a],u=a&&a.split("-")[0],c=s&&s[u],d=n;return o&&o[e]?d=o[e]:c&&c[e]&&(d=c[e]),t&&(d=d.replace(/\{(\d+)\}/g,function(p,g){var y=t[g-1],b=y;return typeof y=="undefined"&&(b=p),b})),d},r.contentEl=function(){return this.contentEl_||this.el_},r.id=function(){return this.id_},r.name=function(){return this.name_},r.children=function(){return this.children_},r.getChildById=function(e){return this.childIndex_[e]},r.getChild=function(e){if(e)return e=ft(e),this.childNameIndex_[e]},r.addChild=function(e,t,n){var a,s;if(t===void 0&&(t={}),n===void 0&&(n=this.children_.length),typeof e=="string"){s=ft(e);var o=t.componentClass||s;t.name=s;var u=i.getComponent(o);if(!u)throw new Error("Component "+o+" does not exist");if(typeof u!="function")return null;a=new u(this.player_||this,t)}else a=e;if(this.children_.splice(n,0,a),typeof a.id=="function"&&(this.childIndex_[a.id()]=a),(s=s||a.name&&ft(a.name()))&&(this.childNameIndex_[s]=a),typeof a.el=="function"&&a.el()){var c=this.contentEl().children[n]||null;this.contentEl().insertBefore(a.el(),c)}return a},r.removeChild=function(e){if(typeof e=="string"&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,n=this.children_.length-1;0<=n;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(t){this.childIndex_[e.id()]=null,this.childNameIndex_[e.name()]=null;var a=e.el();a&&a.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},r.initChildren=function(){var e=this,t=this.options_.children;if(t){var n,a=this.options_,s=i.getComponent("Tech");(n=Array.isArray(t)?t:Object.keys(t)).concat(Object.keys(this.options_).filter(function(o){return!n.some(function(u){return typeof u=="string"?o===u:o===u.name})})).map(function(o){var u,c;return c=typeof o=="string"?t[u=o]||e.options_[u]||{}:(u=o.name,o),{name:u,opts:c}}).filter(function(o){var u=i.getComponent(o.opts.componentClass||ft(o.name));return u&&!s.isTech(u)}).forEach(function(o){var u=o.name,c=o.opts;if(a[u]!==void 0&&(c=a[u]),c!==!1){c===!0&&(c={}),c.playerOptions=e.options_.playerOptions;var d=e.addChild(u,c);d&&(e[u]=d)}})}},r.buildCSSClass=function(){return""},r.ready=function(e,t){if(t===void 0&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},r.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0<e.length&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)},r.$=function(e,t){return _e(e,t||this.contentEl())},r.$$=function(e,t){return Ds(e,t||this.contentEl())},r.hasClass=function(e){return Ce(this.el_,e)},r.addClass=function(e){Ee(this.el_,e)},r.removeClass=function(e){fi(this.el_,e)},r.toggleClass=function(e,t){Cs(this.el_,e,t)},r.show=function(){this.removeClass("vjs-hidden")},r.hide=function(){this.addClass("vjs-hidden")},r.lockShowing=function(){this.addClass("vjs-lock-showing")},r.unlockShowing=function(){this.removeClass("vjs-lock-showing")},r.getAttribute=function(e){return As(this.el_,e)},r.setAttribute=function(e,t){mi(this.el_,e,t)},r.removeAttribute=function(e){Zi(this.el_,e)},r.width=function(e,t){return this.dimension("width",e,t)},r.height=function(e,t){return this.dimension("height",e,t)},r.dimensions=function(e,t){this.width(e,!0),this.height(t)},r.dimension=function(e,t,n){if(t!==void 0)return t!==null&&t==t||(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:this.el_.style[e]=t==="auto"?"":t+"px",void(n||this.trigger("componentresize"));if(!this.el_)return 0;var a=this.el_.style[e],s=a.indexOf("px");return parseInt(s!==-1?a.slice(0,s):this.el_["offset"+ft(e)],10)},r.currentDimension=function(e){var t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(typeof A.getComputedStyle=="function"){var n=A.getComputedStyle(this.el_);t=n.getPropertyValue(e)||n[e]}if((t=parseFloat(t))===0){var a="offset"+ft(e);t=this.el_[a]}return t},r.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},r.currentWidth=function(){return this.currentDimension("width")},r.currentHeight=function(){return this.currentDimension("height")},r.focus=function(){this.el_.focus()},r.blur=function(){this.el_.blur()},r.emitTapEvents=function(){var e,t=0,n=null;this.on("touchstart",function(s){s.touches.length===1&&(n={pageX:s.touches[0].pageX,pageY:s.touches[0].pageY},t=new Date().getTime(),e=!0)}),this.on("touchmove",function(s){if(1<s.touches.length)e=!1;else if(n){var o=s.touches[0].pageX-n.pageX,u=s.touches[0].pageY-n.pageY;10<Math.sqrt(o*o+u*u)&&(e=!1)}});var a=function(){e=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(s){!(n=null)===e&&new Date().getTime()-t<200&&(s.preventDefault(),this.trigger("tap"))})},r.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=$(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});var n=function(a){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",n),this.on("touchcancel",n)}},r.setTimeout=function(e,t){var n,a,s=this;return e=$(this,e),n=A.setTimeout(function(){s.off("dispose",a),e()},t),(a=function(){return s.clearTimeout(n)}).guid="vjs-timeout-"+n,this.on("dispose",a),n},r.clearTimeout=function(e){A.clearTimeout(e);var t=function(){};return t.guid="vjs-timeout-"+e,this.off("dispose",t),e},r.setInterval=function(e,t){var n=this;e=$(this,e);var a=A.setInterval(e,t),s=function(){return n.clearInterval(a)};return s.guid="vjs-interval-"+a,this.on("dispose",s),a},r.clearInterval=function(e){A.clearInterval(e);var t=function(){};return t.guid="vjs-interval-"+e,this.off("dispose",t),e},r.requestAnimationFrame=function(e){var t,n,a=this;return this.supportsRaf_?(e=$(this,e),t=A.requestAnimationFrame(function(){a.off("dispose",n),e()}),(n=function(){return a.cancelAnimationFrame(t)}).guid="vjs-raf-"+t,this.on("dispose",n),t):this.setTimeout(e,1e3/60)},r.cancelAnimationFrame=function(e){if(this.supportsRaf_){A.cancelAnimationFrame(e);var t=function(){};return t.guid="vjs-raf-"+e,this.off("dispose",t),e}return this.clearTimeout(e)},i.registerComponent=function(e,t){if(typeof e!="string"||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var n,a=i.getComponent("Tech"),s=a&&a.isTech(t),o=i===t||i.prototype.isPrototypeOf(t.prototype);if(s||!o)throw n=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+e+'"; '+n+".");e=ft(e),i.components_||(i.components_={});var u=i.getComponent("Player");if(e==="Player"&&u&&u.players){var c=u.players,d=Object.keys(c);if(c&&0<d.length&&d.map(function(p){return c[p]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return i.components_[e]=t},i.getComponent=function(e){if(e)return e=ft(e),i.components_&&i.components_[e]?i.components_[e]:void 0},i}();D.prototype.supportsRaf_=typeof A.requestAnimationFrame=="function"&&typeof A.cancelAnimationFrame=="function",D.registerComponent("Component",D);var cr,hr,dr,pr,St=A.navigator&&A.navigator.userAgent||"",Xs=/AppleWebKit\/([\d.]+)/i.exec(St),ch=Xs?parseFloat(Xs.pop()):null,fr=/iPad/i.test(St),mr=/iPhone/i.test(St)&&!fr,Ys=/iPod/i.test(St),ue=mr||fr||Ys,hh=(cr=St.match(/OS (\d+)_/i))&&cr[1]?cr[1]:null,Pe=/Android/i.test(St),gr=function(){var i=St.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!i)return null;var r=i[1]&&parseFloat(i[1]),e=i[2]&&parseFloat(i[2]);return r&&e?parseFloat(i[1]+"."+i[2]):r||null}(),$s=Pe&&gr<5&&ch<537,Ks=/Firefox/i.test(St),yr=/Edge/i.test(St),be=!yr&&(/Chrome/i.test(St)||/CriOS/i.test(St)),Qs=(hr=St.match(/(Chrome|CriOS)\/(\d+)/))&&hr[2]?parseFloat(hr[2]):null,Js=(dr=/MSIE\s(\d+)\.\d/.exec(St),!(pr=dr&&parseFloat(dr[1]))&&/Trident\/7.0/i.test(St)&&/rv:11.0/.test(St)&&(pr=11),pr),Zs=/Safari/i.test(St)&&!be&&!Pe&&!yr,to=(Zs||ue)&&!be,en=He()&&("ontouchstart"in A||A.navigator.maxTouchPoints||A.DocumentTouch&&A.document instanceof A.DocumentTouch),dh=Object.freeze({IS_IPAD:fr,IS_IPHONE:mr,IS_IPOD:Ys,IS_IOS:ue,IOS_VERSION:hh,IS_ANDROID:Pe,ANDROID_VERSION:gr,IS_NATIVE_ANDROID:$s,IS_FIREFOX:Ks,IS_EDGE:yr,IS_CHROME:be,CHROME_VERSION:Qs,IE_VERSION:Js,IS_SAFARI:Zs,IS_ANY_SAFARI:to,TOUCH_ENABLED:en});function eo(i,r,e,t){return function(n,a,s){if(typeof a!="number"||a<0||s<a)throw new Error("Failed to execute '"+n+"' on 'TimeRanges': The index provided ("+a+") is non-numeric or out of bounds (0-"+s+").")}(i,t,e.length-1),e[t][r]}function vr(i){return i===void 0||i.length===0?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:i.length,start:eo.bind(null,"start",0,i),end:eo.bind(null,"end",1,i)}}function Ue(i,r){return Array.isArray(i)?vr(i):i===void 0||r===void 0?vr():vr([[i,r]])}function io(i,r){var e,t,n=0;if(!r)return 0;i&&i.length||(i=Ue(0,0));for(var a=0;a<i.length;a++)e=i.start(a),r<(t=i.end(a))&&(t=r),n+=t-e;return n/r}for(var nn,rn={},an=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],ph=an[0],sn=0;sn<an.length;sn++)if(an[sn][1]in B){nn=an[sn];break}if(nn)for(var on=0;on<nn.length;on++)rn[ph[on]]=nn[on];function wt(i){if(i instanceof wt)return i;typeof i=="number"?this.code=i:typeof i=="string"?this.message=i:ve(i)&&(typeof i.code=="number"&&(this.code=i.code),ct(this,i)),this.message||(this.message=wt.defaultMessages[this.code]||"")}wt.prototype.code=0,wt.prototype.message="",wt.prototype.status=null,wt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],wt.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 Xe=0;Xe<wt.errorTypes.length;Xe++)wt[wt.errorTypes[Xe]]=Xe,wt.prototype[wt.errorTypes[Xe]]=Xe;var fh=function(i,r){var e,t=null;try{e=JSON.parse(i,r)}catch(n){t=n}return[t,e]};function no(i){return i!=null&&typeof i.then=="function"}function Si(i){no(i)&&i.then(null,function(r){})}var ro=function(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(r,e,t){return i[e]&&(r[e]=i[e]),r},{cues:i.cues&&Array.prototype.map.call(i.cues,function(r){return{startTime:r.startTime,endTime:r.endTime,text:r.text,id:r.id}})})},mh=function(i){var r=i.$$("track"),e=Array.prototype.map.call(r,function(t){return t.track});return Array.prototype.map.call(r,function(t){var n=ro(t.track);return t.src&&(n.src=t.src),n}).concat(Array.prototype.filter.call(i.textTracks(),function(t){return e.indexOf(t)===-1}).map(ro))},gh=function(i,r){return i.forEach(function(e){var t=r.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(function(n){return t.addCue(n)})}),r.textTracks()},_r="vjs-modal-dialog",Ye=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).opened_=a.hasBeenOpened_=a.hasBeenFilled_=!1,a.closeable(!a.options_.uncloseable),a.content(a.options_.content),a.contentEl_=yt("div",{className:_r+"-content"},{role:"document"}),a.descEl_=yt("p",{className:_r+"-description vjs-control-text",id:a.el().getAttribute("aria-describedby")}),qe(a.descEl_,a.description()),a.el_.appendChild(a.descEl_),a.el_.appendChild(a.contentEl_),a}F(r,i);var e=r.prototype;return e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},e.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,i.prototype.dispose.call(this)},e.buildCSSClass=function(){return _r+" vjs-hidden "+i.prototype.buildCSSClass.call(this)},e.handleKeyPress=function(t){t.which===27&&this.closeable()&&this.close()},e.label=function(){return this.localize(this.options_.label||"Modal Window")},e.description=function(){var t=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(t+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),t},e.open=function(){if(!this.opened_){var t=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!t.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&t.pause(),this.closeable()&&this.on(this.el_.ownerDocument,"keydown",$(this,this.handleKeyPress)),this.hadControls_=t.controls(),t.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},e.opened=function(t){return typeof t=="boolean"&&this[t?"open":"close"](),this.opened_},e.close=function(){if(this.opened_){var t=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&t.play(),this.closeable()&&this.off(this.el_.ownerDocument,"keydown",$(this,this.handleKeyPress)),this.hadControls_&&t.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},e.closeable=function(t){if(typeof t=="boolean"){var n=this.closeable_=!!t,a=this.getChild("closeButton");if(n&&!a){var s=this.contentEl_;this.contentEl_=this.el_,a=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(a,"close",this.close)}!n&&a&&(this.off(a,"close",this.close),this.removeChild(a),a.dispose())}return this.closeable_},e.fill=function(){this.fillWith(this.content())},e.fillWith=function(t){var n=this.contentEl(),a=n.parentNode,s=n.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,a.removeChild(n),this.empty(),xs(n,t),this.trigger("modalfill"),s?a.insertBefore(n,s):a.appendChild(n);var o=this.getChild("closeButton");o&&a.appendChild(o.el_)},e.empty=function(){this.trigger("beforemodalempty"),ir(this.contentEl()),this.trigger("modalempty")},e.content=function(t){return typeof t!="undefined"&&(this.content_=t),this.content_},e.conditionalFocus_=function(){var t=B.activeElement,n=this.player_.el_;this.previouslyActiveEl_=null,(n.contains(t)||n===t)&&(this.previouslyActiveEl_=t,this.focus(),this.on(B,"keydown",this.handleKeyDown))},e.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null),this.off(B,"keydown",this.handleKeyDown)},e.handleKeyDown=function(t){if(t.which===9){for(var n,a=this.focusableEls_(),s=this.el_.querySelector(":focus"),o=0;o<a.length;o++)if(s===a[o]){n=o;break}B.activeElement===this.el_&&(n=0),t.shiftKey&&n===0?(a[a.length-1].focus(),t.preventDefault()):t.shiftKey||n!==a.length-1||(a[0].focus(),t.preventDefault())}},e.focusableEls_=function(){var t=this.el_.querySelectorAll("*");return Array.prototype.filter.call(t,function(n){return(n instanceof A.HTMLAnchorElement||n instanceof A.HTMLAreaElement)&&n.hasAttribute("href")||(n instanceof A.HTMLInputElement||n instanceof A.HTMLSelectElement||n instanceof A.HTMLTextAreaElement||n instanceof A.HTMLButtonElement)&&!n.hasAttribute("disabled")||n instanceof A.HTMLIFrameElement||n instanceof A.HTMLObjectElement||n instanceof A.HTMLEmbedElement||n.hasAttribute("tabindex")&&n.getAttribute("tabindex")!==-1||n.hasAttribute("contenteditable")})},r}(D);Ye.prototype.options_={pauseOnOpen:!0,temporary:!0},D.registerComponent("ModalDialog",Ye);var $e=function(i){function r(t){var n;t===void 0&&(t=[]),(n=i.call(this)||this).tracks_=[],Object.defineProperty(V(V(n)),"length",{get:function(){return this.tracks_.length}});for(var a=0;a<t.length;a++)n.addTrack(t[a]);return n}F(r,i);var e=r.prototype;return e.addTrack=function(t){var n=this.tracks_.length;""+n in this||Object.defineProperty(this,n,{get:function(){return this.tracks_[n]}}),this.tracks_.indexOf(t)===-1&&(this.tracks_.push(t),this.trigger({track:t,type:"addtrack"}))},e.removeTrack=function(t){for(var n,a=0,s=this.length;a<s;a++)if(this[a]===t){(n=this[a]).off&&n.off(),this.tracks_.splice(a,1);break}n&&this.trigger({track:n,type:"removetrack"})},e.getTrackById=function(t){for(var n=null,a=0,s=this.length;a<s;a++){var o=this[a];if(o.id===t){n=o;break}}return n},r}(Pt);for(var yh in $e.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"},$e.prototype.allowedEvents_)$e.prototype["on"+yh]=null;var br=function(i,r){for(var e=0;e<i.length;e++)Object.keys(i[e]).length&&r.id!==i[e].id&&(i[e].enabled=!1)},vh=function(i){function r(e){var t;e===void 0&&(e=[]);for(var n=e.length-1;0<=n;n--)if(e[n].enabled){br(e,e[n]);break}return(t=i.call(this,e)||this).changing_=!1,t}return F(r,i),r.prototype.addTrack=function(e){var t=this;e.enabled&&br(this,e),i.prototype.addTrack.call(this,e),e.addEventListener&&e.addEventListener("enabledchange",function(){t.changing_||(t.changing_=!0,br(t,e),t.changing_=!1,t.trigger("change"))})},r}($e),Tr=function(i,r){for(var e=0;e<i.length;e++)Object.keys(i[e]).length&&r.id!==i[e].id&&(i[e].selected=!1)},_h=function(i){function r(e){var t;e===void 0&&(e=[]);for(var n=e.length-1;0<=n;n--)if(e[n].selected){Tr(e,e[n]);break}return(t=i.call(this,e)||this).changing_=!1,Object.defineProperty(V(V(t)),"selectedIndex",{get:function(){for(var a=0;a<this.length;a++)if(this[a].selected)return a;return-1},set:function(){}}),t}return F(r,i),r.prototype.addTrack=function(e){var t=this;e.selected&&Tr(this,e),i.prototype.addTrack.call(this,e),e.addEventListener&&e.addEventListener("selectedchange",function(){t.changing_||(t.changing_=!0,Tr(t,e),t.changing_=!1,t.trigger("change"))})},r}($e),ao=function(i){function r(){return i.apply(this,arguments)||this}return F(r,i),r.prototype.addTrack=function(e){i.prototype.addTrack.call(this,e),e.addEventListener("modechange",$(this,function(){this.queueTrigger("change")})),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",$(this,function(){this.trigger("selectedlanguagechange")}))},r}($e),bh=function(){function i(e){e===void 0&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,n=e.length;t<n;t++)this.addTrackElement_(e[t])}var r=i.prototype;return r.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)},r.getTrackElementByTrack_=function(e){for(var t,n=0,a=this.trackElements_.length;n<a;n++)if(e===this.trackElements_[n].track){t=this.trackElements_[n];break}return t},r.removeTrackElement_=function(e){for(var t=0,n=this.trackElements_.length;t<n;t++)if(e===this.trackElements_[t]){this.trackElements_.splice(t,1);break}},i}(),so=function(){function i(e){i.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var r=i.prototype;return r.setCues_=function(e){var t=this.length||0,n=0,a=e.length;this.cues_=e,this.length_=e.length;var s=function(o){""+o in this||Object.defineProperty(this,""+o,{get:function(){return this.cues_[o]}})};if(t<a)for(n=t;n<a;n++)s.call(this,n)},r.getCueById=function(e){for(var t=null,n=0,a=this.length;n<a;n++){var s=this[n];if(s.id===e){t=s;break}}return t},i}(),Th={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Sh={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},kh={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},oo={disabled:"disabled",hidden:"hidden",showing:"showing"},Sr=function(i){function r(e){var t;e===void 0&&(e={}),t=i.call(this)||this;var n={id:e.id||"vjs_track_"+Ae(),kind:e.kind||"",label:e.label||"",language:e.language||""},a=function(o){Object.defineProperty(V(V(t)),o,{get:function(){return n[o]},set:function(){}})};for(var s in n)a(s);return t}return F(r,i),r}(Pt),kr=function(i){var r=["protocol","hostname","port","pathname","search","hash","host"],e=B.createElement("a");e.href=i;var t,n=e.host===""&&e.protocol!=="file:";n&&((t=B.createElement("div")).innerHTML='<a href="'+i+'"></a>',e=t.firstChild,t.setAttribute("style","display:none; position:absolute;"),B.body.appendChild(t));for(var a={},s=0;s<r.length;s++)a[r[s]]=e[r[s]];return a.protocol==="http:"&&(a.host=a.host.replace(/:80$/,"")),a.protocol==="https:"&&(a.host=a.host.replace(/:443$/,"")),a.protocol||(a.protocol=A.location.protocol),n&&B.body.removeChild(t),a},uo=function(i){if(!i.match(/^https?:\/\//)){var r=B.createElement("div");r.innerHTML='<a href="'+i+'">x</a>',i=r.firstChild.href}return i},wr=function(i){if(typeof i=="string"){var r=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i.exec(i);if(r)return r.pop().toLowerCase()}return""},un=function(i){var r=A.location,e=kr(i);return(e.protocol===":"?r.protocol:e.protocol)+e.host!==r.protocol+r.host},wh=Object.freeze({parseUrl:kr,getAbsoluteURL:uo,getFileExtension:wr,isCrossOrigin:un}),Ch=function(i){var r=Eh.call(i);return r==="[object Function]"||typeof i=="function"&&r!=="[object RegExp]"||typeof window!="undefined"&&(i===window.setTimeout||i===window.alert||i===window.confirm||i===window.prompt)},Eh=Object.prototype.toString;typeof window!="undefined"||typeof global!="undefined"&&global;function Cr(i,r){return i(r={exports:{}},r.exports),r.exports}var ki=Cr(function(i,r){(r=i.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},r.right=function(e){return e.replace(/\s*$/,"")}}),lo=(ki.left,ki.right,Function.prototype.toString),Ah=/^\s*class\b/,co=function(i){try{var r=lo.call(i);return Ah.test(r)}catch(e){return!1}},Lh=Object.prototype.toString,Oh=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",Ph=function(i){if(!i||typeof i!="function"&&typeof i!="object")return!1;if(typeof i=="function"&&!i.prototype)return!0;if(Oh)return function(e){try{return!co(e)&&(lo.call(e),!0)}catch(t){return!1}}(i);if(co(i))return!1;var r=Lh.call(i);return r==="[object Function]"||r==="[object GeneratorFunction]"},Uh=Object.prototype.toString,ho=Object.prototype.hasOwnProperty,Ih=function(i,r,e){if(!Ph(r))throw new TypeError("iterator must be a function");var t;3<=arguments.length&&(t=e),Uh.call(i)==="[object Array]"?function(n,a,s){for(var o=0,u=n.length;o<u;o++)ho.call(n,o)&&(s==null?a(n[o],o,n):a.call(s,n[o],o,n))}(i,r,t):typeof i=="string"?function(n,a,s){for(var o=0,u=n.length;o<u;o++)s==null?a(n.charAt(o),o,n):a.call(s,n.charAt(o),o,n)}(i,r,t):function(n,a,s){for(var o in n)ho.call(n,o)&&(s==null?a(n[o],o,n):a.call(s,n[o],o,n))}(i,r,t)},xh=function(i){if(!i)return{};var r={};return Ih(ki(i).split(`
|
|
`),function(e){var t,n=e.indexOf(":"),a=ki(e.slice(0,n)).toLowerCase(),s=ki(e.slice(n+1));typeof r[a]=="undefined"?r[a]=s:(t=r[a],Object.prototype.toString.call(t)==="[object Array]"?r[a].push(s):r[a]=[r[a],s])}),r},Dh=function(){for(var i={},r=0;r<arguments.length;r++){var e=arguments[r];for(var t in e)Rh.call(e,t)&&(i[t]=e[t])}return i},Rh=Object.prototype.hasOwnProperty,po=Te;function fo(i,r,e){var t=i;return Ch(r)?(e=r,typeof i=="string"&&(t={uri:i})):t=Dh(r,{uri:i}),t.callback=e,t}function Te(i,r,e){return mo(r=fo(i,r,e))}function mo(i){if(typeof i.callback=="undefined")throw new Error("callback argument missing");var r=!1,e=function(S,C,E){r||(r=!0,i.callback(S,C,E))};function t(S){return clearTimeout(u),S instanceof Error||(S=new Error(""+(S||"Unknown XMLHttpRequest Error"))),S.statusCode=0,e(S,T)}function n(){if(!s){var S;clearTimeout(u),S=i.useXDR&&o.status===void 0?200:o.status===1223?204:o.status;var C=T,E=null;return S!==0?(C={body:function(){var U=void 0;if(U=o.response?o.response:o.responseText||function(I){if(I.responseType==="document")return I.responseXML;var x=I.responseXML&&I.responseXML.documentElement.nodeName==="parsererror";return I.responseType!==""||x?null:I.responseXML}(o),b)try{U=JSON.parse(U)}catch(I){}return U}(),statusCode:S,method:d,headers:{},url:c,rawRequest:o},o.getAllResponseHeaders&&(C.headers=xh(o.getAllResponseHeaders()))):E=new Error("Internal XMLHttpRequest Error"),e(E,C,C.body)}}var a,s,o=i.xhr||null;o||(o=i.cors||i.useXDR?new Te.XDomainRequest:new Te.XMLHttpRequest);var u,c=o.url=i.uri||i.url,d=o.method=i.method||"GET",p=i.body||i.data,g=o.headers=i.headers||{},y=!!i.sync,b=!1,T={body:void 0,headers:{},statusCode:0,method:d,url:c,rawRequest:o};if("json"in i&&i.json!==!1&&(b=!0,g.accept||g.Accept||(g.Accept="application/json"),d!=="GET"&&d!=="HEAD"&&(g["content-type"]||g["Content-Type"]||(g["Content-Type"]="application/json"),p=JSON.stringify(i.json===!0?p:i.json))),o.onreadystatechange=function(){o.readyState===4&&setTimeout(n,0)},o.onload=n,o.onerror=t,o.onprogress=function(){},o.onabort=function(){s=!0},o.ontimeout=t,o.open(d,c,!y,i.username,i.password),y||(o.withCredentials=!!i.withCredentials),!y&&0<i.timeout&&(u=setTimeout(function(){if(!s){s=!0,o.abort("timeout");var S=new Error("XMLHttpRequest timeout");S.code="ETIMEDOUT",t(S)}},i.timeout)),o.setRequestHeader)for(a in g)g.hasOwnProperty(a)&&o.setRequestHeader(a,g[a]);else if(i.headers&&!function(S){for(var C in S)if(S.hasOwnProperty(C))return!1;return!0}(i.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in i&&(o.responseType=i.responseType),"beforeSend"in i&&typeof i.beforeSend=="function"&&i.beforeSend(o),o.send(p||null),o}Te.XMLHttpRequest=A.XMLHttpRequest||function(){},Te.XDomainRequest="withCredentials"in new Te.XMLHttpRequest?Te.XMLHttpRequest:A.XDomainRequest,function(i,r){for(var e=0;e<i.length;e++)r(i[e])}(["get","put","post","patch","head","delete"],function(i){Te[i==="delete"?"del":i]=function(r,e,t){return(e=fo(r,e,t)).method=i.toUpperCase(),mo(e)}});var go=function(i,r){var e=new A.WebVTT.Parser(A,A.vttjs,A.WebVTT.StringDecoder()),t=[];e.oncue=function(n){r.addCue(n)},e.onparsingerror=function(n){t.push(n)},e.onflush=function(){r.trigger({type:"loadeddata",target:r})},e.parse(i),0<t.length&&(A.console&&A.console.groupCollapsed&&A.console.groupCollapsed("Text Track parsing errors for "+r.src),t.forEach(function(n){return Z.error(n)}),A.console&&A.console.groupEnd&&A.console.groupEnd()),e.flush()},wi=function(i){function r(t){var n;if(t===void 0&&(t={}),!t.tech)throw new Error("A tech was not provided.");var a=ot(t,{kind:kh[t.kind]||"subtitles",language:t.language||t.srclang||""}),s=oo[a.mode]||"disabled",o=a.default;a.kind!=="metadata"&&a.kind!=="chapters"||(s="hidden"),(n=i.call(this,a)||this).tech_=a.tech,n.cues_=[],n.activeCues_=[];var u=new so(n.cues_),c=new so(n.activeCues_),d=!1,p=$(V(V(n)),function(){this.activeCues=this.activeCues,d&&(this.trigger("cuechange"),d=!1)});return s!=="disabled"&&n.tech_.ready(function(){n.tech_.on("timeupdate",p)},!0),Object.defineProperties(V(V(n)),{default:{get:function(){return o},set:function(){}},mode:{get:function(){return s},set:function(g){var y=this;oo[g]&&((s=g)!=="disabled"?this.tech_.ready(function(){y.tech_.on("timeupdate",p)},!0):this.tech_.off("timeupdate",p),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?u:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(this.cues.length===0)return c;for(var g=this.tech_.currentTime(),y=[],b=0,T=this.cues.length;b<T;b++){var S=this.cues[b];(S.startTime<=g&&S.endTime>=g||S.startTime===S.endTime&&S.startTime<=g&&S.startTime+.5>=g)&&y.push(S)}if(d=!1,y.length!==this.activeCues_.length)d=!0;else for(var C=0;C<y.length;C++)this.activeCues_.indexOf(y[C])===-1&&(d=!0);return this.activeCues_=y,c.setCues_(this.activeCues_),c},set:function(){}}}),a.src?(n.src=a.src,function(g,y){var b={uri:g},T=un(g);T&&(b.cors=T),po(b,$(this,function(S,C,E){if(S)return Z.error(S,C);if(y.loaded_=!0,typeof A.WebVTT!="function"){if(y.tech_){var U=function(){return go(E,y)};y.tech_.on("vttjsloaded",U),y.tech_.on("vttjserror",function(){Z.error("vttjs failed to load, stopping trying to process "+y.src),y.tech_.off("vttjsloaded",U)})}}else go(E,y)}))}(a.src,V(V(n)))):n.loaded_=!0,n}F(r,i);var e=r.prototype;return e.addCue=function(t){var n=t;if(A.vttjs&&!(t instanceof A.vttjs.VTTCue)){for(var a in n=new A.vttjs.VTTCue(t.startTime,t.endTime,t.text),t)a in n||(n[a]=t[a]);n.id=t.id,n.originalCue_=t}for(var s=this.tech_.textTracks(),o=0;o<s.length;o++)s[o]!==this&&s[o].removeCue(n);this.cues_.push(n),this.cues.setCues_(this.cues_)},e.removeCue=function(t){for(var n=this.cues_.length;n--;){var a=this.cues_[n];if(a===t||a.originalCue_&&a.originalCue_===t){this.cues_.splice(n,1),this.cues.setCues_(this.cues_);break}}},r}(Sr);wi.prototype.allowedEvents_={cuechange:"cuechange"};var yo=function(i){function r(e){var t;e===void 0&&(e={});var n=ot(e,{kind:Sh[e.kind]||""});t=i.call(this,n)||this;var a=!1;return Object.defineProperty(V(V(t)),"enabled",{get:function(){return a},set:function(s){typeof s=="boolean"&&s!==a&&(a=s,this.trigger("enabledchange"))}}),n.enabled&&(t.enabled=n.enabled),t.loaded_=!0,t}return F(r,i),r}(Sr),vo=function(i){function r(e){var t;e===void 0&&(e={});var n=ot(e,{kind:Th[e.kind]||""});t=i.call(this,n)||this;var a=!1;return Object.defineProperty(V(V(t)),"selected",{get:function(){return a},set:function(s){typeof s=="boolean"&&s!==a&&(a=s,this.trigger("selectedchange"))}}),n.selected&&(t.selected=n.selected),t}return F(r,i),r}(Sr),Ke=function(i){function r(e){var t,n;e===void 0&&(e={}),t=i.call(this)||this;var a=new wi(e);return t.kind=a.kind,t.src=a.src,t.srclang=a.language,t.label=a.label,t.default=a.default,Object.defineProperties(V(V(t)),{readyState:{get:function(){return n}},track:{get:function(){return a}}}),n=0,a.addEventListener("loadeddata",function(){n=2,t.trigger({type:"load",target:V(V(t))})}),t}return F(r,i),r}(Pt);Ke.prototype.allowedEvents_={load:"load"},Ke.NONE=0,Ke.LOADING=1,Ke.LOADED=2,Ke.ERROR=3;var Ht={audio:{ListClass:vh,TrackClass:yo,capitalName:"Audio"},video:{ListClass:_h,TrackClass:vo,capitalName:"Video"},text:{ListClass:ao,TrackClass:wi,capitalName:"Text"}};Object.keys(Ht).forEach(function(i){Ht[i].getterName=i+"Tracks",Ht[i].privateName=i+"Tracks_"});var Ci={remoteText:{ListClass:ao,TrackClass:wi,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:bh,TrackClass:Ke,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Rt=ot(Ht,Ci);Ci.names=Object.keys(Ci),Ht.names=Object.keys(Ht),Rt.names=[].concat(Ci.names).concat(Ht.names);var Er=Object.create||function(){function i(){}return function(r){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return i.prototype=r,new i}}();function $t(i,r){this.name="ParsingError",this.code=i.code,this.message=r||i.message}function Ar(i){function r(t,n,a,s){return 3600*(0|t)+60*(0|n)+(0|a)+(0|s)/1e3}var e=i.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return e?e[3]?r(e[1],e[2],e[3].replace(":",""),e[4]):59<e[1]?r(e[1],e[2],0,e[4]):r(0,e[1],e[2],e[4]):null}function Ei(){this.values=Er(null)}function Ai(i,r,e,t){var n=t?i.split(t):[i];for(var a in n)if(typeof n[a]=="string"){var s=n[a].split(e);s.length===2&&r(s[0],s[1])}}function Mh(i,r,e){var t,n,a,s=i;function o(){var c=Ar(i);if(c===null)throw new $t($t.Errors.BadTimeStamp,"Malformed timestamp: "+s);return i=i.replace(/^[^\sa-zA-Z-]+/,""),c}function u(){i=i.replace(/^\s+/,"")}if(u(),r.startTime=o(),u(),i.substr(0,3)!=="-->")throw new $t($t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+s);i=i.substr(3),u(),r.endTime=o(),u(),t=i,n=r,a=new Ei,Ai(t,function(c,d){switch(c){case"region":for(var p=e.length-1;0<=p;p--)if(e[p].id===d){a.set(c,e[p].region);break}break;case"vertical":a.alt(c,d,["rl","lr"]);break;case"line":var g=d.split(","),y=g[0];a.integer(c,y),a.percent(c,y)&&a.set("snapToLines",!1),a.alt(c,y,["auto"]),g.length===2&&a.alt("lineAlign",g[1],["start","middle","end"]);break;case"position":g=d.split(","),a.percent(c,g[0]),g.length===2&&a.alt("positionAlign",g[1],["start","middle","end"]);break;case"size":a.percent(c,d);break;case"align":a.alt(c,d,["start","middle","end","left","right"])}},/:/,/\s/),n.region=a.get("region",null),n.vertical=a.get("vertical",""),n.line=a.get("line","auto"),n.lineAlign=a.get("lineAlign","start"),n.snapToLines=a.get("snapToLines",!0),n.size=a.get("size",100),n.align=a.get("align","middle"),n.position=a.get("position",{start:0,left:0,middle:50,end:100,right:100},n.align),n.positionAlign=a.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},n.align)}(($t.prototype=Er(Error.prototype)).constructor=$t).Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Ei.prototype={set:function(i,r){this.get(i)||r===""||(this.values[i]=r)},get:function(i,r,e){return e?this.has(i)?this.values[i]:r[e]:this.has(i)?this.values[i]:r},has:function(i){return i in this.values},alt:function(i,r,e){for(var t=0;t<e.length;++t)if(r===e[t]){this.set(i,r);break}},integer:function(i,r){/^-?\d+$/.test(r)&&this.set(i,parseInt(r,10))},percent:function(i,r){return!!(r.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&0<=(r=parseFloat(r))&&r<=100)&&(this.set(i,r),!0)}};var Bh={"&":"&","<":"<",">":">","‎":"\u200E","‏":"\u200F"," ":"\xA0"},Nh={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},jh={v:"title",lang:"lang"},_o={rt:"ruby"};function bo(i,r){function e(){if(!r)return null;var T,S=r.match(/^([^<]*)(<[^>]*>?)?/);return T=S[1]?S[1]:S[2],r=r.substr(T.length),T}function t(T){return Bh[T]}function n(T){for(;b=T.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)T=T.replace(b[0],t);return T}function a(T,S){var C=Nh[T];if(!C)return null;var E=i.document.createElement(C);E.localName=C;var U=jh[T];return U&&S&&(E[U]=S.trim()),E}for(var s,o,u,c=i.document.createElement("div"),d=c,p=[];(s=e())!==null;)if(s[0]!=="<")d.appendChild(i.document.createTextNode(n(s)));else{if(s[1]==="/"){p.length&&p[p.length-1]===s.substr(2).replace(">","")&&(p.pop(),d=d.parentNode);continue}var g,y=Ar(s.substr(1,s.length-2));if(y){g=i.document.createProcessingInstruction("timestamp",y),d.appendChild(g);continue}var b=s.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!b||!(g=a(b[1],b[3]))||(o=d,_o[(u=g).localName]&&_o[u.localName]!==o.localName))continue;b[2]&&(g.className=b[2].substr(1).replace("."," ")),p.push(b[1]),d.appendChild(g),d=g}return c}var To=[[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 Fh(i){for(var r=0;r<To.length;r++){var e=To[r];if(i>=e[0]&&i<=e[1])return!0}return!1}function ln(){}function Lr(i,r,e){ln.call(this),this.cue=r,this.cueDiv=bo(i,r.text);var t={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:r.vertical===""?"horizontal-tb":r.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(t,this.cueDiv),this.div=i.document.createElement("div"),t={direction:function(a){var s=[],o="";if(!a||!a.childNodes)return"ltr";function u(p,g){for(var y=g.childNodes.length-1;0<=y;y--)p.push(g.childNodes[y])}function c(p){if(!p||!p.length)return null;var g=p.pop(),y=g.textContent||g.innerText;if(y){var b=y.match(/^.*(\n|\r)/);return b?b[p.length=0]:y}return g.tagName==="ruby"?c(p):g.childNodes?(u(p,g),c(p)):void 0}for(u(s,a);o=c(s);)for(var d=0;d<o.length;d++)if(Fh(o.charCodeAt(d)))return"rtl";return"ltr"}(this.cueDiv),writingMode:r.vertical===""?"horizontal-tb":r.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:r.align==="middle"?"center":r.align,font:e.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(t),this.div.appendChild(this.cueDiv);var n=0;switch(r.positionAlign){case"start":n=r.position;break;case"middle":n=r.position-r.size/2;break;case"end":n=r.position-r.size}r.vertical===""?this.applyStyles({left:this.formatStyle(n,"%"),width:this.formatStyle(r.size,"%")}):this.applyStyles({top:this.formatStyle(n,"%"),height:this.formatStyle(r.size,"%")}),this.move=function(a){this.applyStyles({top:this.formatStyle(a.top,"px"),bottom:this.formatStyle(a.bottom,"px"),left:this.formatStyle(a.left,"px"),right:this.formatStyle(a.right,"px"),height:this.formatStyle(a.height,"px"),width:this.formatStyle(a.width,"px")})}}function Ct(i){var r,e,t,n;if(i.div){e=i.div.offsetHeight,t=i.div.offsetWidth,n=i.div.offsetTop;var a=(a=i.div.childNodes)&&(a=a[0])&&a.getClientRects&&a.getClientRects();i=i.div.getBoundingClientRect(),r=a?Math.max(a[0]&&a[0].height||0,i.height/a.length):0}this.left=i.left,this.right=i.right,this.top=i.top||n,this.height=i.height||e,this.bottom=i.bottom||n+(i.height||e),this.width=i.width||t,this.lineHeight=r!==void 0?r:i.lineHeight}function Vh(i,r,e,t){var n=new Ct(r),a=r.cue,s=function(T){if(typeof T.line=="number"&&(T.snapToLines||0<=T.line&&T.line<=100))return T.line;if(!T.track||!T.track.textTrackList||!T.track.textTrackList.mediaElement)return-1;for(var S=T.track,C=S.textTrackList,E=0,U=0;U<C.length&&C[U]!==S;U++)C[U].mode==="showing"&&E++;return-1*++E}(a),o=[];if(a.snapToLines){var u;switch(a.vertical){case"":o=["+y","-y"],u="height";break;case"rl":o=["+x","-x"],u="width";break;case"lr":o=["-x","+x"],u="width"}var c=n.lineHeight,d=c*Math.round(s),p=e[u]+c,g=o[0];Math.abs(d)>p&&(d=d<0?-1:1,d*=Math.ceil(p/c)*c),s<0&&(d+=a.vertical===""?e.height:e.width,o=o.reverse()),n.move(g,d)}else{var y=n.lineHeight/e.height*100;switch(a.lineAlign){case"middle":s-=y/2;break;case"end":s-=y}switch(a.vertical){case"":r.applyStyles({top:r.formatStyle(s,"%")});break;case"rl":r.applyStyles({left:r.formatStyle(s,"%")});break;case"lr":r.applyStyles({right:r.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],n=new Ct(r)}var b=function(T,S){for(var C,E=new Ct(T),U=1,I=0;I<S.length;I++){for(;T.overlapsOppositeAxis(e,S[I])||T.within(e)&&T.overlapsAny(t);)T.move(S[I]);if(T.within(e))return T;var x=T.intersectPercentage(e);x<U&&(C=new Ct(T),U=x),T=new Ct(E)}return C||E}(n,o);r.move(b.toCSSCompatValues(e))}function Li(){}ln.prototype.applyStyles=function(i,r){for(var e in r=r||this.div,i)i.hasOwnProperty(e)&&(r.style[e]=i[e])},ln.prototype.formatStyle=function(i,r){return i===0?0:i+r},(Lr.prototype=Er(ln.prototype)).constructor=Lr,Ct.prototype.move=function(i,r){switch(r=r!==void 0?r:this.lineHeight,i){case"+x":this.left+=r,this.right+=r;break;case"-x":this.left-=r,this.right-=r;break;case"+y":this.top+=r,this.bottom+=r;break;case"-y":this.top-=r,this.bottom-=r}},Ct.prototype.overlaps=function(i){return this.left<i.right&&this.right>i.left&&this.top<i.bottom&&this.bottom>i.top},Ct.prototype.overlapsAny=function(i){for(var r=0;r<i.length;r++)if(this.overlaps(i[r]))return!0;return!1},Ct.prototype.within=function(i){return this.top>=i.top&&this.bottom<=i.bottom&&this.left>=i.left&&this.right<=i.right},Ct.prototype.overlapsOppositeAxis=function(i,r){switch(r){case"+x":return this.left<i.left;case"-x":return this.right>i.right;case"+y":return this.top<i.top;case"-y":return this.bottom>i.bottom}},Ct.prototype.intersectPercentage=function(i){return Math.max(0,Math.min(this.right,i.right)-Math.max(this.left,i.left))*Math.max(0,Math.min(this.bottom,i.bottom)-Math.max(this.top,i.top))/(this.height*this.width)},Ct.prototype.toCSSCompatValues=function(i){return{top:this.top-i.top,bottom:i.bottom-this.bottom,left:this.left-i.left,right:i.right-this.right,height:this.height,width:this.width}},Ct.getSimpleBoxPosition=function(i){var r=i.div?i.div.offsetHeight:i.tagName?i.offsetHeight:0,e=i.div?i.div.offsetWidth:i.tagName?i.offsetWidth:0,t=i.div?i.div.offsetTop:i.tagName?i.offsetTop:0;return{left:(i=i.div?i.div.getBoundingClientRect():i.tagName?i.getBoundingClientRect():i).left,right:i.right,top:i.top||t,height:i.height||r,bottom:i.bottom||t+(i.height||r),width:i.width||e}},Li.StringDecoder=function(){return{decode:function(i){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))}}},Li.convertCueToDOMTree=function(i,r){return i&&r?bo(i,r):null},Li.processCues=function(i,r,e){if(!i||!r||!e)return null;for(;e.firstChild;)e.removeChild(e.firstChild);var t=i.document.createElement("div");if(t.style.position="absolute",t.style.left="0",t.style.right="0",t.style.top="0",t.style.bottom="0",t.style.margin="1.5%",e.appendChild(t),function(u){for(var c=0;c<u.length;c++)if(u[c].hasBeenReset||!u[c].displayState)return!0;return!1}(r)){var n=[],a=Ct.getSimpleBoxPosition(t),s={font:Math.round(.05*a.height*100)/100+"px sans-serif"};(function(){for(var u,c,d=0;d<r.length;d++)c=r[d],u=new Lr(i,c,s),t.appendChild(u.div),Vh(0,u,a,n),c.displayState=u.div,n.push(Ct.getSimpleBoxPosition(u))})()}else for(var o=0;o<r.length;o++)t.appendChild(r[o].displayState)},(Li.Parser=function(i,r,e){e||(e=r,r={}),r||(r={}),this.window=i,this.vttjs=r,this.state="INITIAL",this.buffer="",this.decoder=e||new TextDecoder("utf8"),this.regionList=[]}).prototype={reportOrThrowError:function(i){if(!(i instanceof $t))throw i;this.onparsingerror&&this.onparsingerror(i)},parse:function(i){var r=this;function e(){for(var u=r.buffer,c=0;c<u.length&&u[c]!=="\r"&&u[c]!==`
|
|
`;)++c;var d=u.substr(0,c);return u[c]==="\r"&&++c,u[c]===`
|
|
`&&++c,r.buffer=u.substr(c),d}function t(u){u.match(/X-TIMESTAMP-MAP/)?Ai(u,function(c,d){switch(c){case"X-TIMESTAMP-MAP":p=d,g=new Ei,Ai(p,function(y,b){switch(y){case"MPEGT":g.integer(y+"S",b);break;case"LOCA":g.set(y+"L",Ar(b))}},/[^\d]:/,/,/),r.ontimestampmap&&r.ontimestampmap({MPEGTS:g.get("MPEGTS"),LOCAL:g.get("LOCAL")})}var p,g},/=/):Ai(u,function(c,d){switch(c){case"Region":(function(p){var g=new Ei;if(Ai(p,function(b,T){switch(b){case"id":g.set(b,T);break;case"width":g.percent(b,T);break;case"lines":g.integer(b,T);break;case"regionanchor":case"viewportanchor":var S=T.split(",");if(S.length!==2)break;var C=new Ei;if(C.percent("x",S[0]),C.percent("y",S[1]),!C.has("x")||!C.has("y"))break;g.set(b+"X",C.get("x")),g.set(b+"Y",C.get("y"));break;case"scroll":g.alt(b,T,["up"])}},/=/,/\s/),g.has("id")){var y=new(r.vttjs.VTTRegion||r.window.VTTRegion);y.width=g.get("width",100),y.lines=g.get("lines",3),y.regionAnchorX=g.get("regionanchorX",0),y.regionAnchorY=g.get("regionanchorY",100),y.viewportAnchorX=g.get("viewportanchorX",0),y.viewportAnchorY=g.get("viewportanchorY",100),y.scroll=g.get("scroll",""),r.onregion&&r.onregion(y),r.regionList.push({id:g.get("id"),region:y})}})(d)}},/:/)}i&&(r.buffer+=r.decoder.decode(i,{stream:!0}));try{var n;if(r.state==="INITIAL"){if(!/\r\n|\n/.test(r.buffer))return this;var a=(n=e()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new $t($t.Errors.BadSignature);r.state="HEADER"}for(var s=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;switch(s?s=!1:n=e(),r.state){case"HEADER":/:/.test(n)?t(n):n||(r.state="ID");continue;case"NOTE":n||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){r.state="NOTE";break}if(!n)continue;if(r.cue=new(r.vttjs.VTTCue||r.window.VTTCue)(0,0,""),r.state="CUE",n.indexOf("-->")===-1){r.cue.id=n;continue}case"CUE":try{Mh(n,r.cue,r.regionList)}catch(u){r.reportOrThrowError(u),r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":var o=n.indexOf("-->")!==-1;if(!n||o&&(s=!0)){r.oncue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}r.cue.text&&(r.cue.text+=`
|
|
`),r.cue.text+=n;continue;case"BADCUE":n||(r.state="ID");continue}}}catch(u){r.reportOrThrowError(u),r.state==="CUETEXT"&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state=r.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var i=this;try{if(i.buffer+=i.decoder.decode(),(i.cue||i.state==="HEADER")&&(i.buffer+=`
|
|
|
|
`,i.parse()),i.state==="INITIAL")throw new $t($t.Errors.BadSignature)}catch(r){i.reportOrThrowError(r)}return i.onflush&&i.onflush(),this}};var Hh=Li,qh={"":1,lr:1,rl:1},zh={start:1,middle:1,end:1,left:1,right:1};function Or(i){return typeof i=="string"&&!!zh[i.toLowerCase()]&&i.toLowerCase()}function So(i,r,e){this.hasBeenReset=!1;var t="",n=!1,a=i,s=r,o=e,u=null,c="",d=!0,p="auto",g="start",y=50,b="middle",T=50,S="middle";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return t},set:function(C){t=""+C}},pauseOnExit:{enumerable:!0,get:function(){return n},set:function(C){n=!!C}},startTime:{enumerable:!0,get:function(){return a},set:function(C){if(typeof C!="number")throw new TypeError("Start time must be set to a number.");a=C,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return s},set:function(C){if(typeof C!="number")throw new TypeError("End time must be set to a number.");s=C,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(C){o=""+C,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(C){u=C,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return c},set:function(C){var E,U=typeof(E=C)=="string"&&!!qh[E.toLowerCase()]&&E.toLowerCase();if(U===!1)throw new SyntaxError("An invalid or illegal string was specified.");c=U,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return d},set:function(C){d=!!C,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return p},set:function(C){if(typeof C!="number"&&C!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");p=C,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return g},set:function(C){var E=Or(C);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");g=E,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return y},set:function(C){if(C<0||100<C)throw new Error("Position must be between 0 and 100.");y=C,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return b},set:function(C){var E=Or(C);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");b=E,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return T},set:function(C){if(C<0||100<C)throw new Error("Size must be between 0 and 100.");T=C,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return S},set:function(C){var E=Or(C);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");S=E,this.hasBeenReset=!0}}}),this.displayState=void 0}So.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Wh=So,Gh={"":!0,up:!0};function Oi(i){return typeof i=="number"&&0<=i&&i<=100}var Xh=function(){var i=100,r=3,e=0,t=100,n=0,a=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return i},set:function(o){if(!Oi(o))throw new Error("Width must be between 0 and 100.");i=o}},lines:{enumerable:!0,get:function(){return r},set:function(o){if(typeof o!="number")throw new TypeError("Lines must be set to a number.");r=o}},regionAnchorY:{enumerable:!0,get:function(){return t},set:function(o){if(!Oi(o))throw new Error("RegionAnchorX must be between 0 and 100.");t=o}},regionAnchorX:{enumerable:!0,get:function(){return e},set:function(o){if(!Oi(o))throw new Error("RegionAnchorY must be between 0 and 100.");e=o}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(o){if(!Oi(o))throw new Error("ViewportAnchorY must be between 0 and 100.");a=o}},viewportAnchorX:{enumerable:!0,get:function(){return n},set:function(o){if(!Oi(o))throw new Error("ViewportAnchorX must be between 0 and 100.");n=o}},scroll:{enumerable:!0,get:function(){return s},set:function(o){var u,c=typeof(u=o)=="string"&&!!Gh[u.toLowerCase()]&&u.toLowerCase();if(c===!1)throw new SyntaxError("An invalid or illegal string was specified.");s=c}}})},Pi=Cr(function(i){var r=i.exports={WebVTT:Hh,VTTCue:Wh,VTTRegion:Xh};A.vttjs=r,A.WebVTT=r.WebVTT;var e=r.VTTCue,t=r.VTTRegion,n=A.VTTCue,a=A.VTTRegion;r.shim=function(){A.VTTCue=e,A.VTTRegion=t},r.restore=function(){A.VTTCue=n,A.VTTRegion=a},A.VTTCue||r.shim()});Pi.WebVTT,Pi.VTTCue,Pi.VTTRegion;var st=function(i){function r(t,n){var a;return t===void 0&&(t={}),n===void 0&&(n=function(){}),t.reportTouchActivity=!1,(a=i.call(this,null,t,n)||this).hasStarted_=!1,a.on("playing",function(){this.hasStarted_=!0}),a.on("loadstart",function(){this.hasStarted_=!1}),Rt.names.forEach(function(s){var o=Rt[s];t&&t[o.getterName]&&(a[o.privateName]=t[o.getterName])}),a.featuresProgressEvents||a.manualProgressOn(),a.featuresTimeupdateEvents||a.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(s){t["native"+s+"Tracks"]===!1&&(a["featuresNative"+s+"Tracks"]=!1)}),t.nativeCaptions===!1||t.nativeTextTracks===!1?a.featuresNativeTextTracks=!1:t.nativeCaptions!==!0&&t.nativeTextTracks!==!0||(a.featuresNativeTextTracks=!0),a.featuresNativeTextTracks||a.emulateTextTracks(),a.autoRemoteTextTracks_=new Rt.text.ListClass,a.initTrackListeners(),t.nativeControlsForTouch||a.emitTapEvents(),a.constructor&&(a.name_=a.constructor.name||"Unknown Tech"),a}F(r,i);var e=r.prototype;return e.triggerSourceset=function(t){var n=this;this.isReady_||this.one("ready",function(){return n.setTimeout(function(){return n.triggerSourceset(t)},1)}),this.trigger({src:t,type:"sourceset"})},e.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},e.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},e.trackProgress=function(t){this.stopTrackingProgress(),this.progressInterval=this.setInterval($(this,function(){var n=this.bufferedPercent();this.bufferedPercent_!==n&&this.trigger("progress"),(this.bufferedPercent_=n)===1&&this.stopTrackingProgress()}),500)},e.onDurationChange=function(t){this.duration_=this.duration()},e.buffered=function(){return Ue(0,0)},e.bufferedPercent=function(){return io(this.buffered(),this.duration_)},e.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},e.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},e.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},e.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},e.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},e.dispose=function(){this.clearTracks(Ht.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),i.prototype.dispose.call(this)},e.clearTracks=function(t){var n=this;(t=[].concat(t)).forEach(function(a){for(var s=n[a+"Tracks"]()||[],o=s.length;o--;){var u=s[o];a==="text"&&n.removeRemoteTextTrack(u),s.removeTrack(u)}})},e.cleanupAutoTextTracks=function(){for(var t=this.autoRemoteTextTracks_||[],n=t.length;n--;){var a=t[n];this.removeRemoteTextTrack(a)}},e.reset=function(){},e.error=function(t){return t!==void 0&&(this.error_=new wt(t),this.trigger("error")),this.error_},e.played=function(){return this.hasStarted_?Ue(0,0):Ue()},e.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},e.initTrackListeners=function(){var t=this;Ht.names.forEach(function(n){var a=Ht[n],s=function(){t.trigger(n+"trackchange")},o=t[a.getterName]();o.addEventListener("removetrack",s),o.addEventListener("addtrack",s),t.on("dispose",function(){o.removeEventListener("removetrack",s),o.removeEventListener("addtrack",s)})})},e.addWebVttScript_=function(){var t=this;if(!A.WebVTT)if(B.body.contains(this.el())){if(!this.options_["vtt.js"]&&di(Pi)&&0<Object.keys(Pi).length)return void this.trigger("vttjsloaded");var n=B.createElement("script");n.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",n.onload=function(){t.trigger("vttjsloaded")},n.onerror=function(){t.trigger("vttjserror")},this.on("dispose",function(){n.onload=null,n.onerror=null}),A.WebVTT=!0,this.el().parentNode.appendChild(n)}else this.ready(this.addWebVttScript_)},e.emulateTextTracks=function(){var t=this,n=this.textTracks(),a=this.remoteTextTracks(),s=function(d){return n.addTrack(d.track)},o=function(d){return n.removeTrack(d.track)};a.on("addtrack",s),a.on("removetrack",o),this.addWebVttScript_();var u=function(){return t.trigger("texttrackchange")},c=function(){u();for(var d=0;d<n.length;d++){var p=n[d];p.removeEventListener("cuechange",u),p.mode==="showing"&&p.addEventListener("cuechange",u)}};c(),n.addEventListener("change",c),n.addEventListener("addtrack",c),n.addEventListener("removetrack",c),this.on("dispose",function(){a.off("addtrack",s),a.off("removetrack",o),n.removeEventListener("change",c),n.removeEventListener("addtrack",c),n.removeEventListener("removetrack",c);for(var d=0;d<n.length;d++)n[d].removeEventListener("cuechange",u)})},e.addTextTrack=function(t,n,a){if(!t)throw new Error("TextTrack kind is required but was not provided");return function(s,o,u,c,d){d===void 0&&(d={});var p=s.textTracks();d.kind=o,u&&(d.label=u),c&&(d.language=c),d.tech=s;var g=new Rt.text.TrackClass(d);return p.addTrack(g),g}(this,t,n,a)},e.createRemoteTextTrack=function(t){var n=ot(t,{tech:this});return new Ci.remoteTextEl.TrackClass(n)},e.addRemoteTextTrack=function(t,n){var a=this;t===void 0&&(t={});var s=this.createRemoteTextTrack(t);return n!==!0&&n!==!1&&(Z.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),n=!0),this.remoteTextTrackEls().addTrackElement_(s),this.remoteTextTracks().addTrack(s.track),n!==!0&&this.ready(function(){return a.autoRemoteTextTracks_.addTrack(s.track)}),s},e.removeRemoteTextTrack=function(t){var n=this.remoteTextTrackEls().getTrackElementByTrack_(t);this.remoteTextTrackEls().removeTrackElement_(n),this.remoteTextTracks().removeTrack(t),this.autoRemoteTextTracks_.removeTrack(t)},e.getVideoPlaybackQuality=function(){return{}},e.setPoster=function(){},e.playsinline=function(){},e.setPlaysinline=function(){},e.overrideNativeAudioTracks=function(){},e.overrideNativeVideoTracks=function(){},e.canPlayType=function(){return""},r.canPlayType=function(){return""},r.canPlaySource=function(t,n){return r.canPlayType(t.type)},r.isTech=function(t){return t.prototype instanceof r||t instanceof r||t===r},r.registerTech=function(t,n){if(r.techs_||(r.techs_={}),!r.isTech(n))throw new Error("Tech "+t+" must be a Tech");if(!r.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!r.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return t=ft(t),r.techs_[t]=n,t!=="Tech"&&r.defaultTechOrder_.push(t),n},r.getTech=function(t){if(t)return t=ft(t),r.techs_&&r.techs_[t]?r.techs_[t]:A&&A.videojs&&A.videojs[t]?(Z.warn("The "+t+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),A.videojs[t]):void 0},r}(D);Rt.names.forEach(function(i){var r=Rt[i];st.prototype[r.getterName]=function(){return this[r.privateName]=this[r.privateName]||new r.ListClass,this[r.privateName]}}),st.prototype.featuresVolumeControl=!0,st.prototype.featuresMuteControl=!0,st.prototype.featuresFullscreenResize=!1,st.prototype.featuresPlaybackRate=!1,st.prototype.featuresProgressEvents=!1,st.prototype.featuresSourceset=!1,st.prototype.featuresTimeupdateEvents=!1,st.prototype.featuresNativeTextTracks=!1,st.withSourceHandlers=function(i){i.registerSourceHandler=function(r,e){var t=i.sourceHandlers;t||(t=i.sourceHandlers=[]),e===void 0&&(e=t.length),t.splice(e,0,r)},i.canPlayType=function(r){for(var e,t=i.sourceHandlers||[],n=0;n<t.length;n++)if(e=t[n].canPlayType(r))return e;return""},i.selectSourceHandler=function(r,e){for(var t=i.sourceHandlers||[],n=0;n<t.length;n++)if(t[n].canHandleSource(r,e))return t[n];return null},i.canPlaySource=function(r,e){var t=i.selectSourceHandler(r,e);return t?t.canHandleSource(r,e):""},["seekable","seeking","duration"].forEach(function(r){var e=this[r];typeof e=="function"&&(this[r]=function(){return this.sourceHandler_&&this.sourceHandler_[r]?this.sourceHandler_[r].apply(this.sourceHandler_,arguments):e.apply(this,arguments)})},i.prototype),i.prototype.setSource=function(r){var e=i.selectSourceHandler(r,this.options_);e||(i.nativeSourceHandler?e=i.nativeSourceHandler:Z.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler),e!==i.nativeSourceHandler&&(this.currentSource_=r),this.sourceHandler_=e.handleSource(r,this,this.options_),this.on("dispose",this.disposeSourceHandler)},i.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)}},D.registerComponent("Tech",st),st.registerTech("Tech",st),st.defaultTechOrder_=[];var Ie={},Pr={},cn={};function Yh(i,r,e){i.setTimeout(function(){return function t(n,a,s,o,u,c){n===void 0&&(n={}),a===void 0&&(a=[]),u===void 0&&(u=[]),c===void 0&&(c=!1);var d=a,p=d[0],g=d.slice(1);if(typeof p=="string")t(n,Ie[p],s,o,u,c);else if(p){var y=Qh(o,p);if(!y.setSource)return u.push(y),t(n,g,s,o,u,c);y.setSource(ct({},n),function(b,T){if(b)return t(n,g,s,o,u,c);u.push(y),t(T,n.type===T.type?g:Ie[T.type],s,o,u,c)})}else g.length?t(n,g,s,o,u,c):c?s(n,u):t(n,Ie["*"],s,o,u,!0)}(r,Ie[r.type],e,i)},1)}function ko(i,r,e,t){t===void 0&&(t=null);var n="call"+ft(e),a=i.reduce(Ur(n),t),s=a===cn,o=s?null:r[e](a);return function(u,c,d,p){for(var g=u.length-1;0<=g;g--){var y=u[g];y[c]&&y[c](p,d)}}(i,e,o,s),o}var $h={buffered:1,currentTime:1,duration:1,seekable:1,played:1,paused:1},Kh={setCurrentTime:1},wo={play:1,pause:1};function Ur(i){return function(r,e){return r===cn?cn:e[i]?e[i](r):r}}function Qh(i,r){var e=Pr[i.id()],t=null;if(e==null)return t=r(i),Pr[i.id()]=[[r,t]],t;for(var n=0;n<e.length;n++){var a=e[n],s=a[0],o=a[1];s===r&&(t=o)}return t===null&&(t=r(i),e.push([r,t])),t}var Jh={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",mp3:"audio/mpeg",aac:"audio/aac",oga:"audio/ogg",m3u8:"application/x-mpegURL"},Co=function(i){i===void 0&&(i="");var r=wr(i);return Jh[r.toLowerCase()]||""};function Eo(i){var r=Co(i.src);return!i.type&&r&&(i.type=r),i}var Zh=function(i){function r(e,t,n){var a,s=ot({createEl:!1},t);if(a=i.call(this,e,s,n)||this,t.playerOptions.sources&&t.playerOptions.sources.length!==0)e.src(t.playerOptions.sources);else for(var o=0,u=t.playerOptions.techOrder;o<u.length;o++){var c=ft(u[o]),d=st.getTech(c);if(c||(d=D.getComponent(c)),d&&d.isSupported()){e.loadTech_(c);break}}return a}return F(r,i),r}(D);D.registerComponent("MediaLoader",Zh);var hn=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).emitTapEvents(),a.enable(),a}F(r,i);var e=r.prototype;return e.createEl=function(t,n,a){t===void 0&&(t="div"),n===void 0&&(n={}),a===void 0&&(a={}),n=ct({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass(),tabIndex:0},n),t==="button"&&Z.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead."),a=ct({role:"button"},a),this.tabIndex_=n.tabIndex;var s=i.prototype.createEl.call(this,t,n,a);return this.createControlTextEl(s),s},e.dispose=function(){this.controlTextEl_=null,i.prototype.dispose.call(this)},e.createControlTextEl=function(t){return this.controlTextEl_=yt("span",{className:"vjs-control-text"},{"aria-live":"polite"}),t&&t.appendChild(this.controlTextEl_),this.controlText(this.controlText_,t),this.controlTextEl_},e.controlText=function(t,n){if(n===void 0&&(n=this.el()),t===void 0)return this.controlText_||"Need Text";var a=this.localize(t);this.controlText_=t,qe(this.controlTextEl_,a),this.nonIconControl||n.setAttribute("title",a)},e.buildCSSClass=function(){return"vjs-control vjs-button "+i.prototype.buildCSSClass.call(this)},e.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_!="undefined"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur))},e.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_!="undefined"&&this.el_.removeAttribute("tabIndex"),this.off(["tap","click"],this.handleClick),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur)},e.handleClick=function(t){},e.handleFocus=function(t){Yt(B,"keydown",$(this,this.handleKeyPress))},e.handleKeyPress=function(t){t.which===32||t.which===13?(t.preventDefault(),this.trigger("click")):i.prototype.handleKeyPress&&i.prototype.handleKeyPress.call(this,t)},e.handleBlur=function(t){Dt(B,"keydown",$(this,this.handleKeyPress))},r}(D);D.registerComponent("ClickableComponent",hn);var td=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).update(),t.on("posterchange",$(V(V(a)),a.update)),a}F(r,i);var e=r.prototype;return e.dispose=function(){this.player().off("posterchange",this.update),i.prototype.dispose.call(this)},e.createEl=function(){return yt("div",{className:"vjs-poster",tabIndex:-1})},e.update=function(t){var n=this.player().poster();this.setSrc(n),n?this.show():this.hide()},e.setSrc=function(t){var n="";t&&(n='url("'+t+'")'),this.el_.style.backgroundImage=n},e.handleClick=function(t){this.player_.controls()&&(this.player_.paused()?Si(this.player_.play()):this.player_.pause())},r}(hn);D.registerComponent("PosterImage",td);var dn="#222",ed={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 Ir(i,r){var e;if(i.length===4)e=i[1]+i[1]+i[2]+i[2]+i[3]+i[3];else{if(i.length!==7)throw new Error("Invalid color code provided, "+i+"; must be formatted as e.g. #f0e or #f604e2.");e=i.slice(1)}return"rgba("+parseInt(e.slice(0,2),16)+","+parseInt(e.slice(2,4),16)+","+parseInt(e.slice(4,6),16)+","+r+")"}function xr(i,r,e){try{i.style[r]=e}catch(t){return}}var id=function(i){function r(t,n,a){var s;s=i.call(this,t,n,a)||this;var o=$(V(V(s)),s.updateDisplay);return t.on("loadstart",$(V(V(s)),s.toggleDisplay)),t.on("texttrackchange",o),t.on("loadedmetadata",$(V(V(s)),s.preselectTrack)),t.ready($(V(V(s)),function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",o),t.on("playerresize",o),A.addEventListener("orientationchange",o),t.on("dispose",function(){return A.removeEventListener("orientationchange",o)});for(var u=this.options_.playerOptions.tracks||[],c=0;c<u.length;c++)this.player_.addRemoteTextTrack(u[c],!0);this.preselectTrack()}})),s}F(r,i);var e=r.prototype;return e.preselectTrack=function(){for(var t,n,a,s={captions:1,subtitles:1},o=this.player_.textTracks(),u=this.player_.cache_.selectedLanguage,c=0;c<o.length;c++){var d=o[c];u&&u.enabled&&u.language&&u.language===d.language&&d.kind in s?d.kind===u.kind?a=d:a||(a=d):u&&!u.enabled?n=t=a=null:d.default&&(d.kind!=="descriptions"||t?d.kind in s&&!n&&(n=d):t=d)}a?a.mode="showing":n?n.mode="showing":t&&(t.mode="showing")},e.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},e.clearDisplay=function(){typeof A.WebVTT=="function"&&A.WebVTT.processCues(A,[],this.el_)},e.updateDisplay=function(){var t=this.player_.textTracks();this.clearDisplay();for(var n=null,a=null,s=t.length;s--;){var o=t[s];o.mode==="showing"&&(o.kind==="descriptions"?n=o:a=o)}a?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(a)):n&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(n))},e.updateForTrack=function(t){if(typeof A.WebVTT=="function"&&t.activeCues){for(var n=[],a=0;a<t.activeCues.length;a++)n.push(t.activeCues[a]);if(A.WebVTT.processCues(A,n,this.el_),this.player_.textTrackSettings)for(var s=this.player_.textTrackSettings.getValues(),o=n.length;o--;){var u=n[o];if(u){var c=u.displayState;if(s.color&&(c.firstChild.style.color=s.color),s.textOpacity&&xr(c.firstChild,"color",Ir(s.color||"#fff",s.textOpacity)),s.backgroundColor&&(c.firstChild.style.backgroundColor=s.backgroundColor),s.backgroundOpacity&&xr(c.firstChild,"backgroundColor",Ir(s.backgroundColor||"#000",s.backgroundOpacity)),s.windowColor&&(s.windowOpacity?xr(c,"backgroundColor",Ir(s.windowColor,s.windowOpacity)):c.style.backgroundColor=s.windowColor),s.edgeStyle&&(s.edgeStyle==="dropshadow"?c.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px "+dn:s.edgeStyle==="raised"?c.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px "+dn:s.edgeStyle==="depressed"?c.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px "+dn:s.edgeStyle==="uniform"&&(c.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px "+dn)),s.fontPercent&&s.fontPercent!==1){var d=A.parseFloat(c.style.fontSize);c.style.fontSize=d*s.fontPercent+"px",c.style.height="auto",c.style.top="auto",c.style.bottom="2px"}s.fontFamily&&s.fontFamily!=="default"&&(s.fontFamily==="small-caps"?c.firstChild.style.fontVariant="small-caps":c.firstChild.style.fontFamily=ed[s.fontFamily])}}}},r}(D);D.registerComponent("TextTrackDisplay",id);var nd=function(i){function r(){return i.apply(this,arguments)||this}return F(r,i),r.prototype.createEl=function(){var e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),n=yt("span",{className:"vjs-control-text",innerHTML:this.localize("",[t])}),a=i.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return a.appendChild(n),a},r}(D);D.registerComponent("LoadingSpinner",nd);var re=function(i){function r(){return i.apply(this,arguments)||this}F(r,i);var e=r.prototype;return e.createEl=function(t,n,a){n===void 0&&(n={}),a===void 0&&(a={}),n=ct({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass()},n),a=ct({type:"button"},a);var s=D.prototype.createEl.call(this,"button",n,a);return this.createControlTextEl(s),s},e.addChild=function(t,n){n===void 0&&(n={});var a=this.constructor.name;return Z.warn("Adding an actionable (user controllable) child to a Button ("+a+") is not supported; use a ClickableComponent instead."),D.prototype.addChild.call(this,t,n)},e.enable=function(){i.prototype.enable.call(this),this.el_.removeAttribute("disabled")},e.disable=function(){i.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},e.handleKeyPress=function(t){t.which!==32&&t.which!==13&&i.prototype.handleKeyPress.call(this,t)},r}(hn);D.registerComponent("Button",re);var Ao=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).mouseused_=!1,a.on("mousedown",a.handleMouseDown),a}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-big-play-button"},e.handleClick=function(t){var n=this.player_.play();if(this.mouseused_&&t.clientX&&t.clientY)Si(n);else{var a=this.player_.getChild("controlBar"),s=a&&a.getChild("playToggle");if(s){var o=function(){return s.focus()};no(n)?n.then(o,function(){}):this.setTimeout(o,1)}else this.player_.focus()}},e.handleKeyPress=function(t){this.mouseused_=!1,i.prototype.handleKeyPress.call(this,t)},e.handleMouseDown=function(t){this.mouseused_=!0},r}(re);Ao.prototype.controlText_="Play Video",D.registerComponent("BigPlayButton",Ao);var rd=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).controlText(n&&n.controlText||a.localize("Close")),a}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-close-button "+i.prototype.buildCSSClass.call(this)},e.handleClick=function(t){this.trigger({type:"close",bubbles:!1})},r}(re);D.registerComponent("CloseButton",rd);var Lo=function(i){function r(t,n){var a;return n===void 0&&(n={}),a=i.call(this,t,n)||this,n.replay=n.replay===void 0||n.replay,a.on(t,"play",a.handlePlay),a.on(t,"pause",a.handlePause),n.replay&&a.on(t,"ended",a.handleEnded),a}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-play-control "+i.prototype.buildCSSClass.call(this)},e.handleClick=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.handleSeeked=function(t){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(t):this.handlePlay(t)},e.handlePlay=function(t){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},e.handlePause=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},e.handleEnded=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},r}(re);Lo.prototype.controlText_="Play",D.registerComponent("PlayToggle",Lo);var Oo=function(i,r){i=i<0?0:i;var e=Math.floor(i%60),t=Math.floor(i/60%60),n=Math.floor(i/3600),a=Math.floor(r/60%60),s=Math.floor(r/3600);return(isNaN(i)||i===1/0)&&(n=t=e="-"),(n=0<n||0<s?n+":":"")+(t=((n||10<=a)&&t<10?"0"+t:t)+":")+(e=e<10?"0"+e:e)},Dr=Oo;function Qe(i,r){return r===void 0&&(r=i),Dr(i,r)}var Je=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).throttledUpdateContent=Ge($(V(V(a)),a.updateContent),25),a.on(t,"timeupdate",a.throttledUpdateContent),a}F(r,i);var e=r.prototype;return e.createEl=function(t){var n=this.buildCSSClass(),a=i.prototype.createEl.call(this,"div",{className:n+" vjs-time-control vjs-control",innerHTML:'<span class="vjs-control-text" role="presentation">'+this.localize(this.labelText_)+"\xA0</span>"});return this.contentEl_=yt("span",{className:n+"-display"},{"aria-live":"off",role:"presentation"}),this.updateTextNode_(),a.appendChild(this.contentEl_),a},e.dispose=function(){this.contentEl_=null,this.textNode_=null,i.prototype.dispose.call(this)},e.updateTextNode_=function(){if(this.contentEl_){for(;this.contentEl_.firstChild;)this.contentEl_.removeChild(this.contentEl_.firstChild);this.textNode_=B.createTextNode(this.formattedTime_||this.formatTime_(0)),this.contentEl_.appendChild(this.textNode_)}},e.formatTime_=function(t){return Qe(t)},e.updateFormattedTime_=function(t){var n=this.formatTime_(t);n!==this.formattedTime_&&(this.formattedTime_=n,this.requestAnimationFrame(this.updateTextNode_))},e.updateContent=function(t){},r}(D);Je.prototype.labelText_="Time",Je.prototype.controlText_="Time",D.registerComponent("TimeDisplay",Je);var Rr=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).on(t,"ended",a.handleEnded),a}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-current-time"},e.updateContent=function(t){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(n)},e.handleEnded=function(t){this.player_.duration()&&this.updateFormattedTime_(this.player_.duration())},r}(Je);Rr.prototype.labelText_="Current Time",Rr.prototype.controlText_="Current Time",D.registerComponent("CurrentTimeDisplay",Rr);var Mr=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).on(t,"durationchange",a.updateContent),a.on(t,"loadstart",a.updateContent),a.on(t,"loadedmetadata",a.throttledUpdateContent),a}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-duration"},e.updateContent=function(t){var n=this.player_.duration();this.duration_!==n&&(this.duration_=n,this.updateFormattedTime_(n))},r}(Je);Mr.prototype.labelText_="Duration",Mr.prototype.controlText_="Duration",D.registerComponent("DurationDisplay",Mr);var ad=function(i){function r(){return i.apply(this,arguments)||this}return F(r,i),r.prototype.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/</span></div>"},{"aria-hidden":!0})},r}(D);D.registerComponent("TimeDivider",ad);var Br=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).on(t,"durationchange",a.throttledUpdateContent),a.on(t,"ended",a.handleEnded),a}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-remaining-time"},e.formatTime_=function(t){return"-"+i.prototype.formatTime_.call(this,t)},e.updateContent=function(t){this.player_.duration()&&(this.player_.remainingTimeDisplay?this.updateFormattedTime_(this.player_.remainingTimeDisplay()):this.updateFormattedTime_(this.player_.remainingTime()))},e.handleEnded=function(t){this.player_.duration()&&this.updateFormattedTime_(0)},r}(Je);Br.prototype.labelText_="Remaining Time",Br.prototype.controlText_="Remaining Time",D.registerComponent("RemainingTimeDisplay",Br);var sd=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).updateShowing(),a.on(a.player(),"durationchange",a.updateShowing),a}F(r,i);var e=r.prototype;return e.createEl=function(){var t=i.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=yt("div",{className:"vjs-live-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Stream Type")+"\xA0</span>"+this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},e.dispose=function(){this.contentEl_=null,i.prototype.dispose.call(this)},e.updateShowing=function(t){this.player().duration()===1/0?this.show():this.hide()},r}(D);D.registerComponent("LiveDisplay",sd);var Po=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).updateLiveEdgeStatus(),a.player_.liveTracker&&a.on(a.player_.liveTracker,"liveedgechange",a.updateLiveEdgeStatus),a}F(r,i);var e=r.prototype;return e.createEl=function(){var t=i.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=yt("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},e.updateLiveEdgeStatus=function(t){!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"))},e.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},e.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatus),this.textEl_=null,i.prototype.dispose.call(this)},r}(re);Po.prototype.controlText_="Seek to live, currently playing live",D.registerComponent("SeekToLive",Po);var Nr=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).bar=a.getChild(a.options_.barName),a.vertical(!!a.options_.vertical),a.enable(),a}F(r,i);var e=r.prototype;return e.enabled=function(){return this.enabled_},e.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown),this.on("touchstart",this.handleMouseDown),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur),this.on("click",this.handleClick),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},e.disable=function(){if(this.enabled()){var t=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown),this.off("touchstart",this.handleMouseDown),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur),this.off("click",this.handleClick),this.off(this.player_,"controlsvisible",this.update),this.off(t,"mousemove",this.handleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchmove",this.handleMouseMove),this.off(t,"touchend",this.handleMouseUp),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},e.createEl=function(t,n,a){return n===void 0&&(n={}),a===void 0&&(a={}),n.className=n.className+" vjs-slider",n=ct({tabIndex:0},n),a=ct({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},a),i.prototype.createEl.call(this,t,n,a)},e.handleMouseDown=function(t){var n=this.bar.el_.ownerDocument;t.type==="mousedown"&&t.preventDefault(),t.type!=="touchstart"||be||t.preventDefault(),Ls(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(n,"mousemove",this.handleMouseMove),this.on(n,"mouseup",this.handleMouseUp),this.on(n,"touchmove",this.handleMouseMove),this.on(n,"touchend",this.handleMouseUp),this.handleMouseMove(t)},e.handleMouseMove=function(t){},e.handleMouseUp=function(){var t=this.bar.el_.ownerDocument;Os(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchmove",this.handleMouseMove),this.off(t,"touchend",this.handleMouseUp),this.update()},e.update=function(){if(this.el_){var t=this.getPercent(),n=this.bar;if(n){(typeof t!="number"||t!=t||t<0||t===1/0)&&(t=0);var a=(100*t).toFixed(2)+"%",s=n.el().style;return this.vertical()?s.height=a:s.width=a,t}}},e.calculateDistance=function(t){var n=er(this.el_,t);return this.vertical()?n.y:n.x},e.handleFocus=function(){this.on(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},e.handleKeyPress=function(t){t.which===37||t.which===40?(t.preventDefault(),this.stepBack()):t.which!==38&&t.which!==39||(t.preventDefault(),this.stepForward())},e.handleBlur=function(){this.off(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},e.handleClick=function(t){t.stopImmediatePropagation(),t.preventDefault()},e.vertical=function(t){if(t===void 0)return this.vertical_||!1;this.vertical_=!!t,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},r}(D);D.registerComponent("Slider",Nr);var od=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).partEls_=[],a.on(t,"progress",a.update),a}F(r,i);var e=r.prototype;return e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Loaded")+'</span>: <span class="vjs-control-text-loaded-percentage">0%</span></span>'})},e.dispose=function(){this.partEls_=null,i.prototype.dispose.call(this)},e.update=function(t){var n=this.player_.liveTracker,a=this.player_.buffered(),s=n&&n.isLive()?n.seekableEnd():this.player_.duration(),o=this.player_.bufferedEnd(),u=this.partEls_,c=this.$(".vjs-control-text-loaded-percentage"),d=function(S,C,E){var U=S/C||0;return U=100*(1<=U?1:U),E&&(U=U.toFixed(2)),U+"%"};this.el_.style.width=d(o,s),qe(c,d(o,s,!0));for(var p=0;p<a.length;p++){var g=a.start(p),y=a.end(p),b=u[p];b||(b=this.el_.appendChild(yt()),u[p]=b),b.style.left=d(g,o),b.style.width=d(y-g,o)}for(var T=u.length;T>a.length;T--)this.el_.removeChild(u[T-1]);u.length=a.length},r}(D);D.registerComponent("LoadProgressBar",od);var ud=function(i){function r(){return i.apply(this,arguments)||this}F(r,i);var e=r.prototype;return e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},e.update=function(t,n,a){var s=gi(this.el_),o=gi(this.player_.el()),u=t.width*n;if(o&&s){var c=t.left-o.left+u,d=t.width-u+(o.right-t.right),p=s.width/2;c<p?p+=p-c:d<p&&(p=d),p<0?p=0:p>s.width&&(p=s.width),this.el_.style.right="-"+p+"px",qe(this.el_,a)}},e.updateTime=function(t,n,a,s){var o=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var u,c=o.player_.duration();if(o.player_.liveTracker&&o.player_.liveTracker.isLive()){var d=o.player_.liveTracker.liveWindow(),p=d-n*d;u=(p<1?"":"-")+Qe(p,d)}else u=Qe(a,c);o.update(t,n,u),s&&s()})},r}(D);D.registerComponent("TimeTooltip",ud);var jr=function(i){function r(){return i.apply(this,arguments)||this}F(r,i);var e=r.prototype;return e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},e.update=function(t,n){var a=this.getChild("timeTooltip");if(a){var s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();a.updateTime(t,n,s)}},r}(D);jr.prototype.options_={children:[]},ue||Pe||jr.prototype.options_.children.push("timeTooltip"),D.registerComponent("PlayProgressBar",jr);var Uo=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).update=Ge($(V(V(a)),a.update),25),a}F(r,i);var e=r.prototype;return e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},e.update=function(t,n){var a=this,s=n*this.player_.duration();this.getChild("timeTooltip").updateTime(t,n,s,function(){a.el_.style.left=t.width*n+"px"})},r}(D);Uo.prototype.options_={children:["timeTooltip"]},D.registerComponent("MouseTimeDisplay",Uo);var pn=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).setEventHandlers_(),a}F(r,i);var e=r.prototype;return e.setEventHandlers_=function(){var t=this;this.update=Ge($(this,this.update),30),this.on(this.player_,"timeupdate",this.update),this.on(this.player_,"ended",this.handleEnded),this.on(this.player_,"durationchange",this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.on(this.player_,["playing"],function(){t.clearInterval(t.updateInterval),t.updateInterval=t.setInterval(function(){t.requestAnimationFrame(function(){t.update()})},30)}),this.on(this.player_,["ended","pause","waiting"],function(n){t.player_.liveTracker&&t.player_.liveTracker.isLive()&&n.type!=="ended"||t.clearInterval(t.updateInterval)}),this.on(this.player_,["timeupdate","ended"],this.update)},e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},e.update_=function(t,n){var a=this.player_.liveTracker,s=this.player_.duration();a&&a.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),a&&a.seekableEnd()===1/0?this.disable():this.enable(),this.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Qe(t,s),Qe(s,s)],"{1} of {2}")),this.bar.update(gi(this.el_),n)},e.update=function(t){var n=i.prototype.update.call(this);return this.update_(this.getCurrentTime_(),n),n},e.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},e.handleEnded=function(t){this.update_(this.player_.duration(),1)},e.getPercent=function(){var t,n=this.getCurrentTime_(),a=this.player_.liveTracker;return a&&a.isLive()?(t=(n-a.seekableStart())/a.liveWindow(),a.atLiveEdge()&&(t=1)):t=n/this.player_.duration(),1<=t?1:t||0},e.handleMouseDown=function(t){ze(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),i.prototype.handleMouseDown.call(this,t))},e.handleMouseMove=function(t){if(ze(t)){var n,a=this.calculateDistance(t),s=this.player_.liveTracker;if(s&&s.isLive()){var o=s.seekableStart(),u=s.liveCurrentTime();if(u<=(n=o+a*s.liveWindow())&&(n=u),n<=o&&(n=o+.1),n===1/0)return}else(n=a*this.player_.duration())===this.player_.duration()&&(n-=.1);this.player_.currentTime(n)}},e.enable=function(){i.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},e.disable=function(){i.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},e.handleMouseUp=function(t){i.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying&&Si(this.player_.play())},e.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},e.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},e.handleAction=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.handleKeyPress=function(t){t.which===32||t.which===13?(t.preventDefault(),this.handleAction(t)):i.prototype.handleKeyPress&&i.prototype.handleKeyPress.call(this,t)},r}(Nr);pn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},ue||Pe||pn.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),pn.prototype.playerEvent="timeupdate",D.registerComponent("SeekBar",pn);var Io=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).handleMouseMove=Ge($(V(V(a)),a.handleMouseMove),25),a.throttledHandleMouseSeek=Ge($(V(V(a)),a.handleMouseSeek),25),a.enable(),a}F(r,i);var e=r.prototype;return e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},e.handleMouseMove=function(t){var n=this.getChild("seekBar");if(n){var a=n.getChild("mouseTimeDisplay"),s=n.el(),o=gi(s),u=er(s,t).x;1<u?u=1:u<0&&(u=0),a&&a.update(o,u)}},e.handleMouseSeek=function(t){var n=this.getChild("seekBar");n&&n.handleMouseMove(t)},e.enabled=function(){return this.enabled_},e.disable=function(){this.children().forEach(function(t){return t.disable&&t.disable()}),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},e.enable=function(){this.children().forEach(function(t){return t.enable&&t.enable()}),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},e.handleMouseDown=function(t){var n=this.el_.ownerDocument,a=this.getChild("seekBar");a&&a.handleMouseDown(t),this.on(n,"mousemove",this.throttledHandleMouseSeek),this.on(n,"touchmove",this.throttledHandleMouseSeek),this.on(n,"mouseup",this.handleMouseUp),this.on(n,"touchend",this.handleMouseUp)},e.handleMouseUp=function(t){var n=this.el_.ownerDocument,a=this.getChild("seekBar");a&&a.handleMouseUp(t),this.off(n,"mousemove",this.throttledHandleMouseSeek),this.off(n,"touchmove",this.throttledHandleMouseSeek),this.off(n,"mouseup",this.handleMouseUp),this.off(n,"touchend",this.handleMouseUp)},r}(D);Io.prototype.options_={children:["seekBar"]},D.registerComponent("ProgressControl",Io);var xo=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).on(t,"fullscreenchange",a.handleFullscreenChange),B[rn.fullscreenEnabled]===!1&&a.disable(),a}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-fullscreen-control "+i.prototype.buildCSSClass.call(this)},e.handleFullscreenChange=function(t){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},e.handleClick=function(t){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},r}(re);xo.prototype.controlText_="Fullscreen",D.registerComponent("FullscreenToggle",xo);var ld=function(i){function r(){return i.apply(this,arguments)||this}return F(r,i),r.prototype.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})},r}(D);D.registerComponent("VolumeLevel",ld);var Fr=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).on("slideractive",a.updateLastVolume_),a.on(t,"volumechange",a.updateARIAAttributes),t.ready(function(){return a.updateARIAAttributes()}),a}F(r,i);var e=r.prototype;return e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},e.handleMouseDown=function(t){ze(t)&&i.prototype.handleMouseDown.call(this,t)},e.handleMouseMove=function(t){ze(t)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(t)))},e.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},e.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},e.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},e.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},e.updateARIAAttributes=function(t){var n=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",n),this.el_.setAttribute("aria-valuetext",n+"%")},e.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},e.updateLastVolume_=function(){var t=this,n=this.player_.volume();this.one("sliderinactive",function(){t.player_.volume()===0&&t.player_.lastVolume_(n)})},r}(Nr);Fr.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},Fr.prototype.playerEvent="volumechange",D.registerComponent("VolumeBar",Fr);var Do=function(i){function r(t,n){var a,s,o;return n===void 0&&(n={}),n.vertical=n.vertical||!1,(typeof n.volumeBar=="undefined"||di(n.volumeBar))&&(n.volumeBar=n.volumeBar||{},n.volumeBar.vertical=n.vertical),a=i.call(this,t,n)||this,s=V(V(a)),(o=t).tech_&&!o.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(o,"loadstart",function(){o.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")}),a.throttledHandleMouseMove=Ge($(V(V(a)),a.handleMouseMove),25),a.on("mousedown",a.handleMouseDown),a.on("touchstart",a.handleMouseDown),a.on(a.volumeBar,["focus","slideractive"],function(){a.volumeBar.addClass("vjs-slider-active"),a.addClass("vjs-slider-active"),a.trigger("slideractive")}),a.on(a.volumeBar,["blur","sliderinactive"],function(){a.volumeBar.removeClass("vjs-slider-active"),a.removeClass("vjs-slider-active"),a.trigger("sliderinactive")}),a}F(r,i);var e=r.prototype;return e.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),i.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},e.handleMouseDown=function(t){var n=this.el_.ownerDocument;this.on(n,"mousemove",this.throttledHandleMouseMove),this.on(n,"touchmove",this.throttledHandleMouseMove),this.on(n,"mouseup",this.handleMouseUp),this.on(n,"touchend",this.handleMouseUp)},e.handleMouseUp=function(t){var n=this.el_.ownerDocument;this.off(n,"mousemove",this.throttledHandleMouseMove),this.off(n,"touchmove",this.throttledHandleMouseMove),this.off(n,"mouseup",this.handleMouseUp),this.off(n,"touchend",this.handleMouseUp)},e.handleMouseMove=function(t){this.volumeBar.handleMouseMove(t)},r}(D);Do.prototype.options_={children:["volumeBar"]},D.registerComponent("VolumeControl",Do);var Ro=function(i){function r(t,n){var a,s,o;return a=i.call(this,t,n)||this,s=V(V(a)),(o=t).tech_&&!o.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(o,"loadstart",function(){o.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")}),a.on(t,["loadstart","volumechange"],a.update),a}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-mute-control "+i.prototype.buildCSSClass.call(this)},e.handleClick=function(t){var n=this.player_.volume(),a=this.player_.lastVolume_();if(n===0){var s=a<.1?.1:a;this.player_.volume(s),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},e.update=function(t){this.updateIcon_(),this.updateControlText_()},e.updateIcon_=function(){var t=this.player_.volume(),n=3;ue&&this.player_.muted(this.player_.tech_.el_.muted),t===0||this.player_.muted()?n=0:t<.33?n=1:t<.67&&(n=2);for(var a=0;a<4;a++)fi(this.el_,"vjs-vol-"+a);Ee(this.el_,"vjs-vol-"+n)},e.updateControlText_=function(){var t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)},r}(re);Ro.prototype.controlText_="Mute",D.registerComponent("MuteToggle",Ro);var Mo=function(i){function r(t,n){var a;return n===void 0&&(n={}),typeof n.inline!="undefined"?n.inline=n.inline:n.inline=!0,(typeof n.volumeControl=="undefined"||di(n.volumeControl))&&(n.volumeControl=n.volumeControl||{},n.volumeControl.vertical=!n.inline),(a=i.call(this,t,n)||this).on(t,["loadstart"],a.volumePanelState_),a.on(a.volumeControl,["slideractive"],a.sliderActive_),a.on(a.volumeControl,["sliderinactive"],a.sliderInactive_),a}F(r,i);var e=r.prototype;return e.sliderActive_=function(){this.addClass("vjs-slider-active")},e.sliderInactive_=function(){this.removeClass("vjs-slider-active")},e.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")},e.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),i.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},r}(D);Mo.prototype.options_={children:["muteToggle","volumeControl"]},D.registerComponent("VolumePanel",Mo);var Vr=function(i){function r(t,n){var a;return a=i.call(this,t,n)||this,n&&(a.menuButton_=n.menuButton),a.focusedChild_=-1,a.on("keydown",a.handleKeyPress),a}F(r,i);var e=r.prototype;return e.addItem=function(t){this.addChild(t),t.on("blur",$(this,this.handleBlur)),t.on(["tap","click"],$(this,function(n){this.menuButton_&&(this.menuButton_.unpressButton(),t.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus())}))},e.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=yt(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var n=i.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return n.appendChild(this.contentEl_),Yt(n,"click",function(a){a.preventDefault(),a.stopImmediatePropagation()}),n},e.dispose=function(){this.contentEl_=null,i.prototype.dispose.call(this)},e.handleBlur=function(t){var n=t.relatedTarget||B.activeElement;if(!this.children().some(function(s){return s.el()===n})){var a=this.menuButton_;a&&a.buttonPressed_&&n!==a.el().firstChild&&a.unpressButton()}},e.handleKeyPress=function(t){t.which===37||t.which===40?(t.preventDefault(),this.stepForward()):t.which!==38&&t.which!==39||(t.preventDefault(),this.stepBack())},e.stepForward=function(){var t=0;this.focusedChild_!==void 0&&(t=this.focusedChild_+1),this.focus(t)},e.stepBack=function(){var t=0;this.focusedChild_!==void 0&&(t=this.focusedChild_-1),this.focus(t)},e.focus=function(t){t===void 0&&(t=0);var n=this.children().slice();n.length&&n[0].className&&/vjs-menu-title/.test(n[0].className)&&n.shift(),0<n.length&&(t<0?t=0:t>=n.length&&(t=n.length-1),n[this.focusedChild_=t].el_.focus())},r}(D);D.registerComponent("Menu",Vr);var Hr=function(i){function r(t,n){var a;n===void 0&&(n={}),(a=i.call(this,t,n)||this).menuButton_=new re(t,n),a.menuButton_.controlText(a.controlText_),a.menuButton_.el_.setAttribute("aria-haspopup","true");var s=re.prototype.buildCSSClass();return a.menuButton_.el_.className=a.buildCSSClass()+" "+s,a.menuButton_.removeClass("vjs-control"),a.addChild(a.menuButton_),a.update(),a.enabled_=!0,a.on(a.menuButton_,"tap",a.handleClick),a.on(a.menuButton_,"click",a.handleClick),a.on(a.menuButton_,"focus",a.handleFocus),a.on(a.menuButton_,"blur",a.handleBlur),a.on(a.menuButton_,"mouseenter",function(){a.menu.show()}),a.on("keydown",a.handleSubmenuKeyPress),a}F(r,i);var e=r.prototype;return e.update=function(){var t=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=t,this.addChild(t),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},e.createMenu=function(){var t=new Vr(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var n=yt("li",{className:"vjs-menu-title",innerHTML:ft(this.options_.title),tabIndex:-1});this.hideThreshold_+=1,t.children_.unshift(n),Ji(n,t.contentEl())}if(this.items=this.createItems(),this.items)for(var a=0;a<this.items.length;a++)t.addItem(this.items[a]);return t},e.createItems=function(){},e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},e.buildWrapperCSSClass=function(){var t="vjs-menu-button";return this.options_.inline===!0?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+re.prototype.buildCSSClass()+" "+i.prototype.buildCSSClass.call(this)},e.buildCSSClass=function(){var t="vjs-menu-button";return this.options_.inline===!0?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+i.prototype.buildCSSClass.call(this)},e.controlText=function(t,n){return n===void 0&&(n=this.menuButton_.el()),this.menuButton_.controlText(t,n)},e.handleClick=function(t){this.buttonPressed_?this.unpressButton():this.pressButton()},e.focus=function(){this.menuButton_.focus()},e.blur=function(){this.menuButton_.blur()},e.handleFocus=function(){Yt(B,"keydown",$(this,this.handleKeyPress))},e.handleBlur=function(){Dt(B,"keydown",$(this,this.handleKeyPress))},e.handleKeyPress=function(t){t.which===27||t.which===9?(this.buttonPressed_&&this.unpressButton(),t.which!==9&&(t.preventDefault(),this.menuButton_.el_.focus())):t.which!==13&&t.which!==38&&t.which!==40||this.buttonPressed_||(this.pressButton(),t.preventDefault())},e.handleSubmenuKeyPress=function(t){t.which!==27&&t.which!==9||(this.buttonPressed_&&this.unpressButton(),t.which!==9&&(t.preventDefault(),this.menuButton_.el_.focus()))},e.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),ue&&ks())return;this.menu.focus()}},e.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},e.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},e.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},r}(D);D.registerComponent("MenuButton",Hr);var qr=function(i){function r(e,t){var n,a=t.tracks;if((n=i.call(this,e,t)||this).items.length<=1&&n.hide(),!a)return V(n);var s=$(V(V(n)),n.update);return a.addEventListener("removetrack",s),a.addEventListener("addtrack",s),n.player_.on("ready",s),n.player_.on("dispose",function(){a.removeEventListener("removetrack",s),a.removeEventListener("addtrack",s)}),n}return F(r,i),r}(Hr);D.registerComponent("TrackButton",qr);var Ui=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).selectable=n.selectable,a.isSelected_=n.selected||!1,a.multiSelectable=n.multiSelectable,a.selected(a.isSelected_),a.selectable?a.multiSelectable?a.el_.setAttribute("role","menuitemcheckbox"):a.el_.setAttribute("role","menuitemradio"):a.el_.setAttribute("role","menuitem"),a}F(r,i);var e=r.prototype;return e.createEl=function(t,n,a){return this.nonIconControl=!0,i.prototype.createEl.call(this,"li",ct({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"</span>",tabIndex:-1},n),a)},e.handleClick=function(t){this.selected(!0)},e.selected=function(t){this.selectable&&(this.isSelected_=t?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),!1))},r}(hn);D.registerComponent("MenuItem",Ui);var Ii=function(i){function r(t,n){var a,s=n.track,o=t.textTracks();n.label=s.label||s.language||"Unknown",n.selected=s.mode==="showing",(a=i.call(this,t,n)||this).track=s;var u,c=function(){for(var p=arguments.length,g=new Array(p),y=0;y<p;y++)g[y]=arguments[y];a.handleTracksChange.apply(V(V(a)),g)},d=function(){for(var p=arguments.length,g=new Array(p),y=0;y<p;y++)g[y]=arguments[y];a.handleSelectedLanguageChange.apply(V(V(a)),g)};return t.on(["loadstart","texttrackchange"],c),o.addEventListener("change",c),o.addEventListener("selectedlanguagechange",d),a.on("dispose",function(){t.off(["loadstart","texttrackchange"],c),o.removeEventListener("change",c),o.removeEventListener("selectedlanguagechange",d)}),o.onchange===void 0&&a.on(["tap","click"],function(){if(typeof A.Event!="object")try{u=new A.Event("change")}catch(p){}u||(u=B.createEvent("Event")).initEvent("change",!0,!0),o.dispatchEvent(u)}),a.handleTracksChange(),a}F(r,i);var e=r.prototype;return e.handleClick=function(t){var n=this.track.kind,a=this.track.kinds,s=this.player_.textTracks();if(a||(a=[n]),i.prototype.handleClick.call(this,t),s)for(var o=0;o<s.length;o++){var u=s[o];u===this.track&&-1<a.indexOf(u.kind)?u.mode!=="showing"&&(u.mode="showing"):u.mode!=="disabled"&&(u.mode="disabled")}},e.handleTracksChange=function(t){var n=this.track.mode==="showing";n!==this.isSelected_&&this.selected(n)},e.handleSelectedLanguageChange=function(t){if(this.track.mode==="showing"){var n=this.player_.cache_.selectedLanguage;if(n&&n.enabled&&n.language===this.track.language&&n.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},e.dispose=function(){this.track=null,i.prototype.dispose.call(this)},r}(Ui);D.registerComponent("TextTrackMenuItem",Ii);var Bo=function(i){function r(t,n){return n.track={player:t,kind:n.kind,kinds:n.kinds,default:!1,mode:"disabled"},n.kinds||(n.kinds=[n.kind]),n.label?n.track.label=n.label:n.track.label=n.kinds.join(" and ")+" off",n.selectable=!0,n.multiSelectable=!1,i.call(this,t,n)||this}F(r,i);var e=r.prototype;return e.handleTracksChange=function(t){for(var n=this.player().textTracks(),a=!0,s=0,o=n.length;s<o;s++){var u=n[s];if(-1<this.options_.kinds.indexOf(u.kind)&&u.mode==="showing"){a=!1;break}}a!==this.isSelected_&&this.selected(a)},e.handleSelectedLanguageChange=function(t){for(var n=this.player().textTracks(),a=!0,s=0,o=n.length;s<o;s++){var u=n[s];if(-1<["captions","descriptions","subtitles"].indexOf(u.kind)&&u.mode==="showing"){a=!1;break}}a&&(this.player_.cache_.selectedLanguage={enabled:!1})},r}(Ii);D.registerComponent("OffTextTrackMenuItem",Bo);var Ze=function(i){function r(e,t){return t===void 0&&(t={}),t.tracks=e.textTracks(),i.call(this,e,t)||this}return F(r,i),r.prototype.createItems=function(e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=Ii),this.label_&&(n=this.label_+" off"),e.push(new Bo(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hideThreshold_+=1;var a=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var s=0;s<a.length;s++){var o=a[s];if(-1<this.kinds_.indexOf(o.kind)){var u=new t(this.player_,{track:o,selectable:!0,multiSelectable:!1});u.addClass("vjs-"+o.kind+"-menu-item"),e.push(u)}}return e},r}(qr);D.registerComponent("TextTrackButton",Ze);var No=function(i){function r(t,n){var a,s=n.track,o=n.cue,u=t.currentTime();return n.selectable=!0,n.multiSelectable=!1,n.label=o.text,n.selected=o.startTime<=u&&u<o.endTime,(a=i.call(this,t,n)||this).track=s,a.cue=o,s.addEventListener("cuechange",$(V(V(a)),a.update)),a}F(r,i);var e=r.prototype;return e.handleClick=function(t){i.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},e.update=function(t){var n=this.cue,a=this.player_.currentTime();this.selected(n.startTime<=a&&a<n.endTime)},r}(Ui);D.registerComponent("ChaptersTrackMenuItem",No);var zr=function(i){function r(t,n,a){return i.call(this,t,n,a)||this}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-chapters-button "+i.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-chapters-button "+i.prototype.buildWrapperCSSClass.call(this)},e.update=function(t){this.track_&&(!t||t.type!=="addtrack"&&t.type!=="removetrack")||this.setTrack(this.findChaptersTrack()),i.prototype.update.call(this)},e.setTrack=function(t){if(this.track_!==t){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var n=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);n&&n.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=t,this.track_){this.track_.mode="hidden";var a=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);a&&a.addEventListener("load",this.updateHandler_)}}},e.findChaptersTrack=function(){for(var t=this.player_.textTracks()||[],n=t.length-1;0<=n;n--){var a=t[n];if(a.kind===this.kind_)return a}},e.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(ft(this.kind_))},e.createMenu=function(){return this.options_.title=this.getMenuCaption(),i.prototype.createMenu.call(this)},e.createItems=function(){var t=[];if(!this.track_)return t;var n=this.track_.cues;if(!n)return t;for(var a=0,s=n.length;a<s;a++){var o=n[a],u=new No(this.player_,{track:this.track_,cue:o});t.push(u)}return t},r}(Ze);zr.prototype.kind_="chapters",zr.prototype.controlText_="Chapters",D.registerComponent("ChaptersButton",zr);var Wr=function(i){function r(t,n,a){var s;s=i.call(this,t,n,a)||this;var o=t.textTracks(),u=$(V(V(s)),s.handleTracksChange);return o.addEventListener("change",u),s.on("dispose",function(){o.removeEventListener("change",u)}),s}F(r,i);var e=r.prototype;return e.handleTracksChange=function(t){for(var n=this.player().textTracks(),a=!1,s=0,o=n.length;s<o;s++){var u=n[s];if(u.kind!==this.kind_&&u.mode==="showing"){a=!0;break}}a?this.disable():this.enable()},e.buildCSSClass=function(){return"vjs-descriptions-button "+i.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+i.prototype.buildWrapperCSSClass.call(this)},r}(Ze);Wr.prototype.kind_="descriptions",Wr.prototype.controlText_="Descriptions",D.registerComponent("DescriptionsButton",Wr);var Gr=function(i){function r(t,n,a){return i.call(this,t,n,a)||this}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-subtitles-button "+i.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+i.prototype.buildWrapperCSSClass.call(this)},r}(Ze);Gr.prototype.kind_="subtitles",Gr.prototype.controlText_="Subtitles",D.registerComponent("SubtitlesButton",Gr);var Xr=function(i){function r(e,t){var n;return t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",(n=i.call(this,e,t)||this).addClass("vjs-texttrack-settings"),n.controlText(", opens "+t.kind+" settings dialog"),n}return F(r,i),r.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},r}(Ii);D.registerComponent("CaptionSettingsMenuItem",Xr);var Yr=function(i){function r(t,n,a){return i.call(this,t,n,a)||this}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-captions-button "+i.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-captions-button "+i.prototype.buildWrapperCSSClass.call(this)},e.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Xr(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),i.prototype.createItems.call(this,t)},r}(Ze);Yr.prototype.kind_="captions",Yr.prototype.controlText_="Captions",D.registerComponent("CaptionsButton",Yr);var jo=function(i){function r(){return i.apply(this,arguments)||this}return F(r,i),r.prototype.createEl=function(e,t,n){var a='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return this.options_.track.kind==="captions"&&(a+=`
|
|
<span aria-hidden="true" class="vjs-icon-placeholder"></span>
|
|
<span class="vjs-control-text"> `+this.localize("Captions")+`</span>
|
|
`),a+="</span>",i.prototype.createEl.call(this,e,ct({innerHTML:a},t),n)},r}(Ii);D.registerComponent("SubsCapsMenuItem",jo);var $r=function(i){function r(t,n){var a;return n===void 0&&(n={}),(a=i.call(this,t,n)||this).label_="subtitles",-1<["en","en-us","en-ca","fr-ca"].indexOf(a.player_.language_)&&(a.label_="captions"),a.menuButton_.controlText(ft(a.label_)),a}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-subs-caps-button "+i.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+i.prototype.buildWrapperCSSClass.call(this)},e.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Xr(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=i.prototype.createItems.call(this,t,jo)},r}(Ze);$r.prototype.kinds_=["captions","subtitles"],$r.prototype.controlText_="Subtitles",D.registerComponent("SubsCapsButton",$r);var Fo=function(i){function r(t,n){var a,s=n.track,o=t.audioTracks();n.label=s.label||s.language||"Unknown",n.selected=s.enabled,(a=i.call(this,t,n)||this).track=s,a.addClass("vjs-"+s.kind+"-menu-item");var u=function(){for(var c=arguments.length,d=new Array(c),p=0;p<c;p++)d[p]=arguments[p];a.handleTracksChange.apply(V(V(a)),d)};return o.addEventListener("change",u),a.on("dispose",function(){o.removeEventListener("change",u)}),a}F(r,i);var e=r.prototype;return e.createEl=function(t,n,a){var s='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return this.options_.track.kind==="main-desc"&&(s+=`
|
|
<span aria-hidden="true" class="vjs-icon-placeholder"></span>
|
|
<span class="vjs-control-text"> `+this.localize("Descriptions")+`</span>
|
|
`),s+="</span>",i.prototype.createEl.call(this,t,ct({innerHTML:s},n),a)},e.handleClick=function(t){var n=this.player_.audioTracks();i.prototype.handleClick.call(this,t);for(var a=0;a<n.length;a++){var s=n[a];s.enabled=s===this.track}},e.handleTracksChange=function(t){this.selected(this.track.enabled)},r}(Ui);D.registerComponent("AudioTrackMenuItem",Fo);var Vo=function(i){function r(t,n){return n===void 0&&(n={}),n.tracks=t.audioTracks(),i.call(this,t,n)||this}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-audio-button "+i.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-audio-button "+i.prototype.buildWrapperCSSClass.call(this)},e.createItems=function(t){t===void 0&&(t=[]),this.hideThreshold_=1;for(var n=this.player_.audioTracks(),a=0;a<n.length;a++){var s=n[a];t.push(new Fo(this.player_,{track:s,selectable:!0,multiSelectable:!1}))}return t},r}(qr);Vo.prototype.controlText_="Audio Track",D.registerComponent("AudioTrackButton",Vo);var Kr=function(i){function r(t,n){var a,s=n.rate,o=parseFloat(s,10);return n.label=s,n.selected=o===1,n.selectable=!0,n.multiSelectable=!1,(a=i.call(this,t,n)||this).label=s,a.rate=o,a.on(t,"ratechange",a.update),a}F(r,i);var e=r.prototype;return e.handleClick=function(t){i.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},e.update=function(t){this.selected(this.player().playbackRate()===this.rate)},r}(Ui);Kr.prototype.contentElType="button",D.registerComponent("PlaybackRateMenuItem",Kr);var Ho=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).updateVisibility(),a.updateLabel(),a.on(t,"loadstart",a.updateVisibility),a.on(t,"ratechange",a.updateLabel),a}F(r,i);var e=r.prototype;return e.createEl=function(){var t=i.prototype.createEl.call(this);return this.labelEl_=yt("div",{className:"vjs-playback-rate-value",innerHTML:"1x"}),t.appendChild(this.labelEl_),t},e.dispose=function(){this.labelEl_=null,i.prototype.dispose.call(this)},e.buildCSSClass=function(){return"vjs-playback-rate "+i.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-playback-rate "+i.prototype.buildWrapperCSSClass.call(this)},e.createMenu=function(){var t=new Vr(this.player()),n=this.playbackRates();if(n)for(var a=n.length-1;0<=a;a--)t.addChild(new Kr(this.player(),{rate:n[a]+"x"}));return t},e.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},e.handleClick=function(t){for(var n=this.player().playbackRate(),a=this.playbackRates(),s=a[0],o=0;o<a.length;o++)if(a[o]>n){s=a[o];break}this.player().playbackRate(s)},e.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},e.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0<this.playbackRates().length},e.updateVisibility=function(t){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},e.updateLabel=function(t){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},r}(Hr);Ho.prototype.controlText_="Playback Rate",D.registerComponent("PlaybackRateMenuButton",Ho);var qo=function(i){function r(){return i.apply(this,arguments)||this}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-spacer "+i.prototype.buildCSSClass.call(this)},e.createEl=function(){return i.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},r}(D);D.registerComponent("Spacer",qo);var cd=function(i){function r(){return i.apply(this,arguments)||this}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-custom-control-spacer "+i.prototype.buildCSSClass.call(this)},e.createEl=function(){var t=i.prototype.createEl.call(this,{className:this.buildCSSClass()});return t.innerHTML="\xA0",t},r}(qo);D.registerComponent("CustomControlSpacer",cd);var zo=function(i){function r(){return i.apply(this,arguments)||this}return F(r,i),r.prototype.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},r}(D);zo.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},D.registerComponent("ControlBar",zo);var Wo=function(i){function r(t,n){var a;return(a=i.call(this,t,n)||this).on(t,"error",a.open),a}F(r,i);var e=r.prototype;return e.buildCSSClass=function(){return"vjs-error-display "+i.prototype.buildCSSClass.call(this)},e.content=function(){var t=this.player().error();return t?this.localize(t.message):""},r}(Ye);Wo.prototype.options_=ot(Ye.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),D.registerComponent("ErrorDisplay",Wo);var Qr="vjs-text-track-settings",Go=["#000","Black"],Xo=["#00F","Blue"],Yo=["#0FF","Cyan"],$o=["#0F0","Green"],Ko=["#F0F","Magenta"],Qo=["#F00","Red"],Jo=["#FFF","White"],Zo=["#FF0","Yellow"],Jr=["1","Opaque"],Zr=["0.5","Semi-Transparent"],tu=["0","Transparent"],xe={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Go,Jo,Qo,$o,Xo,Zo,Ko,Yo]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Jr,Zr,tu]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Jo,Go,Qo,$o,Xo,Zo,Ko,Yo]},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(i){return i==="1.00"?null:Number(i)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Jr,Zr]},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:[tu,Zr,Jr]}};function eu(i,r){if(r&&(i=r(i)),i&&i!=="none")return i}xe.windowColor.options=xe.backgroundColor.options;var hd=function(i){function r(t,n){var a;return n.temporary=!1,(a=i.call(this,t,n)||this).updateDisplay=$(V(V(a)),a.updateDisplay),a.fill(),a.hasBeenOpened_=a.hasBeenFilled_=!0,a.endDialog=yt("p",{className:"vjs-control-text",textContent:a.localize("End of dialog window.")}),a.el().appendChild(a.endDialog),a.setDefaults(),n.persistTextTrackSettings===void 0&&(a.options_.persistTextTrackSettings=a.options_.playerOptions.persistTextTrackSettings),a.on(a.$(".vjs-done-button"),"click",function(){a.saveSettings(),a.close()}),a.on(a.$(".vjs-default-button"),"click",function(){a.setDefaults(),a.updateDisplay()}),Ve(xe,function(s){a.on(a.$(s.selector),"change",a.updateDisplay)}),a.options_.persistTextTrackSettings&&a.restoreSettings(),a}F(r,i);var e=r.prototype;return e.dispose=function(){this.endDialog=null,i.prototype.dispose.call(this)},e.createElSelect_=function(t,n,a){var s=this;n===void 0&&(n=""),a===void 0&&(a="label");var o=xe[t],u=o.id.replace("%s",this.id_),c=[n,u].join(" ").trim();return["<"+a+' id="'+u+'" class="'+(a==="label"?"vjs-label":"")+'">',this.localize(o.label),"</"+a+">",'<select aria-labelledby="'+c+'">'].concat(o.options.map(function(d){var p=u+"-"+d[1].replace(/\W+/g,"");return['<option id="'+p+'" value="'+d[0]+'" ','aria-labelledby="'+c+" "+p+'">',s.localize(d[1]),"</option>"].join("")})).concat("</select>").join("")},e.createElFgColor_=function(){var t="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+t+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",t),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",t),"</span>","</fieldset>"].join("")},e.createElBgColor_=function(){var t="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+t+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",t),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",t),"</span>","</fieldset>"].join("")},e.createElWinColor_=function(){var t="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+t+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",t),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",t),"</span>","</fieldset>"].join("")},e.createElColors_=function(){return yt("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},e.createElFont_=function(){return yt("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("")})},e.createElControls_=function(){var t=this.localize("restore all settings to the default values");return yt("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+t+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+t+"</span>","</button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})},e.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},e.label=function(){return this.localize("Caption Settings Dialog")},e.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},e.buildCSSClass=function(){return i.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},e.getValues=function(){var t,n,a,s=this;return n=function(o,u,c){var d,p,g=(d=s.$(u.selector),p=u.parser,eu(d.options[d.options.selectedIndex].value,p));return g!==void 0&&(o[c]=g),o},(a={})===void 0&&(a=0),_s(t=xe).reduce(function(o,u){return n(o,t[u],u)},a)},e.setValues=function(t){var n=this;Ve(xe,function(a,s){(function(o,u,c){if(u){for(var d=0;d<o.options.length;d++)if(eu(o.options[d].value,c)===u){o.selectedIndex=d;break}}})(n.$(a.selector),t[s],a.parser)})},e.setDefaults=function(){var t=this;Ve(xe,function(n){var a=n.hasOwnProperty("default")?n.default:0;t.$(n.selector).selectedIndex=a})},e.restoreSettings=function(){var t;try{t=JSON.parse(A.localStorage.getItem(Qr))}catch(n){Z.warn(n)}t&&this.setValues(t)},e.saveSettings=function(){if(this.options_.persistTextTrackSettings){var t=this.getValues();try{Object.keys(t).length?A.localStorage.setItem(Qr,JSON.stringify(t)):A.localStorage.removeItem(Qr)}catch(n){Z.warn(n)}}},e.updateDisplay=function(){var t=this.player_.getChild("textTrackDisplay");t&&t.updateDisplay()},e.conditionalBlur_=function(){this.previouslyActiveEl_=null,this.off(B,"keydown",this.handleKeyDown);var t=this.player_.controlBar,n=t&&t.subsCapsButton,a=t&&t.captionsButton;n?n.focus():a&&a.focus()},r}(Ye);D.registerComponent("TextTrackSettings",hd);var dd=function(i){function r(t,n){var a,s=n.ResizeObserver||A.ResizeObserver;n.ResizeObserver===null&&(s=!1);var o=ot({createEl:!s,reportTouchActivity:!1},n);return(a=i.call(this,t,o)||this).ResizeObserver=n.ResizeObserver||A.ResizeObserver,a.loadListener_=null,a.resizeObserver_=null,a.debouncedHandler_=function(u,c,d,p){var g;p===void 0&&(p=A);var y=function(){var b=this,T=arguments,S=function(){S=g=null,d||u.apply(b,T)};!g&&d&&u.apply(b,T),p.clearTimeout(g),g=p.setTimeout(S,c)};return y.cancel=function(){p.clearTimeout(g),g=null},y}(function(){a.resizeHandler()},100,!1,V(V(a))),s?(a.resizeObserver_=new a.ResizeObserver(a.debouncedHandler_),a.resizeObserver_.observe(t.el())):(a.loadListener_=function(){a.el_&&a.el_.contentWindow&&Yt(a.el_.contentWindow,"resize",a.debouncedHandler_)},a.one("load",a.loadListener_)),a}F(r,i);var e=r.prototype;return e.createEl=function(){return i.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager"})},e.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},e.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.el_&&this.el_.contentWindow&&Dt(this.el_.contentWindow,"resize",this.debouncedHandler_),this.loadListener_&&this.off("load",this.loadListener_),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null},r}(D);D.registerComponent("ResizeManager",dd);var pd=function(i){function r(t,n){var a,s=ot({createEl:!1},n);return(a=i.call(this,t,s)||this).reset_(),a.on(a.player_,"durationchange",a.handleDurationchange),a}F(r,i);var e=r.prototype;return e.isBehind_=function(){if(!this.timeupdateSeen_)return!1;var t=this.liveCurrentTime(),n=this.player_.currentTime(),a=this.seekableIncrement_;return t!==1/0&&n<=t-(2*a+.07)},e.trackLive_=function(){this.pastSeekEnd_=this.pastSeekEnd_;var t=this.player_.seekable();if(t&&t.length){var n=this.seekableEnd();n!==this.lastSeekEnd_&&(this.lastSeekEnd_&&(this.seekableIncrement_=Math.abs(n-this.lastSeekEnd_)),this.pastSeekEnd_=0,this.lastSeekEnd_=n,this.trigger("seekableendchange")),this.pastSeekEnd_=this.pastSeekEnd()+.03,this.isBehind_()!==this.behindLiveEdge()&&(this.behindLiveEdge_=this.isBehind_(),this.trigger("liveedgechange"))}},e.handleDurationchange=function(){this.player_.duration()===1/0?this.startTracking():this.stopTracking()},e.startTracking=function(){var t=this;this.isTracking()||(this.trackingInterval_=this.setInterval(this.trackLive_,30),this.trackLive_(),this.on(this.player_,"play",this.trackLive_),this.on(this.player_,"pause",this.trackLive_),this.one(this.player_,"play",this.handlePlay),this.timeupdateSeen_||(this.handleTimeupdate=function(){t.timeupdateSeen_=!0,t.handleTimeupdate=null},this.one(this.player_,"timeupdate",this.handleTimeupdate)))},e.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge)},e.reset_=function(){this.pastSeekEnd_=0,this.lastSeekEnd_=null,this.behindLiveEdge_=null,this.timeupdateSeen_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.seekableIncrement_=12,this.off(this.player_,"play",this.trackLive_),this.off(this.player_,"pause",this.trackLive_),this.off(this.player_,"play",this.handlePlay),this.off(this.player_,"timeupdate",this.seekToLiveEdge),this.handleTimeupdate&&(this.off(this.player_,"timeupdate",this.handleTimeupdate),this.handleTimeupdate=null)},e.stopTracking=function(){this.isTracking()&&this.reset_()},e.seekableEnd=function(){for(var t=this.player_.seekable(),n=[],a=t?t.length:0;a--;)n.push(t.end(a));return n.length?n.sort()[n.length-1]:1/0},e.seekableStart=function(){for(var t=this.player_.seekable(),n=[],a=t?t.length:0;a--;)n.push(t.start(a));return n.length?n.sort()[0]:0},e.liveWindow=function(){var t=this.liveCurrentTime();return t===1/0?1/0:t-this.seekableStart()},e.isLive=function(){return this.isTracking()},e.atLiveEdge=function(){return!this.behindLiveEdge()},e.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},e.pastSeekEnd=function(){return this.pastSeekEnd_},e.behindLiveEdge=function(){return this.behindLiveEdge_},e.isTracking=function(){return typeof this.trackingInterval_=="number"},e.seekToLiveEdge=function(){this.atLiveEdge()||(this.player_.currentTime(this.liveCurrentTime()),this.player_.paused()&&this.player_.play())},e.dispose=function(){this.stopTracking(),i.prototype.dispose.call(this)},r}(D);D.registerComponent("LiveTracker",pd);var ta=function(i){var r=i.el();if(r.hasAttribute("src"))return i.triggerSourceset(r.src),!0;var e=i.$$("source"),t=[],n="";if(!e.length)return!1;for(var a=0;a<e.length;a++){var s=e[a].src;s&&t.indexOf(s)===-1&&t.push(s)}return!!t.length&&(t.length===1&&(n=t[0]),i.triggerSourceset(n),!0)},fd=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(i){var r=B.createElement(this.nodeName.toLowerCase());r.innerHTML=i;for(var e=B.createDocumentFragment();r.childNodes.length;)e.appendChild(r.childNodes[0]);return this.innerText="",A.Element.prototype.appendChild.call(this,e),this.innerHTML}}),iu=function(i,r){for(var e={},t=0;t<i.length&&!((e=Object.getOwnPropertyDescriptor(i[t],r))&&e.set&&e.get);t++);return e.enumerable=!0,e.configurable=!0,e},nu=function(i){var r=i.el();if(!r.resetSourceWatch_){var e={},t=iu([i.el(),A.HTMLMediaElement.prototype,A.Element.prototype,fd],"innerHTML"),n=function(a){return function(){for(var s=arguments.length,o=new Array(s),u=0;u<s;u++)o[u]=arguments[u];var c=a.apply(r,o);return ta(i),c}};["append","appendChild","insertAdjacentHTML"].forEach(function(a){r[a]&&(e[a]=r[a],r[a]=n(e[a]))}),Object.defineProperty(r,"innerHTML",ot(t,{set:n(t.set)})),r.resetSourceWatch_=function(){r.resetSourceWatch_=null,Object.keys(e).forEach(function(a){r[a]=e[a]}),Object.defineProperty(r,"innerHTML",t)},i.one("sourceset",r.resetSourceWatch_)}},md=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?uo(A.Element.prototype.getAttribute.call(this,"src")):""},set:function(i){return A.Element.prototype.setAttribute.call(this,"src",i),i}}),gd=function(i){if(i.featuresSourceset){var r=i.el();if(!r.resetSourceset_){var e=iu([i.el(),A.HTMLMediaElement.prototype,md],"src"),t=r.setAttribute,n=r.load;Object.defineProperty(r,"src",ot(e,{set:function(a){var s=e.set.call(r,a);return i.triggerSourceset(r.src),s}})),r.setAttribute=function(a,s){var o=t.call(r,a,s);return/src/i.test(a)&&i.triggerSourceset(r.src),o},r.load=function(){var a=n.call(r);return ta(i)||(i.triggerSourceset(""),nu(i)),a},r.currentSrc?i.triggerSourceset(r.currentSrc):ta(i)||nu(i),r.resetSourceset_=function(){r.resetSourceset_=null,r.load=n,r.setAttribute=t,Object.defineProperty(r,"src",e),r.resetSourceWatch_&&r.resetSourceWatch_()}}}};function ru(){var i=Jn([`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
This may prevent text tracks from loading.`]);return ru=function(){return i},i}var j=function(i){function r(t,n){var a;a=i.call(this,t,n)||this;var s=t.source,o=!1;if(s&&(a.el_.currentSrc!==s.src||t.tag&&t.tag.initNetworkState_===3)?a.setSource(s):a.handleLateInit_(a.el_),t.enableSourceset&&a.setupSourcesetHandling_(),a.el_.hasChildNodes()){for(var u=a.el_.childNodes,c=u.length,d=[];c--;){var p=u[c];p.nodeName.toLowerCase()==="track"&&(a.featuresNativeTextTracks?(a.remoteTextTrackEls().addTrackElement_(p),a.remoteTextTracks().addTrack(p.track),a.textTracks().addTrack(p.track),o||a.el_.hasAttribute("crossorigin")||!un(p.src)||(o=!0)):d.push(p))}for(var g=0;g<d.length;g++)a.el_.removeChild(d[g])}return a.proxyNativeTracks_(),a.featuresNativeTextTracks&&o&&Z.warn(Zn(ru())),a.restoreMetadataTracksInIOSNativePlayer_(),(en||mr||$s)&&t.nativeControlsForTouch===!0&&a.setControls(!0),a.proxyWebkitFullscreen_(),a.triggerReady(),a}F(r,i);var e=r.prototype;return e.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),r.disposeMediaElement(this.el_),this.options_=null,i.prototype.dispose.call(this)},e.setupSourcesetHandling_=function(){gd(this)},e.restoreMetadataTracksInIOSNativePlayer_=function(){var t,n=this.textTracks(),a=function(){t=[];for(var o=0;o<n.length;o++){var u=n[o];u.kind==="metadata"&&t.push({track:u,storedMode:u.mode})}};a(),n.addEventListener("change",a),this.on("dispose",function(){return n.removeEventListener("change",a)});var s=function o(){for(var u=0;u<t.length;u++){var c=t[u];c.track.mode==="disabled"&&c.track.mode!==c.storedMode&&(c.track.mode=c.storedMode)}n.removeEventListener("change",o)};this.on("webkitbeginfullscreen",function(){n.removeEventListener("change",a),n.removeEventListener("change",s),n.addEventListener("change",s)}),this.on("webkitendfullscreen",function(){n.removeEventListener("change",a),n.addEventListener("change",a),n.removeEventListener("change",s)})},e.overrideNative_=function(t,n){var a=this;if(n===this["featuresNative"+t+"Tracks"]){var s=t.toLowerCase();this[s+"TracksListeners_"]&&Object.keys(this[s+"TracksListeners_"]).forEach(function(o){a.el()[s+"Tracks"].removeEventListener(o,a[s+"TracksListeners_"][o])}),this["featuresNative"+t+"Tracks"]=!n,this[s+"TracksListeners_"]=null,this.proxyNativeTracksForType_(s)}},e.overrideNativeAudioTracks=function(t){this.overrideNative_("Audio",t)},e.overrideNativeVideoTracks=function(t){this.overrideNative_("Video",t)},e.proxyNativeTracksForType_=function(t){var n=this,a=Ht[t],s=this.el()[a.getterName],o=this[a.getterName]();if(this["featuresNative"+a.capitalName+"Tracks"]&&s&&s.addEventListener){var u={change:function(d){o.trigger({type:"change",target:o,currentTarget:o,srcElement:o})},addtrack:function(d){o.addTrack(d.track)},removetrack:function(d){o.removeTrack(d.track)}},c=function(){for(var d=[],p=0;p<o.length;p++){for(var g=!1,y=0;y<s.length;y++)if(s[y]===o[p]){g=!0;break}g||d.push(o[p])}for(;d.length;)o.removeTrack(d.shift())};this[a.getterName+"Listeners_"]=u,Object.keys(u).forEach(function(d){var p=u[d];s.addEventListener(d,p),n.on("dispose",function(g){return s.removeEventListener(d,p)})}),this.on("loadstart",c),this.on("dispose",function(d){return n.off("loadstart",c)})}},e.proxyNativeTracks_=function(){var t=this;Ht.names.forEach(function(n){t.proxyNativeTracksForType_(n)})},e.createEl=function(){var t=this.options_.tag;if(!t||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(t){var n=t.cloneNode(!0);t.parentNode&&t.parentNode.insertBefore(n,t),r.disposeMediaElement(t),t=n}else{t=B.createElement("video");var a=ot({},this.options_.tag&&oe(this.options_.tag));en&&this.options_.nativeControlsForTouch===!0||delete a.controls,Es(t,ct(a,{id:this.options_.techId,class:"vjs-tech"}))}t.playerId=this.options_.playerId}typeof this.options_.preload!="undefined"&&mi(t,"preload",this.options_.preload);for(var s=["loop","muted","playsinline","autoplay"],o=0;o<s.length;o++){var u=s[o],c=this.options_[u];typeof c!="undefined"&&(c?mi(t,u,u):Zi(t,u),t[u]=c)}return t},e.handleLateInit_=function(t){if(t.networkState!==0&&t.networkState!==3){if(t.readyState===0){var n=!1,a=function(){n=!0};this.on("loadstart",a);var s=function(){n||this.trigger("loadstart")};return this.on("loadedmetadata",s),void this.ready(function(){this.off("loadstart",a),this.off("loadedmetadata",s),n||this.trigger("loadstart")})}var o=["loadstart"];o.push("loadedmetadata"),2<=t.readyState&&o.push("loadeddata"),3<=t.readyState&&o.push("canplay"),4<=t.readyState&&o.push("canplaythrough"),this.ready(function(){o.forEach(function(u){this.trigger(u)},this)})}},e.setCurrentTime=function(t){try{this.el_.currentTime=t}catch(n){Z(n,"Video is not ready. (Video.js)")}},e.duration=function(){var t=this;return this.el_.duration===1/0&&Pe&&be&&this.el_.currentTime===0?(this.on("timeupdate",function n(){0<t.el_.currentTime&&(t.el_.duration===1/0&&t.trigger("durationchange"),t.off("timeupdate",n))}),NaN):this.el_.duration||NaN},e.width=function(){return this.el_.offsetWidth},e.height=function(){return this.el_.offsetHeight},e.proxyWebkitFullscreen_=function(){var t=this;if("webkitDisplayingFullscreen"in this.el_){var n=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},a=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",n),this.trigger("fullscreenchange",{isFullscreen:!0}))};this.on("webkitbeginfullscreen",a),this.on("dispose",function(){t.off("webkitbeginfullscreen",a),t.off("webkitendfullscreen",n)})}},e.supportsFullScreen=function(){if(typeof this.el_.webkitEnterFullScreen=="function"){var t=A.navigator&&A.navigator.userAgent||"";if(/Android/.test(t)||!/Chrome|Mac OS X 10.5/.test(t))return!0}return!1},e.enterFullScreen=function(){var t=this.el_;t.paused&&t.networkState<=t.HAVE_METADATA?(this.el_.play(),this.setTimeout(function(){t.pause(),t.webkitEnterFullScreen()},0)):t.webkitEnterFullScreen()},e.exitFullScreen=function(){this.el_.webkitExitFullScreen()},e.src=function(t){if(t===void 0)return this.el_.src;this.setSrc(t)},e.reset=function(){r.resetMediaElement(this.el_)},e.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},e.setControls=function(t){this.el_.controls=!!t},e.addTextTrack=function(t,n,a){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,n,a):i.prototype.addTextTrack.call(this,t,n,a)},e.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return i.prototype.createRemoteTextTrack.call(this,t);var n=B.createElement("track");return t.kind&&(n.kind=t.kind),t.label&&(n.label=t.label),(t.language||t.srclang)&&(n.srclang=t.language||t.srclang),t.default&&(n.default=t.default),t.id&&(n.id=t.id),t.src&&(n.src=t.src),n},e.addRemoteTextTrack=function(t,n){var a=i.prototype.addRemoteTextTrack.call(this,t,n);return this.featuresNativeTextTracks&&this.el().appendChild(a),a},e.removeRemoteTextTrack=function(t){if(i.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var n=this.$$("track"),a=n.length;a--;)t!==n[a]&&t!==n[a].track||this.el().removeChild(n[a])},e.getVideoPlaybackQuality=function(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();var t={};return typeof this.el().webkitDroppedFrameCount!="undefined"&&typeof this.el().webkitDecodedFrameCount!="undefined"&&(t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount),A.performance&&typeof A.performance.now=="function"?t.creationTime=A.performance.now():A.performance&&A.performance.timing&&typeof A.performance.timing.navigationStart=="number"&&(t.creationTime=A.Date.now()-A.performance.timing.navigationStart),t},r}(st);if(He()){j.TEST_VID=B.createElement("video");var fn=B.createElement("track");fn.kind="captions",fn.srclang="en",fn.label="English",j.TEST_VID.appendChild(fn)}j.isSupported=function(){try{j.TEST_VID.volume=.5}catch(i){return!1}return!(!j.TEST_VID||!j.TEST_VID.canPlayType)},j.canPlayType=function(i){return j.TEST_VID.canPlayType(i)},j.canPlaySource=function(i,r){return j.canPlayType(i.type)},j.canControlVolume=function(){try{var i=j.TEST_VID.volume;return j.TEST_VID.volume=i/2+.1,i!==j.TEST_VID.volume}catch(r){return!1}},j.canMuteVolume=function(){try{var i=j.TEST_VID.muted;return j.TEST_VID.muted=!i,j.TEST_VID.muted?mi(j.TEST_VID,"muted","muted"):Zi(j.TEST_VID,"muted"),i!==j.TEST_VID.muted}catch(r){return!1}},j.canControlPlaybackRate=function(){if(Pe&&be&&Qs<58)return!1;try{var i=j.TEST_VID.playbackRate;return j.TEST_VID.playbackRate=i/2+.1,i!==j.TEST_VID.playbackRate}catch(r){return!1}},j.canOverrideAttributes=function(){try{var i=function(){};Object.defineProperty(B.createElement("video"),"src",{get:i,set:i}),Object.defineProperty(B.createElement("audio"),"src",{get:i,set:i}),Object.defineProperty(B.createElement("video"),"innerHTML",{get:i,set:i}),Object.defineProperty(B.createElement("audio"),"innerHTML",{get:i,set:i})}catch(r){return!1}return!0},j.supportsNativeTextTracks=function(){return to||ue&&be},j.supportsNativeVideoTracks=function(){return!(!j.TEST_VID||!j.TEST_VID.videoTracks)},j.supportsNativeAudioTracks=function(){return!(!j.TEST_VID||!j.TEST_VID.audioTracks)},j.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],j.prototype.featuresVolumeControl=j.canControlVolume(),j.prototype.featuresMuteControl=j.canMuteVolume(),j.prototype.featuresPlaybackRate=j.canControlPlaybackRate(),j.prototype.featuresSourceset=j.canOverrideAttributes(),j.prototype.movingMediaElementInDOM=!ue,j.prototype.featuresFullscreenResize=!0,j.prototype.featuresProgressEvents=!0,j.prototype.featuresTimeupdateEvents=!0,j.prototype.featuresNativeTextTracks=j.supportsNativeTextTracks(),j.prototype.featuresNativeVideoTracks=j.supportsNativeVideoTracks(),j.prototype.featuresNativeAudioTracks=j.supportsNativeAudioTracks();var au=j.TEST_VID&&j.TEST_VID.constructor.prototype.canPlayType,yd=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;function su(){var i=Jn([`
|
|
Using the tech directly can be dangerous. I hope you know what you're doing.
|
|
See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
`]);return su=function(){return i},i}j.patchCanPlayType=function(){4<=gr&&!Ks&&!be&&(j.TEST_VID.constructor.prototype.canPlayType=function(i){return i&&yd.test(i)?"maybe":au.call(this,i)})},j.unpatchCanPlayType=function(){var i=j.TEST_VID.constructor.prototype.canPlayType;return j.TEST_VID.constructor.prototype.canPlayType=au,i},j.patchCanPlayType(),j.disposeMediaElement=function(i){if(i){for(i.parentNode&&i.parentNode.removeChild(i);i.hasChildNodes();)i.removeChild(i.firstChild);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch(r){}}()}},j.resetMediaElement=function(i){if(i){for(var r=i.querySelectorAll("source"),e=r.length;e--;)i.removeChild(r[e]);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch(t){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(i){j.prototype[i]=function(){return this.el_[i]||this.el_.hasAttribute(i)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(i){j.prototype["set"+ft(i)]=function(r){(this.el_[i]=r)?this.el_.setAttribute(i,i):this.el_.removeAttribute(i)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(i){j.prototype[i]=function(){return this.el_[i]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach(function(i){j.prototype["set"+ft(i)]=function(r){this.el_[i]=r}}),["pause","load","play"].forEach(function(i){j.prototype[i]=function(){var r=this.el_[i](),e=window.localStorage.getItem("refreshCount");if(i==="play"){var t=this;r!==void 0&&window.localStorage&&r.then(function(){window.localStorage.setItem("refreshCount",0)}).catch(function(n){if(console.log("playError:",n),e++,window.localStorage.setItem("refreshCount",e),n.code==0)if(e<2)location.reload();else{var a=document.getElementById("playErrorMessage");a&&(document.getElementById("playErrorMessage").style.display=""),t.el_.muted=!0,t.el_[i]()}})}return r}}),st.withSourceHandlers(j),j.nativeSourceHandler={},j.nativeSourceHandler.canPlayType=function(i){try{return j.TEST_VID.canPlayType(i)}catch(r){return""}},j.nativeSourceHandler.canHandleSource=function(i,r){if(i.type)return j.nativeSourceHandler.canPlayType(i.type);if(i.src){var e=wr(i.src);return j.nativeSourceHandler.canPlayType("video/"+e)}return""},j.nativeSourceHandler.handleSource=function(i,r,e){r.setSrc(i.src)},j.nativeSourceHandler.dispose=function(){},j.registerSourceHandler(j.nativeSourceHandler),st.registerTech("Html5",j);var ou=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],ea={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},ia=["tiny","xsmall","small","medium","large","xlarge","huge"],mn={};ia.forEach(function(i){var r=i.charAt(0)==="x"?"x-"+i.substring(1):i;mn[i]="vjs-layout-"+r});var vd={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},_t=function(i){function r(t,n,a){var s;if(t.id=t.id||n.id||"vjs_video_"+Ae(),(n=ct(r.getTagSettings(t),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language)if(typeof t.closest=="function"){var o=t.closest("[lang]");o&&o.getAttribute&&(n.language=o.getAttribute("lang"))}else for(var u=t;u&&u.nodeType===1;){if(oe(u).hasOwnProperty("lang")){n.language=u.getAttribute("lang");break}u=u.parentNode}if((s=i.call(this,null,n,a)||this).log=vs(s.id_),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=t,s.tagAttributes=t&&oe(t),s.language(s.options_.language),n.languages){var c={};Object.getOwnPropertyNames(n.languages).forEach(function(y){c[y.toLowerCase()]=n.languages[y]}),s.languages_=c}else s.languages_=r.prototype.options_.languages;s.cache_={},s.poster_=n.poster||"",s.controls_=!!n.controls,s.cache_.lastVolume=1,t.controls=!1,t.removeAttribute("controls"),t.hasAttribute("autoplay")?s.options_.autoplay=!0:s.autoplay(s.options_.autoplay),s.scrubbing_=!1,s.el_=s.createEl(),s.cache_.lastPlaybackRate=s.defaultPlaybackRate(),lr(V(V(s)),{eventBusKey:"el_"}),s.fluid_&&s.on("playerreset",s.updateStyleEl_);var d=ot(s.options_);if(n.plugins){var p=n.plugins;Object.keys(p).forEach(function(y){if(typeof this[y]!="function")throw new Error('plugin "'+y+'" does not exist');this[y](p[y])},V(V(s)))}s.options_.playerOptions=d,s.middleware_=[],s.initChildren(),s.isAudio(t.nodeName.toLowerCase()==="audio"),s.controls()?s.addClass("vjs-controls-enabled"):s.addClass("vjs-controls-disabled"),s.el_.setAttribute("role","region"),s.isAudio()?s.el_.setAttribute("aria-label",s.localize("Audio Player")):s.el_.setAttribute("aria-label",s.localize("Video Player")),s.isAudio()&&s.addClass("vjs-audio"),s.flexNotSupported_()&&s.addClass("vjs-no-flex"),ue||s.addClass("vjs-workinghover"),r.players[s.id_]=V(V(s));var g=ms.split(".")[0];return s.addClass("vjs-v"+g),s.userActive(!0),s.reportUserActivity(),s.one("play",s.listenForUserActivity_),s.on("fullscreenchange",s.handleFullscreenChange_),s.on("stageclick",s.handleStageClick_),s.breakpoints(s.options_.breakpoints),s.responsive(s.options_.responsive),s.changingSrc_=!1,s.playWaitingForReady_=!1,s.playOnLoadstart_=null,s}F(r,i);var e=r.prototype;return e.dispose=function(){this.trigger("dispose"),this.off("dispose"),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),r.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Pr[this.id()]=null,i.prototype.dispose.call(this)},e.createEl=function(){var t,n=this.tag,a=this.playerElIngest_=n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player"),s=this.tag.tagName.toLowerCase()==="video-js";a?t=this.el_=n.parentNode:s||(t=this.el_=i.prototype.createEl.call(this,"div"));var o=oe(n);if(s){for(t=this.el_=n,n=this.tag=B.createElement("video");t.children.length;)n.appendChild(t.firstChild);Ce(t,"video-js")||Ee(t,"video-js"),t.appendChild(n),a=this.playerElIngest_=t,Object.keys(t).forEach(function(y){n[y]=t[y]})}if(n.setAttribute("tabindex","-1"),o.tabindex="-1",Js&&(n.setAttribute("role","application"),o.role="application"),n.removeAttribute("width"),n.removeAttribute("height"),"width"in o&&delete o.width,"height"in o&&delete o.height,Object.getOwnPropertyNames(o).forEach(function(y){s&&y==="class"||t.setAttribute(y,o[y]),s&&n.setAttribute(y,o[y])}),n.playerId=n.id,n.id+="_html5_api",n.className="vjs-tech",n.player=t.player=this,this.addClass("vjs-paused"),A.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Fs("vjs-styles-dimensions");var u=_e(".vjs-styles-defaults"),c=_e("head");c.insertBefore(this.styleEl_,u?u.nextSibling:c.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio);for(var d=n.getElementsByTagName("a"),p=0;p<d.length;p++){var g=d.item(p);Ee(g,"vjs-hidden"),g.setAttribute("hidden","hidden")}return n.initNetworkState_=n.networkState,n.parentNode&&!a&&n.parentNode.insertBefore(t,n),Ji(n,t),this.children_.unshift(n),this.el_.setAttribute("lang",this.language_),this.el_=t},e.width=function(t){return this.dimension("width",t)},e.height=function(t){return this.dimension("height",t)},e.dimension=function(t,n){var a=t+"_";if(n===void 0)return this[a]||0;if(n==="")return this[a]=void 0,void this.updateStyleEl_();var s=parseFloat(n);isNaN(s)?Z.error('Improper value "'+n+'" supplied for for '+t):(this[a]=s,this.updateStyleEl_())},e.fluid=function(t){if(t===void 0)return!!this.fluid_;var n,a;this.fluid_=!!t,Oe(this)&&this.off("playerreset",this.updateStyleEl_),t?(this.addClass("vjs-fluid"),this.fill(!1),Oe(n=function(){this.on("playerreset",this.updateStyleEl_)})?a():(n.eventedCallbacks||(n.eventedCallbacks=[]),n.eventedCallbacks.push(a))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},e.fill=function(t){if(t===void 0)return!!this.fill_;this.fill_=!!t,t?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},e.aspectRatio=function(t){if(t===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(t))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=t,this.fluid(!0),this.updateStyleEl_()},e.updateStyleEl_=function(){if(A.VIDEOJS_NO_DYNAMIC_STYLE!==!0){var t,n,a,s=(this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?this.aspectRatio_:0<this.videoWidth()?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),o=s[1]/s[0];t=this.width_!==void 0?this.width_:this.height_!==void 0?this.height_/o:this.videoWidth()||300,n=this.height_!==void 0?this.height_:t*o,a=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(a),Vs(this.styleEl_,`
|
|
.`+a+` {
|
|
width: `+t+`px;
|
|
height: `+n+`px;
|
|
}
|
|
|
|
.`+a+`.vjs-fluid {
|
|
|
|
}
|
|
`)}else{var u=typeof this.width_=="number"?this.width_:this.options_.width,c=typeof this.height_=="number"?this.height_:this.options_.height,d=this.tech_&&this.tech_.el();d&&(0<=u&&(d.width=u),0<=c&&(d.height=c))}},e.loadTech_=function(t,n){var a=this;this.tech_&&this.unloadTech_();var s=ft(t),o=t.charAt(0).toLowerCase()+t.slice(1);s!=="Html5"&&this.tag&&(st.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=s,this.isReady_=!1;var u={source:n,autoplay:typeof this.autoplay()!="string"&&this.autoplay(),nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+o+"_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};Rt.names.forEach(function(d){var p=Rt[d];u[p.getterName]=a[p.privateName]}),ct(u,this.options_[s]),ct(u,this.options_[o]),ct(u,this.options_[t.toLowerCase()]),this.tag&&(u.tag=this.tag),n&&n.src===this.cache_.src&&0<this.cache_.currentTime&&(u.startTime=this.cache_.currentTime);var c=st.getTech(t);if(!c)throw new Error("No Tech named '"+s+"' exists! '"+s+"' should be registered using videojs.registerTech()'");this.tech_=new c(u),this.tech_.ready($(this,this.handleTechReady_),!0),gh(this.textTracksJson_||[],this.tech_),ou.forEach(function(d){a.on(a.tech_,d,a["handleTech"+ft(d)+"_"])}),Object.keys(ea).forEach(function(d){a.on(a.tech_,d,function(p){a.tech_.playbackRate()===0&&a.tech_.seeking()?a.queuedCallbacks_.push({callback:a["handleTech"+ea[d]+"_"].bind(a),event:p}):a["handleTech"+ea[d]+"_"](p)})}),this.on(this.tech_,"loadstart",this.handleTechLoadStart_),this.on(this.tech_,"sourceset",this.handleTechSourceset_),this.on(this.tech_,"waiting",this.handleTechWaiting_),this.on(this.tech_,"ended",this.handleTechEnded_),this.on(this.tech_,"seeking",this.handleTechSeeking_),this.on(this.tech_,"play",this.handleTechPlay_),this.on(this.tech_,"firstplay",this.handleTechFirstPlay_),this.on(this.tech_,"pause",this.handleTechPause_),this.on(this.tech_,"durationchange",this.handleTechDurationChange_),this.on(this.tech_,"fullscreenchange",this.handleTechFullscreenChange_),this.on(this.tech_,"error",this.handleTechError_),this.on(this.tech_,"loadedmetadata",this.updateStyleEl_),this.on(this.tech_,"posterchange",this.handleTechPosterChange_),this.on(this.tech_,"textdata",this.handleTechTextData_),this.on(this.tech_,"ratechange",this.handleTechRateChange_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||s==="Html5"&&this.tag||Ji(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},e.unloadTech_=function(){var t=this;Rt.names.forEach(function(n){var a=Rt[n];t[a.privateName]=t[a.getterName]()}),this.textTracksJson_=mh(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},e.tech=function(t){return t===void 0&&Z.warn(Zn(su())),this.tech_},e.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"mousedown",this.handleTechClick_),this.on(this.tech_,"dblclick",this.handleTechDoubleClick_),this.on(this.tech_,"touchstart",this.handleTechTouchStart_),this.on(this.tech_,"touchmove",this.handleTechTouchMove_),this.on(this.tech_,"touchend",this.handleTechTouchEnd_),this.on(this.tech_,"tap",this.handleTechTap_)},e.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_),this.off(this.tech_,"touchstart",this.handleTechTouchStart_),this.off(this.tech_,"touchmove",this.handleTechTouchMove_),this.off(this.tech_,"touchend",this.handleTechTouchEnd_),this.off(this.tech_,"mousedown",this.handleTechClick_),this.off(this.tech_,"dblclick",this.handleTechDoubleClick_)},e.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},e.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())},e.manualAutoplay_=function(t){var n=this;if(this.tech_&&typeof t=="string"){var a,s=function(){var o=n.muted();n.muted(!0);var u=n.play();if(u&&u.then&&u.catch)return u.catch(function(c){n.muted(o)})};if(t==="any"?(a=this.play())&&a.then&&a.catch&&a.catch(function(){return s()}):a=t==="muted"?s():this.play(),a&&a.then&&a.catch)return a.then(function(){n.trigger({type:"autoplay-success",autoplay:t})}).catch(function(o){n.trigger({type:"autoplay-failure",autoplay:t})})}},e.updateSourceCaches_=function(t){t===void 0&&(t="");var n=t,a="";typeof n!="string"&&(n=t.src,a=t.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],n&&!a&&(a=function(g,y){if(!y)return"";if(g.cache_.source.src===y&&g.cache_.source.type)return g.cache_.source.type;var b=g.cache_.sources.filter(function(E){return E.src===y});if(b.length)return b[0].type;for(var T=g.$$("source"),S=0;S<T.length;S++){var C=T[S];if(C.type&&C.src&&C.src===y)return C.type}return Co(y)}(this,n)),this.cache_.source=ot({},t,{src:n,type:a});for(var s=this.cache_.sources.filter(function(g){return g.src&&g.src===n}),o=[],u=this.$$("source"),c=[],d=0;d<u.length;d++){var p=oe(u[d]);o.push(p),p.src&&p.src===n&&c.push(p.src)}c.length&&!s.length?this.cache_.sources=o:s.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=n},e.handleTechSourceset_=function(t){var n=this;if(!this.changingSrc_){var a=function(u){return n.updateSourceCaches_(u)},s=this.currentSource().src,o=t.src;s&&!/^blob:/.test(s)&&/^blob:/.test(o)&&(!this.lastSource_||this.lastSource_.tech!==o&&this.lastSource_.player!==s)&&(a=function(){}),a(o),!t.src&&this.tech_.one(["sourceset","loadstart"],function u(c){if(c.type!=="sourceset"){var d=n.techGet("currentSrc");n.lastSource_.tech=d,n.updateSourceCaches_(d)}n.tech_.off(["sourceset","loadstart"],u)})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})},e.hasStarted=function(t){if(t===void 0)return this.hasStarted_;t!==this.hasStarted_&&(this.hasStarted_=t,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},e.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},e.handleTechRateChange_=function(){0<this.tech_.playbackRate()&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(function(t){return t.callback(t.event)}),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},e.handleTechWaiting_=function(){var t=this;this.addClass("vjs-waiting"),this.trigger("waiting");var n=this.currentTime();this.on("timeupdate",function a(){n!==t.currentTime()&&(t.removeClass("vjs-waiting"),t.off("timeupdate",a))})},e.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},e.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},e.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},e.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},e.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.trigger("seeked")},e.handleTechFirstPlay_=function(){this.options_.starttime&&(Z.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")},e.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},e.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},e.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},e.handleTechClick_=function(t){ze(t)&&this.controls_&&(this.paused()?Si(this.play()):this.pause())},e.handleTechDoubleClick_=function(t){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(n){return n.contains(t.target)})||(this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},e.handleTechTap_=function(){this.userActive(!this.userActive())},e.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},e.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},e.handleTechTouchEnd_=function(t){t.preventDefault()},e.handleFullscreenChange_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},e.handleStageClick_=function(){this.reportUserActivity()},e.handleTechFullscreenChange_=function(t,n){n&&this.isFullscreen(n.isFullscreen),this.trigger("fullscreenchange")},e.handleTechError_=function(){var t=this.tech_.error();this.error(t)},e.handleTechTextData_=function(){var t=null;1<arguments.length&&(t=arguments[1]),this.trigger("textdata",t)},e.getCache=function(){return this.cache_},e.techCall_=function(t,n){this.ready(function(){if(t in Kh)return a=this.middleware_,s=this.tech_,u=n,s[o=t](a.reduce(Ur(o),u));if(t in wo)return ko(this.middleware_,this.tech_,t,n);var a,s,o,u;try{this.tech_&&this.tech_[t](n)}catch(c){throw Z(c),c}},!0)},e.techGet_=function(t){if(this.tech_&&this.tech_.isReady_){if(t in $h)return n=this.middleware_,a=this.tech_,s=t,n.reduceRight(Ur(s),a[s]());if(t in wo)return ko(this.middleware_,this.tech_,t);var n,a,s;try{return this.tech_[t]()}catch(o){throw this.tech_[t]===void 0?(Z("Video.js: "+t+" method not defined for "+this.techName_+" playback technology.",o),o):o.name==="TypeError"?(Z("Video.js: "+t+" unavailable on "+this.techName_+" playback technology element.",o),this.tech_.isReady_=!1,o):(Z(o),o)}}},e.play=function(){var t=this,n=this.options_.Promise||A.Promise;return n?new n(function(a){t.play_(a)}):this.play_()},e.play_=function(t){var n=this;if(t===void 0&&(t=Si),this.playOnLoadstart_&&this.off("loadstart",this.playOnLoadstart_),this.isReady_){if(!this.changingSrc_&&(this.src()||this.currentSrc()))return void t(this.techGet_("play"));this.playOnLoadstart_=function(){n.playOnLoadstart_=null,t(n.play())},this.one("loadstart",this.playOnLoadstart_)}else{if(this.playWaitingForReady_)return;this.playWaitingForReady_=!0,this.ready(function(){n.playWaitingForReady_=!1,t(n.play())})}},e.pause=function(){this.techCall_("pause")},e.paused=function(){return this.techGet_("paused")!==!1},e.played=function(){return this.techGet_("played")||Ue(0,0)},e.scrubbing=function(t){if(typeof t=="undefined")return this.scrubbing_;this.scrubbing_=!!t,t?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},e.currentTime=function(t){return typeof t!="undefined"?(t<0&&(t=0),void this.techCall_("setCurrentTime",t)):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},e.duration=function(t){if(t===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;(t=parseFloat(t))<0&&(t=1/0),t!==this.cache_.duration&&((this.cache_.duration=t)===1/0?(this.addClass("vjs-live"),this.options_.liveui&&this.player_.liveTracker&&this.addClass("vjs-liveui")):(this.removeClass("vjs-live"),this.removeClass("vjs-liveui")),isNaN(t)||this.trigger("durationchange"))},e.remainingTime=function(){return this.duration()-this.currentTime()},e.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},e.buffered=function(){var t=this.techGet_("buffered");return t&&t.length||(t=Ue(0,0)),t},e.bufferedPercent=function(){return io(this.buffered(),this.duration())},e.bufferedEnd=function(){var t=this.buffered(),n=this.duration(),a=t.end(t.length-1);return n<a&&(a=n),a},e.volume=function(t){var n;return t!==void 0?(n=Math.max(0,Math.min(1,parseFloat(t))),this.cache_.volume=n,this.techCall_("setVolume",n),void(0<n&&this.lastVolume_(n))):(n=parseFloat(this.techGet_("volume")),isNaN(n)?1:n)},e.muted=function(t){if(t===void 0)return this.techGet_("muted")||!1;this.techCall_("setMuted",t)},e.defaultMuted=function(t){return t!==void 0?this.techCall_("setDefaultMuted",t):this.techGet_("defaultMuted")||!1},e.lastVolume_=function(t){if(t===void 0||t===0)return this.cache_.lastVolume;this.cache_.lastVolume=t},e.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},e.isFullscreen=function(t){if(t===void 0)return!!this.isFullscreen_;this.isFullscreen_=!!t},e.requestFullscreen=function(){var t=rn;this.isFullscreen(!0),t.requestFullscreen?(Yt(B,t.fullscreenchange,$(this,function n(a){this.isFullscreen(B[t.fullscreenElement]),this.isFullscreen()===!1&&Dt(B,t.fullscreenchange,n),this.trigger("fullscreenchange")})),this.el_[t.requestFullscreen]()):this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):(this.enterFullWindow(),this.trigger("fullscreenchange"))},e.exitFullscreen=function(){var t=rn;this.isFullscreen(!1),t.requestFullscreen?B[t.exitFullscreen]():this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):(this.exitFullWindow(),this.trigger("fullscreenchange"))},e.enterFullWindow=function(){this.isFullWindow=!0,this.docOrigOverflow=B.documentElement.style.overflow,Yt(B,"keydown",$(this,this.fullWindowOnEscKey)),B.documentElement.style.overflow="hidden",Ee(B.body,"vjs-full-window"),this.trigger("enterFullWindow")},e.fullWindowOnEscKey=function(t){t.keyCode===27&&(this.isFullscreen()===!0?this.exitFullscreen():this.exitFullWindow())},e.exitFullWindow=function(){this.isFullWindow=!1,Dt(B,"keydown",this.fullWindowOnEscKey),B.documentElement.style.overflow=this.docOrigOverflow,fi(B.body,"vjs-full-window"),this.trigger("exitFullWindow")},e.canPlayType=function(t){for(var n,a=0,s=this.options_.techOrder;a<s.length;a++){var o=s[a],u=st.getTech(o);if(u||(u=D.getComponent(o)),u){if(u.isSupported()&&(n=u.canPlayType(t)))return n}else Z.error('The "'+o+'" tech is undefined. Skipped browser support check for that tech.')}return""},e.selectSource=function(t){var n,a=this,s=this.options_.techOrder.map(function(c){return[c,st.getTech(c)]}).filter(function(c){var d=c[0],p=c[1];return p?p.isSupported():(Z.error('The "'+d+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),o=function(c,d,p){var g;return c.some(function(y){return d.some(function(b){if(g=p(y,b))return!0})}),g},u=function(c,d){var p=c[0];if(c[1].canPlaySource(d,a.options_[p.toLowerCase()]))return{source:d,tech:p}};return(this.options_.sourceOrder?o(t,s,(n=u,function(c,d){return n(d,c)})):o(s,t,u))||!1},e.src=function(t){var n=this;if(typeof t=="undefined")return this.cache_.src||"";var a=function s(o){if(Array.isArray(o)){var u=[];o.forEach(function(c){c=s(c),Array.isArray(c)?u=u.concat(c):ve(c)&&u.push(c)}),o=u}else o=typeof o=="string"&&o.trim()?[Eo({src:o})]:ve(o)&&typeof o.src=="string"&&o.src&&o.src.trim()?[Eo(o)]:[];return o}(t);a.length?(this.changingSrc_=!0,this.cache_.sources=a,this.updateSourceCaches_(a[0]),Yh(this,a[0],function(s,o){var u,c;if(n.middleware_=o,n.cache_.sources=a,n.updateSourceCaches_(s),n.src_(s))return 1<a.length?n.src(a.slice(1)):(n.changingSrc_=!1,n.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0),void n.triggerReady());u=o,c=n.tech_,u.forEach(function(d){return d.setTech&&d.setTech(c)})})):this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0)},e.src_=function(t){var n,a,s=this,o=this.selectSource([t]);return!o||(n=o.tech,a=this.techName_,ft(n)!==ft(a)?(this.changingSrc_=!0,this.loadTech_(o.tech,o.source),this.tech_.ready(function(){s.changingSrc_=!1})):this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",t):this.techCall_("src",t.src),this.changingSrc_=!1},!0),!1)},e.load=function(){this.techCall_("load")},e.reset=function(){this.tech_&&this.tech_.clearTracks("text"),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),Oe(this)&&this.trigger("playerreset")},e.currentSources=function(){var t=this.currentSource(),n=[];return Object.keys(t).length!==0&&n.push(t),this.cache_.sources||n},e.currentSource=function(){return this.cache_.source||{}},e.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},e.currentType=function(){return this.currentSource()&&this.currentSource().type||""},e.preload=function(t){return t!==void 0?(this.techCall_("setPreload",t),void(this.options_.preload=t)):this.techGet_("preload")},e.autoplay=function(t){if(t===void 0)return this.options_.autoplay||!1;var n;typeof t=="string"&&/(any|play|muted)/.test(t)?(this.options_.autoplay=t,this.manualAutoplay_(t),n=!1):this.options_.autoplay=!!t,n=n||this.options_.autoplay,this.tech_&&this.techCall_("setAutoplay",n)},e.playsinline=function(t){return t!==void 0?(this.techCall_("setPlaysinline",t),this.options_.playsinline=t,this):this.techGet_("playsinline")},e.loop=function(t){return t!==void 0?(this.techCall_("setLoop",t),void(this.options_.loop=t)):this.techGet_("loop")},e.poster=function(t){if(t===void 0)return this.poster_;t||(t=""),t!==this.poster_&&(this.poster_=t,this.techCall_("setPoster",t),this.isPosterFromTech_=!1,this.trigger("posterchange"))},e.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var t=this.tech_.poster()||"";t!==this.poster_&&(this.poster_=t,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},e.controls=function(t){if(t===void 0)return!!this.controls_;t=!!t,this.controls_!==t&&(this.controls_=t,this.usingNativeControls()&&this.techCall_("setControls",t),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_()))},e.usingNativeControls=function(t){if(t===void 0)return!!this.usingNativeControls_;t=!!t,this.usingNativeControls_!==t&&(this.usingNativeControls_=t,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},e.error=function(t){return t===void 0?this.error_||null:t===null?(this.error_=t,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close())):(this.error_=new wt(t),this.addClass("vjs-error"),Z.error("(CODE:"+this.error_.code+" "+wt.errorTypes[this.error_.code]+")",this.error_.message,this.error_),void this.trigger("error"))},e.reportUserActivity=function(t){this.userActivity_=!0},e.userActive=function(t){if(t===void 0)return this.userActive_;if((t=!!t)!==this.userActive_){if(this.userActive_=t,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",function(n){n.stopPropagation(),n.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},e.listenForUserActivity_=function(){var t,n,a,s,o=$(this,this.reportUserActivity);this.on("mousedown",function(){o(),this.clearInterval(t),t=this.setInterval(o,250)}),this.on("mousemove",function(u){u.screenX===n&&u.screenY===a||(n=u.screenX,a=u.screenY,o())}),this.on("mouseup",function(u){o(),this.clearInterval(t)}),this.on("keydown",o),this.on("keyup",o),this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(s);var u=this.options_.inactivityTimeout;u<=0||(s=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},u))}},250)},e.playbackRate=function(t){if(t===void 0)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",t)},e.defaultPlaybackRate=function(t){return t!==void 0?this.techCall_("setDefaultPlaybackRate",t):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},e.isAudio=function(t){if(t===void 0)return!!this.isAudio_;this.isAudio_=!!t},e.addTextTrack=function(t,n,a){if(this.tech_)return this.tech_.addTextTrack(t,n,a)},e.addRemoteTextTrack=function(t,n){if(this.tech_)return this.tech_.addRemoteTextTrack(t,n)},e.removeRemoteTextTrack=function(t){t===void 0&&(t={});var n=t.track;if(n||(n=t),this.tech_)return this.tech_.removeRemoteTextTrack(n)},e.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},e.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},e.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},e.language=function(t){if(t===void 0)return this.language_;this.language_=String(t).toLowerCase()},e.languages=function(){return ot(r.prototype.options_.languages,this.languages_)},e.toJSON=function(){var t=ot(this.options_),n=t.tracks;t.tracks=[];for(var a=0;a<n.length;a++){var s=n[a];(s=ot(s)).player=void 0,t.tracks[a]=s}return t},e.createModal=function(t,n){var a=this;(n=n||{}).content=t||"";var s=new Ye(this,n);return this.addChild(s),s.on("dispose",function(){a.removeChild(s)}),s.open(),s},e.updateCurrentBreakpoint_=function(){if(this.responsive())for(var t=this.currentBreakpoint(),n=this.currentWidth(),a=0;a<ia.length;a++){var s=ia[a];if(n<=this.breakpoints_[s]){if(t===s)return;t&&this.removeClass(mn[t]),this.addClass(mn[s]),this.breakpoint_=s;break}}},e.removeCurrentBreakpoint_=function(){var t=this.currentBreakpointClass();this.breakpoint_="",t&&this.removeClass(t)},e.breakpoints=function(t){return t===void 0||(this.breakpoint_="",this.breakpoints_=ct({},vd,t),this.updateCurrentBreakpoint_()),ct(this.breakpoints_)},e.responsive=function(t){return t===void 0?this.responsive_:(t=Boolean(t))!==this.responsive_?((this.responsive_=t)?(this.on("playerresize",this.updateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.updateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),t):void 0},e.currentBreakpoint=function(){return this.breakpoint_},e.currentBreakpointClass=function(){return mn[this.breakpoint_]||""},r.getTagSettings=function(t){var n={sources:[],tracks:[]},a=oe(t),s=a["data-setup"];if(Ce(t,"vjs-fill")&&(a.fill=!0),Ce(t,"vjs-fluid")&&(a.fluid=!0),s!==null){var o=fh(s||"{}"),u=o[0],c=o[1];u&&Z.error(u),ct(a,c)}if(ct(n,a),t.hasChildNodes())for(var d=t.childNodes,p=0,g=d.length;p<g;p++){var y=d[p],b=y.nodeName.toLowerCase();b==="source"?n.sources.push(oe(y)):b==="track"&&n.tracks.push(oe(y))}return n},e.flexNotSupported_=function(){var t=B.createElement("i");return!("flexBasis"in t.style||"webkitFlexBasis"in t.style||"mozFlexBasis"in t.style||"msFlexBasis"in t.style||"msFlexOrder"in t.style)},r}(D);Rt.names.forEach(function(i){var r=Rt[i];_t.prototype[r.getterName]=function(){return this.tech_?this.tech_[r.getterName]():(this[r.privateName]=this[r.privateName]||new r.ListClass,this[r.privateName])}}),_t.players={};var xi=A.navigator;_t.prototype.options_={techOrder:st.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:xi&&(xi.languages&&xi.languages[0]||xi.userLanguage||xi.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",breakpoints:{},responsive:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(i){_t.prototype[i]=function(){return this.techGet_(i)}}),ou.forEach(function(i){_t.prototype["handleTech"+ft(i)+"_"]=function(){return this.trigger(i)}}),D.registerComponent("Player",_t);var gn="plugin",ti="activePlugins_",ei={},yn=function(i){return ei.hasOwnProperty(i)},vn=function(i){return yn(i)?ei[i]:void 0},uu=function(i,r){i[ti]=i[ti]||{},i[ti][r]=!0},_n=function(i,r,e){var t=(e?"before":"")+"pluginsetup";i.trigger(t,r),i.trigger(t+":"+r.name,r)},lu=function(i,r){return r.prototype.name=i,function(){_n(this,{name:i,plugin:r,instance:null},!0);for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var a=ys(r,[this].concat(t));return this[i]=function(){return a},_n(this,a.getEventHash()),a}},ae=function(){function i(e){if(this.constructor===i)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,lr(this),delete this.trigger,Gs(this,this.constructor.defaultState),uu(e,this.name),this.dispose=$(this,this.dispose),e.on("dispose",this.dispose)}var r=i.prototype;return r.version=function(){return this.constructor.VERSION},r.getEventHash=function(e){return e===void 0&&(e={}),e.name=this.name,e.plugin=this.constructor,e.instance=this,e},r.trigger=function(e,t){return t===void 0&&(t={}),We(this.eventBusEl_,e,this.getEventHash(t))},r.handleStateChanged=function(e){},r.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[ti][e]=!1,this.player=this.state=null,t[e]=lu(e,ei[e])},i.isBasic=function(e){var t=typeof e=="string"?vn(e):e;return typeof t=="function"&&!i.prototype.isPrototypeOf(t.prototype)},i.registerPlugin=function(e,t){if(typeof e!="string")throw new Error('Illegal plugin name, "'+e+'", must be a string, was '+typeof e+".");if(yn(e))Z.warn('A plugin named "'+e+'" already exists. You may want to avoid re-registering plugins!');else if(_t.prototype.hasOwnProperty(e))throw new Error('Illegal plugin name, "'+e+'", cannot share a name with an existing player method!');if(typeof t!="function")throw new Error('Illegal plugin for "'+e+'", must be a function, was '+typeof t+".");var n,a,s;return ei[e]=t,e!==gn&&(i.isBasic(t)?_t.prototype[e]=(n=e,a=t,s=function(){_n(this,{name:n,plugin:a,instance:null},!0);var o=a.apply(this,arguments);return uu(this,n),_n(this,{name:n,plugin:a,instance:o}),o},Object.keys(a).forEach(function(o){s[o]=a[o]}),s):_t.prototype[e]=lu(e,t)),t},i.deregisterPlugin=function(e){if(e===gn)throw new Error("Cannot de-register base plugin.");yn(e)&&(delete ei[e],delete _t.prototype[e])},i.getPlugins=function(e){var t;return e===void 0&&(e=Object.keys(ei)),e.forEach(function(n){var a=vn(n);a&&((t=t||{})[n]=a)}),t},i.getPluginVersion=function(e){var t=vn(e);return t&&t.VERSION||""},i}();ae.getPlugin=vn,ae.BASE_PLUGIN_NAME=gn,ae.registerPlugin(gn,ae),_t.prototype.usingPlugin=function(i){return!!this[ti]&&this[ti][i]===!0},_t.prototype.hasPlugin=function(i){return!!yn(i)};var cu=function(i){return i.indexOf("#")===0?i.slice(1):i};function O(i,r,e){var t=O.getPlayer(i);if(t)return r&&Z.warn('Player "'+i+'" is already initialised. Options will not be applied.'),e&&t.ready(e),t;var n=typeof i=="string"?_e("#"+cu(i)):i;if(!pi(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");B.body.contains(n)||Z.warn("The element supplied is not included in the DOM"),r=r||{},O.hooks("beforesetup").forEach(function(s){var o=s(n,ot(r));ve(o)&&!Array.isArray(o)?r=ot(r,o):Z.error("please return an object in beforesetup hooks")});var a=D.getComponent("Player");return t=new a(n,r,e),O.hooks("setup").forEach(function(s){return s(t)}),t}if(O.hooks_={},O.hooks=function(i,r){return O.hooks_[i]=O.hooks_[i]||[],r&&(O.hooks_[i]=O.hooks_[i].concat(r)),O.hooks_[i]},O.hook=function(i,r){O.hooks(i,r)},O.hookOnce=function(i,r){O.hooks(i,[].concat(r).map(function(e){return function t(){return O.removeHook(i,t),e.apply(void 0,arguments)}}))},O.removeHook=function(i,r){var e=O.hooks(i).indexOf(r);return!(e<=-1)&&(O.hooks_[i]=O.hooks_[i].slice(),O.hooks_[i].splice(e,1),!0)},A.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&He()){var bn=_e(".vjs-styles-defaults");if(!bn){bn=Fs("vjs-styles-defaults");var na=_e("head");na&&na.insertBefore(bn,na.firstChild),Vs(bn,`
|
|
.video-js {
|
|
width: 300px;
|
|
height: 150px;
|
|
}
|
|
|
|
.vjs-fluid {
|
|
|
|
}
|
|
`)}}or(1,O),O.VERSION=ms,O.options=_t.prototype.options_,O.getPlayers=function(){return _t.players},O.getPlayer=function(i){var r,e=_t.players;if(typeof i=="string"){var t=cu(i),n=e[t];if(n)return n;r=_e("#"+t)}else r=i;if(pi(r)){var a=r,s=a.player,o=a.playerId;if(s||e[o])return s||e[o]}},O.getAllPlayers=function(){return Object.keys(_t.players).map(function(i){return _t.players[i]}).filter(Boolean)},O.players=_t.players,O.getComponent=D.getComponent,O.registerComponent=function(i,r){st.isTech(r)&&Z.warn("The "+i+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),D.registerComponent.call(D,i,r)},O.getTech=st.getTech,O.registerTech=st.registerTech,O.use=function(i,r){Ie[i]=Ie[i]||[],Ie[i].push(r)},Object.defineProperty(O,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(O.middleware,"TERMINATOR",{value:cn,writeable:!1,enumerable:!0}),O.browser=dh,O.TOUCH_ENABLED=en,O.extend=function(i,r){r===void 0&&(r={});var e=function(){i.apply(this,arguments)},t={};for(var n in typeof r=="object"?(r.constructor!==Object.prototype.constructor&&(e=r.constructor),t=r):typeof r=="function"&&(e=r),function(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);a.prototype=Object.create(s&&s.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),s&&(a.super_=s)}(e,i),t)t.hasOwnProperty(n)&&(e.prototype[n]=t[n]);return e},O.mergeOptions=ot,O.bind=$,O.registerPlugin=ae.registerPlugin,O.deregisterPlugin=ae.deregisterPlugin,O.plugin=function(i,r){return Z.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),ae.registerPlugin(i,r)},O.getPlugins=ae.getPlugins,O.getPlugin=ae.getPlugin,O.getPluginVersion=ae.getPluginVersion,O.addLanguage=function(i,r){var e;return i=(""+i).toLowerCase(),O.options.languages=ot(O.options.languages,((e={})[i]=r,e)),O.options.languages[i]},O.log=Z,O.createLogger=vs,O.createTimeRange=O.createTimeRanges=Ue,O.formatTime=Qe,O.setFormatTime=function(i){Dr=i},O.resetFormatTime=function(){Dr=Oo},O.parseUrl=kr,O.isCrossOrigin=un,O.EventTarget=Pt,O.on=Yt,O.one=_i,O.off=Dt,O.trigger=We,O.xhr=po,O.TextTrack=wi,O.AudioTrack=yo,O.VideoTrack=vo,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(i){O[i]=function(){return Z.warn("videojs."+i+"() is deprecated; use videojs.dom."+i+"() instead"),Rs[i].apply(null,arguments)}}),O.computedStyle=tr,O.dom=Rs,O.url=wh;var hu=Cr(function(i,r){var e,t,n,a,s;e=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,t=/^([^\/?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(o,u,c){if(c=c||{},o=o.trim(),!(u=u.trim())){if(!c.alwaysNormalize)return o;var d=s.parseURL(o);if(!d)throw new Error("Error trying to parse base URL.");return d.path=s.normalizePath(d.path),s.buildURLFromParts(d)}var p=s.parseURL(u);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return c.alwaysNormalize?(p.path=s.normalizePath(p.path),s.buildURLFromParts(p)):u;var g=s.parseURL(o);if(!g)throw new Error("Error trying to parse base URL.");if(!g.netLoc&&g.path&&g.path[0]!=="/"){var y=t.exec(g.path);g.netLoc=y[1],g.path=y[2]}g.netLoc&&!g.path&&(g.path="/");var b={scheme:g.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(b.netLoc=g.netLoc,p.path[0]!=="/"))if(p.path){var T=g.path,S=T.substring(0,T.lastIndexOf("/")+1)+p.path;b.path=s.normalizePath(S)}else b.path=g.path,p.params||(b.params=g.params,p.query||(b.query=g.query));return b.path===null&&(b.path=c.alwaysNormalize?s.normalizePath(p.path):p.path),s.buildURLFromParts(b)},parseURL:function(o){var u=e.exec(o);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(o){for(o=o.split("").reverse().join("").replace(n,"");o.length!==(o=o.replace(a,"")).length;);return o.split("").reverse().join("")},buildURLFromParts:function(o){return o.scheme+o.netLoc+o.path+o.params+o.query+o.fragment}},i.exports=s}),Tn=function(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")},_d=Object.assign||function(i){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=e[t])}return i},ra=function(i,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof r);i.prototype=Object.create(r&&r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(i,r):i.__proto__=r)},aa=function(i,r){if(!i)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||typeof r!="object"&&typeof r!="function"?i:r},sa=function(){function i(){Tn(this,i),this.listeners={}}return i.prototype.on=function(r,e){this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push(e)},i.prototype.off=function(r,e){if(!this.listeners[r])return!1;var t=this.listeners[r].indexOf(e);return this.listeners[r].splice(t,1),-1<t},i.prototype.trigger=function(r){var e=this.listeners[r],t=void 0,n=void 0,a=void 0;if(e)if(arguments.length===2)for(n=e.length,t=0;t<n;++t)e[t].call(this,arguments[1]);else for(a=Array.prototype.slice.call(arguments,1),n=e.length,t=0;t<n;++t)e[t].apply(this,a)},i.prototype.dispose=function(){this.listeners={}},i.prototype.pipe=function(r){this.on("data",function(e){r.push(e)})},i}(),bd=function(i){function r(){Tn(this,r);var e=aa(this,i.call(this));return e.buffer="",e}return ra(r,i),r.prototype.push=function(e){var t=void 0;for(this.buffer+=e,t=this.buffer.indexOf(`
|
|
`);-1<t;t=this.buffer.indexOf(`
|
|
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},r}(sa),Di=function(i){for(var r=i.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),e={},t=r.length,n=void 0;t--;)r[t]!==""&&((n=/([^=]*)=(.*)/.exec(r[t]).slice(1))[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),e[n[0]]=n[1]);return e},Td=function(i){function r(){Tn(this,r);var e=aa(this,i.call(this));return e.customParsers=[],e}return ra(r,i),r.prototype.push=function(e){var t=void 0,n=void 0;if((e=e.replace(/^[\u0000\s]+|[\u0000\s]+$/g,"")).length!==0)if(e[0]==="#"){for(var a=0;a<this.customParsers.length;a++)if(this.customParsers[a].call(this,e))return;if(e.indexOf("#EXT")===0)if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))this.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return n={type:"tag",tagType:"inf"},t[1]&&(n.duration=parseFloat(t[1])),t[2]&&(n.title=t[2]),void this.trigger("data",n);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"targetduration"},t[1]&&(n.duration=parseInt(t[1],10)),void this.trigger("data",n);if(t=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"totalduration"},t[1]&&(n.duration=parseInt(t[1],10)),void this.trigger("data",n);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"version"},t[1]&&(n.version=parseInt(t[1],10)),void this.trigger("data",n);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return n={type:"tag",tagType:"media-sequence"},t[1]&&(n.number=parseInt(t[1],10)),void this.trigger("data",n);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return n={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(n.number=parseInt(t[1],10)),void this.trigger("data",n);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return n={type:"tag",tagType:"playlist-type"},t[1]&&(n.playlistType=t[1]),void this.trigger("data",n);if(t=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"byterange"},t[1]&&(n.length=parseInt(t[1],10)),t[2]&&(n.offset=parseInt(t[2],10)),void this.trigger("data",n);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return n={type:"tag",tagType:"allow-cache"},t[1]&&(n.allowed=!/NO/.test(t[1])),void this.trigger("data",n);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(n={type:"tag",tagType:"map"},t[1]){var s=Di(t[1]);if(s.URI&&(n.uri=s.URI),s.BYTERANGE){var o=s.BYTERANGE.split("@"),u=o[0],c=o[1];n.byterange={},u&&(n.byterange.length=parseInt(u,10)),c&&(n.byterange.offset=parseInt(c,10))}}this.trigger("data",n)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(n={type:"tag",tagType:"stream-inf"},t[1]){if(n.attributes=Di(t[1]),n.attributes.RESOLUTION){var d=n.attributes.RESOLUTION.split("x"),p={};d[0]&&(p.width=parseInt(d[0],10)),d[1]&&(p.height=parseInt(d[1],10)),n.attributes.RESOLUTION=p}n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes["PROGRAM-ID"]&&(n.attributes["PROGRAM-ID"]=parseInt(n.attributes["PROGRAM-ID"],10))}this.trigger("data",n)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return n={type:"tag",tagType:"media"},t[1]&&(n.attributes=Di(t[1])),void this.trigger("data",n);if(t=/^#EXT-X-ENDLIST/.exec(e))this.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))this.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return n={type:"tag",tagType:"program-date-time"},t[1]&&(n.dateTimeString=t[1],n.dateTimeObject=new Date(t[1])),void this.trigger("data",n);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return n={type:"tag",tagType:"key"},t[1]&&(n.attributes=Di(t[1]),n.attributes.IV&&(n.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(n.attributes.IV=n.attributes.IV.substring(2)),n.attributes.IV=n.attributes.IV.match(/.{8}/g),n.attributes.IV[0]=parseInt(n.attributes.IV[0],16),n.attributes.IV[1]=parseInt(n.attributes.IV[1],16),n.attributes.IV[2]=parseInt(n.attributes.IV[2],16),n.attributes.IV[3]=parseInt(n.attributes.IV[3],16),n.attributes.IV=new Uint32Array(n.attributes.IV))),void this.trigger("data",n);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return n={type:"tag",tagType:"start"},t[1]&&(n.attributes=Di(t[1]),n.attributes["TIME-OFFSET"]=parseFloat(n.attributes["TIME-OFFSET"]),n.attributes.PRECISE=/YES/.test(n.attributes.PRECISE)),void this.trigger("data",n);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-out-cont"},t[1]?n.data=t[1]:n.data="",void this.trigger("data",n);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-out"},t[1]?n.data=t[1]:n.data="",void this.trigger("data",n);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-in"},t[1]?n.data=t[1]:n.data="",void this.trigger("data",n);this.trigger("data",{type:"tag",data:e.slice(4)})}}}else this.trigger("data",{type:"comment",text:e.slice(1)})}else this.trigger("data",{type:"uri",uri:e})},r.prototype.addParser=function(e){var t=this,n=e.expression,a=e.customType,s=e.dataParser,o=e.segment;typeof s!="function"&&(s=function(u){return u}),this.customParsers.push(function(u){if(n.exec(u))return t.trigger("data",{type:"custom",data:s(u),customType:a,segment:o}),!0})},r}(sa),du=function(i){function r(){Tn(this,r);var e=aa(this,i.call(this));e.lineStream=new bd,e.parseStream=new Td,e.lineStream.pipe(e.parseStream);var t=e,n=[],a={},s=void 0,o=void 0,u={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},c=0;return e.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},e.parseStream.on("data",function(d){var p=void 0,g=void 0;({tag:function(){({"allow-cache":function(){this.manifest.allowCache=d.allowed,"allowed"in d||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var y={};"length"in d&&((a.byterange=y).length=d.length,"offset"in d||(this.trigger("info",{message:"defaulting offset to zero"}),d.offset=0)),"offset"in d&&((a.byterange=y).offset=d.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),0<d.duration&&(a.duration=d.duration),d.duration===0&&(a.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=n},key:function(){d.attributes?d.attributes.METHOD!=="NONE"?d.attributes.URI?(d.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),o={method:d.attributes.METHOD||"AES-128",uri:d.attributes.URI},typeof d.attributes.IV!="undefined"&&(o.iv=d.attributes.IV)):this.trigger("warn",{message:"ignoring key declaration without URI"}):o=null:this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(d.number)?this.manifest.mediaSequence=d.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+d.number})},"discontinuity-sequence":function(){isFinite(d.number)?(this.manifest.discontinuitySequence=d.number,c=d.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+d.number})},"playlist-type":function(){/VOD|EVENT/.test(d.playlistType)?this.manifest.playlistType=d.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+d.playlist})},map:function(){s={},d.uri&&(s.uri=d.uri),d.byterange&&(s.byterange=d.byterange)},"stream-inf":function(){this.manifest.playlists=n,this.manifest.mediaGroups=this.manifest.mediaGroups||u,d.attributes?(a.attributes||(a.attributes={}),_d(a.attributes,d.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||u,d.attributes&&d.attributes.TYPE&&d.attributes["GROUP-ID"]&&d.attributes.NAME){var y=this.manifest.mediaGroups[d.attributes.TYPE];y[d.attributes["GROUP-ID"]]=y[d.attributes["GROUP-ID"]]||{},p=y[d.attributes["GROUP-ID"]],(g={default:/yes/i.test(d.attributes.DEFAULT)}).default?g.autoselect=!0:g.autoselect=/yes/i.test(d.attributes.AUTOSELECT),d.attributes.LANGUAGE&&(g.language=d.attributes.LANGUAGE),d.attributes.URI&&(g.uri=d.attributes.URI),d.attributes["INSTREAM-ID"]&&(g.instreamId=d.attributes["INSTREAM-ID"]),d.attributes.CHARACTERISTICS&&(g.characteristics=d.attributes.CHARACTERISTICS),d.attributes.FORCED&&(g.forced=/yes/i.test(d.attributes.FORCED)),p[d.attributes.NAME]=g}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){c+=1,a.discontinuity=!0,this.manifest.discontinuityStarts.push(n.length)},"program-date-time":function(){typeof this.manifest.dateTimeString=="undefined"&&(this.manifest.dateTimeString=d.dateTimeString,this.manifest.dateTimeObject=d.dateTimeObject),a.dateTimeString=d.dateTimeString,a.dateTimeObject=d.dateTimeObject},targetduration:function(){!isFinite(d.duration)||d.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+d.duration}):this.manifest.targetDuration=d.duration},totalduration:function(){!isFinite(d.duration)||d.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+d.duration}):this.manifest.totalDuration=d.duration},start:function(){d.attributes&&!isNaN(d.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:d.attributes["TIME-OFFSET"],precise:d.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){a.cueOut=d.data},"cue-out-cont":function(){a.cueOutCont=d.data},"cue-in":function(){a.cueIn=d.data}}[d.tagType]||function(){}).call(t)},uri:function(){a.uri=d.uri,n.push(a),!this.manifest.targetDuration||"duration"in a||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),a.duration=this.manifest.targetDuration),o&&(a.key=o),a.timeline=c,s&&(a.map=s),a={}},comment:function(){},custom:function(){d.segment?(a.custom=a.custom||{},a.custom[d.customType]=d.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[d.customType]=d.data)}})[d.type].call(t)}),e}return ra(r,i),r.prototype.push=function(e){this.lineStream.push(e)},r.prototype.end=function(){this.lineStream.push(`
|
|
`)},r.prototype.addParser=function(e){this.parseStream.addParser(e)},r}(sa),pu=function(i){return!!i&&typeof i=="object"},Mt=function i(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.reduce(function(n,a){return Object.keys(a).forEach(function(s){Array.isArray(n[s])&&Array.isArray(a[s])?n[s]=n[s].concat(a[s]):pu(n[s])&&pu(a[s])?n[s]=i(n[s],a[s]):n[s]=a[s]}),n},{})},Sn=function(i){return i.reduce(function(r,e){return r.concat(e)},[])},fu=function(i){if(!i.length)return[];for(var r=[],e=0;e<i.length;e++)r.push(i[e]);return r},mu=function(i){var r;return(r=i.reduce(function(e,t){var n,a=t.attributes.id+(t.attributes.lang||"");return e[a]?(t.segments[0].discontinuity=!0,(n=e[a].segments).push.apply(n,t.segments),t.attributes.contentProtection&&(e[a].attributes.contentProtection=t.attributes.contentProtection)):e[a]=t,e},{}),Object.keys(r).map(function(e){return r[e]})).map(function(e){var t,n;return e.discontinuityStarts=(t=e.segments,n="discontinuity",t.reduce(function(a,s,o){return s[n]&&a.push(o),a},[])),e})},Sd=function(i){var r,e=i.attributes,t=i.segments,n={attributes:(r={NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth},r["PROGRAM-ID"]=1,r),uri:"",endList:(e.type||"static")==="static",timeline:e.periodIndex,resolvedUri:"",targetDuration:e.duration,segments:t,mediaSequence:t.length?t[0].number:1};return e.contentProtection&&(n.contentProtection=e.contentProtection),n};typeof window!="undefined"||typeof global!="undefined"&&global;var oa,gu=(function(i,r){var e,t,n,a,s;e=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,t=/^([^\/?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(o,u,c){if(c=c||{},o=o.trim(),!(u=u.trim())){if(!c.alwaysNormalize)return o;var d=s.parseURL(o);if(!d)throw new Error("Error trying to parse base URL.");return d.path=s.normalizePath(d.path),s.buildURLFromParts(d)}var p=s.parseURL(u);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return c.alwaysNormalize?(p.path=s.normalizePath(p.path),s.buildURLFromParts(p)):u;var g=s.parseURL(o);if(!g)throw new Error("Error trying to parse base URL.");if(!g.netLoc&&g.path&&g.path[0]!=="/"){var y=t.exec(g.path);g.netLoc=y[1],g.path=y[2]}g.netLoc&&!g.path&&(g.path="/");var b={scheme:g.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(b.netLoc=g.netLoc,p.path[0]!=="/"))if(p.path){var T=g.path,S=T.substring(0,T.lastIndexOf("/")+1)+p.path;b.path=s.normalizePath(S)}else b.path=g.path,p.params||(b.params=g.params,p.query||(b.query=g.query));return b.path===null&&(b.path=c.alwaysNormalize?s.normalizePath(p.path):p.path),s.buildURLFromParts(b)},parseURL:function(o){var u=e.exec(o);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(o){for(o=o.split("").reverse().join("").replace(n,"");o.length!==(o=o.replace(a,"")).length;);return o.split("").reverse().join("")},buildURLFromParts:function(o){return o.scheme+o.netLoc+o.path+o.params+o.query+o.fragment}},i.exports=s}(oa={exports:{}},oa.exports),oa.exports),ua=function(i,r){return/^[a-z]+:/i.test(r)?r:(/\/\//i.test(i)||(i=gu.buildAbsoluteURL(A.location.href,i)),gu.buildAbsoluteURL(i,r))},Ri=function(i){var r=i.baseUrl,e=r===void 0?"":r,t=i.source,n=t===void 0?"":t,a=i.range,s=a===void 0?"":a,o={uri:n,resolvedUri:ua(e||"",n)};if(s){var u=s.split("-"),c=parseInt(u[0],10),d=parseInt(u[1],10);o.byterange={length:d-c,offset:c}}return o},yu=function(i,r){for(var e,t,n,a,s,o,u,c,d,p,g,y,b=i.type,T=b===void 0?"static":b,S=i.minimumUpdatePeriod,C=S===void 0?0:S,E=i.media,U=E===void 0?"":E,I=i.sourceDuration,x=i.timescale,q=x===void 0?1:x,H=i.startNumber,R=H===void 0?1:H,G=i.periodIndex,ut=[],z=-1,et=0;et<r.length;et++){var rt=r[et],lt=rt.d,mt=rt.r||0,J=rt.t||0;z<0&&(z=J),J&&z<J&&(z=J);var vt=void 0;if(mt<0){var gt=et+1;vt=gt===r.length?T==="dynamic"&&0<C&&0<U.indexOf("$Number$")?(t=z,n=lt,a=(e=i).NOW,s=e.clientOffset,o=e.availabilityStartTime,u=e.timescale,c=u===void 0?1:u,d=e.start,p=d===void 0?0:d,g=e.minimumUpdatePeriod,y=(a+s)/1e3+(g===void 0?0:g)-(o+p),Math.ceil((y*c-t)/n)):(I*q-z)/lt:(r[gt].t-z)/lt}else vt=mt+1;for(var he=R+ut.length+vt,te=R+ut.length;te<he;)ut.push({number:te,duration:lt/q,time:z,timeline:G}),z+=lt,te++}return ut},kd={static:function(i){var r=i.duration,e=i.timescale,t=e===void 0?1:e,n=i.sourceDuration;return{start:0,end:Math.ceil(n/(r/t))}},dynamic:function(i){var r=i.NOW,e=i.clientOffset,t=i.availabilityStartTime,n=i.timescale,a=n===void 0?1:n,s=i.duration,o=i.start,u=o===void 0?0:o,c=i.minimumUpdatePeriod,d=c===void 0?0:c,p=i.timeShiftBufferDepth,g=p===void 0?1/0:p,y=(r+e)/1e3,b=t+u,T=y+d-b,S=Math.ceil(T*a/s),C=Math.floor((y-b-g)*a/s),E=Math.floor((y-b)*a/s);return{start:Math.max(0,C),end:Math.min(S,E)}}},la=function(i){var r,e=i.type,t=e===void 0?"static":e,n=i.duration,a=i.timescale,s=a===void 0?1:a,o=i.sourceDuration,u=kd[t](i),c=function(p,g){for(var y=[],b=p;b<g;b++)y.push(b);return y}(u.start,u.end).map((r=i,function(p,g){var y=r.duration,b=r.timescale,T=b===void 0?1:b,S=r.periodIndex,C=r.startNumber;return{number:(C===void 0?1:C)+p,duration:y/T,timeline:S,time:g*y}}));if(t==="static"){var d=c.length-1;c[d].duration=o-n/s*d}return c},wd=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,vu=function(i,r){return i.replace(wd,(e=r,function(t,n,a,s){if(t==="$$")return"$";if(typeof e[n]=="undefined")return t;var o=""+e[n];return n==="RepresentationID"||(s=a?parseInt(s,10):1)<=o.length?o:""+new Array(s-o.length+1).join("0")+o}));var e},Cd=function(i,r){var e,t,n={RepresentationID:i.id,Bandwidth:i.bandwidth||0},a=i.initialization,s=a===void 0?{sourceURL:"",range:""}:a,o=Ri({baseUrl:i.baseUrl,source:vu(s.sourceURL,n),range:s.range});return(t=r,(e=i).duration||t?e.duration?la(e):yu(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]).map(function(u){n.Number=u.number,n.Time=u.time;var c=vu(i.media||"",n);return{uri:c,timeline:u.timeline,duration:u.duration,resolvedUri:ua(i.baseUrl||"",c),map:o,number:u.number}})},Ed="INVALID_NUMBER_OF_PERIOD",Ad="DASH_EMPTY_MANIFEST",Ld="DASH_INVALID_XML",Od="NO_BASE_URL",Pd="SEGMENT_TIME_UNSPECIFIED",Ud="UNSUPPORTED_UTC_TIMING_SCHEME",Id=function(i,r){var e=i.duration,t=i.segmentUrls,n=t===void 0?[]:t;if(!e&&!r||e&&r)throw new Error(Pd);var a,s=n.map(function(o){return c=o,d=(u=i).baseUrl,p=u.initialization,y=Ri({baseUrl:d,source:(g=p===void 0?{}:p).sourceURL,range:g.range}),(b=Ri({baseUrl:d,source:c.media,range:c.mediaRange})).map=y,b;var u,c,d,p,g,y,b});return e&&(a=la(i)),r&&(a=yu(i,r)),a.map(function(o,u){if(s[u]){var c=s[u];return c.timeline=o.timeline,c.duration=o.duration,c.number=o.number,c}}).filter(function(o){return o})},xd=function(i){var r=i.baseUrl,e=i.initialization,t=e===void 0?{}:e,n=i.sourceDuration,a=i.timescale,s=a===void 0?1:a,o=i.indexRange,u=o===void 0?"":o,c=i.duration;if(!r)throw new Error(Od);var d=Ri({baseUrl:r,source:t.sourceURL,range:t.range}),p=Ri({baseUrl:r,source:r,range:u});if(p.map=d,c){var g=la(i);g.length&&(p.duration=g[0].duration,p.timeline=g[0].timeline)}else n&&(p.duration=n/s,p.timeline=0);return p.number=0,[p]},Dd=function(i){var r,e,t=i.attributes,n=i.segmentInfo;if(n.template?(e=Cd,r=Mt(t,n.template)):n.base?(e=xd,r=Mt(t,n.base)):n.list&&(e=Id,r=Mt(t,n.list)),!e)return{attributes:t};var a=e(r,n.timeline);if(r.duration){var s=r,o=s.duration,u=s.timescale,c=u===void 0?1:u;r.duration=o/c}else a.length?r.duration=a.reduce(function(d,p){return Math.max(d,Math.ceil(p.duration))},0):r.duration=0;return{attributes:r,segments:a}},bt=function(i,r){return fu(i.childNodes).filter(function(e){return e.tagName===r})},_u=function(i){return i.textContent.trim()},Mi=function(i){var r=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(i);if(!r)return 0;var e=r.slice(1),t=e[0],n=e[1],a=e[2],s=e[3],o=e[4],u=e[5];return 31536e3*parseFloat(t||0)+2592e3*parseFloat(n||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)},bu={mediaPresentationDuration:function(i){return Mi(i)},availabilityStartTime:function(i){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(r=i)&&(r+="Z"),Date.parse(r)/1e3;var r},minimumUpdatePeriod:function(i){return Mi(i)},timeShiftBufferDepth:function(i){return Mi(i)},start:function(i){return Mi(i)},width:function(i){return parseInt(i,10)},height:function(i){return parseInt(i,10)},bandwidth:function(i){return parseInt(i,10)},startNumber:function(i){return parseInt(i,10)},timescale:function(i){return parseInt(i,10)},duration:function(i){var r=parseInt(i,10);return isNaN(r)?Mi(i):r},d:function(i){return parseInt(i,10)},t:function(i){return parseInt(i,10)},r:function(i){return parseInt(i,10)},DEFAULT:function(i){return i}},Et=function(i){return i&&i.attributes?fu(i.attributes).reduce(function(r,e){var t=bu[e.name]||bu.DEFAULT;return r[e.name]=t(e.value),r},{}):{}},Kt,ca,Tu,Su,ku,Rd={"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"},kn=function(i,r){return r.length?Sn(i.map(function(e){return r.map(function(t){return ua(e,_u(t))})})):i},ha=function(i){var r=bt(i,"SegmentTemplate")[0],e=bt(i,"SegmentList")[0],t=e&&bt(e,"SegmentURL").map(function(p){return Mt({tag:"SegmentURL"},Et(p))}),n=bt(i,"SegmentBase")[0],a=e||r,s=a&&bt(a,"SegmentTimeline")[0],o=e||n||r,u=o&&bt(o,"Initialization")[0],c=r&&Et(r);c&&u?c.initialization=u&&Et(u):c&&c.initialization&&(c.initialization={sourceURL:c.initialization});var d={template:c,timeline:s&&bt(s,"S").map(function(p){return Et(p)}),list:e&&Mt(Et(e),{segmentUrls:t,initialization:Et(u)}),base:n&&Mt(Et(n),{initialization:Et(u)})};return Object.keys(d).forEach(function(p){d[p]||delete d[p]}),d},Md=function(i){return i.reduce(function(r,e){var t=Et(e),n=Rd[t.schemeIdUri];if(n){r[n]={attributes:t};var a=bt(e,"cenc:pssh")[0];if(a){var s=_u(a),o=s&&function(u){for(var c=A.atob(u),d=new Uint8Array(c.length),p=0;p<c.length;p++)d[p]=c.charCodeAt(p);return d}(s);r[n].pssh=o}}return r},{})},Bd=function(i,r,e){return function(t){var n=Et(t),a=kn(r,bt(t,"BaseURL")),s=bt(t,"Role")[0],o={role:Et(s)},u=Mt(i,n,o),c=Md(bt(t,"ContentProtection"));Object.keys(c).length&&(u=Mt(u,{contentProtection:c}));var d,p,g,y=ha(t),b=bt(t,"Representation"),T=Mt(e,y);return Sn(b.map((d=u,p=a,g=T,function(S){var C=bt(S,"BaseURL"),E=kn(p,C),U=Mt(d,Et(S)),I=ha(S);return E.map(function(x){return{segmentInfo:Mt(g,I),attributes:Mt(U,{baseUrl:x})}})})))}},Nd=function(i,r){r===void 0&&(r={});var e=r,t=e.manifestUri,n=t===void 0?"":t,a=e.NOW,s=a===void 0?Date.now():a,o=e.clientOffset,u=o===void 0?0:o,c=bt(i,"Period");if(!c.length)throw new Error(Ed);var d,p,g=Et(i),y=kn([n],bt(i,"BaseURL"));return g.sourceDuration=g.mediaPresentationDuration||0,g.NOW=s,g.clientOffset=u,Sn(c.map((d=g,p=y,function(b,T){var S=kn(p,bt(b,"BaseURL")),C=Et(b),E=parseInt(C.id,10),U=A.isNaN(E)?T:E,I=Mt(d,{periodIndex:U}),x=bt(b,"AdaptationSet"),q=ha(b);return Sn(x.map(Bd(I,S,q)))})))},wu=function(i){if(i==="")throw new Error(Ad);var r=new A.DOMParser().parseFromString(i,"application/xml"),e=r&&r.documentElement.tagName==="MPD"?r.documentElement:null;if(!e||e&&0<e.getElementsByTagName("parsererror").length)throw new Error(Ld);return e},jd=function(i,r){return function(e){var t;if(!e.length)return{};var n=e[0].attributes,a=n.sourceDuration,s=n.minimumUpdatePeriod,o=s===void 0?0:s,u=mu(e.filter(function(g){var y=g.attributes;return y.mimeType==="video/mp4"||y.contentType==="video"})).map(Sd),c=mu(e.filter(function(g){var y=g.attributes;return y.mimeType==="audio/mp4"||y.contentType==="audio"})),d=e.filter(function(g){var y=g.attributes;return y.mimeType==="text/vtt"||y.contentType==="text"}),p={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(t={AUDIO:{},VIDEO:{}},t["CLOSED-CAPTIONS"]={},t.SUBTITLES={},t),uri:"",duration:a,playlists:u,minimumUpdatePeriod:1e3*o};return c.length&&(p.mediaGroups.AUDIO.audio=c.reduce(function(g,y){var b,T,S,C,E,U=y.attributes.role&&y.attributes.role.value||"main",I=y.attributes.lang||"",x="main";return I&&(x=y.attributes.lang+" ("+U+")"),g[x]&&g[x].playlists[0].attributes.BANDWIDTH>y.attributes.bandwidth||(g[x]={language:I,autoselect:!0,default:U==="main",playlists:[(b=y,S=b.attributes,C=b.segments,E={attributes:(T={NAME:S.id,BANDWIDTH:S.bandwidth,CODECS:S.codecs},T["PROGRAM-ID"]=1,T),uri:"",endList:(S.type||"static")==="static",timeline:S.periodIndex,resolvedUri:"",targetDuration:S.duration,segments:C,mediaSequence:C.length?C[0].number:1},S.contentProtection&&(E.contentProtection=S.contentProtection),E)],uri:""}),g},{})),d.length&&(p.mediaGroups.SUBTITLES.subs=d.reduce(function(g,y){var b,T,S,C,E=y.attributes.lang||"text";return g[E]||(g[E]={language:E,default:!1,autoselect:!1,playlists:[(b=y,S=b.attributes,C=b.segments,typeof C=="undefined"&&(C=[{uri:S.baseUrl,timeline:S.periodIndex,resolvedUri:S.baseUrl||"",duration:S.sourceDuration,number:0}],S.duration=S.sourceDuration),{attributes:(T={NAME:S.id,BANDWIDTH:S.bandwidth},T["PROGRAM-ID"]=1,T),uri:"",endList:(S.type||"static")==="static",timeline:S.periodIndex,resolvedUri:S.baseUrl||"",targetDuration:S.duration,segments:C,mediaSequence:C.length?C[0].number:1})],uri:""}),g},{})),p}(Nd(wu(i),r).map(Dd))},Fd=function(i){return function(r){var e=bt(r,"UTCTiming")[0];if(!e)return null;var t=Et(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Ud)}return t}(wu(i))},ii=function(i){return i>>>0};Tu=function(i){return Kt(i,["moov","trak"]).reduce(function(r,e){var t,n,a,s,o;return(t=Kt(e,["tkhd"])[0])?(n=t[0],s=ii(t[a=n===0?12:20]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]),(o=Kt(e,["mdia","mdhd"])[0])?(a=(n=o[0])===0?12:20,r[s]=ii(o[a]<<24|o[a+1]<<16|o[a+2]<<8|o[a+3]),r):null):null},{})},Su=function(i,r){var e,t,n;return e=Kt(r,["moof","traf"]),t=[].concat.apply([],e.map(function(a){return Kt(a,["tfhd"]).map(function(s){var o,u;return o=ii(s[4]<<24|s[5]<<16|s[6]<<8|s[7]),u=i[o]||9e4,(Kt(a,["tfdt"]).map(function(c){var d,p;return d=c[0],p=ii(c[4]<<24|c[5]<<16|c[6]<<8|c[7]),d===1&&(p*=Math.pow(2,32),p+=ii(c[8]<<24|c[9]<<16|c[10]<<8|c[11])),p})[0]||1/0)/u})})),n=Math.min.apply(null,t),isFinite(n)?n:0},ku=function(i){var r=Kt(i,["moov","trak"]),e=[];return r.forEach(function(t){var n=Kt(t,["mdia","hdlr"]),a=Kt(t,["tkhd"]);n.forEach(function(s,o){var u,c,d=ca(s.subarray(8,12)),p=a[o];d==="vide"&&(c=(u=new DataView(p.buffer,p.byteOffset,p.byteLength)).getUint8(0)===0?u.getUint32(12):u.getUint32(20),e.push(c))})}),e};var Q,Cu,Eu,Au,Lu,Ou,Pu,da,Uu,Iu,xu,Du,Ru,Mu,Bu,Nu,ju,Fu,Vu,Hu,pa,K,fa,qu,zu,Wu,Gu,Xu,Yu,$u,Ku,wn,Qu,Ju,Zu,tl,el,il,nl,ma,Qt={findBox:Kt=function(i,r){var e,t,n,a,s,o=[];if(!r.length)return null;for(e=0;e<i.byteLength;)t=ii(i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]),n=ca(i.subarray(e+4,e+8)),a=1<t?e+t:i.byteLength,n===r[0]&&(r.length===1?o.push(i.subarray(e+8,a)):(s=Kt(i.subarray(e+8,a),r.slice(1))).length&&(o=o.concat(s))),e=a;return o},parseType:ca=function(i){var r="";return r+=String.fromCharCode(i[0]),r+=String.fromCharCode(i[1]),r+=String.fromCharCode(i[2]),r+=String.fromCharCode(i[3])},timescale:Tu,startTime:Su,videoTrackIds:ku},rl=Math.pow(2,32)-1;(function(){var i;if(K={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},typeof Uint8Array!="undefined"){for(i in K)K.hasOwnProperty(i)&&(K[i]=[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]);fa=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),zu=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),qu=new Uint8Array([0,0,0,1]),Wu=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]),Gu=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]),Xu={video:Wu,audio:Gu},Ku=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),$u=new Uint8Array([0,0,0,0,0,0,0,0]),wn=new Uint8Array([0,0,0,0,0,0,0,0]),Qu=wn,Ju=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Zu=wn,Yu=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),Q=function(i){var r,e,t=[],n=0;for(r=1;r<arguments.length;r++)t.push(arguments[r]);for(r=t.length;r--;)n+=t[r].byteLength;for(e=new Uint8Array(n+8),new DataView(e.buffer,e.byteOffset,e.byteLength).setUint32(0,e.byteLength),e.set(i,4),r=0,n=8;r<t.length;r++)e.set(t[r],n),n+=t[r].byteLength;return e},Cu=function(){return Q(K.dinf,Q(K.dref,Ku))},Eu=function(i){return Q(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,i.audioobjecttype<<3|i.samplingfrequencyindex>>>1,i.samplingfrequencyindex<<7|i.channelcount<<3,6,1,2]))},Bu=function(i){return Q(K.hdlr,Xu[i])},Mu=function(i){var r=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,i.duration>>>24&255,i.duration>>>16&255,i.duration>>>8&255,255&i.duration,85,196,0,0]);return i.samplerate&&(r[12]=i.samplerate>>>24&255,r[13]=i.samplerate>>>16&255,r[14]=i.samplerate>>>8&255,r[15]=255&i.samplerate),Q(K.mdhd,r)},Ru=function(i){return Q(K.mdia,Mu(i),Bu(i.type),Ou(i))},Lu=function(i){return Q(K.mfhd,new Uint8Array([0,0,0,0,(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))},Ou=function(i){return Q(K.minf,i.type==="video"?Q(K.vmhd,Yu):Q(K.smhd,$u),Cu(),ju(i))},Pu=function(i,r){for(var e=[],t=r.length;t--;)e[t]=Vu(r[t]);return Q.apply(null,[K.moof,Lu(i)].concat(e))},da=function(i){for(var r=i.length,e=[];r--;)e[r]=xu(i[r]);return Q.apply(null,[K.moov,Iu(4294967295)].concat(e).concat(Uu(i)))},Uu=function(i){for(var r=i.length,e=[];r--;)e[r]=Hu(i[r]);return Q.apply(null,[K.mvex].concat(e))},Iu=function(i){var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i,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 Q(K.mvhd,r)},Nu=function(i){var r,e,t=i.samples||[],n=new Uint8Array(4+t.length);for(e=0;e<t.length;e++)r=t[e].flags,n[e+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return Q(K.sdtp,n)},ju=function(i){return Q(K.stbl,Fu(i),Q(K.stts,Zu),Q(K.stsc,Qu),Q(K.stsz,Ju),Q(K.stco,wn))},Fu=function(i){return Q(K.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),i.type==="video"?tl(i):el(i))},tl=function(i){var r,e=i.sps||[],t=i.pps||[],n=[],a=[];for(r=0;r<e.length;r++)n.push((65280&e[r].byteLength)>>>8),n.push(255&e[r].byteLength),n=n.concat(Array.prototype.slice.call(e[r]));for(r=0;r<t.length;r++)a.push((65280&t[r].byteLength)>>>8),a.push(255&t[r].byteLength),a=a.concat(Array.prototype.slice.call(t[r]));return Q(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&i.width)>>8,255&i.width,(65280&i.height)>>8,255&i.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]),Q(K.avcC,new Uint8Array([1,i.profileIdc,i.profileCompatibility,i.levelIdc,255].concat([e.length]).concat(n).concat([t.length]).concat(a))),Q(K.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},el=function(i){return Q(K.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&i.channelcount)>>8,255&i.channelcount,(65280&i.samplesize)>>8,255&i.samplesize,0,0,0,0,(65280&i.samplerate)>>8,255&i.samplerate,0,0]),Eu(i))},Du=function(i){var r=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&i.id)>>24,(16711680&i.id)>>16,(65280&i.id)>>8,255&i.id,0,0,0,0,(4278190080&i.duration)>>24,(16711680&i.duration)>>16,(65280&i.duration)>>8,255&i.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&i.width)>>8,255&i.width,0,0,(65280&i.height)>>8,255&i.height,0,0]);return Q(K.tkhd,r)},Vu=function(i){var r,e,t,n,a,s;return r=Q(K.tfhd,new Uint8Array([0,0,0,58,(4278190080&i.id)>>24,(16711680&i.id)>>16,(65280&i.id)>>8,255&i.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),a=Math.floor(i.baseMediaDecodeTime/(rl+1)),s=Math.floor(i.baseMediaDecodeTime%(rl+1)),e=Q(K.tfdt,new Uint8Array([1,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s])),i.type==="audio"?(t=pa(i,92),Q(K.traf,r,e,t)):(n=Nu(i),t=pa(i,n.length+92),Q(K.traf,r,e,t,n))},xu=function(i){return i.duration=i.duration||4294967295,Q(K.trak,Du(i),Ru(i))},Hu=function(i){var r=new Uint8Array([0,0,0,0,(4278190080&i.id)>>24,(16711680&i.id)>>16,(65280&i.id)>>8,255&i.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return i.type!=="video"&&(r[r.length-1]=0),Q(K.trex,r)},ma=function(i,r){var e=0,t=0,n=0,a=0;return i.length&&(i[0].duration!==void 0&&(e=1),i[0].size!==void 0&&(t=2),i[0].flags!==void 0&&(n=4),i[0].compositionTimeOffset!==void 0&&(a=8)),[0,0,e|t|n|a,1,(4278190080&i.length)>>>24,(16711680&i.length)>>>16,(65280&i.length)>>>8,255&i.length,(4278190080&r)>>>24,(16711680&r)>>>16,(65280&r)>>>8,255&r]},nl=function(i,r){var e,t,n,a;for(r+=20+16*(t=i.samples||[]).length,e=ma(t,r),a=0;a<t.length;a++)n=t[a],e=e.concat([(4278190080&n.duration)>>>24,(16711680&n.duration)>>>16,(65280&n.duration)>>>8,255&n.duration,(4278190080&n.size)>>>24,(16711680&n.size)>>>16,(65280&n.size)>>>8,255&n.size,n.flags.isLeading<<2|n.flags.dependsOn,n.flags.isDependedOn<<6|n.flags.hasRedundancy<<4|n.flags.paddingValue<<1|n.flags.isNonSyncSample,61440&n.flags.degradationPriority,15&n.flags.degradationPriority,(4278190080&n.compositionTimeOffset)>>>24,(16711680&n.compositionTimeOffset)>>>16,(65280&n.compositionTimeOffset)>>>8,255&n.compositionTimeOffset]);return Q(K.trun,new Uint8Array(e))},il=function(i,r){var e,t,n,a;for(r+=20+8*(t=i.samples||[]).length,e=ma(t,r),a=0;a<t.length;a++)n=t[a],e=e.concat([(4278190080&n.duration)>>>24,(16711680&n.duration)>>>16,(65280&n.duration)>>>8,255&n.duration,(4278190080&n.size)>>>24,(16711680&n.size)>>>16,(65280&n.size)>>>8,255&n.size]);return Q(K.trun,new Uint8Array(e))},pa=function(i,r){return i.type==="audio"?il(i,r):nl(i,r)};var ni={ftyp:Au=function(){return Q(K.ftyp,fa,qu,fa,zu)},mdat:function(i){return Q(K.mdat,i)},moof:Pu,moov:da,initSegment:function(i){var r,e=Au(),t=da(i);return(r=new Uint8Array(e.byteLength+t.byteLength)).set(e),r.set(t,e.byteLength),r}},Cn=function(){this.init=function(){var i={};this.on=function(r,e){i[r]||(i[r]=[]),i[r]=i[r].concat(e)},this.off=function(r,e){var t;return!!i[r]&&(t=i[r].indexOf(e),i[r]=i[r].slice(),i[r].splice(t,1),-1<t)},this.trigger=function(r){var e,t,n,a;if(e=i[r])if(arguments.length===2)for(n=e.length,t=0;t<n;++t)e[t].call(this,arguments[1]);else{for(a=[],t=arguments.length,t=1;t<arguments.length;++t)a.push(arguments[t]);for(n=e.length,t=0;t<n;++t)e[t].apply(this,a)}},this.dispose=function(){i={}}}};Cn.prototype.pipe=function(i){return this.on("data",function(r){i.push(r)}),this.on("done",function(r){i.flush(r)}),i},Cn.prototype.push=function(i){this.trigger("data",i)},Cn.prototype.flush=function(i){this.trigger("done",i)};var ga,al,sl,ol,ul,ll,cl,At=Cn,Vd=function(i){var r,e,t=[],n=[];for(r=t.byteLength=0;r<i.length;r++)(e=i[r]).nalUnitType==="access_unit_delimiter_rbsp"?(t.length&&(t.duration=e.dts-t.dts,n.push(t)),(t=[e]).byteLength=e.data.byteLength,t.pts=e.pts,t.dts=e.dts):(e.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(t.keyFrame=!0),t.duration=e.dts-t.dts,t.byteLength+=e.data.byteLength,t.push(e));return n.length&&(!t.duration||t.duration<=0)&&(t.duration=n[n.length-1].duration),n.push(t),n},Hd=function(i){var r,e,t=[],n=[];for(t.byteLength=0,t.nalCount=0,t.duration=0,t.pts=i[0].pts,t.dts=i[0].dts,n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=i[0].pts,n.dts=i[0].dts,r=0;r<i.length;r++)(e=i[r]).keyFrame?(t.length&&(n.push(t),n.byteLength+=t.byteLength,n.nalCount+=t.nalCount,n.duration+=t.duration),(t=[e]).nalCount=e.length,t.byteLength=e.byteLength,t.pts=e.pts,t.dts=e.dts,t.duration=e.duration):(t.duration+=e.duration,t.nalCount+=e.length,t.byteLength+=e.byteLength,t.push(e));return n.length&&t.duration<=0&&(t.duration=n[n.length-1].duration),n.byteLength+=t.byteLength,n.nalCount+=t.nalCount,n.duration+=t.duration,n.push(t),n},qd=function(i){var r;return!i[0][0].keyFrame&&1<i.length&&(r=i.shift(),i.byteLength-=r.byteLength,i.nalCount-=r.nalCount,i[0][0].dts=r.dts,i[0][0].pts=r.pts,i[0][0].duration+=r.duration),i},zd=function(i,r){var e,t,n,a,s,o,u,c=r||0,d=[];for(e=0;e<i.length;e++)for(a=i[e],t=0;t<a.length;t++)s=a[t],o=s,u=void 0,(u={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}).dataOffset=c,u.compositionTimeOffset=o.pts-o.dts,u.duration=o.duration,u.size=4*o.length,u.size+=o.byteLength,o.keyFrame&&(u.flags.dependsOn=2,u.flags.isNonSyncSample=0),c+=(n=u).size,d.push(n);return d},Wd=function(i){var r,e,t,n,a,s,o=0,u=i.byteLength,c=i.nalCount,d=new Uint8Array(u+4*c),p=new DataView(d.buffer);for(r=0;r<i.length;r++)for(n=i[r],e=0;e<n.length;e++)for(a=n[e],t=0;t<a.length;t++)s=a[t],p.setUint32(o,s.data.byteLength),o+=4,d.set(s.data,o),o+=s.data.byteLength;return d},Se=[33,16,5,32,164,27],ya=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],it=function(i){for(var r=[];i--;)r.push(0);return r},Gd={96e3:[Se,[227,64],it(154),[56]],88200:[Se,[231],it(170),[56]],64e3:[Se,[248,192],it(240),[56]],48e3:[Se,[255,192],it(268),[55,148,128],it(54),[112]],44100:[Se,[255,192],it(268),[55,163,128],it(84),[112]],32e3:[Se,[255,192],it(268),[55,234],it(226),[112]],24e3:[Se,[255,192],it(268),[55,255,128],it(268),[111,112],it(126),[224]],16e3:[Se,[255,192],it(268),[55,255,128],it(268),[111,255],it(269),[223,108],it(195),[1,192]],12e3:[ya,it(268),[3,127,248],it(268),[6,255,240],it(268),[13,255,224],it(268),[27,253,128],it(259),[56]],11025:[ya,it(268),[3,127,248],it(268),[6,255,240],it(268),[13,255,224],it(268),[27,255,192],it(268),[55,175,128],it(108),[112]],8e3:[ya,it(268),[3,121,16],it(47),[7]]},Xd=(ga=Gd,Object.keys(ga).reduce(function(i,r){return i[r]=new Uint8Array(ga[r].reduce(function(e,t){return e.concat(t)},[])),i},{}));ll=function(i,r){return al(ul(i,r))},cl=function(i,r){return sl(ol(i),r)},al=function(i){return 9e4*i},sl=function(i,r){return i*r},ol=function(i){return i/9e4},ul=function(i,r){return i/r};var Yd=ll,$d=cl,Kd=function(i,r,e,t){var n,a,s,o,u=0,c=0,d=0;if(r.length&&(n=Yd(i.baseMediaDecodeTime,i.samplerate),a=Math.ceil(9e4/(i.samplerate/1024)),e&&t&&(u=n-Math.max(e,t),d=(c=Math.floor(u/a))*a),!(c<1||45e3<d))){for((s=Xd[i.samplerate])||(s=r[0].data),o=0;o<c;o++)r.splice(o,0,{data:s});i.baseMediaDecodeTime-=Math.floor($d(d,i.samplerate))}},Qd=function(i,r,e){return r.minSegmentDts>=e?i:(r.minSegmentDts=1/0,i.filter(function(t){return t.dts>=e&&(r.minSegmentDts=Math.min(r.minSegmentDts,t.dts),r.minSegmentPts=r.minSegmentDts,!0)}))},Jd=function(i){var r,e,t=[];for(r=0;r<i.length;r++)e=i[r],t.push({size:e.data.byteLength,duration:1024});return t},Zd=function(i){var r,e,t=0,n=new Uint8Array(function(a){var s,o=0;for(s=0;s<a.length;s++)o+=a[s].data.byteLength;return o}(i));for(r=0;r<i.length;r++)e=i[r],n.set(e.data,t),t+=e.data.byteLength;return n},Bi=function(i){delete i.minSegmentDts,delete i.maxSegmentDts,delete i.minSegmentPts,delete i.maxSegmentPts},hl=function(i,r){var e,t=i.minSegmentDts;return r||(t-=i.timelineStartInfo.dts),e=i.timelineStartInfo.baseMediaDecodeTime,e+=t,e=Math.max(0,e),i.type==="audio"&&(e*=i.samplerate/9e4,e=Math.floor(e)),e},va=function(i,r){typeof r.pts=="number"&&(i.timelineStartInfo.pts===void 0&&(i.timelineStartInfo.pts=r.pts),i.minSegmentPts===void 0?i.minSegmentPts=r.pts:i.minSegmentPts=Math.min(i.minSegmentPts,r.pts),i.maxSegmentPts===void 0?i.maxSegmentPts=r.pts:i.maxSegmentPts=Math.max(i.maxSegmentPts,r.pts)),typeof r.dts=="number"&&(i.timelineStartInfo.dts===void 0&&(i.timelineStartInfo.dts=r.dts),i.minSegmentDts===void 0?i.minSegmentDts=r.dts:i.minSegmentDts=Math.min(i.minSegmentDts,r.dts),i.maxSegmentDts===void 0?i.maxSegmentDts=r.dts:i.maxSegmentDts=Math.max(i.maxSegmentDts,r.dts))},tp=function(i){for(var r=0,e={payloadType:-1,payloadSize:0},t=0,n=0;r<i.byteLength&&i[r]!==128;){for(;i[r]===255;)t+=255,r++;for(t+=i[r++];i[r]===255;)n+=255,r++;if(n+=i[r++],!e.payload&&t===4){e.payloadType=t,e.payloadSize=n,e.payload=i.subarray(r,r+n);break}r+=n,n=t=0}return e},ep=function(i){return i.payload[0]!==181||(i.payload[1]<<8|i.payload[2])!=49||String.fromCharCode(i.payload[3],i.payload[4],i.payload[5],i.payload[6])!=="GA94"||i.payload[7]!==3?null:i.payload.subarray(8,i.payload.length-1)},ip=function(i,r){var e,t,n,a,s=[];if(!(64&r[0]))return s;for(t=31&r[0],e=0;e<t;e++)a={type:3&r[2+(n=3*e)],pts:i},4&r[n+2]&&(a.ccData=r[n+3]<<8|r[n+4],s.push(a));return s},np=function(i){for(var r,e,t=i.byteLength,n=[],a=1;a<t-2;)i[a]===0&&i[a+1]===0&&i[a+2]===3?(n.push(a+2),a+=2):a++;if(n.length===0)return i;r=t-n.length,e=new Uint8Array(r);var s=0;for(a=0;a<r;s++,a++)s===n[0]&&(s++,n.shift()),e[a]=i[s];return e},rp=4,De=function i(){i.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new ht(0,0),new ht(0,1),new ht(1,0),new ht(1,1)],this.reset(),this.ccStreams_.forEach(function(r){r.on("data",this.trigger.bind(this,"data")),r.on("done",this.trigger.bind(this,"done"))},this)};(De.prototype=new At).push=function(i){var r,e,t;if(i.nalUnitType==="sei_rbsp"&&(r=tp(i.escapedRBSP)).payloadType===rp&&(e=ep(r)))if(i.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(i.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));t=ip(i.pts,e),this.captionPackets_=this.captionPackets_.concat(t),this.latestDts_!==i.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=i.dts}},De.prototype.flush=function(){this.captionPackets_.length?(this.captionPackets_.forEach(function(i,r){i.presortIndex=r}),this.captionPackets_.sort(function(i,r){return i.pts===r.pts?i.presortIndex-r.presortIndex:i.pts-r.pts}),this.captionPackets_.forEach(function(i){i.type<2&&this.dispatchCea608Packet(i)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(i){i.flush()},this)):this.ccStreams_.forEach(function(i){i.flush()},this)},De.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(i){i.reset()})},De.prototype.dispatchCea608Packet=function(i){this.setsChannel1Active(i)?this.activeCea608Channel_[i.type]=0:this.setsChannel2Active(i)&&(this.activeCea608Channel_[i.type]=1),this.activeCea608Channel_[i.type]!==null&&this.ccStreams_[(i.type<<1)+this.activeCea608Channel_[i.type]].push(i)},De.prototype.setsChannel1Active=function(i){return(30720&i.ccData)==4096},De.prototype.setsChannel2Active=function(i){return(30720&i.ccData)==6144};var ap={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},En=function(i){return i===null?"":(i=ap[i]||i,String.fromCharCode(i))},sp=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Re=function(){for(var i=[],r=15;r--;)i.push("");return i},ht=function i(r,e){i.prototype.init.call(this),this.field_=r||0,this.dataChannel_=e||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var n,a,s,o,u;if((n=32639&t.ccData)!==this.lastControlCode_){if((61440&n)==4096?this.lastControlCode_=n:n!==this.PADDING_&&(this.lastControlCode_=null),s=n>>>8,o=255&n,n!==this.PADDING_)if(n===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(n===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),a=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=a,this.startPts_=t.pts;else if(n===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(n===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(n===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(n===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(n===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(n===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=Re();else if(n===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Re();else if(n===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(t.pts),this.displayed_=Re()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(s,o))u=En((s=(3&s)<<8)|o),this[this.mode_](t.pts,u),this.column_++;else if(this.isExtCharacter(s,o))this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),u=En((s=(3&s)<<8)|o),this[this.mode_](t.pts,u),this.column_++;else if(this.isMidRowCode(s,o))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,(14&o)==14&&this.addFormatting(t.pts,["i"]),(1&o)==1&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(s,o))this.column_+=3&o;else if(this.isPAC(s,o)){var c=sp.indexOf(7968&n);this.mode_==="rollUp"&&(c-this.rollUpRows_+1<0&&(c=this.rollUpRows_-1),this.setRollUp(t.pts,c)),c!==this.row_&&(this.clearFormatting(t.pts),this.row_=c),1&o&&this.formatting_.indexOf("u")===-1&&this.addFormatting(t.pts,["u"]),(16&n)==16&&(this.column_=4*((14&n)>>1)),this.isColorPAC(o)&&(14&o)==14&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(s)&&(o===0&&(o=null),u=En(s),u+=En(o),this[this.mode_](t.pts,u),this.column_+=u.length)}else this.lastControlCode_=null}};ht.prototype=new At,ht.prototype.flushDisplayed=function(i){var r=this.displayed_.map(function(e){try{return e.trim()}catch(t){return""}}).join(`
|
|
`).replace(/^\n+|\n+$/g,"");r.length&&this.trigger("data",{startPts:this.startPts_,endPts:i,text:r,stream:this.name_})},ht.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Re(),this.nonDisplayed_=Re(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},ht.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=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_},ht.prototype.isSpecialCharacter=function(i,r){return i===this.EXT_&&48<=r&&r<=63},ht.prototype.isExtCharacter=function(i,r){return(i===this.EXT_+1||i===this.EXT_+2)&&32<=r&&r<=63},ht.prototype.isMidRowCode=function(i,r){return i===this.EXT_&&32<=r&&r<=47},ht.prototype.isOffsetControlCode=function(i,r){return i===this.OFFSET_&&33<=r&&r<=35},ht.prototype.isPAC=function(i,r){return i>=this.BASE_&&i<this.BASE_+8&&64<=r&&r<=127},ht.prototype.isColorPAC=function(i){return 64<=i&&i<=79||96<=i&&i<=127},ht.prototype.isNormalChar=function(i){return 32<=i&&i<=127},ht.prototype.setRollUp=function(i,r){if(this.mode_!=="rollUp"&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(i),this.nonDisplayed_=Re(),this.displayed_=Re()),r!==void 0&&r!==this.row_)for(var e=0;e<this.rollUpRows_;e++)this.displayed_[r-e]=this.displayed_[this.row_-e],this.displayed_[this.row_-e]="";r===void 0&&(r=this.row_),this.topRow_=r-this.rollUpRows_+1},ht.prototype.addFormatting=function(i,r){this.formatting_=this.formatting_.concat(r);var e=r.reduce(function(t,n){return t+"<"+n+">"},"");this[this.mode_](i,e)},ht.prototype.clearFormatting=function(i){if(this.formatting_.length){var r=this.formatting_.reverse().reduce(function(e,t){return e+"</"+t+">"},"");this.formatting_=[],this[this.mode_](i,r)}},ht.prototype.popOn=function(i,r){var e=this.nonDisplayed_[this.row_];e+=r,this.nonDisplayed_[this.row_]=e},ht.prototype.rollUp=function(i,r){var e=this.displayed_[this.row_];e+=r,this.displayed_[this.row_]=e},ht.prototype.shiftRowsUp_=function(){var i;for(i=0;i<this.topRow_;i++)this.displayed_[i]="";for(i=this.row_+1;i<15;i++)this.displayed_[i]="";for(i=this.topRow_;i<this.row_;i++)this.displayed_[i]=this.displayed_[i+1];this.displayed_[this.row_]=""},ht.prototype.paintOn=function(i,r){var e=this.displayed_[this.row_];e+=r,this.displayed_[this.row_]=e};var _a={CaptionStream:De,Cea608Stream:ht},Tt={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},ba=function(i,r){var e=1;for(r<i&&(e=-1);4294967296<Math.abs(r-i);)i+=8589934592*e;return i},dl=function i(r){var e,t;i.prototype.init.call(this),this.type_=r,this.push=function(n){n.type===this.type_&&(t===void 0&&(t=n.dts),n.dts=ba(n.dts,t),n.pts=ba(n.pts,t),e=n.dts,this.trigger("data",n))},this.flush=function(){t=e,this.trigger("done")},this.discontinuity=function(){e=t=void 0}};dl.prototype=new At;var Ta,op=dl,up=ba,pl=function(i,r,e){var t,n="";for(t=r;t<e;t++)n+="%"+("00"+i[t].toString(16)).slice(-2);return n},An=function(i,r,e){return decodeURIComponent(pl(i,r,e))},Ln=function(i){return i[0]<<21|i[1]<<14|i[2]<<7|i[3]},fl={TXXX:function(i){var r;if(i.data[0]===3){for(r=1;r<i.data.length;r++)if(i.data[r]===0){i.description=An(i.data,1,r),i.value=An(i.data,r+1,i.data.length).replace(/\0*$/,"");break}i.data=i.value}},WXXX:function(i){var r;if(i.data[0]===3){for(r=1;r<i.data.length;r++)if(i.data[r]===0){i.description=An(i.data,1,r),i.url=An(i.data,r+1,i.data.length);break}}},PRIV:function(i){var r,e;for(r=0;r<i.data.length;r++)if(i.data[r]===0){i.owner=(e=i.data,unescape(pl(e,0,r)));break}i.privateData=i.data.subarray(r+1),i.data=i.privateData}};(Ta=function(i){var r,e={debug:!(!i||!i.debug),descriptor:i&&i.descriptor},t=0,n=[],a=0;if(Ta.prototype.init.call(this),this.dispatchType=Tt.METADATA_STREAM_TYPE.toString(16),e.descriptor)for(r=0;r<e.descriptor.length;r++)this.dispatchType+=("00"+e.descriptor[r].toString(16)).slice(-2);this.push=function(s){var o,u,c,d,p;if(s.type==="timed-metadata"){if(s.dataAlignmentIndicator&&(a=0,n.length=0),n.length===0&&(s.data.length<10||s.data[0]!=="I".charCodeAt(0)||s.data[1]!=="D".charCodeAt(0)||s.data[2]!=="3".charCodeAt(0)))e.debug;else if(n.push(s),a+=s.data.byteLength,n.length===1&&(t=Ln(s.data.subarray(6,10)),t+=10),!(a<t)){for(o={data:new Uint8Array(t),frames:[],pts:n[0].pts,dts:n[0].dts},p=0;p<t;)o.data.set(n[0].data.subarray(0,t-p),p),p+=n[0].data.byteLength,a-=n[0].data.byteLength,n.shift();u=10,64&o.data[5]&&(u+=4,u+=Ln(o.data.subarray(10,14)),t-=Ln(o.data.subarray(16,20)));do{if((c=Ln(o.data.subarray(u+4,u+8)))<1)return;if((d={id:String.fromCharCode(o.data[u],o.data[u+1],o.data[u+2],o.data[u+3]),data:o.data.subarray(u+10,u+c+10)}).key=d.id,fl[d.id]&&(fl[d.id](d),d.owner==="com.apple.streaming.transportStreamTimestamp")){var g=d.data,y=(1&g[3])<<30|g[4]<<22|g[5]<<14|g[6]<<6|g[7]>>>2;y*=4,y+=3&g[7],d.timeStamp=y,o.pts===void 0&&o.dts===void 0&&(o.pts=d.timeStamp,o.dts=d.timeStamp),this.trigger("timestamp",d)}o.frames.push(d),u+=10,u+=c}while(u<t);this.trigger("data",o)}}}}).prototype=new At;var Sa,On,ka,lp=Ta,cp=op;(Sa=function(){var i=new Uint8Array(188),r=0;Sa.prototype.init.call(this),this.push=function(e){var t,n=0,a=188;for(r?((t=new Uint8Array(e.byteLength+r)).set(i.subarray(0,r)),t.set(e,r),r=0):t=e;a<t.byteLength;)t[n]!==71||t[a]!==71?(n++,a++):(this.trigger("data",t.subarray(n,a)),n+=188,a+=188);n<t.byteLength&&(i.set(t.subarray(n),0),r=t.byteLength-n)},this.flush=function(){r===188&&i[0]===71&&(this.trigger("data",i),r=0),this.trigger("done")}}).prototype=new At,(On=function(){var i,r,e,t;On.prototype.init.call(this),(t=this).packetsWaitingForPmt=[],this.programMapTable=void 0,i=function(n,a){var s=0;a.payloadUnitStartIndicator&&(s+=n[s]+1),a.type==="pat"?r(n.subarray(s),a):e(n.subarray(s),a)},r=function(n,a){a.section_number=n[7],a.last_section_number=n[8],t.pmtPid=(31&n[10])<<8|n[11],a.pmtPid=t.pmtPid},e=function(n,a){var s,o;if(1&n[5]){for(t.programMapTable={video:null,audio:null,"timed-metadata":{}},s=3+((15&n[1])<<8|n[2])-4,o=12+((15&n[10])<<8|n[11]);o<s;){var u=n[o],c=(31&n[o+1])<<8|n[o+2];u===Tt.H264_STREAM_TYPE&&t.programMapTable.video===null?t.programMapTable.video=c:u===Tt.ADTS_STREAM_TYPE&&t.programMapTable.audio===null?t.programMapTable.audio=c:u===Tt.METADATA_STREAM_TYPE&&(t.programMapTable["timed-metadata"][c]=u),o+=5+((15&n[o+3])<<8|n[o+4])}a.programMapTable=t.programMapTable}},this.push=function(n){var a={},s=4;if(a.payloadUnitStartIndicator=!!(64&n[1]),a.pid=31&n[1],a.pid<<=8,a.pid|=n[2],1<(48&n[3])>>>4&&(s+=n[s]+1),a.pid===0)a.type="pat",i(n.subarray(s),a),this.trigger("data",a);else if(a.pid===this.pmtPid)for(a.type="pmt",i(n.subarray(s),a),this.trigger("data",a);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([n,s,a]):this.processPes_(n,s,a)},this.processPes_=function(n,a,s){s.pid===this.programMapTable.video?s.streamType=Tt.H264_STREAM_TYPE:s.pid===this.programMapTable.audio?s.streamType=Tt.ADTS_STREAM_TYPE:s.streamType=this.programMapTable["timed-metadata"][s.pid],s.type="pes",s.data=n.subarray(a),this.trigger("data",s)}}).prototype=new At,On.STREAM_TYPES={h264:27,adts:15},(ka=function(){var i=this,r={data:[],size:0},e={data:[],size:0},t={data:[],size:0},n=function(a,s,o){var u,c,d=new Uint8Array(a.size),p={type:s},g=0,y=0;if(a.data.length&&!(a.size<9)){for(p.trackId=a.data[0].pid,g=0;g<a.data.length;g++)c=a.data[g],d.set(c.data,y),y+=c.data.byteLength;var b,T,S;b=d,(T=p).packetLength=6+(b[4]<<8|b[5]),T.dataAlignmentIndicator=(4&b[6])!=0,192&(S=b[7])&&(T.pts=(14&b[9])<<27|(255&b[10])<<20|(254&b[11])<<12|(255&b[12])<<5|(254&b[13])>>>3,T.pts*=4,T.pts+=(6&b[13])>>>1,T.dts=T.pts,64&S&&(T.dts=(14&b[14])<<27|(255&b[15])<<20|(254&b[16])<<12|(255&b[17])<<5|(254&b[18])>>>3,T.dts*=4,T.dts+=(6&b[18])>>>1)),T.data=b.subarray(9+b[8]),u=s==="video"||p.packetLength<=a.size,(o||u)&&(a.size=0,a.data.length=0),u&&i.trigger("data",p)}};ka.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var s,o;switch(a.streamType){case Tt.H264_STREAM_TYPE:case Tt.H264_STREAM_TYPE:s=r,o="video";break;case Tt.ADTS_STREAM_TYPE:s=e,o="audio";break;case Tt.METADATA_STREAM_TYPE:s=t,o="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&n(s,o,!0),s.data.push(a),s.size+=a.data.byteLength},pmt:function(){var s={type:"metadata",tracks:[]},o=a.programMapTable;o.video!==null&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+o.video,codec:"avc",type:"video"}),o.audio!==null&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+o.audio,codec:"adts",type:"audio"}),i.trigger("data",s)}})[a.type]()},this.flush=function(){n(r,"video"),n(e,"audio"),n(t,"timed-metadata"),this.trigger("done")}}).prototype=new At;var ml={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Sa,TransportParseStream:On,ElementaryStream:ka,TimestampRolloverStream:cp,CaptionStream:_a.CaptionStream,Cea608Stream:_a.Cea608Stream,MetadataStream:lp};for(var wa in Tt)Tt.hasOwnProperty(wa)&&(ml[wa]=Tt[wa]);var Ca,Jt=ml,gl=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(Ca=function(){var i;Ca.prototype.init.call(this),this.push=function(r){var e,t,n,a,s,o,u=0,c=0;if(r.type==="audio")for(i?(a=i,(i=new Uint8Array(a.byteLength+r.data.byteLength)).set(a),i.set(r.data,a.byteLength)):i=r.data;u+5<i.length;)if(i[u]===255&&(246&i[u+1])==240){if(t=2*(1&~i[u+1]),e=(3&i[u+3])<<11|i[u+4]<<3|(224&i[u+5])>>5,o=9e4*(s=1024*(1+(3&i[u+6])))/gl[(60&i[u+2])>>>2],n=u+e,i.byteLength<n)return;if(this.trigger("data",{pts:r.pts+c*o,dts:r.dts+c*o,sampleCount:s,audioobjecttype:1+(i[u+2]>>>6&3),channelcount:(1&i[u+2])<<2|(192&i[u+3])>>>6,samplerate:gl[(60&i[u+2])>>>2],samplingfrequencyindex:(60&i[u+2])>>>2,samplesize:16,data:i.subarray(u+7+t,n)}),i.byteLength===n)return void(i=void 0);c++,i=i.subarray(n)}else u++},this.flush=function(){this.trigger("done")}}).prototype=new At;var Ea,Pn,yl,vl=Ca,hp=function(i){var r=i.byteLength,e=0,t=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+t},this.loadWord=function(){var n=i.byteLength-r,a=new Uint8Array(4),s=Math.min(4,r);if(s===0)throw new Error("no bytes available");a.set(i.subarray(n,n+s)),e=new DataView(a.buffer).getUint32(0),t=8*s,r-=s},this.skipBits=function(n){var a;n<t||(n-=t,n-=8*(a=Math.floor(n/8)),r-=a,this.loadWord()),e<<=n,t-=n},this.readBits=function(n){var a=Math.min(t,n),s=e>>>32-a;return 0<(t-=a)?e<<=a:0<r&&this.loadWord(),0<(a=n-a)?s<<a|this.readBits(a):s},this.skipLeadingZeros=function(){var n;for(n=0;n<t;++n)if((e&2147483648>>>n)!=0)return e<<=n,t-=n,n;return this.loadWord(),n+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var n=this.skipLeadingZeros();return this.readBits(n+1)-1},this.readExpGolomb=function(){var n=this.readUnsignedExpGolomb();return 1&n?1+n>>>1:-1*(n>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Pn=function(){var i,r,e=0;Pn.prototype.init.call(this),this.push=function(t){var n;for(r=r?((n=new Uint8Array(r.byteLength+t.data.byteLength)).set(r),n.set(t.data,r.byteLength),n):t.data;e<r.byteLength-3;e++)if(r[e+2]===1){i=e+5;break}for(;i<r.byteLength;)switch(r[i]){case 0:if(r[i-1]!==0){i+=2;break}if(r[i-2]!==0){i++;break}for(e+3!==i-2&&this.trigger("data",r.subarray(e+3,i-2));r[++i]!==1&&i<r.length;);e=i-2,i+=3;break;case 1:if(r[i-1]!==0||r[i-2]!==0){i+=3;break}this.trigger("data",r.subarray(e+3,i-2)),e=i-2,i+=3;break;default:i+=3}r=r.subarray(e),i-=e,e=0},this.flush=function(){r&&3<r.byteLength&&this.trigger("data",r.subarray(e+3)),r=null,e=0,this.trigger("done")}}).prototype=new At,yl={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Ea=function(){var i,r,e,t,n,a,s,o=new Pn;Ea.prototype.init.call(this),(i=this).push=function(u){u.type==="video"&&(r=u.trackId,e=u.pts,t=u.dts,o.push(u))},o.on("data",function(u){var c={trackId:r,pts:e,dts:t,data:u};switch(31&u[0]){case 5:c.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:c.nalUnitType="sei_rbsp",c.escapedRBSP=n(u.subarray(1));break;case 7:c.nalUnitType="seq_parameter_set_rbsp",c.escapedRBSP=n(u.subarray(1)),c.config=a(c.escapedRBSP);break;case 8:c.nalUnitType="pic_parameter_set_rbsp";break;case 9:c.nalUnitType="access_unit_delimiter_rbsp"}i.trigger("data",c)}),o.on("done",function(){i.trigger("done")}),this.flush=function(){o.flush()},s=function(u,c){var d,p=8,g=8;for(d=0;d<u;d++)g!==0&&(g=(p+c.readExpGolomb()+256)%256),p=g===0?p:g},n=function(u){for(var c,d,p=u.byteLength,g=[],y=1;y<p-2;)u[y]===0&&u[y+1]===0&&u[y+2]===3?(g.push(y+2),y+=2):y++;if(g.length===0)return u;c=p-g.length,d=new Uint8Array(c);var b=0;for(y=0;y<c;b++,y++)b===g[0]&&(b++,g.shift()),d[y]=u[b];return d},a=function(u){var c,d,p,g,y,b,T,S,C,E,U,I,x,q=0,H=0,R=0,G=0,ut=1;if(d=(c=new hp(u)).readUnsignedByte(),g=c.readUnsignedByte(),p=c.readUnsignedByte(),c.skipUnsignedExpGolomb(),yl[d]&&((y=c.readUnsignedExpGolomb())===3&&c.skipBits(1),c.skipUnsignedExpGolomb(),c.skipUnsignedExpGolomb(),c.skipBits(1),c.readBoolean()))for(U=y!==3?8:12,x=0;x<U;x++)c.readBoolean()&&s(x<6?16:64,c);if(c.skipUnsignedExpGolomb(),(b=c.readUnsignedExpGolomb())===0)c.readUnsignedExpGolomb();else if(b===1)for(c.skipBits(1),c.skipExpGolomb(),c.skipExpGolomb(),T=c.readUnsignedExpGolomb(),x=0;x<T;x++)c.skipExpGolomb();if(c.skipUnsignedExpGolomb(),c.skipBits(1),S=c.readUnsignedExpGolomb(),C=c.readUnsignedExpGolomb(),(E=c.readBits(1))===0&&c.skipBits(1),c.skipBits(1),c.readBoolean()&&(q=c.readUnsignedExpGolomb(),H=c.readUnsignedExpGolomb(),R=c.readUnsignedExpGolomb(),G=c.readUnsignedExpGolomb()),c.readBoolean()&&c.readBoolean()){switch(c.readUnsignedByte()){case 1:I=[1,1];break;case 2:I=[12,11];break;case 3:I=[10,11];break;case 4:I=[16,11];break;case 5:I=[40,33];break;case 6:I=[24,11];break;case 7:I=[20,11];break;case 8:I=[32,11];break;case 9:I=[80,33];break;case 10:I=[18,11];break;case 11:I=[15,11];break;case 12:I=[64,33];break;case 13:I=[160,99];break;case 14:I=[4,3];break;case 15:I=[3,2];break;case 16:I=[2,1];break;case 255:I=[c.readUnsignedByte()<<8|c.readUnsignedByte(),c.readUnsignedByte()<<8|c.readUnsignedByte()]}I&&(ut=I[0]/I[1])}return{profileIdc:d,levelIdc:p,profileCompatibility:g,width:Math.ceil((16*(S+1)-2*q-2*H)*ut),height:(2-E)*(C+1)*16-2*R-2*G}}}).prototype=new At;var Aa,dp={H264Stream:Ea,NalByteStream:Pn},pp=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],_l=function(i){return i[0]<<21|i[1]<<14|i[2]<<7|i[3]},Un={isLikelyAacData:function(i){return i[0]==="I".charCodeAt(0)&&i[1]==="D".charCodeAt(0)&&i[2]==="3".charCodeAt(0)},parseId3TagSize:function(i,r){var e=i[r+6]<<21|i[r+7]<<14|i[r+8]<<7|i[r+9];return(16&i[r+5])>>4?e+20:e+10},parseAdtsSize:function(i,r){var e=(224&i[r+5])>>5,t=i[r+4]<<3;return 6144&i[r+3]|t|e},parseType:function(i,r){return i[r]==="I".charCodeAt(0)&&i[r+1]==="D".charCodeAt(0)&&i[r+2]==="3".charCodeAt(0)?"timed-metadata":!0&i[r]&&(240&i[r+1])==240?"audio":null},parseSampleRate:function(i){for(var r=0;r+5<i.length;){if(i[r]===255&&(246&i[r+1])==240)return pp[(60&i[r+2])>>>2];r++}return null},parseAacTimestamp:function(i){var r,e,t;r=10,64&i[5]&&(r+=4,r+=_l(i.subarray(10,14)));do{if((e=_l(i.subarray(r+4,r+8)))<1)return null;if(String.fromCharCode(i[r],i[r+1],i[r+2],i[r+3])==="PRIV"){t=i.subarray(r+10,r+e+10);for(var n=0;n<t.byteLength;n++)if(t[n]===0){if(unescape(function(o,u,c){var d,p="";for(d=u;d<c;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p}(t,0,n))!=="com.apple.streaming.transportStreamTimestamp")break;var a=t.subarray(n+1),s=(1&a[3])<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2;return s*=4,s+=3&a[7]}}r+=10,r+=e}while(r<i.byteLength);return null}};(Aa=function(){var i=new Uint8Array,r=0;Aa.prototype.init.call(this),this.setTimestamp=function(e){r=e},this.push=function(e){var t,n,a,s,o=0,u=0;for(i.length?(s=i.length,(i=new Uint8Array(e.byteLength+s)).set(i.subarray(0,s)),i.set(e,s)):i=e;3<=i.length-u;)if(i[u]!=="I".charCodeAt(0)||i[u+1]!=="D".charCodeAt(0)||i[u+2]!=="3".charCodeAt(0))if((255&i[u])!=255||(240&i[u+1])!=240)u++;else{if(i.length-u<7||u+(o=Un.parseAdtsSize(i,u))>i.length)break;a={type:"audio",data:i.subarray(u,u+o),pts:r,dts:r},this.trigger("data",a),u+=o}else{if(i.length-u<10||u+(o=Un.parseId3TagSize(i,u))>i.length)break;n={type:"timed-metadata",data:i.subarray(u,u+o)},this.trigger("data",n),u+=o}t=i.length-u,i=0<t?i.subarray(u):new Uint8Array}}).prototype=new At;var In,Ni,La,ji,fp=Aa,mp=dp.H264Stream,gp=Un.isLikelyAacData,Oa=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Pa=["width","height","profileIdc","levelIdc","profileCompatibility"],bl=function(i,r){var e;if(i.length!==r.length)return!1;for(e=0;e<i.length;e++)if(i[e]!==r[e])return!1;return!0};(Ni=function(i,r){var e=[],t=0,n=0,a=0,s=1/0;r=r||{},Ni.prototype.init.call(this),this.push=function(o){va(i,o),i&&Oa.forEach(function(u){i[u]=o[u]}),e.push(o)},this.setEarliestDts=function(o){n=o-i.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(o){s=o},this.setAudioAppendStart=function(o){a=o},this.flush=function(){var o,u,c,d;e.length!==0&&(o=Qd(e,i,n),i.baseMediaDecodeTime=hl(i,r.keepOriginalTimestamps),Kd(i,o,a,s),i.samples=Jd(o),c=ni.mdat(Zd(o)),e=[],u=ni.moof(t,[i]),d=new Uint8Array(u.byteLength+c.byteLength),t++,d.set(u),d.set(c,u.byteLength),Bi(i),this.trigger("data",{track:i,boxes:d})),this.trigger("done","AudioSegmentStream")}}).prototype=new At,(In=function(i,r){var e,t,n=0,a=[],s=[];r=r||{},In.prototype.init.call(this),delete i.minPTS,this.gopCache_=[],this.push=function(o){va(i,o),o.nalUnitType!=="seq_parameter_set_rbsp"||e||(e=o.config,i.sps=[o.data],Pa.forEach(function(u){i[u]=e[u]},this)),o.nalUnitType!=="pic_parameter_set_rbsp"||t||(t=o.data,i.pps=[o.data]),a.push(o)},this.flush=function(){for(var o,u,c,d,p,g;a.length&&a[0].nalUnitType!=="access_unit_delimiter_rbsp";)a.shift();if(a.length===0)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(o=Vd(a),(c=Hd(o))[0][0].keyFrame||((u=this.getGopForFusion_(a[0],i))?(c.unshift(u),c.byteLength+=u.byteLength,c.nalCount+=u.nalCount,c.pts=u.pts,c.dts=u.dts,c.duration+=u.duration):c=qd(c)),s.length){var y;if(!(y=r.alignGopsAtEnd?this.alignGopsAtEnd_(c):this.alignGopsAtStart_(c)))return this.gopCache_.unshift({gop:c.pop(),pps:i.pps,sps:i.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");Bi(i),c=y}va(i,c),i.samples=zd(c),p=ni.mdat(Wd(c)),i.baseMediaDecodeTime=hl(i,r.keepOriginalTimestamps),this.trigger("processedGopsInfo",c.map(function(b){return{pts:b.pts,dts:b.dts,byteLength:b.byteLength}})),this.gopCache_.unshift({gop:c.pop(),pps:i.pps,sps:i.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.trigger("baseMediaDecodeTime",i.baseMediaDecodeTime),this.trigger("timelineStartInfo",i.timelineStartInfo),d=ni.moof(n,[i]),g=new Uint8Array(d.byteLength+p.byteLength),n++,g.set(d),g.set(p,d.byteLength),this.trigger("data",{track:i,boxes:g}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){Bi(i),t=e=void 0},this.getGopForFusion_=function(o){var u,c,d,p,g,y=1/0;for(g=0;g<this.gopCache_.length;g++)d=(p=this.gopCache_[g]).gop,i.pps&&bl(i.pps[0],p.pps[0])&&i.sps&&bl(i.sps[0],p.sps[0])&&(d.dts<i.timelineStartInfo.dts||-1e4<=(u=o.dts-d.dts-d.duration)&&u<=45e3&&(!c||u<y)&&(c=p,y=u));return c?c.gop:null},this.alignGopsAtStart_=function(o){var u,c,d,p,g,y,b,T;for(g=o.byteLength,y=o.nalCount,b=o.duration,u=c=0;u<s.length&&c<o.length&&(d=s[u],p=o[c],d.pts!==p.pts);)p.pts>d.pts?u++:(c++,g-=p.byteLength,y-=p.nalCount,b-=p.duration);return c===0?o:c===o.length?null:((T=o.slice(c)).byteLength=g,T.duration=b,T.nalCount=y,T.pts=T[0].pts,T.dts=T[0].dts,T)},this.alignGopsAtEnd_=function(o){var u,c,d,p,g,y,b;for(u=s.length-1,c=o.length-1,g=null,y=!1;0<=u&&0<=c;){if(d=s[u],p=o[c],d.pts===p.pts){y=!0;break}d.pts>p.pts?u--:(u===s.length-1&&(g=c),c--)}if(!y&&g===null)return null;if((b=y?c:g)===0)return o;var T=o.slice(b),S=T.reduce(function(C,E){return C.byteLength+=E.byteLength,C.duration+=E.duration,C.nalCount+=E.nalCount,C},{byteLength:0,duration:0,nalCount:0});return T.byteLength=S.byteLength,T.duration=S.duration,T.nalCount=S.nalCount,T.pts=T[0].pts,T.dts=T[0].dts,T},this.alignGopsWith=function(o){s=o}}).prototype=new At,(ji=function(i,r){this.numberOfTracks=0,this.metadataStream=r,typeof(i=i||{}).remux!="undefined"?this.remuxTracks=!!i.remux:this.remuxTracks=!0,typeof i.keepOriginalTimestamps=="boolean"&&(this.keepOriginalTimestamps=i.keepOriginalTimestamps),this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ji.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.pendingBoxes.push(e.boxes),this.pendingBytes+=e.boxes.byteLength,e.track.type==="video"&&(this.videoTrack=e.track),void(e.track.type==="audio"&&(this.audioTrack=e.track)))}}).prototype=new At,ji.prototype.flush=function(i){var r,e,t,n,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if(i!=="VideoSegmentStream"&&i!=="AudioSegmentStream"||this.remuxTracks)return;if(this.pendingTracks.length===0)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,Pa.forEach(function(u){s.info[u]=this.videoTrack[u]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,Oa.forEach(function(u){s.info[u]=this.audioTrack[u]},this)),this.pendingTracks.length===1?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,t=ni.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(t.byteLength),s.initSegment.set(t),s.data=new Uint8Array(this.pendingBytes),n=0;n<this.pendingBoxes.length;n++)s.data.set(this.pendingBoxes[n],a),a+=this.pendingBoxes[n].byteLength;for(n=0;n<this.pendingCaptions.length;n++)(r=this.pendingCaptions[n]).startTime=r.startPts,this.keepOriginalTimestamps||(r.startTime-=o),r.startTime/=9e4,r.endTime=r.endPts,this.keepOriginalTimestamps||(r.endTime-=o),r.endTime/=9e4,s.captionStreams[r.stream]=!0,s.captions.push(r);for(n=0;n<this.pendingMetadata.length;n++)(e=this.pendingMetadata[n]).cueTime=e.pts,this.keepOriginalTimestamps||(e.cueTime-=o),e.cueTime/=9e4,s.metadata.push(e);s.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",s),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(La=function(i){var r,e,t=this,n=!0;La.prototype.init.call(this),i=i||{},this.baseMediaDecodeTime=i.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var a={};(this.transmuxPipeline_=a).type="aac",a.metadataStream=new Jt.MetadataStream,a.aacStream=new fp,a.audioTimestampRolloverStream=new Jt.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new Jt.TimestampRolloverStream("timed-metadata"),a.adtsStream=new vl,a.coalesceStream=new ji(i,a.metadataStream),a.headOfPipeline=a.aacStream,a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.metadataStream.on("timestamp",function(s){a.aacStream.setTimestamp(s.timeStamp)}),a.aacStream.on("data",function(s){s.type!=="timed-metadata"||a.audioSegmentStream||(e=e||{timelineStartInfo:{baseMediaDecodeTime:t.baseMediaDecodeTime},codec:"adts",type:"audio"},a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new Ni(e,i),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream))}),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var a={};(this.transmuxPipeline_=a).type="ts",a.metadataStream=new Jt.MetadataStream,a.packetStream=new Jt.TransportPacketStream,a.parseStream=new Jt.TransportParseStream,a.elementaryStream=new Jt.ElementaryStream,a.videoTimestampRolloverStream=new Jt.TimestampRolloverStream("video"),a.audioTimestampRolloverStream=new Jt.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new Jt.TimestampRolloverStream("timed-metadata"),a.adtsStream=new vl,a.h264Stream=new mp,a.captionStream=new Jt.CaptionStream,a.coalesceStream=new ji(i,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream),a.elementaryStream.pipe(a.videoTimestampRolloverStream).pipe(a.h264Stream),a.elementaryStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.elementaryStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",function(s){var o;if(s.type==="metadata"){for(o=s.tracks.length;o--;)r||s.tracks[o].type!=="video"?e||s.tracks[o].type!=="audio"||((e=s.tracks[o]).timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime):(r=s.tracks[o]).timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime;r&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new In(r,i),a.videoSegmentStream.on("timelineStartInfo",function(u){e&&(e.timelineStartInfo=u,a.audioSegmentStream.setEarliestDts(u.dts))}),a.videoSegmentStream.on("processedGopsInfo",t.trigger.bind(t,"gopInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",function(u){e&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(u)}),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),e&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new Ni(e,i),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream))}}),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(a){var s=this.transmuxPipeline_;i.keepOriginalTimestamps||(this.baseMediaDecodeTime=a),e&&(e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,Bi(e),i.keepOriginalTimestamps||(e.timelineStartInfo.baseMediaDecodeTime=a),s.audioTimestampRolloverStream&&s.audioTimestampRolloverStream.discontinuity()),r&&(s.videoSegmentStream&&(s.videoSegmentStream.gopCache_=[],s.videoTimestampRolloverStream.discontinuity()),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,Bi(r),s.captionStream.reset(),i.keepOriginalTimestamps||(r.timelineStartInfo.baseMediaDecodeTime=a)),s.timedMetadataTimestampRolloverStream&&s.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(a){e&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(a)},this.alignGopsWith=function(a){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(a)},this.push=function(a){if(n){var s=gp(a);s&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():s||this.transmuxPipeline_.type==="ts"||this.setupTsPipeline(),n=!1}this.transmuxPipeline_.headOfPipeline.push(a)},this.flush=function(){n=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new At;var Ut,Tl,Ua={Transmuxer:La,VideoSegmentStream:In,AudioSegmentStream:Ni,AUDIO_PROPERTIES:Oa,VIDEO_PROPERTIES:Pa},xn=Qt.parseType,qt=function(i){return new Date(1e3*i-20828448e5)},Sl=function(i){return{isLeading:(12&i[0])>>>2,dependsOn:3&i[0],isDependedOn:(192&i[1])>>>6,hasRedundancy:(48&i[1])>>>4,paddingValue:(14&i[1])>>>1,isNonSyncSample:1&i[1],degradationPriority:i[2]<<8|i[3]}},ri={avc1:function(i){var r=new DataView(i.buffer,i.byteOffset,i.byteLength);return{dataReferenceIndex:r.getUint16(6),width:r.getUint16(24),height:r.getUint16(26),horizresolution:r.getUint16(28)+r.getUint16(30)/16,vertresolution:r.getUint16(32)+r.getUint16(34)/16,frameCount:r.getUint16(40),depth:r.getUint16(74),config:Ut(i.subarray(78,i.byteLength))}},avcC:function(i){var r,e,t,n,a=new DataView(i.buffer,i.byteOffset,i.byteLength),s={configurationVersion:i[0],avcProfileIndication:i[1],profileCompatibility:i[2],avcLevelIndication:i[3],lengthSizeMinusOne:3&i[4],sps:[],pps:[]},o=31&i[5];for(t=6,n=0;n<o;n++)e=a.getUint16(t),t+=2,s.sps.push(new Uint8Array(i.subarray(t,t+e))),t+=e;for(r=i[t],t++,n=0;n<r;n++)e=a.getUint16(t),t+=2,s.pps.push(new Uint8Array(i.subarray(t,t+e))),t+=e;return s},btrt:function(i){var r=new DataView(i.buffer,i.byteOffset,i.byteLength);return{bufferSizeDB:r.getUint32(0),maxBitrate:r.getUint32(4),avgBitrate:r.getUint32(8)}},esds:function(i){return{version:i[0],flags:new Uint8Array(i.subarray(1,4)),esId:i[6]<<8|i[7],streamPriority:31&i[8],decoderConfig:{objectProfileIndication:i[11],streamType:i[12]>>>2&63,bufferSize:i[13]<<16|i[14]<<8|i[15],maxBitrate:i[16]<<24|i[17]<<16|i[18]<<8|i[19],avgBitrate:i[20]<<24|i[21]<<16|i[22]<<8|i[23],decoderConfigDescriptor:{tag:i[24],length:i[25],audioObjectType:i[26]>>>3&31,samplingFrequencyIndex:(7&i[26])<<1|i[27]>>>7&1,channelConfiguration:i[27]>>>3&15}}}},ftyp:function(i){for(var r=new DataView(i.buffer,i.byteOffset,i.byteLength),e={majorBrand:xn(i.subarray(0,4)),minorVersion:r.getUint32(4),compatibleBrands:[]},t=8;t<i.byteLength;)e.compatibleBrands.push(xn(i.subarray(t,t+4))),t+=4;return e},dinf:function(i){return{boxes:Ut(i)}},dref:function(i){return{version:i[0],flags:new Uint8Array(i.subarray(1,4)),dataReferences:Ut(i.subarray(8))}},hdlr:function(i){var r={version:new DataView(i.buffer,i.byteOffset,i.byteLength).getUint8(0),flags:new Uint8Array(i.subarray(1,4)),handlerType:xn(i.subarray(8,12)),name:""},e=8;for(e=24;e<i.byteLength;e++){if(i[e]===0){e++;break}r.name+=String.fromCharCode(i[e])}return r.name=decodeURIComponent(escape(r.name)),r},mdat:function(i){return{byteLength:i.byteLength,nals:function(r){var e,t,n=new DataView(r.buffer,r.byteOffset,r.byteLength),a=[];for(e=0;e+4<r.length;e+=t)if(t=n.getUint32(e),e+=4,t<=0)a.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&r[e]){case 1:a.push("slice_layer_without_partitioning_rbsp");break;case 5:a.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:a.push("sei_rbsp");break;case 7:a.push("seq_parameter_set_rbsp");break;case 8:a.push("pic_parameter_set_rbsp");break;case 9:a.push("access_unit_delimiter_rbsp");break;default:a.push("UNKNOWN NAL - "+r[e]&31)}return a}(i)}},mdhd:function(i){var r,e=new DataView(i.buffer,i.byteOffset,i.byteLength),t=4,n={version:e.getUint8(0),flags:new Uint8Array(i.subarray(1,4)),language:""};return n.version===1?(t+=4,n.creationTime=qt(e.getUint32(t)),t+=8,n.modificationTime=qt(e.getUint32(t)),t+=4,n.timescale=e.getUint32(t),t+=8):(n.creationTime=qt(e.getUint32(t)),t+=4,n.modificationTime=qt(e.getUint32(t)),t+=4,n.timescale=e.getUint32(t),t+=4),n.duration=e.getUint32(t),t+=4,r=e.getUint16(t),n.language+=String.fromCharCode(96+(r>>10)),n.language+=String.fromCharCode(96+((992&r)>>5)),n.language+=String.fromCharCode(96+(31&r)),n},mdia:function(i){return{boxes:Ut(i)}},mfhd:function(i){return{version:i[0],flags:new Uint8Array(i.subarray(1,4)),sequenceNumber:i[4]<<24|i[5]<<16|i[6]<<8|i[7]}},minf:function(i){return{boxes:Ut(i)}},mp4a:function(i){var r=new DataView(i.buffer,i.byteOffset,i.byteLength),e={dataReferenceIndex:r.getUint16(6),channelcount:r.getUint16(16),samplesize:r.getUint16(18),samplerate:r.getUint16(24)+r.getUint16(26)/65536};return 28<i.byteLength&&(e.streamDescriptor=Ut(i.subarray(28))[0]),e},moof:function(i){return{boxes:Ut(i)}},moov:function(i){return{boxes:Ut(i)}},mvex:function(i){return{boxes:Ut(i)}},mvhd:function(i){var r=new DataView(i.buffer,i.byteOffset,i.byteLength),e=4,t={version:r.getUint8(0),flags:new Uint8Array(i.subarray(1,4))};return t.version===1?(e+=4,t.creationTime=qt(r.getUint32(e)),e+=8,t.modificationTime=qt(r.getUint32(e)),e+=4,t.timescale=r.getUint32(e),e+=8):(t.creationTime=qt(r.getUint32(e)),e+=4,t.modificationTime=qt(r.getUint32(e)),e+=4,t.timescale=r.getUint32(e),e+=4),t.duration=r.getUint32(e),e+=4,t.rate=r.getUint16(e)+r.getUint16(e+2)/16,e+=4,t.volume=r.getUint8(e)+r.getUint8(e+1)/8,e+=2,e+=2,e+=8,t.matrix=new Uint32Array(i.subarray(e,e+36)),e+=36,e+=24,t.nextTrackId=r.getUint32(e),t},pdin:function(i){var r=new DataView(i.buffer,i.byteOffset,i.byteLength);return{version:r.getUint8(0),flags:new Uint8Array(i.subarray(1,4)),rate:r.getUint32(4),initialDelay:r.getUint32(8)}},sdtp:function(i){var r,e={version:i[0],flags:new Uint8Array(i.subarray(1,4)),samples:[]};for(r=4;r<i.byteLength;r++)e.samples.push({dependsOn:(48&i[r])>>4,isDependedOn:(12&i[r])>>2,hasRedundancy:3&i[r]});return e},sidx:function(i){var r,e=new DataView(i.buffer,i.byteOffset,i.byteLength),t={version:i[0],flags:new Uint8Array(i.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8),earliestPresentationTime:e.getUint32(12),firstOffset:e.getUint32(16)},n=e.getUint16(22);for(r=24;n;r+=12,n--)t.references.push({referenceType:(128&i[r])>>>7,referencedSize:2147483647&e.getUint32(r),subsegmentDuration:e.getUint32(r+4),startsWithSap:!!(128&i[r+8]),sapType:(112&i[r+8])>>>4,sapDeltaTime:268435455&e.getUint32(r+8)});return t},smhd:function(i){return{version:i[0],flags:new Uint8Array(i.subarray(1,4)),balance:i[4]+i[5]/256}},stbl:function(i){return{boxes:Ut(i)}},stco:function(i){var r,e=new DataView(i.buffer,i.byteOffset,i.byteLength),t={version:i[0],flags:new Uint8Array(i.subarray(1,4)),chunkOffsets:[]},n=e.getUint32(4);for(r=8;n;r+=4,n--)t.chunkOffsets.push(e.getUint32(r));return t},stsc:function(i){var r,e=new DataView(i.buffer,i.byteOffset,i.byteLength),t=e.getUint32(4),n={version:i[0],flags:new Uint8Array(i.subarray(1,4)),sampleToChunks:[]};for(r=8;t;r+=12,t--)n.sampleToChunks.push({firstChunk:e.getUint32(r),samplesPerChunk:e.getUint32(r+4),sampleDescriptionIndex:e.getUint32(r+8)});return n},stsd:function(i){return{version:i[0],flags:new Uint8Array(i.subarray(1,4)),sampleDescriptions:Ut(i.subarray(8))}},stsz:function(i){var r,e=new DataView(i.buffer,i.byteOffset,i.byteLength),t={version:i[0],flags:new Uint8Array(i.subarray(1,4)),sampleSize:e.getUint32(4),entries:[]};for(r=12;r<i.byteLength;r+=4)t.entries.push(e.getUint32(r));return t},stts:function(i){var r,e=new DataView(i.buffer,i.byteOffset,i.byteLength),t={version:i[0],flags:new Uint8Array(i.subarray(1,4)),timeToSamples:[]},n=e.getUint32(4);for(r=8;n;r+=8,n--)t.timeToSamples.push({sampleCount:e.getUint32(r),sampleDelta:e.getUint32(r+4)});return t},styp:function(i){return ri.ftyp(i)},tfdt:function(i){var r={version:i[0],flags:new Uint8Array(i.subarray(1,4)),baseMediaDecodeTime:i[4]<<24|i[5]<<16|i[6]<<8|i[7]};return r.version===1&&(r.baseMediaDecodeTime*=Math.pow(2,32),r.baseMediaDecodeTime+=i[8]<<24|i[9]<<16|i[10]<<8|i[11]),r},tfhd:function(i){var r,e=new DataView(i.buffer,i.byteOffset,i.byteLength),t={version:i[0],flags:new Uint8Array(i.subarray(1,4)),trackId:e.getUint32(4)},n=1&t.flags[2],a=2&t.flags[2],s=8&t.flags[2],o=16&t.flags[2],u=32&t.flags[2],c=65536&t.flags[0],d=131072&t.flags[0];return r=8,n&&(r+=4,t.baseDataOffset=e.getUint32(12),r+=4),a&&(t.sampleDescriptionIndex=e.getUint32(r),r+=4),s&&(t.defaultSampleDuration=e.getUint32(r),r+=4),o&&(t.defaultSampleSize=e.getUint32(r),r+=4),u&&(t.defaultSampleFlags=e.getUint32(r)),c&&(t.durationIsEmpty=!0),!n&&d&&(t.baseDataOffsetIsMoof=!0),t},tkhd:function(i){var r=new DataView(i.buffer,i.byteOffset,i.byteLength),e=4,t={version:r.getUint8(0),flags:new Uint8Array(i.subarray(1,4))};return t.version===1?(e+=4,t.creationTime=qt(r.getUint32(e)),e+=8,t.modificationTime=qt(r.getUint32(e)),e+=4,t.trackId=r.getUint32(e),e+=4,e+=8):(t.creationTime=qt(r.getUint32(e)),e+=4,t.modificationTime=qt(r.getUint32(e)),e+=4,t.trackId=r.getUint32(e),e+=4,e+=4),t.duration=r.getUint32(e),e+=4,e+=8,t.layer=r.getUint16(e),e+=2,t.alternateGroup=r.getUint16(e),e+=2,t.volume=r.getUint8(e)+r.getUint8(e+1)/8,e+=2,e+=2,t.matrix=new Uint32Array(i.subarray(e,e+36)),e+=36,t.width=r.getUint16(e)+r.getUint16(e+2)/16,e+=4,t.height=r.getUint16(e)+r.getUint16(e+2)/16,t},traf:function(i){return{boxes:Ut(i)}},trak:function(i){return{boxes:Ut(i)}},trex:function(i){var r=new DataView(i.buffer,i.byteOffset,i.byteLength);return{version:i[0],flags:new Uint8Array(i.subarray(1,4)),trackId:r.getUint32(4),defaultSampleDescriptionIndex:r.getUint32(8),defaultSampleDuration:r.getUint32(12),defaultSampleSize:r.getUint32(16),sampleDependsOn:3&i[20],sampleIsDependedOn:(192&i[21])>>6,sampleHasRedundancy:(48&i[21])>>4,samplePaddingValue:(14&i[21])>>1,sampleIsDifferenceSample:!!(1&i[21]),sampleDegradationPriority:r.getUint16(22)}},trun:function(i){var r,e={version:i[0],flags:new Uint8Array(i.subarray(1,4)),samples:[]},t=new DataView(i.buffer,i.byteOffset,i.byteLength),n=1&e.flags[2],a=4&e.flags[2],s=1&e.flags[1],o=2&e.flags[1],u=4&e.flags[1],c=8&e.flags[1],d=t.getUint32(4),p=8;for(n&&(e.dataOffset=t.getInt32(p),p+=4),a&&d&&(r={flags:Sl(i.subarray(p,p+4))},p+=4,s&&(r.duration=t.getUint32(p),p+=4),o&&(r.size=t.getUint32(p),p+=4),c&&(r.compositionTimeOffset=t.getUint32(p),p+=4),e.samples.push(r),d--);d--;)r={},s&&(r.duration=t.getUint32(p),p+=4),o&&(r.size=t.getUint32(p),p+=4),u&&(r.flags=Sl(i.subarray(p,p+4)),p+=4),c&&(r.compositionTimeOffset=t.getUint32(p),p+=4),e.samples.push(r);return e},"url ":function(i){return{version:i[0],flags:new Uint8Array(i.subarray(1,4))}},vmhd:function(i){var r=new DataView(i.buffer,i.byteOffset,i.byteLength);return{version:i[0],flags:new Uint8Array(i.subarray(1,4)),graphicsmode:r.getUint16(4),opcolor:new Uint16Array([r.getUint16(6),r.getUint16(8),r.getUint16(10)])}}},Ia={inspect:Ut=function(i){for(var r,e,t,n,a,s=0,o=[],u=new ArrayBuffer(i.length),c=new Uint8Array(u),d=0;d<i.length;++d)c[d]=i[d];for(r=new DataView(u);s<i.byteLength;)e=r.getUint32(s),t=xn(i.subarray(s+4,s+8)),n=1<e?s+e:i.byteLength,(a=(ri[t]||function(p){return{data:p}})(i.subarray(s+8,n))).size=e,a.type=t,o.push(a),s=n;return o},textify:Tl=function(i,r){var e;return r=r||0,e=new Array(2*r+1).join(" "),i.map(function(t,n){return e+t.type+`
|
|
`+Object.keys(t).filter(function(a){return a!=="type"&&a!=="boxes"}).map(function(a){var s=e+" "+a+": ",o=t[a];if(o instanceof Uint8Array||o instanceof Uint32Array){var u=Array.prototype.slice.call(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)).map(function(c){return" "+("00"+c.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return u?u.length===1?s+"<"+u.join("").slice(1)+">":s+`<
|
|
`+u.map(function(c){return e+" "+c}).join(`
|
|
`)+`
|
|
`+e+" >":s+"<>"}return s+JSON.stringify(o,null,2).split(`
|
|
`).map(function(c,d){return d===0?c:e+" "+c}).join(`
|
|
`)}).join(`
|
|
`)+(t.boxes?`
|
|
`+Tl(t.boxes,r+1):"")}).join(`
|
|
`)},parseTfdt:ri.tfdt,parseHdlr:ri.hdlr,parseTfhd:ri.tfhd,parseTrun:ri.trun},yp=np,vp=_a.CaptionStream,_p=function(i,r){for(var e=i,t=0;t<r.length;t++){var n=r[t];if(e<n.size)return n;e-=n.size}return null},bp=function(i,r){var e=Qt.findBox(i,["moof","traf"]),t=Qt.findBox(i,["mdat"]),n={},a=[];return t.forEach(function(s,o){var u=e[o];a.push({mdat:s,traf:u})}),a.forEach(function(s){var o,u,c,d,p,g,y,b,T=s.mdat,S=s.traf,C=Qt.findBox(S,["tfhd"]),E=Ia.parseTfhd(C[0]),U=E.trackId,I=Qt.findBox(S,["tfdt"]),x=0<I.length?Ia.parseTfdt(I[0]).baseMediaDecodeTime:0,q=Qt.findBox(S,["trun"]);r===U&&0<q.length&&(u=q,d=x,p=(c=E).defaultSampleDuration||0,g=c.defaultSampleSize||0,y=c.trackId,b=[],u.forEach(function(H){var R=Ia.parseTrun(H).samples;R.forEach(function(G){G.duration===void 0&&(G.duration=p),G.size===void 0&&(G.size=g),G.trackId=y,G.dts=d,G.compositionTimeOffset===void 0&&(G.compositionTimeOffset=0),G.pts=d+G.compositionTimeOffset,d+=G.duration}),b=b.concat(R)}),o=function(H,R,G){var ut,z,et,rt,lt=new DataView(H.buffer,H.byteOffset,H.byteLength),mt=[];for(z=0;z+4<H.length;z+=et)if(et=lt.getUint32(z),z+=4,!(et<=0))switch(31&H[z]){case 6:var J=H.subarray(z+1,z+1+et),vt=_p(z,R);ut={nalUnitType:"sei_rbsp",size:et,data:J,escapedRBSP:yp(J),trackId:G},vt?(ut.pts=vt.pts,ut.dts=vt.dts,rt=vt):(ut.pts=rt.pts,ut.dts=rt.dts),mt.push(ut)}return mt}(T,b,U),n[U]||(n[U]=[]),n[U]=n[U].concat(o))}),n},Tp={generator:ni,probe:Qt,Transmuxer:Ua.Transmuxer,AudioSegmentStream:Ua.AudioSegmentStream,VideoSegmentStream:Ua.VideoSegmentStream,CaptionParser:function(){var i,r,e,t,n,a=!1;this.isInitialized=function(){return a},this.init=function(){i=new vp,a=!0,i.on("data",function(s){s.startTime=s.startPts/t,s.endTime=s.endPts/t,n.captions.push(s),n.captionStreams[s.stream]=!0})},this.isNewInit=function(s,o){return!(s&&s.length===0||o&&typeof o=="object"&&Object.keys(o).length===0||e===s[0]&&t===o[e])},this.parse=function(s,o,u){var c,d,p,g;if(!this.isInitialized()||!o||!u)return null;if(this.isNewInit(o,u))e=o[0],t=u[e];else if(!e||!t)return r.push(s),null;for(;0<r.length;){var y=r.shift();this.parse(y,o,u)}return d=s,g=t,(c=(p=e)?{seiNals:bp(d,p)[p],timescale:g}:null)!==null&&c.seiNals?(this.pushNals(c.seiNals),this.flushStream(),n):null},this.pushNals=function(s){if(!this.isInitialized()||!s||s.length===0)return null;s.forEach(function(o){i.push(o)})},this.flushStream=function(){if(!this.isInitialized())return null;i.flush()},this.clearParsedCaptions=function(){n.captions=[],n.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;i.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){r=[],t=e=null,n?this.clearParsedCaptions():n={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}}.CaptionParser,kl=function(i){var r=31&i[1];return r<<=8,r|=i[2]},Dn=function(i){return!!(64&i[1])},Rn=function(i){var r=0;return 1<(48&i[3])>>>4&&(r+=i[4]+1),r},xa=function(i){switch(i){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}},Sp={parseType:function(i,r){var e=kl(i);return e===0?"pat":e===r?"pmt":r?"pes":null},parsePat:function(i){var r=Dn(i),e=4+Rn(i);return r&&(e+=i[e]+1),(31&i[e+10])<<8|i[e+11]},parsePmt:function(i){var r={},e=Dn(i),t=4+Rn(i);if(e&&(t+=i[t]+1),1&i[t+5]){var n;n=3+((15&i[t+1])<<8|i[t+2])-4;for(var a=12+((15&i[t+10])<<8|i[t+11]);a<n;){var s=t+a;r[(31&i[s+1])<<8|i[s+2]]=i[s],a+=5+((15&i[s+3])<<8|i[s+4])}return r}},parsePayloadUnitStartIndicator:Dn,parsePesType:function(i,r){switch(r[kl(i)]){case Tt.H264_STREAM_TYPE:return"video";case Tt.ADTS_STREAM_TYPE:return"audio";case Tt.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(i){if(!Dn(i))return null;var r=4+Rn(i);if(r>=i.byteLength)return null;var e,t=null;return 192&(e=i[r+7])&&((t={}).pts=(14&i[r+9])<<27|(255&i[r+10])<<20|(254&i[r+11])<<12|(255&i[r+12])<<5|(254&i[r+13])>>>3,t.pts*=4,t.pts+=(6&i[r+13])>>>1,t.dts=t.pts,64&e&&(t.dts=(14&i[r+14])<<27|(255&i[r+15])<<20|(254&i[r+16])<<12|(255&i[r+17])<<5|(254&i[r+18])>>>3,t.dts*=4,t.dts+=(6&i[r+18])>>>1)),t},videoPacketContainsKeyFrame:function(i){for(var r=4+Rn(i),e=i.subarray(r),t=0,n=0,a=!1;n<e.byteLength-3;n++)if(e[n+2]===1){t=n+5;break}for(;t<e.byteLength;)switch(e[t]){case 0:if(e[t-1]!==0){t+=2;break}if(e[t-2]!==0){t++;break}for(n+3!==t-2&&xa(31&e[n+3])==="slice_layer_without_partitioning_rbsp_idr"&&(a=!0);e[++t]!==1&&t<e.length;);n=t-2,t+=3;break;case 1:if(e[t-1]!==0||e[t-2]!==0){t+=3;break}xa(31&e[n+3])==="slice_layer_without_partitioning_rbsp_idr"&&(a=!0),n=t-2,t+=3;break;default:t+=3}return e=e.subarray(n),t-=n,n=0,e&&3<e.byteLength&&xa(31&e[n+3])==="slice_layer_without_partitioning_rbsp_idr"&&(a=!0),a}},ai=up,nt={};nt.ts=Sp,nt.aac=Un;var Lt=188,kp=function(i,r,e){for(var t,n,a,s,o=0,u=Lt,c=!1;u<=i.byteLength;)if(i[o]!==71||i[u]!==71&&u!==i.byteLength)o++,u++;else{switch(t=i.subarray(o,u),nt.ts.parseType(t,r.pid)){case"pes":n=nt.ts.parsePesType(t,r.table),a=nt.ts.parsePayloadUnitStartIndicator(t),n==="audio"&&a&&(s=nt.ts.parsePesTime(t))&&(s.type="audio",e.audio.push(s),c=!0)}if(c)break;o+=Lt,u+=Lt}for(o=(u=i.byteLength)-Lt,c=!1;0<=o;)if(i[o]!==71||i[u]!==71&&u!==i.byteLength)o--,u--;else{switch(t=i.subarray(o,u),nt.ts.parseType(t,r.pid)){case"pes":n=nt.ts.parsePesType(t,r.table),a=nt.ts.parsePayloadUnitStartIndicator(t),n==="audio"&&a&&(s=nt.ts.parsePesTime(t))&&(s.type="audio",e.audio.push(s),c=!0)}if(c)break;o-=Lt,u-=Lt}},wp=function(i,r,e){for(var t,n,a,s,o,u,c,d=0,p=Lt,g=!1,y={data:[],size:0};p<i.byteLength;)if(i[d]!==71||i[p]!==71)d++,p++;else{switch(t=i.subarray(d,p),nt.ts.parseType(t,r.pid)){case"pes":if(n=nt.ts.parsePesType(t,r.table),a=nt.ts.parsePayloadUnitStartIndicator(t),n==="video"&&(a&&!g&&(s=nt.ts.parsePesTime(t))&&(s.type="video",e.video.push(s),g=!0),!e.firstKeyFrame)){if(a&&y.size!==0){for(o=new Uint8Array(y.size),u=0;y.data.length;)c=y.data.shift(),o.set(c,u),u+=c.byteLength;nt.ts.videoPacketContainsKeyFrame(o)&&(e.firstKeyFrame=nt.ts.parsePesTime(o),e.firstKeyFrame.type="video"),y.size=0}y.data.push(t),y.size+=t.byteLength}}if(g&&e.firstKeyFrame)break;d+=Lt,p+=Lt}for(d=(p=i.byteLength)-Lt,g=!1;0<=d;)if(i[d]!==71||i[p]!==71)d--,p--;else{switch(t=i.subarray(d,p),nt.ts.parseType(t,r.pid)){case"pes":n=nt.ts.parsePesType(t,r.table),a=nt.ts.parsePayloadUnitStartIndicator(t),n==="video"&&a&&(s=nt.ts.parsePesTime(t))&&(s.type="video",e.video.push(s),g=!0)}if(g)break;d-=Lt,p-=Lt}},Cp=function(i){var r={pid:null,table:null},e={};for(var t in function(n,a){for(var s,o=0,u=Lt;u<n.byteLength;)if(n[o]!==71||n[u]!==71)o++,u++;else{switch(s=n.subarray(o,u),nt.ts.parseType(s,a.pid)){case"pat":a.pid||(a.pid=nt.ts.parsePat(s));break;case"pmt":a.table||(a.table=nt.ts.parsePmt(s))}if(a.pid&&a.table)return;o+=Lt,u+=Lt}}(i,r),r.table)if(r.table.hasOwnProperty(t))switch(r.table[t]){case Tt.H264_STREAM_TYPE:e.video=[],wp(i,r,e),e.video.length===0&&delete e.video;break;case Tt.ADTS_STREAM_TYPE:e.audio=[],kp(i,r,e),e.audio.length===0&&delete e.audio}return e},Ep=function(i,r){var e;return(e=nt.aac.isLikelyAacData(i)?function(t){for(var n,a=!1,s=0,o=null,u=null,c=0,d=0;3<=t.length-d;){switch(nt.aac.parseType(t,d)){case"timed-metadata":if(t.length-d<10){a=!0;break}if((c=nt.aac.parseId3TagSize(t,d))>t.length){a=!0;break}u===null&&(n=t.subarray(d,d+c),u=nt.aac.parseAacTimestamp(n)),d+=c;break;case"audio":if(t.length-d<7){a=!0;break}if((c=nt.aac.parseAdtsSize(t,d))>t.length){a=!0;break}o===null&&(n=t.subarray(d,d+c),o=nt.aac.parseSampleRate(n)),s++,d+=c;break;default:d++}if(a)return null}if(o===null||u===null)return null;var p=9e4/o;return{audio:[{type:"audio",dts:u,pts:u},{type:"audio",dts:u+1024*s*p,pts:u+1024*s*p}]}}(i):Cp(i))&&(e.audio||e.video)?(function(t,n){if(t.audio&&t.audio.length){var a=n;typeof a=="undefined"&&(a=t.audio[0].dts),t.audio.forEach(function(u){u.dts=ai(u.dts,a),u.pts=ai(u.pts,a),u.dtsTime=u.dts/9e4,u.ptsTime=u.pts/9e4})}if(t.video&&t.video.length){var s=n;if(typeof s=="undefined"&&(s=t.video[0].dts),t.video.forEach(function(u){u.dts=ai(u.dts,s),u.pts=ai(u.pts,s),u.dtsTime=u.dts/9e4,u.ptsTime=u.pts/9e4}),t.firstKeyFrame){var o=t.firstKeyFrame;o.dts=ai(o.dts,s),o.pts=ai(o.pts,s),o.dtsTime=o.dts/9e4,o.ptsTime=o.dts/9e4}}}(e,r),e):null},Mn=function(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")},Ap=function(){function i(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}return function(r,e,t){return e&&i(r.prototype,e),t&&i(r,t),r}}(),zt=null,Lp=function(){function i(r){Mn(this,i),zt||(zt=function(){var p=[[[],[],[],[],[]],[[],[],[],[],[]]],g=p[0],y=p[1],b=g[4],T=y[4],S=void 0,C=void 0,E=void 0,U=[],I=[],x=void 0,q=void 0,H=void 0,R=void 0,G=void 0;for(S=0;S<256;S++)I[(U[S]=S<<1^283*(S>>7))^S]=S;for(C=E=0;!b[C];C^=x||1,E=I[E]||1)for(H=(H=E^E<<1^E<<2^E<<3^E<<4)>>8^255&H^99,G=16843009*U[q=U[x=U[T[b[C]=H]=C]]]^65537*q^257*x^16843008*C,R=257*U[H]^16843008*H,S=0;S<4;S++)g[S][C]=R=R<<24^R>>>8,y[S][H]=G=G<<24^G>>>8;for(S=0;S<5;S++)g[S]=g[S].slice(0),y[S]=y[S].slice(0);return p}()),this._tables=[[zt[0][0].slice(),zt[0][1].slice(),zt[0][2].slice(),zt[0][3].slice(),zt[0][4].slice()],[zt[1][0].slice(),zt[1][1].slice(),zt[1][2].slice(),zt[1][3].slice(),zt[1][4].slice()]];var e=void 0,t=void 0,n=void 0,a=void 0,s=void 0,o=this._tables[0][4],u=this._tables[1],c=r.length,d=1;if(c!==4&&c!==6&&c!==8)throw new Error("Invalid aes key size");for(a=r.slice(0),s=[],this._key=[a,s],e=c;e<4*c+28;e++)n=a[e-1],(e%c==0||c===8&&e%c==4)&&(n=o[n>>>24]<<24^o[n>>16&255]<<16^o[n>>8&255]<<8^o[255&n],e%c==0&&(n=n<<8^n>>>24^d<<24,d=d<<1^283*(d>>7))),a[e]=a[e-c]^n;for(t=0;e;t++,e--)n=a[3&t?e:e-4],s[t]=e<=4||t<4?n:u[0][o[n>>>24]]^u[1][o[n>>16&255]]^u[2][o[n>>8&255]]^u[3][o[255&n]]}return i.prototype.decrypt=function(r,e,t,n,a,s){var o=this._key[1],u=r^o[0],c=n^o[1],d=t^o[2],p=e^o[3],g=void 0,y=void 0,b=void 0,T=o.length/4-2,S=void 0,C=4,E=this._tables[1],U=E[0],I=E[1],x=E[2],q=E[3],H=E[4];for(S=0;S<T;S++)g=U[u>>>24]^I[c>>16&255]^x[d>>8&255]^q[255&p]^o[C],y=U[c>>>24]^I[d>>16&255]^x[p>>8&255]^q[255&u]^o[C+1],b=U[d>>>24]^I[p>>16&255]^x[u>>8&255]^q[255&c]^o[C+2],p=U[p>>>24]^I[u>>16&255]^x[c>>8&255]^q[255&d]^o[C+3],C+=4,u=g,c=y,d=b;for(S=0;S<4;S++)a[(3&-S)+s]=H[u>>>24]<<24^H[c>>16&255]<<16^H[d>>8&255]<<8^H[255&p]^o[C++],g=u,u=c,c=d,d=p,p=g},i}(),wl=function(){function i(){Mn(this,i),this.listeners={}}return i.prototype.on=function(r,e){this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push(e)},i.prototype.off=function(r,e){if(!this.listeners[r])return!1;var t=this.listeners[r].indexOf(e);return this.listeners[r].splice(t,1),-1<t},i.prototype.trigger=function(r){var e=this.listeners[r];if(e)if(arguments.length===2)for(var t=e.length,n=0;n<t;++n)e[n].call(this,arguments[1]);else for(var a=Array.prototype.slice.call(arguments,1),s=e.length,o=0;o<s;++o)e[o].apply(this,a)},i.prototype.dispose=function(){this.listeners={}},i.prototype.pipe=function(r){this.on("data",function(e){r.push(e)})},i}(),Cl=function(i){function r(){Mn(this,r);var e=function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||typeof n!="object"&&typeof n!="function"?t:n}(this,i.call(this,wl));return e.jobs=[],e.delay=1,e.timeout_=null,e}return function(e,t){if(typeof t!="function"&&t!==null)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)}(r,i),r.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},r.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},r}(wl),Wt=function(i){return i<<24|(65280&i)<<8|(16711680&i)>>8|i>>>24},El=function(i,r,e){var t=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>2),n=new Lp(Array.prototype.slice.call(r)),a=new Uint8Array(i.byteLength),s=new Int32Array(a.buffer),o=void 0,u=void 0,c=void 0,d=void 0,p=void 0,g=void 0,y=void 0,b=void 0,T=void 0;for(o=e[0],u=e[1],c=e[2],d=e[3],T=0;T<t.length;T+=4)p=Wt(t[T]),g=Wt(t[T+1]),y=Wt(t[T+2]),b=Wt(t[T+3]),n.decrypt(p,g,y,b,s,T),s[T]=Wt(s[T]^o),s[T+1]=Wt(s[T+1]^u),s[T+2]=Wt(s[T+2]^c),s[T+3]=Wt(s[T+3]^d),o=p,u=g,c=y,d=b;return a},Op=function(){function i(r,e,t,n){Mn(this,i);var a=i.STEP,s=new Int32Array(r.buffer),o=new Uint8Array(r.byteLength),u=0;for(this.asyncStream_=new Cl,this.asyncStream_.push(this.decryptChunk_(s.subarray(u,u+a),e,t,o)),u=a;u<s.length;u+=a)t=new Uint32Array([Wt(s[u-4]),Wt(s[u-3]),Wt(s[u-2]),Wt(s[u-1])]),this.asyncStream_.push(this.decryptChunk_(s.subarray(u,u+a),e,t,o));this.asyncStream_.push(function(){var c;n(null,(c=o).subarray(0,c.byteLength-c[c.byteLength-1]))})}return i.prototype.decryptChunk_=function(r,e,t,n){return function(){var a=El(r,e,t);n.set(a,r.byteOffset)}},Ap(i,null,[{key:"STEP",get:function(){return 32e3}}]),i}(),le=function(i,r){return/^[a-z]+:/i.test(r)?r:(/\/\//i.test(i)||(i=hu.buildAbsoluteURL(A.location.href,i)),hu.buildAbsoluteURL(i,r))},Gt=function(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")},Zt=function(){function i(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}return function(r,e,t){return e&&i(r.prototype,e),t&&i(r,t),r}}(),ce=function(i,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof r);i.prototype=Object.create(r&&r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(i,r):i.__proto__=r)},se=function(i,r){if(!i)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||typeof r!="object"&&typeof r!="function"?i:r},Pp=function(i,r){if(Array.isArray(i))return i;if(Symbol.iterator in Object(i))return function(e,t){var n=[],a=!0,s=!1,o=void 0;try{for(var u,c=e[Symbol.iterator]();!(a=(u=c.next()).done)&&(n.push(u.value),!t||n.length!==t);a=!0);}catch(d){s=!0,o=d}finally{try{!a&&c.return&&c.return()}finally{if(s)throw o}}return n}(i,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")},Da=O.mergeOptions,Up=O.EventTarget,Ip=O.log,Ra=function(i,r){["AUDIO","SUBTITLES"].forEach(function(e){for(var t in i.mediaGroups[e])for(var n in i.mediaGroups[e][t]){var a=i.mediaGroups[e][t][n];r(a,e,t,n)}})},Ma=function(i,r){var e=Da(i,{}),t=e.playlists[r.uri];if(!t||t.segments&&r.segments&&t.segments.length===r.segments.length&&t.mediaSequence===r.mediaSequence)return null;var n=Da(t,r);t.segments&&(n.segments=function(s,o,u){var c=o.slice();u=u||0;for(var d=Math.min(s.length,o.length+u),p=u;p<d;p++)c[p-u]=Da(s[p],c[p-u]);return c}(t.segments,r.segments,r.mediaSequence-t.mediaSequence)),n.segments.forEach(function(s){var o,u;o=s,u=n.resolvedUri,o.resolvedUri||(o.resolvedUri=le(u,o.uri)),o.key&&!o.key.resolvedUri&&(o.key.resolvedUri=le(u,o.key.uri)),o.map&&!o.map.resolvedUri&&(o.map.resolvedUri=le(u,o.map.uri))});for(var a=0;a<e.playlists.length;a++)e.playlists[a].uri===r.uri&&(e.playlists[a]=n);return e.playlists[r.uri]=n,e},Al=function(i){for(var r=i.playlists.length;r--;){var e=i.playlists[r];(i.playlists[e.uri]=e).resolvedUri=le(i.uri,e.uri),e.id=r,e.attributes||(e.attributes={},Ip.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))}},Ll=function(i){Ra(i,function(r){r.uri&&(r.resolvedUri=le(i.uri,r.uri))})},Ol=function(i,r){var e=i.segments[i.segments.length-1];return r&&e&&e.duration?1e3*e.duration:500*(i.targetDuration||10)},Bn=function(i){function r(e,t,n){Gt(this,r);var a=se(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));if(a.srcUrl=e,a.hls_=t,a.withCredentials=n,!a.srcUrl)throw new Error("A non-empty playlist URL is required");return a.state="HAVE_NOTHING",a.on("mediaupdatetimeout",function(){a.state==="HAVE_METADATA"&&(a.state="HAVE_CURRENT_METADATA",a.request=a.hls_.xhr({uri:le(a.master.uri,a.media().uri),withCredentials:a.withCredentials},function(s,o){if(a.request)return s?a.playlistRequestError(a.request,a.media().uri,"HAVE_METADATA"):void a.haveMetadata(a.request,a.media().uri)}))}),a}return ce(r,Up),Zt(r,[{key:"playlistRequestError",value:function(e,t,n){this.request=null,n&&(this.state=n),this.error={playlist:this.master.playlists[t],status:e.status,message:"HLS playlist request error at URL: "+t,responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")}},{key:"haveMetadata",value:function(e,t){var n=this;this.request=null,this.state="HAVE_METADATA";var a=new du;a.push(e.responseText),a.end(),a.manifest.uri=t,a.manifest.attributes=a.manifest.attributes||{};var s=Ma(this.master,a.manifest);this.targetDuration=a.manifest.targetDuration,s?(this.master=s,this.media_=this.master.playlists[a.manifest.uri]):this.trigger("playlistunchanged"),this.media().endList||(A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=A.setTimeout(function(){n.trigger("mediaupdatetimeout")},Ol(this.media(),!!s))),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.stopRequest(),A.clearTimeout(this.mediaUpdateTimeout)}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(e){var t=this;if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);var n=this.state;if(typeof e=="string"){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}var a=!this.media_||e.uri!==this.media_.uri;if(this.master.playlists[e.uri].endList)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(a&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(a){if(this.state="SWITCHING_MEDIA",this.request){if(le(this.master.uri,e.uri)===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.hls_.xhr({uri:le(this.master.uri,e.uri),withCredentials:this.withCredentials},function(s,o){if(t.request){if(s)return t.playlistRequestError(t.request,e.uri,n);t.haveMetadata(o,e.uri),n==="HAVE_MASTER"?t.trigger("loadedmetadata"):t.trigger("mediachange")}})}}},{key:"pause",value:function(){this.stopRequest(),A.clearTimeout(this.mediaUpdateTimeout),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}},{key:"load",value:function(e){var t=this;A.clearTimeout(this.mediaUpdateTimeout);var n=this.media();if(e){var a=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=A.setTimeout(function(){return t.load()},a)}else this.started?n&&!n.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,n){if(e.request){if(e.request=null,t)return e.error={status:n.status,message:"HLS playlist request error at URL: "+e.srcUrl,responseText:n.responseText,code:2},e.state==="HAVE_NOTHING"&&(e.started=!1),e.trigger("error");var a=new du;return a.push(n.responseText),a.end(),e.state="HAVE_MASTER",a.manifest.uri=e.srcUrl,a.manifest.playlists?(e.master=a.manifest,Al(e.master),Ll(e.master),e.trigger("loadedplaylist"),void(e.request||e.media(a.manifest.playlists[0]))):(e.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:A.location.href,playlists:[{uri:e.srcUrl,id:0}]},e.master.playlists[e.srcUrl]=e.master.playlists[0],e.master.playlists[0].resolvedUri=e.srcUrl,e.master.playlists[0].attributes=e.master.playlists[0].attributes||{},e.haveMetadata(n,e.srcUrl),e.trigger("loadedmetadata"))}})}}]),r}(),Pl=O.createTimeRange,Ul=function(i,r,e){var t,n;return typeof r=="undefined"&&(r=i.mediaSequence+i.segments.length),r<i.mediaSequence?0:(t=function(a,s){var o=0,u=s-a.mediaSequence,c=a.segments[u];if(c){if(typeof c.start!="undefined")return{result:c.start,precise:!0};if(typeof c.end!="undefined")return{result:c.end-c.duration,precise:!0}}for(;u--;){if(typeof(c=a.segments[u]).end!="undefined")return{result:o+c.end,precise:!0};if(o+=c.duration,typeof c.start!="undefined")return{result:o+c.start,precise:!0}}return{result:o,precise:!1}}(i,r)).precise?t.result:(n=function(a,s){for(var o=0,u=void 0,c=s-a.mediaSequence;c<a.segments.length;c++){if(typeof(u=a.segments[c]).start!="undefined")return{result:u.start-o,precise:!0};if(o+=u.duration,typeof u.end!="undefined")return{result:u.end-o,precise:!0}}return{result:-1,precise:!1}}(i,r)).precise?n.result:t.result+e},Il=function(i,r,e){if(!i)return 0;if(typeof e!="number"&&(e=0),typeof r=="undefined"){if(i.totalDuration)return i.totalDuration;if(!i.endList)return A.Infinity}return Ul(i,r,e)},Fi=function(i,r,e){var t=0;if(e<r){var n=[e,r];r=n[0],e=n[1]}if(r<0){for(var a=r;a<Math.min(0,e);a++)t+=i.targetDuration;r=0}for(var s=r;s<e;s++)t+=i.segments[s].duration;return t},xl=function(i){if(!i.segments.length)return 0;for(var r=i.segments.length-1,e=i.segments[r].duration||i.targetDuration,t=e+2*i.targetDuration;r--&&!(t<=(e+=i.segments[r].duration)););return Math.max(0,r)},Dl=function(i,r,e){if(!i||!i.segments)return null;if(i.endList)return Il(i);if(r===null)return null;r=r||0;var t=e?xl(i):i.segments.length;return Ul(i,i.mediaSequence+t,r)},Rl=function(i){return i-Math.floor(i)==0},Ml=function(i,r){if(Rl(r))return r+.1*i;for(var e=r.toString().split(".")[1].length,t=1;t<=e;t++){var n=Math.pow(10,t),a=r*n;if(Rl(a)||t===e)return(a+i)/n}},xp=Ml.bind(null,1),Dp=Ml.bind(null,-1),Bl=function(i){return i.excludeUntil&&i.excludeUntil>Date.now()},Ba=function(i){return i.excludeUntil&&i.excludeUntil===1/0},Nn=function(i){var r=Bl(i);return!i.disabled&&!r},Nl=function(i,r){return r.attributes&&r.attributes[i]},Na=function(i,r){if(i.playlists.length===1)return!0;var e=r.attributes.BANDWIDTH||Number.MAX_VALUE;return i.playlists.filter(function(t){return!!Nn(t)&&(t.attributes.BANDWIDTH||0)<e}).length===0},Bt={duration:Il,seekable:function(i,r){var e=r||0,t=Dl(i,r,!0);return t===null?Pl():Pl(e,t)},safeLiveIndex:xl,getMediaInfoForTime:function(i,r,e,t){var n=void 0,a=void 0,s=i.segments.length,o=r-t;if(o<0){if(0<e){for(n=e-1;0<=n;n--)if(a=i.segments[n],0<(o+=Dp(a.duration)))return{mediaIndex:n,startTime:t-Fi(i,e,n)}}return{mediaIndex:0,startTime:r}}if(e<0){for(n=e;n<0;n++)if((o-=i.targetDuration)<0)return{mediaIndex:0,startTime:r};e=0}for(n=e;n<s;n++)if(a=i.segments[n],(o-=xp(a.duration))<0)return{mediaIndex:n,startTime:t+Fi(i,e,n)};return{mediaIndex:s-1,startTime:r}},isEnabled:Nn,isDisabled:function(i){return i.disabled},isBlacklisted:Bl,isIncompatible:Ba,playlistEnd:Dl,isAes:function(i){for(var r=0;r<i.segments.length;r++)if(i.segments[r].key)return!0;return!1},isFmp4:function(i){for(var r=0;r<i.segments.length;r++)if(i.segments[r].map)return!0;return!1},hasAttribute:Nl,estimateSegmentRequestTime:function(i,r,e){var t=3<arguments.length&&arguments[3]!==void 0?arguments[3]:0;return Nl("BANDWIDTH",e)?(i*e.attributes.BANDWIDTH-8*t)/r:NaN},isLowestEnabledRendition:Na},Rp=O.xhr,Mp=O.mergeOptions,jl=function(){return function i(r,e){r=Mp({timeout:45e3},r);var t=i.beforeRequest||O.Hls.xhr.beforeRequest;if(t&&typeof t=="function"){var n=t(r);n&&(r=n)}var a=Rp(r,function(o,u){var c=a.response;!o&&c&&(a.responseTime=Date.now(),a.roundTripTime=a.responseTime-a.requestTime,a.bytesReceived=c.byteLength||c.length,a.bandwidth||(a.bandwidth=Math.floor(a.bytesReceived/a.roundTripTime*8*1e3))),u.headers&&(a.responseHeaders=u.headers),o&&o.code==="ETIMEDOUT"&&(a.timedout=!0),o||a.aborted||u.statusCode===200||u.statusCode===206||u.statusCode===0||(o=new Error("XHR Failed with a response of: "+(a&&(c||a.responseText)))),e(o,a)}),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=r.uri,a.requestTime=Date.now(),a}},Bp=function(i,r){var e=i.toString(16);return"00".substring(0,2-e.length)+e+(r%2?" ":"")},Np=function(i){return 32<=i&&i<126?String.fromCharCode(i):"."},Fl=function(i){var r={};return Object.keys(i).forEach(function(e){var t=i[e];ArrayBuffer.isView(t)?r[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:r[e]=t}),r},jn=function(i){var r=i.byterange||{length:1/0,offset:0};return[r.length,r.offset,i.resolvedUri].join(",")},Vl=function(i){for(var r=Array.prototype.slice.call(i),e="",t=0;t<r.length/16;t++)e+=r.slice(16*t,16*t+16).map(Bp).join("")+" "+r.slice(16*t,16*t+16).map(Np).join("")+`
|
|
`;return e},jp=Object.freeze({createTransferableMessage:Fl,initSegmentId:jn,hexDump:Vl,tagDump:function(i){var r=i.bytes;return Vl(r)},textRanges:function(i){var r,e,t="",n=void 0;for(n=0;n<i.length;n++)t+=(e=n,(r=i).start(e)+"-"+r.end(e)+" ");return t}}),Hl=function(i,r,e,t){var n=void 0;if(r==="stream"){n=new Date(1e3*t+e.getTime());var a=i.toISOString(),s=e.toISOString(),o=n.toISOString();return s<=a&&a<=o}if(r==="player")return n=t+e,e<=i&&i<=n},ql=function(i,r,e){if(!e.segments||e.segments.length===0||r!=="player"&&r!=="stream")return null;for(var t=0,n=0;n<e.segments.length;n++){var a=e.segments[n],s=t+a.duration,o=void 0,u=void 0;u=r==="player"?(o=a.start,t):(o=a.dateTimeObject,a.dateTimeObject);var c=typeof a.start!="undefined"&&typeof a.end!="undefined"&&Hl(i,r,o,a.end-a.start),d=Hl(i,r,u,a.duration);if(c)return{segment:a,estimatedStart:u,type:"accurate"};if(d)return{segment:a,estimatedStart:u,type:"estimate"};t=s}return null},Fp=function(i){var r=i.playlist,e=i.time,t=e===void 0?void 0:e,n=i.callback;if(!n)throw new Error("getStreamTime: callback must be provided");if(!r||t===void 0)return n({message:"getStreamTime: playlist and time must be provided"});var a=ql(t,"player",r);if(!a)return n({message:"valid streamTime was not found"});if(a.type==="estimate")return n({message:"Accurate streamTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:t};return a.segment.dateTimeObject&&(s.programDateTime=a.segment.dateTimeObject.toISOString()),n(null,s)},Vp=function i(r){var e=r.streamTime,t=r.playlist,n=r.retryCount,a=n===void 0?2:n,s=r.seekTo,o=r.pauseAfterSeek,u=o===void 0||o,c=r.tech,d=r.callback;if(!d)throw new Error("seekToStreamTime: callback must be provided");if(typeof e=="undefined"||!t||!s)return d({message:"seekToStreamTime: streamTime, seekTo and playlist must be provided"});if(!t.endList&&!c.hasStarted_)return d({message:"player must be playing a live stream to start buffering"});if(!function(T){if(!T.segments||T.segments.length===0)return!1;for(var S=0;S<T.segments.length;S++)if(!T.segments[S].dateTimeObject)return!1;return!0}(t))return d({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri});var p=function(T,S){var C=void 0;try{C=new Date(T)}catch(E){return null}return ql(C,"stream",S)}(e,t);if(!p)return d({message:e+" was not found in the stream"});if(p.type==="estimate")return a===0?d({message:e+" is not buffered yet. Try again"}):i({streamTime:e,playlist:t,retryCount:a-1,seekTo:s,pauseAfterSeek:u,tech:c,callback:d});var g=p.segment,y=function(T,S){var C=void 0,E=void 0;try{C=new Date(T),E=new Date(S)}catch(I){}var U=C.getTime();return(E.getTime()-U)/1e3}(g.dateTimeObject,e),b=g.start+y;c.one("seeked",function(){return d(null,c.currentTime())}),u&&c.pause(),s(b)},Vi=1/30,zl=function(i,r){var e=[],t=void 0;if(i&&i.length)for(t=0;t<i.length;t++)r(i.start(t),i.end(t))&&e.push([i.start(t),i.end(t)]);return O.createTimeRanges(e)},Wl=function(i,r){return zl(i,function(e,t){return e-Vi<=r&&r<=t+Vi})},Gl=function(i,r){return zl(i,function(e){return r<=e-Vi})},ja=function(i){var r=[];if(!i||!i.length)return"";for(var e=0;e<i.length;e++)r.push(i.start(e)+" => "+i.end(e));return r.join(", ")},Xl=function(i){for(var r=[],e=0;e<i.length;e++)r.push({start:i.start(e),end:i.end(e)});return r},si=function(i,r,e){var t=void 0,n=void 0;if(e&&e.cues)for(t=e.cues.length;t--;)(n=e.cues[t]).startTime<=r&&n.endTime>=i&&e.removeCue(n)},Yl=function(i){return isNaN(i)||Math.abs(i)===1/0?Number.MAX_VALUE:i},Hp=function(i,r,e){var t=A.WebKitDataCue||A.VTTCue;if(r&&r.forEach(function(d){var p=d.stream;this.inbandTextTracks_[p].addCue(new t(d.startTime+this.timestampOffset,d.endTime+this.timestampOffset,d.text))},i),e){var n=Yl(i.mediaSource_.duration);if(e.forEach(function(d){var p=d.cueTime+this.timestampOffset;d.frames.forEach(function(g){var y,b=new t(p,p,g.value||g.url||g.data||"");b.frame=g,b.value=g,y=b,Object.defineProperties(y.frame,{id:{get:function(){return O.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),y.value.key}},value:{get:function(){return O.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),y.value.data}},privateData:{get:function(){return O.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),y.value.data}}}),this.metadataTrack_.addCue(b)},this)},i),i.metadataTrack_&&i.metadataTrack_.cues&&i.metadataTrack_.cues.length){for(var a=i.metadataTrack_.cues,s=[],o=0;o<a.length;o++)a[o]&&s.push(a[o]);var u=s.reduce(function(d,p){var g=d[p.startTime]||[];return g.push(p),d[p.startTime]=g,d},{}),c=Object.keys(u).sort(function(d,p){return Number(d)-Number(p)});c.forEach(function(d,p){var g=u[d],y=Number(c[p+1])||n;g.forEach(function(b){b.endTime=y})})}}},Me=typeof window!="undefined"?window:{},Fa=typeof Symbol=="undefined"?"__target":Symbol(),qp="application/javascript",zp=Me.BlobBuilder||Me.WebKitBlobBuilder||Me.MozBlobBuilder||Me.MSBlobBuilder,oi=Me.URL||Me.webkitURL||oi&&oi.msURL,ui=Me.Worker;function $l(i,r){return function(e){var t=this;if(!r)return new ui(i);if(ui&&!e){var n=Jl(r.toString().replace(/^function.+?{/,"").slice(0,-1));return this[Fa]=new ui(n),function(s,o){if(!(!s||!o)){var u=s.terminate;s.objURL=o,s.terminate=function(){s.objURL&&oi.revokeObjectURL(s.objURL),u.call(s)}}}(this[Fa],n),this[Fa]}var a={postMessage:function(s){t.onmessage&&setTimeout(function(){t.onmessage({data:s,target:a})})}};r.call(a),this.postMessage=function(s){setTimeout(function(){a.onmessage({data:s,target:t})})},this.isThisThread=!0}}if(ui){var Va,Kl=Jl("self.onmessage = function () {}"),Ql=new Uint8Array(1);try{(Va=new ui(Kl)).postMessage(Ql,[Ql.buffer])}catch(i){ui=null}finally{oi.revokeObjectURL(Kl),Va&&Va.terminate()}}function Jl(i){try{return oi.createObjectURL(new Blob([i],{type:qp}))}catch(e){var r=new zp;return r.append(i),oi.createObjectURL(r.getBlob(type))}}var Wp=new $l("./transmuxer-worker.worker.js",function(i,r){var e=this;(function(){var t,n,a,s,o,u,c,d,p,g,y,b,T,S,C,E,U,I,x,q,H,R,G,ut,z,et,rt,lt,mt,J,vt,gt,he,te,Ec,Ac,Lc,Oc,Pc,Ka,Uc=Math.pow(2,32)-1;(function(){var l;if(R={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},typeof Uint8Array!="undefined"){for(l in R)R.hasOwnProperty(l)&&(R[l]=[l.charCodeAt(0),l.charCodeAt(1),l.charCodeAt(2),l.charCodeAt(3)]);G=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),z=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),ut=new Uint8Array([0,0,0,1]),et=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]),rt=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]),lt={video:et,audio:rt},vt=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),J=new Uint8Array([0,0,0,0,0,0,0,0]),gt=new Uint8Array([0,0,0,0,0,0,0,0]),he=gt,te=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Ec=gt,mt=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),t=function(l){var h,f,m=[],v=0;for(h=1;h<arguments.length;h++)m.push(arguments[h]);for(h=m.length;h--;)v+=m[h].byteLength;for(f=new Uint8Array(v+8),new DataView(f.buffer,f.byteOffset,f.byteLength).setUint32(0,f.byteLength),f.set(l,4),h=0,v=8;h<m.length;h++)f.set(m[h],v),v+=m[h].byteLength;return f},n=function(){return t(R.dinf,t(R.dref,vt))},a=function(l){return t(R.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,l.audioobjecttype<<3|l.samplingfrequencyindex>>>1,l.samplingfrequencyindex<<7|l.channelcount<<3,6,1,2]))},C=function(l){return t(R.hdlr,lt[l])},S=function(l){var h=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,l.duration>>>24&255,l.duration>>>16&255,l.duration>>>8&255,255&l.duration,85,196,0,0]);return l.samplerate&&(h[12]=l.samplerate>>>24&255,h[13]=l.samplerate>>>16&255,h[14]=l.samplerate>>>8&255,h[15]=255&l.samplerate),t(R.mdhd,h)},T=function(l){return t(R.mdia,S(l),C(l.type),u(l))},o=function(l){return t(R.mfhd,new Uint8Array([0,0,0,0,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l]))},u=function(l){return t(R.minf,l.type==="video"?t(R.vmhd,mt):t(R.smhd,J),n(),U(l))},c=function(l,h){for(var f=[],m=h.length;m--;)f[m]=x(h[m]);return t.apply(null,[R.moof,o(l)].concat(f))},d=function(l){for(var h=l.length,f=[];h--;)f[h]=y(l[h]);return t.apply(null,[R.moov,g(4294967295)].concat(f).concat(p(l)))},p=function(l){for(var h=l.length,f=[];h--;)f[h]=q(l[h]);return t.apply(null,[R.mvex].concat(f))},g=function(l){var h=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l,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(R.mvhd,h)},E=function(l){var h,f,m=l.samples||[],v=new Uint8Array(4+m.length);for(f=0;f<m.length;f++)h=m[f].flags,v[f+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return t(R.sdtp,v)},U=function(l){return t(R.stbl,I(l),t(R.stts,Ec),t(R.stsc,he),t(R.stsz,te),t(R.stco,gt))},I=function(l){return t(R.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),l.type==="video"?Ac(l):Lc(l))},Ac=function(l){var h,f=l.sps||[],m=l.pps||[],v=[],_=[];for(h=0;h<f.length;h++)v.push((65280&f[h].byteLength)>>>8),v.push(255&f[h].byteLength),v=v.concat(Array.prototype.slice.call(f[h]));for(h=0;h<m.length;h++)_.push((65280&m[h].byteLength)>>>8),_.push(255&m[h].byteLength),_=_.concat(Array.prototype.slice.call(m[h]));return t(R.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&l.width)>>8,255&l.width,(65280&l.height)>>8,255&l.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(R.avcC,new Uint8Array([1,l.profileIdc,l.profileCompatibility,l.levelIdc,255].concat([f.length]).concat(v).concat([m.length]).concat(_))),t(R.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},Lc=function(l){return t(R.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&l.channelcount)>>8,255&l.channelcount,(65280&l.samplesize)>>8,255&l.samplesize,0,0,0,0,(65280&l.samplerate)>>8,255&l.samplerate,0,0]),a(l))},b=function(l){var h=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&l.id)>>24,(16711680&l.id)>>16,(65280&l.id)>>8,255&l.id,0,0,0,0,(4278190080&l.duration)>>24,(16711680&l.duration)>>16,(65280&l.duration)>>8,255&l.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&l.width)>>8,255&l.width,0,0,(65280&l.height)>>8,255&l.height,0,0]);return t(R.tkhd,h)},x=function(l){var h,f,m,v,_,k;return h=t(R.tfhd,new Uint8Array([0,0,0,58,(4278190080&l.id)>>24,(16711680&l.id)>>16,(65280&l.id)>>8,255&l.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),_=Math.floor(l.baseMediaDecodeTime/(Uc+1)),k=Math.floor(l.baseMediaDecodeTime%(Uc+1)),f=t(R.tfdt,new Uint8Array([1,0,0,0,_>>>24&255,_>>>16&255,_>>>8&255,255&_,k>>>24&255,k>>>16&255,k>>>8&255,255&k])),l.type==="audio"?(m=H(l,92),t(R.traf,h,f,m)):(v=E(l),m=H(l,v.length+92),t(R.traf,h,f,m,v))},y=function(l){return l.duration=l.duration||4294967295,t(R.trak,b(l),T(l))},q=function(l){var h=new Uint8Array([0,0,0,0,(4278190080&l.id)>>24,(16711680&l.id)>>16,(65280&l.id)>>8,255&l.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return l.type!=="video"&&(h[h.length-1]=0),t(R.trex,h)},Ka=function(l,h){var f=0,m=0,v=0,_=0;return l.length&&(l[0].duration!==void 0&&(f=1),l[0].size!==void 0&&(m=2),l[0].flags!==void 0&&(v=4),l[0].compositionTimeOffset!==void 0&&(_=8)),[0,0,f|m|v|_,1,(4278190080&l.length)>>>24,(16711680&l.length)>>>16,(65280&l.length)>>>8,255&l.length,(4278190080&h)>>>24,(16711680&h)>>>16,(65280&h)>>>8,255&h]},Pc=function(l,h){var f,m,v,_;for(h+=20+16*(m=l.samples||[]).length,f=Ka(m,h),_=0;_<m.length;_++)v=m[_],f=f.concat([(4278190080&v.duration)>>>24,(16711680&v.duration)>>>16,(65280&v.duration)>>>8,255&v.duration,(4278190080&v.size)>>>24,(16711680&v.size)>>>16,(65280&v.size)>>>8,255&v.size,v.flags.isLeading<<2|v.flags.dependsOn,v.flags.isDependedOn<<6|v.flags.hasRedundancy<<4|v.flags.paddingValue<<1|v.flags.isNonSyncSample,61440&v.flags.degradationPriority,15&v.flags.degradationPriority,(4278190080&v.compositionTimeOffset)>>>24,(16711680&v.compositionTimeOffset)>>>16,(65280&v.compositionTimeOffset)>>>8,255&v.compositionTimeOffset]);return t(R.trun,new Uint8Array(f))},Oc=function(l,h){var f,m,v,_;for(h+=20+8*(m=l.samples||[]).length,f=Ka(m,h),_=0;_<m.length;_++)v=m[_],f=f.concat([(4278190080&v.duration)>>>24,(16711680&v.duration)>>>16,(65280&v.duration)>>>8,255&v.duration,(4278190080&v.size)>>>24,(16711680&v.size)>>>16,(65280&v.size)>>>8,255&v.size]);return t(R.trun,new Uint8Array(f))},H=function(l,h){return l.type==="audio"?Oc(l,h):Pc(l,h)};var ee,Qa,Ic,xc,Dc,li={ftyp:s=function(){return t(R.ftyp,G,ut,G,z)},mdat:function(l){return t(R.mdat,l)},moof:c,moov:d,initSegment:function(l){var h,f=s(),m=d(l);return(h=new Uint8Array(f.byteLength+m.byteLength)).set(f),h.set(m,f.byteLength),h}},ci=function(l){return l>>>0};Ic=function(l){return ee(l,["moov","trak"]).reduce(function(h,f){var m,v,_,k,w;return(m=ee(f,["tkhd"])[0])?(v=m[0],k=ci(m[_=v===0?12:20]<<24|m[_+1]<<16|m[_+2]<<8|m[_+3]),(w=ee(f,["mdia","mdhd"])[0])?(_=(v=w[0])===0?12:20,h[k]=ci(w[_]<<24|w[_+1]<<16|w[_+2]<<8|w[_+3]),h):null):null},{})},xc=function(l,h){var f,m,v;return f=ee(h,["moof","traf"]),m=[].concat.apply([],f.map(function(_){return ee(_,["tfhd"]).map(function(k){var w,L;return w=ci(k[4]<<24|k[5]<<16|k[6]<<8|k[7]),L=l[w]||9e4,(ee(_,["tfdt"]).map(function(P){var M,N;return M=P[0],N=ci(P[4]<<24|P[5]<<16|P[6]<<8|P[7]),M===1&&(N*=Math.pow(2,32),N+=ci(P[8]<<24|P[9]<<16|P[10]<<8|P[11])),N})[0]||1/0)/L})})),v=Math.min.apply(null,m),isFinite(v)?v:0},Dc=function(l){var h=ee(l,["moov","trak"]),f=[];return h.forEach(function(m){var v=ee(m,["mdia","hdlr"]),_=ee(m,["tkhd"]);v.forEach(function(k,w){var L,P,M=Qa(k.subarray(8,12)),N=_[w];M==="vide"&&(P=(L=new DataView(N.buffer,N.byteOffset,N.byteLength)).getUint8(0)===0?L.getUint32(12):L.getUint32(20),f.push(P))})}),f};var Be={findBox:ee=function(l,h){var f,m,v,_,k,w=[];if(!h.length)return null;for(f=0;f<l.byteLength;)m=ci(l[f]<<24|l[f+1]<<16|l[f+2]<<8|l[f+3]),v=Qa(l.subarray(f+4,f+8)),_=1<m?f+m:l.byteLength,v===h[0]&&(h.length===1?w.push(l.subarray(f+8,_)):(k=ee(l.subarray(f+8,_),h.slice(1))).length&&(w=w.concat(k))),f=_;return w},parseType:Qa=function(l){var h="";return h+=String.fromCharCode(l[0]),h+=String.fromCharCode(l[1]),h+=String.fromCharCode(l[2]),h+=String.fromCharCode(l[3])},timescale:Ic,startTime:xc,videoTrackIds:Dc},qn=function(){this.init=function(){var l={};this.on=function(h,f){l[h]||(l[h]=[]),l[h]=l[h].concat(f)},this.off=function(h,f){var m;return!!l[h]&&(m=l[h].indexOf(f),l[h]=l[h].slice(),l[h].splice(m,1),-1<m)},this.trigger=function(h){var f,m,v,_;if(f=l[h])if(arguments.length===2)for(v=f.length,m=0;m<v;++m)f[m].call(this,arguments[1]);else{for(_=[],m=arguments.length,m=1;m<arguments.length;++m)_.push(arguments[m]);for(v=f.length,m=0;m<v;++m)f[m].apply(this,_)}},this.dispose=function(){l={}}}};qn.prototype.pipe=function(l){return this.on("data",function(h){l.push(h)}),this.on("done",function(h){l.flush(h)}),l},qn.prototype.push=function(l){this.trigger("data",l)},qn.prototype.flush=function(l){this.trigger("done",l)};var Ja,Rc,Mc,Bc,Nc,jc,Fc,Ot=qn,vf=function(l){var h,f,m=[],v=[];for(h=m.byteLength=0;h<l.length;h++)(f=l[h]).nalUnitType==="access_unit_delimiter_rbsp"?(m.length&&(m.duration=f.dts-m.dts,v.push(m)),(m=[f]).byteLength=f.data.byteLength,m.pts=f.pts,m.dts=f.dts):(f.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(m.keyFrame=!0),m.duration=f.dts-m.dts,m.byteLength+=f.data.byteLength,m.push(f));return v.length&&(!m.duration||m.duration<=0)&&(m.duration=v[v.length-1].duration),v.push(m),v},_f=function(l){var h,f,m=[],v=[];for(m.byteLength=0,m.nalCount=0,m.duration=0,m.pts=l[0].pts,m.dts=l[0].dts,v.byteLength=0,v.nalCount=0,v.duration=0,v.pts=l[0].pts,v.dts=l[0].dts,h=0;h<l.length;h++)(f=l[h]).keyFrame?(m.length&&(v.push(m),v.byteLength+=m.byteLength,v.nalCount+=m.nalCount,v.duration+=m.duration),(m=[f]).nalCount=f.length,m.byteLength=f.byteLength,m.pts=f.pts,m.dts=f.dts,m.duration=f.duration):(m.duration+=f.duration,m.nalCount+=f.length,m.byteLength+=f.byteLength,m.push(f));return v.length&&m.duration<=0&&(m.duration=v[v.length-1].duration),v.byteLength+=m.byteLength,v.nalCount+=m.nalCount,v.duration+=m.duration,v.push(m),v},bf=function(l){var h;return!l[0][0].keyFrame&&1<l.length&&(h=l.shift(),l.byteLength-=h.byteLength,l.nalCount-=h.nalCount,l[0][0].dts=h.dts,l[0][0].pts=h.pts,l[0][0].duration+=h.duration),l},Tf=function(l,h){var f,m,v,_,k,w,L,P=h||0,M=[];for(f=0;f<l.length;f++)for(_=l[f],m=0;m<_.length;m++)k=_[m],w=k,L=void 0,(L={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}).dataOffset=P,L.compositionTimeOffset=w.pts-w.dts,L.duration=w.duration,L.size=4*w.length,L.size+=w.byteLength,w.keyFrame&&(L.flags.dependsOn=2,L.flags.isNonSyncSample=0),P+=(v=L).size,M.push(v);return M},Sf=function(l){var h,f,m,v,_,k,w=0,L=l.byteLength,P=l.nalCount,M=new Uint8Array(L+4*P),N=new DataView(M.buffer);for(h=0;h<l.length;h++)for(v=l[h],f=0;f<v.length;f++)for(_=v[f],m=0;m<_.length;m++)k=_[m],N.setUint32(w,k.data.byteLength),w+=4,M.set(k.data,w),w+=k.data.byteLength;return M},we=[33,16,5,32,164,27],Za=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],at=function(l){for(var h=[];l--;)h.push(0);return h},kf={96e3:[we,[227,64],at(154),[56]],88200:[we,[231],at(170),[56]],64e3:[we,[248,192],at(240),[56]],48e3:[we,[255,192],at(268),[55,148,128],at(54),[112]],44100:[we,[255,192],at(268),[55,163,128],at(84),[112]],32e3:[we,[255,192],at(268),[55,234],at(226),[112]],24e3:[we,[255,192],at(268),[55,255,128],at(268),[111,112],at(126),[224]],16e3:[we,[255,192],at(268),[55,255,128],at(268),[111,255],at(269),[223,108],at(195),[1,192]],12e3:[Za,at(268),[3,127,248],at(268),[6,255,240],at(268),[13,255,224],at(268),[27,253,128],at(259),[56]],11025:[Za,at(268),[3,127,248],at(268),[6,255,240],at(268),[13,255,224],at(268),[27,255,192],at(268),[55,175,128],at(108),[112]],8e3:[Za,at(268),[3,121,16],at(47),[7]]},wf=(Ja=kf,Object.keys(Ja).reduce(function(l,h){return l[h]=new Uint8Array(Ja[h].reduce(function(f,m){return f.concat(m)},[])),l},{}));jc=function(l,h){return Rc(Nc(l,h))},Fc=function(l,h){return Mc(Bc(l),h)},Rc=function(l){return 9e4*l},Mc=function(l,h){return l*h},Bc=function(l){return l/9e4},Nc=function(l,h){return l/h};var Cf=jc,Ef=Fc,Af=function(l,h,f,m){var v,_,k,w,L=0,P=0,M=0;if(h.length&&(v=Cf(l.baseMediaDecodeTime,l.samplerate),_=Math.ceil(9e4/(l.samplerate/1024)),f&&m&&(L=v-Math.max(f,m),M=(P=Math.floor(L/_))*_),!(P<1||45e3<M))){for((k=wf[l.samplerate])||(k=h[0].data),w=0;w<P;w++)h.splice(w,0,{data:k});l.baseMediaDecodeTime-=Math.floor(Ef(M,l.samplerate))}},Lf=function(l,h,f){return h.minSegmentDts>=f?l:(h.minSegmentDts=1/0,l.filter(function(m){return m.dts>=f&&(h.minSegmentDts=Math.min(h.minSegmentDts,m.dts),h.minSegmentPts=h.minSegmentDts,!0)}))},Of=function(l){var h,f,m=[];for(h=0;h<l.length;h++)f=l[h],m.push({size:f.data.byteLength,duration:1024});return m},Pf=function(l){var h,f,m=0,v=new Uint8Array(function(_){var k,w=0;for(k=0;k<_.length;k++)w+=_[k].data.byteLength;return w}(l));for(h=0;h<l.length;h++)f=l[h],v.set(f.data,m),m+=f.data.byteLength;return v},Xi=function(l){delete l.minSegmentDts,delete l.maxSegmentDts,delete l.minSegmentPts,delete l.maxSegmentPts},Vc=function(l,h){var f,m=l.minSegmentDts;return h||(m-=l.timelineStartInfo.dts),f=l.timelineStartInfo.baseMediaDecodeTime,f+=m,f=Math.max(0,f),l.type==="audio"&&(f*=l.samplerate/9e4,f=Math.floor(f)),f},ts=function(l,h){typeof h.pts=="number"&&(l.timelineStartInfo.pts===void 0&&(l.timelineStartInfo.pts=h.pts),l.minSegmentPts===void 0?l.minSegmentPts=h.pts:l.minSegmentPts=Math.min(l.minSegmentPts,h.pts),l.maxSegmentPts===void 0?l.maxSegmentPts=h.pts:l.maxSegmentPts=Math.max(l.maxSegmentPts,h.pts)),typeof h.dts=="number"&&(l.timelineStartInfo.dts===void 0&&(l.timelineStartInfo.dts=h.dts),l.minSegmentDts===void 0?l.minSegmentDts=h.dts:l.minSegmentDts=Math.min(l.minSegmentDts,h.dts),l.maxSegmentDts===void 0?l.maxSegmentDts=h.dts:l.maxSegmentDts=Math.max(l.maxSegmentDts,h.dts))},Uf=function(l){for(var h=0,f={payloadType:-1,payloadSize:0},m=0,v=0;h<l.byteLength&&l[h]!==128;){for(;l[h]===255;)m+=255,h++;for(m+=l[h++];l[h]===255;)v+=255,h++;if(v+=l[h++],!f.payload&&m===4){f.payloadType=m,f.payloadSize=v,f.payload=l.subarray(h,h+v);break}h+=v,v=m=0}return f},If=function(l){return l.payload[0]!==181||(l.payload[1]<<8|l.payload[2])!=49||String.fromCharCode(l.payload[3],l.payload[4],l.payload[5],l.payload[6])!=="GA94"||l.payload[7]!==3?null:l.payload.subarray(8,l.payload.length-1)},xf=function(l,h){var f,m,v,_,k=[];if(!(64&h[0]))return k;for(m=31&h[0],f=0;f<m;f++)_={type:3&h[2+(v=3*f)],pts:l},4&h[v+2]&&(_.ccData=h[v+3]<<8|h[v+4],k.push(_));return k},Df=function(l){for(var h,f,m=l.byteLength,v=[],_=1;_<m-2;)l[_]===0&&l[_+1]===0&&l[_+2]===3?(v.push(_+2),_+=2):_++;if(v.length===0)return l;h=m-v.length,f=new Uint8Array(h);var k=0;for(_=0;_<h;k++,_++)k===v[0]&&(k++,v.shift()),f[_]=l[k];return f},Rf=4,Ne=function l(){l.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new dt(0,0),new dt(0,1),new dt(1,0),new dt(1,1)],this.reset(),this.ccStreams_.forEach(function(h){h.on("data",this.trigger.bind(this,"data")),h.on("done",this.trigger.bind(this,"done"))},this)};(Ne.prototype=new Ot).push=function(l){var h,f,m;if(l.nalUnitType==="sei_rbsp"&&(h=Uf(l.escapedRBSP)).payloadType===Rf&&(f=If(h)))if(l.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(l.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));m=xf(l.pts,f),this.captionPackets_=this.captionPackets_.concat(m),this.latestDts_!==l.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=l.dts}},Ne.prototype.flush=function(){this.captionPackets_.length?(this.captionPackets_.forEach(function(l,h){l.presortIndex=h}),this.captionPackets_.sort(function(l,h){return l.pts===h.pts?l.presortIndex-h.presortIndex:l.pts-h.pts}),this.captionPackets_.forEach(function(l){l.type<2&&this.dispatchCea608Packet(l)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(l){l.flush()},this)):this.ccStreams_.forEach(function(l){l.flush()},this)},Ne.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(l){l.reset()})},Ne.prototype.dispatchCea608Packet=function(l){this.setsChannel1Active(l)?this.activeCea608Channel_[l.type]=0:this.setsChannel2Active(l)&&(this.activeCea608Channel_[l.type]=1),this.activeCea608Channel_[l.type]!==null&&this.ccStreams_[(l.type<<1)+this.activeCea608Channel_[l.type]].push(l)},Ne.prototype.setsChannel1Active=function(l){return(30720&l.ccData)==4096},Ne.prototype.setsChannel2Active=function(l){return(30720&l.ccData)==6144};var Mf={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},zn=function(l){return l===null?"":(l=Mf[l]||l,String.fromCharCode(l))},Bf=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],je=function(){for(var l=[],h=15;h--;)l.push("");return l},dt=function l(h,f){l.prototype.init.call(this),this.field_=h||0,this.dataChannel_=f||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(m){var v,_,k,w,L;if((v=32639&m.ccData)!==this.lastControlCode_){if((61440&v)==4096?this.lastControlCode_=v:v!==this.PADDING_&&(this.lastControlCode_=null),k=v>>>8,w=255&v,v!==this.PADDING_)if(v===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(v===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(m.pts),this.flushDisplayed(m.pts),_=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=_,this.startPts_=m.pts;else if(v===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(m.pts);else if(v===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(m.pts);else if(v===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(m.pts);else if(v===this.CARRIAGE_RETURN_)this.clearFormatting(m.pts),this.flushDisplayed(m.pts),this.shiftRowsUp_(),this.startPts_=m.pts;else if(v===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(v===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(m.pts),this.displayed_=je();else if(v===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=je();else if(v===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(m.pts),this.displayed_=je()),this.mode_="paintOn",this.startPts_=m.pts;else if(this.isSpecialCharacter(k,w))L=zn((k=(3&k)<<8)|w),this[this.mode_](m.pts,L),this.column_++;else if(this.isExtCharacter(k,w))this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),L=zn((k=(3&k)<<8)|w),this[this.mode_](m.pts,L),this.column_++;else if(this.isMidRowCode(k,w))this.clearFormatting(m.pts),this[this.mode_](m.pts," "),this.column_++,(14&w)==14&&this.addFormatting(m.pts,["i"]),(1&w)==1&&this.addFormatting(m.pts,["u"]);else if(this.isOffsetControlCode(k,w))this.column_+=3&w;else if(this.isPAC(k,w)){var P=Bf.indexOf(7968&v);this.mode_==="rollUp"&&(P-this.rollUpRows_+1<0&&(P=this.rollUpRows_-1),this.setRollUp(m.pts,P)),P!==this.row_&&(this.clearFormatting(m.pts),this.row_=P),1&w&&this.formatting_.indexOf("u")===-1&&this.addFormatting(m.pts,["u"]),(16&v)==16&&(this.column_=4*((14&v)>>1)),this.isColorPAC(w)&&(14&w)==14&&this.addFormatting(m.pts,["i"])}else this.isNormalChar(k)&&(w===0&&(w=null),L=zn(k),L+=zn(w),this[this.mode_](m.pts,L),this.column_+=L.length)}else this.lastControlCode_=null}};dt.prototype=new Ot,dt.prototype.flushDisplayed=function(l){var h=this.displayed_.map(function(f){try{return f.trim()}catch(m){return""}}).join(`
|
|
`).replace(/^\n+|\n+$/g,"");h.length&&this.trigger("data",{startPts:this.startPts_,endPts:l,text:h,stream:this.name_})},dt.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=je(),this.nonDisplayed_=je(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},dt.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=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_},dt.prototype.isSpecialCharacter=function(l,h){return l===this.EXT_&&48<=h&&h<=63},dt.prototype.isExtCharacter=function(l,h){return(l===this.EXT_+1||l===this.EXT_+2)&&32<=h&&h<=63},dt.prototype.isMidRowCode=function(l,h){return l===this.EXT_&&32<=h&&h<=47},dt.prototype.isOffsetControlCode=function(l,h){return l===this.OFFSET_&&33<=h&&h<=35},dt.prototype.isPAC=function(l,h){return l>=this.BASE_&&l<this.BASE_+8&&64<=h&&h<=127},dt.prototype.isColorPAC=function(l){return 64<=l&&l<=79||96<=l&&l<=127},dt.prototype.isNormalChar=function(l){return 32<=l&&l<=127},dt.prototype.setRollUp=function(l,h){if(this.mode_!=="rollUp"&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(l),this.nonDisplayed_=je(),this.displayed_=je()),h!==void 0&&h!==this.row_)for(var f=0;f<this.rollUpRows_;f++)this.displayed_[h-f]=this.displayed_[this.row_-f],this.displayed_[this.row_-f]="";h===void 0&&(h=this.row_),this.topRow_=h-this.rollUpRows_+1},dt.prototype.addFormatting=function(l,h){this.formatting_=this.formatting_.concat(h);var f=h.reduce(function(m,v){return m+"<"+v+">"},"");this[this.mode_](l,f)},dt.prototype.clearFormatting=function(l){if(this.formatting_.length){var h=this.formatting_.reverse().reduce(function(f,m){return f+"</"+m+">"},"");this.formatting_=[],this[this.mode_](l,h)}},dt.prototype.popOn=function(l,h){var f=this.nonDisplayed_[this.row_];f+=h,this.nonDisplayed_[this.row_]=f},dt.prototype.rollUp=function(l,h){var f=this.displayed_[this.row_];f+=h,this.displayed_[this.row_]=f},dt.prototype.shiftRowsUp_=function(){var l;for(l=0;l<this.topRow_;l++)this.displayed_[l]="";for(l=this.row_+1;l<15;l++)this.displayed_[l]="";for(l=this.topRow_;l<this.row_;l++)this.displayed_[l]=this.displayed_[l+1];this.displayed_[this.row_]=""},dt.prototype.paintOn=function(l,h){var f=this.displayed_[this.row_];f+=h,this.displayed_[this.row_]=f};var es={CaptionStream:Ne,Cea608Stream:dt},jt={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Hc=function(l,h){var f=1;for(h<l&&(f=-1);4294967296<Math.abs(h-l);)l+=8589934592*f;return l},qc=function l(h){var f,m;l.prototype.init.call(this),this.type_=h,this.push=function(v){v.type===this.type_&&(m===void 0&&(m=v.dts),v.dts=Hc(v.dts,m),v.pts=Hc(v.pts,m),f=v.dts,this.trigger("data",v))},this.flush=function(){m=f,this.trigger("done")},this.discontinuity=function(){f=m=void 0}};qc.prototype=new Ot;var is,Nf=qc,zc=function(l,h,f){var m,v="";for(m=h;m<f;m++)v+="%"+("00"+l[m].toString(16)).slice(-2);return v},Wn=function(l,h,f){return decodeURIComponent(zc(l,h,f))},Gn=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Wc={TXXX:function(l){var h;if(l.data[0]===3){for(h=1;h<l.data.length;h++)if(l.data[h]===0){l.description=Wn(l.data,1,h),l.value=Wn(l.data,h+1,l.data.length).replace(/\0*$/,"");break}l.data=l.value}},WXXX:function(l){var h;if(l.data[0]===3){for(h=1;h<l.data.length;h++)if(l.data[h]===0){l.description=Wn(l.data,1,h),l.url=Wn(l.data,h+1,l.data.length);break}}},PRIV:function(l){var h,f;for(h=0;h<l.data.length;h++)if(l.data[h]===0){l.owner=(f=l.data,unescape(zc(f,0,h)));break}l.privateData=l.data.subarray(h+1),l.data=l.privateData}};(is=function(l){var h,f={debug:!(!l||!l.debug),descriptor:l&&l.descriptor},m=0,v=[],_=0;if(is.prototype.init.call(this),this.dispatchType=jt.METADATA_STREAM_TYPE.toString(16),f.descriptor)for(h=0;h<f.descriptor.length;h++)this.dispatchType+=("00"+f.descriptor[h].toString(16)).slice(-2);this.push=function(k){var w,L,P,M,N;if(k.type==="timed-metadata"){if(k.dataAlignmentIndicator&&(_=0,v.length=0),v.length===0&&(k.data.length<10||k.data[0]!=="I".charCodeAt(0)||k.data[1]!=="D".charCodeAt(0)||k.data[2]!=="3".charCodeAt(0)))f.debug;else if(v.push(k),_+=k.data.byteLength,v.length===1&&(m=Gn(k.data.subarray(6,10)),m+=10),!(_<m)){for(w={data:new Uint8Array(m),frames:[],pts:v[0].pts,dts:v[0].dts},N=0;N<m;)w.data.set(v[0].data.subarray(0,m-N),N),N+=v[0].data.byteLength,_-=v[0].data.byteLength,v.shift();L=10,64&w.data[5]&&(L+=4,L+=Gn(w.data.subarray(10,14)),m-=Gn(w.data.subarray(16,20)));do{if((P=Gn(w.data.subarray(L+4,L+8)))<1)return;if((M={id:String.fromCharCode(w.data[L],w.data[L+1],w.data[L+2],w.data[L+3]),data:w.data.subarray(L+10,L+P+10)}).key=M.id,Wc[M.id]&&(Wc[M.id](M),M.owner==="com.apple.streaming.transportStreamTimestamp")){var W=M.data,Y=(1&W[3])<<30|W[4]<<22|W[5]<<14|W[6]<<6|W[7]>>>2;Y*=4,Y+=3&W[7],M.timeStamp=Y,w.pts===void 0&&w.dts===void 0&&(w.pts=M.timeStamp,w.dts=M.timeStamp),this.trigger("timestamp",M)}w.frames.push(M),L+=10,L+=P}while(L<m);this.trigger("data",w)}}}}).prototype=new Ot;var ns,Xn,rs,jf=is,Ff=Nf;(ns=function(){var l=new Uint8Array(188),h=0;ns.prototype.init.call(this),this.push=function(f){var m,v=0,_=188;for(h?((m=new Uint8Array(f.byteLength+h)).set(l.subarray(0,h)),m.set(f,h),h=0):m=f;_<m.byteLength;)m[v]!==71||m[_]!==71?(v++,_++):(this.trigger("data",m.subarray(v,_)),v+=188,_+=188);v<m.byteLength&&(l.set(m.subarray(v),0),h=m.byteLength-v)},this.flush=function(){h===188&&l[0]===71&&(this.trigger("data",l),h=0),this.trigger("done")}}).prototype=new Ot,(Xn=function(){var l,h,f,m;Xn.prototype.init.call(this),(m=this).packetsWaitingForPmt=[],this.programMapTable=void 0,l=function(v,_){var k=0;_.payloadUnitStartIndicator&&(k+=v[k]+1),_.type==="pat"?h(v.subarray(k),_):f(v.subarray(k),_)},h=function(v,_){_.section_number=v[7],_.last_section_number=v[8],m.pmtPid=(31&v[10])<<8|v[11],_.pmtPid=m.pmtPid},f=function(v,_){var k,w;if(1&v[5]){for(m.programMapTable={video:null,audio:null,"timed-metadata":{}},k=3+((15&v[1])<<8|v[2])-4,w=12+((15&v[10])<<8|v[11]);w<k;){var L=v[w],P=(31&v[w+1])<<8|v[w+2];L===jt.H264_STREAM_TYPE&&m.programMapTable.video===null?m.programMapTable.video=P:L===jt.ADTS_STREAM_TYPE&&m.programMapTable.audio===null?m.programMapTable.audio=P:L===jt.METADATA_STREAM_TYPE&&(m.programMapTable["timed-metadata"][P]=L),w+=5+((15&v[w+3])<<8|v[w+4])}_.programMapTable=m.programMapTable}},this.push=function(v){var _={},k=4;if(_.payloadUnitStartIndicator=!!(64&v[1]),_.pid=31&v[1],_.pid<<=8,_.pid|=v[2],1<(48&v[3])>>>4&&(k+=v[k]+1),_.pid===0)_.type="pat",l(v.subarray(k),_),this.trigger("data",_);else if(_.pid===this.pmtPid)for(_.type="pmt",l(v.subarray(k),_),this.trigger("data",_);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([v,k,_]):this.processPes_(v,k,_)},this.processPes_=function(v,_,k){k.pid===this.programMapTable.video?k.streamType=jt.H264_STREAM_TYPE:k.pid===this.programMapTable.audio?k.streamType=jt.ADTS_STREAM_TYPE:k.streamType=this.programMapTable["timed-metadata"][k.pid],k.type="pes",k.data=v.subarray(_),this.trigger("data",k)}}).prototype=new Ot,Xn.STREAM_TYPES={h264:27,adts:15},(rs=function(){var l=this,h={data:[],size:0},f={data:[],size:0},m={data:[],size:0},v=function(_,k,w){var L,P,M=new Uint8Array(_.size),N={type:k},W=0,Y=0;if(_.data.length&&!(_.size<9)){for(N.trackId=_.data[0].pid,W=0;W<_.data.length;W++)P=_.data[W],M.set(P.data,Y),Y+=P.data.byteLength;var X,tt,Ft;X=M,(tt=N).packetLength=6+(X[4]<<8|X[5]),tt.dataAlignmentIndicator=(4&X[6])!=0,192&(Ft=X[7])&&(tt.pts=(14&X[9])<<27|(255&X[10])<<20|(254&X[11])<<12|(255&X[12])<<5|(254&X[13])>>>3,tt.pts*=4,tt.pts+=(6&X[13])>>>1,tt.dts=tt.pts,64&Ft&&(tt.dts=(14&X[14])<<27|(255&X[15])<<20|(254&X[16])<<12|(255&X[17])<<5|(254&X[18])>>>3,tt.dts*=4,tt.dts+=(6&X[18])>>>1)),tt.data=X.subarray(9+X[8]),L=k==="video"||N.packetLength<=_.size,(w||L)&&(_.size=0,_.data.length=0),L&&l.trigger("data",N)}};rs.prototype.init.call(this),this.push=function(_){({pat:function(){},pes:function(){var k,w;switch(_.streamType){case jt.H264_STREAM_TYPE:case jt.H264_STREAM_TYPE:k=h,w="video";break;case jt.ADTS_STREAM_TYPE:k=f,w="audio";break;case jt.METADATA_STREAM_TYPE:k=m,w="timed-metadata";break;default:return}_.payloadUnitStartIndicator&&v(k,w,!0),k.data.push(_),k.size+=_.data.byteLength},pmt:function(){var k={type:"metadata",tracks:[]},w=_.programMapTable;w.video!==null&&k.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+w.video,codec:"avc",type:"video"}),w.audio!==null&&k.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+w.audio,codec:"adts",type:"audio"}),l.trigger("data",k)}})[_.type]()},this.flush=function(){v(h,"video"),v(f,"audio"),v(m,"timed-metadata"),this.trigger("done")}}).prototype=new Ot;var Gc={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:ns,TransportParseStream:Xn,ElementaryStream:rs,TimestampRolloverStream:Ff,CaptionStream:es.CaptionStream,Cea608Stream:es.Cea608Stream,MetadataStream:jf};for(var as in jt)jt.hasOwnProperty(as)&&(Gc[as]=jt[as]);var ss,ie=Gc,Xc=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(ss=function(){var l;ss.prototype.init.call(this),this.push=function(h){var f,m,v,_,k,w,L=0,P=0;if(h.type==="audio")for(l?(_=l,(l=new Uint8Array(_.byteLength+h.data.byteLength)).set(_),l.set(h.data,_.byteLength)):l=h.data;L+5<l.length;)if(l[L]===255&&(246&l[L+1])==240){if(m=2*(1&~l[L+1]),f=(3&l[L+3])<<11|l[L+4]<<3|(224&l[L+5])>>5,w=9e4*(k=1024*(1+(3&l[L+6])))/Xc[(60&l[L+2])>>>2],v=L+f,l.byteLength<v)return;if(this.trigger("data",{pts:h.pts+P*w,dts:h.dts+P*w,sampleCount:k,audioobjecttype:1+(l[L+2]>>>6&3),channelcount:(1&l[L+2])<<2|(192&l[L+3])>>>6,samplerate:Xc[(60&l[L+2])>>>2],samplingfrequencyindex:(60&l[L+2])>>>2,samplesize:16,data:l.subarray(L+7+m,v)}),l.byteLength===v)return void(l=void 0);P++,l=l.subarray(v)}else L++},this.flush=function(){this.trigger("done")}}).prototype=new Ot;var os,Yn,Yc,$c=ss,Vf=function(l){var h=l.byteLength,f=0,m=0;this.length=function(){return 8*h},this.bitsAvailable=function(){return 8*h+m},this.loadWord=function(){var v=l.byteLength-h,_=new Uint8Array(4),k=Math.min(4,h);if(k===0)throw new Error("no bytes available");_.set(l.subarray(v,v+k)),f=new DataView(_.buffer).getUint32(0),m=8*k,h-=k},this.skipBits=function(v){var _;v<m||(v-=m,v-=8*(_=Math.floor(v/8)),h-=_,this.loadWord()),f<<=v,m-=v},this.readBits=function(v){var _=Math.min(m,v),k=f>>>32-_;return 0<(m-=_)?f<<=_:0<h&&this.loadWord(),0<(_=v-_)?k<<_|this.readBits(_):k},this.skipLeadingZeros=function(){var v;for(v=0;v<m;++v)if((f&2147483648>>>v)!=0)return f<<=v,m-=v,v;return this.loadWord(),v+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var v=this.skipLeadingZeros();return this.readBits(v+1)-1},this.readExpGolomb=function(){var v=this.readUnsignedExpGolomb();return 1&v?1+v>>>1:-1*(v>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Yn=function(){var l,h,f=0;Yn.prototype.init.call(this),this.push=function(m){var v;for(h=h?((v=new Uint8Array(h.byteLength+m.data.byteLength)).set(h),v.set(m.data,h.byteLength),v):m.data;f<h.byteLength-3;f++)if(h[f+2]===1){l=f+5;break}for(;l<h.byteLength;)switch(h[l]){case 0:if(h[l-1]!==0){l+=2;break}if(h[l-2]!==0){l++;break}for(f+3!==l-2&&this.trigger("data",h.subarray(f+3,l-2));h[++l]!==1&&l<h.length;);f=l-2,l+=3;break;case 1:if(h[l-1]!==0||h[l-2]!==0){l+=3;break}this.trigger("data",h.subarray(f+3,l-2)),f=l-2,l+=3;break;default:l+=3}h=h.subarray(f),l-=f,f=0},this.flush=function(){h&&3<h.byteLength&&this.trigger("data",h.subarray(f+3)),h=null,f=0,this.trigger("done")}}).prototype=new Ot,Yc={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(os=function(){var l,h,f,m,v,_,k,w=new Yn;os.prototype.init.call(this),(l=this).push=function(L){L.type==="video"&&(h=L.trackId,f=L.pts,m=L.dts,w.push(L))},w.on("data",function(L){var P={trackId:h,pts:f,dts:m,data:L};switch(31&L[0]){case 5:P.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:P.nalUnitType="sei_rbsp",P.escapedRBSP=v(L.subarray(1));break;case 7:P.nalUnitType="seq_parameter_set_rbsp",P.escapedRBSP=v(L.subarray(1)),P.config=_(P.escapedRBSP);break;case 8:P.nalUnitType="pic_parameter_set_rbsp";break;case 9:P.nalUnitType="access_unit_delimiter_rbsp"}l.trigger("data",P)}),w.on("done",function(){l.trigger("done")}),this.flush=function(){w.flush()},k=function(L,P){var M,N=8,W=8;for(M=0;M<L;M++)W!==0&&(W=(N+P.readExpGolomb()+256)%256),N=W===0?N:W},v=function(L){for(var P,M,N=L.byteLength,W=[],Y=1;Y<N-2;)L[Y]===0&&L[Y+1]===0&&L[Y+2]===3?(W.push(Y+2),Y+=2):Y++;if(W.length===0)return L;P=N-W.length,M=new Uint8Array(P);var X=0;for(Y=0;Y<P;X++,Y++)X===W[0]&&(X++,W.shift()),M[Y]=L[X];return M},_=function(L){var P,M,N,W,Y,X,tt,Ft,de,pe,fe,pt,me,Ki=0,ne=0,Fe=0,kt=0,ge=1;if(M=(P=new Vf(L)).readUnsignedByte(),W=P.readUnsignedByte(),N=P.readUnsignedByte(),P.skipUnsignedExpGolomb(),Yc[M]&&((Y=P.readUnsignedExpGolomb())===3&&P.skipBits(1),P.skipUnsignedExpGolomb(),P.skipUnsignedExpGolomb(),P.skipBits(1),P.readBoolean()))for(fe=Y!==3?8:12,me=0;me<fe;me++)P.readBoolean()&&k(me<6?16:64,P);if(P.skipUnsignedExpGolomb(),(X=P.readUnsignedExpGolomb())===0)P.readUnsignedExpGolomb();else if(X===1)for(P.skipBits(1),P.skipExpGolomb(),P.skipExpGolomb(),tt=P.readUnsignedExpGolomb(),me=0;me<tt;me++)P.skipExpGolomb();if(P.skipUnsignedExpGolomb(),P.skipBits(1),Ft=P.readUnsignedExpGolomb(),de=P.readUnsignedExpGolomb(),(pe=P.readBits(1))===0&&P.skipBits(1),P.skipBits(1),P.readBoolean()&&(Ki=P.readUnsignedExpGolomb(),ne=P.readUnsignedExpGolomb(),Fe=P.readUnsignedExpGolomb(),kt=P.readUnsignedExpGolomb()),P.readBoolean()&&P.readBoolean()){switch(P.readUnsignedByte()){case 1:pt=[1,1];break;case 2:pt=[12,11];break;case 3:pt=[10,11];break;case 4:pt=[16,11];break;case 5:pt=[40,33];break;case 6:pt=[24,11];break;case 7:pt=[20,11];break;case 8:pt=[32,11];break;case 9:pt=[80,33];break;case 10:pt=[18,11];break;case 11:pt=[15,11];break;case 12:pt=[64,33];break;case 13:pt=[160,99];break;case 14:pt=[4,3];break;case 15:pt=[3,2];break;case 16:pt=[2,1];break;case 255:pt=[P.readUnsignedByte()<<8|P.readUnsignedByte(),P.readUnsignedByte()<<8|P.readUnsignedByte()]}pt&&(ge=pt[0]/pt[1])}return{profileIdc:M,levelIdc:N,profileCompatibility:W,width:Math.ceil((16*(Ft+1)-2*Ki-2*ne)*ge),height:(2-pe)*(de+1)*16-2*Fe-2*kt}}}).prototype=new Ot;var us,Hf={H264Stream:os,NalByteStream:Yn},qf=function(l){return l[0]==="I".charCodeAt(0)&&l[1]==="D".charCodeAt(0)&&l[2]==="3".charCodeAt(0)},zf=function(l,h){var f=l[h+6]<<21|l[h+7]<<14|l[h+8]<<7|l[h+9];return(16&l[h+5])>>4?f+20:f+10},Wf=function(l,h){var f=(224&l[h+5])>>5,m=l[h+4]<<3;return 6144&l[h+3]|m|f};(us=function(){var l=new Uint8Array,h=0;us.prototype.init.call(this),this.setTimestamp=function(f){h=f},this.push=function(f){var m,v,_,k,w=0,L=0;for(l.length?(k=l.length,(l=new Uint8Array(f.byteLength+k)).set(l.subarray(0,k)),l.set(f,k)):l=f;3<=l.length-L;)if(l[L]!=="I".charCodeAt(0)||l[L+1]!=="D".charCodeAt(0)||l[L+2]!=="3".charCodeAt(0))if((255&l[L])!=255||(240&l[L+1])!=240)L++;else{if(l.length-L<7||L+(w=Wf(l,L))>l.length)break;_={type:"audio",data:l.subarray(L,L+w),pts:h,dts:h},this.trigger("data",_),L+=w}else{if(l.length-L<10||L+(w=zf(l,L))>l.length)break;v={type:"timed-metadata",data:l.subarray(L,L+w)},this.trigger("data",v),L+=w}m=l.length-L,l=0<m?l.subarray(L):new Uint8Array}}).prototype=new Ot;var $n,Yi,ls,$i,Gf=us,Xf=Hf.H264Stream,Yf=qf,cs=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],hs=["width","height","profileIdc","levelIdc","profileCompatibility"],Kc=function(l,h){var f;if(l.length!==h.length)return!1;for(f=0;f<l.length;f++)if(l[f]!==h[f])return!1;return!0};(Yi=function(l,h){var f=[],m=0,v=0,_=0,k=1/0;h=h||{},Yi.prototype.init.call(this),this.push=function(w){ts(l,w),l&&cs.forEach(function(L){l[L]=w[L]}),f.push(w)},this.setEarliestDts=function(w){v=w-l.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(w){k=w},this.setAudioAppendStart=function(w){_=w},this.flush=function(){var w,L,P,M;f.length!==0&&(w=Lf(f,l,v),l.baseMediaDecodeTime=Vc(l,h.keepOriginalTimestamps),Af(l,w,_,k),l.samples=Of(w),P=li.mdat(Pf(w)),f=[],L=li.moof(m,[l]),M=new Uint8Array(L.byteLength+P.byteLength),m++,M.set(L),M.set(P,L.byteLength),Xi(l),this.trigger("data",{track:l,boxes:M})),this.trigger("done","AudioSegmentStream")}}).prototype=new Ot,($n=function(l,h){var f,m,v=0,_=[],k=[];h=h||{},$n.prototype.init.call(this),delete l.minPTS,this.gopCache_=[],this.push=function(w){ts(l,w),w.nalUnitType!=="seq_parameter_set_rbsp"||f||(f=w.config,l.sps=[w.data],hs.forEach(function(L){l[L]=f[L]},this)),w.nalUnitType!=="pic_parameter_set_rbsp"||m||(m=w.data,l.pps=[w.data]),_.push(w)},this.flush=function(){for(var w,L,P,M,N,W;_.length&&_[0].nalUnitType!=="access_unit_delimiter_rbsp";)_.shift();if(_.length===0)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(w=vf(_),(P=_f(w))[0][0].keyFrame||((L=this.getGopForFusion_(_[0],l))?(P.unshift(L),P.byteLength+=L.byteLength,P.nalCount+=L.nalCount,P.pts=L.pts,P.dts=L.dts,P.duration+=L.duration):P=bf(P)),k.length){var Y;if(!(Y=h.alignGopsAtEnd?this.alignGopsAtEnd_(P):this.alignGopsAtStart_(P)))return this.gopCache_.unshift({gop:P.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),_=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");Xi(l),P=Y}ts(l,P),l.samples=Tf(P),N=li.mdat(Sf(P)),l.baseMediaDecodeTime=Vc(l,h.keepOriginalTimestamps),this.trigger("processedGopsInfo",P.map(function(X){return{pts:X.pts,dts:X.dts,byteLength:X.byteLength}})),this.gopCache_.unshift({gop:P.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),_=[],this.trigger("baseMediaDecodeTime",l.baseMediaDecodeTime),this.trigger("timelineStartInfo",l.timelineStartInfo),M=li.moof(v,[l]),W=new Uint8Array(M.byteLength+N.byteLength),v++,W.set(M),W.set(N,M.byteLength),this.trigger("data",{track:l,boxes:W}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){Xi(l),m=f=void 0},this.getGopForFusion_=function(w){var L,P,M,N,W,Y=1/0;for(W=0;W<this.gopCache_.length;W++)M=(N=this.gopCache_[W]).gop,l.pps&&Kc(l.pps[0],N.pps[0])&&l.sps&&Kc(l.sps[0],N.sps[0])&&(M.dts<l.timelineStartInfo.dts||-1e4<=(L=w.dts-M.dts-M.duration)&&L<=45e3&&(!P||L<Y)&&(P=N,Y=L));return P?P.gop:null},this.alignGopsAtStart_=function(w){var L,P,M,N,W,Y,X,tt;for(W=w.byteLength,Y=w.nalCount,X=w.duration,L=P=0;L<k.length&&P<w.length&&(M=k[L],N=w[P],M.pts!==N.pts);)N.pts>M.pts?L++:(P++,W-=N.byteLength,Y-=N.nalCount,X-=N.duration);return P===0?w:P===w.length?null:((tt=w.slice(P)).byteLength=W,tt.duration=X,tt.nalCount=Y,tt.pts=tt[0].pts,tt.dts=tt[0].dts,tt)},this.alignGopsAtEnd_=function(w){var L,P,M,N,W,Y,X;for(L=k.length-1,P=w.length-1,W=null,Y=!1;0<=L&&0<=P;){if(M=k[L],N=w[P],M.pts===N.pts){Y=!0;break}M.pts>N.pts?L--:(L===k.length-1&&(W=P),P--)}if(!Y&&W===null)return null;if((X=Y?P:W)===0)return w;var tt=w.slice(X),Ft=tt.reduce(function(de,pe){return de.byteLength+=pe.byteLength,de.duration+=pe.duration,de.nalCount+=pe.nalCount,de},{byteLength:0,duration:0,nalCount:0});return tt.byteLength=Ft.byteLength,tt.duration=Ft.duration,tt.nalCount=Ft.nalCount,tt.pts=tt[0].pts,tt.dts=tt[0].dts,tt},this.alignGopsWith=function(w){k=w}}).prototype=new Ot,($i=function(l,h){this.numberOfTracks=0,this.metadataStream=h,typeof(l=l||{}).remux!="undefined"?this.remuxTracks=!!l.remux:this.remuxTracks=!0,typeof l.keepOriginalTimestamps=="boolean"&&(this.keepOriginalTimestamps=l.keepOriginalTimestamps),this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,$i.prototype.init.call(this),this.push=function(f){return f.text?this.pendingCaptions.push(f):f.frames?this.pendingMetadata.push(f):(this.pendingTracks.push(f.track),this.pendingBoxes.push(f.boxes),this.pendingBytes+=f.boxes.byteLength,f.track.type==="video"&&(this.videoTrack=f.track),void(f.track.type==="audio"&&(this.audioTrack=f.track)))}}).prototype=new Ot,$i.prototype.flush=function(l){var h,f,m,v,_=0,k={captions:[],captionStreams:{},metadata:[],info:{}},w=0;if(this.pendingTracks.length<this.numberOfTracks){if(l!=="VideoSegmentStream"&&l!=="AudioSegmentStream"||this.remuxTracks)return;if(this.pendingTracks.length===0)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(w=this.videoTrack.timelineStartInfo.pts,hs.forEach(function(L){k.info[L]=this.videoTrack[L]},this)):this.audioTrack&&(w=this.audioTrack.timelineStartInfo.pts,cs.forEach(function(L){k.info[L]=this.audioTrack[L]},this)),this.pendingTracks.length===1?k.type=this.pendingTracks[0].type:k.type="combined",this.emittedTracks+=this.pendingTracks.length,m=li.initSegment(this.pendingTracks),k.initSegment=new Uint8Array(m.byteLength),k.initSegment.set(m),k.data=new Uint8Array(this.pendingBytes),v=0;v<this.pendingBoxes.length;v++)k.data.set(this.pendingBoxes[v],_),_+=this.pendingBoxes[v].byteLength;for(v=0;v<this.pendingCaptions.length;v++)(h=this.pendingCaptions[v]).startTime=h.startPts,this.keepOriginalTimestamps||(h.startTime-=w),h.startTime/=9e4,h.endTime=h.endPts,this.keepOriginalTimestamps||(h.endTime-=w),h.endTime/=9e4,k.captionStreams[h.stream]=!0,k.captions.push(h);for(v=0;v<this.pendingMetadata.length;v++)(f=this.pendingMetadata[v]).cueTime=f.pts,this.keepOriginalTimestamps||(f.cueTime-=w),f.cueTime/=9e4,k.metadata.push(f);k.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",k),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(ls=function(l){var h,f,m=this,v=!0;ls.prototype.init.call(this),l=l||{},this.baseMediaDecodeTime=l.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var _={};(this.transmuxPipeline_=_).type="aac",_.metadataStream=new ie.MetadataStream,_.aacStream=new Gf,_.audioTimestampRolloverStream=new ie.TimestampRolloverStream("audio"),_.timedMetadataTimestampRolloverStream=new ie.TimestampRolloverStream("timed-metadata"),_.adtsStream=new $c,_.coalesceStream=new $i(l,_.metadataStream),_.headOfPipeline=_.aacStream,_.aacStream.pipe(_.audioTimestampRolloverStream).pipe(_.adtsStream),_.aacStream.pipe(_.timedMetadataTimestampRolloverStream).pipe(_.metadataStream).pipe(_.coalesceStream),_.metadataStream.on("timestamp",function(k){_.aacStream.setTimestamp(k.timeStamp)}),_.aacStream.on("data",function(k){k.type!=="timed-metadata"||_.audioSegmentStream||(f=f||{timelineStartInfo:{baseMediaDecodeTime:m.baseMediaDecodeTime},codec:"adts",type:"audio"},_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new Yi(f,l),_.adtsStream.pipe(_.audioSegmentStream).pipe(_.coalesceStream))}),_.coalesceStream.on("data",this.trigger.bind(this,"data")),_.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var _={};(this.transmuxPipeline_=_).type="ts",_.metadataStream=new ie.MetadataStream,_.packetStream=new ie.TransportPacketStream,_.parseStream=new ie.TransportParseStream,_.elementaryStream=new ie.ElementaryStream,_.videoTimestampRolloverStream=new ie.TimestampRolloverStream("video"),_.audioTimestampRolloverStream=new ie.TimestampRolloverStream("audio"),_.timedMetadataTimestampRolloverStream=new ie.TimestampRolloverStream("timed-metadata"),_.adtsStream=new $c,_.h264Stream=new Xf,_.captionStream=new ie.CaptionStream,_.coalesceStream=new $i(l,_.metadataStream),_.headOfPipeline=_.packetStream,_.packetStream.pipe(_.parseStream).pipe(_.elementaryStream),_.elementaryStream.pipe(_.videoTimestampRolloverStream).pipe(_.h264Stream),_.elementaryStream.pipe(_.audioTimestampRolloverStream).pipe(_.adtsStream),_.elementaryStream.pipe(_.timedMetadataTimestampRolloverStream).pipe(_.metadataStream).pipe(_.coalesceStream),_.h264Stream.pipe(_.captionStream).pipe(_.coalesceStream),_.elementaryStream.on("data",function(k){var w;if(k.type==="metadata"){for(w=k.tracks.length;w--;)h||k.tracks[w].type!=="video"?f||k.tracks[w].type!=="audio"||((f=k.tracks[w]).timelineStartInfo.baseMediaDecodeTime=m.baseMediaDecodeTime):(h=k.tracks[w]).timelineStartInfo.baseMediaDecodeTime=m.baseMediaDecodeTime;h&&!_.videoSegmentStream&&(_.coalesceStream.numberOfTracks++,_.videoSegmentStream=new $n(h,l),_.videoSegmentStream.on("timelineStartInfo",function(L){f&&(f.timelineStartInfo=L,_.audioSegmentStream.setEarliestDts(L.dts))}),_.videoSegmentStream.on("processedGopsInfo",m.trigger.bind(m,"gopInfo")),_.videoSegmentStream.on("baseMediaDecodeTime",function(L){f&&_.audioSegmentStream.setVideoBaseMediaDecodeTime(L)}),_.h264Stream.pipe(_.videoSegmentStream).pipe(_.coalesceStream)),f&&!_.audioSegmentStream&&(_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new Yi(f,l),_.adtsStream.pipe(_.audioSegmentStream).pipe(_.coalesceStream))}}),_.coalesceStream.on("data",this.trigger.bind(this,"data")),_.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(_){var k=this.transmuxPipeline_;l.keepOriginalTimestamps||(this.baseMediaDecodeTime=_),f&&(f.timelineStartInfo.dts=void 0,f.timelineStartInfo.pts=void 0,Xi(f),l.keepOriginalTimestamps||(f.timelineStartInfo.baseMediaDecodeTime=_),k.audioTimestampRolloverStream&&k.audioTimestampRolloverStream.discontinuity()),h&&(k.videoSegmentStream&&(k.videoSegmentStream.gopCache_=[],k.videoTimestampRolloverStream.discontinuity()),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,Xi(h),k.captionStream.reset(),l.keepOriginalTimestamps||(h.timelineStartInfo.baseMediaDecodeTime=_)),k.timedMetadataTimestampRolloverStream&&k.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(_){f&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(_)},this.alignGopsWith=function(_){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(_)},this.push=function(_){if(v){var k=Yf(_);k&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():k||this.transmuxPipeline_.type==="ts"||this.setupTsPipeline(),v=!1}this.transmuxPipeline_.headOfPipeline.push(_)},this.flush=function(){v=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new Ot;var xt,Qc,ds={Transmuxer:ls,VideoSegmentStream:$n,AudioSegmentStream:Yi,AUDIO_PROPERTIES:cs,VIDEO_PROPERTIES:hs},Kn=Be.parseType,Xt=function(l){return new Date(1e3*l-20828448e5)},Jc=function(l){return{isLeading:(12&l[0])>>>2,dependsOn:3&l[0],isDependedOn:(192&l[1])>>>6,hasRedundancy:(48&l[1])>>>4,paddingValue:(14&l[1])>>>1,isNonSyncSample:1&l[1],degradationPriority:l[2]<<8|l[3]}},hi={avc1:function(l){var h=new DataView(l.buffer,l.byteOffset,l.byteLength);return{dataReferenceIndex:h.getUint16(6),width:h.getUint16(24),height:h.getUint16(26),horizresolution:h.getUint16(28)+h.getUint16(30)/16,vertresolution:h.getUint16(32)+h.getUint16(34)/16,frameCount:h.getUint16(40),depth:h.getUint16(74),config:xt(l.subarray(78,l.byteLength))}},avcC:function(l){var h,f,m,v,_=new DataView(l.buffer,l.byteOffset,l.byteLength),k={configurationVersion:l[0],avcProfileIndication:l[1],profileCompatibility:l[2],avcLevelIndication:l[3],lengthSizeMinusOne:3&l[4],sps:[],pps:[]},w=31&l[5];for(m=6,v=0;v<w;v++)f=_.getUint16(m),m+=2,k.sps.push(new Uint8Array(l.subarray(m,m+f))),m+=f;for(h=l[m],m++,v=0;v<h;v++)f=_.getUint16(m),m+=2,k.pps.push(new Uint8Array(l.subarray(m,m+f))),m+=f;return k},btrt:function(l){var h=new DataView(l.buffer,l.byteOffset,l.byteLength);return{bufferSizeDB:h.getUint32(0),maxBitrate:h.getUint32(4),avgBitrate:h.getUint32(8)}},esds:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),esId:l[6]<<8|l[7],streamPriority:31&l[8],decoderConfig:{objectProfileIndication:l[11],streamType:l[12]>>>2&63,bufferSize:l[13]<<16|l[14]<<8|l[15],maxBitrate:l[16]<<24|l[17]<<16|l[18]<<8|l[19],avgBitrate:l[20]<<24|l[21]<<16|l[22]<<8|l[23],decoderConfigDescriptor:{tag:l[24],length:l[25],audioObjectType:l[26]>>>3&31,samplingFrequencyIndex:(7&l[26])<<1|l[27]>>>7&1,channelConfiguration:l[27]>>>3&15}}}},ftyp:function(l){for(var h=new DataView(l.buffer,l.byteOffset,l.byteLength),f={majorBrand:Kn(l.subarray(0,4)),minorVersion:h.getUint32(4),compatibleBrands:[]},m=8;m<l.byteLength;)f.compatibleBrands.push(Kn(l.subarray(m,m+4))),m+=4;return f},dinf:function(l){return{boxes:xt(l)}},dref:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),dataReferences:xt(l.subarray(8))}},hdlr:function(l){var h={version:new DataView(l.buffer,l.byteOffset,l.byteLength).getUint8(0),flags:new Uint8Array(l.subarray(1,4)),handlerType:Kn(l.subarray(8,12)),name:""},f=8;for(f=24;f<l.byteLength;f++){if(l[f]===0){f++;break}h.name+=String.fromCharCode(l[f])}return h.name=decodeURIComponent(escape(h.name)),h},mdat:function(l){return{byteLength:l.byteLength,nals:function(h){var f,m,v=new DataView(h.buffer,h.byteOffset,h.byteLength),_=[];for(f=0;f+4<h.length;f+=m)if(m=v.getUint32(f),f+=4,m<=0)_.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&h[f]){case 1:_.push("slice_layer_without_partitioning_rbsp");break;case 5:_.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:_.push("sei_rbsp");break;case 7:_.push("seq_parameter_set_rbsp");break;case 8:_.push("pic_parameter_set_rbsp");break;case 9:_.push("access_unit_delimiter_rbsp");break;default:_.push("UNKNOWN NAL - "+h[f]&31)}return _}(l)}},mdhd:function(l){var h,f=new DataView(l.buffer,l.byteOffset,l.byteLength),m=4,v={version:f.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),language:""};return v.version===1?(m+=4,v.creationTime=Xt(f.getUint32(m)),m+=8,v.modificationTime=Xt(f.getUint32(m)),m+=4,v.timescale=f.getUint32(m),m+=8):(v.creationTime=Xt(f.getUint32(m)),m+=4,v.modificationTime=Xt(f.getUint32(m)),m+=4,v.timescale=f.getUint32(m),m+=4),v.duration=f.getUint32(m),m+=4,h=f.getUint16(m),v.language+=String.fromCharCode(96+(h>>10)),v.language+=String.fromCharCode(96+((992&h)>>5)),v.language+=String.fromCharCode(96+(31&h)),v},mdia:function(l){return{boxes:xt(l)}},mfhd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),sequenceNumber:l[4]<<24|l[5]<<16|l[6]<<8|l[7]}},minf:function(l){return{boxes:xt(l)}},mp4a:function(l){var h=new DataView(l.buffer,l.byteOffset,l.byteLength),f={dataReferenceIndex:h.getUint16(6),channelcount:h.getUint16(16),samplesize:h.getUint16(18),samplerate:h.getUint16(24)+h.getUint16(26)/65536};return 28<l.byteLength&&(f.streamDescriptor=xt(l.subarray(28))[0]),f},moof:function(l){return{boxes:xt(l)}},moov:function(l){return{boxes:xt(l)}},mvex:function(l){return{boxes:xt(l)}},mvhd:function(l){var h=new DataView(l.buffer,l.byteOffset,l.byteLength),f=4,m={version:h.getUint8(0),flags:new Uint8Array(l.subarray(1,4))};return m.version===1?(f+=4,m.creationTime=Xt(h.getUint32(f)),f+=8,m.modificationTime=Xt(h.getUint32(f)),f+=4,m.timescale=h.getUint32(f),f+=8):(m.creationTime=Xt(h.getUint32(f)),f+=4,m.modificationTime=Xt(h.getUint32(f)),f+=4,m.timescale=h.getUint32(f),f+=4),m.duration=h.getUint32(f),f+=4,m.rate=h.getUint16(f)+h.getUint16(f+2)/16,f+=4,m.volume=h.getUint8(f)+h.getUint8(f+1)/8,f+=2,f+=2,f+=8,m.matrix=new Uint32Array(l.subarray(f,f+36)),f+=36,f+=24,m.nextTrackId=h.getUint32(f),m},pdin:function(l){var h=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:h.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),rate:h.getUint32(4),initialDelay:h.getUint32(8)}},sdtp:function(l){var h,f={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]};for(h=4;h<l.byteLength;h++)f.samples.push({dependsOn:(48&l[h])>>4,isDependedOn:(12&l[h])>>2,hasRedundancy:3&l[h]});return f},sidx:function(l){var h,f=new DataView(l.buffer,l.byteOffset,l.byteLength),m={version:l[0],flags:new Uint8Array(l.subarray(1,4)),references:[],referenceId:f.getUint32(4),timescale:f.getUint32(8),earliestPresentationTime:f.getUint32(12),firstOffset:f.getUint32(16)},v=f.getUint16(22);for(h=24;v;h+=12,v--)m.references.push({referenceType:(128&l[h])>>>7,referencedSize:2147483647&f.getUint32(h),subsegmentDuration:f.getUint32(h+4),startsWithSap:!!(128&l[h+8]),sapType:(112&l[h+8])>>>4,sapDeltaTime:268435455&f.getUint32(h+8)});return m},smhd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),balance:l[4]+l[5]/256}},stbl:function(l){return{boxes:xt(l)}},stco:function(l){var h,f=new DataView(l.buffer,l.byteOffset,l.byteLength),m={version:l[0],flags:new Uint8Array(l.subarray(1,4)),chunkOffsets:[]},v=f.getUint32(4);for(h=8;v;h+=4,v--)m.chunkOffsets.push(f.getUint32(h));return m},stsc:function(l){var h,f=new DataView(l.buffer,l.byteOffset,l.byteLength),m=f.getUint32(4),v={version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleToChunks:[]};for(h=8;m;h+=12,m--)v.sampleToChunks.push({firstChunk:f.getUint32(h),samplesPerChunk:f.getUint32(h+4),sampleDescriptionIndex:f.getUint32(h+8)});return v},stsd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleDescriptions:xt(l.subarray(8))}},stsz:function(l){var h,f=new DataView(l.buffer,l.byteOffset,l.byteLength),m={version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleSize:f.getUint32(4),entries:[]};for(h=12;h<l.byteLength;h+=4)m.entries.push(f.getUint32(h));return m},stts:function(l){var h,f=new DataView(l.buffer,l.byteOffset,l.byteLength),m={version:l[0],flags:new Uint8Array(l.subarray(1,4)),timeToSamples:[]},v=f.getUint32(4);for(h=8;v;h+=8,v--)m.timeToSamples.push({sampleCount:f.getUint32(h),sampleDelta:f.getUint32(h+4)});return m},styp:function(l){return hi.ftyp(l)},tfdt:function(l){var h={version:l[0],flags:new Uint8Array(l.subarray(1,4)),baseMediaDecodeTime:l[4]<<24|l[5]<<16|l[6]<<8|l[7]};return h.version===1&&(h.baseMediaDecodeTime*=Math.pow(2,32),h.baseMediaDecodeTime+=l[8]<<24|l[9]<<16|l[10]<<8|l[11]),h},tfhd:function(l){var h,f=new DataView(l.buffer,l.byteOffset,l.byteLength),m={version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:f.getUint32(4)},v=1&m.flags[2],_=2&m.flags[2],k=8&m.flags[2],w=16&m.flags[2],L=32&m.flags[2],P=65536&m.flags[0],M=131072&m.flags[0];return h=8,v&&(h+=4,m.baseDataOffset=f.getUint32(12),h+=4),_&&(m.sampleDescriptionIndex=f.getUint32(h),h+=4),k&&(m.defaultSampleDuration=f.getUint32(h),h+=4),w&&(m.defaultSampleSize=f.getUint32(h),h+=4),L&&(m.defaultSampleFlags=f.getUint32(h)),P&&(m.durationIsEmpty=!0),!v&&M&&(m.baseDataOffsetIsMoof=!0),m},tkhd:function(l){var h=new DataView(l.buffer,l.byteOffset,l.byteLength),f=4,m={version:h.getUint8(0),flags:new Uint8Array(l.subarray(1,4))};return m.version===1?(f+=4,m.creationTime=Xt(h.getUint32(f)),f+=8,m.modificationTime=Xt(h.getUint32(f)),f+=4,m.trackId=h.getUint32(f),f+=4,f+=8):(m.creationTime=Xt(h.getUint32(f)),f+=4,m.modificationTime=Xt(h.getUint32(f)),f+=4,m.trackId=h.getUint32(f),f+=4,f+=4),m.duration=h.getUint32(f),f+=4,f+=8,m.layer=h.getUint16(f),f+=2,m.alternateGroup=h.getUint16(f),f+=2,m.volume=h.getUint8(f)+h.getUint8(f+1)/8,f+=2,f+=2,m.matrix=new Uint32Array(l.subarray(f,f+36)),f+=36,m.width=h.getUint16(f)+h.getUint16(f+2)/16,f+=4,m.height=h.getUint16(f)+h.getUint16(f+2)/16,m},traf:function(l){return{boxes:xt(l)}},trak:function(l){return{boxes:xt(l)}},trex:function(l){var h=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:h.getUint32(4),defaultSampleDescriptionIndex:h.getUint32(8),defaultSampleDuration:h.getUint32(12),defaultSampleSize:h.getUint32(16),sampleDependsOn:3&l[20],sampleIsDependedOn:(192&l[21])>>6,sampleHasRedundancy:(48&l[21])>>4,samplePaddingValue:(14&l[21])>>1,sampleIsDifferenceSample:!!(1&l[21]),sampleDegradationPriority:h.getUint16(22)}},trun:function(l){var h,f={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]},m=new DataView(l.buffer,l.byteOffset,l.byteLength),v=1&f.flags[2],_=4&f.flags[2],k=1&f.flags[1],w=2&f.flags[1],L=4&f.flags[1],P=8&f.flags[1],M=m.getUint32(4),N=8;for(v&&(f.dataOffset=m.getInt32(N),N+=4),_&&M&&(h={flags:Jc(l.subarray(N,N+4))},N+=4,k&&(h.duration=m.getUint32(N),N+=4),w&&(h.size=m.getUint32(N),N+=4),P&&(h.compositionTimeOffset=m.getUint32(N),N+=4),f.samples.push(h),M--);M--;)h={},k&&(h.duration=m.getUint32(N),N+=4),w&&(h.size=m.getUint32(N),N+=4),L&&(h.flags=Jc(l.subarray(N,N+4)),N+=4),P&&(h.compositionTimeOffset=m.getUint32(N),N+=4),f.samples.push(h);return f},"url ":function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4))}},vmhd:function(l){var h=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),graphicsmode:h.getUint16(4),opcolor:new Uint16Array([h.getUint16(6),h.getUint16(8),h.getUint16(10)])}}},ps={inspect:xt=function(l){for(var h,f,m,v,_,k=0,w=[],L=new ArrayBuffer(l.length),P=new Uint8Array(L),M=0;M<l.length;++M)P[M]=l[M];for(h=new DataView(L);k<l.byteLength;)f=h.getUint32(k),m=Kn(l.subarray(k+4,k+8)),v=1<f?k+f:l.byteLength,(_=(hi[m]||function(N){return{data:N}})(l.subarray(k+8,v))).size=f,_.type=m,w.push(_),k=v;return w},textify:Qc=function(l,h){var f;return h=h||0,f=new Array(2*h+1).join(" "),l.map(function(m,v){return f+m.type+`
|
|
`+Object.keys(m).filter(function(_){return _!=="type"&&_!=="boxes"}).map(function(_){var k=f+" "+_+": ",w=m[_];if(w instanceof Uint8Array||w instanceof Uint32Array){var L=Array.prototype.slice.call(new Uint8Array(w.buffer,w.byteOffset,w.byteLength)).map(function(P){return" "+("00"+P.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return L?L.length===1?k+"<"+L.join("").slice(1)+">":k+`<
|
|
`+L.map(function(P){return f+" "+P}).join(`
|
|
`)+`
|
|
`+f+" >":k+"<>"}return k+JSON.stringify(w,null,2).split(`
|
|
`).map(function(P,M){return M===0?P:f+" "+P}).join(`
|
|
`)}).join(`
|
|
`)+(m.boxes?`
|
|
`+Qc(m.boxes,h+1):"")}).join(`
|
|
`)},parseTfdt:hi.tfdt,parseHdlr:hi.hdlr,parseTfhd:hi.tfhd,parseTrun:hi.trun},$f=Df,Kf=es.CaptionStream,Qf=function(l,h){for(var f=l,m=0;m<h.length;m++){var v=h[m];if(f<v.size)return v;f-=v.size}return null},Jf=function(l,h){var f=Be.findBox(l,["moof","traf"]),m=Be.findBox(l,["mdat"]),v={},_=[];return m.forEach(function(k,w){var L=f[w];_.push({mdat:k,traf:L})}),_.forEach(function(k){var w,L,P,M,N,W,Y,X,tt=k.mdat,Ft=k.traf,de=Be.findBox(Ft,["tfhd"]),pe=ps.parseTfhd(de[0]),fe=pe.trackId,pt=Be.findBox(Ft,["tfdt"]),me=0<pt.length?ps.parseTfdt(pt[0]).baseMediaDecodeTime:0,Ki=Be.findBox(Ft,["trun"]);h===fe&&0<Ki.length&&(L=Ki,M=me,N=(P=pe).defaultSampleDuration||0,W=P.defaultSampleSize||0,Y=P.trackId,X=[],L.forEach(function(ne){var Fe=ps.parseTrun(ne).samples;Fe.forEach(function(kt){kt.duration===void 0&&(kt.duration=N),kt.size===void 0&&(kt.size=W),kt.trackId=Y,kt.dts=M,kt.compositionTimeOffset===void 0&&(kt.compositionTimeOffset=0),kt.pts=M+kt.compositionTimeOffset,M+=kt.duration}),X=X.concat(Fe)}),w=function(ne,Fe,kt){var ge,ye,Qi,fs,em=new DataView(ne.buffer,ne.byteOffset,ne.byteLength),th=[];for(ye=0;ye+4<ne.length;ye+=Qi)if(Qi=em.getUint32(ye),ye+=4,!(Qi<=0))switch(31&ne[ye]){case 6:var eh=ne.subarray(ye+1,ye+1+Qi),Qn=Qf(ye,Fe);ge={nalUnitType:"sei_rbsp",size:Qi,data:eh,escapedRBSP:$f(eh),trackId:kt},Qn?(ge.pts=Qn.pts,ge.dts=Qn.dts,fs=Qn):(ge.pts=fs.pts,ge.dts=fs.dts),th.push(ge)}return th}(tt,X,fe),v[fe]||(v[fe]=[]),v[fe]=v[fe].concat(w))}),v},Zf={generator:li,probe:Be,Transmuxer:ds.Transmuxer,AudioSegmentStream:ds.AudioSegmentStream,VideoSegmentStream:ds.VideoSegmentStream,CaptionParser:function(){var l,h,f,m,v,_=!1;this.isInitialized=function(){return _},this.init=function(){l=new Kf,_=!0,l.on("data",function(k){k.startTime=k.startPts/m,k.endTime=k.endPts/m,v.captions.push(k),v.captionStreams[k.stream]=!0})},this.isNewInit=function(k,w){return!(k&&k.length===0||w&&typeof w=="object"&&Object.keys(w).length===0||f===k[0]&&m===w[f])},this.parse=function(k,w,L){var P,M,N,W;if(!this.isInitialized()||!w||!L)return null;if(this.isNewInit(w,L))f=w[0],m=L[f];else if(!f||!m)return h.push(k),null;for(;0<h.length;){var Y=h.shift();this.parse(Y,w,L)}return M=k,W=m,(P=(N=f)?{seiNals:Jf(M,N)[N],timescale:W}:null)!==null&&P.seiNals?(this.pushNals(P.seiNals),this.flushStream(),v):null},this.pushNals=function(k){if(!this.isInitialized()||!k||k.length===0)return null;k.forEach(function(w){l.push(w)})},this.flushStream=function(){if(!this.isInitialized())return null;l.flush()},this.clearParsedCaptions=function(){v.captions=[],v.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;l.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){h=[],m=f=null,v?this.clearParsedCaptions():v={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}},tm=function(){function l(h,f){for(var m=0;m<f.length;m++){var v=f[m];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(h,v.key,v)}}return function(h,f,m){return f&&l(h.prototype,f),m&&l(h,m),h}}(),Zc=function(){function l(h,f){(function(m,v){if(!(m instanceof v))throw new TypeError("Cannot call a class as a function")})(this,l),this.options=f||{},this.self=h,this.init()}return tm(l,[{key:"init",value:function(){var h,f;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Zf.Transmuxer(this.options),h=this.self,(f=this.transmuxer).on("data",function(m){var v=m.initSegment;m.initSegment={data:v.buffer,byteOffset:v.byteOffset,byteLength:v.byteLength};var _=m.data;m.data=_.buffer,h.postMessage({action:"data",segment:m,byteOffset:_.byteOffset,byteLength:_.byteLength},[m.data])}),f.captionStream&&f.captionStream.on("data",function(m){h.postMessage({action:"caption",data:m})}),f.on("done",function(m){h.postMessage({action:"done"})}),f.on("gopInfo",function(m){h.postMessage({action:"gopInfo",gopInfo:m})})}},{key:"push",value:function(h){var f=new Uint8Array(h.data,h.byteOffset,h.byteLength);this.transmuxer.push(f)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(h){var f=h.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4*f))}},{key:"setAudioAppendStart",value:function(h){this.transmuxer.setAudioAppendStart(Math.ceil(9e4*h.appendStart))}},{key:"flush",value:function(h){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}},{key:"alignGopsWith",value:function(h){this.transmuxer.alignGopsWith(h.gopsToAlignWith.slice())}}]),l}();new function(l){l.onmessage=function(h){h.data.action==="init"&&h.data.options?this.messageHandlers=new Zc(l,h.data.options):(this.messageHandlers||(this.messageHandlers=new Zc(l)),h.data&&h.data.action&&h.data.action!=="init"&&this.messageHandlers[h.data.action]&&this.messageHandlers[h.data.action](h.data))}}(e)})()}),Zl={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},tc=function(i){return i.map(function(r){return r.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,n){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(n).toString(16)).slice(-2)})})},Hi=function(){var i,r=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"",e={codecCount:0};return e.codecCount=r.split(",").length,e.codecCount=e.codecCount||2,(i=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(r))&&(e.videoCodec=i[2],e.videoObjectTypeIndicator=i[3]),e.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(r),e.audioProfile=e.audioProfile&&e.audioProfile[2],e},Ha=function(i,r,e){return i+"/"+r+'; codecs="'+e.filter(function(t){return!!t}).join(", ")+'"'},Gp=function(i,r){var e,t,n=(e=r).segments&&e.segments.length&&e.segments[0].map?"mp4":"mp2t",a=(t=r.attributes||{}).CODECS?Hi(t.CODECS):Zl,s=r.attributes||{},o=!0,u=!1;if(!r)return[];if(i.mediaGroups.AUDIO&&s.AUDIO){var c=i.mediaGroups.AUDIO[s.AUDIO];if(c){for(var d in o=!(u=!0),c)if(!c[d].uri&&!c[d].playlists){o=!0;break}}}u&&!a.audioProfile&&(o||(a.audioProfile=function(T,S){if(!T.mediaGroups.AUDIO||!S)return null;var C=T.mediaGroups.AUDIO[S];if(!C)return null;for(var E in C){var U=C[E];if(U.default&&U.playlists)return Hi(U.playlists[0].attributes.CODECS).audioProfile}return null}(i,s.AUDIO)),a.audioProfile||(O.log.warn("Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"),a.audioProfile=Zl.audioProfile));var p={};a.videoCodec&&(p.video=""+a.videoCodec+a.videoObjectTypeIndicator),a.audioProfile&&(p.audio="mp4a.40."+a.audioProfile);var g=Ha("audio",n,[p.audio]),y=Ha("video",n,[p.video]),b=Ha("video",n,[p.video,p.audio]);return u?!o&&p.video?[y,g]:o||p.video?[b,g]:[g,g]:p.video?[b]:[g]},ec=function(i){return/mp4a\.\d+.\d+/i.test(i)},ic=function(i){return/avc1\.[\da-f]+/i.test(i)},Xp=function(i){function r(e,t){Gt(this,r);var n=se(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,O.EventTarget));n.timestampOffset_=0,n.pendingBuffers_=[],n.bufferUpdating_=!1,n.mediaSource_=e,n.codecs_=t,n.audioCodec_=null,n.videoCodec_=null,n.audioDisabled_=!1,n.appendAudioInitSegment_=!0,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=11<=O.browser.IE_VERSION;var a={remux:!1,alignGopsAtEnd:n.safeAppend_};return n.codecs_.forEach(function(s){ec(s)?n.audioCodec_=s:ic(s)&&(n.videoCodec_=s)}),n.transmuxer_=new Wp,n.transmuxer_.postMessage({action:"init",options:a}),n.transmuxer_.onmessage=function(s){return s.data.action==="data"?n.data_(s):s.data.action==="done"?n.done_(s):s.data.action==="gopInfo"?n.appendGopInfo_(s):void 0},Object.defineProperty(n,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(s){typeof s=="number"&&0<=s&&(this.timestampOffset_=s,this.appendAudioInitSegment_=!0,this.gopBuffer_.length=0,this.timeMapping_=0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:s}))}}),Object.defineProperty(n,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(s){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=s),this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=s)}}),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(s,o,u){var c=null,d=null,p=0,g=[],y=[];if(!s&&!o)return O.createTimeRange();if(!s)return o.buffered;if(!o||u)return s.buffered;if(s.buffered.length===0&&o.buffered.length===0)return O.createTimeRange();for(var b=s.buffered,T=o.buffered,S=b.length;S--;)g.push({time:b.start(S),type:"start"}),g.push({time:b.end(S),type:"end"});for(S=T.length;S--;)g.push({time:T.start(S),type:"start"}),g.push({time:T.end(S),type:"end"});for(g.sort(function(C,E){return C.time-E.time}),S=0;S<g.length;S++)g[S].type==="start"?++p==2&&(c=g[S].time):g[S].type==="end"&&--p==1&&(d=g[S].time),c!==null&&d!==null&&(y.push([c,d]),d=c=null);return O.createTimeRanges(y)}(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),n}return ce(r,O.EventTarget),Zt(r,[{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(n,a,s){var o=a.player_;if(s.captions&&s.captions.length){for(var u in n.inbandTextTracks_||(n.inbandTextTracks_={}),s.captionStreams)if(!n.inbandTextTracks_[u]){o.tech_.trigger({type:"usage",name:"hls-608"});var c=o.textTracks().getTrackById(u);n.inbandTextTracks_[u]=c||o.addRemoteTextTrack({kind:"captions",id:u,label:u},!1).track}}s.metadata&&s.metadata.length&&!n.metadataTrack_&&(n.metadataTrack_=o.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,n.metadataTrack_.inBandMetadataTrackDispatchType=s.metadata.dispatchType)}(this,this.mediaSource_,t),this.pendingBuffers_.push(t)}},{key:"done_",value:function(e){this.mediaSource_.readyState!=="closed"?this.processPendingSegments_():this.pendingBuffers_.length=0}},{key:"createRealSourceBuffers_",value:function(){var e=this,t=["audio","video"];t.forEach(function(n){if(e[n+"Codec_"]&&!e[n+"Buffer_"]){var a=null;if(e.mediaSource_[n+"Buffer_"])(a=e.mediaSource_[n+"Buffer_"]).updating=!1;else{var s=n+'/mp4;codecs="'+e[n+"Codec_"]+'"';a=function(o,u){var c=o.addSourceBuffer(u),d=Object.create(null);d.updating=!1,d.realBuffer_=c;var p=function(y){typeof c[y]=="function"?d[y]=function(){return c[y].apply(c,arguments)}:typeof d[y]=="undefined"&&Object.defineProperty(d,y,{get:function(){return c[y]},set:function(b){return c[y]=b}})};for(var g in c)p(g);return d}(e.mediaSource_.nativeMediaSource_,s),e.mediaSource_[n+"Buffer_"]=a}e[n+"Buffer_"]=a,["update","updatestart","updateend"].forEach(function(o){a.addEventListener(o,function(){if(n!=="audio"||!e.audioDisabled_)return o==="updateend"&&(e[n+"Buffer_"].updating=!1),t.every(function(u){return!(u!=="audio"||!e.audioDisabled_)||n===u||!e[u+"Buffer_"]||!e[u+"Buffer_"].updating})?e.trigger(o):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:function(n,a,s){if(typeof a=="undefined"||a===null||!n.length)return[];var o=Math.ceil(9e4*(a-s+3)),u=void 0;for(u=0;u<n.length&&!(n[u].pts>o);u++);return n.slice(u)}(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(t,n,a){if(!n.length)return t;if(a)return n.slice();for(var s=n[0].pts,o=0;o<t.length&&!(t[o].pts>=s);o++);return t.slice(0,o).concat(n)}(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(a,s,o,u){for(var c=Math.ceil(9e4*(s-u)),d=Math.ceil(9e4*(o-u)),p=a.slice(),g=a.length;g--&&!(a[g].pts<=d););if(g===-1)return p;for(var y=g+1;y--&&!(a[y].pts<=c););return y=Math.max(y,0),p.splice(y,g-y+1),p}(this.gopBuffer_,e,t,this.timeMapping_)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(e,t)),si(e,t,this.metadataTrack_),this.inbandTextTracks_)for(var n in this.inbandTextTracks_)si(e,t,this.inbandTextTracks_[n])}},{key:"processPendingSegments_",value:function(){var e={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};e=this.pendingBuffers_.reduce(function(n,a){var s=a.type,o=a.data,u=a.initSegment;return n[s].segments.push(o),n[s].bytes+=o.byteLength,n[s].initSegment=u,a.captions&&(n.captions=n.captions.concat(a.captions)),a.info&&(n[s].info=a.info),a.metadata&&(n.metadata=n.metadata.concat(a.metadata)),n},e),this.videoBuffer_||this.audioBuffer_||(e.video.bytes===0&&(this.videoCodec_=null),e.audio.bytes===0&&(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_),Hp(this,e.captions,e.metadata)):!this.videoBuffer_||!this.audioDisabled_&&this.audioBuffer_||(t=!0),!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 n=0,a=void 0;if(e.bytes){a=new Uint8Array(e.bytes),e.segments.forEach(function(s){a.set(s,n),n+=s.byteLength});try{t.updating=!0,t.appendBuffer(a)}catch(s){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:s.message,originalError:s})}}}},{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}}]),r}(),qa=function(i){function r(){Gt(this,r);var e=se(this,(r.__proto__||Object.getPrototypeOf(r)).call(this)),t=void 0;for(t in e.nativeMediaSource_=new A.MediaSource,e.nativeMediaSource_)t in r.prototype||typeof e.nativeMediaSource_[t]!="function"||(e[t]=e.nativeMediaSource_[t].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(n){(this.duration_=n)===1/0||(this.nativeMediaSource_.duration=n)}}),Object.defineProperty(e,"seekable",{get:function(){return this.duration_===1/0?O.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,e.sourceBuffers.length===1){var n=e.sourceBuffers[0];return n.appendAudioInitSegment_=!0,n.audioDisabled_=!n.audioCodec_,void e.activeSourceBuffers_.push(n)}for(var a=!1,s=!0,o=0;o<e.player_.audioTracks().length;o++){var u=e.player_.audioTracks()[o];if(u.enabled&&u.kind!=="main"){s=!(a=!0);break}}e.sourceBuffers.forEach(function(c,d){if(c.appendAudioInitSegment_=!0,c.videoCodec_&&c.audioCodec_)c.audioDisabled_=a;else if(c.videoCodec_&&!c.audioCodec_)c.audioDisabled_=!0,s=!1;else if(!c.videoCodec_&&c.audioCodec_&&(c.audioDisabled_=d?s:!s,c.audioDisabled_))return;e.activeSourceBuffers_.push(c)})},e.onPlayerMediachange_=function(){e.sourceBuffers.forEach(function(n){n.appendAudioInitSegment_=!0})},e.onHlsReset_=function(){e.sourceBuffers.forEach(function(n){n.transmuxer_&&n.transmuxer_.postMessage({action:"resetCaptions"})})},e.onHlsSegmentTimeMapping_=function(n){e.sourceBuffers.forEach(function(a){return a.timeMapping_=n.mapping})},["sourceopen","sourceclose","sourceended"].forEach(function(n){this.nativeMediaSource_.addEventListener(n,this.trigger.bind(this))},e),e.on("sourceopen",function(n){var a=B.querySelector('[src="'+e.url_+'"]');a&&(e.player_=O(a.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(n){for(var a=Yl(e.duration),s=0;s<e.sourceBuffers.length;s++){var o=e.sourceBuffers[s],u=o.metadataTrack_&&o.metadataTrack_.cues;u&&u.length&&(u[u.length-1].endTime=a)}}),e.on("sourceclose",function(n){this.sourceBuffers.forEach(function(a){a.transmuxer_&&a.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 ce(r,O.EventTarget),Zt(r,[{key:"addSeekableRange_",value:function(e,t){var n=void 0;if(this.duration!==1/0)throw(n=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity")).name="InvalidStateError",n.code=11,n;(t>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=t)}},{key:"addSourceBuffer",value:function(e){var t,n,a=void 0,s=(t={type:"",parameters:{}},n=e.trim().split(";"),t.type=n.shift().trim(),n.forEach(function(u){var c=u.trim().split("=");if(1<c.length){var d=c[0].replace(/"/g,"").trim(),p=c[1].replace(/"/g,"").trim();t.parameters[d]=p}}),t);if(/^(video|audio)\/mp2t$/i.test(s.type)){var o=[];s.parameters&&s.parameters.codecs&&(o=s.parameters.codecs.split(","),o=(o=tc(o)).filter(function(u){return ec(u)||ic(u)})),o.length===0&&(o=["avc1.4d400d","mp4a.40.2"]),a=new Xp(this,o),this.sourceBuffers.length!==0&&(this.sourceBuffers[0].createRealSourceBuffers_(),a.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)}else a=this.nativeMediaSource_.addSourceBuffer(e);return this.sourceBuffers.push(a),a}}]),r}(),nc=0;O.mediaSources={};var rc=function(i,r){var e=O.mediaSources[i];if(!e)throw new Error("Media Source not found (Video.js)");e.trigger({type:"sourceopen",swfId:r})},za=function(){return!!A.MediaSource&&!!A.MediaSource.isTypeSupported&&A.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},qi=function(){if(this.MediaSource={open:rc,supportsNativeMediaSources:za},za())return new qa;throw new Error("Cannot use create a virtual MediaSource for this video")};qi.open=rc,qi.supportsNativeMediaSources=za;var ac={createObjectURL:function(i){var r=void 0;return i instanceof qa?(r=A.URL.createObjectURL(i.nativeMediaSource_),i.url_=r):i instanceof qa?(r="blob:vjs-media-source/"+nc,nc++,O.mediaSources[r]=i,r):(r=A.URL.createObjectURL(i),i.url_=r)}};O.MediaSource=qi,O.URL=ac;var Yp=O.EventTarget,$p=O.mergeOptions,sc=function(i,r){for(var e=$p(i,{duration:r.duration,minimumUpdatePeriod:r.minimumUpdatePeriod}),t=0;t<r.playlists.length;t++){var n=Ma(e,r.playlists[t]);n&&(e=n)}return Ra(r,function(a,s,o,u){if(a.playlists&&a.playlists.length){var c=a.playlists[0].uri,d=Ma(e,a.playlists[0]);d&&((e=d).mediaGroups[s][o][u].playlists[0]=e.playlists[c])}}),e},Wa=function(i){function r(e,t,n,a){Gt(this,r);var s=se(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));if(s.hls_=t,s.withCredentials=n,!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_()}),typeof e=="string"?(s.srcUrl=e,s.state="HAVE_NOTHING",se(s)):(s.masterPlaylistLoader_=a,s.state="HAVE_METADATA",s.started=!0,s.media(e),A.setTimeout(function(){s.trigger("loadedmetadata")},0),s)}return ce(r,Yp),Zt(r,[{key:"dispose",value:function(){this.stopRequest(),A.clearTimeout(this.mediaUpdateTimeout)}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);var t=this.state;if(typeof e=="string"){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}var n=!this.media_||e.uri!==this.media_.uri;this.state="HAVE_METADATA",n&&(this.media_&&this.trigger("mediachanging"),this.media_=e,this.refreshMedia_(),t!=="HAVE_MASTER"&&this.trigger("mediachange"))}},{key:"pause",value:function(){this.stopRequest(),A.clearTimeout(this.mediaUpdateTimeout),this.state==="HAVE_NOTHING"&&(this.started=!1)}},{key:"load",value:function(e){var t=this;A.clearTimeout(this.mediaUpdateTimeout);var n=this.media();if(e){var a=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=A.setTimeout(function(){return t.load()},a)}else this.started?this.trigger("loadedplaylist"):this.start()}},{key:"parseMasterXml",value:function(){var e=jd(this.masterXml_,{manifestUri:this.srcUrl,clientOffset:this.clientOffset_});e.uri=this.srcUrl;for(var t=0;t<e.playlists.length;t++){var n="placeholder-uri-"+t;e.playlists[t].uri=n,e.playlists[n]=e.playlists[t]}return Ra(e,function(a,s,o,u){if(a.playlists&&a.playlists.length){var c="placeholder-uri-"+s+"-"+o+"-"+u;a.playlists[0].uri=c,e.playlists[c]=a.playlists[0]}}),Al(e),Ll(e),e}},{key:"start",value:function(){var e=this;this.started=!0,this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(t,n){if(e.request){if(e.request=null,t)return e.error={status:n.status,message:"DASH playlist request error at URL: "+e.srcUrl,responseText:n.responseText,code:2},e.state==="HAVE_NOTHING"&&(e.started=!1),e.trigger("error");e.masterXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?e.masterLoaded_=Date.parse(n.responseHeaders.date):e.masterLoaded_=Date.now(),e.syncClientServerClock_(e.onClientServerClockSync_.bind(e))}})}},{key:"syncClientServerClock_",value:function(e){var t=this,n=Fd(this.masterXml_);return n===null?(this.clientOffset_=this.masterLoaded_-Date.now(),e()):n.method==="DIRECT"?(this.clientOffset_=n.value-Date.now(),e()):void(this.request=this.hls_.xhr({uri:le(this.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials},function(a,s){if(t.request){if(a)return t.clientOffset_=t.masterLoaded_-Date.now(),e();var o=void 0;o=n.method==="HEAD"?s.responseHeaders&&s.responseHeaders.date?Date.parse(s.responseHeaders.date):t.masterLoaded_:Date.parse(s.responseText),t.clientOffset_=o-Date.now(),e()}}))}},{key:"onClientServerClockSync_",value:function(){var e=this;this.master=this.parseMasterXml(),this.state="HAVE_MASTER",this.trigger("loadedplaylist"),this.media_||this.media(this.master.playlists[0]),A.setTimeout(function(){e.trigger("loadedmetadata")},0),this.master.minimumUpdatePeriod&&A.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,n){if(e.request){if(e.request=null,t)return e.error={status:n.status,message:"DASH playlist request error at URL: "+e.srcUrl,responseText:n.responseText,code:2},e.state==="HAVE_NOTHING"&&(e.started=!1),e.trigger("error");e.masterXml_=n.responseText;var a=e.parseMasterXml();e.master=sc(e.master,a),A.setTimeout(function(){e.trigger("minimumUpdatePeriod")},e.master.minimumUpdatePeriod)}})}},{key:"refreshMedia_",value:function(){var e=this,t=void 0,n=void 0;n=this.masterPlaylistLoader_?(t=this.masterPlaylistLoader_.master,this.masterPlaylistLoader_.parseMasterXml()):(t=this.master,this.parseMasterXml());var a=sc(t,n);a?(this.masterPlaylistLoader_?this.masterPlaylistLoader_.master=a:this.master=a,this.media_=a.playlists[this.media_.uri]):this.trigger("playlistunchanged"),this.media().endList||(this.mediaUpdateTimeout=A.setTimeout(function(){e.trigger("mediaupdatetimeout")},Ol(this.media(),!!a))),this.trigger("loadedplaylist")}}]),r}(),zi=function(i){return O.log.debug?O.log.debug.bind(O,"VHS:",i+" >"):function(){}};function Wi(){}var Kp=function(){function i(r,e,t,n){Gt(this,i),this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=r,this.processedAppend_=!1,this.type_=t,this.mimeType_=e,this.logger_=zi("SourceUpdater["+t+"]["+e+"]"),r.readyState==="closed"?r.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,e,n)):this.createSourceBuffer_(e,n)}return Zt(i,[{key:"createSourceBuffer_",value:function(r,e){var t=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(r),this.logger_("created SourceBuffer"),e&&(e.trigger("sourcebufferadded"),this.mediaSource.sourceBuffers.length<2)?e.on("sourcebufferadded",function(){t.start_()}):this.start_()}},{key:"start_",value:function(){var r=this;this.started_=!0,this.onUpdateendCallback_=function(){var e=r.pendingCallback_;r.pendingCallback_=null,r.logger_("buffered ["+ja(r.buffered())+"]"),e&&e(),r.runCallback_()},this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_),this.runCallback_()}},{key:"abort",value:function(r){var e=this;this.processedAppend_&&this.queueCallback_(function(){e.sourceBuffer_.abort()},r)}},{key:"appendBuffer",value:function(r,e){var t=this;this.processedAppend_=!0,this.queueCallback_(function(){t.sourceBuffer_.appendBuffer(r)},e)}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:O.createTimeRanges()}},{key:"remove",value:function(r,e){var t=this,n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:Wi;this.processedAppend_&&this.queueCallback_(function(){t.logger_("remove ["+r+" => "+e+"]"),t.sourceBuffer_.remove(r,e)},n)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||this.pendingCallback_}},{key:"timestampOffset",value:function(r){var e=this;return typeof r!="undefined"&&(this.queueCallback_(function(){e.sourceBuffer_.timestampOffset=r}),this.timestampOffset_=r),this.timestampOffset_}},{key:"queueCallback_",value:function(r,e){this.callbacks_.push([r.bind(this),e]),this.runCallback_()}},{key:"runCallback_",value:function(){var r=void 0;!this.updating()&&this.callbacks_.length&&this.started_&&(r=this.callbacks_.shift(),this.pendingCallback_=r[1],r[0]())}},{key:"dispose",value:function(){this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_),this.sourceBuffer_&&this.mediaSource.readyState==="open"&&this.sourceBuffer_.abort()}}]),i}(),Nt={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},Fn=2,oc=-101,uc=-102,lc=function(i){var r,e,t={};return i.byterange&&(t.Range=(r=i.byterange,e=r.offset+r.length-1,"bytes="+r.offset+"-"+e)),t},cc=function(i){i.forEach(function(r){r.abort()})},Ga=function(i,r){return r.timedout?{status:r.status,message:"HLS request timed-out at URL: "+r.uri,code:oc,xhr:r}:r.aborted?{status:r.status,message:"HLS request aborted at URL: "+r.uri,code:uc,xhr:r}:i?{status:r.status,message:"HLS request errored at URL: "+r.uri,code:Fn,xhr:r}:null},Qp=function(i,r,e){var t=0,n=!1;return function(a,s){var o,u,c;if(!n)return a?(n=!0,cc(i),e(a,s)):(t+=1)===i.length?(s.endOfAllRequests=Date.now(),s.encryptedBytes?(u=s,c=e,(o=r).addEventListener("message",function d(p){if(p.data.source===u.requestId){o.removeEventListener("message",d);var g=p.data.decrypted;return u.bytes=new Uint8Array(g.bytes,g.byteOffset,g.byteLength),c(null,u)}}),void o.postMessage(Fl({source:u.requestId,encrypted:u.encryptedBytes,key:u.key.bytes,iv:u.key.iv}),[u.encryptedBytes.buffer,u.key.bytes.buffer])):e(null,s)):void 0}},Jp=function(i,r){return function(e){var t,n,a;return i.stats=O.mergeOptions(i.stats,(n=(t=e).target,(a={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-n.requestTime||0}).bytesReceived=t.loaded,a.bandwidth=Math.floor(a.bytesReceived/a.roundTripTime*8*1e3),a)),!i.stats.firstBytesReceivedAt&&i.stats.bytesReceived&&(i.stats.firstBytesReceivedAt=Date.now()),r(e,i)}},Zp=function(i,r,e,t,n,a,s){var o,u,c,d,p,g=[],y=Qp(g,e,s);if(n.key){var b=i(O.mergeOptions(r,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),(o=n,u=y,function(I,x){var q=x.response,H=Ga(I,x);if(H)return u(H,o);if(q.byteLength!==16)return u({status:x.status,message:"Invalid HLS key at URL: "+x.uri,code:Fn,xhr:x},o);var R=new DataView(q);return o.key.bytes=new Uint32Array([R.getUint32(0),R.getUint32(4),R.getUint32(8),R.getUint32(12)]),u(null,o)}));g.push(b)}if(n.map&&!n.map.bytes){var T=i(O.mergeOptions(r,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:lc(n.map)}),(c=n,d=t,p=y,function(I,x){var q=x.response,H=Ga(I,x);return H?p(H,c):q.byteLength===0?p({status:x.status,message:"Empty HLS segment content at URL: "+x.uri,code:Fn,xhr:x},c):(c.map.bytes=new Uint8Array(x.response),d.isInitialized()||d.init(),c.map.timescales=Qt.timescale(c.map.bytes),c.map.videoTrackIds=Qt.videoTrackIds(c.map.bytes),p(null,c))}));g.push(T)}var S,C,E,U=i(O.mergeOptions(r,{uri:n.resolvedUri,responseType:"arraybuffer",headers:lc(n)}),(S=n,C=t,E=y,function(I,x){var q,H=x.response,R=Ga(I,x),G=void 0;return R?E(R,S):H.byteLength===0?E({status:x.status,message:"Empty HLS segment content at URL: "+x.uri,code:Fn,xhr:x},S):(S.stats={bandwidth:(q=x).bandwidth,bytesReceived:q.bytesReceived||0,roundTripTime:q.roundTripTime||0},S.key?S.encryptedBytes=new Uint8Array(x.response):S.bytes=new Uint8Array(x.response),S.map&&S.map.bytes&&(C.isInitialized()||C.init(),(G=C.parse(S.bytes,S.map.videoTrackIds,S.map.timescales))&&G.captions&&(S.captionStreams=G.captionStreams,S.fmp4Captions=G.captions)),E(null,S))}));return U.addEventListener("progress",Jp(n,a)),g.push(U),function(){return cc(g)}},hc=function(i,r){var e;return i&&(e=A.getComputedStyle(i))?e[r]:""},Gi=function(i,r){var e=i.slice();i.sort(function(t,n){var a=r(t,n);return a===0?e.indexOf(t)-e.indexOf(n):a})},Xa=function(i,r){var e=void 0,t=void 0;return i.attributes.BANDWIDTH&&(e=i.attributes.BANDWIDTH),e=e||A.Number.MAX_VALUE,r.attributes.BANDWIDTH&&(t=r.attributes.BANDWIDTH),e-(t=t||A.Number.MAX_VALUE)},dc=function(i,r,e){if(!i||!r)return!1;var t=e===i.segments.length;return i.endList&&r.readyState==="open"&&t},pc=function(i){return typeof i=="number"&&isFinite(i)},Ya=function(i){function r(e){Gt(this,r);var t=se(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));if(!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");return t.bandwidth=e.bandwidth,t.throughput={rate:0,count:0},t.roundTrip=NaN,t.resetStats_(),t.mediaIndex=null,t.hasPlayed_=e.hasPlayed,t.currentTime_=e.currentTime,t.seekable_=e.seekable,t.seeking_=e.seeking,t.duration_=e.duration,t.mediaSource_=e.mediaSource,t.hls_=e.hls,t.loaderType_=e.loaderType,t.startingMedia_=void 0,t.segmentMetadataTrack_=e.segmentMetadataTrack,t.goalBufferLength_=e.goalBufferLength,t.sourceType_=e.sourceType,t.inbandTextTracks_=e.inbandTextTracks,t.state_="INIT",t.checkBufferTimeout_=null,t.error_=void 0,t.currentTimeline_=-1,t.pendingSegment_=null,t.mimeType_=null,t.sourceUpdater_=null,t.xhrOptions_=null,t.activeInitSegmentId_=null,t.initSegments_={},t.captionParser_=new Tp,t.decrypter_=e.decrypter,t.syncController_=e.syncController,t.syncPoint_={segmentIndex:0,time:0},t.syncController_.on("syncinfoupdate",function(){return t.trigger("syncinfoupdate")}),t.mediaSource_.addEventListener("sourceopen",function(){return t.ended_=!1}),t.fetchAtBuffer_=!1,t.logger_=zi("SegmentLoader["+t.loaderType_+"]"),Object.defineProperty(t,"state",{get:function(){return this.state_},set:function(n){n!==this.state_&&(this.logger_(this.state_+" -> "+n),this.state_=n)}}),t}return ce(r,O.EventTarget),Zt(r,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED",this.pause(),this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_(),this.captionParser_.reset()}},{key:"abort",value:function(){this.state==="WAITING"?(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 typeof e!="undefined"&&(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():O.createTimeRanges()}},{key:"initSegment",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0&&arguments[1];if(!e)return null;var n=jn(e),a=this.initSegments_[n];return t&&!a&&e.bytes&&(this.initSegments_[n]=a={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,timescales:e.timescales,videoTrackIds:e.videoTrackIds}),a||e}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&this.state==="INIT")&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}},{key:"init_",value:function(){return this.state="READY",this.sourceUpdater_=new Kp(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};if(e){var n=this.playlist_,a=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.hasPlayed_()||(e.syncInfo={mediaSequence:e.mediaSequence,time:0});var s=n?n.id:null;if(this.logger_("playlist update ["+s+" => "+e.id+"]"),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(n&&n.uri===e.uri){var o=e.mediaSequence-n.mediaSequence;this.logger_("live window shift ["+o+"]"),this.mediaIndex!==null&&(this.mediaIndex-=o),a&&(a.mediaIndex-=o,0<=a.mediaIndex&&(a.segment=e.segments[a.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(n,e)}else this.mediaIndex!==null&&this.resyncLoader()}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(A.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return this.checkBufferTimeout_===null}},{key:"mimeType",value:function(e,t){this.mimeType_||(this.mimeType_=e,this.sourceBufferEmitter_=t,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(e){this.ended_=!1,this.resetLoader(),this.remove(0,this.duration_(),e),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,n){if(this.sourceUpdater_&&this.sourceUpdater_.remove(e,t,n),si(e,t,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var a in this.inbandTextTracks_)si(e,t,this.inbandTextTracks_[a])}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&A.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=A.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&A.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=A.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&&(dc(this.playlist_,this.mediaSource_,e.mediaIndex)?this.endOfStream():(e.mediaIndex!==this.playlist_.segments.length-1||this.mediaSource_.readyState!=="ended"||this.seeking_())&&((e.timeline!==this.currentTimeline_||e.startOfSegment!==null&&e.startOfSegment<this.sourceUpdater_.timestampOffset())&&(this.syncController_.reset(),e.timestampOffset=e.startOfSegment,this.captionParser_.clearAllCaptions()),this.loadSegment_(e)))}}},{key:"checkBuffer_",value:function(e,t,n,a,s,o){var u=0,c=void 0;e.length&&(u=e.end(e.length-1));var d=Math.max(0,u-s);if(!t.segments.length||d>=this.goalBufferLength_()||!a&&1<=d)return null;if(o===null)return n=this.getSyncSegmentCandidate_(t),this.generateSegmentInfo_(t,n,null,!0);if(n!==null){var p=t.segments[n];return c=p&&p.end?p.end:u,this.generateSegmentInfo_(t,n+1,c,!1)}if(this.fetchAtBuffer_){var g=Bt.getMediaInfoForTime(t,u,o.segmentIndex,o.time);n=g.mediaIndex,c=g.startTime}else{var y=Bt.getMediaInfoForTime(t,s,o.segmentIndex,o.time);n=y.mediaIndex,c=y.startTime}return this.generateSegmentInfo_(t,n,c,!1)}},{key:"getSyncSegmentCandidate_",value:function(e){var t=this;if(this.currentTimeline_===-1)return 0;var n=e.segments.map(function(a,s){return{timeline:a.timeline,segmentIndex:s}}).filter(function(a){return a.timeline===t.currentTimeline_});return n.length?n[Math.min(n.length-1,1)].segmentIndex:Math.max(e.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(e,t,n,a){if(t<0||t>=e.segments.length)return null;var s=e.segments[t];return{requestId:"segment-loader-"+Math.random(),uri:s.resolvedUri,mediaIndex:t,isSyncRequest:a,startOfSegment:n,playlist:e,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:s.timeline,duration:s.duration,segment:s}}},{key:"abortRequestEarly_",value:function(e){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return!1;var t=this.currentTime_(),n=e.bandwidth,a=this.pendingSegment_.duration,s=Bt.estimateSegmentRequestTime(a,n,this.playlist_,e.bytesReceived),o=function(p,g){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:1;return((p.length?p.end(p.length-1):0)-g)/y}(this.buffered_(),t,this.hls_.tech_.playbackRate())-1;if(s<=o)return!1;var u=function(p){var g=p.master,y=p.currentTime,b=p.bandwidth,T=p.duration,S=p.segmentDuration,C=p.timeUntilRebuffer,E=p.currentTimeline,U=p.syncController,I=g.playlists.filter(function(R){return!Bt.isIncompatible(R)}),x=I.filter(Bt.isEnabled);x.length||(x=I.filter(function(R){return!Bt.isDisabled(R)}));var q=x.filter(Bt.hasAttribute.bind(null,"BANDWIDTH")).map(function(R){var G=U.getSyncPoint(R,T,E,y)?1:2;return{playlist:R,rebufferingImpact:Bt.estimateSegmentRequestTime(S,b,R)*G-C}}),H=q.filter(function(R){return R.rebufferingImpact<=0});return Gi(H,function(R,G){return Xa(G.playlist,R.playlist)}),H.length?H[0]:(Gi(q,function(R,G){return R.rebufferingImpact-G.rebufferingImpact}),q[0]||null)}({master:this.hls_.playlists.master,currentTime:t,bandwidth:n,duration:this.duration_(),segmentDuration:a,timeUntilRebuffer:o,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(u){var c=s-o-u.rebufferingImpact,d=.5;return o<=Vi&&(d=1),!u.playlist||u.playlist.uri===this.playlist_.uri||c<d?!1:(this.bandwidth=u.playlist.attributes.BANDWIDTH*Nt.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=Zp(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,n,a,s,o=(t=this.seekable_(),n=this.currentTime_(),a=this.playlist_.targetDuration||10,s=void 0,s=t.length&&0<t.start(0)&&t.start(0)<n?t.start(0):n-30,Math.min(s,n-a));0<o&&this.remove(0,o)}},{key:"createSimplifiedSegmentObj_",value:function(e){var t=e.segment,n={resolvedUri:t.resolvedUri,byterange:t.byterange,requestId:e.requestId};if(t.key){var a=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key={resolvedUri:t.key.resolvedUri,iv:a}}return t.map&&(n.map=this.initSegment(t.map)),n}},{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===uc?void(this.mediaRequestsAborted+=1):(this.pause(),e.code===oc?(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)),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(n,a,s){for(var o in s)if(!n[o]){a.trigger({type:"usage",name:"hls-608"});var u=a.textTracks().getTrackById(o);n[o]=u||a.addRemoteTextTrack({kind:"captions",id:o,label:o},!1).track}}(this.inbandTextTracks_,this.hls_.tech_,e.captionStreams),function(n){var a=n.inbandTextTracks,s=n.captionArray,o=n.timestampOffset;if(s){var u=window.WebKitDataCue||window.VTTCue;s.forEach(function(c){var d=c.stream,p=c.startTime,g=c.endTime;a[d]&&(p+=o,g+=o,a[d].addCue(new u(p,g,c.text)))})}}({inbandTextTracks:this.inbandTextTracks_,captionArray:e.fmp4Captions,timestampOffset:0}),this.captionParser_.clearParsedCaptions()),this.handleSegment_()}},{key:"handleSegment_",value:function(){var e=this;if(this.pendingSegment_){var t=this.pendingSegment_,n=t.segment,a=this.syncController_.probeSegmentInfo(t);typeof this.startingMedia_=="undefined"&&a&&(a.containsAudio||a.containsVideo)&&(this.startingMedia_={containsAudio:a.containsAudio,containsVideo:a.containsVideo});var s,o,u,c=(s=this.loaderType_,o=this.startingMedia_,u=a,s==="main"&&o&&u?u.containsAudio||u.containsVideo?o.containsVideo&&!u.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.":!o.containsVideo&&u.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(c)return this.error({message:c,blacklistDuration:1/0}),void this.trigger("error");if(t.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");t.timestampOffset!==null&&t.timestampOffset!==this.sourceUpdater_.timestampOffset()&&(this.sourceUpdater_.timestampOffset(t.timestampOffset),this.trigger("timestampoffset"));var d,p,g,y,b,T,S,C,E,U,I,x=this.syncController_.mappingForTimeline(t.timeline);if(x!==null&&this.trigger({type:"segmenttimemapping",mapping:x}),this.state="APPENDING",n.map){var q=jn(n.map);if(!this.activeInitSegmentId_||this.activeInitSegmentId_!==q){var H=this.initSegment(n.map);this.sourceUpdater_.appendBuffer(H.bytes,function(){e.activeInitSegmentId_=q})}}t.byteLength=t.bytes.byteLength,typeof n.start=="number"&&typeof n.end=="number"?this.mediaSecondsLoaded+=n.end-n.start:this.mediaSecondsLoaded+=n.duration,this.logger_((p=(d=t).segment,g=p.start,y=p.end,b=d.playlist,T=b.mediaSequence,S=b.id,C=b.segments,E=C===void 0?[]:C,U=d.mediaIndex,I=d.timeline,["appending ["+U+"] of ["+T+", "+(T+E.length)+"] from playlist ["+S+"]","["+g+" => "+y+"] in timeline ["+I+"]"].join(" "))),this.sourceUpdater_.appendBuffer(t.bytes,this.handleUpdateEnd_.bind(this))}else this.state="READY"}},{key:"handleUpdateEnd_",value:function(){if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_,t=e.segment,n=this.mediaIndex!==null;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():(n&&this.trigger("bandwidthupdate"),this.trigger("progress"),dc(e.playlist,this.mediaSource_,e.mediaIndex+1)&&this.endOfStream(),this.paused()||this.monitorBuffer_())}},{key:"recordThroughput_",value:function(e){var t=this.throughput.rate,n=Date.now()-e.endOfAllRequests+1,a=Math.floor(e.byteLength/n*8*1e3);this.throughput.rate+=(a-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(e){if(this.segmentMetadataTrack_){var t=e.segment,n=t.start,a=t.end;if(pc(n)&&pc(a)){si(n,a,this.segmentMetadataTrack_);var s=A.WebKitDataCue||A.VTTCue,o={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.uri,start:n,end:a},u=new s(n,a,JSON.stringify(o));u.value=o,this.segmentMetadataTrack_.addCue(u)}}}}]),r}(),fc=function(i){return decodeURIComponent(escape(String.fromCharCode.apply(null,i)))},mc=new Uint8Array(`
|
|
|
|
`.split("").map(function(i){return i.charCodeAt(0)})),tf=function(i){function r(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};Gt(this,r);var n=se(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t));return n.mediaSource_=null,n.subtitlesTrack_=null,n}return ce(r,Ya),Zt(r,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return O.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,n=e[e.length-1].startTime;return O.createTimeRanges([[t,n]])}},{key:"initSegment",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0&&arguments[1];if(!e)return null;var n=jn(e),a=this.initSegments_[n];if(t&&!a&&e.bytes){var s=mc.byteLength+e.bytes.byteLength,o=new Uint8Array(s);o.set(e.bytes),o.set(mc,e.bytes.byteLength),this.initSegments_[n]=a={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:o}}return a||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 typeof e=="undefined"||(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}},{key:"remove",value:function(e,t){si(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(this.syncController_.timestampOffsetForTimeline(t.timeline)===null)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_,n=t.segment;if(typeof A.WebVTT!="function"&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var a=function(){e.handleSegment_()};return this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",a),void this.subtitlesTrack_.tech_.one("vttjserror",function(){e.subtitlesTrack_.tech_.off("vttjsloaded",a),e.error({message:"Error loading vtt.js"}),e.state="READY",e.pause(),e.trigger("error")})}n.requested=!0;try{this.parseVTTCues_(t)}catch(s){return this.error({message:s.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+=n.duration,t.cues.length&&this.remove(t.cues[0].endTime,t.cues[t.cues.length-1].endTime),t.cues.forEach(function(s){e.subtitlesTrack_.addCue(s)}),this.handleUpdateEnd_()}else this.state="READY"}},{key:"parseVTTCues_",value:function(e){var t=void 0,n=!1;typeof A.TextDecoder=="function"?t=new A.TextDecoder("utf8"):(t=A.WebVTT.StringDecoder(),n=!0);var a=new A.WebVTT.Parser(A,A.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},a.oncue=e.cues.push.bind(e.cues),a.ontimestampmap=function(u){return e.timestampmap=u},a.onparsingerror=function(u){O.log.warn("Error encountered when parsing cues: "+u.message)},e.segment.map){var s=e.segment.map.bytes;n&&(s=fc(s)),a.parse(s)}var o=e.bytes;n&&(o=fc(o)),a.parse(o),a.flush()}},{key:"updateTimeMapping_",value:function(e,t,n){var a=e.segment;if(t)if(e.cues.length){var s=e.timestampmap,o=s.MPEGTS/9e4-s.LOCAL+t.mapping;if(e.cues.forEach(function(d){d.startTime+=o,d.endTime+=o}),!n.syncInfo){var u=e.cues[0].startTime,c=e.cues[e.cues.length-1].startTime;n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:Math.min(u,c-a.duration)}}}else a.empty=!0}}]),r}(),ef=function(i,r){for(var e=i.cues,t=0;t<e.length;t++){var n=e[t];if(r>=n.adStartTime&&r<=n.adEndTime)return n}return null},nf=Ep,gc=[{name:"VOD",run:function(i,r,e,t,n){return e===1/0?null:{time:0,segmentIndex:0}}},{name:"ProgramDateTime",run:function(i,r,e,t,n){if(!i.datetimeToDisplayTime)return null;var a=r.segments||[],s=null,o=null;n=n||0;for(var u=0;u<a.length;u++){var c=a[u];if(c.dateTimeObject){var d=c.dateTimeObject.getTime()/1e3+i.datetimeToDisplayTime,p=Math.abs(n-d);if(o!==null&&o<p)break;o=p,s={time:d,segmentIndex:u}}}return s}},{name:"Segment",run:function(i,r,e,t,n){var a=r.segments||[],s=null,o=null;n=n||0;for(var u=0;u<a.length;u++){var c=a[u];if(c.timeline===t&&typeof c.start!="undefined"){var d=Math.abs(n-c.start);if(o!==null&&o<d)break;(!s||o===null||d<=o)&&(o=d,s={time:c.start,segmentIndex:u})}}return s}},{name:"Discontinuity",run:function(i,r,e,t,n){var a=null;if(n=n||0,r.discontinuityStarts&&r.discontinuityStarts.length)for(var s=null,o=0;o<r.discontinuityStarts.length;o++){var u=r.discontinuityStarts[o],c=r.discontinuitySequence+o+1,d=i.discontinuities[c];if(d){var p=Math.abs(n-d.time);if(s!==null&&s<p)break;(!a||s===null||p<=s)&&(s=p,a={time:d.time,segmentIndex:u})}}return a}},{name:"Playlist",run:function(i,r,e,t,n){return r.syncInfo?{time:r.syncInfo.time,segmentIndex:r.syncInfo.mediaSequence-r.mediaSequence}:null}}],rf=function(i){function r(){Gt(this,r);var e=se(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return e.inspectCache_=void 0,e.timelines=[],e.discontinuities=[],e.datetimeToDisplayTime=null,e.logger_=zi("SyncController"),e}return ce(r,O.EventTarget),Zt(r,[{key:"getSyncPoint",value:function(e,t,n,a){var s=this.runStrategies_(e,t,n,a);return s.length?this.selectSyncPoint_(s,{key:"time",value:a}):null}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments)return null;var n=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!n.length)return null;var a=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return 0<a.segmentIndex&&(a.time*=-1),Math.abs(a.time+Fi(e,a.segmentIndex,0))}},{key:"runStrategies_",value:function(e,t,n,a){for(var s=[],o=0;o<gc.length;o++){var u=gc[o],c=u.run(this,e,t,n,a);c&&(c.strategy=u.name,s.push({strategy:u.name,syncPoint:c}))}return s}},{key:"selectSyncPoint_",value:function(e,t){for(var n=e[0].syncPoint,a=Math.abs(e[0].syncPoint[t.key]-t.value),s=e[0].strategy,o=1;o<e.length;o++){var u=Math.abs(e[o].syncPoint[t.key]-t.value);u<a&&(a=u,n=e[o].syncPoint,s=e[o].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+s+"]: [time:"+n.time+", segmentIndex:"+n.segmentIndex+"]"),n}},{key:"saveExpiredSegmentInfo",value:function(e,t){for(var n=t.mediaSequence-e.mediaSequence-1;0<=n;n--){var a=e.segments[n];if(a&&typeof a.start!="undefined"){t.syncInfo={mediaSequence:e.mediaSequence+n,time:a.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,n=e.playlist,a=void 0;return(a=t.map?this.probeMp4Segment_(e):this.probeTsSegment_(e))&&this.calculateSegmentTimeMapping_(e,a)&&(this.saveDiscontinuitySyncInfo_(e),n.syncInfo||(n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:t.start})),a}},{key:"probeMp4Segment_",value:function(e){var t=e.segment,n=Qt.timescale(t.map.bytes),a=Qt.startTime(n,e.bytes);return e.timestampOffset!==null&&(e.timestampOffset-=a),{start:a,end:a+t.duration}}},{key:"probeTsSegment_",value:function(e){var t=nf(e.bytes,this.inspectCache_),n=void 0,a=void 0;return t?(t.video&&t.video.length===2?(this.inspectCache_=t.video[1].dts,n=t.video[0].dtsTime,a=t.video[1].dtsTime):t.audio&&t.audio.length===2&&(this.inspectCache_=t.audio[1].dts,n=t.audio[0].dtsTime,a=t.audio[1].dtsTime),{start:n,end:a,containsVideo:t.video&&t.video.length===2,containsAudio:t.audio&&t.audio.length===2}):null}},{key:"timestampOffsetForTimeline",value:function(e){return typeof this.timelines[e]=="undefined"?null:this.timelines[e].time}},{key:"mappingForTimeline",value:function(e){return typeof this.timelines[e]=="undefined"?null:this.timelines[e].mapping}},{key:"calculateSegmentTimeMapping_",value:function(e,t){var n=e.segment,a=this.timelines[e.timeline];if(e.timestampOffset!==null)a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+a.time+"] [mapping: "+a.mapping+"]"),n.start=e.startOfSegment,n.end=t.end+a.mapping;else{if(!a)return!1;n.start=t.start+a.mapping,n.end=t.end+a.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(e){var t=e.playlist,n=e.segment;if(n.discontinuity)this.discontinuities[n.timeline]={time:n.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var a=0;a<t.discontinuityStarts.length;a++){var s=t.discontinuityStarts[a],o=t.discontinuitySequence+a+1,u=s-e.mediaIndex,c=Math.abs(u);if(!this.discontinuities[o]||this.discontinuities[o].accuracy>c){var d=void 0;d=u<0?n.start-Fi(t,e.mediaIndex,s):n.end+Fi(t,e.mediaIndex+1,s),this.discontinuities[o]={time:d,accuracy:c}}}}}]),r}(),af=new $l("./decrypter-worker.worker.js",function(i,r){var e,t,n,a,s,o,u,c,d=this;e=function(p,g){if(!(p instanceof g))throw new TypeError("Cannot call a class as a function")},t=function(){function p(g,y){for(var b=0;b<y.length;b++){var T=y[b];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(g,T.key,T)}}return function(g,y,b){return y&&p(g.prototype,y),b&&p(g,b),g}}(),n=null,a=function(){function p(g){e(this,p),n||(n=function(){var q=[[[],[],[],[],[]],[[],[],[],[],[]]],H=q[0],R=q[1],G=H[4],ut=R[4],z=void 0,et=void 0,rt=void 0,lt=[],mt=[],J=void 0,vt=void 0,gt=void 0,he=void 0,te=void 0;for(z=0;z<256;z++)mt[(lt[z]=z<<1^283*(z>>7))^z]=z;for(et=rt=0;!G[et];et^=J||1,rt=mt[rt]||1)for(gt=(gt=rt^rt<<1^rt<<2^rt<<3^rt<<4)>>8^255>^99,te=16843009*lt[vt=lt[J=lt[ut[G[et]=gt]=et]]]^65537*vt^257*J^16843008*et,he=257*lt[gt]^16843008*gt,z=0;z<4;z++)H[z][et]=he=he<<24^he>>>8,R[z][gt]=te=te<<24^te>>>8;for(z=0;z<5;z++)H[z]=H[z].slice(0),R[z]=R[z].slice(0);return q}()),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 y=void 0,b=void 0,T=void 0,S=void 0,C=void 0,E=this._tables[0][4],U=this._tables[1],I=g.length,x=1;if(I!==4&&I!==6&&I!==8)throw new Error("Invalid aes key size");for(S=g.slice(0),C=[],this._key=[S,C],y=I;y<4*I+28;y++)T=S[y-1],(y%I==0||I===8&&y%I==4)&&(T=E[T>>>24]<<24^E[T>>16&255]<<16^E[T>>8&255]<<8^E[255&T],y%I==0&&(T=T<<8^T>>>24^x<<24,x=x<<1^283*(x>>7))),S[y]=S[y-I]^T;for(b=0;y;b++,y--)T=S[3&b?y:y-4],C[b]=y<=4||b<4?T:U[0][E[T>>>24]]^U[1][E[T>>16&255]]^U[2][E[T>>8&255]]^U[3][E[255&T]]}return p.prototype.decrypt=function(g,y,b,T,S,C){var E=this._key[1],U=g^E[0],I=T^E[1],x=b^E[2],q=y^E[3],H=void 0,R=void 0,G=void 0,ut=E.length/4-2,z=void 0,et=4,rt=this._tables[1],lt=rt[0],mt=rt[1],J=rt[2],vt=rt[3],gt=rt[4];for(z=0;z<ut;z++)H=lt[U>>>24]^mt[I>>16&255]^J[x>>8&255]^vt[255&q]^E[et],R=lt[I>>>24]^mt[x>>16&255]^J[q>>8&255]^vt[255&U]^E[et+1],G=lt[x>>>24]^mt[q>>16&255]^J[U>>8&255]^vt[255&I]^E[et+2],q=lt[q>>>24]^mt[U>>16&255]^J[I>>8&255]^vt[255&x]^E[et+3],et+=4,U=H,I=R,x=G;for(z=0;z<4;z++)S[(3&-z)+C]=gt[U>>>24]<<24^gt[I>>16&255]<<16^gt[x>>8&255]<<8^gt[255&q]^E[et++],H=U,U=I,I=x,x=q,q=H},p}(),s=function(){function p(){e(this,p),this.listeners={}}return p.prototype.on=function(g,y){this.listeners[g]||(this.listeners[g]=[]),this.listeners[g].push(y)},p.prototype.off=function(g,y){if(!this.listeners[g])return!1;var b=this.listeners[g].indexOf(y);return this.listeners[g].splice(b,1),-1<b},p.prototype.trigger=function(g){var y=this.listeners[g];if(y)if(arguments.length===2)for(var b=y.length,T=0;T<b;++T)y[T].call(this,arguments[1]);else for(var S=Array.prototype.slice.call(arguments,1),C=y.length,E=0;E<C;++E)y[E].apply(this,S)},p.prototype.dispose=function(){this.listeners={}},p.prototype.pipe=function(g){this.on("data",function(y){g.push(y)})},p}(),o=function(p){function g(){e(this,g);var y=function(b,T){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!T||typeof T!="object"&&typeof T!="function"?b:T}(this,p.call(this,s));return y.jobs=[],y.delay=1,y.timeout_=null,y}return function(y,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);y.prototype=Object.create(b&&b.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(y,b):y.__proto__=b)}(g,p),g.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},g.prototype.push=function(y){this.jobs.push(y),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},g}(s),u=function(p){return p<<24|(65280&p)<<8|(16711680&p)>>8|p>>>24},c=function(){function p(g,y,b,T){e(this,p);var S=p.STEP,C=new Int32Array(g.buffer),E=new Uint8Array(g.byteLength),U=0;for(this.asyncStream_=new o,this.asyncStream_.push(this.decryptChunk_(C.subarray(U,U+S),y,b,E)),U=S;U<C.length;U+=S)b=new Uint32Array([u(C[U-4]),u(C[U-3]),u(C[U-2]),u(C[U-1])]),this.asyncStream_.push(this.decryptChunk_(C.subarray(U,U+S),y,b,E));this.asyncStream_.push(function(){var I;T(null,(I=E).subarray(0,I.byteLength-I[I.byteLength-1]))})}return p.prototype.decryptChunk_=function(g,y,b,T){return function(){var S=function(C,E,U){var I=new Int32Array(C.buffer,C.byteOffset,C.byteLength>>2),x=new a(Array.prototype.slice.call(E)),q=new Uint8Array(C.byteLength),H=new Int32Array(q.buffer),R=void 0,G=void 0,ut=void 0,z=void 0,et=void 0,rt=void 0,lt=void 0,mt=void 0,J=void 0;for(R=U[0],G=U[1],ut=U[2],z=U[3],J=0;J<I.length;J+=4)et=u(I[J]),rt=u(I[J+1]),lt=u(I[J+2]),mt=u(I[J+3]),x.decrypt(et,rt,lt,mt,H,J),H[J]=u(H[J]^R),H[J+1]=u(H[J+1]^G),H[J+2]=u(H[J+2]^ut),H[J+3]=u(H[J+3]^z),R=et,G=rt,ut=lt,z=mt;return q}(g,y,b);T.set(S,g.byteOffset)}},t(p,null,[{key:"STEP",get:function(){return 32e3}}]),p}(),new function(p){p.onmessage=function(g){var y=g.data,b=new Uint8Array(y.encrypted.bytes,y.encrypted.byteOffset,y.encrypted.byteLength),T=new Uint32Array(y.key.bytes,y.key.byteOffset,y.key.byteLength/4),S=new Uint32Array(y.iv.bytes,y.iv.byteOffset,y.iv.byteLength/4);new c(b,T,S,function(C,E){var U,I;p.postMessage((U={source:y.source,decrypted:E},I={},Object.keys(U).forEach(function(x){var q=U[x];ArrayBuffer.isView(q)?I[x]={bytes:q.buffer,byteOffset:q.byteOffset,byteLength:q.byteLength}:I[x]=q}),I),[E.buffer])})}}(d)}),Vn=function(i,r){i.abort(),i.pause(),r&&r.activePlaylistLoader&&(r.activePlaylistLoader.pause(),r.activePlaylistLoader=null)},yc=function(i,r){(r.activePlaylistLoader=i).load()},Hn={AUDIO:function(i,r){return function(){var e=r.segmentLoaders[i],t=r.mediaTypes[i],n=r.blacklistCurrentPlaylist;Vn(e,t);var a=t.activeTrack(),s=t.activeGroup(),o=(s.filter(function(d){return d.default})[0]||s[0]).id,u=t.tracks[o];if(a!==u){for(var c in O.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),t.tracks)t.tracks[c].enabled=t.tracks[c]===u;t.onTrackChanged()}else n({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(i,r){return function(){var e=r.segmentLoaders[i],t=r.mediaTypes[i];O.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Vn(e,t);var n=t.activeTrack();n&&(n.mode="disabled"),t.onTrackChanged()}}},vc={AUDIO:function(i,r,e){if(r){var t=e.tech,n=e.requestOptions,a=e.segmentLoaders[i];r.on("loadedmetadata",function(){var s=r.media();a.playlist(s,n),(!t.paused()||s.endList&&t.preload()!=="none")&&a.load()}),r.on("loadedplaylist",function(){a.playlist(r.media(),n),t.paused()||a.load()}),r.on("error",Hn[i](i,e))}},SUBTITLES:function(i,r,e){var t=e.tech,n=e.requestOptions,a=e.segmentLoaders[i],s=e.mediaTypes[i];r.on("loadedmetadata",function(){var o=r.media();a.playlist(o,n),a.track(s.activeTrack()),(!t.paused()||o.endList&&t.preload()!=="none")&&a.load()}),r.on("loadedplaylist",function(){a.playlist(r.media(),n),t.paused()||a.load()}),r.on("error",Hn[i](i,e))}},sf=function(i,r){return function(e){return e.attributes[i]===r}},of=function(i){return function(r){return r.resolvedUri===i}},uf={AUDIO:function(i,r){var e,t,n=r.hls,a=r.sourceType,s=r.segmentLoaders[i],o=r.requestOptions.withCredentials,u=r.master,c=u.mediaGroups,d=u.playlists,p=r.mediaTypes[i],g=p.groups,y=p.tracks,b=r.masterPlaylistLoader;for(var T in c[i]&&Object.keys(c[i]).length!==0||(c[i]={main:{default:{default:!0}}}),c[i]){g[T]||(g[T]=[]);var S=d.filter(sf(i,T));for(var C in c[i][T]){var E=c[i][T][C];S.filter(of(E.resolvedUri)).length&&delete E.resolvedUri;var U=void 0;if(U=E.resolvedUri?new Bn(E.resolvedUri,n,o):E.playlists&&a==="dash"?new Wa(E.playlists[0],n,o,b):null,E=O.mergeOptions({id:C,playlistLoader:U},E),vc[i](i,E.playlistLoader,r),g[T].push(E),typeof y[C]=="undefined"){var I=new O.AudioTrack({id:C,kind:(e=E,t=void 0,t=e.default?"main":"alternative",e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")&&(t="main-desc"),t),enabled:!1,language:E.language,default:E.default,label:C});y[C]=I}}}s.on("error",Hn[i](i,r))},SUBTITLES:function(i,r){var e=r.tech,t=r.hls,n=r.sourceType,a=r.segmentLoaders[i],s=r.requestOptions.withCredentials,o=r.master.mediaGroups,u=r.mediaTypes[i],c=u.groups,d=u.tracks,p=r.masterPlaylistLoader;for(var g in o[i])for(var y in c[g]||(c[g]=[]),o[i][g])if(!o[i][g][y].forced){var b=o[i][g][y],T=void 0;if(n==="hls"?T=new Bn(b.resolvedUri,t,s):n==="dash"&&(T=new Wa(b.playlists[0],t,s,p)),b=O.mergeOptions({id:y,playlistLoader:T},b),vc[i](i,b.playlistLoader,r),c[g].push(b),typeof d[y]=="undefined"){var S=e.addRemoteTextTrack({id:y,kind:"subtitles",default:b.default&&b.autoselect,language:b.language,label:y},!1).track;d[y]=S}}a.on("error",Hn[i](i,r))},"CLOSED-CAPTIONS":function(i,r){var e=r.tech,t=r.master.mediaGroups,n=r.mediaTypes[i],a=n.groups,s=n.tracks;for(var o in t[i])for(var u in a[o]||(a[o]=[]),t[i][o]){var c=t[i][o][u];if(c.instreamId.match(/CC\d/)&&(a[o].push(O.mergeOptions({id:u},c)),typeof s[u]=="undefined")){var d=e.addRemoteTextTrack({id:c.instreamId,kind:"captions",default:c.default&&c.autoselect,language:c.language,label:u},!1).track;s[u]=d}}}},lf={AUDIO:function(i,r){return function(){var e=r.mediaTypes[i].tracks;for(var t in e)if(e[t].enabled)return e[t];return null}},SUBTITLES:function(i,r){return function(){var e=r.mediaTypes[i].tracks;for(var t in e)if(e[t].mode==="showing")return e[t];return null}}},cf=function(i){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(c){uf[c](c,i)});var r=i.mediaTypes,e=i.masterPlaylistLoader,t=i.tech,n=i.hls;["AUDIO","SUBTITLES"].forEach(function(c){var d,p,g,y,b,T;r[c].activeGroup=(d=c,p=i,function(S){var C=p.masterPlaylistLoader,E=p.mediaTypes[d].groups,U=C.media();if(!U)return null;var I=null;return U.attributes[d]&&(I=E[U.attributes[d]]),I=I||E.main,typeof S=="undefined"?I:S===null?null:I.filter(function(x){return x.id===S.id})[0]||null}),r[c].activeTrack=lf[c](c,i),r[c].onGroupChanged=(g=c,y=i,function(){var S=y.segmentLoaders,C=S[g],E=S.main,U=y.mediaTypes[g],I=U.activeTrack(),x=U.activeGroup(I),q=U.activePlaylistLoader;Vn(C,U),x&&(x.playlistLoader?(C.resyncLoader(),yc(x.playlistLoader,U)):q&&E.resetEverything())}),r[c].onTrackChanged=(b=c,T=i,function(){var S=T.segmentLoaders,C=S[b],E=S.main,U=T.mediaTypes[b],I=U.activeTrack(),x=U.activeGroup(I),q=U.activePlaylistLoader;Vn(C,U),x&&(x.playlistLoader?(q!==x.playlistLoader&&(C.track&&C.track(I),C.resetEverything()),yc(x.playlistLoader,U)):E.resetEverything())})});var a=r.AUDIO.activeGroup(),s=(a.filter(function(c){return c.default})[0]||a[0]).id;r.AUDIO.tracks[s].enabled=!0,r.AUDIO.onTrackChanged(),e.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(c){return r[c].onGroupChanged()})});var o=function(){r.AUDIO.onTrackChanged(),t.trigger({type:"usage",name:"hls-audio-change"})};for(var u in t.audioTracks().addEventListener("change",o),t.remoteTextTracks().addEventListener("change",r.SUBTITLES.onTrackChanged),n.on("dispose",function(){t.audioTracks().removeEventListener("change",o),t.remoteTextTracks().removeEventListener("change",r.SUBTITLES.onTrackChanged)}),t.clearTracks("audio"),r.AUDIO.tracks)t.audioTracks().addTrack(r.AUDIO.tracks[u])},ke=void 0,hf=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],df=function(i){function r(e){Gt(this,r);var t,n=se(this,(r.__proto__||Object.getPrototypeOf(r)).call(this)),a=e.url,s=e.withCredentials,o=e.tech,u=e.bandwidth,c=e.externHls,d=e.useCueTags,p=e.blacklistDuration,g=e.enableLowInitialPlaylist,y=e.sourceType,b=e.seekTo;if(!a)throw new Error("A non-empty playlist URL is required");ke=c,n.withCredentials=s,n.tech_=o,n.hls_=o.hls,n.seekTo_=b,n.sourceType_=y,n.useCueTags_=d,n.blacklistDuration=p,n.enableLowInitialPlaylist=g,n.useCueTags_&&(n.cueTagsTrack_=n.tech_.addTextTrack("metadata","ad-cues"),n.cueTagsTrack_.inBandMetadataTrackDispatchType=""),n.requestOptions_={withCredentials:n.withCredentials,timeout:null},n.mediaTypes_=(t={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(S){t[S]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Wi,activeTrack:Wi,onGroupChanged:Wi,onTrackChanged:Wi}}),t),n.mediaSource=new O.MediaSource,n.mediaSource.addEventListener("sourceopen",n.handleSourceOpen_.bind(n)),n.seekable_=O.createTimeRanges(),n.hasPlayed_=function(){return!1},n.syncController_=new rf(e),n.segmentMetadataTrack_=o.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,n.decrypter_=new af,n.inbandTextTracks_={};var T={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_};return n.masterPlaylistLoader_=n.sourceType_==="dash"?new Wa(a,n.hls_,n.withCredentials):new Bn(a,n.hls_,n.withCredentials),n.setupMasterPlaylistLoaderListeners_(),n.mainSegmentLoader_=new Ya(O.mergeOptions(T,{segmentMetadataTrack:n.segmentMetadataTrack_,loaderType:"main"}),e),n.audioSegmentLoader_=new Ya(O.mergeOptions(T,{loaderType:"audio"}),e),n.subtitleSegmentLoader_=new tf(O.mergeOptions(T,{loaderType:"vtt"}),e),n.setupSegmentLoaderListeners_(),hf.forEach(function(S){n[S+"_"]=function(C){return this.audioSegmentLoader_[C]+this.mainSegmentLoader_[C]}.bind(n,S)}),n.logger_=zi("MPC"),n.masterPlaylistLoader_.load(),n}return ce(r,O.EventTarget),Zt(r,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var t=e.masterPlaylistLoader_.media(),n=1.5*e.masterPlaylistLoader_.targetDuration*1e3;Na(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=n,t.endList&&e.tech_.preload()!=="none"&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),cf({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(a){return O.log.warn("Failed to create SourceBuffers",a),e.mediaSource.endOfStream("decode")}e.setupFirstPlay(),e.trigger("selectedinitialmedia")}),this.masterPlaylistLoader_.on("loadedplaylist",function(){var t=e.masterPlaylistLoader_.media();if(!t){e.excludeUnsupportedVariants_();var n=void 0;return e.enableLowInitialPlaylist&&(n=e.selectInitialPlaylist()),n||(n=e.selectPlaylist()),e.initialMedia_=n,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 a=function(){var s=e.seekable();s.length!==0&&e.mediaSource.addSeekableRange_(s.start(0),s.end(0))};e.duration()!==1/0?e.tech_.one("durationchange",function s(){e.duration()===1/0?a():e.tech_.one("durationchange",s)}):a()}}),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(),n=1.5*e.masterPlaylistLoader_.targetDuration*1e3;Na(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=n,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 n=e.mediaGroups||{},a=!0,s=Object.keys(n.AUDIO);for(var o in n.AUDIO)for(var u in n.AUDIO[o])n.AUDIO[o][u].uri||(a=!1);a&&this.tech_.trigger({type:"usage",name:"hls-demuxed"}),Object.keys(n.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"}),ke.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"hls-aes"}),ke.Playlist.isFmp4(t)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"}),s.length&&1<Object.keys(n.AUDIO[s[0]]).length&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var e=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){var t=e.selectPlaylist(),n=e.masterPlaylistLoader_.media(),a=e.tech_.buffered(),s=a.length?a.end(a.length-1)-e.tech_.currentTime():0,o=e.bufferLowWaterLine();(!n.endList||e.duration()<Nt.MAX_BUFFER_LOW_WATER_LINE||t.attributes.BANDWIDTH<n.attributes.BANDWIDTH||o<=s)&&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(){O.browser.IE_VERSION||O.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.seekTo_(0),this.hasPlayed_()&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.seekTo_(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 n=this.seekable();if(!n.length)return!1;if(O.browser.IE_VERSION&&this.tech_.readyState()===0)return this.tech_.one("loadedmetadata",function(){e.trigger("firstplay"),e.seekTo_(n.end(0)),e.hasPlayed_=function(){return!0}}),!1;this.trigger("firstplay"),this.seekTo_(n.end(0))}return this.hasPlayed_=function(){return!0},this.load(),!0}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(t){return O.log.warn("Failed to create Source Buffers",t),this.mediaSource.endOfStream("decode")}if(this.tech_.autoplay()){var e=this.tech_.play();typeof e!="undefined"&&typeof e.then=="function"&&e.then(null,function(t){})}this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var e=this.mainSegmentLoader_.ended_;this.mediaTypes_.AUDIO.activePlaylistLoader&&(e=!this.mainSegmentLoader_.startingMedia_||this.mainSegmentLoader_.startingMedia_.containsVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_),e&&this.mediaSource.endOfStream()}},{key:"stuckAtPlaylistEnd_",value:function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.mediaSource.duration);if(t===null)return!1;var n=ke.Playlist.playlistEnd(e,t),a=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return n-a<=.1;var o=s.end(s.length-1);return o-a<=.1&&n-o<=.1}},{key:"blacklistCurrentPlaylist",value:function(){var e,t=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},n=arguments[1],a=void 0;if(a=t.playlist||this.masterPlaylistLoader_.media(),n=n||t.blacklistDuration||this.blacklistDuration,!a){this.error=t;try{return this.mediaSource.endOfStream("network")}catch(o){return this.trigger("error")}}var s=this.masterPlaylistLoader_.master.playlists.filter(Nn).length===1;return s?(O.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the final playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(s)):(a.excludeUntil=Date.now()+1e3*n,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),e=this.selectPlaylist(),O.log.warn("Problem encountered with the current HLS playlist."+(t.message?" "+t.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(e))}},{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=Wl(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:ke.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var e=void 0,t=void 0;if(this.masterPlaylistLoader_){var n=this.masterPlaylistLoader_.media();if(n){var a=this.syncController_.getExpiredTime(n,this.mediaSource.duration);if(a!==null&&(e=ke.Playlist.seekable(n,a)).length!==0){if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(n=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),(a=this.syncController_.getExpiredTime(n,this.mediaSource.duration))===null||(t=ke.Playlist.seekable(n,a)).length===0))return;t?t.start(0)>e.end(0)||e.start(0)>t.end(0)?this.seekable_=e:this.seekable_=O.createTimeRanges([[t.start(0)>e.start(0)?t.start(0):e.start(0),t.end(0)<e.end(0)?t.end(0):e.end(0)]]):this.seekable_=e,this.logger_("seekable updated ["+ja(this.seekable_)+"]"),this.tech_.trigger("seekablechanged")}}}}},{key:"updateDuration",value:function(){var e=this,t=this.mediaSource.duration,n=ke.Playlist.duration(this.masterPlaylistLoader_.media()),a=this.tech_.buffered(),s=function o(){e.mediaSource.duration=n,e.tech_.trigger("durationchange"),e.mediaSource.removeEventListener("sourceopen",o)};0<a.length&&(n=Math.max(n,a.end(a.length-1))),t!==n&&(this.mediaSource.readyState!=="open"?this.mediaSource.addEventListener("sourceopen",s):s())}},{key:"dispose",value:function(){var e=this;this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),["AUDIO","SUBTITLES"].forEach(function(t){var n=e.mediaTypes_[t].groups;for(var a in n)n[a].forEach(function(s){s.playlistLoader&&s.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var e,t=this.masterPlaylistLoader_.media();if(t&&this.mediaSource.readyState==="open"){if((e=Gp(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=1<e.length&&e[0].indexOf(",")===-1&&e[0]!==e[1]?new O.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){e.attributes.CODECS&&A.MediaSource&&A.MediaSource.isTypeSupported&&!A.MediaSource.isTypeSupported('video/mp4; codecs="'+e.attributes.CODECS.replace(/avc1\.(\d+)\.(\d+)/i,function(t){return tc([t])[0]})+'"')&&(e.excludeUntil=1/0)})}},{key:"excludeIncompatibleVariants_",value:function(e){var t=2,n=null,a=void 0;e.attributes.CODECS&&(a=Hi(e.attributes.CODECS),n=a.videoCodec,t=a.codecCount),this.master().playlists.forEach(function(s){var o={codecCount:2,videoCodec:null};s.attributes.CODECS&&(o=Hi(s.attributes.CODECS)),o.codecCount!==t&&(s.excludeUntil=1/0),o.videoCodec!==n&&(s.excludeUntil=1/0)})}},{key:"updateAdCues_",value:function(e){var t=0,n=this.seekable();n.length&&(t=n.start(0)),function(a,s){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:0;if(a.segments)for(var u=o,c=void 0,d=0;d<a.segments.length;d++){var p=a.segments[d];if(c||(c=ef(s,u+p.duration/2)),c){if("cueIn"in p){c.endTime=u,c.adEndTime=u,u+=p.duration,c=null;continue}if(u<c.endTime){u+=p.duration;continue}c.endTime+=p.duration}else if("cueOut"in p&&((c=new A.VTTCue(u,u+p.duration,p.cueOut)).adStartTime=u,c.adEndTime=u+parseFloat(p.cueOut),s.addCue(c)),"cueOutCont"in p){var g,y,b=p.cueOutCont.split("/").map(parseFloat),T=Pp(b,2);g=T[0],y=T[1],(c=new A.VTTCue(u,u+p.duration,"")).adStartTime=u-g,c.adEndTime=c.adStartTime+y,s.addCue(c)}u+=p.duration}}(e,this.cueTagsTrack_,t)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=Nt.GOAL_BUFFER_LENGTH,n=Nt.GOAL_BUFFER_LENGTH_RATE,a=Math.max(t,Nt.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*n,a)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=Nt.BUFFER_LOW_WATER_LINE,n=Nt.BUFFER_LOW_WATER_LINE_RATE,a=Math.max(t,Nt.MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*n,a)}}]),r}(),pf=function i(r,e,t){Gt(this,i);var n,a,s,o=r.masterPlaylistController_,u=o[(r.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(o);if(e.attributes.RESOLUTION){var c=e.attributes.RESOLUTION;this.width=c.width,this.height=c.height}this.bandwidth=e.attributes.BANDWIDTH,this.id=t,this.enabled=(n=r.playlists,a=e.uri,s=u,function(d){var p=n.master.playlists[a],g=Ba(p),y=Nn(p);return typeof d=="undefined"?y:(d?delete p.disabled:p.disabled=!0,d===y||g||(s(),d?n.trigger("renditionenabled"):n.trigger("renditiondisabled")),d)})},_c=["seeking","seeked","pause","playing","error"],ff=function(){function i(r){var e=this;Gt(this,i),this.tech_=r.tech,this.seekable=r.seekable,this.seekTo=r.seekTo,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=zi("PlaybackWatcher"),this.logger_("initialize");var t=function(){return e.monitorCurrentTime_()},n=function(){return e.techWaiting_()},a=function(){return e.cancelTimer_()},s=function(){return e.fixesBadSeeks_()};this.tech_.on("seekablechanged",s),this.tech_.on("waiting",n),this.tech_.on(_c,a),this.tech_.on("canplay",t),this.dispose=function(){e.logger_("dispose"),e.tech_.off("seekablechanged",s),e.tech_.off("waiting",n),e.tech_.off(_c,a),e.tech_.off("canplay",t),e.checkCurrentTimeTimeout_&&A.clearTimeout(e.checkCurrentTimeTimeout_),e.cancelTimer_()}}return Zt(i,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&A.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=A.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 r=this.tech_.currentTime(),e=this.tech_.buffered();if(this.lastRecordedTime===r&&(!e.length||r+.1>=e.end(e.length-1)))return this.techWaiting_();5<=this.consecutiveUpdates&&r===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):r===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=r)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var r=this.tech_.seeking(),e=this.seekable(),t=this.tech_.currentTime(),n=void 0;return r&&this.afterSeekableWindow_(e,t)&&(n=e.end(e.length-1)),r&&this.beforeSeekableWindow_(e,t)&&(n=e.start(0)+.1),typeof n!="undefined"&&(this.logger_("Trying to seek outside of seekable at time "+t+" with seekable range "+ja(e)+". Seeking to "+n+"."),this.seekTo(n),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var r=this.tech_.currentTime(),e=this.tech_.buffered(),t=Wl(e,r);return t.length&&r+3<=t.end(0)?(this.cancelTimer_(),this.seekTo(r),this.logger_("Stopped at "+r+" while inside a buffered region ["+t.start(0)+" -> "+t.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var r=this.seekable(),e=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_()||this.tech_.seeking()||this.timer_!==null)return!0;if(this.beforeSeekableWindow_(r,e)){var t=r.end(r.length-1);return this.logger_("Fell out of live window at time "+e+". Seeking to live point (seekable end) "+t),this.cancelTimer_(),this.seekTo(t),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.buffered(),a=Gl(n,e);if(this.videoUnderflow_(a,n,e))return this.cancelTimer_(),this.seekTo(e),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;if(0<a.length){var s=a.start(0)-e;return this.logger_("Stopped at "+e+", setting timer for "+s+", seeking to "+a.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,e),!0}return!1}},{key:"afterSeekableWindow_",value:function(r,e){return!!r.length&&e>r.end(r.length-1)+.1}},{key:"beforeSeekableWindow_",value:function(r,e){return!!(r.length&&0<r.start(0)&&e<r.start(0)-.1)}},{key:"videoUnderflow_",value:function(r,e,t){if(r.length===0){var n=this.gapFromVideoUnderflow_(e,t);if(n)return this.logger_("Encountered a gap in video from "+n.start+" to "+n.end+". Seeking to current time "+t),!0}return!1}},{key:"skipTheGap_",value:function(r){var e=this.tech_.buffered(),t=this.tech_.currentTime(),n=Gl(e,t);this.cancelTimer_(),n.length!==0&&t===r&&(this.logger_("skipTheGap_:","currentTime:",t,"scheduled currentTime:",r,"nextRange start:",n.start(0)),this.seekTo(n.start(0)+Vi),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(r,e){for(var t=function(o){if(o.length<2)return O.createTimeRanges();for(var u=[],c=1;c<o.length;c++){var d=o.end(c-1),p=o.start(c);u.push([d,p])}return O.createTimeRanges(u)}(r),n=0;n<t.length;n++){var a=t.start(n),s=t.end(n);if(e-a<4&&2<e-a)return{start:a,end:s}}return null}}]),i}(),mf={errorInterval:30,getSource:function(i){return i(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}},bc=function(i){(function r(e,t){var n=0,a=0,s=O.mergeOptions(mf,t);e.ready(function(){e.trigger({type:"usage",name:"hls-error-reload-initialized"})});var o=function(){a&&e.currentTime(a)},u=function(p){p!=null&&(a=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",o),e.src(p),e.trigger({type:"usage",name:"hls-error-reload"}),e.play())},c=function(){if(Date.now()-n<1e3*s.errorInterval)e.trigger({type:"usage",name:"hls-error-reload-canceled"});else{if(s.getSource&&typeof s.getSource=="function")return n=Date.now(),s.getSource.call(e,u);O.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},d=function p(){e.off("loadedmetadata",o),e.off("error",c),e.off("dispose",p)};e.on("error",c),e.on("dispose",d),e.reloadSourceOnError=function(p){d(),r(e,p)}})(this,i)};O.use("*",function(i){return{setSource:function(r,e){e(null,r)},setCurrentTime:function(r){return i.vhs&&i.currentSource().src===i.vhs.source_.src&&i.vhs.setCurrentTime(r),r},play:function(){i.vhs&&i.currentSource().src===i.vhs.source_.src&&i.vhs.setCurrentTime(i.currentTime())}}});var It={PlaylistLoader:Bn,Playlist:Bt,Decrypter:Op,AsyncStream:Cl,decrypt:El,utils:jp,STANDARD_PLAYLIST_SELECTOR:function(){return function(i,r,e,t,n){var a=i.playlists.map(function(E){var U,I;return U=E.attributes.RESOLUTION&&E.attributes.RESOLUTION.width,I=E.attributes.RESOLUTION&&E.attributes.RESOLUTION.height,{bandwidth:E.attributes.BANDWIDTH||A.Number.MAX_VALUE,width:U,height:I,playlist:E}});Gi(a,function(E,U){return E.bandwidth-U.bandwidth});var s=(a=a.filter(function(E){return!Bt.isIncompatible(E.playlist)})).filter(function(E){return Bt.isEnabled(E.playlist)});s.length||(s=a.filter(function(E){return!Bt.isDisabled(E.playlist)}));var o=s.filter(function(E){return E.bandwidth*Nt.BANDWIDTH_VARIANCE<r}),u=o[o.length-1],c=o.filter(function(E){return E.bandwidth===u.bandwidth})[0];if(n===!1){var d=c||s[0]||a[0];return d?d.playlist:null}var p=o.filter(function(E){return E.width&&E.height});Gi(p,function(E,U){return E.width-U.width});var g=p.filter(function(E){return E.width===e&&E.height===t});u=g[g.length-1];var y=g.filter(function(E){return E.bandwidth===u.bandwidth})[0],b=void 0,T=void 0,S=void 0;y||(T=(b=p.filter(function(E){return E.width>e||E.height>t})).filter(function(E){return E.width===b[0].width&&E.height===b[0].height}),u=T[T.length-1],S=T.filter(function(E){return E.bandwidth===u.bandwidth})[0]);var C=S||y||c||s[0]||a[0];return C?C.playlist:null}(this.playlists.master,this.systemBandwidth,parseInt(hc(this.tech_.el(),"width"),10),parseInt(hc(this.tech_.el(),"height"),10),this.limitRenditionByPlayerDimensions)},INITIAL_PLAYLIST_SELECTOR:function(){var i=this.playlists.master.playlists.filter(Bt.isEnabled);return Gi(i,function(r,e){return Xa(r,e)}),i.filter(function(r){return Hi(r.attributes.CODECS).videoCodec})[0]||null},comparePlaylistBandwidth:Xa,comparePlaylistResolution:function(i,r){var e=void 0,t=void 0;return i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(e=i.attributes.RESOLUTION.width),e=e||A.Number.MAX_VALUE,r.attributes.RESOLUTION&&r.attributes.RESOLUTION.width&&(t=r.attributes.RESOLUTION.width),e===(t=t||A.Number.MAX_VALUE)&&i.attributes.BANDWIDTH&&r.attributes.BANDWIDTH?i.attributes.BANDWIDTH-r.attributes.BANDWIDTH:e-t},xhr:jl()};["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(i){Object.defineProperty(It,i,{get:function(){return O.log.warn("using Hls."+i+" is UNSAFE be sure you know what you are doing"),Nt[i]},set:function(r){O.log.warn("using Hls."+i+" is UNSAFE be sure you know what you are doing"),typeof r!="number"||r<0?O.log.warn("value of Hls."+i+" must be greater than or equal to 0"):Nt[i]=r}})});var Tc="videojs-vhs",Sc=function(i){return/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(i)?"hls":/^application\/dash\+xml/i.test(i)?"dash":null},kc=function(i,r){for(var e=r.media(),t=-1,n=0;n<i.length;n++)if(i[n].id===e.uri){t=n;break}i.selectedIndex_=t,i.trigger({selectedIndex:t,type:"change"})};It.canPlaySource=function(){return O.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var gf=function(i){if(i.options_.sourceType==="dash"){var r=O.players[i.tech_.options_.playerId];if(r.eme){var e=function(t,n,a){if(!t)return t;var s={};for(var o in t)s[o]={audioContentType:'audio/mp4; codecs="'+a.attributes.CODECS+'"',videoContentType:'video/mp4; codecs="'+n.attributes.CODECS+'"'},n.contentProtection&&n.contentProtection[o]&&n.contentProtection[o].pssh&&(s[o].pssh=n.contentProtection[o].pssh),typeof t[o]=="string"&&(s[o].url=t[o]);return O.mergeOptions(t,s)}(i.source_.keySystems,i.playlists.media(),i.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader.media());e&&(r.currentSource().keySystems=e,r.eme.initializeMediaKeys&&r.eme.initializeMediaKeys())}}},wc=function(){if(!window.localStorage)return null;var i=window.localStorage.getItem(Tc);if(!i)return null;try{return JSON.parse(i)}catch(r){return null}};It.supportsNativeHls=function(){var i=B.createElement("video");return O.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(r){return/maybe|probably/i.test(i.canPlayType(r))}):!1}(),It.supportsNativeDash=!!O.getTech("Html5").isSupported()&&/maybe|probably/i.test(B.createElement("video").canPlayType("application/dash+xml")),It.supportsTypeNatively=function(i){return i==="hls"?It.supportsNativeHls:i==="dash"&&It.supportsNativeDash},It.isSupported=function(){return O.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var yf=O.getComponent("Component"),Cc=function(i){function r(e,t,n){Gt(this,r);var a=se(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,t,n.hls));if(t.options_&&t.options_.playerId){var s=O(t.options_.playerId);s.hasOwnProperty("hls")||Object.defineProperty(s,"hls",{get:function(){return O.log.warn("player.hls is deprecated. Use player.tech().hls instead."),t.trigger({type:"usage",name:"hls-player-access"}),a},configurable:!0}),s.vhs=a,(s.dash=a).player_=s}if(a.tech_=t,a.source_=e,a.stats={},a.setOptions_(),a.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(a.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return a.on(B,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(o){var u=B.fullscreenElement||B.webkitFullscreenElement||B.mozFullScreenElement||B.msFullscreenElement;u&&u.contains(a.tech_.el())&&a.masterPlaylistController_.smoothQualityChange_()}),a.on(a.tech_,"seeking",function(){this.tech_.seeking()&&this.tech_.currentTime()===0&&this.tech_.player_.loop()&&this.setCurrentTime(0)}),a.on(a.tech_,"error",function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()}),a.on(a.tech_,"play",a.play),a}return ce(r,yf),Zt(r,[{key:"setOptions_",value:function(){var e=this;if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage!="undefined"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,typeof this.options_.blacklistDuration!="number"&&(this.options_.blacklistDuration=300),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){var t=wc();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"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Nt.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Nt.INITIAL_BANDWIDTH,["withCredentials","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange"].forEach(function(n){typeof e.source_[n]!="undefined"&&(e.options_[n]=e.source_[n])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions}},{key:"src",value:function(e,t){var n=this;e&&(this.setOptions_(),this.options_.url=this.source_.src,this.options_.tech=this.tech_,this.options_.externHls=It,this.options_.sourceType=Sc(t),this.options_.seekTo=function(a){n.tech_.setCurrentTime(a),n.setCurrentTime(a)},this.masterPlaylistController_=new df(this.options_),this.playbackWatcher_=new ff(O.mergeOptions(this.options_,{seekable:function(){return n.seekable()}})),this.masterPlaylistController_.on("error",function(){O.players[n.tech_.options_.playerId].error(n.masterPlaylistController_.error)}),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):It.STANDARD_PLAYLIST_SELECTOR.bind(this),this.masterPlaylistController_.selectInitialPlaylist=It.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(a){this.masterPlaylistController_.selectPlaylist=a.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(a){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=a,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(a){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=a,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var a=1/(this.bandwidth||1),s=void 0;return s=0<this.throughput?1/this.throughput:0,Math.floor(1/(a+s))},set:function(){O.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 n.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return n.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return n.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return n.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return n.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return n.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return n.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return n.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return Xl(n.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return n.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return n.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return n.tech_.name_},enumerable:!0},duration:{get:function(){return n.tech_.duration()},enumerable:!0},master:{get:function(){return n.playlists.master},enumerable:!0},playerDimensions:{get:function(){return n.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return Xl(n.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return n.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",function(){n.options_.useBandwidthFromLocalStorage&&function(a){if(!!window.localStorage){var s=wc();s=s?O.mergeOptions(s,a):a;try{window.localStorage.setItem(Tc,JSON.stringify(s))}catch(o){return}}}({bandwidth:n.bandwidth,throughput:Math.round(n.throughput)})}),this.masterPlaylistController_.on("selectedinitialmedia",function(){var a,s;s=(a=n).playlists,a.representations=function(){return s.master.playlists.filter(function(o){return!Ba(o)}).map(function(o,u){return new pf(a,o,o.uri)})},gf(n)}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.tech_.ready(function(){return n.setupQualityLevels_()}),this.tech_.el()&&this.tech_.src(O.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var e=this,t=O.players[this.tech_.options_.playerId];t&&t.qualityLevels&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){var n,a;n=e.qualityLevels_,(a=e).representations().forEach(function(s){n.addQualityLevel(s)}),kc(n,a.playlists)}),this.playlists.on("mediachange",function(){kc(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,n,a){t===null&&(t=Function.prototype);var s=Object.getOwnPropertyDescriptor(t,n);if(s===void 0){var o=Object.getPrototypeOf(t);return o===null?void 0:e(o,n,a)}if("value"in s)return s.value;var u=s.get;return u!==void 0?u.call(a):void 0}(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"dispose",this).call(this)}},{key:"convertToStreamTime",value:function(e,t){return Fp({playlist:this.masterPlaylistController_.media(),time:e,callback:t})}},{key:"seekToStreamTime",value:function(e,t){var n=!(2<arguments.length&&arguments[2]!==void 0)||arguments[2],a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:2;return Vp({streamTime:e,playlist:this.masterPlaylistController_.media(),retryCount:a,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}]),r}(),$a={name:"videojs-http-streaming",VERSION:"1.5.1",canHandleSource:function(i){var r=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},e=O.mergeOptions(O.options,r);return $a.canPlayType(i.type,e)},handleSource:function(i,r){var e=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},t=O.mergeOptions(O.options,e);return r.hls=new Cc(i,r,t),r.hls.xhr=jl(),r.hls.src(i.src,i.type),r.hls},canPlayType:function(i){var r=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},e=O.mergeOptions(O.options,r).hls.overrideNative,t=Sc(i);return t&&(!It.supportsTypeNatively(t)||e)?"maybe":""}};return typeof O.MediaSource!="undefined"&&typeof O.URL!="undefined"||(O.MediaSource=qi,O.URL=ac),qi.supportsNativeMediaSources()&&O.getTech("Html5").registerSourceHandler($a,0),O.HlsHandler=Cc,O.HlsSourceHandler=$a,O.Hls=It,O.use||O.registerComponent("Hls",It),O.options.hls=O.options.hls||{},O.registerPlugin?O.registerPlugin("reloadSourceOnError",bc):O.plugin("reloadSourceOnError",bc),O}),function(){(function(B){var A=B&&B.videojs;A&&(A.CDN_VERSION="7.4.1")})(window)}();
|