/**
 * @license
 * Video.js 7.10.2 <http://videojs.com/>
 * Copyright Brightcove, Inc. <https://www.brightcove.com/>
 * Available under Apache License Version 2.0
 * <https://github.com/videojs/video.js/blob/master/LICENSE>
 *
 * Includes vtt.js <https://github.com/mozilla/vtt.js>
 * Available under Apache License Version 2.0
 * <https://github.com/mozilla/vtt.js/blob/master/LICENSE>
 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define(["global/window","global/document"],t):(e=e||self).videojs=t(e.window,e.document)}(this,(function(e,t){"use strict";e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var i="7.10.2",n=[],r=function t(i){function r(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];a("log",s,t)}var a,s="info";return a=function(t,i){return function(r,a,s){var o=i.levels[a],u=new RegExp("^("+o+")$");if("log"!==r&&s.unshift(r.toUpperCase()+":"),s.unshift(t+":"),n){n.push([].concat(s));var l=n.length-1e3;n.splice(0,0<l?l:0)}if(e.console){var c=e.console[r];c||"debug"!==r||(c=e.console.info||e.console.log),c&&o&&u.test(r)&&c[Array.isArray(s)?"apply":"call"](e.console,s)}}}(i,r),r.createLogger=function(e){return t(i+": "+e)},r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:s},r.level=function(e){if("string"==typeof e){if(!r.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');s=e}return s},(r.history=function(){return n?[].concat(n):[]}).filter=function(e){return(n||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},r.history.clear=function(){n&&(n.length=0)},r.history.disable=function(){null!==n&&(n.length=0,n=null)},r.history.enable=function(){null===n&&(n=[])},r.error=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return a("error",s,t)},r.warn=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return a("warn",s,t)},r.debug=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return a("debug",s,t)},r}("VIDEOJS"),a=r.createLogger;function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e,t){return e(t={exports:{}},t.exports),t.exports}var u=o((function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},t.apply(this,arguments)}e.exports=t})),l=Object.prototype.toString,c=function(e){return p(e)?Object.keys(e):[]};function d(e,t){c(e).forEach((function(i){return t(e[i],i)}))}function h(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?u.apply(void 0,[e].concat(i)):(i.forEach((function(t){t&&d(t,(function(t,i){e[i]=t}))})),e)}function p(e){return!!e&&"object"==typeof e}function f(e){return p(e)&&"[object Object]"===l.call(e)&&e.constructor===Object}function m(t,i){if(!t||!i)return"";if("function"!=typeof e.getComputedStyle)return"";var n=e.getComputedStyle(t);return n?n.getPropertyValue(i)||n[i]:""}function g(e){return"string"==typeof e&&Boolean(e.trim())}function v(e){if(0<=e.indexOf(" "))throw new Error("class has illegal whitespace characters")}function y(){return t===e.document}function _(e){return p(e)&&1===e.nodeType}function b(){try{return e.parent!==e.self}catch(e){return!0}}function T(e){return function(i,n){if(!g(i))return t[e](null);g(n)&&(n=t.querySelector(n));var r=_(n)?n:t;return r[e]&&r[e](i)}}function S(e,i,n,a){void 0===e&&(e="div"),void 0===i&&(i={}),void 0===n&&(n={});var s=t.createElement(e);return Object.getOwnPropertyNames(i).forEach((function(e){var t=i[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(r.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 "+t+"."),s.setAttribute(e,t)):"textContent"===e?k(s,t):s[e]!==t&&(s[e]=t)})),Object.getOwnPropertyNames(n).forEach((function(e){s.setAttribute(e,n[e])})),a&&q(s,a),s}function k(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function C(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function E(e,t){return v(t),e.classList?e.classList.contains(t):function(e){return new RegExp("(^|\\s)"+e+"($|\\s)")}(t).test(e.className)}function w(e,t){return e.classList?e.classList.add(t):E(e,t)||(e.className=(e.className+" "+t).trim()),e}function I(e,t){return e.classList?e.classList.remove(t):(v(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e}function A(e,t,i){var n=E(e,t);if("function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=!n),i!==n)return i?w(e,t):I(e,t),e}function x(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 P(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 L(e,t){return e.getAttribute(t)}function D(e,t,i){e.setAttribute(t,i)}function O(e,t){e.removeAttribute(t)}function R(){t.body.focus(),t.onselectstart=function(){return!1}}function M(){t.onselectstart=function(){return!0}}function N(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(m(e,"height"))),i.width||(i.width=parseFloat(m(e,"width"))),i}}function U(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;n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;);return{left:n,top:r,width:t,height:i}}function F(e,t){var i={},n=U(t.target),r=U(e),a=r.width,s=r.height,o=t.offsetY-(r.top-n.top),u=t.offsetX-(r.left-n.left);return t.changedTouches&&(u=t.changedTouches[0].pageX-r.left,o=t.changedTouches[0].pageY+r.top),i.y=1-Math.max(0,Math.min(1,o/s)),i.x=Math.max(0,Math.min(1,u/a)),i}function B(e){return p(e)&&3===e.nodeType}function j(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function V(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return"function"==typeof e&&(e=e()),_(e)||B(e)?e:"string"==typeof e&&/\S/.test(e)?t.createTextNode(e):void 0})).filter((function(e){return e}))}function q(e,t){return V(t).forEach((function(t){return e.appendChild(t)})),e}function H(e,t){return q(j(e),t)}function W(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 z,G=T("querySelector"),K=T("querySelectorAll"),X=Object.freeze({__proto__:null,isReal:y,isEl:_,isInFrame:b,createEl:S,textContent:k,prependTo:C,hasClass:E,addClass:w,removeClass:I,toggleClass:A,setAttributes:x,getAttributes:P,getAttribute:L,setAttribute:D,removeAttribute:O,blockTextSelection:R,unblockTextSelection:M,getBoundingClientRect:N,findPosition:U,getPointerPosition:F,isTextNode:B,emptyEl:j,normalizeContent:V,appendContent:q,insertContent:H,isSingleLeftClick:W,$:G,$$:K}),Y=!1,$=function(){if(y()&&!1!==z.options.autoSetup){var e=Array.prototype.slice.call(t.getElementsByTagName("video")),i=Array.prototype.slice.call(t.getElementsByTagName("audio")),n=Array.prototype.slice.call(t.getElementsByTagName("video-js")),r=e.concat(i,n);if(r&&0<r.length)for(var a=0,s=r.length;a<s;a++){var o=r[a];if(!o||!o.getAttribute){Q(1);break}void 0===o.player&&null!==o.getAttribute("data-setup")&&z(o)}else Y||Q(1)}};function Q(t,i){i&&(z=i),e.setTimeout($,t)}function J(){Y=!0,e.removeEventListener("load",J)}function Z(e){var i=t.createElement("style");return i.className=e,i}function ee(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t}y()&&("complete"===t.readyState?J():e.addEventListener("load",J));var te,ie=3;function ne(){return ie++}e.WeakMap||(te=function(){function t(){this.vdata="vdata"+Math.floor(e.performance&&e.performance.now()||Date.now()),this.data={}}var i=t.prototype;return i.set=function(e,t){var i=e[this.vdata]||ne();return e[this.vdata]||(e[this.vdata]=i),this.data[i]=t,this},i.get=function(e){var t=e[this.vdata];if(t)return this.data[t];r("We have no data for this element",e)},i.has=function(e){return e[this.vdata]in this.data},i.delete=function(e){var t=e[this.vdata];t&&(delete this.data[t],delete e[this.vdata])},t}());var re,ae=e.WeakMap?new WeakMap:new te;function se(e,t){if(ae.has(e)){var i=ae.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&ae.delete(e)}}function oe(e,t,i,n){i.forEach((function(i){e(t,i,n)}))}function ue(i){if(i.fixed_)return i;function n(){return!0}function r(){return!1}if(!i||!i.isPropagationStopped){var a=i||e.event;for(var s in i={},a)"layerX"!==s&&"layerY"!==s&&"keyLocation"!==s&&"webkitMovementX"!==s&&"webkitMovementY"!==s&&("returnValue"===s&&a.preventDefault||(i[s]=a[s]));if(i.target||(i.target=i.srcElement||t),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){a.preventDefault&&a.preventDefault(),i.returnValue=!1,a.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){a.stopPropagation&&a.stopPropagation(),i.cancelBubble=!0,a.cancelBubble=!0,i.isPropagationStopped=n},i.isPropagationStopped=r,i.stopImmediatePropagation=function(){a.stopImmediatePropagation&&a.stopImmediatePropagation(),i.isImmediatePropagationStopped=n,i.stopPropagation()},i.isImmediatePropagationStopped=r,null!==i.clientX&&void 0!==i.clientX){var o=t.documentElement,u=t.body;i.pageX=i.clientX+(o&&o.scrollLeft||u&&u.scrollLeft||0)-(o&&o.clientLeft||u&&u.clientLeft||0),i.pageY=i.clientY+(o&&o.scrollTop||u&&u.scrollTop||0)-(o&&o.clientTop||u&&u.clientTop||0)}i.which=i.charCode||i.keyCode,null!==i.button&&void 0!==i.button&&(i.button=1&i.button?0:4&i.button?1:2&i.button?2:0)}return i.fixed_=!0,i}var le=function(){if("boolean"!=typeof re){re=!1;try{var t=Object.defineProperty({},"passive",{get:function(){re=!0}});e.addEventListener("test",null,t),e.removeEventListener("test",null,t)}catch(t){}}return re},ce=["touchstart","touchmove"];function de(e,t,i){if(Array.isArray(t))return oe(de,e,t,i);ae.has(e)||ae.set(e,{});var n=ae.get(e);if(n.handlers||(n.handlers={}),n.handlers[t]||(n.handlers[t]=[]),i.guid||(i.guid=ne()),n.handlers[t].push(i),n.dispatcher||(n.disabled=!1,n.dispatcher=function(t,i){if(!n.disabled){t=ue(t);var a=n.handlers[t.type];if(a)for(var s=a.slice(0),o=0,u=s.length;o<u&&!t.isImmediatePropagationStopped();o++)try{s[o].call(e,t,i)}catch(t){r.error(t)}}}),1===n.handlers[t].length)if(e.addEventListener){var a=!1;le()&&-1<ce.indexOf(t)&&(a={passive:!0}),e.addEventListener(t,n.dispatcher,a)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function he(e,t,i){if(ae.has(e)){var n=ae.get(e);if(n.handlers){if(Array.isArray(t))return oe(he,e,t,i);var r=function(e,t){n.handlers[t]=[],se(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);se(e,t)}else r(e,t)}else for(var o in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},o)&&r(e,o)}}}function pe(e,t,i){var n=ae.has(e)?ae.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=ue(t),n.dispatcher&&n.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles)pe.call(null,r,t,i);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){ae.has(t.target)||ae.set(t.target,{});var a=ae.get(t.target);t.target[t.type]&&(a.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),a.disabled=!1)}return!t.defaultPrevented}function fe(e,t,i){if(Array.isArray(t))return oe(fe,e,t,i);function n(){he(e,t,n),i.apply(this,arguments)}n.guid=i.guid=i.guid||ne(),de(e,t,n)}function me(e,t,i){function n(){he(e,t,n),i.apply(this,arguments)}n.guid=i.guid=i.guid||ne(),de(e,t,n)}function ge(e,t,i){t.guid||(t.guid=ne());var n=t.bind(e);return n.guid=i?i+"_"+t.guid:t.guid,n}function ve(t,i){var n=e.performance.now();return function(){var r=e.performance.now();i<=r-n&&(t.apply(void 0,arguments),n=r)}}function ye(){}var _e,be=Object.freeze({__proto__:null,fixEvent:ue,on:de,off:he,trigger:pe,one:fe,any:me});function Te(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length}function Se(e){if(!e.nodeName&&!Ie(e))throw new Error("Invalid target; must be a DOM node or evented object.")}function ke(e){if(!Te(e))throw new Error("Invalid event type; must be a non-empty string or array.")}function Ce(e){if("function"!=typeof e)throw new Error("Invalid listener; must be a function.")}function Ee(e,t){var i,n,r,a=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return r=a?(i=e.eventBusEl_,3<=t.length&&t.shift(),n=t[0],t[1]):(i=t[0],n=t[1],t[2]),Se(i),ke(n),Ce(r),{isTargetingSelf:a,target:i,type:n,listener:r=ge(e,r)}}function we(e,t,i,n){Se(e),e.nodeName?be[t](e,i,n):e[t](i,n)}ye.prototype.allowedEvents_={},ye.prototype.addEventListener=ye.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},de(this,e,t),this.addEventListener=i},ye.prototype.removeEventListener=ye.prototype.off=function(e,t){he(this,e,t)},ye.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},fe(this,e,t),this.addEventListener=i},ye.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},me(this,e,t),this.addEventListener=i},ye.prototype.dispatchEvent=ye.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=ue(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),pe(this,e)},ye.prototype.queueTrigger=function(t){var i=this;_e=_e||new Map;var n=t.type||t,r=_e.get(this);r||(r=new Map,_e.set(this,r));var a=r.get(n);r.delete(n),e.clearTimeout(a);var s=e.setTimeout((function(){0===r.size&&(r=null,_e.delete(i)),i.trigger(t)}),0);r.set(n,s)};var Ie=function(e){return e instanceof ye||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"==typeof e[t]}))},Ae={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Ee(this,i),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(we(s,"on",o,u),!a){var l=function(){return e.off(s,o,u)};l.guid=u.guid;var c=function(){return e.off("dispose",l)};c.guid=u.guid,we(this,"on","dispose",l),we(s,"on","dispose",c)}},one:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Ee(this,i),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)we(s,"one",o,u);else{var l=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)};l.guid=u.guid,we(s,"one",o,l)}},any:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Ee(this,i),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)we(s,"any",o,u);else{var l=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)};l.guid=u.guid,we(s,"any",o,l)}},off:function(e,t,i){if(!e||Te(e))he(this.eventBusEl_,e,t);else{var n=e,r=t;Se(n),ke(r),Ce(i),i=ge(this,i),this.off("dispose",i),n.nodeName?(he(n,r,i),he(n,"dispose",i)):Ie(n)&&(n.off(r,i),n.off("dispose",i))}},trigger:function(e,t){return pe(this.eventBusEl_,e,t)}};function xe(t,i){void 0===i&&(i={});var n=i.eventBusKey;if(n){if(!t[n].nodeName)throw new Error('The eventBusKey "'+n+'" does not refer to an element.');t.eventBusEl_=t[n]}else t.eventBusEl_=S("span",{className:"vjs-event-bus"});return h(t,Ae),t.eventedCallbacks&&t.eventedCallbacks.forEach((function(e){e()})),t.on("dispose",(function(){t.off(),e.setTimeout((function(){t.eventBusEl_=null}),0)})),t}var Pe={state:{},setState:function(e){var t,i=this;return"function"==typeof e&&(e=e()),d(e,(function(e,n){i.state[n]!==e&&((t=t||{})[n]={from:i.state[n],to:e}),i.state[n]=e})),t&&Ie(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function Le(e,t){return h(e,Pe),e.state=h({},e.state,t),"function"==typeof e.handleStateChanged&&Ie(e)&&e.on("statechanged",e.handleStateChanged),e}function De(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toLowerCase()}))}function Oe(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))}function Re(){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&&d(t,(function(t,i){f(t)?(f(e[i])||(e[i]={}),e[i]=Re(e[i],t)):e[i]=t}))})),e}var Me=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.set_[e]=t,this},t.forEach=function(e,t){for(var i in this.map_)e.call(t,this.map_[i],i,this)},e}(),Ne=e.Map?e.Map:Me,Ue=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}(),Fe=e.Set?e.Set:Ue,Be=function(){function t(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Re({},this.options_),t=this.options_=Re(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){var n=e&&e.id&&e.id()||"no_player";this.id_=n+"_component_"+ne()}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),!1!==t.evented&&xe(this,{eventBusKey:this.el_?"el_":null}),Le(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Fe,this.setIntervalIds_=new Fe,this.rafIds_=new Fe,this.namedRafs_=new Ne,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var i=t.prototype;return i.dispose=function(){if(!this.isDisposed_){if(this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),ae.has(this.el_)&&ae.delete(this.el_),this.el_=null),this.player_=null}},i.isDisposed=function(){return Boolean(this.isDisposed_)},i.player=function(){return this.player_},i.options=function(e){return e&&(this.options_=Re(this.options_,e)),this.options_},i.el=function(){return this.el_},i.createEl=function(e,t,i){return S(e,t,i)},i.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],s=n&&n.split("-")[0],o=r&&r[s],u=i;return a&&a[e]?u=a[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,(function(e,i){var n=t[i-1],r=n;return void 0===n&&(r=e),r}))),u},i.contentEl=function(){return this.contentEl_||this.el_},i.id=function(){return this.id_},i.name=function(){return this.name_},i.children=function(){return this.children_},i.getChildById=function(e){return this.childIndex_[e]},i.getChild=function(e){if(e)return this.childNameIndex_[e]},i.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},i.addChild=function(e,i,n){var r,a;if(void 0===i&&(i={}),void 0===n&&(n=this.children_.length),"string"==typeof e){a=Oe(e);var s=i.componentClass||a;i.name=a;var o=t.getComponent(s);if(!o)throw new Error("Component "+s+" does not exist");if("function"!=typeof o)return null;r=new o(this.player_||this,i)}else r=e;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,"function"==typeof r.id&&(this.childIndex_[r.id()]=r),(a=a||r.name&&Oe(r.name()))&&(this.childNameIndex_[a]=r,this.childNameIndex_[De(a)]=r),"function"==typeof r.el&&r.el()){var u=null;this.children_[n+1]&&(this.children_[n+1].el_?u=this.children_[n+1].el_:_(this.children_[n+1])&&(u=this.children_[n+1])),this.contentEl().insertBefore(r.el(),u)}return r},i.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,i=this.children_.length-1;0<=i;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Oe(e.name())]=null,this.childNameIndex_[De(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},i.initChildren=function(){var e=this,i=this.options_.children;if(i){var n,r=this.options_,a=t.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((function(t){var n,r;return r="string"==typeof t?i[n=t]||e.options_[n]||{}:(n=t.name,t),{name:n,opts:r}})).filter((function(e){var i=t.getComponent(e.opts.componentClass||Oe(e.name));return i&&!a.isTech(i)})).forEach((function(t){var i=t.name,n=t.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=e.options_.playerOptions;var a=e.addChild(i,n);a&&(e[i]=a)}}))}},i.buildCSSClass=function(){return""},i.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))},i.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)},i.$=function(e,t){return G(e,t||this.contentEl())},i.$$=function(e,t){return K(e,t||this.contentEl())},i.hasClass=function(e){return E(this.el_,e)},i.addClass=function(e){w(this.el_,e)},i.removeClass=function(e){I(this.el_,e)},i.toggleClass=function(e,t){A(this.el_,e,t)},i.show=function(){this.removeClass("vjs-hidden")},i.hide=function(){this.addClass("vjs-hidden")},i.lockShowing=function(){this.addClass("vjs-lock-showing")},i.unlockShowing=function(){this.removeClass("vjs-lock-showing")},i.getAttribute=function(e){return L(this.el_,e)},i.setAttribute=function(e,t){D(this.el_,e,t)},i.removeAttribute=function(e){O(this.el_,e)},i.width=function(e,t){return this.dimension("width",e,t)},i.height=function(e,t){return this.dimension("height",e,t)},i.dimensions=function(e,t){this.width(e,!0),this.height(t)},i.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+Oe(e)],10)},i.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=m(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+Oe(e);t=this.el_[i]}return t},i.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},i.currentWidth=function(){return this.currentDimension("width")},i.currentHeight=function(){return this.currentDimension("height")},i.focus=function(){this.el_.focus()},i.blur=function(){this.el_.blur()},i.handleKeyDown=function(e){this.player_&&(e.stopPropagation(),this.player_.handleKeyDown(e))},i.handleKeyPress=function(e){this.handleKeyDown(e)},i.emitTapEvents=function(){var t,i=0,n=null;function r(){t=!1}this.on("touchstart",(function(r){1===r.touches.length&&(n={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY},i=e.performance.now(),t=!0)})),this.on("touchmove",(function(e){if(1<e.touches.length)t=!1;else if(n){var i=e.touches[0].pageX-n.pageX,r=e.touches[0].pageY-n.pageY;10<Math.sqrt(i*i+r*r)&&(t=!1)}})),this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",(function(r){!(n=null)===t&&e.performance.now()-i<200&&(r.preventDefault(),this.trigger("tap"))}))},i.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=ge(this.player(),this.player().reportUserActivity);this.on("touchstart",(function(){t(),this.clearInterval(e),e=this.setInterval(t,250)}));var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},i.setTimeout=function(t,i){var n,r=this;return t=ge(this,t),this.clearTimersOnDispose_(),n=e.setTimeout((function(){r.setTimeoutIds_.has(n)&&r.setTimeoutIds_.delete(n),t()}),i),this.setTimeoutIds_.add(n),n},i.clearTimeout=function(t){return this.setTimeoutIds_.has(t)&&(this.setTimeoutIds_.delete(t),e.clearTimeout(t)),t},i.setInterval=function(t,i){t=ge(this,t),this.clearTimersOnDispose_();var n=e.setInterval(t,i);return this.setIntervalIds_.add(n),n},i.clearInterval=function(t){return this.setIntervalIds_.has(t)&&(this.setIntervalIds_.delete(t),e.clearInterval(t)),t},i.requestAnimationFrame=function(t){var i,n=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),t=ge(this,t),i=e.requestAnimationFrame((function(){n.rafIds_.has(i)&&n.rafIds_.delete(i),t()})),this.rafIds_.add(i),i):this.setTimeout(t,1e3/60)},i.requestNamedAnimationFrame=function(e,t){var i=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=ge(this,t);var n=this.requestAnimationFrame((function(){t(),i.namedRafs_.has(e)&&i.namedRafs_.delete(e)}));return this.namedRafs_.set(e,n),e}},i.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},i.cancelAnimationFrame=function(t){return this.supportsRaf_?(this.rafIds_.has(t)&&(this.rafIds_.delete(t),e.cancelAnimationFrame(t)),t):this.clearTimeout(t)},i.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})))},t.registerComponent=function(e,i){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var n=t.getComponent("Tech"),r=n&&n.isTech(i),a=t===i||t.prototype.isPrototypeOf(i.prototype);if(r||!a)throw new Error('Illegal component, "'+e+'"; '+(r?"techs must be registered using Tech.registerTech()":"must be a Component subclass")+".");e=Oe(e),t.components_||(t.components_={});var s=t.getComponent("Player");if("Player"===e&&s&&s.players){var o=s.players,u=Object.keys(o);if(o&&0<u.length&&u.map((function(e){return o[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return t.components_[e]=i,t.components_[De(e)]=i},t.getComponent=function(e){if(e&&t.components_)return t.components_[e]},t}();Be.prototype.supportsRaf_="function"==typeof e.requestAnimationFrame&&"function"==typeof e.cancelAnimationFrame,Be.registerComponent("Component",Be);var je=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};o((function(e){function t(i){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(i)}e.exports=t})),o((function(e){function t(i){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(i)}e.exports=t}));var Ve,qe,He,We,ze=function(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t},Ge=e.navigator&&e.navigator.userAgent||"",Ke=/AppleWebKit\/([\d.]+)/i.exec(Ge),Xe=Ke?parseFloat(Ke.pop()):null,Ye=/iPod/i.test(Ge),$e=(Ve=Ge.match(/OS (\d+)_/i))&&Ve[1]?Ve[1]:null,Qe=/Android/i.test(Ge),Je=function(){var e=Ge.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}(),Ze=Qe&&Je<5&&Xe<537,et=/Firefox/i.test(Ge),tt=/Edg/i.test(Ge),it=!tt&&(/Chrome/i.test(Ge)||/CriOS/i.test(Ge)),nt=(qe=Ge.match(/(Chrome|CriOS)\/(\d+)/))&&qe[2]?parseFloat(qe[2]):null,rt=(!(We=(He=/MSIE\s(\d+)\.\d/.exec(Ge))&&parseFloat(He[1]))&&/Trident\/7.0/i.test(Ge)&&/rv:11.0/.test(Ge)&&(We=11),We),at=/Safari/i.test(Ge)&&!it&&!Qe&&!tt,st=/Windows/i.test(Ge),ot=y()&&("ontouchstart"in e||e.navigator.maxTouchPoints||e.DocumentTouch&&e.document instanceof e.DocumentTouch),ut=/iPad/i.test(Ge)||at&&ot&&!/iPhone/i.test(Ge),lt=/iPhone/i.test(Ge)&&!ut,ct=lt||ut||Ye,dt=(at||ct)&&!it,ht=Object.freeze({__proto__:null,IS_IPOD:Ye,IOS_VERSION:$e,IS_ANDROID:Qe,ANDROID_VERSION:Je,IS_NATIVE_ANDROID:Ze,IS_FIREFOX:et,IS_EDGE:tt,IS_CHROME:it,CHROME_VERSION:nt,IE_VERSION:rt,IS_SAFARI:at,IS_WINDOWS:st,TOUCH_ENABLED:ot,IS_IPAD:ut,IS_IPHONE:lt,IS_IOS:ct,IS_ANY_SAFARI:dt});function pt(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 ft(e){return void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:pt.bind(null,"start",0,e),end:pt.bind(null,"end",1,e)}}function mt(e,t){return Array.isArray(e)?ft(e):void 0===e||void 0===t?ft():ft([[e,t]])}function gt(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=mt(0,0));for(var a=0;a<e.length;a++)i=e.start(a),t<(n=e.end(a))&&(n=t),r+=n-i;return r/t}for(var vt,yt={prefixed:!0},_t=[["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"]],bt=_t[0],Tt=0;Tt<_t.length;Tt++)if(_t[Tt][1]in t){vt=_t[Tt];break}if(vt){for(var St=0;St<vt.length;St++)yt[bt[St]]=vt[St];yt.prefixed=vt[0]!==bt[0]}function kt(e){if(e instanceof kt)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:p(e)&&("number"==typeof e.code&&(this.code=e.code),h(this,e)),this.message||(this.message=kt.defaultMessages[this.code]||"")}kt.prototype.code=0,kt.prototype.message="",kt.prototype.status=null,kt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],kt.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 Ct=0;Ct<kt.errorTypes.length;Ct++)kt[kt.errorTypes[Ct]]=Ct,kt.prototype[kt.errorTypes[Ct]]=Ct;function Et(e){return null!=e&&"function"==typeof e.then}function wt(e){Et(e)&&e.then(null,(function(e){}))}function It(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 At=o((function(e,t){function i(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return s[e];var i,a=String(e);return(i=n[a.toLowerCase()])?i:(i=r[a.toLowerCase()])||(1===a.length?a.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){var a;if(a=n[t.toLowerCase()])return a===i;if(a=r[t.toLowerCase()])return a===i}else if("number"==typeof t)return t===i;return!1}};var n=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(a=97;a<123;a++)n[String.fromCharCode(a)]=a-32;for(var 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=t.names=t.title={};for(a in n)s[n[a]]=a;for(var o in r)n[o]=r[o]})),xt=(At.code,At.codes,At.aliases,At.names,At.title,"vjs-modal-dialog"),Pt=function(i){function n(e,t){var n;return(n=i.call(this,e,t)||this).opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1,n.closeable(!n.options_.uncloseable),n.content(n.options_.content),n.contentEl_=S("div",{className:xt+"-content"},{role:"document"}),n.descEl_=S("p",{className:xt+"-description vjs-control-text",id:n.el().getAttribute("aria-describedby")}),k(n.descEl_,n.description()),n.el_.appendChild(n.descEl_),n.el_.appendChild(n.contentEl_),n}ze(n,i);var r=n.prototype;return r.createEl=function(){return i.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},r.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,i.prototype.dispose.call(this)},r.buildCSSClass=function(){return xt+" vjs-hidden "+i.prototype.buildCSSClass.call(this)},r.label=function(){return this.localize(this.options_.label||"Modal Window")},r.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},r.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},r.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},r.close=function(){if(this.opened_){var e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},r.closeable=function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,i=this.getChild("closeButton");if(t&&!i){var n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close)}!t&&i&&(this.off(i,"close",this.close),this.removeChild(i),i.dispose())}return this.closeable_},r.fill=function(){this.fillWith(this.content())},r.fillWith=function(e){var t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),H(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);var r=this.getChild("closeButton");r&&i.appendChild(r.el_)},r.empty=function(){this.trigger("beforemodalempty"),j(this.contentEl()),this.trigger("modalempty")},r.content=function(e){return void 0!==e&&(this.content_=e),this.content_},r.conditionalFocus_=function(){var e=t.activeElement,i=this.player_.el_;this.previouslyActiveEl_=null,!i.contains(e)&&i!==e||(this.previouslyActiveEl_=e,this.focus())},r.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},r.handleKeyDown=function(e){if(e.stopPropagation(),At.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(At.isEventKey(e,"Tab")){for(var i,n=this.focusableEls_(),r=this.el_.querySelector(":focus"),a=0;a<n.length;a++)if(r===n[a]){i=a;break}t.activeElement===this.el_&&(i=0),e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}},r.focusableEls_=function(){var t=this.el_.querySelectorAll("*");return Array.prototype.filter.call(t,(function(t){return(t instanceof e.HTMLAnchorElement||t instanceof e.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof e.HTMLInputElement||t instanceof e.HTMLSelectElement||t instanceof e.HTMLTextAreaElement||t instanceof e.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof e.HTMLIFrameElement||t instanceof e.HTMLObjectElement||t instanceof e.HTMLEmbedElement||t.hasAttribute("tabindex")&&-1!==t.getAttribute("tabindex")||t.hasAttribute("contenteditable")}))},n}(Be);Pt.prototype.options_={pauseOnOpen:!0,temporary:!0},Be.registerComponent("ModalDialog",Pt);var Lt=function(e){function t(t){var i;void 0===t&&(t=[]),(i=e.call(this)||this).tracks_=[],Object.defineProperty(je(i),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<t.length;n++)i.addTrack(t[n]);return i}ze(t,e);var i=t.prototype;return i.addTrack=function(e){var t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.tracks_[t]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this}))},i.removeTrack=function(e){for(var t,i=0,n=this.length;i<n;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},i.getTrackById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},t}(ye);for(var Dt in Lt.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"},Lt.prototype.allowedEvents_)Lt.prototype["on"+Dt]=null;function Ot(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 Rt(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 Mt(i){var n=["protocol","hostname","port","pathname","search","hash","host"],r=t.createElement("a");r.href=i;var a,s=""===r.host&&"file:"!==r.protocol;s&&((a=t.createElement("div")).innerHTML='<a href="'+i+'"></a>',r=a.firstChild,a.setAttribute("style","display:none; position:absolute;"),t.body.appendChild(a));for(var o={},u=0;u<n.length;u++)o[n[u]]=r[n[u]];return"http:"===o.protocol&&(o.host=o.host.replace(/:80$/,"")),"https:"===o.protocol&&(o.host=o.host.replace(/:443$/,"")),o.protocol||(o.protocol=e.location.protocol),s&&t.body.removeChild(a),o}function Nt(e){if(!e.match(/^https?:\/\//)){var i=t.createElement("div");i.innerHTML='<a href="'+e+'">x</a>',e=i.firstChild.href}return e}function Ut(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""}function Ft(t,i){void 0===i&&(i=e.location);var n=Mt(t);return(":"===n.protocol?i.protocol:n.protocol)+n.host!==i.protocol+i.host}var Bt=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;0<=n;n--)if(t[n].enabled){Ot(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}ze(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&Ot(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,Ot(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}(Lt),jt=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;0<=n;n--)if(t[n].selected){Rt(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(je(i),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),i}ze(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.selected&&Rt(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,Rt(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}(Lt),Vt=function(e){function t(){return e.apply(this,arguments)||this}ze(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}(Lt),qt=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}(),Ht=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}(),Wt={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},zt={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Gt={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Kt={disabled:"disabled",hidden:"hidden",showing:"showing"},Xt=function(e){function t(t){var i;function n(e){Object.defineProperty(je(i),e,{get:function(){return r[e]},set:function(){}})}void 0===t&&(t={}),i=e.call(this)||this;var r={id:t.id||"vjs_track_"+ne(),kind:t.kind||"",label:t.label||"",language:t.language||""};for(var a in r)n(a);return i}return ze(t,e),t}(ye),Yt=Object.freeze({__proto__:null,parseUrl:Mt,getAbsoluteURL:Nt,getFileExtension:Ut,isCrossOrigin:Ft}),$t=function(e){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)}
/**
         * @license
         * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
         * Copyright (c) 2014 David Björklund
         * Available under the MIT license
         * <https://github.com/kesla/parse-headers/blob/master/LICENCE>
         */,Qt=Object.prototype.toString,Jt=function(e){var t={};return e&&e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();void 0===t[n]?t[n]=r:Array.isArray(t[n])?t[n].push(r):t[n]=[t[n],r]})),t},Zt=ii,ei=ii;function ti(e,t,i){var n=e;return $t(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=u({},t,{uri:e}),n.callback=i,n}function ii(e,t,i){return ni(t=ti(e,t,i))}function ni(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(e){return clearTimeout(o),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,m)}function r(){if(!s){var t;clearTimeout(o),t=e.useXDR&&void 0===u.status?200:1223===u.status?204:u.status;var n=m,r=null;return 0!==t?(n={body:function(){var e=void 0;if(e=u.response?u.response:u.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(u),f)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:c,headers:{},url:l,rawRequest:u},u.getAllResponseHeaders&&(n.headers=Jt(u.getAllResponseHeaders()))):r=new Error("Internal XMLHttpRequest Error"),i(r,n,n.body)}}var a,s,o,u=e.xhr||null,l=(u=u||(e.cors||e.useXDR?new ii.XDomainRequest:new ii.XMLHttpRequest)).url=e.uri||e.url,c=u.method=e.method||"GET",d=e.body||e.data,h=u.headers=e.headers||{},p=!!e.sync,f=!1,m={body:void 0,headers:{},statusCode:0,method:c,url:l,rawRequest:u};if("json"in e&&!1!==e.json&&(f=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==c&&"HEAD"!==c&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),d=JSON.stringify(!0===e.json?d:e.json))),u.onreadystatechange=function(){4===u.readyState&&setTimeout(r,0)},u.onload=r,u.onerror=n,u.onprogress=function(){},u.onabort=function(){s=!0},u.ontimeout=n,u.open(c,l,!p,e.username,e.password),p||(u.withCredentials=!!e.withCredentials),!p&&0<e.timeout&&(o=setTimeout((function(){if(!s){s=!0,u.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}}),e.timeout)),u.setRequestHeader)for(a in h)h.hasOwnProperty(a)&&u.setRequestHeader(a,h[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(u.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(u),u.send(d||null),u}function ri(t,i){var n=new e.WebVTT.Parser(e,e.vttjs,e.WebVTT.StringDecoder()),a=[];n.oncue=function(e){i.addCue(e)},n.onparsingerror=function(e){a.push(e)},n.onflush=function(){i.trigger({type:"loadeddata",target:i})},n.parse(t),0<a.length&&(e.console&&e.console.groupCollapsed&&e.console.groupCollapsed("Text Track parsing errors for "+i.src),a.forEach((function(e){return r.error(e)})),e.console&&e.console.groupEnd&&e.console.groupEnd()),n.flush()}function ai(t,i){var n={uri:t},a=Ft(t);a&&(n.cors=a);var s="use-credentials"===i.tech_.crossOrigin();s&&(n.withCredentials=s),Zt(n,ge(this,(function(t,n,a){if(t)return r.error(t,n);i.loaded_=!0,"function"!=typeof e.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],(function(e){if("vttjserror"!==e.type)return ri(a,i);r.error("vttjs failed to load, stopping trying to process "+i.src)})):ri(a,i)})))}ii.XMLHttpRequest=e.XMLHttpRequest||function(){},ii.XDomainRequest="withCredentials"in new ii.XMLHttpRequest?ii.XMLHttpRequest:e.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],(function(e){ii["delete"===e?"del":e]=function(t,i,n){return(i=ti(t,i,n)).method=e.toUpperCase(),ni(i)}})),Zt.default=ei;var si=function(t){function i(e){var i;if(void 0===e&&(e={}),!e.tech)throw new Error("A tech was not provided.");var n=Re(e,{kind:Gt[e.kind]||"subtitles",language:e.language||e.srclang||""}),r=Kt[n.mode]||"disabled",a=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=t.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var s=new Ht(i.cues_),o=new Ht(i.activeCues_),u=!1,l=ge(je(i),(function(){this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1)}));return"disabled"!==r&&i.tech_.ready((function(){i.tech_.on("timeupdate",l)}),!0),Object.defineProperties(je(i),{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){var t=this;Kt[e]&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||ai(this.src,this),"disabled"!==r?this.tech_.ready((function(){t.tech_.on("timeupdate",l)}),!0):this.tech_.off("timeupdate",l),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i<n;i++){var r=this.cues[i];(r.startTime<=e&&r.endTime>=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(u=!1,t.length!==this.activeCues_.length)u=!0;else for(var a=0;a<t.length;a++)-1===this.activeCues_.indexOf(t[a])&&(u=!0);return this.activeCues_=t,o.setCues_(this.activeCues_),o},set:function(){}}}),n.src?(i.src=n.src,i.preload_||(i.loaded_=!0),(i.preload_||a||"subtitles"!==n.kind&&"captions"!==n.kind)&&ai(i.src,je(i))):i.loaded_=!0,i}ze(i,t);var n=i.prototype;return n.addCue=function(t){var i=t;if(e.vttjs&&!(t instanceof e.vttjs.VTTCue)){for(var n in i=new e.vttjs.VTTCue(t.startTime,t.endTime,t.text),t)n in i||(i[n]=t[n]);i.id=t.id,i.originalCue_=t}for(var r=this.tech_.textTracks(),a=0;a<r.length;a++)r[a]!==this&&r[a].removeCue(i);this.cues_.push(i),this.cues.setCues_(this.cues_)},n.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}}},i}(Xt);si.prototype.allowedEvents_={cuechange:"cuechange"};var oi=function(e){function t(t){var i;void 0===t&&(t={});var n=Re(t,{kind:zt[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(je(i),"enabled",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("enabledchange"))}}),n.enabled&&(i.enabled=n.enabled),i.loaded_=!0,i}return ze(t,e),t}(Xt),ui=function(e){function t(t){var i;void 0===t&&(t={});var n=Re(t,{kind:Wt[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(je(i),"selected",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("selectedchange"))}}),n.selected&&(i.selected=n.selected),i}return ze(t,e),t}(Xt),li=function(e){function t(t){var i,n;void 0===t&&(t={}),i=e.call(this)||this;var r=new si(t);return i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i.default=r.default,Object.defineProperties(je(i),{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=0,r.addEventListener("loadeddata",(function(){n=2,i.trigger({type:"load",target:je(i)})})),i}return ze(t,e),t}(ye);li.prototype.allowedEvents_={load:"load"},li.NONE=0,li.LOADING=1,li.LOADED=2,li.ERROR=3;var ci={audio:{ListClass:Bt,TrackClass:oi,capitalName:"Audio"},video:{ListClass:jt,TrackClass:ui,capitalName:"Video"},text:{ListClass:Vt,TrackClass:si,capitalName:"Text"}};Object.keys(ci).forEach((function(e){ci[e].getterName=e+"Tracks",ci[e].privateName=e+"Tracks_"}));var di={remoteText:{ListClass:Vt,TrackClass:si,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:qt,TrackClass:li,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},hi=u({},ci,di);di.names=Object.keys(di),ci.names=Object.keys(ci),hi.names=[].concat(di.names).concat(ci.names);var pi=Object.create||function(e){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return fi.prototype=e,new fi};function fi(){}function mi(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function gi(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):59<i[1]?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function vi(){this.values=pi(null)}function yi(e,t,i,n){var r=n?e.split(n):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(i);2===s.length&&t(s[0],s[1])}}function _i(e,t,i){var n=e;function r(){var t=gi(e);if(null===t)throw new mi(mi.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 mi(mi.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 vi;yi(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)}((mi.prototype=pi(Error.prototype)).constructor=mi).Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},vi.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 bi=t.createElement("textarea"),Ti={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Si={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)"},ki={v:"title",lang:"lang"},Ci={rt:"ruby"};function Ei(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function n(t,i){var n=Ti[t];if(!n)return null;var r=e.document.createElement(n),a=ki[t];return a&&i&&(r[a]=i.trim()),r}for(var r,a,s,o,u=e.document.createElement("div"),l=u,c=[];null!==(r=i());)if("<"!==r[0])l.appendChild(e.document.createTextNode((a=r,bi.innerHTML=a,a=bi.textContent,bi.textContent="",a)));else{if("/"===r[1]){c.length&&c[c.length-1]===r.substr(2).replace(">","")&&(c.pop(),l=l.parentNode);continue}var d,h=gi(r.substr(1,r.length-2));if(h){d=e.document.createProcessingInstruction("timestamp",h),l.appendChild(d);continue}var p=r.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!p)continue;if(!(d=n(p[1],p[3])))continue;if(s=l,Ci[(o=d).localName]&&Ci[o.localName]!==s.localName)continue;if(p[2]){var f=p[2].split(".");f.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(Si.hasOwnProperty(i)){var n=t?"background-color":"color",r=Si[i];d.style[n]=r}})),d.className=f.join(" ")}c.push(p[1]),l.appendChild(d),l=d}return u}var wi=[[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 Ii(e){for(var t=0;t<wi.length;t++){var i=wi[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function Ai(){}function xi(e,t,i){Ai.call(this),this.cue=t,this.cueDiv=Ei(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:function(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])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var a=i.match(/^.*(\n|\r)/);return a?a[e.length=0]:i}return"ruby"===t.tagName?r(e):t.childNodes?(n(e,t),r(e)):void 0}for(n(t,e);i=r(t);)for(var a=0;a<i.length;a++)if(Ii(i.charCodeAt(a)))return"rtl";return"ltr"}(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(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 Pi(e){var t,i,n,r;if(e.div){i=e.div.offsetHeight,n=e.div.offsetWidth,r=e.div.offsetTop;var a=(a=e.div.childNodes)&&(a=a[0])&&a.getClientRects&&a.getClientRects();e=e.div.getBoundingClientRect(),t=a?Math.max(a[0]&&a[0].height||0,e.height/a.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||i,this.bottom=e.bottom||r+(e.height||i),this.width=e.width||n,this.lineHeight=void 0!==t?t:e.lineHeight}function Li(e,t,i,n){var r=new Pi(t),a=t.cue,s=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}(a),o=[];if(a.snapToLines){var u;switch(a.vertical){case"":o=["+y","-y"],u="height";break;case"rl":o=["+x","-x"],u="width";break;case"lr":o=["-x","+x"],u="width"}var l=r.lineHeight,c=l*Math.round(s),d=i[u]+l,h=o[0];Math.abs(c)>d&&(c=c<0?-1:1,c*=Math.ceil(d/l)*l),s<0&&(c+=""===a.vertical?i.height:i.width,o=o.reverse()),r.move(h,c)}else{var p=r.lineHeight/i.height*100;switch(a.lineAlign){case"center":s-=p/2;break;case"end":s-=p}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],r=new Pi(t)}var f=function(e,t){for(var r,a=new Pi(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 Pi(e),s=u),e=new Pi(a)}return r||a}(r,o);t.move(f.toCSSCompatValues(i))}function Di(){}Ai.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},Ai.prototype.formatStyle=function(e,t){return 0===e?0:e+t},(xi.prototype=pi(Ai.prototype)).constructor=xi,Pi.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}},Pi.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},Pi.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},Pi.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},Pi.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}},Pi.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)},Pi.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}},Pi.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}},Di.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Di.convertCueToDOMTree=function(e,t){return e&&t?Ei(e,t):null},Di.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var r=[],a=Pi.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 xi(e,o,s),n.appendChild(i.div),Li(0,i,a,r),o.displayState=i.div,r.push(Pi.getSimpleBoxPosition(i))}()}else for(var o=0;o<t.length;o++)n.appendChild(t[o].displayState)},(Di.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 mi))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/)?yi(e,(function(e,i){if("X-TIMESTAMP-MAP"===e)!function(e){var i=new vi;yi(e,(function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",gi(t))}}),/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}(i)}),/=/):yi(e,(function(e,i){if("Region"===e)!function(e){var i=new vi;if(yi(e,(function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var n=t.split(",");if(2!==n.length)break;var r=new vi;if(r.percent("x",n[0]),r.percent("y",n[1]),!r.has("x")||!r.has("y"))break;i.set(e+"X",r.get("x")),i.set(e+"Y",r.get("y"));break;case"scroll":i.alt(e,t,["up"])}}),/=/,/\s/),i.has("id")){var n=new(t.vttjs.VTTRegion||t.window.VTTRegion);n.width=i.get("width",100),n.lines=i.get("lines",3),n.regionAnchorX=i.get("regionanchorX",0),n.regionAnchorY=i.get("regionanchorY",100),n.viewportAnchorX=i.get("viewportanchorX",0),n.viewportAnchorY=i.get("viewportanchorY",100),n.scroll=i.get("scroll",""),t.onregion&&t.onregion(n),t.regionList.push({id:i.get("id"),region:n})}}(i)}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(r=i()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new mi(mi.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{_i(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 mi(mi.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var Oi=Di,Ri={"":1,lr:1,rl:1},Mi={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Ni(e){return"string"==typeof e&&!!Mi[e.toLowerCase()]&&e.toLowerCase()}function Ui(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){var t=function(e){return"string"==typeof e&&!!Ri[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");l=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return 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){var t=Ni(e);t&&(h=t,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){var t=Ni(e);t&&(f=t,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){var t=Ni(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Ui.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Fi=Ui,Bi={"":!0,up:!0};function ji(e){return"number"==typeof e&&0<=e&&e<=100}function Vi(){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(!ji(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(!ji(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!ji(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!ji(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!ji(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=function(e){return"string"==typeof e&&!!Bi[e.toLowerCase()]&&e.toLowerCase()}(e);!1===t||(s=t)}}})}var qi=o((function(t){var i=t.exports={WebVTT:Oi,VTTCue:Fi,VTTRegion:Vi};e.vttjs=i,e.WebVTT=i.WebVTT;var n=i.VTTCue,r=i.VTTRegion,a=e.VTTCue,s=e.VTTRegion;i.shim=function(){e.VTTCue=n,e.VTTRegion=r},i.restore=function(){e.VTTCue=a,e.VTTRegion=s},e.VTTCue||i.shim()}));qi.WebVTT,qi.VTTCue,qi.VTTRegion;var Hi=function(i){function n(e,t){var n;return void 0===e&&(e={}),void 0===t&&(t=function(){}),e.reportTouchActivity=!1,(n=i.call(this,null,e,t)||this).hasStarted_=!1,n.on("playing",(function(){this.hasStarted_=!0})),n.on("loadstart",(function(){this.hasStarted_=!1})),hi.names.forEach((function(t){var i=hi[t];e&&e[i.getterName]&&(n[i.privateName]=e[i.getterName])})),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((function(t){!1===e["native"+t+"Tracks"]&&(n["featuresNative"+t+"Tracks"]=!1)})),!1===e.nativeCaptions||!1===e.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.preloadTextTracks=!1!==e.preloadTextTracks,n.autoRemoteTextTracks_=new hi.text.ListClass,n.initTrackListeners(),e.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}ze(n,i);var a=n.prototype;return a.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"})},a.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},a.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},a.trackProgress=function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(ge(this,(function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()})),500)},a.onDurationChange=function(e){this.duration_=this.duration()},a.buffered=function(){return mt(0,0)},a.bufferedPercent=function(){return gt(this.buffered(),this.duration_)},a.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},a.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},a.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},a.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval((function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}),250)},a.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},a.dispose=function(){this.clearTracks(ci.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),i.prototype.dispose.call(this)},a.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)}}))},a.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},a.reset=function(){},a.crossOrigin=function(){},a.setCrossOrigin=function(){},a.error=function(e){return void 0!==e&&(this.error_=new kt(e),this.trigger("error")),this.error_},a.played=function(){return this.hasStarted_?mt(0,0):mt()},a.setScrubbing=function(){},a.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},a.initTrackListeners=function(){var e=this;ci.names.forEach((function(t){function i(){e.trigger(t+"trackchange")}var n=ci[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)}))}))},a.addWebVttScript_=function(){var i=this;if(!e.WebVTT)if(t.body.contains(this.el())){if(!this.options_["vtt.js"]&&f(qi)&&0<Object.keys(qi).length)return void this.trigger("vttjsloaded");var n=t.createElement("script");n.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",n.onload=function(){i.trigger("vttjsloaded")},n.onerror=function(){i.trigger("vttjserror")},this.on("dispose",(function(){n.onload=null,n.onerror=null})),e.WebVTT=!0,this.el().parentNode.appendChild(n)}else this.ready(this.addWebVttScript_)},a.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)}))},a.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();r.kind=t,i&&(r.label=i),n&&(r.language=n),r.tech=e;var s=new hi.text.TrackClass(r);return a.addTrack(s),s}(this,e,t,i)},a.createRemoteTextTrack=function(e){var t=Re(e,{tech:this});return new di.remoteTextEl.TrackClass(t)},a.addRemoteTextTrack=function(e,t){var i=this;void 0===e&&(e={});var n=this.createRemoteTextTrack(e);return!0!==t&&!1!==t&&(r.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},a.removeRemoteTextTrack=function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)},a.getVideoPlaybackQuality=function(){return{}},a.requestPictureInPicture=function(){var t=this.options_.Promise||e.Promise;if(t)return t.reject()},a.disablePictureInPicture=function(){return!0},a.setDisablePictureInPicture=function(){},a.setPoster=function(){},a.playsinline=function(){},a.setPlaysinline=function(){},a.overrideNativeAudioTracks=function(){},a.overrideNativeVideoTracks=function(){},a.canPlayType=function(){return""},n.canPlayType=function(){return""},n.canPlaySource=function(e,t){return n.canPlayType(e.type)},n.isTech=function(e){return e.prototype instanceof n||e instanceof n||e===n},n.registerTech=function(e,t){if(n.techs_||(n.techs_={}),!n.isTech(t))throw new Error("Tech "+e+" must be a Tech");if(!n.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!n.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Oe(e),n.techs_[e]=t,n.techs_[De(e)]=t,"Tech"!==e&&n.defaultTechOrder_.push(e),t},n.getTech=function(t){if(t)return n.techs_&&n.techs_[t]?n.techs_[t]:(t=Oe(t),e&&e.videojs&&e.videojs[t]?(r.warn("The "+t+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),e.videojs[t]):void 0)},n}(Be);hi.names.forEach((function(e){var t=hi[e];Hi.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Hi.prototype.featuresVolumeControl=!0,Hi.prototype.featuresMuteControl=!0,Hi.prototype.featuresFullscreenResize=!1,Hi.prototype.featuresPlaybackRate=!1,Hi.prototype.featuresProgressEvents=!1,Hi.prototype.featuresSourceset=!1,Hi.prototype.featuresTimeupdateEvents=!1,Hi.prototype.featuresNativeTextTracks=!1,Hi.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){var n=e.sourceHandlers;n=n||(e.sourceHandlers=[]),void 0===i&&(i=n.length),n.splice(i,0,t)},e.canPlayType=function(t){for(var i,n=e.sourceHandlers||[],r=0;r<n.length;r++)if(i=n[r].canPlayType(t))return i;return""},e.selectSourceHandler=function(t,i){for(var n=e.sourceHandlers||[],r=0;r<n.length;r++)if(n[r].canHandleSource(t,i))return n[r];return null},e.canPlaySource=function(t,i){var n=e.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach((function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(t){var i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:r.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)}},Be.registerComponent("Tech",Hi),Hi.registerTech("Tech",Hi),Hi.defaultTechOrder_=[];var Wi={},zi={},Gi={};function Ki(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=o[0],l=o.slice(1);if("string"==typeof u)e(t,Wi[u],n,r,a,s);else if(u){var c=function(e,t){var i=zi[e.id()],n=null;if(null==i)return n=t(e),zi[e.id()]=[[t,n]],n;for(var r=0;r<i.length;r++){var a=i[r],s=a[0],o=a[1];s===t&&(n=o)}return null===n&&(n=t(e),i.push([t,n])),n}(r,u);if(!c.setSource)return a.push(c),e(t,l,n,r,a,s);c.setSource(h({},t),(function(i,o){if(i)return e(t,l,n,r,a,s);a.push(c),e(o,t.type===o.type?l:Wi[o.type],n,r,a,s)}))}else l.length?e(t,l,n,r,a,s):s?n(t,a):e(t,Wi["*"],n,r,a,!0)}(t,Wi[t.type],i,e)}),1)}function Xi(e,t,i,n){void 0===n&&(n=null);var r="call"+Oe(i),a=e.reduce(Ji(r),n),s=a===Gi,o=s?null:t[i](a);return 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,o,s),o}var Yi={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1},$i={setCurrentTime:1,setMuted:1,setVolume:1},Qi={play:1,pause:1};function Ji(e){return function(t,i){return t===Gi?Gi:i[e]?i[e](t):t}}function Zi(e){void 0===e&&(e="");var t=Ut(e);return en[t.toLowerCase()]||""}var en={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",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"};function tn(e){if(!e.type){var t=Zi(e.src);t&&(e.type=t)}return e}var nn=function(e){function t(t,i,n){var r,a=Re({createEl:!1},i);if(r=e.call(this,t,a,n)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var s=0,o=i.playerOptions.techOrder;s<o.length;s++){var u=Oe(o[s]),l=Hi.getTech(u);if(u||(l=Be.getComponent(u)),l&&l.isSupported()){t.loadTech_(u);break}}return r}return ze(t,e),t}(Be);Be.registerComponent("MediaLoader",nn);var rn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).emitTapEvents(),n.enable(),n}ze(t,e);var i=t.prototype;return i.createEl=function(t,i,n){void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i=h({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass(),tabIndex:0},i),"button"===t&&r.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead."),n=h({role:"button"},n),this.tabIndex_=i.tabIndex;var a=e.prototype.createEl.call(this,t,i,n);return this.createControlTextEl(a),a},i.dispose=function(){this.controlTextEl_=null,e.prototype.dispose.call(this)},i.createControlTextEl=function(e){return this.controlTextEl_=S("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,k(this.controlTextEl_,i),this.nonIconControl||t.setAttribute("title",i)},i.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)},i.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick),this.on("keydown",this.handleKeyDown))},i.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver),this.off("mouseout",this.handleMouseOut),this.off(["tap","click"],this.handleClick),this.off("keydown",this.handleKeyDown)},i.handleClick=function(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)},i.handleKeyDown=function(t){At.isEventKey(t,"Space")||At.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(Be);Be.registerComponent("ClickableComponent",rn);var an=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update(),t.on("posterchange",ge(je(n),n.update)),n}ze(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 S("div",{className:"vjs-poster",tabIndex:-1})},i.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},i.setSrc=function(e){var t="";e&&(t='url("'+e+'")'),this.el_.style.backgroundImage=t},i.handleClick=function(e){if(this.player_.controls()){var t=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&0<this.player_.eme.sessions.length;!this.player_.tech(!0)||(rt||tt)&&t||this.player_.tech(!0).focus(),this.player_.paused()?wt(this.player_.play()):this.player_.pause()}},t}(rn);Be.registerComponent("PosterImage",an);var sn="#222",on={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 un(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 ln(e,t,i){try{e.style[t]=i}catch(e){return}}var cn=function(t){function i(i,n,r){var a;a=t.call(this,i,n,r)||this;var s=ge(je(a),a.updateDisplay);return i.on("loadstart",ge(je(a),a.toggleDisplay)),i.on("texttrackchange",s),i.on("loadedmetadata",ge(je(a),a.preselectTrack)),i.ready(ge(je(a),(function(){if(i.tech_&&i.tech_.featuresNativeTextTracks)this.hide();else{i.on("fullscreenchange",s),i.on("playerresize",s),e.addEventListener("orientationchange",s),i.on("dispose",(function(){return e.removeEventListener("orientationchange",s)}));for(var t=this.options_.playerOptions.tracks||[],n=0;n<t.length;n++)this.player_.addRemoteTextTrack(t[n],!0);this.preselectTrack()}}))),a}ze(i,t);var n=i.prototype;return n.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?o: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")},n.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},n.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},n.clearDisplay=function(){"function"==typeof e.WebVTT&&e.WebVTT.processCues(e,[],this.el_)},n.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))}},n.updateDisplayState=function(t){for(var i=this.player_.textTrackSettings.getValues(),n=t.activeCues,r=n.length;r--;){var a=n[r];if(a){var s=a.displayState;if(i.color&&(s.firstChild.style.color=i.color),i.textOpacity&&ln(s.firstChild,"color",un(i.color||"#fff",i.textOpacity)),i.backgroundColor&&(s.firstChild.style.backgroundColor=i.backgroundColor),i.backgroundOpacity&&ln(s.firstChild,"backgroundColor",un(i.backgroundColor||"#000",i.backgroundOpacity)),i.windowColor&&(i.windowOpacity?ln(s,"backgroundColor",un(i.windowColor,i.windowOpacity)):s.style.backgroundColor=i.windowColor),i.edgeStyle&&("dropshadow"===i.edgeStyle?s.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px "+sn:"raised"===i.edgeStyle?s.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px "+sn:"depressed"===i.edgeStyle?s.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px "+sn:"uniform"===i.edgeStyle&&(s.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px "+sn)),i.fontPercent&&1!==i.fontPercent){var o=e.parseFloat(s.style.fontSize);s.style.fontSize=o*i.fontPercent+"px",s.style.height="auto",s.style.top="auto"}i.fontFamily&&"default"!==i.fontFamily&&("small-caps"===i.fontFamily?s.firstChild.style.fontVariant="small-caps":s.firstChild.style.fontFamily=on[i.fontFamily])}}},n.updateForTrack=function(t){if(Array.isArray(t)||(t=[t]),"function"==typeof e.WebVTT&&!t.every((function(e){return!e.activeCues}))){for(var i=[],n=0;n<t.length;++n)for(var r=t[n],a=0;a<r.activeCues.length;++a)i.push(r.activeCues[a]);e.WebVTT.processCues(e,i,this.el_);for(var s=0;s<t.length;++s){for(var o=t[s],u=0;u<o.activeCues.length;++u){var l=o.activeCues[u].displayState;w(l,"vjs-text-track-cue"),w(l,"vjs-text-track-cue-"+(o.language?o.language:s))}this.player_.textTrackSettings&&this.updateDisplayState(o)}}},i}(Be);Be.registerComponent("TextTrackDisplay",cn);var dn=function(e){function t(){return e.apply(this,arguments)||this}return ze(t,e),t.prototype.createEl=function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player"),n=S("span",{className:"vjs-control-text",innerHTML:this.localize("{1} is loading.",[i])}),r=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(n),r},t}(Be);Be.registerComponent("LoadingSpinner",dn);var hn=function(e){function t(){return e.apply(this,arguments)||this}ze(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===t&&(t={}),void 0===i&&(i={}),t=h({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass()},t),i=h({type:"button"},i);var n=Be.prototype.createEl.call(this,"button",t,i);return this.createControlTextEl(n),n},i.addChild=function(e,t){void 0===t&&(t={});var i=this.constructor.name;return r.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),Be.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){At.isEventKey(t,"Space")||At.isEventKey(t,"Enter")?t.stopPropagation():e.prototype.handleKeyDown.call(this,t)},t}(rn);Be.registerComponent("Button",hn);var pn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).mouseused_=!1,n.on("mousedown",n.handleMouseDown),n}ze(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 wt(t),void(!this.player_.tech(!0)||(rt||tt)&&i||this.player_.tech(!0).focus())}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(r){var a=function(){return r.focus()};Et(t)?t.then(a,(function(){})):this.setTimeout(a,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(hn);pn.prototype.controlText_="Play Video",Be.registerComponent("BigPlayButton",pn);var fn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}ze(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){At.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(hn);Be.registerComponent("CloseButton",fn);var mn=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",n.handlePlay),n.on(t,"pause",n.handlePause),i.replay&&n.on(t,"ended",n.handleEnded),n}ze(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},t}(hn);function gn(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),s=Math.floor(t/3600);return!isNaN(e)&&e!==1/0||(r=n=i="-"),(r=0<r||0<s?r+":":"")+(n=((r||10<=a)&&n<10?"0"+n:n)+":")+(i<10?"0"+i:i)}mn.prototype.controlText_="Play",Be.registerComponent("PlayToggle",mn);var vn=gn;function yn(e,t){return void 0===t&&(t=e),vn(e,t)}var _n=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["timeupdate","ended"],n.updateContent),n.updateTextNode_(),n}ze(i,e);var n=i.prototype;return n.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control",innerHTML:'<span class="vjs-control-text" role="presentation">'+this.localize(this.labelText_)+" </span>"});return this.contentEl_=S("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},n.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},n.updateTextNode_=function(e){var i=this;void 0===e&&(e=0),e=yn(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(function(){if(i.contentEl_){var e=i.textNode_;i.textNode_=t.createTextNode(i.formattedTime_),i.textNode_&&(e?i.contentEl_.replaceChild(i.textNode_,e):i.contentEl_.appendChild(i.textNode_))}})))},n.updateContent=function(e){},i}(Be);_n.prototype.labelText_="Time",_n.prototype.controlText_="Time",Be.registerComponent("TimeDisplay",_n);var bn=function(e){function t(){return e.apply(this,arguments)||this}ze(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)},t}(_n);bn.prototype.labelText_="Current Time",bn.prototype.controlText_="Current Time",Be.registerComponent("CurrentTimeDisplay",bn);var Tn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",n.updateContent),n.on(t,"loadstart",n.updateContent),n.on(t,"loadedmetadata",n.updateContent),n}ze(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}(_n);Tn.prototype.labelText_="Duration",Tn.prototype.controlText_="Duration",Be.registerComponent("DurationDisplay",Tn);var Sn=function(e){function t(){return e.apply(this,arguments)||this}return ze(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/</span></div>"},{"aria-hidden":!0})},t}(Be);Be.registerComponent("TimeDivider",Sn);var kn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",n.updateContent),n}ze(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return t.insertBefore(S("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}(_n);kn.prototype.labelText_="Remaining Time",kn.prototype.controlText_="Remaining Time",Be.registerComponent("RemainingTimeDisplay",kn);var Cn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",n.updateShowing),n}ze(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_=S("div",{className:"vjs-live-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Stream Type")+" </span>"+this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(Be);Be.registerComponent("LiveDisplay",Cn);var En=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatus),n}ze(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_=S("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatus),this.textEl_=null,e.prototype.dispose.call(this)},t}(hn);function wn(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}En.prototype.controlText_="Seek to live, currently playing live",Be.registerComponent("SeekToLive",En);var In=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}ze(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown),this.on("touchstart",this.handleMouseDown),this.on("keydown",this.handleKeyDown),this.on("click",this.handleClick),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown),this.off("touchstart",this.handleMouseDown),this.off("keydown",this.handleKeyDown),this.off("click",this.handleClick),this.off(this.player_,"controlsvisible",this.update),this.off(e,"mousemove",this.handleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchmove",this.handleMouseMove),this.off(e,"touchend",this.handleMouseUp),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=h({tabIndex:0},i),n=h({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||it||e.preventDefault(),R(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchmove",this.handleMouseMove),this.on(t,"touchend",this.handleMouseUp),this.handleMouseMove(e)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;M(),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(wn(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var t=F(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){At.isEventKey(t,"Left")||At.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):At.isEventKey(t,"Right")||At.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}(Be);function An(e,t){return wn(e/t*100,0,100).toFixed(2)+"%"}Be.registerComponent("Slider",In);var xn=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",n.update),n}ze(i,e);var n=i.prototype;return n.createEl=function(){var i=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),n=S("span",{className:"vjs-control-text"}),r=S("span",{textContent:this.localize("Loaded")}),a=t.createTextNode(": ");return this.percentageEl_=S("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),i.appendChild(n),n.appendChild(r),n.appendChild(a),n.appendChild(this.percentageEl_),i},n.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},n.update=function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",(function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),a=t.partEls_,s=An(r,n);t.percent_!==s&&(t.el_.style.width=s,k(t.percentageEl_,s),t.percent_=s);for(var o=0;o<i.length;o++){var u=i.start(o),l=i.end(o),c=a[o];c||(c=t.el_.appendChild(S()),a[o]=c),c.dataset.start===u&&c.dataset.end===l||(c.dataset.start=u,c.dataset.end=l,c.style.left=An(u,r),c.style.width=An(l-u,r))}for(var d=a.length;d>i.length;d--)t.el_.removeChild(a[d-1]);a.length=i.length}))},i}(Be);Be.registerComponent("LoadProgressBar",xn);var Pn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ve(ge(je(n),n.update),30),n}ze(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=U(this.el_),r=N(this.player_.el()),a=e.width*t;if(r&&n){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right),u=n.width/2;s<u?u+=u-s:o<u&&(u=o),u<0?u=0:u>n.width&&(u=n.width),this.el_.style.right="-"+u+"px",this.write(i)}},i.write=function(e){k(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",(function(){var a,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),u=o-t*o;a=(u<1?"":"-")+yn(u,o)}else a=yn(i,s);r.update(e,t,a),n&&n()}))},t}(Be);Be.registerComponent("TimeTooltip",Pn);var Ln=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ve(ge(je(n),n.update),30),n}ze(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(Be);Ln.prototype.options_={children:[]},ct||Qe||Ln.prototype.options_.children.push("timeTooltip"),Be.registerComponent("PlayProgressBar",Ln);var Dn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ve(ge(je(n),n.update),30),n}ze(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}(Be);Dn.prototype.options_={children:["timeTooltip"]},Be.registerComponent("MouseTimeDisplay",Dn);var On=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}ze(i,e);var n=i.prototype;return n.setEventHandlers_=function(){this.update_=ge(this,this.update),this.update=ve(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.on(this.player_,["playing"],this.enableInterval_),this.on(this.player_,["ended","pause","waiting"],this.disableInterval_),"hidden"in t&&"visibilityState"in t&&this.on(t,"visibilitychange",this.toggleVisibility_)},n.toggleVisibility_=function(e){t.hidden?this.disableInterval_(e):(this.enableInterval_(),this.update())},n.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))},n.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},n.update=function(t){var i=this,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}",[yn(e,r),yn(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(N(i.el()),i.getProgress())})),n},n.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},n.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},n.handleMouseDown=function(t){W(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},n.handleMouseMove=function(e){if(W(e)){var t,i=this.calculateDistance(e),n=this.player_.liveTracker;if(n&&n.isLive()){if(.99<=i)return void n.seekToLiveEdge();var r=n.seekableStart(),a=n.liveCurrentTime();if(a<=(t=r+i*n.liveWindow())&&(t=a),t<=r&&(t=r+.1),t===1/0)return}else(t=i*this.player_.duration())===this.player_.duration()&&(t-=.1);this.player_.currentTime(t)}},n.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},n.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},n.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?wt(this.player_.play()):this.update_()},n.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},n.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},n.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},n.handleKeyDown=function(t){if(At.isEventKey(t,"Space")||At.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(At.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(0);else if(At.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.duration());else if(/^[0-9]$/.test(At(t))){t.preventDefault(),t.stopPropagation();var i=10*(At.codes[At(t)]-At.codes[0])/100;this.player_.currentTime(this.player_.duration()*i)}else At.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()-60)):At.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},n.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableInterval_),this.off(this.player_,["ended","pause","waiting"],this.disableInterval_),"hidden"in t&&"visibilityState"in t&&this.off(t,"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},i}(In);On.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},ct||Qe||On.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Be.registerComponent("SeekBar",On);var Rn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=ve(ge(je(n),n.handleMouseMove),30),n.throttledHandleMouseSeek=ve(ge(je(n),n.handleMouseSeek),30),n.enable(),n}ze(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(i||n){var r=t.el(),a=U(r),s=F(r,e).x;s=wn(s,0,1),n&&n.update(a,s),i&&i.update(a,t.getProgress())}}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseUp(e),this.off(t,"mousemove",this.throttledHandleMouseSeek),this.off(t,"touchmove",this.throttledHandleMouseSeek),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchend",this.handleMouseUp)},t}(Be);Rn.prototype.options_={children:["seekBar"]},Be.registerComponent("ProgressControl",Rn);var Mn=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["enterpictureinpicture","leavepictureinpicture"],n.handlePictureInPictureChange),n.on(t,["disablepictureinpicturechanged","loadedmetadata"],n.handlePictureInPictureEnabledChange),n.disable(),n}ze(i,e);var n=i.prototype;return n.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},n.handlePictureInPictureEnabledChange=function(){t.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},n.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},n.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},i}(hn);Mn.prototype.controlText_="Picture-in-Picture",Be.registerComponent("PictureInPictureToggle",Mn);var Nn=function(e){function i(i,n){var r;return(r=e.call(this,i,n)||this).on(i,"fullscreenchange",r.handleFullscreenChange),!1===t[i.fsApi_.fullscreenEnabled]&&r.disable(),r}ze(i,e);var n=i.prototype;return n.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},n.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},n.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},i}(hn);Nn.prototype.controlText_="Fullscreen",Be.registerComponent("FullscreenToggle",Nn);var Un=function(e){function t(){return e.apply(this,arguments)||this}return ze(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})},t}(Be);Be.registerComponent("VolumeLevel",Un);var Fn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",n.updateLastVolume_),n.on(t,"volumechange",n.updateARIAAttributes),t.ready((function(){return n.updateARIAAttributes()})),n}ze(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){W(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){W(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}(In);Fn.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},Fn.prototype.playerEvent="volumechange",Be.registerComponent("VolumeBar",Fn);var Bn=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,void 0!==i.volumeBar&&!f(i.volumeBar)||(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),n=e.call(this,t,i)||this,function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(je(n),t),n.throttledHandleMouseMove=ve(ge(je(n),n.handleMouseMove),30),n.on("mousedown",n.handleMouseDown),n.on("touchstart",n.handleMouseDown),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}ze(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchend",this.handleMouseUp)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(Be);Bn.prototype.options_={children:["volumeBar"]},Be.registerComponent("VolumeControl",Bn);var jn=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(je(n),t),n.on(t,["loadstart","volumechange"],n.update),n}ze(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;ct&&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++)I(this.el_,"vjs-vol-"+i);w(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}(hn);jn.prototype.controlText_="Mute",Be.registerComponent("MuteToggle",jn);var Vn=function(e){function i(t,i){var n;return void 0===i&&(i={}),void 0!==i.inline?i.inline=i.inline:i.inline=!0,void 0!==i.volumeControl&&!f(i.volumeControl)||(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).on(t,["loadstart"],n.volumePanelState_),n.on(n.muteToggle,"keyup",n.handleKeyPress),n.on(n.volumeControl,"keyup",n.handleVolumeControlKeyUp),n.on("keydown",n.handleKeyPress),n.on("mouseover",n.handleMouseOver),n.on("mouseout",n.handleMouseOut),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}ze(i,e);var n=i.prototype;return n.sliderActive_=function(){this.addClass("vjs-slider-active")},n.sliderInactive_=function(){this.removeClass("vjs-slider-active")},n.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")},n.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})},n.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},n.handleVolumeControlKeyUp=function(e){At.isEventKey(e,"Esc")&&this.muteToggle.focus()},n.handleMouseOver=function(e){this.addClass("vjs-hover"),de(t,"keyup",ge(this,this.handleKeyPress))},n.handleMouseOut=function(e){this.removeClass("vjs-hover"),he(t,"keyup",ge(this,this.handleKeyPress))},n.handleKeyPress=function(e){At.isEventKey(e,"Esc")&&this.handleMouseOut()},i}(Be);Vn.prototype.options_={children:["muteToggle","volumeControl"]},Be.registerComponent("VolumePanel",Vn);var qn=function(e){function i(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",n.handleKeyDown),n.boundHandleBlur_=ge(je(n),n.handleBlur),n.boundHandleTapClick_=ge(je(n),n.handleTapClick),n}ze(i,e);var n=i.prototype;return n.addEventListenerForItem=function(e){e instanceof Be&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},n.removeEventListenerForItem=function(e){e instanceof Be&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},n.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},n.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},n.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=S(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),de(i,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),i},n.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},n.handleBlur=function(e){var i=e.relatedTarget||t.activeElement;if(!this.children().some((function(e){return e.el()===i}))){var n=this.menuButton_;n&&n.buttonPressed_&&i!==n.el().firstChild&&n.unpressButton()}},n.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter((function(t){return t.el()===e.target}))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},n.handleKeyDown=function(e){At.isEventKey(e,"Left")||At.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(At.isEventKey(e,"Right")||At.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},n.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},n.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},n.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].className&&/vjs-menu-title/.test(t[0].className)&&t.shift(),0<t.length&&(e<0?e=0:e>=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())},i}(Be);Be.registerComponent("Menu",qn);var Hn=function(e){function i(i,n){var r;void 0===n&&(n={}),(r=e.call(this,i,n)||this).menuButton_=new hn(i,n),r.menuButton_.controlText(r.controlText_),r.menuButton_.el_.setAttribute("aria-haspopup","true");var a=hn.prototype.buildCSSClass();return r.menuButton_.el_.className=r.buildCSSClass()+" "+a,r.menuButton_.removeClass("vjs-control"),r.addChild(r.menuButton_),r.update(),r.enabled_=!0,r.on(r.menuButton_,"tap",r.handleClick),r.on(r.menuButton_,"click",r.handleClick),r.on(r.menuButton_,"keydown",r.handleKeyDown),r.on(r.menuButton_,"mouseenter",(function(){r.addClass("vjs-hover"),r.menu.show(),de(t,"keyup",ge(je(r),r.handleMenuKeyUp))})),r.on("mouseleave",r.handleMouseLeave),r.on("keydown",r.handleSubmenuKeyDown),r}ze(i,e);var n=i.prototype;return n.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},n.createMenu=function(){var e=new qn(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=S("li",{className:"vjs-menu-title",innerHTML:Oe(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;var i=new Be(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n<this.items.length;n++)e.addItem(this.items[n]);return e},n.createItems=function(){},n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},n.buildWrapperCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+hn.prototype.buildCSSClass()+" "+e.prototype.buildCSSClass.call(this)},n.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)},n.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},n.dispose=function(){this.handleMouseLeave(),e.prototype.dispose.call(this)},n.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},n.handleMouseLeave=function(e){this.removeClass("vjs-hover"),he(t,"keyup",ge(this,this.handleMenuKeyUp))},n.focus=function(){this.menuButton_.focus()},n.blur=function(){this.menuButton_.blur()},n.handleKeyDown=function(e){At.isEventKey(e,"Esc")||At.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),At.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(At.isEventKey(e,"Up")||At.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},n.handleMenuKeyUp=function(e){(At.isEventKey(e,"Esc")||At.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},n.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},n.handleSubmenuKeyDown=function(e){(At.isEventKey(e,"Esc")||At.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),At.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},n.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),ct&&b())return;this.menu.focus()}},n.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},n.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},n.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},i}(Be);Be.registerComponent("MenuButton",Hn);var Wn=function(e){function t(t,i){var n,r=i.tracks;if((n=e.call(this,t,i)||this).items.length<=1&&n.hide(),!r)return je(n);var a=ge(je(n),n.update);return r.addEventListener("removetrack",a),r.addEventListener("addtrack",a),n.player_.on("ready",a),n.player_.on("dispose",(function(){r.removeEventListener("removetrack",a),r.removeEventListener("addtrack",a)})),n}return ze(t,e),t}(Hn);Be.registerComponent("TrackButton",Wn);var zn=["Tab","Esc","Up","Down","Right","Left"],Gn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).selectable=i.selectable,n.isSelected_=i.selected||!1,n.multiSelectable=i.multiSelectable,n.selected(n.isSelected_),n.selectable?n.multiSelectable?n.el_.setAttribute("role","menuitemcheckbox"):n.el_.setAttribute("role","menuitemradio"):n.el_.setAttribute("role","menuitem"),n}ze(t,e);var i=t.prototype;return i.createEl=function(t,i,n){return this.nonIconControl=!0,e.prototype.createEl.call(this,"li",h({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"</span>",tabIndex:-1},i),n)},i.handleKeyDown=function(t){zn.some((function(e){return At.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}(rn);Be.registerComponent("MenuItem",Gn);var Kn=function(i){function n(n,r){var a,s,o=r.track,u=n.textTracks();function l(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];a.handleTracksChange.apply(je(a),t)}function c(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];a.handleSelectedLanguageChange.apply(je(a),t)}return r.label=o.label||o.language||"Unknown",r.selected="showing"===o.mode,(a=i.call(this,n,r)||this).track=o,a.kinds=(r.kinds||[r.kind||a.track.kind]).filter(Boolean),n.on(["loadstart","texttrackchange"],l),u.addEventListener("change",l),u.addEventListener("selectedlanguagechange",c),a.on("dispose",(function(){n.off(["loadstart","texttrackchange"],l),u.removeEventListener("change",l),u.removeEventListener("selectedlanguagechange",c)})),void 0===u.onchange&&a.on(["tap","click"],(function(){if("object"!=typeof e.Event)try{s=new e.Event("change")}catch(e){}s||(s=t.createEvent("Event")).initEvent("change",!0,!0),u.dispatchEvent(s)})),a.handleTracksChange(),a}ze(n,i);var r=n.prototype;return r.handleClick=function(e){var t=this.track,n=this.player_.textTracks();if(i.prototype.handleClick.call(this,e),n)for(var r=0;r<n.length;r++){var a=n[r];-1!==this.kinds.indexOf(a.kind)&&(a===t?"showing"!==a.mode&&(a.mode="showing"):"disabled"!==a.mode&&(a.mode="disabled"))}},r.handleTracksChange=function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)},r.handleSelectedLanguageChange=function(e){if("showing"===this.track.mode){var t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},r.dispose=function(){this.track=null,i.prototype.dispose.call(this)},n}(Gn);Be.registerComponent("TextTrackMenuItem",Kn);var Xn=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}ze(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}(Kn);Be.registerComponent("OffTextTrackMenuItem",Xn);var Yn=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return ze(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=Kn),this.label_&&(i=this.label_+" off"),e.push(new Xn(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=n[r];if(-1<this.kinds_.indexOf(a.kind)){var s=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+a.kind+"-menu-item"),e.push(s)}}return e},t}(Wn);Be.registerComponent("TextTrackButton",Yn);var $n=function(e){function t(t,i){var n,r=i.track,a=i.cue,s=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=a.text,i.selected=a.startTime<=s&&s<a.endTime,(n=e.call(this,t,i)||this).track=r,n.cue=a,r.addEventListener("cuechange",ge(je(n),n.update)),n}ze(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},i.update=function(e){var t=this.cue,i=this.player_.currentTime();this.selected(t.startTime<=i&&i<t.endTime)},t}(Gn);Be.registerComponent("ChaptersTrackMenuItem",$n);var Qn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}ze(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)},i.update=function(t){this.track_&&(!t||"addtrack"!==t.type&&"removetrack"!==t.type)||this.setTrack(this.findChaptersTrack()),e.prototype.update.call(this)},i.setTrack=function(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";var i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_)}}},i.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;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(Oe(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],a=new $n(this.player_,{track:this.track_,cue:r});e.push(a)}return e},t}(Yn);Qn.prototype.kind_="chapters",Qn.prototype.controlText_="Chapters",Be.registerComponent("ChaptersButton",Qn);var Jn=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var a=t.textTracks(),s=ge(je(r),r.handleTracksChange);return a.addEventListener("change",s),r.on("dispose",(function(){a.removeEventListener("change",s)})),r}ze(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}(Yn);Jn.prototype.kind_="descriptions",Jn.prototype.controlText_="Descriptions",Be.registerComponent("DescriptionsButton",Jn);var Zn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}ze(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}(Yn);Zn.prototype.kind_="subtitles",Zn.prototype.controlText_="Subtitles",Be.registerComponent("SubtitlesButton",Zn);var er=function(e){function t(t,i){var n;return i.track={player:t,kind:i.kind,label:i.kind+" settings",selectable:!1,default:!1,mode:"disabled"},i.selectable=!1,i.name="CaptionSettingsMenuItem",(n=e.call(this,t,i)||this).addClass("vjs-texttrack-settings"),n.controlText(", opens "+i.kind+" settings dialog"),n}return ze(t,e),t.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},t}(Kn);Be.registerComponent("CaptionSettingsMenuItem",er);var tr=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}ze(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 er(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t)},t}(Yn);tr.prototype.kind_="captions",tr.prototype.controlText_="Captions",Be.registerComponent("CaptionsButton",tr);var ir=function(e){function t(){return e.apply(this,arguments)||this}return ze(t,e),t.prototype.createEl=function(t,i,n){var r='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"captions"===this.options_.track.kind&&(r+='\n        <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n        <span class="vjs-control-text"> '+this.localize("Captions")+"</span>\n      "),r+="</span>",e.prototype.createEl.call(this,t,h({innerHTML:r},i),n)},t}(Kn);Be.registerComponent("SubsCapsMenuItem",ir);var nr=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).label_="subtitles",-1<["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)&&(n.label_="captions"),n.menuButton_.controlText(Oe(n.label_)),n}ze(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 er(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t,ir)},t}(Yn);nr.prototype.kinds_=["captions","subtitles"],nr.prototype.controlText_="Subtitles",Be.registerComponent("SubsCapsButton",nr);var rr=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(je(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}ze(t,e);var i=t.prototype;return i.createEl=function(t,i,n){var r='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"main-desc"===this.options_.track.kind&&(r+='\n        <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n        <span class="vjs-control-text"> '+this.localize("Descriptions")+"</span>\n      "),r+="</span>",e.prototype.createEl.call(this,t,h({innerHTML:r},i),n)},i.handleClick=function(t){var i=this.player_.audioTracks();e.prototype.handleClick.call(this,t);for(var n=0;n<i.length;n++){var r=i[n];r.enabled=r===this.track}},i.handleTracksChange=function(e){this.selected(this.track.enabled)},t}(Gn);Be.registerComponent("AudioTrackMenuItem",rr);var ar=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.audioTracks(),e.call(this,t,i)||this}ze(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 rr(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e},t}(Wn);ar.prototype.controlText_="Audio Track",Be.registerComponent("AudioTrackButton",ar);var sr=function(e){function t(t,i){var n,r=i.rate,a=parseFloat(r,10);return i.label=r,i.selected=1===a,i.selectable=!0,i.multiSelectable=!1,(n=e.call(this,t,i)||this).label=r,n.rate=a,n.on(t,"ratechange",n.update),n}ze(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}(Gn);sr.prototype.contentElType="button",Be.registerComponent("PlaybackRateMenuItem",sr);var or=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateVisibility(),n.updateLabel(),n.on(t,"loadstart",n.updateVisibility),n.on(t,"ratechange",n.updateLabel),n}ze(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this);return this.labelEl_=S("div",{className:"vjs-playback-rate-value",innerHTML:"1x"}),t.appendChild(this.labelEl_),t},i.dispose=function(){this.labelEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)},i.createMenu=function(){var e=new qn(this.player()),t=this.playbackRates();if(t)for(var i=t.length-1;0<=i;i--)e.addChild(new sr(this.player(),{rate:t[i]+"x"}));return e},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){for(var t=this.player().playbackRate(),i=this.playbackRates(),n=i[0],r=0;r<i.length;r++)if(i[r]>t){n=i[r];break}this.player().playbackRate(n)},i.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&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_.innerHTML=this.player().playbackRate()+"x")},t}(Hn);or.prototype.controlText_="Playback Rate",Be.registerComponent("PlaybackRateMenuButton",or);var ur=function(e){function t(){return e.apply(this,arguments)||this}ze(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},t}(Be);Be.registerComponent("Spacer",ur);var lr=function(e){function t(){return e.apply(this,arguments)||this}ze(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){var t=e.prototype.createEl.call(this,{className:this.buildCSSClass()});return t.innerHTML=" ",t},t}(ur);Be.registerComponent("CustomControlSpacer",lr);var cr=function(e){function t(){return e.apply(this,arguments)||this}return ze(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(Be);cr.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in t&&cr.prototype.options_.children.splice(cr.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Be.registerComponent("ControlBar",cr);var dr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",n.open),n}ze(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}(Pt);dr.prototype.options_=u({},Pt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Be.registerComponent("ErrorDisplay",dr);var hr="vjs-text-track-settings",pr=["#000","Black"],fr=["#00F","Blue"],mr=["#0FF","Cyan"],gr=["#0F0","Green"],vr=["#F0F","Magenta"],yr=["#F00","Red"],_r=["#FFF","White"],br=["#FF0","Yellow"],Tr=["1","Opaque"],Sr=["0.5","Semi-Transparent"],kr=["0","Transparent"],Cr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[pr,_r,yr,gr,fr,br,vr,mr]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Tr,Sr,kr]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[_r,pr,yr,gr,fr,br,vr,mr]},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:[Tr,Sr]},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:[kr,Sr,Tr]}};function Er(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}Cr.windowColor.options=Cr.backgroundColor.options;var wr=function(t){function i(e,i){var n;return i.temporary=!1,(n=t.call(this,e,i)||this).updateDisplay=ge(je(n),n.updateDisplay),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=S("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()})),d(Cr,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}ze(i,t);var n=i.prototype;return n.dispose=function(){this.endDialog=null,t.prototype.dispose.call(this)},n.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=Cr[e],a=r.id.replace("%s",this.id_),s=[t,a].join(" ").trim();return["<"+i+' id="'+a+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"</"+i+">",'<select aria-labelledby="'+s+'">'].concat(r.options.map((function(e){var t=a+"-"+e[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+e[0]+'" ','aria-labelledby="'+s+" "+t+'">',n.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")},n.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("")},n.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("")},n.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("")},n.createElColors_=function(){return S("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},n.createElFont_=function(){return S("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("")})},n.createElControls_=function(){var e=this.localize("restore all settings to the default values");return S("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("")})},n.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},n.label=function(){return this.localize("Caption Settings Dialog")},n.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},n.buildCSSClass=function(){return t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},n.getValues=function(){var e=this;return function(t,i,n){return void 0===n&&(n=0),c(t).reduce((function(i,n){return function(t,i,n){var r=function(e,t){return Er(e.options[e.options.selectedIndex].value,t)}(e.$(i.selector),i.parser);return void 0!==r&&(t[n]=r),t}(i,t[n],n)}),n)}(Cr,0,{})},n.setValues=function(e){var t=this;d(Cr,(function(i,n){!function(e,t,i){if(t)for(var n=0;n<e.options.length;n++)if(Er(e.options[n].value,i)===t){e.selectedIndex=n;break}}(t.$(i.selector),e[n],i.parser)}))},n.setDefaults=function(){var e=this;d(Cr,(function(t){var i=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=i}))},n.restoreSettings=function(){var t;try{t=JSON.parse(e.localStorage.getItem(hr))}catch(t){r.warn(t)}t&&this.setValues(t)},n.saveSettings=function(){if(this.options_.persistTextTrackSettings){var t=this.getValues();try{Object.keys(t).length?e.localStorage.setItem(hr,JSON.stringify(t)):e.localStorage.removeItem(hr)}catch(t){r.warn(t)}}},n.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},n.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()},i}(Pt);Be.registerComponent("TextTrackSettings",wr);var Ir=function(t){function i(i,n){var r,a=n.ResizeObserver||e.ResizeObserver;null===n.ResizeObserver&&(a=!1);var s=Re({createEl:!a,reportTouchActivity:!1},n);return(r=t.call(this,i,s)||this).ResizeObserver=n.ResizeObserver||e.ResizeObserver,r.loadListener_=null,r.resizeObserver_=null,r.debouncedHandler_=function(t,i,n,r){var a;function s(){var e=this,i=arguments,n=function(){n=a=null,t.apply(e,i)};r.clearTimeout(a),a=r.setTimeout(n,100)}return void 0===r&&(r=e),s.cancel=function(){r.clearTimeout(a),a=null},s}((function(){r.resizeHandler()}),0,0,je(r)),a?(r.resizeObserver_=new r.ResizeObserver(r.debouncedHandler_),r.resizeObserver_.observe(i.el())):(r.loadListener_=function(){if(r.el_&&r.el_.contentWindow){var e=r.debouncedHandler_,t=r.unloadListener_=function(){he(this,"resize",e),he(this,"unload",t),t=null};de(r.el_.contentWindow,"unload",t),de(r.el_.contentWindow,"resize",e)}},r.one("load",r.loadListener_)),r}ze(i,t);var n=i.prototype;return n.createEl=function(){return t.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})},n.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},n.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,t.prototype.dispose.call(this)},i}(Be);Be.registerComponent("ResizeManager",Ir);var Ar={trackingThreshold:30,liveTolerance:15},xr=function(i){function n(e,n){var r,a=Re(Ar,n,{createEl:!1});return(r=i.call(this,e,a)||this).reset_(),r.on(r.player_,"durationchange",r.handleDurationchange),rt&&"hidden"in t&&"visibilityState"in t&&r.on(t,"visibilitychange",r.handleVisibilityChange),r}ze(n,i);var r=n.prototype;return r.handleVisibilityChange=function(){this.player_.duration()===1/0&&(t.hidden?this.stopTracking():this.startTracking())},r.trackLive_=function(){var t=this.player_.seekable();if(t&&t.length){var i=Number(e.performance.now().toFixed(4)),n=-1===this.lastTime_?0:(i-this.lastTime_)/1e3;this.lastTime_=i,this.pastSeekEnd_=this.pastSeekEnd()+n;var r=this.liveCurrentTime(),a=this.player_.currentTime(),s=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-a)>this.options_.liveTolerance;this.timeupdateSeen_&&r!==1/0||(s=!1),s!==this.behindLiveEdge_&&(this.behindLiveEdge_=s,this.trigger("liveedgechange"))}},r.handleDurationchange=function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},r.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLive_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLive_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked):(this.one(this.player_,"play",this.handlePlay),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate)))},r.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked)},r.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=!this.skipNextSeeked_&&2<e,this.skipNextSeeked_=!1,this.trackLive_()},r.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge)},r.reset_=function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.skipNextSeeked_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLive_),this.off(this.player_,"seeked",this.handleSeeked),this.off(this.player_,"play",this.handlePlay),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate),this.off(this.player_,"timeupdate",this.seekToLiveEdge)},r.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},r.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},r.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},r.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?1/0:e-this.seekableStart()},r.isLive=function(){return this.isTracking()},r.atLiveEdge=function(){return!this.behindLiveEdge()},r.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},r.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},r.behindLiveEdge=function(){return this.behindLiveEdge_},r.isTracking=function(){return"number"==typeof this.trackingInterval_},r.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.skipNextSeeked_=!0,this.player_.currentTime(this.liveCurrentTime()))},r.dispose=function(){this.off(t,"visibilitychange",this.handleVisibilityChange),this.stopTracking(),i.prototype.dispose.call(this)},n}(Be);function Pr(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var a=0;a<i.length;a++){var s=i[a].src;s&&-1===n.indexOf(s)&&n.push(s)}return!!n.length&&(1===n.length&&(r=n[0]),e.triggerSourceset(r),!0)}function Lr(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 Dr(t){var i=t.el();if(!i.resetSourceWatch_){var n={},r=function(t){return Lr([t.el(),e.HTMLMediaElement.prototype,e.Element.prototype,Mr],"innerHTML")}(t),a=function(e){return function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];var s=e.apply(i,r);return Pr(t),s}};["append","appendChild","insertAdjacentHTML"].forEach((function(e){i[e]&&(n[e]=i[e],i[e]=a(n[e]))})),Object.defineProperty(i,"innerHTML",Re(r,{set:a(r.set)})),i.resetSourceWatch_=function(){i.resetSourceWatch_=null,Object.keys(n).forEach((function(e){i[e]=n[e]})),Object.defineProperty(i,"innerHTML",r)},t.one("sourceset",i.resetSourceWatch_)}}function Or(e,t,i,n){function r(i){return Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0})}void 0===n&&(n=!0);var a={configurable:!0,enumerable:!0,get:function(){var e=i();return r(e),e}};return n&&(a.set=r),Object.defineProperty(e,t,a)}Be.registerComponent("LiveTracker",xr);var Rr,Mr=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(i){var n=t.createElement(this.nodeName.toLowerCase());n.innerHTML=i;for(var r=t.createDocumentFragment();n.childNodes.length;)r.appendChild(n.childNodes[0]);return this.innerText="",e.Element.prototype.appendChild.call(this,r),this.innerHTML}}),Nr=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?Nt(e.Element.prototype.getAttribute.call(this,"src")):""},set:function(t){return e.Element.prototype.setAttribute.call(this,"src",t),t}}),Ur=function(i){function n(e,t){var n;n=i.call(this,e,t)||this;var a=e.source,s=!1;if(a&&(n.el_.currentSrc!==a.src||e.tag&&3===e.tag.initNetworkState_)?n.setSource(a):n.handleLateInit_(n.el_),e.enableSourceset&&n.setupSourcesetHandling_(),n.el_.hasChildNodes()){for(var o=n.el_.childNodes,u=o.length,l=[];u--;){var c=o[u];"track"===c.nodeName.toLowerCase()&&(n.featuresNativeTextTracks?(n.remoteTextTrackEls().addTrackElement_(c),n.remoteTextTracks().addTrack(c.track),n.textTracks().addTrack(c.track),s||n.el_.hasAttribute("crossorigin")||!Ft(c.src)||(s=!0)):l.push(c))}for(var d=0;d<l.length;d++)n.el_.removeChild(l[d])}return n.proxyNativeTracks_(),n.featuresNativeTextTracks&&s&&r.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_(),(ot||lt||Ze)&&!0===e.nativeControlsForTouch&&n.setControls(!0),n.proxyWebkitFullscreen_(),n.triggerReady(),n}ze(n,i);var a=n.prototype;return a.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),n.disposeMediaElement(this.el_),this.options_=null,i.prototype.dispose.call(this)},a.setupSourcesetHandling_=function(){!function(t){if(t.featuresSourceset){var i=t.el();if(!i.resetSourceset_){var n=function(t){return Lr([t.el(),e.HTMLMediaElement.prototype,Nr],"src")}(t),r=i.setAttribute,a=i.load;Object.defineProperty(i,"src",Re(n,{set:function(e){var r=n.set.call(i,e);return t.triggerSourceset(i.src),r}})),i.setAttribute=function(e,n){var a=r.call(i,e,n);return/src/i.test(e)&&t.triggerSourceset(i.src),a},i.load=function(){var e=a.call(i);return Pr(t)||(t.triggerSourceset(""),Dr(t)),e},i.currentSrc?t.triggerSourceset(i.currentSrc):Pr(t)||Dr(t),i.resetSourceset_=function(){i.resetSourceset_=null,i.load=a,i.setAttribute=r,Object.defineProperty(i,"src",n),i.resetSourceWatch_&&i.resetSourceWatch_()}}}}(this)},a.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)}))},a.overrideNative_=function(e,t){var i=this;if(t===this["featuresNative"+e+"Tracks"]){var n=e.toLowerCase();this[n+"TracksListeners_"]&&Object.keys(this[n+"TracksListeners_"]).forEach((function(e){i.el()[n+"Tracks"].removeEventListener(e,i[n+"TracksListeners_"][e])})),this["featuresNative"+e+"Tracks"]=!t,this[n+"TracksListeners_"]=null,this.proxyNativeTracksForType_(n)}},a.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},a.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},a.proxyNativeTracksForType_=function(e){var t=this,i=ci[e],n=this.el()[i.getterName],r=this[i.getterName]();if(this["featuresNative"+i.capitalName+"Tracks"]&&n&&n.addEventListener){var a={change:function(i){var n={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(n),"text"===e&&t[di.remoteText.getterName]().trigger(n)},addtrack:function(e){r.addTrack(e.track)},removetrack:function(e){r.removeTrack(e.track)}},s=function(){for(var e=[],t=0;t<r.length;t++){for(var i=!1,a=0;a<n.length;a++)if(n[a]===r[t]){i=!0;break}i||e.push(r[t])}for(;e.length;)r.removeTrack(e.shift())};this[i.getterName+"Listeners_"]=a,Object.keys(a).forEach((function(e){var i=a[e];n.addEventListener(e,i),t.on("dispose",(function(t){return n.removeEventListener(e,i)}))})),this.on("loadstart",s),this.on("dispose",(function(e){return t.off("loadstart",s)}))}},a.proxyNativeTracks_=function(){var e=this;ci.names.forEach((function(t){e.proxyNativeTracksForType_(t)}))},a.createEl=function(){var e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){var i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),n.disposeMediaElement(e),e=i}else{e=t.createElement("video");var r=Re({},this.options_.tag&&P(this.options_.tag));ot&&!0===this.options_.nativeControlsForTouch||delete r.controls,x(e,h(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&D(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);for(var a=["loop","muted","playsinline","autoplay"],s=0;s<a.length;s++){var o=a[s],u=this.options_[o];void 0!==u&&(u?D(e,o,o):O(e,o),e[o]=u)}return e},a.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)}))}},a.setScrubbing=function(e){this.isScrubbing_=e},a.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&dt?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){r(e,"Video is not ready. (Video.js)")}},a.duration=function(){var e=this;return this.el_.duration===1/0&&Qe&&it&&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},a.width=function(){return this.el_.offsetWidth},a.height=function(){return this.el_.offsetHeight},a.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",(function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)}))}},a.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var t=e.navigator&&e.navigator.userAgent||"";if(/Android/.test(t)||!/Chrome|Mac OS X 10.5/.test(t))return!0}return!1},a.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)wt(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)}},a.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},a.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},a.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},a.reset=function(){n.resetMediaElement(this.el_)},a.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},a.setControls=function(e){this.el_.controls=!!e},a.addTextTrack=function(e,t,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,n):i.prototype.addTextTrack.call(this,e,t,n)},a.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return i.prototype.createRemoteTextTrack.call(this,e);var n=t.createElement("track");return e.kind&&(n.kind=e.kind),e.label&&(n.label=e.label),(e.language||e.srclang)&&(n.srclang=e.language||e.srclang),e.default&&(n.default=e.default),e.id&&(n.id=e.id),e.src&&(n.src=e.src),n},a.addRemoteTextTrack=function(e,t){var n=i.prototype.addRemoteTextTrack.call(this,e,t);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},a.removeRemoteTextTrack=function(e){if(i.prototype.removeRemoteTextTrack.call(this,e),this.featuresNativeTextTracks)for(var t=this.$$("track"),n=t.length;n--;)e!==t[n]&&e!==t[n].track||this.el().removeChild(t[n])},a.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var t={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount),e.performance&&"function"==typeof e.performance.now?t.creationTime=e.performance.now():e.performance&&e.performance.timing&&"number"==typeof e.performance.timing.navigationStart&&(t.creationTime=e.Date.now()-e.performance.timing.navigationStart),t},n}(Hi);Or(Ur,"TEST_VID",(function(){if(y()){var e=t.createElement("video"),i=t.createElement("track");return i.kind="captions",i.srclang="en",i.label="English",e.appendChild(i),e}})),Ur.isSupported=function(){try{Ur.TEST_VID.volume=.5}catch(e){return!1}return!(!Ur.TEST_VID||!Ur.TEST_VID.canPlayType)},Ur.canPlayType=function(e){return Ur.TEST_VID.canPlayType(e)},Ur.canPlaySource=function(e,t){return Ur.canPlayType(e.type)},Ur.canControlVolume=function(){try{var e=Ur.TEST_VID.volume;return Ur.TEST_VID.volume=e/2+.1,e!==Ur.TEST_VID.volume}catch(e){return!1}},Ur.canMuteVolume=function(){try{var e=Ur.TEST_VID.muted;return Ur.TEST_VID.muted=!e,Ur.TEST_VID.muted?D(Ur.TEST_VID,"muted","muted"):O(Ur.TEST_VID,"muted"),e!==Ur.TEST_VID.muted}catch(e){return!1}},Ur.canControlPlaybackRate=function(){if(Qe&&it&&nt<58)return!1;try{var e=Ur.TEST_VID.playbackRate;return Ur.TEST_VID.playbackRate=e/2+.1,e!==Ur.TEST_VID.playbackRate}catch(e){return!1}},Ur.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(t.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(t.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(t.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(t.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},Ur.supportsNativeTextTracks=function(){return dt||ct&&it},Ur.supportsNativeVideoTracks=function(){return!(!Ur.TEST_VID||!Ur.TEST_VID.videoTracks)},Ur.supportsNativeAudioTracks=function(){return!(!Ur.TEST_VID||!Ur.TEST_VID.audioTracks)},Ur.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresVolumeControl","canControlVolume"],["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function(e){var t=e[0],i=e[1];Or(Ur.prototype,t,(function(){return Ur[i]()}),!0)})),Ur.prototype.movingMediaElementInDOM=!ct,Ur.prototype.featuresFullscreenResize=!0,Ur.prototype.featuresProgressEvents=!0,Ur.prototype.featuresTimeupdateEvents=!0,Ur.patchCanPlayType=function(){4<=Je&&!et&&!it&&(Rr=Ur.TEST_VID&&Ur.TEST_VID.constructor.prototype.canPlayType,Ur.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":Rr.call(this,e)})},Ur.unpatchCanPlayType=function(){var e=Ur.TEST_VID.constructor.prototype.canPlayType;return Rr&&(Ur.TEST_VID.constructor.prototype.canPlayType=Rr),e},Ur.patchCanPlayType(),Ur.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){}}()}},Ur.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){Ur.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){Ur.prototype["set"+Oe(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){Ur.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){Ur.prototype["set"+Oe(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){Ur.prototype[e]=function(){return this.el_[e]()}})),Hi.withSourceHandlers(Ur),Ur.nativeSourceHandler={},Ur.nativeSourceHandler.canPlayType=function(e){try{return Ur.TEST_VID.canPlayType(e)}catch(e){return""}},Ur.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Ur.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=Ut(e.src);return Ur.nativeSourceHandler.canPlayType("video/"+i)}return""},Ur.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Ur.nativeSourceHandler.dispose=function(){},Ur.registerSourceHandler(Ur.nativeSourceHandler),Hi.registerTech("Html5",Ur);var Fr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Br={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},jr=["tiny","xsmall","small","medium","large","xlarge","huge"],Vr={};jr.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Vr[e]="vjs-layout-"+t}));var qr={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},Hr=function(n){function s(e,r,o){var u;if(e.id=e.id||r.id||"vjs_video_"+ne(),(r=h(s.getTagSettings(e),r)).initChildren=!1,r.createEl=!1,r.evented=!1,r.reportTouchActivity=!1,!r.language)if("function"==typeof e.closest){var l=e.closest("[lang]");l&&l.getAttribute&&(r.language=l.getAttribute("lang"))}else for(var c=e;c&&1===c.nodeType;){if(P(c).hasOwnProperty("lang")){r.language=c.getAttribute("lang");break}c=c.parentNode}if((u=n.call(this,null,r,o)||this).boundDocumentFullscreenChange_=ge(je(u),u.documentFullscreenChange_),u.boundFullWindowOnEscKey_=ge(je(u),u.fullWindowOnEscKey),u.isFullscreen_=!1,u.log=a(u.id_),u.fsApi_=yt,u.isPosterFromTech_=!1,u.queuedCallbacks_=[],u.isReady_=!1,u.hasStarted_=!1,u.userActive_=!1,u.debugEnabled_=!1,!u.options_||!u.options_.techOrder||!u.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(u.tag=e,u.tagAttributes=e&&P(e),u.language(u.options_.language),r.languages){var d={};Object.getOwnPropertyNames(r.languages).forEach((function(e){d[e.toLowerCase()]=r.languages[e]})),u.languages_=d}else u.languages_=s.prototype.options_.languages;u.resetCache_(),u.poster_=r.poster||"",u.controls_=!!r.controls,e.controls=!1,e.removeAttribute("controls"),u.changingSrc_=!1,u.playCallbacks_=[],u.playTerminatedQueue_=[],e.hasAttribute("autoplay")?u.autoplay(!0):u.autoplay(u.options_.autoplay),r.plugins&&Object.keys(r.plugins).forEach((function(e){if("function"!=typeof u[e])throw new Error('plugin "'+e+'" does not exist')})),u.scrubbing_=!1,u.el_=u.createEl(),xe(je(u),{eventBusKey:"el_"}),u.fsApi_.requestFullscreen&&(de(t,u.fsApi_.fullscreenchange,u.boundDocumentFullscreenChange_),u.on(u.fsApi_.fullscreenchange,u.boundDocumentFullscreenChange_)),u.fluid_&&u.on("playerreset",u.updateStyleEl_);var p=Re(u.options_);r.plugins&&Object.keys(r.plugins).forEach((function(e){u[e](r.plugins[e])})),r.debug&&u.debug(!0),u.options_.playerOptions=p,u.middleware_=[],u.initChildren(),u.isAudio("audio"===e.nodeName.toLowerCase()),u.controls()?u.addClass("vjs-controls-enabled"):u.addClass("vjs-controls-disabled"),u.el_.setAttribute("role","region"),u.isAudio()?u.el_.setAttribute("aria-label",u.localize("Audio Player")):u.el_.setAttribute("aria-label",u.localize("Video Player")),u.isAudio()&&u.addClass("vjs-audio"),u.flexNotSupported_()&&u.addClass("vjs-no-flex"),ot&&u.addClass("vjs-touch-enabled"),ct||u.addClass("vjs-workinghover"),s.players[u.id_]=je(u);var f=i.split(".")[0];return u.addClass("vjs-v"+f),u.userActive(!0),u.reportUserActivity(),u.one("play",u.listenForUserActivity_),u.on("stageclick",u.handleStageClick_),u.on("keydown",u.handleKeyDown),u.breakpoints(u.options_.breakpoints),u.responsive(u.options_.responsive),u}ze(s,n);var o=s.prototype;return o.dispose=function(){var e=this;this.trigger("dispose"),this.off("dispose"),he(t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),he(t,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),s.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),function(e){zi[e.id()]=null}(this),hi.names.forEach((function(t){var i=hi[t],n=e[i.getterName]();n&&n.off&&n.off()})),n.prototype.dispose.call(this)},o.createEl=function(){var i,r=this.tag,a=this.playerElIngest_=r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player"),s="video-js"===this.tag.tagName.toLowerCase();a?i=this.el_=r.parentNode:s||(i=this.el_=n.prototype.createEl.call(this,"div"));var o=P(r);if(s){for(i=this.el_=r,r=this.tag=t.createElement("video");i.children.length;)r.appendChild(i.firstChild);E(i,"video-js")||w(i,"video-js"),i.appendChild(r),a=this.playerElIngest_=i,Object.keys(i).forEach((function(e){try{r[e]=i[e]}catch(e){}}))}if(r.setAttribute("tabindex","-1"),o.tabindex="-1",(rt||it&&st)&&(r.setAttribute("role","application"),o.role="application"),r.removeAttribute("width"),r.removeAttribute("height"),"width"in o&&delete o.width,"height"in o&&delete o.height,Object.getOwnPropertyNames(o).forEach((function(e){s&&"class"===e||i.setAttribute(e,o[e]),s&&r.setAttribute(e,o[e])})),r.playerId=r.id,r.id+="_html5_api",r.className="vjs-tech",r.player=i.player=this,this.addClass("vjs-paused"),!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=Z("vjs-styles-dimensions");var u=G(".vjs-styles-defaults"),l=G("head");l.insertBefore(this.styleEl_,u?u.nextSibling:l.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 c=r.getElementsByTagName("a"),d=0;d<c.length;d++){var h=c.item(d);w(h,"vjs-hidden"),h.setAttribute("hidden","hidden")}return r.initNetworkState_=r.networkState,r.parentNode&&!a&&r.parentNode.insertBefore(i,r),C(r,i),this.children_.unshift(r),this.el_.setAttribute("lang",this.language_),this.el_=i},o.crossOrigin=function(e){if(!e)return this.techGet_("crossOrigin");"anonymous"===e||"use-credentials"===e?this.techCall_("setCrossOrigin",e):r.warn('crossOrigin must be "anonymous" or "use-credentials", given "'+e+'"')},o.width=function(e){return this.dimension("width",e)},o.height=function(e){return this.dimension("height",e)},o.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)?r.error('Improper value "'+t+'" supplied for for '+e):(this[i]=n,this.updateStyleEl_())},o.fluid=function(e){if(void 0===e)return!!this.fluid_;this.fluid_=!!e,Ie(this)&&this.off("playerreset",this.updateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),function(e,t){Ie(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))}((function(){this.on("playerreset",this.updateStyleEl_)}))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},o.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")},o.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_()},o.updateStyleEl_=function(){if(!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){var t,i,n,r=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0<this.videoWidth()?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),a=r[1]/r[0];t=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/a:this.videoWidth()||300,i=void 0!==this.height_?this.height_:t*a,n=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(n),ee(this.styleEl_,"\n      ."+n+" {\n        width: "+t+"px;\n        height: "+i+"px;\n      }\n\n      ."+n+".vjs-fluid {\n        padding-top: "+100*a+"%;\n      }\n    ")}else{var s="number"==typeof this.width_?this.width_:this.options_.width,o="number"==typeof this.height_?this.height_:this.options_.height,u=this.tech_&&this.tech_.el();u&&(0<=s&&(u.width=s),0<=o&&(u.height=o))}},o.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=Oe(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Hi.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a={source:t,autoplay:"string"!=typeof this.autoplay()&&this.autoplay(),nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,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};hi.names.forEach((function(e){var t=hi[e];a[t.getterName]=i[t.privateName]})),h(a,this.options_[n]),h(a,this.options_[r]),h(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&0<this.cache_.currentTime&&(a.startTime=this.cache_.currentTime);var s=Hi.getTech(e);if(!s)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new s(a),this.tech_.ready(ge(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_),Fr.forEach((function(e){i.on(i.tech_,e,i["handleTech"+Oe(e)+"_"])})),Object.keys(Br).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+Br[e]+"_"].bind(i),event:t}):i["handleTech"+Br[e]+"_"](t)}))})),this.on(this.tech_,"loadstart",this.handleTechLoadStart_),this.on(this.tech_,"sourceset",this.handleTechSourceset_),this.on(this.tech_,"waiting",this.handleTechWaiting_),this.on(this.tech_,"ended",this.handleTechEnded_),this.on(this.tech_,"seeking",this.handleTechSeeking_),this.on(this.tech_,"play",this.handleTechPlay_),this.on(this.tech_,"firstplay",this.handleTechFirstPlay_),this.on(this.tech_,"pause",this.handleTechPause_),this.on(this.tech_,"durationchange",this.handleTechDurationChange_),this.on(this.tech_,"fullscreenchange",this.handleTechFullscreenChange_),this.on(this.tech_,"fullscreenerror",this.handleTechFullscreenError_),this.on(this.tech_,"enterpictureinpicture",this.handleTechEnterPictureInPicture_),this.on(this.tech_,"leavepictureinpicture",this.handleTechLeavePictureInPicture_),this.on(this.tech_,"error",this.handleTechError_),this.on(this.tech_,"loadedmetadata",this.updateStyleEl_),this.on(this.tech_,"posterchange",this.handleTechPosterChange_),this.on(this.tech_,"textdata",this.handleTechTextData_),this.on(this.tech_,"ratechange",this.handleTechRateChange_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||C(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},o.unloadTech_=function(){var e=this;hi.names.forEach((function(t){var i=hi[t];e[i.privateName]=e[i.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=It(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(It))}(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},o.tech=function(e){return void 0===e&&r.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_},o.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"mouseup",this.handleTechClick_),this.on(this.tech_,"dblclick",this.handleTechDoubleClick_),this.on(this.tech_,"touchstart",this.handleTechTouchStart_),this.on(this.tech_,"touchmove",this.handleTechTouchMove_),this.on(this.tech_,"touchend",this.handleTechTouchEnd_),this.on(this.tech_,"tap",this.handleTechTap_)},o.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_),this.off(this.tech_,"touchstart",this.handleTechTouchStart_),this.off(this.tech_,"touchmove",this.handleTechTouchMove_),this.off(this.tech_,"touchend",this.handleTechTouchEnd_),this.off(this.tech_,"mouseup",this.handleTechClick_),this.off(this.tech_,"dblclick",this.handleTechDoubleClick_)},o.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},o.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(this.autoplay())},o.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(Et(n))return n.catch(i)};if("any"===e&&!0!==this.muted()?Et(i=this.play())&&(i=i.catch(n)):i="muted"===e&&!0!==this.muted()?n():this.play(),Et(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(i){t.trigger({type:"autoplay-failure",autoplay:e})}))}},o.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((function(e){return e.src===t}));if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r<n.length;r++){var a=n[r];if(a.type&&a.src&&a.src===t)return a.type}return Zi(t)}(this,t)),this.cache_.source=Re({},e,{src:t,type:i});for(var n=this.cache_.sources.filter((function(e){return e.src&&e.src===t})),r=[],a=this.$$("source"),s=[],o=0;o<a.length;o++){var u=P(a[o]);r.push(u),u.src&&u.src===t&&s.push(u.src)}s.length&&!n.length?this.cache_.sources=r:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},o.handleTechSourceset_=function(e){var t=this;if(!this.changingSrc_){var i=function(e){return t.updateSourceCaches_(e)},n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(this.lastSource_&&(this.lastSource_.tech===r||this.lastSource_.player===n)||(i=function(){})),i(r),e.src||this.tech_.any(["sourceset","loadstart"],(function(e){if("sourceset"!==e.type){var i=t.techGet("currentSrc");t.lastSource_.tech=i,t.updateSourceCaches_(i)}}))}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})},o.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"))},o.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},o.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")},o.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))}))},o.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},o.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},o.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},o.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},o.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},o.handleTechFirstPlay_=function(){this.options_.starttime&&(r.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")},o.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},o.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},o.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},o.handleTechClick_=function(e){W(e)&&this.controls_&&(this.paused()?wt(this.play()):this.pause())},o.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()))},o.handleTechTap_=function(){this.userActive(!this.userActive())},o.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},o.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},o.handleTechTouchEnd_=function(e){e.preventDefault()},o.handleStageClick_=function(){this.reportUserActivity()},o.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},o.documentFullscreenChange_=function(e){var i=e.target.player;if(!i||i===this){var n=this.el(),r=t[this.fsApi_.fullscreenElement]===n;!r&&n.matches?r=n.matches(":"+this.fsApi_.fullscreen):!r&&n.msMatchesSelector&&(r=n.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(r)}},o.handleTechFullscreenChange_=function(e,t){t&&(t.nativeIOSFullscreen&&this.toggleClass("vjs-ios-native-fs"),this.isFullscreen(t.isFullscreen))},o.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},o.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},o.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},o.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},o.handleTechError_=function(){var e=this.tech_.error();this.error(e)},o.handleTechTextData_=function(e,t){var i=null;1<arguments.length&&(i=t),this.trigger("textdata",i)},o.getCache=function(){return this.cache_},o.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],volume:1}},o.techCall_=function(e,t){this.ready((function(){if(e in $i)return function(e,t,i,n){return t[i](e.reduce(Ji(i),n))}(this.middleware_,this.tech_,e,t);if(e in Qi)return Xi(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw r(e),e}}),!0)},o.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in Yi)return function(e,t,i){return e.reduceRight(Ji(i),t[i]())}(this.middleware_,this.tech_,e);if(e in Qi)return Xi(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw r("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw r("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw r(t),t}}},o.play=function(){var t=this,i=this.options_.Promise||e.Promise;return i?new i((function(e){t.play_(e)})):this.play_()},o.play_=function(e){var t=this;void 0===e&&(e=wt),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!dt&&!ct||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},o.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},o.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},o.pause=function(){this.techCall_("pause")},o.paused=function(){return!1!==this.techGet_("paused")},o.played=function(){return this.techGet_("played")||mt(0,0)},o.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")},o.currentTime=function(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.applyInitTime_),void this.one("canplay",this.applyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},o.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},o.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},o.remainingTime=function(){return this.duration()-this.currentTime()},o.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},o.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=mt(0,0)),e},o.bufferedPercent=function(){return gt(this.buffered(),this.duration())},o.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return t<i&&(i=t),i},o.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)},o.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},o.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},o.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},o.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},o.isFullscreen=function(e){if(void 0===e)return this.isFullscreen_;var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()},o.requestFullscreen=function(t){var i=this.options_.Promise||e.Promise;if(i){var n=this;return new i((function(e,i){function r(){n.off("fullscreenerror",s),n.off("fullscreenchange",a)}function a(){r(),e()}function s(e,t){r(),i(t)}n.one("fullscreenchange",a),n.one("fullscreenerror",s);var o=n.requestFullscreenHelper_(t);if(o)return o.then(r,r),o}))}return this.requestFullscreenHelper_()},o.requestFullscreenHelper_=function(e){var t,i=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then((function(){return i.isFullscreen(!0)}),(function(){return i.isFullscreen(!1)})),n}this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):this.enterFullWindow()},o.exitFullscreen=function(){var t=this.options_.Promise||e.Promise;if(t){var i=this;return new t((function(e,t){function n(){i.off("fullscreenerror",a),i.off("fullscreenchange",r)}function r(){n(),e()}function a(e,i){n(),t(i)}i.one("fullscreenchange",r),i.one("fullscreenerror",a);var s=i.exitFullscreenHelper_();if(s)return s.then(n,n),s}))}return this.exitFullscreenHelper_()},o.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var i=t[this.fsApi_.exitFullscreen]();return i&&i.then((function(){return e.isFullscreen(!1)})),i}this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):this.exitFullWindow()},o.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=t.documentElement.style.overflow,de(t,"keydown",this.boundFullWindowOnEscKey_),t.documentElement.style.overflow="hidden",w(t.body,"vjs-full-window"),this.trigger("enterFullWindow")},o.fullWindowOnEscKey=function(e){At.isEventKey(e,"Esc")&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},o.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,he(t,"keydown",this.boundFullWindowOnEscKey_),t.documentElement.style.overflow=this.docOrigOverflow,I(t.body,"vjs-full-window"),this.trigger("exitFullWindow")},o.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},o.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},o.requestPictureInPicture=function(){if("pictureInPictureEnabled"in t&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},o.exitPictureInPicture=function(){if("pictureInPictureEnabled"in t)return t.exitPictureInPicture()},o.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))},o.handleHotkeys=function(e){var i=this.options_.userActions?this.options_.userActions.hotkeys:{},n=i.fullscreenKey,r=void 0===n?function(e){return At.isEventKey(e,"f")}:n,a=i.muteKey,s=void 0===a?function(e){return At.isEventKey(e,"m")}:a,o=i.playPauseKey,u=void 0===o?function(e){return At.isEventKey(e,"k")||At.isEventKey(e,"Space")}:o;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();var l=Be.getComponent("FullscreenToggle");!1!==t[this.fsApi_.fullscreenEnabled]&&l.prototype.handleClick.call(this,e)}else s.call(this,e)?(e.preventDefault(),e.stopPropagation(),Be.getComponent("MuteToggle").prototype.handleClick.call(this,e)):u.call(this,e)&&(e.preventDefault(),e.stopPropagation(),Be.getComponent("PlayToggle").prototype.handleClick.call(this,e))},o.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i<n.length;i++){var a=n[i],s=Hi.getTech(a);if(s=s||Be.getComponent(a)){if(s.isSupported()&&(t=s.canPlayType(e)))return t}else r.error('The "'+a+'" tech is undefined. Skipped browser support check for that tech.')}return""},o.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}function i(e,t){var i=e[0];if(e[1].canPlaySource(t,a.options_[i.toLowerCase()]))return{source:t,tech:i}}var n,a=this,s=this.options_.techOrder.map((function(e){return[e,Hi.getTech(e)]})).filter((function(e){var t=e[0],i=e[1];return i?i.isSupported():(r.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)}));return(this.options_.sourceOrder?t(e,s,(n=i,function(e,t){return n(t,e)})):t(s,e,i))||!1},o.src=function(e){var t=this;if(void 0===e)return this.cache_.src||"";var i=function e(t){if(Array.isArray(t)){var i=[];t.forEach((function(t){t=e(t),Array.isArray(t)?i=i.concat(t):p(t)&&i.push(t)})),t=i}else t="string"==typeof t&&t.trim()?[tn({src:t})]:p(t)&&"string"==typeof t.src&&t.src&&t.src.trim()?[tn(t)]:[];return t}(e);i.length?(this.changingSrc_=!0,this.cache_.sources=i,this.updateSourceCaches_(i[0]),Ki(this,i[0],(function(e,n){if(t.middleware_=n,t.cache_.sources=i,t.updateSourceCaches_(e),t.src_(e))return 1<i.length?t.src(i.slice(1)):(t.changingSrc_=!1,t.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0),void t.triggerReady());!function(e,t){e.forEach((function(e){return e.setTech&&e.setTech(t)}))}(n,t.tech_)}))):this.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0)},o.src_=function(e){var t=this,i=this.selectSource([e]);return!i||(function(e,t){return Oe(e)===Oe(t)}(i.tech,this.techName_)?this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0):(this.changingSrc_=!0,this.loadTech_(i.tech,i.source),this.tech_.ready((function(){t.changingSrc_=!1}))),!1)},o.load=function(){this.techCall_("load")},o.reset=function(){var t=this,i=this.options_.Promise||e.Promise;this.paused()||!i?this.doReset_():wt(this.play().then((function(){return t.doReset_()})))},o.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),Ie(this)&&this.trigger("playerreset")},o.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},o.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar,t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},o.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},o.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},o.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},o.currentSource=function(){return this.cache_.source||{}},o.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},o.currentType=function(){return this.currentSource()&&this.currentSource().type||""},o.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},o.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)?(this.options_.autoplay=e,this.manualAutoplay_(e),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},o.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},o.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},o.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"))},o.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},o.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},o.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},o.error=function(e){if(void 0===e)return this.error_||null;if(this.options_.suppressNotSupportedError&&e&&4===e.code){var t=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),void this.one("loadstart",(function(){this.off(["click","touchstart"],t)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new kt(e),this.addClass("vjs-error"),r.error("(CODE:"+this.error_.code+" "+kt.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error")},o.reportUserActivity=function(e){this.userActivity_=!0},o.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")}},o.listenForUserActivity_=function(){function e(e){r(),this.clearInterval(t)}var t,i,n,r=ge(this,this.reportUserActivity);this.on("mousedown",(function(){r(),this.clearInterval(t),t=this.setInterval(r,250)})),this.on("mousemove",(function(e){e.screenX===i&&e.screenY===n||(i=e.screenX,n=e.screenY,r())})),this.on("mouseup",e),this.on("mouseleave",e);var a,s=this.getChild("controlBar");!s||ct||Qe||(s.on("mouseenter",(function(e){this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout,this.player().options_.inactivityTimeout=0})),s.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",r),this.on("keyup",r),this.setInterval((function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var e=this.options_.inactivityTimeout;e<=0||(a=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}}),250)},o.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},o.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},o.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},o.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},o.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},o.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)},o.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},o.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},o.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},o.language=function(e){if(void 0===e)return this.language_;this.language_=String(e).toLowerCase()},o.languages=function(){return Re(s.prototype.options_.languages,this.languages_)},o.toJSON=function(){var e=Re(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var n=t[i];(n=Re(n)).player=void 0,e.tracks[i]=n}return e},o.createModal=function(e,t){var i=this;(t=t||{}).content=e||"";var n=new Pt(this,t);return this.addChild(n),n.on("dispose",(function(){i.removeChild(n)})),n.open(),n},o.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),i=0;i<jr.length;i++){var n=jr[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(Vr[e]),this.addClass(Vr[n]),this.breakpoint_=n;break}}},o.removeCurrentBreakpoint_=function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)},o.breakpoints=function(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=h({},qr,e),this.updateCurrentBreakpoint_()),h(this.breakpoints_)},o.responsive=function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?((this.responsive_=e)?(this.on("playerresize",this.updateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.updateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0},o.currentBreakpoint=function(){return this.breakpoint_},o.currentBreakpointClass=function(){return Vr[this.breakpoint_]||""},o.loadMedia=function(e,t){var i=this;if(e&&"object"==typeof e){this.reset(),this.cache_.media=Re(e);var n=this.cache_.media,r=n.artwork,a=n.poster,s=n.src,o=n.textTracks;!r&&a&&(this.cache_.media.artwork=[{src:a,type:Zi(a)}]),s&&this.src(s),a&&this.poster(a),Array.isArray(o)&&o.forEach((function(e){return i.addRemoteTextTrack(e,!1)})),this.ready(t)}},o.getMedia=function(){if(this.cache_.media)return Re(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:Zi(t.poster)}]),t},s.getTagSettings=function(e){var t={sources:[],tracks:[]},i=P(e),n=i["data-setup"];if(E(e,"vjs-fill")&&(i.fill=!0),E(e,"vjs-fluid")&&(i.fluid=!0),null!==n){var a=function(e,t){var i,n=null;try{i=JSON.parse(e,t)}catch(e){n=e}return[n,i]}(n||"{}"),s=a[0],o=a[1];s&&r.error(s),h(i,o)}if(h(t,i),e.hasChildNodes())for(var u=e.childNodes,l=0,c=u.length;l<c;l++){var d=u[l],p=d.nodeName.toLowerCase();"source"===p?t.sources.push(P(d)):"track"===p&&t.tracks.push(P(d))}return t},o.flexNotSupported_=function(){var e=t.createElement("i");return!("flexBasis"in e.style||"webkitFlexBasis"in e.style||"mozFlexBasis"in e.style||"msFlexBasis"in e.style||"msFlexOrder"in e.style)},o.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)},s}(Be);hi.names.forEach((function(e){var t=hi[e];Hr.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),Hr.prototype.crossorigin=Hr.prototype.crossOrigin,Hr.players={};var Wr=e.navigator;Hr.prototype.options_={techOrder:Hi.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Wr&&(Wr.languages&&Wr.languages[0]||Wr.userLanguage||Wr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1},["ended","seeking","seekable","networkState","readyState"].forEach((function(e){Hr.prototype[e]=function(){return this.techGet_(e)}})),Fr.forEach((function(e){Hr.prototype["handleTech"+Oe(e)+"_"]=function(){return this.trigger(e)}})),Be.registerComponent("Player",Hr);var zr=o((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 Gr(e){return ea.hasOwnProperty(e)}function Kr(e){return Gr(e)?ea[e]:void 0}function Xr(e,t){e[Zr]=e[Zr]||{},e[Zr][t]=!0}function Yr(e,t,i){var n=(i?"before":"")+"pluginsetup";e.trigger(n,t),e.trigger(n+":"+t.name,t)}function $r(e,t){return t.prototype.name=e,function(){Yr(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=Qr(t,[this].concat(n));return this[e]=function(){return a},Yr(this,a.getEventHash()),a}}var Qr=o((function(e){function t(i,n,r){return 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}}()?e.exports=t=Reflect.construct:e.exports=t=function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&zr(r,i.prototype),r},t.apply(null,arguments)}e.exports=t})),Jr="plugin",Zr="activePlugins_",ea={},ta=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)),xe(this),delete this.trigger,Le(this,this.constructor.defaultState),Xr(t,this.name),this.dispose=ge(this,this.dispose),t.on("dispose",this.dispose)}var t=e.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(e){return void 0===e&&(e={}),e.name=this.name,e.plugin=this.constructor,e.instance=this,e},t.trigger=function(e,t){return void 0===t&&(t={}),pe(this.eventBusEl_,e,this.getEventHash(t))},t.handleStateChanged=function(e){},t.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Zr][e]=!1,this.player=this.state=null,t[e]=$r(e,ea[e])},e.isBasic=function(t){var i="string"==typeof t?Kr(t):t;return"function"==typeof i&&!e.prototype.isPrototypeOf(i.prototype)},e.registerPlugin=function(t,i){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(Gr(t))r.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(Hr.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 ea[t]=i,t!==Jr&&(e.isBasic(i)?Hr.prototype[t]=function(e,t){function i(){Yr(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return Xr(this,e),Yr(this,{name:e,plugin:t,instance:i}),i}return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(t,i):Hr.prototype[t]=$r(t,i)),i},e.deregisterPlugin=function(e){if(e===Jr)throw new Error("Cannot de-register base plugin.");Gr(e)&&(delete ea[e],delete Hr.prototype[e])},e.getPlugins=function(e){var t;return void 0===e&&(e=Object.keys(ea)),e.forEach((function(e){var i=Kr(e);i&&((t=t||{})[e]=i)})),t},e.getPluginVersion=function(e){var t=Kr(e);return t&&t.VERSION||""},e}();ta.getPlugin=Kr,ta.BASE_PLUGIN_NAME=Jr,ta.registerPlugin(Jr,ta),Hr.prototype.usingPlugin=function(e){return!!this[Zr]&&!0===this[Zr][e]},Hr.prototype.hasPlugin=function(e){return!!Gr(e)};var ia=function(e){return 0===e.indexOf("#")?e.slice(1):e};function na(e,t,i){var n=na.getPlayer(e);if(n)return t&&r.warn('Player "'+e+'" is already initialised. Options will not be applied.'),i&&n.ready(i),n;var a="string"==typeof e?G("#"+ia(e)):e;if(!_(a))throw new TypeError("The element or ID supplied is not valid. (videojs)");a.ownerDocument.defaultView&&a.ownerDocument.body.contains(a)||r.warn("The element supplied is not included in the DOM"),t=t||{},na.hooks("beforesetup").forEach((function(e){var i=e(a,Re(t));p(i)&&!Array.isArray(i)?t=Re(t,i):r.error("please return an object in beforesetup hooks")}));var s=Be.getComponent("Player");return n=new s(a,t,i),na.hooks("setup").forEach((function(e){return e(n)})),n}if(na.hooks_={},na.hooks=function(e,t){return na.hooks_[e]=na.hooks_[e]||[],t&&(na.hooks_[e]=na.hooks_[e].concat(t)),na.hooks_[e]},na.hook=function(e,t){na.hooks(e,t)},na.hookOnce=function(e,t){na.hooks(e,[].concat(t).map((function(t){return function i(){return na.removeHook(e,i),t.apply(void 0,arguments)}})))},na.removeHook=function(e,t){var i=na.hooks(e).indexOf(t);return!(i<=-1||(na.hooks_[e]=na.hooks_[e].slice(),na.hooks_[e].splice(i,1),0))},!0!==e.VIDEOJS_NO_DYNAMIC_STYLE&&y()){var ra=G(".vjs-styles-defaults");if(!ra){ra=Z("vjs-styles-defaults");var aa=G("head");aa&&aa.insertBefore(ra,aa.firstChild),ee(ra,"\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid {\n        padding-top: 56.25%\n      }\n    ")}}function sa(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Q(1,na),na.VERSION=i,na.options=Hr.prototype.options_,na.getPlayers=function(){return Hr.players},na.getPlayer=function(e){var t,i=Hr.players;if("string"==typeof e){var n=ia(e),r=i[n];if(r)return r;t=G("#"+n)}else t=e;if(_(t)){var a=t,s=a.player,o=a.playerId;if(s||i[o])return s||i[o]}},na.getAllPlayers=function(){return Object.keys(Hr.players).map((function(e){return Hr.players[e]})).filter(Boolean)},na.players=Hr.players,na.getComponent=Be.getComponent,na.registerComponent=function(e,t){Hi.isTech(t)&&r.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),Be.registerComponent.call(Be,e,t)},na.getTech=Hi.getTech,na.registerTech=Hi.registerTech,na.use=function(e,t){Wi[e]=Wi[e]||[],Wi[e].push(t)},Object.defineProperty(na,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(na.middleware,"TERMINATOR",{value:Gi,writeable:!1,enumerable:!0}),na.browser=ht,na.TOUCH_ENABLED=ot,na.extend=function(e,t){void 0===t&&(t={});var i=function(){e.apply(this,arguments)},n={};for(var r in"object"==typeof t?(t.constructor!==Object.prototype.constructor&&(i=t.constructor),n=t):"function"==typeof t&&(i=t),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&&zr(e,t)}(i,e),e&&(i.super_=e),n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r]);return i},na.mergeOptions=Re,na.bind=ge,na.registerPlugin=ta.registerPlugin,na.deregisterPlugin=ta.deregisterPlugin,na.plugin=function(e,t){return r.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),ta.registerPlugin(e,t)},na.getPlugins=ta.getPlugins,na.getPlugin=ta.getPlugin,na.getPluginVersion=ta.getPluginVersion,na.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),na.options.languages=Re(na.options.languages,((i={})[e]=t,i)),na.options.languages[e]},na.log=r,na.createLogger=a,na.createTimeRange=na.createTimeRanges=mt,na.formatTime=yn,na.setFormatTime=function(e){vn=e},na.resetFormatTime=function(){vn=gn},na.parseUrl=Mt,na.isCrossOrigin=Ft,na.EventTarget=ye,na.on=de,na.one=fe,na.off=he,na.trigger=pe,na.xhr=Zt,na.TextTrack=si,na.AudioTrack=oi,na.VideoTrack=ui,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((function(e){na[e]=function(){return r.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead"),X[e].apply(null,arguments)}})),na.computedStyle=m,na.dom=X,na.url=Yt,na.defineLazyProperty=Or;var oa=sa(o((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)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return i.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=n.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;l.path=s.normalizePath(d)}else l.path=o.path,a.params||(l.params=o.params,a.query||(l.query=o.query));return null===l.path&&(l.path=i.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(l)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(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}))),ua=sa(e),la=function(e,t){return/^[a-z]+:/i.test(t)?t:(/\/\//i.test(e)||(e=oa.default.buildAbsoluteURL(ua.default.location&&ua.default.location.href||"",e)),oa.default.buildAbsoluteURL(e,t))},ca=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),-1<i},t.trigger=function(e,t){var i=this.listeners[e];if(i)if(2===arguments.length)for(var n=i.length,r=0;r<n;++r)i[r].call(this,t);else for(var a=Array.prototype.slice.call(arguments,1),s=i.length,o=0;o<s;++o)i[o].apply(this,a)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();var da=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(e);function ha(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}var pa=function(e){for(var t=function(e){return da.default.atob?da.default.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},fa=function(e){function t(){var t;return(t=e.call(this)||this).buffer="",t}return ze(t,e),t.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");-1<t;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(ca),ma=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}ze(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,i){var n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((function(e){for(var r=0;r<n.customParsers.length;r++)if(n.customParsers[r].call(n,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))n.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void n.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"totalduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void n.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"byterange"},t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),void n.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"map"},t[1]){var a=ha(t[1]);if(a.URI&&(i.uri=a.URI),a.BYTERANGE){var s=a.BYTERANGE.split("@"),o=s[0],u=s[1];i.byterange={},o&&(i.byterange.length=parseInt(o,10)),u&&(i.byterange.offset=parseInt(u,10))}}n.trigger("data",i)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=ha(t[1]),i.attributes.RESOLUTION){var l=i.attributes.RESOLUTION.split("x"),c={};l[0]&&(c.width=parseInt(l[0],10)),l[1]&&(c.height=parseInt(l[1],10)),i.attributes.RESOLUTION=c}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}n.trigger("data",i)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=ha(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e))n.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))n.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=ha(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void n.trigger("data",i);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return i={type:"tag",tagType:"start"},t[1]&&(i.attributes=ha(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);n.trigger("data",{type:"tag",data:e.slice(4)})}}}else n.trigger("data",{type:"comment",text:e.slice(1)})})):this.trigger("data",{type:"uri",uri:e}))},i.addParser=function(e){var t=this,i=e.expression,n=e.customType,r=e.dataParser,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}(ca),ga=function(e){function t(){var t;(t=e.call(this)||this).lineStream=new fa,t.parseStream=new ma,t.lineStream.pipe(t.parseStream);var i,n,r=je(t),a=[],s={},o={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},l=0;t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};var c=0;return t.parseStream.on("data",(function(e){var t,d;({tag:function(){({"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&((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("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?void(this.manifest.contentProtection={"com.widevine.alpha":{attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:pa(e.attributes.URI.split(",")[1])}}):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,l=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||o,e.attributes?(s.attributes||(s.attributes={}),u(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||o,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(d={default:/yes/i.test(e.attributes.DEFAULT)}).default?d.autoselect=!0:d.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(d.language=e.attributes.LANGUAGE),e.attributes.URI&&(d.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(d.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(d.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(d.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=d}else 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},totalduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration}):this.manifest.totalDuration=e.duration},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data}}[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),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}ze(t,e);var i=t.prototype;return i.push=function(e){this.lineStream.push(e)},i.end=function(){this.lineStream.push("\n")},i.addParser=function(e){this.parseStream.addParser(e)},i.addTagMapper=function(e){this.parseStream.addTagMapper(e)},t}(ca),va=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var i=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,n=/^application\/dash\+xml/i;t.simpleTypeFromSourceType=function(e){return i.test(e)?"hls":n.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null}}));
/*! @name m3u8-parser @version 4.5.0 @license Apache-2.0 */s(va);var ya=va.simpleTypeFromSourceType,_a=/[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]/,ba=new RegExp("[\\-\\.0-9"+_a.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Ta=new RegExp("^"+_a.source+ba.source+"*(?::"+_a.source+ba.source+"*)?$");function Sa(){}function ka(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Ca(e,t,i,n,r,a){for(var s,o=++t,u=0;;){var l=e.charAt(o);switch(l){case"=":if(1===u)s=e.slice(t,o),u=3;else{if(2!==u)throw new Error("attribute equal must after attrName");u=3}break;case"'":case'"':if(3===u||1===u){if(1===u&&(a.warning('attribute value must after "="'),s=e.slice(t,o)),t=o+1,!(0<(o=e.indexOf(l,t))))throw new Error("attribute value no end '"+l+"' match");c=e.slice(t,o).replace(/&#?\w+;/g,r),i.add(s,c,t-1),u=5}else{if(4!=u)throw new Error('attribute value must after "="');c=e.slice(t,o).replace(/&#?\w+;/g,r),i.add(s,c,t),a.warning('attribute "'+s+'" missed start quot('+l+")!!"),t=o+1,u=5}break;case"/":switch(u){case 0:i.setTagName(e.slice(t,o));case 5:case 6:case 7:u=7,i.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==u&&i.setTagName(e.slice(t,o)),o;case">":switch(u){case 0:i.setTagName(e.slice(t,o));case 5:case 6:case 7:break;case 4:case 1:"/"===(c=e.slice(t,o)).slice(-1)&&(i.closed=!0,c=c.slice(0,-1));case 2:2===u&&(c=s),4==u?(a.warning('attribute "'+c+'" missed quot(")!!'),i.add(s,c.replace(/&#?\w+;/g,r),t)):("http://www.w3.org/1999/xhtml"===n[""]&&c.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),i.add(c,c,t));break;case 3:throw new Error("attribute value missed!!")}return o;case"":l=" ";default:if(l<=" ")switch(u){case 0:i.setTagName(e.slice(t,o)),u=6;break;case 1:s=e.slice(t,o),u=2;break;case 4:var c=e.slice(t,o).replace(/&#?\w+;/g,r);a.warning('attribute "'+c+'" missed quot(")!!'),i.add(s,c,t);case 5:u=6}else switch(u){case 2:i.tagName,"http://www.w3.org/1999/xhtml"===n[""]&&s.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),i.add(s,s,t),t=o,u=1;break;case 5:a.warning('attribute space is required"'+s+'"!!');case 6:u=1,t=o;break;case 3:u=4,t=o;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}o++}}function Ea(e,t,i){for(var n=e.tagName,r=null,a=e.length;a--;){var s=e[a],o=s.qName,u=s.value;if(0<(h=o.indexOf(":")))var l=s.prefix=o.slice(0,h),c=o.slice(h+1),d="xmlns"===l&&c;else l=null,d="xmlns"===(c=o)&&"";s.localName=c,!1!==d&&(null==r&&(r={},Aa(i,i={})),i[d]=r[d]=u,s.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(d,u))}for(a=e.length;a--;)(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==l&&(s.uri=i[l||""]));var h;c=0<(h=n.indexOf(":"))?(l=e.prefix=n.slice(0,h),e.localName=n.slice(h+1)):(l=null,e.localName=n);var p=e.uri=i[l||""];if(t.startElement(p,c,n,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,!0;if(t.endElement(p,c,n),r)for(l in r)t.endPrefixMapping(l)}function wa(e,t,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var a=e.indexOf("</"+i+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(i)||(s=s.replace(/&#?\w+;/g,n)),r.characters(s,0,s.length),a}return t+1}function Ia(e,t,i,n){var r=n[i];return null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),n[i]=r),r<t}function Aa(e,t){for(var i in e)t[i]=e[i]}function xa(e,t,i,n){if("-"===e.charAt(t+2))return"-"!==e.charAt(t+3)?-1:t<(r=e.indexOf("--\x3e",t+4))?(i.comment(e,t+4,r-t-4),r+3):(n.error("Unclosed comment"),-1);if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var 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),s=a.length;if(1<s&&/!doctype/i.test(a[0][0])){var o=a[1][0],u=3<s&&/^public$/i.test(a[2][0])&&a[3][0],l=4<s&&a[4][0],c=a[s-1];return i.startDTD(o,u&&u.replace(/^(['"])(.*?)\1$/,"$2"),l&&l.replace(/^(['"])(.*?)\1$/,"$2")),i.endDTD(),c.index+c[0].length}return-1}function Pa(e,t,i){var n=e.indexOf("?>",t);if(n){var r=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,i.processingInstruction(r[1],r[2]),n+2):-1}return-1}function La(e){}function Da(e,t){return e.__proto__=t,e}Sa.prototype={parse:function(e,t,i){var n=this.domBuilder;n.startDocument(),Aa(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)?function(e){if(65535<e){var t=55296+((e-=65536)>>10),i=56320+(1023&e);return String.fromCharCode(t,i)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function s(t){if(f<t){var 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=e.indexOf("<",f);if(m<0){if(!e.substr(f).match(/^\s*$/)){var g=n.doc,v=g.createTextNode(e.substr(f));g.appendChild(v),n.currentElement=v}return}switch(f<m&&s(m),e.charAt(m+1)){case"/":var y=e.indexOf(">",m+3),_=e.substring(m+2,y),b=h.pop();y<0?(_=e.substring(m+2).replace(/[\s<].*/,""),r.error("end tag name: "+_+" is not complete:"+b.tagName),y=m+1+_.length):_.match(/\s</)&&(_=_.replace(/[\s<].*/,""),r.error("end tag name: "+_+" maybe not complete"),y=m+1+_.length);var T=b.localNSMap,S=b.tagName==_;if(S||b.tagName&&b.tagName.toLowerCase()==_.toLowerCase()){if(n.endElement(b.uri,b.localName,_),T)for(var k in T)n.endPrefixMapping(k);S||r.fatalError("end tag name: "+_+" is not match the current start tagName:"+b.tagName)}else h.push(b);y++;break;case"?":d&&o(m),y=Pa(e,m,n);break;case"!":d&&o(m),y=xa(e,m,n,r);break;default:d&&o(m);var C=new La,E=h[h.length-1].currentNSMap,w=(y=Ca(e,m,C,E,a,r),C.length);if(!C.closed&&Ia(e,y,C.tagName,p)&&(C.closed=!0,i.nbsp||r.warning("unclosed xml attribute")),d&&w){for(var I=ka(d,{}),A=0;A<w;A++){var x=C[A];o(x.offset),x.locator=ka(d,{})}n.locator=I,Ea(C,n,E)&&h.push(C),n.locator=d}else Ea(C,n,E)&&h.push(C);"http://www.w3.org/1999/xhtml"!==C.uri||C.closed?y++:y=wa(e,y,C.tagName,a,n)}}catch(t){r.error("element parse error: "+t),y=-1}f<y?f=y:s(Math.max(m,f)+1)}}(e,t,i,n,this.errorHandler),n.endDocument()}},La.prototype={setTagName:function(e){if(!Ta.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,t,i){if(!Ta.test(e))throw new Error("invalid attribute:"+e);this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},Da({},Da.prototype)instanceof Da||(Da=function(e,t){function i(){}for(t in i.prototype=t,i=new i,e)i[t]=e[t];return i});var Oa=Sa;function Ra(e,t){for(var i in e)t[i]=e[i]}function Ma(e,t){var i=e.prototype;if(Object.create){var n=Object.create(t.prototype);i.__proto__=n}if(!(i instanceof t)){var r=function(){};r.prototype=t.prototype,Ra(i,r=new r),e.prototype=i=r}i.constructor!=e&&(i.constructor=e)}var Na="http://www.w3.org/1999/xhtml",Ua={},Fa=Ua.ELEMENT_NODE=1,Ba=Ua.ATTRIBUTE_NODE=2,ja=Ua.TEXT_NODE=3,Va=Ua.CDATA_SECTION_NODE=4,qa=Ua.ENTITY_REFERENCE_NODE=5,Ha=Ua.ENTITY_NODE=6,Wa=Ua.PROCESSING_INSTRUCTION_NODE=7,za=Ua.COMMENT_NODE=8,Ga=Ua.DOCUMENT_NODE=9,Ka=Ua.DOCUMENT_TYPE_NODE=10,Xa=Ua.DOCUMENT_FRAGMENT_NODE=11,Ya=Ua.NOTATION_NODE=12,$a={},Qa={},Ja=($a.INDEX_SIZE_ERR=(Qa[1]="Index size error",1),$a.DOMSTRING_SIZE_ERR=(Qa[2]="DOMString size error",2),$a.HIERARCHY_REQUEST_ERR=(Qa[3]="Hierarchy request error",3)),Za=($a.WRONG_DOCUMENT_ERR=(Qa[4]="Wrong document",4),$a.INVALID_CHARACTER_ERR=(Qa[5]="Invalid character",5),$a.NO_DATA_ALLOWED_ERR=(Qa[6]="No data allowed",6),$a.NO_MODIFICATION_ALLOWED_ERR=(Qa[7]="No modification allowed",7),$a.NOT_FOUND_ERR=(Qa[8]="Not found",8)),es=($a.NOT_SUPPORTED_ERR=(Qa[9]="Not supported",9),$a.INUSE_ATTRIBUTE_ERR=(Qa[10]="Attribute in use",10));function ts(e,t){if(t instanceof Error)var i=t;else i=this,Error.call(this,Qa[e]),this.message=Qa[e],Error.captureStackTrace&&Error.captureStackTrace(this,ts);return i.code=e,t&&(this.message=this.message+": "+t),i}function is(){}function ns(e,t){this._node=e,this._refresh=t,rs(this)}function rs(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var i=e._refresh(e._node);Rs(e,"length",i.length),Ra(i,e),e._inc=t}}function as(){}function ss(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function os(e,t,i,n){if(n?t[ss(t,n)]=i:t[t.length++]=i,e){var r=(i.ownerElement=e).ownerDocument;r&&(n&&fs(r,e,n),function(e,t,i){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==i.namespaceURI&&(t._nsMap[i.prefix?i.localName:""]=i.value)}(r,e,i))}}function us(e,t,i){var n=ss(t,i);if(!(0<=n))throw ts(Za,new Error(e.tagName+"@"+i));for(var r=t.length-1;n<r;)t[n]=t[++n];if(t.length=r,e){var a=e.ownerDocument;a&&(fs(a,e,i),i.ownerElement=null)}}function ls(e){if(this._features={},e)for(var t in e)this._features=e[t]}function cs(){}function ds(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function hs(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(hs(e,t))return!0}while(e=e.nextSibling)}function ps(){}function fs(e,t,i){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==i.namespaceURI&&delete t._nsMap[i.prefix?i.localName:""]}function ms(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 gs(e,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:e.firstChild=n,n?n.previousSibling=i:e.lastChild=i,ms(e.ownerDocument,e),t}function vs(e,t,i){var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===Xa){var r=t.firstChild;if(null==r)return t;var a=t.lastChild}else r=a=t;var s=i?i.previousSibling:e.lastChild;for(r.previousSibling=s,a.nextSibling=i,s?s.nextSibling=r:e.firstChild=r,null==i?e.lastChild=a:i.previousSibling=a;r.parentNode=e,r!==a&&(r=r.nextSibling););return ms(e.ownerDocument||e,e),t.nodeType==Xa&&(t.firstChild=t.lastChild=null),t}function ys(){this._nsMap={}}function _s(){}function bs(){}function Ts(){}function Ss(){}function ks(){}function Cs(){}function Es(){}function ws(){}function Is(){}function As(){}function xs(){}function Ps(){}function Ls(e,t){var i=[],n=9==this.nodeType?this.documentElement:this,r=n.prefix,a=n.namespaceURI;if(a&&null==r&&null==(r=n.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return Os(this,i,e,t,s),i.join("")}function Ds(e,t,i){var n=e.prefix||"",r=e.namespaceURI;if(!n&&!r)return!1;if("xml"===n&&"http://www.w3.org/XML/1998/namespace"===r||"http://www.w3.org/2000/xmlns/"==r)return!1;for(var a=i.length;a--;){var s=i[a];if(s.prefix==n)return s.namespace!=r}return!0}function Os(e,t,i,n,r){if(n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case Fa:r=r||[];var a=e.attributes,s=a.length,o=e.firstChild,u=e.tagName;i=Na===e.namespaceURI||i,t.push("<",u);for(var l=0;l<s;l++)"xmlns"==(c=a.item(l)).prefix?r.push({prefix:c.localName,namespace:c.value}):"xmlns"==c.nodeName&&r.push({prefix:"",namespace:c.value});for(l=0;l<s;l++){var c;if(Ds(c=a.item(l),0,r)){var d=c.prefix||"",h=c.namespaceURI,p=d?" xmlns:"+d:" xmlns";t.push(p,'="',h,'"'),r.push({prefix:d,namespace:h})}Os(c,t,i,n,r)}if(Ds(e,0,r)&&(d=e.prefix||"",h=e.namespaceURI,p=d?" xmlns:"+d:" xmlns",t.push(p,'="',h,'"'),r.push({prefix:d,namespace:h})),o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(t.push(">"),i&&/^script$/i.test(u))for(;o;)o.data?t.push(o.data):Os(o,t,i,n,r),o=o.nextSibling;else for(;o;)Os(o,t,i,n,r),o=o.nextSibling;t.push("</",u,">")}else t.push("/>");return;case Ga:case Xa:for(o=e.firstChild;o;)Os(o,t,i,n,r),o=o.nextSibling;return;case Ba:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,ds),'"');case ja:return t.push(e.data.replace(/[<&]/g,ds));case Va:return t.push("<![CDATA[",e.data,"]]>");case za:return t.push("\x3c!--",e.data,"--\x3e");case Ka:var f=e.publicId,m=e.systemId;if(t.push("<!DOCTYPE ",e.name),f)t.push(' PUBLIC "',f),m&&"."!=m&&t.push('" "',m),t.push('">');else if(m&&"."!=m)t.push(' SYSTEM "',m,'">');else{var g=e.internalSubset;g&&t.push(" [",g,"]"),t.push(">")}return;case Wa:return t.push("<?",e.target," ",e.data,"?>");case qa:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Rs(e,t,i){e[t]=i}$a.INVALID_STATE_ERR=(Qa[11]="Invalid state",11),$a.SYNTAX_ERR=(Qa[12]="Syntax error",12),$a.INVALID_MODIFICATION_ERR=(Qa[13]="Invalid modification",13),$a.NAMESPACE_ERR=(Qa[14]="Invalid namespace",14),$a.INVALID_ACCESS_ERR=(Qa[15]="Invalid access",15),ts.prototype=Error.prototype,Ra($a,ts),is.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var i=[],n=0;n<this.length;n++)Os(this[n],i,e,t);return i.join("")}},ns.prototype.item=function(e){return rs(this),this[e]},Ma(ns,is),as.prototype={length:0,item:is.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 ts(es);var i=this.getNamedItem(e.nodeName);return os(this._ownerElement,this,e,i),i},setNamedItemNS:function(e){var t,i=e.ownerElement;if(i&&i!=this._ownerElement)throw new ts(es);return t=this.getNamedItemNS(e.namespaceURI,e.localName),os(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return us(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var i=this.getNamedItemNS(e,t);return us(this._ownerElement,this,i),i},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var n=this[i];if(n.localName==t&&n.namespaceURI==e)return n}return null}},ls.prototype={hasFeature:function(e,t){var i=this._features[e.toLowerCase()];return!(!i||t&&!(t in i))},createDocument:function(e,t,i){var n=new ps;if(n.implementation=this,n.childNodes=new is,(n.doctype=i)&&n.appendChild(i),t){var r=n.createElementNS(e,t);n.appendChild(r)}return n},createDocumentType:function(e,t,i){var n=new Cs;return n.name=e,n.nodeName=e,n.publicId=t,n.systemId=i,n}},cs.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 vs(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return gs(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 is),r.ownerDocument=t,r.nodeType){case Fa:var o=i.attributes,u=r.attributes=new as,l=o.length;u._ownerElement=r;for(var c=0;c<l;c++)r.setAttributeNode(e(t,o.item(c),!0));break;case Ba: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==ja&&e.nodeType==ja?(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==Ba?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==Ba?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},Ra(Ua,cs),Ra(Ua,cs.prototype),ps.prototype={nodeName:"#document",nodeType:Ga,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType!=Xa)return null==this.documentElement&&e.nodeType==Fa&&(this.documentElement=e),vs(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),gs(this,e)},importNode:function(e,t){return function e(t,i,n){var r;switch(i.nodeType){case Fa:(r=i.cloneNode(!1)).ownerDocument=t;case Xa:break;case Ba: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 hs(this.documentElement,(function(i){if(i.nodeType==Fa&&i.getAttribute("id")==e)return t=i,!0})),t},createElement:function(e){var t=new ys;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new is,(t.attributes=new as)._ownerElement=t},createDocumentFragment:function(){var e=new As;return e.ownerDocument=this,e.childNodes=new is,e},createTextNode:function(e){var t=new Ts;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Ss;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ks;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new xs;return i.ownerDocument=this,i.tagName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new _s;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Is;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new ys,n=t.split(":"),r=i.attributes=new as;return i.childNodes=new is,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 _s,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}},Ma(ps,cs),ps.prototype.getElementsByTagName=(ys.prototype={nodeType:Fa,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===Xa?this.insertBefore(e,null):function(e,t){var i=t.parentNode;if(i){var n=e.lastChild;i.removeChild(t),n=e.lastChild}return n=e.lastChild,t.parentNode=e,t.previousSibling=n,t.nextSibling=null,n?n.nextSibling=t:e.firstChild=t,e.lastChild=t,ms(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new ns(this,(function(t){var i=[];return hs(t,(function(n){n===t||n.nodeType!=Fa||"*"!==e&&n.tagName!=e||i.push(n)})),i}))},getElementsByTagNameNS:function(e,t){return new ns(this,(function(i){var n=[];return hs(i,(function(r){r===i||r.nodeType!==Fa||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||n.push(r)})),n}))}}).getElementsByTagName,ps.prototype.getElementsByTagNameNS=ys.prototype.getElementsByTagNameNS,Ma(ys,cs),_s.prototype.nodeType=Ba,Ma(_s,cs),bs.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(Qa[Ja])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},Ma(bs,cs),Ts.prototype={nodeName:"#text",nodeType:ja,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},Ma(Ts,bs),Ss.prototype={nodeName:"#comment",nodeType:za},Ma(Ss,bs),ks.prototype={nodeName:"#cdata-section",nodeType:Va},Ma(ks,bs),Cs.prototype.nodeType=Ka,Ma(Cs,cs),Es.prototype.nodeType=Ya,Ma(Es,cs),ws.prototype.nodeType=Ha,Ma(ws,cs),Is.prototype.nodeType=qa,Ma(Is,cs),As.prototype.nodeName="#document-fragment",As.prototype.nodeType=Xa,Ma(As,cs),xs.prototype.nodeType=Wa,Ma(xs,cs),Ps.prototype.serializeToString=function(e,t,i){return Ls.call(e,t,i)},cs.prototype.toString=Ls;try{Object.defineProperty&&(Object.defineProperty(ns.prototype,"length",{get:function(){return rs(this),this.$$length}}),Object.defineProperty(cs.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case Fa:case Xa:var i=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&i.push(e(t)),t=t.nextSibling;return i.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case Fa:case Xa: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}}}),Rs=function(e,t,i){e["$$"+t]=i})}catch(e){}function Ms(e){return!!e&&"object"==typeof e}function Ns(){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.keys(t).forEach((function(i){Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):Ms(e[i])&&Ms(t[i])?e[i]=Ns(e[i],t[i]):e[i]=t[i]})),e}),{})}function Us(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Fs(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t}function Bs(e){var t=e.baseUrl,i=void 0===t?"":t,n=e.source,r=void 0===n?"":n,a=e.range,s=void 0===a?"":a,o=e.indexRange,u=void 0===o?"":o,l={uri:r,resolvedUri:la(i||"",r)};if(s||u){var c=(s||u).split("-"),d=parseInt(c[0],10),h=parseInt(c[1],10);l.byterange={length:h-d+1,offset:d}}return l}function js(e){var t=e.type,i=void 0===t?"static":t,n=e.duration,r=e.timescale,a=void 0===r?1:r,s=e.sourceDuration,o=vo[i](e),u=function(e,t){for(var i=[],n=e;n<t;n++)i.push(n);return i}(o.start,o.end).map(function(e){return function(t,i){var n=e.duration,r=e.timescale,a=void 0===r?1:r,s=e.periodIndex,o=e.startNumber;return{number:(void 0===o?1:o)+t,duration:n/a,timeline:s,time:i*n}}}(e));if("static"===i){var l=u.length-1;u[l].duration=s-n/a*l}return u}function Vs(e){var t=e.baseUrl,i=e.initialization,n=void 0===i?{}:i,r=e.sourceDuration,a=e.indexRange,s=void 0===a?"":a,o=e.duration;if(!t)throw new Error(fo);var u=Bs({baseUrl:t,source:n.sourceURL,range:n.range}),l=Bs({baseUrl:t,source:t,indexRange:s});if(l.map=u,o){var c=js(e);c.length&&(l.duration=c[0].duration,l.timeline=c[0].timeline)}else r&&(l.duration=r,l.timeline=0);return l.number=0,[l]}function qs(e,t,i){for(var n=e.sidx.map?e.sidx.map:null,r=e.sidx.duration,a=e.timeline||0,s=e.sidx.byterange,o=s.offset+s.length,u=t.timescale,l=t.references.filter((function(e){return 1!==e.referenceType})),c=[],d=o+t.firstOffset,h=0;h<l.length;h++){var p=t.references[h],f=p.referencedSize,m=Vs({baseUrl:i,timescale:u,timeline:a,periodIndex:a,duration:p.subsegmentDuration,sourceDuration:r,indexRange:d+"-"+(d+f-1)})[0];n&&(m.map=n),c.push(m),d+=f}return e.segments=c,e}function Hs(e){return function(e){return Object.keys(e).map((function(t){return e[t]}))}(e.reduce((function(e,t){var i,n=t.attributes.id+(t.attributes.lang||"");return e[n]?(t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[n].segments).push.apply(i,t.segments),t.attributes.contentProtection&&(e[n].attributes.contentProtection=t.attributes.contentProtection)):e[n]=t,e}),{})).map((function(e){return e.discontinuityStarts=function(e,t){return e.reduce((function(e,t,i){return t.discontinuity&&e.push(i),e}),[])}(e.segments),e}))}function Ws(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e){var n=e[i];if(n.sidx){var r=n.sidx.uri+"-"+(o=(s=n.sidx.byterange).offset+s.length-1,s.offset+"-"+o),a=t[r]&&t[r].sidx;n.sidx&&a&&qs(n,a,n.sidx.resolvedUri)}}var s,o;return e}function zs(e){var t,i=e.attributes,n=e.segments,r=e.sidx,a={attributes:(t={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(a.contentProtection=i.contentProtection),r&&(a.sidx=r),a}function Gs(e,t){for(var i,n,r,a,s,o,u,l,c,d,h,p,f=e.type,m=void 0===f?"static":f,g=e.minimumUpdatePeriod,v=void 0===g?0:g,y=e.media,_=void 0===y?"":y,b=e.sourceDuration,T=e.timescale,S=void 0===T?1:T,k=e.startNumber,C=void 0===k?1:k,E=e.periodIndex,w=[],I=-1,A=0;A<t.length;A++){var x=t[A],P=x.d,L=x.r||0,D=x.t||0;I<0&&(I=D),D&&I<D&&(I=D);var O=void 0;if(L<0){var R=A+1;O=R===t.length?"dynamic"===m&&0<v&&0<_.indexOf("$Number$")?(n=I,r=P,a=(i=e).NOW,s=i.clientOffset,o=i.availabilityStartTime,l=void 0===(u=i.timescale)?1:u,d=void 0===(c=i.start)?0:c,p=(a+s)/1e3+(void 0===(h=i.minimumUpdatePeriod)?0:h)-(o+d),Math.ceil((p*l-n)/r)):(b*S-I)/P:(t[R].t-I)/P}else O=L+1;for(var M=C+w.length+O,N=C+w.length;N<M;)w.push({number:N,duration:P/S,time:I,timeline:E}),I+=P,N++}return w}function Ks(e,t){return e.replace(yo,function(e){return function(t,i,n,r){if("$$"===t)return"$";if(void 0===e[i])return t;var a=""+e[i];return"RepresentationID"===i||(r=n?parseInt(r,10):1)<=a.length?a:new Array(r-a.length+1).join("0")+a}}(t))}function Xs(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,a=Bs({baseUrl:e.baseUrl,source:Ks(r.sourceURL,i),range:r.range});return function(e,t){return e.duration||t?e.duration?js(e):Gs(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}(e,t).map((function(t){i.Number=t.number,i.Time=t.time;var n=Ks(e.media||"",i);return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:la(e.baseUrl||"",n),map:a,number:t.number}}))}function Ys(e,t){var i=e.duration,n=e.segmentUrls,r=void 0===n?[]:n;if(!i&&!t||i&&t)throw new Error(mo);var a,s=r.map((function(t){return function(e,t){var i=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,a=Bs({baseUrl:i,source:r.sourceURL,range:r.range}),s=Bs({baseUrl:i,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)}));return i&&(a=js(e)),t&&(a=Gs(e,t)),a.map((function(e,t){if(s[t]){var i=s[t];return i.timeline=e.timeline,i.duration=e.duration,i.number=e.number,i}})).filter((function(e){return e}))}function $s(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=Xs,t=Ns(n,r.template)):r.base?(i=Vs,t=Ns(n,r.base)):r.list&&(i=Ys,t=Ns(n,r.list));var a={attributes:n};if(!i)return a;var s=i(t,r.timeline);if(t.duration){var o=t,u=o.duration,l=o.timescale,c=void 0===l?1:l;t.duration=u/c}else s.length?t.duration=s.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0;return a.attributes=t,a.segments=s,r.base&&t.indexRange&&(a.sidx=s[0],a.segments=[]),a}function Qs(e,t){return Fs(e.childNodes).filter((function(e){return e.tagName===t}))}function Js(e){return e.textContent.trim()}function Zs(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],u=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)}function eo(e){return e&&e.attributes?Fs(e.attributes).reduce((function(e,t){var i=_o[t.name]||_o.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}}function to(e,t){return t.length?Us(e.map((function(e){return t.map((function(t){return la(e,Js(t))}))}))):e}function io(e){var t=Qs(e,"SegmentTemplate")[0],i=Qs(e,"SegmentList")[0],n=i&&Qs(i,"SegmentURL").map((function(e){return Ns({tag:"SegmentURL"},eo(e))})),r=Qs(e,"SegmentBase")[0],a=i||t,s=a&&Qs(a,"SegmentTimeline")[0],o=i||r||t,u=o&&Qs(o,"Initialization")[0],l=t&&eo(t);l&&u?l.initialization=u&&eo(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,timeline:s&&Qs(s,"S").map((function(e){return eo(e)})),list:i&&Ns(eo(i),{segmentUrls:n,initialization:eo(u)}),base:r&&Ns(eo(r),{initialization:eo(u)})};return Object.keys(c).forEach((function(e){c[e]||delete c[e]})),c}function no(t,i){void 0===i&&(i={});var n=i,r=n.manifestUri,a=void 0===r?"":r,s=n.NOW,o=void 0===s?Date.now():s,u=n.clientOffset,l=void 0===u?0:u,c=Qs(t,"Period");if(!c.length)throw new Error(co);var d=Qs(t,"Location"),h=eo(t),p=to([a],Qs(t,"BaseURL"));return h.sourceDuration=h.mediaPresentationDuration||0,h.NOW=o,h.clientOffset=l,d.length&&(h.locations=d.map(Js)),{locations:h.locations,representationInfo:Us(c.map(function(t,i){return function(n,r){var a=to(i,Qs(n,"BaseURL")),s=eo(n),o=parseInt(s.id,10),u=e.isNaN(o)?r:o,l=Ns(t,{periodIndex:u}),c=Qs(n,"AdaptationSet"),d=io(n);return Us(c.map(function(e,t,i){return function(n){var r=eo(n),a=to(t,Qs(n,"BaseURL")),s={role:eo(Qs(n,"Role")[0])},o=Ns(e,r,s),u=function(e){return e.reduce((function(e,t){var i=eo(t),n=bo[i.schemeIdUri];if(n){e[n]={attributes:i};var r=Qs(t,"cenc:pssh")[0];if(r){var a=Js(r),s=a&&pa(a);e[n].pssh=s}}return e}),{})}(Qs(n,"ContentProtection"));Object.keys(u).length&&(o=Ns(o,{contentProtection:u}));var l=io(n),c=Qs(n,"Representation"),d=Ns(i,l);return Us(c.map(function(e,t,i){return function(n){var r=Qs(n,"BaseURL"),a=to(t,r),s=Ns(e,eo(n)),o=io(n);return a.map((function(e){return{segmentInfo:Ns(i,o),attributes:Ns(s,{baseUrl:e})}}))}}(o,a,d)))}}(l,a,d)))}}(h,p)))}}function ro(e){if(""===e)throw new Error(ho);var t=(new lo).parseFromString(e,"application/xml"),i=t&&"MPD"===t.documentElement.tagName?t.documentElement:null;if(!i||i&&0<i.getElementsByTagName("parsererror").length)throw new Error(po);return i}function ao(e,t){void 0===t&&(t={});var i=no(ro(e),t),n=function(e){return e.map($s)}(i.representationInfo);return function(e,t,i){var n;if(void 0===i&&(i={}),!e.length)return{};var r=e[0].attributes,a=r.sourceDuration,s=r.type,o=void 0===s?"static":s,u=r.suggestedPresentationDelay,l=r.minimumUpdatePeriod,c=Hs(e.filter((function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType}))).map(zs),d=Hs(e.filter((function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType}))),h=e.filter((function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType})),p={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(n={AUDIO:{},VIDEO:{}},n["CLOSED-CAPTIONS"]={},n.SUBTITLES={},n),uri:"",duration:a,playlists:Ws(c,i)};return 0<=l&&(p.minimumUpdatePeriod=1e3*l),t&&(p.locations=t),"dynamic"===o&&(p.suggestedPresentationDelay=u),d.length&&(p.mediaGroups.AUDIO.audio=function(e,t){var i;void 0===t&&(t={});var n=e.reduce((function(e,n){var r=n.attributes.role&&n.attributes.role.value||"",a=n.attributes.lang||"",s="main";if(a){var o=r?" ("+r+")":"";s=n.attributes.lang+o}return e[s]&&e[s].playlists[0].attributes.BANDWIDTH>n.attributes.bandwidth||(e[s]={language:a,autoselect:!0,default:"main"===r,playlists:Ws([function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,a={attributes:(t={NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(a.contentProtection=i.contentProtection),r&&(a.sidx=r),a}(n)],t),uri:""},void 0===i&&"main"===r&&((i=n).default=!0)),e}),{});return i||(n[Object.keys(n)[0]].default=!0),n}(d,i)),h.length&&(p.mediaGroups.SUBTITLES.subs=function(e,t){return void 0===t&&(t={}),e.reduce((function(e,i){var n=i.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:Ws([function(e){var t,i=e.attributes,n=e.segments;void 0===n&&(n=[{uri:i.baseUrl,timeline:i.periodIndex,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);var r=((t={NAME:i.id,BANDWIDTH:i.bandwidth})["PROGRAM-ID"]=1,t);return i.codecs&&(r.CODECS=i.codecs),{attributes:r,uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:i.baseUrl||"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1}}(i)],t),uri:""}),e}),{})}(h,i)),p}(n,i.locations,t.sidxMapping)}var so=ls,oo=Ps,uo=o((function(e,t){function i(e){this.options=e||{locator:{}}}function n(){this.cdata=!1}function r(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function a(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function s(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}i.prototype.parseFromString=function(e,t){var i=this.options,r=new o,a=i.domBuilder||new n,s=i.errorHandler,u=i.locator,l=i.xmlns||{},c={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return u&&a.setDocumentLocator(u),r.errorHandler=function(e,t,i){if(!e){if(t instanceof n)return t;e=t}var r={},a=e instanceof Function;function s(t){var n=e[t];!n&&a&&(n=2==e.length?function(i){e(t,i)}:e),r[t]=n&&function(e){n("[xmldom "+t+"]\t"+e+function(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(i))}||function(){}}return i=i||{},s("warning"),s("error"),s("fatalError"),r}(s,a,u),r.domBuilder=i.domBuilder||a,/\/x?html?$/.test(t)&&(c.nbsp=" ",c.copy="©",l[""]="http://www.w3.org/1999/xhtml"),l.xml=l.xml||"http://www.w3.org/XML/1998/namespace",e?r.parse(e,l,c):r.errorHandler.error("invalid doc source"),a.doc},n.prototype={startDocument:function(){this.doc=(new u).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,n){var a=this.doc,o=a.createElementNS(e,i||t),u=n.length;s(this,o),this.currentElement=o,this.locator&&r(this.locator,o);for(var l=0;l<u;l++){e=n.getURI(l);var c=n.getValue(l),d=(i=n.getQName(l),a.createAttributeNS(e,i));this.locator&&r(n.getLocator(l),d),d.value=d.nodeValue=c,o.setAttributeNode(d)}},endElement:function(e,t,i){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var i=this.doc.createProcessingInstruction(e,t);this.locator&&r(this.locator,i),s(this,i)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){if(e=a.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(e);else n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&r(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=a.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&r(this.locator,n),s(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var a=n.createDocumentType(e,t,i);this.locator&&r(this.locator,a),s(this,a)}},warning:function(e){},error:function(e){},fatalError:function(e){throw e}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){n.prototype[e]=function(){return null}}));var o=Oa,u=t.DOMImplementation=so;t.XMLSerializer=oo,t.DOMParser=i})),lo=(uo.DOMImplementation,uo.XMLSerializer,uo.DOMParser),co="INVALID_NUMBER_OF_PERIOD",ho="DASH_EMPTY_MANIFEST",po="DASH_INVALID_XML",fo="NO_BASE_URL",mo="SEGMENT_TIME_UNSPECIFIED",go="UNSUPPORTED_UTC_TIMING_SCHEME",vo={static:function(e){var t=e.duration,i=e.timescale,n=void 0===i?1:i,r=e.sourceDuration;return{start:0,end:Math.ceil(r/(t/n))}},dynamic:function(e){var t=e.NOW,i=e.clientOffset,n=e.availabilityStartTime,r=e.timescale,a=void 0===r?1:r,s=e.duration,o=e.start,u=void 0===o?0:o,l=e.minimumUpdatePeriod,c=void 0===l?0:l,d=e.timeShiftBufferDepth,h=void 0===d?1/0:d,p=(t+i)/1e3,f=n+u,m=p+c-f,g=Math.ceil(m*a/s),v=Math.floor((p-f-h)*a/s),y=Math.floor((p-f)*a/s);return{start:Math.max(0,v),end:Math.min(g,y)}}},yo=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,_o={mediaPresentationDuration:function(e){return Zs(e)},availabilityStartTime:function(e){return function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z"),Date.parse(e)}(e)/1e3},minimumUpdatePeriod:function(e){return Zs(e)},suggestedPresentationDelay:function(e){return Zs(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return Zs(e)},start:function(e){return Zs(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?Zs(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}},bo={"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"},To=o((function(e,t){function i(e){return e instanceof Uint8Array?e:new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0)}function n(e){if(!e)return"";e=Array.prototype.slice.call(e);var t=String.fromCharCode.apply(null,i(e));try{return decodeURIComponent(escape(t))}catch(e){}return t}function r(e,t){void 0===t&&(t=0);var n=(e=i(e))[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?20+n:10+n}function a(e,t){return void 0===t&&(t=0),(e=i(e)).length-t<10||"ID3"!==n(e.subarray(t,t+3))?t:a(e,t+=r(e,t))}Object.defineProperty(t,"__esModule",{value:!0});var s={aac:function(e){var t=a(e);return e.length>=t+2&&255==(255&e[t])&&224==(224&e[t+1])&&16==(22&e[t+1])},mp3:function(e){var t=a(e);return e.length>=t+2&&255==(255&e[t])&&224==(224&e[t+1])&&2==(6&e[t+1])},webm:function(e){return 4<=e.length&&26==(255&e[0])&&69==(255&e[1])&&223==(255&e[2])&&163==(255&e[3])},mp4:function(e){return 8<=e.length&&/^(f|s)typ$/.test(n(e.subarray(4,8)))&&!/^ftyp3g$/.test(n(e.subarray(4,10)))},"3gp":function(e){return 10<=e.length&&/^ftyp3g$/.test(n(e.subarray(4,10)))},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){return 4<=e.length&&/^fLaC$/.test(n(e.subarray(0,4)))},ogg:function(e){return 4<=e.length&&/^OggS$/.test(n(e.subarray(0,4)))}},o=Object.keys(s).filter((function(e){return"ts"!==e})).concat("ts");o.forEach((function(e){var t=s[e];s[e]=function(e){return t(i(e))}})),t.detectContainerForBytes=function(e){e=i(e);for(var t=0;t<o.length;t++){var n=o[t];if(s[n](e))return n}return""},t.getId3Offset=a,t.id3Size=r,t.isLikely=s,t.isLikelyFmp4MediaSegment=function(e){e=i(e);for(var t=0;t<e.length;){var r=(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0;if("moof"===n(e.subarray(t+4,t+8)))return!0;0==r||r+t>e.length?t=e.length:t+=r}return!1}}));s(To);var So=To.detectContainerForBytes,ko=To.getId3Offset,Co=(To.id3Size,To.isLikely,To.isLikelyFmp4MediaSegment),Eo=o((function(e,t){function i(e){return e instanceof Uint8Array?e:new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0)}Object.defineProperty(t,"__esModule",{value:!0}),t.bytesToString=function(e){if(!e)return"";e=Array.prototype.slice.call(e);var t=String.fromCharCode.apply(null,i(e));try{return decodeURIComponent(escape(t))}catch(e){}return t},t.concatTypedArrays=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.reduce((function(e,t){return e+(t&&(t.byteLength||t.length)||0)}),0),a=new Uint8Array(r),s=0;return t.forEach((function(e){e=i(e),a.set(e,s),s+=e.byteLength})),a},t.isTypedArray=function(e){return ArrayBuffer.isView(e)},t.stringToBytes=function(e,t){return void 0===t&&(t=!1),"string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e?[]:(t||(e=unescape(encodeURIComponent(e))),e.split("").map((function(e){return 255&e.charCodeAt(0)})))},t.toUint8=i}));function wo(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),-1<n)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(a=[],n=arguments.length,n=1;n<arguments.length;++n)a.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,a)}},this.dispose=function(){e={}}}}s(Eo),Eo.bytesToString;var Io=Eo.concatTypedArrays,Ao=(Eo.isTypedArray,Eo.stringToBytes),xo=Eo.toUint8;function Po(e){var t=31&e[1];return(t<<=8)|e[2]}function Lo(e){return!!(64&e[1])}function Do(e){var t=0;return 1<(48&e[3])>>>4&&(t+=e[4]+1),t}function Oo(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}}function Ro(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return i=0<=i?i:0,(16&e[t+5])>>4?i+20:i+10}function Mo(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}wo.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},wo.prototype.push=function(e){this.trigger("data",e)},wo.prototype.flush=function(e){this.trigger("done",e)},wo.prototype.partialFlush=function(e){this.trigger("partialdone",e)},wo.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},wo.prototype.reset=function(e){this.trigger("reset",e)},new wo;var No={parseType:function(e,t){var i=Po(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=Lo(e),i=4+Do(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=Lo(e),n=4+Do(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var 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:Lo,parsePesType:function(e,t){switch(t[Po(e)]){case 27:return"video";case 15:return"audio";case 21:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!Lo(e))return null;var t=4+Do(e);if(t>=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+Do(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"===Oo(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"===Oo(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"===Oo(31&i[r+3])&&(a=!0),a}},Uo=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Fo={isLikelyAacData:function(e){var t=function e(t,i){return t.length-i<10||t[i]!=="I".charCodeAt(0)||t[i+1]!=="D".charCodeAt(0)||t[i+2]!=="3".charCodeAt(0)?i:e(t,i+=Ro(t,i))}(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:Ro,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 Uo[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=Mo(e.subarray(10,14)));do{if((i=Mo(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r<n.byteLength;r++)if(0===n[r]){if("com.apple.streaming.transportStreamTimestamp"!==unescape(function(e,t,i){var n,r="";for(n=0;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r}(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])}}t+=10,t+=i}while(t<e.byteLength);return null}},Bo=(function(e){return 9e4*e},function(e,t){return e*t},function(e){return e/9e4},function(e,t){return e/t},9e4),jo=function(e,t){var i=1;for(t<e&&(i=-1);4294967296<Math.abs(t-e);)e+=8589934592*i;return e},Vo={};function qo(e,t,i){for(var n,r,a,s,o=0,u=Xo,l=!1;u<=e.byteLength;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o++,u++;else{if("pes"===(n=e.subarray(o,u),Vo.ts.parseType(n,t.pid)))r=Vo.ts.parsePesType(n,t.table),a=Vo.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=Vo.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0);if(l)break;o+=Xo,u+=Xo}for(o=(u=e.byteLength)-Xo,l=!1;0<=o;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o--,u--;else{if("pes"===(n=e.subarray(o,u),Vo.ts.parseType(n,t.pid)))r=Vo.ts.parsePesType(n,t.table),a=Vo.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=Vo.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0);if(l)break;o-=Xo,u-=Xo}}function Ho(e,t,i){for(var n,r,a,s,o,u,l,c=0,d=Xo,h=!1,p={data:[],size:0};d<e.byteLength;)if(71!==e[c]||71!==e[d])c++,d++;else{if("pes"===(n=e.subarray(c,d),Vo.ts.parseType(n,t.pid)))if(r=Vo.ts.parsePesType(n,t.table),a=Vo.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(a&&!h&&(s=Vo.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),h=!0),!i.firstKeyFrame)){if(a&&0!==p.size){for(o=new Uint8Array(p.size),u=0;p.data.length;)l=p.data.shift(),o.set(l,u),u+=l.byteLength;if(Vo.ts.videoPacketContainsKeyFrame(o)){var f=Vo.ts.parsePesTime(o);f&&(i.firstKeyFrame=f,i.firstKeyFrame.type="video")}p.size=0}p.data.push(n),p.size+=n.byteLength}if(h&&i.firstKeyFrame)break;c+=Xo,d+=Xo}for(c=(d=e.byteLength)-Xo,h=!1;0<=c;)if(71!==e[c]||71!==e[d])c--,d--;else{if("pes"===(n=e.subarray(c,d),Vo.ts.parseType(n,t.pid)))r=Vo.ts.parsePesType(n,t.table),a=Vo.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=Vo.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),h=!0);if(h)break;c-=Xo,d-=Xo}}Vo.ts=No,Vo.aac=Fo;var Wo,zo,Go,Ko=9e4,Xo=188,Yo=function(e,t){var i;return(i=Vo.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(Vo.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=Vo.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=Vo.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=Vo.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=Vo.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var u=Ko/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*u,pts:a+1024*n*u}]}}(e):function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=Xo;r<e.byteLength;)if(71!==e[n]||71!==e[r])n++,r++;else{switch(i=e.subarray(n,r),Vo.ts.parseType(i,t.pid)){case"pat":t.pid||(t.pid=Vo.ts.parsePat(i));break;case"pmt":t.table||(t.table=Vo.ts.parsePmt(i))}if(t.pid&&t.table)return;n+=Xo,r+=Xo}}(e,t),t.table)if(t.table.hasOwnProperty(n))switch(t.table[n]){case 27:i.video=[],Ho(e,t,i),0===i.video.length&&delete i.video;break;case 15:i.audio=[],qo(e,t,i),0===i.audio.length&&delete i.audio}return i}(e))&&(i.audio||i.video)?(function(e,t){if(e.audio&&e.audio.length){var i=t;void 0===i&&(i=e.audio[0].dts),e.audio.forEach((function(e){e.dts=jo(e.dts,i),e.pts=jo(e.pts,i),e.dtsTime=e.dts/Ko,e.ptsTime=e.pts/Ko}))}if(e.video&&e.video.length){var n=t;if(void 0===n&&(n=e.video[0].dts),e.video.forEach((function(e){e.dts=jo(e.dts,n),e.pts=jo(e.pts,n),e.dtsTime=e.dts/Ko,e.ptsTime=e.pts/Ko})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=jo(r.dts,n),r.pts=jo(r.pts,n),r.dtsTime=r.dts/Ko,r.ptsTime=r.dts/Ko}}}(i,t),i):null},$o=function(e){return e>>>0},Qo=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])},Jo=$o,Zo=function e(t,i){var n,r,a,s,o,u=[];if(!i.length)return null;for(n=0;n<t.byteLength;)r=Jo(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),a=Qo(t.subarray(n+4,n+8)),s=1<r?n+r:t.byteLength,a===i[0]&&(1===i.length?u.push(t.subarray(n+8,s)):(o=e(t.subarray(n+8,s),i.slice(1))).length&&(u=u.concat(o))),n=s;return u},eu=$o,tu=function(e){return("00"+e.toString(16)).slice(-2)};Wo=function(e,t){var i,n,r;return i=Zo(t,["moof","traf"]),n=[].concat.apply([],i.map((function(t){return Zo(t,["tfhd"]).map((function(i){var n,r;return n=eu(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),r=e[n]||9e4,(Zo(t,["tfdt"]).map((function(e){var t,i;return t=e[0],i=eu(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=eu(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),i}))[0]||1/0)/r}))}))),r=Math.min.apply(null,n),isFinite(r)?r:0},zo=function(e){var t=Zo(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,n,r={},a=Zo(e,["tkhd"])[0];a&&(n=(t=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0),r.id=0===n?t.getUint32(12):t.getUint32(20));var s=Zo(e,["mdia","hdlr"])[0];if(s){var o=Qo(s.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var u=Zo(e,["mdia","minf","stbl","stsd"])[0];if(u){var l=u.subarray(8);r.codec=Qo(l.subarray(4,8));var c,d=Zo(l,[r.codec])[0];d&&(/^[a-z]vc[1-9]$/i.test(r.codec)?(c=d.subarray(78),"avcC"===Qo(c.subarray(4,8))&&11<c.length?(r.codec+=".",r.codec+=tu(c[9]),r.codec+=tu(c[10]),r.codec+=tu(c[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)&&(c=d.subarray(28),"esds"===Qo(c.subarray(4,8))&&20<c.length&&0!==c[19]?(r.codec+="."+tu(c[19]),r.codec+="."+tu(c[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"))}var h=Zo(e,["mdia","mdhd"])[0];h&&(r.timescale=Go(h)),i.push(r)})),i};var iu=Wo,nu=zo,ru=(Go=function(e){var t=0===e[0]?12:20;return eu(e[t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])},o((function(t,i){function n(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)})):e}function r(e){return e.map(n)}function a(e){void 0===e&&(e="");var t=e.split(","),i={};return t.forEach((function(e){e=e.trim(),["video","audio"].forEach((function(t){var n=l[t].exec(e.toLowerCase());if(n&&!(n.length<=1)){var r=e.substring(0,n[1].length),a=e.replace(r,"");i[t]={type:r,details:a}}}))})),i}function s(e){return void 0===e&&(e=""),l.audio.test(e.trim().toLowerCase())}function o(e){if(e&&"string"==typeof e){var t=e.toLowerCase().split(",").map((function(e){return n(e.trim())})),i="video";1===t.length&&s(t[0])&&(i="audio");var r="mp4";return t.every((function(e){return l.mp4.test(e)}))?r="mp4":t.every((function(e){return l.webm.test(e)}))?r="webm":t.every((function(e){return l.ogg.test(e)}))&&(r="ogg"),i+"/"+r+';codecs="'+e+'"'}}Object.defineProperty(i,"__esModule",{value:!0});var u=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(e),l={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v)/,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)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/};i.DEFAULT_AUDIO_CODEC="mp4a.40.2",i.DEFAULT_VIDEO_CODEC="avc1.4d400d",i.browserSupportsCodec=function(e){return void 0===e&&(e=""),u.default.MediaSource&&u.default.MediaSource.isTypeSupported&&u.default.MediaSource.isTypeSupported(o(e))||!1},i.codecsFromDefault=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return a(r.playlists[0].attributes.CODECS)}return null},i.getMimeForCodec=o,i.isAudioCodec=s,i.isVideoCodec=function(e){return void 0===e&&(e=""),l.video.test(e.trim().toLowerCase())},i.mapLegacyAvcCodecs=function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e){return r([e])[0]}))},i.muxerSupportsCodec=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every((function(e){return e=e.trim(),l.muxerVideo.test(e)||l.muxerAudio.test(e)}))},i.parseCodecs=a,i.translateLegacyCodec=n,i.translateLegacyCodecs=r})));function au(e,t,i){return e&&i&&i.responseURL&&t!==i.responseURL?i.responseURL:t}function su(e,t){return e+"-"+t}function ou(e){var t=e.manifestString,i=e.customTagParsers,n=void 0===i?[]:i,r=e.customTagMappers,a=void 0===r?[]:r,s=new ga;return n.forEach((function(e){return s.addParser(e)})),a.forEach((function(e){return s.addTagMapper(e)})),s.push(t),s.end(),s.manifest}function uu(e,t){["AUDIO","SUBTITLES"].forEach((function(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 lu(e){var t=e.playlist,i=e.uri,n=e.id;t.id=n,i&&(t.uri=i),t.attributes=t.attributes||{}}function cu(e,t){e.uri=t;for(var i=0;i<e.playlists.length;i++)if(!e.playlists[i].uri){var n="placeholder-uri-"+i;e.playlists[i].uri=n}uu(e,(function(t,i,n,r){if(t.playlists&&t.playlists.length&&!t.playlists[0].uri){var a="placeholder-uri-"+i+"-"+n+"-"+r,s=su(0,a);t.playlists[0].uri=a,t.playlists[0].id=s,e.playlists[s]=t.playlists[0],e.playlists[a]=t.playlists[0]}})),function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];lu({playlist:i,id:su(t,i.uri)}),i.resolvedUri=dl(e.uri,i.uri),e.playlists[i.id]=i,(e.playlists[i.uri]=i).attributes.BANDWIDTH||hl.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}(e),function(e){uu(e,(function(t){t.uri&&(t.resolvedUri=dl(e.uri,t.uri))}))}(e)}function du(e,t){e.resolvedUri||(e.resolvedUri=dl(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=dl(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=dl(t,e.map.uri))}function hu(e,t){var i=pl(e,{}),n=i.playlists[t.id];if(!n)return null;if(n.segments&&t.segments&&n.segments.length===t.segments.length&&n.endList===t.endList&&n.mediaSequence===t.mediaSequence)return null;var r=pl(n,t);n.segments&&(r.segments=function(e,t,i){var n=t.slice();i=i||0;for(var r=Math.min(e.length,t.length+i),a=i;a<r;a++)n[a-i]=pl(e[a],n[a-i]);return n}(n.segments,t.segments,t.mediaSequence-n.mediaSequence)),r.segments.forEach((function(e){du(e,r.resolvedUri)}));for(var a=0;a<i.playlists.length;a++)i.playlists[a].id===t.id&&(i.playlists[a]=r);return i.playlists[t.id]=r,i.playlists[t.uri]=r,i}function pu(e,t){var i=e.segments[e.segments.length-1];return t&&i&&i.duration?1e3*i.duration:500*(e.targetDuration||10)}function fu(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 na.createTimeRanges(n)}function mu(e,t){return fu(e,(function(e,i){return e-.1<=t&&t<=i+.1}))}function gu(e,t){return fu(e,(function(e){return t<=e-ml}))}function vu(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 yu(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}function _u(e,t,i){if(void 0===t&&(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+=r.duration,void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t);if(n.precise)return n.result;var r=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+=i.duration,void 0!==i.end)return{result:i.end-n,precise:!0}}return{result:-1,precise:!1}}(e,t);return r.precise?r.result:n.result+i}function bu(t,i,n){if(!t)return 0;if("number"!=typeof n&&(n=0),void 0===i){if(t.totalDuration)return t.totalDuration;if(!t.endList)return e.Infinity}return _u(t,i,n)}function Tu(e,t,i){var n=0;if(i<t){var r=[i,t];t=r[0],i=r[1]}if(t<0){for(var a=t;a<Math.min(0,i);a++)n+=e.targetDuration;t=0}for(var s=t;s<i;s++)n+=e.segments[s].duration;return n}function Su(e,t){if(!e.segments.length)return 0;var i=e.segments.length,n=e.segments[i-1].duration||e.targetDuration,r="number"==typeof t?t:n+2*e.targetDuration;if(0===r)return i;for(var a=0;i--&&!(r<=(a+=e.segments[i].duration)););return Math.max(0,i)}function ku(e,t,i,n){if(!e||!e.segments)return null;if(e.endList)return bu(e);if(null===t)return null;t=t||0;var r=i?Su(e,n):e.segments.length;return _u(e,e.mediaSequence+r,t)}function Cu(e){return e.excludeUntil&&e.excludeUntil>Date.now()}function Eu(e){return e.excludeUntil&&e.excludeUntil===1/0}function wu(e){var t=Cu(e);return!e.disabled&&!t}function Iu(e,t){return t.attributes&&t.attributes[e]}function Au(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!!wu(e)&&(e.attributes.BANDWIDTH||0)<i})).length}function xu(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),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)))),n(t,e)}function Pu(){return function e(t,i){t=_l({timeout:45e3},t);var n=e.beforeRequest||na.Vhs.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var a=yl(t,(function(e,t){return xu(a,e,t,i)})),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=t.uri,a.requestTime=Date.now(),a}}function Lu(e){var t={};return e.byterange&&(t.Range=function(e){var t=e.offset+e.length-1;return"bytes="+e.offset+"-"+t}(e.byterange)),t}function Du(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")}function Ou(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function Ru(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t}function Mu(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function Nu(e){return e.resolvedUri}function Uu(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(Du).join("")+" "+t.slice(16*n,16*n+16).map(Ou).join("")+"\n";return i}function Fu(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");if(void 0===t||!i||!a)return l({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!i.endList&&!u.hasStarted_)return l({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1;return!0}(i))return l({message:"programDateTime tags must be provided in the manifest "+i.resolvedUri});var c=function(e,t){var i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;var n=t.segments[0];if(i<n.dateTimeObject)return null;for(var r=0;r<t.segments.length-1&&(n=t.segments[r],!(i<t.segments[r+1].dateTimeObject));r++);var a=t.segments[t.segments.length-1],s=a.dateTimeObject,o=a.videoTimingInfo?function(e){return e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds}(a.videoTimingInfo):a.duration+.25*a.duration;return new Date(s.getTime()+1e3*o)<i?null:(s<i&&(n=a),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:vl.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(t,i);if(!c)return l({message:t+" was not found in the stream"});var d=c.segment,h=function(e,t){var i,n;try{i=new Date(e),n=new Date(t)}catch(e){}var r=i.getTime();return(n.getTime()-r)/1e3}(d.dateTimeObject,t);if("estimate"===c.type)return 0===r?l({message:t+" is not buffered yet. Try again"}):(a(c.estimatedStart+h),void u.one("seeked",(function(){Fu({programTime:t,playlist:i,retryCount:r-1,seekTo:a,pauseAfterSeek:o,tech:u,callback:l})})));var p=d.start+h;u.one("seeked",(function(){return l(null,u.currentTime())})),o&&u.pause(),a(p)}function Bu(e,t){if(4===e.readyState)return t()}function ju(e){var t=e.masterXml,i=e.srcUrl,n=ao(t,{manifestUri:i,clientOffset:e.clientOffset,sidxMapping:e.sidxMapping});return cu(n,i),n}function Vu(e,t){for(var i=!0,n=Tl(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),r=0;r<t.playlists.length;r++){var a=hu(n,t.playlists[r]);a&&(n=a,i=!1)}return uu(t,(function(e,t,r,a){if(e.playlists&&e.playlists.length){var s=e.playlists[0].id,o=hu(n,e.playlists[0]);o&&((n=o).mediaGroups[t][r][a].playlists[0]=n.playlists[s],i=!1)}})),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(i=!1),i?null:n}function qu(e){var t=e.byterange.offset+e.byterange.length-1;return e.uri+"-"+e.byterange.offset+"-"+t}function Hu(e,t){var i,n,r={};for(var a in e){var s=e[a].sidx;if(s){var o=qu(s);if(!t[o])break;i=t[o].sidxInfo,n=s,(Boolean(!i.map&&!n.map)||Boolean(i.map&&n.map&&i.map.byterange.offset===n.map.byterange.offset&&i.map.byterange.length===n.map.byterange.length))&&i.uri===n.uri&&i.byterange.offset===n.byterange.offset&&i.byterange.length===n.byterange.length&&(r[o]=t[o])}}return r}function Wu(e,t,i,n,r,a){var s={uri:au(r.handleManifestRedirects,t.resolvedUri),byterange:t.byterange,playlist:i},o=na.mergeOptions(s,{responseType:"arraybuffer",headers:Lu(s)});return 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);if(s=Io(s,Ao(i,!0)),a=a||ko(s),s.length<10||a&&s.length<a+2)return Bu(t,(function(){return n(e,t,"",s)}));var r=So(s);return"ts"===r&&s.length<188||!r&&s.length<376?Bu(t,(function(){return n(e,t,"",s)})):n(null,t,r,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,xu(e,null,{statusCode:e.status},r)}))}},(function(e,t){return xu(u,e,t,r)}));return u}(s.uri,n,(function(t,r,u,l){if(t)return a(t,r);if(!u||"mp4"!==u)return a({status:r.status,message:"Unsupported "+(u||"unknown")+" container type for sidx segment at URL: "+s.uri,response:"",playlist:i,internal:!0,blacklistDuration:1/0,code:2},r);var c=s.byterange,d=c.offset,h=c.length;if(l.length>=h+d)return a(t,{response:l.subarray(d,d+h),status:r.status,uri:r.uri});e.request=n(o,a)}))}function zu(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t.buffer}function Gu(e){var t=e.transmuxer,i=e.bytes,n=e.audioAppendStart,r=e.gopsToAlignWith,a=e.isPartial,s=e.remux,o=e.onData,u=e.onTrackInfo,l=e.onAudioTimingInfo,c=e.onVideoTimingInfo,d=e.onVideoSegmentTimingInfo,h=e.onId3,p=e.onCaptions,f=e.onDone,m={isPartial:a,buffer:[]};if(t.onmessage=function(e){el&&("data"===e.data.action&&function(e,t,i){var n=e.data.segment,r=n.type,a=n.initSegment,s=n.captions,o=n.captionStreams,u=n.metadata,l=n.videoFrameDtsTime,c=n.videoFramePtsTime;t.buffer.push({captions:s,captionStreams:o,metadata:u});var d=e.data.segment.boxes||{data:e.data.segment.data},h={type:r,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};void 0!==l&&(h.videoFrameDtsTime=l),void 0!==c&&(h.videoFramePtsTime=c),i(h)}(e,m,o),"trackinfo"===e.data.action&&u(e.data.trackInfo),"gopInfo"===e.data.action&&function(e,t){t.gopInfo=e.data.gopInfo}(e,m),"audioTimingInfo"===e.data.action&&l(e.data.audioTimingInfo),"videoTimingInfo"===e.data.action&&c(e.data.videoTimingInfo),"videoSegmentTimingInfo"===e.data.action&&d(e.data.videoSegmentTimingInfo),"id3Frame"===e.data.action&&h([e.data.id3Frame],e.data.id3Frame.dispatchType),"caption"===e.data.action&&p(e.data.caption),"transmuxed"===e.data.type&&(t.onmessage=null,function(e){var t=e.transmuxedData,i=e.callback;t.buffer=[],i(t)}({transmuxedData:m,callback:f}),El()))},n&&t.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==s&&t.postMessage({action:"setRemux",remux:s}),i.byteLength){var g=i instanceof ArrayBuffer?i:i.buffer,v=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:g,byteOffset:v,byteLength:i.byteLength},[g])}t.postMessage({action:a?"partialFlush":"flush"})}function Ku(e,t){e.postMessage({action:t}),El()}function Xu(e,t){el?Cl.push(Ku.bind(null,t,e)):Ku(t,el=e)}function Yu(e){e.forEach((function(e){e.abort()}))}function $u(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Al,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:xl,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Il,xhr:t}:null}function Qu(e){var t=e.segment,i=e.bytes,n=e.isPartial,r=e.trackInfoFn,a=e.timingInfoFn,s=e.videoSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.dataFn,c=e.doneFn,d=t.map&&t.map.tracks||{},h=Boolean(d.audio&&d.video),p=a.bind(null,t,"audio","start"),f=a.bind(null,t,"audio","end"),m=a.bind(null,t,"video","start"),g=a.bind(null,t,"video","end");if(!n&&!t.lastReachedChar){var v=function(e,t){var i=Yo(e,t*Bo);if(!i)return null;var n={hasVideo:i.video&&2===i.video.length||!1,hasAudio:i.audio&&2===i.audio.length||!1};return n.hasVideo&&(n.videoStart=i.video[0].ptsTime),n.hasAudio&&(n.audioStart=i.audio[0].ptsTime),n}(i,t.baseStartTime);v&&(r(t,{hasAudio:v.hasAudio,hasVideo:v.hasVideo,isMuxed:h}),r=null,v.hasAudio&&!h&&p(v.audioStart),v.hasVideo&&m(v.videoStart),m=p=null)}!function(e){el?Cl.push(e):Gu(el=e)}({bytes:i,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,isPartial:n,remux:h,onData:function(e){e.type="combined"===e.type?"video":e.type,l(t,e)},onTrackInfo:function(e){r&&(h&&(e.isMuxed=!0),r(t,e))},onAudioTimingInfo:function(e){p&&void 0!==e.start&&(p(e.start),p=null),f&&void 0!==e.end&&f(e.end)},onVideoTimingInfo:function(e){m&&void 0!==e.start&&(m(e.start),m=null),g&&void 0!==e.end&&g(e.end)},onVideoSegmentTimingInfo:function(e){s(e)},onId3:function(e,i){o(t,e,i)},onCaptions:function(e){u(t,[e])},onDone:function(e){c&&!n&&(e.type="combined"===e.type?"video":e.type,c(null,t,e))}})}function Ju(e){var t=e.segment,i=e.bytes,n=e.isPartial,r=e.trackInfoFn,a=e.timingInfoFn,s=e.videoSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.dataFn,c=e.doneFn,d=new Uint8Array(i);if(Co(d)){t.isFmp4=!0;var h=t.map.tracks,p={isFmp4:!0,hasVideo:!!h.video,hasAudio:!!h.audio};h.audio&&h.audio.codec&&"enca"!==h.audio.codec&&(p.audioCodec=h.audio.codec),h.video&&h.video.codec&&"encv"!==h.video.codec&&(p.videoCodec=h.video.codec),h.video&&h.audio&&(p.isMuxed=!0),r(t,p);var f=iu(t.map.timescales,d);p.hasAudio&&!p.isMuxed&&a(t,"audio","start",f),p.hasVideo&&a(t,"video","start",f);var m=function(e){l(t,{data:i,type:p.hasAudio&&!p.isMuxed?"audio":"video"}),e&&e.length&&u(t,e),c(null,t,{})};if(!h.video||!i.byteLength||!t.transmuxer)return void m();var g=i instanceof ArrayBuffer?i:i.buffer,v=i instanceof ArrayBuffer?0:i.byteOffset;return t.transmuxer.addEventListener("message",(function e(n){if("mp4Captions"===n.data.action){t.transmuxer.removeEventListener("message",e);var r=n.data.data;t.bytes=i=new Uint8Array(r,r.byteOffset||0,r.byteLength),m(n.data.captions)}})),void t.transmuxer.postMessage({action:"pushMp4Captions",timescales:t.map.timescales,trackIds:[h.video.id],data:g,byteOffset:v,byteLength:i.byteLength},[g])}if(t.transmuxer){if(void 0===t.container&&(t.container=So(d)),"ts"!==t.container&&"aac"!==t.container)return r(t,{hasAudio:!1,hasVideo:!1}),void c(null,t,{});Qu({segment:t,bytes:i,isPartial:n,trackInfoFn:r,timingInfoFn:a,videoSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,dataFn:l,doneFn:c})}else c(null,t,{})}function Zu(e){var t=e.xhr,i=e.xhrOptions,n=e.decryptionWorker,r=e.segment,a=e.abortFn,s=e.progressFn,o=e.trackInfoFn,u=e.timingInfoFn,l=e.videoSegmentTimingInfoFn,c=e.id3Fn,d=e.captionsFn,h=e.dataFn,p=e.doneFn,f=e.handlePartialData,m=[],g=function(e){var t=e.activeXhrs,i=e.decryptionWorker,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.id3Fn,o=e.captionsFn,u=e.dataFn,l=e.doneFn,c=0,d=!1;return function(e,h){if(!d){if(e)return d=!0,Yu(t),l(e,h);if((c+=1)===t.length){if(h.endOfAllRequests=Date.now(),h.encryptedBytes)return function(e){var t,i=e.decryptionWorker,n=e.segment,r=e.trackInfoFn,a=e.timingInfoFn,s=e.videoSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.dataFn,c=e.doneFn;i.addEventListener("message",(function e(t){if(t.data.source===n.requestId){i.removeEventListener("message",e);var d=t.data.decrypted;n.bytes=new Uint8Array(d.bytes,d.byteOffset,d.byteLength),Ju({segment:n,bytes:n.bytes,isPartial:!1,trackInfoFn:r,timingInfoFn:a,videoSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,dataFn:l,doneFn:c})}})),t=n.key.bytes.slice?n.key.bytes.slice():new Uint32Array(Array.prototype.slice.call(n.key.bytes)),i.postMessage(Ru({source:n.requestId,encrypted:n.encryptedBytes,key:t,iv:n.key.iv}),[n.encryptedBytes.buffer,t.buffer])}({decryptionWorker:i,segment:h,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,id3Fn:s,captionsFn:o,dataFn:u,doneFn:l});Ju({segment:h,bytes:h.bytes,isPartial:!1,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,id3Fn:s,captionsFn:o,dataFn:u,doneFn:l})}}}}({activeXhrs:m,decryptionWorker:n,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,id3Fn:c,captionsFn:d,dataFn:h,doneFn:p});if(r.key&&!r.key.bytes){var v=t(na.mergeOptions(i,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),function(e,t){return function(i,n){var r=n.response,a=$u(i,n);if(a)return t(a,e);if(16!==r.byteLength)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:Il,xhr:n},e);var s=new DataView(r);return e.key.bytes=new Uint32Array([s.getUint32(0),s.getUint32(4),s.getUint32(8),s.getUint32(12)]),t(null,e)}}(r,g));m.push(v)}if(r.map&&!r.map.bytes){var y=t(na.mergeOptions(i,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Lu(r.map)}),function(e){var t=e.segment,i=e.finishProcessingFn;return function(e,n){var r=n.response,a=$u(e,n);if(a)return i(a,t);if(0===r.byteLength)return i({status:n.status,message:"Empty HLS segment content at URL: "+n.uri,code:Il,xhr:n},t);t.map.bytes=new Uint8Array(n.response);var s=So(t.map.bytes);return"mp4"!==s?i({status:n.status,message:"Found unsupported "+(s||"unknown")+" container for initialization segment at URL: "+n.uri,code:Il,internal:!0,xhr:n},t):(nu(t.map.bytes).forEach((function(e){t.map.tracks=t.map.tracks||{},t.map.tracks[e.type]||(t.map.tracks[e.type]=e).id&&e.timescale&&(t.map.timescales=t.map.timescales||{},t.map.timescales[e.id]=e.timescale)})),i(null,t))}}({segment:r,finishProcessingFn:g}));m.push(y)}var _=na.mergeOptions(i,{uri:r.resolvedUri,responseType:"arraybuffer",headers:Lu(r)});f&&(_.responseType="text",_.beforeSend=function(e){e.overrideMimeType("text/plain; charset=x-user-defined")});var b=t(_,function(e){var t=e.segment,i=e.finishProcessingFn,n=e.responseType;return function(e,r){var a=r.response,s=$u(e,r);if(s)return i(s,t);var o="arraybuffer"!==n&&r.responseText?zu(r.responseText.substring(t.lastReachedChar||0)):r.response;return 0===a.byteLength?i({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:Il,xhr:r},t):(t.stats=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}}(r),t.key?t.encryptedBytes=new Uint8Array(o):t.bytes=new Uint8Array(o),i(null,t))}}({segment:r,finishProcessingFn:g,responseType:_.responseType}));b.addEventListener("progress",function(e){var t=e.segment,i=e.progressFn,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.id3Fn,o=e.captionsFn,u=e.dataFn,l=e.handlePartialData;return function(e){var c=e.target;if(!c.aborted){if(l&&!t.key&&c.responseText&&8<=c.responseText.length){var d=zu(c.responseText.substring(t.lastReachedChar||0));!t.lastReachedChar&&Co(new Uint8Array(d))||(t.lastReachedChar=c.responseText.length,Ju({segment:t,bytes:d,isPartial:!0,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,id3Fn:s,captionsFn:o,dataFn:u}))}return t.stats=na.mergeOptions(t.stats,function(e){var t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i}(e)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),i(e,t)}}}({segment:r,progressFn:s,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,id3Fn:c,captionsFn:d,dataFn:h,handlePartialData:f})),m.push(b);var T={};return m.forEach((function(e){e.addEventListener("loadend",function(e){var t=e.loadendState,i=e.abortFn;return function(e){e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}}({loadendState:T,abortFn:a}))})),function(){return Yu(m)}}s(ru);var el,tl=ru.DEFAULT_AUDIO_CODEC,il=ru.DEFAULT_VIDEO_CODEC,nl=ru.browserSupportsCodec,rl=ru.codecsFromDefault,al=ru.getMimeForCodec,sl=ru.isAudioCodec,ol=ru.isVideoCodec,ul=(ru.mapLegacyAvcCodecs,ru.muxerSupportsCodec),ll=ru.parseCodecs,cl=ru.translateLegacyCodec,dl=(ru.translateLegacyCodecs,la),hl=na.log,pl=na.mergeOptions,fl=function(t){function i(e,i,n){var r;if(void 0===n&&(n={}),r=t.call(this)||this,!e)throw new Error("A non-empty playlist URL or object is required");var a=n,s=a.withCredentials,o=void 0!==s&&s,u=a.handleManifestRedirects,l=void 0!==u&&u;r.src=e,r.vhs_=i,r.withCredentials=o,r.handleManifestRedirects=l;var c=i.options_;return r.customTagParsers=c&&c.customTagParsers||[],r.customTagMappers=c&&c.customTagMappers||[],r.state="HAVE_NOTHING",r.on("mediaupdatetimeout",(function(){"HAVE_METADATA"===r.state&&(r.state="HAVE_CURRENT_METADATA",r.request=r.vhs_.xhr({uri:dl(r.master.uri,r.media().uri),withCredentials:r.withCredentials},(function(e,t){if(r.request)return e?r.playlistRequestError(r.request,r.media(),"HAVE_METADATA"):void r.haveMetadata({playlistString:r.request.responseText,url:r.media().uri,id:r.media().id})})))})),r}ze(i,t);var n=i.prototype;return n.playlistRequestError=function(e,t,i){var n=t.uri,r=t.id;this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")},n.haveMetadata=function(t){var i=this,n=t.playlistString,r=t.playlistObject,a=t.url,s=t.id;this.request=null,this.state="HAVE_METADATA";var o=r||ou({manifestString:n,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers});lu({playlist:o,uri:a,id:s});var u=hu(this.master,o);this.targetDuration=o.targetDuration,u?(this.master=u,this.media_=this.master.playlists[s]):this.trigger("playlistunchanged"),this.media().endList||(e.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=e.setTimeout((function(){i.trigger("mediaupdatetimeout")}),pu(this.media(),!!u))),this.trigger("loadedplaylist")},n.dispose=function(){this.trigger("dispose"),this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.finalRenditionTimeout),this.off()},n.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},n.media=function(t,i){var n=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}if(e.clearTimeout(this.finalRenditionTimeout),i){var r=t.targetDuration/2*1e3||5e3;this.finalRenditionTimeout=e.setTimeout(this.media.bind(this,t,!1),r)}else{var a=this.state,s=!this.media_||t.id!==this.media_.id;if(this.master.playlists[t.id].endList||t.endList&&t.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=t,void(s&&(this.trigger("mediachanging"),"HAVE_MASTER"===a?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(s){if(this.state="SWITCHING_MEDIA",this.request){if(t.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.vhs_.xhr({uri:t.resolvedUri,withCredentials:this.withCredentials},(function(e,i){if(n.request){if(t.resolvedUri=au(n.handleManifestRedirects,t.resolvedUri,i),e)return n.playlistRequestError(n.request,t,a);n.haveMetadata({playlistString:i.responseText,url:t.uri,id:t.id}),"HAVE_MASTER"===a?n.trigger("loadedmetadata"):n.trigger("mediachange")}}))}}},n.pause=function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},n.load=function(t){var i=this;e.clearTimeout(this.mediaUpdateTimeout);var n=this.media();if(t){var r=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=e.setTimeout((function(){return i.load()}),r)}else this.started?n&&!n.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},n.start=function(){var t=this;if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=e.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((function(){t.setupInitialPlaylist(t.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(e,i){if(t.request){if(t.request=null,e)return t.error={status:i.status,message:"HLS playlist request error at URL: "+t.src+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");t.src=au(t.handleManifestRedirects,t.src,i);var n=ou({manifestString:i.responseText,customTagParsers:t.customTagParsers,customTagMappers:t.customTagMappers});t.setupInitialPlaylist(n)}}))},n.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri},n.setupInitialPlaylist=function(t){if(this.state="HAVE_MASTER",t.playlists)return this.master=t,cu(this.master,this.srcUri()),t.playlists.forEach((function(e){e.segments&&e.segments.forEach((function(t){du(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var i=this.srcUri()||e.location.href;this.master=function(t,i){var n=su(0,i),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:e.location.href,resolvedUri:e.location.href,playlists:[{uri:i,id:n,resolvedUri:i,attributes:{}}]};return r.playlists[n]=r.playlists[0],r.playlists[i]=r.playlists[0],r}(0,i),this.haveMetadata({playlistObject:t,url:i,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},i}(na.EventTarget),ml=1/30,gl=na.createTimeRange,vl={duration:bu,seekable:function(e,t,i){var n=t||0,r=ku(e,t,!0,i);return null===r?gl():gl(n,r)},safeLiveIndex:Su,getMediaInfoForTime:function(e,t,i,n){var r,a=e.segments.length,s=t-n;if(s<0){if(0<i)for(r=i-1;0<=r;r--)if(0<(s+=e.segments[r].duration+ml))return{mediaIndex:r,startTime:n-Tu(e,i,r)};return{mediaIndex:0,startTime:t}}if(i<0){for(r=i;r<0;r++)if((s-=e.targetDuration)<0)return{mediaIndex:0,startTime:t};i=0}for(r=i;r<a;r++)if((s-=e.segments[r].duration+ml)<0)return{mediaIndex:r,startTime:n+Tu(e,i,r)};return{mediaIndex:a-1,startTime:t}},isEnabled:wu,isDisabled:function(e){return e.disabled},isBlacklisted:Cu,isIncompatible:Eu,playlistEnd:ku,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:Iu,estimateSegmentRequestTime:function(e,t,i,n){return void 0===n&&(n=0),Iu("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*n)/t:NaN},isLowestEnabledRendition:Au},yl=na.xhr,_l=na.mergeOptions,bl=Object.freeze({__proto__:null,createTransferableMessage:Ru,initSegmentId:Mu,segmentKeyId:Nu,hexDump:Uu,tagDump:function(e){return Uu(e.bytes)},textRanges:function(e){var t,i,n,r="";for(t=0;t<e.length;t++)r+=(n=t,(i=e).start(n)+"-"+i.end(n)+" ");return r}}),Tl=na.mergeOptions,Sl=function(t){function i(e,i,n,r){var a;void 0===n&&(n={}),a=t.call(this)||this;var s=n,o=s.withCredentials,u=void 0!==o&&o,l=s.handleManifestRedirects,c=void 0!==l&&l;if(a.vhs_=i,a.withCredentials=u,a.handleManifestRedirects=c,!e)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_={},"string"==typeof e?(a.srcUrl=e,a.sidxMapping_={},je(a)):(a.setupChildLoader(r,e),a)}ze(i,t);var n=i.prototype;return n.setupChildLoader=function(e,t){this.masterPlaylistLoader_=e,this.childPlaylist_=t},n.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},e.clearTimeout(this.minimumUpdatePeriodTimeout_),e.clearTimeout(this.mediaRequest_),e.clearTimeout(this.mediaUpdateTimeout),this.off()},n.hasPendingRequest=function(){return this.request||this.mediaRequest_},n.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},n.sidxRequestFinished_=function(e,t,i,n){var r=this;return function(a,s){if(r.request){if(r.request=null,a)return r.error="object"==typeof a?a:{status:s.status,message:"DASH playlist request error at URL: "+e.uri,response:s.response,code:2},i&&(r.state=i),void r.trigger("error");var o=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},r=i.getUint16(22);for(t=24;r;t+=12,r--)n.references.push({referenceType:(128&e[t])>>>7,referencedSize:2147483647&i.getUint32(t),subsegmentDuration:i.getUint32(t+4),startsWithSap:!!(128&e[t+8]),sapType:(112&e[t+8])>>>4,sapDeltaTime:268435455&i.getUint32(t+8)});return n}(xo(s.response).subarray(8));return n(t,o)}}},n.media=function(t){var i=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var n=this.state;if("string"==typeof t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}var r=!this.media_||t.id!==this.media_.id;if(r&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList)return this.state="HAVE_METADATA",this.media_=t,void(r&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(r)if(this.media_&&this.trigger("mediachanging"),t.sidx){var a,s;s=this.masterPlaylistLoader_?(a=this.masterPlaylistLoader_.master,this.masterPlaylistLoader_.sidxMapping_):(a=this.master,this.sidxMapping_);var o=qu(t.sidx);s[o]={sidxInfo:t.sidx},this.request=Wu(this,t.sidx,t,this.vhs_.xhr,{handleManifestRedirects:this.handleManifestRedirects},this.sidxRequestFinished_(t,a,n,(function(e,r){if(!e||!r)throw new Error("failed to request sidx");s[o].sidx=r,i.haveMetadata({startingState:n,playlist:e.playlists[t.id]})})))}else this.mediaRequest_=e.setTimeout(this.haveMetadata.bind(this,{startingState:n,playlist:t}),0)},n.haveMetadata=function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},n.pause=function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.minimumUpdatePeriodTimeout_),"HAVE_NOTHING"===this.state&&(this.started=!1)},n.load=function(t){var i=this;e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.minimumUpdatePeriodTimeout_);var n=this.media();if(t){var r=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=e.setTimeout((function(){return i.load()}),r)}else this.started?n&&!n.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},n.start=function(){var t=this;this.started=!0,this.masterPlaylistLoader_?this.mediaRequest_=e.setTimeout(this.haveMaster_.bind(this),0):this.request=this.vhs_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},(function(e,i){if(t.request){if(t.request=null,e)return t.error={status:i.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:i.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");t.masterXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?t.masterLoaded_=Date.parse(i.responseHeaders.date):t.masterLoaded_=Date.now(),t.srcUrl=au(t.handleManifestRedirects,t.srcUrl,i),t.syncClientServerClock_(t.onClientServerClockSync_.bind(t))}}))},n.syncClientServerClock_=function(e){var t=this,i=function(e){return function(e){var t=Qs(e,"UTCTiming")[0];if(!t)return null;var i=eo(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;default:throw new Error(go)}return i}(ro(e))}(this.masterXml_);return null===i?(this.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.clientOffset_=i.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:dl(this.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n)return t.clientOffset_=t.masterLoaded_-Date.now(),e();var a;a="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.clientOffset_=a-Date.now(),e()}})))},n.haveMaster_=function(){this.state="HAVE_MASTER",this.mediaRequest_=null,this.masterPlaylistLoader_?this.media_||this.media(this.childPlaylist_):(this.updateMainManifest_(ju({masterXml:this.masterXml_,srcUrl:this.srcUrl,clientOffset:this.clientOffset_,sidxMapping:this.sidxMapping_})),this.trigger("loadedplaylist"))},n.updateMinimumUpdatePeriodTimeout_=function(){var t=this;function i(i){t.minimumUpdatePeriodTimeout_=e.setTimeout((function(){t.trigger("minimumUpdatePeriod")}),i)}e.clearTimeout(this.minimumUpdatePeriodTimeout_);var n=this.master&&this.master.minimumUpdatePeriod;0<n?i(n):0===n&&(this.media()?i(1e3*this.media().targetDuration):this.one("loadedplaylist",(function(){i(1e3*t.media().targetDuration)})))},n.onClientServerClockSync_=function(){this.haveMaster_(),this.hasPendingRequest()||this.media_||this.media(this.master.playlists[0]),this.updateMinimumUpdatePeriodTimeout_()},n.updateMainManifest_=function(e){if(this.master=e,this.master.locations&&this.master.locations.length){var t=this.master.locations[0];t!==this.srcUrl&&(this.srcUrl=t)}},n.refreshXml_=function(){var e=this;this.request=this.vhs_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"DASH playlist request error at URL: "+e.srcUrl,responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.masterXml_=i.responseText,e.sidxMapping_=function(e,t,i,n){var r=ao(e,{manifestUri:t,clientOffset:i}),a=Hu(r.playlists,n);return uu(r,(function(e,t,i,r){if(e.playlists&&e.playlists.length){var s=e.playlists;a=Tl(a,Hu(s,n))}})),a}(e.masterXml_,e.srcUrl,e.clientOffset_,e.sidxMapping_);var n=ju({masterXml:e.masterXml_,srcUrl:e.srcUrl,clientOffset:e.clientOffset_,sidxMapping:e.sidxMapping_}),r=Vu(e.master,n),a=e.media().sidx;if(r)if(a){var s=qu(a);if(!e.sidxMapping_[s]){var o=e.media();e.request=Wu(e,o.sidx,o,e.vhs_.xhr,{handleManifestRedirects:e.handleManifestRedirects},e.sidxRequestFinished_(o,n,e.state,(function(t,i){if(!t||!i)throw new Error("failed to request sidx on minimumUpdatePeriod");e.sidxMapping_[s].sidx=i,e.updateMinimumUpdatePeriodTimeout_(),e.refreshMedia_(e.media().id)})))}}else e.updateMainManifest_(r),e.media_&&(e.media_=e.master.playlists[e.media_.id]);e.updateMinimumUpdatePeriodTimeout_()}}))},n.refreshMedia_=function(t){var i,n,r=this;if(!t)throw new Error("refreshMedia_ must take a media id");n=this.masterPlaylistLoader_?(i=this.masterPlaylistLoader_.master,ju({masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_})):(i=this.master,ju({masterXml:this.masterXml_,srcUrl:this.srcUrl,clientOffset:this.clientOffset_,sidxMapping:this.sidxMapping_}));var a=Vu(i,n);a?(this.masterPlaylistLoader_?this.masterPlaylistLoader_.master=a:this.master=a,this.media_=a.playlists[t]):(this.media_=i.playlists[t],this.trigger("playlistunchanged")),this.media().endList||(this.mediaUpdateTimeout=e.setTimeout((function(){r.trigger("mediaupdatetimeout")}),pu(this.media(),!!a))),this.trigger("loadedplaylist")},i}(na.EventTarget),kl={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,BUFFER_LOW_WATER_LINE_RATE:1},Cl=[],El=function(){el=null,Cl.length&&("function"==typeof(el=Cl.shift())?el():Gu(el))},wl=function(e){Xu("reset",e)},Il=2,Al=-101,xl=-102,Pl="undefined"!=typeof window?window:{},Ll="undefined"==typeof Symbol?"__target":Symbol(),Dl="application/javascript",Ol=Pl.BlobBuilder||Pl.WebKitBlobBuilder||Pl.MozBlobBuilder||Pl.MSBlobBuilder,Rl=Pl.URL||Pl.webkitURL||Rl&&Rl.msURL,Ml=Pl.Worker;function Nl(e,t){return function(i){var n=this;if(!t)return new Ml(e);if(Ml&&!i){var r=jl(t.toString().replace(/^function.+?{/,"").slice(0,-1));return this[Ll]=new Ml(r),function(e,t){if(e&&t){var i=e.terminate;e.objURL=t,e.terminate=function(){e.objURL&&Rl.revokeObjectURL(e.objURL),i.call(e)}}}(this[Ll],r),this[Ll]}var a={postMessage:function(e){n.onmessage&&setTimeout((function(){n.onmessage({data:e,target:a})}))}};t.call(a),this.postMessage=function(e){setTimeout((function(){a.onmessage({data:e,target:n})}))},this.isThisThread=!0}}if(Ml){var Ul,Fl=jl("self.onmessage = function () {}"),Bl=new Uint8Array(1);try{(Ul=new Ml(Fl)).postMessage(Bl,[Bl.buffer])}catch(e){Ml=null}finally{Rl.revokeObjectURL(Fl),Ul&&Ul.terminate()}}function jl(e){try{return Rl.createObjectURL(new Blob([e],{type:Dl}))}catch(i){var t=new Ol;return t.append(e),Rl.createObjectURL(t.getBlob(type))}}function Vl(e,t){var i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]}function ql(e,t){var i=t.attributes||{},n=function(e){var t=e.attributes||{};if(t.CODECS)return ll(t.CODECS)}(t)||{};if(Vl(e,t)&&!n.audio&&!function(e,t){if(!Vl(e,t))return!0;var i=t.attributes||{},n=e.mediaGroups.AUDIO[i.AUDIO];for(var r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1}(e,t)){var r=rl(e,i.AUDIO);r&&(n.audio=r.audio)}var a={};return n.video&&(a.video=cl(""+n.video.type+n.video.details)),n.audio&&(a.audio=cl(""+n.audio.type+n.audio.details)),a}function Hl(e){return na.log.debug?na.log.debug.bind(na,"VHS:",e+" >"):function(){}}function Wl(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 zl(t,i){if(!t)return"";var n=e.getComputedStyle(t);return n?n[i]:""}function Gl(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 Kl(t,i){var n,r;return t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),n=n||e.Number.MAX_VALUE,i.attributes.BANDWIDTH&&(r=i.attributes.BANDWIDTH),n-(r||e.Number.MAX_VALUE)}function Xl(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 Yl(e){return"number"==typeof e&&isFinite(e)}function $l(e){return e+"TimingInfo"}function Ql(e){var t=e.segmentTimeline,i=e.currentTimeline,n=e.startOfSegment,r=e.buffered;return e.overrideCheck||t!==i?r.length?r.end(r.length-1):n:null}function Jl(e){var t=e.timelineChangeController,i=e.currentTimeline,n=e.segmentTimeline,r=e.loaderType,a=e.audioDisabled;if(i===n)return!1;if("audio"===r){var s=t.lastTimelineChange({type:"main"});return!s||s.to!==n}if("main"===r&&a){var o=t.pendingTimelineChange({type:"audio"});return!o||o.to!==n}return!1}var Zl=new Nl("./transmuxer-worker.worker.js",(function(e,t){var i=this;
/*! @name @videojs/http-streaming @version 2.2.4 @license Apache-2.0 */!function(){function e(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),-1<n)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(a=[],n=arguments.length,n=1;n<arguments.length;++n)a.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,a)}},this.dispose=function(){e={}}}}e.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},e.prototype.push=function(e){this.trigger("data",e)},e.prototype.flush=function(e){this.trigger("done",e)},e.prototype.partialFlush=function(e){this.trigger("partialdone",e)},e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},e.prototype.reset=function(e){this.trigger("reset",e)};var t,n,r,a,s,o,u,l,c,d,h,p,f,m,g,v,y,_,b,T,S,k,C,E,w,I,A,x,P,L,D,O,R,M,N,U,F,B,j,V,q=e,H=Math.pow(2,32)-1;function W(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 z(e){for(var t=[];e--;)t.push(0);return t}function G(){G.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new Ee(0,0),new Ee(0,1),new Ee(1,0),new Ee(1,1)],this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this)}!function(){var e;if(k={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in k)k.hasOwnProperty(e)&&(k[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);C=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),w=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),E=new Uint8Array([0,0,0,1]),I=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),A=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),x={video:I,audio:A},D=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]),O=new Uint8Array([0,0,0,0,0,0,0,0]),R=O,M=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),N=O,P=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),t=function(e){var t,i,n=[],r=0;for(t=1;t<arguments.length;t++)n.push(arguments[t]);for(t=n.length;t--;)r+=n[t].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,r=8;t<n.length;t++)i.set(n[t],r),r+=n[t].byteLength;return i},n=function(){return t(k.dinf,t(k.dref,D))},r=function(e){return t(k.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},g=function(e){return t(k.hdlr,x[e])},m=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(k.mdhd,i)},f=function(e){return t(k.mdia,m(e),g(e.type),o(e))},s=function(e){return t(k.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},o=function(e){return t(k.minf,"video"===e.type?t(k.vmhd,P):t(k.smhd,L),n(),y(e))},u=function(e,i){for(var n=[],r=i.length;r--;)n[r]=b(i[r]);return t.apply(null,[k.moof,s(e)].concat(n))},l=function(e){for(var i=e.length,n=[];i--;)n[i]=h(e[i]);return t.apply(null,[k.moov,d(4294967295)].concat(n).concat(c(e)))},c=function(e){for(var i=e.length,n=[];i--;)n[i]=T(e[i]);return t.apply(null,[k.mvex].concat(n))},d=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t(k.mvhd,i)},v=function(e){var i,n,r=e.samples||[],a=new Uint8Array(4+r.length);for(n=0;n<r.length;n++)i=r[n].flags,a[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return t(k.sdtp,a)},y=function(e){return t(k.stbl,_(e),t(k.stts,N),t(k.stsc,R),t(k.stsz,M),t(k.stco,O))},_=function(e){return t(k.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?U(e):F(e))},U=function(e){var i,n,r=e.sps||[],a=e.pps||[],s=[],o=[];for(i=0;i<r.length;i++)s.push((65280&r[i].byteLength)>>>8),s.push(255&r[i].byteLength),s=s.concat(Array.prototype.slice.call(r[i]));for(i=0;i<a.length;i++)o.push((65280&a[i].byteLength)>>>8),o.push(255&a[i].byteLength),o=o.concat(Array.prototype.slice.call(a[i]));if(n=[k.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(k.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),t(k.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1];n.push(t(k.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return t.apply(null,n)},F=function(e){return t(k.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),r(e))},p=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(k.tkhd,i)},b=function(e){var i,n,r,a,s,o;return i=t(k.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/(1+H)),o=Math.floor(e.baseMediaDecodeTime%(1+H)),n=t(k.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(r=S(e,92),t(k.traf,i,n,r)):(a=v(e),r=S(e,a.length+92),t(k.traf,i,n,r,a))},h=function(e){return e.duration=e.duration||4294967295,t(k.trak,p(e),f(e))},T=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(k.trex,i)},V=function(e,t){var i=0,n=0,r=0,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]},j=function(e,i){var n,r,a,s,o,u;for(i+=20+16*(s=e.samples||[]).length,a=V(s,i),(r=new Uint8Array(a.length+16*s.length)).set(a),n=a.length,u=0;u<s.length;u++)o=s[u],r[n++]=(4278190080&o.duration)>>>24,r[n++]=(16711680&o.duration)>>>16,r[n++]=(65280&o.duration)>>>8,r[n++]=255&o.duration,r[n++]=(4278190080&o.size)>>>24,r[n++]=(16711680&o.size)>>>16,r[n++]=(65280&o.size)>>>8,r[n++]=255&o.size,r[n++]=o.flags.isLeading<<2|o.flags.dependsOn,r[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[n++]=61440&o.flags.degradationPriority,r[n++]=15&o.flags.degradationPriority,r[n++]=(4278190080&o.compositionTimeOffset)>>>24,r[n++]=(16711680&o.compositionTimeOffset)>>>16,r[n++]=(65280&o.compositionTimeOffset)>>>8,r[n++]=255&o.compositionTimeOffset;return t(k.trun,r)},B=function(e,i){var n,r,a,s,o,u;for(i+=20+8*(s=e.samples||[]).length,a=V(s,i),(n=new Uint8Array(a.length+8*s.length)).set(a),r=a.length,u=0;u<s.length;u++)o=s[u],n[r++]=(4278190080&o.duration)>>>24,n[r++]=(16711680&o.duration)>>>16,n[r++]=(65280&o.duration)>>>8,n[r++]=255&o.duration,n[r++]=(4278190080&o.size)>>>24,n[r++]=(16711680&o.size)>>>16,n[r++]=(65280&o.size)>>>8,n[r++]=255&o.size;return t(k.trun,n)},S=function(e,t){return"audio"===e.type?B(e,t):j(e,t)},a=function(){return t(k.ftyp,C,E,C,w)};var K,X,Y,$,Q,J=function(e){return t(k.mdat,e)},Z=u,ee=function(e){var t,i=a(),n=l(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t},te=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},ie=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},ne=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},re=function(e,t){var i,n=[];return i=W(e,t||0),n.push(i),n},ae=function(e){var t,i,n=0,r=e.byteLength,a=e.length,s=new Uint8Array(r+4*a),o=new DataView(s.buffer);for(t=0;t<e.length;t++)i=e[t],o.setUint32(n,i.data.byteLength),n+=4,s.set(i.data,n),n+=i.data.byteLength;return s},se=[33,16,5,32,164,27],oe=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ue=9e4,le=(Y=function(e,t){return e*t},$=function(e){return e/9e4}),ce=(Q=function(e,t){return e/t},function(e,t){return X(Q(e,t))}),de=function(e,t,i){return $(i?e:e-t)},he=X=function(e){return 9e4*e},pe=le,fe=function(e,t,i,n){var r,a,s,o,u,l=0,c=0,d=0;if(t.length&&(r=ce(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(ue/(e.samplerate/1024)),i&&n&&(l=r-Math.max(i,n),d=(c=Math.floor(l/a))*a),!(c<1||ue/2<d))){for(s=(s=function(){if(!K){var e={96e3:[se,[227,64],z(154),[56]],88200:[se,[231],z(170),[56]],64e3:[se,[248,192],z(240),[56]],48e3:[se,[255,192],z(268),[55,148,128],z(54),[112]],44100:[se,[255,192],z(268),[55,163,128],z(84),[112]],32e3:[se,[255,192],z(268),[55,234],z(226),[112]],24e3:[se,[255,192],z(268),[55,255,128],z(268),[111,112],z(126),[224]],16e3:[se,[255,192],z(268),[55,255,128],z(268),[111,255],z(269),[223,108],z(195),[1,192]],12e3:[oe,z(268),[3,127,248],z(268),[6,255,240],z(268),[13,255,224],z(268),[27,253,128],z(259),[56]],11025:[oe,z(268),[3,127,248],z(268),[6,255,240],z(268),[13,255,224],z(268),[27,255,192],z(268),[55,175,128],z(108),[112]],8e3:[oe,z(268),[3,121,16],z(47),[7]]};K=function(e){return Object.keys(e).reduce((function(t,i){return t[i]=new Uint8Array(e[i].reduce((function(e,t){return e.concat(t)}),[])),t}),{})}(e)}return K}()[e.samplerate])||t[0].data,o=0;o<c;o++)u=t[0],t.splice(0,0,{data:s,dts:u.dts-a,pts:u.pts-a});e.baseMediaDecodeTime-=Math.floor(function(e,t){return Y($(e),t)}(d,e.samplerate))}},me=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)})))},ge=function(e){var t,i,n=[];for(t=0;t<e.length;t++)i=e[t],n.push({size:i.data.byteLength,duration:1024});return n},ve=function(e){var t,i,n=0,r=new Uint8Array(function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i}(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,n),n+=i.data.byteLength;return r},ye=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},_e=function(e,t){var i,n=e.minSegmentDts;return t||(n-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=n,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/9e4,i=Math.floor(i)),i},be=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))};function Te(e){return null===e?"":(e=ke[e]||e,String.fromCharCode(e))}function Se(){for(var e=[],t=15;t--;)e.push("");return e}(G.prototype=new q).push=function(e){var t,i,n;if("sei_rbsp"===e.nalUnitType&&4===(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)).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));n=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(n),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},G.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},G.prototype.flushStream=function(e){this.captionPackets_.length&&(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2&&this.dispatchCea608Packet(e)}),this),this.captionPackets_.length=0),this.flushCCStreams(e)},G.prototype.flush=function(){return this.flushStream("flush")},G.prototype.partialFlush=function(){return this.flushStream("partialFlush")},G.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},G.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)},G.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},G.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},G.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var ke={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},Ce=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ee=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;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Se();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Se();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Se()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))a=Te((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=Te((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=Ce.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=Te(n),a+=Te(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};function we(e,t){var i=1;for(t<e&&(i=-1);4294967296<Math.abs(t-e);)e+=8589934592*i;return e}function Ie(e){var t,i;Ie.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=we(e.dts,i),e.pts=we(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){t=i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}Ee.prototype=new q,Ee.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e){try{return e.trim()}catch(e){return""}})).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},Ee.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Se(),this.nonDisplayed_=Se(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Ee.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_},Ee.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},Ee.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},Ee.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},Ee.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},Ee.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&64<=t&&t<=127},Ee.prototype.isColorPAC=function(e){return 64<=e&&e<=79||96<=e&&e<=127},Ee.prototype.isNormalChar=function(e){return 32<=e&&e<=127},Ee.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Se(),this.displayed_=Se()),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},Ee.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce((function(e,t){return e+"<"+t+">"}),"");this[this.mode_](e,i)},Ee.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),"");this.formatting_=[],this[this.mode_](e,t)}},Ee.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Ee.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Ee.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},Ee.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var Ae={CaptionStream:G,Cea608Stream:Ee},xe={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21};function Pe(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r}function Le(e,t,i){return decodeURIComponent(Pe(e,t,i))}function De(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}Ie.prototype=new q;var Oe,Re=Ie,Me={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=Le(e.data,1,t),e.value=Le(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=Le(e.data,1,t),e.url=Le(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,i;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(i=e.data,unescape(Pe(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Oe=function(e){var t,i={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},n=0,r=[],a=0;if(Oe.prototype.init.call(this),this.dispatchType=xe.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,s,o,u,l;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)))i.debug;else if(r.push(e),a+=e.data.byteLength,1===r.length&&(n=De(e.data.subarray(6,10)),n+=10),!(a<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<n;)t.data.set(r[0].data.subarray(0,n-l),l),l+=r[0].data.byteLength,a-=r[0].data.byteLength,r.shift();s=10,64&t.data[5]&&(s+=4,s+=De(t.data.subarray(10,14)),n-=De(t.data.subarray(16,20)));do{if((o=De(t.data.subarray(s+4,s+8)))<1)return;if((u={id:String.fromCharCode(t.data[s],t.data[s+1],t.data[s+2],t.data[s+3]),data:t.data.subarray(s+10,s+o+10)}).key=u.id,Me[u.id]&&(Me[u.id](u),"com.apple.streaming.transportStreamTimestamp"===u.owner)){var c=u.data,d=(1&c[3])<<30|c[4]<<22|c[5]<<14|c[6]<<6|c[7]>>>2;d*=4,d+=3&c[7],u.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=u.timeStamp,t.dts=u.timeStamp),this.trigger("timestamp",u)}t.frames.push(u),s+=10,s+=o}while(s<n);this.trigger("data",t)}}}).prototype=new q;var Ne,Ue,Fe,Be=Oe,je=Re;(Ne=function(){var e=new Uint8Array(188),t=0;Ne.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")}}).prototype=new q,(Ue=function(){var e,t,i,n;Ue.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(e.subarray(r),n):i(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var a=e[r],s=(31&e[r+1])<<8|e[r+2];a===xe.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=s:a===xe.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=s:a===xe.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=xe.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=xe.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 q,Ue.STREAM_TYPES={h264:27,adts:15},(Fe=function(){function e(e,t,n){var r,a,s=new Uint8Array(e.size),o={type:t},u=0,l=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,u=0;u<e.data.length;u++)a=e.data[u],s.set(a.data,l),l+=a.data.byteLength;!function(e,t){var i;t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=0!=(4&e[6]),192&(i=e[7])&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8])}(s,o),r="video"===t||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&i.trigger("data",o)}}var t,i=this,n={data:[],size:0},r={data:[],size:0},a={data:[],size:0};Fe.prototype.init.call(this),this.push=function(s){({pat:function(){},pes:function(){var t,i;switch(s.streamType){case xe.H264_STREAM_TYPE:t=n,i="video";break;case xe.ADTS_STREAM_TYPE:t=r,i="audio";break;case xe.METADATA_STREAM_TYPE:t=a,i="timed-metadata";break;default:return}s.payloadUnitStartIndicator&&e(t,i,!0),t.data.push(s),t.size+=s.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=s.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"}),i.trigger("data",e)}})[s.type]()},this.reset=function(){n.size=0,n.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){e(n,"video"),e(r,"audio"),e(a,"timed-metadata")},this.flush=function(){this.flushStreams_(),this.trigger("done")}}).prototype=new q;var Ve={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Ne,TransportParseStream:Ue,ElementaryStream:Fe,TimestampRolloverStream:je,CaptionStream:Ae.CaptionStream,Cea608Stream:Ae.Cea608Stream,MetadataStream:Be};for(var qe in xe)xe.hasOwnProperty(qe)&&(Ve[qe]=xe[qe]);var He,We=Ve,ze=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(He=function(e){var t,i=0;He.prototype.init.call(this),this.push=function(n){var r,a,s,o,u,l,c=0;if(e||(i=0),"audio"===n.type)for(t?(o=t,(t=new Uint8Array(o.byteLength+n.data.byteLength)).set(o),t.set(n.data,o.byteLength)):t=n.data;c+5<t.length;)if(255===t[c]&&240==(246&t[c+1])){if(a=2*(1&~t[c+1]),r=(3&t[c+3])<<11|t[c+4]<<3|(224&t[c+5])>>5,l=9e4*(u=1024*(1+(3&t[c+6])))/ze[(60&t[c+2])>>>2],s=c+r,t.byteLength<s)return;if(this.trigger("data",{pts:n.pts+i*l,dts:n.dts+i*l,sampleCount:u,audioobjecttype:1+(t[c+2]>>>6&3),channelcount:(1&t[c+2])<<2|(192&t[c+3])>>>6,samplerate:ze[(60&t[c+2])>>>2],samplingfrequencyindex:(60&t[c+2])>>>2,samplesize:16,data:t.subarray(c+7+a,s)}),i++,t.byteLength===s)return void(t=void 0);t=t.subarray(s)}else c++},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new q;var Ge,Ke,Xe,Ye=He,$e=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(){var e;for(e=0;e<n;++e)if(0!=(i&2147483648>>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};function Qe(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return i=0<=i?i:0,(16&e[t+5])>>4?i+20:i+10}(Ke=function(){var e,t,i=0;Ke.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")}}).prototype=new q,Xe={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Ge=function(){var e,t,i,n,r,a,s,o=new Ke;Ge.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};switch(31&s[0]){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){var i,n=8,r=8;for(i=0;i<e;i++)0!==r&&(r=(n+t.readExpGolomb()+256)%256),n=0===r?n:r},r=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},a=function(e){var t,i,n,r,a,o,u,l,c,d,h,p,f,m=0,g=0,v=0,y=0,_=1;if(i=(t=new $e(e)).readUnsignedByte(),r=t.readUnsignedByte(),n=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),Xe[i]&&(3===(a=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(h=3!==a?8:12,f=0;f<h;f++)t.readBoolean()&&s(f<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),u=t.readUnsignedExpGolomb(),f=0;f<u;f++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(d=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb(),y=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:p=[1,1];break;case 2:p=[12,11];break;case 3:p=[10,11];break;case 4:p=[16,11];break;case 5:p=[40,33];break;case 6:p=[24,11];break;case 7:p=[20,11];break;case 8:p=[32,11];break;case 9:p=[80,33];break;case 10:p=[18,11];break;case 11:p=[15,11];break;case 12:p=[64,33];break;case 13:p=[160,99];break;case 14:p=[4,3];break;case 15:p=[3,2];break;case 16:p=[2,1];break;case 255:p=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}p&&(_=p[0]/p[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:Math.ceil((16*(l+1)-2*m-2*g)*_),height:(2-d)*(c+1)*16-2*v-2*y,sarRatio:p}}}).prototype=new q;var Je,Ze={H264Stream:Ge,NalByteStream:Ke},et=function(e){var t=function e(t,i){return t.length-i<10||t[i]!=="I".charCodeAt(0)||t[i+1]!=="D".charCodeAt(0)||t[i+2]!=="3".charCodeAt(0)?i:e(t,i+=Qe(t,i))}(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},tt=Qe,it=function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i};function nt(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function rt(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}}(Je=function(){var e=new Uint8Array,t=0;Je.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var n,r,a,s,o=0,u=0;for(e.length?(s=e.length,(e=new Uint8Array(i.byteLength+s)).set(e.subarray(0,s)),e.set(i,s)):e=i;3<=e.length-u;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255!=(255&e[u])||240!=(240&e[u+1]))u++;else{if(e.length-u<7)break;if(u+(o=it(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else{if(e.length-u<10)break;if(u+(o=tt(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=0<n?e.subarray(u):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new q;var at,st,ot,ut,lt=Je,ct=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],dt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],ht=Ze.H264Stream,pt=et;function ft(e,t){var i=[],n=0,r=0,a=0,s=1/0,o=null,u=null;t=t||{},ft.prototype.init.call(this),this.push=function(t){be(e,t),e&&ct.forEach((function(i){e[i]=t[i]})),i.push(t)},this.setEarliestDts=function(e){r=e},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.processFrames_=function(){var l,c,d,h,p;0!==i.length&&0!==(l=me(i,e,r)).length&&(e.baseMediaDecodeTime=_e(e,t.keepOriginalTimestamps),fe(e,l,a,s),e.samples=ge(l),d=J(ve(l)),i=[],c=Z(n,[e]),n++,e.initSegment=ee([e]),(h=new Uint8Array(c.byteLength+d.byteLength)).set(c),h.set(d,c.byteLength),ye(e),null===o&&(u=o=l[0].pts),u+=l.length*(1024*vt/e.samplerate),p={start:o},this.trigger("timingInfo",p),this.trigger("data",{track:e,boxes:h}))},this.flush=function(){this.processFrames_(),this.trigger("timingInfo",{start:o,end:u}),this.resetTiming_(),this.trigger("done","AudioSegmentStream")},this.partialFlush=function(){this.processFrames_(),this.trigger("partialdone","AudioSegmentStream")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline","AudioSegmentStream")},this.resetTiming_=function(){ye(e),u=o=null},this.reset=function(){this.resetTiming_(),i=[],this.trigger("reset")}}(st=function(e,t){var i=[],n=0,r=0,a=0,s=1/0;t=t||{},st.prototype.init.call(this),this.push=function(t){be(e,t),e&&ct.forEach((function(i){e[i]=t[i]})),i.push(t)},this.setEarliestDts=function(e){r=e},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.flush=function(){var o,u,l,c,d;0!==i.length&&(o=me(i,e,r),e.baseMediaDecodeTime=_e(e,t.keepOriginalTimestamps),fe(e,o,a,s),e.samples=ge(o),l=J(ve(o)),i=[],u=Z(n,[e]),c=new Uint8Array(u.byteLength+l.byteLength),n++,c.set(u),c.set(l,u.byteLength),ye(e),d=Math.ceil(9216e4/e.samplerate),o.length&&this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+o.length*d}),this.trigger("data",{track:e,boxes:c})),this.trigger("done","AudioSegmentStream")},this.reset=function(){ye(e),i=[],this.trigger("reset")}}).prototype=new q,(at=function(e,t){var i,n,r=0,a=[],s=[];t=t||{},at.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){be(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],dt.forEach((function(t){e[t]=i[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var i,n,o,u,l,c,d,h,p=0;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0===a.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(i=te(a),(o=ie(i))[0][0].keyFrame||((n=this.getGopForFusion_(a[0],e))?(p=n.duration,o.unshift(n),o.byteLength+=n.byteLength,o.nalCount+=n.nalCount,o.pts=n.pts,o.dts=n.dts,o.duration+=n.duration):o=ne(o)),s.length){var f;if(!(f=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");ye(e),o=f}be(e,o),e.samples=function(e,t){var i,n,r,a,s=t||0,o=[];for(i=0;i<e.length;i++)for(a=e[i],n=0;n<a.length;n++)s+=(r=W(a[n],s)).size,o.push(r);return o}(o),l=J(function(e){var t,i,n,r,a,s,o=0,u=e.byteLength,l=e.nalCount,c=new Uint8Array(u+4*l),d=new DataView(c.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(a=r[i],n=0;n<a.length;n++)s=a[n],d.setUint32(o,s.data.byteLength),o+=4,c.set(s.data,o),o+=s.data.byteLength;return c}(o)),e.baseMediaDecodeTime=_e(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),d=o[0],h=o[o.length-1],this.trigger("segmentTimingInfo",rt(e.baseMediaDecodeTime,d.dts,d.pts,h.dts+h.duration,h.pts+h.duration,p)),this.trigger("timingInfo",{start:o[0].pts,end:o[o.length-1].pts+o[o.length-1].duration}),this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),u=Z(r,[e]),c=new Uint8Array(u.byteLength+l.byteLength),r++,c.set(u),c.set(l,u.byteLength),this.trigger("data",{track:e,boxes:c}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),a=[],this.gopCache_.length=0,s.length=0,this.trigger("reset")},this.resetStream_=function(){ye(e),n=i=void 0},this.getGopForFusion_=function(t){var i,n,r,a,s,o=1/0;for(s=0;s<this.gopCache_.length;s++)r=(a=this.gopCache_[s]).gop,e.pps&&nt(e.pps[0],a.pps[0])&&e.sps&&nt(e.sps[0],a.sps[0])&&(r.dts<e.timelineStartInfo.dts||-1e4<=(i=t.dts-r.dts-r.duration)&&i<=45e3&&(!n||i<o)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=i=0;t<s.length&&i<e.length&&(n=s[t],r=e[i],n.pts!==r.pts);)r.pts>n.pts?t++:(i++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===i?e:i===e.length?null:((l=e.slice(i)).byteLength=a,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,i,n,r,a,o,u;for(t=s.length-1,i=e.length-1,a=null,o=!1;0<=t&&0<=i;){if(n=s[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(u=o?i:a))return e;var l=e.slice(u),c=l.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){s=e}}).prototype=new q,(ut=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,ut.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 q,ut.prototype.flush=function(e){var t,i,n,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,dt.forEach((function(e){s.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,ct.forEach((function(e){s.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=ee(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=de(t.startPts,o,this.keepOriginalTimestamps),t.endTime=de(t.endPts,o,this.keepOriginalTimestamps),s.captionStreams[t.stream]=!0,s.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=de(i.pts,o,this.keepOriginalTimestamps),s.metadata.push(i);for(s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),r=0;r<s.captions.length;r++)t=s.captions[r],this.trigger("caption",t);for(r=0;r<s.metadata.length;r++)i=s.metadata[r],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},ut.prototype.setRemux=function(e){this.remuxTracks=e},(ot=function(e){var t,i,n=this,r=!0;ot.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};(this.transmuxPipeline_=r).type="aac",r.metadataStream=new We.MetadataStream,r.aacStream=new lt,r.audioTimestampRolloverStream=new We.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new We.TimestampRolloverStream("timed-metadata"),r.adtsStream=new Ye,r.coalesceStream=new ut(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 st(i,e),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var r={};(this.transmuxPipeline_=r).type="ts",r.metadataStream=new We.MetadataStream,r.packetStream=new We.TransportPacketStream,r.parseStream=new We.TransportParseStream,r.elementaryStream=new We.ElementaryStream,r.timestampRolloverStream=new We.TimestampRolloverStream,r.adtsStream=new Ye,r.h264Stream=new ht,r.captionStream=new We.CaptionStream,r.coalesceStream=new ut(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 at(t,e),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 st(i,e),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,ye(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,ye(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.push=function(e){if(r){var t=pt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new q;var mt={Transmuxer:ot,VideoSegmentStream:at,AudioSegmentStream:st,AUDIO_PROPERTIES:ct,VIDEO_PROPERTIES:dt,generateVideoSegmentTimingInfo:rt}.Transmuxer,gt={Adts:Ye,h264:Ze},vt=ue;function yt(e,t){var i,n,r,a=0,s=[],o=[],u=null,l=null,c=!0;t=t||{},yt.prototype.init.call(this),this.push=function(t){be(e,t),void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],dt.forEach((function(t){e[t]=i[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.data,e.pps=[t.data]),s.push(t)},this.processNals_=function(i){var n;for(s=o.concat(s);s.length&&"access_unit_delimiter_rbsp"!==s[0].nalUnitType;)s.shift();if(0!==s.length){var d=te(s);if(d.length)if(o=d[d.length-1],i&&(d.pop(),d.duration-=o.duration,d.nalCount-=o.length,d.byteLength-=o.byteLength),d.length){if(this.trigger("timelineStartInfo",e.timelineStartInfo),c){if(!(r=ie(d))[0][0].keyFrame){if(!(r=ne(r))[0][0].keyFrame)return s=[].concat.apply([],d).concat(o),void(o=[]);(d=[].concat.apply([],r)).duration=r.duration}c=!1}for(null===u&&(u=d[0].pts,l=u),l+=d.duration,this.trigger("timingInfo",{start:u,end:l}),n=0;n<d.length;n++){var h=d[n];e.samples=re(h);var p=J(ae(h));ye(e),be(e,h),e.baseMediaDecodeTime=_e(e,t.keepOriginalTimestamps);var f=Z(a,[e]);a++,e.initSegment=ee([e]);var m=new Uint8Array(f.byteLength+p.byteLength);m.set(f),m.set(p,f.byteLength),this.trigger("data",{track:e,boxes:m,sequence:a,videoFrameDts:h.dts,videoFramePts:h.pts})}s=[]}else s=[]}},this.resetTimingAndConfig_=function(){n=i=void 0,l=u=null},this.partialFlush=function(){this.processNals_(!0),this.trigger("partialdone","VideoSegmentStream")},this.flush=function(){this.processNals_(!1),this.resetTimingAndConfig_(),this.trigger("done","VideoSegmentStream")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline","VideoSegmentStream")},this.reset=function(){this.resetTimingAndConfig_(),o=[],s=[],c=!0,this.trigger("reset")}}ft.prototype=new q;var _t=ft;function bt(e){return e.prototype=new q,e.prototype.init.call(e),e}function Tt(e,t){e.on("data",t.trigger.bind(t,"data")),e.on("done",t.trigger.bind(t,"done")),e.on("partialdone",t.trigger.bind(t,"partialdone")),e.on("endedtimeline",t.trigger.bind(t,"endedtimeline")),e.on("audioTimingInfo",t.trigger.bind(t,"audioTimingInfo")),e.on("videoTimingInfo",t.trigger.bind(t,"videoTimingInfo")),e.on("trackinfo",t.trigger.bind(t,"trackinfo")),e.on("id3Frame",(function(i){i.dispatchType=e.metadataStream.dispatchType,i.cueTime=le(i.pts),t.trigger("id3Frame",i)})),e.on("caption",(function(e){t.trigger("caption",e)}))}function St(e){var t=null,i=!0;e=e||{},St.prototype.init.call(this),e.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.push=function(n){if(i){var r=Ct(n);!r||t&&"aac"===t.type?r||t&&"ts"===t.type||(t=function(e){var t={type:"ts",tracks:{audio:null,video:null},packet:new We.TransportPacketStream,parse:new We.TransportParseStream,elementary:new We.ElementaryStream,timestampRollover:new We.TimestampRolloverStream,adts:new gt.Adts,h264:new gt.h264.H264Stream,captionStream:new We.CaptionStream,metadataStream:new We.MetadataStream};return t.headOfPipeline=t.packet,t.packet.pipe(t.parse).pipe(t.elementary).pipe(t.timestampRollover),t.timestampRollover.pipe(t.h264),t.h264.pipe(t.captionStream),t.timestampRollover.pipe(t.metadataStream),t.timestampRollover.pipe(t.adts),t.elementary.on("data",(function(i){if("metadata"===i.type){for(var n=0;n<i.tracks.length;n++)t.tracks[i.tracks[n].type]||(t.tracks[i.tracks[n].type]=i.tracks[n],t.tracks[i.tracks[n].type].timelineStartInfo.baseMediaDecodeTime=e.baseMediaDecodeTime);t.tracks.video&&!t.videoSegmentStream&&(t.videoSegmentStream=new kt(t.tracks.video,e),t.videoSegmentStream.on("timelineStartInfo",(function(i){t.tracks.audio&&!e.keepOriginalTimestamps&&t.audioSegmentStream.setEarliestDts(i.dts-e.baseMediaDecodeTime)})),t.videoSegmentStream.on("timingInfo",t.trigger.bind(t,"videoTimingInfo")),t.videoSegmentStream.on("data",(function(e){t.trigger("data",{type:"video",data:e})})),t.videoSegmentStream.on("done",t.trigger.bind(t,"done")),t.videoSegmentStream.on("partialdone",t.trigger.bind(t,"partialdone")),t.videoSegmentStream.on("endedtimeline",t.trigger.bind(t,"endedtimeline")),t.h264.pipe(t.videoSegmentStream)),t.tracks.audio&&!t.audioSegmentStream&&(t.audioSegmentStream=new _t(t.tracks.audio,e),t.audioSegmentStream.on("data",(function(e){t.trigger("data",{type:"audio",data:e})})),t.audioSegmentStream.on("done",t.trigger.bind(t,"done")),t.audioSegmentStream.on("partialdone",t.trigger.bind(t,"partialdone")),t.audioSegmentStream.on("endedtimeline",t.trigger.bind(t,"endedtimeline")),t.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo")),t.adts.pipe(t.audioSegmentStream)),t.trigger("trackinfo",{hasAudio:!!t.tracks.audio,hasVideo:!!t.tracks.video})}})),t.captionStream.on("data",(function(i){var n;n=t.tracks.video&&t.tracks.video.timelineStartInfo.pts||0,i.startTime=de(i.startPts,n,e.keepOriginalTimestamps),i.endTime=de(i.endPts,n,e.keepOriginalTimestamps),t.trigger("caption",i)})),(t=bt(t)).metadataStream.on("data",t.trigger.bind(t,"id3Frame")),t}(e),Tt(t,this)):(t=function(e){var t={type:"aac",tracks:{audio:null},metadataStream:new We.MetadataStream,aacStream:new lt,audioRollover:new We.TimestampRolloverStream("audio"),timedMetadataRollover:new We.TimestampRolloverStream("timed-metadata"),adtsStream:new Ye(!0)};return t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioRollover).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataRollover).pipe(t.metadataStream),t.metadataStream.on("timestamp",(function(e){t.aacStream.setTimestamp(e.timeStamp)})),t.aacStream.on("data",(function(i){"timed-metadata"!==i.type&&"audio"!==i.type||t.audioSegmentStream||(t.tracks.audio=t.tracks.audio||{timelineStartInfo:{baseMediaDecodeTime:e.baseMediaDecodeTime},codec:"adts",type:"audio"},t.audioSegmentStream=new _t(t.tracks.audio,e),t.audioSegmentStream.on("data",(function(e){t.trigger("data",{type:"audio",data:e})})),t.audioSegmentStream.on("partialdone",t.trigger.bind(t,"partialdone")),t.audioSegmentStream.on("done",t.trigger.bind(t,"done")),t.audioSegmentStream.on("endedtimeline",t.trigger.bind(t,"endedtimeline")),t.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo")),t.adtsStream.pipe(t.audioSegmentStream),t.trigger("trackinfo",{hasAudio:!!t.tracks.audio,hasVideo:!!t.tracks.video}))})),(t=bt(t)).metadataStream.on("data",t.trigger.bind(t,"id3Frame")),t}(e),Tt(t,this)),i=!1}t.headOfPipeline.push(n)},this.flush=function(){t&&(i=!0,t.headOfPipeline.flush())},this.partialFlush=function(){t&&t.headOfPipeline.partialFlush()},this.endTimeline=function(){t&&t.headOfPipeline.endTimeline()},this.reset=function(){t&&t.headOfPipeline.reset()},this.setBaseMediaDecodeTime=function(i){e.keepOriginalTimestamps||(e.baseMediaDecodeTime=i),t&&(t.tracks.audio&&(t.tracks.audio.timelineStartInfo.dts=void 0,t.tracks.audio.timelineStartInfo.pts=void 0,ye(t.tracks.audio),t.audioRollover&&t.audioRollover.discontinuity()),t.tracks.video&&(t.videoSegmentStream&&(t.videoSegmentStream.gopCache_=[]),t.tracks.video.timelineStartInfo.dts=void 0,t.tracks.video.timelineStartInfo.pts=void 0,ye(t.tracks.video)),t.timestampRollover&&t.timestampRollover.discontinuity())},this.setRemux=function(i){e.remux=i,t&&t.coalesceStream&&t.coalesceStream.setRemux(i)},this.setAudioAppendStart=function(e){t&&t.tracks.audio&&t.audioSegmentStream&&t.audioSegmentStream.setAudioAppendStart(e)},this.alignGopsWith=function(e){}}yt.prototype=new q;var kt=yt,Ct=et;function Et(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}function wt(e,t){var i=Dt(e,["moof","traf"]),n=Dt(e,["mdat"]),r={},a=[];return n.forEach((function(e,t){var n=i[t];a.push({mdat:e,traf:n})})),a.forEach((function(e){var i,n=e.mdat,a=e.traf,s=Dt(a,["tfhd"]),o=Ut(s[0]),u=o.trackId,l=Dt(a,["tfdt"]),c=0<l.length?Rt(l[0]).baseMediaDecodeTime:0,d=Dt(a,["trun"]);t===u&&0<d.length&&(i=function(e,t,i){var n,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u=[];for(r=0;r+4<e.length;r+=a)if(a=o.getUint32(r),r+=4,!(a<=0))switch(31&e[r]){case 6:var l=e.subarray(r+1,r+1+a),c=Et(r,t);if(n={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:Ft(l),trackId:i},c)n.pts=c.pts,n.dts=c.dts,s=c;else{if(!s)break;n.pts=s.pts,n.dts=s.dts}u.push(n)}return u}(n,function(e,t,i){var n=t,r=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,s=i.trackId,o=[];return e.forEach((function(e){var t=Nt(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=n+e.compositionTimeOffset,n+=e.duration})),o=o.concat(t)})),o}(d,c,o),u),r[u]||(r[u]=[]),r[u]=r[u].concat(i))})),r}function It(e){return"AudioSegmentStream"===e?"audio":"VideoSegmentStream"===e?"video":""}St.prototype=new q;var At=St,xt=function(e){return e>>>0},Pt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])},Lt=xt,Dt=function e(t,i){var n,r,a,s,o,u=[];if(!i.length)return null;for(n=0;n<t.byteLength;)r=Lt(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),a=Pt(t.subarray(n+4,n+8)),s=1<r?n+r:t.byteLength,a===i[0]&&(1===i.length?u.push(t.subarray(n+8,s)):(o=e(t.subarray(n+8,s),i.slice(1))).length&&(u=u.concat(o))),n=s;return u},Ot=xt,Rt=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:Ot(e[4]<<24|e[5]<<16|e[6]<<8|e[7])};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=Ot(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),t},Mt=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]}},Nt=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:Mt(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=Mt(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},Ut=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],a=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],u=32&n.flags[2],l=65536&n.flags[0],c=131072&n.flags[0];return t=8,r&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),a&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),s&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),u&&(n.defaultSampleFlags=i.getUint32(t)),l&&(n.durationIsEmpty=!0),!r&&c&&(n.baseDataOffsetIsMoof=!0),n},Ft=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},Bt=Ae.CaptionStream,jt=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}))},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){var o;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 u=t.shift();this.parse(u,a,s)}return null!==(o=function(e,t,i){return null===t?null:{seiNals:wt(e,t)[t],timescale:i}}(e,i,n))&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],n=i=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()},Vt=function(){function e(e,t){this.options=t||{},this.self=e,this.init()}var t=e.prototype;return t.init=function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=this.options.handlePartialData?new At(this.options):new mt(this.options),this.options.handlePartialData?function(e,t){t.on("data",(function(t){var i={data:t.data.track.initSegment.buffer,byteOffset:t.data.track.initSegment.byteOffset,byteLength:t.data.track.initSegment.byteLength},n={boxes:{data:t.data.boxes.buffer,byteOffset:t.data.boxes.byteOffset,byteLength:t.data.boxes.byteLength},initSegment:i,type:t.type,sequence:t.data.sequence};void 0!==t.data.videoFrameDts&&(n.videoFrameDtsTime=pe(t.data.videoFrameDts)),void 0!==t.data.videoFramePts&&(n.videoFramePtsTime=pe(t.data.videoFramePts)),e.postMessage({action:"data",segment:n},[n.boxes.data,n.initSegment.data])})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(t){e.postMessage({action:"caption",caption:t})})),t.on("done",(function(t){e.postMessage({action:"done",type:It(t)})})),t.on("partialdone",(function(t){e.postMessage({action:"partialdone",type:It(t)})})),t.on("endedsegment",(function(t){e.postMessage({action:"endedSegment",type:It(t)})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){if(null!==t.start){var i={start:pe(t.start)};t.end&&(i.end=pe(t.end)),e.postMessage({action:"audioTimingInfo",audioTimingInfo:i})}else e.postMessage({action:"audioTimingInfo",audioTimingInfo:t})})),t.on("videoTimingInfo",(function(t){var i={start:pe(t.start)};t.end&&(i.end=pe(t.end)),e.postMessage({action:"videoTimingInfo",videoTimingInfo:i})}))}(this.self,this.transmuxer):function(e,t){t.on("data",(function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};var n=t.data;t.data=n.buffer,e.postMessage({action:"data",segment:t,byteOffset:n.byteOffset,byteLength:n.byteLength},[t.data])})),t.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:pe(t.start.dts),presentation:pe(t.start.pts)},end:{decode:pe(t.end.dts),presentation:pe(t.end.pts)},baseMediaDecodeTime:pe(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=pe(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo: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:pe(t.start),end:pe(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:pe(t.start),end:pe(t.end)}})}))}(this.self,this.transmuxer)},t.pushMp4Captions=function(e){this.captionParser||(this.captionParser=new jt,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:i&&i.captions||[],data:t.buffer},[t.buffer])},t.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},t.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},t.push=function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)},t.reset=function(){this.transmuxer.reset()},t.setTimestampOffset=function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(he(t)))},t.setAudioAppendStart=function(e){this.transmuxer.setAudioAppendStart(Math.ceil(he(e.appendStart)))},t.setRemux=function(e){this.transmuxer.setRemux(e.remux)},t.flush=function(e){this.transmuxer.flush(),i.postMessage({action:"done",type:"transmuxed"})},t.partialFlush=function(e){this.transmuxer.partialFlush(),i.postMessage({action:"partialdone",type:"transmuxed"})},t.endTimeline=function(){this.transmuxer.endTimeline(),i.postMessage({action:"endedtimeline",type:"transmuxed"})},t.alignGopsWith=function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())},e}();new function(e){e.onmessage=function(t){"init"===t.data.action&&t.data.options?this.messageHandlers=new Vt(e,t.data.options):(this.messageHandlers||(this.messageHandlers=new Vt(e)),t.data&&t.data.action&&"init"!==t.data.action&&this.messageHandlers[t.data.action]&&this.messageHandlers[t.data.action](t.data))}}(i)}()})),ec=Hl("PlaylistSelector"),tc=function(t){function i(e,i){var n;if(n=t.call(this)||this,!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");return n.bandwidth=e.bandwidth,n.throughput={rate:0,count:0},n.roundTrip=NaN,n.resetStats_(),n.mediaIndex=null,n.hasPlayed_=e.hasPlayed,n.currentTime_=e.currentTime,n.seekable_=e.seekable,n.seeking_=e.seeking,n.duration_=e.duration,n.mediaSource_=e.mediaSource,n.vhs_=e.vhs,n.loaderType_=e.loaderType,n.currentMediaInfo_=void 0,n.startingMediaInfo_=void 0,n.segmentMetadataTrack_=e.segmentMetadataTrack,n.goalBufferLength_=e.goalBufferLength,n.sourceType_=e.sourceType,n.sourceUpdater_=e.sourceUpdater,n.inbandTextTracks_=e.inbandTextTracks,n.state_="INIT",n.handlePartialData_=e.handlePartialData,n.timelineChangeController_=e.timelineChangeController,n.shouldSaveSegmentTimingInfo_=!0,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<=na.browser.IE_VERSION,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=e.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=e.decrypter,n.syncController_=e.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_=Hl("SegmentLoader["+n.loaderType_+"]"),Object.defineProperty(je(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}ze(i,t);var n=i.prototype;return n.createTransmuxer_=function(){var e=new Zl;return e.postMessage({action:"init",options:{remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,handlePartialData:this.handlePartialData_}}),e},n.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0},n.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&(this.transmuxer_.terminate(),el=null,Cl.length=0),this.resetStats_(),this.checkBufferTimeout_&&e.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},n.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},n.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},n.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_)},n.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},n.error=function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},n.endOfStream=function(){this.ended_=!0,this.transmuxer_&&wl(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},n.buffered_=function(){if(!this.sourceUpdater_||!this.startingMediaInfo_)return na.createTimeRanges();if("main"===this.loaderType_){var e=this.startingMediaInfo_,t=e.hasAudio,i=e.hasVideo,n=e.isMuxed;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},n.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Mu(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},n.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Nu(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r},n.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},n.load=function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY")}},n.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},n.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});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&&!this.handlePartialData_||this.resyncLoader(),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");var a=e.mediaSequence-i.mediaSequence;this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex&&(this.mediaIndex-=a),n&&(n.mediaIndex-=a,0<=n.mediaIndex&&(n.segment=e.segments[n.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(i,e)}},n.pause=function(){this.checkBufferTimeout_&&(e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},n.paused=function(){return null===this.checkBufferTimeout_},n.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"})},n.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},n.resyncLoader=function(){this.transmuxer_&&wl(this.transmuxer_),this.mediaIndex=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"})},n.remove=function(e,t,i){if(void 0===i&&(i=function(){}),t===1/0&&(t=this.duration_()),this.sourceUpdater_&&this.currentMediaInfo_){var n=1,r=function(){0==--n&&i()};for(var a in this.audioDisabled_||(n++,this.sourceUpdater_.removeAudio(e,t,r)),"main"===this.loaderType_&&this.currentMediaInfo_&&this.currentMediaInfo_.hasVideo&&(this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil((t-n)*Bo),a=Math.ceil((i-n)*Bo),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),s.splice(u,o-u+1),s}(this.gopBuffer_,e,t,this.timeMapping_),n++,this.sourceUpdater_.removeVideo(e,t,r)),this.inbandTextTracks_)Xl(e,t,this.inbandTextTracks_[a]);Xl(e,t,this.segmentMetadataTrack_),r()}},n.monitorBuffer_=function(){this.checkBufferTimeout_&&e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),1)},n.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),500)},n.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var e=this.buffered_(),t=this.checkBuffer_(e,this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);t&&(t.timestampOffset=Ql({segmentTimeline:t.timeline,currentTimeline:this.currentTimeline_,startOfSegment:t.startOfSegment,buffered:e,overrideCheck:this.isPendingTimestampOffset_}),this.isPendingTimestampOffset_=!1,"number"==typeof t.timestampOffset&&this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:t.timeline}),this.loadSegment_(t))}},n.isEndOfStream_=function(e,t){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),!t||!this.mediaSource_)return!1;var i=e+1===t.segments.length;return t.endList&&"open"===this.mediaSource_.readyState&&i},n.checkBuffer_=function(e,t,i,n,r,a){var s=0;e.length&&(s=e.end(e.length-1));var o=Math.max(0,s-r);if(!t.segments.length)return null;if(o>=this.goalBufferLength_())return null;if(!n&&1<=o)return null;var u,l=null,c=!1;if(null===a)l=this.getSyncSegmentCandidate_(t),c=!0;else if(null!==i){var d=t.segments[i];u=d&&d.end?d.end:s,l=i+1}else if(this.fetchAtBuffer_){var h=vl.getMediaInfoForTime(t,s,a.segmentIndex,a.time);l=h.mediaIndex,u=h.startTime}else{var p=vl.getMediaInfoForTime(t,r,a.segmentIndex,a.time);l=p.mediaIndex,u=p.startTime}var f=this.generateSegmentInfo_(t,l,u,c);return!f||this.mediaSource_&&this.playlist_&&f.mediaIndex===this.playlist_.segments.length-1&&"ended"===this.mediaSource_.readyState&&!this.seeking_()?void 0:(this.logger_("checkBuffer_ returning "+f.uri,{segmentInfo:f,playlist:t,currentMediaIndex:i,nextMediaIndex:l,startOfSegment:u,isSyncRequest:c}),f)},n.getSyncSegmentCandidate_=function(e){var t=this;if(-1===this.currentTimeline_)return 0;var i=e.segments.map((function(e,t){return{timeline:e.timeline,segmentIndex:t}})).filter((function(e){return e.timeline===t.currentTimeline_}));return i.length?i[Math.min(i.length-1,1)].segmentIndex:Math.max(e.segments.length-1,0)},n.generateSegmentInfo_=function(e,t,i,n){if(t<0||t>=e.segments.length)return null;var r,a,s=e.segments[t],o=this.sourceUpdater_.audioBuffered(),u=this.sourceUpdater_.videoBuffered();return o.length&&(r=o.end(o.length-1)-this.sourceUpdater_.audioTimestampOffset()),u.length&&(a=function(e,t,i){if(null==t||!e.length)return[];var n,r=Math.ceil((t-i+3)*Bo);for(n=0;n<e.length&&!(e[n].pts>r);n++);return e.slice(n)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),{requestId:"segment-loader-"+Math.random(),uri:s.resolvedUri,mediaIndex:t,isSyncRequest:n,startOfSegment:i,playlist:e,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:s.timeline,duration:s.duration,segment:s,byteLength:0,transmuxer:this.transmuxer_,audioAppendStart:r,gopsToAlignWith:a}},n.abortRequestEarly_=function(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return!1;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return!1;var t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=vl.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),a=function(e,t,i){return void 0===i&&(i=1),((e.length?e.end(e.length-1):0)-t)/i}(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(r<=a)return!1;var s=function(e){var t=e.currentTime,i=e.bandwidth,n=e.duration,r=e.segmentDuration,a=e.timeUntilRebuffer,s=e.currentTimeline,o=e.syncController,u=e.master.playlists.filter((function(e){return!vl.isIncompatible(e)})),l=u.filter(vl.isEnabled);l.length||(l=u.filter((function(e){return!vl.isDisabled(e)})));var c=l.filter(vl.hasAttribute.bind(null,"BANDWIDTH")).map((function(e){var u=o.getSyncPoint(e,n,s,t)?1:2;return{playlist:e,rebufferingImpact:vl.estimateSegmentRequestTime(r,i,e)*u-a}})),d=c.filter((function(e){return e.rebufferingImpact<=0}));return Gl(d,(function(e,t){return Kl(t.playlist,e.playlist)})),d.length?d[0]:(Gl(c,(function(e,t){return e.rebufferingImpact-t.rebufferingImpact})),c[0]||null)}({master:this.vhs_.playlists.master,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var o=r-a-s.rebufferingImpact,u=.5;return a<=ml&&(u=1),!(!s.playlist||s.playlist.uri===this.playlist_.uri||o<u)&&(this.bandwidth=s.playlist.attributes.BANDWIDTH*kl.BANDWIDTH_VARIANCE+1,this.abort(),this.trigger("earlyabort"),!0)}},n.handleAbort_=function(){this.mediaRequestsAborted+=1},n.handleProgress_=function(e,t){this.checkForAbort_(t.requestId)||this.abortRequestEarly_(t.stats)||this.trigger("progress")},n.handleTrackInfo_=function(e,t){this.checkForAbort_(e.requestId)||this.abortRequestEarly_(e.stats)||this.checkForIllegalMediaSwitch(t)||(t=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)||(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.abortRequestEarly_(e.stats)||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_()))},n.handleTimingInfo_=function(e,t,i,n){if(!this.checkForAbort_(e.requestId)&&!this.abortRequestEarly_(e.stats)){var r=this.pendingSegment_,a=$l(t);r[a]=r[a]||{},r[a][i]=n,this.logger_("timinginfo: "+t+" - "+i+" - "+n),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}},n.handleCaptions_=function(t,i){var n=this;if(!this.checkForAbort_(t.requestId)&&!this.abortRequestEarly_(t.stats))if(0!==i.length)if(this.pendingSegment_.hasAppendedData_){var r=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),a={};i.forEach((function(e){a[e.stream]=a[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=a[e.stream];t.startTime=Math.min(t.startTime,e.startTime+r),t.endTime=Math.max(t.endTime,e.endTime+r),t.captions.push(e)})),Object.keys(a).forEach((function(t){var i=a[t],s=i.startTime,o=i.endTime,u=i.captions,l=n.inbandTextTracks_;n.logger_("adding cues from "+s+" -> "+o+" for "+t),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"});var n=t.textTracks().getTrackById(i);e[i]=n||t.addRemoteTextTrack({kind:"captions",id:i,label:i},!1).track}}(l,n.vhs_.tech_,t),Xl(s,o,l[t]),function(t){var i=t.inbandTextTracks,n=t.captionArray,r=t.timestampOffset;if(n){var a=e.WebKitDataCue||e.VTTCue;n.forEach((function(e){var t=e.stream;i[t].addCue(new a(e.startTime+r,e.endTime+r,e.text))}))}}({captionArray:u,inbandTextTracks:l,timestampOffset:r})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,t,i));else this.logger_("SegmentLoader received no captions from a caption event")},n.handleId3_=function(t,i,n){if(!this.checkForAbort_(t.requestId)&&!this.abortRequestEarly_(t.stats))if(this.pendingSegment_.hasAppendedData_){var r=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();!function(e,t,i){e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)}(this.inbandTextTracks_,n,this.vhs_.tech_),function(t){var i=t.inbandTextTracks,n=t.metadataArray,r=t.timestampOffset,a=t.videoDuration;if(n){var s=e.WebKitDataCue||e.VTTCue,o=i.metadataTrack_;if(o&&(n.forEach((function(t){var i=t.cueTime+r;!("number"!=typeof i||e.isNaN(i)||i<0)&&i<1/0&&t.frames.forEach((function(e){var t=new s(i,i,e.value||e.url||e.data||"");t.frame=e,t.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return na.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return na.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return na.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(t),o.addCue(t)}))})),o.cues&&o.cues.length)){for(var u=o.cues,l=[],c=0;c<u.length;c++)u[c]&&l.push(u[c]);var d=l.reduce((function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),h=Object.keys(d).sort((function(e,t){return Number(e)-Number(t)}));h.forEach((function(e,t){var i=d[e],n=Number(h[t+1])||a;i.forEach((function(e){e.endTime=n}))}))}}}({inbandTextTracks:this.inbandTextTracks_,metadataArray:i,timestampOffset:r,videoDuration:this.duration_()})}else this.metadataQueue_.id3.push(this.handleId3_.bind(this,t,i,n))},n.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach((function(e){return e()})),this.metadataQueue_.caption.forEach((function(e){return e()})),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},n.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach((function(e){return e()}))},n.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach((function(e){return e()}))},n.hasEnoughInfoToLoad_=function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!(!e||this.currentMediaInfo_&&Jl({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},n.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready())return!1;var e=this.pendingSegment_;if(!e||!e.trackInfo)return!1;if(!this.handlePartialData_){var t=this.currentMediaInfo_,i=t.hasAudio,n=t.hasVideo,r=t.isMuxed;if(n&&!e.videoTimingInfo)return!1;if(i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo)return!1}return!Jl({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_})},n.handleData_=function(e,t){if(!this.checkForAbort_(e.requestId)&&!this.abortRequestEarly_(e.stats))if(!this.callQueue_.length&&this.hasEnoughInfoToAppend_()){var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[$l(t.type)].start;else{var n,r="main"===this.loaderType_&&this.currentMediaInfo_.hasVideo;r&&(n=this.handlePartialData_?t.videoFramePtsTime:i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:r,firstVideoFrameTimeForData:n,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}else this.callQueue_.push(this.handleData_.bind(this,e,t))},n.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)},n.getInitSegmentAndUpdateState_=function(e){var t=e.type,i=e.initSegment,n=e.map,r=e.playlist;if(n){var a=Mu(n);if(this.activeInitSegmentId_===a)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=a}return i&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!!n,this.activeInitSegmentId_=null,i):null},n.appendToSourceBuffer_=function(e){var t=this,i=e.segmentInfo,n=e.type,r=e.initSegment,a=e.data,s=[a],o=a.byteLength;r&&(s.unshift(r),o+=r.byteLength);var u=function(e){var t,i=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach((function(e){t.set(e,i),i+=e.byteLength}))),t}({bytes:o,segments:s});this.sourceUpdater_.appendBuffer({segmentInfo:i,type:n,bytes:u},(function(e){e&&(t.error(n+" append of "+u.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),t.trigger("appenderror"))}))},n.handleVideoSegmentTimingInfo_=function(e,t){if(this.pendingSegment_&&e===this.pendingSegment_.requestId){var i=this.pendingSegment_.segment;i.videoTimingInfo||(i.videoTimingInfo={}),i.videoTimingInfo.transmuxerPrependedSeconds=t.prependedContentDuration||0,i.videoTimingInfo.transmuxedPresentationStart=t.start.presentation,i.videoTimingInfo.transmuxedPresentationEnd=t.end.presentation,i.videoTimingInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}},n.appendData_=function(e,t){var i=t.type,n=t.data;if(n&&n.byteLength&&("audio"!==i||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}},n.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=t.buffered_();"number"==typeof e.timestampOffset&&(e.timestampOffset=Ql({segmentTimeline:e.timeline,currentTimeline:t.currentTimeline_,startOfSegment:e.startOfSegment,buffered:i,overrideCheck:!0})),delete e.audioAppendStart;var n=t.sourceUpdater_.audioBuffered();n.length&&(e.audioAppendStart=n.end(n.length-1)-t.sourceUpdater_.audioTimestampOffset()),t.updateTransmuxerAndRequestSegment_(e)}))},n.updateTransmuxerAndRequestSegment_=function(e){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 t=this.createSimplifiedSegmentObj_(e);e.abortRequests=Zu({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,handlePartialData:this.handlePartialData_,abortFn:this.handleAbort_.bind(this),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleVideoSegmentTimingInfo_.bind(this,e.requestId),captionsFn:this.handleCaptions_.bind(this),id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this)})},n.trimBackBuffer_=function(e){var t=function(e,t,i){var n=t-kl.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));var r=t-i;return Math.min(r,n)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0<t&&this.remove(0,t)},n.createSimplifiedSegmentObj_=function(e){var t=e.segment,i={resolvedUri:t.resolvedUri,byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith},n=e.playlist.segments[e.mediaIndex];if(n&&n.end&&n.timeline===t.timeline&&(i.baseStartTime=n.end+e.timestampOffset),t.key){var r=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);i.key=this.segmentKey(t.key),i.key.iv=r}return t.map&&(i.map=this.initSegmentForMap(t.map)),i},n.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},n.saveBandwidthRelatedStats_=function(e){this.bandwidth=e.bandwidth,this.roundTrip=e.roundTripTime,this.pendingSegment_.byteLength=e.bytesReceived},n.handleTimeout_=function(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate")},n.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){if(this.pendingSegment_=null,this.state="READY",e.code===xl)return;return this.pause(),e.code===Al?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error"))}this.saveBandwidthRelatedStats_(t.stats);var n=this.pendingSegment_;n.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";var r=this.isEndOfStream_(n.mediaIndex,n.playlist),a=null!==this.mediaIndex,s=n.timeline!==this.currentTimeline_&&0<n.timeline;!n.isFmp4&&(r||a&&s)&&function(e){Xu("endTimeline",e)}(this.transmuxer_),this.trigger("appending"),this.waitForAppendsToComplete_(n)}},n.setTimeMapping_=function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)},n.updateMediaSecondsLoaded_=function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},n.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},n.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,u=e.audioTimingInfo;if(void 0!==t)return t;if(!s)return u.start;var l=i.segments[n-1];return 0!==n&&l&&void 0!==l.start&&l.end===r+a?o.start:r},n.waitForAppendsToComplete_=function(e){if(!this.currentMediaInfo_)return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var t=this.currentMediaInfo_,i=t.hasAudio,n=t.hasVideo,r=t.isMuxed,a="main"===this.loaderType_&&n,s=!this.audioDisabled_&&i&&!r;if(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);a&&e.waitingOnAppends++,s&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},n.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},n.checkForIllegalMediaSwitch=function(e){var t=function(e,t,i){return"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.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.":!t.hasVideo&&i.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.loaderType_,this.currentMediaInfo_,e);return!!t&&(this.error({message:t,blacklistDuration:1/0}),this.trigger("error"),!0)},n.updateSourceBufferTimestampOffset_=function(e){if(null!==e.timestampOffset&&"number"==typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var t=!1;e.timestampOffset-=e.timingInfo.start,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")}},n.updateTimingInfoEnd_=function(e){e.timingInfo=e.timingInfo||{};var t="main"===this.loaderType_&&this.currentMediaInfo_.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;t&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)},n.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_}),this.logger_(function(e){var t=e.segment,i=t.start,n=t.end,r=e.playlist,a=r.mediaSequence,s=r.id,o=r.segments,u=void 0===o?[]:o,l=e.mediaIndex,c=e.timeline;return["appending ["+l+"] of ["+a+", "+(a+u.length)+"] from playlist ["+s+"]","["+i+" => "+n+"] in timeline ["+c+"]"].join(" ")}(e)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest)this.trigger("syncinfoupdate");else{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;t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration?this.resetEverything():(null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.isEndOfStream_(e.mediaIndex,e.playlist)&&this.endOfStream(),this.trigger("appended"),this.paused()||this.monitorBuffer_())}},n.recordThroughput_=function(e){var t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count},n.addSegmentMetadataCue_=function(t){if(this.segmentMetadataTrack_){var i=t.segment,n=i.start,r=i.end;if(Yl(n)&&Yl(r)){Xl(n,r,this.segmentMetadataTrack_);var a=e.WebKitDataCue||e.VTTCue,s={custom:i.custom,dateTimeObject:i.dateTimeObject,dateTimeString:i.dateTimeString,bandwidth:t.playlist.attributes.BANDWIDTH,resolution:t.playlist.attributes.RESOLUTION,codecs:t.playlist.attributes.CODECS,byteLength:t.byteLength,uri:t.uri,timeline:t.timeline,playlist:t.playlist.id,start:n,end:r},o=new a(n,r,JSON.stringify(s));o.value=s,this.segmentMetadataTrack_.addCue(o)}}},i}(na.EventTarget);function ic(){}function nc(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))}function rc(e,t){var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]}function ac(e,t){if(0!==t.queue.length){var i=0,n=t.queue[i];if("mediaSource"!==n.type){if("mediaSource"!==e&&t.started_&&"closed"!==t.mediaSource.readyState&&!rc(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),n.action(e,t),n.doneFn?t.queuePending[e]=n:ac(e,t)}}else t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),n.action(t),n.doneFn&&n.doneFn(),ac("audio",t),ac("video",t))}}function sc(e,t){var i=t[e+"Buffer"],n=nc(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 oc(e,t){return e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t)}function uc(e){var t=e.type,i=e.sourceUpdater,n=e.action,r=e.doneFn,a=e.name;i.queue.push({type:t,action:n,doneFn:r,name:a}),ac(t,i)}function lc(e,t){return function(i){if(t.queuePending[e]){var n=t.queuePending[e].doneFn;t.queuePending[e]=null,n&&n(t[e+"Error_"])}ac(e,t)}}function cc(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))}function dc(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}function hc(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)}function pc(e,t){(t.activePlaylistLoader=e).load()}function fc(e,t,i){var n=e.masterPlaylistController_,r=n[(e.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(n);if(t.attributes.RESOLUTION){var a=t.attributes.RESOLUTION;this.width=a.width,this.height=a.height}this.bandwidth=t.attributes.BANDWIDTH,this.codecs=ql(n.master(),t),this.playlist=t,this.id=i,this.enabled=function(e,t,i){return function(n){var r=e.master.playlists[t],a=Eu(r),s=wu(r);return void 0===n?s:(n?delete r.disabled:r.disabled=!0,n===s||a||(i(),n?e.trigger("renditionenabled"):e.trigger("renditiondisabled")),n)}}(e.playlists,t.id,r)}function mc(e){!function e(t,i){var n=0,r=0,a=na.mergeOptions(qc,i);function s(){r&&t.currentTime(r)}function o(e){null!=e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())}function u(){return Date.now()-n<1e3*a.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):a.getSource&&"function"==typeof a.getSource?(n=Date.now(),a.getSource.call(t,o)):void na.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}function l(){t.off("loadedmetadata",s),t.off("error",u),t.off("dispose",l)}t.ready((function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})})),t.on("error",u),t.on("dispose",l),t.reloadSourceOnError=function(i){l(),e(t,i)}}(this,e)}var gc,vc=["video","audio"],yc=function(e,t){return function(i,n){var r=n[i+"Buffer"];oc(n.mediaSource,r)&&(n.logger_("Appending segment "+t.mediaIndex+"'s "+e.length+" bytes to "+i+"Buffer"),r.appendBuffer(e))}},_c=function(e,t){return function(i,n){var r=n[i+"Buffer"];oc(n.mediaSource,r)&&(n.logger_("Removing "+e+" to "+t+" from "+i+"Buffer"),r.remove(e,t))}},bc=function(e){return function(t,i){var n=i[t+"Buffer"];oc(i.mediaSource,n)&&(i.logger_("Setting "+t+"timestampOffset to "+e),n.timestampOffset=e)}},Tc=function(e){return function(t,i){e()}},Sc=function(e){return function(t){if("open"===t.mediaSource.readyState){t.logger_("Calling mediaSource endOfStream("+(e||"")+")");try{t.mediaSource.endOfStream(e)}catch(t){na.log.warn("Failed to call media source endOfStream",t)}}}},kc=function(e){return function(t){t.logger_("Setting mediaSource duration to "+e);try{t.mediaSource.duration=e}catch(t){na.log.warn("Failed to set media source duration",t)}}},Cc=function(e,t){return function(i){var n=nc(e),r=al(t);i.logger_("Adding "+e+"Buffer with codec "+t+" to mediaSource");var a=i.mediaSource.addSourceBuffer(r);a.addEventListener("updateend",i["on"+n+"UpdateEnd_"]),a.addEventListener("error",i["on"+n+"Error_"]),i.codecs[e]=t,i[e+"Buffer"]=a}},Ec=function(e){return function(t){var i=t[e+"Buffer"];if(sc(e,t),oc(t.mediaSource,i)){t.logger_("Removing "+e+"Buffer with codec "+t.codecs[e]+" from mediaSource");try{t.mediaSource.removeSourceBuffer(i)}catch(t){na.log.warn("Failed to removeSourceBuffer "+e+"Buffer",t)}}}},wc=function(e){return function(t,i){var n=i[t+"Buffer"],r=al(e);oc(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)}},Ic=function(t){function i(e){var i;return(i=t.call(this)||this).mediaSource=e,i.sourceopenListener_=function(){return ac("mediaSource",je(i))},i.mediaSource.addEventListener("sourceopen",i.sourceopenListener_),i.logger_=Hl("SourceUpdater"),i.audioTimestampOffset_=0,i.videoTimestampOffset_=0,i.queue=[],i.queuePending={audio:null,video:null},i.delayedAudioAppendQueue_=[],i.videoAppendQueued_=!1,i.codecs={},i.onVideoUpdateEnd_=lc("video",je(i)),i.onAudioUpdateEnd_=lc("audio",je(i)),i.onVideoError_=function(e){i.videoError_=e},i.onAudioError_=function(e){i.audioError_=e},i.started_=!1,i}ze(i,t);var n=i.prototype;return n.ready=function(){return this.started_},n.createSourceBuffers=function(e){this.ready()||(this.addOrChangeSourceBuffers(e),this.started_=!0,this.trigger("ready"))},n.addSourceBuffer=function(e,t){uc({type:"mediaSource",sourceUpdater:this,action:Cc(e,t),name:"addSourceBuffer"})},n.abort=function(e){uc({type:e,sourceUpdater:this,action:function(e,t){if("open"===t.mediaSource.readyState){var i=t[e+"Buffer"];if(oc(t.mediaSource,i)){t.logger_("calling abort on "+e+"Buffer");try{i.abort()}catch(t){na.log.warn("Failed to abort on "+e+"Buffer",t)}}}},name:"abort"})},n.removeSourceBuffer=function(e){this.canRemoveSourceBuffer()?uc({type:"mediaSource",sourceUpdater:this,action:Ec(e),name:"removeSourceBuffer"}):na.log.error("removeSourceBuffer is not supported!")},n.canRemoveSourceBuffer=function(){return!na.browser.IE_VERSION&&e.MediaSource&&e.MediaSource.prototype&&"function"==typeof e.MediaSource.prototype.removeSourceBuffer},i.canChangeType=function(){return e.SourceBuffer&&e.SourceBuffer.prototype&&"function"==typeof e.SourceBuffer.prototype.changeType},n.canChangeType=function(){return this.constructor.canChangeType()},n.changeType=function(e,t){this.canChangeType()?uc({type:e,sourceUpdater:this,action:wc(t),name:"changeType"}):na.log.error("changeType is not supported!")},n.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.ready())return t.addSourceBuffer(i,n);t.canChangeType()&&t.changeType(i,n)}))},n.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");if(uc({type:r,sourceUpdater:this,action:yc(a,n||{mediaIndex:-1}),doneFn:t,name:"appendBuffer"}),"video"===r){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;var s=this.delayedAudioAppendQueue_.slice();this.logger_("queuing delayed audio "+s.length+" appendBuffers"),this.delayedAudioAppendQueue_.length=0,s.forEach((function(e){i.appendBuffer.apply(i,e)}))}},n.audioBuffered=function(){return oc(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:na.createTimeRange()},n.videoBuffered=function(){return oc(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:na.createTimeRange()},n.buffered=function(){var e=oc(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=oc(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 na.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 na.createTimeRanges(s)}(this.audioBuffered(),this.videoBuffered())},n.setDuration=function(e,t){void 0===t&&(t=ic),uc({type:"mediaSource",sourceUpdater:this,action:kc(e),name:"duration",doneFn:t})},n.endOfStream=function(e,t){void 0===e&&(e=null),void 0===t&&(t=ic),"string"!=typeof e&&(e=void 0),uc({type:"mediaSource",sourceUpdater:this,action:Sc(e),name:"endOfStream",doneFn:t})},n.removeAudio=function(e,t,i){void 0===i&&(i=ic),this.audioBuffered().length&&0!==this.audioBuffered().end(0)?uc({type:"audio",sourceUpdater:this,action:_c(e,t),doneFn:i,name:"remove"}):i()},n.removeVideo=function(e,t,i){void 0===i&&(i=ic),this.videoBuffered().length&&0!==this.videoBuffered().end(0)?uc({type:"video",sourceUpdater:this,action:_c(e,t),doneFn:i,name:"remove"}):i()},n.updating=function(){return!(!rc("audio",this)&&!rc("video",this))},n.audioTimestampOffset=function(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(uc({type:"audio",sourceUpdater:this,action:bc(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_},n.videoTimestampOffset=function(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(uc({type:"video",sourceUpdater:this,action:bc(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_},n.audioQueueCallback=function(e){this.audioBuffer&&uc({type:"audio",sourceUpdater:this,action:Tc(e),name:"callback"})},n.videoQueueCallback=function(e){this.videoBuffer&&uc({type:"video",sourceUpdater:this,action:Tc(e),name:"callback"})},n.dispose=function(){var e=this;this.trigger("dispose"),vc.forEach((function(t){e.abort(t),e.canRemoveSourceBuffer()?e.removeSourceBuffer(t):e[t+"QueueCallback"]((function(){return sc(t,e)}))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()},i}(na.EventTarget),Ac=new Uint8Array("\n\n".split("").map((function(e){return e.charCodeAt(0)}))),xc=function(t){function i(e,i){var n;return void 0===i&&(i={}),(n=t.call(this,e,i)||this).handlePartialData_=!1,n.mediaSource_=null,n.subtitlesTrack_=null,n.loaderType_="subtitle",n.featuresNativeTextTracks_=e.featuresNativeTextTracks,n.shouldSaveSegmentTimingInfo_=!1,n}ze(i,t);var n=i.prototype;return n.createTransmuxer_=function(){return null},n.buffered_=function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return na.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return na.createTimeRanges([[t,i]])},n.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Mu(e),n=this.initSegments_[i];if(t&&!n&&e.bytes){var r=Ac.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(Ac,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||e},n.couldBeginLoading_=function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()},n.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},n.track=function(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_},n.remove=function(e,t){Xl(e,t,this.subtitlesTrack_)},n.fillBuffer_=function(){var e=this;this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var t=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(t=this.skipEmptySegments_(t)){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline))return this.syncController_.one("timestampoffset",(function(){e.state="READY",e.paused()||e.monitorBuffer_()})),void(this.state="WAITING_ON_TIMELINE");this.loadSegment_(t)}},n.skipEmptySegments_=function(e){for(;e&&e.segment.empty;)e=this.generateSegmentInfo_(e.playlist,e.mediaIndex+1,e.startOfSegment+e.duration,e.isSyncRequest);return e},n.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},n.segmentRequestFinished_=function(t,i,n){var r=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(i.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(t)return t.code===Al&&this.handleTimeout_(),t.code===xl?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(t);this.saveBandwidthRelatedStats_(i.stats),this.state="APPENDING",this.trigger("appending");var a=this.pendingSegment_,s=a.segment;if(s.map&&(s.map.bytes=i.map.bytes),a.bytes=i.bytes,"function"!=typeof e.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var o,u=function(){r.subtitlesTrack_.tech_.off("vttjsloaded",o),r.stopForError({message:"Error loading vtt.js"})};return o=function(){r.subtitlesTrack_.tech_.off("vttjserror",u),r.segmentRequestFinished_(t,i,n)},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",o),void this.subtitlesTrack_.tech_.one("vttjserror",u)}s.requested=!0;try{this.parseVTTCues_(a)}catch(t){return void this.stopForError({message:t.message})}if(this.updateTimeMapping_(a,this.syncController_.timelines[a.timeline],this.playlist_),a.cues.length?a.timingInfo={start:a.cues[0].startTime,end:a.cues[a.cues.length-1].endTime}:a.timingInfo={start:a.startOfSegment,end:a.startOfSegment+a.duration},a.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");a.byteLength=a.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,a.cues.forEach((function(t){r.remove(t.startTime,t.endTime),r.subtitlesTrack_.addCue(r.featuresNativeTextTracks_?new e.VTTCue(t.startTime,t.endTime,t.text):t)})),this.handleAppendsDone_()}else this.state="READY"},n.handleData_=function(){},n.updateTimingInfoEnd_=function(){},n.parseVTTCues_=function(t){var i,n=!1;"function"==typeof e.TextDecoder?i=new e.TextDecoder("utf8"):(i=e.WebVTT.StringDecoder(),n=!0);var r=new e.WebVTT.Parser(e,e.vttjs,i);if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},r.oncue=t.cues.push.bind(t.cues),r.ontimestampmap=function(e){t.timestampmap=e},r.onparsingerror=function(e){na.log.warn("Error encountered when parsing cues: "+e.message)},t.segment.map){var a=t.segment.map.bytes;n&&(a=cc(a)),r.parse(a)}var s=t.bytes;n&&(s=cc(s)),r.parse(s),r.flush()},n.updateTimeMapping_=function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,a=r.MPEGTS/Bo-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=a,e.endTime+=a})),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}else n.empty=!0},i}(tc),Pc=[{name:"VOD",run:function(e,t,i,n,r){return i===1/0?null:{time:0,segmentIndex:0}}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!e.datetimeToDisplayTime)return null;var a=t.segments||[],s=null,o=null;r=r||0;for(var u=0;u<a.length;u++){var l=a[u];if(l.dateTimeObject){var c=l.dateTimeObject.getTime()/1e3+e.datetimeToDisplayTime,d=Math.abs(r-c);if(null!==o&&(0===d||o<d))break;o=d,s={time:c,segmentIndex:u}}}return s}},{name:"Segment",run:function(e,t,i,n,r){var a=t.segments||[],s=null,o=null;r=r||0;for(var u=0;u<a.length;u++){var l=a[u];if(l.timeline===n&&void 0!==l.start){var c=Math.abs(r-l.start);if(null!==o&&o<c)break;(!s||null===o||c<=o)&&(o=c,s={time:l.start,segmentIndex:u})}}return s}},{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){var d=Math.abs(r-c.time);if(null!==s&&s<d)break;(!a||null===s||d<=s)&&(s=d,a={time:c.time,segmentIndex:u})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence}:null}}],Lc=function(e){function t(t){var i;return(i=e.call(this)||this).timelines=[],i.discontinuities=[],i.datetimeToDisplayTime=null,i.logger_=Hl("SyncController"),i}ze(t,e);var i=t.prototype;return i.getSyncPoint=function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null},i.getExpiredTime=function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return 0<n.segmentIndex&&(n.time*=-1),Math.abs(n.time+Tu(e,n.segmentIndex,0))},i.runStrategies_=function(e,t,i,n){for(var r=[],a=0;a<Pc.length;a++){var s=Pc[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+"]"),i},i.saveExpiredSegmentInfo=function(e,t){for(var i=t.mediaSequence-e.mediaSequence-1;0<=i;i--){var n=e.segments[i];if(n&&void 0!==n.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:n.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},i.setDateTimeMapping=function(e){if(!this.datetimeToDisplayTime&&e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0].dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-t}},i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping;this.calculateSegmentTimeMapping_(t,t.timingInfo,i)&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:t.segment.start}))},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=e.segment,r=this.timelines[e.timeline];if(null!==e.timestampOffset)r={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=r,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+r.time+"] [mapping: "+r.mapping+"]")),n.start=e.startOfSegment,n.end=t.end+r.mapping;else{if(!r)return!1;n.start=t.start+r.mapping,n.end=t.end+r.mapping}return!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=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,s=r-e.mediaIndex,o=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>o){var u;u=s<0?i.start-Tu(t,e.mediaIndex,r):i.end+Tu(t,e.mediaIndex+1,r),this.discontinuities[a]={time:u,accuracy:o}}}},i.dispose=function(){this.trigger("dispose"),this.off()},t}(na.EventTarget),Dc=function(e){function t(){var t;return(t=e.call(this)||this).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}ze(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,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.lastTimelineChanges_[t]={type:t,from:i,to:n},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(na.EventTarget),Oc=new Nl("./decrypter-worker.worker.js",(function(e,t){var i,n,r,a,s,o,u;
/*! @name @videojs/http-streaming @version 2.2.4 @license Apache-2.0 */function l(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)}}function c(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}i=function(e,t,i){return t&&l(e.prototype,t),i&&l(e,i),e},n=function(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t},r=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),-1<i},t.trigger=function(e,t){var i=this.listeners[e];if(i)if(2===arguments.length)for(var n=i.length,r=0;r<n;++r)i[r].call(this,t);else for(var a=Array.prototype.slice.call(arguments,1),s=i.length,o=0;o<s;++o)i[o].apply(this,a)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}(),a=null,s=function(){function e(e){var t,i,n;a=a||function(){var e,t,i,n,r,a,s,o,u=[[[],[],[],[],[]],[[],[],[],[],[]]],l=u[0],c=u[1],d=l[4],h=c[4],p=[],f=[];for(e=0;e<256;e++)f[(p[e]=e<<1^283*(e>>7))^e]=e;for(t=i=0;!d[t];t^=n||1,i=f[i]||1)for(a=(a=i^i<<1^i<<2^i<<3^i<<4)>>8^255&a^99,o=16843009*p[r=p[n=p[h[d[t]=a]=t]]]^65537*r^257*n^16843008*t,s=257*p[a]^16843008*a,e=0;e<4;e++)l[e][t]=s=s<<24^s>>>8,c[e][a]=o=o<<24^o>>>8;for(e=0;e<5;e++)l[e]=l[e].slice(0),c[e]=c[e].slice(0);return u}(),this._tables=[[a[0][0].slice(),a[0][1].slice(),a[0][2].slice(),a[0][3].slice(),a[0][4].slice()],[a[1][0].slice(),a[1][1].slice(),a[1][2].slice(),a[1][3].slice(),a[1][4].slice()]];var r=this._tables[0][4],s=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:s[0][r[n>>>24]]^s[1][r[n>>16&255]]^s[2][r[n>>8&255]]^s[3][r[255&n]]}return e.prototype.decrypt=function(e,t,i,n,r,a){var s,o,u,l,c=this._key[1],d=e^c[0],h=n^c[1],p=i^c[2],f=t^c[3],m=c.length/4-2,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],S=v[4];for(l=0;l<m;l++)s=y[d>>>24]^_[h>>16&255]^b[p>>8&255]^T[255&f]^c[g],o=y[h>>>24]^_[p>>16&255]^b[f>>8&255]^T[255&d]^c[g+1],u=y[p>>>24]^_[f>>16&255]^b[d>>8&255]^T[255&h]^c[g+2],f=y[f>>>24]^_[d>>16&255]^b[h>>8&255]^T[255&p]^c[g+3],g+=4,d=s,h=o,p=u;for(l=0;l<4;l++)r[(3&-l)+a]=S[d>>>24]<<24^S[h>>16&255]<<16^S[p>>8&255]<<8^S[255&f]^c[g++],s=d,d=h,h=p,p=f,f=s},e}(),o=function(e){function t(){var t;return(t=e.call(this,r)||this).jobs=[],t.delay=1,t.timeout_=null,t}n(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}(r),u=function(){function e(t,i,n,r){var a=e.STEP,s=new Int32Array(t.buffer),u=new Uint8Array(t.byteLength),l=0;for(this.asyncStream_=new o,this.asyncStream_.push(this.decryptChunk_(s.subarray(l,l+a),i,n,u)),l=a;l<s.length;l+=a)n=new Uint32Array([c(s[l-4]),c(s[l-3]),c(s[l-2]),c(s[l-1])]),this.asyncStream_.push(this.decryptChunk_(s.subarray(l,l+a),i,n,u));this.asyncStream_.push((function(){r(null,
/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
function(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}
/*! @name aes-decrypter @version 3.1.0 @license Apache-2.0 */(u))}))}return e.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=function(e,t,i){var n,r,a,o,u,l,d,h,p,f=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),m=new s(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),v=new Int32Array(g.buffer);for(n=i[0],r=i[1],a=i[2],o=i[3],p=0;p<f.length;p+=4)u=c(f[p]),l=c(f[p+1]),d=c(f[p+2]),h=c(f[p+3]),m.decrypt(u,l,d,h,v,p),v[p]=c(v[p]^n),v[p+1]=c(v[p+1]^r),v[p+2]=c(v[p+2]^a),v[p+3]=c(v[p+3]^o),n=u,r=l,a=d,o=h;return g}(e,t,i);n.set(r,e.byteOffset)}},i(e,null,[{key:"STEP",get:function(){return 32e3}}]),e}(),new function(e){e.onmessage=function(t){var i=t.data,n=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),r=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),a=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new u(n,r,a,(function(t,n){e.postMessage(function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t}({source:i.source,decrypted:n}),[n.buffer])}))}}(this)})),Rc={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;hc(i,n);var a=n.activeTrack(),s=n.activeGroup(),o=(s.filter((function(e){return e.default}))[0]||s[0]).id,u=n.tracks[o];if(a!==u){for(var l in na.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[l].enabled=n.tracks[l]===u;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];na.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),hc(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},Mc={AUDIO:function(e,t,i){if(t){var 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",Rc[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",Rc[e](e,i))}},Nc={AUDIO:function(e,t){var i=t.vhs,n=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.master,o=s.mediaGroups,u=s.playlists,l=t.mediaTypes[e],c=l.groups,d=l.tracks,h=t.masterPlaylistLoader;function p(r){function s(s){var u=o[e][r][s];l.filter((function(e){return e.resolvedUri===u.resolvedUri})).length&&delete u.resolvedUri;var p;if(p="vhs-json"===n&&u.playlists?new fl(u.playlists[0],i,a):u.resolvedUri?new fl(u.resolvedUri,i,a):u.playlists&&"dash"===n?new Sl(u.playlists[0],i,a,h):null,u=na.mergeOptions({id:s,playlistLoader:p},u),Mc[e](e,u.playlistLoader,t),c[r].push(u),void 0===d[s]){var f=new na.AudioTrack({id:s,kind:function(e){var t=e.default?"main":"alternative";return e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")&&(t="main-desc"),t}(u),enabled:!1,language:u.language,default:u.default,label:s});d[s]=f}}c[r]||(c[r]=[]);var l=u.filter((function(t){return t.attributes[e]===r}));for(var p in o[e][r])s(p)}for(var f in o[e]&&0!==Object.keys(o[e]).length||(o[e]={main:{default:{default:!0}}}),o[e])p(f);r.on("error",Rc[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,u=t.mediaTypes[e],l=u.groups,c=u.tracks,d=t.masterPlaylistLoader;for(var h in o[e])for(var p in l[h]||(l[h]=[]),o[e][h])if(!o[e][h][p].forced){var f=o[e][h][p],m=void 0;if("hls"===r?m=new fl(f.resolvedUri,n,s):"dash"===r?m=new Sl(f.playlists[0],n,s,d):"vhs-json"===r&&(m=new fl(f.playlists?f.playlists[0]:f.resolvedUri,n,s)),f=na.mergeOptions({id:p,playlistLoader:m},f),Mc[e](e,f.playlistLoader,t),l[h].push(f),void 0===c[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;c[p]=g}}a.on("error",Rc[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in n[e])for(var u in a[o]||(a[o]=[]),n[e][o]){var l=n[e][o][u];if(l.instreamId.match(/CC\d/)&&(a[o].push(na.mergeOptions({id:u},l)),void 0===s[u])){var c=i.addRemoteTextTrack({id:l.instreamId,kind:"captions",default:l.default&&l.autoselect,language:l.language,label:u},!1).track;s[u]=c}}}},Uc={AUDIO:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if(i[n].enabled)return i[n];return null}},SUBTITLES:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if("showing"===i[n].mode||"hidden"===i[n].mode)return i[n];return null}}},Fc=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],Bc=function(t){function i(i){var n;n=t.call(this)||this;var r=i.src,a=i.handleManifestRedirects,s=i.withCredentials,o=i.tech,u=i.bandwidth,l=i.externVhs,c=i.useCueTags,d=i.blacklistDuration,h=i.enableLowInitialPlaylist,p=i.sourceType,f=i.cacheEncryptionKeys,m=i.handlePartialData;if(!r)throw new Error("A non-empty playlist URL or JSON manifest string is required");gc=l,n.withCredentials=s,n.tech_=o,n.vhs_=o.vhs,n.sourceType_=p,n.useCueTags_=c,n.blacklistDuration=d,n.enableLowInitialPlaylist=h,n.useCueTags_&&(n.cueTagsTrack_=n.tech_.addTextTrack("metadata","ad-cues"),n.cueTagsTrack_.inBandMetadataTrackDispatchType=""),n.requestOptions_={withCredentials:s,handleManifestRedirects:a,timeout:null},n.on("error",n.pauseLoading),n.mediaTypes_=function(){var e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:ic,activeTrack:ic,onGroupChanged:ic,onTrackChanged:ic}})),e}(),n.mediaSource=new e.MediaSource,n.handleDurationChange_=n.handleDurationChange_.bind(je(n)),n.handleSourceOpen_=n.handleSourceOpen_.bind(je(n)),n.handleSourceEnded_=n.handleSourceEnded_.bind(je(n)),n.mediaSource.addEventListener("durationchange",n.handleDurationChange_),n.mediaSource.addEventListener("sourceopen",n.handleSourceOpen_),n.mediaSource.addEventListener("sourceended",n.handleSourceEnded_),n.seekable_=na.createTimeRanges(),n.hasPlayed_=!1,n.syncController_=new Lc(i),n.segmentMetadataTrack_=o.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,n.decrypter_=new Oc,n.sourceUpdater_=new Ic(n.mediaSource),n.inbandTextTracks_={},n.timelineChangeController_=new Dc;var g={vhs:n.vhs_,mediaSource:n.mediaSource,currentTime:n.tech_.currentTime.bind(n.tech_),seekable:function(){return n.seekable()},seeking:function(){return n.tech_.seeking()},duration:function(){return n.duration()},hasPlayed:function(){return n.hasPlayed_},goalBufferLength:function(){return n.goalBufferLength()},bandwidth:u,syncController:n.syncController_,decrypter:n.decrypter_,sourceType:n.sourceType_,inbandTextTracks:n.inbandTextTracks_,cacheEncryptionKeys:f,handlePartialData:m,sourceUpdater:n.sourceUpdater_,timelineChangeController:n.timelineChangeController_};return n.masterPlaylistLoader_="dash"===n.sourceType_?new Sl(r,n.vhs_,n.requestOptions_):new fl(r,n.vhs_,n.requestOptions_),n.setupMasterPlaylistLoaderListeners_(),n.mainSegmentLoader_=new tc(na.mergeOptions(g,{segmentMetadataTrack:n.segmentMetadataTrack_,loaderType:"main"}),i),n.audioSegmentLoader_=new tc(na.mergeOptions(g,{loaderType:"audio"}),i),n.subtitleSegmentLoader_=new xc(na.mergeOptions(g,{loaderType:"vtt",featuresNativeTextTracks:n.tech_.featuresNativeTextTracks}),i),n.setupSegmentLoaderListeners_(),Fc.forEach((function(e){n[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(je(n),e)})),n.logger_=Hl("MPC"),n.triggeredFmp4Usage=!1,n.masterPlaylistLoader_.load(),n}ze(i,t);var n=i.prototype;return n.setupMasterPlaylistLoaderListeners_=function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;Au(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){Nc[t](t,e)}));var t=e.mediaTypes,i=e.masterPlaylistLoader,n=e.tech,r=e.vhs;["AUDIO","SUBTITLES"].forEach((function(i){t[i].activeGroup=function(e,t){return function(i){var n=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,a=n.media();if(!a)return null;var s=null;return a.attributes[e]&&(s=r[a.attributes[e]]),s=s||r.main,void 0===i?s:null===i?null:s.filter((function(e){return e.id===i.id}))[0]||null}}(i,e),t[i].activeTrack=Uc[i](i,e),t[i].onGroupChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.activeGroup(s),u=a.activePlaylistLoader;hc(n,a),o&&(o.playlistLoader?(n.resyncLoader(),pc(o.playlistLoader,a)):u&&r.resetEverything())}}(i,e),t[i].onGroupChanging=function(e,t){return function(){var i=t.segmentLoaders[e];i.abort(),i.pause()}}(i,e),t[i].onTrackChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.activeGroup(s),u=a.activePlaylistLoader;if(hc(n,a),o){if("AUDIO"===e){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();n.setAudio(!0),r.setAudio(!1)}u!==o.playlistLoader&&(n.track&&n.track(s),n.resetEverything()),pc(o.playlistLoader,a)}}}(i,e)}));var a=t.AUDIO.activeGroup();if(a){var s=(a.filter((function(e){return e.default}))[0]||a[0]).id;t.AUDIO.tracks[s].enabled=!0,t.AUDIO.onTrackChanged()}function o(){t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"}),n.trigger({type:"usage",name:"hls-audio-change"})}for(var u in i.on("mediachange",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanged()}))})),i.on("mediachanging",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanging()}))})),n.audioTracks().addEventListener("change",o),n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(function(){n.audioTracks().removeEventListener("change",o),n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),n.clearTracks("audio"),t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[u])}({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(){var t=e.masterPlaylistLoader_.media();if(!t){var i;if(e.excludeUnsupportedVariants_(),e.enableLowInitialPlaylist&&(i=e.selectInitialPlaylist()),i=i||e.selectPlaylist(),e.initialMedia_=i,e.masterPlaylistLoader_.media(e.initialMedia_),"vhs-json"!==e.sourceType_||!e.initialMedia_.segments)return;t=e.initialMedia_}e.handleUpdatedMediaPlaylist(t)})),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;Au(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})})),this.masterPlaylistLoader_.on("playlistunchanged",(function(){var t=e.masterPlaylistLoader_.media();e.stuckAtPlaylistEnd_(t)&&(e.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),e.tech_.trigger("playliststuck"))})),this.masterPlaylistLoader_.on("renditiondisabled",(function(){e.tech_.trigger({type:"usage",name:"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"})}))},n.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())},n.triggerPresenceUsage_=function(e,t){var i=e.mediaGroups||{},n=!0,r=Object.keys(i.AUDIO);for(var a in i.AUDIO)for(var s in i.AUDIO[a])i.AUDIO[a][s].uri||(n=!1);n&&(this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),this.tech_.trigger({type:"usage",name:"hls-demuxed"})),Object.keys(i.SUBTITLES).length&&(this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),this.tech_.trigger({type:"usage",name:"hls-webvtt"})),gc.Playlist.isAes(t)&&(this.tech_.trigger({type:"usage",name:"vhs-aes"}),this.tech_.trigger({type:"usage",name:"hls-aes"})),r.length&&1<Object.keys(i.AUDIO[r[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"}))},n.setupSegmentLoaderListeners_=function(){var e=this;function t(){if(!e.sourceUpdater_.ready())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)}this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist(),i=e.masterPlaylistLoader_.media(),n=e.tech_.buffered();!function(e){var t=e.currentPlaylist,i=e.nextPlaylist,n=e.forwardBuffer,r=e.bufferLowWaterLine,a=e.duration;return i?!t.endList||a<kl.MAX_BUFFER_LOW_WATER_LINE||i.attributes.BANDWIDTH<t.attributes.BANDWIDTH||r<=n:(na.log.warn("We received no playlist to switch to. Please check your stream."),!1)}({currentPlaylist:i,nextPlaylist:t,forwardBuffer:n.length?n.end(n.length-1)-e.tech_.currentTime():0,bufferLowWaterLine:e.bufferLowWaterLine(),duration:e.duration(),log:e.logger_})||e.masterPlaylistLoader_.media(t),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")})),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("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(){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()}))},n.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},n.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},n.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(e),this.mainSegmentLoader_.resetLoader())},n.fastQualityChange_=function(e){var t=this;void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(e),this.mainSegmentLoader_.resetEverything((function(){na.browser.IE_VERSION||na.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())})))},n.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}},n.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(na.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},n.handleSourceOpen_=function(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){var e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(function(e){}))}this.trigger("sourceopen")},n.handleSourceEnded_=function(){if(this.inbandTextTracks_.metadataTrack_){var e=this.inbandTextTracks_.metadataTrack_.cues;if(e&&e.length){var t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}}},n.handleDurationChange_=function(){this.tech_.trigger("durationchange")},n.onEndOfStream=function(){var e=this.mainSegmentLoader_.ended_;this.mediaTypes_.AUDIO.activePlaylistLoader&&(e=!this.mainSegmentLoader_.currentMediaInfo_||this.mainSegmentLoader_.currentMediaInfo_.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_),e&&this.sourceUpdater_.endOfStream()},n.stuckAtPlaylistEnd_=function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;var i=gc.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-n<=.1;var a=r.end(r.length-1);return a-n<=.1&&i-a<=.1},n.blacklistCurrentPlaylist=function(e,t){void 0===e&&(e={});var i=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"));var n=this.masterPlaylistLoader_.master.playlists,r=n.filter(wu),a=1===r.length&&r[0]===i;if(1===n.length&&t!==1/0)return na.log.warn("Problem encountered with playlist "+i.id+". Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(a);if(a){var s=!1;n.forEach((function(e){if(e!==i){var t=e.excludeUntil;void 0!==t&&t!==1/0&&(s=!0,delete e.excludeUntil)}})),s&&(na.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}i.excludeUntil=Date.now()+1e3*t,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var o=this.selectPlaylist();if(!o)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var u=e.internal?this.logger_:na.log.warn,l=e.message?" "+e.message:"";return u((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+l+" Switching to playlist "+o.id+"."),o.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),o.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),this.masterPlaylistLoader_.media(o,a)},n.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"])},n.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){var t=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader;t&&n.push(t)})),["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]()}))}))},n.setCurrentTime=function(e){var t=mu(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},n.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:gc.Playlist.duration(e):1/0:0},n.seekable=function(){return this.seekable_},n.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=this.masterPlaylistLoader_.master.suggestedPresentationDelay,r=gc.Playlist.seekable(t,i,n);if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=gc.Playlist.seekable(t,i,n)).length)return}var a,s;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),s=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=na.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]]):this.seekable_=r,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===a&&this.seekable_.start(0)===s||(this.logger_("seekable updated ["+vu(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}},n.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();if(!t.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1))}else{var i=this.tech_.buffered(),n=gc.Playlist.duration(this.masterPlaylistLoader_.media());0<i.length&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}},n.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),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()},n.master=function(){return this.masterPlaylistLoader_.master},n.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},n.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader;return!(!this.mainSegmentLoader_.currentMediaInfo_||e&&!this.audioSegmentLoader_.currentMediaInfo_)},n.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.currentMediaInfo_||{},audio:this.audioSegmentLoader_.currentMediaInfo_||{}};t.video=t.main;var i=ql(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||il),t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||tl)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r)&&(n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||tl,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),n.audio||n.video){var a,s={};if(["video","audio"].forEach((function(e){if(n.hasOwnProperty(e)&&!function(e,t){return e?nl(t):ul(t)}(t[e].isFmp4,n[e])){var i=t[e].isFmp4?"browser":"muxer";s[i]=s[i]||[],s[i].push(n[e]),"audio"===e&&(a=i)}})),r&&a&&this.media().attributes.AUDIO){var o=this.media().attributes.AUDIO;this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===o&&t!==e.media()&&(t.excludeUntil=1/0)})),this.logger_("excluding audio group "+o+" as "+a+' does not support codec(s): "'+n.audio+'"')}if(!Object.keys(s).length){if(this.sourceUpdater_.ready()&&!this.sourceUpdater_.canChangeType()){var u=[];if(["video","audio"].forEach((function(t){var i=(ll(e.sourceUpdater_.codecs[t]||"")[t]||{}).type,r=(ll(n[t]||"")[t]||{}).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}var l=Object.keys(s).reduce((function(e,t){return e&&(e+=", "),e+(t+' does not support codec(s): "')+s[t].join(",")+'"'}),"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:l,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},n.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.ready()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}},n.excludeUnsupportedVariants_=function(){var e=this;this.master().playlists.forEach((function(t){var i=ql(e.master,t);!i.audio||ul(i.audio)||nl(i.audio)||(t.excludeUntil=1/0),!i.video||ul(i.video)||nl(i.video)||(t.excludeUntil=1/0)}))},n.excludeIncompatibleVariants_=function(e){var t=this,i=ll(e),n=Object.keys(i).length;this.master().playlists.forEach((function(e){if(e.excludeUntil!==1/0){var r={},a=2,s=[],o=ql(t.masterPlaylistLoader_.master,e);if(o.audio||o.video){var u=[o.video,o.audio].filter(Boolean).join(",");r=ll(u),a=Object.keys(r).length}a!==n&&(s.push('codec count "'+a+'" !== "'+n+'"'),e.excludeUntil=1/0),t.sourceUpdater_.canChangeType()||(r.video&&i.video&&r.video.type.toLowerCase()!==i.video.type.toLowerCase()&&(s.push('video codec "'+r.video.type+'" !== "'+i.video.type+'"'),e.excludeUntil=1/0),r.audio&&i.audio&&r.audio.type.toLowerCase()!==i.audio.type.toLowerCase()&&(e.excludeUntil=1/0,s.push('audio codec "'+r.audio.type+'" !== "'+i.audio.type+'"'))),s.length&&t.logger_("blacklisting "+e.id+": "+s.join(" && "))}}))},n.updateAdCues_=function(t){var i=0,n=this.seekable();n.length&&(i=n.start(0)),function(t,i,n){if(void 0===n&&(n=0),t.segments)for(var r,a=n,s=0;s<t.segments.length;s++){var o=t.segments[s];if(r=r||dc(i,a+o.duration/2)){if("cueIn"in o){r.endTime=a,r.adEndTime=a,a+=o.duration,r=null;continue}if(a<r.endTime){a+=o.duration;continue}r.endTime+=o.duration}else if("cueOut"in o&&((r=new e.VTTCue(a,a+o.duration,o.cueOut)).adStartTime=a,r.adEndTime=a+parseFloat(o.cueOut),i.addCue(r)),"cueOutCont"in o){var u=o.cueOutCont.split("/").map(parseFloat),l=u[0],c=u[1];(r=new e.VTTCue(a,a+o.duration,"")).adStartTime=a-l,r.adEndTime=r.adStartTime+c,i.addCue(r)}a+=o.duration}}(t,this.cueTagsTrack_,i)},n.goalBufferLength=function(){var e=this.tech_.currentTime(),t=kl.GOAL_BUFFER_LENGTH,i=kl.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,kl.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)},n.bufferLowWaterLine=function(){var e=this.tech_.currentTime(),t=kl.BUFFER_LOW_WATER_LINE,i=kl.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,kl.MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,n)},i}(na.EventTarget),jc=["seeking","seeked","pause","playing","error"],Vc=function(){function t(t){var i=this;function n(){return i.monitorCurrentTime_()}function r(){return i.techWaiting_()}function a(){return i.cancelTimer_()}function s(){return i.fixesBadSeeks_()}this.masterPlaylistController_=t.masterPlaylistController,this.tech_=t.tech,this.seekable=t.seekable,this.allowSeeksWithinUnsafeLiveWindow=t.allowSeeksWithinUnsafeLiveWindow,this.media=t.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=Hl("PlaybackWatcher"),this.logger_("initialize");var o=this.masterPlaylistController_,u=["main","subtitle","audio"],l={};u.forEach((function(e){l[e]={reset:function(){return i.resetSegmentDownloads_(e)},updateend:function(){return i.checkSegmentDownloads_(e)}},o[e+"SegmentLoader_"].on("appendsdone",l[e].updateend),o[e+"SegmentLoader_"].on("playlistupdate",l[e].reset),i.tech_.on(["seeked","seeking"],l[e].reset)})),this.tech_.on("seekablechanged",s),this.tech_.on("waiting",r),this.tech_.on(jc,a),this.tech_.on("canplay",n),this.dispose=function(){i.logger_("dispose"),i.tech_.off("seekablechanged",s),i.tech_.off("waiting",r),i.tech_.off(jc,a),i.tech_.off("canplay",n),u.forEach((function(e){o[e+"SegmentLoader_"].off("appendsdone",l[e].updateend),o[e+"SegmentLoader_"].off("playlistupdate",l[e].reset),i.tech_.off(["seeked","seeking"],l[e].reset)})),i.checkCurrentTimeTimeout_&&e.clearTimeout(i.checkCurrentTimeTimeout_),i.cancelTimer_()}}var i=t.prototype;return i.monitorCurrentTime_=function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&e.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=e.setTimeout(this.monitorCurrentTime_.bind(this),250)},i.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_()},i.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:yu(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)))},i.checkCurrentTime_=function(){if(this.tech_.seeking()&&this.fixesBadSeeks_())return this.consecutiveUpdates=0,void(this.lastRecordedTime=this.tech_.currentTime());if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+.1>=t.end(t.length-1)))return this.techWaiting_();5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},i.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},i.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)),this.beforeSeekableWindow_(t,i)){var n=t.start(0);e=n+(n===t.end(0)?0:.1)}if(void 0!==e)return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+vu(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;var r=this.tech_.buffered();return!!function(e){var t=e.buffered,i=e.targetDuration,n=e.currentTime;return!(!t.length||t.end(0)-t.start(0)<2*i||n>t.start(0)||!(t.start(0)-n<i))}({buffered:r,targetDuration:this.media().targetDuration,currentTime:i})&&(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)},i.waiting_=function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=mu(this.tech_.buffered(),e);return t.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"}),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}},i.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return 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;var a=gu(r,t);if(0<a.length){var s=a.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+a.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1},i.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!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration),r<t},i.beforeSeekableWindow_=function(e,t){return!!(e.length&&0<e.start(0)&&t<e.start(0)-.1)},i.videoUnderflow_=function(e){var t=e.videoBuffered,i=e.audioBuffered,n=e.currentTime;if(t){var r;if(t.length&&i.length){var a=mu(t,n-3),s=mu(t,n),o=mu(i,n);o.length&&!s.length&&a.length&&(r={start:a.end(0),end:o.end(0)})}else gu(t,n).length||(r=this.gapFromVideoUnderflow_(t,n));return!!r&&(this.logger_("Encountered a gap in video from "+r.start+" to "+r.end+". Seeking to current time "+n),!0)}},i.skipTheGap_=function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),n=gu(t,i);this.cancelTimer_(),0!==n.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+ml),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))},i.gapFromVideoUnderflow_=function(e,t){for(var i=function(e){if(e.length<2)return na.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 na.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},t}(),qc={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Hc={PlaylistLoader:fl,Playlist:vl,utils:bl,STANDARD_PLAYLIST_SELECTOR:function(){var t=this.useDevicePixelRatio&&e.devicePixelRatio||1;return function(t,i,n,r,a){var s={bandwidth:i,width:n,height:r,limitRenditionByPlayerDimensions:a},o=t.playlists.map((function(t){var i=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width,n=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height;return{bandwidth:t.attributes.BANDWIDTH||e.Number.MAX_VALUE,width:i,height:n,playlist:t}}));Gl(o,(function(e,t){return e.bandwidth-t.bandwidth}));var u=(o=o.filter((function(e){return!vl.isIncompatible(e.playlist)}))).filter((function(e){return vl.isEnabled(e.playlist)}));u.length||(u=o.filter((function(e){return!vl.isDisabled(e.playlist)})));var l=u.filter((function(e){return e.bandwidth*kl.BANDWIDTH_VARIANCE<i})),c=l[l.length-1],d=l.filter((function(e){return e.bandwidth===c.bandwidth}))[0];if(!1===a){var h=d||u[0]||o[0];if(h&&h.playlist){var p="sortedPlaylistReps";return d&&(p="bandwidthBestRep"),u[0]&&(p="enabledPlaylistReps"),ec("choosing "+Wl(h)+" using "+p+" with options",s),h.playlist}return ec("could not choose a playlist with options",s),null}var f=l.filter((function(e){return e.width&&e.height}));Gl(f,(function(e,t){return e.width-t.width}));var m=f.filter((function(e){return e.width===n&&e.height===r}));c=m[m.length-1];var g,v,y,_=m.filter((function(e){return e.bandwidth===c.bandwidth}))[0];_||(v=(g=f.filter((function(e){return e.width>n||e.height>r}))).filter((function(e){return e.width===g[0].width&&e.height===g[0].height})),c=v[v.length-1],y=v.filter((function(e){return e.bandwidth===c.bandwidth}))[0]);var b=y||_||d||u[0]||o[0];if(b&&b.playlist){var T="sortedPlaylistReps";return y?T="resolutionPlusOneRep":_?T="resolutionBestRep":d?T="bandwidthBestRep":u[0]&&(T="enabledPlaylistReps"),ec("choosing "+Wl(b)+" using "+T+" with options",s),b.playlist}return ec("could not choose a playlist with options",s),null}(this.playlists.master,this.systemBandwidth,parseInt(zl(this.tech_.el(),"width"),10)*t,parseInt(zl(this.tech_.el(),"height"),10)*t,this.limitRenditionByPlayerDimensions)},INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(vl.isEnabled);return Gl(t,(function(e,t){return Kl(e,t)})),t.filter((function(t){return!!ql(e.playlists.master,t).video}))[0]||null},comparePlaylistBandwidth:Kl,comparePlaylistResolution:function(t,i){var n,r;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),n=n||e.Number.MAX_VALUE,i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(r=i.attributes.RESOLUTION.width),n===(r=r||e.Number.MAX_VALUE)&&t.attributes.BANDWIDTH&&i.attributes.BANDWIDTH?t.attributes.BANDWIDTH-i.attributes.BANDWIDTH:n-r},xhr:Pu()};function Wc(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"})}["GOAL_BUFFER_LENGTH","MAX_GOAL_BUFFER_LENGTH","BACK_BUFFER_LENGTH","GOAL_BUFFER_LENGTH_RATE","BUFFER_LOW_WATER_LINE","MAX_BUFFER_LOW_WATER_LINE","BUFFER_LOW_WATER_LINE_RATE","BANDWIDTH_VARIANCE"].forEach((function(e){Object.defineProperty(Hc,e,{get:function(){return na.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),kl[e]},set:function(t){na.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?na.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):kl[e]=t}})}));var zc="videojs-vhs";function Gc(){if(!e.localStorage)return null;var t=e.localStorage.getItem(zc);if(!t)return null;try{return JSON.parse(t)}catch(t){return null}}Hc.canPlaySource=function(){return na.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")},Hc.supportsNativeHls=function(){if(!t||!t.createElement)return!1;var e=t.createElement("video");return!!na.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))}))}(),Hc.supportsNativeDash=!!(t&&t.createElement&&na.getTech("Html5").isSupported())&&/maybe|probably/i.test(t.createElement("video").canPlayType("application/dash+xml")),Hc.supportsTypeNatively=function(e){return"hls"===e?Hc.supportsNativeHls:"dash"===e&&Hc.supportsNativeDash},Hc.isSupported=function(){return na.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var Kc=function(i){function n(e,n,r){var a;if(a=i.call(this,n,na.mergeOptions(r.hls,r.vhs))||this,r.hls&&Object.keys(r.hls).length&&na.log.warn("Using hls options is deprecated. Use vhs instead."),n.options_&&n.options_.playerId){var s=na(n.options_.playerId);s.hasOwnProperty("hls")||Object.defineProperty(s,"hls",{get:function(){return na.log.warn("player.hls is deprecated. Use player.tech().vhs instead."),n.trigger({type:"usage",name:"hls-player-access"}),je(a)},configurable:!0}),s.hasOwnProperty("vhs")||Object.defineProperty(s,"vhs",{get:function(){return na.log.warn("player.vhs is deprecated. Use player.tech().vhs instead."),n.trigger({type:"usage",name:"vhs-player-access"}),je(a)},configurable:!0}),s.hasOwnProperty("dash")||Object.defineProperty(s,"dash",{get:function(){return na.log.warn("player.dash is deprecated. Use player.tech().vhs instead."),je(a)},configurable:!0}),a.player_=s}if(a.tech_=n,a.source_=e,a.stats={},a.ignoreNextSeekingEvent_=!1,a.setOptions_(),a.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(a.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return a.on(t,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(function(e){var i=t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;i&&i.contains(a.tech_.el())&&a.masterPlaylistController_.smoothQualityChange_()})),a.on(a.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),a.on(a.tech_,"error",(function(){this.tech_.error()&&this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()})),a.on(a.tech_,"play",a.play),a}ze(n,i);var r=n.prototype;return r.setOptions_=function(){var e=this;if(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_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.handlePartialData=this.options_.handlePartialData||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var t=Gc();t&&t.bandwidth&&(this.options_.bandwidth=t.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})),t&&t.throughput&&(this.options_.throughput=t.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=kl.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===kl.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys","handlePartialData"].forEach((function(t){void 0!==e.source_[t]&&(e.options_[t]=e.source_[t])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio},r.src=function(t,i){var n=this;t&&(this.setOptions_(),this.options_.src=function(e){return 0===e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e}(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Hc,this.options_.sourceType=ya(i),this.options_.seekTo=function(e){n.tech_.setCurrentTime(e)},this.masterPlaylistController_=new Bc(this.options_),this.playbackWatcher_=new Vc(na.mergeOptions(this.options_,{seekable:function(){return n.seekable()},media:function(){return n.masterPlaylistController_.media()},masterPlaylistController:this.masterPlaylistController_})),this.masterPlaylistController_.on("error",(function(){var e=na.players[n.tech_.options_.playerId],t=n.masterPlaylistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)})),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):Hc.STANDARD_PLAYLIST_SELECTOR.bind(this),this.masterPlaylistController_.selectInitialPlaylist=Hc.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=e,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=0<this.throughput?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){na.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return n.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return n.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return n.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return n.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return n.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return n.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return n.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return n.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return yu(n.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return n.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return n.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return n.tech_.name_},enumerable:!0},duration:{get:function(){return n.tech_.duration()},enumerable:!0},master:{get:function(){return n.playlists.master},enumerable:!0},playerDimensions:{get:function(){return n.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return yu(n.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return n.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){n.options_.useBandwidthFromLocalStorage&&function(t){if(e.localStorage){var i=Gc();i=i?na.mergeOptions(i,t):t;try{e.localStorage.setItem(zc,JSON.stringify(i))}catch(t){return}}}({bandwidth:n.bandwidth,throughput:Math.round(n.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){!function(e){var t=e.playlists;e.representations=function(){return t&&t.master&&t.master.playlists?t.master.playlists.filter((function(e){return!Eu(e)})).map((function(t,i){return new fc(e,t,t.id)})):[]}}(n)})),this.masterPlaylistController_.sourceUpdater_.on("ready",(function(){var e=n.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;!function(e){var t=e.player,i=e.sourceKeySystems,n=e.media,r=e.audioMedia,a=e.mainPlaylists,s=function(e,t,i){if(!e)return e;var n={video:t&&t.attributes&&t.attributes.CODECS,audio:i&&i.attributes&&i.attributes.CODECS};!n.audio&&n.video&&1<n.video.split(",").length&&n.video.split(",").forEach((function(e){e=e.trim(),sl(e)?n.audio=e:ol(e)&&(n.video=e)}));var r=n.video?'video/mp4;codecs="'+n.video+'"':null,a=n.audio?'audio/mp4;codecs="'+n.audio+'"':null,s={};for(var o in e)s[o]={audioContentType:a,videoContentType:r},t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(s[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(s[o].url=e[o]);return na.mergeOptions(e,s)}(i,n,r);s&&(!(t.currentSource().keySystems=s)||t.eme?11!==na.browser.IE_VERSION&&t.eme.initializeMediaKeys&&function(e,t){return e.reduce((function(e,i){if(!i.contentProtection)return e;var n=t.reduce((function(e,t){var n=i.contentProtection[t];return n&&n.pssh&&(e[t]={pssh:n.pssh}),e}),{});return Object.keys(n).length&&e.push(n),e}),[])}(r?a.concat([r]):a,Object.keys(i)).forEach((function(e){t.eme.initializeMediaKeys({keySystems:e})})):na.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"))}({player:n.player_,sourceKeySystems:n.source_.keySystems,media:n.playlists.media(),audioMedia:e&&e.media(),mainPlaylists:n.playlists.master.playlists})})),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_=e.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_)))},r.setupQualityLevels_=function(){var e=this,t=na.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){!function(e,t){t.representations().forEach((function(t){e.addQualityLevel(t)})),Wc(e,t.playlists)}(e.qualityLevels_,e)})),this.playlists.on("mediachange",(function(){Wc(e.qualityLevels_,e.playlists)})))},n.version=function(){return{"@videojs/http-streaming":"2.2.4","mux.js":"5.6.7","mpd-parser":"0.14.0","m3u8-parser":"4.5.0","aes-decrypter":"3.1.0"}},r.version=function(){return this.constructor.version()},r.canChangeType=function(){return Ic.canChangeType()},r.play=function(){this.masterPlaylistController_.play()},r.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},r.duration=function(){return this.masterPlaylistController_.duration()},r.seekable=function(){return this.masterPlaylistController_.seekable()},r.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_&&e.URL.revokeObjectURL&&(e.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),i.prototype.dispose.call(this)},r.convertToProgramTime=function(e,t){return function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===n)return r({message:"getProgramTime: playlist and time must be provided"});var a=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);if(!a)return r({message:"valid programTime was not found"});if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)}({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},r.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),Fu({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},n}(na.getComponent("Component")),Xc={name:"videojs-http-streaming",VERSION:"2.2.4",canHandleSource:function(e,t){void 0===t&&(t={});var i=na.mergeOptions(na.options,t);return Xc.canPlayType(e.type,i)},handleSource:function(e,t,i){void 0===i&&(i={});var n=na.mergeOptions(na.options,i);return t.vhs=new Kc(e,t,n),na.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return na.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=Pu(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){void 0===t&&(t={});var i=na.mergeOptions(na.options,t).vhs.overrideNative,n=void 0===i?!na.browser.IS_ANY_SAFARI:i,r=ya(e);return!r||Hc.supportsTypeNatively(r)&&!n?"":"maybe"}};return nl("avc1.4d400d,mp4a.40.2")&&na.getTech("Html5").registerSourceHandler(Xc,0),na.VhsHandler=Kc,Object.defineProperty(na,"HlsHandler",{get:function(){return na.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),Kc},configurable:!0}),na.VhsSourceHandler=Xc,Object.defineProperty(na,"HlsSourceHandler",{get:function(){return na.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),Xc},configurable:!0}),na.Vhs=Hc,Object.defineProperty(na,"Hls",{get:function(){return na.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),Hc},configurable:!0}),na.use||(na.registerComponent("Hls",Hc),na.registerComponent("Vhs",Hc)),na.options.vhs=na.options.vhs||{},na.options.hls=na.options.hls||{},na.registerPlugin?na.registerPlugin("reloadSourceOnError",mc):na.plugin("reloadSourceOnError",mc),na})),function(){var e,t;e=window,(t=e&&e.videojs)&&(t.CDN_VERSION="7.10.2")}();
!function(t,e){if("object"==typeof exports&&"undefined"!=typeof module){var i=require("video.js");module.exports=e(i.default||i)}else"function"==typeof define&&define.amd?define(["videojs"],(function(i){return t.Youtube=e(i)})):t.Youtube=e(t.videojs)}(this,(function(t){"use strict";var e,i,s,o,r,a,n,h,l=t.browser.IS_IOS||t.browser.IS_NATIVE_ANDROID,d=t.getTech("Tech");class u extends d{constructor(t,e){super(t,e),this.setPoster(t.poster),this.setSrc(this.options_.source,!0),this.setTimeout(function(){this.el_&&(this.el_.parentNode.className+=" vjs-youtube",l&&(this.el_.parentNode.className+=" vjs-youtube-mobile"),u.isApiReady?this.initYTPlayer():u.apiReadyQueue.push(this))}.bind(this))}dispose(){if(this.ytPlayer)this.ytPlayer.stopVideo&&this.ytPlayer.stopVideo(),this.ytPlayer.destroy&&this.ytPlayer.destroy();else{var t=u.apiReadyQueue.indexOf(this);-1!==t&&u.apiReadyQueue.splice(t,1)}this.ytPlayer=null,this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-youtube","").replace(" vjs-youtube-mobile",""),this.el_.parentNode.removeChild(this.el_),d.prototype.dispose.call(this)}createEl(){var t=document.createElement("div");t.setAttribute("id",this.options_.techId),t.setAttribute("style","width:100%;height:100%;top:0;left:0;position:absolute"),t.setAttribute("class","vjs-tech");var e=document.createElement("div");if(e.appendChild(t),!l&&!this.options_.ytControls){var i=document.createElement("div");i.setAttribute("class","vjs-iframe-blocker"),i.setAttribute("style","position:absolute;top:0;left:0;width:100%;height:100%"),i.onclick=function(){this.pause()}.bind(this),e.appendChild(i)}return e}initYTPlayer(){var t={controls:0,modestbranding:1,rel:0,showinfo:0,loop:this.options_.loop?1:0};if(void 0!==this.options_.autohide&&(t.autohide=this.options_.autohide),void 0!==this.options_.cc_load_policy&&(t.cc_load_policy=this.options_.cc_load_policy),void 0!==this.options_.ytControls&&(t.controls=this.options_.ytControls),void 0!==this.options_.disablekb&&(t.disablekb=this.options_.disablekb),void 0!==this.options_.color&&(t.color=this.options_.color),t.controls?void 0!==this.options_.fs&&(t.fs=this.options_.fs):t.fs=0,-1!==this.options_.source.src.indexOf("end=")){var e=this.options_.source.src.match(/end=([0-9]*)/);this.options_.end=parseInt(e[1])}if(void 0!==this.options_.end&&(t.end=this.options_.end),void 0!==this.options_.hl?t.hl=this.options_.hl:void 0!==this.options_.language&&(t.hl=this.options_.language.substr(0,2)),void 0!==this.options_.iv_load_policy&&(t.iv_load_policy=this.options_.iv_load_policy),void 0!==this.options_.list?t.list=this.options_.list:this.url&&void 0!==this.url.listId&&(t.list=this.url.listId),void 0!==this.options_.listType&&(t.listType=this.options_.listType),void 0!==this.options_.modestbranding&&(t.modestbranding=this.options_.modestbranding),void 0!==this.options_.playlist&&(t.playlist=this.options_.playlist),void 0!==this.options_.playsinline&&(t.playsinline=this.options_.playsinline),void 0!==this.options_.rel&&(t.rel=this.options_.rel),void 0!==this.options_.showinfo&&(t.showinfo=this.options_.showinfo),-1!==this.options_.source.src.indexOf("start=")){var i=this.options_.source.src.match(/start=([0-9]*)/);this.options_.start=parseInt(i[1])}if(void 0!==this.options_.start&&(t.start=this.options_.start),void 0!==this.options_.theme&&(t.theme=this.options_.theme),void 0!==this.options_.customVars){var s=this.options_.customVars;Object.keys(s).forEach((function(e){t[e]=s[e]}))}this.activeVideoId=this.url?this.url.videoId:null,this.activeList=t.list;var o={videoId:this.activeVideoId,playerVars:t,events:{onReady:this.onPlayerReady.bind(this),onPlaybackQualityChange:this.onPlayerPlaybackQualityChange.bind(this),onPlaybackRateChange:this.onPlayerPlaybackRateChange.bind(this),onStateChange:this.onPlayerStateChange.bind(this),onVolumeChange:this.onPlayerVolumeChange.bind(this),onError:this.onPlayerError.bind(this)}};void 0!==this.options_.enablePrivacyEnhancedMode&&this.options_.enablePrivacyEnhancedMode&&(o.host="https://www.youtube-nocookie.com"),this.ytPlayer=new YT.Player(this.options_.techId,o)}onPlayerReady(){this.options_.muted&&this.ytPlayer.mute(),this.ytPlayer.getAvailablePlaybackRates().length>1&&(this.featuresPlaybackRate=!0),this.playerReady_=!0,this.triggerReady(),this.playOnReady?this.play():this.cueOnReady&&(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)}onPlayerPlaybackQualityChange(){}onPlayerPlaybackRateChange(){this.trigger("ratechange")}onPlayerStateChange(t){var e=t.data;if(e!==this.lastState&&!this.errorNumber)switch(this.lastState=e,e){case-1:this.trigger("loadstart"),this.trigger("loadedmetadata"),this.trigger("durationchange"),this.trigger("ratechange");break;case YT.PlayerState.ENDED:this.trigger("ended");break;case YT.PlayerState.PLAYING:this.trigger("timeupdate"),this.trigger("durationchange"),this.trigger("playing"),this.trigger("play"),this.isSeeking&&this.onSeeked();break;case YT.PlayerState.PAUSED:this.trigger("canplay"),this.isSeeking?this.onSeeked():this.trigger("pause");break;case YT.PlayerState.BUFFERING:this.player_.trigger("timeupdate"),this.player_.trigger("waiting")}}onPlayerVolumeChange(){this.trigger("volumechange")}onPlayerError(t){this.errorNumber=t.data,this.trigger("pause"),this.trigger("error")}error(){var t=1e3+this.errorNumber;switch(this.errorNumber){case 5:return{code:t,message:"Error while trying to play the video"};case 2:case 100:return{code:t,message:"Unable to find the video"};case 101:case 150:return{code:t,message:"Playback on other Websites has been disabled by the video owner."}}return{code:t,message:"YouTube unknown error ("+this.errorNumber+")"}}loadVideoById_(t){var e={videoId:t};this.options_.start&&(e.startSeconds=this.options_.start),this.options_.end&&(e.endSeconds=this.options_.end),this.ytPlayer.loadVideoById(e)}cueVideoById_(t){var e={videoId:t};this.options_.start&&(e.startSeconds=this.options_.start),this.options_.end&&(e.endSeconds=this.options_.end),this.ytPlayer.cueVideoById(e)}src(t){return t&&this.setSrc({src:t}),this.source}poster(){return l?null:this.poster_}setPoster(t){this.poster_=t}setSrc(t){t&&t.src&&(delete this.errorNumber,this.source=t,this.url=u.parseUrl(t.src),this.options_.poster||this.url.videoId&&(this.poster_="https://img.youtube.com/vi/"+this.url.videoId+"/0.jpg",this.trigger("posterchange"),this.checkHighResPoster()),this.options_.autoplay&&!l?this.isReady_?this.play():this.playOnReady=!0:this.activeVideoId!==this.url.videoId&&(this.isReady_?(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId):this.cueOnReady=!0))}autoplay(){return this.options_.autoplay}setAutoplay(t){this.options_.autoplay=t}loop(){return this.options_.loop}setLoop(t){this.options_.loop=t}play(){this.url&&this.url.videoId&&(this.wasPausedBeforeSeek=!1,this.isReady_?(this.url.listId&&(this.activeList===this.url.listId?this.ytPlayer.playVideo():(this.ytPlayer.loadPlaylist(this.url.listId),this.activeList=this.url.listId)),this.activeVideoId===this.url.videoId?this.ytPlayer.playVideo():(this.loadVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)):(this.trigger("waiting"),this.playOnReady=!0))}pause(){this.ytPlayer&&this.ytPlayer.pauseVideo()}paused(){return!this.ytPlayer||this.lastState!==YT.PlayerState.PLAYING&&this.lastState!==YT.PlayerState.BUFFERING}currentTime(){return this.ytPlayer?this.ytPlayer.getCurrentTime():0}setCurrentTime(t){this.lastState===YT.PlayerState.PAUSED&&(this.timeBeforeSeek=this.currentTime()),this.isSeeking||(this.wasPausedBeforeSeek=this.paused()),this.ytPlayer.seekTo(t,!0),this.trigger("timeupdate"),this.trigger("seeking"),this.isSeeking=!0,this.lastState===YT.PlayerState.PAUSED&&this.timeBeforeSeek!==t&&(clearInterval(this.checkSeekedInPauseInterval),this.checkSeekedInPauseInterval=setInterval(function(){this.lastState===YT.PlayerState.PAUSED&&this.isSeeking?this.currentTime()!==this.timeBeforeSeek&&(this.trigger("timeupdate"),this.onSeeked()):clearInterval(this.checkSeekedInPauseInterval)}.bind(this),250))}seeking(){return this.isSeeking}seekable(){return this.ytPlayer?t.createTimeRange(0,this.ytPlayer.getDuration()):t.createTimeRange()}onSeeked(){clearInterval(this.checkSeekedInPauseInterval),this.isSeeking=!1,this.wasPausedBeforeSeek&&this.pause(),this.trigger("seeked")}playbackRate(){return this.ytPlayer?this.ytPlayer.getPlaybackRate():1}setPlaybackRate(t){this.ytPlayer&&this.ytPlayer.setPlaybackRate(t)}duration(){return this.ytPlayer?this.ytPlayer.getDuration():0}currentSrc(){return this.source&&this.source.src}ended(){return!!this.ytPlayer&&this.lastState===YT.PlayerState.ENDED}volume(){return this.ytPlayer?this.ytPlayer.getVolume()/100:1}setVolume(t){this.ytPlayer&&this.ytPlayer.setVolume(100*t)}muted(){return!!this.ytPlayer&&this.ytPlayer.isMuted()}setMuted(t){this.ytPlayer&&(this.muted(!0),t?this.ytPlayer.mute():this.ytPlayer.unMute(),this.setTimeout((function(){this.trigger("volumechange")}),50))}buffered(){if(!this.ytPlayer||!this.ytPlayer.getVideoLoadedFraction)return t.createTimeRange();var e=this.ytPlayer.getVideoLoadedFraction()*this.ytPlayer.getDuration();return t.createTimeRange(0,e)}preload(){}load(){}reset(){}networkState(){if(!this.ytPlayer)return 0;switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 3:return 2;default:return 1}}readyState(){if(!this.ytPlayer)return 0;switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 5:return 1;case 3:return 2;default:return 4}}supportsFullScreen(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled}checkHighResPoster(){var t="https://img.youtube.com/vi/"+this.url.videoId+"/maxresdefault.jpg";try{var e=new Image;e.onload=function(){if("naturalHeight"in e){if(e.naturalHeight<=90||e.naturalWidth<=120)return}else if(e.height<=90||e.width<=120)return;this.poster_=t,this.trigger("posterchange")}.bind(this),e.onerror=function(){},e.src=t}catch(t){}}}u.isSupported=function(){return!0},u.canPlaySource=function(t){return u.canPlayType(t.type)},u.canPlayType=function(t){return"video/youtube"===t},u.parseUrl=function(t){var e={videoId:null},i=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);i&&11===i[2].length&&(e.videoId=i[2]);return(i=t.match(/[?&]list=([^#\&\?]+)/))&&i[1]&&(e.listId=i[1]),e},u.apiReadyQueue=[],"undefined"!=typeof document&&(o="https://www.youtube.com/iframe_api",r=function(){YT.ready((function(){u.isApiReady=!0;for(var t=0;t<u.apiReadyQueue.length;++t)u.apiReadyQueue[t].initYTPlayer()}))},a=!1,n=document.createElement("script"),(h=document.getElementsByTagName("script")[0])&&(h.parentNode.insertBefore(n,h),n.onload=function(){a||(a=!0,r())},n.onreadystatechange=function(){a||"complete"!==this.readyState&&"loaded"!==this.readyState||(a=!0,r())},n.src=o),e=".vjs-youtube .vjs-iframe-blocker { display: none; }.vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }.vjs-youtube .vjs-poster { background-size: cover; }.vjs-youtube-mobile .vjs-big-play-button { display: none; }",i=document.head||document.getElementsByTagName("head")[0],(s=document.createElement("style")).type="text/css",s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e)),i.appendChild(s)),void 0!==t.registerTech?t.registerTech("Youtube",u):t.registerComponent("Youtube",u)}));
/*! @name videojs-contrib-ads @version 6.9.0 @license Apache-2.0 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js"),require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define(["video.js","global/window","global/document"],t):(e=e||self).videojsContribAds=t(e.videojs,e.window,e.document)}(this,function(e,t,n){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t,n=n&&n.hasOwnProperty("default")?n.default:n;var a="6.9.0";var o=function(e,t){t.isImmediatePropagationStopped=function(){return!0},t.cancelBubble=!0,t.isPropagationStopped=function(){return!0}},r=function(e,t,n){o(0,n),e.trigger({type:t+n.type,originalEvent:n})},i=function(e,t){e.ads.isInAdMode()&&(e.ads.isContentResuming()?e.ads._contentEnding&&r(e,"content",t):r(e,"ad",t))},s=function(e,t){e.ads.isInAdMode()?e.ads.isContentResuming()?(o(0,t),e.trigger("resumeended")):r(e,"ad",t):e.ads._contentHasEnded||e.ads.stitchedAds()||(r(e,"content",t),e.trigger("readyforpostroll"))},d=function(e,t){if(!("loadstart"===t.type&&!e.ads._hasThereBeenALoadStartDuringPlayerLife||"loadeddata"===t.type&&!e.ads._hasThereBeenALoadedData||"loadedmetadata"===t.type&&!e.ads._hasThereBeenALoadedMetaData))if(e.ads.inAdBreak())r(e,"ad",t);else{if(e.currentSrc()!==e.ads.contentSrc)return;r(e,"content",t)}},l=function(e,t){e.ads.inAdBreak()?r(e,"ad",t):e.ads.isContentResuming()&&r(e,"content",t)};function u(e){"playing"===e.type?i(this,e):"ended"===e.type?s(this,e):"loadstart"===e.type||"loadeddata"===e.type||"loadedmetadata"===e.type?d(this,e):"play"===e.type?l(this,e):this.ads.isInAdMode()&&(this.ads.isContentResuming()?r(this,"content",e):r(this,"ad",e))}var c={},f=function(){!function(n){if(e.dom.isInFrame()&&"function"!=typeof t.__tcfapi){for(var a,o=t,r={};o;){try{if(o.frames.__tcfapiLocator){a=o;break}}catch(e){}if(o===t.top)break;o=o.parent}if(!a)return;t.__tcfapi=function(e,t,n,o){var i=Math.random()+"",s={__tcfapiCall:{command:e,parameter:o,version:t,callId:i}};r[i]=n,a.postMessage(s,"*")},t.addEventListener("message",function(e){var t={};try{t="string"==typeof e.data?JSON.parse(e.data):e.data}catch(e){}var n=t.__tcfapiReturn;n&&"function"==typeof r[n.callId]&&(r[n.callId](n.returnValue,n.success),r[n.callId]=null)},!1)}}(),"function"==typeof t.__tcfapi&&t.__tcfapi("addEventListener",2,function(e,t){t&&(c=e)})},h=function(e,t){return t?encodeURIComponent(e):e},p=function(e,t,n){if(e&&e[n])for(var a=e[n],o=Object.keys(a),r=0;r<o.length;r++){t["{mediainfo."+n+"."+o[r]+"}"]=a[o[r]]}};var g={processMetadataTracks:function(e,t){for(var n=e.textTracks(),a=function(n){"metadata"===n.kind&&(e.ads.cueTextTracks.setMetadataTrackMode(n),t(e,n))},o=0;o<n.length;o++)a(n[o]);n.addEventListener("addtrack",function(e){a(e.track)})},setMetadataTrackMode:function(e){},getSupportedAdCue:function(e,t){return t},isSupportedAdCue:function(e,t){return!0},getCueId:function(e,t){return t.id}},y=function(e,t){return void 0!==t&&e.ads.includedCues[t]},v=function(e,t){void 0!==t&&""!==t&&(e.ads.includedCues[t]=!0)};function m(){!1!==this.ads._shouldBlockPlay&&(this.paused()||(this.ads.debug("Playback was canceled by cancelContentPlay"),this.pause()),this.ads._cancelledPlay=!0)}g.processAdTrack=function(t,n,a,o){t.ads.includedCues={};for(var r=0;r<n.length;r++){var i=n[r],s=this.getSupportedAdCue(t,i);if(!this.isSupportedAdCue(t,i))return void e.log.warn("Skipping as this is not a supported ad cue.",i);var d=this.getCueId(t,i),l=i.startTime;if(y(t,d))return void e.log("Skipping ad already seen with ID "+d);o&&o(t,s,d,l),a(t,s,d,l),v(t,d)}};var A={},S=e;A.isMiddlewareMediatorSupported=function(){return!S.browser.IS_IOS&&!S.browser.IS_ANDROID&&!!(S.use&&S.middleware&&S.middleware.TERMINATOR)},A.playMiddleware=function(t){return{setSource:function(e,t){t(null,e)},callPlay:function(){if(t.ads&&!0===t.ads._shouldBlockPlay)return t.ads.debug("Using playMiddleware to block content playback"),t.ads._playBlocked=!0,S.middleware.TERMINATOR},play:function(n,a){t.ads&&t.ads._playBlocked&&n?(t.ads.debug("Play call to Tech was terminated."),t.trigger("play"),t.addClass("vjs-has-started"),t.ads._playBlocked=!1):a&&a.catch&&a.catch(function(n){"NotAllowedError"!==n.name||e.browser.IS_SAFARI||t.trigger("pause")})}}},A.testHook=function(e){S=e};var _=A.playMiddleware,P=A.isMiddlewareMediatorSupported,b=function(){if(e.getPlugin)return Boolean(e.getPlugin("ads"));var t=e.getComponent("Player");return Boolean(t&&t.prototype.ads)};var k=function(){function e(){}return e.getState=function(t){if(t)return e.states_&&e.states_[t]?e.states_[t]:void 0},e.registerState=function(t,n){if("string"!=typeof t||!t)throw new Error('Illegal state name, "'+t+'"; must be a non-empty string.');return e.states_||(e.states_={}),e.states_[t]=n,n},e}(),C=function(){function t(e){this.player=e}t._getName=function(){return"Anonymous State"};var n=t.prototype;return n.transitionTo=function(e){var t=this.player;this.cleanup(t);var n=new e(t);t.ads._state=n,t.ads.debug(this.constructor._getName()+" -> "+n.constructor._getName());for(var a=arguments.length,o=new Array(a>1?a-1:0),r=1;r<a;r++)o[r-1]=arguments[r];n.init.apply(n,[t].concat(o))},n.init=function(){},n.cleanup=function(){},n.onPlay=function(){},n.onPlaying=function(){},n.onEnded=function(){},n.onAdEnded=function(){},n.onAdsReady=function(){e.log.warn("Unexpected adsready event")},n.onAdsError=function(){},n.onAdsCanceled=function(){},n.onAdTimeout=function(){},n.onAdStarted=function(){},n.onContentChanged=function(){},n.onContentResumed=function(){},n.onReadyForPostroll=function(){e.log.warn("Unexpected readyforpostroll event")},n.onNoPreroll=function(){},n.onNoPostroll=function(){},n.startLinearAdMode=function(){e.log.warn("Unexpected startLinearAdMode invocation (State via "+this.constructor._getName()+")")},n.endLinearAdMode=function(){e.log.warn("Unexpected endLinearAdMode invocation (State via "+this.constructor._getName()+")")},n.skipLinearAdMode=function(){e.log.warn("Unexpected skipLinearAdMode invocation (State via "+this.constructor._getName()+")")},n.isAdState=function(){throw new Error("isAdState unimplemented for "+this.constructor._getName())},n.isWaitingForAdBreak=function(){return!1},n.isContentResuming=function(){return!1},n.inAdBreak=function(){return!1},n.handleEvent=function(e){var t=this.player;"play"===e?this.onPlay(t):"adsready"===e?this.onAdsReady(t):"adserror"===e?this.onAdsError(t):"adscanceled"===e?this.onAdsCanceled(t):"adtimeout"===e?this.onAdTimeout(t):"ads-ad-started"===e?this.onAdStarted(t):"contentchanged"===e?this.onContentChanged(t):"contentresumed"===e?this.onContentResumed(t):"readyforpostroll"===e?this.onReadyForPostroll(t):"playing"===e?this.onPlaying(t):"ended"===e?this.onEnded(t):"nopreroll"===e?this.onNoPreroll(t):"nopostroll"===e?this.onNoPostroll(t):"adended"===e&&this.onAdEnded(t)},t}();function T(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}k.registerState("State",C);var w=function(e){function t(t){var n;return(n=e.call(this,t)||this).contentResuming=!1,n.waitingForAdBreak=!1,n}T(t,e);var n=t.prototype;return n.isAdState=function(){return!0},n.onPlaying=function(){var e=k.getState("ContentPlayback");this.contentResuming&&this.transitionTo(e)},n.onContentResumed=function(){var e=k.getState("ContentPlayback");this.contentResuming&&this.transitionTo(e)},n.isWaitingForAdBreak=function(){return this.waitingForAdBreak},n.isContentResuming=function(){return this.contentResuming},n.inAdBreak=function(){return!0===this.player.ads._inLinearAdMode},t}(C);k.registerState("AdState",w);var R=function(e){function t(){return e.apply(this,arguments)||this}T(t,e);var n=t.prototype;return n.isAdState=function(){return!1},n.onContentChanged=function(e){var t=k.getState("BeforePreroll"),n=k.getState("Preroll");e.ads.debug("Received contentchanged event (ContentState)"),e.paused()?this.transitionTo(t):(this.transitionTo(n,!1),e.pause(),e.ads._pausedOnContentupdate=!0)},t}(C);k.registerState("ContentState",R);var L,B=function(t){function n(){return t.apply(this,arguments)||this}T(n,t),n._getName=function(){return"AdsDone"};var a=n.prototype;return a.init=function(e){e.ads._contentHasEnded=!0,e.trigger("ended")},a.startLinearAdMode=function(){e.log.warn("Unexpected startLinearAdMode invocation (AdsDone)")},n}(k.getState("ContentState"));k.registerState("AdsDone",B);var M={start:function(t){t.ads.debug("Starting ad break"),t.ads._inLinearAdMode=!0,t.trigger("adstart"),t.ads.shouldTakeSnapshots()&&(t.ads.snapshot=function(t){var n;n=e.browser.IS_IOS&&t.ads.isLive(t)&&t.seekable().length>0?t.currentTime()-t.seekable().end(0):t.currentTime();var a=t.$(".vjs-tech"),o=t.textTracks?t.textTracks():[],r=[],i={ended:t.ended(),currentSrc:t.currentSrc(),sources:t.currentSources(),src:t.tech_.src(),currentTime:n,type:t.currentType()};a&&(i.style=a.getAttribute("style"));for(var s=0;s<o.length;s++){var d=o[s];r.push({track:d,mode:d.mode}),d.mode="disabled"}return i.suppressedTracks=r,i}(t)),t.ads.shouldPlayContentBehindAd(t)&&(t.ads.preAdVolume_=t.volume(),t.volume(0)),t.addClass("vjs-ad-playing"),t.hasClass("vjs-live")&&t.removeClass("vjs-live"),t.ads.removeNativePoster()},end:function(t,n){t.ads.debug("Ending ad break"),void 0===n&&(n=function(){}),t.ads.adType=null,t.ads._inLinearAdMode=!1,t.trigger("adend"),t.removeClass("vjs-ad-playing"),t.ads.isLive(t)&&t.addClass("vjs-live"),t.ads.shouldTakeSnapshots()?function(t,n){var a=t.ads.snapshot;if(void 0===n&&(n=function(){}),!0===t.ads.disableNextSnapshotRestore)return t.ads.disableNextSnapshotRestore=!1,delete t.ads.snapshot,void n();var o,r=t.$(".vjs-tech"),i=20,s=a.suppressedTracks,d=function(){for(var e=0;e<s.length;e++)(o=s[e]).track.mode=o.mode},l=function(){var n;if(e.browser.IS_IOS&&t.ads.isLive(t)){if(a.currentTime<0&&(n=t.seekable().length>0?t.seekable().end(0)+a.currentTime:t.currentTime(),t.currentTime(n)),t.paused()){var o=t.play();o&&o.catch&&o.catch(function(t){e.log.warn("Play promise rejected in IOS snapshot resume",t)})}}else if(a.ended)t.currentTime(t.duration());else{t.currentTime(a.currentTime);var r=t.play();r&&r.catch&&r.catch(function(t){e.log.warn("Play promise rejected in snapshot resume",t)})}t.ads.shouldRemoveAutoplay_&&(t.autoplay(!1),t.ads.shouldRemoveAutoplay_=!1)},u=function n(){if(t.off("contentcanplay",n),L&&t.clearTimeout(L),(r=t.el().querySelector(".vjs-tech")).readyState>1)return l();if(void 0===r.seekable)return l();if(r.seekable.length>0)return l();if(i--)t.setTimeout(n,50);else try{l()}catch(t){e.log.warn("Failed to resume the content after an advertisement",t)}};if("style"in a&&r.setAttribute("style",a.style||""),t.ads.videoElementRecycled())t.one("resumeended",function(){delete t.ads.snapshot,n()}),t.one("contentloadedmetadata",d),e.browser.IS_IOS&&!t.autoplay()&&(t.autoplay(!0),t.ads.shouldRemoveAutoplay_=!0),t.src(a.sources),t.one("contentcanplay",u),L=t.setTimeout(u,2e3);else{if(d(),!t.ended()){var c=t.play();c&&c.catch&&c.catch(function(t){e.log.warn("Play promise rejected in snapshot restore",t)})}delete t.ads.snapshot,n()}}(t,n):(t.volume(t.ads.preAdVolume_),n())}},j=function(t){function n(){return t.apply(this,arguments)||this}T(n,t),n._getName=function(){return"Preroll"};var a=n.prototype;return a.init=function(e,t,n){if(this.waitingForAdBreak=!0,e.addClass("vjs-ad-loading"),n||e.ads.nopreroll_)return this.resumeAfterNoPreroll(e);var a=e.ads.settings.timeout;"number"==typeof e.ads.settings.prerollTimeout&&(a=e.ads.settings.prerollTimeout),this._timeout=e.setTimeout(function(){e.trigger("adtimeout")},a),t?this.handleAdsReady():this.adsReady=!1},a.onAdsReady=function(t){t.ads.inAdBreak()?e.log.warn("Unexpected adsready event (Preroll)"):(t.ads.debug("Received adsready event (Preroll)"),this.handleAdsReady())},a.handleAdsReady=function(){this.adsReady=!0,this.readyForPreroll()},a.afterLoadStart=function(e){var t=this.player;t.ads._hasThereBeenALoadStartDuringPlayerLife?e():(t.ads.debug("Waiting for loadstart..."),t.one("loadstart",function(){t.ads.debug("Received loadstart event"),e()}))},a.noPreroll=function(){var e=this;this.afterLoadStart(function(){e.player.ads.debug("Skipping prerolls due to nopreroll event (Preroll)"),e.resumeAfterNoPreroll(e.player)})},a.readyForPreroll=function(){var e=this.player;this.afterLoadStart(function(){e.ads.debug("Triggered readyforpreroll event (Preroll)"),e.trigger("readyforpreroll")})},a.onAdsCanceled=function(e){var t=this;e.ads.debug("adscanceled (Preroll)"),this.afterLoadStart(function(){t.resumeAfterNoPreroll(e)})},a.onAdsError=function(t){var n=this;e.log("adserror (Preroll)"),this.inAdBreak()?t.ads.endLinearAdMode():this.afterLoadStart(function(){n.resumeAfterNoPreroll(t)})},a.startLinearAdMode=function(){var t=this.player;!this.adsReady||t.ads.inAdBreak()||this.isContentResuming()?e.log.warn("Unexpected startLinearAdMode invocation (Preroll)"):(this.clearTimeout(t),t.ads.adType="preroll",this.waitingForAdBreak=!1,M.start(t),t.ads._shouldBlockPlay=!1)},a.onAdStarted=function(e){e.removeClass("vjs-ad-loading")},a.endLinearAdMode=function(){var e=this.player;this.inAdBreak()&&(e.removeClass("vjs-ad-loading"),e.addClass("vjs-ad-content-resuming"),this.contentResuming=!0,M.end(e))},a.skipLinearAdMode=function(){var t=this,n=this.player;n.ads.inAdBreak()||this.isContentResuming()?e.log.warn("Unexpected skipLinearAdMode invocation"):this.afterLoadStart(function(){n.trigger("adskip"),n.ads.debug("skipLinearAdMode (Preroll)"),t.resumeAfterNoPreroll(n)})},a.onAdTimeout=function(e){var t=this;this.afterLoadStart(function(){e.ads.debug("adtimeout (Preroll)"),t.resumeAfterNoPreroll(e)})},a.onNoPreroll=function(t){t.ads.inAdBreak()||this.isContentResuming()?e.log.warn("Unexpected nopreroll event (Preroll)"):this.noPreroll()},a.resumeAfterNoPreroll=function(e){if(this.contentResuming=!0,e.ads._shouldBlockPlay=!1,this.cleanupPartial(e),e.ads._playRequested||e.ads._pausedOnContentupdate)if(e.paused()){e.ads.debug("resumeAfterNoPreroll: attempting to resume playback (Preroll)");var t=e.play();t&&t.then&&t.then(null,function(e){})}else e.ads.debug("resumeAfterNoPreroll: already playing (Preroll)"),e.trigger("play"),e.trigger("playing")},a.cleanup=function(t){t.ads._hasThereBeenALoadStartDuringPlayerLife||e.log.warn("Leaving Preroll state before loadstart event can cause issues."),this.cleanupPartial(t)},a.cleanupPartial=function(e){e.removeClass("vjs-ad-loading"),e.removeClass("vjs-ad-content-resuming"),this.clearTimeout(e)},a.clearTimeout=function(e){e.clearTimeout(this._timeout),this._timeout=null},n}(k.getState("AdState"));k.registerState("Preroll",j);var I=function(e){function t(){return e.apply(this,arguments)||this}T(t,e),t._getName=function(){return"BeforePreroll"};var n=t.prototype;return n.init=function(e){this.adsReady=!1,this.shouldResumeToContent=!1,e.ads._shouldBlockPlay=!e.ads.settings.allowVjsAutoplay||!e.autoplay()},n.onAdsReady=function(e){e.ads.debug("Received adsready event (BeforePreroll)"),this.adsReady=!0},n.onPlay=function(e){var t=k.getState("Preroll");e.ads.debug("Received play event (BeforePreroll)"),this.transitionTo(t,this.adsReady,this.shouldResumeToContent)},n.onAdsCanceled=function(e){e.ads.debug("adscanceled (BeforePreroll)"),this.shouldResumeToContent=!0},n.onAdsError=function(){this.player.ads.debug("adserror (BeforePreroll)"),this.shouldResumeToContent=!0},n.onNoPreroll=function(){this.player.ads.debug("Skipping prerolls due to nopreroll event (BeforePreroll)"),this.shouldResumeToContent=!0},n.skipLinearAdMode=function(){var e=this.player;e.trigger("adskip"),e.ads.debug("skipLinearAdMode (BeforePreroll)"),this.shouldResumeToContent=!0},n.onContentChanged=function(){this.init(this.player)},t}(k.getState("ContentState"));k.registerState("BeforePreroll",I);var N=function(e){function t(){return e.apply(this,arguments)||this}T(t,e),t._getName=function(){return"Midroll"};var n=t.prototype;return n.init=function(e){e.ads.adType="midroll",M.start(e),e.addClass("vjs-ad-loading")},n.onAdStarted=function(e){e.removeClass("vjs-ad-loading")},n.endLinearAdMode=function(){var e=this.player;this.inAdBreak()&&(this.contentResuming=!0,e.addClass("vjs-ad-content-resuming"),e.removeClass("vjs-ad-loading"),M.end(e))},n.onAdsError=function(e){this.inAdBreak()&&e.ads.endLinearAdMode()},n.cleanup=function(e){e.removeClass("vjs-ad-loading"),e.removeClass("vjs-ad-content-resuming")},t}(k.getState("AdState"));k.registerState("Midroll",N);var E=function(t){function n(){return t.apply(this,arguments)||this}T(n,t),n._getName=function(){return"Postroll"};var a=n.prototype;return a.init=function(e){if(this.waitingForAdBreak=!0,e.ads._contentEnding=!0,e.ads.nopostroll_){this.resumeContent(e);var t=k.getState("AdsDone");this.transitionTo(t)}else{e.addClass("vjs-ad-loading");var n=e.ads.settings.timeout;"number"==typeof e.ads.settings.postrollTimeout&&(n=e.ads.settings.postrollTimeout),this._postrollTimeout=e.setTimeout(function(){e.trigger("adtimeout")},n)}},a.startLinearAdMode=function(){var t=this.player;t.ads.inAdBreak()||this.isContentResuming()?e.log.warn("Unexpected startLinearAdMode invocation (Postroll)"):(t.ads.adType="postroll",t.clearTimeout(this._postrollTimeout),this.waitingForAdBreak=!1,M.start(t))},a.onAdStarted=function(e){e.removeClass("vjs-ad-loading")},a.endLinearAdMode=function(){var e=this,t=this.player,n=k.getState("AdsDone");this.inAdBreak()&&(t.removeClass("vjs-ad-loading"),this.resumeContent(t),M.end(t,function(){e.transitionTo(n)}))},a.skipLinearAdMode=function(){var t=this.player;t.ads.inAdBreak()||this.isContentResuming()?e.log.warn("Unexpected skipLinearAdMode invocation"):(t.ads.debug("Postroll abort (skipLinearAdMode)"),t.trigger("adskip"),this.abort(t))},a.onAdTimeout=function(e){e.ads.debug("Postroll abort (adtimeout)"),this.abort(e)},a.onAdsError=function(e){e.ads.debug("Postroll abort (adserror)"),e.ads.inAdBreak()?e.ads.endLinearAdMode():this.abort(e)},a.onContentChanged=function(e){if(this.isContentResuming()){var t=k.getState("BeforePreroll");this.transitionTo(t)}else if(!this.inAdBreak()){var n=k.getState("Preroll");this.transitionTo(n)}},a.onNoPostroll=function(t){this.isContentResuming()||this.inAdBreak()?e.log.warn("Unexpected nopostroll event (Postroll)"):this.abort(t)},a.resumeContent=function(e){this.contentResuming=!0,e.addClass("vjs-ad-content-resuming")},a.abort=function(e){var t=k.getState("AdsDone");this.resumeContent(e),e.removeClass("vjs-ad-loading"),this.transitionTo(t)},a.cleanup=function(e){e.removeClass("vjs-ad-content-resuming"),e.clearTimeout(this._postrollTimeout),e.ads._contentEnding=!1},n}(k.getState("AdState"));k.registerState("Postroll",E);var x=function(e){function t(){return e.apply(this,arguments)||this}T(t,e),t._getName=function(){return"ContentPlayback"};var n=t.prototype;return n.init=function(e){e.ads._shouldBlockPlay=!1},n.onAdsReady=function(e){e.ads.debug("Received adsready event (ContentPlayback)"),e.ads.nopreroll_||(e.ads.debug("Triggered readyforpreroll event (ContentPlayback)"),e.trigger("readyforpreroll"))},n.onReadyForPostroll=function(e){var t=k.getState("Postroll");e.ads.debug("Received readyforpostroll event"),this.transitionTo(t)},n.startLinearAdMode=function(){var e=k.getState("Midroll");this.transitionTo(e)},t}(k.getState("ContentState"));k.registerState("ContentPlayback",x);var D=function(e){function t(){return e.apply(this,arguments)||this}T(t,e),t._getName=function(){return"StitchedContentPlayback"};var n=t.prototype;return n.init=function(){this.player.ads._shouldBlockPlay=!1},n.onContentChanged=function(){this.player.ads.debug("Received contentchanged event ("+this.constructor._getName()+")")},n.startLinearAdMode=function(){var e=k.getState("StitchedAdRoll");this.transitionTo(e)},t}(k.getState("ContentState"));k.registerState("StitchedContentPlayback",D);var O=function(e){function t(){return e.apply(this,arguments)||this}T(t,e),t._getName=function(){return"StitchedAdRoll"};var n=t.prototype;return n.init=function(){this.waitingForAdBreak=!1,this.contentResuming=!1,this.player.ads.adType="stitched",M.start(this.player)},n.onPlaying=function(){},n.onContentResumed=function(){},n.onAdEnded=function(){this.endLinearAdMode(),this.player.trigger("ended")},n.endLinearAdMode=function(){var e=k.getState("StitchedContentPlayback");M.end(this.player),this.transitionTo(e)},t}(k.getState("AdState"));k.registerState("StitchedAdRoll",O);var F=A.isMiddlewareMediatorSupported,U=e.getTech("Html5").Events,V={timeout:5e3,prerollTimeout:void 0,postrollTimeout:void 0,debug:!1,stitchedAds:!1,contentIsLive:void 0,liveCuePoints:!0,allowVjsAutoplay:e.options.normalizeAutoplay||!1},q=function(o){var r=this,i=e.mergeOptions(V,o),s=[];U.concat(["firstplay","loadedalldata"]).forEach(function(e){-1===s.indexOf(e)&&s.push(e)}),r.on(s,u),F()||function(t,n){n&&e.log("Using cancelContentPlay to block content playback"),t.on("play",m)}(r,i.debug),r.setTimeout(function(){r.ads._hasThereBeenALoadStartDuringPlayerLife||""===r.src()||e.log.error("videojs-contrib-ads has not seen a loadstart event 5 seconds after being initialized, but a source is present. This indicates that videojs-contrib-ads was initialized too late. It must be initialized immediately after video.js in the same tick. As a result, some ads will not play and some media events will be incorrect. For more information, see http://videojs.github.io/videojs-contrib-ads/integrator/getting-started.html")},5e3),r.on("ended",function(){r.hasClass("vjs-has-started")||r.addClass("vjs-has-started")}),r.on("contenttimeupdate",function(){r.removeClass("vjs-waiting")}),r.on(["addurationchange","adcanplay"],function(){if(!r.ads.settings.stitchedAds&&!r.hasStarted()&&(!r.ads.snapshot||r.currentSrc()!==r.ads.snapshot.currentSrc)&&r.ads.inAdBreak()){var t=r.play();t&&t.catch&&t.catch(function(t){e.log.warn("Play promise rejected when playing ad",t)})}}),r.on("nopreroll",function(){r.ads.debug("Received nopreroll event"),r.ads.nopreroll_=!0}),r.on("nopostroll",function(){r.ads.debug("Received nopostroll event"),r.ads.nopostroll_=!0}),r.on("playing",function(){r.ads._cancelledPlay=!1,r.ads._pausedOnContentupdate=!1}),r.on("play",function(){r.ads._playRequested=!0}),r.one("loadstart",function(){r.ads._hasThereBeenALoadStartDuringPlayerLife=!0}),r.on("loadeddata",function(){r.ads._hasThereBeenALoadedData=!0}),r.on("loadedmetadata",function(){r.ads._hasThereBeenALoadedMetaData=!0}),r.ads=function(t){return{disableNextSnapshotRestore:!1,_contentEnding:!1,_contentHasEnded:!1,_hasThereBeenALoadStartDuringPlayerLife:!1,_hasThereBeenALoadedData:!1,_hasThereBeenALoadedMetaData:!1,_inLinearAdMode:!1,_shouldBlockPlay:!1,_playBlocked:!1,_playRequested:!1,adType:null,VERSION:a,reset:function(){t.ads.disableNextSnapshotRestore=!1,t.ads._contentEnding=!1,t.ads._contentHasEnded=!1,t.ads.snapshot=null,t.ads.adType=null,t.ads._hasThereBeenALoadedData=!1,t.ads._hasThereBeenALoadedMetaData=!1,t.ads._cancelledPlay=!1,t.ads._shouldBlockPlay=!1,t.ads._playBlocked=!1,t.ads.nopreroll_=!1,t.ads.nopostroll_=!1,t.ads._playRequested=!1},startLinearAdMode:function(){t.ads._state.startLinearAdMode()},endLinearAdMode:function(){t.ads._state.endLinearAdMode()},skipLinearAdMode:function(){t.ads._state.skipLinearAdMode()},stitchedAds:function(t){return void 0!==t&&(e.log.warn("Using player.ads.stitchedAds() as a setter is deprecated, it should be set as an option upon initialization of contrib-ads."),this.settings.stitchedAds=!!t),this.settings.stitchedAds},videoElementRecycled:function(){if(t.ads.shouldPlayContentBehindAd(t))return!1;if(!this.snapshot)throw new Error("You cannot use videoElementRecycled while there is no snapshot.");var e=t.tech_.src()!==this.snapshot.src,n=t.currentSrc()!==this.snapshot.currentSrc;return e||n},isLive:function(n){return void 0===n&&(n=t),"boolean"==typeof n.ads.settings.contentIsLive?n.ads.settings.contentIsLive:n.duration()===1/0||"8"===e.browser.IOS_VERSION&&0===n.duration()},shouldPlayContentBehindAd:function(n){if(void 0===n&&(n=t),n)return!!n.ads.settings.liveCuePoints&&!e.browser.IS_IOS&&!e.browser.IS_ANDROID&&n.duration()===1/0;throw new Error("shouldPlayContentBehindAd requires a player as a param")},shouldTakeSnapshots:function(e){return void 0===e&&(e=t),!this.shouldPlayContentBehindAd(e)&&!this.stitchedAds()},isInAdMode:function(){return this._state.isAdState()},isWaitingForAdBreak:function(){return this._state.isWaitingForAdBreak()},isContentResuming:function(){return this._state.isContentResuming()},isAdPlaying:function(){return this._state.inAdBreak()},inAdBreak:function(){return this._state.inAdBreak()},removeNativePoster:function(){var e=t.$(".vjs-tech");e&&e.removeAttribute("poster")},debug:function(){if(this.settings.debug){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];1===n.length&&"string"==typeof n[0]?e.log("ADS: "+n[0]):e.log.apply(e,["ADS:"].concat(n))}}}}(r),r.ads.settings=i,i.stitchedAds=!!i.stitchedAds,i.stitchedAds?r.ads._state=new(k.getState("StitchedContentPlayback"))(r):r.ads._state=new(k.getState("BeforePreroll"))(r),r.ads._state.init(r),r.ads.cueTextTracks=g,r.ads.adMacroReplacement=function(a,o,r){var i=this,s={};a=a.replace(/{([^}=]+)=([^}]+)}/g,function(e,t,n){return s["{"+t+"}"]=n,"{"+t+"}"}),void 0===o&&(o=!1);var d={};for(var l in void 0!==r&&(d=r),d["{player.id}"]=this.options_["data-player"]||this.id_,d["{player.height}"]=this.currentHeight(),d["{player.width}"]=this.currentWidth(),d["{mediainfo.id}"]=this.mediainfo?this.mediainfo.id:"",d["{mediainfo.name}"]=this.mediainfo?this.mediainfo.name:"",d["{mediainfo.duration}"]=this.mediainfo?this.mediainfo.duration:"",d["{player.duration}"]=this.duration(),d["{player.pageUrl}"]=e.dom.isInFrame()?n.referrer:t.location.href,d["{playlistinfo.id}"]=this.playlistinfo?this.playlistinfo.id:"",d["{playlistinfo.name}"]=this.playlistinfo?this.playlistinfo.name:"",d["{timestamp}"]=(new Date).getTime(),d["{document.referrer}"]=n.referrer,d["{window.location.href}"]=t.location.href,d["{random}"]=Math.floor(1e12*Math.random()),["description","tags","reference_id","ad_keys"].forEach(function(e){i.mediainfo&&i.mediainfo[e]?d["{mediainfo."+e+"}"]=i.mediainfo[e]:s["{mediainfo."+e+"}"]?d["{mediainfo."+e+"}"]=s["{mediainfo."+e+"}"]:d["{mediainfo."+e+"}"]=""}),p(this.mediainfo,d,"custom_fields"),p(this.mediainfo,d,"customFields"),Object.keys(c).forEach(function(e){d["{tcf."+e+"}"]=c[e]}),d["{tcf.gdprAppliesInt}"]=c.gdprApplies?1:0,d)a=a.split(l).join(h(d[l],o));for(var u in a=a.replace(/{pageVariable\.([^}]+)}/g,function(n,a){for(var r,i=t,d=a.split("."),l=0;l<d.length;l++)l===d.length-1?r=i[d[l]]:i=i[d[l]];var u=typeof r;return null===r?"null":void 0===r?s["{pageVariable."+a+"}"]?s["{pageVariable."+a+"}"]:(e.log.warn('Page variable "'+a+'" not found'),""):"string"!==u&&"number"!==u&&"boolean"!==u?(e.log.warn('Page variable "'+a+'" is not a supported type'),""):h(String(r),o)}),s)a=a.replace(u,s[u]);return a}.bind(r),function(e){e.ads.contentSrc=e.currentSrc(),e.ads._seenInitialLoadstart=!1,e.on("loadstart",function(){if(!e.ads.inAdBreak()){var t=e.currentSrc();t!==e.ads.contentSrc&&(e.ads._seenInitialLoadstart&&e.trigger({type:"contentchanged"}),e.trigger({type:"contentupdate",oldValue:e.ads.contentSrc,newValue:t}),e.ads.contentSrc=t),e.ads._seenInitialLoadstart=!0}})}(r),r.on("contentchanged",r.ads.reset);var d=function(){var t=r.textTracks();if(!r.ads.shouldPlayContentBehindAd(r)&&r.ads.inAdBreak()&&r.tech_.featuresNativeTextTracks&&e.browser.IS_IOS&&!Array.isArray(r.textTracks()))for(var n=0;n<t.length;n++){var a=t[n];"showing"===a.mode&&(a.mode="disabled")}};r.ready(function(){r.textTracks().addEventListener("change",d)}),r.on(["play","playing","ended","adsready","adscanceled","adskip","adserror","adtimeout","adended","ads-ad-started","contentchanged","dispose","contentresumed","readyforpostroll","nopreroll","nopostroll"],function(e){r.ads._state.handleEvent(e.type)}),r.on("dispose",function(){r.ads.reset(),r.textTracks().removeEventListener("change",d)}),f(),r.ads.listenToTcf=f};return q.VERSION=a,function(t){!b(e)&&((e.registerPlugin||e.plugin)("ads",t),P()&&!e.usingContribAdsMiddleware_&&(e.use("*",_),e.usingContribAdsMiddleware_=!0,e.log.debug("Play middleware has been registered with videojs")))}(q),q});
(()=>{var e={248:function(e,t){!function(e){"use strict";function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function r(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?t(Object(i),!0).forEach((function(t){s(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function o(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function d(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=c(e);if(t){var n=c(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return d(this,r)}}function h(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}var m=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=[],n=T(e);for(var a in!t.ERRORCODE||r.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=R(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING,t)t[a]=E(t[a]);for(var o in n){var s=n[o];"string"==typeof s&&i.push(y(s,t))}return i}function y(e,t){var r=(e=A(e,t)).match(/[^[\]]+(?=])/g);if(!r)return e;var i=r.filter((function(e){return m.indexOf(e)>-1}));return 0===i.length?e:A(e,i=i.reduce((function(e,t){return e[t]=-1,e}),{}))}function A(e,t){var r=e;for(var i in t){var n=t[i];r=r.replace(new RegExp("(?:\\[|%%)(".concat(i,")(?:\\]|%%)"),"g"),n)}return r}function T(e){return Array.isArray(e)?e.map((function(e){return e&&e.hasOwnProperty("url")?e.url:e})):e}function b(e,t){for(var r=0;r<t.length;r++)if(k(t[r],e))return!0;return!1}function k(e,t){if(e&&t){var r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);return r.length===i.length&&e.id===t.id&&e.url===t.url}return!1}function E(e){return encodeURIComponent(e).replace(/[!'()*]/g,(function(e){return"%".concat(e.charCodeAt(0).toString(16))}))}function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}var w={track:function(e,t,r){g(e,t,r).forEach((function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)}))},resolveURLTemplates:g,extractURLsFromTemplates:T,containsTemplateObject:b,isTemplateObjectEqual:k,encodeURIComponentRFC3986:E,replaceUrlMacros:y,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce((function(t,r){return t.concat(Array.isArray(r)?e(r):r)}),[])},joinArrayOfUniqueTemplateObjs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];return r.concat(i).reduce((function(e,t){return b(t,e)||e.push(t),e}),[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:R};function L(e){return-1!==["true","TRUE","True","1"].indexOf(e)}var N={childByName:function(e,t){var r=e.childNodes;for(var i in r){var n=r[i];if(n.nodeName===t)return n}},childrenByName:function(e,t){var r=[],i=e.childNodes;for(var n in i){var a=i[n];a.nodeName===t&&r.push(a)}return r},resolveVastAdTagURI:function(e,t){if(!t)return e;if(0===e.indexOf("//")){var r=location.protocol;return"".concat(r).concat(e)}if(-1===e.indexOf("://")){var i=t.slice(0,t.lastIndexOf("/"));return"".concat(i,"/").concat(e)}return e},parseBoolean:L,parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,r){var i=t.getAttribute(e);i&&r.setAttribute(e,i)},parseAttributes:function(e){for(var t=e.attributes,r={},i=0;i<t.length;i++)r[t[i].nodeName]=t[i].nodeValue;return r},parseDuration:function(e){if(null==e)return-1;if(w.isNumeric(e))return parseInt(e);var t=e.split(":");if(3!==t.length)return-1;var r=t[2].split("."),i=parseInt(r[0]);2===r.length&&(i+=parseFloat("0.".concat(r[1])));var n=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(n)||isNaN(i)||n>3600||i>60?-1:a+n+i},splitVAST:function(e){var t=[],r=null;return e.forEach((function(i,n){if(i.sequence&&(i.sequence=parseInt(i.sequence,10)),i.sequence>1){var a=e[n-1];if(a&&a.sequence===i.sequence-1)return void(r&&r.push(i));delete i.sequence}r=[i],t.push(r)})),t},assignAttributes:function(e,t){if(e)for(var r in e){var i=e[r];if(i.nodeName&&i.nodeValue&&t.hasOwnProperty(i.nodeName)){var n=i.nodeValue;"boolean"==typeof t[i.nodeName]&&(n=L(n)),t[i.nodeName]=n}}},mergeWrapperAdData:function(e,t){e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),t.viewableImpression.length>0&&(e.viewableImpression=[].concat(h(e.viewableImpression),h(t.viewableImpression))),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;var r=(t.creatives||[]).filter((function(e){return e&&"companion"===e.type})),i=r.reduce((function(e,t){return(t.variations||[]).forEach((function(t){(t.companionClickTrackingURLTemplates||[]).forEach((function(t){w.containsTemplateObject(t,e)||e.push(t)}))})),e}),[]);e.creatives=r.concat(e.creatives);var n=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,a=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;e.creatives.forEach((function(e){if(t.trackingEvents&&t.trackingEvents[e.type])for(var r in t.trackingEvents[e.type]){var o=t.trackingEvents[e.type][r];Array.isArray(e.trackingEvents[r])||(e.trackingEvents[r]=[]),e.trackingEvents[r]=e.trackingEvents[r].concat(o)}"linear"===e.type&&(n&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),a&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),"companion"===e.type&&i.length&&(e.variations||[]).forEach((function(e){e.companionClickTrackingURLTemplates=w.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,i)}))})),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories))}};function C(e,t){var r=function(){var e=v(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"companion",required:null,variations:[]}}(t);return r.required=e.getAttribute("required")||null,r.variations=N.childrenByName(e,"Companion").map((function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adType:"companionAd",width:e.width||0,height:e.height||0,assetWidth:e.assetWidth||null,assetHeight:e.assetHeight||null,expandedWidth:e.expandedWidth||null,expandedHeight:e.expandedHeight||null,apiFramework:e.apiFramework||null,adSlotID:e.adSlotID||null,pxratio:e.pxratio||"1",renderingMode:e.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,xmlEncoded:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(N.parseAttributes(e));t.htmlResources=N.childrenByName(e,"HTMLResource").reduce((function(e,t){var r=N.parseNodeText(t);return r?e.concat(r):e}),[]),t.iframeResources=N.childrenByName(e,"IFrameResource").reduce((function(e,t){var r=N.parseNodeText(t);return r?e.concat(r):e}),[]),t.staticResources=N.childrenByName(e,"StaticResource").reduce((function(e,t){var r=N.parseNodeText(t);return r?e.concat({url:r,creativeType:t.getAttribute("creativeType")||null}):e}),[]),t.altText=N.parseNodeText(N.childByName(e,"AltText"))||null;var r=N.childByName(e,"TrackingEvents");r&&N.childrenByName(r,"Tracking").forEach((function(e){var r=e.getAttribute("event"),i=N.parseNodeText(e);r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))})),t.companionClickTrackingURLTemplates=N.childrenByName(e,"CompanionClickTracking").map((function(e){return{id:e.getAttribute("id")||null,url:N.parseNodeText(e)}})),t.companionClickThroughURLTemplate=N.parseNodeText(N.childByName(e,"CompanionClickThrough"))||null;var i=N.childByName(e,"AdParameters");return i&&(t.adParameters=N.parseNodeText(i),t.xmlEncoded=i.getAttribute("xmlEncoded")||null),t})),r}function U(e){return"linear"===e.type}function I(e,t){var r,i=function(){var e=v(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);i.duration=N.parseDuration(N.parseNodeText(N.childByName(e,"Duration")));var n=e.getAttribute("skipoffset");if(null==n)i.skipDelay=null;else if("%"===n.charAt(n.length-1)&&-1!==i.duration){var a=parseInt(n,10);i.skipDelay=i.duration*(a/100)}else i.skipDelay=N.parseDuration(n);var o=N.childByName(e,"VideoClicks");if(o){var s=N.childByName(o,"ClickThrough");i.videoClickThroughURLTemplate=s?{id:s.getAttribute("id")||null,url:N.parseNodeText(s)}:null,N.childrenByName(o,"ClickTracking").forEach((function(e){i.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:N.parseNodeText(e)})})),N.childrenByName(o,"CustomClick").forEach((function(e){i.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:N.parseNodeText(e)})}))}var l=N.childByName(e,"AdParameters");l&&(i.adParameters=N.parseNodeText(l)),N.childrenByName(e,"TrackingEvents").forEach((function(e){N.childrenByName(e,"Tracking").forEach((function(e){var t=e.getAttribute("event"),n=N.parseNodeText(e);if(t&&n){if("progress"===t){if(!(r=e.getAttribute("offset")))return;t="%"===r.charAt(r.length-1)?"progress-".concat(r):"progress-".concat(Math.round(N.parseDuration(r)))}Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(n)}}))})),N.childrenByName(e,"MediaFiles").forEach((function(e){N.childrenByName(e,"MediaFile").forEach((function(e){i.mediaFiles.push(function(e){var t={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};t.id=e.getAttribute("id"),t.fileURL=N.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.mediaType=e.getAttribute("mediaType")||"2D",t.apiFramework=e.getAttribute("apiFramework"),t.fileSize=parseInt(e.getAttribute("fileSize")||0),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);var r=e.getAttribute("scalable");r&&"string"==typeof r&&(t.scalable=N.parseBoolean(r));var i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=N.parseBoolean(i)),t}(e))}));var t=N.childByName(e,"InteractiveCreativeFile");t&&(i.interactiveCreativeFile=function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:N.parseBoolean(e.variableDuration),fileURL:null}}(N.parseAttributes(e));return t.fileURL=N.parseNodeText(e),t}(t));var r=N.childByName(e,"ClosedCaptionFiles");r&&N.childrenByName(r,"ClosedCaptionFile").forEach((function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(N.parseAttributes(e));t.fileURL=N.parseNodeText(e),i.closedCaptionFiles.push(t)}));var n,a,o,s=N.childByName(e,"Mezzanine"),l=(n=s,a={},o=!1,["delivery","type","width","height"].forEach((function(e){n&&n.getAttribute(e)?a[e]=n.getAttribute(e):o=!0})),o?null:a);if(l){var c={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};c.id=s.getAttribute("id"),c.fileURL=N.parseNodeText(s),c.delivery=l.delivery,c.codec=s.getAttribute("codec"),c.type=l.type,c.width=parseInt(l.width,10),c.height=parseInt(l.height,10),c.fileSize=parseInt(s.getAttribute("fileSize"),10),c.mediaType=s.getAttribute("mediaType")||"2D",i.mezzanine=c}}));var c=N.childByName(e,"Icons");return c&&N.childrenByName(c,"Icon").forEach((function(e){i.icons.push(function(e){var t={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null};t.program=e.getAttribute("program"),t.height=parseInt(e.getAttribute("height")||0),t.width=parseInt(e.getAttribute("width")||0),t.xPosition=function(e){return-1!==["left","right"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("xPosition")),t.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),t.apiFramework=e.getAttribute("apiFramework"),t.pxratio=e.getAttribute("pxratio")||"1",t.offset=N.parseDuration(e.getAttribute("offset")),t.duration=N.parseDuration(e.getAttribute("duration")),N.childrenByName(e,"HTMLResource").forEach((function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=N.parseNodeText(e)})),N.childrenByName(e,"IFrameResource").forEach((function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=N.parseNodeText(e)})),N.childrenByName(e,"StaticResource").forEach((function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=N.parseNodeText(e)}));var r=N.childByName(e,"IconClicks");return r&&(t.iconClickThroughURLTemplate=N.parseNodeText(N.childByName(r,"IconClickThrough")),N.childrenByName(r,"IconClickTracking").forEach((function(e){t.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:N.parseNodeText(e)})}))),t.iconViewTrackingURLTemplate=N.parseNodeText(N.childByName(e,"IconViewTracking")),t}(e))})),i}function S(e,t){var r=function(){var e=v(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return N.childrenByName(e,"TrackingEvents").forEach((function(e){var t,i;N.childrenByName(e,"Tracking").forEach((function(e){t=e.getAttribute("event"),i=N.parseNodeText(e),t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))}))})),N.childrenByName(e,"NonLinear").forEach((function(e){var t={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.expandedWidth=e.getAttribute("expandedWidth"),t.expandedHeight=e.getAttribute("expandedHeight"),t.scalable=N.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=N.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=N.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),N.childrenByName(e,"HTMLResource").forEach((function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=N.parseNodeText(e)})),N.childrenByName(e,"IFrameResource").forEach((function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=N.parseNodeText(e)})),N.childrenByName(e,"StaticResource").forEach((function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=N.parseNodeText(e)}));var i=N.childByName(e,"AdParameters");i&&(t.adParameters=N.parseNodeText(i)),t.nonlinearClickThroughURLTemplate=N.parseNodeText(N.childByName(e,"NonLinearClickThrough")),N.childrenByName(e,"NonLinearClickTracking").forEach((function(e){t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:N.parseNodeText(e)})})),r.variations.push(t)})),r}function x(e){var t=[];return e.forEach((function(e){var r=D(e);r&&t.push(r)})),t}function D(e){if("#comment"===e.nodeName)return null;var t,r={name:null,value:null,attributes:{},children:[]},i=e.attributes,n=e.childNodes;if(r.name=e.nodeName,e.attributes)for(var a in i)if(i.hasOwnProperty(a)){var o=i[a];o.nodeName&&o.nodeValue&&(r.attributes[o.nodeName]=o.nodeValue)}for(var s in n)if(n.hasOwnProperty(s)){var l=D(n[s]);l&&r.children.push(l)}if(0===r.children.length||1===r.children.length&&["#cdata-section","#text"].indexOf(r.children[0].name)>=0){var c=N.parseNodeText(e);""!==c&&(r.value=c),r.children=[]}return null===(t=r).value&&0===Object.keys(t.attributes).length&&0===t.children.length?null:r}function O(e){var t=[];return e.forEach((function(e){var r,i={id:e.getAttribute("id")||null,adId:V(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},n=[];N.childrenByName(e,"UniversalAdId").forEach((function(e){var t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:N.parseNodeText(e)};n.push(t)}));var a=N.childByName(e,"CreativeExtensions");for(var o in a&&(r=x(N.childrenByName(a,"CreativeExtension"))),e.childNodes){var s=e.childNodes[o],l=void 0;switch(s.nodeName){case"Linear":l=I(s,i);break;case"NonLinearAds":l=S(s,i);break;case"CompanionAds":l=C(s,i)}l&&(n&&(l.universalAdIds=n),r&&(l.creativeExtensions=r),t.push(l))}})),t}function V(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}var P={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function M(e,t){if(P[e.nodeName]&&P[e.nodeName].attributes){var r=P[e.nodeName].attributes.filter((function(t){return!e.getAttribute(t)}));r.length>0&&F({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:r},t)}}function _(e,t,r){var i=P[e.nodeName],n=!r&&"Wrapper"!==e.nodeName;if(i&&!n){if(i.subElements){var a=i.subElements.filter((function(t){return!N.childByName(e,t)}));a.length>0&&F({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:a},t)}r&&i.oneOfinLineResources&&(i.oneOfinLineResources.some((function(t){return N.childByName(e,t)}))||F({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}function B(e){return e.children&&0!==e.children.length}function F(e,t){var r=e.name,i=e.parentName,n=e.attributes,a=e.subElements,o=e.oneOfResources,s="Element '".concat(r,"'");t("VAST-warning",{message:s+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):a?" missing required sub element(s) '".concat(a.join(", "),"' "):o?" must provide one of the following '".concat(o.join(", "),"' "):" is empty",parentElement:i,specVersion:4.1})}var j={verifyRequiredValues:function e(t,r,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),M(t,r),B(t)){_(t,r,i);for(var n=0;n<t.children.length;n++)e(t.children[n],r,i)}else 0===N.parseNodeText(t).length&&F({name:t.nodeName,parentName:t.parentNode.nodeName},r)},hasSubElements:B,emitMissingValueWarning:F,verifyRequiredAttributes:M,verifyRequiredSubElements:_};function W(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.allowMultipleAds,n=r.followAdditionalWrappers,a=e.childNodes;for(var o in a){var s=a[o];if(-1!==["Wrapper","InLine"].indexOf(s.nodeName)&&("Wrapper"!==s.nodeName||!1!==n)){if(N.copyNodeAttribute("id",e,s),N.copyNodeAttribute("sequence",e,s),N.copyNodeAttribute("adType",e,s),"Wrapper"===s.nodeName)return{ad:z(s,t),type:"WRAPPER"};if("InLine"===s.nodeName)return{ad:H(s,t,{allowMultipleAds:i}),type:"INLINE"}}}}function H(e,t){return!1===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allowMultipleAds&&e.getAttribute("sequence")?null:q(e,t)}function q(e,t){var r=[];t&&j.verifyRequiredValues(e,t);var i=e.childNodes,n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,sequence:e.sequence||null,adType:e.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(N.parseAttributes(e));for(var a in i){var o=i[a];switch(o.nodeName){case"Error":n.errorURLTemplates.push(N.parseNodeText(o));break;case"Impression":n.impressionURLTemplates.push({id:o.getAttribute("id")||null,url:N.parseNodeText(o)});break;case"Creatives":n.creatives=O(N.childrenByName(o,"Creative"));break;case"Extensions":var s=N.childrenByName(o,"Extension");n.extensions=x(s),n.adVerifications.length||(r=Q(s));break;case"AdVerifications":n.adVerifications=G(N.childrenByName(o,"Verification"));break;case"AdSystem":n.system={value:N.parseNodeText(o),version:o.getAttribute("version")||null};break;case"AdTitle":n.title=N.parseNodeText(o);break;case"AdServingId":n.adServingId=N.parseNodeText(o);break;case"Category":n.categories.push({authority:o.getAttribute("authority")||null,value:N.parseNodeText(o)});break;case"Expires":n.expires=parseInt(N.parseNodeText(o),10);break;case"ViewableImpression":n.viewableImpression.push(X(o));break;case"Description":n.description=N.parseNodeText(o);break;case"Advertiser":n.advertiser={id:o.getAttribute("id")||null,value:N.parseNodeText(o)};break;case"Pricing":n.pricing={value:N.parseNodeText(o),model:o.getAttribute("model")||null,currency:o.getAttribute("currency")||null};break;case"Survey":n.survey=N.parseNodeText(o);break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:o.getAttribute("authority")||null,value:N.parseNodeText(o)})}}return r.length&&(n.adVerifications=n.adVerifications.concat(r)),n}function z(e,t){var r=q(e,t),i=e.getAttribute("followAdditionalWrappers"),n=e.getAttribute("allowMultipleAds"),a=e.getAttribute("fallbackOnNoAd");r.followAdditionalWrappers=!i||N.parseBoolean(i),r.allowMultipleAds=!!n&&N.parseBoolean(n),r.fallbackOnNoAd=a?N.parseBoolean(a):null;var o=N.childByName(e,"VASTAdTagURI");if(o?r.nextWrapperURL=N.parseNodeText(o):(o=N.childByName(e,"VASTAdTagURL"))&&(r.nextWrapperURL=N.parseNodeText(N.childByName(o,"URL"))),r.creatives.forEach((function(e){if(-1!==["linear","nonlinear"].indexOf(e.type)){if(e.trackingEvents){r.trackingEvents||(r.trackingEvents={}),r.trackingEvents[e.type]||(r.trackingEvents[e.type]={});var t=function(t){var i=e.trackingEvents[t];Array.isArray(r.trackingEvents[e.type][t])||(r.trackingEvents[e.type][t]=[]),i.forEach((function(i){r.trackingEvents[e.type][t].push(i)}))};for(var i in e.trackingEvents)t(i)}e.videoClickTrackingURLTemplates&&(Array.isArray(r.videoClickTrackingURLTemplates)||(r.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach((function(e){r.videoClickTrackingURLTemplates.push(e)}))),e.videoClickThroughURLTemplate&&(r.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(r.videoCustomClickURLTemplates)||(r.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach((function(e){r.videoCustomClickURLTemplates.push(e)})))}})),r.nextWrapperURL)return r}function G(e){var t=[];return e.forEach((function(e){var r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},i=e.childNodes;for(var n in N.assignAttributes(e.attributes,r),i){var a=i[n];switch(a.nodeName){case"JavaScriptResource":case"ExecutableResource":r.resource=N.parseNodeText(a),N.assignAttributes(a.attributes,r);break;case"VerificationParameters":r.parameters=N.parseNodeText(a)}}var o=N.childByName(e,"TrackingEvents");o&&N.childrenByName(o,"Tracking").forEach((function(e){var t=e.getAttribute("event"),i=N.parseNodeText(e);t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))})),t.push(r)})),t}function Q(e){var t=null,r=[];return e.some((function(e){return t=N.childByName(e,"AdVerifications")})),t&&(r=G(N.childrenByName(t,"Verification"))),r}function X(e){var t={};t.id=e.getAttribute("id")||null;var r=e.childNodes;for(var i in r){var n=r[i],a=n.nodeName,o=N.parseNodeText(n);if(("Viewable"===a||"NotViewable"===a||"ViewUndetermined"===a)&&o){var s=a.toLowerCase();Array.isArray(t[s])||(t[s]=[]),t[s].push(o)}}return t}var Y=function(){function e(){n(this,e),this._handlers=[]}return o(e,[{key:"on",value:function(e,t){if("function"!=typeof t)throw new TypeError("The handler argument must be of type Function. Received type ".concat(i(t)));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(i(e)));return this._handlers.push({event:e,handler:t}),this}},{key:"once",value:function(e,t){return this.on(e,function(e,t,r){var i={fired:!1,wrapFn:void 0};function n(){i.fired||(e.off(t,i.wrapFn),i.fired=!0,r.bind(e).apply(void 0,arguments))}return i.wrapFn=n,n}(this,e,t))}},{key:"off",value:function(e,t){return this._handlers=this._handlers.filter((function(r){return r.event!==e||r.handler!==t})),this}},{key:"emit",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];var n=!1;return this._handlers.forEach((function(t){"*"===t.event&&(n=!0,t.handler.apply(t,[e].concat(r))),t.event===e&&(n=!0,t.handler.apply(t,r))})),n}},{key:"removeAllListeners",value:function(e){return e?(this._handlers=this._handlers.filter((function(t){return t.event!==e})),this):(this._handlers=[],this)}},{key:"listenerCount",value:function(e){return this._handlers.filter((function(t){return t.event===e})).length}},{key:"listeners",value:function(e){return this._handlers.reduce((function(t,r){return r.event===e&&t.push(r.handler),t}),[])}},{key:"eventNames",value:function(){return this._handlers.map((function(e){return e.event}))}}]),e}(),K={get:function(e,t,r){r(new Error("Please bundle the library for node to use the node urlHandler"))}},J=12e4;function $(){try{var e=new window.XMLHttpRequest;return"withCredentials"in e?e:null}catch(e){return null}}function Z(e,t,r){var i=r?408:e.status,n=r?"XHRURLHandler: Request timed out after ".concat(e.timeout," ms (").concat(i,")"):"XHRURLHandler: ".concat(e.statusText," (").concat(i,")");t(new Error(n),null,{statusCode:i})}var ee={get:function(e,t,r){if("https:"===window.location.protocol&&0===e.indexOf("http://"))return r(new Error("XHRURLHandler: Cannot go from HTTPS to HTTP."));try{var i=$();i.open("GET",e),i.timeout=t.timeout||J,i.withCredentials=t.withCredentials||!1,i.overrideMimeType&&i.overrideMimeType("text/xml"),i.onload=function(){return function(e,t){200===e.status?t(null,e.responseXML,{byteLength:e.response.length,statusCode:e.status}):Z(e,t,!1)}(i,r)},i.onerror=function(){return Z(i,r,!1)},i.onabort=function(){return Z(i,r,!1)},i.ontimeout=function(){return Z(i,r,!0)},i.send()}catch(e){r(new Error("XHRURLHandler: Unexpected error"))}},supported:function(){return!!$()}},te={get:function(e,t,r){return r||("function"==typeof t&&(r=t),t={}),"undefined"==typeof window||null===window?K.get(e,t,r):ee.supported()?ee.get(e,t,r):r(new Error("Current context is not supported by any of the default URLHandlers. Please provide a custom URLHandler"))}},re=0,ie=0,ne=function(e,t){!e||!t||e<=0||t<=0||(ie=(ie*re+8*e/t)/++re)},ae={ERRORCODE:900,extensions:[]},oe=function(e){l(r,e);var t=p(r);function r(){var e;return n(this,r),(e=t.call(this)).remainingAds=[],e.parentURLs=[],e.errorURLTemplates=[],e.rootErrorURLTemplates=[],e.maxWrapperDepth=null,e.URLTemplateFilters=[],e.fetchingOptions={},e.parsingOptions={},e}return o(r,[{key:"addURLTemplateFilter",value:function(e){"function"==typeof e&&this.URLTemplateFilters.push(e)}},{key:"removeURLTemplateFilter",value:function(){this.URLTemplateFilters.pop()}},{key:"countURLTemplateFilters",value:function(){return this.URLTemplateFilters.length}},{key:"clearURLTemplateFilters",value:function(){this.URLTemplateFilters=[]}},{key:"trackVastError",value:function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];this.emit("VAST-error",Object.assign.apply(Object,[{},ae,t].concat(i))),w.track(e,t)}},{key:"getErrorURLTemplates",value:function(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}},{key:"getEstimatedBitrate",value:function(){return ie}},{key:"fetchVAST",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return new Promise((function(a,o){t.URLTemplateFilters.forEach((function(t){e=t(e)})),t.parentURLs.push(e);var s=Date.now();t.emit("VAST-resolving",{url:e,previousUrl:i,wrapperDepth:r,maxWrapperDepth:t.maxWrapperDepth,timeout:t.fetchingOptions.timeout,wrapperAd:n}),t.urlHandler.get(e,t.fetchingOptions,(function(n,l){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=Math.round(Date.now()-s),d=Object.assign({url:e,previousUrl:i,wrapperDepth:r,error:n,duration:u},c);t.emit("VAST-resolved",d),ne(c.byteLength,u),n?o(n):a(l)}))}))}},{key:"initParsingStatus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.errorURLTemplates=[],this.fetchingOptions={timeout:e.timeout||J,withCredentials:e.withCredentials},this.maxWrapperDepth=e.wrapperLimit||10,this.parentURLs=[],this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.remainingAds=[],this.rootErrorURLTemplates=[],this.rootURL="",this.urlHandler=e.urlHandler||e.urlhandler||te,this.vastVersion=null,ne(e.byteLength,e.requestDuration)}},{key:"getRemainingAds",value:function(e){var t=this;if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));var r=e?w.flatten(this.remainingAds):this.remainingAds.shift();return this.errorURLTemplates=[],this.parentURLs=[],this.resolveAds(r,{wrapperDepth:0,url:this.rootURL}).then((function(e){return t.buildVASTResponse(e)}))}},{key:"getAndParseVAST",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(r),this.URLTemplateFilters.forEach((function(t){e=t(e)})),this.rootURL=e,this.fetchVAST(e).then((function(i){return r.previousUrl=e,r.isRootVAST=!0,r.url=e,t.parse(i,r).then((function(e){return t.buildVASTResponse(e)}))}))}},{key:"parseVAST",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(r),r.isRootVAST=!0,this.parse(e,r).then((function(e){return t.buildVASTResponse(e)}))}},{key:"buildVASTResponse",value:function(e){var t,r={ads:(t={ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion}).ads||[],errorURLTemplates:t.errorURLTemplates||[],version:t.version||null};return this.completeWrapperResolving(r),r}},{key:"parseVastXml",value:function(e,t){var r=t.isRootVAST,i=void 0!==r&&r,n=t.url,a=void 0===n?null:n,o=t.wrapperDepth,s=void 0===o?0:o,l=t.allowMultipleAds,c=t.followAdditionalWrappers;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName)throw this.emit("VAST-ad-parsed",{type:"ERROR",url:a,wrapperDepth:s}),new Error("Invalid VAST XMLDocument");var u=[],d=e.documentElement.childNodes,p=e.documentElement.getAttribute("version");for(var h in i&&p&&(this.vastVersion=p),d){var f=d[h];if("Error"===f.nodeName){var v=N.parseNodeText(f);i?this.rootErrorURLTemplates.push(v):this.errorURLTemplates.push(v)}else if("Ad"===f.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)l=!0;else if(!1===l&&u.length>1)break;var m=W(f,this.emit.bind(this),{allowMultipleAds:l,followAdditionalWrappers:c});m.ad?(u.push(m.ad),this.emit("VAST-ad-parsed",{type:m.type,url:a,wrapperDepth:s,adIndex:u.length-1,vastVersion:p})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return u}},{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.url,i=void 0===r?null:r,n=t.resolveAll,a=void 0===n||n,o=t.wrapperSequence,s=void 0===o?null:o,l=t.previousUrl,c=void 0===l?null:l,u=t.wrapperDepth,d=void 0===u?0:u,p=t.isRootVAST,h=void 0!==p&&p,f=t.followAdditionalWrappers,v=t.allowMultipleAds,m=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&h&&(v=!0);try{m=this.parseVastXml(e,{isRootVAST:h,url:i,wrapperDepth:d,allowMultipleAds:v,followAdditionalWrappers:f})}catch(e){return Promise.reject(e)}return 1===m.length&&null!=s&&(m[0].sequence=s),!1===a&&(this.remainingAds=N.splitVAST(m),m=this.remainingAds.shift()),this.resolveAds(m,{wrapperDepth:d,previousUrl:c,url:i})}},{key:"resolveAds",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0,i=r.wrapperDepth,n=r.previousUrl,a=r.url,o=[];return n=a,t.forEach((function(t){var r=e.resolveWrappers(t,i,n);o.push(r)})),Promise.all(o).then((function(t){var r=w.flatten(t);if(!r&&e.remainingAds.length>0){var o=e.remainingAds.shift();return e.resolveAds(o,{wrapperDepth:i,previousUrl:n,url:a})}return r}))}},{key:"resolveWrappers",value:function(e,t,r){var i=this;return new Promise((function(n){var a;if(t++,!e.nextWrapperURL)return delete e.nextWrapperURL,n(e);if(t>=i.maxWrapperDepth||-1!==i.parentURLs.indexOf(e.nextWrapperURL))return e.errorCode=302,delete e.nextWrapperURL,n(e);e.nextWrapperURL=N.resolveVastAdTagURI(e.nextWrapperURL,r),i.URLTemplateFilters.forEach((function(t){e.nextWrapperURL=t(e.nextWrapperURL)}));var o=null!==(a=i.parsingOptions.allowMultipleAds)&&void 0!==a?a:e.allowMultipleAds,s=e.sequence;i.fetchVAST(e.nextWrapperURL,t,r,e).then((function(a){return i.parse(a,{url:e.nextWrapperURL,previousUrl:r,wrapperSequence:s,wrapperDepth:t,followAdditionalWrappers:e.followAdditionalWrappers,allowMultipleAds:o}).then((function(t){if(delete e.nextWrapperURL,0===t.length)return e.creatives=[],n(e);t.forEach((function(t){t&&N.mergeWrapperAdData(t,e)})),n(t)}))})).catch((function(t){e.errorCode=301,e.errorMessage=t.message,n(e)}))}))}},{key:"completeWrapperResolving",value:function(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(var t=e.ads.length-1;t>=0;t--){var r=e.ads[t];(r.errorCode||0===r.creatives.length)&&(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),e.ads.splice(t,1))}}}]),r}(Y),se=null,le={data:{},length:0,getItem:function(e){return this.data[e]},setItem:function(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem:function(e){delete this.data[e],this.length=Object.keys(this.data).length},clear:function(){this.data={},this.length=0}},ce=function(){function e(){n(this,e),this.storage=this.initStorage()}return o(e,[{key:"initStorage",value:function(){if(se)return se;try{se="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){se=null}return se&&!this.isStorageDisabled(se)||(se=le).clear(),se}},{key:"isStorageDisabled",value:function(e){var t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch(e){return!0}return e.removeItem(t),!1}},{key:"getItem",value:function(e){return this.storage.getItem(e)}},{key:"setItem",value:function(e,t){return this.storage.setItem(e,t)}},{key:"removeItem",value:function(e){return this.storage.removeItem(e)}},{key:"clear",value:function(){return this.storage.clear()}}]),e}(),ue=function(){function e(t,r,i){n(this,e),this.cappingFreeLunch=t||0,this.cappingMinimumTimeInterval=r||0,this.defaultOptions={withCredentials:!1,timeout:0},this.vastParser=new oe,this.storage=i||new ce,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}return o(e,[{key:"getParser",value:function(){return this.vastParser}},{key:"lastSuccessfulAd",get:function(){return this.storage.getItem("vast-client-last-successful-ad")},set:function(e){this.storage.setItem("vast-client-last-successful-ad",e)}},{key:"totalCalls",get:function(){return this.storage.getItem("vast-client-total-calls")},set:function(e){this.storage.setItem("vast-client-total-calls",e)}},{key:"totalCallsTimeout",get:function(){return this.storage.getItem("vast-client-total-calls-timeout")},set:function(e){this.storage.setItem("vast-client-total-calls-timeout",e)}},{key:"hasRemainingAds",value:function(){return this.vastParser.remainingAds.length>0}},{key:"getNextAds",value:function(e){return this.vastParser.getRemainingAds(e)}},{key:"get",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Date.now();return(r=Object.assign({},this.defaultOptions,r)).hasOwnProperty("resolveAll")||(r.resolveAll=!1),this.totalCallsTimeout<i?(this.totalCalls=1,this.totalCallsTimeout=i+36e5):this.totalCalls++,new Promise((function(n,a){if(t.cappingFreeLunch>=t.totalCalls)return a(new Error("VAST call canceled â€“ FreeLunch capping not reached yet ".concat(t.totalCalls,"/").concat(t.cappingFreeLunch)));var o=i-t.lastSuccessfulAd;if(o<0)t.lastSuccessfulAd=0;else if(o<t.cappingMinimumTimeInterval)return a(new Error("VAST call canceled â€“ (".concat(t.cappingMinimumTimeInterval,")ms minimum interval reached")));t.vastParser.getAndParseVAST(e,r).then((function(e){return n(e)})).catch((function(e){return a(e)}))}))}}]),e}(),de=function(e){l(a,e);var t=p(a);function a(e,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;for(var l in n(this,a),(o=t.call(this)).ad=r,o.creative=i,o.variation=s,o.muted=!1,o.impressed=!1,o.skippable=!1,o.trackingEvents={},o.lastPercentage=0,o._alreadyTriggeredQuartiles={},o.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"],o.creative.trackingEvents){var c=o.creative.trackingEvents[l];o.trackingEvents[l]=c.slice(0)}return U(o.creative)?o._initLinearTracking():o._initVariationTracking(),e&&o.on("start",(function(){e.lastSuccessfulAd=Date.now()})),o}return o(a,[{key:"_initLinearTracking",value:function(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}},{key:"_initVariationTracking",value:function(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(var e in this.variation.trackingEvents){var t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}"nonLinearAd"===this.variation.adType?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return"companionAd"===e.adType}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}},{key:"setDuration",value:function(e){w.isValidTimeValue(e)&&(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100})}},{key:"setProgress",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(w.isValidTimeValue(e)&&"object"===i(r)){var n=this.skipDelay||-1;if(-1===n||this.skippable||(n>e?this.emit("skip-countdown",n-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){var a=Math.round(e/this.assetDuration*100),o=[];if(e>0){o.push("start");for(var s=this.lastPercentage;s<a;s++)o.push("progress-".concat(s+1,"%"));for(var l in o.push("progress-".concat(Math.round(e))),this.quartiles)this.isQuartileReached(l,this.quartiles[l],e)&&(o.push(l),this._alreadyTriggeredQuartiles[l]=!0);this.lastPercentage=a}o.forEach((function(e){t.track(e,{macros:r,once:!0})})),e<this.progress&&this.track("rewind",{macros:r})}this.progress=e}}},{key:"isQuartileReached",value:function(e,t,r){var i=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(i=!0),i}},{key:"setMuted",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"===i(t)&&(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e)}},{key:"setPaused",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"===i(t)&&(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e)}},{key:"setFullscreen",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"===i(t)&&(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e)}},{key:"setExpand",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"===i(t)&&(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e)}},{key:"setSkipDelay",value:function(e){w.isValidTimeValue(e)&&(this.skipDelay=e)}},{key:"trackImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&(this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})))}},{key:"error",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"===i(e)&&"boolean"==typeof t&&this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t})}},{key:"errorWithCode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"string"==typeof e&&"boolean"==typeof t&&(this.error({ERRORCODE:e},t),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead"))}},{key:"complete",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&this.track("complete",{macros:e})}},{key:"notUsed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&(this.track("notUsed",{macros:e}),this.trackingEvents=[])}},{key:"otherAdInteraction",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&this.track("otherAdInteraction",{macros:e})}},{key:"acceptInvitation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&this.track("acceptInvitation",{macros:e})}},{key:"adExpand",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&this.track("adExpand",{macros:e})}},{key:"adCollapse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&this.track("adCollapse",{macros:e})}},{key:"minimize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&this.track("minimize",{macros:e})}},{key:"verificationNotExecuted",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e&&"object"===i(t)){if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");var r=this.ad.adVerifications.find((function(t){return t.vendor===e}));if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));var n=r.trackingEvents;if(n&&n.verificationNotExecuted){var a=n.verificationNotExecuted;this.trackURLs(a,t),this.emit("verificationNotExecuted",{trackingURLTemplates:a})}}}},{key:"overlayViewDuration",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&"object"===i(t)&&(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t}))}},{key:"close",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&this.track(this.linear?"closeLinear":"close",{macros:e})}},{key:"skip",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&this.track("skip",{macros:e})}},{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"===i(e)&&this.track("loaded",{macros:e})}},{key:"click",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((null===e||"string"==typeof e)&&"object"===i(t)){this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);var n=this.clickThroughURLTemplate||e,a=r({},t);if(n){this.progress&&(a.ADPLAYHEAD=this.progressFormatted());var o=w.resolveURLTemplates([n],a)[0];this.emit("clickthrough",o)}}}},{key:"track",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.macros,n=void 0===r?{}:r,a=t.once,o=void 0!==a&&a;if("object"===i(n)){"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close");var s=this.trackingEvents[e],l=this.emitAlwaysEvents.indexOf(e)>-1;s?(this.emit(e,{trackingURLTemplates:s}),this.trackURLs(s,n)):l&&this.emit(e,null),o&&(delete this.trackingEvents[e],l&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}}},{key:"trackURLs",value:function(e){var t,i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(a.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(a.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(i=t.universalAdIds)&&void 0!==i&&i.length&&(a.UNIVERSALADID=this.creative.universalAdIds.map((function(e){return e.idRegistry.concat(" ",e.value)})).join(",")),this.ad&&(this.ad.sequence&&(a.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(a.ADTYPE=this.ad.adType),this.ad.adServingId&&(a.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(a.ADCATEGORIES=this.ad.categories.map((function(e){return e.value})).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(a.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories)),w.track(e,a,n)}},{key:"convertToTimecode",value:function(e){if(!w.isValidTimeValue(e))return"";var t=1e3*e,r=Math.floor(t/36e5),i=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(w.addLeadingZeros(r,2),":").concat(w.addLeadingZeros(i,2),":").concat(w.addLeadingZeros(n,2),".").concat(w.addLeadingZeros(a,3))}},{key:"progressFormatted",value:function(){return this.convertToTimecode(this.progress)}}]),a}(Y);e.VASTClient=ue,e.VASTParser=oe,e.VASTTracker=de,Object.defineProperty(e,"__esModule",{value:!0})}(t)},144:(e,t,r)=>{var i,n=void 0!==r.g?r.g:"undefined"!=typeof window?window:{},a=r(893);"undefined"!=typeof document?i=document:(i=n["__GLOBAL_DOCUMENT_CACHE@4"])||(i=n["__GLOBAL_DOCUMENT_CACHE@4"]=a),e.exports=i},908:(e,t,r)=>{var i;i="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{},e.exports=i},596:e=>{"use strict";var t=["handshakeVersion","initAd","startAd","stopAd","skipAd","resizeAd","pauseAd","resumeAd","expandAd","collapseAd","subscribe","unsubscribe"];function r(e,t,r){}r.prototype.handshakeVersion=function(e,t){},r.prototype.initAd=function(e,t,r,i,n,a,o){},r.prototype.startAd=function(e){},r.prototype.stopAd=function(e){},r.prototype.skipAd=function(e){},r.prototype.resizeAd=function(e,t,r,i){},r.prototype.pauseAd=function(e){},r.prototype.resumeAd=function(e){},r.prototype.expandAd=function(e){},r.prototype.collapseAd=function(e){},r.prototype.subscribe=function(e,t,r){},r.prototype.unsubscribe=function(e,t){},r.prototype.getAdLinear=function(e){},r.prototype.getAdWidth=function(e){},r.prototype.getAdHeight=function(e){},r.prototype.getAdExpanded=function(e){},r.prototype.getAdSkippableState=function(e){},r.prototype.getAdRemainingTime=function(e){},r.prototype.getAdDuration=function(e){},r.prototype.getAdVolume=function(e){},r.prototype.getAdCompanions=function(e){},r.prototype.getAdIcons=function(e){},r.prototype.setAdVolume=function(e,t){},n(r,"METHODS",t),n(r,"GETTERS",["getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","getAdVolume","getAdCompanions","getAdIcons"]),n(r,"SETTERS",["setAdVolume"]),n(r,"EVENTS",["AdLoaded","AdStarted","AdStopped","AdSkipped","AdSkippableStateChange","AdSizeChange","AdLinearChange","AdDurationChange","AdExpandedChange","AdRemainingTimeChange","AdVolumeChange","AdImpression","AdVideoStart","AdVideoFirstQuartile","AdVideoMidpoint","AdVideoThirdQuartile","AdVideoComplete","AdClickThru","AdInteraction","AdUserAcceptInvitation","AdUserMinimize","AdUserClose","AdPaused","AdPlaying","AdLog","AdError"]);var i=t.filter((function(e){return-1===["skipAd"].indexOf(e)}));function n(e,t,r){Object.defineProperty(e,t,{writable:!1,configurable:!1,value:r})}n(r,"checkVPAIDInterface",(function(e){return i.every((function(t){return"function"==typeof e[t]}))})),e.exports=r},13:(e,t,r)=>{"use strict";var i=r(596),n=r(437),a=i.checkVPAIDInterface,o=r(77),s=(i.METHODS,"AdClickThru"),l=i.EVENTS.filter((function(e){return e!=s}));function c(e,t,r,i){this._isValid=a(e),this._isValid&&(this._creative=e,this._el=t,this._videoEl=r,this._iframe=i,this._subscribers=new n,o.setFullSizeStyle(t),u.call(this))}function u(){if(l.forEach(function(e){this._creative.subscribe(p.bind(this,e),e)}.bind(this)),this._creative.subscribe(d.bind(this),s),this._videoEl){var e=this._iframe.contentDocument.documentElement,t=this._videoEl;e.addEventListener("click",(function(r){r.target===e&&t.click()}))}}function d(e,t,r){this._subscribers.triggerSync(s,{url:e,id:t,playerHandles:r})}function p(e){this._subscribers.trigger.apply(this._subscribers,Array.prototype.slice.call(arguments))}function h(e,t,r,i){e?e(r,i):r&&t.trigger("AdError",r)}c.prototype=Object.create(i.prototype),c.prototype.isValidVPAIDAd=function(){return this._isValid},i.METHODS.forEach((function(e){-1===["subscribe","unsubscribe","initAd"].indexOf(e)&&(c.prototype[e]=function(){var t=i.prototype[e].length,r=Array.prototype.slice.call(arguments),n=t===r.length?r.pop():void 0;setTimeout(function(){var t,i=null;try{t=this._creative[e].apply(this._creative,r)}catch(e){i=e}h(n,this._subscribers,i,t)}.bind(this),0)})})),c.prototype.initAd=function(e,t,r,i,n,a,s){n=n||{},a=o.extend({slot:this._el,videoSlot:this._videoEl},a||{}),setTimeout(function(){var o;try{this._creative.initAd(e,t,r,i,n,a)}catch(e){o=e}h(s,this._subscribers,o)}.bind(this),0)},c.prototype.subscribe=function(e,t,r){this._subscribers.subscribe(t,e,r)},c.prototype.unsubscribe=function(e,t){this._subscribers.unsubscribe(t,e)},c.prototype.on=c.prototype.subscribe,c.prototype.off=c.prototype.unsubscribe,i.GETTERS.forEach((function(e){c.prototype[e]=function(t){setTimeout(function(){var r,i=null;try{r=this._creative[e]()}catch(e){i=e}h(t,this._subscribers,i,r)}.bind(this),0)}})),c.prototype.setAdVolume=function(e,t){setTimeout(function(){var r,i=null;try{this._creative.setAdVolume(e),r=this._creative.getAdVolume()}catch(e){i=e}i||(i=o.validate(r===e,"failed to apply volume: "+e)),h(t,this._subscribers,i,r)}.bind(this),0)},c.prototype._destroy=function(){this.stopAd(),this._subscribers.unsubscribeAll()},e.exports=c},178:(e,t,r)=>{"use strict";var i=r(77),n=i.unique("vpaidIframe"),a=r(13);function o(e,t,r,a){r=r||{},this._id=n(),this._destroyed=!1,this._frameContainer=i.createElementInEl(e,"div"),this._videoEl=t,this._vpaidOptions=a||{timeout:1e4},this._templateConfig={template:r.template||'<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"></head><body style="margin:0;padding:0"><div class="ad-element"></div><script type="text/javascript" src="{{iframeURL_JS}}"><\/script><script type="text/javascript">window.parent.postMessage(\'{"event": "ready", "id": "{{iframeID}}"}\', \'{{origin}}\');<\/script></body></html>',extraOptions:r.extraOptions||{}}}function s(e){var t=this[e];t&&t.parentNode&&(t.parentNode.removeChild(t),delete this[e])}function l(){u.call(this),delete this._adUnit}function c(){u.call(this),p.call(this)}function u(){s.call(this,"_frame"),d.call(this)}function d(){this._onLoad&&(window.removeEventListener("message",this._onLoad),delete this._onLoad)}function p(){this._adUnit&&(this._adUnit.stopAd(),delete this._adUnit)}function h(){if(this._destroyed)throw new Error("VPAIDHTML5Client already destroyed!")}function f(){return window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}o.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,c.call(this))},o.prototype.isDestroyed=function(){return this._destroyed},o.prototype.loadAdUnit=function(e,t){if(!this._onLoad){h.call(this),c.call(this);var r=this,n=i.createIframeWithContent(this._frameContainer,this._templateConfig.template,i.extend({iframeURL_JS:e,iframeID:this.getID(),origin:f()},this._templateConfig.extraOptions));this._frame=n,this._onLoad=i.callbackTimeout(this._vpaidOptions.timeout,function(e){if(e.origin!==f())return;var n,o,s,c;try{n=JSON.parse(e.data)}catch(e){throw e}if(n.id!==r.getID())return;r._frame.contentWindow?(c=r._frame.contentWindow.getVPAIDAd,s=i.validate("function"==typeof c,"the ad didn't return a function to create an ad")):s="the iframe is not anymore in the DOM tree";if(!s){var u=r._frame.contentWindow.document.querySelector(".ad-element");(o=new a(c(),u,r._videoEl,r._frame)).subscribe("AdStopped",l.bind(r)),s=i.validate(o.isValidVPAIDAd(),"the add is not fully complaint with VPAID specification")}return r._adUnit=o,d.call(r),t(s,s?null:o),!0}.bind(this),function(){t("timeout",null)}.bind(this)),window.addEventListener("message",this._onLoad)}},o.prototype.unloadAdUnit=function(){c.call(this)},o.prototype.getID=function(){return this._id},e.exports=o,window.VPAIDHTML5Client=o},437:e=>{"use strict";function t(){this._subscribers={}}t.prototype.subscribe=function(e,t,r){this.isHandlerAttached(e,t)||this.get(t).push({handler:e,context:r,eventName:t})},t.prototype.unsubscribe=function(e,t){this._subscribers[t]=this.get(t).filter((function(t){return e!==t.handler}))},t.prototype.unsubscribeAll=function(){this._subscribers={}},t.prototype.trigger=function(e,t){var r=this;this.get(e).concat(this.get("*")).forEach((function(e){setTimeout((function(){r.isHandlerAttached(e.handler,e.eventName)&&e.handler.call(e.context,t)}),0)}))},t.prototype.triggerSync=function(e,t){this.get(e).concat(this.get("*")).forEach((function(e){e.handler.call(e.context,t)}))},t.prototype.get=function(e){return this._subscribers[e]||(this._subscribers[e]=[]),this._subscribers[e]},t.prototype.isHandlerAttached=function(e,t){return this.get(t).some((function(t){return e===t.handler}))},e.exports=t},77:e=>{"use strict";function t(){}function r(e,t,r){var n=document.createElement("iframe");return n.src=t||"about:blank",n.marginWidth="0",n.marginHeight="0",n.frameBorder="0",n.width="100%",n.height="100%",i(n),r&&(n.style.zIndex=r),n.setAttribute("SCROLLING","NO"),e.innerHTML="",e.appendChild(n),n}function i(e){e&&(e.style.position="absolute",e.style.left="0",e.style.top="0",e.style.margin="0px",e.style.padding="0px",e.style.border="none",e.style.width="100%",e.style.height="100%")}function n(e,t){return Object.keys(t).forEach((function(r){var i="object"==typeof i?JSON.stringify(t[r]):t[r];e=e.replace(new RegExp("{{"+r+"}}","g"),i)})),e}function a(e,t){var r=e.contentWindow&&e.contentWindow.document;return!!r&&(r.write(t),!0)}e.exports={noop:t,validate:function(e,t){return e?null:new Error(t)},callbackTimeout:function(e,r,i){var n;return n=setTimeout((function(){r=t,i()}),e),function(){var e=Array.prototype.slice.call(arguments);r.apply(this,e)&&clearTimeout(n)}},createElementInEl:function(e,t,r){var i=document.createElement(t);return r&&(i.id=r),e.appendChild(i),i},createIframeWithContent:function(e,t,i){var o=r(e,null,i.zIndex);if(a(o,n(t,i)))return o},createIframe:r,setFullSizeStyle:i,simpleTemplate:n,setIframeContent:a,extend:function(e,t){return Object.keys(t).forEach((function(r){e[r]=t[r]})),e},unique:function(e){var t=-1;return function(){return e+"_"+ ++t}}}},893:()=>{}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=videojs;var t=r.n(e),i=r(248),n=r(144),a=r.n(n),o=r(908),s=r.n(o);class l extends t().EventTarget{constructor(e,t){super(),this.player=e,this.options=t,this.duration=0,this.originalState={controlsEnabled:e.controls(),seekEnabled:e.controlBar.progressControl.enabled()}}setUp(){const e=this.player,t=this.options;e.controls(t.controlsEnabled),t.seekEnabled?e.controlBar.progressControl.enable():e.controlBar.progressControl.disable(),(()=>{const t=this.blocker=s().document.createElement("div");t.className="vast-blocker",t.onclick=()=>{if(e.paused())return e.play(),!1;this.trigger("click")},e.el().insertBefore(t,e.controlBar.el())})(),(()=>{const t=this.skipButtonElement=s().document.createElement("div");t.className="vast-skip-button",t.style.display="none",e.el().appendChild(t),e.one("adplay",this.#e),t.onclick=e=>{if((" "+t.className+" ").indexOf(" enabled ")>=0&&this.trigger("skip"),void 0===s().Event.prototype.stopPropagation)return!1;e.stopPropagation()}})()}tearDown(){const e=this.player,t=this.originalState;e.controls(t.controlsEnabled),t.seekEnabled?e.controlBar.progressControl.enable():e.controlBar.progressControl.disable(),this.blocker.parentElement.removeChild(this.blocker),this.skipButtonElement.parentElement.removeChild(this.skipButtonElement),e.off("adtimeupdate",this.#t),e.off("adplay",this.#e)}#e=()=>{const e=this.options.skip,t=this.player;e>0&&(t.duration()||this.duration)>=e&&(this.skipButtonElement.style.display="block",t.on("adtimeupdate",this.#t)),t.loadingSpinner.el().style.display="none"};#t=()=>{this.player.loadingSpinner.el().style.display="none";const e=Math.ceil(this.options.skip-this.player.currentTime());var t;e>0?(c(t=this.skipButtonElement)&&(t.className=t.className.replace(" enabled ","")),this.skipButtonElement.innerHTML="Skip in "+e+"..."):(!function(e){c(e)||(e.className+=" enabled ")}(this.skipButtonElement),this.skipButtonElement.innerHTML="Skip")}}function c(e){return(" "+e.className+" ").indexOf(" enabled ")>-1}function u(e){return"linear"===e.type&&e.mediaFiles.length}function d(e){return"companion"===e.type}class p{#r;#i;#n;constructor(e,t){this.#r=e,this.#i=t,this.#n=!1}get linearCreative(){return this.#r.creative}get linearAdTracker(){return this.#r}get companionTracker(){return this.#i}get skipAfterDuration(){return this.#n}set skipAfterDuration(e){this.#n=e}hasVideoMedia(){return this.linearCreative.mediaFiles.some((e=>e&&null==e.apiFramework))}}class h{#a;#o;#s;#l;constructor(e,t,r,i){this.#a=e,this.#o=t,this.#l=r,this.#s=i}loadAds(){return new Promise(((e,t)=>{const{url:r,xml:i}=this.#s;if(!r&&!i)throw new Error("xml or url option must be set");(r?this.loadAdsWithUrl(r):this.loadAdsWithXml(i)).then(e).catch(t)}))}loadAdsWithXml(e){return new Promise(((t,r)=>{let i;if(e.constructor===s().XMLDocument)i=e;else{if(e.constructor!==String)throw new Error("xml config option must be a String or XMLDocument");i=(new(s().DOMParser)).parseFromString(e,"text/xml")}this.#o.parseVAST(i).then(this.#l.selectAds).then(this.#c).then(t).catch(r)}))}loadAdsWithUrl(e){return new Promise(((t,r)=>{this.#a.get(e,{withCredentials:this.#s.withCredentials,wrapperLimit:this.#s.wrapperLimit}).then(this.#l.selectAds).then(this.#c).then(t).catch(r)}))}#c=e=>e.map((e=>{const t=new i.VASTTracker(this.#a,e,e.creatives.find(u),e.creatives.find(d));t.on("clickthrough",f);let r=null;const n=e.creatives.find(d);if(n){const t=this.#s,a=n.variations.filter((e=>e.staticResource)).filter((e=>0===e.type.indexOf("image"))).find((e=>parseInt(e.width,10)<=t.companion.maxWidth&&parseInt(e.height,10)<=t.companion.maxHeight));a&&(r=new i.VASTTracker(this.#a,e,n,a),r.on("clickthrough",f))}return new p(t,r)}))}function f(e){s().open(e,"_blank")}class v{selectAds(e){if(!e.ads||0===e.ads.length)throw new Error("no ads found in VAST");const t=e.ads.filter((e=>e.creatives.some(u)));if(!t.length)throw new Error("no linear ads found in VAST");const r=t.filter((e=>e.sequence));if(r.length)return r.sort(((e,t)=>e.sequence-t.sequence));return t.filter((e=>!r.includes(e))).slice(0,1)}}var m=r(178),g=r.n(m);function y(e){if(e){const t=e.ad,r=e.creative;return{mediaFiles:r.mediaFiles.map((e=>Object.assign({},e))),adSequenceId:t.sequence,adId:t.id,creativeAdId:r.id}}}const A=["application/x-javascript","text/javascript","application/javascript"];class T{#u;#d;#p;#h;#s;#f;constructor(e,t){this.#h=e,this.#s=t,this.#f=new videojs.EventTarget}handle(e){return this.#d=!1,this.#p=!1,this.#u=!1,new Promise(((t,r)=>{const i=this.#s,n=this.#h;let o=null,l={},c=!1;const u=e.creative,d=u.mediaFiles.find((e=>"VPAID"===e.apiFramework&&function(e){return A.indexOf(e.mimeType.trim())>-1}(e)));if(!d)throw new Error("Invalid VPAID media file: only JavaScript is supported");const p=n.el().querySelector(".vjs-tech");o=function(e){const t=e.vpaid.containerId,r=e.vpaid.containerClass;let i=a().getElementById(t);i||(i=a().getElementsByClassName(r)[0]);return i}(i),o?c=!0:(o=function(e){const t=e.vpaid.containerId,r=e.vpaid.containerClass,i=a().createElement("div");t&&i.setAttribute("id",t);r&&i.classList.add(r);return i}(i),c=!1),l=b(o),n.el().insertBefore(o,n.controlBar.el());const h=new(g())(o,p,{});h.loadAdUnit(d.fileURL,((a,d)=>{let p;if(a)return void r(a);const f=()=>{m(),t(),n.trigger("vpaid.AdStopped"),n.trigger({type:"vast.adEnd",vast:y(e)})};d.subscribe("AdStopped",f);const v=e=>{if(d&&!this.#u){d.unsubscribe("AdStopped",f);const t=()=>{this.#u=!0,m(),r(e),n.trigger("vpaid.AdStopped")};E(d,"AdStopped",t,t),d.stopAd()}else this.#u=!0,r(e)};if(this.#f.on("forceStopAd",v),this.#d)return void v("Received cancel signal from player");function m(){if(n.controlBar.show(),n.off("playerresize",T),"new"===i.vpaid.videoInstance&&p.parentElement&&p.parentElement.removeChild(p),h.destroy(),o){if(c){o.innerHTML="";const e=l,t=b(o);for(const[r,i]of Object.entries(t))e.hasOwnProperty(r)?e[r]!==i&&o.setAttribute(r,e[r]):o.removeAttribute(r);for(const[r,i]of Object.entries(e))t.hasOwnProperty(r)||o.setAttribute(r,i)}else o.parentElement&&o.parentElement.removeChild(o);o=null}}const g=()=>{if(this.#d)return void v("Received cancel signal");d.subscribe("AdSkipped",(()=>{e.skip(),n.trigger("vpaid.AdSkipped"),n.trigger({type:"vast.adSkip",vast:y(e)})})),d.subscribe("AdVolumeChange",(()=>{const t=n.volume();d.getAdVolume(((r,i)=>{r||(0===i&&t>0?e.setMuted(!0):i>0&&0===t&&e.setMuted(!1),n.volume(i),n.trigger("vpaid.AdVolumeChange"))}))})),d.subscribe("AdImpression",(()=>{e.trackImpression(),n.trigger("vpaid.AdImpression")})),d.subscribe("AdClickThru",((t,r,i)=>{i&&e.once("clickthrough",(e=>{s().open(e,"_blank")})),e.click(t),n.trigger("vpaid.AdClickThru")})),d.subscribe("AdVideoFirstQuartile",(()=>{e.track("firstQuartile"),n.trigger("vpaid.AdVideoFirstQuartile")})),d.subscribe("AdVideoMidpoint",(()=>{e.track("midpoint"),n.trigger("vpaid.AdVideoMidpoint")})),d.subscribe("AdVideoThirdQuartile",(()=>{e.track("thirdQuartile"),n.trigger("vpaid.AdVideoThirdQuartile")})),d.subscribe("AdVideoComplete",(()=>{e.track("complete"),n.trigger("vpaid.AdVideoComplete")})),d.subscribe("AdUserAcceptInvitation",(()=>{e.acceptInvitation(),n.trigger("vpaid.AdUserAcceptInvitation")})),d.subscribe("AdUserMinimize",(()=>{e.minimize(),n.trigger("vpaid.AdUserMinimize")})),d.subscribe("AdUserClose",(()=>{e.close(),n.trigger("vpaid.AdUserClose")})),d.subscribe("AdPaused",(()=>{e.setPaused(!0),n.trigger("vpaid.AdPaused")})),d.subscribe("AdPlaying",(()=>{e.setPaused(!1),n.trigger("vpaid.AdPlaying")})),d.getAdLinear(k(((e,r)=>{this.#d?v("Received cancel signal"):e?v(e):r?t():v("Non-linear not supported")}),(()=>{v("Unable to get mode of operation: linear or non-linear")})));const t=()=>{n.controlBar.hide();const e=function(e,t=null){let r;return function(){return e&&(r=e.apply(t||this,arguments),e=null),r}}(A);E(d,"AdStarted",e,v),d.startAd()}},A=()=>{this.#d?v("Received cancel signal"):(this.#p=!0,e.track("start"),n.on("playerresize",T),n.trigger("ads-ad-started"),n.trigger({type:"vast.adStart",vast:y(e)}))},T=()=>{d.resizeAd(n.currentWidth(),n.currentHeight(),n.isFullscreen()?"fullscreen":"normal")};d.handshakeVersion("2.0",((t,a)=>{if(t)return log.console(t),void v("Error on VPAID handshake");const l={AdParameters:u.adParameters||""},c=i.vpaid.videoInstance;"same"===c?p=n.tech({kindaKnowWhatImDoing:!0}).el():"new"===c?(p=s().document.createElement("video"),p.style.cssText="position:absolute; top:0; left:0; z-index:2 !important;",o.appendChild(p)):("none"!==c&&console.log(`${c} is an invalid videoInstance value. Defaulting to 'none'.`),p=null);const h={slot:o,videoSlot:p};E(d,"AdLoaded",g,v);const f=n.isFullscreen()?"fullscreen":"normal";d.subscribe("AdError",(t=>{e.error({ERRORCODE:901}),this.#u=!0,m(),r(`Fatal VPAID Error: ${"object"==typeof t?JSON.stringify(t):t}`),n.trigger({type:"vpaid.AdError",error:t})})),d.initAd(n.currentWidth(),n.currentHeight(),f,-1,l,h)}))}))}))}cancel(){this.#d=!0,this.#p&&this.#f.trigger("forceStopAd")}}function b(e){const t={};for(const r of e.attributes)t[r.name]=r.value;return t}function k(e,t=null){const r=setTimeout((()=>{e=()=>{},t&&t()}),1e4);return function(){clearTimeout(r),e.apply(null,arguments)}}function E(e,t,r,i){const n=k(r,(()=>{i&&i(new Error(`Timeout while waiting for ${t} event.`))}));e.subscribe(t,n)}const R=t().getPlugin("plugin"),w=Object.freeze({seekEnabled:!1,controlsEnabled:!1,wrapperLimit:10,withCredentials:!0,skip:0,vpaid:{containerId:void 0,containerClass:"vjs-vpaid-container",videoInstance:"none"},companion:{elementId:null,maxWidth:0,maxHeight:0}});t().registerPlugin("vast",class extends R{constructor(e,r){super(e),"function"==typeof e.ads&&e.ads({debug:!1,liveCuePoints:!1}),console.log("videojsx-vast-plugin running"),r=t().mergeOptions(w,r||{});const n=new i.VASTClient,o=[];let s=null,c=-1;const u=new T(e,r);let d=!1;const p=e.autoplay();e.on("adtimeout",(()=>{d=!0}));const f=new l(e,r);function m(){s?.hasVideoMedia()&&(s.linearAdTracker.skip(),e.trigger({type:"vast.skipAd",vast:y(s.linearAdTracker)}),A())}f.on("skip",m),f.on("click",(()=>{s.linearAdTracker.click()})),e.on("readyforpreroll",(()=>{R()}));new h(n,new i.VASTParser,new v,r).loadAds().then((t=>{if(d)throw new Error("Ad load took too long.");o.push(...t),s=null,e.trigger("adsready")})).catch((t=>{console.log(`Ad cancelled: ${t.message}`),e.trigger("nopreroll")})).finally((()=>{p&&e.play()}));const g=e=>e.filter((e=>null==e.apiFramework)).map((e=>({type:e.mimeType,src:e.fileURL}))),A=()=>{const t=o[c+1];if(t?.hasVideoMedia()?s?.hasVideoMedia()||f.setUp():s?.hasVideoMedia()&&f.tearDown(),t){if(s=t,c++,console.log(`Playing ad ${c+1}/${o.length}`),s.hasVideoMedia()){const t=s.linearCreative.mediaFiles,r=t.filter((e=>"streaming"===e.deliveryType)),i=t.filter((e=>"streaming"!==e.deliveryType));if(i.length>0)e.src(g(i));else if(r.length>0){let t=s.linearAdTracker.assetDuration;if(null==t||t<1)return console.log("Streaming ads must have a duration"),void A();e.src(g(r)),s.skipAfterDuration=!0}f.duration=s.linearAdTracker.assetDuration||0}else u.handle(s.linearAdTracker).then((()=>{A()})).catch((e=>{console.log(e),A()}));E()}else s=null,c=-1,L()},{setUpEvents:b,tearDownEvents:k}=(()=>{const t=()=>{if(s.skipAfterDuration){const e=s;setTimeout((()=>{s===e&&m()}),1e3*e.linearAdTracker.assetDuration)}!s.linearAdTracker.impressed&&s.hasVideoMedia()&&(s.linearAdTracker.trackImpression(),e.trigger({type:"vast.adStart",vast:y(s.linearAdTracker)}))},r=()=>{s&&(isNaN(s.linearAdTracker.assetDuration)&&(s.linearAdTracker.assetDuration=e.duration()),s.linearAdTracker.setProgress(e.currentTime()))},i=()=>{e.remainingTime()>0&&(s.linearAdTracker.setPaused(!0),e.one("adplay",(()=>{s.linearAdTracker.setPaused(!1)})))},n=()=>{s.linearAdTracker.error({ERRORCODE:405}),e.error(null),A()},a=()=>{s.linearAdTracker.setFullscreen(e.isFullscreen())},o=(()=>{let t=e.muted(),r=e.volume();return()=>{const i=e.volume(),n=e.muted();t!==n?(s.linearAdTracker.setMuted(n),t=n):r!==i&&(r>0&&0===i?s.linearAdTracker.setMuted(!0):0===r&&i>0&&s.linearAdTracker.setMuted(!1),r=i)}})(),l=()=>{s.hasVideoMedia()&&(s.linearAdTracker.complete(),e.trigger({type:"vast.adEnd",vast:y(s.linearAdTracker)}),A())};return{setUpEvents:()=>{e.on("adended",l),e.on("adplay",t),e.on("adtimeupdate",r),e.on("adpause",i),e.on("aderror",n),e.on("advolumechange",o),e.on("fullscreenchange",a)},tearDownEvents:()=>{e.off("adended",l),e.off("adplay",t),e.off("adtimeupdate",r),e.off("adpause",i),e.off("aderror",n),e.off("advolumechange",o),e.off("fullscreenchange",a)}}})(),E=()=>{const e=s.companionTracker,t=a().getElementById(r.companion.elementId);if(e&&e.variation&&t){const r=e.variation,i=()=>{e.click()},n=a().createElement("a");n.src="#",n.addEventListener("click",i);const o=a().createElement("img");o.src=r.staticResource,n.appendChild(o),t.innerHTML="",t.appendChild(n)}else t&&(t.innerHTML="")},R=()=>{console.log(`Playing ${o.length} ads`),e.ads.startLinearAdMode(),b(),A()},L=()=>{e.ads.endLinearAdMode(),k(),console.log("Playing content")}}})})()})();
