mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-12-01 04:34:30 +01:00
de5bd07a90
update video.js to 7.20.2
2 lines
567 KiB
JavaScript
2 lines
567 KiB
JavaScript
/*! For license information please see video.min.js.LICENSE.txt */
|
||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,(function(){"use strict";for(var e,t="7.20.2",i={},n=function(e,t){return i[e]=i[e]||[],t&&(i[e]=i[e].concat(t)),i[e]},r=function(e,t){return!((t=n(e).indexOf(t))<=-1||(i[e]=i[e].slice(),i[e].splice(t,1),0))},a={prefixed:!0},s=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],o=s[0],u=0;u<s.length;u++)if(s[u][1]in document){e=s[u];break}if(e){for(var l=0;l<e.length;l++)a[o[l]]=e[l];a.prefixed=e[0]!==o[0]}var c=[],d=function e(t){function i(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r("log",n,t)}var n="info",r=function(e,t){return function(i,n,r){var a,s=t.levels[n];n=new RegExp("^("+s+")$"),"log"!==i&&r.unshift(i.toUpperCase()+":"),r.unshift(e+":"),c&&(c.push([].concat(r)),a=c.length-1e3,c.splice(0,0<a?a:0)),!window.console||(a=(a=window.console[i])||"debug"!==i?a:window.console.info||window.console.log)&&s&&n.test(i)&&a[Array.isArray(r)?"apply":"call"](window.console,r)}}(t,i);return i.createLogger=function(i){return e(t+": "+i)},i.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},i.level=function(e){if("string"==typeof e){if(!i.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');n=e}return n},(i.history=function(){return c?[].concat(c):[]}).filter=function(e){return(c||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},i.history.clear=function(){c&&(c.length=0)},i.history.disable=function(){null!==c&&(c.length=0,c=null)},i.history.enable=function(){null===c&&(c=[])},i.error=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r("error",n,t)},i.warn=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r("warn",n,t)},i.debug=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r("debug",n,t)},i}("VIDEOJS"),h=d.createLogger,p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(e,t){return e(t={exports:{}},t.exports),t.exports}var m=f((function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,n=arguments[t];for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},t.apply(this,arguments)}e.exports=t})),g=Object.prototype.toString,y=function(e){return b(e)?Object.keys(e):[]};function v(e,t){y(e).forEach((function(i){return t(e[i],i)}))}function _(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return Object.assign?m.apply(void 0,[e].concat(i)):(i.forEach((function(t){t&&v(t,(function(t,i){e[i]=t}))})),e)}function b(e){return!!e&&"object"==typeof e}function T(e){return b(e)&&"[object Object]"===g.call(e)&&e.constructor===Object}function S(e,t){if(!e||!t)return"";if("function"!=typeof window.getComputedStyle)return"";var i;try{i=window.getComputedStyle(e)}catch(e){return""}return i?i.getPropertyValue(t)||i[t]:""}var w=window.navigator&&window.navigator.userAgent||"",E=(Ot=/AppleWebKit\/([\d.]+)/i.exec(w))?parseFloat(Ot.pop()):null,k=/iPod/i.test(w),C=(Mt=w.match(/OS (\d+)_/i))&&Mt[1]?Mt[1]:null,I=/Android/i.test(w),x=function(){var e=w.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),A=I&&x<5&&E<537,P=/Firefox/i.test(w),L=/Edg/i.test(w),D=!L&&(/Chrome/i.test(w)||/CriOS/i.test(w)),O=(jt=w.match(/(Chrome|CriOS)\/(\d+)/))&&jt[2]?parseFloat(jt[2]):null,M=ei=!(ei=(ei=/MSIE\s(\d+)\.\d/.exec(w))&&parseFloat(ei[1]))&&/Trident\/7.0/i.test(w)&&/rv:11.0/.test(w)?11:ei,R=/Safari/i.test(w)&&!D&&!I&&!L,N=/Windows/i.test(w),U=Boolean(G()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch)),B=/iPad/i.test(w)||R&&U&&!/iPhone/i.test(w),F=/iPhone/i.test(w)&&!B,j=F||B||k,H=(R||j)&&!D,q=Object.freeze({__proto__:null,IS_IPOD:k,IOS_VERSION:C,IS_ANDROID:I,ANDROID_VERSION:x,IS_NATIVE_ANDROID:A,IS_FIREFOX:P,IS_EDGE:L,IS_CHROME:D,CHROME_VERSION:O,IE_VERSION:M,IS_SAFARI:R,IS_WINDOWS:N,TOUCH_ENABLED:U,IS_IPAD:B,IS_IPHONE:F,IS_IOS:j,IS_ANY_SAFARI:H});function V(e){return"string"==typeof e&&Boolean(e.trim())}function W(e){if(0<=e.indexOf(" "))throw new Error("class has illegal whitespace characters")}function G(){return document===window.document}function z(e){return b(e)&&1===e.nodeType}function X(){try{return window.parent!==window.self}catch(e){return!0}}function K(e){return function(t,i){return V(t)?(i=z(i=V(i)?document.querySelector(i):i)?i:document)[e]&&i[e](t):document[e](null)}}function Y(e,t,i,n){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={});var r=document.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(d.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+i+"."),r.setAttribute(e,i)):"textContent"===e?Q(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),n&&me(r,n),r}function Q(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function $(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function J(e,t){return W(t),e.classList?e.classList.contains(t):new RegExp("(^|\\s)"+t+"($|\\s)").test(e.className)}function Z(e,t){return e.classList?e.classList.add(t):J(e,t)||(e.className=(e.className+" "+t).trim()),e}function ee(e,t){return e?(e.classList?e.classList.remove(t):(W(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e):(d.warn("removeClass was called with an element that doesn't exist"),null)}function te(e,t,i){var n=J(e,t);if((i="boolean"!=typeof(i="function"==typeof i?i(e,t):i)?!n:i)!==n)return(i?Z:ee)(e,t),e}function ie(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null==n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function ne(e){var t={};if(e&&e.attributes&&0<e.attributes.length)for(var i=e.attributes,n=i.length-1;0<=n;n--){var r=i[n].name,a=i[n].value;"boolean"!=typeof e[r]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+r+",")||(a=null!==a),t[r]=a}return t}function re(e,t){return e.getAttribute(t)}function ae(e,t,i){e.setAttribute(t,i)}function se(e,t){e.removeAttribute(t)}function oe(){document.body.focus(),document.onselectstart=function(){return!1}}function ue(){document.onselectstart=function(){return!0}}function le(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((function(e){void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(S(e,"height"))),i.width||(i.width=parseFloat(S(e,"width"))),i}}function ce(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,i=e.offsetHeight,n=0,r=0;e.offsetParent&&e!==document[a.fullscreenElement];)n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:n,top:r,width:t,height:i}}function de(e,t){var i={x:0,y:0};if(j)for(var n=e;n&&"html"!==n.nodeName.toLowerCase();){var r,a=S(n,"transform");/^matrix/.test(a)?(r=a.slice(7,-1).split(/,\s/).map(Number),i.x+=r[4],i.y+=r[5]):/^matrix3d/.test(a)&&(a=a.slice(9,-1).split(/,\s/).map(Number),i.x+=a[12],i.y+=a[13]),n=n.parentNode}var s={},o=ce(t.target),u=ce(e),l=u.width,c=u.height;return e=t.offsetY-(u.top-o.top),o=t.offsetX-(u.left-o.left),t.changedTouches&&(o=t.changedTouches[0].pageX-u.left,e=t.changedTouches[0].pageY+u.top,j&&(o-=i.x,e-=i.y)),s.y=1-Math.max(0,Math.min(1,e/c)),s.x=Math.max(0,Math.min(1,o/l)),s}function he(e){return b(e)&&3===e.nodeType}function pe(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function fe(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return z(e="function"==typeof e?e():e)||he(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0})).filter((function(e){return e}))}function me(e,t){return fe(t).forEach((function(t){return e.appendChild(t)})),e}function ge(e,t){return me(pe(e),t)}function ye(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}var ve,_e=K("querySelector"),be=K("querySelectorAll"),Te=Object.freeze({__proto__:null,isReal:G,isEl:z,isInFrame:X,createEl:Y,textContent:Q,prependTo:$,hasClass:J,addClass:Z,removeClass:ee,toggleClass:te,setAttributes:ie,getAttributes:ne,getAttribute:re,setAttribute:ae,removeAttribute:se,blockTextSelection:oe,unblockTextSelection:ue,getBoundingClientRect:le,findPosition:ce,getPointerPosition:de,isTextNode:he,emptyEl:pe,normalizeContent:fe,appendContent:me,insertContent:ge,isSingleLeftClick:ye,$:_e,$$:be}),Se=!1,we=function(){if(!1!==ve.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),i=Array.prototype.slice.call(document.getElementsByTagName("video-js")),n=e.concat(t,i);if(n&&0<n.length)for(var r=0,a=n.length;r<a;r++){var s=n[r];if(!s||!s.getAttribute){Ee(1);break}void 0===s.player&&null!==s.getAttribute("data-setup")&&ve(s)}else Se||Ee(1)}};function Ee(e,t){G()&&(t&&(ve=t),window.setTimeout(we,e))}function ke(){Se=!0,window.removeEventListener("load",ke)}function Ce(e){var t=document.createElement("style");return t.className=e,t}function Ie(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t}G()&&("complete"===document.readyState?ke():window.addEventListener("load",ke));var xe=3;window.WeakMap||(Zt=function(){function e(){this.vdata="vdata"+Math.floor(window.performance&&window.performance.now()||Date.now()),this.data={}}var t=e.prototype;return t.set=function(e,t){var i=e[this.vdata]||xe++;return e[this.vdata]||(e[this.vdata]=i),this.data[i]=t,this},t.get=function(e){var t=e[this.vdata];if(t)return this.data[t];d("We have no data for this element",e)},t.has=function(e){return e[this.vdata]in this.data},t.delete=function(e){var t=e[this.vdata];t&&(delete this.data[t],delete e[this.vdata])},e}());var Ae,Pe=new(window.WeakMap?WeakMap:Zt);function Le(e,t){var i;Pe.has(e)&&(0===(i=Pe.get(e)).handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&Pe.delete(e))}function De(e,t,i,n){i.forEach((function(i){e(t,i,n)}))}function Oe(e){if(e.fixed_)return e;function t(){return!0}function i(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){var n,r,a,s=e||window.event;for(n in e={},s)"layerX"!==n&&"layerY"!==n&&"keyLocation"!==n&&"webkitMovementX"!==n&&"webkitMovementY"!==n&&"path"!==n&&("returnValue"===n&&s.preventDefault||(e[n]=s[n]));e.target||(e.target=e.srcElement||document),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){s.preventDefault&&s.preventDefault(),e.returnValue=!1,s.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){s.stopPropagation&&s.stopPropagation(),e.cancelBubble=!0,s.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=i,e.stopImmediatePropagation=function(){s.stopImmediatePropagation&&s.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=i,null!==e.clientX&&void 0!==e.clientX&&(r=document.documentElement,a=document.body,e.pageX=e.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),e.pageY=e.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.clientTop||0)),e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}var Me=["touchstart","touchmove"];function Re(e,t,i){if(Array.isArray(t))return De(Re,e,t,i);Pe.has(e)||Pe.set(e,{});var n=Pe.get(e);n.handlers||(n.handlers={}),n.handlers[t]||(n.handlers[t]=[]),i.guid||(i.guid=xe++),n.handlers[t].push(i),n.dispatcher||(n.disabled=!1,n.dispatcher=function(t,i){if(!n.disabled){t=Oe(t);var r=n.handlers[t.type];if(r)for(var a=r.slice(0),s=0,o=a.length;s<o&&!t.isImmediatePropagationStopped();s++)try{a[s].call(e,t,i)}catch(t){d.error(t)}}}),1===n.handlers[t].length&&(e.addEventListener?(i=!1,function(){if("boolean"!=typeof Ae){Ae=!1;try{var e=Object.defineProperty({},"passive",{get:function(){Ae=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){}}return Ae}()&&-1<Me.indexOf(t)&&(i={passive:!0}),e.addEventListener(t,n.dispatcher,i)):e.attachEvent&&e.attachEvent("on"+t,n.dispatcher))}function Ne(e,t,i){if(Pe.has(e)){var n=Pe.get(e);if(n.handlers){if(Array.isArray(t))return De(Ne,e,t,i);var r=function(e,t){n.handlers[t]=[],Le(e,t)};if(void 0!==t){var a=n.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s<a.length;s++)a[s].guid===i.guid&&a.splice(s--,1);Le(e,t)}else r(e,t)}else for(var o in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},o)&&r(e,o)}}}function Ue(e,t,i){var n=Pe.has(e)?Pe.get(e):{},r=e.parentNode||e.ownerDocument;return"string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=Oe(t),n.dispatcher&&n.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles?Ue.call(null,r,t,i):!r&&!t.defaultPrevented&&t.target&&t.target[t.type]&&(Pe.has(t.target)||Pe.set(t.target,{}),r=Pe.get(t.target),t.target[t.type]&&(r.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),r.disabled=!1)),!t.defaultPrevented}function Be(e,t,i){if(Array.isArray(t))return De(Be,e,t,i);function n(){Ne(e,t,n),i.apply(this,arguments)}n.guid=i.guid=i.guid||xe++,Re(e,t,n)}function Fe(e,t,i){function n(){Ne(e,t,n),i.apply(this,arguments)}n.guid=i.guid=i.guid||xe++,Re(e,t,n)}function je(e,t,i){return t.guid||(t.guid=xe++),(e=t.bind(e)).guid=i?i+"_"+t.guid:t.guid,e}function He(e,t){var i=window.performance.now();return function(){var n=window.performance.now();t<=n-i&&(e.apply(void 0,arguments),i=n)}}function qe(){}var Ve,We=Object.freeze({__proto__:null,fixEvent:Oe,on:Re,off:Ne,trigger:Ue,one:Be,any:Fe});function Ge(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e)}function ze(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length}function Xe(e,t,i){if(!e||!e.nodeName&&!Je(e))throw new Error("Invalid target for "+Ge(t)+"#"+i+"; must be a DOM node or evented object.")}function Ke(e,t,i){if(!ze(e))throw new Error("Invalid event type for "+Ge(t)+"#"+i+"; must be a non-empty string or array.")}function Ye(e,t,i){if("function"!=typeof e)throw new Error("Invalid listener for "+Ge(t)+"#"+i+"; must be a function.")}function Qe(e,t,i){var n,r,a=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return t=a?(n=e.eventBusEl_,3<=t.length&&t.shift(),r=t[0],t[1]):(n=t[0],r=t[1],t[2]),Xe(n,e,i),Ke(r,e,i),Ye(t,e,i),{isTargetingSelf:a,target:n,type:r,listener:t=je(e,t)}}function $e(e,t,i,n){Xe(e,e,t),e.nodeName?We[t](e,i,n):e[t](i,n)}qe.prototype.allowedEvents_={},qe.prototype.addEventListener=qe.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Re(this,e,t),this.addEventListener=i},qe.prototype.removeEventListener=qe.prototype.off=function(e,t){Ne(this,e,t)},qe.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Be(this,e,t),this.addEventListener=i},qe.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Fe(this,e,t),this.addEventListener=i},qe.prototype.dispatchEvent=qe.prototype.trigger=function(e){var t=e.type||e;e=Oe(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Ue(this,e)},qe.prototype.queueTrigger=function(e){var t=this;Ve=Ve||new Map;var i=e.type||e,n=Ve.get(this);n||(n=new Map,Ve.set(this,n));var r=n.get(i);n.delete(i),window.clearTimeout(r),r=window.setTimeout((function(){0===n.size&&(n=null,Ve.delete(t)),t.trigger(e)}),0),n.set(i,r)};var Je=function(e){return e instanceof qe||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"==typeof e[t]}))},Ze={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r,a=Qe(this,i,"on"),s=a.isTargetingSelf,o=a.target,u=a.type,l=a.listener;$e(o,"on",u,l),s||((r=function(){return e.off(o,u,l)}).guid=l.guid,(s=function(){return e.off("dispose",r)}).guid=l.guid,$e(this,"on","dispose",r),$e(o,"on","dispose",s))},one:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Qe(this,i,"one"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;a?$e(s,"one",o,u):((a=function t(){e.off(s,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)}).guid=u.guid,$e(s,"one",o,a))},any:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Qe(this,i,"any"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;a?$e(s,"any",o,u):((a=function t(){e.off(s,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)}).guid=u.guid,$e(s,"any",o,a))},off:function(e,t,i){!e||ze(e)?Ne(this.eventBusEl_,e,t):(t=t,Xe(e=e,this,"off"),Ke(t,this,"off"),Ye(i,this,"off"),i=je(this,i),this.off("dispose",i),e.nodeName?(Ne(e,t,i),Ne(e,"dispose",i)):Je(e)&&(e.off(t,i),e.off("dispose",i)))},trigger:function(e,t){Xe(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(!ze(i)){if(i="Invalid event type for "+Ge(this)+"#trigger; must be a non-empty string or object with a type key that has a non-empty value.",!e)throw new Error(i);(this.log||d).error(i)}return Ue(this.eventBusEl_,e,t)}};function et(e,t){if(t=(t=void 0===t?{}:t).eventBusKey){if(!e[t].nodeName)throw new Error('The eventBusKey "'+t+'" does not refer to an element.');e.eventBusEl_=e[t]}else e.eventBusEl_=Y("span",{className:"vjs-event-bus"});return _(e,Ze),e.eventedCallbacks&&e.eventedCallbacks.forEach((function(e){e()})),e.on("dispose",(function(){e.off(),[e,e.el_,e.eventBusEl_].forEach((function(e){e&&Pe.has(e)&&Pe.delete(e)})),window.setTimeout((function(){e.eventBusEl_=null}),0)})),e}var tt={state:{},setState:function(e){var t,i=this;return v(e="function"==typeof e?e():e,(function(e,n){i.state[n]!==e&&((t=t||{})[n]={from:i.state[n],to:e}),i.state[n]=e})),t&&Je(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function it(e,t){return _(e,tt),e.state=_({},e.state,t),"function"==typeof e.handleStateChanged&&Je(e)&&e.on("statechanged",e.handleStateChanged),e}function nt(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toLowerCase()}))}function rt(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))}function at(){for(var e={},t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.forEach((function(t){t&&v(t,(function(t,i){T(t)?(T(e[i])||(e[i]={}),e[i]=at(e[i],t)):e[i]=t}))})),e}var st=window.Map||function(){function e(){this.map_={}}var t=e.prototype;return t.has=function(e){return e in this.map_},t.delete=function(e){var t=this.has(e);return delete this.map_[e],t},t.set=function(e,t){return this.map_[e]=t,this},t.forEach=function(e,t){for(var i in this.map_)e.call(t,this.map_[i],i,this)},e}(),ot=window.Set||function(){function e(){this.set_={}}var t=e.prototype;return t.has=function(e){return e in this.set_},t.delete=function(e){var t=this.has(e);return delete this.set_[e],t},t.add=function(e){return this.set_[e]=1,this},t.forEach=function(e,t){for(var i in this.set_)e.call(t,i,i,this)},e}(),ut=f((function(e,t){function i(e){if(!e||"object"!=typeof e||(t=e.which||e.keyCode||e.charCode)&&(e=t),"number"==typeof e)return o[e];var t=String(e);return(e=n[t.toLowerCase()])||((e=r[t.toLowerCase()])?e:1===t.length?t.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){if(e=n[t.toLowerCase()])return e===i;if(e=r[t.toLowerCase()])return e===i}else if("number"==typeof t)return t===i;return!1}};for(var n=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},a=97;a<123;a++)n[String.fromCharCode(a)]=a-32;for(a=48;a<58;a++)n[a-48]=a;for(a=1;a<13;a++)n["f"+a]=a+111;for(a=0;a<10;a++)n["numpad "+a]=a+96;var s,o=t.names=t.title={};for(a in n)o[n[a]]=a;for(s in r)n[s]=r[s]}));ut.code,ut.codes,ut.aliases,ut.names,ut.title;var lt=function(){function e(e,t,i){var n=this;!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=at({},this.options_),t=this.options_=at(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+xe++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach((function(e){return n.addClass(e)})),!1!==t.evented&&(et(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),it(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new ot,this.setIntervalIds_=new ot,this.rafIds_=new ot,this.namedRafs_=new st,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var t=e.prototype;return t.dispose=function(e){if(void 0===e&&(e={}),!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var t=this.children_.length-1;0<=t;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(e){return e&&(this.options_=at(this.options_,e)),this.options_},t.el=function(){return this.el_},t.createEl=function(e,t,i){return Y(e,t,i)},t.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n];return n=n&&n.split("-")[0],n=r&&r[n],i=i,a&&a[e]?i=a[e]:n&&n[e]&&(i=n[e]),t?i.replace(/\{(\d+)\}/g,(function(e,i){return void 0===(i=t[i-1])?e:i})):i},t.handleLanguagechange=function(){},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(e){return this.childIndex_[e]},t.getChild=function(e){if(e)return this.childNameIndex_[e]},t.getDescendant=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];t=t.reduce((function(e,t){return e.concat(t)}),[]);for(var n=this,r=0;r<t.length;r++)if(!(n=n.getChild(t[r]))||!n.getChild)return;return n},t.addChild=function(t,i,n){if(void 0===i&&(i={}),void 0===n&&(n=this.children_.length),"string"==typeof t){var r=rt(t),a=i.componentClass||r;i.name=r;var s=e.getComponent(a);if(!s)throw new Error("Component "+a+" does not exist");if("function"!=typeof s)return null;s=new s(this.player_||this,i)}else s=t;return s.parentComponent_&&s.parentComponent_.removeChild(s),this.children_.splice(n,0,s),s.parentComponent_=this,"function"==typeof s.id&&(this.childIndex_[s.id()]=s),(r=r||s.name&&rt(s.name()))&&(this.childNameIndex_[r]=s,this.childNameIndex_[nt(r)]=s),"function"==typeof s.el&&s.el()&&(r=null,this.children_[n+1]&&(this.children_[n+1].el_?r=this.children_[n+1].el_:z(this.children_[n+1])&&(r=this.children_[n+1])),this.contentEl().insertBefore(s.el(),r)),s},t.removeChild=function(e){if((e="string"==typeof e?this.getChild(e):e)&&this.children_){for(var t,i=!1,n=this.children_.length-1;0<=n;n--)if(this.children_[n]===e){i=!0,this.children_.splice(n,1);break}i&&(e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[rt(e.name())]=null,this.childNameIndex_[nt(e.name())]=null,(t=e.el())&&t.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el()))}},t.initChildren=function(){var t,i,n,r=this,a=this.options_.children;a&&(t=this.options_,i=e.getComponent("Tech"),(n=Array.isArray(a)?a:Object.keys(a)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((function(e){var t;return e="string"==typeof e?a[t=e]||r.options_[t]||{}:(t=e.name,e),{name:t,opts:e}})).filter((function(t){return(t=e.getComponent(t.opts.componentClass||rt(t.name)))&&!i.isTech(t)})).forEach((function(e){var i=e.name;e=e.opts,!1!==(e=void 0!==t[i]?t[i]:e)&&((e=!0===e?{}:e).playerOptions=r.options_.playerOptions,(e=r.addChild(i,e))&&(r[i]=e))})))},t.buildCSSClass=function(){return""},t.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout((function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0<e.length&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)},t.$=function(e,t){return _e(e,t||this.contentEl())},t.$$=function(e,t){return be(e,t||this.contentEl())},t.hasClass=function(e){return J(this.el_,e)},t.addClass=function(e){Z(this.el_,e)},t.removeClass=function(e){ee(this.el_,e)},t.toggleClass=function(e,t){te(this.el_,e,t)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(e){return re(this.el_,e)},t.setAttribute=function(e,t){ae(this.el_,e,t)},t.removeAttribute=function(e){se(this.el_,e)},t.width=function(e,t){return this.dimension("width",e,t)},t.height=function(e,t){return this.dimension("height",e,t)},t.dimensions=function(e,t){this.width(e,!0),this.height(t)},t.dimension=function(e,t,i){return void 0!==t?(-1!==(""+(t=null===t||t!=t?0:t)).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"))):this.el_?-1!==(i=(t=this.el_.style[e]).indexOf("px"))?parseInt(t.slice(0,i),10):parseInt(this.el_["offset"+rt(e)],10):0},t.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");return t=S(this.el_,e),0!==(t=parseFloat(t))&&!isNaN(t)||(e="offset"+rt(e),t=this.el_[e]),t},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(e){this.player_&&(ut.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))},t.handleKeyPress=function(e){this.handleKeyDown(e)},t.emitTapEvents=function(){var e,t=0,i=null;function n(){e=!1}this.on("touchstart",(function(n){1===n.touches.length&&(i={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=window.performance.now(),e=!0)})),this.on("touchmove",(function(t){var n;1<t.touches.length?e=!1:i&&(n=t.touches[0].pageX-i.pageX,t=t.touches[0].pageY-i.pageY,10<Math.sqrt(n*n+t*t)&&(e=!1))})),this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(n){!(i=null)===e&&window.performance.now()-t<200&&(n.preventDefault(),this.trigger("tap"))}))},t.enableTouchActivity=function(){var e,t,i;this.player()&&this.player().reportUserActivity&&(e=je(this.player(),this.player().reportUserActivity),this.on("touchstart",(function(){e(),this.clearInterval(t),t=this.setInterval(e,250)})),i=function(i){e(),this.clearInterval(t)},this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i))},t.setTimeout=function(e,t){var i,n=this;return e=je(this,e),this.clearTimersOnDispose_(),i=window.setTimeout((function(){n.setTimeoutIds_.has(i)&&n.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i},t.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e},t.setInterval=function(e,t){return e=je(this,e),this.clearTimersOnDispose_(),t=window.setInterval(e,t),this.setIntervalIds_.add(t),t},t.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e},t.requestAnimationFrame=function(e){var t,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=je(this,e),t=window.requestAnimationFrame((function(){i.rafIds_.has(t)&&i.rafIds_.delete(t),e()})),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},t.requestNamedAnimationFrame=function(e,t){var i=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=je(this,t);var n=this.requestAnimationFrame((function(){t(),i.namedRafs_.has(e)&&i.namedRafs_.delete(e)}));return this.namedRafs_.set(e,n),e}},t.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},t.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e):this.clearTimeout(e)},t.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((function(t){var i=t[0],n=t[1];e[i].forEach((function(t,i){return e[n](i)}))})),e.clearingTimersOnDispose_=!1})))},e.registerComponent=function(t,i){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var n=(r=e.getComponent("Tech"))&&r.isTech(i),r=e===i||e.prototype.isPrototypeOf(i.prototype);if(n||!r){var a=n?"techs must be registered using Tech.registerTech()":"must be a Component subclass";throw new Error('Illegal component, "'+t+'"; '+a+".")}if(t=rt(t),e.components_||(e.components_={}),a=e.getComponent("Player"),"Player"===t&&a&&a.players){var s=a.players;if(a=Object.keys(s),s&&0<a.length&&a.map((function(e){return s[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=i,e.components_[nt(t)]=i},e.getComponent=function(t){if(t&&e.components_)return e.components_[t]},e}();lt.prototype.supportsRaf_="function"==typeof window.requestAnimationFrame&&"function"==typeof window.cancelAnimationFrame,lt.registerComponent("Component",lt);var ct=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},dt=function(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t};function ht(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||i<t)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function pt(e){var t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:ht.bind(null,"start",0,e),end:ht.bind(null,"end",1,e)};return window.Symbol&&window.Symbol.iterator&&(t[window.Symbol.iterator]=function(){return(e||[]).values()}),t}function ft(e,t){return Array.isArray(e)?pt(e):void 0===e||void 0===t?pt():pt([[e,t]])}function mt(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=ft(0,0));for(var a=0;a<e.length;a++)i=e.start(a),r+=(n=t<(n=e.end(a))?t:n)-i;return r/t}function gt(e){if(e instanceof gt)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:b(e)&&("number"==typeof e.code&&(this.code=e.code),_(this,e)),this.message||(this.message=gt.defaultMessages[this.code]||"")}gt.prototype.code=0,gt.prototype.message="",gt.prototype.status=null,gt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],gt.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 yt=0;yt<gt.errorTypes.length;yt++)gt[gt.errorTypes[yt]]=yt,gt.prototype[gt.errorTypes[yt]]=yt;function vt(e){return null!=e&&"function"==typeof e.then}function _t(e){vt(e)&&e.then(null,(function(e){}))}function bt(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((function(t,i,n){return e[i]&&(t[i]=e[i]),t}),{cues:e.cues&&Array.prototype.map.call(e.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))})}var Tt="vjs-modal-dialog",St=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.close_=function(e){return n.close(e)},n.opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1,n.closeable(!n.options_.uncloseable),n.content(n.options_.content),n.contentEl_=Y("div",{className:Tt+"-content"},{role:"document"}),n.descEl_=Y("p",{className:Tt+"-description vjs-control-text",id:n.el().getAttribute("aria-describedby")}),Q(n.descEl_,n.description()),n.el_.appendChild(n.descEl_),n.el_.appendChild(n.contentEl_),n}dt(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},i.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return Tt+" vjs-hidden "+e.prototype.buildCSSClass.call(this)},i.label=function(){return this.localize(this.options_.label||"Modal Window")},i.description=function(){var e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e},i.open=function(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)},i.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},i.close=function(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose())},i.closeable=function(e){var t,i;return"boolean"==typeof e&&(t=this.closeable_=!!e,i=this.getChild("closeButton"),t&&!i&&(e=this.contentEl_,this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=e,this.on(i,"close",this.close_)),!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())),this.closeable_},i.fill=function(){this.fillWith(this.content())},i.fillWith=function(e){var t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),ge(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t),(t=this.getChild("closeButton"))&&i.appendChild(t.el_)},i.empty=function(){this.trigger("beforemodalempty"),pe(this.contentEl()),this.trigger("modalempty")},i.content=function(e){return void 0!==e&&(this.content_=e),this.content_},i.conditionalFocus_=function(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())},i.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},i.handleKeyDown=function(e){if(e.stopPropagation(),ut.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(ut.isEventKey(e,"Tab")){for(var t,i=this.focusableEls_(),n=this.el_.querySelector(":focus"),r=0;r<i.length;r++)if(n===i[r]){t=r;break}document.activeElement===this.el_&&(t=0),e.shiftKey&&0===t?(i[i.length-1].focus(),e.preventDefault()):e.shiftKey||t!==i.length-1||(i[0].focus(),e.preventDefault())}},i.focusableEls_=function(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(function(e){return(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")}))},t}(lt);St.prototype.options_={pauseOnOpen:!0,temporary:!0},lt.registerComponent("ModalDialog",St);var wt,Et=function(e){function t(t){var i;void 0===t&&(t=[]),(i=e.call(this)||this).tracks_=[],Object.defineProperty(ct(i),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<t.length;n++)i.addTrack(t[n]);return i}dt(t,e);var i=t.prototype;return i.addTrack=function(e){var t=this,i=this.tracks_.length;""+i in this||Object.defineProperty(this,i,{get:function(){return this.tracks_[i]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=function(){t.trigger({track:e,type:"labelchange",target:t})},Je(e)&&e.addEventListener("labelchange",e.labelchange_)},i.removeTrack=function(e){for(var t,i=0,n=this.length;i<n;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},i.getTrackById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},t}(qe);for(wt in Et.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"},Et.prototype.allowedEvents_)Et.prototype["on"+wt]=null;function kt(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)}function Ct(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)}function It(e){var t=["protocol","hostname","port","pathname","search","hash","host"],i=document.createElement("a");i.href=e;for(var n={},r=0;r<t.length;r++)n[t[r]]=i[t[r]];return"http:"===n.protocol&&(n.host=n.host.replace(/:80$/,"")),"https:"===n.protocol&&(n.host=n.host.replace(/:443$/,"")),n.protocol||(n.protocol=window.location.protocol),n.host||(n.host=window.location.host),n}function xt(e){var t;return e.match(/^https?:\/\//)||((t=document.createElement("a")).href=e,e=t.href),e}function At(e){return"string"==typeof e&&(e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e))?e.pop().toLowerCase():""}function Pt(e,t){return void 0===t&&(t=window.location),(":"===(e=It(e)).protocol?t:e).protocol+e.host!==t.protocol+t.host}var Lt=function(e){function t(t){for(var i,n=(t=void 0===t?[]:t).length-1;0<=n;n--)if(t[n].enabled){kt(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}dt(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&kt(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,kt(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(Et),Dt=function(e){function t(t){for(var i,n=(t=void 0===t?[]:t).length-1;0<=n;n--)if(t[n].selected){Ct(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(ct(i),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),i}dt(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.selected&&Ct(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,Ct(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)},t}(Et),Ot=function(e){function t(){return e.apply(this,arguments)||this}dt(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;e.prototype.addTrack.call(this,t),this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_),-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},t}(Et),Mt=function(){function e(e){void 0===e&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}var t=e.prototype;return t.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)},t.getTrackElementByTrack_=function(e){for(var t,i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t},t.removeTrackElement_=function(e){for(var t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}},e}(),Rt=function(){function e(t){e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=e.prototype;return t.setCues_=function(e){var t=this.length||0,i=0,n=e.length;function r(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})}if(this.cues_=e,this.length_=e.length,t<n)for(i=t;i<n;i++)r.call(this,i)},t.getCueById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},e}(),Nt={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Ut={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Bt={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Ft={disabled:"disabled",hidden:"hidden",showing:"showing"},jt=(E=function(e){function t(t){void 0===t&&(t={});var i,n=e.call(this)||this,r={id:t.id||"vjs_track_"+xe++,kind:t.kind||"",language:t.language||""},a=t.label||"";for(i in r)!function(e){Object.defineProperty(ct(n),e,{get:function(){return r[e]},set:function(){}})}(i);return Object.defineProperty(ct(n),"label",{get:function(){return a},set:function(e){e!==a&&(a=e,this.trigger("labelchange"))}}),n}return dt(t,e),t}(qe),Object.freeze({__proto__:null,parseUrl:It,getAbsoluteURL:xt,getFileExtension:At,isCrossOrigin:Pt})),Ht=ei="undefined"!=typeof window?window:void 0!==p?p:"undefined"!=typeof self?self:{},qt=Object.prototype.toString;Gt.httpHandler=function(e,t){return void 0===t&&(t=!1),function(i,n,r){if(i)e(i);else if(400<=n.statusCode&&n.statusCode<=599){if(i=r,t)if(Ht.TextDecoder){n=function(e){return void 0===e&&(e=""),e.toLowerCase().split(";").reduce((function(e,t){t=(i=t.split("="))[0];var i=i[1];return"charset"===t.trim()?i.trim():e}),"utf-8")}(n.headers&&n.headers["content-type"]);try{i=new TextDecoder(n).decode(r)}catch(i){}}else i=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:i})}else e(null,r)}};var Vt=Gt;function Wt(e,t,i){var n=e;return function(e){if(!e)return!1;var t=qt.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=m({},t,{uri:e}),n.callback=i,n}function Gt(e,t,i){return zt(t=Wt(e,t,i))}function zt(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,n,r){t||(t=!0,e.callback(i,n,r))};function n(){var e=void 0;if(e=l.response||l.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(l),m)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(u),(e=e instanceof Error?e:new Error(""+(e||"Unknown XMLHttpRequest Error"))).statusCode=0,i(e,g)}function a(){if(!o){clearTimeout(u);var t=e.useXDR&&void 0===l.status?200:1223===l.status?204:l.status,r=g,a=null;return 0!==t?(r={body:n(),statusCode:t,method:d,headers:{},url:c,rawRequest:l},l.getAllResponseHeaders&&(r.headers=function(e){var t={};return e&&e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase();i=e.slice(i+1).trim(),void 0===t[n]?t[n]=i:Array.isArray(t[n])?t[n].push(i):t[n]=[t[n],i]})),t}(l.getAllResponseHeaders()))):a=new Error("Internal XMLHttpRequest Error"),i(a,r,r.body)}}var s,o,u,l=e.xhr||null,c=(l=l||new(e.cors||e.useXDR?Gt.XDomainRequest:Gt.XMLHttpRequest)).url=e.uri||e.url,d=l.method=e.method||"GET",h=e.body||e.data,p=l.headers=e.headers||{},f=!!e.sync,m=!1,g={body:void 0,headers:{},statusCode:0,method:d,url:c,rawRequest:l};if("json"in e&&!1!==e.json&&(m=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),h=JSON.stringify(!0===e.json?h:e.json))),l.onreadystatechange=function(){4===l.readyState&&setTimeout(a,0)},l.onload=a,l.onerror=r,l.onprogress=function(){},l.onabort=function(){o=!0},l.ontimeout=r,l.open(d,c,!f,e.username,e.password),f||(l.withCredentials=!!e.withCredentials),!f&&0<e.timeout&&(u=setTimeout((function(){var e;o||(o=!0,l.abort("timeout"),(e=new Error("XMLHttpRequest timeout")).code="ETIMEDOUT",r(e))}),e.timeout)),l.setRequestHeader)for(s in p)p.hasOwnProperty(s)&&l.setRequestHeader(s,p[s]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return;return 1}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(l.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(l),l.send(h||null),l}function Xt(e,t){var i=new window.WebVTT.Parser(window,window.vttjs,window.WebVTT.StringDecoder()),n=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){n.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),0<n.length&&(window.console&&window.console.groupCollapsed&&window.console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach((function(e){return d.error(e)})),window.console&&window.console.groupEnd&&window.console.groupEnd()),i.flush()}function Kt(e,t){var i={uri:e};(e=Pt(e))&&(i.cors=e),(e="use-credentials"===t.tech_.crossOrigin())&&(i.withCredentials=e),Vt(i,je(this,(function(e,i,n){return e?d.error(e,i):(t.loaded_=!0,void("function"!=typeof window.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(function(e){return"vttjserror"!==e.type?Xt(n,t):void d.error("vttjs failed to load, stopping trying to process "+t.src)})):Xt(n,t)))})))}k=Gt,Gt.XMLHttpRequest=Ht.XMLHttpRequest||function(){},Gt.XDomainRequest="withCredentials"in new Gt.XMLHttpRequest?Gt.XMLHttpRequest:Ht.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],(function(e){Gt["delete"===e?"del":e]=function(t,i,n){return(i=Wt(t,i,n)).method=e.toUpperCase(),zt(i)}})),Vt.default=k;var Yt=function(e){function t(t){var i;if(!(t=void 0===t?{}:t).tech)throw new Error("A tech was not provided.");t=at(t,{kind:Bt[t.kind]||"subtitles",language:t.language||t.srclang||""});var n=Ft[t.mode]||"disabled",r=t.default;"metadata"!==t.kind&&"chapters"!==t.kind||(n="hidden"),(i=e.call(this,t)||this).tech_=t.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var a=new Rt(i.cues_),s=new Rt(i.activeCues_),o=!1;return i.timeupdateHandler=je(ct(i),(function(){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1)),this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))})),i.tech_.one("dispose",(function(){i.stopTracking()})),"disabled"!==n&&i.startTracking(),Object.defineProperties(ct(i),{default:{get:function(){return r},set:function(){}},mode:{get:function(){return n},set:function(e){Ft[e]&&n!==e&&(n=e,this.preload_||"disabled"===n||0!==this.cues.length||Kt(this.src,this),this.stopTracking(),"disabled"!==n&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?a:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return s;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i<n;i++){var r=this.cues[i];(r.startTime<=e&&r.endTime>=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(o=!1,t.length!==this.activeCues_.length)o=!0;else for(var a=0;a<t.length;a++)-1===this.activeCues_.indexOf(t[a])&&(o=!0);return this.activeCues_=t,s.setCues_(this.activeCues_),s},set:function(){}}}),t.src?(i.src=t.src,i.preload_||(i.loaded_=!0),(i.preload_||"subtitles"!==t.kind&&"captions"!==t.kind)&&Kt(i.src,ct(i))):i.loaded_=!0,i}dt(t,e);var i=t.prototype;return i.startTracking=function(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)},i.stopTracking=function(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0)},i.addCue=function(e){var t=e;if(window.vttjs&&!(e instanceof window.vttjs.VTTCue)){for(var i in t=new window.vttjs.VTTCue(e.startTime,e.endTime,e.text),e)i in t||(t[i]=e[i]);t.id=e.id,t.originalCue_=e}for(var n=this.tech_.textTracks(),r=0;r<n.length;r++)n[r]!==this&&n[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)},i.removeCue=function(e){for(var t=this.cues_.length;t--;){var i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}},t}(E);Yt.prototype.allowedEvents_={cuechange:"cuechange"},C=function(e){function t(t){var i=at(t=void 0===t?{}:t,{kind:Ut[t.kind]||""}),n=(t=e.call(this,i)||this,!1);return Object.defineProperty(ct(t),"enabled",{get:function(){return n},set:function(e){"boolean"==typeof e&&e!==n&&(n=e,this.trigger("enabledchange"))}}),i.enabled&&(t.enabled=i.enabled),t.loaded_=!0,t}return dt(t,e),t}(E),R=function(e){function t(t){var i=at(t=void 0===t?{}:t,{kind:Nt[t.kind]||""}),n=(t=e.call(this,i)||this,!1);return Object.defineProperty(ct(t),"selected",{get:function(){return n},set:function(e){"boolean"==typeof e&&e!==n&&(n=e,this.trigger("selectedchange"))}}),i.selected&&(t.selected=i.selected),t}return dt(t,e),t}(E),(B=function(e){function t(t){var i;void 0===t&&(t={});var n=e.call(this)||this,r=new Yt(t);return n.kind=r.kind,n.src=r.src,n.srclang=r.language,n.label=r.label,n.default=r.default,Object.defineProperties(ct(n),{readyState:{get:function(){return i}},track:{get:function(){return r}}}),i=0,r.addEventListener("loadeddata",(function(){i=2,n.trigger({type:"load",target:ct(n)})})),n}return dt(t,e),t}(qe)).prototype.allowedEvents_={load:"load"},B.NONE=0,B.LOADING=1,B.LOADED=2,B.ERROR=3;var Qt={audio:{ListClass:Lt,TrackClass:C,capitalName:"Audio"},video:{ListClass:Dt,TrackClass:R,capitalName:"Video"},text:{ListClass:Ot,TrackClass:Yt,capitalName:"Text"}};Object.keys(Qt).forEach((function(e){Qt[e].getterName=e+"Tracks",Qt[e].privateName=e+"Tracks_"}));var $t={remoteText:{ListClass:Ot,TrackClass:Yt,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Mt,TrackClass:B,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Jt=m({},Qt,$t);$t.names=Object.keys($t),Qt.names=Object.keys(Qt),Jt.names=[].concat($t.names).concat(Qt.names);var Zt=void 0!==p?p:"undefined"!=typeof window?window:{},ei=cn="undefined"!=typeof document?document:(cn=Zt["__GLOBAL_DOCUMENT_CACHE@4"])||(Zt["__GLOBAL_DOCUMENT_CACHE@4"]={}),ti=Object.create||function(e){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return ii.prototype=e,new ii};function ii(){}function ni(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function ri(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}return(e=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/))?e[3]?t(e[1],e[2],e[3].replace(":",""),e[4]):59<e[1]?t(e[1],e[2],0,e[4]):t(0,e[1],e[2],e[4]):null}function ai(){this.values=ti(null)}function si(e,t,i,n){var r,a,s=n?e.split(n):[e];for(r in s)"string"==typeof s[r]&&2===(a=s[r].split(i)).length&&t(a[0],a[1])}function oi(e,t,i){var n=e;function r(){var t=ri(e);if(null===t)throw new ni(ni.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new ni(ni.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),a(),t.endTime=r(),a(),function(e,t){var n=new ai;si(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;0<=r;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];n.integer(e,s),n.percent(e,s)&&n.set("snapToLines",!1),n.alt(e,s,["auto"]),2===a.length&&n.alt("lineAlign",a[1],["start","center","end"]);break;case"position":a=t.split(","),n.percent(e,a[0]),2===a.length&&n.alt("positionAlign",a[1],["start","center","end"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");try{t.line=n.get("line","auto")}catch(e){}t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100);try{t.align=n.get("align","center")}catch(e){t.align=n.get("align","middle")}try{t.position=n.get("position","auto")}catch(e){t.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}((ni.prototype=ti(Error.prototype)).constructor=ni).Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},ai.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&0<=(t=parseFloat(t))&&t<=100)&&(this.set(e,t),!0)}};var ui=ei.createElement&&ei.createElement("textarea"),li={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},ci={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},di={v:"title",lang:"lang"},hi={rt:"ruby"};function pi(e,t){for(var i,n,r,a,s,o,u,l,c,d,h=e.document.createElement("div"),p=h,f=[];null!==(i=function(){if(!t)return null;var e=t.match(/^([^<]*)(<[^>]*>?)?/);return e=e[1]||e[2],t=t.substr(e.length),e}());)"<"!==i[0]?p.appendChild(e.document.createTextNode((s=i,ui.innerHTML=s,s=ui.textContent,ui.textContent="",s))):"/"!==i[1]?(a=ri(i.substr(1,i.length-2)))?(n=e.document.createProcessingInstruction("timestamp",a),p.appendChild(n)):(r=i.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(l=r[1],c=r[3],d=void 0,(n=(d=li[l])?(d=e.document.createElement(d),(l=di[l])&&c&&(d[l]=c.trim()),d):null)&&(o=p,hi[(u=n).localName]&&hi[u.localName]!==o.localName||(r[2]&&((a=r[2].split(".")).forEach((function(e){var t=/^bg_/.test(e);e=t?e.slice(3):e,ci.hasOwnProperty(e)&&(e=ci[e],n.style[t?"background-color":"color"]=e)})),n.className=a.join(" ")),f.push(r[1]),p.appendChild(n),p=n))):f.length&&f[f.length-1]===i.substr(2).replace(">","")&&(f.pop(),p=p.parentNode);return h}var fi=[[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 mi(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;0<=i;i--)e.push(t.childNodes[i])}for(n(t,e);i=function e(t){if(!t||!t.length)return null;var i=t.pop(),r=i.textContent||i.innerText;if(r){var a=r.match(/^.*(\n|\r)/);return a?a[t.length=0]:r}return"ruby"===i.tagName?e(t):i.childNodes?(n(t,i),e(t)):void 0}(t);)for(var r=0;r<i.length;r++)if(function(e){for(var t=0;t<fi.length;t++){var i=fi[t];if(e>=i[0]&&e<=i[1])return 1}}(i.charCodeAt(r)))return"rtl";return"ltr"}function gi(){}function yi(e,t,i){gi.call(this),this.cue=t,this.cueDiv=pi(e,t.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:mi(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function vi(e){var t,i,n,r;e.div&&(t=e.div.offsetHeight,i=e.div.offsetWidth,n=e.div.offsetTop,r=(r=e.div.childNodes)&&(r=r[0])&&r.getClientRects&&r.getClientRects(),e=e.div.getBoundingClientRect(),r=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0),this.left=e.left,this.right=e.right,this.top=e.top||n,this.height=e.height||t,this.bottom=e.bottom||n+(e.height||t),this.width=e.width||i,this.lineHeight=void 0!==r?r:e.lineHeight}function _i(e,t,i,n){var r,a=new vi(t),s=t.cue,o=function(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&n++;return-1*++n}(s),u=[];if(s.snapToLines){switch(s.vertical){case"":u=["+y","-y"],r="height";break;case"rl":u=["+x","-x"],r="width";break;case"lr":u=["-x","+x"],r="width"}var l=a.lineHeight,c=l*Math.round(o),d=i[r]+l,h=u[0];Math.abs(c)>d&&(c=c<0?-1:1,c*=Math.ceil(d/l)*l),o<0&&(c+=""===s.vertical?i.height:i.width,u=u.reverse()),a.move(h,c)}else{var p=a.lineHeight/i.height*100;switch(s.lineAlign){case"center":o-=p/2;break;case"end":o-=p}switch(s.vertical){case"":t.applyStyles({top:t.formatStyle(o,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(o,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(o,"%")})}u=["+y","-x","+x","-y"],a=new vi(t)}a=function(e,t){for(var r,a=new vi(e),s=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(n);)e.move(t[o]);if(e.within(i))return e;var u=e.intersectPercentage(i);u<s&&(r=new vi(e),s=u),e=new vi(a)}return r||a}(a,u),t.move(a.toCSSCompatValues(i))}function bi(){}gi.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},gi.prototype.formatStyle=function(e,t){return 0===e?0:e+t},(yi.prototype=ti(gi.prototype)).constructor=yi,vi.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},vi.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},vi.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},vi.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},vi.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},vi.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},vi.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},vi.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},bi.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},bi.convertCueToDOMTree=function(e,t){return e&&t?pi(e,t):null},bi.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return 1}(t)){var r=[],a=vi.getSimpleBoxPosition(n),s={font:Math.round(.05*a.height*100)/100+"px sans-serif"};!function(){for(var i,o,u=0;u<t.length;u++)o=t[u],i=new yi(e,o,s),n.appendChild(i.div),_i(0,i,a,r),o.displayState=i.div,r.push(vi.getSimpleBoxPosition(i))}()}else for(var o=0;o<t.length;o++)n.appendChild(t[o].displayState)},(bi.Parser=function(e,t,i){i||(i=t,t={}),t=t||{},this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]}).prototype={reportOrThrowError:function(e){if(!(e instanceof ni))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var n=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),n}function n(e){e.match(/X-TIMESTAMP-MAP/)?si(e,(function(e,i){var n;"X-TIMESTAMP-MAP"===e&&(i=i,n=new ai,si(i,(function(e,t){switch(e){case"MPEGT":n.integer(e+"S",t);break;case"LOCA":n.set(e+"L",ri(t))}}),/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:n.get("MPEGTS"),LOCAL:n.get("LOCAL")}))}),/=/):si(e,(function(e,i){var n;"Region"===e&&(i=i,n=new ai,si(i,(function(e,t){switch(e){case"id":n.set(e,t);break;case"width":n.percent(e,t);break;case"lines":n.integer(e,t);break;case"regionanchor":case"viewportanchor":var i=t.split(",");if(2!==i.length)break;var r=new ai;if(r.percent("x",i[0]),r.percent("y",i[1]),!r.has("x")||!r.has("y"))break;n.set(e+"X",r.get("x")),n.set(e+"Y",r.get("y"));break;case"scroll":n.alt(e,t,["up"])}}),/=/,/\s/),n.has("id")&&((i=new(t.vttjs.VTTRegion||t.window.VTTRegion)).width=n.get("width",100),i.lines=n.get("lines",3),i.regionAnchorX=n.get("regionanchorX",0),i.regionAnchorY=n.get("regionanchorY",100),i.viewportAnchorX=n.get("viewportanchorX",0),i.viewportAnchorY=n.get("viewportanchorY",100),i.scroll=n.get("scroll",""),t.onregion&&t.onregion(i),t.regionList.push({id:n.get("id"),region:i})))}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var r,a=(r=i()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new ni(ni.Errors.BadSignature);t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:r=i(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(e){t.cue.align="middle"}if(t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{oi(r,t.cue,t.regionList)}catch(e){t.reportOrThrowError(e),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(s=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(t.state="ID");continue}}}catch(e){t.reportOrThrowError(e),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),!e.cue&&"HEADER"!==e.state||(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new ni(ni.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var Ti=bi,Si={"":1,lr:1,rl:1},wi={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Ei(e){return"string"==typeof e&&!!wi[e.toLowerCase()]&&e.toLowerCase()}function ki(e,t,i){this.hasBeenReset=!1;var n="",r=!1,a=e,s=t,o=i,u=null,l="",c=!0,d="auto",h="start",p="auto",f="auto",m=100,g="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(e){n=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");a=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");s=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(e){o=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(e){u=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(e){if(!1===(e="string"==typeof(e=e)&&!!Si[e.toLowerCase()]&&e.toLowerCase()))throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");l=e,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return d},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");d=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return h},set:function(e){(e=Ei(e))&&(h=e,this.hasBeenReset=!0)}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||100<e)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){(e=Ei(e))&&(f=e,this.hasBeenReset=!0)}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||100<e)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){if(!(e=Ei(e)))throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=e,this.hasBeenReset=!0}}}),this.displayState=void 0}ki.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Ci=ki,Ii={"":!0,up:!0};function xi(e){return"number"==typeof e&&0<=e&&e<=100}function Ai(){var e=100,t=3,i=0,n=100,r=0,a=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!xi(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!xi(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!xi(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!xi(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!xi(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){!1===(e="string"==typeof(e=e)&&!!Ii[e.toLowerCase()]&&e.toLowerCase())||(s=e)}}})}var Pi=f((function(e){e=e.exports={WebVTT:Ti,VTTCue:Ci,VTTRegion:Ai},Ht.vttjs=e,Ht.WebVTT=e.WebVTT;var t=e.VTTCue,i=e.VTTRegion,n=Ht.VTTCue,r=Ht.VTTRegion;e.shim=function(){Ht.VTTCue=t,Ht.VTTRegion=i},e.restore=function(){Ht.VTTCue=n,Ht.VTTRegion=r},Ht.VTTCue||e.shim()}));Pi.WebVTT,Pi.VTTCue,Pi.VTTRegion;var Li=function(e){function t(t,i){var n;return void 0===i&&(i=function(){}),(t=void 0===t?{}:t).reportTouchActivity=!1,(n=e.call(this,null,t,i)||this).onDurationChange_=function(e){return n.onDurationChange(e)},n.trackProgress_=function(e){return n.trackProgress(e)},n.trackCurrentTime_=function(e){return n.trackCurrentTime(e)},n.stopTrackingCurrentTime_=function(e){return n.stopTrackingCurrentTime(e)},n.disposeSourceHandler_=function(e){return n.disposeSourceHandler(e)},n.queuedHanders_=new Set,n.hasStarted_=!1,n.on("playing",(function(){this.hasStarted_=!0})),n.on("loadstart",(function(){this.hasStarted_=!1})),Jt.names.forEach((function(e){e=Jt[e],t&&t[e.getterName]&&(n[e.privateName]=t[e.getterName])})),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((function(e){!1===t["native"+e+"Tracks"]&&(n["featuresNative"+e+"Tracks"]=!1)})),!1===t.nativeCaptions||!1===t.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.preloadTextTracks=!1!==t.preloadTextTracks,n.autoRemoteTextTracks_=new Jt.text.ListClass,n.initTrackListeners(),t.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}dt(t,e);var i=t.prototype;return i.triggerSourceset=function(e){var t=this;this.isReady_||this.one("ready",(function(){return t.setTimeout((function(){return t.triggerSourceset(e)}),1)})),this.trigger({src:e,type:"sourceset"})},i.manualProgressOn=function(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)},i.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)},i.trackProgress=function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(je(this,(function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()})),500)},i.onDurationChange=function(e){this.duration_=this.duration()},i.buffered=function(){return ft(0,0)},i.bufferedPercent=function(){return mt(this.buffered(),this.duration_)},i.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},i.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)},i.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)},i.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval((function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}),250)},i.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.dispose=function(){this.clearTracks(Qt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),e.prototype.dispose.call(this)},i.clearTracks=function(e){var t=this;(e=[].concat(e)).forEach((function(e){for(var i=t[e+"Tracks"]()||[],n=i.length;n--;){var r=i[n];"text"===e&&t.removeRemoteTextTrack(r),i.removeTrack(r)}}))},i.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},i.reset=function(){},i.crossOrigin=function(){},i.setCrossOrigin=function(){},i.error=function(e){return void 0!==e&&(this.error_=new gt(e),this.trigger("error")),this.error_},i.played=function(){return this.hasStarted_?ft(0,0):ft()},i.play=function(){},i.setScrubbing=function(){},i.scrubbing=function(){},i.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.initTrackListeners=function(){var e=this;Qt.names.forEach((function(t){function i(){e.trigger(t+"trackchange")}var n=Qt[t],r=e[n.getterName]();r.addEventListener("removetrack",i),r.addEventListener("addtrack",i),e.on("dispose",(function(){r.removeEventListener("removetrack",i),r.removeEventListener("addtrack",i)}))}))},i.addWebVttScript_=function(){var e,t=this;window.WebVTT||(document.body.contains(this.el())?!this.options_["vtt.js"]&&T(Pi)&&0<Object.keys(Pi).length?this.trigger("vttjsloaded"):((e=document.createElement("script")).src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=function(){t.trigger("vttjsloaded")},e.onerror=function(){t.trigger("vttjserror")},this.on("dispose",(function(){e.onload=null,e.onerror=null})),window.WebVTT=!0,this.el().parentNode.appendChild(e)):this.ready(this.addWebVttScript_))},i.emulateTextTracks=function(){function e(e){return n.addTrack(e.track)}function t(e){return n.removeTrack(e.track)}var i=this,n=this.textTracks(),r=this.remoteTextTracks();function a(){return i.trigger("texttrackchange")}function s(){a();for(var e=0;e<n.length;e++){var t=n[e];t.removeEventListener("cuechange",a),"showing"===t.mode&&t.addEventListener("cuechange",a)}}r.on("addtrack",e),r.on("removetrack",t),this.addWebVttScript_(),s(),n.addEventListener("change",s),n.addEventListener("addtrack",s),n.addEventListener("removetrack",s),this.on("dispose",(function(){r.off("addtrack",e),r.off("removetrack",t),n.removeEventListener("change",s),n.removeEventListener("addtrack",s),n.removeEventListener("removetrack",s);for(var i=0;i<n.length;i++)n[i].removeEventListener("cuechange",a)}))},i.addTextTrack=function(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,i,n,r){void 0===r&&(r={});var a=e.textTracks();return r.kind=t,i&&(r.label=i),n&&(r.language=n),r.tech=e,r=new Jt.text.TrackClass(r),a.addTrack(r),r}(this,e,t,i)},i.createRemoteTextTrack=function(e){return e=at(e,{tech:this}),new $t.remoteTextEl.TrackClass(e)},i.addRemoteTextTrack=function(e,t){var i=this,n=this.createRemoteTextTrack(e=void 0===e?{}:e);return!0!==t&&!1!==t&&(d.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),t=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==t&&this.ready((function(){return i.autoRemoteTextTracks_.addTrack(n.track)})),n},i.removeRemoteTextTrack=function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)},i.getVideoPlaybackQuality=function(){return{}},i.requestPictureInPicture=function(){var e=this.options_.Promise||window.Promise;if(e)return e.reject()},i.disablePictureInPicture=function(){return!0},i.setDisablePictureInPicture=function(){},i.requestVideoFrameCallback=function(e){var t=this,i=xe++;return this.paused()?(this.queuedHanders_.add(i),this.one("playing",(function(){t.queuedHanders_.has(i)&&(t.queuedHanders_.delete(i),e())}))):this.requestNamedAnimationFrame(i,e),i},i.cancelVideoFrameCallback=function(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)},i.setPoster=function(){},i.playsinline=function(){},i.setPlaysinline=function(){},i.overrideNativeAudioTracks=function(){},i.overrideNativeVideoTracks=function(){},i.canPlayType=function(){return""},t.canPlayType=function(){return""},t.canPlaySource=function(e,i){return t.canPlayType(e.type)},t.isTech=function(e){return e.prototype instanceof t||e instanceof t||e===t},t.registerTech=function(e,i){if(t.techs_||(t.techs_={}),!t.isTech(i))throw new Error("Tech "+e+" must be a Tech");if(!t.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!t.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=rt(e),t.techs_[e]=i,t.techs_[nt(e)]=i,"Tech"!==e&&t.defaultTechOrder_.push(e),i},t.getTech=function(e){if(e)return t.techs_&&t.techs_[e]?t.techs_[e]:(e=rt(e),window&&window.videojs&&window.videojs[e]?(d.warn("The "+e+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),window.videojs[e]):void 0)},t}(lt);Jt.names.forEach((function(e){var t=Jt[e];Li.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Li.prototype.featuresVolumeControl=!0,Li.prototype.featuresMuteControl=!0,Li.prototype.featuresFullscreenResize=!1,Li.prototype.featuresPlaybackRate=!1,Li.prototype.featuresProgressEvents=!1,Li.prototype.featuresSourceset=!1,Li.prototype.featuresTimeupdateEvents=!1,Li.prototype.featuresNativeTextTracks=!1,Li.prototype.featuresVideoFrameCallback=!1,Li.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){var n=(n=e.sourceHandlers)||(e.sourceHandlers=[]);void 0===i&&(i=n.length),n.splice(i,0,t)},e.canPlayType=function(t){for(var i,n=e.sourceHandlers||[],r=0;r<n.length;r++)if(i=n[r].canPlayType(t))return i;return""},e.selectSourceHandler=function(t,i){for(var n=e.sourceHandlers||[],r=0;r<n.length;r++)if(n[r].canHandleSource(t,i))return n[r];return null},e.canPlaySource=function(t,i){var n=e.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach((function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(t){var i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:d.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},lt.registerComponent("Tech",Li),Li.registerTech("Tech",Li),Li.defaultTechOrder_=[];var Di={},Oi={},Mi={};function Ri(e,t,i,n){void 0===n&&(n=null);var r="call"+rt(i);return r=e.reduce(Fi(r),n),function(e,t,i,n){for(var r=e.length-1;0<=r;r--){var a=e[r];a[t]&&a[t](n,i)}}(e,i,r=(n=r===Mi)?null:t[i](r),n),r}var Ni={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Ui={setCurrentTime:1,setMuted:1,setVolume:1},Bi={play:1,pause:1};function Fi(e){return function(t,i){return t===Mi?Mi:i[e]?i[e](t):t}}function ji(e){return e=At(e=void 0===e?"":e),qi[e.toLowerCase()]||""}function Hi(e){var t;return Array.isArray(e)?(t=[],e.forEach((function(e){e=Hi(e),Array.isArray(e)?t=t.concat(e):b(e)&&t.push(e)})),t):"string"==typeof e&&e.trim()?[Vi({src:e})]:b(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[Vi(e)]:[]}var qi={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"};function Vi(e){var t;return e.type||(t=ji(e.src))&&(e.type=t),e}k=function(e){function t(t,i,n){var r=at({createEl:!1},i);if(n=e.call(this,t,r,n)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var a=0,s=i.playerOptions.techOrder;a<s.length;a++){var o=rt(s[a]),u=Li.getTech(o);if((u=o?u:lt.getComponent(o))&&u.isSupported()){t.loadTech_(o);break}}return n}return dt(t,e),t}(lt),lt.registerComponent("MediaLoader",k),E=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.options_.controlText&&n.controlText(n.options_.controlText),n.handleMouseOver_=function(e){return n.handleMouseOver(e)},n.handleMouseOut_=function(e){return n.handleMouseOut(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.emitTapEvents(),n.enable(),n}dt(t,e);var i=t.prototype;return i.createEl=function(e,t,i){return void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={}),t=_({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&d.error("Creating a ClickableComponent with an HTML element of "+e+" is not supported; use a Button instead."),i=_({role:"button"},i),this.tabIndex_=t.tabIndex,(i=Y(e,t,i)).appendChild(Y("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(i),i},i.dispose=function(){this.controlTextEl_=null,e.prototype.dispose.call(this)},i.createControlTextEl=function(e){return this.controlTextEl_=Y("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_},i.controlText=function(e,t){if(void 0===t&&(t=this.el()),void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,Q(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)},i.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)},i.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))},i.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)},i.handleLanguagechange=function(){this.controlText(this.controlText_)},i.handleClick=function(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)},i.handleKeyDown=function(t){ut.isEventKey(t,"Space")||ut.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(lt),lt.registerComponent("ClickableComponent",E),lt.registerComponent("PosterImage",function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.update(),n.update_=function(e){return n.update(e)},t.on("posterchange",n.update_),n}dt(t,e);var i=t.prototype;return i.dispose=function(){this.player().off("posterchange",this.update_),e.prototype.dispose.call(this)},i.createEl=function(){return Y("div",{className:"vjs-poster",tabIndex:-1})},i.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},i.setSrc=function(e){this.el_.style.backgroundImage=e?'url("'+e+'")':""},i.handleClick=function(e){var t;this.player_.controls()&&(t=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&0<this.player_.eme.sessions.length,!this.player_.tech(!0)||(M||L)&&t||this.player_.tech(!0).focus(),this.player_.paused()?_t(this.player_.play()):this.player_.pause())},t}(E));var Wi="#222",Gi={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 zi(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Xi(e,t,i){try{e.style[t]=i}catch(e){return}}lt.registerComponent("TextTrackDisplay",function(e){function t(t,i,n){function r(e){return a.updateDisplay(e)}var a=e.call(this,t,i,n)||this;return t.on("loadstart",(function(e){return a.toggleDisplay(e)})),t.on("texttrackchange",r),t.on("loadedmetadata",(function(e){return a.preselectTrack(e)})),t.ready(je(ct(a),(function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",r),t.on("playerresize",r),window.addEventListener("orientationchange",r),t.on("dispose",(function(){return window.removeEventListener("orientationchange",r)}));for(var e=this.options_.playerOptions.tracks||[],i=0;i<e.length;i++)this.player_.addRemoteTextTrack(e[i],!0);this.preselectTrack()}}))),a}dt(t,e);var i=t.prototype;return i.preselectTrack=function(){for(var e,t,i,n={captions:1,subtitles:1},r=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,s=0;s<r.length;s++){var o=r[s];a&&a.enabled&&a.language&&a.language===o.language&&o.kind in n?i=o.kind!==a.kind&&i||o:a&&!a.enabled?t=e=i=null:o.default&&("descriptions"!==o.kind||e?o.kind in n&&!t&&(t=o):e=o)}i?i.mode="showing":t?t.mode="showing":e&&(e.mode="showing")},i.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})},i.clearDisplay=function(){"function"==typeof window.WebVTT&&window.WebVTT.processCues(window,[],this.el_)},i.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var i=[],n=0;n<e.length;++n){var r=e[n];"showing"===r.mode&&i.push(r)}this.updateForTrack(i)}else{for(var a=null,s=null,o=e.length;o--;){var u=e[o];"showing"===u.mode&&("descriptions"===u.kind?a=u:s=u)}s?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):a&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(a))}},i.updateDisplayState=function(e){for(var t=this.player_.textTrackSettings.getValues(),i=e.activeCues,n=i.length;n--;){var r,a=i[n];a&&(r=a.displayState,t.color&&(r.firstChild.style.color=t.color),t.textOpacity&&Xi(r.firstChild,"color",zi(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(r.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Xi(r.firstChild,"backgroundColor",zi(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Xi(r,"backgroundColor",zi(t.windowColor,t.windowOpacity)):r.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?r.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px "+Wi:"raised"===t.edgeStyle?r.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px "+Wi:"depressed"===t.edgeStyle?r.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px "+Wi:"uniform"===t.edgeStyle&&(r.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px "+Wi)),t.fontPercent&&1!==t.fontPercent&&(a=window.parseFloat(r.style.fontSize),r.style.fontSize=a*t.fontPercent+"px",r.style.height="auto",r.style.top="auto"),t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?r.firstChild.style.fontVariant="small-caps":r.firstChild.style.fontFamily=Gi[t.fontFamily]))}},i.updateForTrack=function(e){if(Array.isArray(e)||(e=[e]),"function"==typeof window.WebVTT&&!e.every((function(e){return!e.activeCues}))){for(var t=[],i=0;i<e.length;++i)for(var n=e[i],r=0;r<n.activeCues.length;++r)t.push(n.activeCues[r]);window.WebVTT.processCues(window,t,this.el_);for(var a=0;a<e.length;++a){for(var s=e[a],o=0;o<s.activeCues.length;++o){var u=s.activeCues[o].displayState;Z(u,"vjs-text-track-cue"),Z(u,"vjs-text-track-cue-"+(s.language||a)),s.language&&ae(u,"lang",s.language)}this.player_.textTrackSettings&&this.updateDisplayState(s)}}},t}(lt)),lt.registerComponent("LoadingSpinner",function(e){function t(){return e.apply(this,arguments)||this}return dt(t,e),t.prototype.createEl=function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player");return t=Y("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[i])}),(i=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"})).appendChild(t),i},t}(lt));var Ki=function(e){function t(){return e.apply(this,arguments)||this}dt(t,e);var i=t.prototype;return i.createEl=function(e,t,i){return void 0===t&&(t={}),void 0===i&&(i={}),(i=Y("button",t=_({className:this.buildCSSClass()},t),i=_({type:"button"},i))).appendChild(Y("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(i),i},i.addChild=function(e,t){void 0===t&&(t={});var i=this.constructor.name;return d.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),lt.prototype.addChild.call(this,e,t)},i.enable=function(){e.prototype.enable.call(this),this.el_.removeAttribute("disabled")},i.disable=function(){e.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},i.handleKeyDown=function(t){ut.isEventKey(t,"Space")||ut.isEventKey(t,"Enter")?t.stopPropagation():e.prototype.handleKeyDown.call(this,t)},t}(E);function Yi(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60);return t=Math.floor(t/3600),(r=0<(r=isNaN(e)||e===1/0?n=i="-":r)||0<t?r+":":"")+(n=((r||10<=a)&&n<10?"0"+n:n)+":")+(i<10?"0"+i:i)}lt.registerComponent("Button",Ki),(Lt=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.mouseused_=!1,n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-big-play-button"},i.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){var i=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&0<this.player_.eme.sessions.length;return _t(t),void(!this.player_.tech(!0)||(M||L)&&i||this.player_.tech(!0).focus())}var n=(i=this.player_.getChild("controlBar"))&&i.getChild("playToggle");n?(i=function(){return n.focus()},vt(t)?t.then(i,(function(){})):this.setTimeout(i,1)):this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(Ki)).prototype.controlText_="Play Video",lt.registerComponent("BigPlayButton",Lt),lt.registerComponent("CloseButton",function(e){function t(t,i){return(t=e.call(this,t,i)||this).controlText(i&&i.controlText||t.localize("Close")),t}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){ut.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(Ki)),(Dt=function(e){function t(t,i){var n=e.call(this,t,i=void 0===i?{}:i)||this;return i.replay=void 0===i.replay||i.replay,n.on(t,"play",(function(e){return n.handlePlay(e)})),n.on(t,"pause",(function(e){return n.handlePause(e)})),i.replay&&n.on(t,"ended",(function(e){return n.handleEnded(e)})),n}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?_t(this.player_.play()):this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(function(e){return t.handleSeeked(e)}))},t}(Ki)).prototype.controlText_="Play",lt.registerComponent("PlayToggle",Dt);var Qi=Yi;function $i(e,t){return Qi(e,t=void 0===t?e:t)}function Ji(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}function Zi(e,t){return Ji(e/t*100,0,100).toFixed(2)+"%"}(Ot=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.on(t,["timeupdate","ended"],(function(e){return n.updateContent(e)})),n.updateTextNode_(),n}dt(t,e);var i=t.prototype;return i.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control"}),n=Y("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return i.appendChild(n),this.contentEl_=Y("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},i.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},i.updateTextNode_=function(e){var t=this;e=$i(e=void 0===e?0:e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(function(){var e;t.contentEl_&&((e=t.textNode_)&&t.contentEl_.firstChild!==e&&(e=null,d.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),t.textNode_=document.createTextNode(t.formattedTime_),t.textNode_&&(e?t.contentEl_.replaceChild(t.textNode_,e):t.contentEl_.appendChild(t.textNode_)))})))},i.updateContent=function(e){},t}(lt)).prototype.labelText_="Time",Ot.prototype.controlText_="Time",lt.registerComponent("TimeDisplay",Ot),(Mt=function(e){function t(){return e.apply(this,arguments)||this}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateTextNode_(t)},t}(Ot)).prototype.labelText_="Current Time",Mt.prototype.controlText_="Current Time",lt.registerComponent("CurrentTimeDisplay",Mt),(B=function(e){function t(t,i){var n=e.call(this,t,i)||this;return i=function(e){return n.updateContent(e)},n.on(t,"durationchange",i),n.on(t,"loadstart",i),n.on(t,"loadedmetadata",i),n}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(Ot)).prototype.labelText_="Duration",B.prototype.controlText_="Duration",lt.registerComponent("DurationDisplay",B),lt.registerComponent("TimeDivider",function(e){function t(){return e.apply(this,arguments)||this}return dt(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=e.prototype.createEl.call(this,"div"),n=e.prototype.createEl.call(this,"span",{textContent:"/"});return i.appendChild(n),t.appendChild(i),t},t}(lt)),(p=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.on(t,"durationchange",(function(e){return n.updateContent(e)})),n}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return!1!==this.options_.displayNegative&&t.insertBefore(Y("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},t}(Ot)).prototype.labelText_="Remaining Time",p.prototype.controlText_="Remaining Time",lt.registerComponent("RemainingTimeDisplay",p),lt.registerComponent("LiveDisplay",function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.updateShowing(),n.on(n.player(),"durationchange",(function(e){return n.updateShowing(e)})),n}dt(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=Y("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(Y("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(lt)),(Zt=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.updateLiveEdgeStatus(),n.player_.liveTracker&&(n.updateLiveEdgeStatusHandler_=function(e){return n.updateLiveEdgeStatus(e)},n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatusHandler_)),n}dt(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=Y("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,e.prototype.dispose.call(this)},t}(Ki)).prototype.controlText_="Seek to live, currently playing live",lt.registerComponent("SeekToLive",Zt),cn=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.handleMouseDown_=function(e){return n.handleMouseDown(e)},n.handleMouseUp_=function(e){return n.handleMouseUp(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleMouseMove_=function(e){return n.handleMouseMove(e)},n.update_=function(e){return n.update(e)},n.bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}dt(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)},i.createEl=function(t,i,n){return void 0===n&&(n={}),(i=void 0===i?{}:i).className=i.className+" vjs-slider",i=_({tabIndex:0},i),n=_({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||D||e.preventDefault(),oe(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;ue(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.update()},i.update=function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",(function(){var i=e.vertical()?"height":"width";e.bar.el().style[i]=(100*t).toFixed(2)+"%"}))),t}},i.getProgress=function(){return Number(Ji(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){return e=de(this.el_,e),this.vertical()?e.y:e.x},i.handleKeyDown=function(t){ut.isEventKey(t,"Left")||ut.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):ut.isEventKey(t,"Right")||ut.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(lt),lt.registerComponent("Slider",cn),lt.registerComponent("LoadProgressBar",function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.partEls_=[],n.on(t,"progress",(function(e){return n.update(e)})),n}dt(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),i=Y("span",{className:"vjs-control-text"}),n=Y("span",{textContent:this.localize("Loaded")}),r=document.createTextNode(": ");return this.percentageEl_=Y("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),t},i.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",(function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=(e=e&&e.isLive()?e.seekableEnd():t.player_.duration(),t.player_.bufferedEnd()),r=t.partEls_;e=Zi(n,e),t.percent_!==e&&(t.el_.style.width=e,Q(t.percentageEl_,e),t.percent_=e);for(var a=0;a<i.length;a++){var s=i.start(a),o=i.end(a),u=r[a];u||(u=t.el_.appendChild(Y()),r[a]=u),u.dataset.start===s&&u.dataset.end===o||(u.dataset.start=s,u.dataset.end=o,u.style.left=Zi(s,n),u.style.width=Zi(o-s,n))}for(var l=r.length;l>i.length;l--)t.el_.removeChild(r[l-1]);r.length=i.length}))},t}(lt)),lt.registerComponent("TimeTooltip",function(e){function t(t,i){return(i=e.call(this,t,i)||this).update=He(je(ct(i),i.update),30),i}dt(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=ce(this.el_),r=le(this.player_.el()),a=e.width*t;r&&n&&(t=e.left-r.left+a,r=e.width-a+(r.right-e.right),t<(e=n.width/2)?e+=e-t:r<e&&(e=r),e<0?e=0:e>n.width&&(e=n.width),e=Math.round(e),this.el_.style.right="-"+e+"px",this.write(i))},i.write=function(e){Q(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",(function(){var a,s,o=r.player_.duration();o=r.player_.liveTracker&&r.player_.liveTracker.isLive()?((s=(a=r.player_.liveTracker.liveWindow())-t*a)<1?"":"-")+$i(s,a):$i(i,o),r.update(e,t,o),n&&n()}))},t}(lt)),(ei=function(e){function t(t,i){return(i=e.call(this,t,i)||this).update=He(je(ct(i),i.update),30),i}dt(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i,n=this.getChild("timeTooltip");n&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),n.updateTime(e,t,i))},t}(lt)).prototype.options_={children:[]},j||I||ei.prototype.options_.children.push("timeTooltip"),lt.registerComponent("PlayProgressBar",ei),(k=function(e){function t(t,i){return(i=e.call(this,t,i)||this).update=He(je(ct(i),i.update),30),i}dt(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,(function(){i.el_.style.left=e.width*t+"px"}))},t}(lt)).prototype.options_={children:["timeTooltip"]},lt.registerComponent("MouseTimeDisplay",k),(Lt=function(e){function t(t,i){return(i=e.call(this,t,i)||this).setEventHandlers_(),i}dt(t,e);var i=t.prototype;return i.setEventHandlers_=function(){var e=this;this.update_=je(this,this.update),this.update=He(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(t){var i=this;if("hidden"!==document.visibilityState){var n=e.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",(function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,r=i.player_.duration();t&&t.isLive()&&(r=i.player_.liveTracker.liveCurrentTime()),i.percent_!==n&&(i.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),i.percent_=n),i.currentTime_===e&&i.duration_===r||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[$i(e,r),$i(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(le(i.el()),i.getProgress())})),n}},i.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},i.handleMouseDown=function(t){ye(t)&&(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},i.handleMouseMove=function(e,t){if(void 0===t&&(t=!1),ye(e)){t||this.player_.scrubbing()||this.player_.scrubbing(!0);var i=this.calculateDistance(e),n=this.player_.liveTracker;if(n&&n.isLive()){if(.99<=i)return void n.seekToLiveEdge();var r;if(t=n.seekableStart(),(r=(r=(e=n.liveCurrentTime())<=(r=t+i*n.liveWindow())?e:r)<=t?t+.1:r)===1/0)return}else(r=i*this.player_.duration())===this.player_.duration()&&(r-=.1);this.userSeek_(r)}},i.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?_t(this.player_.play()):this.update_()},i.stepForward=function(){this.userSeek_(this.player_.currentTime()+5)},i.stepBack=function(){this.userSeek_(this.player_.currentTime()-5)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(t){var i,n=this.player_.liveTracker;ut.isEventKey(t,"Space")||ut.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.handleAction(t)):ut.isEventKey(t,"Home")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(0)):ut.isEventKey(t,"End")?(t.preventDefault(),t.stopPropagation(),n&&n.isLive()?this.userSeek_(n.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(ut(t))?(t.preventDefault(),t.stopPropagation(),i=10*(ut.codes[ut(t)]-ut.codes[0])/100,n&&n.isLive()?this.userSeek_(n.seekableStart()+n.liveWindow()*i):this.userSeek_(this.player_.duration()*i)):ut.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):ut.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},t}(cn)).prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},j||I||Lt.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),lt.registerComponent("SeekBar",Lt),(Dt=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.handleMouseMove=He(je(ct(n),n.handleMouseMove),30),n.throttledHandleMouseSeek=He(je(ct(n),n.handleMouseSeek),30),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.handleMouseDownHandler_=function(e){return n.handleMouseDown(e)},n.enable(),n}dt(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t,i,n,r,a=this.getChild("seekBar");a&&(t=a.getChild("playProgressBar"),i=a.getChild("mouseTimeDisplay"),(t||i)&&(r=ce(n=a.el()),e=Ji(e=de(n,e).x,0,1),i&&i.update(r,e),t&&t.update(r,a.getProgress())))},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){var e;this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing()&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying&&_t(this.player_.play())))},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.removeListenersAddedOnMousedownAndTouchstart=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},t}(lt)).prototype.options_={children:["seekBar"]},lt.registerComponent("ProgressControl",Dt),(Mt=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.on(t,["enterpictureinpicture","leavepictureinpicture"],(function(e){return n.handlePictureInPictureChange(e)})),n.on(t,["disablepictureinpicturechanged","loadedmetadata"],(function(e){return n.handlePictureInPictureEnabledChange(e)})),n.on(t,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(function(){"audio"===t.currentType().substring(0,5)||t.audioPosterMode()||t.audioOnlyMode()?(t.isInPictureInPicture()&&t.exitPictureInPicture(),n.hide()):n.show()})),n.disable(),n}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},i.handlePictureInPictureEnabledChange=function(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}(Ki)).prototype.controlText_="Picture-in-Picture",lt.registerComponent("PictureInPictureToggle",Mt),(B=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.on(t,"fullscreenchange",(function(e){return n.handleFullscreenChange(e)})),!1===document[t.fsApi_.fullscreenEnabled]&&n.disable(),n}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(Ki)).prototype.controlText_="Fullscreen",lt.registerComponent("FullscreenToggle",B),lt.registerComponent("VolumeLevel",function(e){function t(){return e.apply(this,arguments)||this}return dt(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return t.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),t},t}(lt)),lt.registerComponent("VolumeLevelTooltip",function(e){function t(t,i){return(i=e.call(this,t,i)||this).update=He(je(ct(i),i.update),30),i}dt(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i,n){if(!i){var r=le(this.el_),a=le(this.player_.el());if(i=e.width*t,!a||!r)return;t=e.left-a.left+i,a=e.width-i+(a.right-e.right),t<(e=r.width/2)?e+=e-t:a<e&&(e=a),e<0?e=0:e>r.width&&(e=r.width),this.el_.style.right="-"+e+"px"}this.write(n+"%")},i.write=function(e){Q(this.el_,e)},i.updateVolume=function(e,t,i,n,r){var a=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(function(){a.update(e,t,i,n.toFixed(0)),r&&r()}))},t}(lt)),(Ot=function(e){function t(t,i){return(i=e.call(this,t,i)||this).update=He(je(ct(i),i.update),30),i}dt(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t,i){var n=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,(function(){i?n.el_.style.bottom=e.height*t+"px":n.el_.style.left=e.width*t+"px"}))},t}(lt)).prototype.options_={children:["volumeLevelTooltip"]},lt.registerComponent("MouseVolumeLevelDisplay",Ot),(p=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.on("slideractive",(function(e){return n.updateLastVolume_(e)})),n.on(t,"volumechange",(function(e){return n.updateARIAAttributes(e)})),t.ready((function(){return n.updateARIAAttributes()})),n}dt(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){ye(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){var t,i,n,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=le(n=this.el()),i=this.vertical(),n=de(n,e),n=Ji(n=i?n.y:n.x,0,1),r.update(t,n,i)),ye(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",(function(){0===e.player_.volume()&&e.player_.lastVolume_(t)}))},t}(cn)).prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},j||I||p.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),p.prototype.playerEvent="volumechange",lt.registerComponent("VolumeBar",p),(Zt=function(e){function t(t,i){var n,r,a;return(i=void 0===i?{}:i).vertical=i.vertical||!1,void 0!==i.volumeBar&&!T(i.volumeBar)||(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),n=e.call(this,t,i)||this,r=ct(n),(a=t).tech_&&!a.tech_.featuresVolumeControl&&r.addClass("vjs-hidden"),r.on(a,"loadstart",(function(){a.tech_.featuresVolumeControl?r.removeClass("vjs-hidden"):r.addClass("vjs-hidden")})),n.throttledHandleMouseMove=He(je(ct(n),n.handleMouseMove),30),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n.on("touchstart",(function(e){return n.handleMouseDown(e)})),n.on("mousemove",(function(e){return n.handleMouseMove(e)})),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}dt(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(lt)).prototype.options_={children:["volumeBar"]},lt.registerComponent("VolumeControl",Zt),(ei=function(e){function t(t,i){var n,r,a=e.call(this,t,i)||this;return n=ct(a),(r=t).tech_&&!r.tech_.featuresMuteControl&&n.addClass("vjs-hidden"),n.on(r,"loadstart",(function(){r.tech_.featuresMuteControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")})),a.on(t,["loadstart","volumechange"],(function(e){return a.update(e)})),a}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();0===t?(this.player_.volume(i<.1?.1:i),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;j&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)ee(this.el_,"vjs-vol-"+i);Z(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(Ki)).prototype.controlText_="Mute",lt.registerComponent("MuteToggle",ei),(k=function(e){function t(t,i){var n;return void 0!==(i=void 0===i?{}:i).inline?i.inline=i.inline:i.inline=!0,void 0!==i.volumeControl&&!T(i.volumeControl)||(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).handleKeyPressHandler_=function(e){return n.handleKeyPress(e)},n.on(t,["loadstart"],(function(e){return n.volumePanelState_(e)})),n.on(n.muteToggle,"keyup",(function(e){return n.handleKeyPress(e)})),n.on(n.volumeControl,"keyup",(function(e){return n.handleVolumeControlKeyUp(e)})),n.on("keydown",(function(e){return n.handleKeyPress(e)})),n.on("mouseover",(function(e){return n.handleMouseOver(e)})),n.on("mouseout",(function(e){return n.handleMouseOut(e)})),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}dt(t,e);var i=t.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},i.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},i.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){ut.isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),Re(document,"keyup",this.handleKeyPressHandler_)},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),Ne(document,"keyup",this.handleKeyPressHandler_)},i.handleKeyPress=function(e){ut.isEventKey(e,"Esc")&&this.handleMouseOut()},t}(lt)).prototype.options_={children:["muteToggle","volumeControl"]},lt.registerComponent("VolumePanel",k);var en=function(e){function t(t,i){var n=e.call(this,t,i)||this;return i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",(function(e){return n.handleKeyDown(e)})),n.boundHandleBlur_=function(e){return n.handleBlur(e)},n.boundHandleTapClick_=function(e){return n.handleTapClick(e)},n}dt(t,e);var i=t.prototype;return i.addEventListenerForItem=function(e){e instanceof lt&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof lt&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},i.addItem=function(e){(e=this.addChild(e))&&this.addEventListenerForItem(e)},i.createEl=function(){var t=this.options_.contentElType||"ul";return this.contentEl_=Y(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),(t=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"})).appendChild(this.contentEl_),Re(t,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),t},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},i.handleBlur=function(e){var t=e.relatedTarget||document.activeElement;this.children().some((function(e){return e.el()===t}))||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()},i.handleTapClick=function(e){var t;this.menuButton_&&(this.menuButton_.unpressButton(),t=this.children(),!Array.isArray(t)||(t=t.filter((function(t){return t.el()===e.target}))[0])&&"CaptionSettingsMenuItem"!==t.name()&&this.menuButton_.focus())},i.handleKeyDown=function(e){ut.isEventKey(e,"Left")||ut.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(ut.isEventKey(e,"Right")||ut.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},i.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},i.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0<t.length&&(e<0?e=0:e>=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())},t}(lt);lt.registerComponent("Menu",en),Lt=function(e){function t(t,i){var n;return(n=e.call(this,t,i=void 0===i?{}:i)||this).menuButton_=new Ki(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true"),i=Ki.prototype.buildCSSClass(),n.menuButton_.el_.className=n.buildCSSClass()+" "+i,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0,i=function(e){return n.handleClick(e)},n.handleMenuKeyUp_=function(e){return n.handleMenuKeyUp(e)},n.on(n.menuButton_,"tap",i),n.on(n.menuButton_,"click",i),n.on(n.menuButton_,"keydown",(function(e){return n.handleKeyDown(e)})),n.on(n.menuButton_,"mouseenter",(function(){n.addClass("vjs-hover"),n.menu.show(),Re(document,"keyup",n.handleMenuKeyUp_)})),n.on("mouseleave",(function(e){return n.handleMouseLeave(e)})),n.on("keydown",(function(e){return n.handleSubmenuKeyDown(e)})),n}dt(t,e);var i=t.prototype;return i.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))},i.createMenu=function(){var e,t=new en(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=Y("li",{className:"vjs-menu-title",textContent:rt(this.options_.title),tabIndex:-1}),e=new lt(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(var i=0;i<this.items.length;i++)t.addItem(this.items[i]);return t},i.createItems=function(){},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},i.buildWrapperCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+Ki.prototype.buildCSSClass()+" "+e.prototype.buildCSSClass.call(this)},i.buildCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+e.prototype.buildCSSClass.call(this)},i.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},i.dispose=function(){this.handleMouseLeave(),e.prototype.dispose.call(this)},i.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},i.handleMouseLeave=function(e){this.removeClass("vjs-hover"),Ne(document,"keyup",this.handleMenuKeyUp_)},i.focus=function(){this.menuButton_.focus()},i.blur=function(){this.menuButton_.blur()},i.handleKeyDown=function(e){ut.isEventKey(e,"Esc")||ut.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),ut.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(ut.isEventKey(e,"Up")||ut.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},i.handleMenuKeyUp=function(e){(ut.isEventKey(e,"Esc")||ut.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},i.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},i.handleSubmenuKeyDown=function(e){(ut.isEventKey(e,"Esc")||ut.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),ut.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},i.pressButton=function(){this.enabled_&&(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),j&&X()||this.menu.focus())},i.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},i.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},i.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},t}(lt),lt.registerComponent("MenuButton",Lt),Dt=function(e){function t(t,i){var n=i.tracks;if((i=e.call(this,t,i)||this).items.length<=1&&i.hide(),!n)return ct(i);var r=je(ct(i),i.update);return n.addEventListener("removetrack",r),n.addEventListener("addtrack",r),n.addEventListener("labelchange",r),i.player_.on("ready",r),i.player_.on("dispose",(function(){n.removeEventListener("removetrack",r),n.removeEventListener("addtrack",r),n.removeEventListener("labelchange",r)})),i}return dt(t,e),t}(Lt),lt.registerComponent("TrackButton",Dt);var tn=["Tab","Esc","Up","Down","Right","Left"];Mt=function(e){function t(t,i){return(t=e.call(this,t,i)||this).selectable=i.selectable,t.isSelected_=i.selected||!1,t.multiSelectable=i.multiSelectable,t.selected(t.isSelected_),t.selectable?t.multiSelectable?t.el_.setAttribute("role","menuitemcheckbox"):t.el_.setAttribute("role","menuitemradio"):t.el_.setAttribute("role","menuitem"),t}dt(t,e);var i=t.prototype;return i.createEl=function(t,i,n){return this.nonIconControl=!0,(n=e.prototype.createEl.call(this,"li",_({className:"vjs-menu-item",tabIndex:-1},i),n)).replaceChild(Y("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),n.querySelector(".vjs-icon-placeholder")),n},i.handleKeyDown=function(t){tn.some((function(e){return ut.isEventKey(t,e)}))||e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){this.selected(!0)},i.selected=function(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))},t}(E),lt.registerComponent("MenuItem",Mt);var nn=function(e){function t(t,i){var n,r,a=i.track,s=t.textTracks();function o(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(ct(n),t)}function u(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleSelectedLanguageChange.apply(ct(n),t)}return i.label=a.label||a.language||"Unknown",i.selected="showing"===a.mode,(n=e.call(this,t,i)||this).track=a,n.kinds=(i.kinds||[i.kind||n.track.kind]).filter(Boolean),t.on(["loadstart","texttrackchange"],o),s.addEventListener("change",o),s.addEventListener("selectedlanguagechange",u),n.on("dispose",(function(){t.off(["loadstart","texttrackchange"],o),s.removeEventListener("change",o),s.removeEventListener("selectedlanguagechange",u)})),void 0===s.onchange&&n.on(["tap","click"],(function(){if("object"!=typeof window.Event)try{r=new window.Event("change")}catch(e){}r||(r=document.createEvent("Event")).initEvent("change",!0,!0),s.dispatchEvent(r)})),n.handleTracksChange(),n}dt(t,e);var i=t.prototype;return i.handleClick=function(t){var i=this.track,n=this.player_.textTracks();if(e.prototype.handleClick.call(this,t),n)for(var r=0;r<n.length;r++){var a=n[r];-1!==this.kinds.indexOf(a.kind)&&(a===i?"showing"!==a.mode&&(a.mode="showing"):"disabled"!==a.mode&&(a.mode="disabled"))}},i.handleTracksChange=function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)},i.handleSelectedLanguageChange=function(e){var t;"showing"===this.track.mode&&((t=this.player_.cache_.selectedLanguage)&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind||(this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}))},i.dispose=function(){this.track=null,e.prototype.dispose.call(this)},t}(Mt);lt.registerComponent("TextTrackMenuItem",nn);var rn=function(e){function t(t,i){return i.track={player:t,kind:i.kind,kinds:i.kinds,default:!1,mode:"disabled"},i.kinds||(i.kinds=[i.kind]),i.label?i.track.label=i.label:i.track.label=i.kinds.join(" and ")+" off",i.selectable=!0,i.multiSelectable=!1,e.call(this,t,i)||this}dt(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var a=t[n];if(-1<this.options_.kinds.indexOf(a.kind)&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var a=t[n];if(-1<["captions","descriptions","subtitles"].indexOf(a.kind)&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(nn);lt.registerComponent("OffTextTrackMenuItem",rn),B=function(e){function t(t,i){return(i=void 0===i?{}:i).tracks=t.textTracks(),e.call(this,t,i)||this}return dt(t,e),t.prototype.createItems=function(e,t){var i;void 0===t&&(t=nn),this.label_&&(i=this.label_+" off"),(e=void 0===e?[]:e).push(new rn(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<n.length;r++){var a,s=n[r];-1<this.kinds_.indexOf(s.kind)&&((a=new t(this.player_,{track:s,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1})).addClass("vjs-"+s.kind+"-menu-item"),e.push(a))}return e},t}(Dt),lt.registerComponent("TextTrackButton",B);var an=function(e){function t(t,i){var n=i.track,r=i.cue,a=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=r.text,i.selected=r.startTime<=a&&a<r.endTime,(i=e.call(this,t,i)||this).track=n,i.cue=r,i}return dt(t,e),t.prototype.handleClick=function(t){e.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime)},t}(Mt);lt.registerComponent("ChaptersTrackMenuItem",an),(Ot=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.selectCurrentItem_=function(){r.items.forEach((function(e){e.selected(r.track_.activeCues[0]===e.cue)}))},r}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)},i.update=function(t){t&&t.track&&"chapters"!==t.track.kind||((t=this.findChaptersTrack())!==this.track_?(this.setTrack(t),e.prototype.update.call(this)):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&e.prototype.update.call(this))},i.setTrack=function(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_&&(this.track_.mode="hidden",(e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&e.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)))},i.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;0<=t;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(rt(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i<n;i++){var r=t[i];r=new an(this.player_,{track:this.track_,cue:r}),e.push(r)}return e},t}(B)).prototype.kind_="chapters",Ot.prototype.controlText_="Chapters",lt.registerComponent("ChaptersButton",Ot),(cn=function(e){function t(t,i,n){n=e.call(this,t,i,n)||this;var r=t.textTracks(),a=je(ct(n),n.handleTracksChange);return r.addEventListener("change",a),n.on("dispose",(function(){r.removeEventListener("change",a)})),n}dt(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!1,n=0,r=t.length;n<r;n++){var a=t[n];if(a.kind!==this.kind_&&"showing"===a.mode){i=!0;break}}i?this.disable():this.enable()},i.buildCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(B)).prototype.kind_="descriptions",cn.prototype.controlText_="Descriptions",lt.registerComponent("DescriptionsButton",cn),(p=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(B)).prototype.kind_="subtitles",p.prototype.controlText_="Subtitles",lt.registerComponent("SubtitlesButton",p);var sn=function(e){function t(t,i){return i.track={player:t,kind:i.kind,label:i.kind+" settings",selectable:!1,default:!1,mode:"disabled"},i.selectable=!1,i.name="CaptionSettingsMenuItem",(t=e.call(this,t,i)||this).addClass("vjs-texttrack-settings"),t.controlText(", opens "+i.kind+" settings dialog"),t}return dt(t,e),t.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},t}(nn);lt.registerComponent("CaptionSettingsMenuItem",sn),(Zt=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-captions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-captions-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new sn(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t)},t}(B)).prototype.kind_="captions",Zt.prototype.controlText_="Captions",lt.registerComponent("CaptionsButton",Zt);var on=function(e){function t(){return e.apply(this,arguments)||this}return dt(t,e),t.prototype.createEl=function(t,i,n){return n=(i=e.prototype.createEl.call(this,t,i,n)).querySelector(".vjs-menu-item-text"),"captions"===this.options_.track.kind&&(n.appendChild(Y("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(Y("span",{className:"vjs-control-text",textContent:" "+this.localize("Captions")}))),i},t}(nn);lt.registerComponent("SubsCapsMenuItem",on),(ei=function(e){function t(t,i){return(i=e.call(this,t,i=void 0===i?{}:i)||this).label_="subtitles",-1<["en","en-us","en-ca","fr-ca"].indexOf(i.player_.language_)&&(i.label_="captions"),i.menuButton_.controlText(rt(i.label_)),i}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new sn(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t,on)},t}(B)).prototype.kinds_=["captions","subtitles"],ei.prototype.controlText_="Subtitles",lt.registerComponent("SubsCapsButton",ei);var un=function(e){function t(t,i){var n,r=i.track,a=t.audioTracks();function s(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(ct(n),t)}return i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item"),a.addEventListener("change",s),n.on("dispose",(function(){a.removeEventListener("change",s)})),n}dt(t,e);var i=t.prototype;return i.createEl=function(t,i,n){return n=(i=e.prototype.createEl.call(this,t,i,n)).querySelector(".vjs-menu-item-text"),"main-desc"===this.options_.track.kind&&(n.appendChild(Y("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(Y("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),i},i.handleClick=function(t){if(e.prototype.handleClick.call(this,t),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks)for(var i=this.player_.audioTracks(),n=0;n<i.length;n++){var r=i[n];r!==this.track&&(r.enabled=r===this.track)}},i.handleTracksChange=function(e){this.selected(this.track.enabled)},t}(Mt);lt.registerComponent("AudioTrackMenuItem",un),(k=function(e){function t(t,i){return(i=void 0===i?{}:i).tracks=t.audioTracks(),e.call(this,t,i)||this}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-audio-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-audio-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(e){void 0===e&&(e=[]),this.hideThreshold_=1;for(var t=this.player_.audioTracks(),i=0;i<t.length;i++){var n=t[i];e.push(new un(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e},t}(Dt)).prototype.controlText_="Audio Track",lt.registerComponent("AudioTrackButton",k);var ln=function(e){function t(t,i){var n,r=i.rate,a=parseFloat(r,10);return i.label=r,i.selected=a===t.playbackRate(),i.selectable=!0,i.multiSelectable=!1,(n=e.call(this,t,i)||this).label=r,n.rate=a,n.on(t,"ratechange",(function(e){return n.update(e)})),n}dt(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},i.update=function(e){this.selected(this.player().playbackRate()===this.rate)},t}(Mt);ln.prototype.contentElType="button",lt.registerComponent("PlaybackRateMenuItem",ln),(E=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.menuButton_.el_.setAttribute("aria-describedby",n.labelElId_),n.updateVisibility(),n.updateLabel(),n.on(t,"loadstart",(function(e){return n.updateVisibility(e)})),n.on(t,"ratechange",(function(e){return n.updateLabel(e)})),n.on(t,"playbackrateschange",(function(e){return n.handlePlaybackRateschange(e)})),n}dt(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this);return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=Y("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),t.appendChild(this.labelEl_),t},i.dispose=function(){this.labelEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){for(var e=this.playbackRates(),t=[],i=e.length-1;0<=i;i--)t.push(new ln(this.player(),{rate:e[i]+"x"}));return t},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){var t=this.player().playbackRate(),i=this.playbackRates();t=(i.indexOf(t)+1)%i.length,this.player().playbackRate(i[t])},i.handlePlaybackRateschange=function(e){this.update()},i.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0<this.playbackRates().length},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},t}(Lt)).prototype.controlText_="Playback Rate",lt.registerComponent("PlaybackRateMenuButton",E),Ot=function(e){function t(){return e.apply(this,arguments)||this}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(t,i,n){return void 0===t&&(t="div"),void 0===n&&(n={}),(i=void 0===i?{}:i).className||(i.className=this.buildCSSClass()),e.prototype.createEl.call(this,t,i,n)},t}(lt),lt.registerComponent("Spacer",Ot),lt.registerComponent("CustomControlSpacer",function(e){function t(){return e.apply(this,arguments)||this}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:" "})},t}(Ot)),(cn=function(e){function t(){return e.apply(this,arguments)||this}return dt(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(lt)).prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in document&&cn.prototype.options_.children.splice(cn.prototype.options_.children.length-1,0,"pictureInPictureToggle"),lt.registerComponent("ControlBar",cn),(p=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.on(t,"error",(function(e){return n.open(e)})),n}dt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(St)).prototype.options_=m({},St.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),lt.registerComponent("ErrorDisplay",p);var cn,dn="vjs-text-track-settings",hn={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Zt=["#000","Black"],Lt=["#FFF","White"],Mt=["#F00","Red"],Dt=["#0F0","Green"],B=["#00F","Blue"],E=["#FF0","Yellow"],k=["#F0F","Magenta"],ei=["#0FF","Cyan"]]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Ot=["1","Opaque"],cn=["0.5","Semi-Transparent"],p=["0","Transparent"]]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Lt,Zt,Mt,Dt,B,E,k,ei]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Ot,cn]},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:[p,cn,Ot]}};function pn(e,t){if((e=t?t(e):e)&&"none"!==e)return e}hn.windowColor.options=hn.backgroundColor.options,lt.registerComponent("TextTrackSettings",function(e){function t(t,i){var n;return i.temporary=!1,(n=e.call(this,t,i)||this).updateDisplay=n.updateDisplay.bind(ct(n)),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=Y("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")}),n.el().appendChild(n.endDialog),n.setDefaults(),void 0===i.persistTextTrackSettings&&(n.options_.persistTextTrackSettings=n.options_.playerOptions.persistTextTrackSettings),n.on(n.$(".vjs-done-button"),"click",(function(){n.saveSettings(),n.close()})),n.on(n.$(".vjs-default-button"),"click",(function(){n.setDefaults(),n.updateDisplay()})),v(hn,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}dt(t,e);var i=t.prototype;return i.dispose=function(){this.endDialog=null,e.prototype.dispose.call(this)},i.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=(e=hn[e]).id.replace("%s",this.id_),a=[t,r].join(" ").trim();return["<"+i+' id="'+r+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(e.label),"</"+i+">",'<select aria-labelledby="'+a+'">'].concat(e.options.map((function(e){var t=r+"-"+e[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+e[0]+'" ','aria-labelledby="'+a+" "+t+'">',n.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")},i.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",e),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")},i.createElBgColor_=function(){var e="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",e),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")},i.createElWinColor_=function(){var e="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",e),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")},i.createElColors_=function(){return Y("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return Y("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})},i.createElControls_=function(){var e=this.localize("restore all settings to the default values");return Y("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+e+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+e+"</span>","</button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})},i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.label=function(){return this.localize("Caption Settings Dialog")},i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.buildCSSClass=function(){return e.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e,t,i,n=this;return t=function(e,t,i){var r;return void 0!==(r=n.$(t.selector),t=t.parser,t=pn(r.options[r.options.selectedIndex].value,t))&&(e[i]=t),e},void 0===(i={})&&(i=0),y(e=hn).reduce((function(i,n){return t(i,e[n],n)}),i)},i.setValues=function(e){var t=this;v(hn,(function(i,n){!function(e,t,i){if(t)for(var n=0;n<e.options.length;n++)if(pn(e.options[n].value,i)===t){e.selectedIndex=n;break}}(t.$(i.selector),e[n],i.parser)}))},i.setDefaults=function(){var e=this;v(hn,(function(t){var i=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=i}))},i.restoreSettings=function(){var e;try{e=JSON.parse(window.localStorage.getItem(dn))}catch(e){d.warn(e)}e&&this.setValues(e)},i.saveSettings=function(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(dn,JSON.stringify(e)):window.localStorage.removeItem(dn)}catch(e){d.warn(e)}}},i.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},i.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=(t=this.player_.controlBar)&&t.subsCapsButton,t=t&&t.captionsButton;e?e.focus():t&&t.focus()},t}(St)),lt.registerComponent("ResizeManager",function(e){function t(t,i){var n,r=i.ResizeObserver||window.ResizeObserver,a=at({createEl:!(r=null!==i.ResizeObserver&&r),reportTouchActivity:!1},i);return(n=e.call(this,t,a)||this).ResizeObserver=i.ResizeObserver||window.ResizeObserver,n.loadListener_=null,n.resizeObserver_=null,n.debouncedHandler_=function(e,t,i,n){var r;function a(){var t=this,i=arguments,a=function(){a=r=null,e.apply(t,i)};n.clearTimeout(r),r=n.setTimeout(a,100)}return void 0===n&&(n=window),a.cancel=function(){n.clearTimeout(r),r=null},a}((function(){n.resizeHandler()}),0,0,ct(n)),r?(n.resizeObserver_=new n.ResizeObserver(n.debouncedHandler_),n.resizeObserver_.observe(t.el())):(n.loadListener_=function(){var e,t;n.el_&&n.el_.contentWindow&&(e=n.debouncedHandler_,t=n.unloadListener_=function(){Ne(this,"resize",e),Ne(this,"unload",t),t=null},Re(n.el_.contentWindow,"unload",t),Re(n.el_.contentWindow,"resize",e))},n.one("load",n.loadListener_)),n}dt(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})},i.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},i.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,e.prototype.dispose.call(this)},t}(lt));var fn={trackingThreshold:20,liveTolerance:15};function mn(e){if((n=e.el()).hasAttribute("src"))return e.triggerSourceset(n.src),1;var t=e.$$("source"),i=[],n="";if(t.length){for(var r=0;r<t.length;r++){var a=t[r].src;a&&-1===i.indexOf(a)&&i.push(a)}return!!i.length&&(1===i.length&&(n=i[0]),e.triggerSourceset(n),!0)}}function gn(e,t){for(var i={},n=0;n<e.length&&!((i=Object.getOwnPropertyDescriptor(e[n],t))&&i.set&&i.get);n++);return i.enumerable=!0,i.configurable=!0,i}function yn(e){var t,i,n,r=e.el();r.resetSourceWatch_||(t={},i=gn([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,bn],"innerHTML"),n=function(t){return function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var s=t.apply(r,n);return mn(e),s}},["append","appendChild","insertAdjacentHTML"].forEach((function(e){r[e]&&(t[e]=r[e],r[e]=n(t[e]))})),Object.defineProperty(r,"innerHTML",at(i,{set:n(i.set)})),r.resetSourceWatch_=function(){r.resetSourceWatch_=null,Object.keys(t).forEach((function(e){r[e]=t[e]})),Object.defineProperty(r,"innerHTML",i)},e.one("sourceset",r.resetSourceWatch_))}function vn(e,t,i,n){function r(i){return Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0})}var a={configurable:!0,enumerable:!0,get:function(){var e=i();return r(e),e}};return(n=void 0===n||n)&&(a.set=r),Object.defineProperty(e,t,a)}lt.registerComponent("LiveTracker",function(e){function t(t,i){i=at(fn,i,{createEl:!1});var n=e.call(this,t,i)||this;return n.handleVisibilityChange_=function(e){return n.handleVisibilityChange(e)},n.trackLiveHandler_=function(){return n.trackLive_()},n.handlePlay_=function(e){return n.handlePlay(e)},n.handleFirstTimeupdate_=function(e){return n.handleFirstTimeupdate(e)},n.handleSeeked_=function(e){return n.handleSeeked(e)},n.seekToLiveEdge_=function(e){return n.seekToLiveEdge(e)},n.reset_(),n.on(n.player_,"durationchange",(function(e){return n.handleDurationchange(e)})),n.on(n.player_,"canplay",(function(){return n.toggleTracking()})),M&&"hidden"in document&&"visibilityState"in document&&n.on(document,"visibilitychange",n.handleVisibilityChange_),n}dt(t,e);var i=t.prototype;return i.handleVisibilityChange=function(){this.player_.duration()===1/0&&(document.hidden?this.stopTracking():this.startTracking())},i.trackLive_=function(){var e,t=this.player_.seekable();t&&t.length&&(e=Number(window.performance.now().toFixed(4)),t=-1===this.lastTime_?0:(e-this.lastTime_)/1e3,this.lastTime_=e,this.pastSeekEnd_=this.pastSeekEnd()+t,e=this.liveCurrentTime(),t=this.player_.currentTime(),t=this.player_.paused()||this.seekedBehindLive_||Math.abs(e-t)>this.options_.liveTolerance,(t=!(!this.timeupdateSeen_||e===1/0)&&t)!==this.behindLiveEdge_&&(this.behindLiveEdge_=t,this.trigger("liveedgechange")))},i.handleDurationchange=function(){this.toggleTracking()},i.toggleTracking=function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},i.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))},i.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},i.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2<e,this.nextSeekedFromUser_=!1,this.trackLive_()},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},i.reset_=function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)},i.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},i.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},i.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return"number"==typeof this.trackingInterval_},i.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},i.dispose=function(){this.off(document,"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),e.prototype.dispose.call(this)},t}(lt));var _n,bn=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(e){var t=document.createElement(this.nodeName.toLowerCase());t.innerHTML=e;for(var i=document.createDocumentFragment();t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",window.Element.prototype.appendChild.call(this,i),this.innerHTML}}),Tn=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?xt(window.Element.prototype.getAttribute.call(this,"src")):""},set:function(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}}),Sn=function(e){function t(t,i){var n=e.call(this,t,i)||this,r=(i=t.source,!1);if(n.featuresVideoFrameCallback=n.featuresVideoFrameCallback&&"VIDEO"===n.el_.tagName,i&&(n.el_.currentSrc!==i.src||t.tag&&3===t.tag.initNetworkState_)?n.setSource(i):n.handleLateInit_(n.el_),t.enableSourceset&&n.setupSourcesetHandling_(),n.isScrubbing_=!1,n.el_.hasChildNodes()){for(var a=n.el_.childNodes,s=a.length,o=[];s--;){var u=a[s];"track"===u.nodeName.toLowerCase()&&(n.featuresNativeTextTracks?(n.remoteTextTrackEls().addTrackElement_(u),n.remoteTextTracks().addTrack(u.track),n.textTracks().addTrack(u.track),r||n.el_.hasAttribute("crossorigin")||!Pt(u.src)||(r=!0)):o.push(u))}for(var l=0;l<o.length;l++)n.el_.removeChild(o[l])}return n.proxyNativeTracks_(),n.featuresNativeTextTracks&&r&&d.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),n.restoreMetadataTracksInIOSNativePlayer_(),(U||F||A)&&!0===t.nativeControlsForTouch&&n.setControls(!0),n.proxyWebkitFullscreen_(),n.triggerReady(),n}dt(t,e);var i=t.prototype;return i.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),t.disposeMediaElement(this.el_),this.options_=null,e.prototype.dispose.call(this)},i.setupSourcesetHandling_=function(){!function(e){var t,i,n,r;e.featuresSourceset&&((t=e.el()).resetSourceset_||(i=gn([e.el(),window.HTMLMediaElement.prototype,Tn],"src"),n=t.setAttribute,r=t.load,Object.defineProperty(t,"src",at(i,{set:function(n){return n=i.set.call(t,n),e.triggerSourceset(t.src),n}})),t.setAttribute=function(i,r){return r=n.call(t,i,r),/src/i.test(i)&&e.triggerSourceset(t.src),r},t.load=function(){var i=r.call(t);return mn(e)||(e.triggerSourceset(""),yn(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):mn(e)||yn(e),t.resetSourceset_=function(){t.resetSourceset_=null,t.load=r,t.setAttribute=n,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}))}(this)},i.restoreMetadataTracksInIOSNativePlayer_=function(){function e(){t=[];for(var e=0;e<i.length;e++){var n=i[e];"metadata"===n.kind&&t.push({track:n,storedMode:n.mode})}}var t,i=this.textTracks();function n(){for(var e=0;e<t.length;e++){var r=t[e];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}i.removeEventListener("change",n)}e(),i.addEventListener("change",e),this.on("dispose",(function(){return i.removeEventListener("change",e)})),this.on("webkitbeginfullscreen",(function(){i.removeEventListener("change",e),i.removeEventListener("change",n),i.addEventListener("change",n)})),this.on("webkitendfullscreen",(function(){i.removeEventListener("change",e),i.addEventListener("change",e),i.removeEventListener("change",n)}))},i.overrideNative_=function(e,t){var i,n=this;t===this["featuresNative"+e+"Tracks"]&&(this[(i=e.toLowerCase())+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach((function(e){n.el()[i+"Tracks"].removeEventListener(e,n[i+"TracksListeners_"][e])})),this["featuresNative"+e+"Tracks"]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i))},i.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},i.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},i.proxyNativeTracksForType_=function(e){var t,i,n=this,r=Qt[e],a=this.el()[r.getterName],s=this[r.getterName]();this["featuresNative"+r.capitalName+"Tracks"]&&a&&a.addEventListener&&(i=function(){for(var e=[],t=0;t<s.length;t++){for(var i=!1,n=0;n<a.length;n++)if(a[n]===s[t]){i=!0;break}i||e.push(s[t])}for(;e.length;)s.removeTrack(e.shift())},this[r.getterName+"Listeners_"]=t={change:function(t){var i={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(i),"text"===e&&n[$t.remoteText.getterName]().trigger(i)},addtrack:function(e){s.addTrack(e.track)},removetrack:function(e){s.removeTrack(e.track)}},Object.keys(t).forEach((function(e){var i=t[e];a.addEventListener(e,i),n.on("dispose",(function(t){return a.removeEventListener(e,i)}))})),this.on("loadstart",i),this.on("dispose",(function(e){return n.off("loadstart",i)})))},i.proxyNativeTracks_=function(){var e=this;Qt.names.forEach((function(t){e.proxyNativeTracksForType_(t)}))},i.createEl=function(){var e,i=this.options_.tag;i&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(i?(e=i.cloneNode(!0),i.parentNode&&i.parentNode.insertBefore(e,i),t.disposeMediaElement(i),i=e):(i=document.createElement("video"),e=at({},this.options_.tag&&ne(this.options_.tag)),U&&!0===this.options_.nativeControlsForTouch||delete e.controls,ie(i,_(e,{id:this.options_.techId,class:"vjs-tech"}))),i.playerId=this.options_.playerId),void 0!==this.options_.preload&&ae(i,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(i.disablePictureInPicture=this.options_.disablePictureInPicture);for(var n=["loop","muted","playsinline","autoplay"],r=0;r<n.length;r++){var a=n[r],s=this.options_[a];void 0!==s&&(s?ae(i,a,a):se(i,a),i[a]=s)}return i},i.handleLateInit_=function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,i=function(){t=!0};this.on("loadstart",i);var n=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",n),void this.ready((function(){this.off("loadstart",i),this.off("loadedmetadata",n),t||this.trigger("loadstart")}))}var r=["loadstart"];r.push("loadedmetadata"),2<=e.readyState&&r.push("loadeddata"),3<=e.readyState&&r.push("canplay"),4<=e.readyState&&r.push("canplaythrough"),this.ready((function(){r.forEach((function(e){this.trigger(e)}),this)}))}},i.setScrubbing=function(e){this.isScrubbing_=e},i.scrubbing=function(){return this.isScrubbing_},i.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&H?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){d(e,"Video is not ready. (Video.js)")}},i.duration=function(){var e=this;return this.el_.duration===1/0&&I&&D&&0===this.el_.currentTime?(this.on("timeupdate",(function t(){0<e.el_.currentTime&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))})),NaN):this.el_.duration||NaN},i.width=function(){return this.el_.offsetWidth},i.height=function(){return this.el_.offsetHeight},i.proxyWebkitFullscreen_=function(){var e,t,i=this;"webkitDisplayingFullscreen"in this.el_&&(e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))},this.on("webkitbeginfullscreen",t),this.on("dispose",(function(){i.off("webkitbeginfullscreen",t),i.off("webkitendfullscreen",e)})))},i.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var e=window.navigator&&window.navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},i.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)_t(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}),0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},i.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},i.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},i.requestVideoFrameCallback=function(t){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(t):e.prototype.requestVideoFrameCallback.call(this,t)},i.cancelVideoFrameCallback=function(t){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(t):e.prototype.cancelVideoFrameCallback.call(this,t)},i.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},i.reset=function(){t.resetMediaElement(this.el_)},i.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.setControls=function(e){this.el_.controls=!!e},i.addTextTrack=function(t,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,n):e.prototype.addTextTrack.call(this,t,i,n)},i.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return e.prototype.createRemoteTextTrack.call(this,t);var i=document.createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i},i.addRemoteTextTrack=function(t,i){return i=e.prototype.addRemoteTextTrack.call(this,t,i),this.featuresNativeTextTracks&&this.el().appendChild(i),i},i.removeRemoteTextTrack=function(t){if(e.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),n=i.length;n--;)t!==i[n]&&t!==i[n].track||this.el().removeChild(i[n])},i.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&"function"==typeof window.performance.now?e.creationTime=window.performance.now():window.performance&&window.performance.timing&&"number"==typeof window.performance.timing.navigationStart&&(e.creationTime=window.Date.now()-window.performance.timing.navigationStart),e},t}(Li);vn(Sn,"TEST_VID",(function(){if(G()){var e=document.createElement("video"),t=document.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}})),Sn.isSupported=function(){try{Sn.TEST_VID.volume=.5}catch(e){return!1}return!(!Sn.TEST_VID||!Sn.TEST_VID.canPlayType)},Sn.canPlayType=function(e){return Sn.TEST_VID.canPlayType(e)},Sn.canPlaySource=function(e,t){return Sn.canPlayType(e.type)},Sn.canControlVolume=function(){try{var e=Sn.TEST_VID.volume;Sn.TEST_VID.volume=e/2+.1;var t=e!==Sn.TEST_VID.volume;return t&&j?(window.setTimeout((function(){Sn&&Sn.prototype&&(Sn.prototype.featuresVolumeControl=e!==Sn.TEST_VID.volume)})),!1):t}catch(e){return!1}},Sn.canMuteVolume=function(){try{var e=Sn.TEST_VID.muted;return Sn.TEST_VID.muted=!e,Sn.TEST_VID.muted?ae(Sn.TEST_VID,"muted","muted"):se(Sn.TEST_VID,"muted"),e!==Sn.TEST_VID.muted}catch(e){return!1}},Sn.canControlPlaybackRate=function(){if(I&&D&&O<58)return!1;try{var e=Sn.TEST_VID.playbackRate;return Sn.TEST_VID.playbackRate=e/2+.1,e!==Sn.TEST_VID.playbackRate}catch(e){return!1}},Sn.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},Sn.supportsNativeTextTracks=function(){return H||j&&D},Sn.supportsNativeVideoTracks=function(){return!(!Sn.TEST_VID||!Sn.TEST_VID.videoTracks)},Sn.supportsNativeAudioTracks=function(){return!(!Sn.TEST_VID||!Sn.TEST_VID.audioTracks)},Sn.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function(e){var t=e[0],i=e[1];vn(Sn.prototype,t,(function(){return Sn[i]()}),!0)})),Sn.prototype.featuresVolumeControl=Sn.canControlVolume(),Sn.prototype.movingMediaElementInDOM=!j,Sn.prototype.featuresFullscreenResize=!0,Sn.prototype.featuresProgressEvents=!0,Sn.prototype.featuresTimeupdateEvents=!0,Sn.prototype.featuresVideoFrameCallback=!(!Sn.TEST_VID||!Sn.TEST_VID.requestVideoFrameCallback),Sn.patchCanPlayType=function(){4<=x&&!P&&!D&&(_n=Sn.TEST_VID&&Sn.TEST_VID.constructor.prototype.canPlayType,Sn.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":_n.call(this,e)})},Sn.unpatchCanPlayType=function(){var e=Sn.TEST_VID.constructor.prototype.canPlayType;return _n&&(Sn.TEST_VID.constructor.prototype.canPlayType=_n),e},Sn.patchCanPlayType(),Sn.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},Sn.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){Sn.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){Sn.prototype["set"+rt(e)]=function(t){(this.el_[e]=t)?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){Sn.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){Sn.prototype["set"+rt(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){Sn.prototype[e]=function(){return this.el_[e]()}})),Li.withSourceHandlers(Sn),Sn.nativeSourceHandler={},Sn.nativeSourceHandler.canPlayType=function(e){try{return Sn.TEST_VID.canPlayType(e)}catch(e){return""}},Sn.nativeSourceHandler.canHandleSource=function(e,t){return e.type?Sn.nativeSourceHandler.canPlayType(e.type):e.src?(e=At(e.src),Sn.nativeSourceHandler.canPlayType("video/"+e)):""},Sn.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Sn.nativeSourceHandler.dispose=function(){},Sn.registerSourceHandler(Sn.nativeSourceHandler),Li.registerTech("Html5",Sn);var wn=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],En={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},kn=["tiny","xsmall","small","medium","large","xlarge","huge"],Cn={};kn.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Cn[e]="vjs-layout-"+t}));var In={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},xn=function(e){function i(n,r,s){var o,u;if(n.id=n.id||r.id||"vjs_video_"+xe++,(r=_(i.getTagSettings(n),r)).initChildren=!1,r.createEl=!1,r.evented=!1,r.reportTouchActivity=!1,!r.language)if("function"==typeof n.closest){var l=n.closest("[lang]");l&&l.getAttribute&&(r.language=l.getAttribute("lang"))}else for(var c=n;c&&1===c.nodeType;){if(ne(c).hasOwnProperty("lang")){r.language=c.getAttribute("lang");break}c=c.parentNode}if((o=e.call(this,null,r,s)||this).boundDocumentFullscreenChange_=function(e){return o.documentFullscreenChange_(e)},o.boundFullWindowOnEscKey_=function(e){return o.fullWindowOnEscKey(e)},o.boundUpdateStyleEl_=function(e){return o.updateStyleEl_(e)},o.boundApplyInitTime_=function(e){return o.applyInitTime_(e)},o.boundUpdateCurrentBreakpoint_=function(e){return o.updateCurrentBreakpoint_(e)},o.boundHandleTechClick_=function(e){return o.handleTechClick_(e)},o.boundHandleTechDoubleClick_=function(e){return o.handleTechDoubleClick_(e)},o.boundHandleTechTouchStart_=function(e){return o.handleTechTouchStart_(e)},o.boundHandleTechTouchMove_=function(e){return o.handleTechTouchMove_(e)},o.boundHandleTechTouchEnd_=function(e){return o.handleTechTouchEnd_(e)},o.boundHandleTechTap_=function(e){return o.handleTechTap_(e)},o.isFullscreen_=!1,o.log=h(o.id_),o.fsApi_=a,o.isPosterFromTech_=!1,o.queuedCallbacks_=[],o.isReady_=!1,o.hasStarted_=!1,o.userActive_=!1,o.debugEnabled_=!1,o.audioOnlyMode_=!1,o.audioPosterMode_=!1,o.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!o.options_||!o.options_.techOrder||!o.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");return o.tag=n,o.tagAttributes=n&&ne(n),o.language(o.options_.language),r.languages?(u={},Object.getOwnPropertyNames(r.languages).forEach((function(e){u[e.toLowerCase()]=r.languages[e]})),o.languages_=u):o.languages_=i.prototype.options_.languages,o.resetCache_(),o.poster_=r.poster||"",o.controls_=!!r.controls,n.controls=!1,n.removeAttribute("controls"),o.changingSrc_=!1,o.playCallbacks_=[],o.playTerminatedQueue_=[],n.hasAttribute("autoplay")?o.autoplay(!0):o.autoplay(o.options_.autoplay),r.plugins&&Object.keys(r.plugins).forEach((function(e){if("function"!=typeof o[e])throw new Error('plugin "'+e+'" does not exist')})),o.scrubbing_=!1,o.el_=o.createEl(),et(ct(o),{eventBusKey:"el_"}),o.fsApi_.requestFullscreen&&(Re(document,o.fsApi_.fullscreenchange,o.boundDocumentFullscreenChange_),o.on(o.fsApi_.fullscreenchange,o.boundDocumentFullscreenChange_)),o.fluid_&&o.on(["playerreset","resize"],o.boundUpdateStyleEl_),s=at(o.options_),r.plugins&&Object.keys(r.plugins).forEach((function(e){o[e](r.plugins[e])})),r.debug&&o.debug(!0),o.options_.playerOptions=s,o.middleware_=[],o.playbackRates(r.playbackRates),o.initChildren(),o.isAudio("audio"===n.nodeName.toLowerCase()),o.controls()?o.addClass("vjs-controls-enabled"):o.addClass("vjs-controls-disabled"),o.el_.setAttribute("role","region"),o.isAudio()?o.el_.setAttribute("aria-label",o.localize("Audio Player")):o.el_.setAttribute("aria-label",o.localize("Video Player")),o.isAudio()&&o.addClass("vjs-audio"),o.flexNotSupported_()&&o.addClass("vjs-no-flex"),U&&o.addClass("vjs-touch-enabled"),j||o.addClass("vjs-workinghover"),i.players[o.id_]=ct(o),n=t.split(".")[0],o.addClass("vjs-v"+n),o.userActive(!0),o.reportUserActivity(),o.one("play",(function(e){return o.listenForUserActivity_(e)})),o.on("stageclick",(function(e){return o.handleStageClick_(e)})),o.on("keydown",(function(e){return o.handleKeyDown(e)})),o.on("languagechange",(function(e){return o.handleLanguagechange(e)})),o.breakpoints(o.options_.breakpoints),o.responsive(o.options_.responsive),o.on("ready",(function(){o.audioPosterMode(o.options_.audioPosterMode),o.audioOnlyMode(o.options_.audioOnlyMode)})),o}dt(i,e);var r=i.prototype;return r.dispose=function(){var t=this;this.trigger("dispose"),this.off("dispose"),Ne(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Ne(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),i.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),Oi[this.id()]=null,Jt.names.forEach((function(e){e=Jt[e],(e=t[e.getterName]())&&e.off&&e.off()})),e.prototype.dispose.call(this,{restoreEl:this.options_.restoreEl})},r.createEl=function(){var t,i=this.tag,n=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),r="video-js"===this.tag.tagName.toLowerCase();n?t=this.el_=i.parentNode:r||(t=this.el_=e.prototype.createEl.call(this,"div"));var a,s,o=ne(i);if(r){for(t=this.el_=i,i=this.tag=document.createElement("video");t.children.length;)i.appendChild(t.firstChild);J(t,"video-js")||Z(t,"video-js"),t.appendChild(i),n=this.playerElIngest_=t,Object.keys(t).forEach((function(e){try{i[e]=t[e]}catch(e){}}))}i.setAttribute("tabindex","-1"),o.tabindex="-1",(M||D&&N)&&(i.setAttribute("role","application"),o.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in o&&delete o.width,"height"in o&&delete o.height,Object.getOwnPropertyNames(o).forEach((function(e){r&&"class"===e||t.setAttribute(e,o[e]),r&&i.setAttribute(e,o[e])})),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",(i.player=t.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=Ce("vjs-styles-dimensions"),a=_e(".vjs-styles-defaults"),(s=_e("head")).insertBefore(this.styleEl_,a?a.nextSibling:s.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);for(var u=i.getElementsByTagName("a"),l=0;l<u.length;l++){var c=u.item(l);Z(c,"vjs-hidden"),c.setAttribute("hidden","hidden")}return i.initNetworkState_=i.networkState,i.parentNode&&!n&&i.parentNode.insertBefore(t,i),$(i,t),this.children_.unshift(i),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t},r.crossOrigin=function(e){if(!e)return this.techGet_("crossOrigin");"anonymous"===e||"use-credentials"===e?this.techCall_("setCrossOrigin",e):d.warn('crossOrigin must be "anonymous" or "use-credentials", given "'+e+'"')},r.width=function(e){return this.dimension("width",e)},r.height=function(e){return this.dimension("height",e)},r.dimension=function(e,t){var i=e+"_";if(void 0===t)return this[i]||0;if(""===t||"auto"===t)return this[i]=void 0,void this.updateStyleEl_();var n=parseFloat(t);isNaN(n)?d.error('Improper value "'+t+'" supplied for for '+e):(this[i]=n,this.updateStyleEl_())},r.fluid=function(e){var t,i=this;if(void 0===e)return!!this.fluid_;this.fluid_=!!e,Je(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),t=function(){i.on(["playerreset","resize"],i.boundUpdateStyleEl_)},Je(e=this)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},r.fill=function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},r.aspectRatio=function(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()},r.updateStyleEl_=function(){var e,t,i,n;!0!==window.VIDEOJS_NO_DYNAMIC_STYLE?(n=(i=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0<this.videoWidth()?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"))[1]/i[0],e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/n:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*n,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),Ie(this.styleEl_,"\n ."+i+" {\n width: "+e+"px;\n height: "+t+"px;\n }\n\n ."+i+".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: "+100*n+"%;\n }\n ")):(t="number"==typeof this.width_?this.width_:this.options_.width,i="number"==typeof this.height_?this.height_:this.options_.height,(n=this.tech_&&this.tech_.el())&&(0<=t&&(n.width=t),0<=i&&(n.height=i)))},r.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=rt(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Li.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a=this.autoplay(),s={source:t,autoplay:a=!("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset,Promise:this.options_.Promise};if(Jt.names.forEach((function(e){e=Jt[e],s[e.getterName]=i[e.privateName]})),_(s,this.options_[n]),_(s,this.options_[r]),_(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&0<this.cache_.currentTime&&(s.startTime=this.cache_.currentTime),!(e=Li.getTech(e)))throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new e(s),this.tech_.ready(je(this,this.handleTechReady_),!0),function(e,t){e.forEach((function(e){var i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((function(e){return i.addCue(e)}))})),t.textTracks()}(this.textTracksJson_||[],this.tech_),wn.forEach((function(e){i.on(i.tech_,e,(function(t){return i["handleTech"+rt(e)+"_"](t)}))})),Object.keys(En).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+En[e]+"_"].bind(i),event:t}):i["handleTech"+En[e]+"_"](t)}))})),this.on(this.tech_,"loadstart",(function(e){return i.handleTechLoadStart_(e)})),this.on(this.tech_,"sourceset",(function(e){return i.handleTechSourceset_(e)})),this.on(this.tech_,"waiting",(function(e){return i.handleTechWaiting_(e)})),this.on(this.tech_,"ended",(function(e){return i.handleTechEnded_(e)})),this.on(this.tech_,"seeking",(function(e){return i.handleTechSeeking_(e)})),this.on(this.tech_,"play",(function(e){return i.handleTechPlay_(e)})),this.on(this.tech_,"firstplay",(function(e){return i.handleTechFirstPlay_(e)})),this.on(this.tech_,"pause",(function(e){return i.handleTechPause_(e)})),this.on(this.tech_,"durationchange",(function(e){return i.handleTechDurationChange_(e)})),this.on(this.tech_,"fullscreenchange",(function(e,t){return i.handleTechFullscreenChange_(e,t)})),this.on(this.tech_,"fullscreenerror",(function(e,t){return i.handleTechFullscreenError_(e,t)})),this.on(this.tech_,"enterpictureinpicture",(function(e){return i.handleTechEnterPictureInPicture_(e)})),this.on(this.tech_,"leavepictureinpicture",(function(e){return i.handleTechLeavePictureInPicture_(e)})),this.on(this.tech_,"error",(function(e){return i.handleTechError_(e)})),this.on(this.tech_,"posterchange",(function(e){return i.handleTechPosterChange_(e)})),this.on(this.tech_,"textdata",(function(e){return i.handleTechTextData_(e)})),this.on(this.tech_,"ratechange",(function(e){return i.handleTechRateChange_(e)})),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||$(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},r.unloadTech_=function(){var e=this;Jt.names.forEach((function(t){t=Jt[t],e[t.privateName]=e[t.getterName]()})),this.textTracksJson_=function(e){var t=e.$$("track"),i=Array.prototype.map.call(t,(function(e){return e.track}));return Array.prototype.map.call(t,(function(e){var t=bt(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(e){return-1===i.indexOf(e)})).map(bt))}(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},r.tech=function(e){return void 0===e&&d.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},r.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)},r.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)},r.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},r.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_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())},r.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var i,n=function(){var e=t.muted();function i(){t.muted(e)}t.muted(!0),t.playTerminatedQueue_.push(i);var n=t.play();if(vt(n))return n.catch((function(e){throw i(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))}))};if("any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():n():vt(i=this.play())&&(i=i.catch(n)),vt(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(){t.trigger({type:"autoplay-failure",autoplay:e})}))}},r.updateSourceCaches_=function(e){var t=e=void 0===e?"":e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((function(e){return e.src===t}));if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r<n.length;r++){var a=n[r];if(a.type&&a.src&&a.src===t)return a.type}return ji(t)}(this,t)),this.cache_.source=at({},e,{src:t,type:i}),i=this.cache_.sources.filter((function(e){return e.src&&e.src===t}));for(var n=[],r=this.$$("source"),a=[],s=0;s<r.length;s++){var o=ne(r[s]);n.push(o),o.src&&o.src===t&&a.push(o.src)}a.length&&!i.length?this.cache_.sources=n:i.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},r.handleTechSourceset_=function(e){var t,i,n,r=this;this.changingSrc_||(t=function(e){return r.updateSourceCaches_(e)},i=this.currentSource().src,n=e.src,i&&!/^blob:/.test(i)&&/^blob:/.test(n)&&(this.lastSource_&&(this.lastSource_.tech===n||this.lastSource_.player===i)||(t=function(){})),t(n),e.src||this.tech_.any(["sourceset","loadstart"],(function(e){"sourceset"!==e.type&&(e=r.techGet("currentSrc"),r.lastSource_.tech=e,r.updateSourceCaches_(e))}))),this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})},r.hasStarted=function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},r.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},r.handleTechRateChange_=function(){0<this.tech_.playbackRate()&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((function(e){return e.callback(e.event)})),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},r.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",(function i(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))}))},r.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},r.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},r.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},r.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},r.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},r.handleTechFirstPlay_=function(){this.options_.starttime&&(d.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},r.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},r.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},r.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},r.handleTechClick_=function(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?_t(this.play()):this.pause()))},r.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(function(t){return t.contains(e.target)}))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},r.handleTechTap_=function(){this.userActive(!this.userActive())},r.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},r.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},r.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},r.handleStageClick_=function(){this.reportUserActivity()},r.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},r.documentFullscreenChange_=function(e){var t=e.target.player;t&&t!==this||(e=this.el(),!(t=document[this.fsApi_.fullscreenElement]===e)&&e.matches?t=e.matches(":"+this.fsApi_.fullscreen):!t&&e.msMatchesSelector&&(t=e.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(t))},r.handleTechFullscreenChange_=function(e,t){var i=this;t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",(function(){i.removeClass("vjs-ios-native-fs")}))),this.isFullscreen(t.isFullscreen))},r.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},r.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},r.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},r.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},r.handleTechError_=function(){var e=this.tech_.error();this.error(e)},r.handleTechTextData_=function(){this.trigger("textdata",1<arguments.length?arguments[1]:null)},r.getCache=function(){return this.cache_},r.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}},r.techCall_=function(e,t){this.ready((function(){if(e in Ui)return i=this.middleware_,n=this.tech_,r=t,n[n=e](i.reduce(Fi(n),r));if(e in Bi)return Ri(this.middleware_,this.tech_,e,t);var i,n,r;try{this.tech_&&this.tech_[e](t)}catch(i){throw d(i),i}}),!0)},r.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in Ni)return t=this.middleware_,i=this.tech_,n=e,t.reduceRight(Fi(n),i[n]());if(e in Bi)return Ri(this.middleware_,this.tech_,e);var t,i,n;try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw d("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw d("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw d(t),t}}},r.play=function(){var e=this,t=this.options_.Promise||window.Promise;return t?new t((function(t){e.play_(t)})):this.play_()},r.play_=function(e){var t=this;if(this.playCallbacks_.push(e=void 0===e?_t:e),e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!e)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(e||!H&&!j||this.load());null===(e=this.techGet_("play"))?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(e)},r.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},r.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},r.pause=function(){this.techCall_("pause")},r.paused=function(){return!1!==this.techGet_("paused")},r.played=function(){return this.techGet_("played")||ft(0,0)},r.scrubbing=function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},r.currentTime=function(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},r.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},r.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},r.remainingTime=function(){return this.duration()-this.currentTime()},r.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},r.buffered=function(){var e;return(e=this.techGet_("buffered"))&&e.length?e:ft(0,0)},r.bufferedPercent=function(){return mt(this.buffered(),this.duration())},r.bufferedEnd=function(){var e=this.buffered(),t=this.duration();return t<(e=e.end(e.length-1))?t:e},r.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(0<t&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},r.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},r.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},r.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},r.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},r.isFullscreen=function(e){if(void 0===e)return this.isFullscreen_;var t=this.isFullscreen_;this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_()},r.requestFullscreen=function(e){var t=this.options_.Promise||window.Promise;if(t){var i=this;return new t((function(t,n){function r(){i.off("fullscreenerror",s),i.off("fullscreenchange",a)}function a(){r(),t()}function s(e,t){r(),n(t)}i.one("fullscreenchange",a),i.one("fullscreenerror",s);var o=i.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(t,n))}))}return this.requestFullscreenHelper_()},r.requestFullscreenHelper_=function(e){var t=this;if(this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(i=e)),this.fsApi_.requestFullscreen){var i=this.el_[this.fsApi_.requestFullscreen](i);return i&&i.then((function(){return t.isFullscreen(!0)}),(function(){return t.isFullscreen(!1)})),i}this.tech_.supportsFullScreen()&&1==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},r.exitFullscreen=function(){var e=this.options_.Promise||window.Promise;if(e){var t=this;return new e((function(e,i){function n(){t.off("fullscreenerror",a),t.off("fullscreenchange",r)}function r(){n(),e()}function a(e,t){n(),i(t)}t.one("fullscreenchange",r),t.one("fullscreenerror",a);var s=t.exitFullscreenHelper_();s&&(s.then(n,n),s.then(e,i))}))}return this.exitFullscreenHelper_()},r.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=document[this.fsApi_.exitFullscreen]();return t&&_t(t.then((function(){return e.isFullscreen(!1)}))),t}this.tech_.supportsFullScreen()&&1==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},r.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,Re(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",Z(document.body,"vjs-full-window"),this.trigger("enterFullWindow")},r.fullWindowOnEscKey=function(e){ut.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},r.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,Ne(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,ee(document.body,"vjs-full-window"),this.trigger("exitFullWindow")},r.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},r.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},r.requestPictureInPicture=function(){if("pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},r.exitPictureInPicture=function(){if("pictureInPictureEnabled"in document)return document.exitPictureInPicture()},r.handleKeyDown=function(e){var t=this.options_.userActions;t&&t.hotkeys&&(function(e){var t=e.tagName.toLowerCase();return!!e.isContentEditable||("input"===t?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type):-1!==["textarea"].indexOf(t))}(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e)))},r.handleHotkeys=function(e){var t=(n=this.options_.userActions?this.options_.userActions.hotkeys:{}).fullscreenKey,i=void 0===(i=n.muteKey)?function(e){return ut.isEventKey(e,"m")}:i,n=void 0===(n=n.playPauseKey)?function(e){return ut.isEventKey(e,"k")||ut.isEventKey(e,"Space")}:n;(void 0===t?function(e){return ut.isEventKey(e,"f")}:t).call(this,e)?(e.preventDefault(),e.stopPropagation(),t=lt.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):i.call(this,e)?(e.preventDefault(),e.stopPropagation(),lt.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),lt.getComponent("PlayToggle").prototype.handleClick.call(this,e))},r.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i<n.length;i++){var r=n[i],a=Li.getTech(r);if(a=a||lt.getComponent(r)){if(a.isSupported()&&(t=a.canPlayType(e)))return t}else d.error('The "'+r+'" tech is undefined. Skipped browser support check for that tech.')}return""},r.selectSource=function(e){function t(e,t,i){var n;return e.some((function(e){return t.some((function(t){if(n=i(e,t))return!0}))})),n}var i,n=this,r=this.options_.techOrder.map((function(e){return[e,Li.getTech(e)]})).filter((function(e){var t=e[0];return(e=e[1])?e.isSupported():(d.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)})),a=function(e,t){var i=e[0];if(e[1].canPlaySource(t,n.options_[i.toLowerCase()]))return{source:t,tech:i}};return(a=this.options_.sourceOrder?t(e,r,(i=a,function(e,t){return i(t,e)})):t(r,e,a))||!1},r.handleSrc_=function(e,t){var i=this;if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();var n,r,a=Hi(e);a.length?(this.changingSrc_=!0,t||(this.cache_.sources=a),this.updateSourceCaches_(a[0]),function(e,t,i){e.setTimeout((function(){return function e(t,i,n,r,a,s){void 0===t&&(t={}),void 0===i&&(i=[]),void 0===a&&(a=[]),void 0===s&&(s=!1);var o=i,u=(i=o[0],o.slice(1));if("string"==typeof i)e(t,Di[i],n,r,a,s);else if(i){var l=function(e,t){var i=Oi[e.id()],n=null;if(null==i)return n=t(e),Oi[e.id()]=[[t,n]],n;for(var r=0;r<i.length;r++){var a=(s=i[r])[0],s=s[1];a===t&&(n=s)}return null===n&&(n=t(e),i.push([t,n])),n}(r,i);if(!l.setSource)return a.push(l),e(t,u,n,r,a,s);l.setSource(_({},t),(function(i,o){return i?e(t,u,n,r,a,s):(a.push(l),void e(o,t.type===o.type?u:Di[o.type],n,r,a,s))}))}else u.length?e(t,u,n,r,a,s):s?n(t,a):e(t,Di["*"],n,r,a,!0)}(t,Di[t.type],i,e)}),1)}(this,a[0],(function(e,n){var r;return i.middleware_=n,t||(i.cache_.sources=a),i.updateSourceCaches_(e),i.src_(e)?1<a.length?i.handleSrc_(a.slice(1)):(i.changingSrc_=!1,i.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0),void i.triggerReady()):(n=n,r=i.tech_,void n.forEach((function(e){return e.setTech&&e.setTech(r)})))})),this.options_.retryOnError&&1<a.length&&(r=function(){i.off("error",n)},this.one("error",n=function(){i.error(null),i.handleSrc_(a.slice(1),!0)}),this.one("playing",r),this.resetRetryOnError_=function(){i.off("error",n),i.off("playing",r)})):this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)},r.src=function(e){return this.handleSrc_(e,!1)},r.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,rt(t)!==rt(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready((function(){n.changingSrc_=!1}))):this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1)},r.load=function(){this.techCall_("load")},r.reset=function(){var e=this,t=this.options_.Promise||window.Promise;this.paused()||!t?this.doReset_():_t(this.play().then((function(){return e.doReset_()})))},r.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),Je(this)&&this.trigger("playerreset")},r.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},r.resetProgressBar_=function(){this.currentTime(0);var e=(t=this.controlBar||{}).durationDisplay,t=t.remainingTimeDisplay;e&&e.updateContent(),t&&t.updateContent()},r.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},r.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},r.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},r.currentSource=function(){return this.cache_.source||{}},r.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},r.currentType=function(){return this.currentSource()&&this.currentSource().type||""},r.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},r.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},r.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},r.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},r.poster=function(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},r.handleTechPosterChange_=function(){var e;this.poster_&&!this.options_.techCanOverridePoster||!this.tech_||!this.tech_.poster||(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))},r.controls=function(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},r.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},r.error=function(e){var t=this;if(void 0===e)return this.error_||null;if(n("beforeerror").forEach((function(i){b(i=i(t,e))&&!Array.isArray(i)||"string"==typeof i||"number"==typeof i||null===i?e=i:t.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){var i=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),void this.one("loadstart",(function(){this.off(["click","touchstart"],i)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new gt(e),this.addClass("vjs-error"),d.error("(CODE:"+this.error_.code+" "+gt.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),n("error").forEach((function(e){return e(t,t.error_)}))},r.reportUserActivity=function(e){this.userActivity_=!0},r.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},r.listenForUserActivity_=function(){var e,t,i,n,r=je(this,this.reportUserActivity),a=function(t){r(),this.clearInterval(e)};this.on("mousedown",(function(){r(),this.clearInterval(e),e=this.setInterval(r,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,r())})),this.on("mouseup",a),this.on("mouseleave",a),!(a=this.getChild("controlBar"))||j||I||(a.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),a.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",r),this.on("keyup",r),this.setInterval((function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(n),(e=this.options_.inactivityTimeout)<=0||(n=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e)))}),250)},r.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},r.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},r.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},r.enableAudioOnlyUI_=function(){var e=this;this.addClass("vjs-audio-only-mode");var t=this.children(),i=this.getChild("ControlBar"),n=i&&i.currentHeight();t.forEach((function(t){t!==i&&t.el_&&!t.hasClass("vjs-hidden")&&(t.hide(),e.audioOnlyCache_.hiddenChildren.push(t))})),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(n),this.trigger("audioonlymodechange")},r.disableAudioOnlyUI_=function(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach((function(e){return e.show()})),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")},r.audioOnlyMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;this.audioOnlyMode_=e;var i=this.options_.Promise||window.Promise;if(i){if(e){var n=[];return this.isInPictureInPicture()&&n.push(this.exitPictureInPicture()),this.isFullscreen()&&n.push(this.exitFullscreen()),this.audioPosterMode()&&n.push(this.audioPosterMode(!1)),i.all(n).then((function(){return t.enableAudioOnlyUI_()}))}return i.resolve().then((function(){return t.disableAudioOnlyUI_()}))}e?(this.isInPictureInPicture()&&this.exitPictureInPicture(),this.isFullscreen()&&this.exitFullscreen(),this.enableAudioOnlyUI_()):this.disableAudioOnlyUI_()},r.enablePosterModeUI_=function(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},r.disablePosterModeUI_=function(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},r.audioPosterMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;this.audioPosterMode_=e;var i=this.options_.Promise||window.Promise;return i?e?(this.audioOnlyMode()?this.audioOnlyMode(!1):i.resolve()).then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.disablePosterModeUI_()})):e?(this.audioOnlyMode()&&this.audioOnlyMode(!1),void this.enablePosterModeUI_()):void this.disablePosterModeUI_()},r.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},r.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},r.removeRemoteTextTrack=function(e){var t=(t=(e=void 0===e?{}:e).track)||e;if(this.tech_)return this.tech_.removeRemoteTextTrack(t)},r.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},r.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},r.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},r.language=function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Je(this)&&this.trigger("languagechange"))},r.languages=function(){return at(i.prototype.options_.languages,this.languages_)},r.toJSON=function(){var e=at(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var n=t[i];(n=at(n)).player=void 0,e.tracks[i]=n}return e},r.createModal=function(e,t){var i=this;(t=t||{}).content=e||"";var n=new St(this,t);return this.addChild(n),n.on("dispose",(function(){i.removeChild(n)})),n.open(),n},r.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),i=0;i<kn.length;i++){var n=kn[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(Cn[e]),this.addClass(Cn[n]),this.breakpoint_=n;break}}},r.removeCurrentBreakpoint_=function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)},r.breakpoints=function(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=_({},In,e),this.updateCurrentBreakpoint_()),_(this.breakpoints_)},r.responsive=function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?((this.responsive_=e)?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0},r.currentBreakpoint=function(){return this.breakpoint_},r.currentBreakpointClass=function(){return Cn[this.breakpoint_]||""},r.loadMedia=function(e,t){var i,n,r,a=this;e&&"object"==typeof e&&(this.reset(),this.cache_.media=at(e),i=(r=this.cache_.media).artwork,n=r.poster,e=r.src,r=r.textTracks,!i&&n&&(this.cache_.media.artwork=[{src:n,type:ji(n)}]),e&&this.src(e),n&&this.poster(n),Array.isArray(r)&&r.forEach((function(e){return a.addRemoteTextTrack(e,!1)})),this.ready(t))},r.getMedia=function(){if(this.cache_.media)return at(this.cache_.media);var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}}))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:ji(t.poster)}]),t},i.getTagSettings=function(e){var t,i={sources:[],tracks:[]},n=ne(e),r=n["data-setup"];if(J(e,"vjs-fill")&&(n.fill=!0),J(e,"vjs-fluid")&&(n.fluid=!0),null!==r&&(r=(t=function(e,t){var i,n=null;try{i=JSON.parse(e,void 0)}catch(e){n=e}return[n,i]}(r||"{}"))[0],t=t[1],r&&d.error(r),_(n,t)),_(i,n),e.hasChildNodes())for(var a=e.childNodes,s=0,o=a.length;s<o;s++){var u=a[s],l=u.nodeName.toLowerCase();"source"===l?i.sources.push(ne(u)):"track"===l&&i.tracks.push(ne(u))}return i},r.flexNotSupported_=function(){var e=document.createElement("i");return!("flexBasis"in e.style||"webkitFlexBasis"in e.style||"mozFlexBasis"in e.style||"msFlexBasis"in e.style||"msFlexOrder"in e.style)},r.debug=function(e){if(void 0===e)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)},r.playbackRates=function(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every((function(e){return"number"==typeof e}))&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))},i}(lt);Jt.names.forEach((function(e){var t=Jt[e];xn.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),xn.prototype.crossorigin=xn.prototype.crossOrigin,xn.players={},Ot=window.navigator,xn.prototype.options_={techOrder:Li.defaultTechOrder_,html5:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Ot&&(Ot.languages&&Ot.languages[0]||Ot.userLanguage||Ot.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach((function(e){xn.prototype[e]=function(){return this.techGet_(e)}})),wn.forEach((function(e){xn.prototype["handleTech"+rt(e)+"_"]=function(){return this.trigger(e)}})),lt.registerComponent("Player",xn);var An=f((function(e){function t(i,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(i,n)}e.exports=t}));function Pn(e){return Bn.hasOwnProperty(e)}function Ln(e){return Pn(e)?Bn[e]:void 0}function Dn(e,t,i){i=(i?"before":"")+"pluginsetup",e.trigger(i,t),e.trigger(i+":"+t.name,t)}function On(e,t){return t.prototype.name=e,function(){Dn(this,{name:e,plugin:t,instance:null},!0);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];var a=Rn(t,[this].concat(n));return this[e]=function(){return a},Dn(this,a.getEventHash()),a}}var Mn=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}},Rn=f((function(e){function t(i,n,r){return Mn()?e.exports=t=Reflect.construct:e.exports=t=function(e,t,i){var n=[null];return n.push.apply(n,t),n=new(Function.bind.apply(e,n)),i&&An(n,i.prototype),n},t.apply(null,arguments)}e.exports=t})),Nn="plugin",Un="activePlugins_",Bn={},Fn=function(e,t){e[Un]=e[Un]||{},e[Un][t]=!0},jn=function(){function e(t){if(this.constructor===e)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,this.log||(this.log=this.player.log.createLogger(this.name)),et(this),delete this.trigger,it(this,this.constructor.defaultState),Fn(t,this.name),this.dispose=this.dispose.bind(this),t.on("dispose",this.dispose)}var t=e.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(e){return(e=void 0===e?{}:e).name=this.name,e.plugin=this.constructor,e.instance=this,e},t.trigger=function(e,t){return Ue(this.eventBusEl_,e,this.getEventHash(t=void 0===t?{}:t))},t.handleStateChanged=function(e){},t.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Un][e]=!1,this.player=this.state=null,t[e]=On(e,Bn[e])},e.isBasic=function(t){return"function"==typeof(t="string"==typeof t?Ln(t):t)&&!e.prototype.isPrototypeOf(t.prototype)},e.registerPlugin=function(t,i){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(Pn(t))d.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(xn.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'+t+'", cannot share a name with an existing player method!');if("function"!=typeof i)throw new Error('Illegal plugin for "'+t+'", must be a function, was '+typeof i+".");return Bn[t]=i,t!==Nn&&(e.isBasic(i)?xn.prototype[t]=function(e,t){function i(){Dn(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return Fn(this,e),Dn(this,{name:e,plugin:t,instance:i}),i}return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(t,i):xn.prototype[t]=On(t,i)),i},e.deregisterPlugin=function(e){if(e===Nn)throw new Error("Cannot de-register base plugin.");Pn(e)&&(delete Bn[e],delete xn.prototype[e])},e.getPlugins=function(e){var t;return(e=void 0===e?Object.keys(Bn):e).forEach((function(e){var i=Ln(e);i&&((t=t||{})[e]=i)})),t},e.getPluginVersion=function(e){return(e=Ln(e))&&e.VERSION||""},e}();jn.getPlugin=Ln,jn.BASE_PLUGIN_NAME=Nn,jn.registerPlugin(Nn,jn),xn.prototype.usingPlugin=function(e){return!!this[Un]&&!0===this[Un][e]},xn.prototype.hasPlugin=function(e){return!!Pn(e)};var Hn=function(e){return 0===e.indexOf("#")?e.slice(1):e};function qn(e,t,i){if(a=qn.getPlayer(e))return t&&d.warn('Player "'+e+'" is already initialised. Options will not be applied.'),i&&a.ready(i),a;var r="string"==typeof e?_e("#"+Hn(e)):e;if(!z(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");r.ownerDocument.defaultView&&r.ownerDocument.body.contains(r)||d.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),n("beforesetup").forEach((function(e){b(e=e(r,at(t)))&&!Array.isArray(e)?t=at(t,e):d.error("please return an object in beforesetup hooks")}));var a=new(lt.getComponent("Player"))(r,t,i);return n("setup").forEach((function(e){return e(a)})),a}function Vn(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i="function"==typeof window.URL,n=/^\/\//.test(e),r=!window.location&&!/\/\//i.test(e);return i?e=new window.URL(e,window.location||Gn):/\/\//i.test(e)||(e=Wn.buildAbsoluteURL(window.location&&window.location.href||"",e)),i?(i=new URL(t,e),r?i.href.slice(Gn.length):n?i.href.slice(i.protocol.length):i.href):Wn.buildAbsoluteURL(e,t)}qn.hooks_=i,qn.hooks=n,qn.hook=function(e,t){n(e,t)},qn.hookOnce=function(e,t){n(e,[].concat(t).map((function(t){return function i(){return r(e,i),t.apply(void 0,arguments)}})))},qn.removeHook=r,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&G()&&((zn=_e(".vjs-styles-defaults"))||(zn=Ce("vjs-styles-defaults"),(Ot=_e("head"))&&Ot.insertBefore(zn,Ot.firstChild),Ie(zn,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n "))),Ee(1,qn),qn.VERSION=t,qn.options=xn.prototype.options_,qn.getPlayers=function(){return xn.players},qn.getPlayer=function(e){var t=xn.players;if("string"==typeof e){var i=Hn(e),n=t[i];if(n)return n;i=_e("#"+i)}else i=e;if(z(i)&&(e=i.player,i=i.playerId,e||t[i]))return e||t[i]},qn.getAllPlayers=function(){return Object.keys(xn.players).map((function(e){return xn.players[e]})).filter(Boolean)},qn.players=xn.players,qn.getComponent=lt.getComponent,qn.registerComponent=function(e,t){Li.isTech(t)&&d.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),lt.registerComponent.call(lt,e,t)},qn.getTech=Li.getTech,qn.registerTech=Li.registerTech,qn.use=function(e,t){Di[e]=Di[e]||[],Di[e].push(t)},Object.defineProperty(qn,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(qn.middleware,"TERMINATOR",{value:Mi,writeable:!1,enumerable:!0}),qn.browser=q,qn.TOUCH_ENABLED=U,qn.extend=function(e,t){var i,n=function(){e.apply(this,arguments)},r={};for(i in"object"==typeof(t=void 0===t?{}:t)?(t.constructor!==Object.prototype.constructor&&(n=t.constructor),r=t):"function"==typeof t&&(n=t),function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&An(e,t)}(n,e),e&&(n.super_=e),r)r.hasOwnProperty(i)&&(n.prototype[i]=r[i]);return n},qn.mergeOptions=at,qn.bind=je,qn.registerPlugin=jn.registerPlugin,qn.deregisterPlugin=jn.deregisterPlugin,qn.plugin=function(e,t){return d.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),jn.registerPlugin(e,t)},qn.getPlugins=jn.getPlugins,qn.getPlugin=jn.getPlugin,qn.getPluginVersion=jn.getPluginVersion,qn.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),qn.options.languages=at(qn.options.languages,((i={})[e]=t,i)),qn.options.languages[e]},qn.log=d,qn.createLogger=h,qn.createTimeRange=qn.createTimeRanges=ft,qn.formatTime=$i,qn.setFormatTime=function(e){Qi=e},qn.resetFormatTime=function(){Qi=Yi},qn.parseUrl=It,qn.isCrossOrigin=Pt,qn.EventTarget=qe,qn.on=Re,qn.one=Be,qn.off=Ne,qn.trigger=Ue,qn.xhr=Vt,qn.TextTrack=Yt,qn.AudioTrack=C,qn.VideoTrack=R,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((function(e){qn[e]=function(){return d.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead"),Te[e].apply(null,arguments)}})),qn.computedStyle=S,qn.dom=Te,qn.url=jt,qn.defineLazyProperty=vn,qn.addLanguage("en",{"Non-Fullscreen":"Exit Fullscreen"});var Wn=f((function(e,t){var i,n,r,a,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,n=/^([^\/?#]*)([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=s.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=s.normalizePath(r.path),s.buildURLFromParts(r)}if(!(r=s.parseURL(t)))throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=s.normalizePath(r.path),s.buildURLFromParts(r)):t;if(!(t=s.parseURL(e)))throw new Error("Error trying to parse base URL.");var a;return!t.netLoc&&t.path&&"/"!==t.path[0]&&(a=n.exec(t.path),t.netLoc=a[1],t.path=a[2]),t.netLoc&&!t.path&&(t.path="/"),e={scheme:t.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment},r.netLoc||(e.netLoc=t.netLoc,"/"!==r.path[0]&&(r.path?(a=(a=t.path).substring(0,a.lastIndexOf("/")+1)+r.path,e.path=s.normalizePath(a)):(e.path=t.path,r.params||(e.params=t.params,r.query||(e.query=t.query))))),null===e.path&&(e.path=i.alwaysNormalize?s.normalizePath(r.path):r.path),s.buildURLFromParts(e)},parseURL:function(e){return(e=i.exec(e))?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s})),Gn="http://example.com",zn=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1<t)},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();function Xn(e){for(var t=function(e){return window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary")}(e),i=new Uint8Array(t.length),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i}function Kn(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||"");return e={},t[1]&&(e.length=parseInt(t[1],10)),t[2]&&(e.offset=parseInt(t[2],10)),e}function Yn(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n}function Qn(e){var t={};return Object.keys(e).forEach((function(i){t[i.toLowerCase().replace(/-(\w)/g,(function(e){return e[1].toUpperCase()}))]=e[i]})),t}function $n(e){var t,i,n,r,a=e.serverControl,s=e.targetDuration,o=e.partTargetDuration;a&&(t="#EXT-X-SERVER-CONTROL",i="holdBack",n="partHoldBack",r=s&&3*s,e=o&&2*o,s&&!a.hasOwnProperty(i)&&(a[i]=r,this.trigger("info",{message:t+" defaulting HOLD-BACK to targetDuration * 3 ("+r+")."})),r&&a[i]<r&&(this.trigger("warn",{message:t+" clamping HOLD-BACK ("+a[i]+") to targetDuration * 3 ("+r+")"}),a[i]=r),o&&!a.hasOwnProperty(n)&&(a[n]=3*o,this.trigger("info",{message:t+" defaulting PART-HOLD-BACK to partTargetDuration * 3 ("+a[n]+")."})),o&&a[n]<e&&(this.trigger("warn",{message:t+" clamping PART-HOLD-BACK ("+a[n]+") to partTargetDuration * 2 ("+e+")."}),a[n]=e))}function Jn(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)}))}function Zn(e){e=(e=void 0===e?"":e).split(",");var t=[];return e.forEach((function(e){var i;e=e.trim(),fr.forEach((function(n){var r,a=pr[n].exec(e.toLowerCase());!a||a.length<=1||(i=n,r=e.substring(0,a[1].length),a=e.replace(r,""),t.push({type:r,details:a,mediaType:n}))})),i||t.push({type:e,details:"",mediaType:"unknown"})})),t}function er(e){return pr.audio.test((e=void 0===e?"":e).trim().toLowerCase())}function tr(e){if(e&&"string"==typeof e){var t=e.toLowerCase().split(",").map((function(e){return Jn(e.trim())})),i="video";1===t.length&&er(t[0])?i="audio":1===t.length&&(n=t[0],pr.text.test((n=void 0===n?"":n).trim().toLowerCase()))&&(i="application");var n="mp4";return t.every((function(e){return pr.mp4.test(e)}))?n="mp4":t.every((function(e){return pr.webm.test(e)}))?n="webm":t.every((function(e){return pr.ogg.test(e)}))&&(n="ogg"),i+"/"+n+';codecs="'+e+'"'}}function ir(e){return void 0===e&&(e=""),window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(tr(e))||!1}function nr(e){return(e=void 0===e?"":e).toLowerCase().split(",").every((function(e){e=e.trim();for(var t=0;t<mr.length;t++)if(pr["muxer"+mr[t]].test(e))return!0;return!1}))}function rr(e){return yr.test(e)?"hls":vr.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null}function ar(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer}function sr(e){return e instanceof Uint8Array?e:(Array.isArray(e)||_r(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))}function or(e,t){if("string"!=typeof(e="string"!=typeof e&&e&&"function"==typeof e.toString?e.toString():e))return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return i}function ur(e,t,i){var n=void 0===i?{}:i,r=void 0===(i=n.offset)?0:i,a=void 0===(n=n.mask)?[]:n;return e=sr(e),n=(t=sr(t)).every||Array.prototype.every,t.length&&e.length-r>=t.length&&n.call(t,(function(t,i){return t===(a[i]?a[i]&e[r+i]:e[r+i])}))}var lr=function(e){function t(){var t=e.call(this)||this;return t.buffer="",t}return dt(t,e),t.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");-1<t;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(zn),cr=String.fromCharCode(9),dr=function(e){function t(){var t=e.call(this)||this;return t.customParsers=[],t.tagMappers=[],t}dt(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,i){return(i=i(e))===e?t:t.concat([i])}),[e]).forEach((function(e){for(var r,a,s=0;s<n.customParsers.length;s++)if(n.customParsers[s].call(n,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))n.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void n.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void n.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?(.*)?$/.exec(e))return i=m(Kn(t[1]),{type:"tag",tagType:"byterange"}),void n.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e))return i={type:"tag",tagType:"map"},t[1]&&((r=Yn(t[1])).URI&&(i.uri=r.URI),r.BYTERANGE&&(i.byterange=Kn(r.BYTERANGE))),void n.trigger("data",i);if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e))return i={type:"tag",tagType:"stream-inf"},t[1]&&(i.attributes=Yn(t[1]),i.attributes.RESOLUTION&&(a={},(r=i.attributes.RESOLUTION.split("x"))[0]&&(a.width=parseInt(r[0],10)),r[1]&&(a.height=parseInt(r[1],10)),i.attributes.RESOLUTION=a),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))),void n.trigger("data",i);if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=Yn(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e))n.trigger("data",{type:"tag",tagType:"endlist"});else{if(!(t=/^#EXT-X-DISCONTINUITY/.exec(e)))return(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))?(i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void n.trigger("data",i)):(t=/^#EXT-X-KEY:?(.*)$/.exec(e))?(i={type:"tag",tagType:"key"},t[1]&&(i.attributes=Yn(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void n.trigger("data",i)):(t=/^#EXT-X-START:?(.*)$/.exec(e))?(i={type:"tag",tagType:"start"},t[1]&&(i.attributes=Yn(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void n.trigger("data",i)):(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))?(i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i)):(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))?(i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i)):(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))?(i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i)):(t=/^#EXT-X-SKIP:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"skip"}).attributes=Yn(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(cr)),void n.trigger("data",i)):(t=/^#EXT-X-PART:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"part"}).attributes=Yn(t[1]),["DURATION"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["INDEPENDENT","GAP"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=Kn(i.attributes.BYTERANGE)),void n.trigger("data",i)):(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"server-control"}).attributes=Yn(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),void n.trigger("data",i)):(t=/^#EXT-X-PART-INF:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"part-inf"}).attributes=Yn(t[1]),["PART-TARGET"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),void n.trigger("data",i)):(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"preload-hint"}).attributes=Yn(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach((function(e){var t;i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseInt(i.attributes[e],10),t="BYTERANGE-LENGTH"===e?"length":"offset",i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[t]=i.attributes[e],delete i.attributes[e])})),void n.trigger("data",i)):(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"rendition-report"}).attributes=Yn(t[1]),["LAST-MSN","LAST-PART"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseInt(i.attributes[e],10))})),void n.trigger("data",i)):void n.trigger("data",{type:"tag",data:e.slice(4)});n.trigger("data",{type:"tag",tagType:"discontinuity"})}}else n.trigger("data",{type:"comment",text:e.slice(1)})})):this.trigger("data",{type:"uri",uri:e}))},i.addParser=function(e){var t=this,i=e.expression,n=e.customType,r=e.dataParser,a=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push((function(e){if(i.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:n,segment:a}),!0}))},i.addTagMapper=function(e){var t=e.expression,i=e.map;this.tagMappers.push((function(e){return t.test(e)?i(e):e}))},t}(zn),hr=function(e){function t(){var t=e.call(this)||this;t.lineStream=new lr,t.parseStream=new dr,t.lineStream.pipe(t.parseStream);var i,n,r=ct(t),a=[],s={},o=!1,u={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},l=0;t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};var c=0,d=0;return t.on("end",(function(){s.uri||!s.parts&&!s.preloadHints||(!s.map&&i&&(s.map=i),!s.key&&n&&(s.key=n),s.timeline||"number"!=typeof l||(s.timeline=l),t.manifest.preloadSegment=s)})),t.parseStream.on("data",(function(e){var t,h;({tag:function(){({version:function(){e.version&&(this.manifest.version=e.version)},"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&((s.byterange=t).length=e.length,"offset"in e||(e.offset=c)),"offset"in e&&((s.byterange=t).offset=e.offset),c=t.offset+t.length},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<e.duration&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=a},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes});if("com.microsoft.playready"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:e.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:Xn(e.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,l=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange),n&&(i.key=n)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||u,e.attributes?(s.attributes||(s.attributes={}),m(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){var i;this.manifest.mediaGroups=this.manifest.mediaGroups||u,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME?((i=this.manifest.mediaGroups[e.attributes.TYPE])[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(h={default:/yes/i.test(e.attributes.DEFAULT)}).default?h.autoselect=!0:h.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(h.language=e.attributes.LANGUAGE),e.attributes.URI&&(h.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(h.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(h.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(h.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=h):this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){l+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),s.dateTimeString=e.dateTimeString,s.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,$n.call(this,this.manifest))},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data},skip:function(){this.manifest.skip=Qn(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part:function(){var t=this;o=!0;var i=this.manifest.segments.length,n=Qn(e.attributes);s.parts=s.parts||[],s.parts.push(n),n.byterange&&(n.byterange.hasOwnProperty("offset")||(n.byterange.offset=d),d=n.byterange.offset+n.byterange.length);var r=s.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+r+" for segment #"+i,e.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((function(e,i){e.hasOwnProperty("lastPart")||t.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+i+" lacks required attribute(s): LAST-PART"})}))},"server-control":function(){var t=this.manifest.serverControl=Qn(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),$n.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var t=this.manifest.segments.length,i=Qn(e.attributes),n=i.type&&"PART"===i.type;s.preloadHints=s.preloadHints||[],s.preloadHints.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=n?d:0,n&&(d=i.byterange.offset+i.byterange.length)));var r=s.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t,e.attributes,["TYPE","URI"]),i.type)for(var a=0;a<s.preloadHints.length-1;a++){var o=s.preloadHints[a];o.type&&o.type===i.type&&this.trigger("warn",{message:"#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t+" has the same TYPE "+i.type+" as preload hint #"+a})}},"rendition-report":function(){var t=Qn(e.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(t);var i=this.manifest.renditionReports.length-1;t=["LAST-MSN","URI"],o&&t.push("LAST-PART"),this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #"+i,e.attributes,t)},"part-inf":function(){this.manifest.partInf=Qn(e.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",e.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),$n.call(this,this.manifest)}}[e.tagType]||function(){}).call(r)},uri:function(){s.uri=e.uri,a.push(s),!this.manifest.targetDuration||"duration"in s||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),n&&(s.key=n),s.timeline=l,i&&(s.map=i),d=0,s={}},comment:function(){},custom:function(){e.segment?(s.custom=s.custom||{},s.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(r)})),t}dt(t,e);var i=t.prototype;return i.warnOnMissingAttributes_=function(e,t,i){var n=[];i.forEach((function(e){t.hasOwnProperty(e)||n.push(e)})),n.length&&this.trigger("warn",{message:e+" lacks required attribute(s): "+n.join(", ")})},i.push=function(e){this.lineStream.push(e)},i.end=function(){this.lineStream.push("\n"),this.trigger("end")},i.addParser=function(e){this.parseStream.addParser(e)},i.addTagMapper=function(e){this.parseStream.addTagMapper(e)},t}(zn),pr={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},fr=["video","audio","text"],mr=["Video","Audio","Text"],gr="mp4a.40.2",yr=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,vr=/^application\/dash\+xml/i,_r=ar,br=window.BigInt||Number,Tr=[br("0x1"),br("0x100"),br("0x10000"),br("0x1000000"),br("0x100000000"),br("0x10000000000"),br("0x1000000000000"),br("0x100000000000000"),br("0x10000000000000000")];function Sr(e,t){return(t=void 0===t?Object:t)&&"function"==typeof t.freeze?t.freeze(e):e}var wr=Sr({HTML:"text/html",isHTML:function(e){return e===wr.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Er=Sr({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Er.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),kr={freeze:Sr,MIME_TYPE:wr,NAMESPACE:Er},Cr=kr.NAMESPACE;function Ir(e){return""!==e}function xr(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function Ar(e){return e?(e=(e=e)?e.split(/[\t\n\f\r ]+/).filter(Ir):[],Object.keys(e.reduce(xr,{}))):[]}function Pr(e,t){for(var i in e)t[i]=e[i]}function Lr(e,t){var i,n=e.prototype;n instanceof t||((i=function(){}).prototype=t.prototype,Pr(n,i=new i),e.prototype=n=i),n.constructor!=e&&(n.constructor=e)}var Dr,Or=(q={}).ELEMENT_NODE=1,Mr=q.ATTRIBUTE_NODE=2,Rr=q.TEXT_NODE=3,Nr=q.CDATA_SECTION_NODE=4,Ur=q.ENTITY_REFERENCE_NODE=5,Br=(q.ENTITY_NODE=6,q.PROCESSING_INSTRUCTION_NODE=7),Fr=q.COMMENT_NODE=8,jr=q.DOCUMENT_NODE=9,Hr=q.DOCUMENT_TYPE_NODE=10,qr=q.DOCUMENT_FRAGMENT_NODE=11,Vr=(q.NOTATION_NODE=12,C={},{});function Wr(e,t){var i;return t instanceof Error?i=t:(i=this,Error.call(this,Vr[e]),this.message=Vr[e],Error.captureStackTrace&&Error.captureStackTrace(this,Wr)),i.code=e,t&&(this.message=this.message+": "+t),i}function Gr(){}function zr(e,t){this._node=e,this._refresh=t,Xr(this)}function Xr(e){var t,i=e._node._inc||e._node.ownerDocument._inc;e._inc!=i&&(t=e._refresh(e._node),Ea(e,"length",t.length),Pr(t,e),e._inc=i)}function Kr(){}function Yr(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function Qr(e,t,i,n){n?t[Yr(t,n)]=i:t[t.length++]=i,!e||(t=(i.ownerElement=e).ownerDocument)&&(n&&na(t,e,n),e=e,i=i,(t=t)&&t._inc++,i.namespaceURI===Cr.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value))}function $r(e,t,i){var n=Yr(t,i);if(!(0<=n))throw Wr(8,new Error(e.tagName+"@"+i));for(var r,a=t.length-1;n<a;)t[n]=t[++n];t.length=a,!e||(r=e.ownerDocument)&&(na(r,e,i),i.ownerElement=null)}function Jr(){}function Zr(){}function ea(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function ta(e,t){if(t(e))return 1;if(e=e.firstChild)do{if(ta(e,t))return 1}while(e=e.nextSibling)}function ia(){}function na(e,t,i){e&&e._inc++,i.namespaceURI===Cr.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function ra(e,t,i){if(e&&e._inc){e._inc++;var n=t.childNodes;if(i)n[n.length++]=i;else{for(var r=t.firstChild,a=0;r;)r=(n[a++]=r).nextSibling;n.length=a}}}function aa(e,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:e.firstChild=n,n?n.previousSibling=i:e.lastChild=i,ra(e.ownerDocument,e),t}function sa(e,t,i){var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===qr){var r=t.firstChild;if(null==r)return t;var a=t.lastChild}else r=a=t;for(n=i?i.previousSibling:e.lastChild,r.previousSibling=n,a.nextSibling=i,n?n.nextSibling=r:e.firstChild=r,null==i?e.lastChild=a:i.previousSibling=a;r.parentNode=e,r!==a&&(r=r.nextSibling););return ra(e.ownerDocument||e,e),t.nodeType==qr&&(t.firstChild=t.lastChild=null),t}function oa(){this._nsMap={}}function ua(){}function la(){}function ca(){}function da(){}function ha(){}function pa(){}function fa(){}function ma(){}function ga(){}function ya(){}function va(){}function _a(){}function ba(e,t){var i,n=[],r=9==this.nodeType&&this.documentElement||this,a=r.prefix,s=r.namespaceURI;return wa(this,n,e,t,i=s&&null==a&&null==(a=r.lookupPrefix(s))?[{namespace:s,prefix:null}]:i),n.join("")}function Ta(e,t,i){var n=e.prefix||"",r=e.namespaceURI;if(r&&("xml"!==n||r!==Cr.XML)&&r!==Cr.XMLNS){for(var a=i.length;a--;){var s=i[a];if(s.prefix===n)return s.namespace!==r}return 1}}function Sa(e,t,i){e.push(" ",t,'="',i.replace(/[<&"]/g,ea),'"')}function wa(e,t,i,n,r){if(r=r||[],n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case Or:var a,s,o,u=e.attributes,l=u.length,c=e.firstChild,d=e.tagName,h=d;if(!(i=Cr.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var p,f=0;f<u.length;f++)if("xmlns"===u.item(f).name){p=u.item(f).value;break}if(!p)for(var m=r.length-1;0<=m;m--)if(""===(g=r[m]).prefix&&g.namespace===e.namespaceURI){p=g.namespace;break}var g;if(p!==e.namespaceURI)for(m=r.length-1;0<=m;m--)if((g=r[m]).namespace===e.namespaceURI){g.prefix&&(h=g.prefix+":"+d);break}}t.push("<",h);for(var y=0;y<l;y++)"xmlns"==(a=u.item(y)).prefix?r.push({prefix:a.localName,namespace:a.value}):"xmlns"==a.nodeName&&r.push({prefix:"",namespace:a.value});for(y=0;y<l;y++)Ta(a=u.item(y),0,r)&&(Sa(t,(s=a.prefix||"")?"xmlns:"+s:"xmlns",o=a.namespaceURI),r.push({prefix:s,namespace:o})),wa(a,t,i,n,r);if(d===h&&Ta(e,0,r)&&(Sa(t,(s=e.prefix||"")?"xmlns:"+s:"xmlns",o=e.namespaceURI),r.push({prefix:s,namespace:o})),c||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(d)){if(t.push(">"),i&&/^script$/i.test(d))for(;c;)c.data?t.push(c.data):wa(c,t,i,n,r.slice()),c=c.nextSibling;else for(;c;)wa(c,t,i,n,r.slice()),c=c.nextSibling;t.push("</",h,">")}else t.push("/>");return;case jr:case qr:for(c=e.firstChild;c;)wa(c,t,i,n,r.slice()),c=c.nextSibling;return;case Mr:return Sa(t,e.name,e.value),0;case Rr:return t.push(e.data.replace(/[<&]/g,ea).replace(/]]>/g,"]]>"));case Nr:return t.push("<![CDATA[",e.data,"]]>");case Fr:return t.push("\x3c!--",e.data,"--\x3e");case Hr:var v=e.publicId,_=e.systemId;return t.push("<!DOCTYPE ",e.name),void(v?(t.push(" PUBLIC ",v),_&&"."!=_&&t.push(" ",_),t.push(">")):_&&"."!=_?t.push(" SYSTEM ",_,">"):((_=e.internalSubset)&&t.push(" [",_,"]"),t.push(">")));case Br:return t.push("<?",e.target," ",e.data,"?>");case Ur:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Ea(e,t,i){e[t]=i}C.INDEX_SIZE_ERR=(Vr[1]="Index size error",1),C.DOMSTRING_SIZE_ERR=(Vr[2]="DOMString size error",2),C.HIERARCHY_REQUEST_ERR=(Vr[3]="Hierarchy request error",3),C.WRONG_DOCUMENT_ERR=(Vr[4]="Wrong document",4),C.INVALID_CHARACTER_ERR=(Vr[5]="Invalid character",5),C.NO_DATA_ALLOWED_ERR=(Vr[6]="No data allowed",6),C.NO_MODIFICATION_ALLOWED_ERR=(Vr[7]="No modification allowed",7),C.NOT_FOUND_ERR=(Vr[8]="Not found",8),C.NOT_SUPPORTED_ERR=(Vr[9]="Not supported",9),C.INUSE_ATTRIBUTE_ERR=(Vr[10]="Attribute in use",10),C.INVALID_STATE_ERR=(Vr[11]="Invalid state",11),C.SYNTAX_ERR=(Vr[12]="Syntax error",12),C.INVALID_MODIFICATION_ERR=(Vr[13]="Invalid modification",13),C.NAMESPACE_ERR=(Vr[14]="Invalid namespace",14),C.INVALID_ACCESS_ERR=(Vr[15]="Invalid access",15),Wr.prototype=Error.prototype,Pr(C,Wr),Gr.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var i=[],n=0;n<this.length;n++)wa(this[n],i,e,t);return i.join("")}},zr.prototype.item=function(e){return Xr(this),this[e]},Lr(zr,Gr),Kr.prototype={length:0,item:Gr.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var i=this[t];if(i.nodeName==e)return i}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new Wr(10);return t=this.getNamedItem(e.nodeName),Qr(this._ownerElement,this,e,t),t},setNamedItemNS:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new Wr(10);return t=this.getNamedItemNS(e.namespaceURI,e.localName),Qr(this._ownerElement,this,e,t),t},removeNamedItem:function(e){return e=this.getNamedItem(e),$r(this._ownerElement,this,e),e},removeNamedItemNS:function(e,t){return t=this.getNamedItemNS(e,t),$r(this._ownerElement,this,t),t},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var n=this[i];if(n.localName==t&&n.namespaceURI==e)return n}return null}},Jr.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,i){var n=new ia;return n.implementation=this,n.childNodes=new Gr,n.doctype=i||null,i&&n.appendChild(i),t&&(t=n.createElementNS(e,t),n.appendChild(t)),n},createDocumentType:function(e,t,i){var n=new pa;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=i||"",n}},Zr.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return sa(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return aa(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return function e(t,i,n){var r=new i.constructor;for(var a in i){var s=i[a];"object"!=typeof s&&s!=r[a]&&(r[a]=s)}switch(i.childNodes&&(r.childNodes=new Gr),r.ownerDocument=t,r.nodeType){case Or:var o=i.attributes,u=r.attributes=new Kr,l=o.length;u._ownerElement=r;for(var c=0;c<l;c++)r.setAttributeNode(e(t,o.item(c),!0));break;case Mr:n=!0}if(n)for(var d=i.firstChild;d;)r.appendChild(e(t,d,n)),d=d.nextSibling;return r}(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==Rr&&e.nodeType==Rr?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return 0<this.attributes.length},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var n in i)if(i[n]==e)return n;t=t.nodeType==Mr?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&e in i)return i[e];t=t.nodeType==Mr?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},Pr(q,Zr),Pr(q,Zr.prototype),ia.prototype={nodeName:"#document",nodeType:jr,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType!=qr)return null==this.documentElement&&e.nodeType==Or&&(this.documentElement=e),sa(this,e,t),e.ownerDocument=this,e;for(var i=e.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,t),i=n}return e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),aa(this,e)},importNode:function(e,t){return function e(t,i,n){var r;switch(i.nodeType){case Or:(r=i.cloneNode(!1)).ownerDocument=t;case qr:break;case Mr:n=!0}if((r=r||i.cloneNode(!1)).ownerDocument=t,r.parentNode=null,n)for(var a=i.firstChild;a;)r.appendChild(e(t,a,n)),a=a.nextSibling;return r}(this,e,t)},getElementById:function(e){var t=null;return ta(this.documentElement,(function(i){if(i.nodeType==Or&&i.getAttribute("id")==e)return t=i,!0})),t},getElementsByClassName:function(e){var t=Ar(e);return new zr(this,(function(i){var n=[];return 0<t.length&&ta(i.documentElement,(function(r){var a,s,o;r===i||r.nodeType!==Or||(a=r.getAttribute("class"))&&((s=e===a)||(a=Ar(a),s=t.every((o=a,function(e){return o&&-1!==o.indexOf(e)}))),s&&n.push(r))})),n}))},createElement:function(e){var t=new oa;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new Gr,(t.attributes=new Kr)._ownerElement=t},createDocumentFragment:function(){var e=new ya;return e.ownerDocument=this,e.childNodes=new Gr,e},createTextNode:function(e){var t=new ca;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new da;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ha;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new va;return i.ownerDocument=this,i.tagName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new ua;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new ga;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new oa,n=t.split(":"),r=i.attributes=new Kr;return i.childNodes=new Gr,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,r._ownerElement=i},createAttributeNS:function(e,t){var i=new ua,n=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,i}},Lr(ia,Zr),ia.prototype.getElementsByTagName=(oa.prototype={nodeType:Or,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){return(e=this.getAttributeNode(e))&&e.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){(e=this.ownerDocument.createAttribute(e)).value=e.nodeValue=""+t,this.setAttributeNode(e)},removeAttribute:function(e){(e=this.getAttributeNode(e))&&this.removeAttributeNode(e)},appendChild:function(e){return e.nodeType===qr?this.insertBefore(e,null):function(e,t){var i=t.parentNode;i&&(n=e.lastChild,i.removeChild(t),n=e.lastChild);var n=e.lastChild;return t.parentNode=e,t.previousSibling=n,t.nextSibling=null,n?n.nextSibling=t:e.firstChild=t,e.lastChild=t,ra(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){(t=this.getAttributeNodeNS(e,t))&&this.removeAttributeNode(t)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){return(t=this.getAttributeNodeNS(e,t))&&t.value||""},setAttributeNS:function(e,t,i){(t=this.ownerDocument.createAttributeNS(e,t)).value=t.nodeValue=""+i,this.setAttributeNode(t)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new zr(this,(function(t){var i=[];return ta(t,(function(n){n===t||n.nodeType!=Or||"*"!==e&&n.tagName!=e||i.push(n)})),i}))},getElementsByTagNameNS:function(e,t){return new zr(this,(function(i){var n=[];return ta(i,(function(r){r===i||r.nodeType!==Or||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||n.push(r)})),n}))}}).getElementsByTagName,ia.prototype.getElementsByTagNameNS=oa.prototype.getElementsByTagNameNS,Lr(oa,Zr),ua.prototype.nodeType=Mr,Lr(ua,Zr),la.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(Vr[3])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){var n=this.data.substring(0,e);t=this.data.substring(e+t),this.nodeValue=this.data=i=n+i+t,this.length=i.length}},Lr(la,Zr),ca.prototype={nodeName:"#text",nodeType:Rr,splitText:function(e){var t=(i=this.data).substring(e),i=i.substring(0,e);return this.data=this.nodeValue=i,this.length=i.length,t=this.ownerDocument.createTextNode(t),this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling),t}},Lr(ca,la),da.prototype={nodeName:"#comment",nodeType:Fr},Lr(da,la),ha.prototype={nodeName:"#cdata-section",nodeType:Nr},Lr(ha,la),pa.prototype.nodeType=Hr,Lr(pa,Zr),fa.prototype.nodeType=12,Lr(fa,Zr),ma.prototype.nodeType=6,Lr(ma,Zr),ga.prototype.nodeType=Ur,Lr(ga,Zr),ya.prototype.nodeName="#document-fragment",ya.prototype.nodeType=qr,Lr(ya,Zr),va.prototype.nodeType=Br,Lr(va,Zr),_a.prototype.serializeToString=function(e,t,i){return ba.call(e,t,i)},Zr.prototype.toString=ba;try{Object.defineProperty&&(Dr=function e(t){switch(t.nodeType){case Or:case qr:var i=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&i.push(e(t)),t=t.nextSibling;return i.join("");default:return t.nodeValue}},Object.defineProperty(zr.prototype,"length",{get:function(){return Xr(this),this.$$length}}),Object.defineProperty(Zr.prototype,"textContent",{get:function(){return Dr(this)},set:function(e){switch(this.nodeType){case Or:case qr:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),Ea=function(e,t,i){e["$$"+t]=i})}catch(e){}R={DocumentType:pa,DOMException:Wr,DOMImplementation:Jr,Element:oa,Node:Zr,NodeList:Gr,XMLSerializer:_a};var ka=f((function(e,t){var i=kr.freeze;t.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=i({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES}));ka.XML_ENTITIES,ka.HTML_ENTITIES,ka.entityMap;var Ca=kr.NAMESPACE,Ia=(jt=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,zn=new RegExp("[\\-\\.0-9"+jt.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),new RegExp("^"+jt.source+zn.source+"*(?::"+jt.source+zn.source+"*)?$"));function xa(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,xa)}function Aa(){}function Pa(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function La(e,t,i){for(var n=e.tagName,r=null,a=e.length;a--;){var s=e[a],o=s.qName,u=s.value;o=0<(c=o.indexOf(":"))?(l=s.prefix=o.slice(0,c),d=o.slice(c+1),"xmlns"===l&&d):(l=null,"xmlns"===(d=o)&&""),s.localName=d,!1!==o&&(null==r&&(r={},Da(i,i={})),i[o]=r[o]=u,s.uri=Ca.XMLNS,t.startPrefixMapping(o,u))}var l;for(a=e.length;a--;)(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri=Ca.XML),"xmlns"!==l&&(s.uri=i[l||""]));var c,d=0<(c=n.indexOf(":"))?(l=e.prefix=n.slice(0,c),e.localName=n.slice(c+1)):(l=null,e.localName=n),h=e.uri=i[l||""];if(t.startElement(h,d,n,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,1;if(t.endElement(h,d,n),r)for(l in r)t.endPrefixMapping(l)}function Da(e,t){for(var i in e)t[i]=e[i]}function Oa(){this.attributeNames={}}(xa.prototype=new Error).name=xa.name,Aa.prototype={parse:function(e,t,i){var n=this.domBuilder;n.startDocument(),Da(t,t={}),function(e,t,i,n,r){function a(e){var t=e.slice(1,-1);return t in i?i[t]:"#"===t.charAt(0)?65535<(t=parseInt(t.substr(1).replace("x","0x")))?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):String.fromCharCode(t):(r.error("entity not found:"+e),e)}function s(t){var i;f<t&&(i=e.substring(f,t).replace(/&#?\w+;/g,a),d&&o(f),n.characters(i,0,t-f),f=t)}function o(t,i){for(;l<=t&&(i=c.exec(e));)u=i.index,l=u+i[0].length,d.lineNumber++;d.columnNumber=t-u+1}for(var u=0,l=0,c=/.*(?:\r\n?|\n)|.*$/g,d=n.locator,h=[{currentNSMap:t}],p={},f=0;;){try{var m,g,y=e.indexOf("<",f);if(y<0)return e.substr(f).match(/^\s*$/)||(g=(m=n.doc).createTextNode(e.substr(f)),m.appendChild(g),n.currentElement=g);switch(f<y&&s(y),e.charAt(y+1)){case"/":var v=e.indexOf(">",y+3),_=e.substring(y+2,v).replace(/[ \t\n\r]+$/g,""),b=h.pop();v<0?(_=e.substring(y+2).replace(/[\s<].*/,""),r.error("end tag name: "+_+" is not complete:"+b.tagName),v=y+1+_.length):_.match(/\s</)&&(_=_.replace(/[\s<].*/,""),r.error("end tag name: "+_+" maybe not complete"),v=y+1+_.length);var T=b.localNSMap,S=b.tagName==_;if(S||b.tagName&&b.tagName.toLowerCase()==_.toLowerCase()){if(n.endElement(b.uri,b.localName,_),T)for(var w in T)n.endPrefixMapping(w);S||r.fatalError("end tag name: "+_+" is not match the current start tagName:"+b.tagName)}else h.push(b);v++;break;case"?":d&&o(y),v=function(e,t,i){var n=e.indexOf("?>",t);return n&&(t=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/))?(t[0].length,i.processingInstruction(t[1],t[2]),n+2):-1}(e,y,n);break;case"!":d&&o(y),v=function(e,t,i,n){if("-"===e.charAt(t+2)){if("-"!==e.charAt(t+3))return-1;var r=e.indexOf("--\x3e",t+4);return t<r?(i.comment(e,t+4,r-t-4),r+3):(n.error("Unclosed comment"),-1)}if("CDATA["==e.substr(t+3,6))return r=e.indexOf("]]>",t+9),i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3;var a=function(e,t){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=t,r.exec(e);i=r.exec(e);)if(n.push(i),i[1])return n}(e,t);return 1<(n=a.length)&&/!doctype/i.test(a[0][0])?(r=a[1][0],e=!1,t=!1,3<n&&(/^public$/i.test(a[2][0])?(e=a[3][0],t=4<n&&a[4][0]):/^system$/i.test(a[2][0])&&(t=a[3][0])),n=a[n-1],i.startDTD(r,e,t),i.endDTD(),n.index+n[0].length):-1}(e,y,n,r);break;default:d&&o(y);var E=new Oa,k=h[h.length-1].currentNSMap,C=(v=function(e,t,i,n,r,a){function s(e,t,n){i.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),i.addValue(e,t,n)}for(var o,u=++t,l=0;;){var c=e.charAt(u);switch(c){case"=":if(1===l)o=e.slice(t,u),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(a.warning('attribute value must after "="'),o=e.slice(t,u)),t=u+1,!(0<(u=e.indexOf(c,t))))throw new Error("attribute value no end '"+c+"' match");s(o,d=e.slice(t,u).replace(/&#?\w+;/g,r),t-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');s(o,d=e.slice(t,u).replace(/&#?\w+;/g,r),t),a.warning('attribute "'+o+'" missed start quot('+c+")!!"),t=u+1,l=5}break;case"/":switch(l){case 0:i.setTagName(e.slice(t,u));case 5:case 6:case 7:l=7,i.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==l&&i.setTagName(e.slice(t,u)),u;case">":switch(l){case 0:i.setTagName(e.slice(t,u));case 5:case 6:case 7:break;case 4:case 1:"/"===(d=e.slice(t,u)).slice(-1)&&(i.closed=!0,d=d.slice(0,-1));case 2:2===l&&(d=o),4==l?(a.warning('attribute "'+d+'" missed quot(")!'),s(o,d.replace(/&#?\w+;/g,r),t)):(Ca.isHTML(n[""])&&d.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),s(d,d,t));break;case 3:throw new Error("attribute value missed!!")}return u;case"":c=" ";default:if(c<=" ")switch(l){case 0:i.setTagName(e.slice(t,u)),l=6;break;case 1:o=e.slice(t,u),l=2;break;case 4:var d=e.slice(t,u).replace(/&#?\w+;/g,r);a.warning('attribute "'+d+'" missed quot(")!!'),s(o,d,t);case 5:l=6}else switch(l){case 2:i.tagName,Ca.isHTML(n[""])&&o.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=u,l=1;break;case 5:a.warning('attribute space is required"'+o+'"!!');case 6:l=1,t=u;break;case 3:l=4,t=u;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}(e,y,E,k,a,r),E.length);if(!E.closed&&function(e,t,i,n){var r=n[i];return null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),n[i]=r),r<t}(e,v,E.tagName,p)&&(E.closed=!0,i.nbsp||r.warning("unclosed xml attribute")),d&&C){for(var I=Pa(d,{}),x=0;x<C;x++){var A=E[x];o(A.offset),A.locator=Pa(d,{})}n.locator=I,La(E,n,k)&&h.push(E),n.locator=d}else La(E,n,k)&&h.push(E);Ca.isHTML(E.uri)&&!E.closed?v=function(e,t,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var a=e.indexOf("</"+i+">",t);if(e=e.substring(t+1,a),/[&<]/.test(e))return/^script$/i.test(i)||(e=e.replace(/&#?\w+;/g,n)),r.characters(e,0,e.length),a}return t+1}(e,v,E.tagName,a,n):v++}}catch(t){if(t instanceof xa)throw t;r.error("element parse error: "+t),v=-1}f<v?f=v:s(Math.max(y,f)+1)}}(e,t,i,n,this.errorHandler),n.endDocument()}},Oa.prototype={setTagName:function(e){if(!Ia.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!Ia.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},C={XMLReader:Aa,ParseError:xa};var Ma=R.DOMImplementation,Ra=kr.NAMESPACE,Na=C.ParseError,Ua=C.XMLReader;function Ba(e){this.options=e||{locator:{}}}function Fa(){this.cdata=!1}function ja(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Ha(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function qa(e,t){(e.currentElement||e.doc).appendChild(t)}function Va(e){return!!e&&"object"==typeof e}function Wa(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return t.reduce((function(e,t){return"object"!=typeof t||Object.keys(t).forEach((function(i){Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):Va(e[i])&&Va(t[i])?e[i]=Wa(e[i],t[i]):e[i]=t[i]})),e}),{})}function Ga(e){return Object.keys(e).map((function(t){return e[t]}))}function za(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Xa(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t}function Ka(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return i;return-1}function Ya(e){var t=e.baseUrl,i=void 0===(n=e.source)?"":n,n=void 0===(n=e.range)?"":n;return e=void 0===(e=e.indexRange)?"":e,i={uri:i,resolvedUri:Vn((void 0===t?"":t)||"",i)},(n||e)&&(n=(n||e).split("-"),e=window.BigInt?window.BigInt(n[0]):parseInt(n[0],10),n=window.BigInt?window.BigInt(n[1]):parseInt(n[1],10),e<Number.MAX_SAFE_INTEGER&&"bigint"==typeof e&&(e=Number(e)),"bigint"==typeof(n="bigint"==typeof(n=n<Number.MAX_SAFE_INTEGER&&"bigint"==typeof n?Number(n):n)||"bigint"==typeof e?window.BigInt(n)-window.BigInt(e)+window.BigInt(1):n-e+1)&&n<Number.MAX_SAFE_INTEGER&&(n=Number(n)),i.byterange={length:n,offset:e}),i}function Qa(e){return e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e}function $a(e){var t,i=e.type,n=e.duration,r=e.timescale,a=void 0===r?1:r,s=e.periodDuration,o=e.sourceDuration;return e=function(e,t){for(var i=[],n=e;n<t;n++)i.push(n);return i}((r=Us[i](e)).start,r.end).map((t=e,function(e){var i=t.duration,n=t.timescale,r=t.periodStart,a=t.startNumber;return{number:(void 0===a?1:a)+e,duration:i/(void 0===n?1:n),timeline:r,time:e*i}})),"static"===i&&(e[i=e.length-1].duration=("number"==typeof s?s:o)-n/a*i),e}function Ja(e){var t=e.baseUrl,i=void 0===(u=e.initialization)?{}:u,n=e.sourceDuration,r=void 0===(o=e.indexRange)?"":o,a=e.periodStart,s=e.presentationTime,o=void 0===(u=e.number)?0:u,u=e.duration;if(!t)throw new Error(Rs);return i=Ya({baseUrl:t,source:i.sourceURL,range:i.range}),(r=Ya({baseUrl:t,source:t,indexRange:r})).map=i,u?(e=$a(e)).length&&(r.duration=e[0].duration,r.timeline=e[0].timeline):n&&(r.duration=n,r.timeline=a),r.presentationTime=s||a,r.number=o,[r]}function Za(e,t,i){for(var n=e.sidx.map||null,r=e.sidx.duration,a=e.timeline||0,s=(s=e.sidx.byterange).offset+s.length,o=t.timescale,u=t.references.filter((function(e){return 1!==e.referenceType})),l=[],c=e.endList?"static":"dynamic",d=e.sidx.timeline,h=d,p=e.mediaSequence||0,f="bigint"==typeof t.firstOffset?window.BigInt(s)+t.firstOffset:s+t.firstOffset,m=0;m<u.length;m++){var g=(v=t.references[m]).referencedSize,y=v.subsegmentDuration,v=void 0;v=Ja({baseUrl:i,timescale:o,timeline:a,periodStart:d,presentationTime:h,number:p,duration:y,sourceDuration:r,indexRange:f+"-"+(v="bigint"==typeof f?f+window.BigInt(g)-window.BigInt(1):f+g-1),type:c})[0],n&&(v.map=n),l.push(v),f+="bigint"==typeof f?window.BigInt(g):g,h+=y/o,p++}return e.segments=l,e}function es(e){return t=function(e){return e.timeline},Ga(e.reduce((function(e,i){return i.forEach((function(i){e[t(i)]=i})),e}),{})).sort((function(e,t){return e.timeline>t.timeline?1:-1}));var t}function ts(e){var t,i,n=[];return t=e,i=function(e,t,i,r){n=n.concat(e.playlists||[])},Bs.forEach((function(e){for(var n in t.mediaGroups[e])for(var r in t.mediaGroups[e][n]){var a=t.mediaGroups[e][n][r];i(a)}})),n}function is(e){var t=e.playlist;e=e.mediaSequence,t.mediaSequence=e,t.segments.forEach((function(e,i){e.number=t.mediaSequence+i}))}function ns(e){return e&&e.uri+"-"+(e="bigint"==typeof(t=e.byterange).offset||"bigint"==typeof t.length?window.BigInt(t.offset)+window.BigInt(t.length)-window.BigInt(1):t.offset+t.length-1,t.offset+"-"+e);var t}function rs(e){return Ga(e.reduce((function(e,t){var i,n=t.attributes.id+(t.attributes.lang||"");return e[n]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[n].segments).push.apply(i,t.segments)),t.attributes.contentProtection&&(e[n].attributes.contentProtection=t.attributes.contentProtection)):(e[n]=t,e[n].attributes.timelineStarts=[]),e[n].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e}),{})).map((function(e){return e.discontinuityStarts=(e.segments||[]).reduce((function(e,t,i){return t.discontinuity&&e.push(i),e}),[]),e}))}function as(e,t){var i=ns(e.sidx);return(i=i&&t[i]&&t[i].sidx)&&Za(e,i,e.sidx.resolvedUri),e}function ss(e){var t=e.attributes,i=e.segments,n=e.sidx,r=e.discontinuityStarts;return i={attributes:((e={NAME:t.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:t.width,height:t.height},CODECS:t.codecs,BANDWIDTH:t.bandwidth})["PROGRAM-ID"]=1,e),uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:"",targetDuration:t.duration,discontinuityStarts:r,timelineStarts:t.timelineStarts,segments:i},t.contentProtection&&(i.contentProtection=t.contentProtection),n&&(i.sidx=n),i}function os(e){return"video/mp4"===(e=e.attributes).mimeType||"video/webm"===e.mimeType||"video"===e.contentType}function us(e){return"audio/mp4"===(e=e.attributes).mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType}function ls(e){return"text/vtt"===(e=e.attributes).mimeType||"text"===e.contentType}function cs(e){return e?Object.keys(e).reduce((function(t,i){return i=e[i],t.concat(i.playlists)}),[]):[]}function ds(e,t){for(var i,n,r,a,s,o,u=e.type,l=e.minimumUpdatePeriod,c=void 0===l?0:l,d=void 0===(l=e.media)?"":l,h=e.sourceDuration,p=void 0===(l=e.timescale)?1:l,f=void 0===(l=e.startNumber)?1:l,m=e.periodStart,g=[],y=-1,v=0;v<t.length;v++){var _,b,T=t[v],S=T.d,w=T.r||0,E=T.t||0;y<0&&(y=E),E&&y<E&&(y=E),b=w<0?(_=v+1)===t.length?"dynamic"===u&&0<c&&0<d.indexOf("$Number$")?(i=y,n=S,T=void 0,r=(E=e).NOW,a=E.clientOffset,s=E.availabilityStartTime,o=E.timescale,T=E.periodStart,E=E.minimumUpdatePeriod,Math.ceil((((r+a)/1e3+(void 0===E?0:E)-(s+(void 0===T?0:T)))*(void 0===o?1:o)-i)/n)):(h*p-y)/S:(t[_].t-y)/S:w+1;for(var k=f+g.length+b,C=f+g.length;C<k;)g.push({number:C,duration:S/p,time:y,timeline:m}),y+=S,C++}return g}function hs(e,t){return e.replace(Fs,(i=t,function(e,t,n,r){return"$$"===e?"$":void 0===i[t]?e:(e=""+i[t],"RepresentationID"===t||(r=n?parseInt(r,10):1)<=e.length?e:new Array(r-e.length+1).join("0")+e)}));var i}function ps(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=void 0===(n=e.initialization)?{sourceURL:"",range:""}:n,r=Ya({baseUrl:e.baseUrl,source:hs(n.sourceURL,i),range:n.range});return(n=t,(t=e).duration||n?t.duration?$a(t):ds(t,n):[{number:t.startNumber||1,duration:t.sourceDuration,time:0,timeline:t.periodStart}]).map((function(t){i.Number=t.number,i.Time=t.time;var n=hs(e.media||"",i),a=e.timescale||1,s=e.presentationTimeOffset||0;return a=e.periodStart+(t.time-s)/a,{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:Vn(e.baseUrl||"",n),map:r,number:t.number,presentationTime:a}}))}function fs(e,t){var i=e.duration,n=void 0===(n=e.segmentUrls)?[]:n,r=e.periodStart;if(!i&&!t||i&&t)throw new Error(Ns);var a,s=n.map((function(t){return n=t,t=(i=e).baseUrl,i=Ya({baseUrl:t,source:(i=void 0===(i=i.initialization)?{}:i).sourceURL,range:i.range}),(n=Ya({baseUrl:t,source:n.media,range:n.mediaRange})).map=i,n;var i,n}));return i&&(a=$a(e)),(a=t?ds(e,t):a).map((function(t,i){if(s[i]){var n=s[i],a=e.timescale||1;return i=e.presentationTimeOffset||0,n.timeline=t.timeline,n.duration=t.duration,n.number=t.number,n.presentationTime=r+(t.time-i)/a,n}})).filter((function(e){return e}))}function ms(e){var t,i=e.attributes,n=e.segmentInfo;n.template?(r=ps,t=Wa(i,n.template)):n.base?(r=Ja,t=Wa(i,n.base)):n.list&&(r=fs,t=Wa(i,n.list));var r,a={attributes:i};return r?(e=r(t,n.segmentTimeline),t.duration?(i=t.duration,r=t.timescale,t.duration=i/(void 0===r?1:r)):e.length?t.duration=e.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0,a.attributes=t,a.segments=e,n.base&&t.indexRange&&(a.sidx=e[0],a.segments=[]),a):a}function gs(e,t){return Xa(e.childNodes).filter((function(e){return e.tagName===t}))}function ys(e){return e.textContent.trim()}function vs(e){if(!(r=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e)))return 0;var t=(a=r.slice(1))[0],i=a[1],n=a[2],r=(e=a[3],a[4]),a=a[5];return 31536e3*parseFloat(t||0)+2592e3*parseFloat(i||0)+86400*parseFloat(n||0)+3600*parseFloat(e||0)+60*parseFloat(r||0)+parseFloat(a||0)}function _s(e){return e&&e.attributes?Xa(e.attributes).reduce((function(e,t){var i=js[t.name]||js.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}}function bs(e,t){return t.length?za(e.map((function(e){return t.map((function(t){return Vn(e,ys(t))}))}))):e}function Ts(e){var t=gs(e,"SegmentTemplate")[0],i=gs(e,"SegmentList")[0],n=i&&gs(i,"SegmentURL").map((function(e){return Wa({tag:"SegmentURL"},_s(e))})),r=gs(e,"SegmentBase")[0],a=(e=(a=i||t)&&gs(a,"SegmentTimeline")[0],(a=i||r||t)&&gs(a,"Initialization")[0]);(t=t&&_s(t))&&a?t.initialization=a&&_s(a):t&&t.initialization&&(t.initialization={sourceURL:t.initialization});var s={template:t,segmentTimeline:e&&gs(e,"S").map(_s),list:i&&Wa(_s(i),{segmentUrls:n,initialization:_s(a)}),base:r&&Wa(_s(r),{initialization:_s(a)})};return Object.keys(s).forEach((function(e){s[e]||delete s[e]})),s}function Ss(e){if(""===e)throw new Error(Os);var t,i,n=new Ls;try{i=(t=n.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!i||i&&0<i.getElementsByTagName("parsererror").length)throw new Error(Ms);return i}function ws(e,t){return void 0===t&&(t=0),(e=sr(e)).length-t<10||!ur(e,Ws,{offset:t})?t:ws(e,t+=function(e,t){void 0===t&&(t=0);var i=(e=sr(e))[t+5];return t=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],(16&i)>>4?20+t:10+t}(e,t))}function Es(e){return"string"==typeof e?or(e):e}function ks(e,t,i){var n;void 0===i&&(i=!1),n=t,t=Array.isArray(n)?n.map(Es):[Es(n)],e=sr(e);var r=[];if(!t.length)return r;for(var a=0;a<e.length;){var s=(e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3])>>>0,o=e.subarray(a+4,a+8);if(0==s)break;var u=a+s;if(u>e.length){if(i)break;u=e.length}s=e.subarray(a+8,u),ur(o,t[0])&&(1===t.length?r.push(s):r.push.apply(r,ks(s,t.slice(1),i))),a=u}return r}function Cs(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var r=function(e){for(var t=1,i=0;i<zs.length&&!(e&zs[i]);i++)t++;return t}(e[t]),a=e.subarray(t,t+r);return i&&((a=Array.prototype.slice.call(e,t,t+r))[0]^=zs[r-1]),{length:r,value:function(e,t){t=void 0!==(t=(i=void 0===t?{}:t).signed)&&t;var i,n=void 0!==(i=i.le)&&i;return i=((e=sr(e))[i=n?"reduce":"reduceRight"]||Array.prototype[i]).call(e,(function(t,i,r){return r=n?r:Math.abs(r+1-e.length),t+br(i)*Tr[r]}),br(0)),!t||(t=Tr[e.length]/br(2)-br(1))<(i=br(i))&&(i-=t,i-=t,i-=br(2)),Number(i)}(a,{signed:n}),bytes:a}}function Is(e){return"string"==typeof e?e.match(/.{1,2}/g).map(Is):"number"==typeof e?function(e,t){for(var i=void 0!==(t=(void 0===t?{}:t).le)&&t,n=(t=e=br(e="bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e?0:e),Math.ceil(t.toString(2).length/8)),r=new Uint8Array(new ArrayBuffer(n)),a=0;a<n;a++){var s=i?a:Math.abs(a+1-r.length);r[s]=Number(e/Tr[a]&br(255)),e<0&&(r[s]=Math.abs(~r[s]),r[s]-=0===a?1:2)}return r}(e):e}function xs(e,t,i){if(i>=t.length)return t.length;var n=Cs(t,i,!1);if(ur(e.bytes,n.bytes))return i;var r=Cs(t,i+n.length);return xs(e,t,i+r.length+r.value+n.length)}function As(e,t){var i;i=t,t=Array.isArray(i)?i.map(Is):[Is(i)],e=sr(e);var n=[];if(!t.length)return n;for(var r=0;r<e.length;){var a=Cs(e,r,!1),s=Cs(e,r+a.length),o=r+a.length+s.length;127===s.value&&(s.value=xs(a,e,o),s.value!==e.length&&(s.value-=o));var u=o+s.value>e.length?e.length:o+s.value;u=e.subarray(o,u),ur(t[0],a.bytes)&&(1===t.length?n.push(u):n=n.concat(As(u,t.slice(1)))),r+=a.length+s.length+u.length}return n}function Ps(e,t,i,n){void 0===n&&(n=1/0),e=sr(e),i=[].concat(i);for(var r,a=0,s=0;a<e.length&&(s<n||r);){var o=void 0;if(ur(e.subarray(a),Xs)?o=4:ur(e.subarray(a),Ks)&&(o=3),o){if(s++,r)return function(e){for(var t=[],i=1;i<e.length-2;)ur(e.subarray(i,i+3),Ys)&&(t.push(i+2),i++),i++;if(0===t.length)return e;var n=e.length-t.length,r=new Uint8Array(n),a=0;for(i=0;i<n;a++,i++)a===t[0]&&(a++,t.shift()),r[i]=e[a];return r}(e.subarray(r,a));var u=void 0;"h264"===t?u=31&e[a+o]:"h265"===t&&(u=e[a+o]>>1&63),-1!==i.indexOf(u)&&(r=a+o),a+=o+("h264"===t?1:2)}else a++}return e.subarray(0,0)}Ba.prototype.parseFromString=function(e,t){var i=this.options,n=new Ua,r=i.domBuilder||new Fa,a=i.errorHandler,s=i.locator,o=i.xmlns||{},u=/\/x?html?$/.test(t);return t=u?ka.HTML_ENTITIES:ka.XML_ENTITIES,s&&r.setDocumentLocator(s),n.errorHandler=function(e,t,i){if(!e){if(t instanceof Fa)return t;e=t}var n={},r=e instanceof Function;function a(t){var a=e[t];!a&&r&&(a=2==e.length?function(i){e(t,i)}:e),n[t]=a?function(e){a("[xmldom "+t+"]\t"+e+function(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(i))}:function(){}}return i=i||{},a("warning"),a("error"),a("fatalError"),n}(a,r,s),n.domBuilder=i.domBuilder||r,u&&(o[""]=Ra.HTML),o.xml=o.xml||Ra.XML,e&&"string"==typeof e?n.parse(e,o,t):n.errorHandler.error("invalid doc source"),r.doc},Fa.prototype={startDocument:function(){this.doc=(new Ma).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,n){var r=this.doc,a=r.createElementNS(e,i||t),s=n.length;qa(this,a),this.currentElement=a,this.locator&&ja(this.locator,a);for(var o=0;o<s;o++){e=n.getURI(o);var u=n.getValue(o),l=(i=n.getQName(o),r.createAttributeNS(e,i));this.locator&&ja(n.getLocator(o),l),l.value=l.nodeValue=u,a.setAttributeNode(l)}},endElement:function(e,t,i){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){t=this.doc.createProcessingInstruction(e,t),this.locator&&ja(this.locator,t),qa(this,t)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){var n;(e=Ha.apply(this,arguments))&&(n=this.cdata?this.doc.createCDATASection(e):this.doc.createTextNode(e),this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&ja(this.locator,n))},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=Ha.apply(this,arguments),e=this.doc.createComment(e),this.locator&&ja(this.locator,e),qa(this,e)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var n=this.doc.implementation;n&&n.createDocumentType&&(i=n.createDocumentType(e,t,i),this.locator&&ja(this.locator,i),qa(this,i),this.doc.doctype=i)},warning:function(e){},error:function(e){},fatalError:function(e){throw new Na(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){Fa.prototype[e]=function(){return null}}));var Ls={__DOMHandler:Fa,DOMParser:Ba,DOMImplementation:R.DOMImplementation,XMLSerializer:R.XMLSerializer}.DOMParser,Ds="INVALID_NUMBER_OF_PERIOD",Os="DASH_EMPTY_MANIFEST",Ms="DASH_INVALID_XML",Rs="NO_BASE_URL",Ns="SEGMENT_TIME_UNSPECIFIED",Us={static:function(e){var t=e.duration,i=void 0===(r=e.timescale)?1:r,n=e.sourceDuration,r=e.periodDuration;return i=t/i,"number"==typeof(e=Qa(e.endNumber))?{start:0,end:e}:"number"==typeof r?{start:0,end:r/i}:{start:0,end:n/i}},dynamic:function(e){var t=e.NOW,i=e.clientOffset,n=e.availabilityStartTime,r=void 0===(u=e.timescale)?1:u,a=e.duration,s=void 0===(o=e.periodStart)?0:o,o=void 0===(u=e.minimumUpdatePeriod)?0:u,u=void 0===(u=e.timeShiftBufferDepth)?1/0:u;return e=Qa(e.endNumber),i=(t+i)/1e3,s=n+s,o=Math.ceil((i+o-s)*r/a),u=Math.floor((i-s-u)*r/a),a=Math.floor((i-s)*r/a),{start:Math.max(0,u),end:"number"==typeof e?e:Math.min(o,a)}}},Bs=["AUDIO","SUBTITLES"],Fs=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,js={mediaPresentationDuration:vs,availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e=e)&&(e+="Z"),Date.parse(e)/1e3},minimumUpdatePeriod:vs,suggestedPresentationDelay:vs,type:function(e){return e},timeShiftBufferDepth:vs,start:vs,width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?vs(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},Hs={"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"},qs=Math.pow(2,32),Vs=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.getBigUint64?(e=t.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(e):e:t.getUint32(0)*qs+t.getUint32(4)},Ws=sr([73,68,51]),Gs={EBML:sr([26,69,223,163]),DocType:sr([66,130]),Segment:sr([24,83,128,103]),SegmentInfo:sr([21,73,169,102]),Tracks:sr([22,84,174,107]),Track:sr([174]),TrackNumber:sr([215]),DefaultDuration:sr([35,227,131]),TrackEntry:sr([174]),TrackType:sr([131]),FlagDefault:sr([136]),CodecID:sr([134]),CodecPrivate:sr([99,162]),VideoTrack:sr([224]),AudioTrack:sr([225]),Cluster:sr([31,67,182,117]),Timestamp:sr([231]),TimestampScale:sr([42,215,177]),BlockGroup:sr([160]),BlockDuration:sr([155]),Block:sr([161]),SimpleBlock:sr([163])},zs=[128,64,32,16,8,4,2,1],Xs=sr([0,0,0,1]),Ks=sr([0,0,1]),Ys=sr([0,0,3]),Qs={webm:sr([119,101,98,109]),matroska:sr([109,97,116,114,111,115,107,97]),flac:sr([102,76,97,67]),ogg:sr([79,103,103,83]),ac3:sr([11,119]),riff:sr([82,73,70,70]),avi:sr([65,86,73]),wav:sr([87,65,86,69]),"3gp":sr([102,116,121,112,51,103]),mp4:sr([102,116,121,112]),fmp4:sr([115,116,121,112]),mov:sr([102,116,121,112,113,116]),moov:sr([109,111,111,118]),moof:sr([109,111,111,102])},$s={aac:function(e){return ur(e,[255,16],{offset:ws(e),mask:[255,22]})},mp3:function(e){return ur(e,[255,2],{offset:ws(e),mask:[255,6]})},webm:function(e){return ur(e=As(e,[Gs.EBML,Gs.DocType])[0],Qs.webm)},mkv:function(e){return ur(e=As(e,[Gs.EBML,Gs.DocType])[0],Qs.matroska)},mp4:function(e){return!$s["3gp"](e)&&!$s.mov(e)&&(!(!ur(e,Qs.mp4,{offset:4})&&!ur(e,Qs.fmp4,{offset:4}))||!(!ur(e,Qs.moof,{offset:4})&&!ur(e,Qs.moov,{offset:4}))||void 0)},mov:function(e){return ur(e,Qs.mov,{offset:4})},"3gp":function(e){return ur(e,Qs["3gp"],{offset:4})},ac3:function(e){var t=ws(e);return ur(e,Qs.ac3,{offset:t})},ts:function(e){if(e.length<189&&1<=e.length)return 71===e[0];for(var t=0;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac:function(e){var t=ws(e);return ur(e,Qs.flac,{offset:t})},ogg:function(e){return ur(e,Qs.ogg)},avi:function(e){return ur(e,Qs.riff)&&ur(e,Qs.avi,{offset:8})},wav:function(e){return ur(e,Qs.riff)&&ur(e,Qs.wav,{offset:8})},h264:function(e){return Ps(e,"h264",7,3).length},h265:function(e){return Ps(e,"h265",[32,33],3).length}},Js=Object.keys($s).filter((function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e})).concat(["ts","h264","h265"]);function Zs(e){e=sr(e);for(var t=0;t<Js.length;t++){var i=Js[t];if(_u[i](e))return i}return""}function eo(e,t,i){return e&&i&&i.responseURL&&t!==i.responseURL?i.responseURL:t}function to(e){return qn.log.debug?qn.log.debug.bind(qn,"VHS:",e+" >"):function(){}}function io(e,t){var i,n=[];if(e&&e.length)for(i=0;i<e.length;i++)t(e.start(i),e.end(i))&&n.push([e.start(i),e.end(i)]);return qn.createTimeRanges(n)}function no(e,t){return io(e,(function(e,i){return e-.1<=t&&t<=i+.1}))}function ro(e,t){return io(e,(function(e){return t<=e-Su}))}function ao(e){var t=[];if(!e||!e.length)return"";for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")}function so(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}function oo(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function uo(e,t){var i=0;if(!e||!e.length)return i;for(var n=0;n<e.length;n++){var r=e.start(n),a=e.end(n);a<t||(i+=r<t&&t<=a?a-t:a-r)}return i}function lo(e,t){if(!t.preload)return t.duration;var i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i}function co(e){return(e.segments||[]).reduce((function(e,t,i){return t.parts?t.parts.forEach((function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e}),[])}function ho(e){return(e=e.segments&&e.segments.length&&e.segments[e.segments.length-1])&&e.parts||[]}function po(e){var t=e.preloadSegment;if(t)return e=t.parts,(t=(t.preloadHints||[]).reduce((function(e,t){return e+("PART"===t.type?1:0)}),0))+(e&&e.length?e.length:0)}function fo(e,t){return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0<ho(t).length)&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:e&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0}function mo(e,t,i){if((t=void 0===t?e.mediaSequence+e.segments.length:t)<e.mediaSequence)return 0;var n=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(void 0!==(r=e.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=lo(e,r),void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t);return n.precise?n.result:(t=function(e,t){for(var i,n=0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(i=e.segments[r]).start)return{result:i.start-n,precise:!0};if(n+=lo(e,i),void 0!==i.end)return{result:i.end-n,precise:!0}}return{result:-1,precise:!1}}(e,t)).precise?t.result:n.result+i}function go(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return window.Infinity}return mo(e,t,i)}function yo(e){var t=e.defaultDuration,i=e.durationList,n=e.startIndex,r=e.endIndex,a=0;if(r<n&&(n=(e=[r,n])[0],r=e[1]),n<0){for(var s=n;s<Math.min(0,r);s++)a+=t;n=0}for(var o=n;o<r;o++)a+=i[o].duration;return a}function vo(e,t,i,n){return e&&e.segments?e.endList?go(e):null===t?null:(t=mo(e,e.mediaSequence+e.segments.length,t=t||0),i&&(t-=n="number"==typeof n?n:fo(null,e)),Math.max(0,t)):null}function _o(e){return e.excludeUntil&&e.excludeUntil>Date.now()}function bo(e){return e.excludeUntil&&e.excludeUntil===1/0}function To(e){var t=_o(e);return!e.disabled&&!t}function So(e,t){return t.attributes&&t.attributes[e]}function wo(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((function(e){return!!To(e)&&(e.attributes.BANDWIDTH||0)<i})).length}function Eo(e,t){return!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.id!==t.id)&&(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)&&(!e.uri||!t.uri||e.uri!==t.uri))}function ko(e,t){var i,n=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},r=!1;for(i in n){for(var a in n[i])if(r=t(n[i][a]))break;if(r)break}return!!r}function Co(e){if(!e||!e.playlists||!e.playlists.length)return ko(e,(function(e){return e.playlists&&e.playlists.length||e.uri}));for(var t=0;t<e.playlists.length;t++){var i=function(t){var i=e.playlists[t];return(t=i.attributes&&i.attributes.CODECS)&&t.split(",").every(er)||ko(e,(function(e){return Eo(i,e)}))?"continue":{v:!1}}(t);if("continue"!==i&&"object"==typeof i)return i.v}return!0}function Io(e,t){return e+"-"+t}function xo(e,t){e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((function(i){if(e.mediaGroups[i])for(var n in e.mediaGroups[i])for(var r in e.mediaGroups[i][n]){var a=e.mediaGroups[i][n][r];t(a,i,n,r)}}))}function Ao(e){var t=e.playlist,i=e.uri;e=e.id,t.id=e,t.playlistErrors_=0,i&&(t.uri=i),t.attributes=t.attributes||{}}function Po(e,t){e.uri=t;for(var i=0;i<e.playlists.length;i++)e.playlists[i].uri||(e.playlists[i].uri="placeholder-uri-"+i);var n,r=Co(e);xo(e,(function(t,i,n,a){var s="placeholder-uri-"+i+"-"+n+"-"+a;if(!t.playlists||!t.playlists.length){if(r&&"AUDIO"===i&&!t.uri)for(var o=0;o<e.playlists.length;o++){var u=e.playlists[o];if(u.attributes&&u.attributes.AUDIO&&u.attributes.AUDIO===n)return}t.playlists=[m({},t)]}t.playlists.forEach((function(t,i){var n=Io(i,s);t.uri?t.resolvedUri=t.resolvedUri||Tu(e.uri,t.uri):(t.uri=0===i?s:n,t.resolvedUri=t.uri),t.id=t.id||n,t.attributes=t.attributes||{},e.playlists[t.id]=t,e.playlists[t.uri]=t}))})),function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];Ao({playlist:i,id:Io(t,i.uri)}),i.resolvedUri=Tu(e.uri,i.uri),e.playlists[i.id]=i,(e.playlists[i.uri]=i).attributes.BANDWIDTH||ku.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}(e),xo(n=e,(function(e){e.uri&&(e.resolvedUri=Tu(n.uri,e.uri))}))}function Lo(e,t){!e.resolvedUri&&e.uri&&(e.resolvedUri=Tu(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=Tu(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=Tu(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=Tu(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((function(e){e.resolvedUri||(e.resolvedUri=Tu(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((function(e){e.resolvedUri||(e.resolvedUri=Tu(t,e.uri))}))}function Do(e){var t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(var n=0;n<i.preloadHints.length;n++)if("MAP"===i.preloadHints[n].type)return t;i.duration=e.targetDuration,i.preload=!0,t.push(i)}return t}function Oo(e,t){return e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment}function Mo(e,t,i){void 0===i&&(i=Oo);var n=Cu(e,{}),r=n.playlists[t.id];if(!r)return null;if(i(r,t))return null;t.segments=Do(t);var a=Cu(r,t);if(a.preloadSegment&&!t.preloadSegment&&delete a.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(var s=0;s<t.skip.skippedSegments;s++)t.segments.unshift({skipped:!0})}a.segments=function(e,t,i){var n=e.slice(),r=t.slice();i=i||0;for(var a,s=[],o=0;o<r.length;o++){var u=n[o+i],l=r[o];u?(a=u.map||a,s.push(function(e,t){if(!e)return t;var i=Cu(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(var n=0;n<t.parts.length;n++)e.parts&&e.parts[n]&&(i.parts[n]=Cu(e.parts[n],t.parts[n]));return!e.skipped&&t.skipped&&(i.skipped=!1),e.preload&&!t.preload&&(i.preload=!1),i}(u,l))):(a&&!l.map&&(l.map=a),s.push(l))}return s}(r.segments,t.segments,t.mediaSequence-r.mediaSequence)}a.segments.forEach((function(e){Lo(e,a.resolvedUri)}));for(var o=0;o<n.playlists.length;o++)n.playlists[o].id===t.id&&(n.playlists[o]=a);return n.playlists[t.id]=a,n.playlists[t.uri]=a,xo(e,(function(e,i,n,r){if(e.playlists)for(var s=0;s<e.playlists.length;s++)t.id===e.playlists[s].id&&(e.playlists[s]=a)})),n}function Ro(e,t){var i=e.segments||[],n=(i=(n=i[i.length-1])&&n.parts&&n.parts[n.parts.length-1])&&i.duration||n&&n.duration;return t&&n?1e3*n:500*(e.partTargetDuration||e.targetDuration||10)}function No(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),n(t=t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode?t:new Error("XHR Failed with a response of: "+(e&&(r||e.responseText))),e)}function Uo(){function e(t,i){t=Au({timeout:45e3},t);var n=e.beforeRequest||qn.Vhs.xhr.beforeRequest;!n||"function"!=typeof n||(n=n(t))&&(t=n);var r=(!0===qn.Vhs.xhr.original?xu:qn.Vhs.xhr)(t,(function(e,t){return No(r,e,t,i)})),a=r.abort;return r.abort=function(){return r.aborted=!0,a.apply(r,arguments)},r.uri=t.uri,r.requestTime=Date.now(),r}return e.original=!0,e}function Bo(e){var t,i={};return e.byterange&&(i.Range="bytes="+(e=(t=e.byterange).offset)+"-"+(t="bigint"==typeof t.offset||"bigint"==typeof t.length?window.BigInt(t.offset)+window.BigInt(t.length)-window.BigInt(1):t.offset+t.length-1)),i}function Fo(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function jo(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function Ho(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];ar(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t}function qo(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function Vo(e){return e.resolvedUri}function Wo(e){for(var t=Array.prototype.slice.call(e),i="",n=0;n<t.length/16;n++)i+=t.slice(16*n,16*n+16).map(Fo).join("")+" "+t.slice(16*n,16*n+16).map(jo).join("")+"\n";return i}function Go(e){var t=e.programTime,i=e.playlist,n=e.retryCount,r=void 0===n?2:n,a=e.seekTo,s=e.pauseAfterSeek,o=void 0===s||s,u=e.tech,l=e.callback;if(!l)throw new Error("seekToProgramTime: callback must be provided");return void 0!==t&&i&&a?i.endList||u.hasStarted_?function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1;return!0}(i)?(n=function(e,t){var i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;if(i<(r=t.segments[0]).dateTimeObject)return null;for(var n=0;n<t.segments.length-1;n++){var r=t.segments[n];if(i<t.segments[n+1].dateTimeObject)break}var a=t.segments[t.segments.length-1],s=(e=a.dateTimeObject,a.videoTimingInfo?(s=a.videoTimingInfo).transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds:a.duration+.25*a.duration);return new Date(e.getTime()+1e3*s)<i?null:{segment:r=e<i?a:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:Eu.duration(t,t.mediaSequence+t.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"}}(t,i))?(e=function(e,t){var i;try{n=new Date(e),i=new Date(t)}catch(e){}var n=n.getTime();return(i.getTime()-n)/1e3}((s=n.segment).dateTimeObject,t),"estimate"===n.type?0===r?l({message:t+" is not buffered yet. Try again"}):(a(n.estimatedStart+e),void u.one("seeked",(function(){Go({programTime:t,playlist:i,retryCount:r-1,seekTo:a,pauseAfterSeek:o,tech:u,callback:l})}))):(e=s.start+e,u.one("seeked",(function(){return l(null,u.currentTime())})),o&&u.pause(),void a(e))):l({message:t+" was not found in the stream"}):l({message:"programDateTime tags must be provided in the manifest "+i.resolvedUri}):l({message:"player must be playing a live stream to start buffering"}):l({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"})}function zo(e,t){if(!Oo(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(var i=0;i<e.segments.length;i++){var n=e.segments[i],r=t.segments[i];if(n.uri!==r.uri)return!1;if(n.byterange||r.byterange){if(n=n.byterange,r=r.byterange,n&&!r||!n&&r)return!1;if(n.offset!==r.offset||n.length!==r.length)return!1}}return!0}function Xo(e,t){var i,n={};for(i in e){var r=e[i].sidx;if(r){var a=ns(r);if(!t[a])break;var s=t[a].sidxInfo;s=s,r=r,(Boolean(!s.map&&!r.map)||Boolean(s.map&&r.map&&s.map.byterange.offset===r.map.byterange.offset&&s.map.byterange.length===r.map.byterange.length))&&s.uri===r.uri&&s.byterange.offset===r.byterange.offset&&s.byterange.length===r.byterange.length&&(n[a]=t[a])}}return n}function Ko(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}function Yo(e){var t=e.transmuxer,i=e.bytes,n=e.audioAppendStart,r=e.gopsToAlignWith,a=e.remux,s=e.onData,o=e.onTrackInfo,u=e.onAudioTimingInfo,l=e.onVideoTimingInfo,c=e.onVideoSegmentTimingInfo,d=e.onAudioSegmentTimingInfo,h=e.onId3,p=e.onCaptions,f=e.onDone,m=e.onEndedTimeline,g=e.onTransmuxerLog,y=e.isEndOfTimeline,v={buffer:[]},_=y;t.onmessage=function(i){var n;t.currentTransmux===e&&("data"===i.data.action&&function(e,t,i){var n=(l=e.data.segment).type,r=l.initSegment,a=l.captions,s=l.captionStreams,o=l.metadata,u=l.videoFrameDtsTime,l=l.videoFramePtsTime;t.buffer.push({captions:a,captionStreams:s,metadata:o}),e=e.data.segment.boxes||{data:e.data.segment.data},r={type:n,data:new Uint8Array(e.data,e.data.byteOffset,e.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)},void 0!==u&&(r.videoFrameDtsTime=u),void 0!==l&&(r.videoFramePtsTime=l),i(r)}(i,v,s),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&(v.gopInfo=i.data.gopInfo),"audioTimingInfo"===i.data.action&&u(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&l(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&c(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&d(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&h([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(_=!1,m()),"log"===i.data.action&&g(i.data.log),"transmuxed"===i.data.type&&(_||(t.onmessage=null,i=(n={transmuxedData:v,callback:f}).transmuxedData,n=n.callback,i.buffer=[],n(i),Mu(t))))},n&&t.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==a&&t.postMessage({action:"setRemux",remux:a}),i.byteLength&&(r=i instanceof ArrayBuffer?i:i.buffer,a=i instanceof ArrayBuffer?0:i.byteOffset,t.postMessage({action:"push",data:r,byteOffset:a,byteLength:i.byteLength},[r])),y&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})}function Qo(e,t){e.postMessage({action:t}),Mu(e)}function $o(e){var t=e.transmuxer,i=e.endAction||e.action,n=e.callback,r=m({},e,{endAction:null,transmuxer:null,callback:null}),a=function r(a){a.data.action===i&&(t.removeEventListener("message",r),a.data.data&&(a.data.data=new Uint8Array(a.data.data,e.byteOffset||0,e.byteLength||a.data.data.byteLength),e.data&&(e.data=a.data.data)),n(a.data))};t.addEventListener("message",a),e.data?(a=e.data instanceof ArrayBuffer,r.byteOffset=a?0:e.data.byteOffset,r.byteLength=e.data.byteLength,a=[a?e.data:e.data.buffer],t.postMessage(r,a)):t.postMessage(r)}function Jo(e){e.forEach((function(e){e.abort()}))}function Zo(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Uu,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Bu,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Nu,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:Nu,xhr:t}:null}function eu(e,t,i){return function(n,r){var a=r.response;if(n=Zo(n,r))return i(n,e);if(16!==a.byteLength)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Nu,xhr:r},e);a=new DataView(a);for(var s=new Uint32Array([a.getUint32(0),a.getUint32(4),a.getUint32(8),a.getUint32(12)]),o=0;o<t.length;o++)t[o].bytes=s;return i(null,e)}}function tu(e,t){var i=Zs(e.map.bytes);if("mp4"!==i){var n=e.map.resolvedUri||e.map.uri;return t({internal:!0,message:"Found unsupported "+(i||"unknown")+" container for initialization segment at URL: "+n,code:Nu})}$o({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:function(i){var n=i.tracks;return i=i.data,e.map.bytes=i,n.forEach((function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||"number"==typeof(e.map.tracks[t.type]=t).id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale)})),t(null)}})}function iu(e){var t=e.segment,i=e.bytes,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=new Uint8Array(i);if(0<ks(f,["moof"]).length){t.isFmp4=!0;var m=t.map.tracks,g={isFmp4:!0,hasVideo:!!m.video,hasAudio:!!m.audio};m.audio&&m.audio.codec&&"enca"!==m.audio.codec&&(g.audioCodec=m.audio.codec),m.video&&m.video.codec&&"encv"!==m.video.codec&&(g.videoCodec=m.video.codec),m.video&&m.audio&&(g.isMuxed=!0),n(t,g);var y=function(e){d(t,{data:f,type:g.hasAudio&&!g.isMuxed?"audio":"video"}),e&&e.length&&u(t,e),h(null,t,{})};$o({action:"probeMp4StartTime",timescales:t.map.timescales,data:f,transmuxer:t.transmuxer,callback:function(e){var n=e.data;e=e.startTime,i=n.buffer,t.bytes=f=n,g.hasAudio&&!g.isMuxed&&r(t,"audio","start",e),g.hasVideo&&r(t,"video","start",e),m.video&&n.byteLength&&t.transmuxer?$o({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:f,timescales:t.map.timescales,trackIds:[m.video.id],callback:function(e){i=e.data.buffer,t.bytes=f=e.data,e.logs.forEach((function(e){p(qn.mergeOptions(e,{stream:"mp4CaptionParser"}))})),y(e.captions)}}):y()}})}else if(t.transmuxer){if(void 0===t.container&&(t.container=Zs(f)),"ts"!==t.container&&"aac"!==t.container)return n(t,{hasAudio:!1,hasVideo:!1}),h(null,t,{}),0;!function(e){var t=e.segment,i=e.bytes,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=(e=t.map&&t.map.tracks||{},Boolean(e.audio&&e.video)),m=r.bind(null,t,"audio","start"),g=r.bind(null,t,"audio","end"),y=r.bind(null,t,"video","start"),v=r.bind(null,t,"video","end");$o({action:"probeTs",transmuxer:t.transmuxer,data:i,baseStartTime:t.baseStartTime,callback:function(e){t.bytes=i=e.data,(e=e.result)&&(n(t,{hasAudio:e.hasAudio,hasVideo:e.hasVideo,isMuxed:f}),n=null,e.hasAudio&&!f&&m(e.audioStart),e.hasVideo&&y(e.videoStart),y=m=null),function(e){if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void Yo(e);e.transmuxer.transmuxQueue.push(e)}({bytes:i,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,remux:f,onData:function(e){e.type="combined"===e.type?"video":e.type,d(t,e)},onTrackInfo:function(e){n&&(f&&(e.isMuxed=!0),n(t,e))},onAudioTimingInfo:function(e){m&&void 0!==e.start&&(m(e.start),m=null),g&&void 0!==e.end&&g(e.end)},onVideoTimingInfo:function(e){y&&void 0!==e.start&&(y(e.start),y=null),v&&void 0!==e.end&&v(e.end)},onVideoSegmentTimingInfo:function(e){a(e)},onAudioSegmentTimingInfo:function(e){s(e)},onId3:function(e,i){o(t,e,i)},onCaptions:function(e){u(t,[e])},isEndOfTimeline:l,onEndedTimeline:function(){c()},onTransmuxerLog:p,onDone:function(e){h&&(e.type="combined"===e.type?"video":e.type,h(null,t,e))}})}})}({segment:t,bytes:i,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p})}else h(null,t,{})}function nu(e,t){var i=e.id,n=e.key,r=e.encryptedBytes,a=e.decryptionWorker;e=function e(n){n.data.source===i&&(a.removeEventListener("message",e),n=n.data.decrypted,t(new Uint8Array(n.bytes,n.byteOffset,n.byteLength)))},a.addEventListener("message",e),e=n.bytes.slice?n.bytes.slice():new Uint32Array(Array.prototype.slice.call(n.bytes)),a.postMessage(Ho({source:i,encrypted:r,key:e,iv:n.iv}),[r.buffer,e.buffer])}function ru(e,t){return t=t.attributes||{},e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]}function au(e){var t={};return e.forEach((function(e){var i=e.mediaType,n=e.type;e=e.details,t[i]=t[i]||[],t[i].push(Jn(""+n+e))})),Object.keys(t).forEach((function(e){return 1<t[e].length?(Fu("multiple "+e+" codecs found as attributes: "+t[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(t[e]=null)):void(t[e]=t[e][0])})),t}function su(e){var t=0;return e.audio&&t++,e.video&&t++,t}function ou(e,t){var i,n=t.attributes||{},r=au(function(e){if((e=e.attributes||{}).CODECS)return Zn(e.CODECS)}(t)||[]);return ru(e,t)&&!r.audio&&!function(e,t){if(!ru(e,t))return!0;t=t.attributes||{};var i,n=e.mediaGroups.AUDIO[t.AUDIO];for(i in n)if(!n[i].uri&&!n[i].playlists)return!0;return!1}(e,t)&&(i=au(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i,n=e.mediaGroups.AUDIO[t];if(!n)return null;for(i in n){var r=n[i];if(r.default&&r.playlists)return Zn(r.playlists[0].attributes.CODECS)}return null}(e,n.AUDIO)||[])).audio&&(r.audio=i.audio),r}function uu(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}}function lu(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function cu(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))}function du(e,t){var i,n;return(i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE)-((n=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:n)||window.Number.MAX_VALUE)}function hu(e,t,i,n,r,a){if(e){var s={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r},o=e.playlists;Eu.isAudioOnly(e)&&(o=a.getAudioTrackPlaylists_(),s.audioOnly=!0);var u=o.map((function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||window.Number.MAX_VALUE,width:t,height:i,playlist:e}}));cu(u,(function(e,t){return e.bandwidth-t.bandwidth}));var l,c,d,h=(u=u.filter((function(e){return!Eu.isIncompatible(e.playlist)}))).filter((function(e){return Eu.isEnabled(e.playlist)})),p=(e=(h=h.length?h:u.filter((function(e){return!Eu.isDisabled(e.playlist)}))).filter((function(e){return e.bandwidth*Du.BANDWIDTH_VARIANCE<t})))[e.length-1];if(o=e.filter((function(e){return e.bandwidth===p.bandwidth}))[0],!1===r){var f=o||h[0]||u[0];return f&&f.playlist?(r=o?"bandwidthBestRep":"sortedPlaylistReps",h[0]&&(r="enabledPlaylistReps"),ju("choosing "+uu(f)+" using "+r+" with options",s),f.playlist):(ju("could not choose a playlist with options",s),null)}cu(f=e.filter((function(e){return e.width&&e.height})),(function(e,t){return e.width-t.width})),p=(e=f.filter((function(e){return e.width===i&&e.height===n})))[e.length-1],(e=e.filter((function(e){return e.bandwidth===p.bandwidth}))[0])||(c=(l=f.filter((function(e){return e.width>i||e.height>n}))).filter((function(e){return e.width===l[0].width&&e.height===l[0].height})),p=c[c.length-1],c=c.filter((function(e){return e.bandwidth===p.bandwidth}))[0]),a.experimentalLeastPixelDiffSelector&&(cu(m=f.map((function(e){return e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e})),(function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff})),d=m[0]);var m=d||c||e||o||h[0]||u[0];return m&&m.playlist?(u="sortedPlaylistReps",d?u="leastPixelDiffRep":c?u="resolutionPlusOneRep":e?u="resolutionBestRep":o?u="bandwidthBestRep":h[0]&&(u="enabledPlaylistReps"),ju("choosing "+uu(m)+" using "+u+" with options",s),m.playlist):(ju("could not choose a playlist with options",s),null)}}function pu(e,t,i){var n,r;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}function fu(e){return"number"==typeof e&&isFinite(e)}function mu(e){var t=e.startOfSegment,i=e.duration,n=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,u=a.segments,l=e.mediaIndex,c=e.partIndex,d=e.timeline,h=(void 0===u?[]:u).length-1,p="mediaIndex/partIndex increment";return e.getMediaInfoForTime?p="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(p="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(p+=" with independent "+e.independent),a="number"==typeof c,u=e.segment.uri?"segment":"pre-segment",e=a?po({preloadSegment:n})-1:0,u+" ["+(s+l)+"/"+(s+h)+"]"+(a?" part ["+c+"/"+e+"]":"")+" segment start/end ["+n.start+" => "+n.end+"]"+(a?" part start/end ["+r.start+" => "+r.end+"]":"")+" startOfSegment ["+t+"] duration ["+i+"] timeline ["+d+"] selected by ["+p+"] playlist ["+o+"]"}function gu(e){return e+"TimingInfo"}function yu(e){var t=e.timelineChangeController,i=e.currentTimeline,n=e.segmentTimeline,r=e.loaderType;if(e=e.audioDisabled,i!==n){if("audio"===r)return!(i=t.lastTimelineChange({type:"main"}))||i.to!==n;if("main"===r&&e)return!(t=t.pendingTimelineChange({type:"audio"}))||t.to!==n}}function vu(e){var t=e.segmentDuration;return e=e.maxDuration,!!t&&Math.round(t)>e+Su}Js.forEach((function(e){var t=$s[e];$s[e]=function(e){return t(sr(e))}}));var _u=$s,bu=9e4,Tu=Vn,Su=1/30,wu=qn.createTimeRange,Eu={liveEdgeDelay:fo,duration:go,seekable:function(e,t,i){var n=t||0;return null===(i=vo(e,t,!0,i))?wu():wu(n,i)},getMediaInfoForTime:function(e){for(var t=e.playlist,i=e.currentTime,n=e.startingSegmentIndex,r=e.startingPartIndex,a=e.startTime,s=e.experimentalExactManifestTimings,o=i-a,u=co(t),l=0,c=0;c<u.length;c++){var d=u[c];if(n===d.segmentIndex&&("number"!=typeof r||"number"!=typeof d.partIndex||r===d.partIndex)){l=c;break}}if(o<0){if(0<l)for(var h=l-1;0<=h;h--){var p=u[h];if(o+=p.duration,s){if(o<0)continue}else if(o+Su<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-yo({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:h})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i}}if(l<0){for(var f=l;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i};l=0}for(var m=l;m<u.length;m++){var g=u[m];if(o-=g.duration,s){if(0<o)continue}else if(0<=o-Su)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+yo({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:m})}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:i}},isEnabled:To,isDisabled:function(e){return e.disabled},isBlacklisted:_o,isIncompatible:bo,playlistEnd:vo,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:So,estimateSegmentRequestTime:function(e,t,i,n){return So("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*(n=void 0===n?0:n))/t:NaN},isLowestEnabledRendition:wo,isAudioOnly:Co,playlistMatch:Eo,segmentDurationWithParts:lo},ku=qn.log,Cu=qn.mergeOptions,Iu=function(e){function t(t,i,n){var r;if(void 0===n&&(n={}),r=e.call(this)||this,!t)throw new Error("A non-empty playlist URL or object is required");r.logger_=to("PlaylistLoader");var a=void 0!==(a=n.withCredentials)&&a;return n=void 0!==(n=n.handleManifestRedirects)&&n,r.src=t,r.vhs_=i,r.withCredentials=a,r.handleManifestRedirects=n,i=i.options_,r.customTagParsers=i&&i.customTagParsers||[],r.customTagMappers=i&&i.customTagMappers||[],r.experimentalLLHLS=i&&i.experimentalLLHLS||!1,qn.browser.IE_VERSION&&(r.experimentalLLHLS=!1),r.state="HAVE_NOTHING",r.handleMediaupdatetimeout_=r.handleMediaupdatetimeout_.bind(ct(r)),r.on("mediaupdatetimeout",r.handleMediaupdatetimeout_),r}dt(t,e);var i=t.prototype;return i.handleMediaupdatetimeout_=function(){var e,t,i=this;"HAVE_METADATA"===this.state&&(e=this.media(),t=Tu(this.master.uri,e.uri),this.experimentalLLHLS&&(t=function(e,t){if(t.endList||!t.serverControl)return e;var i,n,r,a,s={};return t.serverControl.canBlockReload&&(r=t.preloadSegment,i=t.mediaSequence+t.segments.length,r&&(n=r.parts||[],-1<(r=po(t)-1)&&r!=n.length-1&&(s._HLS_part=r),(-1<r||n.length)&&i--),s._HLS_msn=i),t.serverControl&&t.serverControl.canSkipUntil&&(s._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(s).length&&(a=new window.URL(e),["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){s.hasOwnProperty(e)&&a.searchParams.set(e,s[e])})),e=a.toString()),e}(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials},(function(e,t){if(i.request)return e?i.playlistRequestError(i.request,i.media(),"HAVE_METADATA"):void i.haveMetadata({playlistString:i.request.responseText,url:i.media().uri,id:i.media().id})})))},i.playlistRequestError=function(e,t,i){var n=t.uri;t=t.id,this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[t],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")},i.parseManifest_=function(e){var t=this,i=e.url;return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=void 0===(a=e.customTagParsers)?[]:a,a=void 0===(a=e.customTagMappers)?[]:a,s=(e=e.experimentalLLHLS,new hr);t&&s.on("warn",t),i&&s.on("info",i),r.forEach((function(e){return s.addParser(e)})),a.forEach((function(e){return s.addTagMapper(e)})),s.push(n),s.end();var o=s.manifest;e||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){o.hasOwnProperty(e)&&delete o[e]})),o.segments&&o.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),o.targetDuration||(u=10,o.segments&&o.segments.length&&(u=o.segments.reduce((function(e,t){return Math.max(e,t.duration)}),0)),t&&t("manifest has no targetDuration defaulting to "+u),o.targetDuration=u);var u=ho(o);return u.length&&!o.partTargetDuration&&(u=u.reduce((function(e,t){return Math.max(e,t.duration)}),0),t&&(t("manifest has no partTargetDuration defaulting to "+u),ku.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=u),o}({onwarn:function(e){return e=e.message,t.logger_("m3u8-parser warn for "+i+": "+e)},oninfo:function(e){return e=e.message,t.logger_("m3u8-parser info for "+i+": "+e)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},i.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url;e=e.id,this.request=null,this.state="HAVE_METADATA",(t=i||this.parseManifest_({url:n,manifestString:t})).lastRequest=Date.now(),Ao({playlist:t,uri:n,id:e}),n=Mo(this.master,t),this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,n?(this.master=n,this.media_=this.master.playlists[e]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Ro(this.media(),!!n)),this.trigger("loadedplaylist")},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.off()},i.stopRequest=function(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())},i.media=function(e,t){var i=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(window.clearTimeout(this.finalRenditionTimeout),t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state;if(t=!this.media_||e.id!==this.media_.id,(n=this.master.playlists[e.id])&&n.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(t&&(this.trigger("mediachanging"),"HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(Ro(e,!0)),t){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){if(e.lastRequest=Date.now(),e.resolvedUri=eo(i.handleManifestRedirects,e.resolvedUri,n),t)return i.playlistRequestError(i.request,e,r);i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}},i.pause=function(){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},i.load=function(e){var t=this;this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var i=this.media();e?(e=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout((function(){t.mediaUpdateTimeout=null,t.load()}),e)):this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},i.updateMediaUpdateTimeout_=function(e){var t=this;this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout((function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)}),e))},i.start=function(){var e=this;if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((function(){e.setupInitialPlaylist(e.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.src=eo(e.handleManifestRedirects,e.src,i),i=e.parseManifest_({manifestString:i.responseText,url:e.src}),e.setupInitialPlaylist(i)}}))},i.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri},i.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,Po(this.master,this.srcUri()),e.playlists.forEach((function(e){e.segments=Do(e),e.segments.forEach((function(t){Lo(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t,i,n,r=this.srcUri()||window.location.href;this.master=(i=Io(0,t=r),(n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]}).playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n),this.haveMetadata({playlistObject:e,url:r,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(q=qn.EventTarget),xu=qn.xhr,Au=qn.mergeOptions,Pu=(jt=Object.freeze({__proto__:null,createTransferableMessage:Ho,initSegmentId:qo,segmentKeyId:Vo,hexDump:Wo,tagDump:function(e){return Wo(e=e.bytes)},textRanges:function(e){for(var t,i,n="",r=0;r<e.length;r++)n+=(i=r,(t=e).start(i)+"-"+t.end(i)+" ");return n}}),zn=qn.EventTarget,qn.mergeOptions),Lu=function(e){function t(t,i,n,r){var a;if(void 0===n&&(n={}),(a=e.call(this)||this).masterPlaylistLoader_=r||ct(a),r||(a.isMaster_=!0),r=void 0!==(r=n.withCredentials)&&r,n=void 0!==(n=n.handleManifestRedirects)&&n,a.vhs_=i,a.withCredentials=r,a.handleManifestRedirects=n,!t)throw new Error("A non-empty playlist URL or object is required");return a.on("minimumUpdatePeriod",(function(){a.refreshXml_()})),a.on("mediaupdatetimeout",(function(){a.refreshMedia_(a.media().id)})),a.state="HAVE_NOTHING",a.loadedPlaylists_={},a.logger_=to("DashPlaylistLoader"),a.isMaster_?(a.masterPlaylistLoader_.srcUrl=t,a.masterPlaylistLoader_.sidxMapping_={}):a.childPlaylist_=t,a}dt(t,e);var i=t.prototype;return i.requestErrored_=function(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)},i.addSidxSegments_=function(e,t,i){var n,r,a=this,s=e.sidx&&ns(e.sidx);e.sidx&&s&&!this.masterPlaylistLoader_.sidxMapping_[s]?(n=eo(this.handleManifestRedirects,e.sidx.resolvedUri),r=function(n,r){if(!a.requestErrored_(n,r,t)){var o;n=a.masterPlaylistLoader_.sidxMapping_;try{o=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},n=12;0===i.version?(i.earliestPresentationTime=t.getUint32(n),i.firstOffset=t.getUint32(n+4),n+=8):(i.earliestPresentationTime=Vs(e.subarray(n)),i.firstOffset=Vs(e.subarray(n+8)),n+=16);var r=t.getUint16(n+=2);for(n+=2;0<r;n+=12,r--)i.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)});return i}(sr(r.response).subarray(8))}catch(n){return void a.requestErrored_(n,r,t)}return n[s]={sidxInfo:e.sidx,sidx:o},Za(e,o,e.sidx.resolvedUri),i(!0)}},this.request=function(e,t,i){function n(e,t,n,r){return t.abort(),o=!0,i(e,t,n,r)}function r(e,t){if(!o){if(e)return n(e,t,"",s);var i=t.responseText.substring(s&&s.byteLength||0,t.responseText.length);return s=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if((t=t.filter((function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e}))).length<=1)return sr(t[0]);var n=t.reduce((function(e,t,i){return e+(t.byteLength||t.length)}),0),r=new Uint8Array(n),a=0;return t.forEach((function(e){e=sr(e),r.set(e,a),a+=e.byteLength})),r}(s,or(i,!0)),a=a||ws(s),s.length<10||a&&s.length<a+2||"ts"===(i=Zs(s))&&s.length<188||!i&&s.length<376?function(e,t){if(4===e.readyState)return t()}(t,(function(){return n(e,t,"",s)})):n(null,t,i,s)}}var a,s=[],o=!1,u=t({uri:e,beforeSend:function(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function(t){return t.total,t.loaded,No(e,null,{statusCode:e.status},r)}))}},(function(e,t){return No(u,e,t,r)}));return u}(n,this.vhs_.xhr,(function(t,i,s,o){if(t)return r(t,i);if(!s||"mp4"!==s)return r({status:i.status,message:"Unsupported "+(s||"unknown")+" container type for sidx segment at URL: "+n,response:"",playlist:e,internal:!0,blacklistDuration:1/0,code:2},i);s=(u=e.sidx.byterange).offset;var u=u.length;if(o.length>=u+s)return r(t,{response:o.subarray(s,s+u),status:i.status,uri:i.uri});a.request=a.vhs_.xhr({uri:n,responseType:"arraybuffer",headers:Bo({byterange:e.sidx.byterange})},r)}))):this.mediaRequest_=window.setTimeout((function(){return i(!1)}),0)},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},i.hasPendingRequest=function(){return this.request||this.mediaRequest_},i.stopRequest=function(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())},i.media=function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=this.state;if("string"==typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})})))},i.haveMetadata=function(e){var t=e.startingState;e=e.playlist,this.state="HAVE_METADATA",this.loadedPlaylists_[e.id]=e,this.mediaRequest_=null,this.refreshMedia_(e.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},i.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(window.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},i.load=function(e){var t=this;window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var i=this.media();e?(e=i?i.targetDuration/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout((function(){return t.load()}),e)):this.started?i&&!i.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},i.start=function(){var e=this;this.started=!0,this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_(),e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=window.setTimeout((function(){return e.haveMaster_()}),0)},i.requestMaster_=function(e){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(!t.requestErrored_(i,n)){var r=n.responseText!==t.masterPlaylistLoader_.masterXml_;return t.masterPlaylistLoader_.masterXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now(),t.masterPlaylistLoader_.srcUrl=eo(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n),r?(t.handleMaster_(),void t.syncClientServerClock_((function(){return e(n,r)}))):e(n,r)}"HAVE_NOTHING"===t.state&&(t.started=!1)}))},i.syncClientServerClock_=function(e){var t=this,i=function(e){return function(e){if(!(e=gs(e,"UTCTiming")[0]))return null;var t=_s(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("UNSUPPORTED_UTC_TIMING_SCHEME")}return t}(Ss(e))}(this.masterPlaylistLoader_.masterXml_);return null===i?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.masterPlaylistLoader_.clientOffset_=i.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:Tu(this.masterPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n)return t.masterPlaylistLoader_.clientOffset_=t.masterLoaded_-Date.now(),e();r="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.masterPlaylistLoader_.clientOffset_=r-Date.now(),e()}})))},i.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},i.handleMaster_=function(){this.mediaRequest_=null;var e=this.masterPlaylistLoader_.master,t=(Po(i=function(e,t){void 0===t&&(t={});var i=function(e,t){var i=t=void 0===t?{}:t,n=void 0===(a=i.manifestUri)?"":a,r=(t=void 0===(r=i.NOW)?Date.now():r,void 0===(a=i.clientOffset)?0:a);if(!(i=gs(e,"Period")).length)throw new Error(Ds);var a=gs(e,"Location"),s=_s(e);e=bs([n],gs(e,"BaseURL")),s.type=s.type||"static",s.sourceDuration=s.mediaPresentationDuration||0,s.NOW=t,s.clientOffset=r,a.length&&(s.locations=a.map(ys));var o,u,l=[];return i.forEach((function(e,t){var i,n=_s(e),r=l[t-1];n.start=(t=(i={attributes:n,priorPeriodAttributes:r?r.attributes:null,mpdType:s.type}).attributes,r=i.priorPeriodAttributes,i=i.mpdType,"number"==typeof t.start?t.start:r&&"number"==typeof r.start&&"number"==typeof r.duration?r.start+r.duration:r||"static"!==i?null:0),l.push({node:e,attributes:n})})),{locations:s.locations,representationInfo:za(l.map((o=s,u=e,function(e,t){var i=bs(u,gs(e.node,"BaseURL")),n=Wa(o,{periodStart:e.attributes.start});"number"==typeof e.attributes.duration&&(n.periodDuration=e.attributes.duration);var r=gs(e.node,"AdaptationSet");return e=Ts(e.node),za(r.map(function(e,t,i){return function(n){var r=_s(n),a=bs(t,gs(n,"BaseURL")),s={role:_s(s=gs(n,"Role")[0])};r=Wa(e,r,s),(s="urn:scte:dash:cc:cea-608:2015"===(s=_s(s=gs(n,"Accessibility")[0])).schemeIdUri?("string"!=typeof s.value?[]:s.value.split(";")).map((function(e){var t,i,n;return/^CC\d=/.test(n=e)?(i=(t=e.split("="))[0],n=t[1]):/^CC\d$/.test(e)&&(i=e),{channel:i,language:n}})):"urn:scte:dash:cc:cea-708:2015"===s.schemeIdUri?("string"!=typeof s.value?[]:s.value.split(";")).map((function(e){var t,i,n={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};return/=/.test(e)?(t=(i=e.split("="))[0],i=void 0===(i=i[1])?"":i,n.channel=t,n.language=e,i.split(",").forEach((function(e){e=(t=e.split(":"))[0];var t=t[1];"lang"===e?n.language=t:"er"===e?n.easyReader=Number(t):"war"===e?n.aspectRatio=Number(t):"3D"===e&&(n["3D"]=Number(t))}))):n.language=e,n.channel&&(n.channel="SERVICE"+n.channel),n})):void 0)&&(r=Wa(r,{captionServices:s})),(s=gs(n,"Label")[0])&&s.childNodes.length&&(r=Wa(r,{label:c=s.childNodes[0].nodeValue.trim()}));var o,u,l,c=gs(n,"ContentProtection").reduce((function(e,t){var i=_s(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());var n=Hs[i.schemeIdUri];return n&&(e[n]={attributes:i},(t=gs(t,"cenc:pssh")[0])&&(t=ys(t),e[n].pssh=t&&Xn(t))),e}),{});return Object.keys(c).length&&(r=Wa(r,{contentProtection:c})),c=Ts(n),n=gs(n,"Representation"),c=Wa(i,c),za(n.map((o=r,u=a,l=c,function(e){var t=gs(e,"BaseURL"),i=(t=bs(u,t),Wa(o,_s(e))),n=Ts(e);return t.map((function(e){return{segmentInfo:Wa(l,n),attributes:Wa(i,{baseUrl:e})}}))})))}}(n,i,e)))})))}}(Ss(e),t);return function(e){var t=e.dashPlaylists,i=e.locations,n=void 0===(h=e.sidxMapping)?{}:h,r=e.previousManifest;if(!t.length)return{};var a,s,o=(p=t[0].attributes).sourceDuration,u=p.type,l=p.suggestedPresentationDelay,c=p.minimumUpdatePeriod,d=rs(t.filter(os)).map(ss),h=rs(t.filter(us)),p=(e=rs(t.filter(ls)),t.map((function(e){return e.attributes.captionServices})).filter(Boolean));return o={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:((t={AUDIO:{},VIDEO:{}})["CLOSED-CAPTIONS"]={},t.SUBTITLES={},t),uri:"",duration:o,playlists:function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e)e[i]=as(e[i],t);return e}(d,n)},0<=c&&(o.minimumUpdatePeriod=1e3*c),i&&(o.locations=i),"dynamic"===u&&(o.suggestedPresentationDelay=l),l=0===o.playlists.length,l=h.length?function(e,t,i){var n;return void 0===t&&(t={}),void 0===i&&(i=!1),e=e.reduce((function(e,r){var a=r.attributes.role&&r.attributes.role.value||"",s=r.attributes.lang||"",o=r.attributes.label||"main";e[o=s&&!r.attributes.label?r.attributes.lang+(a?" ("+a+")":""):o]||(e[o]={language:s,autoselect:!0,default:"main"===a,playlists:[],uri:""});var u,l,c,d,h,p,f=as((l=i,c=(u=r).attributes,f=u.segments,d=u.sidx,h=u.mediaSequence,p=u.discontinuitySequence,s=u.discontinuityStarts,f={attributes:((u={NAME:c.id,BANDWIDTH:c.bandwidth,CODECS:c.codecs})["PROGRAM-ID"]=1,u),uri:"",endList:"static"===c.type,timeline:c.periodStart,resolvedUri:"",targetDuration:c.duration,discontinuitySequence:p,discontinuityStarts:s,timelineStarts:c.timelineStarts,mediaSequence:h,segments:f},c.contentProtection&&(f.contentProtection=c.contentProtection),d&&(f.sidx=d),l&&(f.attributes.AUDIO="audio",f.attributes.SUBTITLES="subs"),f),t);return e[o].playlists.push(f),void 0===n&&"main"===a&&((n=r).default=!0),e}),{}),n||(e[Object.keys(e)[0]].default=!0),e}(h,n,l):null,n=e.length?(void 0===(a=n)&&(a={}),e.reduce((function(e,t){var i=t.attributes.lang||"text";return e[i]||(e[i]={language:i,default:!1,autoselect:!1,playlists:[],uri:""}),e[i].playlists.push(as(function(e){var t=e.attributes,i=e.segments,n=e.mediaSequence,r=e.discontinuityStarts,a=e.discontinuitySequence;return void 0===i&&(i=[{uri:t.baseUrl,timeline:t.periodStart,resolvedUri:t.baseUrl||"",duration:t.sourceDuration,number:0}],t.duration=t.sourceDuration),(e={NAME:t.id,BANDWIDTH:t.bandwidth})["PROGRAM-ID"]=1,t.codecs&&(e.CODECS=t.codecs),{attributes:e,uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,timelineStarts:t.timelineStarts,discontinuityStarts:r,discontinuitySequence:a,mediaSequence:n,segments:i}}(t),a)),e}),{})):null,d=(e=d.concat(cs(l),cs(n))).map((function(e){return e.timelineStarts})),o.timelineStarts=es(d),e=e,s=o.timelineStarts,e.forEach((function(e){e.mediaSequence=0,e.discontinuitySequence=Ka(s,(function(t){return t.timeline===e.timeline})),e.segments&&e.segments.forEach((function(e,t){e.number=t}))})),l&&(o.mediaGroups.AUDIO.audio=l),n&&(o.mediaGroups.SUBTITLES.subs=n),p.length&&(o.mediaGroups["CLOSED-CAPTIONS"].cc=p.reduce((function(e,t){return t&&t.forEach((function(t){var i=t.channel,n=t.language;e[n]={autoselect:!1,default:!1,instreamId:i,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e}),{})),r?function(e){var t,i,n=e.oldManifest,r=e.newManifest,a=n.playlists.concat(ts(n));return e=r.playlists.concat(ts(r)),r.timelineStarts=es([n.timelineStarts,r.timelineStarts]),a={oldPlaylists:a,newPlaylists:e,timelineStarts:r.timelineStarts},t=a.oldPlaylists,e=a.newPlaylists,i=a.timelineStarts,e.forEach((function(e){e.discontinuitySequence=Ka(i,(function(t){return t.timeline===e.timeline}));var n=function(e,t){for(var i=0;i<e.length;i++)if(e[i].attributes.NAME===t)return e[i];return null}(t,e.attributes.NAME);if(n&&!e.sidx){var r=e.segments[0],a=Ka(n.segments,(function(e){return Math.abs(e.presentationTime-r.presentationTime)<1/60}));if(-1===a)return is({playlist:e,mediaSequence:n.mediaSequence+n.segments.length}),e.segments[0].discontinuity=!0,e.discontinuityStarts.unshift(0),void((!n.segments.length&&e.timeline>n.timeline||n.segments.length&&e.timeline>n.segments[n.segments.length-1].timeline)&&e.discontinuitySequence--);n.segments[a].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,e.discontinuityStarts.unshift(0),e.discontinuitySequence--),is({playlist:e,mediaSequence:n.segments[a].number})}})),r}({oldManifest:r,newManifest:o}):o}({dashPlaylists:e=i.representationInfo.map(ms),locations:i.locations,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest})}((i={masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:e}).masterXml,{manifestUri:t=i.srcUrl,clientOffset:i.clientOffset,sidxMapping:i.sidxMapping,previousManifest:i=i.previousManifest}),t),i);e&&(t=function(e,t,i){for(var n=!0,r=Pu(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts}),a=0;a<t.playlists.length;a++){var s,o=t.playlists[a];o.sidx&&(s=ns(o.sidx),i&&i[s]&&i[s].sidx&&Za(o,i[s].sidx,o.sidx.resolvedUri)),(o=Mo(r,o,zo))&&(r=o,n=!1)}return xo(t,(function(e,t,i,a){var s;e.playlists&&e.playlists.length&&(s=e.playlists[0].id,(e=Mo(r,e.playlists[0],zo))&&((r=e).mediaGroups[t][i][a].playlists[0]=r.playlists[s],n=!1))})),(n=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&n)?null:r}(e,t,this.masterPlaylistLoader_.sidxMapping_)),this.masterPlaylistLoader_.master=t||e;var i=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0];return i&&i!==this.masterPlaylistLoader_.srcUrl&&(this.masterPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(t)},i.updateMinimumUpdatePeriodTimeout_=function(){var e=this.masterPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);var t=e.master&&e.master.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_("found invalid minimumUpdatePeriod of "+t+", not setting a timeout"):this.createMUPTimeout_(t)},i.createMUPTimeout_=function(e){var t=this.masterPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout((function(){t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)},i.refreshXml_=function(){var e=this;this.requestMaster_((function(t,i){var n,r;i&&(e.media_&&(e.media_=e.masterPlaylistLoader_.master.playlists[e.media_.id]),e.masterPlaylistLoader_.sidxMapping_=(i=e.masterPlaylistLoader_.master,n=e.masterPlaylistLoader_.sidxMapping_,r=Xo(i.playlists,n),xo(i,(function(e,t,i,a){e.playlists&&e.playlists.length&&(e=e.playlists,r=Pu(r,Xo(e,n)))})),r),e.addSidxSegments_(e.media(),e.state,(function(t){e.refreshMedia_(e.media().id)})))}))},i.refreshMedia_=function(e){var t=this;if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMaster_&&this.handleMaster_();var i=this.masterPlaylistLoader_.master.playlists,n=!this.media_||this.media_!==i[e];n?this.media_=i[e]:this.trigger("playlistunchanged"),this.mediaUpdateTimeout||function e(){t.media().endList||(t.mediaUpdateTimeout=window.setTimeout((function(){t.trigger("mediaupdatetimeout"),e()}),Ro(t.media(),Boolean(n))))}(),this.trigger("loadedplaylist")},t}(zn),Du={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},Ou=(C=function(e){return function(){var t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(i){var t=new BlobBuilder;return t.append(e),URL.createObjectURL(t.getBlob())}}(e),i=Ko(new Worker(t));i.objURL=t;var n=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),n.call(this)},i}})((R=function(e){return"var browserWorkerPolyFill = "+Ko.toString()+";\nbrowserWorkerPolyFill(self);\n"+e})((q=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)})((function(){(Ae=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){return!!e[t]&&(i=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(i,1),-1<i)},this.trigger=function(t){var i,n,r,a=e[t];if(a)if(2===arguments.length)for(n=a.length,i=0;i<n;++i)a[i].call(this,arguments[1]);else{for(r=[],i=arguments.length,i=1;i<arguments.length;++i)r.push(arguments[i]);for(n=a.length,i=0;i<n;++i)a[i].apply(this,r)}},this.dispose=function(){e={}}}}).prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},Ae.prototype.push=function(e){this.trigger("data",e)},Ae.prototype.flush=function(e){this.trigger("done",e)},Ae.prototype.partialFlush=function(e){this.trigger("partialdone",e)},Ae.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},Ae.prototype.reset=function(e){this.trigger("reset",e)};var e,t,i,n,r,a,s,o,u,l,c,d,h,p,f,m,g,y,v,_,b,T,S,w,E,k,C,I,x,A,P,L,D,O,M,R,N,U,B,F=Ae,j=Math.pow(2,32),H=(ct={getUint64:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.getBigUint64?(e=t.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(e):e:t.getUint32(0)*j+t.getUint32(4)},MAX_UINT32:j}).MAX_UINT32;function q(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i}function V(e){for(var t=[];e--;)t.push(0);return t}!function(){if(b={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(var e in b)b.hasOwnProperty(e)&&(b[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);T=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),w=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),S=new Uint8Array([0,0,0,1]),E=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]),k=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]),C={video:E,audio:k},A=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]),P=new Uint8Array([0,0,0,0,0,0,0,0]),L=P,D=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O=P,I=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),e=function(e){for(var t,i=[],n=0,r=1;r<arguments.length;r++)i.push(arguments[r]);for(r=i.length;r--;)n+=i[r].byteLength;for(t=new Uint8Array(n+8),new DataView(t.buffer,t.byteOffset,t.byteLength).setUint32(0,t.byteLength),t.set(e,4),r=0,n=8;r<i.length;r++)t.set(i[r],n),n+=i[r].byteLength;return t},t=function(){return e(b.dinf,e(b.dref,A))},i=function(t){return e(b.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,t.audioobjecttype<<3|t.samplingfrequencyindex>>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},p=function(t){return e(b.hdlr,C[t])},h=function(t){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(i[12]=t.samplerate>>>24&255,i[13]=t.samplerate>>>16&255,i[14]=t.samplerate>>>8&255,i[15]=255&t.samplerate),e(b.mdhd,i)},d=function(t){return e(b.mdia,h(t),p(t.type),a(t))},r=function(t){return e(b.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},a=function(i){return e(b.minf,"video"===i.type?e(b.vmhd,I):e(b.smhd,x),t(),m(i))},we=function(t,i){for(var n=[],a=i.length;a--;)n[a]=y(i[a]);return e.apply(null,[b.moof,r(t)].concat(n))},s=function(t){for(var i=t.length,n=[];i--;)n[i]=l(t[i]);return e.apply(null,[b.moov,u(4294967295)].concat(n).concat(o(t)))},o=function(t){for(var i=t.length,n=[];i--;)n[i]=v(t[i]);return e.apply(null,[b.mvex].concat(n))},u=function(t){return t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,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]),e(b.mvhd,t)},f=function(t){for(var i,n=t.samples||[],r=new Uint8Array(4+n.length),a=0;a<n.length;a++)i=n[a].flags,r[a+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return e(b.sdtp,r)},m=function(t){return e(b.stbl,g(t),e(b.stts,O),e(b.stsc,L),e(b.stsz,D),e(b.stco,P))},g=function(t){return e(b.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),("video"===t.type?M:R)(t))},M=function(t){for(var i,n,r=t.sps||[],a=t.pps||[],s=[],o=[],u=0;u<r.length;u++)s.push((65280&r[u].byteLength)>>>8),s.push(255&r[u].byteLength),s=s.concat(Array.prototype.slice.call(r[u]));for(u=0;u<a.length;u++)o.push((65280&a[u].byteLength)>>>8),o.push(255&a[u].byteLength),o=o.concat(Array.prototype.slice.call(a[u]));return i=[b.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.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]),e(b.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([r.length],s,[a.length],o))),e(b.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],t.sarRatio&&(n=t.sarRatio[0],t=t.sarRatio[1],i.push(e(b.pasp,new Uint8Array([(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t])))),e.apply(null,i)},R=function(t){return e(b.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),i(t))},c=function(t){return t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.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&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]),e(b.tkhd,t)},y=function(t){var i,n=e(b.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(t.baseMediaDecodeTime/H),a=Math.floor(t.baseMediaDecodeTime%H);return r=e(b.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,a>>>24&255,a>>>16&255,a>>>8&255,255&a])),"audio"===t.type?(i=_(t,92),e(b.traf,n,r,i)):(a=f(t),i=_(t,a.length+92),e(b.traf,n,r,i,a))},l=function(t){return t.duration=t.duration||4294967295,e(b.trak,c(t),d(t))},v=function(t){var i=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(i[i.length-1]=0),e(b.trex,i)},N=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},U=function(t,i){var n,r,a,s,o=t.samples||[];for(i+=20+16*o.length,i=N(o,i),(r=new Uint8Array(i.length+16*o.length)).set(i),n=i.length,s=0;s<o.length;s++)a=o[s],r[n++]=(4278190080&a.duration)>>>24,r[n++]=(16711680&a.duration)>>>16,r[n++]=(65280&a.duration)>>>8,r[n++]=255&a.duration,r[n++]=(4278190080&a.size)>>>24,r[n++]=(16711680&a.size)>>>16,r[n++]=(65280&a.size)>>>8,r[n++]=255&a.size,r[n++]=a.flags.isLeading<<2|a.flags.dependsOn,r[n++]=a.flags.isDependedOn<<6|a.flags.hasRedundancy<<4|a.flags.paddingValue<<1|a.flags.isNonSyncSample,r[n++]=61440&a.flags.degradationPriority,r[n++]=15&a.flags.degradationPriority,r[n++]=(4278190080&a.compositionTimeOffset)>>>24,r[n++]=(16711680&a.compositionTimeOffset)>>>16,r[n++]=(65280&a.compositionTimeOffset)>>>8,r[n++]=255&a.compositionTimeOffset;return e(b.trun,r)},B=function(t,i){var n,r,a,s,o=t.samples||[];for(i+=20+8*o.length,i=N(o,i),(n=new Uint8Array(i.length+8*o.length)).set(i),r=i.length,s=0;s<o.length;s++)a=o[s],n[r++]=(4278190080&a.duration)>>>24,n[r++]=(16711680&a.duration)>>>16,n[r++]=(65280&a.duration)>>>8,n[r++]=255&a.duration,n[r++]=(4278190080&a.size)>>>24,n[r++]=(16711680&a.size)>>>16,n[r++]=(65280&a.size)>>>8,n[r++]=255&a.size;return e(b.trun,n)},_=function(e,t){return("audio"===e.type?B:U)(e,t)},n=function(){return e(b.ftyp,T,S,T,w)};var W,G=function(t){return e(b.mdat,t)},z=we,X=function(e){var t=n(),i=s(e);return(e=new Uint8Array(t.byteLength+i.byteLength)).set(t),e.set(i,t.byteLength),e},K=[33,16,5,32,164,27],Y=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Q=function(e){return 9e4*e},$=function(e){return e/9e4},J=9e4,Z=Q,ee=$,te=function(e,t){return Q(function(e,t){return e/t}(e,t))},ie=function(e,t,i){return $(i?e:e-t)},ne=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},re=function(e,t){var i=e.minSegmentDts;return t||(i-=e.timelineStartInfo.dts),t=e.timelineStartInfo.baseMediaDecodeTime,t+=i,t=Math.max(0,t),"audio"===e.type&&(t*=e.samplerate/9e4,t=Math.floor(t)),t},ae=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},se=function(e){for(var t=e.byteLength,i=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return e;var r=t-i.length,a=new Uint8Array(r),s=0;for(n=0;n<r;s++,n++)s===i[0]&&(s++,i.shift()),a[n]=e[s];return a};function oe(e){return 32<=e&&e<=127||160<=e&&e<=255}function ue(e){this.windowNum=e,this.reset()}((Ee=function e(t){t=t||{},e.prototype.init.call(this),this.parse708captions_="boolean"!=typeof t.parse708captions||t.parse708captions,this.captionPackets_=[],this.ccStreams_=[new ge(0,0),new ge(0,1),new ge(1,0),new ge(1,1)],this.parse708captions_&&(this.cc708Stream_=new de({captionServices:t.captionServices})),this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))}).prototype=new F).push=function(e){var t,i;if("sei_rbsp"===e.nalUnitType&&(t=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}i.payload=void 0}t+=r,r=n=0}return i}(e.escapedRBSP)).payload&&4===t.payloadType&&(i=function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)}(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));i=function(e,t){var i,n,r,a,s=[];if(!(64&t[0]))return s;for(n=31&t[0],i=0;i<n;i++)a={type:3&t[2+(r=3*i)],pts:e},4&t[2+r]&&(a.ccData=t[3+r]<<8|t[4+r],s.push(a));return s}(e.pts,i),this.captionPackets_=this.captionPackets_.concat(i),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Ee.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},Ee.prototype.flushStream=function(e){this.captionPackets_.length&&(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)}),this),this.captionPackets_.length=0),this.flushCCStreams(e)},Ee.prototype.flush=function(){return this.flushStream("flush")},Ee.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Ee.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},Ee.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},Ee.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Ee.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Ee.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},Ee.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)};var le={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600};function ce(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new ue(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)}ue.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},ue.prototype.getText=function(){return this.rows.join("\n")},ue.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},ue.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),0<this.rows.length&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},ue.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},ue.prototype.addText=function(e){this.rows[this.rowIdx]+=e},ue.prototype.backspace=function(){var e;this.isEmpty()||(e=this.rows[this.rowIdx],this.rows[this.rowIdx]=e.substr(0,e.length-1))},ce.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new ue(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},ce.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},ce.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var de=function e(t){t=t||{},e.prototype.init.call(this);var i,n=this,r=t.captionServices||{},a={};Object.keys(r).forEach((function(e){i=r[e],/^SERVICE/.test(e)&&(a[e]=i.encoding)})),this.serviceEncodings=a,this.current708Packet=null,this.services={},this.push=function(e){(3===e.type||null===n.current708Packet)&&n.new708Packet(),n.add708Bytes(e)}};function he(e){return null===e?"":(e=fe[e]||e,String.fromCharCode(e))}function pe(){for(var e=[],t=15;t--;)e.push("");return e}de.prototype=new F,de.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},de.prototype.add708Bytes=function(e){var t=(i=e.ccData)>>>8,i=255&i;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(t),this.current708Packet.data.push(i)},de.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,n=null,r=0,a=i[r++];for(t.seq=a>>6,t.sizeCode=63&a;r<i.length;r++)e=31&(a=i[r++]),7==(n=a>>5)&&0<e&&(n=i[r++]),this.pushServiceBlock(n,r,e),0<e&&(r+=e-1)},de.prototype.pushServiceBlock=function(e,t,i){for(var n,r=t,a=this.current708Packet.data,s=(s=this.services[e])||this.initService(e,r);r<t+i&&r<a.length;r++)oe(n=a[r])?r=this.handleText(r,s):24===n?r=this.multiByteCharacter(r,s):16===n?r=this.extendedCommands(r,s):128<=n&&n<=135?r=this.setCurrentWindow(r,s):152<=n&&n<=159?r=this.defineWindow(r,s):136===n?r=this.clearWindows(r,s):140===n?r=this.deleteWindows(r,s):137===n?r=this.displayWindows(r,s):138===n?r=this.hideWindows(r,s):139===n?r=this.toggleWindows(r,s):151===n?r=this.setWindowAttributes(r,s):144===n?r=this.setPenAttributes(r,s):145===n?r=this.setPenColor(r,s):146===n?r=this.setPenLocation(r,s):143===n?s=this.reset(r,s):8===n?s.currentWindow.backspace():12===n?s.currentWindow.clearText():13===n?s.currentWindow.pendingNewLine=!0:14===n?s.currentWindow.clearText():141===n&&r++},de.prototype.extendedCommands=function(e,t){return oe(this.current708Packet.data[++e])?this.handleText(e,t,{isExtended:!0}):e},de.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},de.prototype.initService=function(e,t){var i,n="SERVICE"+e,r=this;return n in this.serviceEncodings&&(i=this.serviceEncodings[n]),this.services[e]=new ce(e,i,r),this.services[e].init(this.getPts(t),(function(t){r.flushDisplayed(t,r.services[e])})),this.services[e]},de.prototype.handleText=function(e,t,i){var n,r=i&&i.isExtended,a=i&&i.isMultiByte,s=r?4096:0,o=(u=this.current708Packet.data)[e],u=(i=u[e+1],t.currentWindow),l=t.textDecoder_&&!r?(a?(n=[o,i],e++):n=[o],t.textDecoder_.decode(new Uint8Array(n))):(l=le[o|=s]||o,4096&o&&o===l?"":String.fromCharCode(l));return u.pendingNewLine&&!u.isEmpty()&&u.newLine(this.getPts(e)),u.pendingNewLine=!1,u.addText(l),e},de.prototype.multiByteCharacter=function(e,t){var i=(n=this.current708Packet.data)[e+1],n=n[e+2];return oe(i)&&oe(n)?this.handleText(++e,t,{isMultiByte:!0}):e},de.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},de.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,n=i[e];return t.setCurrentWindow(7&n),t=t.currentWindow,n=i[++e],t.visible=(32&n)>>5,t.rowLock=(16&n)>>4,t.columnLock=(8&n)>>3,t.priority=7&n,n=i[++e],t.relativePositioning=(128&n)>>7,t.anchorVertical=127&n,n=i[++e],t.anchorHorizontal=n,n=i[++e],t.anchorPoint=(240&n)>>4,t.rowCount=15&n,n=i[++e],t.columnCount=63&n,n=i[++e],t.windowStyle=(56&n)>>3,t.penStyle=7&n,t.virtualRowCount=t.rowCount+1,e},de.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e];return t=t.currentWindow.winAttr,n=i[++e],t.fillOpacity=(192&n)>>6,t.fillRed=(48&n)>>4,t.fillGreen=(12&n)>>2,t.fillBlue=3&n,n=i[++e],t.borderType=(192&n)>>6,t.borderRed=(48&n)>>4,t.borderGreen=(12&n)>>2,t.borderBlue=3&n,n=i[++e],t.borderType+=(128&n)>>5,t.wordWrap=(64&n)>>6,t.printDirection=(48&n)>>4,t.scrollDirection=(12&n)>>2,t.justify=3&n,n=i[++e],t.effectSpeed=(240&n)>>4,t.effectDirection=(12&n)>>2,t.displayEffect=3&n,e},de.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},de.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},de.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=1);return e},de.prototype.hideWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=0);return e},de.prototype.toggleWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible^=1);return e},de.prototype.clearWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].clearText();return e},de.prototype.deleteWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].reset();return e},de.prototype.setPenAttributes=function(e,t){var i=this.current708Packet.data,n=i[e];return t=t.currentWindow.penAttr,n=i[++e],t.textTag=(240&n)>>4,t.offset=(12&n)>>2,t.penSize=3&n,n=i[++e],t.italics=(128&n)>>7,t.underline=(64&n)>>6,t.edgeType=(56&n)>>3,t.fontStyle=7&n,e},de.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e];return t=t.currentWindow.penColor,n=i[++e],t.fgOpacity=(192&n)>>6,t.fgRed=(48&n)>>4,t.fgGreen=(12&n)>>2,t.fgBlue=3&n,n=i[++e],t.bgOpacity=(192&n)>>6,t.bgRed=(48&n)>>4,t.bgGreen=(12&n)>>2,t.bgBlue=3&n,n=i[++e],t.edgeRed=(48&n)>>4,t.edgeGreen=(12&n)>>2,t.edgeBlue=3&n,e},de.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],r.row=15&n,n=i[++e],r.column=63&n,e},de.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var fe={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},me=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ge=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a=32639&e.ccData;a!==this.lastControlCode_?(4096==(61440&a)?this.lastControlCode_=a:a!==this.PADDING_&&(this.lastControlCode_=null),t=a>>>8,i=255&a,a===this.PADDING_||(a===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":a===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),r=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=r,this.startPts_=e.pts):a===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):a===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):a===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):a===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):a===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1):a===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=pe()):a===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=pe():a===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=pe()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(n=he((t=(3&t)<<8)|i),this[this.mode_](e.pts,n),this.column_++):this.isExtCharacter(t,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),n=he((t=(3&t)<<8)|i),this[this.mode_](e.pts,n),this.column_++):this.isMidRowCode(t,i)?(this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&i)&&this.addFormatting(e.pts,["i"]),1==(1&i)&&this.addFormatting(e.pts,["u"])):this.isOffsetControlCode(t,i)?this.column_+=3&i:this.isPAC(t,i)?(r=me.indexOf(7968&a),"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&(this.clearFormatting(e.pts),this.row_=r),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&a)&&(this.column_=4*((14&a)>>1)),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),n=he(t),n+=he(i),this[this.mode_](e.pts,n),this.column_+=n.length))):this.lastControlCode_=null}};function ye(e,t){var i=1;for(t<e&&(i=-1);4294967296<Math.abs(t-e);)e+=8589934592*i;return e}ge.prototype=new F,ge.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch(e){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},ge.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=pe(),this.nonDisplayed_=pe(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},ge.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},ge.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},ge.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},ge.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},ge.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},ge.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&64<=t&&t<=127},ge.prototype.isColorPAC=function(e){return 64<=e&&e<=79||96<=e&&e<=127},ge.prototype.isNormalChar=function(e){return 32<=e&&e<=127},ge.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=pe(),this.displayed_=pe()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},ge.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t),t=t.reduce((function(e,t){return e+"<"+t+">"}),""),this[this.mode_](e,t)},ge.prototype.clearFormatting=function(e){var t;this.formatting_.length&&(t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),""),this.formatting_=[],this[this.mode_](e,t))},ge.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];this.nonDisplayed_[this.row_]=i+=t},ge.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];this.displayed_[this.row_]=i+=t},ge.prototype.shiftRowsUp_=function(){for(var e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},ge.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];this.displayed_[this.row_]=i+=t};var ve={CaptionStream:Ee,Cea608Stream:ge,Cea708Stream:de},_e={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21};function be(e,t,i){for(var n="",r=t;r<i;r++)n+="%"+("00"+e[r].toString(16)).slice(-2);return n}function Te(e,t,i){return decodeURIComponent(be(e,t,i))}function Se(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}(Ae=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=ye(e.dts,n),e.pts=ye(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){i=n=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}).prototype=new F;var we=Ae,Ee=ye,ke={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Te(e.data,1,t),e.value=Te(e.data,t+1,e.data.length).replace(/\0*$/,"");break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Te(e.data,1,t),e.url=Te(e.data,t+1,e.data.length);break}},PRIV:function(e){for(var t,i=0;i<e.data.length;i++)if(0===e.data[i]){e.owner=(t=e.data,unescape(be(t,0,i)));break}e.privateData=e.data.subarray(i+1),e.data=e.privateData}},Ce=function(e){var t,i={descriptor:e&&e.descriptor},n=0,r=[],a=0;if(Ce.prototype.init.call(this),this.dispatchType=_e.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,i,s,o,u,l,c;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(a=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(r.push(e),a+=e.data.byteLength,1===r.length&&(n=Se(e.data.subarray(6,10)),n+=10),!(a<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},o=0;o<n;)t.data.set(r[0].data.subarray(0,n-o),o),o+=r[0].data.byteLength,a-=r[0].data.byteLength,r.shift();i=10,64&t.data[5]&&(i+=4,i+=Se(t.data.subarray(10,14)),n-=Se(t.data.subarray(16,20)));do{if((s=Se(t.data.subarray(i+4,i+8)))<1)return void this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping metadata parsing."})}while((c={id:String.fromCharCode(t.data[i],t.data[i+1],t.data[i+2],t.data[i+3]),data:t.data.subarray(i+10,i+s+10)}).key=c.id,ke[c.id]&&(ke[c.id](c),"com.apple.streaming.transportStreamTimestamp"===c.owner&&(l=(1&(u=c.data)[3])<<30|u[4]<<22|u[5]<<14|u[6]<<6|u[7]>>>2,l*=4,l+=3&u[7],c.timeStamp=l,void 0===t.pts&&void 0===t.dts&&(t.pts=c.timeStamp,t.dts=c.timeStamp),this.trigger("timestamp",c))),t.frames.push(c),i+=10,(i+=s)<n);this.trigger("data",t)}}};Ce.prototype=new F;var Ie,xe,Ae=Ce,Pe=(we=we,function(){var e=new Uint8Array(188),t=0;Pe.prototype.init.call(this),this.push=function(i){var n,r=0,a=188;for(t?((n=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),n.set(i,t),t=0):n=i;a<n.byteLength;)71!==n[r]||71!==n[a]?(r++,a++):(this.trigger("data",n.subarray(r,a)),r+=188,a+=188);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){188===t&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}});Pe.prototype=new F,(Ie=function(){var e,t,i,n;Ie.prototype.init.call(this),(n=this).packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,n){var r=0;n.payloadUnitStartIndicator&&(r+=e[r]+1),("pat"===n.type?t:i)(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var a=e[r],s=(31&e[r+1])<<8|e[r+2];a===_e.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=s:a===_e.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=s:a===_e.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][s]=a),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=n.programMapTable}},this.push=function(t){var i={},n=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],1<(48&t[3])>>>4&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=_e.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=_e.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new F,Ie.STREAM_TYPES={h264:27,adts:15},(xe=function(){function e(e,t,n){var r,a,s,o,u=new Uint8Array(e.size),l={type:t},c=0,d=0;if(e.data.length&&!(e.size<9)){for(l.trackId=e.data[0].pid,c=0;c<e.data.length;c++)r=e.data[c],u.set(r.data,d),d+=r.data.byteLength;s=l,o=(a=u)[0]<<16|a[1]<<8|a[2],s.data=new Uint8Array,1==o&&(s.packetLength=6+(a[4]<<8|a[5]),s.dataAlignmentIndicator=0!=(4&a[6]),192&(o=a[7])&&(s.pts=(14&a[9])<<27|(255&a[10])<<20|(254&a[11])<<12|(255&a[12])<<5|(254&a[13])>>>3,s.pts*=4,s.pts+=(6&a[13])>>>1,s.dts=s.pts,64&o&&(s.dts=(14&a[14])<<27|(255&a[15])<<20|(254&a[16])<<12|(255&a[17])<<5|(254&a[18])>>>3,s.dts*=4,s.dts+=(6&a[18])>>>1)),s.data=a.subarray(9+a[8])),t="video"===t||l.packetLength<=e.size,(n||t)&&(e.size=0,e.data.length=0),t&&i.trigger("data",l)}}var t,i=this,n=!1,r={data:[],size:0},a={data:[],size:0},s={data:[],size:0};xe.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,i;switch(o.streamType){case _e.H264_STREAM_TYPE:t=r,i="video";break;case _e.ADTS_STREAM_TYPE:t=a,i="audio";break;case _e.METADATA_STREAM_TYPE:t=s,i="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&e(t,i,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),n=!0,i.trigger("data",e)}})[o.type]()},this.reset=function(){r.size=0,r.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){e(r,"video"),e(a,"audio"),e(s,"timed-metadata")},this.flush=function(){var e;!n&&t&&(e={type:"metadata",tracks:[]},null!==t.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i.trigger("data",e)),n=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new F;var Le,De={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Pe,TransportParseStream:Ie,ElementaryStream:xe,TimestampRolloverStream:we,CaptionStream:ve.CaptionStream,Cea608Stream:ve.Cea608Stream,Cea708Stream:ve.Cea708Stream,MetadataStream:Ae};for(Le in _e)_e.hasOwnProperty(Le)&&(De[Le]=_e[Le]);var Oe=De,Me=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Re=function(e){var t,i=0;Re.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+e+" to "+t+" in frame "+i+" outside syncword"})},this.push=function(n){var r,a,s,o,u,l,c=0;if(e||(i=0),"audio"===n.type){for(t&&t.length?(s=t,(t=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),t.set(n.data,s.byteLength)):t=n.data;c+7<t.length;)if(255===t[c]&&240==(246&t[c+1])){if("number"==typeof l&&(this.skipWarn_(l,c),l=null),a=2*(1&~t[c+1]),r=(3&t[c+3])<<11|t[c+4]<<3|(224&t[c+5])>>5,u=9e4*(o=1024*(1+(3&t[c+6])))/Me[(60&t[c+2])>>>2],t.byteLength-c<r)break;this.trigger("data",{pts:n.pts+i*u,dts:n.dts+i*u,sampleCount:o,audioobjecttype:1+(t[c+2]>>>6&3),channelcount:(1&t[c+2])<<2|(192&t[c+3])>>>6,samplerate:Me[(60&t[c+2])>>>2],samplingfrequencyindex:(60&t[c+2])>>>2,samplesize:16,data:t.subarray(c+7+a,c+r)}),i++,c+=r}else"number"!=typeof l&&(l=c),c++;"number"==typeof l&&(this.skipWarn_(l,c),l=null),t=t.subarray(c)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}};Re.prototype=new F;var Ne,Ue,Be=Re,Fe=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;e<n||(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord()),i<<=e,n-=e},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return 0<(n-=r)?i<<=r:0<t&&this.loadWord(),0<(r=e-r)?a<<r|this.readBits(r):a},this.skipLeadingZeros=function(){for(var e=0;e<n;++e)if(0!=(i&2147483648>>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},je=function(){var e,t,i=0;je.prototype.init.call(this),this.push=function(n){for(var r,a=(t=t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),r):n.data).byteLength;i<a-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<a;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}for(i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));1!==t[++e]&&e<a;);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.reset=function(){t=null,i=0,this.trigger("reset")},this.flush=function(){t&&3<t.byteLength&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}};function He(e,t){var i=0<=(i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9])?i:0;return(16&e[t+5])>>4?i+20:i+10}function qe(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:qe(e,t+=He(e,t))}function Ve(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}je.prototype=new F,Ue={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Ne=function(){var e,t,i,n,r,a,s,o=new je;Ne.prototype.init.call(this),(e=this).push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(s){var o={trackId:t,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(e,t){for(var i=8,n=8,r=0;r<e;r++)i=0===(n=0!==n?(i+t.readExpGolomb()+256)%256:n)?i:n},r=function(e){for(var t=e.byteLength,i=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return e;var r=t-i.length,a=new Uint8Array(r),s=0;for(n=0;n<r;s++,n++)s===i[0]&&(s++,i.shift()),a[n]=e[s];return a},a=function(e){var t,i,n,r,a,o=0,u=0,l=0,c=0,d=[1,1],h=new Fe(e),p=h.readUnsignedByte(),f=h.readUnsignedByte(),m=h.readUnsignedByte();if(h.skipUnsignedExpGolomb(),Ue[p]&&(3===(i=h.readUnsignedExpGolomb())&&h.skipBits(1),h.skipUnsignedExpGolomb(),h.skipUnsignedExpGolomb(),h.skipBits(1),h.readBoolean()))for(r=3!==i?8:12,a=0;a<r;a++)h.readBoolean()&&s(a<6?16:64,h);if(h.skipUnsignedExpGolomb(),0===(n=h.readUnsignedExpGolomb()))h.readUnsignedExpGolomb();else if(1===n)for(h.skipBits(1),h.skipExpGolomb(),h.skipExpGolomb(),t=h.readUnsignedExpGolomb(),a=0;a<t;a++)h.skipExpGolomb();if(h.skipUnsignedExpGolomb(),h.skipBits(1),e=h.readUnsignedExpGolomb(),i=h.readUnsignedExpGolomb(),0===(n=h.readBits(1))&&h.skipBits(1),h.skipBits(1),h.readBoolean()&&(o=h.readUnsignedExpGolomb(),u=h.readUnsignedExpGolomb(),l=h.readUnsignedExpGolomb(),c=h.readUnsignedExpGolomb()),h.readBoolean()&&h.readBoolean()){switch(h.readUnsignedByte()){case 1:d=[1,1];break;case 2:d=[12,11];break;case 3:d=[10,11];break;case 4:d=[16,11];break;case 5:d=[40,33];break;case 6:d=[24,11];break;case 7:d=[20,11];break;case 8:d=[32,11];break;case 9:d=[80,33];break;case 10:d=[18,11];break;case 11:d=[15,11];break;case 12:d=[64,33];break;case 13:d=[160,99];break;case 14:d=[4,3];break;case 15:d=[3,2];break;case 16:d=[2,1];break;case 255:d=[h.readUnsignedByte()<<8|h.readUnsignedByte(),h.readUnsignedByte()<<8|h.readUnsignedByte()]}d&&(d[0],d[1])}return{profileIdc:p,levelIdc:m,profileCompatibility:f,width:16*(e+1)-2*o-2*u,height:(2-n)*(i+1)*16-2*l-2*c,sarRatio:d}}}).prototype=new F,Ae={H264Stream:Ne,NalByteStream:je};var We=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Ge={isLikelyAacData:function(e){var t=qe(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:He,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return We[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i=10;64&e[5]&&(i+=4,i+=Ve(e.subarray(10,14)));do{if((t=Ve(e.subarray(i+4,i+8)))<1)return null;if("PRIV"===String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]))for(var n=e.subarray(i+10,i+t+10),r=0;r<n.byteLength;r++)if(0===n[r]){if("com.apple.streaming.transportStreamTimestamp"!==unescape(function(e,t,i){for(var n="",r=0;r<i;r++)n+="%"+("00"+e[r].toString(16)).slice(-2);return n}(n,0,r)))break;var a=n.subarray(r+1),s=(1&a[3])<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2;return(s*=4)+(3&a[7])}}while(i+=10,(i+=t)<e.byteLength);return null}},ze=function(){var e=new Uint8Array,t=0;ze.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var n,r,a=0,s=0;for(e.length?(r=e.length,(e=new Uint8Array(i.byteLength+r)).set(e.subarray(0,r)),e.set(i,r)):e=i;3<=e.length-s;)if(e[s]!=="I".charCodeAt(0)||e[s+1]!=="D".charCodeAt(0)||e[s+2]!=="3".charCodeAt(0))if(255!=(255&e[s])||240!=(240&e[s+1]))s++;else{if(e.length-s<7)break;if(s+(a=Ge.parseAdtsSize(e,s))>e.length)break;n={type:"audio",data:e.subarray(s,s+a),pts:t,dts:t},this.trigger("data",n),s+=a}else{if(e.length-s<10)break;if(s+(a=Ge.parseId3TagSize(e,s))>e.length)break;n={type:"timed-metadata",data:e.subarray(s,s+a)},this.trigger("data",n),s+=a}i=e.length-s,e=0<i?e.subarray(s):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}};function Xe(e,t){t.stream=e,this.trigger("log",t)}function Ke(e,t){for(var i=Object.keys(t),n=0;n<i.length;n++){var r=i[n];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",Xe.bind(e,r))}}function Ye(e,t){var i;if(e.length===t.length){for(i=0;i<e.length;i++)if(e[i]!==t[i])return;return 1}}function Qe(e,t,i,n,r,a){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(n-t),pts:e+(r-i)},prependedContentDuration:a,baseMediaDecodeTime:e}}ze.prototype=new F;var $e,Je,Ze,et=ze,tt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],it=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],nt=Ae.H264Stream,rt=Ge.isLikelyAacData,at=function(e,t){var i=[],n=0,r=0,a=1/0,s=(t=t||{}).firstSequenceNumber||0;at.prototype.init.call(this),this.push=function(t){ae(e,t),e&&tt.forEach((function(i){e[i]=t[i]})),i.push(t)},this.setEarliestDts=function(e){n=e},this.setVideoBaseMediaDecodeTime=function(e){a=e},this.setAudioAppendStart=function(e){r=e},this.flush=function(){var o,u,l,c,d;0!==i.length&&(o=function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))}(i,e,n),e.baseMediaDecodeTime=re(e,t.keepOriginalTimestamps),d=function(e,t,i,n){var r,a,s,o,u,l,c=0,d=0;if(t.length&&(r=te(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(J/(e.samplerate/1024)),i&&n&&(s=r-Math.max(i,n),d=(c=Math.floor(s/a))*a),!(c<1||J/2<d))){for(o=(o=function(){var e,t;return W||(e={96e3:[K,[227,64],V(154),[56]],88200:[K,[231],V(170),[56]],64e3:[K,[248,192],V(240),[56]],48e3:[K,[255,192],V(268),[55,148,128],V(54),[112]],44100:[K,[255,192],V(268),[55,163,128],V(84),[112]],32e3:[K,[255,192],V(268),[55,234],V(226),[112]],24e3:[K,[255,192],V(268),[55,255,128],V(268),[111,112],V(126),[224]],16e3:[K,[255,192],V(268),[55,255,128],V(268),[111,255],V(269),[223,108],V(195),[1,192]],12e3:[Y,V(268),[3,127,248],V(268),[6,255,240],V(268),[13,255,224],V(268),[27,253,128],V(259),[56]],11025:[Y,V(268),[3,127,248],V(268),[6,255,240],V(268),[13,255,224],V(268),[27,255,192],V(268),[55,175,128],V(108),[112]],8e3:[Y,V(268),[3,121,16],V(47),[7]]},t=e,W=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})),W}()[e.samplerate])||t[0].data,u=0;u<c;u++)l=t[0],t.splice(0,0,{data:o,dts:l.dts-a,pts:l.pts-a});return e.baseMediaDecodeTime-=Math.floor(function(e,t){return function(e,t){return e*t}($(e),t)}(d,e.samplerate)),d}}(e,o,r,a),e.samples=function(e){for(var t,i=[],n=0;n<e.length;n++)t=e[n],i.push({size:t.data.byteLength,duration:1024});return i}(o),u=G(function(e){for(var t,i=0,n=new Uint8Array(function(e){for(var t=0,i=0;i<e.length;i++)t+=e[i].data.byteLength;return t}(e)),r=0;r<e.length;r++)t=e[r],n.set(t.data,i),i+=t.data.byteLength;return n}(o)),i=[],c=z(s,[e]),l=new Uint8Array(c.byteLength+u.byteLength),s++,l.set(c),l.set(u,c.byteLength),ne(e),c=Math.ceil(9216e4/e.samplerate),o.length&&(c=o.length*c,this.trigger("segmentTimingInfo",Qe(te(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+c,o[0].pts+c,d||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+c})),this.trigger("data",{track:e,boxes:l})),this.trigger("done","AudioSegmentStream")},this.reset=function(){ne(e),i=[],this.trigger("reset")}};function st(e){var t=31&e[1];return(t<<=8)|e[2]}function ot(e){return!!(64&e[1])}function ut(e){var t=0;return 1<(48&e[3])>>>4&&(t+=e[4]+1),t}function lt(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}}at.prototype=new F,($e=function(e,t){var i,n,r=[],a=[],s=(t=t||{}).firstSequenceNumber||0;$e.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){ae(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],it.forEach((function(t){e[t]=i[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.data,e.pps=[t.data]),r.push(t)},this.flush=function(){for(var i,n,o,u=0;r.length&&"access_unit_delimiter_rbsp"!==r[0].nalUnitType;)r.shift();if(0===r.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(i=function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,t=n.byteLength=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n),r}(r),(n=function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r}(i))[0][0].keyFrame||((o=this.getGopForFusion_(r[0],e))?(u=o.duration,n.unshift(o),n.byteLength+=o.byteLength,n.nalCount+=o.nalCount,n.pts=o.pts,n.dts=o.dts,n.duration+=o.duration):n=function(e){var t;return!e[0][0].keyFrame&&1<e.length&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e}(n)),a.length){var l=t.alignGopsAtEnd?this.alignGopsAtEnd_(n):this.alignGopsAtStart_(n);if(!l)return this.gopCache_.unshift({gop:n.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),r=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");ne(e),n=l}ae(e,n),e.samples=function(e,t){for(var i,n,r,a=0,s=[],o=0;o<e.length;o++)for(n=e[o],i=0;i<n.length;i++)a+=(r=q(r=n[i],a)).size,s.push(r);return s}(n),i=G(function(e){for(var t,i,n,r,a,s=0,o=e.byteLength,u=e.nalCount,l=new Uint8Array(o+4*u),c=new DataView(l.buffer),d=0;d<e.length;d++)for(n=e[d],t=0;t<n.length;t++)for(r=n[t],i=0;i<r.length;i++)a=r[i],c.setUint32(s,a.data.byteLength),l.set(a.data,s+=4),s+=a.data.byteLength;return l}(n)),e.baseMediaDecodeTime=re(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",n.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),o=n[0],l=n[n.length-1],this.trigger("segmentTimingInfo",Qe(e.baseMediaDecodeTime,o.dts,o.pts,l.dts+l.duration,l.pts+l.duration,u)),this.trigger("timingInfo",{start:n[0].pts,end:n[n.length-1].pts+n[n.length-1].duration}),this.gopCache_.unshift({gop:n.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),r=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),u=z(s,[e]),n=new Uint8Array(u.byteLength+i.byteLength),s++,n.set(u),n.set(i,u.byteLength),this.trigger("data",{track:e,boxes:n}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),r=[],this.gopCache_.length=0,a.length=0,this.trigger("reset")},this.resetStream_=function(){ne(e),n=i=void 0},this.getGopForFusion_=function(t){for(var i,n,r,a=1/0,s=0;s<this.gopCache_.length;s++)n=(r=this.gopCache_[s]).gop,e.pps&&Ye(e.pps[0],r.pps[0])&&e.sps&&Ye(e.sps[0],r.sps[0])&&(n.dts<e.timelineStartInfo.dts||-1e4<=(n=t.dts-n.dts-n.duration)&&n<=45e3&&(!i||n<a)&&(i=r,a=n));return i?i.gop:null},this.alignGopsAtStart_=function(e){for(var t,i,n,r,s=e.byteLength,o=e.nalCount,u=e.duration,l=t=0;l<a.length&&t<e.length&&(i=a[l],n=e[t],i.pts!==n.pts);)n.pts>i.pts?l++:(t++,s-=n.byteLength,o-=n.nalCount,u-=n.duration);return 0===t?e:t===e.length?null:((r=e.slice(t)).byteLength=s,r.duration=u,r.nalCount=o,r.pts=r[0].pts,r.dts=r[0].dts,r)},this.alignGopsAtEnd_=function(e){for(var t,i,n=a.length-1,r=e.length-1,s=null,o=!1;0<=n&&0<=r;){if(t=a[n],i=e[r],t.pts===i.pts){o=!0;break}t.pts>i.pts?n--:(n===a.length-1&&(s=r),r--)}if(!o&&null===s)return null;if(0===(l=o?r:s))return e;var u=e.slice(l),l=u.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return u.byteLength=l.byteLength,u.duration=l.duration,u.nalCount=l.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){a=e}}).prototype=new F,(Ze=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ze.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new F,Ze.prototype.flush=function(e){var t,i,n,r=0,a={captions:[],captionStreams:{},metadata:[],info:{}},s=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(s=this.videoTrack.timelineStartInfo.pts,it.forEach((function(e){a.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(s=this.audioTrack.timelineStartInfo.pts,tt.forEach((function(e){a.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?a.type=this.pendingTracks[0].type:a.type="combined",this.emittedTracks+=this.pendingTracks.length,e=X(this.pendingTracks),a.initSegment=new Uint8Array(e.byteLength),a.initSegment.set(e),a.data=new Uint8Array(this.pendingBytes),n=0;n<this.pendingBoxes.length;n++)a.data.set(this.pendingBoxes[n],r),r+=this.pendingBoxes[n].byteLength;for(n=0;n<this.pendingCaptions.length;n++)(t=this.pendingCaptions[n]).startTime=ie(t.startPts,s,this.keepOriginalTimestamps),t.endTime=ie(t.endPts,s,this.keepOriginalTimestamps),a.captionStreams[t.stream]=!0,a.captions.push(t);for(n=0;n<this.pendingMetadata.length;n++)(i=this.pendingMetadata[n]).cueTime=ie(i.pts,s,this.keepOriginalTimestamps),a.metadata.push(i);for(a.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",a),n=0;n<a.captions.length;n++)t=a.captions[n],this.trigger("caption",t);for(n=0;n<a.metadata.length;n++)i=a.metadata[n],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ze.prototype.setRemux=function(e){this.remuxTracks=e},(Je=function(e){var t,i,n=this,r=!0;Je.prototype.init.call(this),this.baseMediaDecodeTime=(e=e||{}).baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};(this.transmuxPipeline_=r).type="aac",r.metadataStream=new Oe.MetadataStream,r.aacStream=new et,r.audioTimestampRolloverStream=new Oe.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Oe.TimestampRolloverStream("timed-metadata"),r.adtsStream=new Be,r.coalesceStream=new Ze(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(a){"timed-metadata"!==a.type&&"audio"!==a.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new at(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Ke(this,r)},this.setupTsPipeline=function(){var r={};(this.transmuxPipeline_=r).type="ts",r.metadataStream=new Oe.MetadataStream,r.packetStream=new Oe.TransportPacketStream,r.parseStream=new Oe.TransportParseStream,r.elementaryStream=new Oe.ElementaryStream,r.timestampRolloverStream=new Oe.TimestampRolloverStream,r.adtsStream=new Be,r.h264Stream=new nt,r.captionStream=new Oe.CaptionStream(e),r.coalesceStream=new Ze(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new $e(t,e),r.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new at(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Ke(this,r)},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,ne(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,ne(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){var t;r&&((t=rt(e))&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1),this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new F;var ct,dt={Transmuxer:Je,VideoSegmentStream:$e,AudioSegmentStream:at,AUDIO_PROPERTIES:tt,VIDEO_PROPERTIES:it,generateSegmentTimingInfo:Qe},ht=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])},pt=Ae=function(e){return e>>>0},ft=function e(t,i){var n,r,a,s=[];if(!i.length)return null;for(n=0;n<t.byteLength;)r=pt(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),a=ht(t.subarray(n+4,n+8)),r=1<r?n+r:t.byteLength,a===i[0]&&(1===i.length?s.push(t.subarray(n+8,r)):(a=e(t.subarray(n+8,r),i.slice(1))).length&&(s=s.concat(a))),n=r;return s},mt=Ae,gt=ct.getUint64,yt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},vt=(F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},F="undefined"!=typeof window?window:void 0!==F?F:"undefined"!=typeof self?self:{}),_t=se,bt=ve.CaptionStream,Tt=function(){var e,t,i,n,r,a,s=!1;this.isInitialized=function(){return s},this.init=function(t){e=new bt,s=!0,a=!!t&&t.isPartial,e.on("data",(function(e){e.startTime=e.startPts/n,e.endTime=e.endPts/n,r.captions.push(e),r.captionStreams[e.stream]=!0})),e.on("log",(function(e){r.logs.push(e)}))},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length||i===e[0]&&n===t[i])},this.parse=function(e,a,s){if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))i=a[0],n=s[i];else if(null===i||!n)return t.push(e),null;for(;0<t.length;){var o=t.shift();this.parse(o,a,s)}return(e=function(e,t,i){return null===t?null:{seiNals:(t=function(e,t){var i=ft(e,["moof","traf"]),n=(e=ft(e,["mdat"]),{}),r=[];return e.forEach((function(e,t){t=i[t],r.push({mdat:e,traf:t})})),r.forEach((function(e){var i,r,a,s,o,u=e.mdat,l=e.traf,c=ft(l,["tfhd"]),d=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4)},n=1&i.flags[2],r=2&i.flags[2],a=8&i.flags[2],s=16&i.flags[2],o=32&i.flags[2],u=65536&i.flags[0],l=131072&i.flags[0];return e=8,n&&(e+=4,i.baseDataOffset=t.getUint32(12),e+=4),r&&(i.sampleDescriptionIndex=t.getUint32(e),e+=4),a&&(i.defaultSampleDuration=t.getUint32(e),e+=4),s&&(i.defaultSampleSize=t.getUint32(e),e+=4),o&&(i.defaultSampleFlags=t.getUint32(e)),u&&(i.durationIsEmpty=!0),!n&&l&&(i.baseDataOffsetIsMoof=!0),i}(c[0]);e=d.trackId,c=0<(c=ft(l,["tfdt"])).length?function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=gt(e.subarray(4)):t.baseMediaDecodeTime=mt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t}(c[0]).baseMediaDecodeTime:0,l=ft(l,["trun"]),t===e&&0<l.length&&(l=l,i=c,r=(d=d).defaultSampleDuration||0,a=d.defaultSampleSize||0,s=d.trackId,o=[],l.forEach((function(e){(e=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],c=n.getUint32(4),d=8;for(r&&(i.dataOffset=n.getInt32(d),d+=4),a&&c&&(t={flags:yt(e.subarray(d,d+4))},d+=4,s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(d):t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t),c--);c--;)t={},s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),u&&(t.flags=yt(e.subarray(d,d+4)),d+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(d):t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t);return i}(e).samples).forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=i,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof i?(e.pts=i+vt.BigInt(e.compositionTimeOffset),i+=vt.BigInt(e.duration)):(e.pts=i+e.compositionTimeOffset,i+=e.duration)})),o=o.concat(e)})),u=function(e,t,i){for(var n,r,a=new DataView(e.buffer,e.byteOffset,e.byteLength),s={logs:[],seiNals:[]},o=0;o+4<e.length;o+=n)if(n=a.getUint32(o),o+=4,!(n<=0))switch(31&e[o]){case 6:var u=e.subarray(o+1,o+1+n),l=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=t[n];if(i<r.size)return r;i-=r.size}return null}(o,t);if(u={nalUnitType:"sei_rbsp",size:n,data:u,escapedRBSP:_t(u),trackId:i},l)u.pts=l.pts,u.dts=l.dts,r=l;else{if(!r){s.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+o+" for trackId "+i+". See mux.js#223."});break}u.pts=r.pts,u.dts=r.dts}s.seiNals.push(u)}return s}(u,o,e),n[e]||(n[e]={seiNals:[],logs:[]}),n[e].seiNals=n[e].seiNals.concat(u.seiNals),n[e].logs=n[e].logs.concat(u.logs))})),n}(e,t)[t]||{}).seiNals,logs:t.logs,timescale:i}}(e,i,n))&&e.logs&&(r.logs=r.logs.concat(e.logs)),null!==e&&e.seiNals?(this.pushNals(e.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],n=i=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},St=Ae,wt=function(e){return("00"+e.toString(16)).slice(-2)},Et=ct.getUint64,kt=(F=function(e){return ft(e,["moov","trak"]).reduce((function(e,t){var i,n,r=ft(t,["tkhd"])[0];return r?(i=r[0],r=St(r[n=0===i?12:20]<<24|r[1+n]<<16|r[2+n]<<8|r[3+n]),(t=ft(t,["mdia","mdhd"])[0])?(i=t[0],e[r]=St(t[n=0===i?12:20]<<24|t[1+n]<<16|t[2+n]<<8|t[3+n]),e):null):null}),{})},se=function(e,t){return"bigint"==typeof(t=ft(t,["moof","traf"]).reduce((function(t,i){var n,r=ft(i,["tfhd"])[0],a=St(r[4]<<24|r[5]<<16|r[6]<<8|r[7]);return r=e[a]||9e4,a=ft(i,["tfdt"])[0],i=new DataView(a.buffer,a.byteOffset,a.byteLength),"bigint"==typeof(i=1===a[0]?Et(a.subarray(4,12)):i.getUint32(4))?n=i/vt.BigInt(r):"number"!=typeof i||isNaN(i)||(n=i/r),(n=n<Number.MAX_SAFE_INTEGER?Number(n):n)<t?n:t}),1/0))||isFinite(t)?t:0},Ae=function(e){e=ft(e,["moov","trak"]);var t=[];return e.forEach((function(e){var i=ft(e,["mdia","hdlr"]),n=ft(e,["tkhd"]);i.forEach((function(e,i){e=ht(e.subarray(8,12)),i=n[i],"vide"===e&&(i=0===(i=new DataView(i.buffer,i.byteOffset,i.byteLength)).getUint8(0)?i.getUint32(12):i.getUint32(20),t.push(i))}))})),t},se),Ct=ct=function(e){e=ft(e,["moov","trak"]);var t=[];return e.forEach((function(e){var i={},n=ft(e,["tkhd"])[0];n&&(n=(r=new DataView(n.buffer,n.byteOffset,n.byteLength)).getUint8(0),i.id=0===n?r.getUint32(12):r.getUint32(20));var r=ft(e,["mdia","hdlr"])[0];r&&(s=ht(r.subarray(8,12)),i.type="vide"===s?"video":"soun"===s?"audio":s);var a,s=ft(e,["mdia","minf","stbl","stsd"])[0];s&&(s=s.subarray(8),i.codec=ht(s.subarray(4,8)),(s=ft(s,[i.codec])[0])&&(/^[asm]vc[1-9]$/i.test(i.codec)?(a=s.subarray(78),"avcC"===ht(a.subarray(4,8))&&11<a.length?(i.codec+=".",i.codec+=wt(a[9]),i.codec+=wt(a[10]),i.codec+=wt(a[11])):i.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(i.codec)?(a=s.subarray(28),"esds"===ht(a.subarray(4,8))&&20<a.length&&0!==a[19]?(i.codec+="."+wt(a[19]),i.codec+="."+wt(a[20]>>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2"):i.codec=i.codec.toLowerCase())),(e=ft(e,["mdia","mdhd"])[0])&&(i.timescale=function(e){var t=0===e[0]?12:20;return St(e[t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])}(e)),t.push(i)})),t},It=Ee,xt={};function At(e,t,i){for(var n,r,a,s,o=0,u=188,l=!1;u<=e.byteLength;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o++,u++;else{if(n=e.subarray(o,u),"pes"===xt.ts.parseType(n,t.pid)&&(r=xt.ts.parsePesType(n,t.table),a=xt.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=xt.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)),l)break;o+=188,u+=188}for(o=(u=e.byteLength)-188,l=!1;0<=o;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o--,u--;else{if(n=e.subarray(o,u),"pes"===xt.ts.parseType(n,t.pid)&&(r=xt.ts.parsePesType(n,t.table),a=xt.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=xt.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)),l)break;o-=188,u-=188}}function Pt(e){var t,i={pid:null,table:null},n={};for(t in function(e,t){for(var i,n=0,r=188;r<e.byteLength;)if(71!==e[n]||71!==e[r])n++,r++;else{switch(i=e.subarray(n,r),xt.ts.parseType(i,t.pid)){case"pat":t.pid=xt.ts.parsePat(i);break;case"pmt":var a=xt.ts.parsePmt(i);t.table=t.table||{},Object.keys(a).forEach((function(e){t.table[e]=a[e]}))}n+=188,r+=188}}(e,i),i.table)if(i.table.hasOwnProperty(t))switch(i.table[t]){case _e.H264_STREAM_TYPE:n.video=[],function(e,t,i){for(var n,r,a,s,o,u,l,c,d=0,h=188,p=!1,f={data:[],size:0};h<e.byteLength;)if(71!==e[d]||71!==e[h])d++,h++;else{if(n=e.subarray(d,h),"pes"===xt.ts.parseType(n,t.pid)&&(r=xt.ts.parsePesType(n,t.table),a=xt.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(a&&!p&&(s=xt.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),p=!0),!i.firstKeyFrame))){if(a&&0!==f.size){for(o=new Uint8Array(f.size),u=0;f.data.length;)l=f.data.shift(),o.set(l,u),u+=l.byteLength;!xt.ts.videoPacketContainsKeyFrame(o)||(c=xt.ts.parsePesTime(o))&&(i.firstKeyFrame=c,i.firstKeyFrame.type="video"),f.size=0}f.data.push(n),f.size+=n.byteLength}if(p&&i.firstKeyFrame)break;d+=188,h+=188}for(d=(h=e.byteLength)-188,p=!1;0<=d;)if(71!==e[d]||71!==e[h])d--,h--;else{if(n=e.subarray(d,h),"pes"===xt.ts.parseType(n,t.pid)&&(r=xt.ts.parsePesType(n,t.table),a=xt.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=xt.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),p=!0)),p)break;d-=188,h-=188}}(e,i,n),0===n.video.length&&delete n.video;break;case _e.ADTS_STREAM_TYPE:n.audio=[],At(e,i,n),0===n.audio.length&&delete n.audio}return n}xt.ts={parseType:function(e,t){return 0===(e=st(e))?"pat":e===t?"pmt":t?"pes":null},parsePat:function(e){var t=ot(e),i=4+ut(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=ot(e),n=4+ut(e);if(i&&(n+=e[n]+1),1&e[n+5]){for(var r=3+((15&e[n+1])<<8|e[n+2])-4,a=12+((15&e[n+10])<<8|e[n+11]);a<r;){var s=n+a;t[(31&e[s+1])<<8|e[s+2]]=e[s],a+=5+((15&e[s+3])<<8|e[s+4])}return t}},parsePayloadUnitStartIndicator:ot,parsePesType:function(e,t){switch(t[st(e)]){case _e.H264_STREAM_TYPE:return"video";case _e.ADTS_STREAM_TYPE:return"audio";case _e.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!ot(e))return null;var t=4+ut(e);if(t>=e.byteLength)return null;var i=null,n=e[t+7];return 192&n&&((i={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&n&&(i.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,i.dts*=4,i.dts+=(6&e[t+18])>>>1)),i},videoPacketContainsKeyFrame:function(e){for(var t=4+ut(e),i=e.subarray(t),n=0,r=0,a=!1;r<i.byteLength-3;r++)if(1===i[r+2]){n=r+5;break}for(;n<i.byteLength;)switch(i[n]){case 0:if(0!==i[n-1]){n+=2;break}if(0!==i[n-2]){n++;break}for(r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===lt(31&i[r+3])&&(a=!0);1!==i[++n]&&n<i.length;);r=n-2,n+=3;break;case 1:if(0!==i[n-1]||0!==i[n-2]){n+=3;break}"slice_layer_without_partitioning_rbsp_idr"===lt(31&i[r+3])&&(a=!0),r=n-2,n+=3;break;default:n+=3}return i=i.subarray(r),n-=r,r=0,!!(i&&3<i.byteLength&&"slice_layer_without_partitioning_rbsp_idr"===lt(31&i[r+3]))||a}},xt.aac=Ge;var Lt=J,Dt=function(e,t){var i,n,r=(xt.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,a=null,s=0,o=0;3<=e.length-o;){switch(xt.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=xt.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=xt.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=xt.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=xt.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var u=Lt/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*u,pts:a+1024*n*u}]}}:Pt)(e);return r&&(r.audio||r.video)?(e=t,(t=r).audio&&t.audio.length&&(void 0!==(i=e)&&!isNaN(i)||(i=t.audio[0].dts),t.audio.forEach((function(e){e.dts=It(e.dts,i),e.pts=It(e.pts,i),e.dtsTime=e.dts/Lt,e.ptsTime=e.pts/Lt}))),t.video&&t.video.length&&(void 0!==(n=e)&&!isNaN(n)||(n=t.video[0].dts),t.video.forEach((function(e){e.dts=It(e.dts,n),e.pts=It(e.pts,n),e.dtsTime=e.dts/Lt,e.ptsTime=e.pts/Lt})),t.firstKeyFrame&&((t=t.firstKeyFrame).dts=It(t.dts,n),t.pts=It(t.pts,n),t.dtsTime=t.dts/Lt,t.ptsTime=t.pts/Lt)),r):null},Ot=function(){function e(e,t){this.options=t||{},this.self=e,this.init()}var t=e.prototype;return t.init=function(){var e,t;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new dt.Transmuxer(this.options),e=this.self,(t=this.transmuxer).on("data",(function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength},i=t.data,t.data=i.buffer,e.postMessage({action:"data",segment:t,byteOffset:i.byteOffset,byteLength:i.byteLength},[t.data])})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){var i={start:{decode:ee(t.start.dts),presentation:ee(t.start.pts)},end:{decode:ee(t.end.dts),presentation:ee(t.end.pts)},baseMediaDecodeTime:ee(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=ee(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})})),t.on("audioSegmentTimingInfo",(function(t){var i={start:{decode:ee(t.start.dts),presentation:ee(t.start.pts)},end:{decode:ee(t.end.dts),presentation:ee(t.end.pts)},baseMediaDecodeTime:ee(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=ee(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(t){e.postMessage({action:"caption",caption:t})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:ee(t.start),end:ee(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:ee(t.start),end:ee(t.end)}})})),t.on("log",(function(t){e.postMessage({action:"log",log:t})}))},t.pushMp4Captions=function(e){this.captionParser||(this.captionParser=new Tt,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);e=this.captionParser.parse(t,e.trackIds,e.timescales),this.self.postMessage({action:"mp4Captions",captions:e&&e.captions||[],logs:e&&e.logs||[],data:t.buffer},[t.buffer])},t.probeMp4StartTime=function(e){var t=e.timescales;e=e.data,t=kt(t,e),this.self.postMessage({action:"probeMp4StartTime",startTime:t,data:e},[e.buffer])},t.probeMp4Tracks=function(e){var t=e.data;e=Ct(t),this.self.postMessage({action:"probeMp4Tracks",tracks:e,data:t},[t.buffer])},t.probeTs=function(e){var t=e.data,i=(e="number"!=typeof(i=e.baseStartTime)||isNaN(i)?void 0:i*J,Dt(t,e));e=null,i&&((e={hasVideo:i.video&&2===i.video.length||!1,hasAudio:i.audio&&2===i.audio.length||!1}).hasVideo&&(e.videoStart=i.video[0].ptsTime),e.hasAudio&&(e.audioStart=i.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:e,data:t},[t.buffer])},t.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},t.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},t.push=function(e){e=new Uint8Array(e.data,e.byteOffset,e.byteLength),this.transmuxer.push(e)},t.reset=function(){this.transmuxer.reset()},t.setTimestampOffset=function(e){e=e.timestampOffset||0,this.transmuxer.setBaseMediaDecodeTime(Math.round(Z(e)))},t.setAudioAppendStart=function(e){this.transmuxer.setAudioAppendStart(Math.ceil(Z(e.appendStart)))},t.setRemux=function(e){this.transmuxer.setRemux(e.remux)},t.flush=function(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})},t.endTimeline=function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})},t.alignGopsWith=function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())},e}();self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new Ot(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new Ot(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})))),Mu=function(e){e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():Yo(e.currentTransmux))},Ru=function(e){!function(e,t){if(!t.currentTransmux)return t.currentTransmux=e,Qo(t,e),0;t.transmuxQueue.push(Qo.bind(null,t,e))}("reset",e)},Nu=2,Uu=-101,Bu=-102,Fu=to("CodecUtils"),ju=to("PlaylistSelector"),Hu=(zn=function(){var e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return hu(this.playlists.master,this.systemBandwidth,parseInt(lu(this.tech_.el(),"width"),10)*e,parseInt(lu(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},function(e){function t(t,i){var n=e.call(this)||this;if(!t)throw new TypeError("Initialization settings are required");if("function"!=typeof t.currentTime)throw new TypeError("No currentTime getter specified");if(!t.mediaSource)throw new TypeError("No MediaSource specified");return n.bandwidth=t.bandwidth,n.throughput={rate:0,count:0},n.roundTrip=NaN,n.resetStats_(),n.mediaIndex=null,n.partIndex=null,n.hasPlayed_=t.hasPlayed,n.currentTime_=t.currentTime,n.seekable_=t.seekable,n.seeking_=t.seeking,n.duration_=t.duration,n.mediaSource_=t.mediaSource,n.vhs_=t.vhs,n.loaderType_=t.loaderType,n.currentMediaInfo_=void 0,n.startingMediaInfo_=void 0,n.segmentMetadataTrack_=t.segmentMetadataTrack,n.goalBufferLength_=t.goalBufferLength,n.sourceType_=t.sourceType,n.sourceUpdater_=t.sourceUpdater,n.inbandTextTracks_=t.inbandTextTracks,n.state_="INIT",n.timelineChangeController_=t.timelineChangeController,n.shouldSaveSegmentTimingInfo_=!0,n.parse708captions_=t.parse708captions,n.useDtsForTimestampOffset_=t.useDtsForTimestampOffset,n.captionServices_=t.captionServices,n.experimentalExactManifestTimings=t.experimentalExactManifestTimings,n.checkBufferTimeout_=null,n.error_=void 0,n.currentTimeline_=-1,n.pendingSegment_=null,n.xhrOptions_=null,n.pendingSegments_=[],n.audioDisabled_=!1,n.isPendingTimestampOffset_=!1,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=11<=qn.browser.IE_VERSION,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",(function(){n.isEndOfStream_()||(n.ended_=!1)})),n.fetchAtBuffer_=!1,n.logger_=to("SegmentLoader["+n.loaderType_+"]"),Object.defineProperty(ct(n),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",(function(){n.hasEnoughInfoToLoad_()&&n.processLoadQueue_(),n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),n}dt(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return function(e){var t=new Ou;t.currentTransmux=null,t.transmuxQueue=[];var i=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)},t.postMessage({action:"init",options:e}),t}({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},i.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},i.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},i.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},i.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},i.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,window.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},i.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},i.error=function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},i.endOfStream=function(){this.ended_=!0,this.transmuxer_&&Ru(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},i.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return qn.createTimeRanges();if("main"===this.loaderType_){var t=e.hasAudio,i=e.hasVideo;if(e=e.isMuxed,i&&t&&!this.audioDisabled_&&!e)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=qo(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e},i.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Vo(e),n=this.keyCache_[i];return this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes}),e={resolvedUri:(n||e).resolvedUri},n&&(e.bytes=n.bytes),e},i.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},i.load=function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.playlist=function(e,t){if(void 0===t&&(t={}),e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");t=e.mediaSequence-i.mediaSequence,this.logger_("live window shift ["+t+"]"),null!==this.mediaIndex&&(this.mediaIndex-=t,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(r=this.playlist_.segments[this.mediaIndex],!this.partIndex||r.parts&&r.parts.length&&r.parts[this.partIndex]||(r=this.mediaIndex,this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=r))),n&&(n.mediaIndex-=t,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(0<=n.mediaIndex&&(n.segment=e.segments[n.mediaIndex]),0<=n.partIndex&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}},i.pause=function(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},i.paused=function(){return null===this.checkBufferTimeout_},i.resetEverything=function(e){this.ended_=!1,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))},i.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},i.resyncLoader=function(){this.transmuxer_&&Ru(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},i.remove=function(e,t,i,n){if(void 0===i&&(i=function(){}),void 0===n&&(n=!1),(t=t===1/0?this.duration_():t)<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r,a=1,s=function(){0==--a&&i()};for(r in!n&&this.audioDisabled_||(a++,this.sourceUpdater_.removeAudio(e,t,s)),!n&&"main"!==this.loaderType_||(this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil((t-n)*bu),a=Math.ceil((i-n)*bu),s=(n=e.slice(),e.length);s--&&!(e[s].pts<=a););if(-1===s)return n;for(var o=s+1;o--&&!(e[o].pts<=r););return o=Math.max(o,0),n.splice(o,s-o+1),n}(this.gopBuffer_,e,t,this.timeMapping_),a++,this.sourceUpdater_.removeVideo(e,t,s)),this.inbandTextTracks_)pu(e,t,this.inbandTextTracks_[r]);pu(e,t,this.segmentMetadataTrack_),s()}else this.logger_("skipping remove because no source updater or starting media info")},i.monitorBuffer_=function(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)},i.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)},i.fillBuffer_=function(){var e;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))},i.isEndOfStream_=function(e,t,i){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===i&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var n="number"==typeof e&&t.segments[e];return e=e+1===t.segments.length,n=!n||!n.parts||i+1===n.parts.length,t.endList&&"open"===this.mediaSource_.readyState&&e&&n},i.chooseNextRequest_=function(){var e,t,i=oo(e=this.buffered_())||0,n=uo(e,this.currentTime_()),r=!this.hasPlayed_()&&1<=n,a=n>=this.goalBufferLength_();if(!(e=this.playlist_.segments).length||r||a)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()),(r={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)}).isSyncRequest?r.mediaIndex=function(e,t,i){t=t||[];for(var n=[],r=0,a=0;a<t.length;a++){var s=t[a];if(e===s.timeline&&(n.push(a),i<(r+=s.duration)))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,e,i):null!==this.mediaIndex?(a=e[this.mediaIndex],t="number"==typeof this.partIndex?this.partIndex:-1,r.startOfSegment=a.end||i,a.parts&&a.parts[t+1]?(r.mediaIndex=this.mediaIndex,r.partIndex=t+1):r.mediaIndex=this.mediaIndex+1):(t=(o=Eu.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?i:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time})).segmentIndex,s=o.startTime,o=o.partIndex,r.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+i:"currentTime "+this.currentTime_(),r.mediaIndex=t,r.startOfSegment=s,r.partIndex=o);var s=e[r.mediaIndex],o=s&&"number"==typeof r.partIndex&&s.parts&&s.parts[r.partIndex];return!s||"number"==typeof r.partIndex&&!o?null:("number"!=typeof r.partIndex&&s.parts&&(r.partIndex=0,o=s.parts[0]),n||!o||o.independent||(0===r.partIndex?(o=(n=e[r.mediaIndex-1]).parts&&n.parts.length&&n.parts[n.parts.length-1])&&o.independent&&(--r.mediaIndex,r.partIndex=n.parts.length-1,r.independent="previous segment"):s.parts[r.partIndex-1].independent&&(--r.partIndex,r.independent="previous part")),s=this.mediaSource_&&"ended"===this.mediaSource_.readyState,r.mediaIndex>=e.length-1&&s&&!this.seeking_()?null:this.generateSegmentInfo_(r))},i.generateSegmentInfo_=function(e){var t=e.independent,i=e.playlist,n=e.mediaIndex,r=e.startOfSegment,a=e.isSyncRequest,s=e.partIndex,o=e.forceTimestampOffset,u=e.getMediaInfoForTime,l=i.segments[n];return e="number"==typeof s&&l.parts[s],t={requestId:"segment-loader-"+Math.random(),uri:e&&e.resolvedUri||l.resolvedUri,mediaIndex:n,partIndex:e?s:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:e&&e.duration||l.duration,segment:l,part:e,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:u,independent:t},o=void 0!==o?o:this.isPendingTimestampOffset_,t.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:o}),"number"==typeof(o=oo(this.sourceUpdater_.audioBuffered()))&&(t.audioAppendStart=o-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(t.gopsToAlignWith=function(e,t,i){if(null==t||!e.length)return[];for(var n=Math.ceil((t-i+3)*bu),r=0;r<e.length&&!(e[r].pts>n);r++);return e.slice(r)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),t},i.timestampOffsetForSegment_=function(e){return i=(t=e).segmentTimeline,n=t.currentTimeline,r=t.startOfSegment,e=t.buffered,t.overrideCheck||i!==n?i<n||!e.length?r:e.end(e.length-1):null;var t,i,n,r},i.earlyAbortWhenNeeded_=function(e){var t,i,n,r,a,s,o,u,l,c,d,h,p;!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3||(t=this.currentTime_(),r=e.bandwidth,a=this.pendingSegment_.duration,p=Eu.estimateSegmentRequestTime(a,r,this.playlist_,e.bytesReceived),i=this.buffered_(),n=t,void 0===(e=this.vhs_.tech_.playbackRate())&&(e=1),p<=(e=((i.length?i.end(i.length-1):0)-n)/e-1)||(a=(r={master:this.vhs_.playlists.master,currentTime:t,bandwidth:r,duration:this.duration_(),segmentDuration:a,timeUntilRebuffer:e,currentTimeline:this.currentTimeline_,syncController:this.syncController_}).master,s=r.currentTime,o=r.bandwidth,u=r.duration,l=r.segmentDuration,c=r.timeUntilRebuffer,d=r.currentTimeline,h=r.syncController,cu(a=(r=(a=(a=(r=a.playlists.filter((function(e){return!Eu.isIncompatible(e)}))).filter(Eu.isEnabled)).length?a:r.filter((function(e){return!Eu.isDisabled(e)}))).filter(Eu.hasAttribute.bind(null,"BANDWIDTH")).map((function(e){var t=h.getSyncPoint(e,u,d,s)?1:2;return{playlist:e,rebufferingImpact:Eu.estimateSegmentRequestTime(l,o,e)*t-c}}))).filter((function(e){return e.rebufferingImpact<=0})),(function(e,t){return du(t.playlist,e.playlist)})),(r=a.length?a[0]:(cu(r,(function(e,t){return e.rebufferingImpact-t.rebufferingImpact})),r[0]||null))&&(p=p-e-r.rebufferingImpact,!r.playlist||r.playlist.uri===this.playlist_.uri||p<(e<=Su?1:.5)||(this.bandwidth=r.playlist.attributes.BANDWIDTH*Du.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))))))},i.handleAbort_=function(e){this.logger_("Aborting "+mu(e)),this.mediaRequestsAborted+=1},i.handleProgress_=function(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")},i.handleTrackInfo_=function(e,t){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;var i=Object.keys(e).sort(),n=Object.keys(t).sort();if(i.length!==n.length)return!1;for(var r=0;r<i.length;r++){var a=i[r];if(a!==n[r])return!1;if(e[a]!==t[a])return!1}return!0}(this.currentMediaInfo_,t=t||{})||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(e.requestId)||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_()))},i.handleTimingInfo_=function(e,t,i,n){var r;this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||((r=this.pendingSegment_)[e=gu(t)]=r[e]||{},r[e][i]=n,this.logger_("timinginfo: "+t+" - "+i+" - "+n),this.hasEnoughInfoToAppend_()&&this.processCallQueue_())},i.handleCaptions_=function(e,t){var i,n,r=this;this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(0!==t.length?this.pendingSegment_.hasAppendedData_?(i=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),n={},t.forEach((function(e){n[e.stream]=n[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=n[e.stream];t.startTime=Math.min(t.startTime,e.startTime+i),t.endTime=Math.max(t.endTime,e.endTime+i),t.captions.push(e)})),Object.keys(n).forEach((function(e){var t,a,s,o,u,l,c,d,h,p,f=n[e],m=f.startTime,g=f.endTime,y=f.captions,v=r.inbandTextTracks_;r.logger_("adding cues from "+m+" -> "+g+" for "+e),t=v,a=r.vhs_.tech_,t[s=e]||(a.trigger({type:"usage",name:"vhs-608"}),a.trigger({type:"usage",name:"hls-608"}),/^cc708_/.test(o=s)&&(o="SERVICE"+s.split("_")[1]),(c=a.textTracks().getTrackById(o))?t[s]=c:(l=u=s,f=!1,(c=(a.options_.vhs&&a.options_.vhs.captionServices||{})[o])&&(u=c.label,l=c.language,f=c.default),t[s]=a.addRemoteTextTrack({kind:"captions",id:o,default:f,label:u,language:l},!1).track)),pu(m,g,v[e]),h=(y={captionArray:y,inbandTextTracks:v,timestampOffset:i}).inbandTextTracks,v=y.captionArray,p=y.timestampOffset,v&&(d=window.WebKitDataCue||window.VTTCue,v.forEach((function(e){var t=e.stream;h[t].addCue(new d(e.startTime+p,e.endTime+p,e.text))})))})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})):this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t)):this.logger_("SegmentLoader received no captions from a caption event"))},i.handleId3_=function(e,t,i){var n,r,a,s;this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?(n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r=this.inbandTextTracks_,a=i,s=this.vhs_.tech_,r.metadataTrack_||(r.metadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,r.metadataTrack_.inBandMetadataTrackDispatchType=a),function(e){var t=e.inbandTextTracks,i=e.metadataArray,n=e.timestampOffset,r=e.videoDuration;if(i){var a=window.WebKitDataCue||window.VTTCue,s=t.metadataTrack_;if(s&&(i.forEach((function(e){var t=e.cueTime+n;!("number"!=typeof t||window.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((function(e){var i,n=new a(t,t,e.value||e.url||e.data||"");n.frame=e,n.value=e,i=n,Object.defineProperties(i.frame,{id:{get:function(){return qn.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),i.value.key}},value:{get:function(){return qn.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),i.value.data}},privateData:{get:function(){return qn.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),i.value.data}}}),s.addCue(n)}))})),s.cues&&s.cues.length)){for(var o=s.cues,u=[],l=0;l<o.length;l++)o[l]&&u.push(o[l]);var c=u.reduce((function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),d=Object.keys(c).sort((function(e,t){return Number(e)-Number(t)}));d.forEach((function(e,t){e=c[e];var i=Number(d[t+1])||r;e.forEach((function(e){e.endTime=i}))}))}}}({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:this.duration_()})):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))},i.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach((function(e){return e()})),this.metadataQueue_.caption.forEach((function(e){return e()})),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},i.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach((function(e){return e()}))},i.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach((function(e){return e()}))},i.hasEnoughInfoToLoad_=function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!(!e||this.getCurrentMediaInfo_()&&yu({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.getCurrentMediaInfo_=function(e){return(e=void 0===e?this.pendingSegment_:e)&&e.trackInfo||this.currentMediaInfo_},i.getMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),this.getCurrentMediaInfo_(e)||this.startingMediaInfo_},i.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var i=t.hasAudio,n=t.hasVideo;return t=t.isMuxed,!(n&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!t&&!e.audioTimingInfo||yu({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.handleData_=function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(!this.callQueue_.length&&this.hasEnoughInfoToAppend_()){var i,n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4?(this.trigger("fmp4"),n.timingInfo.start=n[gu(t.type)].start):(i=this.getCurrentMediaInfo_(),(i="main"===this.loaderType_&&i&&i.hasVideo)&&(r=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:i,firstVideoFrameTimeForData:r,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})),this.updateAppendInitSegmentStatus(n,t.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:"main"===this.loaderType_});var r=this.chooseNextRequest_();if(r.mediaIndex!==n.mediaIndex||r.partIndex!==n.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,t)}}else this.callQueue_.push(this.handleData_.bind(this,e,t))},i.updateAppendInitSegmentStatus=function(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)},i.getInitSegmentAndUpdateState_=function(e){var t=e.type,i=e.initSegment,n=e.map,r=e.playlist;if(n){if(e=qo(n),this.activeInitSegmentId_===e)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=e}return i&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,i):null},i.handleQuotaExceededError_=function(e,t){var i=this,n=e.segmentInfo,r=e.type,a=e.bytes,s=this.sourceUpdater_.audioBuffered(),o=this.sourceUpdater_.videoBuffered();1<s.length&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+so(s).join(", ")),1<o.length&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+so(o).join(", "));var u=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,c=o.length?o.start(0):0;if(e=o.length?o.end(o.length-1):0,l-u<=1&&e-c<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+a.byteLength+", audio buffer: "+so(s).join(", ")+", video buffer: "+so(o).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:n,type:r,bytes:a})),a=this.currentTime_()-1,this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+a),this.remove(0,a,(function(){i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=window.setTimeout((function(){i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),i.quotaExceededErrorRetryTimeout_=null,i.processCallQueue_()}),1e3)}),!0)},i.handleAppendError_=function(e,t){var i=e.segmentInfo,n=e.type;e=e.bytes,t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(n+" append of "+e.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:i,type:n,bytes:e}))},i.appendToSourceBuffer_=function(e){var t,i,n=e.segmentInfo,r=e.type,a=e.initSegment,s=e.data,o=e.bytes;o||(e=[s],s=s.byteLength,a&&(e.unshift(a),s+=a.byteLength),i=0,(e={bytes:s,segments:e}).bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach((function(e){t.set(e,i),i+=e.byteLength}))),o=t),this.sourceUpdater_.appendBuffer({segmentInfo:n,type:r,bytes:o},this.handleAppendError_.bind(this,{segmentInfo:n,type:r,bytes:o}))},i.handleSegmentTimingInfo_=function(e,t,i){this.pendingSegment_&&t===this.pendingSegment_.requestId&&((t=this.pendingSegment_.segment)[e+="TimingInfo"]||(t[e]={}),t[e].transmuxerPrependedSeconds=i.prependedContentDuration||0,t[e].transmuxedPresentationStart=i.start.presentation,t[e].transmuxedDecodeStart=i.start.decode,t[e].transmuxedPresentationEnd=i.end.presentation,t[e].transmuxedDecodeEnd=i.end.decode,t[e].baseMediaDecodeTime=i.baseMediaDecodeTime)},i.appendData_=function(e,t){var i=t.type,n=t.data;n&&n.byteLength&&("audio"===i&&this.audioDisabled_||(t=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null}),this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:t,data:n})))},i.loadSegment_=function(e){var t=this;this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((function(){var i=m({},e,{forceTimestampOffset:!0});m(e,t.generateSegmentInfo_(i)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)}))},i.updateTransmuxerAndRequestSegment_=function(e){var t=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,a=e.timeline!==this.currentTimeline_&&0<e.timeline;a=n||r&&a,this.logger_("Requesting "+mu(e)),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=function(e){var t,i,n,r=e.xhr,a=e.xhrOptions,s=e.decryptionWorker,o=e.segment,u=e.abortFn,l=e.progressFn,c=e.trackInfoFn,d=e.timingInfoFn,h=e.videoSegmentTimingInfoFn,p=e.audioSegmentTimingInfoFn,f=e.id3Fn,m=e.captionsFn,g=e.isEndOfTimeline,y=e.endedTimelineFn,v=e.dataFn,_=e.doneFn,b=(e=e.onTransmuxerLog,[]);_=function(e){var t=e.activeXhrs,i=e.decryptionWorker,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=0,m=!1;return function(e,g){if(!m){if(e)return m=!0,Jo(t),h(e,g);if((f+=1)===t.length){var y=function(){if(g.encryptedBytes)return t=(e={decryptionWorker:i,segment:g,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p}).decryptionWorker,m=e.trackInfoFn,y=e.timingInfoFn,v=e.videoSegmentTimingInfoFn,_=e.audioSegmentTimingInfoFn,b=e.id3Fn,T=e.captionsFn,S=e.isEndOfTimeline,w=e.endedTimelineFn,E=e.dataFn,k=e.doneFn,C=e.onTransmuxerLog,void nu({id:(f=e.segment).requestId,key:f.key,encryptedBytes:f.encryptedBytes,decryptionWorker:t},(function(e){f.bytes=e,iu({segment:f,bytes:f.bytes,trackInfoFn:m,timingInfoFn:y,videoSegmentTimingInfoFn:v,audioSegmentTimingInfoFn:_,id3Fn:b,captionsFn:T,isEndOfTimeline:S,endedTimelineFn:w,dataFn:E,doneFn:k,onTransmuxerLog:C})}));var e,t,f,m,y,v,_,b,T,S,w,E,k,C;iu({segment:g,bytes:g.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p})};if(g.endOfAllRequests=Date.now(),g.map&&g.map.encryptedBytes&&!g.map.bytes)return nu({decryptionWorker:i,id:g.requestId+"-init",encryptedBytes:g.map.encryptedBytes,key:g.map.key},(function(e){g.map.bytes=e,tu(g,(function(e){return e?(Jo(t),h(e,g)):void y()}))}));y()}}}}({activeXhrs:b,decryptionWorker:s,trackInfoFn:c,timingInfoFn:d,videoSegmentTimingInfoFn:h,audioSegmentTimingInfoFn:p,id3Fn:f,captionsFn:m,isEndOfTimeline:g,endedTimelineFn:y,dataFn:v,doneFn:_,onTransmuxerLog:e}),o.key&&!o.key.bytes&&(e=[o.key],o.map&&!o.map.bytes&&o.map.key&&o.map.key.resolvedUri===o.key.resolvedUri&&e.push(o.map.key),e=r(qn.mergeOptions(a,{uri:o.key.resolvedUri,responseType:"arraybuffer"}),eu(o,e,_)),b.push(e)),o.map&&!o.map.bytes&&(!o.map.key||o.key&&o.key.resolvedUri===o.map.key.resolvedUri||(t=r(qn.mergeOptions(a,{uri:o.map.key.resolvedUri,responseType:"arraybuffer"}),eu(o,[o.map.key],_)),b.push(t)),t=r(qn.mergeOptions(a,{uri:o.map.resolvedUri,responseType:"arraybuffer",headers:Bo(o.map)}),(i=(t={segment:o,finishProcessingFn:_}).segment,n=t.finishProcessingFn,function(e,t){return(e=Zo(e,t))?n(e,i):(e=new Uint8Array(t.response),i.map.key?(i.map.encryptedBytes=e,n(null,i)):(i.map.bytes=e,void tu(i,(function(e){return e?(e.xhr=t,e.status=t.status,n(e,i)):void n(null,i)}))))})),b.push(t)),(a=r(a=qn.mergeOptions(a,{uri:o.part&&o.part.resolvedUri||o.resolvedUri,responseType:"arraybuffer",headers:Bo(o)}),function(e){var t=e.segment,i=e.finishProcessingFn,n=e.responseType;return function(e,r){return(e=Zo(e,r))?i(e,t):(e="arraybuffer"!==n&&r.responseText?function(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t.buffer}(r.responseText.substring(t.lastReachedChar||0)):r.response,t.stats={bandwidth:(r=r).bandwidth,bytesReceived:r.bytesReceived||0,roundTripTime:r.roundTripTime||0},t.key?t.encryptedBytes=new Uint8Array(e):t.bytes=new Uint8Array(e),i(null,t))}}({segment:o,finishProcessingFn:_,responseType:a.responseType}))).addEventListener("progress",function(e){var t=e.segment,i=e.progressFn;return function(e){var n,r=e.target;if(!r.aborted)return t.stats=qn.mergeOptions(t.stats,(r=(n=e).target,(r={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-r.requestTime||0}).bytesReceived=n.loaded,r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8*1e3),r)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),i(e,t)}}({segment:o,progressFn:l,trackInfoFn:c,timingInfoFn:d,videoSegmentTimingInfoFn:h,audioSegmentTimingInfoFn:p,id3Fn:f,captionsFn:m,isEndOfTimeline:g,endedTimelineFn:y,dataFn:v})),b.push(a);var T={};return b.forEach((function(e){var t,i;e.addEventListener("loadend",(t=(e={loadendState:T,abortFn:u}).loadendState,i=e.abortFn,function(e){e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))})),function(){return Jo(b)}}({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(i){var n=i.message,r=i.level;i=i.stream,t.logger_(mu(e)+" logged from transmuxer stream "+i+" as a "+r+": "+n)}})},i.trimBackBuffer_=function(e){var t,i,n,r;0<(t=this.seekable_(),i=this.currentTime_(),n=this.playlist_.targetDuration||10,r=i-Du.BACK_BUFFER_LENGTH,t.length&&(r=Math.max(r,t.start(0))),r=Math.min(i-n,r))&&this.remove(0,r)},i.createSimplifiedSegmentObj_=function(e){var t,i=e.segment,n={resolvedUri:((t=e.part)||i).resolvedUri,byterange:(t||i).byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part};return(t=e.playlist.segments[e.mediaIndex-1])&&t.timeline===i.timeline&&(t.videoTimingInfo?n.baseStartTime=t.videoTimingInfo.transmuxedDecodeEnd:t.audioTimingInfo&&(n.baseStartTime=t.audioTimingInfo.transmuxedDecodeEnd)),i.key&&(e=i.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]),n.key=this.segmentKey(i.key),n.key.iv=e),i.map&&(n.map=this.initSegmentForMap(i.map)),n},i.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},i.saveBandwidthRelatedStats_=function(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<1/60?this.logger_("Ignoring segment's bandwidth because its duration of "+e+" is less than the min to record "+1/60):(this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)},i.handleTimeout_=function(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate")},i.segmentRequestFinished_=function(e,t,i){if(this.callQueue_.length)this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));else if(this.saveTransferStats_(t.stats),this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId){if(e)return this.pendingSegment_=null,this.state="READY",e.code===Bu?void 0:(this.pause(),e.code===Uu?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error")));e=this.pendingSegment_,this.saveBandwidthRelatedStats_(e.duration,t.stats),e.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var n=t[0].pts,r=0;r<e.length&&!(e[r].pts>=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}},i.setTimeMapping_=function(e){null!==(e=this.syncController_.mappingForTimeline(e))&&(this.timeMapping_=e)},i.updateMediaSecondsLoaded_=function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},i.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},i.trueSegmentStart_=function(e){var t=e.currentStart,i=e.playlist,n=e.mediaIndex,r=e.firstVideoFrameTimeForData,a=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,o=e.videoTimingInfo;return e=e.audioTimingInfo,void 0!==t?t:s?(i=i.segments[n-1],0!==n&&i&&void 0!==i.start&&i.end===r+a?o.start:r):e.start},i.waitForAppendsToComplete_=function(e){if(!(n=this.getCurrentMediaInfo_(e)))return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var t=n.hasAudio,i=n.hasVideo,n=n.isMuxed;if(i="main"===this.loaderType_&&i,n=!this.audioDisabled_&&t&&!n,e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);i&&e.waitingOnAppends++,n&&e.waitingOnAppends++,i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),n&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},i.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},i.checkForIllegalMediaSwitch=function(e){var t,i;return!(t=this.loaderType_,i=this.getCurrentMediaInfo_(),e=e,!(e="main"===t&&i&&e?e.hasAudio||e.hasVideo?i.hasVideo&&!e.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!i.hasVideo&&e.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null)||(this.error({message:e,blacklistDuration:1/0}),this.trigger("error"),0))},i.updateSourceBufferTimestampOffset_=function(e){var t;null===e.timestampOffset||"number"!=typeof e.timingInfo.start||e.changedTimestampOffset||"main"!==this.loaderType_||(t=!1,e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset"))},i.getSegmentStartTimeForTimestampOffsetCalculation_=function(e){var t=e.videoTimingInfo,i=e.audioTimingInfo;return e=e.timingInfo,this.useDtsForTimestampOffset_?t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i&&"number"==typeof i.transmuxedDecodeStart?i.transmuxedDecodeStart:e.start:e.start},i.updateTimingInfoEnd_=function(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_();(t="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo)&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)},i.handleAppendsDone_=function(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_;if(this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_}),(i=function(e,t){if("hls"!==t)return null;var i,n,r=(i={audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo},n=0,["video","audio"].forEach((function(e){var t,r=i[e+"TimingInfo"];r&&(e=r.start,r=r.end,"bigint"==typeof e||"bigint"==typeof r?t=window.BigInt(r)-window.BigInt(e):"number"==typeof e&&"number"==typeof r&&(t=r-e),void 0!==t&&n<t&&(n=t))})),n="bigint"==typeof n&&n<Number.MAX_SAFE_INTEGER?Number(n):n);if(!r)return null;var a=vu({segmentDuration:r,maxDuration:2*(s=e.playlist.targetDuration)}),s=(t=vu({segmentDuration:r,maxDuration:s}),"Segment with index "+e.mediaIndex+" from playlist "+e.playlist.id+" has a duration of "+r+" when the reported duration is "+e.duration+" and the target duration is "+s+". For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1");return a||t?{severity:a?"warn":"info",message:s}:null}(e,this.sourceType_))&&("warn"===i.severity?qn.log.warn(i.message):this.logger_(i.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",!e.isSyncRequest||(this.trigger("syncinfoupdate"),e.hasAppendedData_)){this.logger_("Appended "+mu(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");var t=e.segment,i=e.part;if(t=t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration,i=i&&i.end&&this.currentTime_()-i.end>3*e.playlist.partTargetDuration,t||i)return this.logger_("bad "+(t?"segment":"part")+" "+mu(e)),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}else this.logger_("Throwing away un-appended sync request "+mu(e))},i.recordThroughput_=function(e){var t,i;e.duration<1/60?this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60):(t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,i=Math.floor(e.byteLength/i*8*1e3),this.throughput.rate+=(i-t)/++this.throughput.count)},i.addSegmentMetadataCue_=function(e){var t,i,n,r;this.segmentMetadataTrack_&&(i=(t=e.segment).start,r=t.end,fu(i)&&fu(r)&&(pu(i,r,this.segmentMetadataTrack_),n=window.WebKitDataCue||window.VTTCue,e={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:r},(r=new n(i,r,JSON.stringify(e))).value=e,this.segmentMetadataTrack_.addCue(r)))},t}(qn.EventTarget));function qu(){}function Vu(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))}function Wu(e,t){var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]}function Gu(e,t){if(0!==t.queue.length){var i=0,n=t.queue[i];if("mediaSource"!==n.type){if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!Wu(e,t)){if(n.type!==e){if(null===(i=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];if("mediaSource"===n.type)return null;if(n.type===e)return i}return null}(e,t.queue)))return;n=t.queue[i]}t.queue.splice(i,1),(t.queuePending[e]=n).action(e,t),n.doneFn||(t.queuePending[e]=null,Gu(e,t))}}else t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),n.action(t),n.doneFn&&n.doneFn(),Gu("audio",t),Gu("video",t))}}function zu(e,t){var i=t[e+"Buffer"],n=Vu(e);i&&(i.removeEventListener("updateend",t["on"+n+"UpdateEnd_"]),i.removeEventListener("error",t["on"+n+"Error_"]),t.codecs[e]=null,t[e+"Buffer"]=null)}function Xu(e,t){return e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t)}function Ku(e){var t=e.type,i=e.sourceUpdater,n=e.action,r=e.doneFn;e=e.name,i.queue.push({type:t,action:n,doneFn:r,name:e}),Gu(t,i)}function Yu(e,t){return function(i){var n;t.queuePending[e]&&(n=t.queuePending[e].doneFn,t.queuePending[e]=null,n&&n(t[e+"Error_"])),Gu(e,t)}}function Qu(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))}function $u(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)}function Ju(e,t){(t.activePlaylistLoader=e).load()}function Zu(e,t){for(var i=0;i<e.length;i++){if(Eo(t,e[i]))return!0;if(e[i].playlists&&Zu(e[i].playlists,t))return!0}return!1}function el(e,t,i){var n,r,a,s,o=e.masterPlaylistController_,u=o[(e.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(o);t.attributes&&(n=t.attributes.RESOLUTION,this.width=n&&n.width,this.height=n&&n.height,this.bandwidth=t.attributes.BANDWIDTH),this.codecs=ou(o.master(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,a=t.id,s=u,function(e){var t=r.master.playlists[a],i=bo(t),n=To(t);return void 0===e?n:(e?delete t.disabled:t.disabled=!0,e===n||i||(s(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})}function tl(e,t){var i=0,n=0,r=qn.mergeOptions(xl,t);function a(){n&&e.currentTime(n)}function s(t){null!=t&&(n=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",a),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.trigger({type:"usage",name:"hls-error-reload"}),e.play())}function o(){return Date.now()-i<1e3*r.errorInterval?(e.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void e.trigger({type:"usage",name:"hls-error-reload-canceled"})):r.getSource&&"function"==typeof r.getSource?(i=Date.now(),r.getSource.call(e,s)):void qn.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}function u(){e.off("loadedmetadata",a),e.off("error",o),e.off("dispose",u)}e.ready((function(){e.trigger({type:"usage",name:"vhs-error-reload-initialized"}),e.trigger({type:"usage",name:"hls-error-reload-initialized"})})),e.on("error",o),e.on("dispose",u),e.reloadSourceOnError=function(t){u(),tl(e,t)}}var il,nl=["video","audio"],rl=function(e,t,i){return function(n,r){var a=r[n+"Buffer"];if(Xu(r.mediaSource,a)){r.logger_("Appending segment "+t.mediaIndex+"'s "+e.length+" bytes to "+n+"Buffer");try{a.appendBuffer(e)}catch(a){r.logger_("Error with code "+a.code+" "+(22===a.code?"(QUOTA_EXCEEDED_ERR) ":"")+"when appending segment "+t.mediaIndex+" to "+n+"Buffer"),r.queuePending[n]=null,i(a)}}}},al=function(e,t){return function(i,n){var r=n[i+"Buffer"];if(Xu(n.mediaSource,r)){n.logger_("Removing "+e+" to "+t+" from "+i+"Buffer");try{r.remove(e,t)}catch(r){n.logger_("Remove "+e+" to "+t+" from "+i+"Buffer failed")}}}},sl=function(e){return function(t,i){var n=i[t+"Buffer"];Xu(i.mediaSource,n)&&(i.logger_("Setting "+t+"timestampOffset to "+e),n.timestampOffset=e)}},ol=function(e){return function(t,i){e()}},ul=function(e){return function(t){if("open"===t.mediaSource.readyState){t.logger_("Calling mediaSource endOfStream("+(e||"")+")");try{t.mediaSource.endOfStream(e)}catch(t){qn.log.warn("Failed to call media source endOfStream",t)}}}},ll=function(e){return function(t){t.logger_("Setting mediaSource duration to "+e);try{t.mediaSource.duration=e}catch(t){qn.log.warn("Failed to set media source duration",t)}}},cl=function(e,t){return function(i){var n=Vu(e),r=tr(t);i.logger_("Adding "+e+"Buffer with codec "+t+" to mediaSource"),(r=i.mediaSource.addSourceBuffer(r)).addEventListener("updateend",i["on"+n+"UpdateEnd_"]),r.addEventListener("error",i["on"+n+"Error_"]),i.codecs[e]=t,i[e+"Buffer"]=r}},dl=function(e){return function(t){var i=t[e+"Buffer"];if(zu(e,t),Xu(t.mediaSource,i)){t.logger_("Removing "+e+"Buffer with codec "+t.codecs[e]+" from mediaSource");try{t.mediaSource.removeSourceBuffer(i)}catch(t){qn.log.warn("Failed to removeSourceBuffer "+e+"Buffer",t)}}}},hl=function(e){return function(t,i){var n=i[t+"Buffer"],r=tr(e);Xu(i.mediaSource,n)&&i.codecs[t]!==e&&(i.logger_("changing "+t+"Buffer codec from "+i.codecs[t]+" to "+e),n.changeType(r),i.codecs[t]=e)}},pl=function(e){function t(t){var i=e.call(this)||this;return i.mediaSource=t,i.sourceopenListener_=function(){return Gu("mediaSource",ct(i))},i.mediaSource.addEventListener("sourceopen",i.sourceopenListener_),i.logger_=to("SourceUpdater"),i.audioTimestampOffset_=0,i.videoTimestampOffset_=0,i.queue=[],i.queuePending={audio:null,video:null},i.delayedAudioAppendQueue_=[],i.videoAppendQueued_=!1,i.codecs={},i.onVideoUpdateEnd_=Yu("video",ct(i)),i.onAudioUpdateEnd_=Yu("audio",ct(i)),i.onVideoError_=function(e){i.videoError_=e},i.onAudioError_=function(e){i.audioError_=e},i.createdSourceBuffers_=!1,i.initializedEme_=!1,i.triggeredReady_=!1,i}dt(t,e);var i=t.prototype;return i.initializedEme=function(){this.initializedEme_=!0,this.triggerReady()},i.hasCreatedSourceBuffers=function(){return this.createdSourceBuffers_},i.hasInitializedAnyEme=function(){return this.initializedEme_},i.ready=function(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()},i.createSourceBuffers=function(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())},i.triggerReady=function(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))},i.addSourceBuffer=function(e,t){Ku({type:"mediaSource",sourceUpdater:this,action:cl(e,t),name:"addSourceBuffer"})},i.abort=function(e){Ku({type:e,sourceUpdater:this,action:function(e,t){if("open"===t.mediaSource.readyState){var i=t[e+"Buffer"];if(Xu(t.mediaSource,i)){t.logger_("calling abort on "+e+"Buffer");try{i.abort()}catch(t){qn.log.warn("Failed to abort on "+e+"Buffer",t)}}}},name:"abort"})},i.removeSourceBuffer=function(e){this.canRemoveSourceBuffer()?Ku({type:"mediaSource",sourceUpdater:this,action:dl(e),name:"removeSourceBuffer"}):qn.log.error("removeSourceBuffer is not supported!")},i.canRemoveSourceBuffer=function(){return!qn.browser.IE_VERSION&&!qn.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer},t.canChangeType=function(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType},i.canChangeType=function(){return this.constructor.canChangeType()},i.changeType=function(e,t){this.canChangeType()?Ku({type:e,sourceUpdater:this,action:hl(t),name:"changeType"}):qn.log.error("changeType is not supported!")},i.addOrChangeSourceBuffers=function(e){var t=this;if(!e||"object"!=typeof e||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((function(i){var n=e[i];if(!t.hasCreatedSourceBuffers())return t.addSourceBuffer(i,n);t.canChangeType()&&t.changeType(i,n)}))},i.appendBuffer=function(e,t){var i=this,n=e.segmentInfo,r=e.type,a=e.bytes;if(this.processedAppend_=!0,"audio"===r&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_("delayed audio append of "+a.length+" until video append");Ku({type:r,sourceUpdater:this,action:rl(a,n||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===r&&(this.videoAppendQueued_=!0,this.delayedAudioAppendQueue_.length&&(r=this.delayedAudioAppendQueue_.slice(),this.logger_("queuing delayed audio "+r.length+" appendBuffers"),this.delayedAudioAppendQueue_.length=0,r.forEach((function(e){i.appendBuffer.apply(i,e)}))))},i.audioBuffered=function(){return Xu(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered||qn.createTimeRange()},i.videoBuffered=function(){return Xu(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered||qn.createTimeRange()},i.buffered=function(){var e=Xu(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Xu(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){var i=null,n=null,r=0,a=[],s=[];if(!(e&&e.length&&t&&t.length))return qn.createTimeRange();for(var o=e.length;o--;)a.push({time:e.start(o),type:"start"}),a.push({time:e.end(o),type:"end"});for(o=t.length;o--;)a.push({time:t.start(o),type:"start"}),a.push({time:t.end(o),type:"end"});for(a.sort((function(e,t){return e.time-t.time})),o=0;o<a.length;o++)"start"===a[o].type?2==++r&&(i=a[o].time):"end"===a[o].type&&1==--r&&(n=a[o].time),null!==i&&null!==n&&(s.push([i,n]),n=i=null);return qn.createTimeRanges(s)}(this.audioBuffered(),this.videoBuffered())},i.setDuration=function(e,t){void 0===t&&(t=qu),Ku({type:"mediaSource",sourceUpdater:this,action:ll(e),name:"duration",doneFn:t})},i.endOfStream=function(e,t){void 0===t&&(t=qu),Ku({type:"mediaSource",sourceUpdater:this,action:ul(e="string"!=typeof(e=void 0===e?null:e)?void 0:e),name:"endOfStream",doneFn:t})},i.removeAudio=function(e,t,i){void 0===i&&(i=qu),this.audioBuffered().length&&0!==this.audioBuffered().end(0)?Ku({type:"audio",sourceUpdater:this,action:al(e,t),doneFn:i,name:"remove"}):i()},i.removeVideo=function(e,t,i){void 0===i&&(i=qu),this.videoBuffered().length&&0!==this.videoBuffered().end(0)?Ku({type:"video",sourceUpdater:this,action:al(e,t),doneFn:i,name:"remove"}):i()},i.updating=function(){return!(!Wu("audio",this)&&!Wu("video",this))},i.audioTimestampOffset=function(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Ku({type:"audio",sourceUpdater:this,action:sl(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_},i.videoTimestampOffset=function(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(Ku({type:"video",sourceUpdater:this,action:sl(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_},i.audioQueueCallback=function(e){this.audioBuffer&&Ku({type:"audio",sourceUpdater:this,action:ol(e),name:"callback"})},i.videoQueueCallback=function(e){this.videoBuffer&&Ku({type:"video",sourceUpdater:this,action:ol(e),name:"callback"})},i.dispose=function(){var e=this;this.trigger("dispose"),nl.forEach((function(t){e.abort(t),e.canRemoveSourceBuffer()?e.removeSourceBuffer(t):e[t+"QueueCallback"]((function(){return zu(t,e)}))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()},t}(qn.EventTarget),fl=new Uint8Array("\n\n".split("").map((function(e){return e.charCodeAt(0)}))),ml=function(e){function t(t,i){return(i=e.call(this,t,i=void 0===i?{}:i)||this).mediaSource_=null,i.subtitlesTrack_=null,i.loaderType_="subtitle",i.featuresNativeTextTracks_=t.featuresNativeTextTracks,i.shouldSaveSegmentTimingInfo_=!1,i}dt(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return null},i.buffered_=function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return qn.createTimeRanges();var e=(t=this.subtitlesTrack_.cues)[0].startTime,t=t[t.length-1].startTime;return qn.createTimeRanges([[e,t]])},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=qo(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(t=fl.byteLength+e.bytes.byteLength,(t=new Uint8Array(t)).set(e.bytes),t.set(fl,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}),n||e},i.couldBeginLoading_=function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.track=function(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_},i.remove=function(e,t){pu(e,t,this.subtitlesTrack_)},i.fillBuffer_=function(){var e=this,t=this.chooseNextRequest_();if(t){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline))return this.syncController_.one("timestampoffset",(function(){e.state="READY",e.paused()||e.monitorBuffer_()})),void(this.state="WAITING_ON_TIMELINE");this.loadSegment_(t)}},i.timestampOffsetForSegment_=function(){return null},i.chooseNextRequest_=function(){return this.skipEmptySegments_(e.prototype.chooseNextRequest_.call(this))},i.skipEmptySegments_=function(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e},i.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},i.segmentRequestFinished_=function(e,t,i){var n=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===Uu&&this.handleTimeout_(),e.code===Bu?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),this.state="APPENDING",this.trigger("appending");var a=r.segment;if(a.map&&(a.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof window.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var s=function(){n.subtitlesTrack_.tech_.off("vttjsloaded",o),n.stopForError({message:"Error loading vtt.js"})},o=function(){n.subtitlesTrack_.tech_.off("vttjserror",s),n.segmentRequestFinished_(e,t,i)};return this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",o),void this.subtitlesTrack_.tech_.one("vttjserror",s)}a.requested=!0;try{this.parseVTTCues_(r)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,r.cues.forEach((function(e){n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)})),function(e){var t=e.cues;if(t)for(var i=0;i<t.length;i++){for(var n=[],r=0,a=0;a<t.length;a++)t[i].startTime===t[a].startTime&&t[i].endTime===t[a].endTime&&t[i].text===t[a].text&&1<++r&&n.push(t[a]);n.length&&n.forEach((function(t){return e.removeCue(t)}))}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},i.handleData_=function(){},i.updateTimingInfoEnd_=function(){},i.parseVTTCues_=function(e){var t=!1;"function"==typeof window.TextDecoder?i=new window.TextDecoder("utf8"):(i=window.WebVTT.StringDecoder(),t=!0);var i=new window.WebVTT.Parser(window,window.vttjs,i);e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},i.oncue=e.cues.push.bind(e.cues),i.ontimestampmap=function(t){e.timestampmap=t},i.onparsingerror=function(e){qn.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map&&(n=e.segment.map.bytes,t&&(n=Qu(n)),i.parse(n));var n=e.bytes;t&&(n=Qu(n)),i.parse(n),i.flush()},i.updateTimeMapping_=function(e,t,i){var n,r,a=e.segment;t&&(e.cues.length?(r=e.timestampmap,n=r.MPEGTS/bu-r.LOCAL+t.mapping,e.cues.forEach((function(e){e.startTime+=n,e.endTime+=n})),i.syncInfo||(r=e.cues[0].startTime,t=e.cues[e.cues.length-1].startTime,i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(r,t-a.duration)})):a.empty=!0)},t}(Hu),gl=[{name:"VOD",run:function(e,t,i,n,r){return i===1/0?null:{time:0,segmentIndex:0,partIndex:null}}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var a=null,s=null,o=co(t);r=r||0;for(var u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],c=l.segment,d=e.timelineToDatetimeMappings[c.timeline];if(d&&c.dateTimeObject){var h=c.dateTimeObject.getTime()/1e3+d;if(c.parts&&"number"==typeof l.partIndex)for(var p=0;p<l.partIndex;p++)h+=c.parts[p].duration;if(d=Math.abs(r-h),null!==s&&(0===d||s<d))break;s=d,a={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex}}}return a}},{name:"Segment",run:function(e,t,i,n,r){var a=null,s=null;r=r||0;for(var o=co(t),u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],c=l.segment,d=l.part&&l.part.start||c&&c.start;if(c.timeline===n&&void 0!==d){if(c=Math.abs(r-d),null!==s&&s<c)break;(!a||null===s||c<=s)&&(s=c,a={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o<t.discontinuityStarts.length;o++){var u=t.discontinuityStarts[o],l=t.discontinuitySequence+o+1,c=e.discontinuities[l];if(c){if(l=Math.abs(r-c.time),null!==s&&s<l)break;(!a||null===s||l<=s)&&(s=l,a={time:c.time,segmentIndex:u,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],yl=function(e){function t(t){var i=e.call(this)||this;return i.timelines=[],i.discontinuities=[],i.timelineToDatetimeMappings={},i.logger_=to("SyncController"),i}dt(t,e);var i=t.prototype;return i.getSyncPoint=function(e,t,i,n){return(i=this.runStrategies_(e,t,i,n)).length?this.selectSyncPoint_(i,{key:"time",value:n}):null},i.getExpiredTime=function(e,t){return e&&e.segments&&(t=this.runStrategies_(e,t,e.discontinuitySequence,0)).length?(0<(t=this.selectSyncPoint_(t,{key:"segmentIndex",value:0})).segmentIndex&&(t.time*=-1),Math.abs(t.time+yo({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:t.segmentIndex,endIndex:0}))):null},i.runStrategies_=function(e,t,i,n){for(var r=[],a=0;a<gl.length;a++){var s=gl[a],o=s.run(this,e,t,i,n);o&&(o.strategy=s.name,r.push({strategy:s.name,syncPoint:o}))}return r},i.selectSyncPoint_=function(e,t){for(var i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,a=1;a<e.length;a++){var s=Math.abs(e[a].syncPoint[t.key]-t.value);s<n&&(n=s,i=e[a].syncPoint,r=e[a].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+r+"]: [time:"+i.time+", segmentIndex:"+i.segmentIndex+("number"==typeof i.partIndex?",partIndex:"+i.partIndex:"")+"]"),i},i.saveExpiredSegmentInfo=function(e,t){var i=t.mediaSequence-e.mediaSequence;if(86400<i)qn.log.warn("Not saving expired segment info. Media sequence gap "+i+" is too large.");else for(var n=i-1;0<=n;n--){var r=e.segments[n];if(r&&void 0!==r.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},i.setDateTimeMappingForStart=function(e){var t;this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject&&(e=(t=e.segments[0]).dateTimeObject.getTime()/1e3,this.timelineToDatetimeMappings[t.timeline]=-e)},i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i);e=t.segment,n&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:e.start})),t=e.dateTimeObject,e.discontinuity&&i&&t&&(this.timelineToDatetimeMappings[e.timeline]=-t.getTime()/1e3)},i.timestampOffsetForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].time},i.mappingForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping},i.calculateSegmentTimeMapping_=function(e,t,i){var n,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+o.time+"] [mapping: "+o.mapping+"]")),n=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=n,s.end=r),(!a.start||n<a.start)&&(a.start=n),a.end=r,!0},i.saveDiscontinuitySyncInfo_=function(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var n=0;n<t.discontinuityStarts.length;n++){var r,a=t.discontinuityStarts[n],s=t.discontinuitySequence+n+1,o=a-e.mediaIndex,u=Math.abs(o);(!this.discontinuities[s]||this.discontinuities[s].accuracy>u)&&(r=o<0?i.start-yo({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:a}):i.end+yo({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:a}),this.discontinuities[s]={time:r,accuracy:u})}},i.dispose=function(){this.trigger("dispose"),this.off()},t}(qn.EventTarget),vl=function(e){function t(){var t=e.call(this)||this;return t.pendingTimelineChanges_={},t.lastTimelineChanges_={},t}dt(t,e);var i=t.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var t=e.type,i=e.from;return e=e.to,"number"==typeof i&&"number"==typeof e&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:e},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from;return e=e.to,"number"==typeof i&&"number"==typeof e&&(this.lastTimelineChanges_[t]={type:t,from:i,to:e},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(qn.EventTarget),_l=C(R(q((function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var i=t((function(e){function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e},e.exports.default=e.exports,e.exports.__esModule=!0})),n=t((function(e){function t(i,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(i,n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0})),r=t((function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0})),a=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1<t)},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}(),s=null,o=function(){function e(e){var t,i,n;s=s||function(){for(var e,t,i,n,r,a,s,o=[[[],[],[],[],[]],[[],[],[],[],[]]],u=o[0],l=o[1],c=u[4],d=l[4],h=[],p=[],f=0;f<256;f++)p[(h[f]=f<<1^283*(f>>7))^f]=f;for(e=t=0;!c[e];e^=i||1,t=p[t]||1)for(s=16843009*h[n=h[i=h[d[c[e]=r=(r=t^t<<1^t<<2^t<<3^t<<4)>>8^255&r^99]=e]]]^65537*n^257*i^16843008*e,a=257*h[r]^16843008*r,f=0;f<4;f++)u[f][e]=a=a<<24^a>>>8,l[f][r]=s=s<<24^s>>>8;for(f=0;f<5;f++)u[f]=u[f].slice(0),l[f]=l[f].slice(0);return o}(),this._tables=[[s[0][0].slice(),s[0][1].slice(),s[0][2].slice(),s[0][3].slice(),s[0][4].slice()],[s[1][0].slice(),s[1][1].slice(),s[1][2].slice(),s[1][3].slice(),s[1][4].slice()]];var r=this._tables[0][4],a=this._tables[1],o=e.length,u=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");var l=e.slice(0),c=[];for(this._key=[l,c],t=o;t<4*o+28;t++)n=l[t-1],(t%o==0||8===o&&t%o==4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],t%o==0&&(n=n<<8^n>>>24^u<<24,u=u<<1^283*(u>>7))),l[t]=l[t-o]^n;for(i=0;t;i++,t--)n=l[3&i?t:t-4],c[i]=t<=4||i<4?n:a[0][r[n>>>24]]^a[1][r[n>>16&255]]^a[2][r[n>>8&255]]^a[3][r[255&n]]}return e.prototype.decrypt=function(e,t,i,n,r,a){for(var s,o,u,l=this._key[1],c=e^l[0],d=n^l[1],h=i^l[2],p=t^l[3],f=l.length/4-2,m=4,g=(t=this._tables[1])[0],y=t[1],v=t[2],_=t[3],b=t[4],T=0;T<f;T++)s=g[c>>>24]^y[d>>16&255]^v[h>>8&255]^_[255&p]^l[m],o=g[d>>>24]^y[h>>16&255]^v[p>>8&255]^_[255&c]^l[m+1],u=g[h>>>24]^y[p>>16&255]^v[c>>8&255]^_[255&d]^l[m+2],p=g[p>>>24]^y[c>>16&255]^v[d>>8&255]^_[255&h]^l[m+3],m+=4,c=s,d=o,h=u;for(T=0;T<4;T++)r[(3&-T)+a]=b[c>>>24]<<24^b[d>>16&255]<<16^b[h>>8&255]<<8^b[255&p]^l[m++],s=c,c=d,d=h,h=p,p=s},e}(),u=function(e){function t(){var t=e.call(this,a)||this;return t.jobs=[],t.delay=1,t.timeout_=null,t}r(t,e);var i=t.prototype;return i.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(a),l=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},c=function(){function e(t,i,n,r){var a=e.STEP,s=new Int32Array(t.buffer),o=new Uint8Array(t.byteLength),c=0;for(this.asyncStream_=new u,this.asyncStream_.push(this.decryptChunk_(s.subarray(c,c+a),i,n,o)),c=a;c<s.length;c+=a)n=new Uint32Array([l(s[c-4]),l(s[c-3]),l(s[c-2]),l(s[c-1])]),this.asyncStream_.push(this.decryptChunk_(s.subarray(c,c+a),i,n,o));this.asyncStream_.push((function(){var e;r(null,(e=o).subarray(0,e.byteLength-e[e.byteLength-1]))}))}return e.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=function(e,t,i){for(var n,r,a,s,u=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),c=new o(Array.prototype.slice.call(t)),d=(e=new Uint8Array(e.byteLength),new Int32Array(e.buffer)),h=i[0],p=i[1],f=i[2],m=i[3],g=0;g<u.length;g+=4)n=l(u[g]),r=l(u[g+1]),a=l(u[g+2]),s=l(u[g+3]),c.decrypt(n,r,a,s,d,g),d[g]=l(d[g]^h),d[g+1]=l(d[g+1]^p),d[g+2]=l(d[g+2]^f),d[g+3]=l(d[g+3]^m),h=n,p=r,f=a,m=s;return e}(e,t,i);n.set(r,e.byteOffset)}},i(e,null,[{key:"STEP",get:function(){return 32e3}}]),e}();(e=(e="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{}).BigInt||Number)("0x1"),e("0x100"),e("0x10000"),e("0x1000000"),e("0x100000000"),e("0x10000000000"),e("0x1000000000000"),e("0x100000000000000"),e("0x10000000000000000"),self.onmessage=function(e){var t=e.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),n=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4);e=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4),new c(i,n,e,(function(e,i){self.postMessage(function(e){var t={};return Object.keys(e).forEach((function(i){var n,r=e[i];n=r,("function"===ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer)?t[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[i]=r})),t}({source:t.source,decrypted:i}),[i.buffer])}))}})))),bl={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;$u(i,n);var a=n.activeTrack(),s=(i=((i=n.activeGroup()).filter((function(e){return e.default}))[0]||i[0]).id,n.tracks[i]);if(a!==s){for(var o in qn.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[o].enabled=n.tracks[o]===s;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];qn.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),$u(i,n),(i=n.activeTrack())&&(i.mode="disabled"),n.onTrackChanged()}}},Tl={AUDIO:function(e,t,i){var n,r,a;t&&(n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",bl[e](e,i)))},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",bl[e](e,i))}},Sl={AUDIO:function(e,t){var i,n,r=t.vhs,a=t.sourceType,s=t.segmentLoaders[e],o=t.requestOptions,u=t.master.mediaGroups,l=t.mediaTypes[e],c=l.groups,d=l.tracks,h=l.logger_,p=t.masterPlaylistLoader,f=Co(p.master);for(i in u[e]&&0!==Object.keys(u[e]).length||(u[e]={main:{default:{default:!0}}},f&&(u[e].main.default.playlists=p.master.playlists)),u[e])for(var m in c[i]||(c[i]=[]),u[e][i]){var g=u[e][i][m],y=void 0;y=f?(h("AUDIO group '"+i+"' label '"+m+"' is a master playlist"),g.isMasterPlaylist=!0,null):"vhs-json"===a&&g.playlists?new Iu(g.playlists[0],r,o):g.resolvedUri?new Iu(g.resolvedUri,r,o):g.playlists&&"dash"===a?new Lu(g.playlists[0],r,o,p):null,g=qn.mergeOptions({id:m,playlistLoader:y},g),Tl[e](e,g.playlistLoader,t),c[i].push(g),void 0===d[m]&&(g=new qn.AudioTrack({id:m,kind:(n=void 0,n=(y=g).default?"main":"alternative",n=y.characteristics&&0<=y.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":n),enabled:!1,language:g.language,default:g.default,label:m}),d[m]=g)}s.on("error",bl[e](e,t))},SUBTITLES:function(e,t){var i,n=t.tech,r=t.vhs,a=t.sourceType,s=t.segmentLoaders[e],o=t.requestOptions,u=t.master.mediaGroups,l=t.mediaTypes[e],c=l.groups,d=l.tracks,h=t.masterPlaylistLoader;for(i in u[e])for(var p in c[i]||(c[i]=[]),u[e][i])if(!u[e][i][p].forced){var f=u[e][i][p],m=void 0;if("hls"===a)m=new Iu(f.resolvedUri,r,o);else if("dash"===a){if(!f.playlists.filter((function(e){return e.excludeUntil!==1/0})).length)return;m=new Lu(f.playlists[0],r,o,h)}else"vhs-json"===a&&(m=new Iu(f.playlists?f.playlists[0]:f.resolvedUri,r,o));f=qn.mergeOptions({id:p,playlistLoader:m},f),Tl[e](e,f.playlistLoader,t),c[i].push(f),void 0===d[p]&&(f=n.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track,d[p]=f)}s.on("error",bl[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i,n=t.tech,r=t.master.mediaGroups,a=(t=t.mediaTypes[e]).groups,s=t.tracks;for(i in r[e])for(var o in a[i]||(a[i]=[]),r[e][i]){var u,l,c=r[e][i][o];/^(?:CC|SERVICE)/.test(c.instreamId)&&(void 0===(l=(u=n.options_.vhs&&n.options_.vhs.captionServices||{})[(l={label:o,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect}).instreamId]?qn.mergeOptions(l,u[l.instreamId]):l).default&&delete l.default,a[i].push(qn.mergeOptions({id:o},c)),void 0===s[o]&&(l=n.addRemoteTextTrack({id:l.instreamId,kind:"captions",default:l.default,language:l.language,label:l.label},!1).track,s[o]=l))}}},wl={AUDIO:function(e,t){return function(){var i,n=t.mediaTypes[e].tracks;for(i in n)if(n[i].enabled)return n[i];return null}},SUBTITLES:function(e,t){return function(){var i,n=t.mediaTypes[e].tracks;for(i in n)if("showing"===n[i].mode||"hidden"===n[i].mode)return n[i];return null}}},El=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],kl=function(e){function t(t){var i=e.call(this)||this,n=t.src,r=t.handleManifestRedirects,a=t.withCredentials,s=t.tech,o=t.bandwidth,u=t.externVhs,l=t.useCueTags,c=t.blacklistDuration,d=t.enableLowInitialPlaylist,h=t.sourceType,p=t.cacheEncryptionKeys,f=t.experimentalBufferBasedABR,m=t.experimentalLeastPixelDiffSelector,g=t.captionServices;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");var y,v=t.maxPlaylistRetries;return null!=v||(v=1/0),il=u,i.experimentalBufferBasedABR=Boolean(f),i.experimentalLeastPixelDiffSelector=Boolean(m),i.withCredentials=a,i.tech_=s,i.vhs_=s.vhs,i.sourceType_=h,i.useCueTags_=l,i.blacklistDuration=c,i.maxPlaylistRetries=v,i.enableLowInitialPlaylist=d,i.useCueTags_&&(i.cueTagsTrack_=i.tech_.addTextTrack("metadata","ad-cues"),i.cueTagsTrack_.inBandMetadataTrackDispatchType=""),i.requestOptions_={withCredentials:a,handleManifestRedirects:r,maxPlaylistRetries:v,timeout:null},i.on("error",i.pauseLoading),i.mediaTypes_=(y={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(e){y[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:qu,activeTrack:qu,getActiveGroup:qu,onGroupChanged:qu,onTrackChanged:qu,lastTrack_:null,logger_:to("MediaGroups["+e+"]")}})),y),i.mediaSource=new window.MediaSource,i.handleDurationChange_=i.handleDurationChange_.bind(ct(i)),i.handleSourceOpen_=i.handleSourceOpen_.bind(ct(i)),i.handleSourceEnded_=i.handleSourceEnded_.bind(ct(i)),i.mediaSource.addEventListener("durationchange",i.handleDurationChange_),i.mediaSource.addEventListener("sourceopen",i.handleSourceOpen_),i.mediaSource.addEventListener("sourceended",i.handleSourceEnded_),i.seekable_=qn.createTimeRanges(),i.hasPlayed_=!1,i.syncController_=new yl(t),i.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,i.decrypter_=new _l,i.sourceUpdater_=new pl(i.mediaSource),i.inbandTextTracks_={},i.timelineChangeController_=new vl,p={vhs:i.vhs_,parse708captions:t.parse708captions,useDtsForTimestampOffset:t.useDtsForTimestampOffset,captionServices:g,mediaSource:i.mediaSource,currentTime:i.tech_.currentTime.bind(i.tech_),seekable:function(){return i.seekable()},seeking:function(){return i.tech_.seeking()},duration:function(){return i.duration()},hasPlayed:function(){return i.hasPlayed_},goalBufferLength:function(){return i.goalBufferLength()},bandwidth:o,syncController:i.syncController_,decrypter:i.decrypter_,sourceType:i.sourceType_,inbandTextTracks:i.inbandTextTracks_,cacheEncryptionKeys:p,sourceUpdater:i.sourceUpdater_,timelineChangeController:i.timelineChangeController_,experimentalExactManifestTimings:t.experimentalExactManifestTimings},i.masterPlaylistLoader_=new("dash"===i.sourceType_?Lu:Iu)(n,i.vhs_,i.requestOptions_),i.setupMasterPlaylistLoaderListeners_(),i.mainSegmentLoader_=new Hu(qn.mergeOptions(p,{segmentMetadataTrack:i.segmentMetadataTrack_,loaderType:"main"}),t),i.audioSegmentLoader_=new Hu(qn.mergeOptions(p,{loaderType:"audio"}),t),i.subtitleSegmentLoader_=new ml(qn.mergeOptions(p,{loaderType:"vtt",featuresNativeTextTracks:i.tech_.featuresNativeTextTracks}),t),i.setupSegmentLoaderListeners_(),i.experimentalBufferBasedABR&&(i.masterPlaylistLoader_.one("loadedplaylist",(function(){return i.startABRTimer_()})),i.tech_.on("pause",(function(){return i.stopABRTimer_()})),i.tech_.on("play",(function(){return i.startABRTimer_()}))),El.forEach((function(e){i[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(ct(i),e)})),i.logger_=to("MPC"),i.triggeredFmp4Usage=!1,"none"===i.tech_.preload()?(i.loadOnPlay_=function(){i.loadOnPlay_=null,i.masterPlaylistLoader_.load()},i.tech_.one("play",i.loadOnPlay_)):i.masterPlaylistLoader_.load(),i.timeToLoadedData__=-1,i.mainAppendsToLoadedData__=-1,i.audioAppendsToLoadedData__=-1,t="none"===i.tech_.preload()?"play":"loadstart",i.tech_.one(t,(function(){var e=Date.now();i.tech_.one("loadeddata",(function(){i.timeToLoadedData__=Date.now()-e,i.mainAppendsToLoadedData__=i.mainSegmentLoader_.mediaAppends,i.audioAppendsToLoadedData__=i.audioSegmentLoader_.mediaAppends}))})),i}dt(t,e);var i=t.prototype;return i.mainAppendsToLoadedData_=function(){return this.mainAppendsToLoadedData__},i.audioAppendsToLoadedData_=function(){return this.audioAppendsToLoadedData__},i.appendsToLoadedData_=function(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t},i.timeToLoadedData_=function(){return this.timeToLoadedData__},i.checkABR_=function(){var e=this.selectPlaylist();e&&this.shouldSwitchToMedia_(e)&&this.switchMedia_(e,"abr")},i.switchMedia_=function(e,t,i){var n=(r=this.media())&&(r.id||r.uri),r=e.id||e.uri;n&&n!==r&&(this.logger_("switch media "+n+" -> "+r+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,i)},i.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=window.setInterval((function(){return e.checkABR_()}),250)},i.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)},i.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var i,n=e.mediaGroups.AUDIO,r=Object.keys(n);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{var a,s=n.main||r.length&&n[r[0]];for(a in s)if(s[a].default){i={label:a};break}}if(!i)return t;var o,u=[];for(o in n)if(n[o][i.label]){var l=n[o][i.label];if(l.playlists&&l.playlists.length)u.push.apply(u,l.playlists);else if(l.uri)u.push(l);else if(e.playlists.length)for(var c=0;c<e.playlists.length;c++){var d=e.playlists[c];d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===o&&u.push(d)}}return u.length?u:t},i.setupMasterPlaylistLoaderListeners_=function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;wo(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){Sl[t](t,e)}));var t,i=e.mediaTypes,n=e.masterPlaylistLoader,r=e.tech,a=e.vhs,s=e.segmentLoaders,o=s.AUDIO,u=s.main;function l(){i.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"}),r.trigger({type:"usage",name:"hls-audio-change"})}for(t in["AUDIO","SUBTITLES"].forEach((function(t){var n,r,a,s,o,u,l,c,d,h;i[t].activeGroup=(n=t,r=e,function(e){var t=r.masterPlaylistLoader,i=r.mediaTypes[n].groups,a=t.media();if(!a)return null;var s=null;a.attributes[n]&&(s=i[a.attributes[n]]);var o=Object.keys(i);if(!s)if("AUDIO"===n&&1<o.length&&Co(r.master))for(var u=0;u<o.length;u++){var l=i[o[u]];if(Zu(l,a)){s=l;break}}else i.main?s=i.main:1===o.length&&(s=i[o[0]]);return void 0===e?s:null!==e&&s&&s.filter((function(t){return t.id===e.id}))[0]||null}),i[t].activeTrack=wl[t](t,e),i[t].onGroupChanged=(a=t,s=e,function(){var e=(u=s.segmentLoaders)[a],t=u.main,i=s.mediaTypes[a],n=i.activeTrack(),r=i.getActiveGroup(),o=i.activePlaylistLoader,u=i.lastGroup_;r&&u&&r.id===u.id||(i.lastGroup_=r,i.lastTrack_=n,$u(e,i),r&&!r.isMasterPlaylist&&(r.playlistLoader?(e.resyncLoader(),Ju(r.playlistLoader,i)):o&&t.resetEverything()))}),i[t].onGroupChanging=(o=t,u=e,function(){var e=u.segmentLoaders[o];u.mediaTypes[o].lastGroup_=null,e.abort(),e.pause()}),i[t].onTrackChanged=(l=t,c=e,function(){var e=c.masterPlaylistLoader,t=(d=c.segmentLoaders)[l],i=d.main,n=c.mediaTypes[l],r=n.activeTrack(),a=n.getActiveGroup(),s=n.activePlaylistLoader,o=n.lastTrack_;if((!o||!r||o.id!==r.id)&&(n.lastGroup_=a,n.lastTrack_=r,$u(t,n),a)){if(a.isMasterPlaylist){if(!r||!o||r.id===o.id)return;var u=c.vhs.masterPlaylistController_,d=u.selectPlaylist();return u.media()===d?void 0:(n.logger_("track change. Switching master audio from "+o.id+" to "+r.id),e.pause(),i.resetEverything(),void u.fastQualityChange_(d))}if("AUDIO"===l){if(!a.playlistLoader)return i.setAudio(!0),void i.resetEverything();t.setAudio(!0),i.setAudio(!1)}s!==a.playlistLoader&&(t.track&&t.track(r),t.resetEverything()),Ju(a.playlistLoader,n)}}),i[t].getActiveGroup=(d=t,h=e.mediaTypes,function(){var e=h[d].activeTrack();return e?h[d].activeGroup(e):null})})),(s=i.AUDIO.activeGroup())&&(s=(s.filter((function(e){return e.default}))[0]||s[0]).id,i.AUDIO.tracks[s].enabled=!0,i.AUDIO.onGroupChanged(),i.AUDIO.onTrackChanged(),i.AUDIO.getActiveGroup().playlistLoader?(u.setAudio(!1),o.setAudio(!0)):u.setAudio(!0)),n.on("mediachange",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return i[e].onGroupChanged()}))})),n.on("mediachanging",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return i[e].onGroupChanging()}))})),r.audioTracks().addEventListener("change",l),r.remoteTextTracks().addEventListener("change",i.SUBTITLES.onTrackChanged),a.on("dispose",(function(){r.audioTracks().removeEventListener("change",l),r.remoteTextTracks().removeEventListener("change",i.SUBTITLES.onTrackChanged)})),r.clearTracks("audio"),i.AUDIO.tracks)r.audioTracks().addTrack(i.AUDIO.tracks[t])}({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,masterPlaylistLoader:e.masterPlaylistLoader_,vhs:e.vhs_,master:e.master(),mediaTypes:e.mediaTypes_,blacklistCurrentPlaylist:e.blacklistCurrentPlaylist.bind(e)}),e.triggerPresenceUsage_(e.master(),t),e.setupFirstPlay(),!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(function(){e.trigger("selectedinitialmedia")}))})),this.masterPlaylistLoader_.on("loadedplaylist",(function(){e.loadOnPlay_&&e.tech_.off("play",e.loadOnPlay_);var t,i=e.masterPlaylistLoader_.media();if(!i){if(e.excludeUnsupportedVariants_(),!(t=(t=e.enableLowInitialPlaylist?e.selectInitialPlaylist():t)||e.selectPlaylist())||!e.shouldSwitchToMedia_(t))return;if(e.initialMedia_=t,e.switchMedia_(e.initialMedia_,"initial"),"vhs-json"!==e.sourceType_||!e.initialMedia_.segments)return;i=e.initialMedia_}e.handleUpdatedMediaPlaylist(i)})),this.masterPlaylistLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)})),this.masterPlaylistLoader_.on("mediachanging",(function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()})),this.masterPlaylistLoader_.on("mediachange",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;wo(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})})),this.masterPlaylistLoader_.on("playlistunchanged",(function(){var t=e.masterPlaylistLoader_.media();"playlist-unchanged"!==t.lastExcludeReason_&&e.stuckAtPlaylistEnd_(t)&&(e.blacklistCurrentPlaylist({message:"Playlist no longer updating.",reason:"playlist-unchanged"}),e.tech_.trigger("playliststuck"))})),this.masterPlaylistLoader_.on("renditiondisabled",(function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"}),e.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})})),this.masterPlaylistLoader_.on("renditionenabled",(function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"}),e.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})}))},i.handleUpdatedMediaPlaylist=function(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())},i.triggerPresenceUsage_=function(e,t){var i,n=e.mediaGroups||{},r=!0;for(i in e=Object.keys(n.AUDIO),n.AUDIO)for(var a in n.AUDIO[i])n.AUDIO[i][a].uri||(r=!1);r&&(this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),this.tech_.trigger({type:"usage",name:"hls-demuxed"})),Object.keys(n.SUBTITLES).length&&(this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),this.tech_.trigger({type:"usage",name:"hls-webvtt"})),il.Playlist.isAes(t)&&(this.tech_.trigger({type:"usage",name:"vhs-aes"}),this.tech_.trigger({type:"usage",name:"hls-aes"})),e.length&&1<Object.keys(n.AUDIO[e[0]]).length&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},i.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return function(e){var t=e.currentPlaylist,i=e.buffered,n=e.currentTime,r=e.nextPlaylist,a=e.bufferLowWaterLine,s=e.bufferHighWaterLine,o=e.duration,u=e.experimentalBufferBasedABR,l=e.log;if(!r)return qn.log.warn("We received no playlist to switch to. Please check your stream."),!1;var c="allowing switch "+(t&&t.id||"null")+" -> "+r.id;return t?!(r.id===t.id||(e=Boolean(no(i,n).length),t.endList?(i=uo(i,n),o<(n=u?Du.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Du.MAX_BUFFER_LOW_WATER_LINE)?(l(c+" as duration < max low water line ("+o+" < "+n+")"),0):(n=r.attributes.BANDWIDTH)<(r=t.attributes.BANDWIDTH)&&(!u||i<s)?(t=c+" as next bandwidth < current bandwidth ("+n+" < "+r+")",u&&(t+=" and forwardBuffer < bufferHighWaterLine ("+i+" < "+s+")"),l(t),0):(!u||r<n)&&a<=i?(a=c+" as forwardBuffer >= bufferLowWaterLine ("+i+" >= "+a+")",u&&(a+=" and next bandwidth > current bandwidth ("+n+" > "+r+")"),l(a),0):(l("not "+c+" as no switching criteria met"),1)):e||"number"!=typeof t.partTargetDuration?(l(c+" as current playlist is live"),0):(l("not "+c+" as current playlist is live llhls, but currentTime isn't in buffered."),1))):(l(c+" as current playlist is not set"),!0)}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},i.setupSegmentLoaderListeners_=function(){var e=this;function t(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)}this.experimentalBufferBasedABR||(this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist();e.shouldSwitchToMedia_(t)&&e.switchMedia_(t,"bandwidthupdate"),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")}))),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("appenderror",(function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("ended",(function(){e.logger_("main segment loader ended"),e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(t){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120))})),this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()}))},i.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},i.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},i.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},i.fastQualityChange_=function(e){var t=this;(e=void 0===e?this.selectPlaylist():e)!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((function(){qn.browser.IE_VERSION||qn.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")},i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}},i.setupFirstPlay=function(){var e=this,t=this.masterPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_)return!1;if(!t.endList){var i=this.seekable();if(!i.length)return!1;if(qn.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",(function(){e.trigger("firstplay"),e.tech_.setCurrentTime(i.end(0)),e.hasPlayed_=!0})),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(i.end(0))}return this.hasPlayed_=!0,this.load(),!0},i.handleSourceOpen_=function(){var e;this.tryToCreateSourceBuffers_(),!this.tech_.autoplay()||void 0!==(e=this.tech_.play())&&"function"==typeof e.then&&e.then(null,(function(e){})),this.trigger("sourceopen")},i.handleSourceEnded_=function(){var e,t;!this.inbandTextTracks_.metadataTrack_||(e=this.inbandTextTracks_.metadataTrack_.cues)&&e.length&&(t=this.duration(),e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t)},i.handleDurationChange_=function(){this.tech_.trigger("durationchange")},i.onEndOfStream=function(){var e,t=this.mainSegmentLoader_.ended_;(t=this.mediaTypes_.AUDIO.activePlaylistLoader?((e=this.mainSegmentLoader_.getCurrentMediaInfo_())&&!e.hasVideo||t)&&this.audioSegmentLoader_.ended_:t)&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())},i.stuckAtPlaylistEnd_=function(e){if(!this.seekable().length)return!1;if(null===(t=this.syncController_.getExpiredTime(e,this.duration())))return!1;var t,i=il.Playlist.playlistEnd(e,t);return e=this.tech_.currentTime(),(t=this.tech_.buffered()).length?(t=t.end(t.length-1))-e<=.1&&i-t<=.1:i-e<=.1},i.blacklistCurrentPlaylist=function(e,t){var i=(e=void 0===e?{}:e).playlist||this.masterPlaylistLoader_.media();if(t=t||e.blacklistDuration||this.blacklistDuration,!i)return this.error=e,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));i.playlistErrors_++;var n,r=this.masterPlaylistLoader_.master.playlists,a=r.filter(To),s=1===a.length&&a[0]===i;return 1===r.length&&t!==1/0?(qn.log.warn("Problem encountered with playlist "+i.id+". Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(s)):(s&&(n=!1,r.forEach((function(e){var t;e===i||void 0!==(t=e.excludeUntil)&&t!==1/0&&(n=!0,delete e.excludeUntil)})),n&&(qn.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))),a=i.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*t,i.excludeUntil=a,e.reason&&(i.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),(r=this.selectPlaylist())?(t=e.internal?this.logger_:qn.log.warn,a=e.message?" "+e.message:"",t((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+a+" Switching to playlist "+r.id+"."),r.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),r.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),a=r.targetDuration/2*1e3||5e3,a="number"==typeof r.lastRequest&&Date.now()-r.lastRequest<=a,this.switchMedia_(r,"exclude",s||a)):(this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error")))},i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},i.delegateLoaders_=function(e,t){var i=this,n=[],r="all"===e;!r&&"main"!==e||n.push(this.masterPlaylistLoader_);var a=[];!r&&"audio"!==e||a.push("AUDIO"),!r&&"subtitle"!==e||(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach((function(e){(e=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader)&&n.push(e)})),["main","audio","subtitle"].forEach((function(t){var r=i[t+"SegmentLoader_"];!r||e!==t&&"all"!==e||n.push(r)})),n.forEach((function(e){return t.forEach((function(t){"function"==typeof e[t]&&e[t]()}))}))},i.setCurrentTime=function(e){var t=no(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},i.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:il.Playlist.duration(e):1/0:0},i.seekable=function(){return this.seekable_},i.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n,r,a=this.masterPlaylistLoader_.master,s=il.Playlist.seekable(t,i,il.Playlist.liveEdgeDelay(a,t));if(0!==s.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=il.Playlist.seekable(t,i,il.Playlist.liveEdgeDelay(a,t))).length)return}this.seekable_&&this.seekable_.length&&(n=this.seekable_.end(0),r=this.seekable_.start(0)),!e||e.start(0)>s.end(0)||s.start(0)>e.end(0)?this.seekable_=s:this.seekable_=qn.createTimeRanges([[(e.start(0)>s.start(0)?e:s).start(0),(e.end(0)<s.end(0)?e:s).end(0)]]),this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===n&&this.seekable_.start(0)===r||(this.logger_("seekable updated ["+ao(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}},i.updateDuration=function(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){var t=this.seekable();return t.length?void((isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1))):void 0}e=this.tech_.buffered(),t=il.Playlist.duration(this.masterPlaylistLoader_.media()),0<e.length&&(t=Math.max(t,e.end(e.length-1))),this.mediaSource.duration!==t&&this.sourceUpdater_.setDuration(t)},i.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((function(t){var i,n=e.mediaTypes_[t].groups;for(i in n)n[i].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()},i.master=function(){return this.masterPlaylistLoader_.master},i.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},i.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_();return e=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_(),t&&e},i.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};t.video=t.main;var i=ou(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||gr)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r)&&(n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||gr,t.audio.isFmp4=(t.main.hasAudio&&!t.main.isMuxed?t.main:t.audio).isFmp4),n.audio||n.video){var a,s,o={};if(["video","audio"].forEach((function(e){var i;n.hasOwnProperty(e)&&!(t[e].isFmp4?ir:nr)(i=n[e])&&(i=t[e].isFmp4?"browser":"muxer",o[i]=o[i]||[],o[i].push(n[e]),"audio"===e&&(a=i))})),r&&a&&this.media().attributes.AUDIO&&(s=this.media().attributes.AUDIO,this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===s&&t!==e.media()&&(t.excludeUntil=1/0)})),this.logger_("excluding audio group "+s+" as "+a+' does not support codec(s): "'+n.audio+'"')),!Object.keys(o).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var u=[];if(["video","audio"].forEach((function(t){var i=(Zn(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(Zn(n[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&u.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+n[t]+'"')})),u.length)return void this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+u.join(", ")+".",blacklistDuration:1/0,internal:!0})}return n}r=Object.keys(o).reduce((function(e,t){return e&&(e+=", "),e+(t+' does not support codec(s): "')+o[t].join(",")+'"'}),"")+".",this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:r,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},i.tryToCreateSourceBuffers_=function(){var e;"open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_()||(e=this.getCodecsOrExclude_())&&(this.sourceUpdater_.createSourceBuffers(e),e=[e.video,e.audio].filter(Boolean).join(","),this.excludeIncompatibleVariants_(e))},i.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,i=[];Object.keys(t).forEach((function(n){var r,a=t[n];-1===i.indexOf(a.id)&&(i.push(a.id),r=[],!(n=ou(e.master,a)).audio||nr(n.audio)||ir(n.audio)||r.push("audio codec "+n.audio),!n.video||nr(n.video)||ir(n.video)||r.push("video codec "+n.video),n.text&&"stpp.ttml.im1t"===n.text&&r.push("text codec "+n.text),r.length&&(a.excludeUntil=1/0,e.logger_("excluding "+a.id+" for unsupported: "+r.join(", "))))}))},i.excludeIncompatibleVariants_=function(e){var t=this,i=[],n=this.master().playlists,r=su(e=au(Zn(e))),a=e.video&&Zn(e.video)[0]||null,s=e.audio&&Zn(e.audio)[0]||null;Object.keys(n).forEach((function(e){var o,u,l=n[e];-1===i.indexOf(l.id)&&l.excludeUntil!==1/0&&(i.push(l.id),o=[],e=su(u=ou(t.masterPlaylistLoader_.master,l)),(u.audio||u.video)&&(e!==r&&o.push('codec count "'+e+'" !== "'+r+'"'),t.sourceUpdater_.canChangeType()||(e=u.video&&Zn(u.video)[0]||null,u=u.audio&&Zn(u.audio)[0]||null,e&&a&&e.type.toLowerCase()!==a.type.toLowerCase()&&o.push('video codec "'+e.type+'" !== "'+a.type+'"'),u&&s&&u.type.toLowerCase()!==s.type.toLowerCase()&&o.push('audio codec "'+u.type+'" !== "'+s.type+'"')),o.length&&(l.excludeUntil=1/0,t.logger_("blacklisting "+l.id+": "+o.join(" && ")))))}))},i.updateAdCues_=function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i){if(void 0===i&&(i=0),e.segments)for(var n=i,r=0;r<e.segments.length;r++){var a,s,o,u=e.segments[r];if(o=o||function(e,t){for(var i=e.cues,n=0;n<i.length;n++){var r=i[n];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null}(t,n+u.duration/2)){if("cueIn"in u){o.endTime=n,o.adEndTime=n,n+=u.duration,o=null;continue}if(n<o.endTime){n+=u.duration;continue}o.endTime+=u.duration}else"cueOut"in u&&((o=new window.VTTCue(n,n+u.duration,u.cueOut)).adStartTime=n,o.adEndTime=n+parseFloat(u.cueOut),t.addCue(o)),"cueOutCont"in u&&(a=(s=u.cueOutCont.split("/").map(parseFloat))[0],s=s[1],(o=new window.VTTCue(n,n+u.duration,"")).adStartTime=n-a,o.adEndTime=o.adStartTime+s,t.addCue(o));n+=u.duration}}(e,this.cueTagsTrack_,t)},i.goalBufferLength=function(){var e=this.tech_.currentTime(),t=Du.GOAL_BUFFER_LENGTH,i=Du.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Du.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)},i.bufferLowWaterLine=function(){var e=this.tech_.currentTime(),t=Du.BUFFER_LOW_WATER_LINE,i=Du.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Du.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,Du.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.experimentalBufferBasedABR?r:n)},i.bufferHighWaterLine=function(){return Du.BUFFER_HIGH_WATER_LINE},t}(qn.EventTarget),Cl=["seeking","seeked","pause","playing","error"],Il=function(){function e(e){var t=this;function i(){return t.monitorCurrentTime_()}function n(){return t.monitorCurrentTime_()}function r(){return t.techWaiting_()}function a(){return t.cancelTimer_()}this.masterPlaylistController_=e.masterPlaylistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=to("PlaybackWatcher"),this.logger_("initialize");var s=this.masterPlaylistController_,o=["main","subtitle","audio"],u={};function l(e){["main","audio"].forEach((function(i){s[i+"SegmentLoader_"][e]("appended",t.seekingAppendCheck_)}))}o.forEach((function(e){u[e]={reset:function(){return t.resetSegmentDownloads_(e)},updateend:function(){return t.checkSegmentDownloads_(e)}},s[e+"SegmentLoader_"].on("appendsdone",u[e].updateend),s[e+"SegmentLoader_"].on("playlistupdate",u[e].reset),t.tech_.on(["seeked","seeking"],u[e].reset)})),this.seekingAppendCheck_=function(){t.fixesBadSeeks_()&&(t.consecutiveUpdates=0,t.lastRecordedTime=t.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=function(){return l("off")},this.watchForBadSeeking_=function(){t.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(Cl,a),this.tech_.on("canplay",n),this.tech_.one("play",i),this.dispose=function(){t.clearSeekingAppendCheck_(),t.logger_("dispose"),t.tech_.off("waiting",r),t.tech_.off(Cl,a),t.tech_.off("canplay",n),t.tech_.off("play",i),t.tech_.off("seeking",t.watchForBadSeeking_),t.tech_.off("seeked",t.clearSeekingAppendCheck_),o.forEach((function(e){s[e+"SegmentLoader_"].off("appendsdone",u[e].updateend),s[e+"SegmentLoader_"].off("playlistupdate",u[e].reset),t.tech_.off(["seeked","seeking"],u[e].reset)})),t.checkCurrentTimeTimeout_&&window.clearTimeout(t.checkCurrentTimeTimeout_),t.cancelTimer_()}}var t=e.prototype;return t.monitorCurrentTime_=function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)},t.resetSegmentDownloads_=function(e){var t=this.masterPlaylistController_[e+"SegmentLoader_"];0<this[e+"StalledDownloads_"]&&this.logger_("resetting possible stalled download count for "+e+" loader"),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0;return!1}(this[e+"Buffered_"],n);this[e+"Buffered_"]=n,r?this.resetSegmentDownloads_(e):(this[e+"StalledDownloads_"]++,this.logger_("found #"+this[e+"StalledDownloads_"]+" "+e+" appends that did not increase buffer (possible stalled download)",{playlistId:i.playlist_&&i.playlist_.id,buffered:so(n)}),this[e+"StalledDownloads_"]<10||(this.logger_(e+" loader stalled download exclusion"),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:"vhs-"+e+"-download-exclusion"}),"subtitle"!==e&&t.blacklistCurrentPlaylist({message:"Excessive "+e+" segment downloading detected."},1/0)))},t.checkCurrentTime_=function(){if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+.1>=t.end(t.length-1)))return this.techWaiting_();5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),i=this.tech_.currentTime();if(this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1)),void 0!==(e=this.beforeSeekableWindow_(t,i)?(a=t.start(0))+(a===t.end(0)?0:.1):e))return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+ao(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;for(var n=this.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered(),a=n.audioBuffer?n.audioBuffered():null,s=(t=n.videoBuffer?n.videoBuffered():null,(n=this.media()).partTargetDuration||2*(n.targetDuration-Su)),o=[a,t],u=0;u<o.length;u++)if(o[u]&&uo(o[u],i)<s)return!1;return 0!==(r=ro(r,i)).length&&(e=r.start(0)+.1,this.logger_("Buffered region starts ("+r.start(0)+") just beyond seek point ("+i+"). Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0)},t.waiting_=function(){var e,t;this.techWaiting_()||(e=this.tech_.currentTime(),(t=no(t=this.tech_.buffered(),e)).length&&e+3<=t.end(0)&&(this.cancelTimer_(),this.tech_.setCurrentTime(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+t.start(0)+" -> "+t.end(0)+"]. Attempting to resume playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"}),this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})))},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}return e=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,i=this.tech_.buffered(),this.videoUnderflow_({audioBuffered:e.audioBuffered(),videoBuffered:e.videoBuffered(),currentTime:t})?(this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0):0<(e=ro(i,t)).length&&(i=e.start(0)-t,this.logger_("Stopped at "+t+", setting timer for "+i+", seeking to "+e.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*i,t),!0)},t.afterSeekableWindow_=function(e,t,i,n){if(void 0===n&&(n=!1),!e.length)return!1;var r=e.end(e.length-1)+.1;return(r=!i.endList&&n?e.end(e.length-1)+3*i.targetDuration:r)<t},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&0<e.start(0)&&t<e.start(0)-this.liveRangeSafeTimeDelta)},t.videoUnderflow_=function(e){var t,i,n=e.videoBuffered,r=e.audioBuffered,a=e.currentTime;if(n)return n.length&&r.length?(i=no(n,a-3),e=no(n,a),(r=no(r,a)).length&&!e.length&&i.length&&(t={start:i.end(0),end:r.end(0)})):ro(n,a).length||(t=this.gapFromVideoUnderflow_(n,a)),!!t&&(this.logger_("Encountered a gap in video from "+t.start+" to "+t.end+". Seeking to current time "+a),!0)},t.skipTheGap_=function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime();t=ro(t,i),this.cancelTimer_(),0!==t.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",t.start(0)),this.tech_.setCurrentTime(t.start(0)+Su),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))},t.gapFromVideoUnderflow_=function(e,t){for(var i=function(e){if(e.length<2)return qn.createTimeRanges();for(var t=[],i=1;i<e.length;i++){var n=e.end(i-1),r=e.start(i);t.push([n,r])}return qn.createTimeRanges(t)}(e),n=0;n<i.length;n++){var r=i.start(n),a=i.end(n);if(t-r<4&&2<t-r)return{start:r,end:a}}return null},e}(),xl={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Al={PlaylistLoader:Iu,Playlist:Eu,utils:jt,STANDARD_PLAYLIST_SELECTOR:zn,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(Eu.isEnabled);return cu(t,du),t.filter((function(t){return!!ou(e.playlists.master,t).video}))[0]||null},lastBandwidthSelector:zn,movingAverageBandwidthSelector:function(e){var t=-1,i=-1;if(e<0||1<e)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var n=this.useDevicePixelRatio&&window.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),0<this.systemBandwidth&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),hu(this.playlists.master,t,parseInt(lu(this.tech_.el(),"width"),10)*n,parseInt(lu(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:du,comparePlaylistResolution:function(e,t){var i,n;return(i=(i=e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width?e.attributes.RESOLUTION.width:i)||window.Number.MAX_VALUE)===(n=(n=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width?t.attributes.RESOLUTION.width:n)||window.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:Uo()};function Pl(e,t){for(var i=t.media(),n=-1,r=0;r<e.length;r++)if(e[r].id===i.id){n=r;break}e.selectedIndex_=n,e.trigger({selectedIndex:n,type:"change"})}Object.keys(Du).forEach((function(e){Object.defineProperty(Al,e,{get:function(){return qn.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),Du[e]},set:function(t){qn.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?qn.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):Du[e]=t}})}));var Ll="videojs-vhs";function Dl(){if(!window.localStorage)return null;var e=window.localStorage.getItem(Ll);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}}Al.canPlaySource=function(){return qn.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")},Al.supportsNativeHls=function(){if(!document||!document.createElement)return!1;var e=document.createElement("video");return!!qn.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),Al.supportsNativeDash=!!(document&&document.createElement&&qn.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),Al.supportsTypeNatively=function(e){return"hls"===e?Al.supportsNativeHls:"dash"===e&&Al.supportsNativeDash},Al.isSupported=function(){return qn.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var Ol=function(e){function t(t,i,n){var r=e.call(this,i,qn.mergeOptions(n.hls,n.vhs))||this;if(n.hls&&Object.keys(n.hls).length&&qn.log.warn("Using hls options is deprecated. Please rename `hls` to `vhs` in your options object."),"number"==typeof n.initialBandwidth&&(r.options_.bandwidth=n.initialBandwidth),r.logger_=to("VhsHandler"),i.options_&&i.options_.playerId&&((n=qn(i.options_.playerId)).hasOwnProperty("hls")||Object.defineProperty(n,"hls",{get:function(){return qn.log.warn("player.hls is deprecated. Use player.tech().vhs instead."),i.trigger({type:"usage",name:"hls-player-access"}),ct(r)},configurable:!0}),n.hasOwnProperty("vhs")||Object.defineProperty(n,"vhs",{get:function(){return qn.log.warn("player.vhs is deprecated. Use player.tech().vhs instead."),i.trigger({type:"usage",name:"vhs-player-access"}),ct(r)},configurable:!0}),n.hasOwnProperty("dash")||Object.defineProperty(n,"dash",{get:function(){return qn.log.warn("player.dash is deprecated. Use player.tech().vhs instead."),ct(r)},configurable:!0}),r.player_=n),r.tech_=i,r.source_=t,r.stats={},r.ignoreNextSeekingEvent_=!1,r.setOptions_(),r.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(r.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return r.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(function(e){var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(r.tech_.el())?r.masterPlaylistController_.fastQualityChange_():r.masterPlaylistController_.checkABR_()})),r.on(r.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),r.on(r.tech_,"error",(function(){this.tech_.error()&&this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()})),r.on(r.tech_,"play",r.play),r}dt(t,e);var i=t.prototype;return i.setOptions_=function(){var e,t=this;this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.handleManifestRedirects=!1!==this.options_.handleManifestRedirects,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage&&((e=Dl())&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"}))),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=Du.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Du.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","experimentalBufferBasedABR","liveRangeSafeTimeDelta","experimentalLLHLS","useNetworkInformationApi","useDtsForTimestampOffset","experimentalExactManifestTimings","experimentalLeastPixelDiffSelector"].forEach((function(e){void 0!==t.source_[e]&&(t.options_[e]=t.source_[e])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio},i.src=function(e,t){var i=this;e&&(this.setOptions_(),this.options_.src=0===(e=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,this.options_.tech=this.tech_,this.options_.externVhs=Al,this.options_.sourceType=rr(t),this.options_.seekTo=function(e){i.tech_.setCurrentTime(e)},this.options_.smoothQualityChange&&qn.log.warn("smoothQualityChange is deprecated and will be removed in the next major version"),this.masterPlaylistController_=new kl(this.options_),t=qn.mergeOptions({liveRangeSafeTimeDelta:.1},this.options_,{seekable:function(){return i.seekable()},media:function(){return i.masterPlaylistController_.media()},masterPlaylistController:this.masterPlaylistController_}),this.playbackWatcher_=new Il(t),this.masterPlaylistController_.on("error",(function(){var e=qn.players[i.tech_.options_.playerId],t=i.masterPlaylistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)})),t=this.options_.experimentalBufferBasedABR?Al.movingAverageBandwidthSelector(.55):Al.STANDARD_PLAYLIST_SELECTOR,this.masterPlaylistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.masterPlaylistController_.selectInitialPlaylist=Al.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=e,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){var e=this.masterPlaylistController_.mainSegmentLoader_.bandwidth,t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;return this.options_.useNetworkInformationApi&&t?1e7<=(t=1e3*t.downlink*1e3)&&1e7<=e?Math.max(e,t):t:e},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e=1/(this.bandwidth||1),t=0<this.throughput?1/this.throughput:0;return Math.floor(1/(e+t))},set:function(){qn.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return i.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return i.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return i.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return so(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return so(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(window.localStorage){var t=(t=Dl())?qn.mergeOptions(t,e):e;try{window.localStorage.setItem(Ll,JSON.stringify(t))}catch(e){return}}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var e;(e=i).representations=function(){var t;return(t=Co(t=e.masterPlaylistController_.master())?e.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists)?t.filter((function(e){return!bo(e)})).map((function(t,i){return new el(e,t,t.id)})):[]}})),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",(function(){i.setupEme_()})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.masterPlaylistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_)))},i.createKeySessions_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),function(e){var t=e.player,i=e.sourceKeySystems,n=e.audioMedia;if(e=e.mainPlaylists,!t.eme.initializeMediaKeys)return Promise.resolve();e=e=n?e.concat([n]):e,r=Object.keys(i),e=e.reduce((function(e,t){if(!t.contentProtection)return e;var i=r.reduce((function(e,i){var n=t.contentProtection[i];return n&&n.pssh&&(e[i]={pssh:n.pssh}),e}),{});return Object.keys(i).length&&e.push(i),e}),[]);var r,a=[],s=[];return e.forEach((function(e){s.push(new Promise((function(e,i){t.tech_.one("keysessioncreated",e)}))),a.push(new Promise((function(i,n){t.eme.initializeMediaKeys({keySystems:e},(function(e){e?n(e):i()}))})))})),Promise.race([Promise.all(a),Promise.race(s)])}({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.master.playlists}).then((function(){e.logger_("created EME key session"),e.masterPlaylistController_.sourceUpdater_.initializedEme()})).catch((function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})}))},i.handleWaitingForKey_=function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()},i.setupEme_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;t=function(e){var t=e.player;return!(!(e=function(e,t,i){if(!e)return e;var n={};t&&t.attributes&&t.attributes.CODECS&&(n=au(Zn(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);var r,a=tr(n.video),s=tr(n.audio),o={};for(r in e)o[r]={},s&&(o[r].audioContentType=s),a&&(o[r].videoContentType=a),t.contentProtection&&t.contentProtection[r]&&t.contentProtection[r].pssh&&(o[r].pssh=t.contentProtection[r].pssh),"string"==typeof e[r]&&(o[r].url=e[r]);return qn.mergeOptions(e,o)}(e.sourceKeySystems,e.media,e.audioMedia))||(t.currentSource().keySystems=e)&&!t.eme&&(qn.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1))}({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()}),this.player_.tech_.on("keystatuschange",(function(t){"output-restricted"===t.status&&e.masterPlaylistController_.blacklistCurrentPlaylist({playlist:e.masterPlaylistController_.media(),message:"DRM keystatus changed to "+t.status+". Playlist will fail to play. Check for HDCP content.",blacklistDuration:1/0})})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==qn.browser.IE_VERSION&&t?this.createKeySessions_():this.masterPlaylistController_.sourceUpdater_.initializedEme()},i.setupQualityLevels_=function(){var e=this,t=qn.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach((function(e){t.addQualityLevel(e)})),Pl(t,i.playlists)})),this.playlists.on("mediachange",(function(){Pl(e.qualityLevels_,e.playlists)})))},t.version=function(){return{"@videojs/http-streaming":"2.14.2","mux.js":"6.0.1","mpd-parser":"0.21.1","m3u8-parser":"4.7.1","aes-decrypter":"3.1.3"}},i.version=function(){return this.constructor.version()},i.canChangeType=function(){return pl.canChangeType()},i.play=function(){this.masterPlaylistController_.play()},i.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},i.duration=function(){return this.masterPlaylistController_.duration()},i.seekable=function(){return this.masterPlaylistController_.seekable()},i.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),e.prototype.dispose.call(this)},i.convertToProgramTime=function(e,t){return function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i;if(!(i=e.callback))throw new Error("getProgramTime: callback must be provided");return t&&void 0!==n?(e=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i,n=0,r=0;r<t.segments.length&&!(e<=(n=(i=t.segments[r]).videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:n+i.duration));r++);var a=t.segments[t.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(n<e){if(e>n+.25*a.duration)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t))?"estimate"===e.type?i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:e.estimatedStart}):(t={mediaSeconds:n},(e=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds;return i=e-(t.videoTimingInfo.transmuxedPresentationStart+i),new Date(t.dateTimeObject.getTime()+1e3*i)}(n,e.segment))&&(t.programDateTime=e.toISOString()),i(null,t)):i({message:"valid programTime was not found"}):i({message:"getProgramTime: playlist and time must be provided"})}({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},i.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),Go({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},t}(qn.getComponent("Component")),Ml={name:"videojs-http-streaming",VERSION:"2.14.2",canHandleSource:function(e,t){return t=qn.mergeOptions(qn.options,t=void 0===t?{}:t),Ml.canPlayType(e.type,t)},handleSource:function(e,t,i){return i=qn.mergeOptions(qn.options,i=void 0===i?{}:i),t.vhs=new Ol(e,t,i),qn.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return qn.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=Uo(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){var i=qn.mergeOptions(qn.options,t=void 0===t?{}:t);return t=void 0===(t=(t=void 0===(t=i.vhs)?{}:t).overrideNative)?!qn.browser.IS_ANY_SAFARI:t,i=void 0!==(i=(i=void 0===(i=i.hls)?{}:i).overrideNative)&&i,(e=rr(e))&&(!Al.supportsTypeNatively(e)||i||t)?"maybe":""}};return ir("avc1.4d400d,mp4a.40.2")&&qn.getTech("Html5").registerSourceHandler(Ml,0),qn.VhsHandler=Ol,Object.defineProperty(qn,"HlsHandler",{get:function(){return qn.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),Ol},configurable:!0}),qn.VhsSourceHandler=Ml,Object.defineProperty(qn,"HlsSourceHandler",{get:function(){return qn.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),Ml},configurable:!0}),qn.Vhs=Al,Object.defineProperty(qn,"Hls",{get:function(){return qn.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),Al},configurable:!0}),qn.use||(qn.registerComponent("Hls",Al),qn.registerComponent("Vhs",Al)),qn.options.vhs=qn.options.vhs||{},qn.options.hls=qn.options.hls||{},qn.getPlugin&&qn.getPlugin("reloadSourceOnError")||(qn.registerPlugin||qn.plugin)("reloadSourceOnError",(function(e){tl(this,e)})),qn})); |