diff --git a/lib/classes/filetypes.php b/lib/classes/filetypes.php index 2d05dbe1b92..f976e9b91ec 100644 --- a/lib/classes/filetypes.php +++ b/lib/classes/filetypes.php @@ -152,6 +152,8 @@ abstract class core_filetypes { 'mw' => array('type' => 'application/maple', 'icon' => 'math'), 'mws' => array('type' => 'application/maple', 'icon' => 'math'), 'm3u' => array('type' => 'audio/x-mpegurl', 'icon' => 'mp3', 'groups' => array('audio'), 'string' => 'audio'), + 'm3u8' => array('type' => 'application/x-mpegURL', 'icon' => 'mpeg', + 'groups' => array('video', 'web_video'), 'string' => 'video'), 'mp3' => array('type' => 'audio/mp3', 'icon' => 'mp3', 'groups' => array('audio', 'html_audio', 'web_audio'), 'string' => 'audio'), 'mp4' => array('type' => 'video/mp4', 'icon' => 'mpeg', 'groups' => array('html_video', 'video', 'web_video'), @@ -162,6 +164,8 @@ abstract class core_filetypes { 'string' => 'audio'), 'mpeg' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'), 'string' => 'video'), + 'mpd' => array('type' => 'application/dash+xml', 'icon' => 'mpeg', + 'groups' => array('video', 'web_video'), 'string' => 'video'), 'mpe' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'), 'string' => 'video'), 'mpg' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'), diff --git a/lib/classes/useragent.php b/lib/classes/useragent.php index 763543b77f0..a20f1c1a6a6 100644 --- a/lib/classes/useragent.php +++ b/lib/classes/useragent.php @@ -1165,4 +1165,39 @@ class core_useragent { return true; } + + /** + * Checks if current browser supports the HLS and MPEG-DASH video + * streaming formats. Most browsers get this from Media Source Extensions. + * Safari on iOS, doesn't support MPEG-DASH at all. + * + * Note, the check here is not 100% accurate! + * + * Also we assume that users of Firefox/Chrome/Safari do not use the ancient versions of browsers. + * + * We check the exact version for IE/Edge though. We know that there are still users of very old + * versions that are afraid to upgrade or have slow IT department. + * + * Resources: + * https://developer.mozilla.org/en-US/docs/Web/API/Media_Source_Extensions_API + * https://caniuse.com/#search=mpeg-dash + * https://caniuse.com/#search=hls + * + * @return bool + */ + public static function supports_media_source_extensions(string $extension) : bool { + // Not supported in IE below 11.0. + if (self::is_ie() && !self::check_ie_version('11.0')) { + return false; + } + + if ($extension == '.mpd') { + // Not supported is iOS on Safari. + if (self::is_safari_ios()) { + return false; + } + } + + return true; + } } diff --git a/media/player/videojs/amd/build/video-lazy.min.js b/media/player/videojs/amd/build/video-lazy.min.js index 25f9536f96e..38921dde5f1 100644 --- a/media/player/videojs/amd/build/video-lazy.min.js +++ b/media/player/videojs/amd/build/video-lazy.min.js @@ -1,2 +1,2 @@ -function _typeof(e){if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(e){return typeof e}}else{_typeof=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(e)}(function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t(require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define ("media_videojs/video-lazy",["./window","./document"],t):(e=e||self,e.videojs=t(e.window,e.document))})(this,function(e,t){e=e&&e.hasOwnProperty("default")?e["default"]:e;t=t&&t.hasOwnProperty("default")?t["default"]:t;function a(e,t){e.prototype=Object.create(t.prototype);e.prototype.constructor=e;e.__proto__=t}function n(e,t){n=Object.setPrototypeOf||function(e,t){e.__proto__=t;return e};return n(e,t)}function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(t){return!1}}function s(){if(r()){s=Reflect.construct}else{s=function(e,t,r){var i=[null];i.push.apply(i,t);var a=Function.bind.apply(e,i),s=new a;if(r)n(s,r.prototype);return s}}return s.apply(null,arguments)}function o(e){if(void 0===e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function d(e,t){if(!t){t=e.slice(0)}e.raw=t;return e}var kt=[],Ct=function(t,a){return function(n,r,i){var s=a.levels[r],o=new RegExp("^("+s+")$");if("log"!==n){i.unshift(n.toUpperCase()+":")}i.unshift(t+":");if(kt){kt.push([].concat(i))}if(!e.console){return}var d=e.console[n];if(!d&&"debug"===n){d=e.console.info||e.console.log}if(!d||!s||!o.test(n)){return}d[Array.isArray(i)?"apply":"call"](e.console,i)}};function l(e){var t="info",a,n=function(){for(var e=arguments.length,n=Array(e),r=0;r=Object.getOwnPropertyNames(a.handlers).length){delete a.handlers;delete a.dispatcher;delete a.disabled}if(0===Object.getOwnPropertyNames(a).length){J(e)}}function ee(e,t,a,n){a.forEach(function(a){e(t,a,n)})}function te(a){function n(){return!0}function r(){return!1}if(!a||!a.isPropagationStopped){var i=a||e.event;a={};for(var s in i){if("layerX"!=s&&"layerY"!=s&&"keyLocation"!=s&&"webkitMovementX"!=s&&"webkitMovementY"!=s){if(!("returnValue"==s&&i.preventDefault)){a[s]=i[s]}}}if(!a.target){a.target=a.srcElement||t}if(!a.relatedTarget){a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement}a.preventDefault=function(){if(i.preventDefault){i.preventDefault()}a.returnValue=!1;i.returnValue=!1;a.defaultPrevented=!0};a.defaultPrevented=!1;a.stopPropagation=function(){if(i.stopPropagation){i.stopPropagation()}a.cancelBubble=!0;i.cancelBubble=!0;a.isPropagationStopped=n};a.isPropagationStopped=r;a.stopImmediatePropagation=function(){if(i.stopImmediatePropagation){i.stopImmediatePropagation()}a.isImmediatePropagationStopped=n;a.stopPropagation()};a.isImmediatePropagationStopped=r;if(null!==a.clientX&&a.clientX!==void 0){var o=t.documentElement,d=t.body;a.pageX=a.clientX+(o&&o.scrollLeft||d&&d.scrollLeft||0)-(o&&o.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(o&&o.scrollTop||d&&d.scrollTop||0)-(o&&o.clientTop||d&&d.clientTop||0)}a.which=a.charCode||a.keyCode;if(null!==a.button&&a.button!==void 0){a.button=1&a.button?0:4&a.button?1:2&a.button?2:0}}return a}var Rt=!1;(function(){try{var t=Object.defineProperty({},"passive",{get:function(){Rt=!0}});e.addEventListener("test",null,t);e.removeEventListener("test",null,t)}catch(t){}})();var Mt=["touchstart","touchmove"];function ae(e,t,a){if(Array.isArray(t)){return ee(ae,e,t,a)}var r=X(e);if(!r.handlers){r.handlers={}}if(!r.handlers[t]){r.handlers[t]=[]}if(!a.guid){a.guid=Y()}r.handlers[t].push(a);if(!r.dispatcher){r.disabled=!1;r.dispatcher=function(t,a){if(r.disabled){return}t=te(t);var i=r.handlers[t.type];if(i){for(var s=i.slice(0),o=0,d=s.length;o=t){e.apply(void 0,arguments);a=n}};return n},Gt=function(t,a,n,r){if(void 0===r){r=e}var i,s=function(){r.clearTimeout(i);i=null},o=function(){var e=this,s=arguments,o=function(){i=null;o=null;if(!n){t.apply(e,s)}};if(!i&&n){t.apply(e,s)}r.clearTimeout(i);i=r.setTimeout(o,a)};o.cancel=s;return o},Wt=function(){};Wt.prototype.allowedEvents_={};Wt.prototype.on=function(e,t){var a=this.addEventListener;this.addEventListener=function(){};ae(this,e,t);this.addEventListener=a};Wt.prototype.addEventListener=Wt.prototype.on;Wt.prototype.off=function(e,t){ne(this,e,t)};Wt.prototype.removeEventListener=Wt.prototype.off;Wt.prototype.one=function(e,t){var a=this.addEventListener;this.addEventListener=function(){};ie(this,e,t);this.addEventListener=a};Wt.prototype.trigger=function(e){var t=e.type||e;if("string"==typeof e){e={type:t}}e=te(e);if(this.allowedEvents_[t]&&this["on"+t]){this["on"+t](e)}re(this,e)};Wt.prototype.dispatchEvent=Wt.prototype.trigger;var Kt;Wt.prototype.queueTrigger=function(t){var a=this;if(!Kt){Kt=new Map}var n=t.type||t,r=Kt.get(this);if(!r){r=new Map;Kt.set(this,r)}var i=r.get(n);r.delete(n);e.clearTimeout(i);var s=e.setTimeout(function(){if(0===r.size){r=null;Kt.delete(a)}a.trigger(t)},0);r.set(n,s)};var Yt=function(e){return e instanceof Wt||!!e.eventBusEl_&&["on","one","off","trigger"].every(function(t){return"function"==typeof e[t]})},Xt=function(e,t){if(Yt(e)){t()}else{if(!e.eventedCallbacks){e.eventedCallbacks=[]}e.eventedCallbacks.push(t)}},$t=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},Qt=function(e){if(!e.nodeName&&!Yt(e)){throw new Error("Invalid target; must be a DOM node or evented object.")}},Jt=function(e){if(!$t(e)){throw new Error("Invalid event type; must be a non-empty string or array.")}},Zt=function(e){if("function"!=typeof e){throw new Error("Invalid listener; must be a function.")}},ea=function(e,t){var a=3>t.length||t[0]===e||t[0]===e.eventBusEl_,n,r,i;if(a){n=e.eventBusEl_;if(3<=t.length){t.shift()}r=t[0];i=t[1]}else{n=t[0];r=t[1];i=t[2]}Qt(n);Jt(r);Zt(i);i=qt(e,i);return{isTargetingSelf:a,target:n,type:r,listener:i}},ta=function(e,t,a,n){Qt(e);if(e.nodeName){Bt[t](e,a,n)}else{e[t](a,n)}},aa={on:function(){for(var e=this,t=arguments.length,a=Array(t),n=0;n10){a=!1}}});var n=function(){a=!1};this.on("touchleave",n);this.on("touchcancel",n);this.on("touchend",function(n){t=null;if(!0===a){var r=new Date().getTime()-e;if(r<200){n.preventDefault();this.trigger("tap")}}})};a.enableTouchActivity=function(){if(!this.player()||!this.player().reportUserActivity){return}var e=qt(this.player(),this.player().reportUserActivity),t;this.on("touchstart",function(){e();this.clearInterval(t);t=this.setInterval(e,250)});var a=function(){e();this.clearInterval(t)};this.on("touchmove",e);this.on("touchend",a);this.on("touchcancel",a)};a.setTimeout=function(t,a){var n=this,r,i;t=qt(this,t);r=e.setTimeout(function(){n.off("dispose",i);t()},a);i=function(){return n.clearTimeout(r)};i.guid="vjs-timeout-"+r;this.on("dispose",i);return r};a.clearTimeout=function(t){e.clearTimeout(t);var a=function(){};a.guid="vjs-timeout-"+t;this.off("dispose",a);return t};a.setInterval=function(t,a){var n=this;t=qt(this,t);var r=e.setInterval(t,a),i=function(){return n.clearInterval(r)};i.guid="vjs-interval-"+r;this.on("dispose",i);return r};a.clearInterval=function(t){e.clearInterval(t);var a=function(){};a.guid="vjs-interval-"+t;this.off("dispose",a);return t};a.requestAnimationFrame=function(t){var a=this,n,r;if(this.supportsRaf_){t=qt(this,t);n=e.requestAnimationFrame(function(){a.off("dispose",r);t()});r=function(){return a.cancelAnimationFrame(n)};r.guid="vjs-raf-"+n;this.on("dispose",r);return n}return this.setTimeout(t,1e3/60)};a.cancelAnimationFrame=function(t){if(this.supportsRaf_){e.cancelAnimationFrame(t);var a=function(){};a.guid="vjs-raf-"+t;this.off("dispose",a);return t}return this.clearTimeout(t)};t.registerComponent=function(e,a){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(a),i=t===a||t.prototype.isPrototypeOf(a.prototype);if(r||!i){var s;if(r){s="techs must be registered using Tech.registerTech()"}else{s="must be a Component subclass"}throw new Error("Illegal component, \""+e+"\"; "+s+".")}e=le(e);if(!t.components_){t.components_={}}var o=t.getComponent("Player");if("Player"===e&&o&&o.players){var d=o.players,l=Object.keys(d);if(d&&0ga&&537>oa,ya=/Firefox/i.test(ia),_a=/Edge/i.test(ia),fa=!_a&&(/Chrome/i.test(ia)||/CriOS/i.test(ia)),ba=function(){var e=ia.match(/(Chrome|CriOS)\/(\d+)/);if(e&&e[2]){return parseFloat(e[2])}return null}(),Ta=function(){var e=/MSIE\s(\d+)\.\d/.exec(ia),t=e&&parseFloat(e[1]);return"7.5.5"}(),va=/Safari/i.test(ia)&&!fa&&!ma&&!_a,Sa=(va||ua)&&!fa,ka=v()&&("ontouchstart"in e||e.navigator.maxTouchPoints||e.DocumentTouch&&e.document instanceof e.DocumentTouch),Ca=Object.freeze({IS_IPAD:da,IS_IPHONE:la,IS_IPOD:pa,IS_IOS:ua,IOS_VERSION:ca,IS_ANDROID:ma,ANDROID_VERSION:ga,IS_NATIVE_ANDROID:ha,IS_FIREFOX:ya,IS_EDGE:_a,IS_CHROME:fa,CHROME_VERSION:ba,IE_VERSION:Ta,IS_SAFARI:va,IS_ANY_SAFARI:Sa,TOUCH_ENABLED:ka});function ce(e,t,a){if("number"!=typeof t||0>t||t>a){throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+a+").")}}function me(e,t,a,n){ce(e,n,a.length-1);return a[n][t]}function ge(e){if(e===void 0||0===e.length){return{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}}return{length:e.length,start:me.bind(null,"start",0,e),end:me.bind(null,"end",1,e)}}function he(e,t){if(Array.isArray(e)){return ge(e)}else if(e===void 0||t===void 0){return ge()}return ge([[e,t]])}function ye(e,t){var a=0,n,r;if(!t){return 0}if(!e||!e.length){e=he(0,0)}for(var s=0;st){r=t}a+=r-n}return a/t}for(var Ea={},La=[["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"]],Ia=La[0],Pa,xa=!1,Da=0;Das;s++){n[String.fromCharCode(s)]=s-32}for(var s=48;58>s;s++){n[s-48]=s}for(s=1;13>s;s++){n["f"+s]=s+111}for(s=0;10>s;s++){n["numpad "+s]=s+96}var o=t.names=t.title={};for(s in n){o[n[s]]=s}for(var d in r){n[d]=r[d]}}),Na=Ba.code,ja=Ba.codes,Fa=Ba.aliases,Ha=Ba.names,Va=Ba.title,qa="vjs-modal-dialog",za=function(n){a(r,n);function r(e,t){var a=n.call(this,e,t)||this;a.opened_=a.hasBeenOpened_=a.hasBeenFilled_=!1;a.closeable(!a.options_.uncloseable);a.content(a.options_.content);a.contentEl_=E("div",{className:qa+"-content"},{role:"document"});a.descEl_=E("p",{className:qa+"-description vjs-control-text",id:a.el().getAttribute("aria-describedby")});L(a.descEl_,a.description());a.el_.appendChild(a.descEl_);a.el_.appendChild(a.contentEl_);return a}var i=r.prototype;i.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})};i.dispose=function(){this.contentEl_=null;this.descEl_=null;this.previouslyActiveEl_=null;n.prototype.dispose.call(this)};i.buildCSSClass=function(){return qa+" vjs-hidden "+n.prototype.buildCSSClass.call(this)};i.label=function(){return this.localize(this.options_.label||"Modal Window")};i.description=function(){var e=this.options_.description||this.localize("This is a modal window.");if(this.closeable()){e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")}return e};i.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen");this.opened_=!0;if(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_){this.fill()}this.wasPlaying_=!e.paused();if(this.options_.pauseOnOpen&&this.wasPlaying_){e.pause()}this.on("keydown",this.handleKeyDown);this.hadControls_=e.controls();e.controls(!1);this.show();this.conditionalFocus_();this.el().setAttribute("aria-hidden","false");this.trigger("modalopen");this.hasBeenOpened_=!0}};i.opened=function(e){if("boolean"==typeof e){this[e?"open":"close"]()}return this.opened_};i.close=function(){if(!this.opened_){return}var e=this.player();this.trigger("beforemodalclose");this.opened_=!1;if(this.wasPlaying_&&this.options_.pauseOnOpen){e.play()}this.off("keydown",this.handleKeyDown);if(this.hadControls_){e.controls(!0)}this.hide();this.el().setAttribute("aria-hidden","true");this.trigger("modalclose");this.conditionalBlur_();if(this.options_.temporary){this.dispose()}};i.closeable=function e(t){if("boolean"==typeof t){var e=this.closeable_=!!t,a=this.getChild("closeButton");if(e&&!a){var n=this.contentEl_;this.contentEl_=this.el_;a=this.addChild("closeButton",{controlText:"Close Modal Dialog"});this.contentEl_=n;this.on(a,"close",this.close)}if(!e&&a){this.off(a,"close",this.close);this.removeChild(a);a.dispose()}}return this.closeable_};i.fill=function(){this.fillWith(this.content())};i.fillWith=function(e){var t=this.contentEl(),a=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill");this.hasBeenFilled_=!0;a.removeChild(t);this.empty();W(t,e);this.trigger("modalfill");if(n){a.insertBefore(t,n)}else{a.appendChild(t)}var r=this.getChild("closeButton");if(r){a.appendChild(r.el_)}};i.empty=function(){this.trigger("beforemodalempty");q(this.contentEl());this.trigger("modalempty")};i.content=function(e){if("undefined"!=typeof e){this.content_=e}return this.content_};i.conditionalFocus_=function(){var e=t.activeElement,a=this.player_.el_;this.previouslyActiveEl_=null;if(a.contains(e)||a===e){this.previouslyActiveEl_=e;this.focus()}};i.conditionalBlur_=function(){if(this.previouslyActiveEl_){this.previouslyActiveEl_.focus();this.previouslyActiveEl_=null}};i.handleKeyDown=function(e){e.stopPropagation();if(Ba.isEventKey(e,"Escape")&&this.closeable()){e.preventDefault();this.close();return}if(!Ba.isEventKey(e,"Tab")){return}for(var a=this.focusableEls_(),n=this.el_.querySelector(":focus"),r,s=0;s";s=d.firstChild;d.setAttribute("style","display:none; position:absolute;");t.body.appendChild(d)}for(var l={},p=0;px";e=a.firstChild.href}return e},dn=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i,a=t.exec(e);if(a){return a.pop().toLowerCase()}}return""},ln=function(t){var a=e.location,n=sn(t),r=":"===n.protocol?a.protocol:n.protocol,i=r+n.host!==a.protocol+a.host;return i},pn=Object.freeze({parseUrl:sn,getAbsoluteURL:on,getFileExtension:dn,isCrossOrigin:ln}),un=function(e){var t=cn.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)},cn=Object.prototype.toString;var mn=Te(function(e,t){t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")};t.left=function(e){return e.replace(/^\s*/,"")};t.right=function(e){return e.replace(/\s*$/,"")}}),gn=mn.left,hn=mn.right,yn=Function.prototype.toString,_n=/^\s*class\b/,fn=function(e){try{var t=yn.call(e);return _n.test(t)}catch(t){return!1}},bn=function(e){try{if(fn(e)){return!1}yn.call(e);return!0}catch(t){return!1}},Tn=Object.prototype.toString,vn="function"==typeof Symbol&&"symbol"===_typeof(Symbol.toStringTag),Sn=function(e){if(!e){return!1}if("function"!=typeof e&&"object"!==_typeof(e)){return!1}if("function"==typeof e&&!e.prototype){return!0}if(vn){return bn(e)}if(fn(e)){return!1}var t=Tn.call(e);return t==="[object Function]"||t==="[object GeneratorFunction]"},kn=Object.prototype.toString,Cn=Object.prototype.hasOwnProperty,En=function(e,t,a){for(var n=0,r=e.length;n=e){t.push(r)}else if(r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e){t.push(r)}}p=!1;if(t.length!==this.activeCues_.length){p=!0}else{for(var s=0;s=t){this.set(e,t);return!0}}return!1}};function Ae(e,t,a,n){var r=n?e.split(n):[e];for(var s in r){if("string"!=typeof r[s]){continue}var i=r[s].split(a);if(2!==i.length){continue}var o=i[0],d=i[1];t(o,d)}}function we(e,t,a){var s=e;function n(){var t=xe(e);if(null===t){throw new Pe(Pe.Errors.BadTimeStamp,"Malformed timestamp: "+s)}e=e.replace(/^[^\sa-zA-Z-]+/,"");return t}function r(e,t){var n=new De;Ae(e,function(e,t){switch(e){case"region":for(var r=a.length-1;0<=r;r--){if(a[r].id===t){n.set(e,a[r].region);break}}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var s=t.split(","),o=s[0];n.integer(e,o);n.percent(e,o)?n.set("snapToLines",!1):null;n.alt(e,o,["auto"]);if(2===s.length){n.alt("lineAlign",s[1],["start","middle","end"])}break;case"position":s=t.split(",");n.percent(e,s[0]);if(2===s.length){n.alt("positionAlign",s[1],["start","middle","end"])}break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","middle","end","left","right"]);break;}},/:/,/\s/);t.region=n.get("region",null);t.vertical=n.get("vertical","");t.line=n.get("line","auto");t.lineAlign=n.get("lineAlign","start");t.snapToLines=n.get("snapToLines",!0);t.size=n.get("size",100);t.align=n.get("align","middle");t.position=n.get("position",{start:0,left:0,middle:50,end:100,right:100},t.align);t.positionAlign=n.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},t.align)}function i(){e=e.replace(/^\s+/,"")}i();t.startTime=n();i();if("-->"!==e.substr(0,3)){throw new Pe(Pe.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+s)}e=e.substr(3);i();t.endTime=n();i();r(e,t)}var Gn={"&":"&","<":"<",">":">","‎":"\u200E","‏":"\u200F"," ":"\xA0"},Wn={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Kn={v:"title",lang:"lang"},Yn={rt:"ruby"};function Oe(e,a){function n(){if(!a){return null}function e(e){a=a.substr(e.length);return e}var t=a.match(/^([^<]*)(<[^>]*>?)?/);return e(t[1]?t[1]:t[2])}function r(t){return Gn[t]}function i(e){while(h=e.match(/&(amp|lt|gt|lrm|rlm|nbsp);/)){e=e.replace(h[0],r)}return e}function s(e,t){return!Yn[t.localName]||Yn[t.localName]===e.localName}function o(t,a){var n=Wn[t];if(!n){return null}var r=e.document.createElement(n);r.localName=n;var i=Kn[t];if(i&&a){r[i]=a.trim()}return r}var d=e.document.createElement("div"),l=d,p,u=[];while(null!==(p=n())){if("<"===p[0]){if("/"===p[1]){if(u.length&&u[u.length-1]===p.substr(2).replace(">","")){u.pop();l=l.parentNode}continue}var c=xe(p.substr(1,p.length-2)),g;if(c){g=e.document.createProcessingInstruction("timestamp",c);l.appendChild(g);continue}var h=p.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!h){continue}g=o(h[1],h[3]);if(!g){continue}if(!s(l,g)){continue}if(h[2]){g.className=h[2].substr(1).replace("."," ")}u.push(h[1]);l.appendChild(g);l=g;continue}l.appendChild(e.document.createTextNode(i(p)))}return d}var Xn=[[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 Ue(e){for(var t=0,a;t=a[0]&&e<=a[1]){return!0}}return!1}function Re(e){var n=[],r="",s;if(!e||!e.childNodes){return"ltr"}function t(e,t){for(var a=t.childNodes.length-1;0<=a;a--){e.push(t.childNodes[a])}}function a(e){if(!e||!e.length){return null}var n=e.pop(),r=n.textContent||n.innerText;if(r){var i=r.match(/^.*(\n|\r)/);if(i){e.length=0;return i[0]}return r}if("ruby"===n.tagName){return a(e)}if(n.childNodes){t(e,n);return a(e)}}t(n,e);while(r=a(n)){for(var o=0;o=e.line)){return e.line}if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement){return-1}for(var t=e.track,a=t.textTrackList,n=0,r=0;re.left&&this.tope.top};je.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right};je.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom;}};je.prototype.intersectPercentage=function(e){var t=Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left)),a=Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top));return t*a/(this.height*this.width)};je.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}};je.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,a=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e;var r={left:e.left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||a};return r};function Fe(e,t,a,n){function r(e,t){for(var r,s=new je(e),o=1,d=0;dl){r=new je(e);o=l}e=new je(s)}return r||s}var i=new je(t),s=t.cue,o=Me(s),d=[];if(s.snapToLines){var l;switch(s.vertical){case"":d=["+y","-y"];l="height";break;case"rl":d=["+x","-x"];l="width";break;case"lr":d=["-x","+x"];l="width";break;}var p=i.lineHeight,u=p*Math.round(o),c=a[l]+p,m=d[0];if(Math.abs(u)>c){u=0>u?-1:1;u*=Math.ceil(c/p)*p}if(0>o){u+=""===s.vertical?a.height:a.width;d=d.reverse()}i.move(m,u)}else{var g=100*(i.lineHeight/a.height);switch(s.lineAlign){case"middle":o-=g/2;break;case"end":o-=g;break;}switch(s.vertical){case"":t.applyStyles({top:t.formatStyle(o,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(o,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(o,"%")});break;}d=["+y","-x","+x","-y"];i=new je(t)}var h=r(i,d);t.move(h.toCSSCompatValues(a))}function He(){}He.StringDecoder=function(){return{decode:function(e){if(!e){return""}if("string"!=typeof e){throw new Error("Error - expected string data.")}return decodeURIComponent(encodeURIComponent(e))}}};He.convertCueToDOMTree=function(e,t){if(!e||!t){return null}return Oe(e,t)};He.processCues=function(e,t,a){if(!e||!t||!a){return null}while(a.firstChild){a.removeChild(a.firstChild)}var r=e.document.createElement("div");r.style.position="absolute";r.style.left="0";r.style.right="0";r.style.top="0";r.style.bottom="0";r.style.margin="1.5%";a.appendChild(r);function n(e){for(var t=0;t")){i.cue.id=s;continue}case"CUE":try{we(s,i.cue,i.regionList)}catch(t){i.reportOrThrowError(t);i.cue=null;i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":var l=-1!==s.indexOf("-->");if(!s||l&&(d=!0)){i.oncue&&i.oncue(i.cue);i.cue=null;i.state="ID";continue}if(i.cue.text){i.cue.text+="\n"}i.cue.text+=s;continue;case"BADCUE":if(!s){i.state="ID"}continue;}}}catch(t){i.reportOrThrowError(t);if("CUETEXT"===i.state&&i.cue&&i.oncue){i.oncue(i.cue)}i.cue=null;i.state="INITIAL"===i.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var t=this;try{t.buffer+=t.decoder.decode();if(t.cue||"HEADER"===t.state){t.buffer+="\n\n";t.parse()}if("INITIAL"===t.state){throw new Pe(Pe.Errors.BadSignature)}}catch(a){t.reportOrThrowError(a)}t.onflush&&t.onflush();return this}};var $n={"":1,lr:1,rl:1},Qn={start:1,middle:1,end:1,left:1,right:1};function Ve(e){if("string"!=typeof e){return!1}var t=$n[e.toLowerCase()];return t?e.toLowerCase():!1}function qe(e){if("string"!=typeof e){return!1}var t=Qn[e.toLowerCase()];return t?e.toLowerCase():!1}function ze(e,t,a){this.hasBeenReset=!1;var n="",r=!1,i=e,s=t,o=a,d=null,l="",p=!0,u="auto",c="start",m=50,g="middle",h=50,y="middle";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 i},set:function(e){if("number"!=typeof e){throw new TypeError("Start time must be set to a number.")}i=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 d},set:function(e){d=e;this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(e){var t=Ve(e);if(!1===t){throw new SyntaxError("An invalid or illegal string was specified.")}l=t;this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return p},set:function(e){p=!!e;this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e&&e!=="auto"){throw new SyntaxError("An invalid number or illegal string was specified.")}u=e;this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return c},set:function(e){var t=qe(e);if(!t){throw new SyntaxError("An invalid or illegal string was specified.")}c=t;this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return m},set:function(e){if(0>e||100e||100=e}var Zn=function(){var e=100,t=3,a=0,n=100,r=0,i=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!We(t)){throw new Error("Width must be between 0 and 100.")}e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e){throw new TypeError("Lines must be set to a number.")}t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!We(e)){throw new Error("RegionAnchorX must be between 0 and 100.")}n=e}},regionAnchorX:{enumerable:!0,get:function(){return a},set:function(e){if(!We(e)){throw new Error("RegionAnchorY must be between 0 and 100.")}a=e}},viewportAnchorY:{enumerable:!0,get:function(){return i},set:function(e){if(!We(e)){throw new Error("ViewportAnchorY must be between 0 and 100.")}i=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!We(e)){throw new Error("ViewportAnchorX must be between 0 and 100.")}r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=Ge(e);if(!1===t){throw new SyntaxError("An invalid or illegal string was specified.")}s=t}}})},er=Te(function(t){var a=t.exports={WebVTT:He,VTTCue:ze,VTTRegion:Zn};e.vttjs=a;e.WebVTT=a.WebVTT;var n=a.VTTCue,r=a.VTTRegion,i=e.VTTCue,s=e.VTTRegion;a.shim=function(){e.VTTCue=n;e.VTTRegion=r};a.restore=function(){e.VTTCue=i;e.VTTRegion=s};if(!e.VTTCue){a.shim()}}),tr=er.WebVTT,ar=er.VTTCue,nr=er.VTTRegion;function Ke(e,t,a,n,r){if(void 0===r){r={}}var i=e.textTracks();r.kind=t;if(a){r.label=a}if(n){r.language=n}r.tech=e;var s=new qn.text.TrackClass(r);i.addTrack(s);return s}var rr=function(n){a(r,n);function r(e,t){var a;if(void 0===e){e={}}if(void 0===t){t=function(){}}e.reportTouchActivity=!1;a=n.call(this,null,e,t)||this;a.hasStarted_=!1;a.on("playing",function(){this.hasStarted_=!0});a.on("loadstart",function(){this.hasStarted_=!1});qn.names.forEach(function(t){var n=qn[t];if(e&&e[n.getterName]){a[n.privateName]=e[n.getterName]}});if(!a.featuresProgressEvents){a.manualProgressOn()}if(!a.featuresTimeupdateEvents){a.manualTimeUpdatesOn()}["Text","Audio","Video"].forEach(function(t){if(!1===e["native"+t+"Tracks"]){a["featuresNative"+t+"Tracks"]=!1}});if(!1===e.nativeCaptions||!1===e.nativeTextTracks){a.featuresNativeTextTracks=!1}else if(!0===e.nativeCaptions||!0===e.nativeTextTracks){a.featuresNativeTextTracks=!0}if(!a.featuresNativeTextTracks){a.emulateTextTracks()}a.autoRemoteTextTracks_=new qn.text.ListClass;a.initTrackListeners();if(!e.nativeControlsForTouch){a.emitTapEvents()}if(a.constructor){a.name_=a.constructor.name||"Unknown Tech"}return a}var i=r.prototype;i.triggerSourceset=function(e){var t=this;if(!this.isReady_){this.one("ready",function(){return t.setTimeout(function(){return t.triggerSourceset(e)},1)})}this.trigger({src:e,type:"sourceset"})};i.manualProgressOn=function(){this.on("durationchange",this.onDurationChange);this.manualProgress=!0;this.one("ready",this.trackProgress)};i.manualProgressOff=function(){this.manualProgress=!1;this.stopTrackingProgress();this.off("durationchange",this.onDurationChange)};i.trackProgress=function(){this.stopTrackingProgress();this.progressInterval=this.setInterval(qt(this,function(){var e=this.bufferedPercent();if(this.bufferedPercent_!==e){this.trigger("progress")}this.bufferedPercent_=e;if(1===e){this.stopTrackingProgress()}}),500)};i.onDurationChange=function(){this.duration_=this.duration()};i.buffered=function(){return he(0,0)};i.bufferedPercent=function(){return ye(this.buffered(),this.duration_)};i.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)};i.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0;this.on("play",this.trackCurrentTime);this.on("pause",this.stopTrackingCurrentTime)};i.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1;this.stopTrackingCurrentTime();this.off("play",this.trackCurrentTime);this.off("pause",this.stopTrackingCurrentTime)};i.trackCurrentTime=function(){if(this.currentTimeInterval){this.stopTrackingCurrentTime()}this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)};i.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval);this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})};i.dispose=function(){this.clearTracks(Hn.names);if(this.manualProgress){this.manualProgressOff()}if(this.manualTimeUpdates){this.manualTimeUpdatesOff()}n.prototype.dispose.call(this)};i.clearTracks=function(e){var t=this;e=[].concat(e);e.forEach(function(e){var a=t[e+"Tracks"]()||[],n=a.length;while(n--){var r=a[n];if("text"===e){t.removeRemoteTextTrack(r)}a.removeTrack(r)}})};i.cleanupAutoTextTracks=function(){var e=this.autoRemoteTextTracks_||[],t=e.length;while(t--){var a=e[t];this.removeRemoteTextTrack(a)}};i.reset=function(){};i.error=function(e){if(e!==void 0){this.error_=new _e(e);this.trigger("error")}return this.error_};i.played=function(){if(this.hasStarted_){return he(0,0)}return he()};i.setCurrentTime=function(){if(this.manualTimeUpdates){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}};i.initTrackListeners=function(){var e=this;Hn.names.forEach(function(t){var a=Hn[t],n=function(){e.trigger(t+"trackchange")},r=e[a.getterName]();r.addEventListener("removetrack",n);r.addEventListener("addtrack",n);e.on("dispose",function(){r.removeEventListener("removetrack",n);r.removeEventListener("addtrack",n)})})};i.addWebVttScript_=function(){var a=this;if(e.WebVTT){return}if(t.body.contains(this.el())){if(!this.options_["vtt.js"]&&h(er)&&0",className:this.buildCSSClass(),tabIndex:0},a);if("button"===t){Et.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead.")}n=m({role:"button"},n);this.tabIndex_=a.tabIndex;var r=e.prototype.createEl.call(this,t,a,n);this.createControlTextEl(r);return r};n.dispose=function(){this.controlTextEl_=null;e.prototype.dispose.call(this)};n.createControlTextEl=function(e){this.controlTextEl_=E("span",{className:"vjs-control-text"},{"aria-live":"polite"});if(e){e.appendChild(this.controlTextEl_)}this.controlText(this.controlText_,e);return this.controlTextEl_};n.controlText=function(e,t){if(void 0===t){t=this.el()}if(e===void 0){return this.controlText_||"Need Text"}var a=this.localize(e);this.controlText_=e;L(this.controlTextEl_,a);if(!this.nonIconControl){t.setAttribute("title",a)}};n.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)};n.enable=function(){if(!this.enabled_){this.enabled_=!0;this.removeClass("vjs-disabled");this.el_.setAttribute("aria-disabled","false");if("undefined"!=typeof this.tabIndex_){this.el_.setAttribute("tabIndex",this.tabIndex_)}this.on(["tap","click"],this.handleClick);this.on("keydown",this.handleKeyDown)}};n.disable=function(){this.enabled_=!1;this.addClass("vjs-disabled");this.el_.setAttribute("aria-disabled","true");if("undefined"!=typeof this.tabIndex_){this.el_.removeAttribute("tabIndex")}this.off(["tap","click"],this.handleClick);this.off("keydown",this.handleKeyDown)};n.handleClick=function(){};n.handleKeyDown=function(t){if(Ba.isEventKey(t,"Space")||Ba.isEventKey(t,"Enter")){t.preventDefault();t.stopPropagation();this.trigger("click")}else{e.prototype.handleKeyDown.call(this,t)}};return t}(ra);ra.registerComponent("ClickableComponent",yr);var _r=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.update();t.on("posterchange",qt(o(o(n)),n.update));return n}var n=t.prototype;n.dispose=function(){this.player().off("posterchange",this.update);e.prototype.dispose.call(this)};n.createEl=function(){var e=E("div",{className:"vjs-poster",tabIndex:-1});return e};n.update=function(){var e=this.player().poster();this.setSrc(e);if(e){this.show()}else{this.hide()}};n.setSrc=function(e){var t="";if(e){t="url(\""+e+"\")"}this.el_.style.backgroundImage=t};n.handleClick=function(){if(!this.player_.controls()){return}this.player_.tech(!0).focus();if(this.player_.paused()){be(this.player_.play())}else{this.player_.pause()}};return t}(yr);ra.registerComponent("PosterImage",_r);var fr="#ccc",br={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 it(e,t){var a;if(4===e.length){a=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]}else if(7===e.length){a=e.slice(1)}else{throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.")}return"rgba("+parseInt(a.slice(0,2),16)+","+parseInt(a.slice(2,4),16)+","+parseInt(a.slice(4,6),16)+","+t+")"}function st(e,t,a){try{e.style[t]=a}catch(t){}}var Tr=function(t){a(n,t);function n(a,n,r){var i=t.call(this,a,n,r)||this;var s=qt(o(o(i)),i.updateDisplay);a.on("loadstart",qt(o(o(i)),i.toggleDisplay));a.on("texttrackchange",s);a.on("loadedmetadata",qt(o(o(i)),i.preselectTrack));a.ready(qt(o(o(i)),function(){if(a.tech_&&a.tech_.featuresNativeTextTracks){this.hide();return}a.on("fullscreenchange",s);a.on("playerresize",s);e.addEventListener("orientationchange",s);a.on("dispose",function(){return e.removeEventListener("orientationchange",s)});for(var t=this.options_.playerOptions.tracks||[],n=0;n",className:this.buildCSSClass()},t);a=m({type:"button"},a);var n=ra.prototype.createEl.call(this,e,t,a);this.createControlTextEl(n);return n};n.addChild=function(e,t){if(void 0===t){t={}}var a=this.constructor.name;Et.warn("Adding an actionable (user controllable) child to a Button ("+a+") is not supported; use a ClickableComponent instead.");return ra.prototype.addChild.call(this,e,t)};n.enable=function(){e.prototype.enable.call(this);this.el_.removeAttribute("disabled")};n.disable=function(){e.prototype.disable.call(this);this.el_.setAttribute("disabled","disabled")};n.handleKeyDown=function(t){if(Ba.isEventKey(t,"Space")||Ba.isEventKey(t,"Enter")){t.stopPropagation();return}e.prototype.handleKeyDown.call(this,t)};return t}(yr);ra.registerComponent("Button",Sr);var kr=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.mouseused_=!1;n.on("mousedown",n.handleMouseDown);return n}var n=t.prototype;n.buildCSSClass=function(){return"vjs-big-play-button"};n.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){be(t);this.player_.tech(!0).focus();return}var a=this.player_.getChild("controlBar"),n=a&&a.getChild("playToggle");if(!n){this.player_.tech(!0).focus();return}var r=function(){return n.focus()};if(fe(t)){t.then(r,function(){})}else{this.setTimeout(r,1)}};n.handleKeyDown=function(t){this.mouseused_=!1;e.prototype.handleKeyDown.call(this,t)};n.handleMouseDown=function(){this.mouseused_=!0};return t}(Sr);kr.prototype.controlText_="Play Video";ra.registerComponent("BigPlayButton",kr);var Cr=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.controlText(a&&a.controlText||n.localize("Close"));return n}var n=t.prototype;n.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)};n.handleClick=function(){this.trigger({type:"close",bubbles:!1})};return t}(Sr);ra.registerComponent("CloseButton",Cr);var Er=function(e){a(t,e);function t(t,a){var n;if(void 0===a){a={}}n=e.call(this,t,a)||this;a.replay=a.replay===void 0||a.replay;n.on(t,"play",n.handlePlay);n.on(t,"pause",n.handlePause);if(a.replay){n.on(t,"ended",n.handleEnded)}return n}var n=t.prototype;n.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)};n.handleClick=function(){if(this.player_.paused()){this.player_.play()}else{this.player_.pause()}};n.handleSeeked=function(e){this.removeClass("vjs-ended");if(this.player_.paused()){this.handlePause(e)}else{this.handlePlay(e)}};n.handlePlay=function(){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.controlText("Pause")};n.handlePause=function(){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.controlText("Play")};n.handleEnded=function(){this.removeClass("vjs-playing");this.addClass("vjs-ended");this.controlText("Replay");this.one(this.player_,"seeked",this.handleSeeked)};return t}(Sr);Er.prototype.controlText_="Play";ra.registerComponent("PlayToggle",Er);var Lr=function(e,t){e=0>e?0:e;var a=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),i=Math.floor(t/60%60),o=Math.floor(t/3600);if(isNaN(e)||e===1/0){r=n=a="-"}r=0n?"0"+n:n)+":";a=10>a?"0"+a:a;return r+n+a},Ir=Lr;function ot(e,t){if(void 0===t){t=e}return Ir(e,t)}var Pr=function(e){a(n,e);function n(t,a){var n=e.call(this,t,a)||this;n.throttledUpdateContent=zt(qt(o(o(n)),n.updateContent),25);n.on(t,"timeupdate",n.throttledUpdateContent);return n}var r=n.prototype;r.createEl=function(){var t=this.buildCSSClass(),a=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control",innerHTML:""+this.localize(this.labelText_)+"\xA0"});this.contentEl_=E("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"});this.updateTextNode_();a.appendChild(this.contentEl_);return a};r.dispose=function(){this.contentEl_=null;this.textNode_=null;e.prototype.dispose.call(this)};r.updateTextNode_=function(){if(!this.contentEl_){return}while(this.contentEl_.firstChild){this.contentEl_.removeChild(this.contentEl_.firstChild)}this.textNode_=t.createTextNode(this.formattedTime_||this.formatTime_(0));this.contentEl_.appendChild(this.textNode_)};r.formatTime_=function(e){return ot(e)};r.updateFormattedTime_=function(e){var t=this.formatTime_(e);if(t===this.formattedTime_){return}this.formattedTime_=t;this.requestAnimationFrame(this.updateTextNode_)};r.updateContent=function(){};return n}(ra);Pr.prototype.labelText_="Time";Pr.prototype.controlText_="Time";ra.registerComponent("TimeDisplay",Pr);var xr=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.on(t,"ended",n.handleEnded);return n}var n=t.prototype;n.buildCSSClass=function(){return"vjs-current-time"};n.updateContent=function(){var e=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(e)};n.handleEnded=function(){if(!this.player_.duration()){return}this.updateFormattedTime_(this.player_.duration())};return t}(Pr);xr.prototype.labelText_="Current Time";xr.prototype.controlText_="Current Time";ra.registerComponent("CurrentTimeDisplay",xr);var Dr=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.on(t,"durationchange",n.updateContent);n.on(t,"loadstart",n.updateContent);n.on(t,"loadedmetadata",n.throttledUpdateContent);return n}var n=t.prototype;n.buildCSSClass=function(){return"vjs-duration"};n.updateContent=function(){var e=this.player_.duration();if(this.duration_!==e){this.duration_=e;this.updateFormattedTime_(e)}};return t}(Pr);Dr.prototype.labelText_="Duration";Dr.prototype.controlText_="Duration";ra.registerComponent("DurationDisplay",Dr);var Ar=function(e){a(t,e);function t(){return e.apply(this,arguments)||this}var n=t.prototype;n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"
/
"},{"aria-hidden":!0})};return t}(ra);ra.registerComponent("TimeDivider",Ar);var wr=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.on(t,"durationchange",n.throttledUpdateContent);n.on(t,"ended",n.handleEnded);return n}var n=t.prototype;n.buildCSSClass=function(){return"vjs-remaining-time"};n.createEl=function(){var t=e.prototype.createEl.call(this);t.insertBefore(E("span",{},{"aria-hidden":!0},"-"),this.contentEl_);return t};n.updateContent=function(){if("number"!=typeof this.player_.duration()){return}if(this.player_.remainingTimeDisplay){this.updateFormattedTime_(this.player_.remainingTimeDisplay())}else{this.updateFormattedTime_(this.player_.remainingTime())}};n.handleEnded=function(){if(!this.player_.duration()){return}this.updateFormattedTime_(0)};return t}(Pr);wr.prototype.labelText_="Remaining Time";wr.prototype.controlText_="Remaining Time";ra.registerComponent("RemainingTimeDisplay",wr);var Or=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.updateShowing();n.on(n.player(),"durationchange",n.updateShowing);return n}var n=t.prototype;n.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});this.contentEl_=E("div",{className:"vjs-live-display",innerHTML:""+this.localize("Stream Type")+"\xA0"+this.localize("LIVE")},{"aria-live":"off"});t.appendChild(this.contentEl_);return t};n.dispose=function(){this.contentEl_=null;e.prototype.dispose.call(this)};n.updateShowing=function(){if(this.player().duration()===1/0){this.show()}else{this.hide()}};return t}(ra);ra.registerComponent("LiveDisplay",Or);var Ur=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.updateLiveEdgeStatus();if(n.player_.liveTracker){n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatus)}return n}var n=t.prototype;n.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});this.textEl_=E("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"});t.appendChild(this.textEl_);return t};n.updateLiveEdgeStatus=function(){if(!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")}else{this.setAttribute("aria-disabled",!1);this.removeClass("vjs-at-live-edge");this.controlText("Seek to live, currently behind live")}};n.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()};n.dispose=function(){if(this.player_.liveTracker){this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatus)}this.textEl_=null;e.prototype.dispose.call(this)};return t}(Sr);Ur.prototype.controlText_="Seek to live, currently playing live";ra.registerComponent("SeekToLive",Ur);var Rr=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.bar=n.getChild(n.options_.barName);n.vertical(!!n.options_.vertical);n.enable();return n}var n=t.prototype;n.enabled=function(){return this.enabled_};n.enable=function(){if(this.enabled()){return}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);if(this.playerEvent){this.on(this.player_,this.playerEvent,this.update)}this.removeClass("disabled");this.setAttribute("tabindex",0);this.enabled_=!0};n.disable=function(){if(!this.enabled()){return}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");if(this.playerEvent){this.off(this.player_,this.playerEvent,this.update)}this.enabled_=!1};n.createEl=function(t,a,n){if(void 0===a){a={}}if(void 0===n){n={}}a.className=a.className+" vjs-slider";a=m({tabIndex:0},a);n=m({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n);return e.prototype.createEl.call(this,t,a,n)};n.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;if("mousedown"===e.type){e.preventDefault()}if("touchstart"===e.type&&!fa){e.preventDefault()}B();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)};n.handleMouseMove=function(){};n.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;N();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()};n.update=function(){if(!this.el_){return}var e=this.getPercent(),t=this.bar;if(!t){return}if("number"!=typeof e||e!==e||0>e||e===1/0){e=0}var a=(100*e).toFixed(2)+"%",n=t.el().style;if(this.vertical()){n.height=a}else{n.width=a}return e};n.calculateDistance=function(e){var t=H(this.el_,e);if(this.vertical()){return t.y}return t.x};n.handleKeyDown=function(t){if(Ba.isEventKey(t,"Left")||Ba.isEventKey(t,"Down")){t.preventDefault();t.stopPropagation();this.stepBack()}else if(Ba.isEventKey(t,"Right")||Ba.isEventKey(t,"Up")){t.preventDefault();t.stopPropagation();this.stepForward()}else{e.prototype.handleKeyDown.call(this,t)}};n.handleClick=function(e){e.stopPropagation();e.preventDefault()};n.vertical=function(e){if(e===void 0){return this.vertical_||!1}this.vertical_=!!e;if(this.vertical_){this.addClass("vjs-slider-vertical")}else{this.addClass("vjs-slider-horizontal")}};return t}(ra);ra.registerComponent("Slider",Rr);var Mr=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.partEls_=[];n.on(t,"progress",n.update);return n}var n=t.prototype;n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:""+this.localize("Loaded")+": 0%"})};n.dispose=function(){this.partEls_=null;e.prototype.dispose.call(this)};n.update=function(){var e=this.player_.liveTracker,t=this.player_.buffered(),a=e&&e.isLive()?e.seekableEnd():this.player_.duration(),n=this.player_.bufferedEnd(),r=this.partEls_,s=this.$(".vjs-control-text-loaded-percentage"),o=function(e,t,a){var n=e/t||0;n=100*(1<=n?1:n);if(a){n=n.toFixed(2)}return n+"%"};this.el_.style.width=o(n,a);L(s,o(n,a,!0));for(var d=0;dt.length;c--){this.el_.removeChild(r[c-1])}r.length=t.length};return t}(ra);ra.registerComponent("LoadProgressBar",Mr);var Br=function(e){a(t,e);function t(){return e.apply(this,arguments)||this}var n=t.prototype;n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})};n.update=function(e,t,a){var n=j(this.el_),r=j(this.player_.el()),i=e.width*t;if(!r||!n){return}var s=e.left-r.left+i,o=e.width-i+(r.right-e.right),d=n.width/2;if(sd){d=0}else if(d>n.width){d=n.width}this.el_.style.right="-"+d+"px";L(this.el_,a)};n.updateTime=function(e,t,a,n){var r=this;if(this.rafId_){this.cancelAnimationFrame(this.rafId_)}this.rafId_=this.requestAnimationFrame(function(){var i,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),d=o-t*o;i=(1>d?"":"-")+ot(d,o)}else{i=ot(a,s)}r.update(e,t,i);if(n){n()}})};return t}(ra);ra.registerComponent("TimeTooltip",Br);var Nr=function(e){a(t,e);function t(){return e.apply(this,arguments)||this}var n=t.prototype;n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})};n.update=function(e,t){var a=this.getChild("timeTooltip");if(!a){return}var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();a.updateTime(e,t,n)};return t}(ra);Nr.prototype.options_={children:[]};if(!ua&&!ma){Nr.prototype.options_.children.push("timeTooltip")}ra.registerComponent("PlayProgressBar",Nr);var jr=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.update=zt(qt(o(o(n)),n.update),25);return n}var n=t.prototype;n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})};n.update=function(e,t){var a=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,function(){a.el_.style.left=e.width*t+"px"})};return t}(ra);jr.prototype.options_={children:["timeTooltip"]};ra.registerComponent("MouseTimeDisplay",jr);var Fr=12,Hr=30,Vr=function(e){a(n,e);function n(t,a){var n=e.call(this,t,a)||this;n.setEventHandlers_();return n}var r=n.prototype;r.setEventHandlers_=function(){this.update=zt(qt(this,this.update),Hr);this.on(this.player_,"timeupdate",this.update);this.on(this.player_,"ended",this.handleEnded);this.on(this.player_,"durationchange",this.update);if(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_);if("hidden"in t&&"visibilityState"in t){this.on(t,"visibilitychange",this.toggleVisibility_)}};r.toggleVisibility_=function(a){if(t.hidden){this.disableInterval_(a)}else{this.enableInterval_();this.requestAnimationFrame(this.update)}};r.enableInterval_=function(){var e=this;this.clearInterval(this.updateInterval);this.updateInterval=this.setInterval(function(){e.requestAnimationFrame(e.update)},Hr)};r.disableInterval_=function(t){if(this.player_.liveTracker&&this.player_.liveTracker.isLive()&&"ended"!==t.type){return}this.clearInterval(this.updateInterval)};r.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})};r.update_=function(e,t){var a=this.player_.liveTracker,n=this.player_.duration();if(a&&a.isLive()){n=this.player_.liveTracker.liveCurrentTime()}this.el_.setAttribute("aria-valuenow",(100*t).toFixed(2));this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[ot(e,n),ot(n,n)],"{1} of {2}"));if(this.bar){this.bar.update(j(this.el_),t)}};r.update=function(){if(null===this.el().offsetParent){return}var t=e.prototype.update.call(this);this.update_(this.getCurrentTime_(),t);return t};r.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()};r.handleEnded=function(){this.update_(this.player_.duration(),1)};r.getPercent=function(){var e=this.getCurrentTime_(),t,a=this.player_.liveTracker;if(a&&a.isLive()){t=(e-a.seekableStart())/a.liveWindow();if(a.atLiveEdge()){t=1}}else{t=e/this.player_.duration()}return 1<=t?1:t||0};r.handleMouseDown=function(t){if(!K(t)){return}t.stopPropagation();this.player_.scrubbing(!0);this.videoWasPlaying=!this.player_.paused();this.player_.pause();e.prototype.handleMouseDown.call(this,t)};r.handleMouseMove=function(e){if(!K(e)){return}var t,a=this.calculateDistance(e),n=this.player_.liveTracker;if(!n||!n.isLive()){t=a*this.player_.duration();if(t===this.player_.duration()){t=t-.1}}else{var r=n.seekableStart(),i=n.liveCurrentTime();t=r+a*n.liveWindow();if(t>=i){t=i}if(t<=r){t=r+.1}if(t===1/0){return}}this.player_.currentTime(t)};r.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");if(!t){return}t.show()};r.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");if(!t){return}t.hide()};r.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t);if(t){t.stopPropagation()}this.player_.scrubbing(!1);this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0});if(this.videoWasPlaying){be(this.player_.play())}};r.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)};r.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)};r.handleAction=function(){if(this.player_.paused()){this.player_.play()}else{this.player_.pause()}};r.handleKeyDown=function(t){if(Ba.isEventKey(t,"Space")||Ba.isEventKey(t,"Enter")){t.preventDefault();t.stopPropagation();this.handleAction(t)}else if(Ba.isEventKey(t,"Home")){t.preventDefault();t.stopPropagation();this.player_.currentTime(0)}else if(Ba.isEventKey(t,"End")){t.preventDefault();t.stopPropagation();this.player_.currentTime(this.player_.duration())}else if(/^[0-9]$/.test(Ba(t))){t.preventDefault();t.stopPropagation();var a=10*(Ba.codes[Ba(t)]-Ba.codes[0])/100;this.player_.currentTime(this.player_.duration()*a)}else if(Ba.isEventKey(t,"PgDn")){t.preventDefault();t.stopPropagation();this.player_.currentTime(this.player_.currentTime()-5*Fr)}else if(Ba.isEventKey(t,"PgUp")){t.preventDefault();t.stopPropagation();this.player_.currentTime(this.player_.currentTime()+5*Fr)}else{e.prototype.handleKeyDown.call(this,t)}};return n}(Rr);Vr.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};if(!ua&&!ma){Vr.prototype.options_.children.splice(1,0,"mouseTimeDisplay")}ra.registerComponent("SeekBar",Vr);var qr=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.handleMouseMove=zt(qt(o(o(n)),n.handleMouseMove),25);n.throttledHandleMouseSeek=zt(qt(o(o(n)),n.handleMouseSeek),25);n.enable();return n}var n=t.prototype;n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})};n.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var a=t.getChild("mouseTimeDisplay"),n=t.el(),r=j(n),i=H(n,e).x;if(1i){i=0}if(a){a.update(r,i)}}};n.handleMouseSeek=function(e){var t=this.getChild("seekBar");if(t){t.handleMouseMove(e)}};n.enabled=function(){return this.enabled_};n.disable=function(){this.children().forEach(function(e){return e.disable&&e.disable()});if(!this.enabled()){return}this.off(["mousedown","touchstart"],this.handleMouseDown);this.off(this.el_,"mousemove",this.handleMouseMove);this.handleMouseUp();this.addClass("disabled");this.enabled_=!1};n.enable=function(){this.children().forEach(function(e){return e.enable&&e.enable()});if(this.enabled()){return}this.on(["mousedown","touchstart"],this.handleMouseDown);this.on(this.el_,"mousemove",this.handleMouseMove);this.removeClass("disabled");this.enabled_=!0};n.handleMouseDown=function(e){var t=this.el_.ownerDocument,a=this.getChild("seekBar");if(a){a.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)};n.handleMouseUp=function(e){var t=this.el_.ownerDocument,a=this.getChild("seekBar");if(a){a.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)};return t}(ra);qr.prototype.options_={children:["seekBar"]};ra.registerComponent("ProgressControl",qr);var zr=function(e){a(n,e);function n(a,n){var r=e.call(this,a,n)||this;r.on(a,"fullscreenchange",r.handleFullscreenChange);if(!1===t[Ea.fullscreenEnabled]){r.disable()}return r}var r=n.prototype;r.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)};r.handleFullscreenChange=function(){if(this.player_.isFullscreen()){this.controlText("Non-Fullscreen")}else{this.controlText("Fullscreen")}};r.handleClick=function(){if(!this.player_.isFullscreen()){this.player_.requestFullscreen()}else{this.player_.exitFullscreen()}};return n}(Sr);zr.prototype.controlText_="Fullscreen";ra.registerComponent("FullscreenToggle",zr);var Gr=function(e,t){if(t.tech_&&!t.tech_.featuresVolumeControl){e.addClass("vjs-hidden")}e.on(t,"loadstart",function(){if(!t.tech_.featuresVolumeControl){e.addClass("vjs-hidden")}else{e.removeClass("vjs-hidden")}})},Wr=function(e){a(t,e);function t(){return e.apply(this,arguments)||this}var n=t.prototype;n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:""})};return t}(ra);ra.registerComponent("VolumeLevel",Wr);var Kr=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.on("slideractive",n.updateLastVolume_);n.on(t,"volumechange",n.updateARIAAttributes);t.ready(function(){return n.updateARIAAttributes()});return n}var n=t.prototype;n.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"})};n.handleMouseDown=function(t){if(!K(t)){return}e.prototype.handleMouseDown.call(this,t)};n.handleMouseMove=function(e){if(!K(e)){return}this.checkMuted();this.player_.volume(this.calculateDistance(e))};n.checkMuted=function(){if(this.player_.muted()){this.player_.muted(!1)}};n.getPercent=function(){if(this.player_.muted()){return 0}return this.player_.volume()};n.stepForward=function(){this.checkMuted();this.player_.volume(this.player_.volume()+.1)};n.stepBack=function(){this.checkMuted();this.player_.volume(this.player_.volume()-.1)};n.updateARIAAttributes=function(){var e=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",e);this.el_.setAttribute("aria-valuetext",e+"%")};n.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())};n.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",function(){if(0===e.player_.volume()){e.player_.lastVolume_(t)}})};return t}(Rr);Kr.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};Kr.prototype.playerEvent="volumechange";ra.registerComponent("VolumeBar",Kr);var Yr=function(e){a(t,e);function t(t,a){var n;if(void 0===a){a={}}a.vertical=a.vertical||!1;if("undefined"==typeof a.volumeBar||h(a.volumeBar)){a.volumeBar=a.volumeBar||{};a.volumeBar.vertical=a.vertical}n=e.call(this,t,a)||this;Gr(o(o(n)),t);n.throttledHandleMouseMove=zt(qt(o(o(n)),n.handleMouseMove),25);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")});return n}var n=t.prototype;n.createEl=function(){var t="vjs-volume-horizontal";if(this.options_.vertical){t="vjs-volume-vertical"}return e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})};n.handleMouseDown=function(){var e=this.el_.ownerDocument;this.on(e,"mousemove",this.throttledHandleMouseMove);this.on(e,"touchmove",this.throttledHandleMouseMove);this.on(e,"mouseup",this.handleMouseUp);this.on(e,"touchend",this.handleMouseUp)};n.handleMouseUp=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseMove);this.off(e,"touchmove",this.throttledHandleMouseMove);this.off(e,"mouseup",this.handleMouseUp);this.off(e,"touchend",this.handleMouseUp)};n.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)};return t}(ra);Yr.prototype.options_={children:["volumeBar"]};ra.registerComponent("VolumeControl",Yr);var Xr=function(e,t){if(t.tech_&&!t.tech_.featuresMuteControl){e.addClass("vjs-hidden")}e.on(t,"loadstart",function(){if(!t.tech_.featuresMuteControl){e.addClass("vjs-hidden")}else{e.removeClass("vjs-hidden")}})},$r=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;Xr(o(o(n)),t);n.on(t,["loadstart","volumechange"],n.update);return n}var n=t.prototype;n.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)};n.handleClick=function(){var e=this.player_.volume(),t=this.player_.lastVolume_();if(0===e){var a=.1>t?.1:t;this.player_.volume(a);this.player_.muted(!1)}else{this.player_.muted(this.player_.muted()?!1:!0)}};n.update=function(){this.updateIcon_();this.updateControlText_()};n.updateIcon_=function(){var e=this.player_.volume(),t=3;if(ua&&this.player_.tech_&&this.player_.tech_.el_){this.player_.muted(this.player_.tech_.el_.muted)}if(0===e||this.player_.muted()){t=0}else if(.33>e){t=1}else if(.67>e){t=2}for(var a=0;4>a;a++){D(this.el_,"vjs-vol-"+a)}x(this.el_,"vjs-vol-"+t)};n.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume(),t=e?"Unmute":"Mute";if(this.controlText()!==t){this.controlText(t)}};return t}(Sr);$r.prototype.controlText_="Mute";ra.registerComponent("MuteToggle",$r);var Qr=function(e){a(t,e);function t(t,a){var n;if(void 0===a){a={}}if("undefined"!=typeof a.inline){a.inline=a.inline}else{a.inline=!0}if("undefined"==typeof a.volumeControl||h(a.volumeControl)){a.volumeControl=a.volumeControl||{};a.volumeControl.vertical=!a.inline}n=e.call(this,t,a)||this;n.on(t,["loadstart"],n.volumePanelState_);n.on(n.volumeControl,["slideractive"],n.sliderActive_);n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_);return n}var n=t.prototype;n.sliderActive_=function(){this.addClass("vjs-slider-active")};n.sliderInactive_=function(){this.removeClass("vjs-slider-active")};n.volumePanelState_=function(){if(this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")){this.addClass("vjs-hidden")}if(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";if(!this.options_.inline){t="vjs-volume-panel-vertical"}return e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})};return t}(ra);Qr.prototype.options_={children:["muteToggle","volumeControl"]};ra.registerComponent("VolumePanel",Qr);var Jr=function(e){a(n,e);function n(t,a){var n=e.call(this,t,a)||this;if(a){n.menuButton_=a.menuButton}n.focusedChild_=-1;n.on("keydown",n.handleKeyDown);n.boundHandleBlur_=qt(o(o(n)),n.handleBlur);n.boundHandleTapClick_=qt(o(o(n)),n.handleTapClick);return n}var r=n.prototype;r.addEventListenerForItem=function(e){if(!(e instanceof ra)){return}this.on(e,"blur",this.boundHandleBlur_);this.on(e,["tap","click"],this.boundHandleTapClick_)};r.removeEventListenerForItem=function(e){if(!(e instanceof ra)){return}this.off(e,"blur",this.boundHandleBlur_);this.off(e,["tap","click"],this.boundHandleTapClick_)};r.removeChild=function(t){if("string"==typeof t){t=this.getChild(t)}this.removeEventListenerForItem(t);e.prototype.removeChild.call(this,t)};r.addItem=function(e){var t=this.addChild(e);if(t){this.addEventListenerForItem(t)}};r.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=E(t,{className:"vjs-menu-content"});this.contentEl_.setAttribute("role","menu");var a=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});a.appendChild(this.contentEl_);ae(a,"click",function(e){e.preventDefault();e.stopImmediatePropagation()});return a};r.dispose=function(){this.contentEl_=null;this.boundHandleBlur_=null;this.boundHandleTapClick_=null;e.prototype.dispose.call(this)};r.handleBlur=function(e){var a=e.relatedTarget||t.activeElement;if(!this.children().some(function(e){return e.el()===a})){var n=this.menuButton_;if(n&&n.buttonPressed_&&a!==n.el().firstChild){n.unpressButton()}}};r.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t)){return}var a=t.filter(function(t){return t.el()===e.target})[0];if(!a){return}if("CaptionSettingsMenuItem"!==a.name()){this.menuButton_.focus()}}};r.handleKeyDown=function(e){if(Ba.isEventKey(e,"Left")||Ba.isEventKey(e,"Down")){e.preventDefault();e.stopPropagation();this.stepForward()}else if(Ba.isEventKey(e,"Right")||Ba.isEventKey(e,"Up")){e.preventDefault();e.stopPropagation();this.stepBack()}};r.stepForward=function(){var e=0;if(this.focusedChild_!==void 0){e=this.focusedChild_+1}this.focus(e)};r.stepBack=function(){var e=0;if(this.focusedChild_!==void 0){e=this.focusedChild_-1}this.focus(e)};r.focus=function(e){if(void 0===e){e=0}var t=this.children().slice(),a=t.length&&t[0].className&&/vjs-menu-title/.test(t[0].className);if(a){t.shift()}if(0e){e=0}else if(e>=t.length){e=t.length-1}this.focusedChild_=e;t[e].el_.focus()}};return n}(ra);ra.registerComponent("Menu",Jr);var Zr=function(e){a(t,e);function t(t,a){var n;if(void 0===a){a={}}n=e.call(this,t,a)||this;n.menuButton_=new Sr(t,a);n.menuButton_.controlText(n.controlText_);n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=Sr.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+r;n.menuButton_.removeClass("vjs-control");n.addChild(n.menuButton_);n.update();n.enabled_=!0;n.on(n.menuButton_,"tap",n.handleClick);n.on(n.menuButton_,"click",n.handleClick);n.on(n.menuButton_,"keydown",n.handleKeyDown);n.on(n.menuButton_,"mouseenter",function(){n.menu.show()});n.on("keydown",n.handleSubmenuKeyDown);return n}var n=t.prototype;n.update=function(){var e=this.createMenu();if(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");if(this.items&&this.items.length<=this.hideThreshold_){this.hide()}else{this.show()}};n.createMenu=function(){var e=new Jr(this.player_,{menuButton:this});this.hideThreshold_=0;if(this.options_.title){var t=E("li",{className:"vjs-menu-title",innerHTML:le(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;var a=new ra(this.player_,{el:t});e.addItem(a)}this.items=this.createItems();if(this.items){for(var n=0;n=n.items.length){n.hide()}if(!r){return o(n)}var i=qt(o(o(n)),n.update);r.addEventListener("removetrack",i);r.addEventListener("addtrack",i);n.player_.on("ready",i);n.player_.on("dispose",function(){r.removeEventListener("removetrack",i);r.removeEventListener("addtrack",i)});return n}return t}(Zr);ra.registerComponent("TrackButton",ei);var ti=["Tab","Esc","Up","Down","Right","Left"],ai=function(e){a(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.selectable=a.selectable;n.isSelected_=a.selected||!1;n.multiSelectable=a.multiSelectable;n.selected(n.isSelected_);if(n.selectable){if(n.multiSelectable){n.el_.setAttribute("role","menuitemcheckbox")}else{n.el_.setAttribute("role","menuitemradio")}}else{n.el_.setAttribute("role","menuitem")}return n}var n=t.prototype;n.createEl=function(t,a,n){this.nonIconControl=!0;return e.prototype.createEl.call(this,"li",m({className:"vjs-menu-item",innerHTML:""+this.localize(this.options_.label)+"",tabIndex:-1},a),n)};n.handleKeyDown=function(t){if(!ti.some(function(e){return Ba.isEventKey(t,e)})){e.prototype.handleKeyDown.call(this,t)}};n.handleClick=function(){this.selected(!0)};n.selected=function(e){if(this.selectable){if(e){this.addClass("vjs-selected");this.el_.setAttribute("aria-checked","true");this.controlText(", selected");this.isSelected_=!0}else{this.removeClass("vjs-selected");this.el_.setAttribute("aria-checked","false");this.controlText("");this.isSelected_=!1}}};return t}(yr);ra.registerComponent("MenuItem",ai);var ni=function(n){a(r,n);function r(a,r){var i,s=r.track,d=a.textTracks();r.label=s.label||s.language||"Unknown";r.selected="showing"===s.mode;i=n.call(this,a,r)||this;i.track=s;i.kinds=(r.kinds||[r.kind||i.track.kind]).filter(Boolean);var l=function(){for(var e=arguments.length,t=Array(e),a=0;a"+this.localize(this.options_.label);if("captions"===this.options_.track.kind){r+="\n \n "+this.localize("Captions")+"\n "}r+="";var i=e.prototype.createEl.call(this,t,m({innerHTML:r},a),n);return i};return t}(ni);ra.registerComponent("SubsCapsMenuItem",ci);var mi=function(e){a(t,e);function t(t,a){var n;if(void 0===a){a={}}n=e.call(this,t,a)||this;n.label_="subtitles";if(-1<["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)){n.label_="captions"}n.menuButton_.controlText(le(n.label_));return n}var n=t.prototype;n.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)};n.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)};n.createItems=function(){var t=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")){t.push(new pi(this.player_,{kind:this.label_}));this.hideThreshold_+=1}t=e.prototype.createItems.call(this,t,ci);return t};return t}(ii);mi.prototype.kinds_=["captions","subtitles"];mi.prototype.controlText_="Subtitles";ra.registerComponent("SubsCapsButton",mi);var gi=function(e){a(t,e);function t(t,a){var n,r=a.track,i=t.audioTracks();a.label=r.label||r.language||"Unknown";a.selected=r.enabled;n=e.call(this,t,a)||this;n.track=r;n.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=Array(e),a=0;a"+this.localize(this.options_.label);if("main-desc"===this.options_.track.kind){r+="\n \n "+this.localize("Descriptions")+"\n "}r+="";var i=e.prototype.createEl.call(this,t,m({innerHTML:r},a),n);return i};n.handleClick=function(t){var a=this.player_.audioTracks();e.prototype.handleClick.call(this,t);for(var n=0,r;ne){a=t[n];break}}this.player().playbackRate(a)};n.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates};n.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0 select",id:"captions-background-color-%s",label:"Color",options:[ki,xi,Pi,Li,Ci,Di,Ii,Ei]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Ai,wi,Oi]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[xi,ki,Pi,Li,Ci,Di,Ii,Ei]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:+e}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Ai,wi]},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:[Oi,wi,Ai]}};Ui.windowColor.options=Ui.backgroundColor.options;function dt(e,t){if(t){e=t(e)}if(e&&"none"!==e){return e}}function lt(e,t){var a=e.options[e.options.selectedIndex].value;return dt(a,t)}function pt(e,t,a){if(!t){return}for(var n=0;n",this.localize(r.label),"","").join("")};r.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return["
","",this.localize("Text"),"",this.createElSelect_("color",e),"",this.createElSelect_("textOpacity",e),"","
"].join("")};r.createElBgColor_=function(){var e="captions-background-"+this.id_;return["
","",this.localize("Background"),"",this.createElSelect_("backgroundColor",e),"",this.createElSelect_("backgroundOpacity",e),"","
"].join("")};r.createElWinColor_=function(){var e="captions-window-"+this.id_;return["
","",this.localize("Window"),"",this.createElSelect_("windowColor",e),"",this.createElSelect_("windowOpacity",e),"","
"].join("")};r.createElColors_=function(){return E("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})};r.createElFont_=function(){return E("div",{className:"vjs-track-settings-font",innerHTML:["
",this.createElSelect_("fontPercent","","legend"),"
","
",this.createElSelect_("edgeStyle","","legend"),"
","
",this.createElSelect_("fontFamily","","legend"),"
"].join("")})};r.createElControls_=function(){var e=this.localize("restore all settings to the default values");return E("div",{className:"vjs-track-settings-controls",innerHTML:["",""].join("")})};r.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]};r.label=function(){return this.localize("Caption Settings Dialog")};r.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")};r.buildCSSClass=function(){return t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"};r.getValues=function(){var e=this;return c(Ui,function(t,a,n){var r=lt(e.$(a.selector),a.parser);if(r!==void 0){t[n]=r}return t},{})};r.setValues=function(e){var t=this;u(Ui,function(a,n){pt(t.$(a.selector),e[n],a.parser)})};r.setDefaults=function(){var e=this;u(Ui,function(t){var a=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=a})};r.restoreSettings=function(){var t;try{t=JSON.parse(e.localStorage.getItem("vjs-text-track-settings"))}catch(e){Et.warn(e)}if(t){this.setValues(t)}};r.saveSettings=function(){if(!this.options_.persistTextTrackSettings){return}var t=this.getValues();try{if(Object.keys(t).length){e.localStorage.setItem("vjs-text-track-settings",JSON.stringify(t))}else{e.localStorage.removeItem("vjs-text-track-settings")}}catch(e){Et.warn(e)}};r.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");if(e){e.updateDisplay()}};r.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,a=e&&e.captionsButton;if(t){t.focus()}else if(a){a.focus()}};return n}(za);ra.registerComponent("TextTrackSettings",Ri);var Mi=function(t){a(n,t);function n(a,n){var r,i=n.ResizeObserver||e.ResizeObserver;if(null===n.ResizeObserver){i=!1}var s=ue({createEl:!i,reportTouchActivity:!1},n);r=t.call(this,a,s)||this;r.ResizeObserver=n.ResizeObserver||e.ResizeObserver;r.loadListener_=null;r.resizeObserver_=null;r.debouncedHandler_=Gt(function(){r.resizeHandler()},100,!1,o(o(r)));if(i){r.resizeObserver_=new r.ResizeObserver(r.debouncedHandler_);r.resizeObserver_.observe(a.el())}else{r.loadListener_=function(){if(!r.el_||!r.el_.contentWindow){return}var e=r.debouncedHandler_,t=r.unloadListener_=function(){ne(this,"resize",e);ne(this,"unload",t);t=null};ae(r.el_.contentWindow,"unload",t);ae(r.el_.contentWindow,"resize",e)};r.one("load",r.loadListener_)}return r}var r=n.prototype;r.createEl=function(){return t.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})};r.resizeHandler=function(){if(!this.player_||!this.player_.trigger){return}this.player_.trigger("playerresize")};r.dispose=function(){if(this.debouncedHandler_){this.debouncedHandler_.cancel()}if(this.resizeObserver_){if(this.player_.el()){this.resizeObserver_.unobserve(this.player_.el())}this.resizeObserver_.disconnect()}if(this.loadListener_){this.off("load",this.loadListener_)}if(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)};return n}(ra);ra.registerComponent("ResizeManager",Mi);var Bi=function(e){a(n,e);function n(a,n){var r,i=ue({createEl:!1},n);r=e.call(this,a,i)||this;r.reset_();r.on(r.player_,"durationchange",r.handleDurationchange);if(Ta&&"hidden"in t&&"visibilityState"in t){r.on(t,"visibilitychange",r.handleVisibilityChange)}return r}var r=n.prototype;r.handleVisibilityChange=function(){if(this.player_.duration()!==1/0){return}if(t.hidden){this.stopTracking()}else{this.startTracking()}};r.isBehind_=function(){if(!this.timeupdateSeen_){return!1}var e=this.liveCurrentTime(),t=this.player_.currentTime(),a=this.seekableIncrement_;return e!==1/0&&e-(2*a+.07)>=t};r.trackLive_=function(){this.pastSeekEnd_=this.pastSeekEnd_;var e=this.player_.seekable();if(!e||!e.length){return}var t=this.seekableEnd();if(t!==this.lastSeekEnd_){if(this.lastSeekEnd_){this.seekableIncrement_=Math.abs(t-this.lastSeekEnd_)}this.pastSeekEnd_=0;this.lastSeekEnd_=t;this.trigger("seekableendchange")}this.pastSeekEnd_=this.pastSeekEnd()+.03;if(this.isBehind_()!==this.behindLiveEdge()){this.behindLiveEdge_=this.isBehind_();this.trigger("liveedgechange")}};r.handleDurationchange=function(){if(this.player_.duration()===1/0){this.startTracking()}else{this.stopTracking()}};r.startTracking=function(){var e=this;if(this.isTracking()){return}this.trackingInterval_=this.setInterval(this.trackLive_,30);this.trackLive_();this.on(this.player_,"play",this.trackLive_);this.on(this.player_,"pause",this.trackLive_);this.one(this.player_,"play",this.handlePlay);if(!this.timeupdateSeen_){this.handleTimeupdate=function(){e.timeupdateSeen_=!0;e.handleTimeupdate=null};this.one(this.player_,"timeupdate",this.handleTimeupdate)}};r.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge)};r.reset_=function(){this.pastSeekEnd_=0;this.lastSeekEnd_=null;this.behindLiveEdge_=null;this.timeupdateSeen_=!1;this.clearInterval(this.trackingInterval_);this.trackingInterval_=null;this.seekableIncrement_=12;this.off(this.player_,"play",this.trackLive_);this.off(this.player_,"pause",this.trackLive_);this.off(this.player_,"play",this.handlePlay);this.off(this.player_,"timeupdate",this.seekToLiveEdge);if(this.handleTimeupdate){this.off(this.player_,"timeupdate",this.handleTimeupdate);this.handleTimeupdate=null}};r.stopTracking=function(){if(!this.isTracking()){return}this.reset_()};r.seekableEnd=function(){var e=this.player_.seekable(),t=[],a=e?e.length:0;while(a--){t.push(e.end(a))}return t.length?t.sort()[t.length-1]:1/0};r.seekableStart=function(){var e=this.player_.seekable(),t=[],a=e?e.length:0;while(a--){t.push(e.start(a))}return t.length?t.sort()[0]:0};r.liveWindow=function(){var e=this.liveCurrentTime();if(e===1/0){return 1/0}return 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(){return this.pastSeekEnd_};r.behindLiveEdge=function(){return this.behindLiveEdge_};r.isTracking=function(){return"number"==typeof this.trackingInterval_};r.seekToLiveEdge=function(){if(this.atLiveEdge()){return}this.player_.currentTime(this.liveCurrentTime());if(this.player_.paused()){this.player_.play()}};r.dispose=function(){this.stopTracking();e.prototype.dispose.call(this)};return n}(ra);ra.registerComponent("LiveTracker",Bi);var Ni=function(e){var t=e.el();if(t.hasAttribute("src")){e.triggerSourceset(t.src);return!0}var a=e.$$("source"),n=[],r="";if(!a.length){return!1}for(var s=0,o;sba){return!1}try{var e=Wi.TEST_VID.playbackRate;Wi.TEST_VID.playbackRate=e/2+.1;return e!==Wi.TEST_VID.playbackRate}catch(t){return!1}};Wi.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(t){return!1}return!0};Wi.supportsNativeTextTracks=function(){return Sa||ua&&fa};Wi.supportsNativeVideoTracks=function(){return!!(Wi.TEST_VID&&Wi.TEST_VID.videoTracks)};Wi.supportsNativeAudioTracks=function(){return!!(Wi.TEST_VID&&Wi.TEST_VID.audioTracks)};Wi.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];Wi.prototype.featuresVolumeControl=Wi.canControlVolume();Wi.prototype.featuresMuteControl=Wi.canMuteVolume();Wi.prototype.featuresPlaybackRate=Wi.canControlPlaybackRate();Wi.prototype.featuresSourceset=Wi.canOverrideAttributes();Wi.prototype.movingMediaElementInDOM=!ua;Wi.prototype.featuresFullscreenResize=!0;Wi.prototype.featuresProgressEvents=!0;Wi.prototype.featuresTimeupdateEvents=!0;Wi.prototype.featuresNativeTextTracks=Wi.supportsNativeTextTracks();Wi.prototype.featuresNativeVideoTracks=Wi.supportsNativeVideoTracks();Wi.prototype.featuresNativeAudioTracks=Wi.supportsNativeAudioTracks();var Yi=Wi.TEST_VID&&Wi.TEST_VID.constructor.prototype.canPlayType,Xi=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;Wi.patchCanPlayType=function(){if(4<=ga&&!ya&&!fa){Wi.TEST_VID.constructor.prototype.canPlayType=function(e){if(e&&Xi.test(e)){return"maybe"}return Yi.call(this,e)}}};Wi.unpatchCanPlayType=function(){var e=Wi.TEST_VID.constructor.prototype.canPlayType;Wi.TEST_VID.constructor.prototype.canPlayType=Yi;return e};Wi.patchCanPlayType();Wi.disposeMediaElement=function(e){if(!e){return}if(e.parentNode){e.parentNode.removeChild(e)}while(e.hasChildNodes()){e.removeChild(e.firstChild)}e.removeAttribute("src");if("function"==typeof e.load){(function(){try{e.load()}catch(t){}})()}};Wi.resetMediaElement=function(e){if(!e){return}var t=e.querySelectorAll("source"),a=t.length;while(a--){e.removeChild(t[a])}e.removeAttribute("src");if("function"==typeof e.load){(function(){try{e.load()}catch(t){}})()}};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){Wi.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){Wi.prototype["set"+le(e)]=function(t){this.el_[e]=t;if(t){this.el_.setAttribute(e,e)}else{this.el_.removeAttribute(e)}}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(e){Wi.prototype[e]=function(){return this.el_[e]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach(function(e){Wi.prototype["set"+le(e)]=function(t){this.el_[e]=t}});["pause","load","play"].forEach(function(e){Wi.prototype[e]=function(){return this.el_[e]()}});rr.withSourceHandlers(Wi);Wi.nativeSourceHandler={};Wi.nativeSourceHandler.canPlayType=function(e){try{return Wi.TEST_VID.canPlayType(e)}catch(t){return""}};Wi.nativeSourceHandler.canHandleSource=function(e){if(e.type){return Wi.nativeSourceHandler.canPlayType(e.type)}else if(e.src){var t=dn(e.src);return Wi.nativeSourceHandler.canPlayType("video/"+t)}return""};Wi.nativeSourceHandler.handleSource=function(e,t){t.setSrc(e.src)};Wi.nativeSourceHandler.dispose=function(){};Wi.registerSourceHandler(Wi.nativeSourceHandler);rr.registerTech("Html5",Wi);function ct(){var e=d(["\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n "]);ct=function(){return e};return e}var $i=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Qi={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ji=["tiny","xsmall","small","medium","large","xlarge","huge"],Zi={};Ji.forEach(function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Zi[e]="vjs-layout-"+t});var es={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},ts=function(n){a(r,n);function r(e,t,a){var i;e.id=e.id||t.id||"vjs_video_"+Y();t=m(r.getTagSettings(e),t);t.initChildren=!1;t.createEl=!1;t.evented=!1;t.reportTouchActivity=!1;if(!t.language){if("function"==typeof e.closest){var s=e.closest("[lang]");if(s&&s.getAttribute){t.language=s.getAttribute("lang")}}else{var d=e;while(d&&1===d.nodeType){if(O(d).hasOwnProperty("lang")){t.language=d.getAttribute("lang");break}d=d.parentNode}}}i=n.call(this,null,t,a)||this;i.boundDocumentFullscreenChange_=qt(o(o(i)),i.documentFullscreenChange_);i.boundFullWindowOnEscKey_=qt(o(o(i)),i.fullWindowOnEscKey);i.log=Lt(i.id_);i.isPosterFromTech_=!1;i.queuedCallbacks_=[];i.isReady_=!1;i.hasStarted_=!1;i.userActive_=!1;if(!i.options_||!i.options_.techOrder||!i.options_.techOrder.length){throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?")}i.tag=e;i.tagAttributes=e&&O(e);i.language(i.options_.language);if(t.languages){var l={};Object.getOwnPropertyNames(t.languages).forEach(function(e){l[e.toLowerCase()]=t.languages[e]});i.languages_=l}else{i.languages_=r.prototype.options_.languages}i.resetCache_();i.poster_=t.poster||"";i.controls_=!!t.controls;e.controls=!1;e.removeAttribute("controls");i.changingSrc_=!1;i.playCallbacks_=[];i.playTerminatedQueue_=[];if(e.hasAttribute("autoplay")){i.autoplay(!0)}else{i.autoplay(i.options_.autoplay)}if(t.plugins){Object.keys(t.plugins).forEach(function(e){if("function"!=typeof i[e]){throw new Error("plugin \""+e+"\" does not exist")}})}i.scrubbing_=!1;i.el_=i.createEl();oe(o(o(i)),{eventBusKey:"el_"});if(i.fluid_){i.on("playerreset",i.updateStyleEl_)}var p=ue(i.options_);if(t.plugins){Object.keys(t.plugins).forEach(function(e){i[e](t.plugins[e])})}i.options_.playerOptions=p;i.middleware_=[];i.initChildren();i.isAudio("audio"===e.nodeName.toLowerCase());if(i.controls()){i.addClass("vjs-controls-enabled")}else{i.addClass("vjs-controls-disabled")}i.el_.setAttribute("role","region");if(i.isAudio()){i.el_.setAttribute("aria-label",i.localize("Audio Player"))}else{i.el_.setAttribute("aria-label",i.localize("Video Player"))}if(i.isAudio()){i.addClass("vjs-audio")}if(i.flexNotSupported_()){i.addClass("vjs-no-flex")}if(ka){i.addClass("vjs-touch-enabled")}if(!ua){i.addClass("vjs-workinghover")}r.players[i.id_]=o(o(i));var u="7.5.5".split(".")[0];i.addClass("vjs-v"+u);i.userActive(!0);i.reportUserActivity();i.one("play",i.listenForUserActivity_);i.on("stageclick",i.handleStageClick_);i.on("keydown",i.handleKeyDown);i.breakpoints(i.options_.breakpoints);i.responsive(i.options_.responsive);return i}var i=r.prototype;i.dispose=function(){var e=this;this.trigger("dispose");this.off("dispose");ne(t,Ea.fullscreenchange,this.boundDocumentFullscreenChange_);ne(t,"keydown",this.boundFullWindowOnEscKey_);if(this.styleEl_&&this.styleEl_.parentNode){this.styleEl_.parentNode.removeChild(this.styleEl_);this.styleEl_=null}r.players[this.id_]=null;if(this.tag&&this.tag.player){this.tag.player=null}if(this.el_&&this.el_.player){this.el_.player=null}if(this.tech_){this.tech_.dispose();this.isPosterFromTech_=!1;this.poster_=""}if(this.playerElIngest_){this.playerElIngest_=null}if(this.tag){this.tag=null}tt(this);qn.names.forEach(function(t){var a=qn[t],n=e[a.getterName]();if(n&&n.off){n.off()}});n.prototype.dispose.call(this)};i.createEl=function(){var a=this.tag,r,s=this.playerElIngest_=a.parentNode&&a.parentNode.hasAttribute&&a.parentNode.hasAttribute("data-vjs-player"),o="video-js"===this.tag.tagName.toLowerCase();if(s){r=this.el_=a.parentNode}else if(!o){r=this.el_=n.prototype.createEl.call(this,"div")}var d=O(a);if(o){r=this.el_=a;a=this.tag=t.createElement("video");while(r.children.length){a.appendChild(r.firstChild)}if(!P(r,"video-js")){x(r,"video-js")}r.appendChild(a);s=this.playerElIngest_=r;Object.keys(r).forEach(function(e){a[e]=r[e]})}a.setAttribute("tabindex","-1");d.tabindex="-1";if(Ta){a.setAttribute("role","application");d.role="application"}a.removeAttribute("width");a.removeAttribute("height");if("width"in d){delete d.width}if("height"in d){delete d.height}Object.getOwnPropertyNames(d).forEach(function(e){if(!(o&&"class"===e)){r.setAttribute(e,d[e])}if(o){a.setAttribute(e,d[e])}});a.playerId=a.id;a.id+="_html5_api";a.className="vjs-tech";a.player=r.player=this;this.addClass("vjs-paused");if(!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=Ht("vjs-styles-dimensions");var l=Dt(".vjs-styles-defaults"),p=Dt("head");p.insertBefore(this.styleEl_,l?l.nextSibling:p.firstChild)}this.fill_=!1;this.fluid_=!1;this.width(this.options_.width);this.height(this.options_.height);this.fill(this.options_.fill);this.fluid(this.options_.fluid);this.aspectRatio(this.options_.aspectRatio);for(var u=a.getElementsByTagName("a"),c=0,m;ce){e=0}this.techCall_("setCurrentTime",e);return}this.cache_.currentTime=this.techGet_("currentTime")||0;return this.cache_.currentTime};i.duration=function(e){if(e===void 0){return this.cache_.duration!==void 0?this.cache_.duration:NaN}e=parseFloat(e);if(0>e){e=1/0}if(e!==this.cache_.duration){this.cache_.duration=e;if(e===1/0){this.addClass("vjs-live");if(this.options_.liveui&&this.player_.liveTracker){this.addClass("vjs-liveui")}}else{this.removeClass("vjs-live");this.removeClass("vjs-liveui")}if(!isNaN(e)){this.trigger("durationchange")}}};i.remainingTime=function(){return this.duration()-this.currentTime()};i.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())};i.buffered=function e(){var e=this.techGet_("buffered");if(!e||!e.length){e=he(0,0)}return e};i.bufferedPercent=function(){return ye(this.buffered(),this.duration())};i.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),a=e.end(e.length-1);if(a>t){a=t}return a};i.volume=function(e){var t;if(e!==void 0){t=Math.max(0,Math.min(1,parseFloat(e)));this.cache_.volume=t;this.techCall_("setVolume",t);if(0=e){return}d=this.setTimeout(function(){if(!this.userActivity_){this.userActive(!1)}},e)},250)};i.playbackRate=function(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}if(this.tech_&&this.tech_.featuresPlaybackRate){return this.cache_.lastPlaybackRate||this.techGet_("playbackRate")}return 1};i.defaultPlaybackRate=function(e){if(e!==void 0){return this.techCall_("setDefaultPlaybackRate",e)}if(this.tech_&&this.tech_.featuresPlaybackRate){return this.techGet_("defaultPlaybackRate")}return 1};i.isAudio=function(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_};i.addTextTrack=function(e,t,a){if(this.tech_){return this.tech_.addTextTrack(e,t,a)}};i.addRemoteTextTrack=function(e,t){if(this.tech_){return this.tech_.addRemoteTextTrack(e,t)}};i.removeRemoteTextTrack=function(e){if(void 0===e){e={}}var t=e,a=t.track;if(!a){a=e}if(this.tech_){return this.tech_.removeRemoteTextTrack(a)}};i.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")};i.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0};i.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0};i.language=function(e){if(e===void 0){return this.language_}this.language_=(e+"").toLowerCase()};i.languages=function(){return ue(r.prototype.options_.languages,this.languages_)};i.toJSON=function(){var e=ue(this.options_),t=e.tracks;e.tracks=[];for(var a=0,n;a=a){return!1}mt.hooks_[e]=mt.hooks_[e].slice();mt.hooks_[e].splice(a,1);return!0};if(!0!==e.VIDEOJS_NO_DYNAMIC_STYLE&&v()){var hs=Dt(".vjs-styles-defaults");if(!hs){hs=Ht("vjs-styles-defaults");var ys=Dt("head");if(ys){ys.insertBefore(hs,ys.firstChild)}Vt(hs,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}se(1,mt);mt.VERSION="7.5.5";mt.options=ts.prototype.options_;mt.getPlayers=function(){return ts.players};mt.getPlayer=function(e){var t=ts.players,a;if("string"==typeof e){var n=gs(e),r=t[n];if(r){return r}a=Dt("#"+n)}else{a=e}if(S(a)){var i=a,s=i.player,o=i.playerId;if(s||t[o]){return s||t[o]}}};mt.getAllPlayers=function(){return Object.keys(ts.players).map(function(e){return ts.players[e]}).filter(Boolean)};mt.players=ts.players;mt.getComponent=ra.getComponent;mt.registerComponent=function(e,t){if(rr.isTech(t)){Et.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)")}ra.registerComponent.call(ra,e,t)};mt.getTech=rr.getTech;mt.registerTech=rr.registerTech;mt.use=function(e,t){ir[e]=ir[e]||[];ir[e].push(t)};Object.defineProperty(mt,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(mt.middleware,"TERMINATOR",{value:or,writeable:!1,enumerable:!0});mt.browser=Ca;mt.TOUCH_ENABLED=ka;mt.extend=ms;mt.mergeOptions=ue;mt.bind=qt;mt.registerPlugin=us.registerPlugin;mt.deregisterPlugin=us.deregisterPlugin;mt.plugin=function(e,t){Et.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead");return us.registerPlugin(e,t)};mt.getPlugins=us.getPlugins;mt.getPlugin=us.getPlugin;mt.getPluginVersion=us.getPluginVersion;mt.addLanguage=function(e,t){var a;e=(""+e).toLowerCase();mt.options.languages=ue(mt.options.languages,(a={},a[e]=t,a));return mt.options.languages[e]};mt.log=Et;mt.createLogger=Lt;mt.createTimeRange=mt.createTimeRanges=he;mt.formatTime=ot;mt.setFormatTime=function(e){Ir=e};mt.resetFormatTime=function(){Ir=Lr};mt.parseUrl=sn;mt.isCrossOrigin=ln;mt.EventTarget=Wt;mt.on=ae;mt.one=ie;mt.off=ne;mt.trigger=re;mt.xhr=wn;mt.TextTrack=Rn;mt.AudioTrack=Mn;mt.VideoTrack=Bn;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(e){mt[e]=function(){Et.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead");return At[e].apply(null,arguments)}});mt.computedStyle=y;mt.dom=At;mt.url=pn;var _s=Te(function(e){(function(){var t=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,a=/^([^\/?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,i={buildAbsoluteURL:function(e,t,n){n=n||{};e=e.trim();t=t.trim();if(!t){if(!n.alwaysNormalize){return e}var r=i.parseURL(e);if(!r){throw new Error("Error trying to parse base URL.")}r.path=i.normalizePath(r.path);return i.buildURLFromParts(r)}var s=i.parseURL(t);if(!s){throw new Error("Error trying to parse relative URL.")}if(s.scheme){if(!n.alwaysNormalize){return t}s.path=i.normalizePath(s.path);return i.buildURLFromParts(s)}var o=i.parseURL(e);if(!o){throw new Error("Error trying to parse base URL.")}if(!o.netLoc&&o.path&&"/"!==o.path[0]){var d=a.exec(o.path);o.netLoc=d[1];o.path=d[2]}if(o.netLoc&&!o.path){o.path="/"}var l={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc){l.netLoc=o.netLoc;if("/"!==s.path[0]){if(!s.path){l.path=o.path;if(!s.params){l.params=o.params;if(!s.query){l.query=o.query}}}else{var p=o.path,u=p.substring(0,p.lastIndexOf("/")+1)+s.path;l.path=i.normalizePath(u)}}}if(null===l.path){l.path=n.alwaysNormalize?i.normalizePath(s.path):s.path}return i.buildURLFromParts(l)},parseURL:function(e){var a=t.exec(e);if(!a){return null}return{scheme:a[1]||"",netLoc:a[2]||"",path:a[3]||"",params:a[4]||"",query:a[5]||"",fragment:a[6]||""}},normalizePath:function(e){e=e.split("").reverse().join("").replace(n,"");while(e.length!==(e=e.replace(r,"")).length){}return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=i})(Ma)});function gt(){gt=Object.assign||function(e){for(var t=1,a;te.duration){this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration});return}this.manifest.targetDuration=e.duration},totalduration:function(){if(!isFinite(e.duration)||0>e.duration){this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration});return}this.manifest.totalDuration=e.duration},start:function(){if(!e.attributes||isNaN(e.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}},"cue-out":function(){r.cueOut=e.data},"cue-out-cont":function(){r.cueOutCont=e.data},"cue-in":function(){r.cueIn=e.data}})[e.tagType]||o).call(a)},uri:function(){r.uri=e.uri;n.push(r);if(this.manifest.targetDuration&&!("duration"in r)){this.trigger("warn",{message:"defaulting segment duration to the target duration"});r.duration=this.manifest.targetDuration}if(s){r.key=s}r.timeline=l;if(i){r.map=i}r={}},comment:function(){},custom:function(){if(e.segment){r.custom=r.custom||{};r.custom[e.customType]=e.data}else{this.manifest.custom=this.manifest.custom||{};this.manifest.custom[e.customType]=e.data}}})[e.type].call(a)});return t}var a=t.prototype;a.push=function(e){this.lineStream.push(e)};a.end=function(){this.lineStream.push("\n")};a.addParser=function(e){this.parseStream.addParser(e)};a.addTagMapper=function(e){this.parseStream.addTagMapper(e)};return t}(fs),Cs=function(e){return!!e&&"object"===_typeof(e)},Es=function e(){for(var t=arguments.length,a=Array(t),n=0;nt.attributes.bandwidth){return e}e[r]={language:n,autoselect:!0,default:"main"===a,playlists:[ws(t)],uri:""};return e},{})},Rs=function(e){return e.reduce(function(e,t){var a=t.attributes.lang||"text";if(e[a]){return e}e[a]={language:a,default:!1,autoselect:!1,playlists:[Os(t)],uri:""};return e},{})},Ms=function(e){var t,a=e.attributes,n=e.segments,r={attributes:(t={NAME:a.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:a.width,height:a.height},CODECS:a.codecs,BANDWIDTH:a.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(a.type||"static"),timeline:a.periodIndex,resolvedUri:"",targetDuration:a.duration,segments:n,mediaSequence:n.length?n[0].number:1};if(a.contentProtection){r.contentProtection=a.contentProtection}return r},Bs=function(e){var t;if(!e.length){return{}}var a=e[0].attributes,n=a.sourceDuration,r=a.minimumUpdatePeriod,i=void 0===r?0:r,s=As(e.filter(function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType})).map(Ms),o=As(e.filter(function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType})),d=e.filter(function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType}),l={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(t={AUDIO:{},VIDEO:{}},t["CLOSED-CAPTIONS"]={},t.SUBTITLES={},t),uri:"",duration:n,playlists:s,minimumUpdatePeriod:1e3*i};if(o.length){l.mediaGroups.AUDIO.audio=Us(o)}if(d.length){l.mediaGroups.SUBTITLES.subs=Rs(d)}return l},Ns="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var js=function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e){(function(){var t=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,a=/^([^\/?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,i={buildAbsoluteURL:function(e,t,n){n=n||{};e=e.trim();t=t.trim();if(!t){if(!n.alwaysNormalize){return e}var r=i.parseURL(e);if(!r){throw new Error("Error trying to parse base URL.")}r.path=i.normalizePath(r.path);return i.buildURLFromParts(r)}var s=i.parseURL(t);if(!s){throw new Error("Error trying to parse relative URL.")}if(s.scheme){if(!n.alwaysNormalize){return t}s.path=i.normalizePath(s.path);return i.buildURLFromParts(s)}var o=i.parseURL(e);if(!o){throw new Error("Error trying to parse base URL.")}if(!o.netLoc&&o.path&&"/"!==o.path[0]){var d=a.exec(o.path);o.netLoc=d[1];o.path=d[2]}if(o.netLoc&&!o.path){o.path="/"}var l={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc){l.netLoc=o.netLoc;if("/"!==s.path[0]){if(!s.path){l.path=o.path;if(!s.params){l.params=o.params;if(!s.query){l.query=o.query}}}else{var p=o.path,u=p.substring(0,p.lastIndexOf("/")+1)+s.path;l.path=i.normalizePath(u)}}}if(null===l.path){l.path=n.alwaysNormalize?i.normalizePath(s.path):s.path}return i.buildURLFromParts(l)},parseURL:function(e){var a=t.exec(e);if(!a){return null}return{scheme:a[1]||"",netLoc:a[2]||"",path:a[3]||"",params:a[4]||"",query:a[5]||"",fragment:a[6]||""}},normalizePath:function(e){e=e.split("").reverse().join("").replace(n,"");while(e.length!==(e=e.replace(r,"")).length){}return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=i})(Ns)}),Fs=function(t,a){if(/^[a-z]+:/i.test(a)){return a}if(!/\/\//i.test(t)){t=js.buildAbsoluteURL(e.location.href,t)}return js.buildAbsoluteURL(t,a)},Hs=function(e){var t=e.baseUrl,a=void 0===t?"":t,n=e.source,r=void 0===n?"":n,i=e.range,s=void 0===i?"":i,o={uri:r,resolvedUri:Fs(a||"",r)};if(s){var d=s.split("-"),l=parseInt(d[0],10),p=parseInt(d[1],10);o.byterange={length:p-l,offset:l}}return o},Vs=function(e,t,a){var n=e.NOW,r=e.clientOffset,i=e.availabilityStartTime,s=e.timescale,o=void 0===s?1:s,d=e.start,l=void 0===d?0:d,p=e.minimumUpdatePeriod,u=void 0===p?0:p;return Math.ceil((((n+r)/1e3+u-(i+l))*o-t)/a)},qs=function(e,t){for(var a=e.type,n=void 0===a?"static":a,r=e.minimumUpdatePeriod,i=void 0===r?0:r,s=e.media,o=void 0===s?"":s,d=e.sourceDuration,l=e.timescale,p=void 0===l?1:l,u=e.startNumber,c=void 0===u?1:u,m=e.periodIndex,g=[],h=-1,y=0;yh){h=T}if(T&&T>h){h=T}var v=void 0;if(0>b){var S=y+1;if(S===t.length){if("dynamic"===n&&0=r){return i}return""+Array(r-i.length+1).join("0")+i}},Xs=function(e,t){return e.replace(Ks,Ys(t))},$s=function(e,t){if(!e.duration&&!t){return[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}if(e.duration){return Ws(e)}return qs(e,t)},Qs=function(e,t){var a={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,i=Hs({baseUrl:e.baseUrl,source:Xs(r.sourceURL,a),range:r.range}),s=$s(e,t);return s.map(function(t){a.Number=t.number;a.Time=t.time;var n=Xs(e.media||"",a);return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:Fs(e.baseUrl||"",n),map:i,number:t.number}})},Js={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"},Zs=function(e,t){var a=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,i=Hs({baseUrl:a,source:r.sourceURL,range:r.range}),s=Hs({baseUrl:a,source:t.media,range:t.mediaRange});s.map=i;return s},eo=function(e,t){var a=e.duration,n=e.segmentUrls,r=void 0===n?[]:n;if(!a&&!t||a&&t){throw new Error(Js.SEGMENT_TIME_UNSPECIFIED)}var i=r.map(function(t){return Zs(e,t)}),s;if(a){s=Ws(e)}if(t){s=qs(e,t)}var o=s.map(function(e,t){if(i[t]){var a=i[t];a.timeline=e.timeline;a.duration=e.duration;a.number=e.number;return a}}).filter(function(e){return e});return o},to=function(e){var t=e.baseUrl,a=e.initialization,n=void 0===a?{}:a,r=e.sourceDuration,i=e.timescale,s=void 0===i?1:i,o=e.indexRange,d=void 0===o?"":o,l=e.duration;if(!t){throw new Error(Js.NO_BASE_URL)}var p=Hs({baseUrl:t,source:n.sourceURL,range:n.range}),u=Hs({baseUrl:t,source:t,range:d});u.map=p;if(l){var c=Ws(e);if(c.length){u.duration=c[0].duration;u.timeline=c[0].timeline}}else if(r){u.duration=r/s;u.timeline=0}u.number=0;return[u]},ao=function(e){var t=e.attributes,a=e.segmentInfo,n,r;if(a.template){r=Qs;n=Es(t,a.template)}else if(a.base){r=to;n=Es(t,a.base)}else if(a.list){r=eo;n=Es(t,a.list)}if(!r){return{attributes:t}}var i=r(n,a.timeline);if(n.duration){var s=n,o=s.duration,d=s.timescale,l=void 0===d?1:d;n.duration=o/l}else if(i.length){n.duration=i.reduce(function(e,t){return Math.max(e,Math.ceil(t.duration))},0)}else{n.duration=0}return{attributes:n,segments:i}},no=function(e){return e.map(ao)},ro=function(e,t){return xs(e.childNodes).filter(function(e){var a=e.tagName;return a===t})},io=function(e){return e.textContent.trim()},so=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/,a=t.exec(e);if(!a){return 0}var n=a.slice(1),r=n[0],i=n[1],s=n[2],o=n[3],d=n[4],l=n[5];return parseFloat(r||0)*31536000+parseFloat(i||0)*2592000+parseFloat(s||0)*86400+parseFloat(o||0)*3600+parseFloat(d||0)*60+parseFloat(l||0)},oo=function(e){var t=/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;if(t.test(e)){e+="Z"}return Date.parse(e)},lo={mediaPresentationDuration:function(e){return so(e)},availabilityStartTime:function(e){return oo(e)/1e3},minimumUpdatePeriod:function(e){return so(e)},timeShiftBufferDepth:function(e){return so(e)},start:function(e){return so(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);if(isNaN(t)){return so(e)}return 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}},po=function(e){if(!(e&&e.attributes)){return{}}return xs(e.attributes).reduce(function(t,a){var e=lo[a.name]||lo.DEFAULT;t[a.name]=e(a.value);return t},{})};function _t(t){for(var a=e.atob(t),n=new Uint8Array(a.length),r=0;r>>0}}.toUnsigned,Co,Eo,Lo,Io,Po;Co=function(e,t){var a=[],n,r,s,o,d;if(!t.length){return null}for(n=0;n>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))};Uo=function(){return Ao(Zo.ftyp,ed,td,ed,ad)};Wo=function(e){return Ao(Zo.hdlr,id[e])};Ro=function(e){return Ao(Zo.mdat,e)};Go=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,255&e.duration>>>24,255&e.duration>>>16,255&e.duration>>>8,255&e.duration,85,196,0,0]);if(e.samplerate){t[12]=255&e.samplerate>>>24;t[13]=255&e.samplerate>>>16;t[14]=255&e.samplerate>>>8;t[15]=255&e.samplerate}return Ao(Zo.mdhd,t)};zo=function(e){return Ao(Zo.mdia,Go(e),Wo(e.type),Bo(e))};Mo=function(e){return Ao(Zo.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))};Bo=function(e){return Ao(Zo.minf,"video"===e.type?Ao(Zo.vmhd,sd):Ao(Zo.smhd,od),wo(),Yo(e))};No=function(e,t){var a=[],n=t.length;while(n--){a[n]=$o(t[n])}return Ao.apply(null,[Zo.moof,Mo(e)].concat(a))};jo=function(e){var t=e.length,a=[];while(t--){a[t]=Vo(e[t])}return Ao.apply(null,[Zo.moov,Ho(4294967295)].concat(a).concat(Fo(e)))};Fo=function(e){var t=e.length,a=[];while(t--){a[t]=Qo(e[t])}return Ao.apply(null,[Zo.mvex].concat(a))};Ho=function(e){var t=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 Ao(Zo.mvhd,t)};Ko=function(e){var t=e.samples||[],a=new Uint8Array(4+t.length),n,r;for(r=0;r>>8);n.push(255&t[s].byteLength);n=n.concat(Array.prototype.slice.call(t[s]))}for(s=0;s>>8);r.push(255&a[s].byteLength);r=r.concat(Array.prototype.slice.call(a[s]))}return Ao(Zo.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]),Ao(Zo.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([t.length]).concat(n).concat([a.length]).concat(r))),Ao(Zo.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))};t=function(e){return Ao(Zo.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]),Oo(e))}})();qo=function(e){var t=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 Ao(Zo.tkhd,t)};$o=function(e){var t,a,n,r,i,s,o;t=Ao(Zo.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/(Do+1));o=Math.floor(e.baseMediaDecodeTime%(Do+1));a=Ao(Zo.tfdt,new Uint8Array([1,0,0,0,255&s>>>24,255&s>>>16,255&s>>>8,255&s,255&o>>>24,255&o>>>16,255&o>>>8,255&o]));i=92;if("audio"===e.type){n=Jo(e,i);return Ao(Zo.traf,t,a,n)}r=Ko(e);n=Jo(e,r.length+i);return Ao(Zo.traf,t,a,n,r)};Vo=function(e){e.duration=e.duration||4294967295;return Ao(Zo.trak,qo(e),zo(e))};Qo=function(e){var t=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]);if("video"!==e.type){t[t.length-1]=0}return Ao(Zo.trex,t)};(function(){var e,t,a;a=function(e,t){var a=0,n=0,r=0,i=0;if(e.length){if(e[0].duration!==void 0){a=1}if(e[0].size!==void 0){n=2}if(e[0].flags!==void 0){r=4}if(e[0].compositionTimeOffset!==void 0){i=8}}return[0,0,a|n|r|i,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]};t=function(e,t){var n,r,s,o;r=e.samples||[];t+=20+16*r.length;n=a(r,t);for(o=0;o>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size,s.flags.isLeading<<2|s.flags.dependsOn,s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,s.flags.degradationPriority&61440,15&s.flags.degradationPriority,(4278190080&s.compositionTimeOffset)>>>24,(16711680&s.compositionTimeOffset)>>>16,(65280&s.compositionTimeOffset)>>>8,255&s.compositionTimeOffset])}return Ao(Zo.trun,new Uint8Array(n))};e=function(e,t){var n,r,s,o;r=e.samples||[];t+=20+8*r.length;n=a(r,t);for(o=0;o>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size])}return Ao(Zo.trun,new Uint8Array(n))};Jo=function(a,n){if("audio"===a.type){return e(a,n)}return t(a,n)}})();var md={ftyp:Uo,mdat:Ro,moof:No,moov:jo,initSegment:function(e){var t=Uo(),a=jo(e),n;n=new Uint8Array(t.byteLength+a.byteLength);n.set(t);n.set(a,t.byteLength);return n}},gd=function(){this.init=function(){var e={};this.on=function(t,a){if(!e[t]){e[t]=[]}e[t]=e[t].concat(a)};this.off=function(t,a){var n;if(!e[t]){return!1}n=e[t].indexOf(a);e[t]=e[t].slice();e[t].splice(n,1);return-1=n.duration)){n.duration=r[r.length-1].duration}r.push(n);return r},_d=function(e){var t,a,n=[],r=[];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;for(t=0;t=n.duration){n.duration=r[r.length-1].duration}r.byteLength+=n.byteLength;r.nalCount+=n.nalCount;r.duration+=n.duration;r.push(n);return r},fd=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},bd=function(e,t){var a=fd();a.dataOffset=t;a.compositionTimeOffset=e.pts-e.dts;a.duration=e.duration;a.size=4*e.length;a.size+=e.byteLength;if(e.keyFrame){a.flags.dependsOn=2;a.flags.isNonSyncSample=0}return a},Td=function(e,t){var a,n,r,s,o,d=t||0,l=[];for(a=0;ad||l>Md/2){return}p=Id[e.samplerate];if(!p){p=t[0].data}for(u=0;u=a){return e}t.minSegmentDts=1/0;return e.filter(function(e){if(e.dts>=a){t.minSegmentDts=Math.min(t.minSegmentDts,e.dts);t.minSegmentPts=t.minSegmentDts;return!0}return!1})},generateSampleTable:jd,concatenateFrameData:Fd},Vd={clearDtsInfo:function(e){delete e.minSegmentDts;delete e.maxSegmentDts;delete e.minSegmentPts;delete e.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(e,t){var a,n,r=e.minSegmentDts;if(!t){r-=e.timelineStartInfo.dts}a=e.timelineStartInfo.baseMediaDecodeTime;a+=r;a=Math.max(0,a);if("audio"===e.type){n=e.samplerate/9e4;a*=n;a=Math.floor(a)}return a},collectDtsInfo:function(e,t){if("number"==typeof t.pts){if(e.timelineStartInfo.pts===void 0){e.timelineStartInfo.pts=t.pts}if(e.minSegmentPts===void 0){e.minSegmentPts=t.pts}else{e.minSegmentPts=Math.min(e.minSegmentPts,t.pts)}if(e.maxSegmentPts===void 0){e.maxSegmentPts=t.pts}else{e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)}}if("number"==typeof t.dts){if(e.timelineStartInfo.dts===void 0){e.timelineStartInfo.dts=t.dts}if(e.minSegmentDts===void 0){e.minSegmentDts=t.dts}else{e.minSegmentDts=Math.min(e.minSegmentDts,t.dts)}if(e.maxSegmentDts===void 0){e.maxSegmentDts=t.dts}else{e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts)}}}},qd=4,zd=function(e){var t=0,a={payloadType:-1,payloadSize:0},n=0,r=0;while(te.type){this.dispatchCea608Packet(e)}},this);this.captionPackets_.length=0;this.ccStreams_.forEach(function(e){e.flush()},this)};Yd.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(e){e.reset()})};Yd.prototype.dispatchCea608Packet=function(e){if(this.setsChannel1Active(e)){this.activeCea608Channel_[e.type]=0}else if(this.setsChannel2Active(e)){this.activeCea608Channel_[e.type]=1}if(null===this.activeCea608Channel_[e.type]){return}this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)};Yd.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)};Yd.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)};var Xd={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},$d=function(e){if(null===e){return""}e=Xd[e]||e;return String.fromCharCode(e)},Qd=14,Jd=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Zd=function(){var e=[],t=Qd+1;while(t--){e.push("")}return e},el=function e(t,a){e.prototype.init.call(this);this.field_=t||0;this.dataChannel_=a||0;this.name_="CC"+((this.field_<<1|this.dataChannel_)+1);this.setConstants();this.reset();this.push=function(e){var t,a,n,r,i;t=32639&e.ccData;if(t===this.lastControlCode_){this.lastControlCode_=null;return}if(4096==(61440&t)){this.lastControlCode_=t}else if(t!==this.PADDING_){this.lastControlCode_=null}n=t>>>8;r=255&t;if(t===this.PADDING_){}else 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);a=this.displayed_;this.displayed_=this.nonDisplayed_;this.nonDisplayed_=a;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_){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}}else if(t===this.ERASE_DISPLAYED_MEMORY_){this.flushDisplayed(e.pts);this.displayed_=Zd()}else if(t===this.ERASE_NON_DISPLAYED_MEMORY_){this.nonDisplayed_=Zd()}else if(t===this.RESUME_DIRECT_CAPTIONING_){if("paintOn"!==this.mode_){this.flushDisplayed(e.pts);this.displayed_=Zd()}this.mode_="paintOn";this.startPts_=e.pts}else if(this.isSpecialCharacter(n,r)){n=(3&n)<<8;i=$d(n|r);this[this.mode_](e.pts,i);this.column_++}else if(this.isExtCharacter(n,r)){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}n=(3&n)<<8;i=$d(n|r);this[this.mode_](e.pts,i);this.column_++}else if(this.isMidRowCode(n,r)){this.clearFormatting(e.pts);this[this.mode_](e.pts," ");this.column_++;if(14==(14&r)){this.addFormatting(e.pts,["i"])}if(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=Jd.indexOf(7968&t);if("rollUp"===this.mode_){if(0>s-this.rollUpRows_+1){s=this.rollUpRows_-1}this.setRollUp(e.pts,s)}if(s!==this.row_){this.clearFormatting(e.pts);this.row_=s}if(1&r&&-1===this.formatting_.indexOf("u")){this.addFormatting(e.pts,["u"])}if(16==(16&t)){this.column_=4*((14&t)>>1)}if(this.isColorPAC(r)){if(14==(14&r)){this.addFormatting(e.pts,["i"])}}}else if(this.isNormalChar(n)){if(0===r){r=null}i=$d(n);i+=$d(r);this[this.mode_](e.pts,i);this.column_+=i.length}}};el.prototype=new hd;el.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){try{return e.trim()}catch(t){console.error("Skipping malformed caption.");return""}}).join("\n").replace(/^\n+|\n+$/g,"");if(t.length){this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})}};el.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=Zd();this.nonDisplayed_=Zd();this.lastControlCode_=null;this.column_=0;this.row_=Qd;this.rollUpRows_=2;this.formatting_=[]};el.prototype.setConstants=function(){if(0===this.dataChannel_){this.BASE_=16;this.EXT_=17;this.CONTROL_=(20|this.field_)<<8;this.OFFSET_=23}else if(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_};el.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&63>=t};el.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&63>=t};el.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&47>=t};el.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&35>=t};el.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=t};el.prototype.isColorPAC=function(e){return 64<=e&&79>=e||96<=e&&127>=e};el.prototype.isNormalChar=function(e){return 32<=e&&127>=e};el.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_){this.row_=Qd;this.mode_="rollUp";this.flushDisplayed(e);this.nonDisplayed_=Zd();this.displayed_=Zd()}if(t!==void 0&&t!==this.row_){for(var a=0;a"},"");this[this.mode_](e,a)};el.prototype.clearFormatting=function(e){if(!this.formatting_.length){return}var t=this.formatting_.reverse().reduce(function(e,t){return e+""},"");this.formatting_=[];this[this.mode_](e,t)};el.prototype.popOn=function(e,t){var a=this.nonDisplayed_[this.row_];a+=t;this.nonDisplayed_[this.row_]=a};el.prototype.rollUp=function(e,t){var a=this.displayed_[this.row_];a+=t;this.displayed_[this.row_]=a};el.prototype.shiftRowsUp_=function(){var e;for(e=0;et){a=-1}while(Math.abs(t-e)>4294967296){e+=a*8589934592}return e},rl=function e(t){var a,n;e.prototype.init.call(this);this.type_=t;this.push=function(e){if(e.type!==this.type_){return}if(n===void 0){n=e.dts}e.dts=nl(e.dts,n);e.pts=nl(e.pts,n);a=e.dts;this.trigger("data",e)};this.flush=function(){n=a;this.trigger("done")};this.discontinuity=function(){n=void 0;a=void 0}};rl.prototype=new hd;var il={TimestampRolloverStream:rl,handleRollover:nl},sl=function(e,t,a){var n,r="";for(n=t;ne.data.length||e.data[0]!==73||e.data[1]!==68||e.data[2]!==51)){if(t.debug){console.log("Skipping unrecognized metadata packet")}return}n.push(e);r+=e.data.byteLength;if(1===n.length){a=ll(e.data.subarray(6,10));a+=10}if(rl){return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.")}c=String.fromCharCode(s.data[o],s.data[o+1],s.data[o+2],s.data[o+3]);p={id:c,data:s.data.subarray(o+10,o+l+10)};p.key=p.id;if(pl[p.id]){pl[p.id](p);if("com.apple.streaming.transportStreamTimestamp"===p.owner){var m=p.data,d=(1&m[3])<<30|m[4]<<22|m[5]<<14|m[6]<<6|m[7]>>>2;d*=4;d+=3&m[7];p.timeStamp=d;if(s.pts===void 0&&s.dts===void 0){s.pts=p.timeStamp;s.dts=p.timeStamp}this.trigger("timestamp",p)}}s.frames.push(p);o+=10;o+=l}while(o>>4){n+=t[n]+1}if(0===a.pid){a.type="pat";e(t.subarray(n),a);this.trigger("data",a)}else if(a.pid===this.pmtPid){a.type="pmt";e(t.subarray(n),a);this.trigger("data",a);while(this.packetsWaitingForPmt.length){this.processPes_.apply(this,this.packetsWaitingForPmt.shift())}}else if(this.programMapTable===void 0){this.packetsWaitingForPmt.push([t,n,a])}else{this.processPes_(t,n,a)}};this.processPes_=function(e,t,a){if(a.pid===this.programMapTable.video){a.streamType=al.H264_STREAM_TYPE}else if(a.pid===this.programMapTable.audio){a.streamType=al.ADTS_STREAM_TYPE}else{a.streamType=this.programMapTable["timed-metadata"][a.pid]}a.type="pes";a.data=e.subarray(t);this.trigger("data",a)}};hl.prototype=new hd;hl.STREAM_TYPES={h264:27,adts:15};yl=function(){var e=this,t={data:[],size:0},a={data:[],size:0},n={data:[],size:0},r=function(e,t){var a;t.packetLength=6+(e[4]<<8|e[5]);t.dataAlignmentIndicator=0!=(4&e[6]);a=e[7];if(192&a){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;if(64&a){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])},i=function(t,a,n){var s=new Uint8Array(t.size),o={type:a},d=0,l=0,p=!1,u;if(!t.data.length||9>t.size){return}o.trackId=t.data[0].pid;for(d=0;d>5;l=1024*((3&e[a+6])+1);p=9e4*l/kl[(60&e[a+2])>>>2];o=a+r;if(e.byteLength>>6)+1,channelcount:(1&e[a+2])<<2|(192&e[a+3])>>>6,samplerate:kl[(60&e[a+2])>>>2],samplingfrequencyindex:(60&e[a+2])>>>2,samplesize:16,data:e.subarray(a+7+s,o)});if(e.byteLength===o){e=void 0;return}n++;e=e.subarray(o)}};this.flush=function(){this.trigger("done")}};Sl.prototype=new hd;var Cl=Sl,El;El=function(e){var t=e.byteLength,a=0,n=0;this.length=function(){return 8*t};this.bitsAvailable=function(){return 8*t+n};this.loadWord=function(){var r=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(0===s){throw new Error("no bytes available")}i.set(e.subarray(r,r+s));a=new DataView(i.buffer).getUint32(0);n=8*s;t-=s};this.skipBits=function(e){var r;if(n>e){a<<=e;n-=e}else{e-=n;r=Math.floor(e/8);e-=8*r;t-=r;this.loadWord();a<<=e;n-=e}};this.readBits=function(e){var r=Math.min(n,e),i=a>>>32-r;n-=r;if(0>>e)){a<<=e;n-=e;return e}}this.loadWord();return 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();if(1&e){return 1+e>>>1}return-1*(e>>>1)};this.readBoolean=function(){return 1===this.readBits(1)};this.readUnsignedByte=function(){return this.readBits(8)};this.loadWord()};var Ll=El,Il,Pl,xl;Pl=function(){var e=0,t,a;Pl.prototype.init.call(this);this.push=function(n){var r;if(!a){a=n.data}else{r=new Uint8Array(a.byteLength+n.data.byteLength);r.set(a);r.set(n.data,a.byteLength);a=r}for(;ev){o(16,d)}else{o(64,d)}}}}}d.skipUnsignedExpGolomb();m=d.readUnsignedExpGolomb();if(0===m){d.readUnsignedExpGolomb()}else if(1===m){d.skipBits(1);d.skipExpGolomb();d.skipExpGolomb();g=d.readUnsignedExpGolomb();for(v=0;v>>2]}return null},Ml=function(e){var t,a,n,r;t=10;if(64&e[5]){t+=4;t+=wl(e.subarray(10,14))}do{a=wl(e.subarray(t+4,t+8));if(1>a){return null}r=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);if("PRIV"===r){n=e.subarray(t+10,t+a+10);for(var s=0;s>>2;d*=4;d+=3&l[7];return d}break}}}t+=10;t+=a}while(t>4){return a+20}return a+10},parseAdtsSize:function(e,t){var a=(224&e[t+5])>>5,n=e[t+4]<<3,r=e[t+3]&6144;return r|n|a},parseType:function(e,t){if(e[t]===73&&e[t+1]===68&&e[t+2]===51){return"timed-metadata"}else if(e[t]&!0&&240==(240&e[t+1])){return"audio"}return null},parseSampleRate:Rl,parseAacTimestamp:Ml},Nl;Nl=function(){var e=new Uint8Array,t=0;Nl.prototype.init.call(this);this.setTimestamp=function(e){t=e};this.push=function(a){var n=0,r=0,i,s,o,d;if(e.length){d=e.length;e=new Uint8Array(a.byteLength+d);e.set(e.subarray(0,d));e.set(a,d)}else{e=a}while(3<=e.length-r){if(e[r]===73&&e[r+1]===68&&e[r+2]===51){if(10>e.length-r){break}n=Bl.parseId3TagSize(e,r);if(r+n>e.length){break}s={type:"timed-metadata",data:e.subarray(r,r+n)};this.trigger("data",s);r+=n;continue}else if(255==(255&e[r])&&240==(240&e[r+1])){if(7>e.length-r){break}n=Bl.parseAdtsSize(e,r);if(r+n>e.length){break}o={type:"audio",data:e.subarray(r,r+n),pts:t,dts:t};this.trigger("data",o);r+=n;continue}r++}i=e.length-r;if(0=-10000&&n<=45000){if(!r||a>n){r=o;a=n}}}if(r){return r.gop}return null};this.alignGopsAtStart_=function(e){var t,a,n,i,s,o,d,l;s=e.byteLength;o=e.nalCount;d=e.duration;t=a=0;while(tn.pts){t++;continue}a++;s-=i.byteLength;o-=i.nalCount;d-=i.duration}if(0===a){return e}if(a===e.length){return null}l=e.slice(a);l.byteLength=s;l.duration=d;l.nalCount=o;l.pts=l[0].pts;l.dts=l[0].dts;return l};this.alignGopsAtEnd_=function(e){var t,a,n,i,s,o;t=r.length-1;a=e.length-1;s=null;o=!1;while(0<=t&&0<=a){n=r[t];i=e[a];if(n.pts===i.pts){o=!0;break}if(n.pts>i.pts){t--;continue}if(t===r.length-1){s=a}a--}if(!o&&null===s){return null}var d;if(o){d=a}else{d=s}if(0===d){return e}var l=e.slice(d),p=l.reduce(function(e,t){e.byteLength+=t.byteLength;e.duration+=t.duration;e.nalCount+=t.nalCount;return e},{byteLength:0,duration:0,nalCount:0});l.byteLength=p.byteLength;l.duration=p.duration;l.nalCount=p.nalCount;l.pts=l[0].pts;l.dts=l[0].dts;return l};this.alignGopsWith=function(e){r=e}};zl.prototype=new hd;Kl=function(e,t){this.numberOfTracks=0;this.metadataStream=t;e=e||{};if("undefined"!=typeof e.remux){this.remuxTracks=!!e.remux}else{this.remuxTracks=!0}if("boolean"==typeof e.keepOriginalTimestamps){this.keepOriginalTimestamps=e.keepOriginalTimestamps}this.pendingTracks=[];this.videoTrack=null;this.pendingBoxes=[];this.pendingCaptions=[];this.pendingMetadata=[];this.pendingBytes=0;this.emittedTracks=0;Kl.prototype.init.call(this);this.push=function(e){if(e.text){return this.pendingCaptions.push(e)}if(e.frames){return this.pendingMetadata.push(e)}this.pendingTracks.push(e.track);this.pendingBoxes.push(e.boxes);this.pendingBytes+=e.boxes.byteLength;if("video"===e.track.type){this.videoTrack=e.track}if("audio"===e.track.type){this.audioTrack=e.track}}};Kl.prototype=new hd;Kl.prototype.flush=function(e){var t=0,a={captions:[],captionStreams:{},metadata:[],info:{}},n,r,s,o=0,d;if(this.pendingTracks.length=this.numberOfTracks){this.trigger("done");this.emittedTracks=0}return}}if(this.videoTrack){o=this.videoTrack.timelineStartInfo.pts;ql.forEach(function(e){a.info[e]=this.videoTrack[e]},this)}else if(this.audioTrack){o=this.audioTrack.timelineStartInfo.pts;Vl.forEach(function(e){a.info[e]=this.audioTrack[e]},this)}if(1===this.pendingTracks.length){a.type=this.pendingTracks[0].type}else{a.type="combined"}this.emittedTracks+=this.pendingTracks.length;s=md.initSegment(this.pendingTracks);a.initSegment=new Uint8Array(s.byteLength);a.initSegment.set(s);a.data=new Uint8Array(this.pendingBytes);for(d=0;d=this.numberOfTracks){this.trigger("done");this.emittedTracks=0}};Wl=function(e){var t=this,a=!0,n,r;Wl.prototype.init.call(this);e=e||{};this.baseMediaDecodeTime=e.baseMediaDecodeTime||0;this.transmuxPipeline_={};this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a;a.type="aac";a.metadataStream=new vl.MetadataStream;a.aacStream=new jl;a.audioTimestampRolloverStream=new vl.TimestampRolloverStream("audio");a.timedMetadataTimestampRolloverStream=new vl.TimestampRolloverStream("timed-metadata");a.adtsStream=new Cl;a.coalesceStream=new Kl(e,a.metadataStream);a.headOfPipeline=a.aacStream;a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream);a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream);a.metadataStream.on("timestamp",function(e){a.aacStream.setTimestamp(e.timeStamp)});a.aacStream.on("data",function(n){if("timed-metadata"===n.type&&!a.audioSegmentStream){r=r||{timelineStartInfo:{baseMediaDecodeTime:t.baseMediaDecodeTime},codec:"adts",type:"audio"};a.coalesceStream.numberOfTracks++;a.audioSegmentStream=new Gl(r,e);a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)}});a.coalesceStream.on("data",this.trigger.bind(this,"data"));a.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a;a.type="ts";a.metadataStream=new vl.MetadataStream;a.packetStream=new vl.TransportPacketStream;a.parseStream=new vl.TransportParseStream;a.elementaryStream=new vl.ElementaryStream;a.videoTimestampRolloverStream=new vl.TimestampRolloverStream("video");a.audioTimestampRolloverStream=new vl.TimestampRolloverStream("audio");a.timedMetadataTimestampRolloverStream=new vl.TimestampRolloverStream("timed-metadata");a.adtsStream=new Cl;a.h264Stream=new Fl;a.captionStream=new vl.CaptionStream;a.coalesceStream=new Kl(e,a.metadataStream);a.headOfPipeline=a.packetStream;a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream);a.elementaryStream.pipe(a.videoTimestampRolloverStream).pipe(a.h264Stream);a.elementaryStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream);a.elementaryStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream);a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream);a.elementaryStream.on("data",function(s){var o;if("metadata"===s.type){o=s.tracks.length;while(o--){if(!n&&"video"===s.tracks[o].type){n=s.tracks[o];n.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}else if(!r&&"audio"===s.tracks[o].type){r=s.tracks[o];r.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}}if(n&&!a.videoSegmentStream){a.coalesceStream.numberOfTracks++;a.videoSegmentStream=new zl(n,e);a.videoSegmentStream.on("timelineStartInfo",function(e){if(r){r.timelineStartInfo=e;a.audioSegmentStream.setEarliestDts(e.dts)}});a.videoSegmentStream.on("processedGopsInfo",t.trigger.bind(t,"gopInfo"));a.videoSegmentStream.on("segmentTimingInfo",t.trigger.bind(t,"videoSegmentTimingInfo"));a.videoSegmentStream.on("baseMediaDecodeTime",function(e){if(r){a.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}});a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)}if(r&&!a.audioSegmentStream){a.coalesceStream.numberOfTracks++;a.audioSegmentStream=new Gl(r,e);a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)}}});a.coalesceStream.on("data",this.trigger.bind(this,"data"));a.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setBaseMediaDecodeTime=function(t){var a=this.transmuxPipeline_;if(!e.keepOriginalTimestamps){this.baseMediaDecodeTime=t}if(r){r.timelineStartInfo.dts=void 0;r.timelineStartInfo.pts=void 0;Vd.clearDtsInfo(r);if(!e.keepOriginalTimestamps){r.timelineStartInfo.baseMediaDecodeTime=t}if(a.audioTimestampRolloverStream){a.audioTimestampRolloverStream.discontinuity()}}if(n){if(a.videoSegmentStream){a.videoSegmentStream.gopCache_=[];a.videoTimestampRolloverStream.discontinuity()}n.timelineStartInfo.dts=void 0;n.timelineStartInfo.pts=void 0;Vd.clearDtsInfo(n);a.captionStream.reset();if(!e.keepOriginalTimestamps){n.timelineStartInfo.baseMediaDecodeTime=t}}if(a.timedMetadataTimestampRolloverStream){a.timedMetadataTimestampRolloverStream.discontinuity()}};this.setAudioAppendStart=function(e){if(r){this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)}};this.alignGopsWith=function(e){if(n&&this.transmuxPipeline_.videoSegmentStream){this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)}};this.push=function(e){if(a){var t=Hl(e);if(t&&"aac"!==this.transmuxPipeline_.type){this.setupAacPipeline()}else if(!t&&"ts"!==this.transmuxPipeline_.type){this.setupTsPipeline()}a=!1}this.transmuxPipeline_.headOfPipeline.push(e)};this.flush=function(){a=!0;this.transmuxPipeline_.headOfPipeline.flush()};this.resetCaptions=function(){if(this.transmuxPipeline_.captionStream){this.transmuxPipeline_.captionStream.reset()}}};Wl.prototype=new hd;var $l={Transmuxer:Wl,VideoSegmentStream:zl,AudioSegmentStream:Gl,AUDIO_PROPERTIES:Vl,VIDEO_PROPERTIES:ql,generateVideoSegmentTimingInfo:Xl},Ql,Jl,Zl=xo.parseType,ep=function(e){return new Date(1e3*e-20828448e5)},tp=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]}},ap=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=[],n,r;for(n=0;n+4=r){a.push("MALFORMED DATA");continue}switch(31&e[n]){case 1:a.push("slice_layer_without_partitioning_rbsp");break;case 5:a.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:a.push("sei_rbsp");break;case 7:a.push("seq_parameter_set_rbsp");break;case 8:a.push("pic_parameter_set_rbsp");break;case 9:a.push("access_unit_delimiter_rbsp");break;default:a.push(31&"UNKNOWN NAL - "+e[n]);break;}}return a},np={avc1:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:Ql(e.subarray(78,e.byteLength))}},avcC:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},n=31&e[5],r,s,o,d;o=6;for(d=0;d>>2,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:31&e[26]>>>3,samplingFrequencyIndex:(7&e[26])<<1|1&e[27]>>>7,channelConfiguration:15&e[27]>>>3}}}},ftyp:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={majorBrand:Zl(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},n=8;while(n>10)+96);r.language+=String.fromCharCode(((992&n)>>5)+96);r.language+=String.fromCharCode((31&n)+96);return r},mdia:function(e){return{boxes:Ql(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:Ql(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};if(28>4,isDependedOn:(12&e[a])>>2,hasRedundancy:3&e[a]})}return t},sidx:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8),earliestPresentationTime:t.getUint32(12),firstOffset:t.getUint32(16)},n=t.getUint16(22),r;for(r=24;n;r+=12,n--){a.references.push({referenceType:(128&e[r])>>>7,referencedSize:2147483647&t.getUint32(r),subsegmentDuration:t.getUint32(r+4),startsWithSap:!!(128&e[r+8]),sapType:(112&e[r+8])>>>4,sapDeltaTime:268435455&t.getUint32(r+8)})}return a},smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:Ql(e)}},stco:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},n=t.getUint32(4),r;for(r=8;n;r+=4,n--){a.chunkOffsets.push(t.getUint32(r))}return a},stsc:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=t.getUint32(4),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]},r;for(r=8;a;r+=12,a--){n.sampleToChunks.push({firstChunk:t.getUint32(r),samplesPerChunk:t.getUint32(r+4),sampleDescriptionIndex:t.getUint32(r+8)})}return n},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:Ql(e.subarray(8))}},stsz:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:t.getUint32(4),entries:[]},n;for(n=12;n>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},a=new DataView(e.buffer,e.byteOffset,e.byteLength),n=1&t.flags[2],r=4&t.flags[2],i=1&t.flags[1],s=2&t.flags[1],o=4&t.flags[1],d=8&t.flags[1],l=a.getUint32(4),p=8,u;if(n){t.dataOffset=a.getInt32(p);p+=4}if(r&&l){u={flags:tp(e.subarray(p,p+4))};p+=4;if(i){u.duration=a.getUint32(p);p+=4}if(s){u.size=a.getUint32(p);p+=4}if(d){u.compositionTimeOffset=a.getUint32(p);p+=4}t.samples.push(u);l--}while(l--){u={};if(i){u.duration=a.getUint32(p);p+=4}if(s){u.size=a.getUint32(p);p+=4}if(o){u.flags=tp(e.subarray(p,p+4));p+=4}if(d){u.compositionTimeOffset=a.getUint32(p);p+=4}t.samples.push(u)}return t},"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}};Ql=function(e){for(var t=0,a=[],n,r,s,o,d,l=new ArrayBuffer(e.length),p=new Uint8Array(l),u=0;u"}if(1===i.length){return n+"<"+i.join("").slice(1)+">"}return n+"<\n"+i.map(function(e){return a+" "+e}).join("\n")+"\n"+a+" >"}return n+JSON.stringify(r,null,2).split("\n").map(function(e,t){if(0===t){return e}return a+" "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+Jl(e.boxes,t+1):"")}).join("\n")};var rp={inspect:Ql,textify:Jl,parseTfdt:np.tfdt,parseHdlr:np.hdlr,parseTfhd:np.tfhd,parseTrun:np.trun,parseSidx:np.sidx},ip=Kd.discardEmulationPreventionBytes,sp=tl.CaptionStream,op=function(e,t){for(var a=e,n=0,r;n=d){continue}switch(31&e[o]){case 6:var p=e.subarray(o+1,o+1+d),u=op(o,t);s={nalUnitType:"sei_rbsp",size:d,data:p,escapedRBSP:ip(p),trackId:a};if(u){s.pts=u.pts;s.dts=u.dts;l=u}else{s.pts=l.pts;s.dts=l.dts}r.push(s);break;default:break;}}return r},lp=function(e,t,a){var n=t,r=a.defaultSampleDuration||0,i=a.defaultSampleSize||0,s=a.trackId,o=[];e.forEach(function(e){var t=rp.parseTrun(e),a=t.samples;a.forEach(function(e){if(e.duration===void 0){e.duration=r}if(e.size===void 0){e.size=i}e.trackId=s;e.dts=n;if(e.compositionTimeOffset===void 0){e.compositionTimeOffset=0}e.pts=n+e.compositionTimeOffset;n+=e.duration});o=o.concat(a)});return o},pp=function(e,t){var a=xo.findBox(e,["moof","traf"]),n=xo.findBox(e,["mdat"]),r={},i=[];n.forEach(function(e,t){var n=a[t];i.push({mdat:e,traf:n})});i.forEach(function(e){var a=e.mdat,n=e.traf,i=xo.findBox(n,["tfhd"]),s=rp.parseTfhd(i[0]),o=s.trackId,d=xo.findBox(n,["tfdt"]),l=0>>4){t+=e[4]+1}return t},_p=function(e){var t={},a=hp(e),n=4+yp(e);if(a){n+=e[n]+1}if(!(1&e[n+5])){return}var r,s,o;r=(15&e[n+1])<<8|e[n+2];s=3+r-4;o=(15&e[n+10])<<8|e[n+11];var d=12+o;while(d=e.byteLength){return null}var n=null,r;r=e[a+7];if(192&r){n={};n.pts=(14&e[a+9])<<27|(255&e[a+10])<<20|(254&e[a+11])<<12|(255&e[a+12])<<5|(254&e[a+13])>>>3;n.pts*=4;n.pts+=(6&e[a+13])>>>1;n.dts=n.pts;if(64&r){n.dts=(14&e[a+14])<<27|(255&e[a+15])<<20|(254&e[a+16])<<12|(255&e[a+17])<<5|(254&e[a+18])>>>3;n.dts*=4;n.dts+=(6&e[a+18])>>>1}}return n},videoPacketContainsKeyFrame:function(e){var t=4+yp(e),a=e.subarray(t),n=0,r=0,i=!1,s;for(;re.length-s){t=!0;break}i=Tp.aac.parseId3TagSize(e,s);if(i>e.length){t=!0;break}if(null===r){o=e.subarray(s,s+i);r=Tp.aac.parseAacTimestamp(o)}s+=i;break;case"audio":if(7>e.length-s){t=!0;break}i=Tp.aac.parseAdtsSize(e,s);if(i>e.length){t=!0;break}if(null===n){o=e.subarray(s,s+i);n=Tp.aac.parseSampleRate(o)}a++;s+=i;break;default:s++;break;}if(t){return null}}if(null===n||null===r){return null}var l=90000/n,p={audio:[{type:"audio",dts:r,pts:r},{type:"audio",dts:r+1024*a*l,pts:r+1024*a*l}]};return p},Lp=function(e){var t={pid:null,table:null},a={};vp(e,t);for(var n in t.table){if(t.table.hasOwnProperty(n)){var r=t.table[n];switch(r){case al.H264_STREAM_TYPE:a.video=[];kp(e,t,a);if(0===a.video.length){delete a.video}break;case al.ADTS_STREAM_TYPE:a.audio=[];Sp(e,t,a);if(0===a.audio.length){delete a.audio}break;default:break;}}}return a};function ft(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}var Ip=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}},Pp=function(){function e(e,t){for(var a=0,n;ao;o++){d[(u[o]=o<<1^283*(o>>7))^o]=o}for(l=p=0;!n[l];l^=c||1,p=d[p]||1){h=p^p<<1^p<<2^p<<3^p<<4;h=99^(h>>8^255&h);n[l]=h;r[h]=l;g=u[m=u[c=u[l]]];_=16843009*g^65537*m^257*c^16843008*l;y=257*u[h]^16843008*h;for(o=0;4>o;o++){t[o][l]=y=y<<24^y>>>8;a[o][h]=_=_<<24^_>>>8}}for(o=0;5>o;o++){t[o]=t[o].slice(0);a[o]=a[o].slice(0)}return e},wp=null,Op=function(){function e(t){Ip(this,e);if(!wp){wp=Ap()}this._tables=[[wp[0][0].slice(),wp[0][1].slice(),wp[0][2].slice(),wp[0][3].slice(),wp[0][4].slice()],[wp[1][0].slice(),wp[1][1].slice(),wp[1][2].slice(),wp[1][3].slice(),wp[1][4].slice()]];var a=void 0,n=void 0,r=void 0,s=void 0,o=void 0,d=this._tables[0][4],l=this._tables[1],p=t.length,u=1;if(4!==p&&6!==p&&8!==p){throw new Error("Invalid aes key size")}s=t.slice(0);o=[];this._key=[s,o];for(a=p;a<4*p+28;a++){r=s[a-1];if(0==a%p||8===p&&4==a%p){r=d[r>>>24]<<24^d[255&r>>16]<<16^d[255&r>>8]<<8^d[255&r];if(0==a%p){r=r<<8^r>>>24^u<<24;u=u<<1^283*(u>>7)}}s[a]=s[a-p]^r}for(n=0;a;n++,a--){r=s[3&n?a:a-4];if(4>=a||4>n){o[n]=r}else{o[n]=l[0][d[r>>>24]]^l[1][d[255&r>>16]]^l[2][d[255&r>>8]]^l[3][d[255&r]]}}}e.prototype.decrypt=function(e,t,n,r,s,o){var l=this._key[1],p=e^l[0],u=r^l[1],m=n^l[2],g=t^l[3],h=void 0,y=void 0,_=void 0,f=l.length/4-2,T=void 0,v=4,S=this._tables[1],k=S[0],C=S[1],E=S[2],L=S[3],I=S[4];for(T=0;T>>24]^C[255&u>>16]^E[255&m>>8]^L[255&g]^l[v];y=k[u>>>24]^C[255&m>>16]^E[255&g>>8]^L[255&p]^l[v+1];_=k[m>>>24]^C[255&g>>16]^E[255&p>>8]^L[255&u]^l[v+2];g=k[g>>>24]^C[255&p>>16]^E[255&u>>8]^L[255&m]^l[v+3];v+=4;p=h;u=y;m=_}for(T=0;4>T;T++){s[(3&-T)+o]=I[p>>>24]<<24^I[255&u>>16]<<16^I[255&m>>8]<<8^I[255&g]^l[v++];h=p;p=u;u=m;m=g;g=h}};return e}(),Up=function(){function e(){Ip(this,e);this.listeners={}}e.prototype.on=function(e,t){if(!this.listeners[e]){this.listeners[e]=[]}this.listeners[e].push(t)};e.prototype.off=function(e,t){if(!this.listeners[e]){return!1}var a=this.listeners[e].indexOf(t);this.listeners[e].splice(a,1);return-1>8|e>>>24},Bp=function(e,t,a){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new Op(Array.prototype.slice.call(t)),i=new Uint8Array(e.byteLength),s=new Int32Array(i.buffer),o=void 0,d=void 0,l=void 0,p=void 0,u=void 0,c=void 0,m=void 0,g=void 0,h=void 0;o=a[0];d=a[1];l=a[2];p=a[3];for(h=0;ha){var r=[a,t];t=r[0];a=r[1]}if(0>t){for(var s=t;s=n){break}}return Math.max(0,t)},uu=function(e,t,a){if(!e||!e.segments){return null}if(e.endList){return du(e)}if(null===t){return null}t=t||0;var n=a?pu(e):e.segments.length;return ou(e,e.mediaSequence+n,t)},cu=function(e){return 0==e-Math.floor(e)},mu=function(e,t){if(cu(t)){return t+.1*e}for(var a=t.toString().split(".")[1].length,n=1;n<=a;n++){var r=Math.pow(10,n),s=t*r;if(cu(s)||n===a){return(s+e)/r}}},gu=mu.bind(null,1),hu=mu.bind(null,-1),yu=function(e,t,a,n){var r=void 0,s=void 0,o=e.segments.length,d=t-n;if(0>d){if(0a){for(r=a;0>r;r++){d-=e.targetDuration;if(0>d){return{mediaIndex:0,startTime:t}}}a=0}for(r=a;rd){return{mediaIndex:r,startTime:n+lu(e,a,r)}}}return{mediaIndex:o-1,startTime:t}},_u=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},fu=function(e){return e.excludeUntil&&e.excludeUntil===1/0},bu=function(e){var t=_u(e);return!e.disabled&&!t},Tu=function(e){for(var t=0;tt){return String.fromCharCode(t)}return"."},Au=function(e){var t={};Object.keys(e).forEach(function(a){var n=e[a];if(ArrayBuffer.isView(n)){t[a]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}}else{t[a]=n}});return t},wu=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Ou=function(e){for(var t=Array.prototype.slice.call(e),a=16,n="",r=void 0,i=void 0,s=0;sp){return null}if(a>d){n=o}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Cu.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"}},Fu=function(e,t){if(!t||!t.segments||0===t.segments.length){return null}for(var a=0,n=void 0,r=0;ra){if(e>a+s.duration*Mu){return null}n=s}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:a-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}},Hu=function(e,t){var a=void 0,n=void 0;try{a=new Date(e);n=new Date(t)}catch(t){}var r=a.getTime(),i=n.getTime();return(i-r)/1e3},Vu=function(e){if(!e.segments||0===e.segments.length){return!1}for(var t=0,a;t=t})},Xu=function(e,t){return Ku(e,function(e){return e-Gu>=t})},$u=function(e){if(2>e.length){return mt.createTimeRanges()}for(var t=[],a=1;a "+e.end(a))}return t.join(", ")},Ju=function(e,t){var a=2=e){a.removeCue(r)}}},ac=function(e){Object.defineProperties(e.frame,{id:{get:function(){mt.log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");return e.value.key}},value:{get:function(){mt.log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");return e.value.data}},privateData:{get:function(){mt.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");return e.value.data}}})},nc=function(e){var t;if(isNaN(e)||Math.abs(e)===1/0){t=Number.MAX_VALUE}else{t=e}return t},rc=function(t,a,n){var r=e.WebKitDataCue||e.VTTCue;if(a){a.forEach(function(e){var t=e.stream;this.inbandTextTracks_[t].addCue(new r(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))},t)}if(n){var s=nc(t.mediaSource_.duration);n.forEach(function(t){var a=t.cueTime+this.timestampOffset;if("number"!=typeof a||e.isNaN(a)||0>a||!(a<1/0)){return}t.frames.forEach(function(e){var t=new r(a,a,e.value||e.url||e.data||"");t.frame=e;t.value=e;ac(t);this.metadataTrack_.addCue(t)},this)},t);if(t.metadataTrack_&&t.metadataTrack_.cues&&t.metadataTrack_.cues.length){for(var o=t.metadataTrack_.cues,d=[],l=0;l>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))};i=function(){return a(C.ftyp,E,L,E,I)};_=function(e){return a(C.hdlr,D[e])};s=function(e){return a(C.mdat,e)};y=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,255&e.duration>>>24,255&e.duration>>>16,255&e.duration>>>8,255&e.duration,85,196,0,0]);if(e.samplerate){t[12]=255&e.samplerate>>>24;t[13]=255&e.samplerate>>>16;t[14]=255&e.samplerate>>>8;t[15]=255&e.samplerate}return a(C.mdhd,t)};h=function(e){return a(C.mdia,y(e),_(e.type),d(e))};o=function(e){return a(C.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))};d=function(e){return a(C.minf,"video"===e.type?a(C.vmhd,A):a(C.smhd,w),n(),b(e))};l=function(e,t){var n=[],r=t.length;while(r--){n[r]=v(t[r])}return a.apply(null,[C.moof,o(e)].concat(n))};p=function(e){var t=e.length,n=[];while(t--){n[t]=m(e[t])}return a.apply(null,[C.moov,c(4294967295)].concat(n).concat(u(e)))};u=function(e){var t=e.length,n=[];while(t--){n[t]=S(e[t])}return a.apply(null,[C.mvex].concat(n))};c=function(e){var t=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 a(C.mvhd,t)};f=function(e){var t=e.samples||[],n=new Uint8Array(4+t.length),r,s;for(s=0;s>>8);r.push(255&t[o].byteLength);r=r.concat(Array.prototype.slice.call(t[o]))}for(o=0;o>>8);s.push(255&n[o].byteLength);s=s.concat(Array.prototype.slice.call(n[o]))}return a(C.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]),a(C.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([t.length]).concat(r).concat([n.length]).concat(s))),a(C.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))};t=function(e){return a(C.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))}})();g=function(e){var t=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 a(C.tkhd,t)};v=function(e){var t,n,r,i,s,o,d;t=a(C.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]));o=Math.floor(e.baseMediaDecodeTime/4294967296);d=Math.floor(e.baseMediaDecodeTime%4294967296);n=a(C.tfdt,new Uint8Array([1,0,0,0,255&o>>>24,255&o>>>16,255&o>>>8,255&o,255&d>>>24,255&d>>>16,255&d>>>8,255&d]));s=92;if("audio"===e.type){r=k(e,s);return a(C.traf,t,n,r)}i=f(e);r=k(e,i.length+s);return a(C.traf,t,n,r,i)};m=function(e){e.duration=e.duration||4294967295;return a(C.trak,g(e),h(e))};S=function(e){var t=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]);if("video"!==e.type){t[t.length-1]=0}return a(C.trex,t)};(function(){var e,t,n;n=function(e,t){var a=0,n=0,r=0,i=0;if(e.length){if(e[0].duration!==void 0){a=1}if(e[0].size!==void 0){n=2}if(e[0].flags!==void 0){r=4}if(e[0].compositionTimeOffset!==void 0){i=8}}return[0,0,a|n|r|i,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]};t=function(e,t){var r,s,o,d;s=e.samples||[];t+=20+16*s.length;r=n(s,t);for(d=0;d>>24,(16711680&o.duration)>>>16,(65280&o.duration)>>>8,255&o.duration,(4278190080&o.size)>>>24,(16711680&o.size)>>>16,(65280&o.size)>>>8,255&o.size,o.flags.isLeading<<2|o.flags.dependsOn,o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,o.flags.degradationPriority&61440,15&o.flags.degradationPriority,(4278190080&o.compositionTimeOffset)>>>24,(16711680&o.compositionTimeOffset)>>>16,(65280&o.compositionTimeOffset)>>>8,255&o.compositionTimeOffset])}return a(C.trun,new Uint8Array(r))};e=function(e,t){var r,s,o,d;s=e.samples||[];t+=20+8*s.length;r=n(s,t);for(d=0;d>>24,(16711680&o.duration)>>>16,(65280&o.duration)>>>8,255&o.duration,(4278190080&o.size)>>>24,(16711680&o.size)>>>16,(65280&o.size)>>>8,255&o.size])}return a(C.trun,new Uint8Array(r))};k=function(a,n){if("audio"===a.type){return e(a,n)}return t(a,n)}})();var N={ftyp:i,mdat:s,moof:l,moov:p,initSegment:function(e){var t=i(),a=p(e),n;n=new Uint8Array(t.byteLength+a.byteLength);n.set(t);n.set(a,t.byteLength);return n}},j={toUnsigned:function(e){return e>>>0}}.toUnsigned,F,H,V,q,z;F=function(e,t){var a=[],n,r,s,o,d;if(!t.length){return null}for(n=0;n=n.duration)){n.duration=r[r.length-1].duration}r.push(n);return r},groupFramesIntoGops:function(e){var t,a,n=[],r=[];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;for(t=0;t=n.duration){n.duration=r[r.length-1].duration}r.byteLength+=n.byteLength;r.nalCount+=n.nalCount;r.duration+=n.duration;r.push(n);return r},extendFirstKeyFrame:function(e){var t;if(!e[0][0].keyFrame&&1d||l>pe/2){return}p=te[e.samplerate];if(!p){p=t[0].data}for(u=0;u=a){return e}t.minSegmentDts=1/0;return e.filter(function(e){if(e.dts>=a){t.minSegmentDts=Math.min(t.minSegmentDts,e.dts);t.minSegmentPts=t.minSegmentDts;return!0}return!1})},generateSampleTable:function(e){var t,a,n=[];for(t=0;te.type){this.dispatchCea608Packet(e)}},this);this.captionPackets_.length=0;this.ccStreams_.forEach(function(e){e.flush()},this)};ye.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(e){e.reset()})};ye.prototype.dispatchCea608Packet=function(e){if(this.setsChannel1Active(e)){this.activeCea608Channel_[e.type]=0}else if(this.setsChannel2Active(e)){this.activeCea608Channel_[e.type]=1}if(null===this.activeCea608Channel_[e.type]){return}this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)};ye.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)};ye.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)};var _e={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},fe=function(e){if(null===e){return""}e=_e[e]||e;return String.fromCharCode(e)},be=14,Te=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ve=function(){var e=[],t=be+1;while(t--){e.push("")}return e},Se=function e(t,a){e.prototype.init.call(this);this.field_=t||0;this.dataChannel_=a||0;this.name_="CC"+((this.field_<<1|this.dataChannel_)+1);this.setConstants();this.reset();this.push=function(e){var t,a,n,r,i;t=32639&e.ccData;if(t===this.lastControlCode_){this.lastControlCode_=null;return}if(4096==(61440&t)){this.lastControlCode_=t}else if(t!==this.PADDING_){this.lastControlCode_=null}n=t>>>8;r=255&t;if(t===this.PADDING_){}else 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);a=this.displayed_;this.displayed_=this.nonDisplayed_;this.nonDisplayed_=a;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_){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}}else if(t===this.ERASE_DISPLAYED_MEMORY_){this.flushDisplayed(e.pts);this.displayed_=ve()}else if(t===this.ERASE_NON_DISPLAYED_MEMORY_){this.nonDisplayed_=ve()}else if(t===this.RESUME_DIRECT_CAPTIONING_){if("paintOn"!==this.mode_){this.flushDisplayed(e.pts);this.displayed_=ve()}this.mode_="paintOn";this.startPts_=e.pts}else if(this.isSpecialCharacter(n,r)){n=(3&n)<<8;i=fe(n|r);this[this.mode_](e.pts,i);this.column_++}else if(this.isExtCharacter(n,r)){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}n=(3&n)<<8;i=fe(n|r);this[this.mode_](e.pts,i);this.column_++}else if(this.isMidRowCode(n,r)){this.clearFormatting(e.pts);this[this.mode_](e.pts," ");this.column_++;if(14==(14&r)){this.addFormatting(e.pts,["i"])}if(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=Te.indexOf(7968&t);if("rollUp"===this.mode_){if(0>s-this.rollUpRows_+1){s=this.rollUpRows_-1}this.setRollUp(e.pts,s)}if(s!==this.row_){this.clearFormatting(e.pts);this.row_=s}if(1&r&&-1===this.formatting_.indexOf("u")){this.addFormatting(e.pts,["u"])}if(16==(16&t)){this.column_=4*((14&t)>>1)}if(this.isColorPAC(r)){if(14==(14&r)){this.addFormatting(e.pts,["i"])}}}else if(this.isNormalChar(n)){if(0===r){r=null}i=fe(n);i+=fe(r);this[this.mode_](e.pts,i);this.column_+=i.length}}};Se.prototype=new K;Se.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){try{return e.trim()}catch(t){console.error("Skipping malformed caption.");return""}}).join("\n").replace(/^\n+|\n+$/g,"");if(t.length){this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})}};Se.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=ve();this.nonDisplayed_=ve();this.lastControlCode_=null;this.column_=0;this.row_=be;this.rollUpRows_=2;this.formatting_=[]};Se.prototype.setConstants=function(){if(0===this.dataChannel_){this.BASE_=16;this.EXT_=17;this.CONTROL_=(20|this.field_)<<8;this.OFFSET_=23}else if(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_};Se.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&63>=t};Se.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&63>=t};Se.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&47>=t};Se.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&35>=t};Se.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=t};Se.prototype.isColorPAC=function(e){return 64<=e&&79>=e||96<=e&&127>=e};Se.prototype.isNormalChar=function(e){return 32<=e&&127>=e};Se.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_){this.row_=be;this.mode_="rollUp";this.flushDisplayed(e);this.nonDisplayed_=ve();this.displayed_=ve()}if(t!==void 0&&t!==this.row_){for(var a=0;a"},"");this[this.mode_](e,a)};Se.prototype.clearFormatting=function(e){if(!this.formatting_.length){return}var t=this.formatting_.reverse().reduce(function(e,t){return e+""},"");this.formatting_=[];this[this.mode_](e,t)};Se.prototype.popOn=function(e,t){var a=this.nonDisplayed_[this.row_];a+=t;this.nonDisplayed_[this.row_]=a};Se.prototype.rollUp=function(e,t){var a=this.displayed_[this.row_];a+=t;this.displayed_[this.row_]=a};Se.prototype.shiftRowsUp_=function(){var e;for(e=0;et){a=-1}while(Math.abs(t-e)>4294967296){e+=a*8589934592}return e},Le=function e(t){var a,n;e.prototype.init.call(this);this.type_=t;this.push=function(e){if(e.type!==this.type_){return}if(n===void 0){n=e.dts}e.dts=Ee(e.dts,n);e.pts=Ee(e.pts,n);a=e.dts;this.trigger("data",e)};this.flush=function(){n=a;this.trigger("done")};this.discontinuity=function(){n=void 0;a=void 0}};Le.prototype=new K;var Ie=function(e,t,a){var n,r="";for(n=t;ne.data.length||e.data[0]!==73||e.data[1]!==68||e.data[2]!==51)){if(t.debug){console.log("Skipping unrecognized metadata packet")}return}n.push(e);r+=e.data.byteLength;if(1===n.length){a=De(e.data.subarray(6,10));a+=10}if(rl){return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.")}c=String.fromCharCode(s.data[o],s.data[o+1],s.data[o+2],s.data[o+3]);p={id:c,data:s.data.subarray(o+10,o+l+10)};p.key=p.id;if(Ae[p.id]){Ae[p.id](p);if("com.apple.streaming.transportStreamTimestamp"===p.owner){var m=p.data,d=(1&m[3])<<30|m[4]<<22|m[5]<<14|m[6]<<6|m[7]>>>2;d*=4;d+=3&m[7];p.timeStamp=d;if(s.pts===void 0&&s.dts===void 0){s.pts=p.timeStamp;s.dts=p.timeStamp}this.trigger("timestamp",p)}}s.frames.push(p);o+=10;o+=l}while(o>>4){n+=t[n]+1}if(0===a.pid){a.type="pat";e(t.subarray(n),a);this.trigger("data",a)}else if(a.pid===this.pmtPid){a.type="pmt";e(t.subarray(n),a);this.trigger("data",a);while(this.packetsWaitingForPmt.length){this.processPes_.apply(this,this.packetsWaitingForPmt.shift())}}else if(this.programMapTable===void 0){this.packetsWaitingForPmt.push([t,n,a])}else{this.processPes_(t,n,a)}};this.processPes_=function(e,t,a){if(a.pid===this.programMapTable.video){a.streamType=Ce.H264_STREAM_TYPE}else if(a.pid===this.programMapTable.audio){a.streamType=Ce.ADTS_STREAM_TYPE}else{a.streamType=this.programMapTable["timed-metadata"][a.pid]}a.type="pes";a.data=e.subarray(t);this.trigger("data",a)}};Me.prototype=new K;Me.STREAM_TYPES={h264:27,adts:15};Be=function(){var e=this,t={data:[],size:0},a={data:[],size:0},n={data:[],size:0},r=function(e,t){var a;t.packetLength=6+(e[4]<<8|e[5]);t.dataAlignmentIndicator=0!=(4&e[6]);a=e[7];if(192&a){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;if(64&a){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])},i=function(t,a,n){var s=new Uint8Array(t.size),o={type:a},d=0,l=0,p=!1,u;if(!t.data.length||9>t.size){return}o.trackId=t.data[0].pid;for(d=0;d>5;l=1024*((3&e[a+6])+1);p=9e4*l/ze[(60&e[a+2])>>>2];o=a+r;if(e.byteLength>>6)+1,channelcount:(1&e[a+2])<<2|(192&e[a+3])>>>6,samplerate:ze[(60&e[a+2])>>>2],samplingfrequencyindex:(60&e[a+2])>>>2,samplesize:16,data:e.subarray(a+7+s,o)});if(e.byteLength===o){e=void 0;return}n++;e=e.subarray(o)}};this.flush=function(){this.trigger("done")}};qe.prototype=new K;var Ge=qe,We;We=function(e){var t=e.byteLength,a=0,n=0;this.length=function(){return 8*t};this.bitsAvailable=function(){return 8*t+n};this.loadWord=function(){var r=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(0===s){throw new Error("no bytes available")}i.set(e.subarray(r,r+s));a=new DataView(i.buffer).getUint32(0);n=8*s;t-=s};this.skipBits=function(e){var r;if(n>e){a<<=e;n-=e}else{e-=n;r=Math.floor(e/8);e-=8*r;t-=r;this.loadWord();a<<=e;n-=e}};this.readBits=function(e){var r=Math.min(n,e),i=a>>>32-r;n-=r;if(0>>e)){a<<=e;n-=e;return e}}this.loadWord();return 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();if(1&e){return 1+e>>>1}return-1*(e>>>1)};this.readBoolean=function(){return 1===this.readBits(1)};this.readUnsignedByte=function(){return this.readBits(8)};this.loadWord()};var Ke=We,Ye,Xe,$e;Xe=function(){var e=0,t,a;Xe.prototype.init.call(this);this.push=function(n){var r;if(!a){a=n.data}else{r=new Uint8Array(a.byteLength+n.data.byteLength);r.set(a);r.set(n.data,a.byteLength);a=r}for(;ev){o(16,d)}else{o(64,d)}}}}}d.skipUnsignedExpGolomb();m=d.readUnsignedExpGolomb();if(0===m){d.readUnsignedExpGolomb()}else if(1===m){d.skipBits(1);d.skipExpGolomb();d.skipExpGolomb();g=d.readUnsignedExpGolomb();for(v=0;v>4){return a+20}return a+10},parseAdtsSize:function(e,t){var a=(224&e[t+5])>>5,n=e[t+4]<<3,r=e[t+3]&6144;return r|n|a},parseType:function(e,t){if(e[t]===73&&e[t+1]===68&&e[t+2]===51){return"timed-metadata"}else if(e[t]&!0&&240==(240&e[t+1])){return"audio"}return null},parseSampleRate:function(e){var t=0;while(t+5>>2]}return null},parseAacTimestamp:function(e){var t,a,n,r;t=10;if(64&e[5]){t+=4;t+=Ze(e.subarray(10,14))}do{a=Ze(e.subarray(t+4,t+8));if(1>a){return null}r=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);if("PRIV"===r){n=e.subarray(t+10,t+a+10);for(var s=0;s>>2;d*=4;d+=3&l[7];return d}break}}}t+=10;t+=a}while(te.length-r){break}n=at.parseId3TagSize(e,r);if(r+n>e.length){break}s={type:"timed-metadata",data:e.subarray(r,r+n)};this.trigger("data",s);r+=n;continue}else if(255==(255&e[r])&&240==(240&e[r+1])){if(7>e.length-r){break}n=at.parseAdtsSize(e,r);if(r+n>e.length){break}o={type:"audio",data:e.subarray(r,r+n),pts:t,dts:t};this.trigger("data",o);r+=n;continue}r++}i=e.length-r;if(0=-10000&&n<=45000){if(!r||a>n){r=o;a=n}}}if(r){return r.gop}return null};this.alignGopsAtStart_=function(e){var t,a,n,i,s,o,d,l;s=e.byteLength;o=e.nalCount;d=e.duration;t=a=0;while(tn.pts){t++;continue}a++;s-=i.byteLength;o-=i.nalCount;d-=i.duration}if(0===a){return e}if(a===e.length){return null}l=e.slice(a);l.byteLength=s;l.duration=d;l.nalCount=o;l.pts=l[0].pts;l.dts=l[0].dts;return l};this.alignGopsAtEnd_=function(e){var t,a,n,i,s,o;t=r.length-1;a=e.length-1;s=null;o=!1;while(0<=t&&0<=a){n=r[t];i=e[a];if(n.pts===i.pts){o=!0;break}if(n.pts>i.pts){t--;continue}if(t===r.length-1){s=a}a--}if(!o&&null===s){return null}var d;if(o){d=a}else{d=s}if(0===d){return e}var l=e.slice(d),p=l.reduce(function(e,t){e.byteLength+=t.byteLength;e.duration+=t.duration;e.nalCount+=t.nalCount;return e},{byteLength:0,duration:0,nalCount:0});l.byteLength=p.byteLength;l.duration=p.duration;l.nalCount=p.nalCount;l.pts=l[0].pts;l.dts=l[0].dts;return l};this.alignGopsWith=function(e){r=e}};lt.prototype=new K;ct=function(e,t){this.numberOfTracks=0;this.metadataStream=t;e=e||{};if("undefined"!=typeof e.remux){this.remuxTracks=!!e.remux}else{this.remuxTracks=!0}if("boolean"==typeof e.keepOriginalTimestamps){this.keepOriginalTimestamps=e.keepOriginalTimestamps}this.pendingTracks=[];this.videoTrack=null;this.pendingBoxes=[];this.pendingCaptions=[];this.pendingMetadata=[];this.pendingBytes=0;this.emittedTracks=0;ct.prototype.init.call(this);this.push=function(e){if(e.text){return this.pendingCaptions.push(e)}if(e.frames){return this.pendingMetadata.push(e)}this.pendingTracks.push(e.track);this.pendingBoxes.push(e.boxes);this.pendingBytes+=e.boxes.byteLength;if("video"===e.track.type){this.videoTrack=e.track}if("audio"===e.track.type){this.audioTrack=e.track}}};ct.prototype=new K;ct.prototype.flush=function(e){var t=0,a={captions:[],captionStreams:{},metadata:[],info:{}},n,r,s,o=0,d;if(this.pendingTracks.length=this.numberOfTracks){this.trigger("done");this.emittedTracks=0}return}}if(this.videoTrack){o=this.videoTrack.timelineStartInfo.pts;dt.forEach(function(e){a.info[e]=this.videoTrack[e]},this)}else if(this.audioTrack){o=this.audioTrack.timelineStartInfo.pts;ot.forEach(function(e){a.info[e]=this.audioTrack[e]},this)}if(1===this.pendingTracks.length){a.type=this.pendingTracks[0].type}else{a.type="combined"}this.emittedTracks+=this.pendingTracks.length;s=N.initSegment(this.pendingTracks);a.initSegment=new Uint8Array(s.byteLength);a.initSegment.set(s);a.data=new Uint8Array(this.pendingBytes);for(d=0;d=this.numberOfTracks){this.trigger("done");this.emittedTracks=0}};ut=function(e){var t=this,a=!0,n,r;ut.prototype.init.call(this);e=e||{};this.baseMediaDecodeTime=e.baseMediaDecodeTime||0;this.transmuxPipeline_={};this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a;a.type="aac";a.metadataStream=new Ve.MetadataStream;a.aacStream=new rt;a.audioTimestampRolloverStream=new Ve.TimestampRolloverStream("audio");a.timedMetadataTimestampRolloverStream=new Ve.TimestampRolloverStream("timed-metadata");a.adtsStream=new Ge;a.coalesceStream=new ct(e,a.metadataStream);a.headOfPipeline=a.aacStream;a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream);a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream);a.metadataStream.on("timestamp",function(e){a.aacStream.setTimestamp(e.timeStamp)});a.aacStream.on("data",function(n){if("timed-metadata"===n.type&&!a.audioSegmentStream){r=r||{timelineStartInfo:{baseMediaDecodeTime:t.baseMediaDecodeTime},codec:"adts",type:"audio"};a.coalesceStream.numberOfTracks++;a.audioSegmentStream=new pt(r,e);a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)}});a.coalesceStream.on("data",this.trigger.bind(this,"data"));a.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a;a.type="ts";a.metadataStream=new Ve.MetadataStream;a.packetStream=new Ve.TransportPacketStream;a.parseStream=new Ve.TransportParseStream;a.elementaryStream=new Ve.ElementaryStream;a.videoTimestampRolloverStream=new Ve.TimestampRolloverStream("video");a.audioTimestampRolloverStream=new Ve.TimestampRolloverStream("audio");a.timedMetadataTimestampRolloverStream=new Ve.TimestampRolloverStream("timed-metadata");a.adtsStream=new Ge;a.h264Stream=new it;a.captionStream=new Ve.CaptionStream;a.coalesceStream=new ct(e,a.metadataStream);a.headOfPipeline=a.packetStream;a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream);a.elementaryStream.pipe(a.videoTimestampRolloverStream).pipe(a.h264Stream);a.elementaryStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream);a.elementaryStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream);a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream);a.elementaryStream.on("data",function(s){var o;if("metadata"===s.type){o=s.tracks.length;while(o--){if(!n&&"video"===s.tracks[o].type){n=s.tracks[o];n.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}else if(!r&&"audio"===s.tracks[o].type){r=s.tracks[o];r.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}}if(n&&!a.videoSegmentStream){a.coalesceStream.numberOfTracks++;a.videoSegmentStream=new lt(n,e);a.videoSegmentStream.on("timelineStartInfo",function(e){if(r){r.timelineStartInfo=e;a.audioSegmentStream.setEarliestDts(e.dts)}});a.videoSegmentStream.on("processedGopsInfo",t.trigger.bind(t,"gopInfo"));a.videoSegmentStream.on("segmentTimingInfo",t.trigger.bind(t,"videoSegmentTimingInfo"));a.videoSegmentStream.on("baseMediaDecodeTime",function(e){if(r){a.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}});a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)}if(r&&!a.audioSegmentStream){a.coalesceStream.numberOfTracks++;a.audioSegmentStream=new pt(r,e);a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)}}});a.coalesceStream.on("data",this.trigger.bind(this,"data"));a.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setBaseMediaDecodeTime=function(t){var a=this.transmuxPipeline_;if(!e.keepOriginalTimestamps){this.baseMediaDecodeTime=t}if(r){r.timelineStartInfo.dts=void 0;r.timelineStartInfo.pts=void 0;me.clearDtsInfo(r);if(!e.keepOriginalTimestamps){r.timelineStartInfo.baseMediaDecodeTime=t}if(a.audioTimestampRolloverStream){a.audioTimestampRolloverStream.discontinuity()}}if(n){if(a.videoSegmentStream){a.videoSegmentStream.gopCache_=[];a.videoTimestampRolloverStream.discontinuity()}n.timelineStartInfo.dts=void 0;n.timelineStartInfo.pts=void 0;me.clearDtsInfo(n);a.captionStream.reset();if(!e.keepOriginalTimestamps){n.timelineStartInfo.baseMediaDecodeTime=t}}if(a.timedMetadataTimestampRolloverStream){a.timedMetadataTimestampRolloverStream.discontinuity()}};this.setAudioAppendStart=function(e){if(r){this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)}};this.alignGopsWith=function(e){if(n&&this.transmuxPipeline_.videoSegmentStream){this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)}};this.push=function(e){if(a){var t=st(e);if(t&&"aac"!==this.transmuxPipeline_.type){this.setupAacPipeline()}else if(!t&&"ts"!==this.transmuxPipeline_.type){this.setupTsPipeline()}a=!1}this.transmuxPipeline_.headOfPipeline.push(e)};this.flush=function(){a=!0;this.transmuxPipeline_.headOfPipeline.flush()};this.resetCaptions=function(){if(this.transmuxPipeline_.captionStream){this.transmuxPipeline_.captionStream.reset()}}};ut.prototype=new K;var ht={Transmuxer:ut,VideoSegmentStream:lt,AudioSegmentStream:pt,AUDIO_PROPERTIES:ot,VIDEO_PROPERTIES:dt,generateVideoSegmentTimingInfo:gt},yt,_t,ft=G.parseType,bt=function(e){return new Date(1e3*e-20828448e5)},Tt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},vt=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=[],n,r;for(n=0;n+4=r){a.push("MALFORMED DATA");continue}switch(31&e[n]){case 1:a.push("slice_layer_without_partitioning_rbsp");break;case 5:a.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:a.push("sei_rbsp");break;case 7:a.push("seq_parameter_set_rbsp");break;case 8:a.push("pic_parameter_set_rbsp");break;case 9:a.push("access_unit_delimiter_rbsp");break;default:a.push(31&"UNKNOWN NAL - "+e[n]);break;}}return a},St={avc1:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:yt(e.subarray(78,e.byteLength))}},avcC:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},n=31&e[5],r,s,o,d;o=6;for(d=0;d>>2,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:31&e[26]>>>3,samplingFrequencyIndex:(7&e[26])<<1|1&e[27]>>>7,channelConfiguration:15&e[27]>>>3}}}},ftyp:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={majorBrand:ft(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},n=8;while(n>10)+96);r.language+=String.fromCharCode(((992&n)>>5)+96);r.language+=String.fromCharCode((31&n)+96);return r},mdia:function(e){return{boxes:yt(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:yt(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};if(28>4,isDependedOn:(12&e[a])>>2,hasRedundancy:3&e[a]})}return t},sidx:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8),earliestPresentationTime:t.getUint32(12),firstOffset:t.getUint32(16)},n=t.getUint16(22),r;for(r=24;n;r+=12,n--){a.references.push({referenceType:(128&e[r])>>>7,referencedSize:2147483647&t.getUint32(r),subsegmentDuration:t.getUint32(r+4),startsWithSap:!!(128&e[r+8]),sapType:(112&e[r+8])>>>4,sapDeltaTime:268435455&t.getUint32(r+8)})}return a},smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:yt(e)}},stco:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},n=t.getUint32(4),r;for(r=8;n;r+=4,n--){a.chunkOffsets.push(t.getUint32(r))}return a},stsc:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=t.getUint32(4),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]},r;for(r=8;a;r+=12,a--){n.sampleToChunks.push({firstChunk:t.getUint32(r),samplesPerChunk:t.getUint32(r+4),sampleDescriptionIndex:t.getUint32(r+8)})}return n},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:yt(e.subarray(8))}},stsz:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:t.getUint32(4),entries:[]},n;for(n=12;n>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},a=new DataView(e.buffer,e.byteOffset,e.byteLength),n=1&t.flags[2],r=4&t.flags[2],i=1&t.flags[1],s=2&t.flags[1],o=4&t.flags[1],d=8&t.flags[1],l=a.getUint32(4),p=8,u;if(n){t.dataOffset=a.getInt32(p);p+=4}if(r&&l){u={flags:Tt(e.subarray(p,p+4))};p+=4;if(i){u.duration=a.getUint32(p);p+=4}if(s){u.size=a.getUint32(p);p+=4}if(d){u.compositionTimeOffset=a.getUint32(p);p+=4}t.samples.push(u);l--}while(l--){u={};if(i){u.duration=a.getUint32(p);p+=4}if(s){u.size=a.getUint32(p);p+=4}if(o){u.flags=Tt(e.subarray(p,p+4));p+=4}if(d){u.compositionTimeOffset=a.getUint32(p);p+=4}t.samples.push(u)}return t},"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}};yt=function(e){for(var t=0,a=[],n,r,s,o,d,l=new ArrayBuffer(e.length),p=new Uint8Array(l),u=0;u"}if(1===i.length){return n+"<"+i.join("").slice(1)+">"}return n+"<\n"+i.map(function(e){return a+" "+e}).join("\n")+"\n"+a+" >"}return n+JSON.stringify(r,null,2).split("\n").map(function(e,t){if(0===t){return e}return a+" "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+_t(e.boxes,t+1):"")}).join("\n")};var kt={inspect:yt,textify:_t,parseTfdt:St.tfdt,parseHdlr:St.hdlr,parseTfhd:St.tfhd,parseTrun:St.trun,parseSidx:St.sidx},Ct=he.discardEmulationPreventionBytes,Et=ke.CaptionStream,Lt=function(e,t){for(var a=e,n=0,r;n=d){continue}switch(31&e[o]){case 6:var p=e.subarray(o+1,o+1+d),u=Lt(o,t);s={nalUnitType:"sei_rbsp",size:d,data:p,escapedRBSP:Ct(p),trackId:a};if(u){s.pts=u.pts;s.dts=u.dts;l=u}else{s.pts=l.pts;s.dts=l.dts}r.push(s);break;default:break;}}return r},Pt=function(e,t,a){var n=t,r=a.defaultSampleDuration||0,i=a.defaultSampleSize||0,s=a.trackId,o=[];e.forEach(function(e){var t=kt.parseTrun(e),a=t.samples;a.forEach(function(e){if(e.duration===void 0){e.duration=r}if(e.size===void 0){e.size=i}e.trackId=s;e.dts=n;if(e.compositionTimeOffset===void 0){e.compositionTimeOffset=0}e.pts=n+e.compositionTimeOffset;n+=e.duration});o=o.concat(a)});return o},xt=function(e,t){var a=G.findBox(e,["moof","traf"]),n=G.findBox(e,["mdat"]),r={},i=[];n.forEach(function(e,t){var n=a[t];i.push({mdat:e,traf:n})});i.forEach(function(e){var a=e.mdat,n=e.traf,i=G.findBox(n,["tfhd"]),s=kt.parseTfhd(i[0]),o=s.trackId,d=G.findBox(n,["tfdt"]),l=0n){break}}return e.slice(r)},Ic=function(e,t,a){if(!t.length){return e}if(a){return t.slice()}var n=t[0].pts,r=0;for(r;r=n){break}}return e.slice(0,r).concat(t)},Pc=function(e,t,a,n){var r=Math.ceil(9e4*(t-n)),s=Math.ceil(9e4*(a-n)),o=e.slice(),d=e.length;while(d--){if(e[d].pts<=s){break}}if(-1==d){return o}var l=d+1;while(l--){if(e[l].pts<=r){break}}l=Math.max(l,0);o.splice(l,d-l+1);return o},xc=function(e,t,a){var n=null,r=null,i=0,s=[],o=[];if(!e&&!t){return mt.createTimeRange()}if(!e){return t.buffered}if(!t){return e.buffered}if(a){return e.buffered}if(0===e.buffered.length&&0===t.buffered.length){return mt.createTimeRange()}var d=e.buffered,l=t.buffered,p=d.length;while(p--){s.push({time:d.start(p),type:"start"});s.push({time:d.end(p),type:"end"})}p=l.length;while(p--){s.push({time:l.start(p),type:"start"});s.push({time:l.end(p),type:"end"})}s.sort(function(e,t){return e.time-t.time});for(p=0;pthis.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration)){this.nativeMediaSource_.duration=t}}},{key:"addSourceBuffer",value:function(e){var t=void 0,a=kc(e);if(/^(video|audio)\/mp2t$/i.test(a.type)){var n=[];if(a.parameters&&a.parameters.codecs){n=a.parameters.codecs.split(",");n=hc(n);n=n.filter(function(e){return Cc(e)||Ec(e)})}if(0===n.length){n=["avc1.4d400d","mp4a.40.2"]}t=new wc(this,n);if(0!==this.sourceBuffers.length){this.sourceBuffers[0].createRealSourceBuffers_();t.createRealSourceBuffers_();this.sourceBuffers[0].audioDisabled_=!0}}else{t=this.nativeMediaSource_.addSourceBuffer(e)}this.sourceBuffers.push(t);return t}}]);return n}(mt.EventTarget),Uc=0;mt.mediaSources={};var Rc=function(e,t){var a=mt.mediaSources[e];if(a){a.trigger({type:"sourceopen",swfId:t})}else{throw new Error("Media Source not found (Video.js)")}},Mc=function(){return!!e.MediaSource&&!!e.MediaSource.isTypeSupported&&e.MediaSource.isTypeSupported("video/mp4;codecs=\"avc1.4d400d,mp4a.40.2\"")},Bc=function(){this.MediaSource={open:Rc,supportsNativeMediaSources:Mc};if(Mc()){return new Oc}throw new Error("Cannot use create a virtual MediaSource for this video")};Bc.open=Rc;Bc.supportsNativeMediaSources=Mc;var Nc={createObjectURL:function(t){var a=void 0;if(t instanceof Oc){a=e.URL.createObjectURL(t.nativeMediaSource_);t.url_=a;return a}if(!(t instanceof Oc)){a=e.URL.createObjectURL(t);t.url_=a;return a}a="blob:vjs-media-source/"+Uc;Uc++;mt.mediaSources[a]=t;return a}};mt.MediaSource=Bc;mt.URL=Nc;var jc=mt.EventTarget,Fc=mt.mergeOptions,Hc=function(e,t){for(var a=void 0,n=Fc(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),r=0,s;r")}return function(){}};function St(){}var zc=function(){function e(t,a,n,r){Hp(this,e);this.callbacks_=[];this.pendingCallback_=null;this.timestampOffset_=0;this.mediaSource=t;this.processedAppend_=!1;this.type_=n;this.mimeType_=a;this.logger_=qc("SourceUpdater["+n+"]["+a+"]");if("closed"===t.readyState){t.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,a,r))}else{this.createSourceBuffer_(a,r)}}Vp(e,[{key:"createSourceBuffer_",value:function(e,t){var a=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(e);this.logger_("created SourceBuffer");if(t){t.trigger("sourcebufferadded");if(2>this.mediaSource.sourceBuffers.length){t.on("sourcebufferadded",function(){a.start_()});return}}this.start_()}},{key:"start_",value:function(){var e=this;this.started_=!0;this.onUpdateendCallback_=function(){var t=e.pendingCallback_;e.pendingCallback_=null;e.logger_("buffered ["+Qu(e.buffered())+"]");if(t){t()}e.runCallback_()};this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_);this.runCallback_()}},{key:"abort",value:function(e){var t=this;if(this.processedAppend_){this.queueCallback_(function(){t.sourceBuffer_.abort()},e)}}},{key:"appendBuffer",value:function(e,t){var a=this;this.processedAppend_=!0;this.queueCallback_(function(){if(e.videoSegmentTimingInfoCallback){a.sourceBuffer_.addEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback)}a.sourceBuffer_.appendBuffer(e.bytes)},function(){if(e.videoSegmentTimingInfoCallback){a.sourceBuffer_.removeEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback)}t()})}},{key:"buffered",value:function(){if(!this.sourceBuffer_){return mt.createTimeRanges()}return this.sourceBuffer_.buffered}},{key:"remove",value:function(e,t){var a=this,n=2 "+t+"]");a.sourceBuffer_.remove(e,t)},n)}}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||!!this.pendingCallback_&&this.pendingCallback_!==St}},{key:"timestampOffset",value:function(e){var t=this;if("undefined"!=typeof e){this.queueCallback_(function(){t.sourceBuffer_.timestampOffset=e});this.timestampOffset_=e}return this.timestampOffset_}},{key:"queueCallback_",value:function(e,t){this.callbacks_.push([e.bind(this),t]);this.runCallback_()}},{key:"runCallback_",value:function(){var e;if(!this.updating()&&this.callbacks_.length&&this.started_){e=this.callbacks_.shift();this.pendingCallback_=e[1];e[0]()}}},{key:"dispose",value:function(){this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_);if(this.sourceBuffer_&&"open"===this.mediaSource.readyState){this.sourceBuffer_.abort()}}}]);return e}(),Gc={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,BUFFER_LOW_WATER_LINE_RATE:1},Wc={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Kc=function(e){var t=void 0,a=void 0;a=e.offset+e.length-1;t=e.offset;return"bytes="+t+"-"+a},Yc=function(e){var t={};if(e.byterange){t.Range=Kc(e.byterange)}return t},Xc=function(e){e.forEach(function(e){e.abort()})},$c=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}},Qc=function(e){var t=e.target,a=Date.now()-t.requestTime,n={bandwidth:1/0,bytesReceived:0,roundTripTime:a||0};n.bytesReceived=e.loaded;n.bandwidth=Math.floor(1e3*(8*(n.bytesReceived/n.roundTripTime)));return n},Jc=function(e,t){if(t.timedout){return{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Wc.TIMEOUT,xhr:t}}if(t.aborted){return{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Wc.ABORTED,xhr:t}}if(e){return{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Wc.FAILURE,xhr:t}}return null},Zc=function(e,t){return function(a,n){var r=n.response,i=Jc(a,n);if(i){return t(i,e)}if(16!==r.byteLength){return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:Wc.FAILURE,xhr:n},e)}var s=new DataView(r);e.key.bytes=new Uint32Array([s.getUint32(0),s.getUint32(4),s.getUint32(8),s.getUint32(12)]);return t(null,e)}},em=function(e,t,a){return function(n,r){var i=r.response,s=Jc(n,r);if(s){return a(s,e)}if(0===i.byteLength){return a({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:Wc.FAILURE,xhr:r},e)}e.map.bytes=new Uint8Array(r.response);if(!t.isInitialized()){t.init()}e.map.timescales=xo.timescale(e.map.bytes);e.map.videoTrackIds=xo.videoTrackIds(e.map.bytes);return a(null,e)}},tm=function(e,t,a){return function(n,r){var i=r.response,s=Jc(n,r),o=void 0;if(s){return a(s,e)}if(0===i.byteLength){return a({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:Wc.FAILURE,xhr:r},e)}e.stats=$c(r);if(e.key){e.encryptedBytes=new Uint8Array(r.response)}else{e.bytes=new Uint8Array(r.response)}if(e.map&&e.map.bytes){if(!t.isInitialized()){t.init()}o=t.parse(e.bytes,e.map.videoTrackIds,e.map.timescales);if(o&&o.captions){e.captionStreams=o.captionStreams;e.fmp4Captions=o.captions}}return a(null,e)}},am=function(e,t,a){e.addEventListener("message",function n(r){if(r.data.source===t.requestId){e.removeEventListener("message",n);var i=r.data.decrypted;t.bytes=new Uint8Array(i.bytes,i.byteOffset,i.byteLength);return a(null,t)}});e.postMessage(Au({source:t.requestId,encrypted:t.encryptedBytes,key:t.key.bytes,iv:t.key.iv}),[t.encryptedBytes.buffer,t.key.bytes.buffer])},nm=function(e,t,a){var n=0,r=!1;return function(i,s){if(r){return}if(i){r=!0;Xc(e);return a(i,s)}n+=1;if(n===e.length){s.endOfAllRequests=Date.now();if(s.encryptedBytes){return am(t,s,a)}return a(null,s)}}},rm=function(e,t){return function(a){e.stats=mt.mergeOptions(e.stats,Qc(a));if(!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived){e.stats.firstBytesReceivedAt=Date.now()}return t(a,e)}},im=function(e,t,a,n,r,i,s){var o=[],d=nm(o,a,s);if(r.key){var l=mt.mergeOptions(t,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),p=Zc(r,d),u=e(l,p);o.push(u)}if(r.map&&!r.map.bytes){var c=mt.mergeOptions(t,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Yc(r.map)}),m=em(r,n,d),g=e(c,m);o.push(g)}var h=mt.mergeOptions(t,{uri:r.resolvedUri,responseType:"arraybuffer",headers:Yc(r)}),y=tm(r,n,d),_=e(h,y);_.addEventListener("progress",rm(r,i));o.push(_);return function(){return Xc(o)}},sm=function(t,a){var n;if(!t){return""}n=e.getComputedStyle(t);if(!n){return""}return n[a]},om=function(e,t){var a=e.slice();e.sort(function(e,n){var r=t(e,n);if(0===r){return a.indexOf(e)-a.indexOf(n)}return r})},dm=function(t,a){var n=void 0,r=void 0;if(t.attributes.BANDWIDTH){n=t.attributes.BANDWIDTH}n=n||e.Number.MAX_VALUE;if(a.attributes.BANDWIDTH){r=a.attributes.BANDWIDTH}r=r||e.Number.MAX_VALUE;return n-r},lm=function(t,a){var n=void 0,r=void 0;if(t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width){n=t.attributes.RESOLUTION.width}n=n||e.Number.MAX_VALUE;if(a.attributes.RESOLUTION&&a.attributes.RESOLUTION.width){r=a.attributes.RESOLUTION.width}r=r||e.Number.MAX_VALUE;if(n===r&&t.attributes.BANDWIDTH&&a.attributes.BANDWIDTH){return t.attributes.BANDWIDTH-a.attributes.BANDWIDTH}return n-r},pm=function(t,a,n,r,i){var s=t.playlists.map(function(t){var a=void 0,n=void 0,r=void 0;a=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width;n=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height;r=t.attributes.BANDWIDTH;r=r||e.Number.MAX_VALUE;return{bandwidth:r,width:a,height:n,playlist:t}});om(s,function(e,t){return e.bandwidth-t.bandwidth});s=s.filter(function(e){return!Cu.isIncompatible(e.playlist)});var o=s.filter(function(e){return Cu.isEnabled(e.playlist)});if(!o.length){o=s.filter(function(e){return!Cu.isDisabled(e.playlist)})}var d=o.filter(function(e){return e.bandwidth*Gc.BANDWIDTH_VARIANCEn||e.height>r});y=h.filter(function(e){return e.width===h[0].width&&e.height===h[0].height});l=y[y.length-1];_=y.filter(function(e){return e.bandwidth===l.bandwidth})[0]}var f=_||g||p||o[0]||s[0];return f?f.playlist:null},um=function(e){var t=e.master,a=e.currentTime,n=e.bandwidth,r=e.duration,i=e.segmentDuration,s=e.timeUntilRebuffer,o=e.currentTimeline,d=e.syncController,l=t.playlists.filter(function(e){return!Cu.isIncompatible(e)}),p=l.filter(Cu.isEnabled);if(!p.length){p=l.filter(function(e){return!Cu.isDisabled(e)})}var u=p.filter(Cu.hasAttribute.bind(null,"BANDWIDTH")),c=u.map(function(e){var t=d.getSyncPoint(e,r,o,a),l=t?1:2,p=Cu.estimateSegmentRequestTime(i,n,e);return{playlist:e,rebufferingImpact:p*l-s}}),m=c.filter(function(e){return 0>=e.rebufferingImpact});om(m,function(e,t){return dm(t.playlist,e.playlist)});if(m.length){return m[0]}om(c,function(e,t){return e.rebufferingImpact-t.rebufferingImpact});return c[0]||null},cm=function(e,t,a){for(var n in a){if(!e[n]){t.trigger({type:"usage",name:"hls-608"});var r=t.textTracks().getTrackById(n);if(r){e[n]=r}else{e[n]=t.addRemoteTextTrack({kind:"captions",id:n,label:n},!1).track}}}},mm=function(e){var t=e.inbandTextTracks,a=e.captionArray,n=e.timestampOffset;if(!a){return}var r=window.WebKitDataCue||window.VTTCue;a.forEach(function(e){var a=e.stream,i=e.startTime,s=e.endTime;if(!t[a]){return}i+=n;s+=n;t[a].addCue(new r(i,s,e.text))})},gm=function(e,t,a){if(!e||!t){return!1}var n=e.segments,r=a===n.length;return e.endList&&"open"===t.readyState&&r},hm=function(e){return"number"==typeof e&&isFinite(e)},ym=function(e,t,a){if("main"!==e||!t||!a){return null}if(!a.containsAudio&&!a.containsVideo){return"Neither audio nor video found in segment."}if(t.containsVideo&&!a.containsVideo){return"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."}if(!t.containsVideo&&a.containsVideo){return"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."}return null},_m=function(e,t,a){var n;if(e.length&&0 "+n+"] in timeline ["+p+"]"].join(" ")},bm=function(t){zp(a,t);function a(e){Hp(this,a);var t=Gp(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));if(!e){throw new TypeError("Initialization settings are required")}if("function"!=typeof e.currentTime){throw new TypeError("No currentTime getter specified")}if(!e.mediaSource){throw new TypeError("No MediaSource specified")}t.bandwidth=e.bandwidth;t.throughput={rate:0,count:0};t.roundTrip=NaN;t.resetStats_();t.mediaIndex=null;t.hasPlayed_=e.hasPlayed;t.currentTime_=e.currentTime;t.seekable_=e.seekable;t.seeking_=e.seeking;t.duration_=e.duration;t.mediaSource_=e.mediaSource;t.hls_=e.hls;t.loaderType_=e.loaderType;t.startingMedia_=void 0;t.segmentMetadataTrack_=e.segmentMetadataTrack;t.goalBufferLength_=e.goalBufferLength;t.sourceType_=e.sourceType;t.inbandTextTracks_=e.inbandTextTracks;t.state_="INIT";t.checkBufferTimeout_=null;t.error_=void 0;t.currentTimeline_=-1;t.pendingSegment_=null;t.mimeType_=null;t.sourceUpdater_=null;t.xhrOptions_=null;t.activeInitSegmentId_=null;t.initSegments_={};t.captionParser_=new mp;t.decrypter_=e.decrypter;t.syncController_=e.syncController;t.syncPoint_={segmentIndex:0,time:0};t.syncController_.on("syncinfoupdate",function(){return t.trigger("syncinfoupdate")});t.mediaSource_.addEventListener("sourceopen",function(){return t.ended_=!1});t.fetchAtBuffer_=!1;t.logger_=qc("SegmentLoader["+t.loaderType_+"]");Object.defineProperty(t,"state",{get:function(){return this.state_},set:function(e){if(e!==this.state_){this.logger_(this.state_+" -> "+e);this.state_=e}}});return t}Vp(a,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0;this.mediaRequests=0;this.mediaRequestsAborted=0;this.mediaRequestsTimedout=0;this.mediaRequestsErrored=0;this.mediaTransferDuration=0;this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED";this.pause();this.abort_();if(this.sourceUpdater_){this.sourceUpdater_.dispose()}this.resetStats_();this.captionParser_.reset()}},{key:"abort",value:function(){if("WAITING"!==this.state){if(this.pendingSegment_){this.pendingSegment_=null}return}this.abort_();this.state="READY";if(!this.paused()){this.monitorBuffer_()}}},{key:"abort_",value:function(){if(this.pendingSegment_){this.pendingSegment_.abortRequests()}this.pendingSegment_=null}},{key:"error",value:function(e){if("undefined"!=typeof e){this.error_=e}this.pendingSegment_=null;return this.error_}},{key:"endOfStream",value:function(){this.ended_=!0;this.pause();this.trigger("ended")}},{key:"buffered_",value:function(){if(!this.sourceUpdater_){return mt.createTimeRanges()}return this.sourceUpdater_.buffered()}},{key:"initSegment",value:function(e){var t=1 "+(e.id||e.uri)+"]");this.trigger("syncinfoupdate");if("INIT"===this.state&&this.couldBeginLoading_()){return this.init_()}if(!a||a.uri!==e.uri){if(null!==this.mediaIndex){this.resyncLoader()}return}var i=e.mediaSequence-a.mediaSequence;this.logger_("live window shift ["+i+"]");if(null!==this.mediaIndex){this.mediaIndex-=i}if(n){n.mediaIndex-=i;if(0<=n.mediaIndex){n.segment=e.segments[n.mediaIndex]}}this.syncController_.saveExpiredSegmentInfo(a,e)}},{key:"pause",value:function(){if(this.checkBufferTimeout_){e.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=null}}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(e,t){if(this.mimeType_){return}this.mimeType_=e;this.sourceBufferEmitter_=t;if("INIT"===this.state&&this.couldBeginLoading_()){this.init_()}}},{key:"resetEverything",value:function(e){this.ended_=!1;this.resetLoader();this.remove(0,this.duration_(),e);this.captionParser_.clearAllCaptions();this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1;this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null;this.syncPoint_=null;this.abort()}},{key:"remove",value:function(e,t,a){if(this.sourceUpdater_){this.sourceUpdater_.remove(e,t,a)}tc(e,t,this.segmentMetadataTrack_);if(this.inbandTextTracks_){for(var n in this.inbandTextTracks_){tc(e,t,this.inbandTextTracks_[n])}}}},{key:"monitorBuffer_",value:function(){if(this.checkBufferTimeout_){e.clearTimeout(this.checkBufferTimeout_)}this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){if("READY"===this.state){this.fillBuffer_()}if(this.checkBufferTimeout_){e.clearTimeout(this.checkBufferTimeout_)}this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(this.sourceUpdater_.updating()){return}if(!this.syncPoint_){this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_())}var e=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(!e){return}if(this.isEndOfStream_(e.mediaIndex)){this.endOfStream();return}if(e.mediaIndex===this.playlist_.segments.length-1&&"ended"===this.mediaSource_.readyState&&!this.seeking_()){return}if(e.timeline!==this.currentTimeline_||null!==e.startOfSegment&&e.startOfSegment=this.goalBufferLength_()){return null}if(!n&&1<=d){return null}if(null===i){a=this.getSyncSegmentCandidate_(t);return this.generateSegmentInfo_(t,a,null,!0)}if(null!==a){var l=t.segments[a];if(l&&l.end){o=l.end}else{o=s}return this.generateSegmentInfo_(t,a+1,o,!1)}if(this.fetchAtBuffer_){var p=Cu.getMediaInfoForTime(t,s,i.segmentIndex,i.time);a=p.mediaIndex;o=p.startTime}else{var u=Cu.getMediaInfoForTime(t,r,i.segmentIndex,i.time);a=u.mediaIndex;o=u.startTime}return this.generateSegmentInfo_(t,a,o,!1)}},{key:"getSyncSegmentCandidate_",value:function(e){var t=this;if(-1===this.currentTimeline_){return 0}var a=e.segments.map(function(e,t){return{timeline:e.timeline,segmentIndex:t}}).filter(function(e){return e.timeline===t.currentTimeline_});if(a.length){return a[Math.min(a.length-1,1)].segmentIndex}return Math.max(e.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(e,t,a,n){if(0>t||t>=e.segments.length){return null}var r=e.segments[t];return{requestId:"segment-loader-"+Math.random(),uri:r.resolvedUri,mediaIndex:t,isSyncRequest:n,startOfSegment:a,playlist:e,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:r.timeline,duration:r.duration,segment:r}}},{key:"abortRequestEarly_",value:function(e){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH){return!1}if(1e3>Date.now()-(e.firstBytesReceivedAt||Date.now())){return!1}var t=this.currentTime_(),a=e.bandwidth,n=this.pendingSegment_.duration,r=Cu.estimateSegmentRequestTime(n,a,this.playlist_,e.bytesReceived),i=Ju(this.buffered_(),t,this.hls_.tech_.playbackRate())-1;if(r<=i){return!1}var s=um({master:this.hls_.playlists.master,currentTime:t,bandwidth:a,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:i,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!s){return}var o=r-i-s.rebufferingImpact,d=.5;if(i<=Gu){d=1}if(!s.playlist||s.playlist.uri===this.playlist_.uri||o3*e.playlist.targetDuration){this.resetEverything();return}if(a){this.trigger("bandwidthupdate")}this.trigger("progress");if(this.isEndOfStream_(e.mediaIndex+1,e.playlist)){this.endOfStream()}if(!this.paused()){this.monitorBuffer_()}}},{key:"recordThroughput_",value:function(e){var t=this.throughput.rate,a=Date.now()-e.endOfAllRequests+1,n=Math.floor(1e3*(8*(e.byteLength/a)));this.throughput.rate+=(n-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(t){if(!this.segmentMetadataTrack_){return}var a=t.segment,n=a.start,r=a.end;if(!hm(n)||!hm(r)){return}tc(n,r,this.segmentMetadataTrack_);var i=e.WebKitDataCue||e.VTTCue,s={custom:a.custom,dateTimeObject:a.dateTimeObject,dateTimeString:a.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.uri,start:n,end:r},o=JSON.stringify(s),d=new i(n,r,o);d.value=s;this.segmentMetadataTrack_.addCue(d)}}]);return a}(mt.EventTarget),Tm=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},vm=new Uint8Array(["\n","\n"].map(function(e){return e.charCodeAt(0)})),Sm=function(t){zp(a,t);function a(e){var t=1=r.adStartTime&&t<=r.adEndTime){return r}}return null},Cm=function(t,a){var n=2=u){d=u;o={time:p.start,segmentIndex:l}}}}return o}},{name:"Discontinuity",run:function(e,t,a,n,r){var s=null;r=r||0;if(t.discontinuityStarts&&t.discontinuityStarts.length){for(var o=null,d=0;d=c){o=c;s={time:u.time,segmentIndex:l}}}}}return s}},{name:"Playlist",run:function(e,t){if(t.syncInfo){var a={time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence};return a}return null}}],Im=function(e){zp(t,e);function t(){Hp(this,t);var e=Gp(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));e.inspectCache_=void 0;e.timelines=[];e.discontinuities=[];e.datetimeToDisplayTime=null;e.logger_=qc("SyncController");return e}Vp(t,[{key:"getSyncPoint",value:function(e,t,a,n){var r=this.runStrategies_(e,t,a,n);if(!r.length){return null}return this.selectSyncPoint_(r,{key:"time",value:n})}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments){return null}var a=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!a.length){return null}var n=this.selectSyncPoint_(a,{key:"segmentIndex",value:0});if(0d){var l=void 0;if(0>o){l=a.start-lu(t,e.mediaIndex,r)}else{l=a.end+lu(t,e.mediaIndex+1,r)}this.discontinuities[s]={time:l,accuracy:d}}}}}}]);return t}(mt.EventTarget),Pm=new bt("./decrypter-worker.worker.js",function(){var e=this,t=function(){function t(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}var a=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}},n=function(){function e(e,t){for(var a=0,n;ao;o++){d[(u[o]=o<<1^283*(o>>7))^o]=o}for(l=p=0;!n[l];l^=c||1,p=d[p]||1){h=p^p<<1^p<<2^p<<3^p<<4;h=99^(h>>8^255&h);n[l]=h;r[h]=l;g=u[m=u[c=u[l]]];_=16843009*g^65537*m^257*c^16843008*l;y=257*u[h]^16843008*h;for(o=0;4>o;o++){t[o][l]=y=y<<24^y>>>8;a[o][h]=_=_<<24^_>>>8}}for(o=0;5>o;o++){t[o]=t[o].slice(0);a[o]=a[o].slice(0)}return e},o=null,d=function(){function e(t){a(this,e);if(!o){o=s()}this._tables=[[o[0][0].slice(),o[0][1].slice(),o[0][2].slice(),o[0][3].slice(),o[0][4].slice()],[o[1][0].slice(),o[1][1].slice(),o[1][2].slice(),o[1][3].slice(),o[1][4].slice()]];var n=void 0,r=void 0,d=void 0,l=void 0,p=void 0,u=this._tables[0][4],c=this._tables[1],m=t.length,g=1;if(4!==m&&6!==m&&8!==m){throw new Error("Invalid aes key size")}l=t.slice(0);p=[];this._key=[l,p];for(n=m;n<4*m+28;n++){d=l[n-1];if(0==n%m||8===m&&4==n%m){d=u[d>>>24]<<24^u[255&d>>16]<<16^u[255&d>>8]<<8^u[255&d];if(0==n%m){d=d<<8^d>>>24^g<<24;g=g<<1^283*(g>>7)}}l[n]=l[n-m]^d}for(r=0;n;r++,n--){d=l[3&r?n:n-4];if(4>=n||4>r){p[r]=d}else{p[r]=c[0][u[d>>>24]]^c[1][u[255&d>>16]]^c[2][u[255&d>>8]]^c[3][u[255&d]]}}}e.prototype.decrypt=function(e,t,n,r,s,o){var l=this._key[1],p=e^l[0],u=r^l[1],m=n^l[2],g=t^l[3],h=void 0,y=void 0,_=void 0,f=l.length/4-2,T=void 0,v=4,S=this._tables[1],k=S[0],C=S[1],E=S[2],L=S[3],I=S[4];for(T=0;T>>24]^C[255&u>>16]^E[255&m>>8]^L[255&g]^l[v];y=k[u>>>24]^C[255&m>>16]^E[255&g>>8]^L[255&p]^l[v+1];_=k[m>>>24]^C[255&g>>16]^E[255&p>>8]^L[255&u]^l[v+2];g=k[g>>>24]^C[255&p>>16]^E[255&u>>8]^L[255&m]^l[v+3];v+=4;p=h;u=y;m=_}for(T=0;4>T;T++){s[(3&-T)+o]=I[p>>>24]<<24^I[255&u>>16]<<16^I[255&m>>8]<<8^I[255&g]^l[v++];h=p;p=u;u=m;m=g;g=h}};return e}(),l=function(){function e(){a(this,e);this.listeners={}}e.prototype.on=function(e,t){if(!this.listeners[e]){this.listeners[e]=[]}this.listeners[e].push(t)};e.prototype.off=function(e,t){if(!this.listeners[e]){return!1}var a=this.listeners[e].indexOf(t);this.listeners[e].splice(a,1);return-1>8|e>>>24},c=function(e,t,a){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new d(Array.prototype.slice.call(t)),i=new Uint8Array(e.byteLength),s=new Int32Array(i.buffer),o=void 0,l=void 0,p=void 0,c=void 0,m=void 0,g=void 0,h=void 0,y=void 0,_=void 0;o=a[0];l=a[1];p=a[2];c=a[3];for(_=0;_=i){e.masterPlaylistLoader_.media(t)}e.tech_.trigger("bandwidthupdate")});this.mainSegmentLoader_.on("progress",function(){e.trigger("progress")});this.mainSegmentLoader_.on("error",function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())});this.mainSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()});this.mainSegmentLoader_.on("timestampoffset",function(){e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})});this.audioSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()});this.mainSegmentLoader_.on("ended",function(){e.onEndOfStream()});this.mainSegmentLoader_.on("earlyabort",function(){e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)});this.mainSegmentLoader_.on("reseteverything",function(){e.tech_.trigger("hls-reset")});this.mainSegmentLoader_.on("segmenttimemapping",function(t){e.tech_.trigger({type:"hls-segment-time-mapping",mapping:t.mapping})});this.audioSegmentLoader_.on("ended",function(){e.onEndOfStream()})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load();if(this.mediaTypes_.AUDIO.activePlaylistLoader){this.audioSegmentLoader_.load()}if(this.mediaTypes_.SUBTITLES.activePlaylistLoader){this.subtitleSegmentLoader_.load()}}},{key:"smoothQualityChange_",value:function(){var e=this.selectPlaylist();if(e!==this.masterPlaylistLoader_.media()){this.masterPlaylistLoader_.media(e);this.mainSegmentLoader_.resetLoader()}}},{key:"fastQualityChange_",value:function(){var e=this,t=this.selectPlaylist();if(t===this.masterPlaylistLoader_.media()){return}this.masterPlaylistLoader_.media(t);this.mainSegmentLoader_.resetEverything(function(){if(mt.browser.IE_VERSION||mt.browser.IS_EDGE){e.tech_.setCurrentTime(e.tech_.currentTime()+.04)}else{e.tech_.setCurrentTime(e.tech_.currentTime())}})}},{key:"play",value:function(){if(this.setupFirstPlay()){return}if(this.tech_.ended()){this.seekTo_(0)}if(this.hasPlayed_()){this.load()}var e=this.tech_.seekable();if(this.tech_.duration()===1/0){if(this.tech_.currentTime()e.end(0)||e.start(0)>t.end(0)){this.seekable_=e}else{this.seekable_=mt.createTimeRanges([[t.start(0)>e.start(0)?t.start(0):e.start(0),t.end(0) "+a);try{e.mediaSource.duration=a}catch(t){mt.log.warn("Failed to set media source duration",t)}e.tech_.trigger("durationchange");e.mediaSource.removeEventListener("sourceopen",t)};if(0t.length){this.error="No compatible SourceBuffer configuration for the variant stream:"+e.resolvedUri;return this.mediaSource.endOfStream("decode")}this.configureLoaderMimeTypes_(t);this.excludeIncompatibleVariants_(e)}},{key:"configureLoaderMimeTypes_",value:function(e){var t=1=t.end(t.length-1))){return this.techWaiting_()}if(5<=this.consecutiveUpdates&&e===this.lastRecordedTime){this.consecutiveUpdates++;this.waiting_()}else if(e===this.lastRecordedTime){this.consecutiveUpdates++}else{this.consecutiveUpdates=0;this.lastRecordedTime=e}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0;if(this.timer_){this.logger_("cancelTimer_");clearTimeout(this.timer_)}this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var e=this.tech_.seeking();if(!e){return!1}var t=this.seekable(),a=this.tech_.currentTime(),n=this.afterSeekableWindow_(t,a,this.media(),this.allowSeeksWithinUnsafeLiveWindow),r=void 0;if(n){var i=t.end(t.length-1);r=i}if(this.beforeSeekableWindow_(t,a)){var s=t.start(0);r=s+Wu}if("undefined"!=typeof r){this.logger_("Trying to seek outside of seekable at time "+a+" with "+("seekable range "+Qu(t)+". Seeking to ")+(r+"."));this.seekTo(r);return!0}return!1}},{key:"waiting_",value:function(){if(this.techWaiting_()){return}var e=this.tech_.currentTime(),t=this.tech_.buffered(),a=Yu(t,e);if(a.length&&e+3<=a.end(0)){this.cancelTimer_();this.seekTo(e);this.logger_("Stopped at "+e+" while inside a buffered region "+("["+a.start(0)+" -> "+a.end(0)+"]. Attempting to resume playback by seeking to the current time."));this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})}}},{key:"techWaiting_",value:function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_()){return!0}if(this.tech_.seeking()||null!==this.timer_){return!0}if(this.beforeSeekableWindow_(e,t)){var a=e.end(e.length-1);this.logger_("Fell out of live window at time "+t+". Seeking to "+("live point (seekable end) "+a));this.cancelTimer_();this.seekTo(a);this.tech_.trigger({type:"usage",name:"hls-live-resync"});return!0}var n=this.tech_.buffered(),r=Xu(n,t);if(this.videoUnderflow_(r,n,t)){this.cancelTimer_();this.seekTo(t);this.tech_.trigger({type:"usage",name:"hls-video-underflow"});return!0}if(0r){return!0}return!1}},{key:"beforeSeekableWindow_",value:function(e,t){if(e.length&&0t-r&&2t){mt.log.warn("value of Hls."+e+" must be greater than or equal to 0");return}Gc[e]=t}})});var ag=function(e){var t=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;if(t.test(e)){return"hls"}var a=/^application\/dash\+xml/i;if(a.test(e)){return"dash"}return null},ng=function(e,t){for(var a=t.media(),n=-1,r=0;r=Object.getOwnPropertyNames(a.handlers).length){delete a.handlers;delete a.dispatcher;delete a.disabled}if(0===Object.getOwnPropertyNames(a).length){xt["delete"](e)}}function W(e,t,a,r){a.forEach(function(a){e(t,a,r)})}function z(a){function r(){return!0}function n(){return!1}if(!a||!a.isPropagationStopped){var i=a||e.event;a={};for(var s in i){if("layerX"!=s&&"layerY"!=s&&"keyLocation"!=s&&"webkitMovementX"!=s&&"webkitMovementY"!=s){if(!("returnValue"==s&&i.preventDefault)){a[s]=i[s]}}}if(!a.target){a.target=a.srcElement||t}if(!a.relatedTarget){a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement}a.preventDefault=function(){if(i.preventDefault){i.preventDefault()}a.returnValue=!1;i.returnValue=!1;a.defaultPrevented=!0};a.defaultPrevented=!1;a.stopPropagation=function(){if(i.stopPropagation){i.stopPropagation()}a.cancelBubble=!0;i.cancelBubble=!0;a.isPropagationStopped=r};a.isPropagationStopped=n;a.stopImmediatePropagation=function(){if(i.stopImmediatePropagation){i.stopImmediatePropagation()}a.isImmediatePropagationStopped=r;a.stopPropagation()};a.isImmediatePropagationStopped=n;if(null!==a.clientX&&a.clientX!==void 0){var o=t.documentElement,l=t.body;a.pageX=a.clientX+(o&&o.scrollLeft||l&&l.scrollLeft||0)-(o&&o.clientLeft||l&&l.clientLeft||0);a.pageY=a.clientY+(o&&o.scrollTop||l&&l.scrollTop||0)-(o&&o.clientTop||l&&l.clientTop||0)}a.which=a.charCode||a.keyCode;if(null!==a.button&&a.button!==void 0){a.button=1&a.button?0:4&a.button?1:2&a.button?2:0}}return a}var Dt=!1;(function(){try{var t=Object.defineProperty({},"passive",{get:function(){Dt=!0}});e.addEventListener("test",null,t);e.removeEventListener("test",null,t)}catch(t){}})();var wt=["touchstart","touchmove"];function G(e,t,a){if(Array.isArray(t)){return W(G,e,t,a)}if(!xt.has(e)){xt.set(e,{})}var r=xt.get(e);if(!r.handlers){r.handlers={}}if(!r.handlers[t]){r.handlers[t]=[]}if(!a.guid){a.guid=q()}r.handlers[t].push(a);if(!r.dispatcher){r.disabled=!1;r.dispatcher=function(t,a){if(r.disabled){return}t=z(t);var i=r.handlers[t.type];if(i){for(var s=i.slice(0),o=0,l=s.length;o=a){t.apply(void 0,arguments);r=n}};return n},Nt=function(t,a,r,n){if(void 0===n){n=e}var i,s=function(){n.clearTimeout(i);i=null},o=function(){var e=this,s=arguments,o=function(){i=null;o=null;if(!r){t.apply(e,s)}};if(!i&&r){t.apply(e,s)}n.clearTimeout(i);i=n.setTimeout(o,a)};o.cancel=s;return o},Bt=function(){};Bt.prototype.allowedEvents_={};Bt.prototype.on=function(e,t){var a=this.addEventListener;this.addEventListener=function(){};G(this,e,t);this.addEventListener=a};Bt.prototype.addEventListener=Bt.prototype.on;Bt.prototype.off=function(e,t){K(this,e,t)};Bt.prototype.removeEventListener=Bt.prototype.off;Bt.prototype.one=function(e,t){var a=this.addEventListener;this.addEventListener=function(){};X(this,e,t);this.addEventListener=a};Bt.prototype.any=function(e,t){var a=this.addEventListener;this.addEventListener=function(){};Q(this,e,t);this.addEventListener=a};Bt.prototype.trigger=function(e){var t=e.type||e;if("string"==typeof e){e={type:t}}e=z(e);if(this.allowedEvents_[t]&&this["on"+t]){this["on"+t](e)}Y(this,e)};Bt.prototype.dispatchEvent=Bt.prototype.trigger;var jt;Bt.prototype.queueTrigger=function(t){var a=this;if(!jt){jt=new Map}var r=t.type||t,n=jt.get(this);if(!n){n=new Map;jt.set(this,n)}var i=n.get(r);n["delete"](r);e.clearTimeout(i);var s=e.setTimeout(function(){if(0===n.size){n=null;jt["delete"](a)}a.trigger(t)},0);n.set(r,s)};var Ft=function(e){return e instanceof Bt||!!e.eventBusEl_&&["on","one","off","trigger"].every(function(t){return"function"==typeof e[t]})},Ht=function(e,t){if(Ft(e)){t()}else{if(!e.eventedCallbacks){e.eventedCallbacks=[]}e.eventedCallbacks.push(t)}},qt=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},Vt=function(e){if(!e.nodeName&&!Ft(e)){throw new Error("Invalid target; must be a DOM node or evented object.")}},Wt=function(e){if(!qt(e)){throw new Error("Invalid event type; must be a non-empty string or array.")}},zt=function(e){if("function"!=typeof e){throw new Error("Invalid listener; must be a function.")}},Gt=function(e,t){var a=3>t.length||t[0]===e||t[0]===e.eventBusEl_,r,n,i;if(a){r=e.eventBusEl_;if(3<=t.length){t.shift()}n=t[0];i=t[1]}else{r=t[0];n=t[1];i=t[2]}Vt(r);Wt(n);zt(i);i=Ut(e,i);return{isTargetingSelf:a,target:r,type:n,listener:i}},$t=function(e,t,a,r){Vt(e);if(e.nodeName){Ot[t](e,a,r)}else{e[t](a,r)}},Kt={on:function(){for(var e=this,t=arguments.length,a=Array(t),r=0;r10){r=!1}}});var n=function(){r=!1};this.on("touchleave",n);this.on("touchcancel",n);this.on("touchend",function(n){a=null;if(!0===r){var i=e.performance.now()-t;if(i<200){n.preventDefault();this.trigger("tap")}}})};a.enableTouchActivity=function(){if(!this.player()||!this.player().reportUserActivity){return}var e=Ut(this.player(),this.player().reportUserActivity),t;this.on("touchstart",function(){e();this.clearInterval(t);t=this.setInterval(e,250)});var a=function(){e();this.clearInterval(t)};this.on("touchmove",e);this.on("touchend",a);this.on("touchcancel",a)};a.setTimeout=function(t,a){var r=this,n;t=Ut(this,t);this.clearTimersOnDispose_();n=e.setTimeout(function(){if(r.setTimeoutIds_.has(n)){r.setTimeoutIds_["delete"](n)}t()},a);this.setTimeoutIds_.add(n);return n};a.clearTimeout=function(t){if(this.setTimeoutIds_.has(t)){this.setTimeoutIds_["delete"](t);e.clearTimeout(t)}return t};a.setInterval=function(t,a){t=Ut(this,t);this.clearTimersOnDispose_();var r=e.setInterval(t,a);this.setIntervalIds_.add(r);return r};a.clearInterval=function(t){if(this.setIntervalIds_.has(t)){this.setIntervalIds_["delete"](t);e.clearInterval(t)}return t};a.requestAnimationFrame=function(t){var a=this;if(!this.supportsRaf_){return this.setTimeout(t,1e3/60)}this.clearTimersOnDispose_();var r;t=Ut(this,t);r=e.requestAnimationFrame(function(){if(a.rafIds_.has(r)){a.rafIds_["delete"](r)}t()});this.rafIds_.add(r);return r};a.cancelAnimationFrame=function(t){if(!this.supportsRaf_){return this.clearTimeout(t)}if(this.rafIds_.has(t)){this.rafIds_["delete"](t);e.cancelAnimationFrame(t)}return t};a.clearTimersOnDispose_=function(){var e=this;if(this.clearingTimersOnDispose_){return}this.clearingTimersOnDispose_=!0;this.one("dispose",function(){[["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var a=t[0],r=t[1];e[a].forEach(e[r],e)});e.clearingTimersOnDispose_=!1})};t.registerComponent=function(e,a){if("string"!=typeof e||!e){throw new Error("Illegal component name, \""+e+"\"; must be a non-empty string.")}var r=t.getComponent("Tech"),n=r&&r.isTech(a),i=t===a||t.prototype.isPrototypeOf(a.prototype);if(n||!i){var s;if(n){s="techs must be registered using Tech.registerTech()"}else{s="must be a Component subclass"}throw new Error("Illegal component, \""+e+"\"; "+s+".")}e=Qt(e);if(!t.components_){t.components_={}}var o=t.getComponent("Player");if("Player"===e&&o&&o.players){var l=o.players,d=Object.keys(l);if(l&&0da&&537>aa,ua=/Firefox/i.test(ea),ca=/Edge/i.test(ea),ma=!ca&&(/Chrome/i.test(ea)||/CriOS/i.test(ea)),ga=function(){var e=ea.match(/(Chrome|CriOS)\/(\d+)/);if(e&&e[2]){return parseFloat(e[2])}return null}(),ya=function(){var e=/MSIE\s(\d+)\.\d/.exec(ea),t=e&&parseFloat(e[1]);return"7.6.5"}(),ha=/Safari/i.test(ea)&&!ma&&!la&&!ca,_a=(ha||sa)&&!ma,fa=/Windows/i.test(ea),ba=m()&&("ontouchstart"in e||e.navigator.maxTouchPoints||e.DocumentTouch&&e.document instanceof e.DocumentTouch),Ta=Object.freeze({IS_IPAD:ra,IS_IPHONE:na,IS_IPOD:ia,IS_IOS:sa,IOS_VERSION:oa,IS_ANDROID:la,ANDROID_VERSION:da,IS_NATIVE_ANDROID:pa,IS_FIREFOX:ua,IS_EDGE:ca,IS_CHROME:ma,CHROME_VERSION:ga,IE_VERSION:ya,IS_SAFARI:ha,IS_ANY_SAFARI:_a,IS_WINDOWS:fa,TOUCH_ENABLED:ba});function se(e,t,a){if("number"!=typeof t||0>t||t>a){throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+a+").")}}function oe(e,t,a,r){se(e,r,a.length-1);return a[r][t]}function le(e){if(e===void 0||0===e.length){return{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}}return{length:e.length,start:oe.bind(null,"start",0,e),end:oe.bind(null,"end",1,e)}}function de(e,t){if(Array.isArray(e)){return le(e)}else if(e===void 0||t===void 0){return le()}return le([[e,t]])}function pe(e,t){var a=0,r,n;if(!t){return 0}if(!e||!e.length){e=de(0,0)}for(var s=0;st){n=t}a+=n-r}return a/t}for(var va={prefixed:!0},Sa=[["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"]],ka=Sa[0],Ca,Ea=0;Eas;s++){r[String.fromCharCode(s)]=s-32}for(var s=48;58>s;s++){r[s-48]=s}for(s=1;13>s;s++){r["f"+s]=s+111}for(s=0;10>s;s++){r["numpad "+s]=s+96}var o=t.names=t.title={};for(s in r){o[r[s]]=s}for(var l in n){r[l]=n[l]}}),wa=Da.code,Oa=Da.codes,Ra=Da.aliases,Ua=Da.names,Ma=Da.title,Na="vjs-modal-dialog",Ba=function(a){te(r,a);function r(e,t){var r=a.call(this,e,t)||this;r.opened_=r.hasBeenOpened_=r.hasBeenFilled_=!1;r.closeable(!r.options_.uncloseable);r.content(r.options_.content);r.contentEl_=_("div",{className:Na+"-content"},{role:"document"});r.descEl_=_("p",{className:Na+"-description vjs-control-text",id:r.el().getAttribute("aria-describedby")});f(r.descEl_,r.description());r.el_.appendChild(r.descEl_);r.el_.appendChild(r.contentEl_);return r}var n=r.prototype;n.createEl=function(){return a.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})};n.dispose=function(){this.contentEl_=null;this.descEl_=null;this.previouslyActiveEl_=null;a.prototype.dispose.call(this)};n.buildCSSClass=function(){return Na+" vjs-hidden "+a.prototype.buildCSSClass.call(this)};n.label=function(){return this.localize(this.options_.label||"Modal Window")};n.description=function(){var e=this.options_.description||this.localize("This is a modal window.");if(this.closeable()){e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")}return e};n.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen");this.opened_=!0;if(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_){this.fill()}this.wasPlaying_=!e.paused();if(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}};n.opened=function(e){if("boolean"==typeof e){this[e?"open":"close"]()}return this.opened_};n.close=function(){if(!this.opened_){return}var e=this.player();this.trigger("beforemodalclose");this.opened_=!1;if(this.wasPlaying_&&this.options_.pauseOnOpen){e.play()}this.off("keydown",this.handleKeyDown);if(this.hadControls_){e.controls(!0)}this.hide();this.el().setAttribute("aria-hidden","true");this.trigger("modalclose");this.conditionalBlur_();if(this.options_.temporary){this.dispose()}};n.closeable=function e(t){if("boolean"==typeof t){var e=this.closeable_=!!t,a=this.getChild("closeButton");if(e&&!a){var r=this.contentEl_;this.contentEl_=this.el_;a=this.addChild("closeButton",{controlText:"Close Modal Dialog"});this.contentEl_=r;this.on(a,"close",this.close)}if(!e&&a){this.off(a,"close",this.close);this.removeChild(a);a.dispose()}}return this.closeable_};n.fill=function(){this.fillWith(this.content())};n.fillWith=function(e){var t=this.contentEl(),a=t.parentNode,r=t.nextSibling;this.trigger("beforemodalfill");this.hasBeenFilled_=!0;a.removeChild(t);this.empty();B(t,e);this.trigger("modalfill");if(r){a.insertBefore(t,r)}else{a.appendChild(t)}var n=this.getChild("closeButton");if(n){a.appendChild(n.el_)}};n.empty=function(){this.trigger("beforemodalempty");U(this.contentEl());this.trigger("modalempty")};n.content=function(e){if("undefined"!=typeof e){this.content_=e}return this.content_};n.conditionalFocus_=function(){var e=t.activeElement,a=this.player_.el_;this.previouslyActiveEl_=null;if(a.contains(e)||a===e){this.previouslyActiveEl_=e;this.focus()}};n.conditionalBlur_=function(){if(this.previouslyActiveEl_){this.previouslyActiveEl_.focus();this.previouslyActiveEl_=null}};n.handleKeyDown=function(e){e.stopPropagation();if(Da.isEventKey(e,"Escape")&&this.closeable()){e.preventDefault();this.close();return}if(!Da.isEventKey(e,"Tab")){return}for(var a=this.focusableEls_(),r=this.el_.querySelector(":focus"),n,s=0;s";s=l.firstChild;l.setAttribute("style","display:none; position:absolute;");t.body.appendChild(l)}for(var d={},p=0;px";e=a.firstChild.href}return e},tr=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/,a=t.exec(e);if(a){return a.pop().toLowerCase()}}return""},ar=function(t){var a=e.location,r=Za(t),n=":"===r.protocol?a.protocol:r.protocol,i=n+r.host!==a.protocol+a.host;return i},rr=Object.freeze({parseUrl:Za,getAbsoluteURL:er,getFileExtension:tr,isCrossOrigin:ar}),nr=function(e){var t=ir.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)},ir=Object.prototype.toString;var sr=Array.prototype.slice,or=Object.prototype.toString,lr=function(e){var t=this;if("function"!=typeof t||or.call(t)!=="[object Function]"){throw new TypeError("Function.prototype.bind called on incompatible "+t)}for(var a=sr.call(arguments,1),r,n=function(){if(this instanceof r){var n=t.apply(this,a.concat(sr.call(arguments)));if(Object(n)===n){return n}return this}else{return t.apply(e,a.concat(sr.call(arguments)))}},s=Math.max(0,t.length-a.length),o=[],l=0;l>0},ToUint32:function(e){return this.ToNumber(e)>>>0},ToUint16:function(e){var t=this.ToNumber(e);if(Xr(t)||0===t||!Jr(t)){return 0}var a=Zr(t)*Math.floor(Math.abs(t));return en(a,65536)},ToString:function(e){return gn(e)},ToObject:function(e){this.CheckObjectCoercible(e);return cn(e)},CheckObjectCoercible:function(e,t){if(null==e){throw new mn(t||"Cannot call method on "+e)}return e},IsCallable:ln,SameValue:function(e,t){if(e===t){if(0===e){return 1/e==1/t}return!0}return Xr(e)&&Xr(t)},Type:function(e){if(null===e){return"Null"}if("undefined"==typeof e){return"Undefined"}if("function"==typeof e||"object"===_typeof(e)){return"Object"}if("number"==typeof e){return"Number"}if("boolean"==typeof e){return"Boolean"}if("string"==typeof e){return"String"}},IsPropertyDescriptor:function(e){if("Object"!==this.Type(e)){return!1}var t={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var a in e){if(zr(e,a)&&!t[a]){return!1}}var r=zr(e,"[[Value]]"),n=zr(e,"[[Get]]")||zr(e,"[[Set]]");if(r&&n){throw new mn("Property Descriptors may not be both accessor and data descriptors")}return!0},IsAccessorDescriptor:function(e){if("undefined"==typeof e){return!1}Yr(this,"Property Descriptor","Desc",e);if(!zr(e,"[[Get]]")&&!zr(e,"[[Set]]")){return!1}return!0},IsDataDescriptor:function(e){if("undefined"==typeof e){return!1}Yr(this,"Property Descriptor","Desc",e);if(!zr(e,"[[Value]]")&&!zr(e,"[[Writable]]")){return!1}return!0},IsGenericDescriptor:function(e){if("undefined"==typeof e){return!1}Yr(this,"Property Descriptor","Desc",e);if(!this.IsAccessorDescriptor(e)&&!this.IsDataDescriptor(e)){return!0}return!1},FromPropertyDescriptor:function(e){if("undefined"==typeof e){return e}Yr(this,"Property Descriptor","Desc",e);if(this.IsDataDescriptor(e)){return{value:e["[[Value]]"],writable:!!e["[[Writable]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]}}else if(this.IsAccessorDescriptor(e)){return{get:e["[[Get]]"],set:e["[[Set]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]}}else{throw new mn("FromPropertyDescriptor must be called with a fully populated Property Descriptor")}},ToPropertyDescriptor:function(e){if("Object"!==this.Type(e)){throw new mn("ToPropertyDescriptor requires an object")}var t={};if(zr(e,"enumerable")){t["[[Enumerable]]"]=this.ToBoolean(e.enumerable)}if(zr(e,"configurable")){t["[[Configurable]]"]=this.ToBoolean(e.configurable)}if(zr(e,"value")){t["[[Value]]"]=e.value}if(zr(e,"writable")){t["[[Writable]]"]=this.ToBoolean(e.writable)}if(zr(e,"get")){var a=e.get;if("undefined"!=typeof a&&!this.IsCallable(a)){throw new TypeError("getter must be a function")}t["[[Get]]"]=a}if(zr(e,"set")){var r=e.set;if("undefined"!=typeof r&&!this.IsCallable(r)){throw new mn("setter must be a function")}t["[[Set]]"]=r}if((zr(t,"[[Get]]")||zr(t,"[[Set]]"))&&(zr(t,"[[Value]]")||zr(t,"[[Writable]]"))){throw new mn("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute")}return t}},hn=dr.call(Function.call,String.prototype.replace),_n=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,fn=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/,bn=function(){var e=yn.ToString(yn.CheckObjectCoercible(this));return hn(hn(e,_n,""),fn,"")},Tn="\u200B",vn=function(){if(String.prototype.trim&&Tn.trim()===Tn){return String.prototype.trim}return bn},Sn=dr.call(Function.call,vn());Nr(Sn,{getPolyfill:vn,implementation:bn,shim:function(){var e=vn();Nr(String.prototype,{trim:e},{trim:function(){return String.prototype.trim!==e}});return e}});var kn=Sn,Cn=Object.prototype.toString,En=Object.prototype.hasOwnProperty,Pn=function(e,t,a){for(var r=0,n=e.length;r=e){t.push(n)}else if(n.startTime===n.endTime&&n.startTime<=e&&n.startTime+.5>=e){t.push(n)}}d=!1;if(t.length!==this.activeCues_.length){d=!0}else{for(var s=0;s=t){this.set(e,t);return!0}}return!1}};function Ee(e,t,a,r){var n=r?e.split(r):[e];for(var s in n){if("string"!=typeof n[s]){continue}var i=n[s].split(a);if(2!==i.length){continue}var o=i[0],l=i[1];t(o,l)}}function Pe(e,t,a){var s=e;function r(){var t=ke(e);if(null===t){throw new Se(Se.Errors.BadTimeStamp,"Malformed timestamp: "+s)}e=e.replace(/^[^\sa-zA-Z-]+/,"");return t}function n(e,t){var r=new Ce;Ee(e,function(e,t){switch(e){case"region":for(var n=a.length-1;0<=n;n--){if(a[n].id===t){r.set(e,a[n].region);break}}break;case"vertical":r.alt(e,t,["rl","lr"]);break;case"line":var s=t.split(","),o=s[0];r.integer(e,o);r.percent(e,o)?r.set("snapToLines",!1):null;r.alt(e,o,["auto"]);if(2===s.length){r.alt("lineAlign",s[1],["start","middle","end"])}break;case"position":s=t.split(",");r.percent(e,s[0]);if(2===s.length){r.alt("positionAlign",s[1],["start","middle","end"])}break;case"size":r.percent(e,t);break;case"align":r.alt(e,t,["start","middle","end","left","right"]);break;}},/:/,/\s/);t.region=r.get("region",null);t.vertical=r.get("vertical","");t.line=r.get("line","auto");t.lineAlign=r.get("lineAlign","start");t.snapToLines=r.get("snapToLines",!0);t.size=r.get("size",100);t.align=r.get("align","middle");t.position=r.get("position",{start:0,left:0,middle:50,end:100,right:100},t.align);t.positionAlign=r.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},t.align)}function i(){e=e.replace(/^\s+/,"")}i();t.startTime=r();i();if("-->"!==e.substr(0,3)){throw new Se(Se.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+s)}e=e.substr(3);i();t.endTime=r();i();n(e,t)}var Gn={"&":"&","<":"<",">":">","‎":"\u200E","‏":"\u200F"," ":"\xA0"},$n={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Kn={v:"title",lang:"lang"},Yn={rt:"ruby"};function Ie(e,a){function r(){if(!a){return null}function e(e){a=a.substr(e.length);return e}var t=a.match(/^([^<]*)(<[^>]*>?)?/);return e(t[1]?t[1]:t[2])}function n(t){return Gn[t]}function i(e){while(y=e.match(/&(amp|lt|gt|lrm|rlm|nbsp);/)){e=e.replace(y[0],n)}return e}function s(e,t){return!Yn[t.localName]||Yn[t.localName]===e.localName}function o(t,a){var r=$n[t];if(!r){return null}var n=e.document.createElement(r);n.localName=r;var i=Kn[t];if(i&&a){n[i]=a.trim()}return n}var l=e.document.createElement("div"),d=l,p,u=[];while(null!==(p=r())){if("<"===p[0]){if("/"===p[1]){if(u.length&&u[u.length-1]===p.substr(2).replace(">","")){u.pop();d=d.parentNode}continue}var c=ke(p.substr(1,p.length-2)),g;if(c){g=e.document.createProcessingInstruction("timestamp",c);d.appendChild(g);continue}var y=p.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!y){continue}g=o(y[1],y[3]);if(!g){continue}if(!s(d,g)){continue}if(y[2]){g.className=y[2].substr(1).replace("."," ")}u.push(y[1]);d.appendChild(g);d=g;continue}d.appendChild(e.document.createTextNode(i(p)))}return l}var Xn=[[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 Le(e){for(var t=0,a;t=a[0]&&e<=a[1]){return!0}}return!1}function xe(e){var r=[],n="",s;if(!e||!e.childNodes){return"ltr"}function t(e,t){for(var a=t.childNodes.length-1;0<=a;a--){e.push(t.childNodes[a])}}function a(e){if(!e||!e.length){return null}var r=e.pop(),n=r.textContent||r.innerText;if(n){var i=n.match(/^.*(\n|\r)/);if(i){e.length=0;return i[0]}return n}if("ruby"===r.tagName){return a(e)}if(r.childNodes){t(e,r);return a(e)}}t(r,e);while(n=a(r)){for(var o=0;o=e.line)){return e.line}if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement){return-1}for(var t=e.track,a=t.textTrackList,r=0,n=0;ne.left&&this.tope.top};Oe.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right};Oe.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom;}};Oe.prototype.intersectPercentage=function(e){var t=Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left)),a=Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top));return t*a/(this.height*this.width)};Oe.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}};Oe.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,a=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,r=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e;var n={left:e.left,right:e.right,top:e.top||r,height:e.height||t,bottom:e.bottom||r+(e.height||t),width:e.width||a};return n};function Re(e,t,a,r){function n(e,t){for(var n,s=new Oe(e),o=1,l=0;ld){n=new Oe(e);o=d}e=new Oe(s)}return n||s}var i=new Oe(t),s=t.cue,o=Ae(s),l=[];if(s.snapToLines){var d;switch(s.vertical){case"":l=["+y","-y"];d="height";break;case"rl":l=["+x","-x"];d="width";break;case"lr":l=["-x","+x"];d="width";break;}var p=i.lineHeight,u=p*Math.round(o),c=a[d]+p,m=l[0];if(Math.abs(u)>c){u=0>u?-1:1;u*=Math.ceil(c/p)*p}if(0>o){u+=""===s.vertical?a.height:a.width;l=l.reverse()}i.move(m,u)}else{var g=100*(i.lineHeight/a.height);switch(s.lineAlign){case"middle":o-=g/2;break;case"end":o-=g;break;}switch(s.vertical){case"":t.applyStyles({top:t.formatStyle(o,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(o,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(o,"%")});break;}l=["+y","-x","+x","-y"];i=new Oe(t)}var y=n(i,l);t.move(y.toCSSCompatValues(a))}function Ue(){}Ue.StringDecoder=function(){return{decode:function(e){if(!e){return""}if("string"!=typeof e){throw new Error("Error - expected string data.")}return decodeURIComponent(encodeURIComponent(e))}}};Ue.convertCueToDOMTree=function(e,t){if(!e||!t){return null}return Ie(e,t)};Ue.processCues=function(e,t,a){if(!e||!t||!a){return null}while(a.firstChild){a.removeChild(a.firstChild)}var n=e.document.createElement("div");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%";a.appendChild(n);function r(e){for(var t=0;t")){i.cue.id=s;continue}case"CUE":try{Pe(s,i.cue,i.regionList)}catch(t){i.reportOrThrowError(t);i.cue=null;i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":var d=-1!==s.indexOf("-->");if(!s||d&&(l=!0)){i.oncue&&i.oncue(i.cue);i.cue=null;i.state="ID";continue}if(i.cue.text){i.cue.text+="\n"}i.cue.text+=s;continue;case"BADCUE":if(!s){i.state="ID"}continue;}}}catch(t){i.reportOrThrowError(t);if("CUETEXT"===i.state&&i.cue&&i.oncue){i.oncue(i.cue)}i.cue=null;i.state="INITIAL"===i.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var t=this;try{t.buffer+=t.decoder.decode();if(t.cue||"HEADER"===t.state){t.buffer+="\n\n";t.parse()}if("INITIAL"===t.state){throw new Se(Se.Errors.BadSignature)}}catch(a){t.reportOrThrowError(a)}t.onflush&&t.onflush();return this}};var Qn={"":1,lr:1,rl:1},Jn={start:1,middle:1,end:1,left:1,right:1};function Me(e){if("string"!=typeof e){return!1}var t=Qn[e.toLowerCase()];return t?e.toLowerCase():!1}function Ne(e){if("string"!=typeof e){return!1}var t=Jn[e.toLowerCase()];return t?e.toLowerCase():!1}function Be(e,t,a){this.hasBeenReset=!1;var r="",n=!1,i=e,s=t,o=a,l=null,d="",p=!0,u="auto",c="start",m=50,g="middle",y=50,h="middle";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(e){r=""+e}},pauseOnExit:{enumerable:!0,get:function(){return n},set:function(e){n=!!e}},startTime:{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e){throw new TypeError("Start time must be set to a number.")}i=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 l},set:function(e){l=e;this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return d},set:function(e){var t=Me(e);if(!1===t){throw new SyntaxError("An invalid or illegal string was specified.")}d=t;this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return p},set:function(e){p=!!e;this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e&&e!=="auto"){throw new SyntaxError("An invalid number or illegal string was specified.")}u=e;this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return c},set:function(e){var t=Ne(e);if(!t){throw new SyntaxError("An invalid or illegal string was specified.")}c=t;this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return m},set:function(e){if(0>e||100e||100=e}var ei=function(){var e=100,t=3,a=0,r=100,n=0,i=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!Fe(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 r},set:function(e){if(!Fe(e)){throw new Error("RegionAnchorX must be between 0 and 100.")}r=e}},regionAnchorX:{enumerable:!0,get:function(){return a},set:function(e){if(!Fe(e)){throw new Error("RegionAnchorY must be between 0 and 100.")}a=e}},viewportAnchorY:{enumerable:!0,get:function(){return i},set:function(e){if(!Fe(e)){throw new Error("ViewportAnchorY must be between 0 and 100.")}i=e}},viewportAnchorX:{enumerable:!0,get:function(){return n},set:function(e){if(!Fe(e)){throw new Error("ViewportAnchorX must be between 0 and 100.")}n=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=je(e);if(!1===t){throw new SyntaxError("An invalid or illegal string was specified.")}s=t}}})},ti=ge(function(t){var a=t.exports={WebVTT:Ue,VTTCue:Be,VTTRegion:ei};e.vttjs=a;e.WebVTT=a.WebVTT;var r=a.VTTCue,n=a.VTTRegion,i=e.VTTCue,s=e.VTTRegion;a.shim=function(){e.VTTCue=r;e.VTTRegion=n};a.restore=function(){e.VTTCue=i;e.VTTRegion=s};if(!e.VTTCue){a.shim()}}),ai=ti.WebVTT,ri=ti.VTTCue,ni=ti.VTTRegion;function He(e,t,a,r,n){if(void 0===n){n={}}var i=e.textTracks();n.kind=t;if(a){n.label=a}if(r){n.language=r}n.tech=e;var s=new Wn.text.TrackClass(n);i.addTrack(s);return s}var ii=function(a){te(r,a);function r(e,t){var r;if(void 0===e){e={}}if(void 0===t){t=function(){}}e.reportTouchActivity=!1;r=a.call(this,null,e,t)||this;r.hasStarted_=!1;r.on("playing",function(){this.hasStarted_=!0});r.on("loadstart",function(){this.hasStarted_=!1});Wn.names.forEach(function(t){var a=Wn[t];if(e&&e[a.getterName]){r[a.privateName]=e[a.getterName]}});if(!r.featuresProgressEvents){r.manualProgressOn()}if(!r.featuresTimeupdateEvents){r.manualTimeUpdatesOn()}["Text","Audio","Video"].forEach(function(t){if(!1===e["native"+t+"Tracks"]){r["featuresNative"+t+"Tracks"]=!1}});if(!1===e.nativeCaptions||!1===e.nativeTextTracks){r.featuresNativeTextTracks=!1}else if(!0===e.nativeCaptions||!0===e.nativeTextTracks){r.featuresNativeTextTracks=!0}if(!r.featuresNativeTextTracks){r.emulateTextTracks()}r.autoRemoteTextTracks_=new Wn.text.ListClass;r.initTrackListeners();if(!e.nativeControlsForTouch){r.emitTapEvents()}if(r.constructor){r.name_=r.constructor.name||"Unknown Tech"}return r}var n=r.prototype;n.triggerSourceset=function(e){var t=this;if(!this.isReady_){this.one("ready",function(){return t.setTimeout(function(){return t.triggerSourceset(e)},1)})}this.trigger({src:e,type:"sourceset"})};n.manualProgressOn=function(){this.on("durationchange",this.onDurationChange);this.manualProgress=!0;this.one("ready",this.trackProgress)};n.manualProgressOff=function(){this.manualProgress=!1;this.stopTrackingProgress();this.off("durationchange",this.onDurationChange)};n.trackProgress=function(){this.stopTrackingProgress();this.progressInterval=this.setInterval(Ut(this,function(){var e=this.bufferedPercent();if(this.bufferedPercent_!==e){this.trigger("progress")}this.bufferedPercent_=e;if(1===e){this.stopTrackingProgress()}}),500)};n.onDurationChange=function(){this.duration_=this.duration()};n.buffered=function(){return de(0,0)};n.bufferedPercent=function(){return pe(this.buffered(),this.duration_)};n.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)};n.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0;this.on("play",this.trackCurrentTime);this.on("pause",this.stopTrackingCurrentTime)};n.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1;this.stopTrackingCurrentTime();this.off("play",this.trackCurrentTime);this.off("pause",this.stopTrackingCurrentTime)};n.trackCurrentTime=function(){if(this.currentTimeInterval){this.stopTrackingCurrentTime()}this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)};n.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval);this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})};n.dispose=function(){this.clearTracks(qn.names);if(this.manualProgress){this.manualProgressOff()}if(this.manualTimeUpdates){this.manualTimeUpdatesOff()}a.prototype.dispose.call(this)};n.clearTracks=function(e){var t=this;e=[].concat(e);e.forEach(function(e){var a=t[e+"Tracks"]()||[],r=a.length;while(r--){var n=a[r];if("text"===e){t.removeRemoteTextTrack(n)}a.removeTrack(n)}})};n.cleanupAutoTextTracks=function(){var e=this.autoRemoteTextTracks_||[],t=e.length;while(t--){var a=e[t];this.removeRemoteTextTrack(a)}};n.reset=function(){};n.error=function(e){if(e!==void 0){this.error_=new ue(e);this.trigger("error")}return this.error_};n.played=function(){if(this.hasStarted_){return de(0,0)}return de()};n.setCurrentTime=function(){if(this.manualTimeUpdates){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}};n.initTrackListeners=function(){var e=this;qn.names.forEach(function(t){var a=qn[t],r=function(){e.trigger(t+"trackchange")},n=e[a.getterName]();n.addEventListener("removetrack",r);n.addEventListener("addtrack",r);e.on("dispose",function(){n.removeEventListener("removetrack",r);n.removeEventListener("addtrack",r)})})};n.addWebVttScript_=function(){var a=this;if(e.WebVTT){return}if(t.body.contains(this.el())){if(!this.options_["vtt.js"]&&l(ti)&&0",className:this.buildCSSClass(),tabIndex:0},a);if("button"===t){ft.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead.")}r=s({role:"button"},r);this.tabIndex_=a.tabIndex;var n=e.prototype.createEl.call(this,t,a,r);this.createControlTextEl(n);return n};a.dispose=function(){this.controlTextEl_=null;e.prototype.dispose.call(this)};a.createControlTextEl=function(e){this.controlTextEl_=_("span",{className:"vjs-control-text"},{"aria-live":"polite"});if(e){e.appendChild(this.controlTextEl_)}this.controlText(this.controlText_,e);return this.controlTextEl_};a.controlText=function(e,t){if(void 0===t){t=this.el()}if(e===void 0){return this.controlText_||"Need Text"}var a=this.localize(e);this.controlText_=e;f(this.controlTextEl_,a);if(!this.nonIconControl){t.setAttribute("title",a)}};a.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)};a.enable=function(){if(!this.enabled_){this.enabled_=!0;this.removeClass("vjs-disabled");this.el_.setAttribute("aria-disabled","false");if("undefined"!=typeof this.tabIndex_){this.el_.setAttribute("tabIndex",this.tabIndex_)}this.on(["tap","click"],this.handleClick);this.on("keydown",this.handleKeyDown)}};a.disable=function(){this.enabled_=!1;this.addClass("vjs-disabled");this.el_.setAttribute("aria-disabled","true");if("undefined"!=typeof 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)};a.handleClick=function(){};a.handleKeyDown=function(t){if(Da.isEventKey(t,"Space")||Da.isEventKey(t,"Enter")){t.preventDefault();t.stopPropagation();this.trigger("click")}else{e.prototype.handleKeyDown.call(this,t)}};return t}(Zt);Zt.registerComponent("ClickableComponent",fi);var bi=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.update();t.on("posterchange",Ut(ie(r),r.update));return r}var a=t.prototype;a.dispose=function(){this.player().off("posterchange",this.update);e.prototype.dispose.call(this)};a.createEl=function(){var e=_("div",{className:"vjs-poster",tabIndex:-1});return e};a.update=function(){var e=this.player().poster();this.setSrc(e);if(e){this.show()}else{this.hide()}};a.setSrc=function(e){var t="";if(e){t="url(\""+e+"\")"}this.el_.style.backgroundImage=t};a.handleClick=function(){if(!this.player_.controls()){return}if(this.player_.tech(!0)){this.player_.tech(!0).focus()}if(this.player_.paused()){me(this.player_.play())}else{this.player_.pause()}};return t}(fi);Zt.registerComponent("PosterImage",bi);var Ti="#ccc",vi={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 Ze(e,t){var a;if(4===e.length){a=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]}else if(7===e.length){a=e.slice(1)}else{throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.")}return"rgba("+parseInt(a.slice(0,2),16)+","+parseInt(a.slice(2,4),16)+","+parseInt(a.slice(4,6),16)+","+t+")"}function et(e,t,a){try{e.style[t]=a}catch(t){}}var Si=function(t){te(a,t);function a(a,r,n){var i=t.call(this,a,r,n)||this;var s=Ut(ie(i),i.updateDisplay);a.on("loadstart",Ut(ie(i),i.toggleDisplay));a.on("texttrackchange",s);a.on("loadedmetadata",Ut(ie(i),i.preselectTrack));a.ready(Ut(ie(i),function(){if(a.tech_&&a.tech_.featuresNativeTextTracks){this.hide();return}a.on("fullscreenchange",s);a.on("playerresize",s);e.addEventListener("orientationchange",s);a.on("dispose",function(){return e.removeEventListener("orientationchange",s)});for(var t=this.options_.playerOptions.tracks||[],r=0;r",className:this.buildCSSClass()},t);a=s({type:"button"},a);var r=Zt.prototype.createEl.call(this,e,t,a);this.createControlTextEl(r);return r};a.addChild=function(e,t){if(void 0===t){t={}}var a=this.constructor.name;ft.warn("Adding an actionable (user controllable) child to a Button ("+a+") is not supported; use a ClickableComponent instead.");return Zt.prototype.addChild.call(this,e,t)};a.enable=function(){e.prototype.enable.call(this);this.el_.removeAttribute("disabled")};a.disable=function(){e.prototype.disable.call(this);this.el_.setAttribute("disabled","disabled")};a.handleKeyDown=function(t){if(Da.isEventKey(t,"Space")||Da.isEventKey(t,"Enter")){t.stopPropagation();return}e.prototype.handleKeyDown.call(this,t)};return t}(fi);Zt.registerComponent("Button",Ci);var Ei=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.mouseused_=!1;r.on("mousedown",r.handleMouseDown);return r}var a=t.prototype;a.buildCSSClass=function(){return"vjs-big-play-button"};a.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){me(t);if(this.player_.tech(!0)){this.player_.tech(!0).focus()}return}var a=this.player_.getChild("controlBar"),r=a&&a.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}var n=function(){return r.focus()};if(ce(t)){t.then(n,function(){})}else{this.setTimeout(n,1)}};a.handleKeyDown=function(t){this.mouseused_=!1;e.prototype.handleKeyDown.call(this,t)};a.handleMouseDown=function(){this.mouseused_=!0};return t}(Ci);Ei.prototype.controlText_="Play Video";Zt.registerComponent("BigPlayButton",Ei);var Pi=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.controlText(a&&a.controlText||r.localize("Close"));return r}var a=t.prototype;a.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)};a.handleClick=function(){this.trigger({type:"close",bubbles:!1})};a.handleKeyDown=function(t){if(Da.isEventKey(t,"Esc")){t.preventDefault();t.stopPropagation();this.trigger("click")}else{e.prototype.handleKeyDown.call(this,t)}};return t}(Ci);Zt.registerComponent("CloseButton",Pi);var Ii=function(e){te(t,e);function t(t,a){var r;if(void 0===a){a={}}r=e.call(this,t,a)||this;a.replay=a.replay===void 0||a.replay;r.on(t,"play",r.handlePlay);r.on(t,"pause",r.handlePause);if(a.replay){r.on(t,"ended",r.handleEnded)}return r}var a=t.prototype;a.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)};a.handleClick=function(){if(this.player_.paused()){this.player_.play()}else{this.player_.pause()}};a.handleSeeked=function(e){this.removeClass("vjs-ended");if(this.player_.paused()){this.handlePause(e)}else{this.handlePlay(e)}};a.handlePlay=function(){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.controlText("Pause")};a.handlePause=function(){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.controlText("Play")};a.handleEnded=function(){this.removeClass("vjs-playing");this.addClass("vjs-ended");this.controlText("Replay");this.one(this.player_,"seeked",this.handleSeeked)};return t}(Ci);Ii.prototype.controlText_="Play";Zt.registerComponent("PlayToggle",Ii);var Li=function(e,t){e=0>e?0:e;var a=Math.floor(e%60),r=Math.floor(e/60%60),n=Math.floor(e/3600),i=Math.floor(t/60%60),o=Math.floor(t/3600);if(isNaN(e)||e===1/0){n=r=a="-"}n=0r?"0"+r:r)+":";a=10>a?"0"+a:a;return n+r+a},xi=Li;function tt(e,t){if(void 0===t){t=e}return xi(e,t)}var Ai=function(e){te(a,e);function a(t,a){var r=e.call(this,t,a)||this;r.throttledUpdateContent=Mt(Ut(ie(r),r.updateContent),Rt);r.on(t,"timeupdate",r.throttledUpdateContent);return r}var r=a.prototype;r.createEl=function(){var t=this.buildCSSClass(),a=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control",innerHTML:""+this.localize(this.labelText_)+"\xA0"});this.contentEl_=_("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"});this.updateTextNode_();a.appendChild(this.contentEl_);return a};r.dispose=function(){this.contentEl_=null;this.textNode_=null;e.prototype.dispose.call(this)};r.updateTextNode_=function(){if(!this.contentEl_){return}while(this.contentEl_.firstChild){this.contentEl_.removeChild(this.contentEl_.firstChild)}this.textNode_=t.createTextNode(this.formattedTime_||this.formatTime_(0));this.contentEl_.appendChild(this.textNode_)};r.formatTime_=function(e){return tt(e)};r.updateFormattedTime_=function(e){var t=this.formatTime_(e);if(t===this.formattedTime_){return}this.formattedTime_=t;this.requestAnimationFrame(this.updateTextNode_)};r.updateContent=function(){};return a}(Zt);Ai.prototype.labelText_="Time";Ai.prototype.controlText_="Time";Zt.registerComponent("TimeDisplay",Ai);var Di=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.on(t,"ended",r.handleEnded);return r}var a=t.prototype;a.buildCSSClass=function(){return"vjs-current-time"};a.updateContent=function(){var e=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(e)};a.handleEnded=function(){if(!this.player_.duration()){return}this.updateFormattedTime_(this.player_.duration())};return t}(Ai);Di.prototype.labelText_="Current Time";Di.prototype.controlText_="Current Time";Zt.registerComponent("CurrentTimeDisplay",Di);var wi=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.on(t,"durationchange",r.updateContent);r.on(t,"loadstart",r.updateContent);r.on(t,"loadedmetadata",r.throttledUpdateContent);return r}var a=t.prototype;a.buildCSSClass=function(){return"vjs-duration"};a.updateContent=function(){var e=this.player_.duration();if(this.duration_!==e){this.duration_=e;this.updateFormattedTime_(e)}};return t}(Ai);wi.prototype.labelText_="Duration";wi.prototype.controlText_="Duration";Zt.registerComponent("DurationDisplay",wi);var Oi=function(e){te(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"
/
"},{"aria-hidden":!0})};return t}(Zt);Zt.registerComponent("TimeDivider",Oi);var Ri=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.on(t,"durationchange",r.throttledUpdateContent);r.on(t,"ended",r.handleEnded);return r}var a=t.prototype;a.buildCSSClass=function(){return"vjs-remaining-time"};a.createEl=function(){var t=e.prototype.createEl.call(this);t.insertBefore(_("span",{},{"aria-hidden":!0},"-"),this.contentEl_);return t};a.updateContent=function(){if("number"!=typeof this.player_.duration()){return}if(this.player_.remainingTimeDisplay){this.updateFormattedTime_(this.player_.remainingTimeDisplay())}else{this.updateFormattedTime_(this.player_.remainingTime())}};a.handleEnded=function(){if(!this.player_.duration()){return}this.updateFormattedTime_(0)};return t}(Ai);Ri.prototype.labelText_="Remaining Time";Ri.prototype.controlText_="Remaining Time";Zt.registerComponent("RemainingTimeDisplay",Ri);var Ui=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.updateShowing();r.on(r.player(),"durationchange",r.updateShowing);return r}var a=t.prototype;a.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});this.contentEl_=_("div",{className:"vjs-live-display",innerHTML:""+this.localize("Stream Type")+"\xA0"+this.localize("LIVE")},{"aria-live":"off"});t.appendChild(this.contentEl_);return t};a.dispose=function(){this.contentEl_=null;e.prototype.dispose.call(this)};a.updateShowing=function(){if(this.player().duration()===1/0){this.show()}else{this.hide()}};return t}(Zt);Zt.registerComponent("LiveDisplay",Ui);var Mi=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.updateLiveEdgeStatus();if(r.player_.liveTracker){r.on(r.player_.liveTracker,"liveedgechange",r.updateLiveEdgeStatus)}return r}var a=t.prototype;a.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});this.textEl_=_("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"});t.appendChild(this.textEl_);return t};a.updateLiveEdgeStatus=function(){if(!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")}else{this.setAttribute("aria-disabled",!1);this.removeClass("vjs-at-live-edge");this.controlText("Seek to live, currently behind live")}};a.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()};a.dispose=function(){if(this.player_.liveTracker){this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatus)}this.textEl_=null;e.prototype.dispose.call(this)};return t}(Ci);Mi.prototype.controlText_="Seek to live, currently playing live";Zt.registerComponent("SeekToLive",Mi);var Ni=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.bar=r.getChild(r.options_.barName);r.vertical(!!r.options_.vertical);r.enable();return r}var a=t.prototype;a.enabled=function(){return this.enabled_};a.enable=function(){if(this.enabled()){return}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);if(this.playerEvent){this.on(this.player_,this.playerEvent,this.update)}this.removeClass("disabled");this.setAttribute("tabindex",0);this.enabled_=!0};a.disable=function(){if(!this.enabled()){return}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");if(this.playerEvent){this.off(this.player_,this.playerEvent,this.update)}this.enabled_=!1};a.createEl=function(t,a,r){if(void 0===a){a={}}if(void 0===r){r={}}a.className=a.className+" vjs-slider";a=s({tabIndex:0},a);r=s({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},r);return e.prototype.createEl.call(this,t,a,r)};a.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;if("mousedown"===e.type){e.preventDefault()}if("touchstart"===e.type&&!ma){e.preventDefault()}x();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)};a.handleMouseMove=function(){};a.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;A();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()};a.update=function(){if(!this.el_){return}var e=this.getPercent(),t=this.bar;if(!t){return}if("number"!=typeof e||e!==e||0>e||e===1/0){e=0}var a=(100*e).toFixed(2)+"%",r=t.el().style,n=this.vertical()?"height":"width";if(r[n]!==a){r[n]=a}return e};a.calculateDistance=function(e){var t=O(this.el_,e);if(this.vertical()){return t.y}return t.x};a.handleKeyDown=function(t){if(Da.isEventKey(t,"Left")||Da.isEventKey(t,"Down")){t.preventDefault();t.stopPropagation();this.stepBack()}else if(Da.isEventKey(t,"Right")||Da.isEventKey(t,"Up")){t.preventDefault();t.stopPropagation();this.stepForward()}else{e.prototype.handleKeyDown.call(this,t)}};a.handleClick=function(e){e.stopPropagation();e.preventDefault()};a.vertical=function(e){if(e===void 0){return this.vertical_||!1}this.vertical_=!!e;if(this.vertical_){this.addClass("vjs-slider-vertical")}else{this.addClass("vjs-slider-horizontal")}};return t}(Zt);Zt.registerComponent("Slider",Ni);var Bi=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.partEls_=[];r.on(t,"progress",r.update);return r}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:""+this.localize("Loaded")+": 0%"})};a.dispose=function(){this.partEls_=null;e.prototype.dispose.call(this)};a.update=function(){var e=this.player_.liveTracker,t=this.player_.buffered(),a=e&&e.isLive()?e.seekableEnd():this.player_.duration(),r=this.player_.bufferedEnd(),n=this.partEls_,s=this.$(".vjs-control-text-loaded-percentage"),o=function(e,t,a){var r=e/t||0;r=100*(1<=r?1:r);if(a){r=r.toFixed(2)}return r+"%"};this.el_.style.width=o(r,a);f(s,o(r,a,!0));for(var l=0;lt.length;c--){this.el_.removeChild(n[c-1])}n.length=t.length};return t}(Zt);Zt.registerComponent("LoadProgressBar",Bi);var ji=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.update=Mt(Ut(ie(r),r.update),Rt);return r}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})};a.update=function(e,t,a){var r=D(this.el_),n=D(this.player_.el()),i=e.width*t;if(!n||!r){return}var s=e.left-n.left+i,o=e.width-i+(n.right-e.right),l=r.width/2;if(sl){l=0}else if(l>r.width){l=r.width}this.el_.style.right="-"+l+"px";this.write(a)};a.write=function(e){f(this.el_,e)};a.updateTime=function(e,t,a,r){var n=this;if(this.rafId_){this.cancelAnimationFrame(this.rafId_)}this.rafId_=this.requestAnimationFrame(function(){var i,s=n.player_.duration();if(n.player_.liveTracker&&n.player_.liveTracker.isLive()){var o=n.player_.liveTracker.liveWindow(),l=o-t*o;i=(1>l?"":"-")+tt(l,o)}else{i=tt(a,s)}n.update(e,t,i);if(r){r()}})};return t}(Zt);Zt.registerComponent("TimeTooltip",ji);var Fi=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.update=Mt(Ut(ie(r),r.update),Rt);return r}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})};a.update=function(e,t){var a=this.getChild("timeTooltip");if(!a){return}var r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();a.updateTime(e,t,r)};return t}(Zt);Fi.prototype.options_={children:[]};if(!sa&&!la){Fi.prototype.options_.children.push("timeTooltip")}Zt.registerComponent("PlayProgressBar",Fi);var Hi=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.update=Mt(Ut(ie(r),r.update),Rt);return r}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})};a.update=function(e,t){var a=this,r=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,r,function(){a.el_.style.left=e.width*t+"px"})};return t}(Zt);Hi.prototype.options_={children:["timeTooltip"]};Zt.registerComponent("MouseTimeDisplay",Hi);var qi=12,Vi=30,Wi=function(e){te(a,e);function a(t,a){var r=e.call(this,t,a)||this;r.setEventHandlers_();return r}var r=a.prototype;r.setEventHandlers_=function(){this.update=Mt(Ut(this,this.update),Vi);this.on(this.player_,"timeupdate",this.update);this.on(this.player_,"ended",this.handleEnded);this.on(this.player_,"durationchange",this.update);if(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_);if("hidden"in t&&"visibilityState"in t){this.on(t,"visibilitychange",this.toggleVisibility_)}};r.toggleVisibility_=function(a){if(t.hidden){this.disableInterval_(a)}else{this.enableInterval_();this.requestAnimationFrame(this.update)}};r.enableInterval_=function(){var e=this;this.clearInterval(this.updateInterval);this.updateInterval=this.setInterval(function(){e.requestAnimationFrame(e.update)},Vi)};r.disableInterval_=function(t){if(this.player_.liveTracker&&this.player_.liveTracker.isLive()&&"ended"!==t.type){return}this.clearInterval(this.updateInterval)};r.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})};r.update_=function(e,t){var a=this.player_.liveTracker,r=this.player_.duration();if(a&&a.isLive()){r=this.player_.liveTracker.liveCurrentTime()}this.el_.setAttribute("aria-valuenow",(100*t).toFixed(2));this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[tt(e,r),tt(r,r)],"{1} of {2}"));if(this.bar){this.bar.update(D(this.el_),t)}};r.update=function(){if(null===this.el().offsetParent){return}var t=e.prototype.update.call(this);this.update_(this.getCurrentTime_(),t);return t};r.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()};r.handleEnded=function(){this.update_(this.player_.duration(),1)};r.getPercent=function(){var e=this.getCurrentTime_(),t,a=this.player_.liveTracker;if(a&&a.isLive()){t=(e-a.seekableStart())/a.liveWindow();if(a.atLiveEdge()){t=1}}else{t=e/this.player_.duration()}return 1<=t?1:t||0};r.handleMouseDown=function(t){if(!j(t)){return}t.stopPropagation();this.player_.scrubbing(!0);this.videoWasPlaying=!this.player_.paused();this.player_.pause();e.prototype.handleMouseDown.call(this,t)};r.handleMouseMove=function(e){if(!j(e)){return}var t,a=this.calculateDistance(e),r=this.player_.liveTracker;if(!r||!r.isLive()){t=a*this.player_.duration();if(t===this.player_.duration()){t=t-.1}}else{var n=r.seekableStart(),i=r.liveCurrentTime();t=n+a*r.liveWindow();if(t>=i){t=i}if(t<=n){t=n+.1}if(t===1/0){return}}this.player_.currentTime(t)};r.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");if(!t){return}t.show()};r.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");if(!t){return}t.hide()};r.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t);if(t){t.stopPropagation()}this.player_.scrubbing(!1);this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0});if(this.videoWasPlaying){me(this.player_.play())}};r.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)};r.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)};r.handleAction=function(){if(this.player_.paused()){this.player_.play()}else{this.player_.pause()}};r.handleKeyDown=function(t){if(Da.isEventKey(t,"Space")||Da.isEventKey(t,"Enter")){t.preventDefault();t.stopPropagation();this.handleAction(t)}else if(Da.isEventKey(t,"Home")){t.preventDefault();t.stopPropagation();this.player_.currentTime(0)}else if(Da.isEventKey(t,"End")){t.preventDefault();t.stopPropagation();this.player_.currentTime(this.player_.duration())}else if(/^[0-9]$/.test(Da(t))){t.preventDefault();t.stopPropagation();var a=10*(Da.codes[Da(t)]-Da.codes[0])/100;this.player_.currentTime(this.player_.duration()*a)}else if(Da.isEventKey(t,"PgDn")){t.preventDefault();t.stopPropagation();this.player_.currentTime(this.player_.currentTime()-5*qi)}else if(Da.isEventKey(t,"PgUp")){t.preventDefault();t.stopPropagation();this.player_.currentTime(this.player_.currentTime()+5*qi)}else{e.prototype.handleKeyDown.call(this,t)}};return a}(Ni);Wi.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};if(!sa&&!la){Wi.prototype.options_.children.splice(1,0,"mouseTimeDisplay")}Zt.registerComponent("SeekBar",Wi);var zi=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.handleMouseMove=Mt(Ut(ie(r),r.handleMouseMove),Rt);r.throttledHandleMouseSeek=Mt(Ut(ie(r),r.handleMouseSeek),Rt);r.enable();return r}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})};a.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var a=t.getChild("mouseTimeDisplay"),r=t.el(),n=D(r),i=O(r,e).x;if(1i){i=0}if(a){a.update(n,i)}}};a.handleMouseSeek=function(e){var t=this.getChild("seekBar");if(t){t.handleMouseMove(e)}};a.enabled=function(){return this.enabled_};a.disable=function(){this.children().forEach(function(e){return e.disable&&e.disable()});if(!this.enabled()){return}this.off(["mousedown","touchstart"],this.handleMouseDown);this.off(this.el_,"mousemove",this.handleMouseMove);this.handleMouseUp();this.addClass("disabled");this.enabled_=!1};a.enable=function(){this.children().forEach(function(e){return e.enable&&e.enable()});if(this.enabled()){return}this.on(["mousedown","touchstart"],this.handleMouseDown);this.on(this.el_,"mousemove",this.handleMouseMove);this.removeClass("disabled");this.enabled_=!0};a.handleMouseDown=function(e){var t=this.el_.ownerDocument,a=this.getChild("seekBar");if(a){a.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)};a.handleMouseUp=function(e){var t=this.el_.ownerDocument,a=this.getChild("seekBar");if(a){a.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)};return t}(Zt);zi.prototype.options_={children:["seekBar"]};Zt.registerComponent("ProgressControl",zi);var Gi=function(e){te(a,e);function a(a,r){var n=e.call(this,a,r)||this;n.on(a,["enterpictureinpicture","leavepictureinpicture"],n.handlePictureInPictureChange);if(!t.pictureInPictureEnabled){n.disable()}return n}var r=a.prototype;r.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)};r.handlePictureInPictureChange=function(){if(this.player_.isInPictureInPicture()){this.controlText("Exit Picture-in-Picture")}else{this.controlText("Picture-in-Picture")}};r.handleClick=function(){if(!this.player_.isInPictureInPicture()){this.player_.requestPictureInPicture()}else{this.player_.exitPictureInPicture()}};return a}(Ci);Gi.prototype.controlText_="Picture-in-Picture";Zt.registerComponent("PictureInPictureToggle",Gi);var $i=function(e){te(a,e);function a(a,r){var n=e.call(this,a,r)||this;n.on(a,"fullscreenchange",n.handleFullscreenChange);if(!1===t[a.fsApi_.fullscreenEnabled]){n.disable()}return n}var r=a.prototype;r.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)};r.handleFullscreenChange=function(){if(this.player_.isFullscreen()){this.controlText("Non-Fullscreen")}else{this.controlText("Fullscreen")}};r.handleClick=function(){if(!this.player_.isFullscreen()){this.player_.requestFullscreen()}else{this.player_.exitFullscreen()}};return a}(Ci);$i.prototype.controlText_="Fullscreen";Zt.registerComponent("FullscreenToggle",$i);var Ki=function(e,t){if(t.tech_&&!t.tech_.featuresVolumeControl){e.addClass("vjs-hidden")}e.on(t,"loadstart",function(){if(!t.tech_.featuresVolumeControl){e.addClass("vjs-hidden")}else{e.removeClass("vjs-hidden")}})},Yi=function(e){te(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:""})};return t}(Zt);Zt.registerComponent("VolumeLevel",Yi);var Xi=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.on("slideractive",r.updateLastVolume_);r.on(t,"volumechange",r.updateARIAAttributes);t.ready(function(){return r.updateARIAAttributes()});return r}var a=t.prototype;a.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"})};a.handleMouseDown=function(t){if(!j(t)){return}e.prototype.handleMouseDown.call(this,t)};a.handleMouseMove=function(e){if(!j(e)){return}this.checkMuted();this.player_.volume(this.calculateDistance(e))};a.checkMuted=function(){if(this.player_.muted()){this.player_.muted(!1)}};a.getPercent=function(){if(this.player_.muted()){return 0}return this.player_.volume()};a.stepForward=function(){this.checkMuted();this.player_.volume(this.player_.volume()+.1)};a.stepBack=function(){this.checkMuted();this.player_.volume(this.player_.volume()-.1)};a.updateARIAAttributes=function(){var e=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",e);this.el_.setAttribute("aria-valuetext",e+"%")};a.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())};a.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",function(){if(0===e.player_.volume()){e.player_.lastVolume_(t)}})};return t}(Ni);Xi.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};Xi.prototype.playerEvent="volumechange";Zt.registerComponent("VolumeBar",Xi);var Qi=function(e){te(t,e);function t(t,a){var r;if(void 0===a){a={}}a.vertical=a.vertical||!1;if("undefined"==typeof a.volumeBar||l(a.volumeBar)){a.volumeBar=a.volumeBar||{};a.volumeBar.vertical=a.vertical}r=e.call(this,t,a)||this;Ki(ie(r),t);r.throttledHandleMouseMove=Mt(Ut(ie(r),r.handleMouseMove),Rt);r.on("mousedown",r.handleMouseDown);r.on("touchstart",r.handleMouseDown);r.on(r.volumeBar,["focus","slideractive"],function(){r.volumeBar.addClass("vjs-slider-active");r.addClass("vjs-slider-active");r.trigger("slideractive")});r.on(r.volumeBar,["blur","sliderinactive"],function(){r.volumeBar.removeClass("vjs-slider-active");r.removeClass("vjs-slider-active");r.trigger("sliderinactive")});return r}var a=t.prototype;a.createEl=function(){var t="vjs-volume-horizontal";if(this.options_.vertical){t="vjs-volume-vertical"}return e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})};a.handleMouseDown=function(){var e=this.el_.ownerDocument;this.on(e,"mousemove",this.throttledHandleMouseMove);this.on(e,"touchmove",this.throttledHandleMouseMove);this.on(e,"mouseup",this.handleMouseUp);this.on(e,"touchend",this.handleMouseUp)};a.handleMouseUp=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseMove);this.off(e,"touchmove",this.throttledHandleMouseMove);this.off(e,"mouseup",this.handleMouseUp);this.off(e,"touchend",this.handleMouseUp)};a.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)};return t}(Zt);Qi.prototype.options_={children:["volumeBar"]};Zt.registerComponent("VolumeControl",Qi);var Ji=function(e,t){if(t.tech_&&!t.tech_.featuresMuteControl){e.addClass("vjs-hidden")}e.on(t,"loadstart",function(){if(!t.tech_.featuresMuteControl){e.addClass("vjs-hidden")}else{e.removeClass("vjs-hidden")}})},Zi=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;Ji(ie(r),t);r.on(t,["loadstart","volumechange"],r.update);return r}var a=t.prototype;a.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)};a.handleClick=function(){var e=this.player_.volume(),t=this.player_.lastVolume_();if(0===e){var a=.1>t?.1:t;this.player_.volume(a);this.player_.muted(!1)}else{this.player_.muted(this.player_.muted()?!1:!0)}};a.update=function(){this.updateIcon_();this.updateControlText_()};a.updateIcon_=function(){var e=this.player_.volume(),t=3;if(sa&&this.player_.tech_&&this.player_.tech_.el_){this.player_.muted(this.player_.tech_.el_.muted)}if(0===e||this.player_.muted()){t=0}else if(.33>e){t=1}else if(.67>e){t=2}for(var a=0;4>a;a++){S(this.el_,"vjs-vol-"+a)}v(this.el_,"vjs-vol-"+t)};a.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume(),t=e?"Unmute":"Mute";if(this.controlText()!==t){this.controlText(t)}};return t}(Ci);Zi.prototype.controlText_="Mute";Zt.registerComponent("MuteToggle",Zi);var es=function(e){te(a,e);function a(t,a){var r;if(void 0===a){a={}}if("undefined"!=typeof a.inline){a.inline=a.inline}else{a.inline=!0}if("undefined"==typeof a.volumeControl||l(a.volumeControl)){a.volumeControl=a.volumeControl||{};a.volumeControl.vertical=!a.inline}r=e.call(this,t,a)||this;r.on(t,["loadstart"],r.volumePanelState_);r.on(r.muteToggle,"keyup",r.handleKeyPress);r.on(r.volumeControl,"keyup",r.handleVolumeControlKeyUp);r.on("keydown",r.handleKeyPress);r.on("mouseover",r.handleMouseOver);r.on("mouseout",r.handleMouseOut);r.on(r.volumeControl,["slideractive"],r.sliderActive_);r.on(r.volumeControl,["sliderinactive"],r.sliderInactive_);return r}var r=a.prototype;r.sliderActive_=function(){this.addClass("vjs-slider-active")};r.sliderInactive_=function(){this.removeClass("vjs-slider-active")};r.volumePanelState_=function(){if(this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")){this.addClass("vjs-hidden")}if(this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")){this.addClass("vjs-mute-toggle-only")}};r.createEl=function(){var t="vjs-volume-panel-horizontal";if(!this.options_.inline){t="vjs-volume-panel-vertical"}return e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})};r.dispose=function(){this.handleMouseOut();e.prototype.dispose.call(this)};r.handleVolumeControlKeyUp=function(e){if(Da.isEventKey(e,"Esc")){this.muteToggle.focus()}};r.handleMouseOver=function(){this.addClass("vjs-hover");G(t,"keyup",Ut(this,this.handleKeyPress))};r.handleMouseOut=function(){this.removeClass("vjs-hover");K(t,"keyup",Ut(this,this.handleKeyPress))};r.handleKeyPress=function(e){if(Da.isEventKey(e,"Esc")){this.handleMouseOut()}};return a}(Zt);es.prototype.options_={children:["muteToggle","volumeControl"]};Zt.registerComponent("VolumePanel",es);var ts=function(e){te(a,e);function a(t,a){var r=e.call(this,t,a)||this;if(a){r.menuButton_=a.menuButton}r.focusedChild_=-1;r.on("keydown",r.handleKeyDown);r.boundHandleBlur_=Ut(ie(r),r.handleBlur);r.boundHandleTapClick_=Ut(ie(r),r.handleTapClick);return r}var r=a.prototype;r.addEventListenerForItem=function(e){if(!(e instanceof Zt)){return}this.on(e,"blur",this.boundHandleBlur_);this.on(e,["tap","click"],this.boundHandleTapClick_)};r.removeEventListenerForItem=function(e){if(!(e instanceof Zt)){return}this.off(e,"blur",this.boundHandleBlur_);this.off(e,["tap","click"],this.boundHandleTapClick_)};r.removeChild=function(t){if("string"==typeof t){t=this.getChild(t)}this.removeEventListenerForItem(t);e.prototype.removeChild.call(this,t)};r.addItem=function(e){var t=this.addChild(e);if(t){this.addEventListenerForItem(t)}};r.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=_(t,{className:"vjs-menu-content"});this.contentEl_.setAttribute("role","menu");var a=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});a.appendChild(this.contentEl_);G(a,"click",function(e){e.preventDefault();e.stopImmediatePropagation()});return a};r.dispose=function(){this.contentEl_=null;this.boundHandleBlur_=null;this.boundHandleTapClick_=null;e.prototype.dispose.call(this)};r.handleBlur=function(e){var a=e.relatedTarget||t.activeElement;if(!this.children().some(function(e){return e.el()===a})){var r=this.menuButton_;if(r&&r.buttonPressed_&&a!==r.el().firstChild){r.unpressButton()}}};r.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t)){return}var a=t.filter(function(t){return t.el()===e.target})[0];if(!a){return}if("CaptionSettingsMenuItem"!==a.name()){this.menuButton_.focus()}}};r.handleKeyDown=function(e){if(Da.isEventKey(e,"Left")||Da.isEventKey(e,"Down")){e.preventDefault();e.stopPropagation();this.stepForward()}else if(Da.isEventKey(e,"Right")||Da.isEventKey(e,"Up")){e.preventDefault();e.stopPropagation();this.stepBack()}};r.stepForward=function(){var e=0;if(this.focusedChild_!==void 0){e=this.focusedChild_+1}this.focus(e)};r.stepBack=function(){var e=0;if(this.focusedChild_!==void 0){e=this.focusedChild_-1}this.focus(e)};r.focus=function(e){if(void 0===e){e=0}var t=this.children().slice(),a=t.length&&t[0].className&&/vjs-menu-title/.test(t[0].className);if(a){t.shift()}if(0e){e=0}else if(e>=t.length){e=t.length-1}this.focusedChild_=e;t[e].el_.focus()}};return a}(Zt);Zt.registerComponent("Menu",ts);var as=function(e){te(a,e);function a(a,r){var n;if(void 0===r){r={}}n=e.call(this,a,r)||this;n.menuButton_=new Ci(a,r);n.menuButton_.controlText(n.controlText_);n.menuButton_.el_.setAttribute("aria-haspopup","true");var i=Ci.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+i;n.menuButton_.removeClass("vjs-control");n.addChild(n.menuButton_);n.update();n.enabled_=!0;n.on(n.menuButton_,"tap",n.handleClick);n.on(n.menuButton_,"click",n.handleClick);n.on(n.menuButton_,"keydown",n.handleKeyDown);n.on(n.menuButton_,"mouseenter",function(){n.addClass("vjs-hover");n.menu.show();G(t,"keyup",Ut(ie(n),n.handleMenuKeyUp))});n.on("mouseleave",n.handleMouseLeave);n.on("keydown",n.handleSubmenuKeyDown);return n}var r=a.prototype;r.update=function(){var e=this.createMenu();if(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");if(this.items&&this.items.length<=this.hideThreshold_){this.hide()}else{this.show()}};r.createMenu=function(){var e=new ts(this.player_,{menuButton:this});this.hideThreshold_=0;if(this.options_.title){var t=_("li",{className:"vjs-menu-title",innerHTML:Qt(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;var a=new Zt(this.player_,{el:t});e.addItem(a)}this.items=this.createItems();if(this.items){for(var r=0;r=r.items.length){r.hide()}if(!n){return ie(r)}var i=Ut(ie(r),r.update);n.addEventListener("removetrack",i);n.addEventListener("addtrack",i);r.player_.on("ready",i);r.player_.on("dispose",function(){n.removeEventListener("removetrack",i);n.removeEventListener("addtrack",i)});return r}return t}(as);Zt.registerComponent("TrackButton",rs);var ns=["Tab","Esc","Up","Down","Right","Left"],is=function(e){te(t,e);function t(t,a){var r=e.call(this,t,a)||this;r.selectable=a.selectable;r.isSelected_=a.selected||!1;r.multiSelectable=a.multiSelectable;r.selected(r.isSelected_);if(r.selectable){if(r.multiSelectable){r.el_.setAttribute("role","menuitemcheckbox")}else{r.el_.setAttribute("role","menuitemradio")}}else{r.el_.setAttribute("role","menuitem")}return r}var a=t.prototype;a.createEl=function(t,a,r){this.nonIconControl=!0;return e.prototype.createEl.call(this,"li",s({className:"vjs-menu-item",innerHTML:""+this.localize(this.options_.label)+"",tabIndex:-1},a),r)};a.handleKeyDown=function(t){if(!ns.some(function(e){return Da.isEventKey(t,e)})){e.prototype.handleKeyDown.call(this,t)}};a.handleClick=function(){this.selected(!0)};a.selected=function(e){if(this.selectable){if(e){this.addClass("vjs-selected");this.el_.setAttribute("aria-checked","true");this.controlText(", selected");this.isSelected_=!0}else{this.removeClass("vjs-selected");this.el_.setAttribute("aria-checked","false");this.controlText("");this.isSelected_=!1}}};return t}(fi);Zt.registerComponent("MenuItem",is);var ss=function(a){te(r,a);function r(r,n){var i,s=n.track,o=r.textTracks();n.label=s.label||s.language||"Unknown";n.selected="showing"===s.mode;i=a.call(this,r,n)||this;i.track=s;i.kinds=(n.kinds||[n.kind||i.track.kind]).filter(Boolean);var l=function(){for(var e=arguments.length,t=Array(e),a=0;a"+this.localize(this.options_.label);if("captions"===this.options_.track.kind){n+="\n \n "+this.localize("Captions")+"\n "}n+="";var i=e.prototype.createEl.call(this,t,s({innerHTML:n},a),r);return i};return t}(ss);Zt.registerComponent("SubsCapsMenuItem",ys);var hs=function(e){te(t,e);function t(t,a){var r;if(void 0===a){a={}}r=e.call(this,t,a)||this;r.label_="subtitles";if(-1<["en","en-us","en-ca","fr-ca"].indexOf(r.player_.language_)){r.label_="captions"}r.menuButton_.controlText(Qt(r.label_));return r}var a=t.prototype;a.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)};a.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)};a.createItems=function(){var t=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")){t.push(new ms(this.player_,{kind:this.label_}));this.hideThreshold_+=1}t=e.prototype.createItems.call(this,t,ys);return t};return t}(ls);hs.prototype.kinds_=["captions","subtitles"];hs.prototype.controlText_="Subtitles";Zt.registerComponent("SubsCapsButton",hs);var _s=function(e){te(t,e);function t(t,a){var r,n=a.track,i=t.audioTracks();a.label=n.label||n.language||"Unknown";a.selected=n.enabled;r=e.call(this,t,a)||this;r.track=n;r.addClass("vjs-"+n.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=Array(e),a=0;a"+this.localize(this.options_.label);if("main-desc"===this.options_.track.kind){n+="\n \n "+this.localize("Descriptions")+"\n "}n+="";var i=e.prototype.createEl.call(this,t,s({innerHTML:n},a),r);return i};a.handleClick=function(t){var a=this.player_.audioTracks();e.prototype.handleClick.call(this,t);for(var r=0,n;re){a=t[r];break}}this.player().playbackRate(a)};a.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates};a.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0 select",id:"captions-background-color-%s",label:"Color",options:[Es,Ds,As,Ls,Ps,ws,xs,Is]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Os,Rs,Us]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Ds,Es,As,Ls,Ps,ws,xs,Is]},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:+e}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Os,Rs]},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:[Us,Rs,Os]}};Ms.windowColor.options=Ms.backgroundColor.options;function at(e,t){if(t){e=t(e)}if(e&&"none"!==e){return e}}function rt(e,t){var a=e.options[e.options.selectedIndex].value;return at(a,t)}function nt(e,t,a){if(!t){return}for(var r=0;r",this.localize(n.label),"","").join("")};i.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return["
","",this.localize("Text"),"",this.createElSelect_("color",e),"",this.createElSelect_("textOpacity",e),"","
"].join("")};i.createElBgColor_=function(){var e="captions-background-"+this.id_;return["
","",this.localize("Background"),"",this.createElSelect_("backgroundColor",e),"",this.createElSelect_("backgroundOpacity",e),"","
"].join("")};i.createElWinColor_=function(){var e="captions-window-"+this.id_;return["
","",this.localize("Window"),"",this.createElSelect_("windowColor",e),"",this.createElSelect_("windowOpacity",e),"","
"].join("")};i.createElColors_=function(){return _("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})};i.createElFont_=function(){return _("div",{className:"vjs-track-settings-font",innerHTML:["
",this.createElSelect_("fontPercent","","legend"),"
","
",this.createElSelect_("edgeStyle","","legend"),"
","
",this.createElSelect_("fontFamily","","legend"),"
"].join("")})};i.createElControls_=function(){var e=this.localize("restore all settings to the default values");return _("div",{className:"vjs-track-settings-controls",innerHTML:["",""].join("")})};i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]};i.label=function(){return this.localize("Caption Settings Dialog")};i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")};i.buildCSSClass=function(){return t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"};i.getValues=function(){var e=this;return n(Ms,function(t,a,r){var n=rt(e.$(a.selector),a.parser);if(n!==void 0){t[r]=n}return t},{})};i.setValues=function(e){var t=this;r(Ms,function(a,r){nt(t.$(a.selector),e[r],a.parser)})};i.setDefaults=function(){var e=this;r(Ms,function(t){var a=t.hasOwnProperty("default")?t["default"]:0;e.$(t.selector).selectedIndex=a})};i.restoreSettings=function(){var t;try{t=JSON.parse(e.localStorage.getItem("vjs-text-track-settings"))}catch(e){ft.warn(e)}if(t){this.setValues(t)}};i.saveSettings=function(){if(!this.options_.persistTextTrackSettings){return}var t=this.getValues();try{if(Object.keys(t).length){e.localStorage.setItem("vjs-text-track-settings",JSON.stringify(t))}else{e.localStorage.removeItem("vjs-text-track-settings")}}catch(e){ft.warn(e)}};i.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");if(e){e.updateDisplay()}};i.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,a=e&&e.captionsButton;if(t){t.focus()}else if(a){a.focus()}};return a}(Ba);Zt.registerComponent("TextTrackSettings",Ns);var Bs=function(t){te(a,t);function a(a,r){var n,i=r.ResizeObserver||e.ResizeObserver;if(null===r.ResizeObserver){i=!1}var s=ee({createEl:!i,reportTouchActivity:!1},r);n=t.call(this,a,s)||this;n.ResizeObserver=r.ResizeObserver||e.ResizeObserver;n.loadListener_=null;n.resizeObserver_=null;n.debouncedHandler_=Nt(function(){n.resizeHandler()},100,!1,ie(n));if(i){n.resizeObserver_=new n.ResizeObserver(n.debouncedHandler_);n.resizeObserver_.observe(a.el())}else{n.loadListener_=function(){if(!n.el_||!n.el_.contentWindow){return}var e=n.debouncedHandler_,t=n.unloadListener_=function(){K(this,"resize",e);K(this,"unload",t);t=null};G(n.el_.contentWindow,"unload",t);G(n.el_.contentWindow,"resize",e)};n.one("load",n.loadListener_)}return n}var r=a.prototype;r.createEl=function(){return t.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})};r.resizeHandler=function(){if(!this.player_||!this.player_.trigger){return}this.player_.trigger("playerresize")};r.dispose=function(){if(this.debouncedHandler_){this.debouncedHandler_.cancel()}if(this.resizeObserver_){if(this.player_.el()){this.resizeObserver_.unobserve(this.player_.el())}this.resizeObserver_.disconnect()}if(this.loadListener_){this.off("load",this.loadListener_)}if(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)};return a}(Zt);Zt.registerComponent("ResizeManager",Bs);var js=function(e){var t=Math.floor(e.length/2),a=[].concat(e).sort(function(e,t){return e-t});return 0!=e.length%2?a[t]:(a[t-1]+a[t])/2},Fs=function(e){te(a,e);function a(a,r){var n,i=ee({createEl:!1},r);n=e.call(this,a,i)||this;n.reset_();n.on(n.player_,"durationchange",n.handleDurationchange);if(ya&&"hidden"in t&&"visibilityState"in t){n.on(t,"visibilitychange",n.handleVisibilityChange)}return n}var r=a.prototype;r.handleVisibilityChange=function(){if(this.player_.duration()!==1/0){return}if(t.hidden){this.stopTracking()}else{this.startTracking()}};r.isBehind_=function(){if(!this.timeupdateSeen_){return!1}var e=this.liveCurrentTime(),t=this.player_.currentTime(),a=2*this.seekableIncrement_+.07;return e!==1/0&&e-a>=t};r.trackLive_=function(){this.pastSeekEnd_=this.pastSeekEnd_;var e=this.player_.seekable();if(!e||!e.length){return}var t=this.seekableEnd();if(t!==this.lastSeekEnd_){if(this.lastSeekEnd_){this.seekableIncrementList_=this.seekableIncrementList_.slice(-11);this.seekableIncrementList_.push(Math.abs(t-this.lastSeekEnd_));if(3ga){return!1}try{var e=Ys.TEST_VID.playbackRate;Ys.TEST_VID.playbackRate=e/2+.1;return e!==Ys.TEST_VID.playbackRate}catch(t){return!1}};Ys.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(t){return!1}return!0};Ys.supportsNativeTextTracks=function(){return _a||sa&&ma};Ys.supportsNativeVideoTracks=function(){return!!(Ys.TEST_VID&&Ys.TEST_VID.videoTracks)};Ys.supportsNativeAudioTracks=function(){return!!(Ys.TEST_VID&&Ys.TEST_VID.audioTracks)};Ys.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];Ys.prototype.featuresVolumeControl=Ys.canControlVolume();Ys.prototype.featuresMuteControl=Ys.canMuteVolume();Ys.prototype.featuresPlaybackRate=Ys.canControlPlaybackRate();Ys.prototype.featuresSourceset=Ys.canOverrideAttributes();Ys.prototype.movingMediaElementInDOM=!sa;Ys.prototype.featuresFullscreenResize=!0;Ys.prototype.featuresProgressEvents=!0;Ys.prototype.featuresTimeupdateEvents=!0;Ys.prototype.featuresNativeTextTracks=Ys.supportsNativeTextTracks();Ys.prototype.featuresNativeVideoTracks=Ys.supportsNativeVideoTracks();Ys.prototype.featuresNativeAudioTracks=Ys.supportsNativeAudioTracks();var Qs=Ys.TEST_VID&&Ys.TEST_VID.constructor.prototype.canPlayType,Js=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;Ys.patchCanPlayType=function(){if(4<=da&&!ua&&!ma){Ys.TEST_VID.constructor.prototype.canPlayType=function(e){if(e&&Js.test(e)){return"maybe"}return Qs.call(this,e)}}};Ys.unpatchCanPlayType=function(){var e=Ys.TEST_VID.constructor.prototype.canPlayType;Ys.TEST_VID.constructor.prototype.canPlayType=Qs;return e};Ys.patchCanPlayType();Ys.disposeMediaElement=function(e){if(!e){return}if(e.parentNode){e.parentNode.removeChild(e)}while(e.hasChildNodes()){e.removeChild(e.firstChild)}e.removeAttribute("src");if("function"==typeof e.load){(function(){try{e.load()}catch(t){}})()}};Ys.resetMediaElement=function(e){if(!e){return}var t=e.querySelectorAll("source"),a=t.length;while(a--){e.removeChild(t[a])}e.removeAttribute("src");if("function"==typeof e.load){(function(){try{e.load()}catch(t){}})()}};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){Ys.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){Ys.prototype["set"+Qt(e)]=function(t){this.el_[e]=t;if(t){this.el_.setAttribute(e,e)}else{this.el_.removeAttribute(e)}}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(e){Ys.prototype[e]=function(){return this.el_[e]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach(function(e){Ys.prototype["set"+Qt(e)]=function(t){this.el_[e]=t}});["pause","load","play"].forEach(function(e){Ys.prototype[e]=function(){return this.el_[e]()}});ii.withSourceHandlers(Ys);Ys.nativeSourceHandler={};Ys.nativeSourceHandler.canPlayType=function(e){try{return Ys.TEST_VID.canPlayType(e)}catch(t){return""}};Ys.nativeSourceHandler.canHandleSource=function(e){if(e.type){return Ys.nativeSourceHandler.canPlayType(e.type)}else if(e.src){var t=tr(e.src);return Ys.nativeSourceHandler.canPlayType("video/"+t)}return""};Ys.nativeSourceHandler.handleSource=function(e,t){t.setSrc(e.src)};Ys.nativeSourceHandler.dispose=function(){};Ys.registerSourceHandler(Ys.nativeSourceHandler);ii.registerTech("Html5",Ys);var Zs=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],eo={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},to=["tiny","xsmall","small","medium","large","xlarge","huge"],ao={};to.forEach(function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;ao[e]="vjs-layout-"+t});var ro={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},no=function(a){te(r,a);function r(e,t,n){var i;e.id=e.id||t.id||"vjs_video_"+q();t=s(r.getTagSettings(e),t);t.initChildren=!1;t.createEl=!1;t.evented=!1;t.reportTouchActivity=!1;if(!t.language){if("function"==typeof e.closest){var o=e.closest("[lang]");if(o&&o.getAttribute){t.language=o.getAttribute("lang")}}else{var l=e;while(l&&1===l.nodeType){if(E(l).hasOwnProperty("lang")){t.language=l.getAttribute("lang");break}l=l.parentNode}}}i=a.call(this,null,t,n)||this;i.boundDocumentFullscreenChange_=Ut(ie(i),i.documentFullscreenChange_);i.boundFullWindowOnEscKey_=Ut(ie(i),i.fullWindowOnEscKey);i.log=bt(i.id_);i.fsApi_=va;i.isPosterFromTech_=!1;i.queuedCallbacks_=[];i.isReady_=!1;i.hasStarted_=!1;i.userActive_=!1;if(!i.options_||!i.options_.techOrder||!i.options_.techOrder.length){throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?")}i.tag=e;i.tagAttributes=e&&E(e);i.language(i.options_.language);if(t.languages){var d={};Object.getOwnPropertyNames(t.languages).forEach(function(e){d[e.toLowerCase()]=t.languages[e]});i.languages_=d}else{i.languages_=r.prototype.options_.languages}i.resetCache_();i.poster_=t.poster||"";i.controls_=!!t.controls;e.controls=!1;e.removeAttribute("controls");i.changingSrc_=!1;i.playCallbacks_=[];i.playTerminatedQueue_=[];if(e.hasAttribute("autoplay")){i.autoplay(!0)}else{i.autoplay(i.options_.autoplay)}if(t.plugins){Object.keys(t.plugins).forEach(function(e){if("function"!=typeof i[e]){throw new Error("plugin \""+e+"\" does not exist")}})}i.scrubbing_=!1;i.el_=i.createEl();J(ie(i),{eventBusKey:"el_"});if(i.fluid_){i.on("playerreset",i.updateStyleEl_)}var p=ee(i.options_);if(t.plugins){Object.keys(t.plugins).forEach(function(e){i[e](t.plugins[e])})}i.options_.playerOptions=p;i.middleware_=[];i.initChildren();i.isAudio("audio"===e.nodeName.toLowerCase());if(i.controls()){i.addClass("vjs-controls-enabled")}else{i.addClass("vjs-controls-disabled")}i.el_.setAttribute("role","region");if(i.isAudio()){i.el_.setAttribute("aria-label",i.localize("Audio Player"))}else{i.el_.setAttribute("aria-label",i.localize("Video Player"))}if(i.isAudio()){i.addClass("vjs-audio")}if(i.flexNotSupported_()){i.addClass("vjs-no-flex")}if(ba){i.addClass("vjs-touch-enabled")}if(!sa){i.addClass("vjs-workinghover")}r.players[i.id_]=ie(i);var u="7.6.5".split(".")[0];i.addClass("vjs-v"+u);i.userActive(!0);i.reportUserActivity();i.one("play",i.listenForUserActivity_);i.on("stageclick",i.handleStageClick_);i.on("keydown",i.handleKeyDown);i.breakpoints(i.options_.breakpoints);i.responsive(i.options_.responsive);return i}var n=r.prototype;n.dispose=function(){var e=this;this.trigger("dispose");this.off("dispose");K(t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_);K(t,"keydown",this.boundFullWindowOnEscKey_);if(this.styleEl_&&this.styleEl_.parentNode){this.styleEl_.parentNode.removeChild(this.styleEl_);this.styleEl_=null}r.players[this.id_]=null;if(this.tag&&this.tag.player){this.tag.player=null}if(this.el_&&this.el_.player){this.el_.player=null}if(this.tech_){this.tech_.dispose();this.isPosterFromTech_=!1;this.poster_=""}if(this.playerElIngest_){this.playerElIngest_=null}if(this.tag){this.tag=null}Ye(this);Wn.names.forEach(function(t){var a=Wn[t],r=e[a.getterName]();if(r&&r.off){r.off()}});a.prototype.dispose.call(this)};n.createEl=function(){var r=this.tag,n,s=this.playerElIngest_=r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player"),o="video-js"===this.tag.tagName.toLowerCase();if(s){n=this.el_=r.parentNode}else if(!o){n=this.el_=a.prototype.createEl.call(this,"div")}var l=E(r);if(o){n=this.el_=r;r=this.tag=t.createElement("video");while(n.children.length){r.appendChild(n.firstChild)}if(!T(n,"video-js")){v(n,"video-js")}n.appendChild(r);s=this.playerElIngest_=n;Object.keys(n).forEach(function(e){r[e]=n[e]})}r.setAttribute("tabindex","-1");l.tabindex="-1";if(ya||ma&&fa){r.setAttribute("role","application");l.role="application"}r.removeAttribute("width");r.removeAttribute("height");if("width"in l){delete l.width}if("height"in l){delete l.height}Object.getOwnPropertyNames(l).forEach(function(e){if(!(o&&"class"===e)){n.setAttribute(e,l[e])}if(o){r.setAttribute(e,l[e])}});r.playerId=r.id;r.id+="_html5_api";r.className="vjs-tech";r.player=n.player=this;this.addClass("vjs-paused");if(!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=It("vjs-styles-dimensions");var d=St(".vjs-styles-defaults"),p=St("head");p.insertBefore(this.styleEl_,d?d.nextSibling:p.firstChild)}this.fill_=!1;this.fluid_=!1;this.width(this.options_.width);this.height(this.options_.height);this.fill(this.options_.fill);this.fluid(this.options_.fluid);this.aspectRatio(this.options_.aspectRatio);for(var u=r.getElementsByTagName("a"),c=0,m;ce){e=0}this.techCall_("setCurrentTime",e);return}this.cache_.currentTime=this.techGet_("currentTime")||0;return this.cache_.currentTime};n.duration=function(e){if(e===void 0){return this.cache_.duration!==void 0?this.cache_.duration:NaN}e=parseFloat(e);if(0>e){e=1/0}if(e!==this.cache_.duration){this.cache_.duration=e;if(e===1/0){this.addClass("vjs-live");if(this.options_.liveui&&this.player_.liveTracker){this.addClass("vjs-liveui")}}else{this.removeClass("vjs-live");this.removeClass("vjs-liveui")}if(!isNaN(e)){this.trigger("durationchange")}}};n.remainingTime=function(){return this.duration()-this.currentTime()};n.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())};n.buffered=function e(){var e=this.techGet_("buffered");if(!e||!e.length){e=de(0,0)}return e};n.bufferedPercent=function(){return pe(this.buffered(),this.duration())};n.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),a=e.end(e.length-1);if(a>t){a=t}return a};n.volume=function(e){var t;if(e!==void 0){t=Math.max(0,Math.min(1,parseFloat(e)));this.cache_.volume=t;this.techCall_("setVolume",t);if(0=e){return}l=this.setTimeout(function(){if(!this.userActivity_){this.userActive(!1)}},e)},250)};n.playbackRate=function(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}if(this.tech_&&this.tech_.featuresPlaybackRate){return this.cache_.lastPlaybackRate||this.techGet_("playbackRate")}return 1};n.defaultPlaybackRate=function(e){if(e!==void 0){return this.techCall_("setDefaultPlaybackRate",e)}if(this.tech_&&this.tech_.featuresPlaybackRate){return this.techGet_("defaultPlaybackRate")}return 1};n.isAudio=function(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_};n.addTextTrack=function(e,t,a){if(this.tech_){return this.tech_.addTextTrack(e,t,a)}};n.addRemoteTextTrack=function(e,t){if(this.tech_){return this.tech_.addRemoteTextTrack(e,t)}};n.removeRemoteTextTrack=function(e){if(void 0===e){e={}}var t=e,a=t.track;if(!a){a=e}if(this.tech_){return this.tech_.removeRemoteTextTrack(a)}};n.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")};n.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0};n.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0};n.language=function(e){if(e===void 0){return this.language_}this.language_=(e+"").toLowerCase()};n.languages=function(){return ee(r.prototype.options_.languages,this.languages_)};n.toJSON=function(){var e=ee(this.options_),t=e.tracks;e.tracks=[];for(var a=0,r;a=a){return!1}it.hooks_[e]=it.hooks_[e].slice();it.hooks_[e].splice(a,1);return!0};if(!0!==e.VIDEOJS_NO_DYNAMIC_STYLE&&m()){var bo=St(".vjs-styles-defaults");if(!bo){bo=It("vjs-styles-defaults");var To=St("head");if(To){To.insertBefore(bo,To.firstChild)}Lt(bo,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}F(1,it);it.VERSION="7.6.5";it.options=no.prototype.options_;it.getPlayers=function(){return no.players};it.getPlayer=function(e){var t=no.players,a;if("string"==typeof e){var r=fo(e),n=t[r];if(n){return n}a=St("#"+r)}else{a=e}if(g(a)){var i=a,s=i.player,o=i.playerId;if(s||t[o]){return s||t[o]}}};it.getAllPlayers=function(){return Object.keys(no.players).map(function(e){return no.players[e]}).filter(Boolean)};it.players=no.players;it.getComponent=Zt.getComponent;it.registerComponent=function(e,t){if(ii.isTech(t)){ft.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)")}Zt.registerComponent.call(Zt,e,t)};it.getTech=ii.getTech;it.registerTech=ii.registerTech;it.use=function(e,t){si[e]=si[e]||[];si[e].push(t)};Object.defineProperty(it,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(it.middleware,"TERMINATOR",{value:li,writeable:!1,enumerable:!0});it.browser=Ta;it.TOUCH_ENABLED=ba;it.extend=_o;it.mergeOptions=ee;it.bind=Ut;it.registerPlugin=yo.registerPlugin;it.deregisterPlugin=yo.deregisterPlugin;it.plugin=function(e,t){ft.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead");return yo.registerPlugin(e,t)};it.getPlugins=yo.getPlugins;it.getPlugin=yo.getPlugin;it.getPluginVersion=yo.getPluginVersion;it.addLanguage=function(e,t){var a;e=(""+e).toLowerCase();it.options.languages=ee(it.options.languages,(a={},a[e]=t,a));return it.options.languages[e]};it.log=ft;it.createLogger=bt;it.createTimeRange=it.createTimeRanges=de;it.formatTime=tt;it.setFormatTime=function(e){xi=e};it.resetFormatTime=function(){xi=Li};it.parseUrl=Za;it.isCrossOrigin=ar;it.EventTarget=Bt;it.on=G;it.one=X;it.off=K;it.trigger=Y;it.xhr=On;it.TextTrack=Mn;it.AudioTrack=Nn;it.VideoTrack=Bn;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(e){it[e]=function(){ft.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead");return kt[e].apply(null,arguments)}});it.computedStyle=d;it.dom=kt;it.url=rr;var vo=ge(function(e){(function(){var t=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,a=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,i={buildAbsoluteURL:function(e,t,r){r=r||{};e=e.trim();t=t.trim();if(!t){if(!r.alwaysNormalize){return e}var n=i.parseURL(e);if(!n){throw new Error("Error trying to parse base URL.")}n.path=i.normalizePath(n.path);return i.buildURLFromParts(n)}var s=i.parseURL(t);if(!s){throw new Error("Error trying to parse relative URL.")}if(s.scheme){if(!r.alwaysNormalize){return t}s.path=i.normalizePath(s.path);return i.buildURLFromParts(s)}var o=i.parseURL(e);if(!o){throw new Error("Error trying to parse base URL.")}if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=a.exec(o.path);o.netLoc=l[1];o.path=l[2]}if(o.netLoc&&!o.path){o.path="/"}var d={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc){d.netLoc=o.netLoc;if("/"!==s.path[0]){if(!s.path){d.path=o.path;if(!s.params){d.params=o.params;if(!s.query){d.query=o.query}}}else{var p=o.path,u=p.substring(0,p.lastIndexOf("/")+1)+s.path;d.path=i.normalizePath(u)}}}if(null===d.path){d.path=r.alwaysNormalize?i.normalizePath(s.path):s.path}return i.buildURLFromParts(d)},parseURL:function(e){var a=t.exec(e);if(!a){return null}return{scheme:a[1]||"",netLoc:a[2]||"",path:a[3]||"",params:a[4]||"",query:a[5]||"",fragment:a[6]||""}},normalizePath:function(e){e=e.split("").reverse().join("").replace(r,"");while(e.length!==(e=e.replace(n,"")).length){}return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=i})()});function st(){st=Object.assign||function(e){for(var t=1,a;te.duration){this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration});return}this.manifest.targetDuration=e.duration},totalduration:function(){if(!isFinite(e.duration)||0>e.duration){this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration});return}this.manifest.totalDuration=e.duration},start:function(){if(!e.attributes||isNaN(e.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}},"cue-out":function(){n.cueOut=e.data},"cue-out-cont":function(){n.cueOutCont=e.data},"cue-in":function(){n.cueIn=e.data}})[e.tagType]||o).call(a)},uri:function(){n.uri=e.uri;r.push(n);if(this.manifest.targetDuration&&!("duration"in n)){this.trigger("warn",{message:"defaulting segment duration to the target duration"});n.duration=this.manifest.targetDuration}if(s){n.key=s}n.timeline=d;if(i){n.map=i}n={}},comment:function(){},custom:function(){if(e.segment){n.custom=n.custom||{};n.custom[e.customType]=e.data}else{this.manifest.custom=this.manifest.custom||{};this.manifest.custom[e.customType]=e.data}}})[e.type].call(a)});return t}var a=t.prototype;a.push=function(e){this.lineStream.push(e)};a.end=function(){this.lineStream.push("\n")};a.addParser=function(e){this.parseStream.addParser(e)};a.addTagMapper=function(e){this.parseStream.addTagMapper(e)};return t}(So),Lo=function(e){return!!e&&"object"===_typeof(e)},xo=function e(){for(var t=arguments.length,a=Array(t),r=0;ra.attributes.bandwidth){return e}e[s]={language:i,autoselect:!0,default:"main"===n,playlists:Go([$o(a)],t),uri:""};if("undefined"==typeof r&&"main"===n){r=a;r["default"]=!0}return e},{});if(!r){var i=Object.keys(n)[0];n[i]["default"]=!0}return n},Xo=function(e,t){if(void 0===t){t={}}return e.reduce(function(e,a){var r=a.attributes.lang||"text";if(e[r]){return e}e[r]={language:r,default:!1,autoselect:!1,playlists:Go([Ko(a)],t),uri:""};return e},{})},Qo=function(e){var t,a=e.attributes,r=e.segments,n=e.sidx,i={attributes:(t={NAME:a.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:a.width,height:a.height},CODECS:a.codecs,BANDWIDTH:a.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(a.type||"static"),timeline:a.periodIndex,resolvedUri:"",targetDuration:a.duration,segments:r,mediaSequence:r.length?r[0].number:1};if(a.contentProtection){i.contentProtection=a.contentProtection}if(n){i.sidx=n}return i},Jo=function(e,t){var a;if(void 0===t){t={}}if(!e.length){return{}}var r=e[0].attributes,n=r.sourceDuration,i=r.minimumUpdatePeriod,s=void 0===i?0:i,o=zo(e.filter(function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType})).map(Qo),l=zo(e.filter(function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType})),d=e.filter(function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType}),p={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(a={AUDIO:{},VIDEO:{}},a["CLOSED-CAPTIONS"]={},a.SUBTITLES={},a),uri:"",duration:n,playlists:Go(o,t),minimumUpdatePeriod:1e3*s};if(l.length){p.mediaGroups.AUDIO.audio=Yo(l,t)}if(d.length){p.mediaGroups.SUBTITLES.subs=Xo(d,t)}return p},Zo=function(e,t,a){var r=e.NOW,n=e.clientOffset,i=e.availabilityStartTime,s=e.timescale,o=void 0===s?1:s,l=e.start,d=void 0===l?0:l,p=e.minimumUpdatePeriod,u=void 0===p?0:p;return Math.ceil((((r+n)/1e3+u-(i+d))*o-t)/a)},el=function(e,t){for(var a=e.type,r=void 0===a?"static":a,n=e.minimumUpdatePeriod,i=void 0===n?0:n,s=e.media,o=void 0===s?"":s,l=e.sourceDuration,d=e.timescale,p=void 0===d?1:d,u=e.startNumber,c=void 0===u?1:u,m=e.periodIndex,g=[],y=-1,h=0;hy){y=T}if(T&&T>y){y=T}var v=void 0;if(0>b){var S=h+1;if(S===t.length){if("dynamic"===r&&0=n){return i}return""+Array(n-i.length+1).join("0")+i}},rl=function(e,t){return e.replace(tl,al(t))},nl=function(e,t){if(!e.duration&&!t){return[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}if(e.duration){return qo(e)}return el(e,t)},il=function(e,t){var a={RepresentationID:e.id,Bandwidth:e.bandwidth||0},r=e.initialization,n=void 0===r?{sourceURL:"",range:""}:r,i=Bo({baseUrl:e.baseUrl,source:rl(n.sourceURL,a),range:n.range}),s=nl(e,t);return s.map(function(t){a.Number=t.number;a.Time=t.time;var r=rl(e.media||"",a);return{uri:r,timeline:t.timeline,duration:t.duration,resolvedUri:No(e.baseUrl||"",r),map:i,number:t.number}})},sl=function(e,t){var a=e.baseUrl,r=e.initialization,n=void 0===r?{}:r,i=Bo({baseUrl:a,source:n.sourceURL,range:n.range}),s=Bo({baseUrl:a,source:t.media,range:t.mediaRange});s.map=i;return s},ol=function(e,t){var a=e.duration,r=e.segmentUrls,n=void 0===r?[]:r;if(!a&&!t||a&&t){throw new Error(Uo.SEGMENT_TIME_UNSPECIFIED)}var i=n.map(function(t){return sl(e,t)}),s;if(a){s=qo(e)}if(t){s=el(e,t)}var o=s.map(function(e,t){if(i[t]){var a=i[t];a.timeline=e.timeline;a.duration=e.duration;a.number=e.number;return a}}).filter(function(e){return e});return o},ll=function(e){var t=e.attributes,a=e.segmentInfo,r,n;if(a.template){n=il;r=xo(t,a.template)}else if(a.base){n=Vo;r=xo(t,a.base)}else if(a.list){n=ol;r=xo(t,a.list)}var i={attributes:t};if(!n){return i}var s=n(r,a.timeline);if(r.duration){var o=r,l=o.duration,d=o.timescale,p=void 0===d?1:d;r.duration=l/p}else if(s.length){r.duration=s.reduce(function(e,t){return Math.max(e,Math.ceil(t.duration))},0)}else{r.duration=0}i.attributes=r;i.segments=s;if(a.base&&r.indexRange){i.sidx=s[0];i.segments=[]}return i},dl=function(e){return e.map(ll)},pl=function(e,t){return Oo(e.childNodes).filter(function(e){var a=e.tagName;return a===t})},ul=function(e){return e.textContent.trim()},cl=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/,a=t.exec(e);if(!a){return 0}var r=a.slice(1),n=r[0],i=r[1],s=r[2],o=r[3],l=r[4],d=r[5];return parseFloat(n||0)*31536000+parseFloat(i||0)*2592000+parseFloat(s||0)*86400+parseFloat(o||0)*3600+parseFloat(l||0)*60+parseFloat(d||0)},ml=function(e){var t=/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;if(t.test(e)){e+="Z"}return Date.parse(e)},gl={mediaPresentationDuration:function(e){return cl(e)},availabilityStartTime:function(e){return ml(e)/1e3},minimumUpdatePeriod:function(e){return cl(e)},timeShiftBufferDepth:function(e){return cl(e)},start:function(e){return cl(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);if(isNaN(t)){return cl(e)}return 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}},yl=function(e){if(!(e&&e.attributes)){return{}}return Oo(e.attributes).reduce(function(t,a){var e=gl[a.name]||gl.DEFAULT;t[a.name]=e(a.value);return t},{})};function pt(t){for(var a=e.atob(t),r=new Uint8Array(a.length),n=0;n>>0},toHexString:function(e){return("00"+e.toString(16)).slice(-2)}},xl=Ll.toUnsigned,Al=Ll.toHexString,Dl,wl,Ol,Rl,Ul,Ml;Dl=function(e,t){var a=[],r,n,s,o,l;if(!t.length){return null}for(r=0;r>>2).replace(/^0/,"")}else{t.codec="mp4a.40.2"}}}}var c=Dl(e,["mdia","mdhd"])[0];if(c&&r){20;t.timescale=xl(c[20]<<24|c[21]<<16|c[22]<<8|c[23])}a.push(t)});return a};var Nl={findBox:Dl,parseType:wl,timescale:Ol,startTime:Rl,videoTrackIds:Ul,tracks:Ml},Bl,jl,Fl=Nl.parseType,Hl=function(e){return new Date(1e3*e-20828448e5)},ql=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]}},Vl=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=[],r,n;for(r=0;r+4=n){a.push("MALFORMED DATA");continue}switch(31&e[r]){case 1:a.push("slice_layer_without_partitioning_rbsp");break;case 5:a.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:a.push("sei_rbsp");break;case 7:a.push("seq_parameter_set_rbsp");break;case 8:a.push("pic_parameter_set_rbsp");break;case 9:a.push("access_unit_delimiter_rbsp");break;default:a.push(31&"UNKNOWN NAL - "+e[r]);break;}}return a},Wl={avc1:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:Bl(e.subarray(78,e.byteLength))}},avcC:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},r=31&e[5],n,s,o,l;o=6;for(l=0;l>>2,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:31&e[26]>>>3,samplingFrequencyIndex:(7&e[26])<<1|1&e[27]>>>7,channelConfiguration:15&e[27]>>>3}}}},ftyp:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={majorBrand:Fl(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},r=8;while(r>10)+96);n.language+=String.fromCharCode(((992&r)>>5)+96);n.language+=String.fromCharCode((31&r)+96);return n},mdia:function(e){return{boxes:Bl(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:Bl(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};if(28>4,isDependedOn:(12&e[a])>>2,hasRedundancy:3&e[a]})}return t},sidx:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8),earliestPresentationTime:t.getUint32(12),firstOffset:t.getUint32(16)},r=t.getUint16(22),n;for(n=24;r;n+=12,r--){a.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)})}return a},smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:Bl(e)}},stco:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},r=t.getUint32(4),n;for(n=8;r;n+=4,r--){a.chunkOffsets.push(t.getUint32(n))}return a},stsc:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=t.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]},n;for(n=8;a;n+=12,a--){r.sampleToChunks.push({firstChunk:t.getUint32(n),samplesPerChunk:t.getUint32(n+4),sampleDescriptionIndex:t.getUint32(n+8)})}return r},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:Bl(e.subarray(8))}},stsz:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:t.getUint32(4),entries:[]},r;for(r=12;r>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},a=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&t.flags[2],n=4&t.flags[2],i=1&t.flags[1],s=2&t.flags[1],o=4&t.flags[1],l=8&t.flags[1],d=a.getUint32(4),p=8,u;if(r){t.dataOffset=a.getInt32(p);p+=4}if(n&&d){u={flags:ql(e.subarray(p,p+4))};p+=4;if(i){u.duration=a.getUint32(p);p+=4}if(s){u.size=a.getUint32(p);p+=4}if(l){u.compositionTimeOffset=a.getUint32(p);p+=4}t.samples.push(u);d--}while(d--){u={};if(i){u.duration=a.getUint32(p);p+=4}if(s){u.size=a.getUint32(p);p+=4}if(o){u.flags=ql(e.subarray(p,p+4));p+=4}if(l){u.compositionTimeOffset=a.getUint32(p);p+=4}t.samples.push(u)}return t},"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}};Bl=function(e){for(var t=0,a=[],r,n,s,o,l,d=new ArrayBuffer(e.length),p=new Uint8Array(d),u=0;u"}if(1===i.length){return r+"<"+i.join("").slice(1)+">"}return r+"<\n"+i.map(function(e){return a+" "+e}).join("\n")+"\n"+a+" >"}return r+JSON.stringify(n,null,2).split("\n").map(function(e,t){if(0===t){return e}return a+" "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+jl(e.boxes,t+1):"")}).join("\n")};var zl={inspect:Bl,textify:jl,parseTfdt:Wl.tfdt,parseHdlr:Wl.hdlr,parseTfhd:Wl.tfhd,parseTrun:Wl.trun,parseSidx:Wl.sidx},Gl=4,$l=function(e){var t=0,a={payloadType:-1,payloadSize:0},r=0,n=0;while(te.type){this.dispatchCea608Packet(e)}},this);this.captionPackets_.length=0;this.flushCCStreams(e)};Zl.prototype.flush=function(){return this.flushStream("flush")};Zl.prototype.partialFlush=function(){return this.flushStream("partialFlush")};Zl.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(e){e.reset()})};Zl.prototype.dispatchCea608Packet=function(e){if(this.setsTextOrXDSActive(e)){this.activeCea608Channel_[e.type]=null}else if(this.setsChannel1Active(e)){this.activeCea608Channel_[e.type]=0}else if(this.setsChannel2Active(e)){this.activeCea608Channel_[e.type]=1}if(null===this.activeCea608Channel_[e.type]){return}this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)};Zl.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)};Zl.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)};Zl.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var ed={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},td=function(e){if(null===e){return""}e=ed[e]||e;return String.fromCharCode(e)},ad=14,rd=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],nd=function(){var e=[],t=ad+1;while(t--){e.push("")}return e},id=function e(t,a){e.prototype.init.call(this);this.field_=t||0;this.dataChannel_=a||0;this.name_="CC"+((this.field_<<1|this.dataChannel_)+1);this.setConstants();this.reset();this.push=function(e){var t,a,r,n,i;t=32639&e.ccData;if(t===this.lastControlCode_){this.lastControlCode_=null;return}if(4096==(61440&t)){this.lastControlCode_=t}else if(t!==this.PADDING_){this.lastControlCode_=null}r=t>>>8;n=255&t;if(t===this.PADDING_){}else 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);a=this.displayed_;this.displayed_=this.nonDisplayed_;this.nonDisplayed_=a;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_){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}}else if(t===this.ERASE_DISPLAYED_MEMORY_){this.flushDisplayed(e.pts);this.displayed_=nd()}else if(t===this.ERASE_NON_DISPLAYED_MEMORY_){this.nonDisplayed_=nd()}else if(t===this.RESUME_DIRECT_CAPTIONING_){if("paintOn"!==this.mode_){this.flushDisplayed(e.pts);this.displayed_=nd()}this.mode_="paintOn";this.startPts_=e.pts}else if(this.isSpecialCharacter(r,n)){r=(3&r)<<8;i=td(r|n);this[this.mode_](e.pts,i);this.column_++}else if(this.isExtCharacter(r,n)){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}r=(3&r)<<8;i=td(r|n);this[this.mode_](e.pts,i);this.column_++}else if(this.isMidRowCode(r,n)){this.clearFormatting(e.pts);this[this.mode_](e.pts," ");this.column_++;if(14==(14&n)){this.addFormatting(e.pts,["i"])}if(1==(1&n)){this.addFormatting(e.pts,["u"])}}else if(this.isOffsetControlCode(r,n)){this.column_+=3&n}else if(this.isPAC(r,n)){var s=rd.indexOf(7968&t);if("rollUp"===this.mode_){if(0>s-this.rollUpRows_+1){s=this.rollUpRows_-1}this.setRollUp(e.pts,s)}if(s!==this.row_){this.clearFormatting(e.pts);this.row_=s}if(1&n&&-1===this.formatting_.indexOf("u")){this.addFormatting(e.pts,["u"])}if(16==(16&t)){this.column_=4*((14&t)>>1)}if(this.isColorPAC(n)){if(14==(14&n)){this.addFormatting(e.pts,["i"])}}}else if(this.isNormalChar(r)){if(0===n){n=null}i=td(r);i+=td(n);this[this.mode_](e.pts,i);this.column_+=i.length}}};id.prototype=new Jl;id.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){try{return e.trim()}catch(t){console.error("Skipping malformed caption.");return""}}).join("\n").replace(/^\n+|\n+$/g,"");if(t.length){this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})}};id.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=nd();this.nonDisplayed_=nd();this.lastControlCode_=null;this.column_=0;this.row_=ad;this.rollUpRows_=2;this.formatting_=[]};id.prototype.setConstants=function(){if(0===this.dataChannel_){this.BASE_=16;this.EXT_=17;this.CONTROL_=(20|this.field_)<<8;this.OFFSET_=23}else if(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_};id.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&63>=t};id.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&63>=t};id.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&47>=t};id.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&35>=t};id.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=t};id.prototype.isColorPAC=function(e){return 64<=e&&79>=e||96<=e&&127>=e};id.prototype.isNormalChar=function(e){return 32<=e&&127>=e};id.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_){this.row_=ad;this.mode_="rollUp";this.flushDisplayed(e);this.nonDisplayed_=nd();this.displayed_=nd()}if(t!==void 0&&t!==this.row_){for(var a=0;a"},"");this[this.mode_](e,a)};id.prototype.clearFormatting=function(e){if(!this.formatting_.length){return}var t=this.formatting_.reverse().reduce(function(e,t){return e+""},"");this.formatting_=[];this[this.mode_](e,t)};id.prototype.popOn=function(e,t){var a=this.nonDisplayed_[this.row_];a+=t;this.nonDisplayed_[this.row_]=a};id.prototype.rollUp=function(e,t){var a=this.displayed_[this.row_];a+=t;this.displayed_[this.row_]=a};id.prototype.shiftRowsUp_=function(){var e;for(e=0;e=l){continue}switch(31&e[o]){case 6:var p=e.subarray(o+1,o+1+l),u=ld(o,t);s={nalUnitType:"sei_rbsp",size:l,data:p,escapedRBSP:sd(p),trackId:a};if(u){s.pts=u.pts;s.dts=u.dts;d=u}else{s.pts=d.pts;s.dts=d.dts}n.push(s);break;default:break;}}return n},pd=function(e,t,a){var r=t,n=a.defaultSampleDuration||0,i=a.defaultSampleSize||0,s=a.trackId,o=[];e.forEach(function(e){var t=zl.parseTrun(e),a=t.samples;a.forEach(function(e){if(e.duration===void 0){e.duration=n}if(e.size===void 0){e.size=i}e.trackId=s;e.dts=r;if(e.compositionTimeOffset===void 0){e.compositionTimeOffset=0}e.pts=r+e.compositionTimeOffset;r+=e.duration});o=o.concat(a)});return o},ud=function(e,t){var a=Nl.findBox(e,["moof","traf"]),r=Nl.findBox(e,["mdat"]),n={},i=[];r.forEach(function(e,t){var r=a[t];i.push({mdat:e,traf:r})});i.forEach(function(e){var a=e.mdat,r=e.traf,i=Nl.findBox(r,["tfhd"]),s=zl.parseTfhd(i[0]),o=s.trackId,l=Nl.findBox(r,["tfdt"]),d=0t){a=-1}while(Math.abs(t-e)>4294967296){e+=a*8589934592}return e},_d=function e(t){var a,r;e.prototype.init.call(this);this.type_=t||yd;this.push=function(e){if(this.type_!==yd&&e.type!==this.type_){return}if(r===void 0){r=e.dts}e.dts=hd(e.dts,r);e.pts=hd(e.pts,r);a=e.dts;this.trigger("data",e)};this.flush=function(){r=a;this.trigger("done")};this.endTimeline=function(){this.flush();this.trigger("endedtimeline")};this.discontinuity=function(){r=void 0;a=void 0};this.reset=function(){this.discontinuity();this.trigger("reset")}};_d.prototype=new Jl;var fd=function(e){var t=31&e[1];t<<=8;t|=e[2];return t},bd=function(e){return!!(64&e[1])},Td=function(e){var t=0;if(1<(48&e[3])>>>4){t+=e[4]+1}return t},vd=function(e){var t={},a=bd(e),r=4+Td(e);if(a){r+=e[r]+1}if(!(1&e[r+5])){return}var n,s,o;n=(15&e[r+1])<<8|e[r+2];s=3+n-4;o=(15&e[r+10])<<8|e[r+11];var l=12+o;while(l>>2]}return null},Ld=function(e){var t,a,r,n;t=10;if(64&e[5]){t+=4;t+=Cd(e.subarray(10,14))}do{a=Cd(e.subarray(t+4,t+8));if(1>a){return null}n=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);if("PRIV"===n){r=e.subarray(t+10,t+a+10);for(var s=0;s>>2;d*=4;d+=3&l[7];return d}break}}}t+=10;t+=a}while(t=e.byteLength){return null}var r=null,n;n=e[a+7];if(192&n){r={};r.pts=(14&e[a+9])<<27|(255&e[a+10])<<20|(254&e[a+11])<<12|(255&e[a+12])<<5|(254&e[a+13])>>>3;r.pts*=4;r.pts+=(6&e[a+13])>>>1;r.dts=r.pts;if(64&n){r.dts=(14&e[a+14])<<27|(255&e[a+15])<<20|(254&e[a+16])<<12|(255&e[a+17])<<5|(254&e[a+18])>>>3;r.dts*=4;r.dts+=(6&e[a+18])>>>1}}return r},videoPacketContainsKeyFrame:function(e){var t=4+Td(e),a=e.subarray(t),r=0,n=0,i=!1,s;for(;n>4){return a+20}return a+10},parseAdtsSize:function(e,t){var a=(224&e[t+5])>>5,r=e[t+4]<<3,n=e[t+3]&6144;return n|r|a},parseType:function(e,t){if(e[t]===73&&e[t+1]===68&&e[t+2]===51){return"timed-metadata"}else if(e[t]&!0&&240==(240&e[t+1])){return"audio"}return null},parseSampleRate:Id,parseAacTimestamp:Ld};var Fd=Nd.ONE_SECOND_IN_TS,Hd=188,qd=71,Vd=function(e,t){var a=0,r=Hd,n,i;while(re.length-s){t=!0;break}i=jd.aac.parseId3TagSize(e,s);if(i>e.length){t=!0;break}if(null===n){o=e.subarray(s,s+i);n=jd.aac.parseAacTimestamp(o)}s+=i;break;case"audio":if(7>e.length-s){t=!0;break}i=jd.aac.parseAdtsSize(e,s);if(i>e.length){t=!0;break}if(null===r){o=e.subarray(s,s+i);r=jd.aac.parseSampleRate(o)}a++;s+=i;break;default:s++;break;}if(t){return null}}if(null===r||null===n){return null}var d=Fd/r,p={audio:[{type:"audio",dts:n,pts:n},{type:"audio",dts:n+1024*a*d,pts:n+1024*a*d}]};return p},Kd=function(e){var t={pid:null,table:null},a={};Vd(e,t);for(var r in t.table){if(t.table.hasOwnProperty(r)){var n=t.table[r];switch(n){case gd.H264_STREAM_TYPE:a.video=[];zd(e,t,a);if(0===a.video.length){delete a.video}break;case gd.ADTS_STREAM_TYPE:a.audio=[];Wd(e,t,a);if(0===a.audio.length){delete a.audio}break;default:break;}}}return a};function ut(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}var Yd=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}},Xd=function(){function e(e,t){for(var a=0,r;ao;o++){d[(u[o]=o<<1^283*(o>>7))^o]=o}for(l=p=0;!r[l];l^=c||1,p=d[p]||1){y=p^p<<1^p<<2^p<<3^p<<4;y=99^(y>>8^255&y);r[l]=y;n[y]=l;g=u[m=u[c=u[l]]];_=16843009*g^65537*m^257*c^16843008*l;h=257*u[y]^16843008*y;for(o=0;4>o;o++){t[o][l]=h=h<<24^h>>>8;a[o][y]=_=_<<24^_>>>8}}for(o=0;5>o;o++){t[o]=t[o].slice(0);a[o]=a[o].slice(0)}return e},ep=null,tp=function(){function e(t){Yd(this,e);if(!ep){ep=Zd()}this._tables=[[ep[0][0].slice(),ep[0][1].slice(),ep[0][2].slice(),ep[0][3].slice(),ep[0][4].slice()],[ep[1][0].slice(),ep[1][1].slice(),ep[1][2].slice(),ep[1][3].slice(),ep[1][4].slice()]];var a=void 0,r=void 0,n=void 0,s=void 0,o=void 0,l=this._tables[0][4],d=this._tables[1],p=t.length,u=1;if(4!==p&&6!==p&&8!==p){throw new Error("Invalid aes key size")}s=t.slice(0);o=[];this._key=[s,o];for(a=p;a<4*p+28;a++){n=s[a-1];if(0==a%p||8===p&&4==a%p){n=l[n>>>24]<<24^l[255&n>>16]<<16^l[255&n>>8]<<8^l[255&n];if(0==a%p){n=n<<8^n>>>24^u<<24;u=u<<1^283*(u>>7)}}s[a]=s[a-p]^n}for(r=0;a;r++,a--){n=s[3&r?a:a-4];if(4>=a||4>r){o[r]=n}else{o[r]=d[0][l[n>>>24]]^d[1][l[255&n>>16]]^d[2][l[255&n>>8]]^d[3][l[255&n]]}}}e.prototype.decrypt=function(e,t,r,n,s,o){var l=this._key[1],p=e^l[0],u=n^l[1],m=r^l[2],g=t^l[3],y=void 0,h=void 0,_=void 0,f=l.length/4-2,T=void 0,v=4,S=this._tables[1],k=S[0],C=S[1],E=S[2],P=S[3],I=S[4];for(T=0;T>>24]^C[255&u>>16]^E[255&m>>8]^P[255&g]^l[v];h=k[u>>>24]^C[255&m>>16]^E[255&g>>8]^P[255&p]^l[v+1];_=k[m>>>24]^C[255&g>>16]^E[255&p>>8]^P[255&u]^l[v+2];g=k[g>>>24]^C[255&p>>16]^E[255&u>>8]^P[255&m]^l[v+3];v+=4;p=y;u=h;m=_}for(T=0;4>T;T++){s[(3&-T)+o]=I[p>>>24]<<24^I[255&u>>16]<<16^I[255&m>>8]<<8^I[255&g]^l[v++];y=p;p=u;u=m;m=g;g=y}};return e}(),ap=function(){function e(){Yd(this,e);this.listeners={}}e.prototype.on=function(e,t){if(!this.listeners[e]){this.listeners[e]=[]}this.listeners[e].push(t)};e.prototype.off=function(e,t){if(!this.listeners[e]){return!1}var a=this.listeners[e].indexOf(t);this.listeners[e].splice(a,1);return-1>8|e>>>24},ip=function(e,t,a){var r=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),n=new tp(Array.prototype.slice.call(t)),i=new Uint8Array(e.byteLength),s=new Int32Array(i.buffer),o=void 0,l=void 0,d=void 0,p=void 0,u=void 0,c=void 0,m=void 0,g=void 0,y=void 0;o=a[0];l=a[1];d=a[2];p=a[3];for(y=0;ya){var n=[a,t];t=n[0];a=n[1]}if(0>t){for(var s=t;s=r){break}}return Math.max(0,t)},Op=function(e,t,a){if(!e||!e.segments){return null}if(e.endList){return Ap(e)}if(null===t){return null}t=t||0;var r=a?wp(e):e.segments.length;return xp(e,e.mediaSequence+r,t)},Rp=function(e){return 0==e-Math.floor(e)},Up=function(e,t){if(Rp(t)){return t+.1*e}for(var a=t.toString().split(".")[1].length,r=1;r<=a;r++){var n=Math.pow(10,r),s=t*n;if(Rp(s)||r===a){return(s+e)/n}}},Mp=Up.bind(null,1),Np=Up.bind(null,-1),Bp=function(e,t,a,r){var n=void 0,s=void 0,o=e.segments.length,l=t-r;if(0>l){if(0a){for(n=a;0>n;n++){l-=e.targetDuration;if(0>l){return{mediaIndex:0,startTime:t}}}a=0}for(n=a;nl){return{mediaIndex:n,startTime:r+Dp(e,a,n)}}}return{mediaIndex:o-1,startTime:t}},jp=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},Fp=function(e){return e.excludeUntil&&e.excludeUntil===1/0},Hp=function(e){var t=jp(e);return!e.disabled&&!t},qp=function(e){for(var t=0;tt){return String.fromCharCode(t)}return"."},tu=function(e){var t={};Object.keys(e).forEach(function(a){var r=e[a];if(ArrayBuffer.isView(r)){t[a]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}}else{t[a]=r}});return t},au=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},ru=function(e){return e.resolvedUri},nu=function(e){for(var t=Array.prototype.slice.call(e),a=16,r="",n=void 0,i=void 0,s=0;sp){return null}if(a>l){r=o}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:Gp.duration(t,t.mediaSequence+t.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"}},uu=function(e,t){if(!t||!t.segments||0===t.segments.length){return null}for(var a=0,r=void 0,n=0;na){if(e>a+s.duration*ou){return null}r=s}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:a-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},cu=function(e,t){var a=void 0,r=void 0;try{a=new Date(e);r=new Date(t)}catch(t){}var n=a.getTime(),i=r.getTime();return(i-n)/1e3},mu=function(e){if(!e.segments||0===e.segments.length){return!1}for(var t=0,a;t=t})},Tu=function(e,t){return fu(e,function(e){return e-hu>=t})},vu=function(e){if(2>e.length){return it.createTimeRanges()}for(var t=[],a=1;a "+e.end(a))}return t.join(", ")},ku=function(e,t){var a=2=e){a.removeCue(n)}}},Iu=function(e){Object.defineProperties(e.frame,{id:{get:function(){it.log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");return e.value.key}},value:{get:function(){it.log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");return e.value.data}},privateData:{get:function(){it.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");return e.value.data}}})},Lu=function(e){var t;if(isNaN(e)||Math.abs(e)===1/0){t=Number.MAX_VALUE}else{t=e}return t},xu=function(t,a,r){var n=e.WebKitDataCue||e.VTTCue;if(a){a.forEach(function(e){var t=e.stream;this.inbandTextTracks_[t].addCue(new n(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))},t)}if(r){var s=Lu(t.mediaSource_.duration);r.forEach(function(t){var a=t.cueTime+this.timestampOffset;if("number"!=typeof a||e.isNaN(a)||0>a||!(a<1/0)){return}t.frames.forEach(function(e){var t=new n(a,a,e.value||e.url||e.data||"");t.frame=e;t.value=e;Iu(t);this.metadataTrack_.addCue(t)},this)},t);if(t.metadataTrack_&&t.metadataTrack_.cues&&t.metadataTrack_.cues.length){for(var o=t.metadataTrack_.cues,l=[],d=0;d>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))};o=function(){return n(P.ftyp,I,L,I,x)};b=function(e){return n(P.hdlr,w[e])};l=function(e){return n(P.mdat,e)};f=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,255&e.duration>>>24,255&e.duration>>>16,255&e.duration>>>8,255&e.duration,85,196,0,0]);if(e.samplerate){t[12]=255&e.samplerate>>>24;t[13]=255&e.samplerate>>>16;t[14]=255&e.samplerate>>>8;t[15]=255&e.samplerate}return n(P.mdhd,t)};_=function(e){return n(P.mdia,f(e),b(e.type),p(e))};d=function(e){return n(P.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))};p=function(e){return n(P.minf,"video"===e.type?n(P.vmhd,O):n(P.smhd,R),i(),v(e))};u=function(e,t){var a=[],r=t.length;while(r--){a[r]=k(t[r])}return n.apply(null,[P.moof,d(e)].concat(a))};c=function(e){var t=e.length,a=[];while(t--){a[t]=y(e[t])}return n.apply(null,[P.moov,g(4294967295)].concat(a).concat(m(e)))};m=function(e){var t=e.length,a=[];while(t--){a[t]=C(e[t])}return n.apply(null,[P.mvex].concat(a))};g=function(e){var t=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 n(P.mvhd,t)};T=function(e){var t=e.samples||[],a=new Uint8Array(4+t.length),r,s;for(s=0;s>>8);r.push(255&t[o].byteLength);r=r.concat(Array.prototype.slice.call(t[o]))}for(o=0;o>>8);s.push(255&a[o].byteLength);s=s.concat(Array.prototype.slice.call(a[o]))}l=[P.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]),n(P.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([t.length],r,[a.length],s))),n(P.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))];if(e.sarRatio){var d=e.sarRatio[0],p=e.sarRatio[1];l.push(n(P.pasp,new Uint8Array([(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d,(4278190080&p)>>24,(16711680&p)>>16,(65280&p)>>8,255&p])))}return n.apply(null,l)};t=function(e){return n(P.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]),s(e))}})();h=function(e){var t=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 n(P.tkhd,t)};k=function(e){var t,a,i,s,o,l,d;t=n(P.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]));l=Math.floor(e.baseMediaDecodeTime/(r+1));d=Math.floor(e.baseMediaDecodeTime%(r+1));a=n(P.tfdt,new Uint8Array([1,0,0,0,255&l>>>24,255&l>>>16,255&l>>>8,255&l,255&d>>>24,255&d>>>16,255&d>>>8,255&d]));o=92;if("audio"===e.type){i=E(e,o);return n(P.traf,t,a,i)}s=T(e);i=E(e,s.length+o);return n(P.traf,t,a,i,s)};y=function(e){e.duration=e.duration||4294967295;return n(P.trak,h(e),_(e))};C=function(e){var t=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]);if("video"!==e.type){t[t.length-1]=0}return n(P.trex,t)};(function(){var e,t,a;a=function(e,t){var a=0,r=0,n=0,i=0;if(e.length){if(e[0].duration!==void 0){a=1}if(e[0].size!==void 0){r=2}if(e[0].flags!==void 0){n=4}if(e[0].compositionTimeOffset!==void 0){i=8}}return[0,0,a|r|n|i,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]};t=function(e,t){var r,s,o,l;s=e.samples||[];t+=20+16*s.length;r=a(s,t);for(l=0;l>>24,(16711680&o.duration)>>>16,(65280&o.duration)>>>8,255&o.duration,(4278190080&o.size)>>>24,(16711680&o.size)>>>16,(65280&o.size)>>>8,255&o.size,o.flags.isLeading<<2|o.flags.dependsOn,o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,o.flags.degradationPriority&61440,15&o.flags.degradationPriority,(4278190080&o.compositionTimeOffset)>>>24,(16711680&o.compositionTimeOffset)>>>16,(65280&o.compositionTimeOffset)>>>8,255&o.compositionTimeOffset])}return n(P.trun,new Uint8Array(r))};e=function(e,t){var r,s,o,l;s=e.samples||[];t+=20+8*s.length;r=a(s,t);for(l=0;l>>24,(16711680&o.duration)>>>16,(65280&o.duration)>>>8,255&o.duration,(4278190080&o.size)>>>24,(16711680&o.size)>>>16,(65280&o.size)>>>8,255&o.size])}return n(P.trun,new Uint8Array(r))};E=function(a,r){if("audio"===a.type){return e(a,r)}return t(a,r)}})();var F={ftyp:o,mdat:l,moof:u,moov:c,initSegment:function(e){var t=o(),a=c(e),r;r=new Uint8Array(t.byteLength+a.byteLength);r.set(t);r.set(a,t.byteLength);return r}},H=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},q=function(e,t){var a=H();a.dataOffset=t;a.compositionTimeOffset=e.pts-e.dts;a.duration=e.duration;a.size=4*e.length;a.size+=e.byteLength;if(e.keyFrame){a.flags.dependsOn=2;a.flags.isNonSyncSample=0}return a},V={groupNalsIntoFrames:function(e){var t,a,r=[],n=[];n.byteLength=0;n.nalCount=0;n.duration=0;r.byteLength=0;for(t=0;t=r.duration)){r.duration=n[n.length-1].duration}n.byteLength+=r.byteLength;n.nalCount+=r.length;n.duration+=r.duration;n.push(r);return n},groupFramesIntoGops:function(e){var t,a,r=[],n=[];r.byteLength=0;r.nalCount=0;r.duration=0;r.pts=e[0].pts;r.dts=e[0].dts;n.byteLength=0;n.nalCount=0;n.duration=0;n.pts=e[0].pts;n.dts=e[0].dts;for(t=0;t=r.duration){r.duration=n[n.length-1].duration}n.byteLength+=r.byteLength;n.nalCount+=r.nalCount;n.duration+=r.duration;n.push(r);return n},extendFirstKeyFrame:function(e){var t;if(!e[0][0].keyFrame&&1l||d>re.ONE_SECOND_IN_TS/2){return}p=K[e.samplerate];if(!p){p=t[0].data}for(u=0;u=a){return e}t.minSegmentDts=1/0;return e.filter(function(e){if(e.dts>=a){t.minSegmentDts=Math.min(t.minSegmentDts,e.dts);t.minSegmentPts=t.minSegmentDts;return!0}return!1})},generateSampleTable:function(e){var t,a,r=[];for(t=0;te.type){this.dispatchCea608Packet(e)}},this);this.captionPackets_.length=0;this.flushCCStreams(e)};pe.prototype.flush=function(){return this.flushStream("flush")};pe.prototype.partialFlush=function(){return this.flushStream("partialFlush")};pe.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(e){e.reset()})};pe.prototype.dispatchCea608Packet=function(e){if(this.setsTextOrXDSActive(e)){this.activeCea608Channel_[e.type]=null}else if(this.setsChannel1Active(e)){this.activeCea608Channel_[e.type]=0}else if(this.setsChannel2Active(e)){this.activeCea608Channel_[e.type]=1}if(null===this.activeCea608Channel_[e.type]){return}this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)};pe.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)};pe.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)};pe.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var ue={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=function(e){if(null===e){return""}e=ue[e]||e;return String.fromCharCode(e)},me=14,ge=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ye=function(){var e=[],t=me+1;while(t--){e.push("")}return e},he=function e(t,a){e.prototype.init.call(this);this.field_=t||0;this.dataChannel_=a||0;this.name_="CC"+((this.field_<<1|this.dataChannel_)+1);this.setConstants();this.reset();this.push=function(e){var t,a,r,n,i;t=32639&e.ccData;if(t===this.lastControlCode_){this.lastControlCode_=null;return}if(4096==(61440&t)){this.lastControlCode_=t}else if(t!==this.PADDING_){this.lastControlCode_=null}r=t>>>8;n=255&t;if(t===this.PADDING_){}else 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);a=this.displayed_;this.displayed_=this.nonDisplayed_;this.nonDisplayed_=a;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_){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}}else if(t===this.ERASE_DISPLAYED_MEMORY_){this.flushDisplayed(e.pts);this.displayed_=ye()}else if(t===this.ERASE_NON_DISPLAYED_MEMORY_){this.nonDisplayed_=ye()}else if(t===this.RESUME_DIRECT_CAPTIONING_){if("paintOn"!==this.mode_){this.flushDisplayed(e.pts);this.displayed_=ye()}this.mode_="paintOn";this.startPts_=e.pts}else if(this.isSpecialCharacter(r,n)){r=(3&r)<<8;i=ce(r|n);this[this.mode_](e.pts,i);this.column_++}else if(this.isExtCharacter(r,n)){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}r=(3&r)<<8;i=ce(r|n);this[this.mode_](e.pts,i);this.column_++}else if(this.isMidRowCode(r,n)){this.clearFormatting(e.pts);this[this.mode_](e.pts," ");this.column_++;if(14==(14&n)){this.addFormatting(e.pts,["i"])}if(1==(1&n)){this.addFormatting(e.pts,["u"])}}else if(this.isOffsetControlCode(r,n)){this.column_+=3&n}else if(this.isPAC(r,n)){var s=ge.indexOf(7968&t);if("rollUp"===this.mode_){if(0>s-this.rollUpRows_+1){s=this.rollUpRows_-1}this.setRollUp(e.pts,s)}if(s!==this.row_){this.clearFormatting(e.pts);this.row_=s}if(1&n&&-1===this.formatting_.indexOf("u")){this.addFormatting(e.pts,["u"])}if(16==(16&t)){this.column_=4*((14&t)>>1)}if(this.isColorPAC(n)){if(14==(14&n)){this.addFormatting(e.pts,["i"])}}}else if(this.isNormalChar(r)){if(0===n){n=null}i=ce(r);i+=ce(n);this[this.mode_](e.pts,i);this.column_+=i.length}}};he.prototype=new a;he.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){try{return e.trim()}catch(t){console.error("Skipping malformed caption.");return""}}).join("\n").replace(/^\n+|\n+$/g,"");if(t.length){this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})}};he.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=ye();this.nonDisplayed_=ye();this.lastControlCode_=null;this.column_=0;this.row_=me;this.rollUpRows_=2;this.formatting_=[]};he.prototype.setConstants=function(){if(0===this.dataChannel_){this.BASE_=16;this.EXT_=17;this.CONTROL_=(20|this.field_)<<8;this.OFFSET_=23}else if(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_};he.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&63>=t};he.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&63>=t};he.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&47>=t};he.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&35>=t};he.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=t};he.prototype.isColorPAC=function(e){return 64<=e&&79>=e||96<=e&&127>=e};he.prototype.isNormalChar=function(e){return 32<=e&&127>=e};he.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_){this.row_=me;this.mode_="rollUp";this.flushDisplayed(e);this.nonDisplayed_=ye();this.displayed_=ye()}if(t!==void 0&&t!==this.row_){for(var a=0;a"},"");this[this.mode_](e,a)};he.prototype.clearFormatting=function(e){if(!this.formatting_.length){return}var t=this.formatting_.reverse().reduce(function(e,t){return e+""},"");this.formatting_=[];this[this.mode_](e,t)};he.prototype.popOn=function(e,t){var a=this.nonDisplayed_[this.row_];a+=t;this.nonDisplayed_[this.row_]=a};he.prototype.rollUp=function(e,t){var a=this.displayed_[this.row_];a+=t;this.displayed_[this.row_]=a};he.prototype.shiftRowsUp_=function(){var e;for(e=0;et){a=-1}while(Math.abs(t-e)>4294967296){e+=a*8589934592}return e},ve=function e(t){var a,r;e.prototype.init.call(this);this.type_=t||be;this.push=function(e){if(this.type_!==be&&e.type!==this.type_){return}if(r===void 0){r=e.dts}e.dts=Te(e.dts,r);e.pts=Te(e.pts,r);a=e.dts;this.trigger("data",e)};this.flush=function(){r=a;this.trigger("done")};this.endTimeline=function(){this.flush();this.trigger("endedtimeline")};this.discontinuity=function(){r=void 0;a=void 0};this.reset=function(){this.discontinuity();this.trigger("reset")}};ve.prototype=new a;var Se=function(e,t,a){var r,n="";for(r=t;re.data.length||e.data[0]!==73||e.data[1]!==68||e.data[2]!==51)){if(t.debug){console.log("Skipping unrecognized metadata packet")}return}r.push(e);n+=e.data.byteLength;if(1===r.length){a=Ee(e.data.subarray(6,10));a+=10}if(nl){return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.")}c=String.fromCharCode(s.data[o],s.data[o+1],s.data[o+2],s.data[o+3]);p={id:c,data:s.data.subarray(o+10,o+l+10)};p.key=p.id;if(Pe[p.id]){Pe[p.id](p);if("com.apple.streaming.transportStreamTimestamp"===p.owner){var m=p.data,d=(1&m[3])<<30|m[4]<<22|m[5]<<14|m[6]<<6|m[7]>>>2;d*=4;d+=3&m[7];p.timeStamp=d;if(s.pts===void 0&&s.dts===void 0){s.pts=p.timeStamp;s.dts=p.timeStamp}this.trigger("timestamp",p)}}s.frames.push(p);o+=10;o+=l}while(o>>4){r+=t[r]+1}if(0===a.pid){a.type="pat";e(t.subarray(r),a);this.trigger("data",a)}else if(a.pid===this.pmtPid){a.type="pmt";e(t.subarray(r),a);this.trigger("data",a);while(this.packetsWaitingForPmt.length){this.processPes_.apply(this,this.packetsWaitingForPmt.shift())}}else if(this.programMapTable===void 0){this.packetsWaitingForPmt.push([t,r,a])}else{this.processPes_(t,r,a)}};this.processPes_=function(e,t,a){if(a.pid===this.programMapTable.video){a.streamType=fe.H264_STREAM_TYPE}else if(a.pid===this.programMapTable.audio){a.streamType=fe.ADTS_STREAM_TYPE}else{a.streamType=this.programMapTable["timed-metadata"][a.pid]}a.type="pes";a.data=e.subarray(t);this.trigger("data",a)}};De.prototype=new a;De.STREAM_TYPES={h264:27,adts:15};we=function(){var e=this,t={data:[],size:0},a={data:[],size:0},r={data:[],size:0},n,s=function(e,t){var a;t.packetLength=6+(e[4]<<8|e[5]);t.dataAlignmentIndicator=0!=(4&e[6]);a=e[7];if(192&a){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;if(64&a){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])},o=function(t,a,r){var n=new Uint8Array(t.size),o={type:a},l=0,d=0,p=!1,u;if(!t.data.length||9>t.size){return}o.trackId=t.data[0].pid;for(l=0;l>5;p=1024*((3&t[n+6])+1);u=p*Be/Fe[(60&t[n+2])>>>2];l=n+s;if(t.byteLength>>6)+1,channelcount:(1&t[n+2])<<2|(192&t[n+3])>>>6,samplerate:Fe[(60&t[n+2])>>>2],samplingfrequencyindex:(60&t[n+2])>>>2,samplesize:16,data:t.subarray(n+7+o,l)});a++;if(t.byteLength===l){t=void 0;return}t=t.subarray(l)}};this.flush=function(){a=0;this.trigger("done")};this.reset=function(){t=void 0;this.trigger("reset")};this.endTimeline=function(){t=void 0;this.trigger("endedtimeline")}};je.prototype=new a;var He=je,qe;qe=function(e){var t=e.byteLength,a=0,r=0;this.length=function(){return 8*t};this.bitsAvailable=function(){return 8*t+r};this.loadWord=function(){var n=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(0===s){throw new Error("no bytes available")}i.set(e.subarray(n,n+s));a=new DataView(i.buffer).getUint32(0);r=8*s;t-=s};this.skipBits=function(e){var n;if(r>e){a<<=e;r-=e}else{e-=r;n=Math.floor(e/8);e-=8*n;t-=n;this.loadWord();a<<=e;r-=e}};this.readBits=function(e){var n=Math.min(r,e),i=a>>>32-n;r-=n;if(0>>e)){a<<=e;r-=e;return e}}this.loadWord();return 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();if(1&e){return 1+e>>>1}return-1*(e>>>1)};this.readBoolean=function(){return 1===this.readBits(1)};this.readUnsignedByte=function(){return this.readBits(8)};this.loadWord()};var Ve=qe,We,ze,Ge;ze=function(){var e=0,t,a;ze.prototype.init.call(this);this.push=function(r){var n;if(!a){a=r.data}else{n=new Uint8Array(a.byteLength+r.data.byteLength);n.set(a);n.set(r.data,a.byteLength);a=n}var i=a.byteLength;for(;ev){o(16,l)}else{o(64,l)}}}}}l.skipUnsignedExpGolomb();m=l.readUnsignedExpGolomb();if(0===m){l.readUnsignedExpGolomb()}else if(1===m){l.skipBits(1);l.skipExpGolomb();l.skipExpGolomb();g=l.readUnsignedExpGolomb();for(v=0;v>4){return a+20}return a+10},parseAdtsSize:function(e,t){var a=(224&e[t+5])>>5,r=e[t+4]<<3,n=e[t+3]&6144;return n|r|a},parseType:function(e,t){if(e[t]===73&&e[t+1]===68&&e[t+2]===51){return"timed-metadata"}else if(e[t]&!0&&240==(240&e[t+1])){return"audio"}return null},parseSampleRate:function(e){var t=0;while(t+5>>2]}return null},parseAacTimestamp:function(e){var t,a,r,n;t=10;if(64&e[5]){t+=4;t+=Ye(e.subarray(10,14))}do{a=Ye(e.subarray(t+4,t+8));if(1>a){return null}n=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);if("PRIV"===n){r=e.subarray(t+10,t+a+10);for(var s=0;s>>2;d*=4;d+=3&l[7];return d}break}}}t+=10;t+=a}while(te.length-n){break}r=Je.parseId3TagSize(e,n);if(n+r>e.length){break}s={type:"timed-metadata",data:e.subarray(n,n+r)};this.trigger("data",s);n+=r;continue}else if(255==(255&e[n])&&240==(240&e[n+1])){if(7>e.length-n){break}r=Je.parseAdtsSize(e,n);if(n+r>e.length){break}o={type:"audio",data:e.subarray(n,n+r),pts:t,dts:t};this.trigger("data",o);n+=r;continue}n++}i=e.length-n;if(0=-10000&&r<=45000){if(!n||a>r){n=o;a=r}}}if(n){return n.gop}return null};this.alignGopsAtStart_=function(e){var t,a,r,i,s,o,l,d;s=e.byteLength;o=e.nalCount;l=e.duration;t=a=0;while(tr.pts){t++;continue}a++;s-=i.byteLength;o-=i.nalCount;l-=i.duration}if(0===a){return e}if(a===e.length){return null}d=e.slice(a);d.byteLength=s;d.duration=l;d.nalCount=o;d.pts=d[0].pts;d.dts=d[0].dts;return d};this.alignGopsAtEnd_=function(e){var t,a,r,i,s,o;t=n.length-1;a=e.length-1;s=null;o=!1;while(0<=t&&0<=a){r=n[t];i=e[a];if(r.pts===i.pts){o=!0;break}if(r.pts>i.pts){t--;continue}if(t===n.length-1){s=a}a--}if(!o&&null===s){return null}var l;if(o){l=a}else{l=s}if(0===l){return e}var d=e.slice(l),p=d.reduce(function(e,t){e.byteLength+=t.byteLength;e.duration+=t.duration;e.nalCount+=t.nalCount;return e},{byteLength:0,duration:0,nalCount:0});d.byteLength=p.byteLength;d.duration=p.duration;d.nalCount=p.nalCount;d.pts=d[0].pts;d.dts=d[0].dts;return d};this.alignGopsWith=function(e){n=e}};st.prototype=new a;dt=function(e,t){this.numberOfTracks=0;this.metadataStream=t;e=e||{};if("undefined"!=typeof e.remux){this.remuxTracks=!!e.remux}else{this.remuxTracks=!0}if("boolean"==typeof e.keepOriginalTimestamps){this.keepOriginalTimestamps=e.keepOriginalTimestamps}else{this.keepOriginalTimestamps=!1}this.pendingTracks=[];this.videoTrack=null;this.pendingBoxes=[];this.pendingCaptions=[];this.pendingMetadata=[];this.pendingBytes=0;this.emittedTracks=0;dt.prototype.init.call(this);this.push=function(e){if(e.text){return this.pendingCaptions.push(e)}if(e.frames){return this.pendingMetadata.push(e)}this.pendingTracks.push(e.track);this.pendingBytes+=e.boxes.byteLength;if("video"===e.track.type){this.videoTrack=e.track;this.pendingBoxes.push(e.boxes)}if("audio"===e.track.type){this.audioTrack=e.track;this.pendingBoxes.unshift(e.boxes)}}};dt.prototype=new a;dt.prototype.flush=function(e){var t=0,a={captions:[],captionStreams:{},metadata:[],info:{}},r,n,s,o=0,l;if(this.pendingTracks.length=this.numberOfTracks){this.trigger("done");this.emittedTracks=0}return}}if(this.videoTrack){o=this.videoTrack.timelineStartInfo.pts;it.forEach(function(e){a.info[e]=this.videoTrack[e]},this)}else if(this.audioTrack){o=this.audioTrack.timelineStartInfo.pts;nt.forEach(function(e){a.info[e]=this.audioTrack[e]},this)}if(this.videoTrack||this.audioTrack){if(1===this.pendingTracks.length){a.type=this.pendingTracks[0].type}else{a.type="combined"}this.emittedTracks+=this.pendingTracks.length;s=F.initSegment(this.pendingTracks);a.initSegment=new Uint8Array(s.byteLength);a.initSegment.set(s);a.data=new Uint8Array(this.pendingBytes);for(l=0;l=this.numberOfTracks){this.trigger("done");this.emittedTracks=0}};dt.prototype.setRemux=function(e){this.remuxTracks=e};lt=function(e){var t=this,a=!0,r,n;lt.prototype.init.call(this);e=e||{};this.baseMediaDecodeTime=e.baseMediaDecodeTime||0;this.transmuxPipeline_={};this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a;a.type="aac";a.metadataStream=new Ne.MetadataStream;a.aacStream=new et;a.audioTimestampRolloverStream=new Ne.TimestampRolloverStream("audio");a.timedMetadataTimestampRolloverStream=new Ne.TimestampRolloverStream("timed-metadata");a.adtsStream=new He;a.coalesceStream=new dt(e,a.metadataStream);a.headOfPipeline=a.aacStream;a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream);a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream);a.metadataStream.on("timestamp",function(e){a.aacStream.setTimestamp(e.timeStamp)});a.aacStream.on("data",function(i){if("timed-metadata"===i.type&&!a.audioSegmentStream){n=n||{timelineStartInfo:{baseMediaDecodeTime:t.baseMediaDecodeTime},codec:"adts",type:"audio"};a.coalesceStream.numberOfTracks++;a.audioSegmentStream=new ot(n,e);a.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo"));a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)}t.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r})});a.coalesceStream.on("data",this.trigger.bind(this,"data"));a.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a;a.type="ts";a.metadataStream=new Ne.MetadataStream;a.packetStream=new Ne.TransportPacketStream;a.parseStream=new Ne.TransportParseStream;a.elementaryStream=new Ne.ElementaryStream;a.timestampRolloverStream=new Ne.TimestampRolloverStream;a.adtsStream=new He;a.h264Stream=new tt;a.captionStream=new Ne.CaptionStream;a.coalesceStream=new dt(e,a.metadataStream);a.headOfPipeline=a.packetStream;a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream);a.timestampRolloverStream.pipe(a.h264Stream);a.timestampRolloverStream.pipe(a.adtsStream);a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream);a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream);a.elementaryStream.on("data",function(s){var o;if("metadata"===s.type){o=s.tracks.length;while(o--){if(!r&&"video"===s.tracks[o].type){r=s.tracks[o];r.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}else if(!n&&"audio"===s.tracks[o].type){n=s.tracks[o];n.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}}if(r&&!a.videoSegmentStream){a.coalesceStream.numberOfTracks++;a.videoSegmentStream=new st(r,e);a.videoSegmentStream.on("timelineStartInfo",function(e){if(n){n.timelineStartInfo=e;a.audioSegmentStream.setEarliestDts(e.dts)}});a.videoSegmentStream.on("processedGopsInfo",t.trigger.bind(t,"gopInfo"));a.videoSegmentStream.on("segmentTimingInfo",t.trigger.bind(t,"videoSegmentTimingInfo"));a.videoSegmentStream.on("baseMediaDecodeTime",function(e){if(n){a.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}});a.videoSegmentStream.on("timingInfo",t.trigger.bind(t,"videoTimingInfo"));a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)}if(n&&!a.audioSegmentStream){a.coalesceStream.numberOfTracks++;a.audioSegmentStream=new ot(n,e);a.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo"));a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)}t.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r})}});a.coalesceStream.on("data",this.trigger.bind(this,"data"));a.coalesceStream.on("id3Frame",function(e){e.dispatchType=a.metadataStream.dispatchType;t.trigger("id3Frame",e)});a.coalesceStream.on("caption",this.trigger.bind(this,"caption"));a.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setBaseMediaDecodeTime=function(t){var a=this.transmuxPipeline_;if(!e.keepOriginalTimestamps){this.baseMediaDecodeTime=t}if(n){n.timelineStartInfo.dts=void 0;n.timelineStartInfo.pts=void 0;oe.clearDtsInfo(n);if(!e.keepOriginalTimestamps){n.timelineStartInfo.baseMediaDecodeTime=t}if(a.audioTimestampRolloverStream){a.audioTimestampRolloverStream.discontinuity()}}if(r){if(a.videoSegmentStream){a.videoSegmentStream.gopCache_=[]}r.timelineStartInfo.dts=void 0;r.timelineStartInfo.pts=void 0;oe.clearDtsInfo(r);a.captionStream.reset();if(!e.keepOriginalTimestamps){r.timelineStartInfo.baseMediaDecodeTime=t}}if(a.timestampRolloverStream){a.timestampRolloverStream.discontinuity()}};this.setAudioAppendStart=function(e){if(n){this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)}};this.setRemux=function(t){var a=this.transmuxPipeline_;e.remux=t;if(a&&a.coalesceStream){a.coalesceStream.setRemux(t)}};this.alignGopsWith=function(e){if(r&&this.transmuxPipeline_.videoSegmentStream){this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)}};this.push=function(e){if(a){var t=at(e);if(t&&"aac"!==this.transmuxPipeline_.type){this.setupAacPipeline()}else if(!t&&"ts"!==this.transmuxPipeline_.type){this.setupTsPipeline()}a=!1}this.transmuxPipeline_.headOfPipeline.push(e)};this.flush=function(){a=!0;this.transmuxPipeline_.headOfPipeline.flush()};this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()};this.reset=function(){if(this.transmuxPipeline_.headOfPipeline){this.transmuxPipeline_.headOfPipeline.reset()}};this.resetCaptions=function(){if(this.transmuxPipeline_.captionStream){this.transmuxPipeline_.captionStream.reset()}}};lt.prototype=new a;var ct={Transmuxer:lt,VideoSegmentStream:st,AudioSegmentStream:ot,AUDIO_PROPERTIES:nt,VIDEO_PROPERTIES:it,generateVideoSegmentTimingInfo:ut},mt=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}},gt=function(){function e(e,t){for(var a=0,r;ar){break}}return e.slice(n)},Ju=function(e,t,a){if(!t.length){return e}if(a){return t.slice()}var r=t[0].pts,n=0;for(n;n=r){break}}return e.slice(0,n).concat(t)},Zu=function(e,t,a,r){var n=Math.ceil(9e4*(t-r)),s=Math.ceil(9e4*(a-r)),o=e.slice(),l=e.length;while(l--){if(e[l].pts<=s){break}}if(-1==l){return o}var d=l+1;while(d--){if(e[d].pts<=n){break}}d=Math.max(d,0);o.splice(d,l-d+1);return o},ec=function(e,t,a){var r=null,n=null,i=0,s=[],o=[];if(!e&&!t){return it.createTimeRange()}if(!e){return t.buffered}if(!t){return e.buffered}if(a){return e.buffered}if(0===e.buffered.length&&0===t.buffered.length){return it.createTimeRange()}var l=e.buffered,d=t.buffered,p=l.length;while(p--){s.push({time:l.start(p),type:"start"});s.push({time:l.end(p),type:"end"})}p=d.length;while(p--){s.push({time:d.start(p),type:"start"});s.push({time:d.end(p),type:"end"})}s.sort(function(e,t){return e.time-t.time});for(p=0;pthis.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration)){this.nativeMediaSource_.duration=t}}},{key:"addSourceBuffer",value:function(e){var t=void 0,a=Ku(e);if(/^(video|audio)\/mp2t$/i.test(a.type)){var r=[];if(a.parameters&&a.parameters.codecs){r=a.parameters.codecs.split(",");r=Fu(r);r=r.filter(function(e){return Yu(e)||Xu(e)})}if(0===r.length){r=["avc1.4d400d","mp4a.40.2"]}t=new rc(this,r);if(0!==this.sourceBuffers.length){this.sourceBuffers[0].createRealSourceBuffers_();t.createRealSourceBuffers_();this.sourceBuffers[0].audioDisabled_=!0}}else{t=this.nativeMediaSource_.addSourceBuffer(e)}this.sourceBuffers.push(t);return t}}]);return r}(it.EventTarget),ic=0;it.mediaSources={};var sc=function(e,t){var a=it.mediaSources[e];if(a){a.trigger({type:"sourceopen",swfId:t})}else{throw new Error("Media Source not found (Video.js)")}},oc=function(){return!!e.MediaSource&&!!e.MediaSource.isTypeSupported&&e.MediaSource.isTypeSupported("video/mp4;codecs=\"avc1.4d400d,mp4a.40.2\"")},lc=function(){this.MediaSource={open:sc,supportsNativeMediaSources:oc};if(oc()){return new nc}throw new Error("Cannot use create a virtual MediaSource for this video")};lc.open=sc;lc.supportsNativeMediaSources=oc;var dc={createObjectURL:function(t){var a=void 0;if(t instanceof nc){a=e.URL.createObjectURL(t.nativeMediaSource_);t.url_=a;return a}if(!(t instanceof nc)){a=e.URL.createObjectURL(t);t.url_=a;return a}a="blob:vjs-media-source/"+ic;ic++;it.mediaSources[a]=t;return a}};it.MediaSource=lc;it.URL=dc;var pc=it.EventTarget,uc=it.mergeOptions,cc=function(e,t){for(var a=void 0,r=uc(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),n=0,s;n")}return function(){}};function yt(){}var Tc=function(){function e(t,a,r,n){dp(this,e);this.callbacks_=[];this.pendingCallback_=null;this.timestampOffset_=0;this.mediaSource=t;this.processedAppend_=!1;this.type_=r;this.mimeType_=a;this.logger_=bc("SourceUpdater["+r+"]["+a+"]");if("closed"===t.readyState){t.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,a,n))}else{this.createSourceBuffer_(a,n)}}pp(e,[{key:"createSourceBuffer_",value:function(e,t){var a=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(e);this.logger_("created SourceBuffer");if(t){t.trigger("sourcebufferadded");if(2>this.mediaSource.sourceBuffers.length){t.on("sourcebufferadded",function(){a.start_()});return}}this.start_()}},{key:"start_",value:function(){var e=this;this.started_=!0;this.onUpdateendCallback_=function(){var t=e.pendingCallback_;e.pendingCallback_=null;e.sourceBuffer_.removing=!1;e.logger_("buffered ["+Su(e.buffered())+"]");if(t){t()}e.runCallback_()};this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_);this.runCallback_()}},{key:"abort",value:function(e){var t=this;if(this.processedAppend_){this.queueCallback_(function(){t.sourceBuffer_.abort()},e)}}},{key:"appendBuffer",value:function(e,t){var a=this;this.processedAppend_=!0;this.queueCallback_(function(){if(e.videoSegmentTimingInfoCallback){a.sourceBuffer_.addEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback)}a.sourceBuffer_.appendBuffer(e.bytes)},function(){if(e.videoSegmentTimingInfoCallback){a.sourceBuffer_.removeEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback)}t()})}},{key:"buffered",value:function(){if(!this.sourceBuffer_){return it.createTimeRanges()}return this.sourceBuffer_.buffered}},{key:"remove",value:function(e,t){var a=this,r=2 "+t+"]");a.sourceBuffer_.removing=!0;a.sourceBuffer_.remove(e,t)},r)}}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||!!this.pendingCallback_&&this.pendingCallback_!==yt}},{key:"timestampOffset",value:function(e){var t=this;if("undefined"!=typeof e){this.queueCallback_(function(){t.sourceBuffer_.timestampOffset=e;t.runCallback_()});this.timestampOffset_=e}return this.timestampOffset_}},{key:"queueCallback_",value:function(e,t){this.callbacks_.push([e.bind(this),t]);this.runCallback_()}},{key:"runCallback_",value:function(){var e;if(!this.updating()&&this.callbacks_.length&&this.started_){e=this.callbacks_.shift();this.pendingCallback_=e[1];e[0]()}}},{key:"dispose",value:function(){var e=this,t=function t(){if(e.sourceBuffer_&&"open"===e.mediaSource.readyState){e.sourceBuffer_.abort()}e.sourceBuffer_.removeEventListener("updateend",t)};this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_);if(this.sourceBuffer_.removing){this.sourceBuffer_.addEventListener("updateend",t)}else{t()}}}]);return e}(),vc={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,BUFFER_LOW_WATER_LINE_RATE:1},Sc={FAILURE:2,TIMEOUT:-101,ABORTED:-102},kc=function(e){e.forEach(function(e){e.abort()})},Cc=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}},Ec=function(e){var t=e.target,a=Date.now()-t.requestTime,r={bandwidth:1/0,bytesReceived:0,roundTripTime:a||0};r.bytesReceived=e.loaded;r.bandwidth=Math.floor(1e3*(8*(r.bytesReceived/r.roundTripTime)));return r},Pc=function(e,t){if(t.timedout){return{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Sc.TIMEOUT,xhr:t}}if(t.aborted){return{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Sc.ABORTED,xhr:t}}if(e){return{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Sc.FAILURE,xhr:t}}return null},Ic=function(e,t){return function(a,r){var n=r.response,i=Pc(a,r);if(i){return t(i,e)}if(16!==n.byteLength){return t({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Sc.FAILURE,xhr:r},e)}var s=new DataView(n);e.key.bytes=new Uint32Array([s.getUint32(0),s.getUint32(4),s.getUint32(8),s.getUint32(12)]);return t(null,e)}},Lc=function(e,t,a){return function(r,n){var i=n.response,s=Pc(r,n);if(s){return a(s,e)}if(0===i.byteLength){return a({status:n.status,message:"Empty HLS segment content at URL: "+n.uri,code:Sc.FAILURE,xhr:n},e)}e.map.bytes=new Uint8Array(n.response);if(t&&!t.isInitialized()){t.init()}e.map.timescales=Nl.timescale(e.map.bytes);e.map.videoTrackIds=Nl.videoTrackIds(e.map.bytes);return a(null,e)}},xc=function(e,t,a){return function(r,n){var i=n.response,s=Pc(r,n),o=void 0;if(s){return a(s,e)}if(0===i.byteLength){return a({status:n.status,message:"Empty HLS segment content at URL: "+n.uri,code:Sc.FAILURE,xhr:n},e)}e.stats=Cc(n);if(e.key){e.encryptedBytes=new Uint8Array(n.response)}else{e.bytes=new Uint8Array(n.response)}if(t&&e.map&&e.map.bytes){if(!t.isInitialized()){t.init()}o=t.parse(e.bytes,e.map.videoTrackIds,e.map.timescales);if(o&&o.captions){e.captionStreams=o.captionStreams;e.fmp4Captions=o.captions}}return a(null,e)}},Ac=function(e,t,a){e.addEventListener("message",function r(n){if(n.data.source===t.requestId){e.removeEventListener("message",r);var i=n.data.decrypted;t.bytes=new Uint8Array(i.bytes,i.byteOffset,i.byteLength);return a(null,t)}});var r;if(t.key.bytes.slice){r=t.key.bytes.slice()}else{r=new Uint32Array(Array.prototype.slice.call(t.key.bytes))}e.postMessage(tu({source:t.requestId,encrypted:t.encryptedBytes,key:r,iv:t.key.iv}),[t.encryptedBytes.buffer,r.buffer])},Dc=function(e,t,a){var r=0,n=!1;return function(i,s){if(n){return}if(i){n=!0;kc(e);return a(i,s)}r+=1;if(r===e.length){s.endOfAllRequests=Date.now();if(s.encryptedBytes){return Ac(t,s,a)}return a(null,s)}}},wc=function(e,t){return function(a){e.stats=it.mergeOptions(e.stats,Ec(a));if(!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived){e.stats.firstBytesReceivedAt=Date.now()}return t(a,e)}},Oc=function(e,t,a,r,n,i,s){var o=[],l=Dc(o,a,s);if(n.key&&!n.key.bytes){var d=it.mergeOptions(t,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),p=Ic(n,l),u=e(d,p);o.push(u)}if(n.map&&!n.map.bytes){var c=it.mergeOptions(t,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:Qp(n.map)}),m=Lc(n,r,l),g=e(c,m);o.push(g)}var y=it.mergeOptions(t,{uri:n.resolvedUri,responseType:"arraybuffer",headers:Qp(n)}),h=xc(n,r,l),_=e(y,h);_.addEventListener("progress",wc(n,i));o.push(_);return function(){return kc(o)}},Rc=function(t,a){var r;if(!t){return""}r=e.getComputedStyle(t);if(!r){return""}return r[a]},Uc=function(e,t){var a=e.slice();e.sort(function(e,r){var n=t(e,r);if(0===n){return a.indexOf(e)-a.indexOf(r)}return n})},Mc=function(t,a){var r=void 0,n=void 0;if(t.attributes.BANDWIDTH){r=t.attributes.BANDWIDTH}r=r||e.Number.MAX_VALUE;if(a.attributes.BANDWIDTH){n=a.attributes.BANDWIDTH}n=n||e.Number.MAX_VALUE;return r-n},Nc=function(t,a){var r=void 0,n=void 0;if(t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width){r=t.attributes.RESOLUTION.width}r=r||e.Number.MAX_VALUE;if(a.attributes.RESOLUTION&&a.attributes.RESOLUTION.width){n=a.attributes.RESOLUTION.width}n=n||e.Number.MAX_VALUE;if(r===n&&t.attributes.BANDWIDTH&&a.attributes.BANDWIDTH){return t.attributes.BANDWIDTH-a.attributes.BANDWIDTH}return r-n},Bc=function(t,a,r,n,i){var s=t.playlists.map(function(t){var a=void 0,r=void 0,n=void 0;a=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width;r=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height;n=t.attributes.BANDWIDTH;n=n||e.Number.MAX_VALUE;return{bandwidth:n,width:a,height:r,playlist:t}});Uc(s,function(e,t){return e.bandwidth-t.bandwidth});s=s.filter(function(e){return!Gp.isIncompatible(e.playlist)});var o=s.filter(function(e){return Gp.isEnabled(e.playlist)});if(!o.length){o=s.filter(function(e){return!Gp.isDisabled(e.playlist)})}var l=o.filter(function(e){return e.bandwidth*vc.BANDWIDTH_VARIANCEr||e.height>n});h=y.filter(function(e){return e.width===y[0].width&&e.height===y[0].height});d=h[h.length-1];_=h.filter(function(e){return e.bandwidth===d.bandwidth})[0]}var f=_||g||p||o[0]||s[0];return f?f.playlist:null},jc=function(e){var t=e.master,a=e.currentTime,r=e.bandwidth,n=e.duration,i=e.segmentDuration,s=e.timeUntilRebuffer,o=e.currentTimeline,l=e.syncController,d=t.playlists.filter(function(e){return!Gp.isIncompatible(e)}),p=d.filter(Gp.isEnabled);if(!p.length){p=d.filter(function(e){return!Gp.isDisabled(e)})}var u=p.filter(Gp.hasAttribute.bind(null,"BANDWIDTH")),c=u.map(function(e){var t=l.getSyncPoint(e,n,o,a),d=t?1:2,p=Gp.estimateSegmentRequestTime(i,r,e);return{playlist:e,rebufferingImpact:p*d-s}}),m=c.filter(function(e){return 0>=e.rebufferingImpact});Uc(m,function(e,t){return Mc(t.playlist,e.playlist)});if(m.length){return m[0]}Uc(c,function(e,t){return e.rebufferingImpact-t.rebufferingImpact});return c[0]||null},Fc=function(e,t,a){for(var r in a){if(!e[r]){t.trigger({type:"usage",name:"hls-608"});var n=t.textTracks().getTrackById(r);if(n){e[r]=n}else{e[r]=t.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track}}}},Hc=function(e){var t=e.inbandTextTracks,a=e.captionArray,r=e.timestampOffset;if(!a){return}var n=window.WebKitDataCue||window.VTTCue;a.forEach(function(e){var a=e.stream,i=e.startTime,s=e.endTime;if(!t[a]){return}i+=r;s+=r;t[a].addCue(new n(i,s,e.text))})},qc=function(e,t,a){if(!e||!t){return!1}var r=e.segments,n=a===r.length;return e.endList&&"open"===t.readyState&&n},Vc=function(e){return"number"==typeof e&&isFinite(e)},Wc=function(e,t,a){if("main"!==e||!t||!a){return null}if(!a.containsAudio&&!a.containsVideo){return"Neither audio nor video found in segment."}if(t.containsVideo&&!a.containsVideo){return"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."}if(!t.containsVideo&&a.containsVideo){return"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."}return null},zc=function(e,t,a){var r;if(e.length&&0 "+r+"] in timeline ["+p+"]"].join(" ")},$c=function(t){cp(a,t);function a(e){dp(this,a);var t=mp(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));if(!e){throw new TypeError("Initialization settings are required")}if("function"!=typeof e.currentTime){throw new TypeError("No currentTime getter specified")}if(!e.mediaSource){throw new TypeError("No MediaSource specified")}t.bandwidth=e.bandwidth;t.throughput={rate:0,count:0};t.roundTrip=NaN;t.resetStats_();t.mediaIndex=null;t.hasPlayed_=e.hasPlayed;t.currentTime_=e.currentTime;t.seekable_=e.seekable;t.seeking_=e.seeking;t.duration_=e.duration;t.mediaSource_=e.mediaSource;t.hls_=e.hls;t.loaderType_=e.loaderType;t.startingMedia_=void 0;t.segmentMetadataTrack_=e.segmentMetadataTrack;t.goalBufferLength_=e.goalBufferLength;t.sourceType_=e.sourceType;t.inbandTextTracks_=e.inbandTextTracks;t.state_="INIT";t.checkBufferTimeout_=null;t.error_=void 0;t.currentTimeline_=-1;t.pendingSegment_=null;t.mimeType_=null;t.sourceUpdater_=null;t.xhrOptions_=null;t.activeInitSegmentId_=null;t.initSegments_={};t.cacheEncryptionKeys_=e.cacheEncryptionKeys;t.keyCache_={};if("main"===t.loaderType_){t.captionParser_=new md}else{t.captionParser_=null}t.decrypter_=e.decrypter;t.syncController_=e.syncController;t.syncPoint_={segmentIndex:0,time:0};t.syncController_.on("syncinfoupdate",function(){return t.trigger("syncinfoupdate")});t.mediaSource_.addEventListener("sourceopen",function(){return t.ended_=!1});t.fetchAtBuffer_=!1;t.logger_=bc("SegmentLoader["+t.loaderType_+"]");Object.defineProperty(t,"state",{get:function(){return this.state_},set:function(e){if(e!==this.state_){this.logger_(this.state_+" -> "+e);this.state_=e}}});return t}pp(a,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0;this.mediaRequests=0;this.mediaRequestsAborted=0;this.mediaRequestsTimedout=0;this.mediaRequestsErrored=0;this.mediaTransferDuration=0;this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED";this.pause();this.abort_();if(this.sourceUpdater_){this.sourceUpdater_.dispose()}this.resetStats_();if(this.captionParser_){this.captionParser_.reset()}}},{key:"abort",value:function(){if("WAITING"!==this.state){if(this.pendingSegment_){this.pendingSegment_=null}return}this.abort_();this.state="READY";if(!this.paused()){this.monitorBuffer_()}}},{key:"abort_",value:function(){if(this.pendingSegment_){this.pendingSegment_.abortRequests()}this.pendingSegment_=null}},{key:"error",value:function(e){if("undefined"!=typeof e){this.error_=e}this.pendingSegment_=null;return this.error_}},{key:"endOfStream",value:function(){this.ended_=!0;this.pause();this.trigger("ended")}},{key:"buffered_",value:function(){if(!this.sourceUpdater_){return it.createTimeRanges()}return this.sourceUpdater_.buffered()}},{key:"initSegment",value:function(e){var t=1 "+(e.id||e.uri)+"]");this.trigger("syncinfoupdate");if("INIT"===this.state&&this.couldBeginLoading_()){return this.init_()}if(!a||a.uri!==e.uri){if(null!==this.mediaIndex){this.resyncLoader()}return}var i=e.mediaSequence-a.mediaSequence;this.logger_("live window shift ["+i+"]");if(null!==this.mediaIndex){this.mediaIndex-=i}if(r){r.mediaIndex-=i;if(0<=r.mediaIndex){r.segment=e.segments[r.mediaIndex]}}this.syncController_.saveExpiredSegmentInfo(a,e)}},{key:"pause",value:function(){if(this.checkBufferTimeout_){e.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=null}}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(e,t){if(this.mimeType_){return}this.mimeType_=e;this.sourceBufferEmitter_=t;if("INIT"===this.state&&this.couldBeginLoading_()){this.init_()}}},{key:"resetEverything",value:function(e){this.ended_=!1;this.resetLoader();this.remove(0,this.duration_(),e);if(this.captionParser_){this.captionParser_.clearAllCaptions()}this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1;this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null;this.syncPoint_=null;this.abort()}},{key:"remove",value:function(e,t,a){if(this.sourceUpdater_){this.sourceUpdater_.remove(e,t,a)}Pu(e,t,this.segmentMetadataTrack_);if(this.inbandTextTracks_){for(var r in this.inbandTextTracks_){Pu(e,t,this.inbandTextTracks_[r])}}}},{key:"monitorBuffer_",value:function(){if(this.checkBufferTimeout_){e.clearTimeout(this.checkBufferTimeout_)}this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){if("READY"===this.state){this.fillBuffer_()}if(this.checkBufferTimeout_){e.clearTimeout(this.checkBufferTimeout_)}this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(this.sourceUpdater_.updating()){return}if(!this.syncPoint_){this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_())}var e=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(!e){return}if(this.isEndOfStream_(e.mediaIndex)){this.endOfStream();return}if(e.mediaIndex===this.playlist_.segments.length-1&&"ended"===this.mediaSource_.readyState&&!this.seeking_()){return}if(e.timeline!==this.currentTimeline_){this.syncController_.reset();e.timestampOffset=e.startOfSegment;if(this.captionParser_){this.captionParser_.clearAllCaptions()}}this.loadSegment_(e)}},{key:"isEndOfStream_",value:function(e){var t=1=this.goalBufferLength_()){return null}if(!r&&1<=l){return null}if(null===i){a=this.getSyncSegmentCandidate_(t);return this.generateSegmentInfo_(t,a,null,!0)}if(null!==a){t.segments[a];o=s;return this.generateSegmentInfo_(t,a+1,o,!1)}if(this.fetchAtBuffer_){var d=Gp.getMediaInfoForTime(t,s,i.segmentIndex,i.time);a=d.mediaIndex;o=d.startTime}else{var p=Gp.getMediaInfoForTime(t,n,i.segmentIndex,i.time);a=p.mediaIndex;o=p.startTime}return this.generateSegmentInfo_(t,a,o,!1)}},{key:"getSyncSegmentCandidate_",value:function(e){var t=this;if(-1===this.currentTimeline_){return 0}var a=e.segments.map(function(e,t){return{timeline:e.timeline,segmentIndex:t}}).filter(function(e){return e.timeline===t.currentTimeline_});if(a.length){return a[Math.min(a.length-1,1)].segmentIndex}return Math.max(e.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(e,t,a,r){if(0>t||t>=e.segments.length){return null}var n=e.segments[t];return{requestId:"segment-loader-"+Math.random(),uri:n.resolvedUri,mediaIndex:t,isSyncRequest:r,startOfSegment:a,playlist:e,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:n.timeline,duration:n.duration,segment:n}}},{key:"abortRequestEarly_",value:function(e){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH){return!1}if(1e3>Date.now()-(e.firstBytesReceivedAt||Date.now())){return!1}var t=this.currentTime_(),a=e.bandwidth,r=this.pendingSegment_.duration,n=Gp.estimateSegmentRequestTime(r,a,this.playlist_,e.bytesReceived),i=ku(this.buffered_(),t,this.hls_.tech_.playbackRate())-1;if(n<=i){return!1}var s=jc({master:this.hls_.playlists.master,currentTime:t,bandwidth:a,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:i,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!s){return}var o=n-i-s.rebufferingImpact,l=.5;if(i<=hu){l=1}if(!s.playlist||s.playlist.uri===this.playlist_.uri||o3*e.playlist.targetDuration){this.resetEverything();return}if(a){this.trigger("bandwidthupdate")}this.trigger("progress");if(this.isEndOfStream_(e.mediaIndex+1,e.playlist)){this.endOfStream()}if(!this.paused()){this.monitorBuffer_()}}},{key:"recordThroughput_",value:function(e){var t=this.throughput.rate,a=Date.now()-e.endOfAllRequests+1,r=Math.floor(1e3*(8*(e.byteLength/a)));this.throughput.rate+=(r-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(t){if(!this.segmentMetadataTrack_){return}var a=t.segment,r=a.start,n=a.end;if(!Vc(r)||!Vc(n)){return}Pu(r,n,this.segmentMetadataTrack_);var i=e.WebKitDataCue||e.VTTCue,s={custom:a.custom,dateTimeObject:a.dateTimeObject,dateTimeString:a.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.uri,start:r,end:n},o=JSON.stringify(s),l=new i(r,n,o);l.value=s;this.segmentMetadataTrack_.addCue(l)}}]);return a}(it.EventTarget),Kc=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},Yc=new Uint8Array(["\n","\n"].map(function(e){return e.charCodeAt(0)})),Xc=function(t){cp(a,t);function a(e){var t=1=n.adStartTime&&t<=n.adEndTime){return n}}return null},Jc=function(t,a){var r=2=u){l=u;o={time:p.start,segmentIndex:d}}}}return o}},{name:"Discontinuity",run:function(e,t,a,r,n){var s=null;n=n||0;if(t.discontinuityStarts&&t.discontinuityStarts.length){for(var o=null,l=0;l=c){o=c;s={time:u.time,segmentIndex:d}}}}}return s}},{name:"Playlist",run:function(e,t){if(t.syncInfo){var a={time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence};return a}return null}}],tm=function(e){cp(t,e);function t(){dp(this,t);var e=mp(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));e.inspectCache_=void 0;e.timelines=[];e.discontinuities=[];e.datetimeToDisplayTime=null;e.logger_=bc("SyncController");return e}pp(t,[{key:"getSyncPoint",value:function(e,t,a,r){var n=this.runStrategies_(e,t,a,r);if(!n.length){return null}return this.selectSyncPoint_(n,{key:"time",value:r})}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments){return null}var a=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!a.length){return null}var r=this.selectSyncPoint_(a,{key:"segmentIndex",value:0});if(0l){var d=void 0;if(0>o){d=a.start-Dp(t,e.mediaIndex,n)}else{d=a.end+Dp(t,e.mediaIndex+1,n)}this.discontinuities[s]={time:d,accuracy:l}}}}}}]);return t}(it.EventTarget),am=new ct("./decrypter-worker.worker.js",function(){var e=this,t=function(){function t(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}var a=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}},r=function(){function e(e,t){for(var a=0,r;ao;o++){d[(u[o]=o<<1^283*(o>>7))^o]=o}for(l=p=0;!r[l];l^=c||1,p=d[p]||1){y=p^p<<1^p<<2^p<<3^p<<4;y=99^(y>>8^255&y);r[l]=y;n[y]=l;g=u[m=u[c=u[l]]];_=16843009*g^65537*m^257*c^16843008*l;h=257*u[y]^16843008*y;for(o=0;4>o;o++){t[o][l]=h=h<<24^h>>>8;a[o][y]=_=_<<24^_>>>8}}for(o=0;5>o;o++){t[o]=t[o].slice(0);a[o]=a[o].slice(0)}return e},o=null,l=function(){function e(t){a(this,e);if(!o){o=s()}this._tables=[[o[0][0].slice(),o[0][1].slice(),o[0][2].slice(),o[0][3].slice(),o[0][4].slice()],[o[1][0].slice(),o[1][1].slice(),o[1][2].slice(),o[1][3].slice(),o[1][4].slice()]];var r=void 0,n=void 0,l=void 0,d=void 0,p=void 0,u=this._tables[0][4],c=this._tables[1],m=t.length,g=1;if(4!==m&&6!==m&&8!==m){throw new Error("Invalid aes key size")}d=t.slice(0);p=[];this._key=[d,p];for(r=m;r<4*m+28;r++){l=d[r-1];if(0==r%m||8===m&&4==r%m){l=u[l>>>24]<<24^u[255&l>>16]<<16^u[255&l>>8]<<8^u[255&l];if(0==r%m){l=l<<8^l>>>24^g<<24;g=g<<1^283*(g>>7)}}d[r]=d[r-m]^l}for(n=0;r;n++,r--){l=d[3&n?r:r-4];if(4>=r||4>n){p[n]=l}else{p[n]=c[0][u[l>>>24]]^c[1][u[255&l>>16]]^c[2][u[255&l>>8]]^c[3][u[255&l]]}}}e.prototype.decrypt=function(e,t,r,n,s,o){var l=this._key[1],p=e^l[0],u=n^l[1],m=r^l[2],g=t^l[3],y=void 0,h=void 0,_=void 0,f=l.length/4-2,T=void 0,v=4,S=this._tables[1],k=S[0],C=S[1],E=S[2],P=S[3],I=S[4];for(T=0;T>>24]^C[255&u>>16]^E[255&m>>8]^P[255&g]^l[v];h=k[u>>>24]^C[255&m>>16]^E[255&g>>8]^P[255&p]^l[v+1];_=k[m>>>24]^C[255&g>>16]^E[255&p>>8]^P[255&u]^l[v+2];g=k[g>>>24]^C[255&p>>16]^E[255&u>>8]^P[255&m]^l[v+3];v+=4;p=y;u=h;m=_}for(T=0;4>T;T++){s[(3&-T)+o]=I[p>>>24]<<24^I[255&u>>16]<<16^I[255&m>>8]<<8^I[255&g]^l[v++];y=p;p=u;u=m;m=g;g=y}};return e}(),d=function(){function e(){a(this,e);this.listeners={}}e.prototype.on=function(e,t){if(!this.listeners[e]){this.listeners[e]=[]}this.listeners[e].push(t)};e.prototype.off=function(e,t){if(!this.listeners[e]){return!1}var a=this.listeners[e].indexOf(t);this.listeners[e].splice(a,1);return-1>8|e>>>24},c=function(e,t,a){var r=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),n=new l(Array.prototype.slice.call(t)),i=new Uint8Array(e.byteLength),s=new Int32Array(i.buffer),o=void 0,d=void 0,p=void 0,c=void 0,m=void 0,g=void 0,y=void 0,h=void 0,_=void 0;o=a[0];d=a[1];p=a[2];c=a[3];for(_=0;_=i){e.masterPlaylistLoader_.media(t)}e.tech_.trigger("bandwidthupdate")});this.mainSegmentLoader_.on("progress",function(){e.trigger("progress")});this.mainSegmentLoader_.on("error",function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())});this.mainSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()});this.mainSegmentLoader_.on("timestampoffset",function(){e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})});this.audioSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()});this.mainSegmentLoader_.on("ended",function(){e.onEndOfStream()});this.mainSegmentLoader_.on("earlyabort",function(){e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)});this.mainSegmentLoader_.on("reseteverything",function(){e.tech_.trigger("hls-reset")});this.mainSegmentLoader_.on("segmenttimemapping",function(t){e.tech_.trigger({type:"hls-segment-time-mapping",mapping:t.mapping})});this.audioSegmentLoader_.on("ended",function(){e.onEndOfStream()})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load();if(this.mediaTypes_.AUDIO.activePlaylistLoader){this.audioSegmentLoader_.load()}if(this.mediaTypes_.SUBTITLES.activePlaylistLoader){this.subtitleSegmentLoader_.load()}}},{key:"smoothQualityChange_",value:function(){var e=this.selectPlaylist();if(e!==this.masterPlaylistLoader_.media()){this.masterPlaylistLoader_.media(e);this.mainSegmentLoader_.resetLoader()}}},{key:"fastQualityChange_",value:function(){var e=this,t=this.selectPlaylist();if(t===this.masterPlaylistLoader_.media()){return}this.masterPlaylistLoader_.media(t);this.mainSegmentLoader_.resetEverything(function(){if(it.browser.IE_VERSION||it.browser.IS_EDGE){e.tech_.setCurrentTime(e.tech_.currentTime()+.04)}else{e.tech_.setCurrentTime(e.tech_.currentTime())}})}},{key:"play",value:function(){if(this.setupFirstPlay()){return}if(this.tech_.ended()){this.seekTo_(0)}if(this.hasPlayed_()){this.load()}var e=this.tech_.seekable();if(this.tech_.duration()===1/0){if(this.tech_.currentTime()e.end(0)||e.start(0)>t.end(0)){this.seekable_=e}else{this.seekable_=it.createTimeRanges([[t.start(0)>e.start(0)?t.start(0):e.start(0),t.end(0) "+a);try{e.mediaSource.duration=a}catch(t){it.log.warn("Failed to set media source duration",t)}e.tech_.trigger("durationchange");e.mediaSource.removeEventListener("sourceopen",t)};if(0t.length){this.error="No compatible SourceBuffer configuration for the variant stream:"+e.resolvedUri;return this.mediaSource.endOfStream("decode")}this.configureLoaderMimeTypes_(t);this.excludeIncompatibleVariants_(e)}},{key:"configureLoaderMimeTypes_",value:function(e){var t=1=t.end(t.length-1))){return this.techWaiting_()}if(5<=this.consecutiveUpdates&&e===this.lastRecordedTime){this.consecutiveUpdates++;this.waiting_()}else if(e===this.lastRecordedTime){this.consecutiveUpdates++}else{this.consecutiveUpdates=0;this.lastRecordedTime=e}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0;if(this.timer_){this.logger_("cancelTimer_");clearTimeout(this.timer_)}this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var e=this.tech_.seeking();if(!e){return!1}var t=this.seekable(),a=this.tech_.currentTime(),r=this.afterSeekableWindow_(t,a,this.media(),this.allowSeeksWithinUnsafeLiveWindow),n=void 0;if(r){var i=t.end(t.length-1);n=i}if(this.beforeSeekableWindow_(t,a)){var s=t.start(0);n=s+_u}if("undefined"!=typeof n){this.logger_("Trying to seek outside of seekable at time "+a+" with "+("seekable range "+Su(t)+". Seeking to ")+(n+"."));this.seekTo(n);return!0}return!1}},{key:"waiting_",value:function(){if(this.techWaiting_()){return}var e=this.tech_.currentTime(),t=this.tech_.buffered(),a=bu(t,e);if(a.length&&e+3<=a.end(0)){this.cancelTimer_();this.seekTo(e);this.logger_("Stopped at "+e+" while inside a buffered region "+("["+a.start(0)+" -> "+a.end(0)+"]. Attempting to resume playback by seeking to the current time."));this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})}}},{key:"techWaiting_",value:function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_()){return!0}if(this.tech_.seeking()||null!==this.timer_){return!0}if(this.beforeSeekableWindow_(e,t)){var a=e.end(e.length-1);this.logger_("Fell out of live window at time "+t+". Seeking to "+("live point (seekable end) "+a));this.cancelTimer_();this.seekTo(a);this.tech_.trigger({type:"usage",name:"hls-live-resync"});return!0}var r=this.tech_.buffered(),n=Tu(r,t);if(this.videoUnderflow_(n,r,t)){this.cancelTimer_();this.seekTo(t);this.tech_.trigger({type:"usage",name:"hls-video-underflow"});return!0}if(0n){return!0}return!1}},{key:"beforeSeekableWindow_",value:function(e,t){if(e.length&&0t-n&&2t){it.log.warn("value of Hls."+e+" must be greater than or equal to 0");return}vc[e]=t}})});var Lm=function(e){var t=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;if(t.test(e)){return"hls"}var a=/^application\/dash\+xml/i;if(a.test(e)){return"dash"}return null},xm=function(e,t){for(var a=t.media(),r=-1,n=0;n\n * Copyright Brightcove, Inc. \n * Available under Apache License Version 2.0\n * \n *\n * Includes vtt.js \n * Available under Apache License Version 2.0\n * \n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('global/window'), require('global/document')) :\n typeof define === 'function' && define.amd ? define(['./window', './document'], factory) :\n (global = global || self, global.videojs = factory(global.window, global.document));\n}(this, function (window$1, document) {\n window$1 = window$1 && window$1.hasOwnProperty('default') ? window$1['default'] : window$1;\n document = document && document.hasOwnProperty('default') ? document['default'] : document;\n\n var version = \"7.5.5\";\n\n function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n }\n\n function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n }\n\n function isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n }\n\n function _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n _construct = Reflect.construct;\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) _setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n }\n\n function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n }\n\n function _taggedTemplateLiteralLoose(strings, raw) {\n if (!raw) {\n raw = strings.slice(0);\n }\n\n strings.raw = raw;\n return strings;\n }\n\n /**\n * @file create-logger.js\n * @module create-logger\n */\n\n var history = [];\n /**\n * Log messages to the console and history based on the type of message\n *\n * @private\n * @param {string} type\n * The name of the console method to use.\n *\n * @param {Array} args\n * The arguments to be passed to the matching console method.\n */\n\n var LogByTypeFactory = function LogByTypeFactory(name, log) {\n return function (type, level, args) {\n var lvl = log.levels[level];\n var lvlRegExp = new RegExp(\"^(\" + lvl + \")$\");\n\n if (type !== 'log') {\n // Add the type to the front of the message when it's not \"log\".\n args.unshift(type.toUpperCase() + ':');\n } // Add console prefix after adding to history.\n\n\n args.unshift(name + ':'); // Add a clone of the args at this point to history.\n\n if (history) {\n history.push([].concat(args));\n } // If there's no console then don't try to output messages, but they will\n // still be stored in history.\n\n\n if (!window$1.console) {\n return;\n } // Was setting these once outside of this function, but containing them\n // in the function makes it easier to test cases where console doesn't exist\n // when the module is executed.\n\n\n var fn = window$1.console[type];\n\n if (!fn && type === 'debug') {\n // Certain browsers don't have support for console.debug. For those, we\n // should default to the closest comparable log.\n fn = window$1.console.info || window$1.console.log;\n } // Bail out if there's no console or if this type is not allowed by the\n // current logging level.\n\n\n if (!fn || !lvl || !lvlRegExp.test(type)) {\n return;\n }\n\n fn[Array.isArray(args) ? 'apply' : 'call'](window$1.console, args);\n };\n };\n\n function createLogger(name) {\n // This is the private tracking variable for logging level.\n var level = 'info'; // the curried logByType bound to the specific log and history\n\n var logByType;\n /**\n * Logs plain debug messages. Similar to `console.log`.\n *\n * Due to [limitations](https://github.com/jsdoc3/jsdoc/issues/955#issuecomment-313829149)\n * of our JSDoc template, we cannot properly document this as both a function\n * and a namespace, so its function signature is documented here.\n *\n * #### Arguments\n * ##### *args\n * Mixed[]\n *\n * Any combination of values that could be passed to `console.log()`.\n *\n * #### Return Value\n *\n * `undefined`\n *\n * @namespace\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged.\n */\n\n var log = function log() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n logByType('log', level, args);\n }; // This is the logByType helper that the logging methods below use\n\n\n logByType = LogByTypeFactory(name, log);\n /**\n * Create a new sublogger which chains the old name to the new name.\n *\n * For example, doing `videojs.log.createLogger('player')` and then using that logger will log the following:\n * ```js\n * mylogger('foo');\n * // > VIDEOJS: player: foo\n * ```\n *\n * @param {string} name\n * The name to add call the new logger\n * @return {Object}\n */\n\n log.createLogger = function (subname) {\n return createLogger(name + ': ' + subname);\n };\n /**\n * Enumeration of available logging levels, where the keys are the level names\n * and the values are `|`-separated strings containing logging methods allowed\n * in that logging level. These strings are used to create a regular expression\n * matching the function name being called.\n *\n * Levels provided by Video.js are:\n *\n * - `off`: Matches no calls. Any value that can be cast to `false` will have\n * this effect. The most restrictive.\n * - `all`: Matches only Video.js-provided functions (`debug`, `log`,\n * `log.warn`, and `log.error`).\n * - `debug`: Matches `log.debug`, `log`, `log.warn`, and `log.error` calls.\n * - `info` (default): Matches `log`, `log.warn`, and `log.error` calls.\n * - `warn`: Matches `log.warn` and `log.error` calls.\n * - `error`: Matches only `log.error` calls.\n *\n * @type {Object}\n */\n\n\n log.levels = {\n all: 'debug|log|warn|error',\n off: '',\n debug: 'debug|log|warn|error',\n info: 'log|warn|error',\n warn: 'warn|error',\n error: 'error',\n DEFAULT: level\n };\n /**\n * Get or set the current logging level.\n *\n * If a string matching a key from {@link module:log.levels} is provided, acts\n * as a setter.\n *\n * @param {string} [lvl]\n * Pass a valid level to set a new logging level.\n *\n * @return {string}\n * The current logging level.\n */\n\n log.level = function (lvl) {\n if (typeof lvl === 'string') {\n if (!log.levels.hasOwnProperty(lvl)) {\n throw new Error(\"\\\"\" + lvl + \"\\\" in not a valid log level\");\n }\n\n level = lvl;\n }\n\n return level;\n };\n /**\n * Returns an array containing everything that has been logged to the history.\n *\n * This array is a shallow clone of the internal history record. However, its\n * contents are _not_ cloned; so, mutating objects inside this array will\n * mutate them in history.\n *\n * @return {Array}\n */\n\n\n log.history = function () {\n return history ? [].concat(history) : [];\n };\n /**\n * Allows you to filter the history by the given logger name\n *\n * @param {string} fname\n * The name to filter by\n *\n * @return {Array}\n * The filtered list to return\n */\n\n\n log.history.filter = function (fname) {\n return (history || []).filter(function (historyItem) {\n // if the first item in each historyItem includes `fname`, then it's a match\n return new RegExp(\".*\" + fname + \".*\").test(historyItem[0]);\n });\n };\n /**\n * Clears the internal history tracking, but does not prevent further history\n * tracking.\n */\n\n\n log.history.clear = function () {\n if (history) {\n history.length = 0;\n }\n };\n /**\n * Disable history tracking if it is currently enabled.\n */\n\n\n log.history.disable = function () {\n if (history !== null) {\n history.length = 0;\n history = null;\n }\n };\n /**\n * Enable history tracking if it is currently disabled.\n */\n\n\n log.history.enable = function () {\n if (history === null) {\n history = [];\n }\n };\n /**\n * Logs error messages. Similar to `console.error`.\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as an error\n */\n\n\n log.error = function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return logByType('error', level, args);\n };\n /**\n * Logs warning messages. Similar to `console.warn`.\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as a warning.\n */\n\n\n log.warn = function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n return logByType('warn', level, args);\n };\n /**\n * Logs debug messages. Similar to `console.debug`, but may also act as a comparable\n * log if `console.debug` is not available\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as debug.\n */\n\n\n log.debug = function () {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n return logByType('debug', level, args);\n };\n\n return log;\n }\n\n /**\n * @file log.js\n * @module log\n */\n var log = createLogger('VIDEOJS');\n var createLogger$1 = log.createLogger;\n\n function clean(s) {\n return s.replace(/\\n\\r?\\s*/g, '');\n }\n\n var tsml = function tsml(sa) {\n var s = '',\n i = 0;\n\n for (; i < arguments.length; i++) {\n s += clean(sa[i]) + (arguments[i + 1] || '');\n }\n\n return s;\n };\n\n /**\n * @file obj.js\n * @module obj\n */\n\n /**\n * @callback obj:EachCallback\n *\n * @param {Mixed} value\n * The current key for the object that is being iterated over.\n *\n * @param {string} key\n * The current key-value for object that is being iterated over\n */\n\n /**\n * @callback obj:ReduceCallback\n *\n * @param {Mixed} accum\n * The value that is accumulating over the reduce loop.\n *\n * @param {Mixed} value\n * The current key for the object that is being iterated over.\n *\n * @param {string} key\n * The current key-value for object that is being iterated over\n *\n * @return {Mixed}\n * The new accumulated value.\n */\n var toString = Object.prototype.toString;\n /**\n * Get the keys of an Object\n *\n * @param {Object}\n * The Object to get the keys from\n *\n * @return {string[]}\n * An array of the keys from the object. Returns an empty array if the\n * object passed in was invalid or had no keys.\n *\n * @private\n */\n\n var keys = function keys(object) {\n return isObject(object) ? Object.keys(object) : [];\n };\n /**\n * Array-like iteration for objects.\n *\n * @param {Object} object\n * The object to iterate over\n *\n * @param {obj:EachCallback} fn\n * The callback function which is called for each key in the object.\n */\n\n\n function each(object, fn) {\n keys(object).forEach(function (key) {\n return fn(object[key], key);\n });\n }\n /**\n * Array-like reduce for objects.\n *\n * @param {Object} object\n * The Object that you want to reduce.\n *\n * @param {Function} fn\n * A callback function which is called for each key in the object. It\n * receives the accumulated value and the per-iteration value and key\n * as arguments.\n *\n * @param {Mixed} [initial = 0]\n * Starting value\n *\n * @return {Mixed}\n * The final accumulated value.\n */\n\n function reduce(object, fn, initial) {\n if (initial === void 0) {\n initial = 0;\n }\n\n return keys(object).reduce(function (accum, key) {\n return fn(accum, object[key], key);\n }, initial);\n }\n /**\n * Object.assign-style object shallow merge/extend.\n *\n * @param {Object} target\n * @param {Object} ...sources\n * @return {Object}\n */\n\n function assign(target) {\n for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n sources[_key - 1] = arguments[_key];\n }\n\n if (Object.assign) {\n return Object.assign.apply(Object, [target].concat(sources));\n }\n\n sources.forEach(function (source) {\n if (!source) {\n return;\n }\n\n each(source, function (value, key) {\n target[key] = value;\n });\n });\n return target;\n }\n /**\n * Returns whether a value is an object of any kind - including DOM nodes,\n * arrays, regular expressions, etc. Not functions, though.\n *\n * This avoids the gotcha where using `typeof` on a `null` value\n * results in `'object'`.\n *\n * @param {Object} value\n * @return {boolean}\n */\n\n function isObject(value) {\n return !!value && typeof value === 'object';\n }\n /**\n * Returns whether an object appears to be a \"plain\" object - that is, a\n * direct instance of `Object`.\n *\n * @param {Object} value\n * @return {boolean}\n */\n\n function isPlain(value) {\n return isObject(value) && toString.call(value) === '[object Object]' && value.constructor === Object;\n }\n\n /**\n * @file computed-style.js\n * @module computed-style\n */\n /**\n * A safe getComputedStyle.\n *\n * This is needed because in Firefox, if the player is loaded in an iframe with\n * `display:none`, then `getComputedStyle` returns `null`, so, we do a\n * null-check to make sure that the player doesn't break in these cases.\n *\n * @function\n * @param {Element} el\n * The element you want the computed style of\n *\n * @param {string} prop\n * The property name you want\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397\n */\n\n function computedStyle(el, prop) {\n if (!el || !prop) {\n return '';\n }\n\n if (typeof window$1.getComputedStyle === 'function') {\n var cs = window$1.getComputedStyle(el);\n return cs ? cs[prop] : '';\n }\n\n return '';\n }\n\n function _templateObject() {\n var data = _taggedTemplateLiteralLoose([\"Setting attributes in the second argument of createEl()\\n has been deprecated. Use the third argument instead.\\n createEl(type, properties, attributes). Attempting to set \", \" to \", \".\"]);\n\n _templateObject = function _templateObject() {\n return data;\n };\n\n return data;\n }\n /**\n * Detect if a value is a string with any non-whitespace characters.\n *\n * @private\n * @param {string} str\n * The string to check\n *\n * @return {boolean}\n * Will be `true` if the string is non-blank, `false` otherwise.\n *\n */\n\n function isNonBlankString(str) {\n return typeof str === 'string' && /\\S/.test(str);\n }\n /**\n * Throws an error if the passed string has whitespace. This is used by\n * class methods to be relatively consistent with the classList API.\n *\n * @private\n * @param {string} str\n * The string to check for whitespace.\n *\n * @throws {Error}\n * Throws an error if there is whitespace in the string.\n */\n\n\n function throwIfWhitespace(str) {\n if (/\\s/.test(str)) {\n throw new Error('class has illegal whitespace characters');\n }\n }\n /**\n * Produce a regular expression for matching a className within an elements className.\n *\n * @private\n * @param {string} className\n * The className to generate the RegExp for.\n *\n * @return {RegExp}\n * The RegExp that will check for a specific `className` in an elements\n * className.\n */\n\n\n function classRegExp(className) {\n return new RegExp('(^|\\\\s)' + className + '($|\\\\s)');\n }\n /**\n * Whether the current DOM interface appears to be real (i.e. not simulated).\n *\n * @return {boolean}\n * Will be `true` if the DOM appears to be real, `false` otherwise.\n */\n\n\n function isReal() {\n // Both document and window will never be undefined thanks to `global`.\n return document === window$1.document;\n }\n /**\n * Determines, via duck typing, whether or not a value is a DOM element.\n *\n * @param {Mixed} value\n * The value to check.\n *\n * @return {boolean}\n * Will be `true` if the value is a DOM element, `false` otherwise.\n */\n\n function isEl(value) {\n return isObject(value) && value.nodeType === 1;\n }\n /**\n * Determines if the current DOM is embedded in an iframe.\n *\n * @return {boolean}\n * Will be `true` if the DOM is embedded in an iframe, `false`\n * otherwise.\n */\n\n function isInFrame() {\n // We need a try/catch here because Safari will throw errors when attempting\n // to get either `parent` or `self`\n try {\n return window$1.parent !== window$1.self;\n } catch (x) {\n return true;\n }\n }\n /**\n * Creates functions to query the DOM using a given method.\n *\n * @private\n * @param {string} method\n * The method to create the query with.\n *\n * @return {Function}\n * The query method\n */\n\n function createQuerier(method) {\n return function (selector, context) {\n if (!isNonBlankString(selector)) {\n return document[method](null);\n }\n\n if (isNonBlankString(context)) {\n context = document.querySelector(context);\n }\n\n var ctx = isEl(context) ? context : document;\n return ctx[method] && ctx[method](selector);\n };\n }\n /**\n * Creates an element and applies properties, attributes, and inserts content.\n *\n * @param {string} [tagName='div']\n * Name of tag to be created.\n *\n * @param {Object} [properties={}]\n * Element properties to be applied.\n *\n * @param {Object} [attributes={}]\n * Element attributes to be applied.\n *\n * @param {module:dom~ContentDescriptor} content\n * A content descriptor object.\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n function createEl(tagName, properties, attributes, content) {\n if (tagName === void 0) {\n tagName = 'div';\n }\n\n if (properties === void 0) {\n properties = {};\n }\n\n if (attributes === void 0) {\n attributes = {};\n }\n\n var el = document.createElement(tagName);\n Object.getOwnPropertyNames(properties).forEach(function (propName) {\n var val = properties[propName]; // See #2176\n // We originally were accepting both properties and attributes in the\n // same object, but that doesn't work so well.\n\n if (propName.indexOf('aria-') !== -1 || propName === 'role' || propName === 'type') {\n log.warn(tsml(_templateObject(), propName, val));\n el.setAttribute(propName, val); // Handle textContent since it's not supported everywhere and we have a\n // method for it.\n } else if (propName === 'textContent') {\n textContent(el, val);\n } else {\n el[propName] = val;\n }\n });\n Object.getOwnPropertyNames(attributes).forEach(function (attrName) {\n el.setAttribute(attrName, attributes[attrName]);\n });\n\n if (content) {\n appendContent(el, content);\n }\n\n return el;\n }\n /**\n * Injects text into an element, replacing any existing contents entirely.\n *\n * @param {Element} el\n * The element to add text content into\n *\n * @param {string} text\n * The text content to add.\n *\n * @return {Element}\n * The element with added text content.\n */\n\n function textContent(el, text) {\n if (typeof el.textContent === 'undefined') {\n el.innerText = text;\n } else {\n el.textContent = text;\n }\n\n return el;\n }\n /**\n * Insert an element as the first child node of another\n *\n * @param {Element} child\n * Element to insert\n *\n * @param {Element} parent\n * Element to insert child into\n */\n\n function prependTo(child, parent) {\n if (parent.firstChild) {\n parent.insertBefore(child, parent.firstChild);\n } else {\n parent.appendChild(child);\n }\n }\n /**\n * Check if an element has a class name.\n *\n * @param {Element} element\n * Element to check\n *\n * @param {string} classToCheck\n * Class name to check for\n *\n * @return {boolean}\n * Will be `true` if the element has a class, `false` otherwise.\n *\n * @throws {Error}\n * Throws an error if `classToCheck` has white space.\n */\n\n function hasClass(element, classToCheck) {\n throwIfWhitespace(classToCheck);\n\n if (element.classList) {\n return element.classList.contains(classToCheck);\n }\n\n return classRegExp(classToCheck).test(element.className);\n }\n /**\n * Add a class name to an element.\n *\n * @param {Element} element\n * Element to add class name to.\n *\n * @param {string} classToAdd\n * Class name to add.\n *\n * @return {Element}\n * The DOM element with the added class name.\n */\n\n function addClass(element, classToAdd) {\n if (element.classList) {\n element.classList.add(classToAdd); // Don't need to `throwIfWhitespace` here because `hasElClass` will do it\n // in the case of classList not being supported.\n } else if (!hasClass(element, classToAdd)) {\n element.className = (element.className + ' ' + classToAdd).trim();\n }\n\n return element;\n }\n /**\n * Remove a class name from an element.\n *\n * @param {Element} element\n * Element to remove a class name from.\n *\n * @param {string} classToRemove\n * Class name to remove\n *\n * @return {Element}\n * The DOM element with class name removed.\n */\n\n function removeClass(element, classToRemove) {\n if (element.classList) {\n element.classList.remove(classToRemove);\n } else {\n throwIfWhitespace(classToRemove);\n element.className = element.className.split(/\\s+/).filter(function (c) {\n return c !== classToRemove;\n }).join(' ');\n }\n\n return element;\n }\n /**\n * The callback definition for toggleClass.\n *\n * @callback module:dom~PredicateCallback\n * @param {Element} element\n * The DOM element of the Component.\n *\n * @param {string} classToToggle\n * The `className` that wants to be toggled\n *\n * @return {boolean|undefined}\n * If `true` is returned, the `classToToggle` will be added to the\n * `element`. If `false`, the `classToToggle` will be removed from\n * the `element`. If `undefined`, the callback will be ignored.\n */\n\n /**\n * Adds or removes a class name to/from an element depending on an optional\n * condition or the presence/absence of the class name.\n *\n * @param {Element} element\n * The element to toggle a class name on.\n *\n * @param {string} classToToggle\n * The class that should be toggled.\n *\n * @param {boolean|module:dom~PredicateCallback} [predicate]\n * See the return value for {@link module:dom~PredicateCallback}\n *\n * @return {Element}\n * The element with a class that has been toggled.\n */\n\n function toggleClass(element, classToToggle, predicate) {\n // This CANNOT use `classList` internally because IE11 does not support the\n // second parameter to the `classList.toggle()` method! Which is fine because\n // `classList` will be used by the add/remove functions.\n var has = hasClass(element, classToToggle);\n\n if (typeof predicate === 'function') {\n predicate = predicate(element, classToToggle);\n }\n\n if (typeof predicate !== 'boolean') {\n predicate = !has;\n } // If the necessary class operation matches the current state of the\n // element, no action is required.\n\n\n if (predicate === has) {\n return;\n }\n\n if (predicate) {\n addClass(element, classToToggle);\n } else {\n removeClass(element, classToToggle);\n }\n\n return element;\n }\n /**\n * Apply attributes to an HTML element.\n *\n * @param {Element} el\n * Element to add attributes to.\n *\n * @param {Object} [attributes]\n * Attributes to be applied.\n */\n\n function setAttributes(el, attributes) {\n Object.getOwnPropertyNames(attributes).forEach(function (attrName) {\n var attrValue = attributes[attrName];\n\n if (attrValue === null || typeof attrValue === 'undefined' || attrValue === false) {\n el.removeAttribute(attrName);\n } else {\n el.setAttribute(attrName, attrValue === true ? '' : attrValue);\n }\n });\n }\n /**\n * Get an element's attribute values, as defined on the HTML tag.\n *\n * Attributes are not the same as properties. They're defined on the tag\n * or with setAttribute.\n *\n * @param {Element} tag\n * Element from which to get tag attributes.\n *\n * @return {Object}\n * All attributes of the element. Boolean attributes will be `true` or\n * `false`, others will be strings.\n */\n\n function getAttributes(tag) {\n var obj = {}; // known boolean attributes\n // we can check for matching boolean properties, but not all browsers\n // and not all tags know about these attributes, so, we still want to check them manually\n\n var knownBooleans = ',' + 'autoplay,controls,playsinline,loop,muted,default,defaultMuted' + ',';\n\n if (tag && tag.attributes && tag.attributes.length > 0) {\n var attrs = tag.attributes;\n\n for (var i = attrs.length - 1; i >= 0; i--) {\n var attrName = attrs[i].name;\n var attrVal = attrs[i].value; // check for known booleans\n // the matching element property will return a value for typeof\n\n if (typeof tag[attrName] === 'boolean' || knownBooleans.indexOf(',' + attrName + ',') !== -1) {\n // the value of an included boolean attribute is typically an empty\n // string ('') which would equal false if we just check for a false value.\n // we also don't want support bad code like autoplay='false'\n attrVal = attrVal !== null ? true : false;\n }\n\n obj[attrName] = attrVal;\n }\n }\n\n return obj;\n }\n /**\n * Get the value of an element's attribute.\n *\n * @param {Element} el\n * A DOM element.\n *\n * @param {string} attribute\n * Attribute to get the value of.\n *\n * @return {string}\n * The value of the attribute.\n */\n\n function getAttribute(el, attribute) {\n return el.getAttribute(attribute);\n }\n /**\n * Set the value of an element's attribute.\n *\n * @param {Element} el\n * A DOM element.\n *\n * @param {string} attribute\n * Attribute to set.\n *\n * @param {string} value\n * Value to set the attribute to.\n */\n\n function setAttribute(el, attribute, value) {\n el.setAttribute(attribute, value);\n }\n /**\n * Remove an element's attribute.\n *\n * @param {Element} el\n * A DOM element.\n *\n * @param {string} attribute\n * Attribute to remove.\n */\n\n function removeAttribute(el, attribute) {\n el.removeAttribute(attribute);\n }\n /**\n * Attempt to block the ability to select text.\n */\n\n function blockTextSelection() {\n document.body.focus();\n\n document.onselectstart = function () {\n return false;\n };\n }\n /**\n * Turn off text selection blocking.\n */\n\n function unblockTextSelection() {\n document.onselectstart = function () {\n return true;\n };\n }\n /**\n * Identical to the native `getBoundingClientRect` function, but ensures that\n * the method is supported at all (it is in all browsers we claim to support)\n * and that the element is in the DOM before continuing.\n *\n * This wrapper function also shims properties which are not provided by some\n * older browsers (namely, IE8).\n *\n * Additionally, some browsers do not support adding properties to a\n * `ClientRect`/`DOMRect` object; so, we shallow-copy it with the standard\n * properties (except `x` and `y` which are not widely supported). This helps\n * avoid implementations where keys are non-enumerable.\n *\n * @param {Element} el\n * Element whose `ClientRect` we want to calculate.\n *\n * @return {Object|undefined}\n * Always returns a plain object - or `undefined` if it cannot.\n */\n\n function getBoundingClientRect(el) {\n if (el && el.getBoundingClientRect && el.parentNode) {\n var rect = el.getBoundingClientRect();\n var result = {};\n ['bottom', 'height', 'left', 'right', 'top', 'width'].forEach(function (k) {\n if (rect[k] !== undefined) {\n result[k] = rect[k];\n }\n });\n\n if (!result.height) {\n result.height = parseFloat(computedStyle(el, 'height'));\n }\n\n if (!result.width) {\n result.width = parseFloat(computedStyle(el, 'width'));\n }\n\n return result;\n }\n }\n /**\n * Represents the position of a DOM element on the page.\n *\n * @typedef {Object} module:dom~Position\n *\n * @property {number} left\n * Pixels to the left.\n *\n * @property {number} top\n * Pixels from the top.\n */\n\n /**\n * Get the position of an element in the DOM.\n *\n * Uses `getBoundingClientRect` technique from John Resig.\n *\n * @see http://ejohn.org/blog/getboundingclientrect-is-awesome/\n *\n * @param {Element} el\n * Element from which to get offset.\n *\n * @return {module:dom~Position}\n * The position of the element that was passed in.\n */\n\n function findPosition(el) {\n var box;\n\n if (el.getBoundingClientRect && el.parentNode) {\n box = el.getBoundingClientRect();\n }\n\n if (!box) {\n return {\n left: 0,\n top: 0\n };\n }\n\n var docEl = document.documentElement;\n var body = document.body;\n var clientLeft = docEl.clientLeft || body.clientLeft || 0;\n var scrollLeft = window$1.pageXOffset || body.scrollLeft;\n var left = box.left + scrollLeft - clientLeft;\n var clientTop = docEl.clientTop || body.clientTop || 0;\n var scrollTop = window$1.pageYOffset || body.scrollTop;\n var top = box.top + scrollTop - clientTop; // Android sometimes returns slightly off decimal values, so need to round\n\n return {\n left: Math.round(left),\n top: Math.round(top)\n };\n }\n /**\n * Represents x and y coordinates for a DOM element or mouse pointer.\n *\n * @typedef {Object} module:dom~Coordinates\n *\n * @property {number} x\n * x coordinate in pixels\n *\n * @property {number} y\n * y coordinate in pixels\n */\n\n /**\n * Get the pointer position within an element.\n *\n * The base on the coordinates are the bottom left of the element.\n *\n * @param {Element} el\n * Element on which to get the pointer position on.\n *\n * @param {EventTarget~Event} event\n * Event object.\n *\n * @return {module:dom~Coordinates}\n * A coordinates object corresponding to the mouse position.\n *\n */\n\n function getPointerPosition(el, event) {\n var position = {};\n var box = findPosition(el);\n var boxW = el.offsetWidth;\n var boxH = el.offsetHeight;\n var boxY = box.top;\n var boxX = box.left;\n var pageY = event.pageY;\n var pageX = event.pageX;\n\n if (event.changedTouches) {\n pageX = event.changedTouches[0].pageX;\n pageY = event.changedTouches[0].pageY;\n }\n\n position.y = Math.max(0, Math.min(1, (boxY - pageY + boxH) / boxH));\n position.x = Math.max(0, Math.min(1, (pageX - boxX) / boxW));\n return position;\n }\n /**\n * Determines, via duck typing, whether or not a value is a text node.\n *\n * @param {Mixed} value\n * Check if this value is a text node.\n *\n * @return {boolean}\n * Will be `true` if the value is a text node, `false` otherwise.\n */\n\n function isTextNode(value) {\n return isObject(value) && value.nodeType === 3;\n }\n /**\n * Empties the contents of an element.\n *\n * @param {Element} el\n * The element to empty children from\n *\n * @return {Element}\n * The element with no children\n */\n\n function emptyEl(el) {\n while (el.firstChild) {\n el.removeChild(el.firstChild);\n }\n\n return el;\n }\n /**\n * This is a mixed value that describes content to be injected into the DOM\n * via some method. It can be of the following types:\n *\n * Type | Description\n * -----------|-------------\n * `string` | The value will be normalized into a text node.\n * `Element` | The value will be accepted as-is.\n * `TextNode` | The value will be accepted as-is.\n * `Array` | A one-dimensional array of strings, elements, text nodes, or functions. These functions should return a string, element, or text node (any other return value, like an array, will be ignored).\n * `Function` | A function, which is expected to return a string, element, text node, or array - any of the other possible values described above. This means that a content descriptor could be a function that returns an array of functions, but those second-level functions must return strings, elements, or text nodes.\n *\n * @typedef {string|Element|TextNode|Array|Function} module:dom~ContentDescriptor\n */\n\n /**\n * Normalizes content for eventual insertion into the DOM.\n *\n * This allows a wide range of content definition methods, but helps protect\n * from falling into the trap of simply writing to `innerHTML`, which could\n * be an XSS concern.\n *\n * The content for an element can be passed in multiple types and\n * combinations, whose behavior is as follows:\n *\n * @param {module:dom~ContentDescriptor} content\n * A content descriptor value.\n *\n * @return {Array}\n * All of the content that was passed in, normalized to an array of\n * elements or text nodes.\n */\n\n function normalizeContent(content) {\n // First, invoke content if it is a function. If it produces an array,\n // that needs to happen before normalization.\n if (typeof content === 'function') {\n content = content();\n } // Next up, normalize to an array, so one or many items can be normalized,\n // filtered, and returned.\n\n\n return (Array.isArray(content) ? content : [content]).map(function (value) {\n // First, invoke value if it is a function to produce a new value,\n // which will be subsequently normalized to a Node of some kind.\n if (typeof value === 'function') {\n value = value();\n }\n\n if (isEl(value) || isTextNode(value)) {\n return value;\n }\n\n if (typeof value === 'string' && /\\S/.test(value)) {\n return document.createTextNode(value);\n }\n }).filter(function (value) {\n return value;\n });\n }\n /**\n * Normalizes and appends content to an element.\n *\n * @param {Element} el\n * Element to append normalized content to.\n *\n * @param {module:dom~ContentDescriptor} content\n * A content descriptor value.\n *\n * @return {Element}\n * The element with appended normalized content.\n */\n\n function appendContent(el, content) {\n normalizeContent(content).forEach(function (node) {\n return el.appendChild(node);\n });\n return el;\n }\n /**\n * Normalizes and inserts content into an element; this is identical to\n * `appendContent()`, except it empties the element first.\n *\n * @param {Element} el\n * Element to insert normalized content into.\n *\n * @param {module:dom~ContentDescriptor} content\n * A content descriptor value.\n *\n * @return {Element}\n * The element with inserted normalized content.\n */\n\n function insertContent(el, content) {\n return appendContent(emptyEl(el), content);\n }\n /**\n * Check if an event was a single left click.\n *\n * @param {EventTarget~Event} event\n * Event object.\n *\n * @return {boolean}\n * Will be `true` if a single left click, `false` otherwise.\n */\n\n function isSingleLeftClick(event) {\n // Note: if you create something draggable, be sure to\n // call it on both `mousedown` and `mousemove` event,\n // otherwise `mousedown` should be enough for a button\n if (event.button === undefined && event.buttons === undefined) {\n // Why do we need `buttons` ?\n // Because, middle mouse sometimes have this:\n // e.button === 0 and e.buttons === 4\n // Furthermore, we want to prevent combination click, something like\n // HOLD middlemouse then left click, that would be\n // e.button === 0, e.buttons === 5\n // just `button` is not gonna work\n // Alright, then what this block does ?\n // this is for chrome `simulate mobile devices`\n // I want to support this as well\n return true;\n }\n\n if (event.button === 0 && event.buttons === undefined) {\n // Touch screen, sometimes on some specific device, `buttons`\n // doesn't have anything (safari on ios, blackberry...)\n return true;\n }\n\n if (event.button !== 0 || event.buttons !== 1) {\n // This is the reason we have those if else block above\n // if any special case we can catch and let it slide\n // we do it above, when get to here, this definitely\n // is-not-left-click\n return false;\n }\n\n return true;\n }\n /**\n * Finds a single DOM element matching `selector` within the optional\n * `context` of another DOM element (defaulting to `document`).\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelector`.\n *\n * @param {Element|String} [context=document]\n * A DOM element within which to query. Can also be a selector\n * string in which case the first matching element will be used\n * as context. If missing (or no element matches selector), falls\n * back to `document`.\n *\n * @return {Element|null}\n * The element that was found or null.\n */\n\n var $ = createQuerier('querySelector');\n /**\n * Finds a all DOM elements matching `selector` within the optional\n * `context` of another DOM element (defaulting to `document`).\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelectorAll`.\n *\n * @param {Element|String} [context=document]\n * A DOM element within which to query. Can also be a selector\n * string in which case the first matching element will be used\n * as context. If missing (or no element matches selector), falls\n * back to `document`.\n *\n * @return {NodeList}\n * A element list of elements that were found. Will be empty if none\n * were found.\n *\n */\n\n var $$ = createQuerier('querySelectorAll');\n\n var Dom = /*#__PURE__*/Object.freeze({\n isReal: isReal,\n isEl: isEl,\n isInFrame: isInFrame,\n createEl: createEl,\n textContent: textContent,\n prependTo: prependTo,\n hasClass: hasClass,\n addClass: addClass,\n removeClass: removeClass,\n toggleClass: toggleClass,\n setAttributes: setAttributes,\n getAttributes: getAttributes,\n getAttribute: getAttribute,\n setAttribute: setAttribute,\n removeAttribute: removeAttribute,\n blockTextSelection: blockTextSelection,\n unblockTextSelection: unblockTextSelection,\n getBoundingClientRect: getBoundingClientRect,\n findPosition: findPosition,\n getPointerPosition: getPointerPosition,\n isTextNode: isTextNode,\n emptyEl: emptyEl,\n normalizeContent: normalizeContent,\n appendContent: appendContent,\n insertContent: insertContent,\n isSingleLeftClick: isSingleLeftClick,\n $: $,\n $$: $$\n });\n\n /**\n * @file guid.js\n * @module guid\n */\n\n /**\n * Unique ID for an element or function\n * @type {Number}\n */\n var _guid = 1;\n /**\n * Get a unique auto-incrementing ID by number that has not been returned before.\n *\n * @return {number}\n * A new unique ID.\n */\n\n function newGUID() {\n return _guid++;\n }\n\n /**\n * @file dom-data.js\n * @module dom-data\n */\n /**\n * Element Data Store.\n *\n * Allows for binding data to an element without putting it directly on the\n * element. Ex. Event listeners are stored here.\n * (also from jsninja.com, slightly modified and updated for closure compiler)\n *\n * @type {Object}\n * @private\n */\n\n var elData = {};\n /*\n * Unique attribute name to store an element's guid in\n *\n * @type {String}\n * @constant\n * @private\n */\n\n var elIdAttr = 'vdata' + new Date().getTime();\n /**\n * Returns the cache object where data for an element is stored\n *\n * @param {Element} el\n * Element to store data for.\n *\n * @return {Object}\n * The cache object for that el that was passed in.\n */\n\n function getData(el) {\n var id = el[elIdAttr];\n\n if (!id) {\n id = el[elIdAttr] = newGUID();\n }\n\n if (!elData[id]) {\n elData[id] = {};\n }\n\n return elData[id];\n }\n /**\n * Returns whether or not an element has cached data\n *\n * @param {Element} el\n * Check if this element has cached data.\n *\n * @return {boolean}\n * - True if the DOM element has cached data.\n * - False otherwise.\n */\n\n function hasData(el) {\n var id = el[elIdAttr];\n\n if (!id) {\n return false;\n }\n\n return !!Object.getOwnPropertyNames(elData[id]).length;\n }\n /**\n * Delete data for the element from the cache and the guid attr from getElementById\n *\n * @param {Element} el\n * Remove cached data for this element.\n */\n\n function removeData(el) {\n var id = el[elIdAttr];\n\n if (!id) {\n return;\n } // Remove all stored data\n\n\n delete elData[id]; // Remove the elIdAttr property from the DOM node\n\n try {\n delete el[elIdAttr];\n } catch (e) {\n if (el.removeAttribute) {\n el.removeAttribute(elIdAttr);\n } else {\n // IE doesn't appear to support removeAttribute on the document element\n el[elIdAttr] = null;\n }\n }\n }\n\n /**\n * @file events.js. An Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/)\n * (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible)\n * This should work very similarly to jQuery's events, however it's based off the book version which isn't as\n * robust as jquery's, so there's probably some differences.\n *\n * @file events.js\n * @module events\n */\n /**\n * Clean up the listener cache and dispatchers\n *\n * @param {Element|Object} elem\n * Element to clean up\n *\n * @param {string} type\n * Type of event to clean up\n */\n\n function _cleanUpEvents(elem, type) {\n var data = getData(elem); // Remove the events of a particular type if there are none left\n\n if (data.handlers[type].length === 0) {\n delete data.handlers[type]; // data.handlers[type] = null;\n // Setting to null was causing an error with data.handlers\n // Remove the meta-handler from the element\n\n if (elem.removeEventListener) {\n elem.removeEventListener(type, data.dispatcher, false);\n } else if (elem.detachEvent) {\n elem.detachEvent('on' + type, data.dispatcher);\n }\n } // Remove the events object if there are no types left\n\n\n if (Object.getOwnPropertyNames(data.handlers).length <= 0) {\n delete data.handlers;\n delete data.dispatcher;\n delete data.disabled;\n } // Finally remove the element data if there is no data left\n\n\n if (Object.getOwnPropertyNames(data).length === 0) {\n removeData(elem);\n }\n }\n /**\n * Loops through an array of event types and calls the requested method for each type.\n *\n * @param {Function} fn\n * The event method we want to use.\n *\n * @param {Element|Object} elem\n * Element or object to bind listeners to\n *\n * @param {string} type\n * Type of event to bind to.\n *\n * @param {EventTarget~EventListener} callback\n * Event listener.\n */\n\n\n function _handleMultipleEvents(fn, elem, types, callback) {\n types.forEach(function (type) {\n // Call the event method for each one of the types\n fn(elem, type, callback);\n });\n }\n /**\n * Fix a native event to have standard property values\n *\n * @param {Object} event\n * Event object to fix.\n *\n * @return {Object}\n * Fixed event object.\n */\n\n\n function fixEvent(event) {\n function returnTrue() {\n return true;\n }\n\n function returnFalse() {\n return false;\n } // Test if fixing up is needed\n // Used to check if !event.stopPropagation instead of isPropagationStopped\n // But native events return true for stopPropagation, but don't have\n // other expected methods like isPropagationStopped. Seems to be a problem\n // with the Javascript Ninja code. So we're just overriding all events now.\n\n\n if (!event || !event.isPropagationStopped) {\n var old = event || window$1.event;\n event = {}; // Clone the old object so that we can modify the values event = {};\n // IE8 Doesn't like when you mess with native event properties\n // Firefox returns false for event.hasOwnProperty('type') and other props\n // which makes copying more difficult.\n // TODO: Probably best to create a whitelist of event props\n\n for (var key in old) {\n // Safari 6.0.3 warns you if you try to copy deprecated layerX/Y\n // Chrome warns you if you try to copy deprecated keyboardEvent.keyLocation\n // and webkitMovementX/Y\n if (key !== 'layerX' && key !== 'layerY' && key !== 'keyLocation' && key !== 'webkitMovementX' && key !== 'webkitMovementY') {\n // Chrome 32+ warns if you try to copy deprecated returnValue, but\n // we still want to if preventDefault isn't supported (IE8).\n if (!(key === 'returnValue' && old.preventDefault)) {\n event[key] = old[key];\n }\n }\n } // The event occurred on this element\n\n\n if (!event.target) {\n event.target = event.srcElement || document;\n } // Handle which other element the event is related to\n\n\n if (!event.relatedTarget) {\n event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;\n } // Stop the default browser action\n\n\n event.preventDefault = function () {\n if (old.preventDefault) {\n old.preventDefault();\n }\n\n event.returnValue = false;\n old.returnValue = false;\n event.defaultPrevented = true;\n };\n\n event.defaultPrevented = false; // Stop the event from bubbling\n\n event.stopPropagation = function () {\n if (old.stopPropagation) {\n old.stopPropagation();\n }\n\n event.cancelBubble = true;\n old.cancelBubble = true;\n event.isPropagationStopped = returnTrue;\n };\n\n event.isPropagationStopped = returnFalse; // Stop the event from bubbling and executing other handlers\n\n event.stopImmediatePropagation = function () {\n if (old.stopImmediatePropagation) {\n old.stopImmediatePropagation();\n }\n\n event.isImmediatePropagationStopped = returnTrue;\n event.stopPropagation();\n };\n\n event.isImmediatePropagationStopped = returnFalse; // Handle mouse position\n\n if (event.clientX !== null && event.clientX !== undefined) {\n var doc = document.documentElement;\n var body = document.body;\n event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);\n event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);\n } // Handle key presses\n\n\n event.which = event.charCode || event.keyCode; // Fix button for mouse clicks:\n // 0 == left; 1 == middle; 2 == right\n\n if (event.button !== null && event.button !== undefined) {\n // The following is disabled because it does not pass videojs-standard\n // and... yikes.\n\n /* eslint-disable */\n event.button = event.button & 1 ? 0 : event.button & 4 ? 1 : event.button & 2 ? 2 : 0;\n /* eslint-enable */\n }\n } // Returns fixed-up instance\n\n\n return event;\n }\n /**\n * Whether passive event listeners are supported\n */\n\n var _supportsPassive = false;\n\n (function () {\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function get() {\n _supportsPassive = true;\n }\n });\n window$1.addEventListener('test', null, opts);\n window$1.removeEventListener('test', null, opts);\n } catch (e) {// disregard\n }\n })();\n /**\n * Touch events Chrome expects to be passive\n */\n\n\n var passiveEvents = ['touchstart', 'touchmove'];\n /**\n * Add an event listener to element\n * It stores the handler function in a separate cache object\n * and adds a generic handler to the element's event,\n * along with a unique id (guid) to the element.\n *\n * @param {Element|Object} elem\n * Element or object to bind listeners to\n *\n * @param {string|string[]} type\n * Type of event to bind to.\n *\n * @param {EventTarget~EventListener} fn\n * Event listener.\n */\n\n function on(elem, type, fn) {\n if (Array.isArray(type)) {\n return _handleMultipleEvents(on, elem, type, fn);\n }\n\n var data = getData(elem); // We need a place to store all our handler data\n\n if (!data.handlers) {\n data.handlers = {};\n }\n\n if (!data.handlers[type]) {\n data.handlers[type] = [];\n }\n\n if (!fn.guid) {\n fn.guid = newGUID();\n }\n\n data.handlers[type].push(fn);\n\n if (!data.dispatcher) {\n data.disabled = false;\n\n data.dispatcher = function (event, hash) {\n if (data.disabled) {\n return;\n }\n\n event = fixEvent(event);\n var handlers = data.handlers[event.type];\n\n if (handlers) {\n // Copy handlers so if handlers are added/removed during the process it doesn't throw everything off.\n var handlersCopy = handlers.slice(0);\n\n for (var m = 0, n = handlersCopy.length; m < n; m++) {\n if (event.isImmediatePropagationStopped()) {\n break;\n } else {\n try {\n handlersCopy[m].call(elem, event, hash);\n } catch (e) {\n log.error(e);\n }\n }\n }\n }\n };\n }\n\n if (data.handlers[type].length === 1) {\n if (elem.addEventListener) {\n var options = false;\n\n if (_supportsPassive && passiveEvents.indexOf(type) > -1) {\n options = {\n passive: true\n };\n }\n\n elem.addEventListener(type, data.dispatcher, options);\n } else if (elem.attachEvent) {\n elem.attachEvent('on' + type, data.dispatcher);\n }\n }\n }\n /**\n * Removes event listeners from an element\n *\n * @param {Element|Object} elem\n * Object to remove listeners from.\n *\n * @param {string|string[]} [type]\n * Type of listener to remove. Don't include to remove all events from element.\n *\n * @param {EventTarget~EventListener} [fn]\n * Specific listener to remove. Don't include to remove listeners for an event\n * type.\n */\n\n function off(elem, type, fn) {\n // Don't want to add a cache object through getElData if not needed\n if (!hasData(elem)) {\n return;\n }\n\n var data = getData(elem); // If no events exist, nothing to unbind\n\n if (!data.handlers) {\n return;\n }\n\n if (Array.isArray(type)) {\n return _handleMultipleEvents(off, elem, type, fn);\n } // Utility function\n\n\n var removeType = function removeType(el, t) {\n data.handlers[t] = [];\n\n _cleanUpEvents(el, t);\n }; // Are we removing all bound events?\n\n\n if (type === undefined) {\n for (var t in data.handlers) {\n if (Object.prototype.hasOwnProperty.call(data.handlers || {}, t)) {\n removeType(elem, t);\n }\n }\n\n return;\n }\n\n var handlers = data.handlers[type]; // If no handlers exist, nothing to unbind\n\n if (!handlers) {\n return;\n } // If no listener was provided, remove all listeners for type\n\n\n if (!fn) {\n removeType(elem, type);\n return;\n } // We're only removing a single handler\n\n\n if (fn.guid) {\n for (var n = 0; n < handlers.length; n++) {\n if (handlers[n].guid === fn.guid) {\n handlers.splice(n--, 1);\n }\n }\n }\n\n _cleanUpEvents(elem, type);\n }\n /**\n * Trigger an event for an element\n *\n * @param {Element|Object} elem\n * Element to trigger an event on\n *\n * @param {EventTarget~Event|string} event\n * A string (the type) or an event object with a type attribute\n *\n * @param {Object} [hash]\n * data hash to pass along with the event\n *\n * @return {boolean|undefined}\n * Returns the opposite of `defaultPrevented` if default was\n * prevented. Otherwise, returns `undefined`\n */\n\n function trigger(elem, event, hash) {\n // Fetches element data and a reference to the parent (for bubbling).\n // Don't want to add a data object to cache for every parent,\n // so checking hasElData first.\n var elemData = hasData(elem) ? getData(elem) : {};\n var parent = elem.parentNode || elem.ownerDocument; // type = event.type || event,\n // handler;\n // If an event name was passed as a string, creates an event out of it\n\n if (typeof event === 'string') {\n event = {\n type: event,\n target: elem\n };\n } else if (!event.target) {\n event.target = elem;\n } // Normalizes the event properties.\n\n\n event = fixEvent(event); // If the passed element has a dispatcher, executes the established handlers.\n\n if (elemData.dispatcher) {\n elemData.dispatcher.call(elem, event, hash);\n } // Unless explicitly stopped or the event does not bubble (e.g. media events)\n // recursively calls this function to bubble the event up the DOM.\n\n\n if (parent && !event.isPropagationStopped() && event.bubbles === true) {\n trigger.call(null, parent, event, hash); // If at the top of the DOM, triggers the default action unless disabled.\n } else if (!parent && !event.defaultPrevented && event.target && event.target[event.type]) {\n var targetData = getData(event.target); // Checks if the target has a default action for this event.\n\n if (event.target[event.type]) {\n // Temporarily disables event dispatching on the target as we have already executed the handler.\n targetData.disabled = true; // Executes the default action.\n\n if (typeof event.target[event.type] === 'function') {\n event.target[event.type]();\n } // Re-enables event dispatching.\n\n\n targetData.disabled = false;\n }\n } // Inform the triggerer if the default was prevented by returning false\n\n\n return !event.defaultPrevented;\n }\n /**\n * Trigger a listener only once for an event.\n *\n * @param {Element|Object} elem\n * Element or object to bind to.\n *\n * @param {string|string[]} type\n * Name/type of event\n *\n * @param {Event~EventListener} fn\n * Event listener function\n */\n\n function one(elem, type, fn) {\n if (Array.isArray(type)) {\n return _handleMultipleEvents(one, elem, type, fn);\n }\n\n var func = function func() {\n off(elem, type, func);\n fn.apply(this, arguments);\n }; // copy the guid to the new function so it can removed using the original function's ID\n\n\n func.guid = fn.guid = fn.guid || newGUID();\n on(elem, type, func);\n }\n\n var Events = /*#__PURE__*/Object.freeze({\n fixEvent: fixEvent,\n on: on,\n off: off,\n trigger: trigger,\n one: one\n });\n\n /**\n * @file setup.js - Functions for setting up a player without\n * user interaction based on the data-setup `attribute` of the video tag.\n *\n * @module setup\n */\n var _windowLoaded = false;\n var videojs;\n /**\n * Set up any tags that have a data-setup `attribute` when the player is started.\n */\n\n var autoSetup = function autoSetup() {\n // Protect against breakage in non-browser environments and check global autoSetup option.\n if (!isReal() || videojs.options.autoSetup === false) {\n return;\n }\n\n var vids = Array.prototype.slice.call(document.getElementsByTagName('video'));\n var audios = Array.prototype.slice.call(document.getElementsByTagName('audio'));\n var divs = Array.prototype.slice.call(document.getElementsByTagName('video-js'));\n var mediaEls = vids.concat(audios, divs); // Check if any media elements exist\n\n if (mediaEls && mediaEls.length > 0) {\n for (var i = 0, e = mediaEls.length; i < e; i++) {\n var mediaEl = mediaEls[i]; // Check if element exists, has getAttribute func.\n\n if (mediaEl && mediaEl.getAttribute) {\n // Make sure this player hasn't already been set up.\n if (mediaEl.player === undefined) {\n var options = mediaEl.getAttribute('data-setup'); // Check if data-setup attr exists.\n // We only auto-setup if they've added the data-setup attr.\n\n if (options !== null) {\n // Create new video.js instance.\n videojs(mediaEl);\n }\n } // If getAttribute isn't defined, we need to wait for the DOM.\n\n } else {\n autoSetupTimeout(1);\n break;\n }\n } // No videos were found, so keep looping unless page is finished loading.\n\n } else if (!_windowLoaded) {\n autoSetupTimeout(1);\n }\n };\n /**\n * Wait until the page is loaded before running autoSetup. This will be called in\n * autoSetup if `hasLoaded` returns false.\n *\n * @param {number} wait\n * How long to wait in ms\n *\n * @param {module:videojs} [vjs]\n * The videojs library function\n */\n\n\n function autoSetupTimeout(wait, vjs) {\n if (vjs) {\n videojs = vjs;\n }\n\n window$1.setTimeout(autoSetup, wait);\n }\n\n if (isReal() && document.readyState === 'complete') {\n _windowLoaded = true;\n } else {\n /**\n * Listen for the load event on window, and set _windowLoaded to true.\n *\n * @listens load\n */\n one(window$1, 'load', function () {\n _windowLoaded = true;\n });\n }\n\n /**\n * @file stylesheet.js\n * @module stylesheet\n */\n /**\n * Create a DOM syle element given a className for it.\n *\n * @param {string} className\n * The className to add to the created style element.\n *\n * @return {Element}\n * The element that was created.\n */\n\n var createStyleElement = function createStyleElement(className) {\n var style = document.createElement('style');\n style.className = className;\n return style;\n };\n /**\n * Add text to a DOM element.\n *\n * @param {Element} el\n * The Element to add text content to.\n *\n * @param {string} content\n * The text to add to the element.\n */\n\n var setTextContent = function setTextContent(el, content) {\n if (el.styleSheet) {\n el.styleSheet.cssText = content;\n } else {\n el.textContent = content;\n }\n };\n\n /**\n * @file fn.js\n * @module fn\n */\n /**\n * Bind (a.k.a proxy or context). A simple method for changing the context of\n * a function.\n *\n * It also stores a unique id on the function so it can be easily removed from\n * events.\n *\n * @function\n * @param {Mixed} context\n * The object to bind as scope.\n *\n * @param {Function} fn\n * The function to be bound to a scope.\n *\n * @param {number} [uid]\n * An optional unique ID for the function to be set\n *\n * @return {Function}\n * The new function that will be bound into the context given\n */\n\n var bind = function bind(context, fn, uid) {\n // Make sure the function has a unique ID\n if (!fn.guid) {\n fn.guid = newGUID();\n } // Create the new function that changes the context\n\n\n var bound = function bound() {\n return fn.apply(context, arguments);\n }; // Allow for the ability to individualize this function\n // Needed in the case where multiple objects might share the same prototype\n // IF both items add an event listener with the same function, then you try to remove just one\n // it will remove both because they both have the same guid.\n // when using this, you need to use the bind method when you remove the listener as well.\n // currently used in text tracks\n\n\n bound.guid = uid ? uid + '_' + fn.guid : fn.guid;\n return bound;\n };\n /**\n * Wraps the given function, `fn`, with a new function that only invokes `fn`\n * at most once per every `wait` milliseconds.\n *\n * @function\n * @param {Function} fn\n * The function to be throttled.\n *\n * @param {number} wait\n * The number of milliseconds by which to throttle.\n *\n * @return {Function}\n */\n\n var throttle = function throttle(fn, wait) {\n var last = Date.now();\n\n var throttled = function throttled() {\n var now = Date.now();\n\n if (now - last >= wait) {\n fn.apply(void 0, arguments);\n last = now;\n }\n };\n\n return throttled;\n };\n /**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked.\n *\n * Inspired by lodash and underscore implementations.\n *\n * @function\n * @param {Function} func\n * The function to wrap with debounce behavior.\n *\n * @param {number} wait\n * The number of milliseconds to wait after the last invocation.\n *\n * @param {boolean} [immediate]\n * Whether or not to invoke the function immediately upon creation.\n *\n * @param {Object} [context=window]\n * The \"context\" in which the debounced function should debounce. For\n * example, if this function should be tied to a Video.js player,\n * the player can be passed here. Alternatively, defaults to the\n * global `window` object.\n *\n * @return {Function}\n * A debounced function.\n */\n\n var debounce = function debounce(func, wait, immediate, context) {\n if (context === void 0) {\n context = window$1;\n }\n\n var timeout;\n\n var cancel = function cancel() {\n context.clearTimeout(timeout);\n timeout = null;\n };\n /* eslint-disable consistent-this */\n\n\n var debounced = function debounced() {\n var self = this;\n var args = arguments;\n\n var _later = function later() {\n timeout = null;\n _later = null;\n\n if (!immediate) {\n func.apply(self, args);\n }\n };\n\n if (!timeout && immediate) {\n func.apply(self, args);\n }\n\n context.clearTimeout(timeout);\n timeout = context.setTimeout(_later, wait);\n };\n /* eslint-enable consistent-this */\n\n\n debounced.cancel = cancel;\n return debounced;\n };\n\n /**\n * @file src/js/event-target.js\n */\n /**\n * `EventTarget` is a class that can have the same API as the DOM `EventTarget`. It\n * adds shorthand functions that wrap around lengthy functions. For example:\n * the `on` function is a wrapper around `addEventListener`.\n *\n * @see [EventTarget Spec]{@link https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget}\n * @class EventTarget\n */\n\n var EventTarget = function EventTarget() {};\n /**\n * A Custom DOM event.\n *\n * @typedef {Object} EventTarget~Event\n * @see [Properties]{@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}\n */\n\n /**\n * All event listeners should follow the following format.\n *\n * @callback EventTarget~EventListener\n * @this {EventTarget}\n *\n * @param {EventTarget~Event} event\n * the event that triggered this function\n *\n * @param {Object} [hash]\n * hash of data sent during the event\n */\n\n /**\n * An object containing event names as keys and booleans as values.\n *\n * > NOTE: If an event name is set to a true value here {@link EventTarget#trigger}\n * will have extra functionality. See that function for more information.\n *\n * @property EventTarget.prototype.allowedEvents_\n * @private\n */\n\n\n EventTarget.prototype.allowedEvents_ = {};\n /**\n * Adds an `event listener` to an instance of an `EventTarget`. An `event listener` is a\n * function that will get called when an event with a certain name gets triggered.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to call with `EventTarget`s\n */\n\n EventTarget.prototype.on = function (type, fn) {\n // Remove the addEventListener alias before calling Events.on\n // so we don't get into an infinite type loop\n var ael = this.addEventListener;\n\n this.addEventListener = function () {};\n\n on(this, type, fn);\n this.addEventListener = ael;\n };\n /**\n * An alias of {@link EventTarget#on}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#on}\n */\n\n\n EventTarget.prototype.addEventListener = EventTarget.prototype.on;\n /**\n * Removes an `event listener` for a specific event from an instance of `EventTarget`.\n * This makes it so that the `event listener` will no longer get called when the\n * named event happens.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to remove.\n */\n\n EventTarget.prototype.off = function (type, fn) {\n off(this, type, fn);\n };\n /**\n * An alias of {@link EventTarget#off}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#off}\n */\n\n\n EventTarget.prototype.removeEventListener = EventTarget.prototype.off;\n /**\n * This function will add an `event listener` that gets triggered only once. After the\n * first trigger it will get removed. This is like adding an `event listener`\n * with {@link EventTarget#on} that calls {@link EventTarget#off} on itself.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to be called once for each event name.\n */\n\n EventTarget.prototype.one = function (type, fn) {\n // Remove the addEventListener alialing Events.on\n // so we don't get into an infinite type loop\n var ael = this.addEventListener;\n\n this.addEventListener = function () {};\n\n one(this, type, fn);\n this.addEventListener = ael;\n };\n /**\n * This function causes an event to happen. This will then cause any `event listeners`\n * that are waiting for that event, to get called. If there are no `event listeners`\n * for an event then nothing will happen.\n *\n * If the name of the `Event` that is being triggered is in `EventTarget.allowedEvents_`.\n * Trigger will also call the `on` + `uppercaseEventName` function.\n *\n * Example:\n * 'click' is in `EventTarget.allowedEvents_`, so, trigger will attempt to call\n * `onClick` if it exists.\n *\n * @param {string|EventTarget~Event|Object} event\n * The name of the event, an `Event`, or an object with a key of type set to\n * an event name.\n */\n\n\n EventTarget.prototype.trigger = function (event) {\n var type = event.type || event; // deprecation\n // In a future version we should default target to `this`\n // similar to how we default the target to `elem` in\n // `Events.trigger`. Right now the default `target` will be\n // `document` due to the `Event.fixEvent` call.\n\n if (typeof event === 'string') {\n event = {\n type: type\n };\n }\n\n event = fixEvent(event);\n\n if (this.allowedEvents_[type] && this['on' + type]) {\n this['on' + type](event);\n }\n\n trigger(this, event);\n };\n /**\n * An alias of {@link EventTarget#trigger}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#trigger}\n */\n\n\n EventTarget.prototype.dispatchEvent = EventTarget.prototype.trigger;\n var EVENT_MAP;\n\n EventTarget.prototype.queueTrigger = function (event) {\n var _this = this;\n\n // only set up EVENT_MAP if it'll be used\n if (!EVENT_MAP) {\n EVENT_MAP = new Map();\n }\n\n var type = event.type || event;\n var map = EVENT_MAP.get(this);\n\n if (!map) {\n map = new Map();\n EVENT_MAP.set(this, map);\n }\n\n var oldTimeout = map.get(type);\n map.delete(type);\n window$1.clearTimeout(oldTimeout);\n var timeout = window$1.setTimeout(function () {\n // if we cleared out all timeouts for the current target, delete its map\n if (map.size === 0) {\n map = null;\n EVENT_MAP.delete(_this);\n }\n\n _this.trigger(event);\n }, 0);\n map.set(type, timeout);\n };\n\n /**\n * @file mixins/evented.js\n * @module evented\n */\n /**\n * Returns whether or not an object has had the evented mixin applied.\n *\n * @param {Object} object\n * An object to test.\n *\n * @return {boolean}\n * Whether or not the object appears to be evented.\n */\n\n var isEvented = function isEvented(object) {\n return object instanceof EventTarget || !!object.eventBusEl_ && ['on', 'one', 'off', 'trigger'].every(function (k) {\n return typeof object[k] === 'function';\n });\n };\n /**\n * Adds a callback to run after the evented mixin applied.\n *\n * @param {Object} object\n * An object to Add\n * @param {Function} callback\n * The callback to run.\n */\n\n\n var addEventedCallback = function addEventedCallback(target, callback) {\n if (isEvented(target)) {\n callback();\n } else {\n if (!target.eventedCallbacks) {\n target.eventedCallbacks = [];\n }\n\n target.eventedCallbacks.push(callback);\n }\n };\n /**\n * Whether a value is a valid event type - non-empty string or array.\n *\n * @private\n * @param {string|Array} type\n * The type value to test.\n *\n * @return {boolean}\n * Whether or not the type is a valid event type.\n */\n\n\n var isValidEventType = function isValidEventType(type) {\n return (// The regex here verifies that the `type` contains at least one non-\n // whitespace character.\n typeof type === 'string' && /\\S/.test(type) || Array.isArray(type) && !!type.length\n );\n };\n /**\n * Validates a value to determine if it is a valid event target. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the target does not appear to be a valid event target.\n *\n * @param {Object} target\n * The object to test.\n */\n\n\n var validateTarget = function validateTarget(target) {\n if (!target.nodeName && !isEvented(target)) {\n throw new Error('Invalid target; must be a DOM node or evented object.');\n }\n };\n /**\n * Validates a value to determine if it is a valid event target. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the type does not appear to be a valid event type.\n *\n * @param {string|Array} type\n * The type to test.\n */\n\n\n var validateEventType = function validateEventType(type) {\n if (!isValidEventType(type)) {\n throw new Error('Invalid event type; must be a non-empty string or array.');\n }\n };\n /**\n * Validates a value to determine if it is a valid listener. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the listener is not a function.\n *\n * @param {Function} listener\n * The listener to test.\n */\n\n\n var validateListener = function validateListener(listener) {\n if (typeof listener !== 'function') {\n throw new Error('Invalid listener; must be a function.');\n }\n };\n /**\n * Takes an array of arguments given to `on()` or `one()`, validates them, and\n * normalizes them into an object.\n *\n * @private\n * @param {Object} self\n * The evented object on which `on()` or `one()` was called. This\n * object will be bound as the `this` value for the listener.\n *\n * @param {Array} args\n * An array of arguments passed to `on()` or `one()`.\n *\n * @return {Object}\n * An object containing useful values for `on()` or `one()` calls.\n */\n\n\n var normalizeListenArgs = function normalizeListenArgs(self, args) {\n // If the number of arguments is less than 3, the target is always the\n // evented object itself.\n var isTargetingSelf = args.length < 3 || args[0] === self || args[0] === self.eventBusEl_;\n var target;\n var type;\n var listener;\n\n if (isTargetingSelf) {\n target = self.eventBusEl_; // Deal with cases where we got 3 arguments, but we are still listening to\n // the evented object itself.\n\n if (args.length >= 3) {\n args.shift();\n }\n\n type = args[0];\n listener = args[1];\n } else {\n target = args[0];\n type = args[1];\n listener = args[2];\n }\n\n validateTarget(target);\n validateEventType(type);\n validateListener(listener);\n listener = bind(self, listener);\n return {\n isTargetingSelf: isTargetingSelf,\n target: target,\n type: type,\n listener: listener\n };\n };\n /**\n * Adds the listener to the event type(s) on the target, normalizing for\n * the type of target.\n *\n * @private\n * @param {Element|Object} target\n * A DOM node or evented object.\n *\n * @param {string} method\n * The event binding method to use (\"on\" or \"one\").\n *\n * @param {string|Array} type\n * One or more event type(s).\n *\n * @param {Function} listener\n * A listener function.\n */\n\n\n var listen = function listen(target, method, type, listener) {\n validateTarget(target);\n\n if (target.nodeName) {\n Events[method](target, type, listener);\n } else {\n target[method](type, listener);\n }\n };\n /**\n * Contains methods that provide event capabilities to an object which is passed\n * to {@link module:evented|evented}.\n *\n * @mixin EventedMixin\n */\n\n\n var EventedMixin = {\n /**\n * Add a listener to an event (or events) on this object or another evented\n * object.\n *\n * @param {string|Array|Element|Object} targetOrType\n * If this is a string or array, it represents the event type(s)\n * that will trigger the listener.\n *\n * Another evented object can be passed here instead, which will\n * cause the listener to listen for events on _that_ object.\n *\n * In either case, the listener's `this` value will be bound to\n * this object.\n *\n * @param {string|Array|Function} typeOrListener\n * If the first argument was a string or array, this should be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function.\n */\n on: function on$$1() {\n var _this = this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var _normalizeListenArgs = normalizeListenArgs(this, args),\n isTargetingSelf = _normalizeListenArgs.isTargetingSelf,\n target = _normalizeListenArgs.target,\n type = _normalizeListenArgs.type,\n listener = _normalizeListenArgs.listener;\n\n listen(target, 'on', type, listener); // If this object is listening to another evented object.\n\n if (!isTargetingSelf) {\n // If this object is disposed, remove the listener.\n var removeListenerOnDispose = function removeListenerOnDispose() {\n return _this.off(target, type, listener);\n }; // Use the same function ID as the listener so we can remove it later it\n // using the ID of the original listener.\n\n\n removeListenerOnDispose.guid = listener.guid; // Add a listener to the target's dispose event as well. This ensures\n // that if the target is disposed BEFORE this object, we remove the\n // removal listener that was just added. Otherwise, we create a memory leak.\n\n var removeRemoverOnTargetDispose = function removeRemoverOnTargetDispose() {\n return _this.off('dispose', removeListenerOnDispose);\n }; // Use the same function ID as the listener so we can remove it later\n // it using the ID of the original listener.\n\n\n removeRemoverOnTargetDispose.guid = listener.guid;\n listen(this, 'on', 'dispose', removeListenerOnDispose);\n listen(target, 'on', 'dispose', removeRemoverOnTargetDispose);\n }\n },\n\n /**\n * Add a listener to an event (or events) on this object or another evented\n * object. The listener will only be called once and then removed.\n *\n * @param {string|Array|Element|Object} targetOrType\n * If this is a string or array, it represents the event type(s)\n * that will trigger the listener.\n *\n * Another evented object can be passed here instead, which will\n * cause the listener to listen for events on _that_ object.\n *\n * In either case, the listener's `this` value will be bound to\n * this object.\n *\n * @param {string|Array|Function} typeOrListener\n * If the first argument was a string or array, this should be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function.\n */\n one: function one$$1() {\n var _this2 = this;\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var _normalizeListenArgs2 = normalizeListenArgs(this, args),\n isTargetingSelf = _normalizeListenArgs2.isTargetingSelf,\n target = _normalizeListenArgs2.target,\n type = _normalizeListenArgs2.type,\n listener = _normalizeListenArgs2.listener; // Targeting this evented object.\n\n\n if (isTargetingSelf) {\n listen(target, 'one', type, listener); // Targeting another evented object.\n } else {\n var wrapper = function wrapper() {\n _this2.off(target, type, wrapper);\n\n for (var _len3 = arguments.length, largs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n largs[_key3] = arguments[_key3];\n }\n\n listener.apply(null, largs);\n }; // Use the same function ID as the listener so we can remove it later\n // it using the ID of the original listener.\n\n\n wrapper.guid = listener.guid;\n listen(target, 'one', type, wrapper);\n }\n },\n\n /**\n * Removes listener(s) from event(s) on an evented object.\n *\n * @param {string|Array|Element|Object} [targetOrType]\n * If this is a string or array, it represents the event type(s).\n *\n * Another evented object can be passed here instead, in which case\n * ALL 3 arguments are _required_.\n *\n * @param {string|Array|Function} [typeOrListener]\n * If the first argument was a string or array, this may be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function; otherwise, _all_ listeners bound to the\n * event type(s) will be removed.\n */\n off: function off$$1(targetOrType, typeOrListener, listener) {\n // Targeting this evented object.\n if (!targetOrType || isValidEventType(targetOrType)) {\n off(this.eventBusEl_, targetOrType, typeOrListener); // Targeting another evented object.\n } else {\n var target = targetOrType;\n var type = typeOrListener; // Fail fast and in a meaningful way!\n\n validateTarget(target);\n validateEventType(type);\n validateListener(listener); // Ensure there's at least a guid, even if the function hasn't been used\n\n listener = bind(this, listener); // Remove the dispose listener on this evented object, which was given\n // the same guid as the event listener in on().\n\n this.off('dispose', listener);\n\n if (target.nodeName) {\n off(target, type, listener);\n off(target, 'dispose', listener);\n } else if (isEvented(target)) {\n target.off(type, listener);\n target.off('dispose', listener);\n }\n }\n },\n\n /**\n * Fire an event on this evented object, causing its listeners to be called.\n *\n * @param {string|Object} event\n * An event type or an object with a type property.\n *\n * @param {Object} [hash]\n * An additional object to pass along to listeners.\n *\n * @return {boolean}\n * Whether or not the default behavior was prevented.\n */\n trigger: function trigger$$1(event, hash) {\n return trigger(this.eventBusEl_, event, hash);\n }\n };\n /**\n * Applies {@link module:evented~EventedMixin|EventedMixin} to a target object.\n *\n * @param {Object} target\n * The object to which to add event methods.\n *\n * @param {Object} [options={}]\n * Options for customizing the mixin behavior.\n *\n * @param {string} [options.eventBusKey]\n * By default, adds a `eventBusEl_` DOM element to the target object,\n * which is used as an event bus. If the target object already has a\n * DOM element that should be used, pass its key here.\n *\n * @return {Object}\n * The target object.\n */\n\n function evented(target, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n eventBusKey = _options.eventBusKey; // Set or create the eventBusEl_.\n\n if (eventBusKey) {\n if (!target[eventBusKey].nodeName) {\n throw new Error(\"The eventBusKey \\\"\" + eventBusKey + \"\\\" does not refer to an element.\");\n }\n\n target.eventBusEl_ = target[eventBusKey];\n } else {\n target.eventBusEl_ = createEl('span', {\n className: 'vjs-event-bus'\n });\n }\n\n assign(target, EventedMixin);\n\n if (target.eventedCallbacks) {\n target.eventedCallbacks.forEach(function (callback) {\n callback();\n });\n } // When any evented object is disposed, it removes all its listeners.\n\n\n target.on('dispose', function () {\n target.off();\n window$1.setTimeout(function () {\n target.eventBusEl_ = null;\n }, 0);\n });\n return target;\n }\n\n /**\n * @file mixins/stateful.js\n * @module stateful\n */\n /**\n * Contains methods that provide statefulness to an object which is passed\n * to {@link module:stateful}.\n *\n * @mixin StatefulMixin\n */\n\n var StatefulMixin = {\n /**\n * A hash containing arbitrary keys and values representing the state of\n * the object.\n *\n * @type {Object}\n */\n state: {},\n\n /**\n * Set the state of an object by mutating its\n * {@link module:stateful~StatefulMixin.state|state} object in place.\n *\n * @fires module:stateful~StatefulMixin#statechanged\n * @param {Object|Function} stateUpdates\n * A new set of properties to shallow-merge into the plugin state.\n * Can be a plain object or a function returning a plain object.\n *\n * @return {Object|undefined}\n * An object containing changes that occurred. If no changes\n * occurred, returns `undefined`.\n */\n setState: function setState(stateUpdates) {\n var _this = this;\n\n // Support providing the `stateUpdates` state as a function.\n if (typeof stateUpdates === 'function') {\n stateUpdates = stateUpdates();\n }\n\n var changes;\n each(stateUpdates, function (value, key) {\n // Record the change if the value is different from what's in the\n // current state.\n if (_this.state[key] !== value) {\n changes = changes || {};\n changes[key] = {\n from: _this.state[key],\n to: value\n };\n }\n\n _this.state[key] = value;\n }); // Only trigger \"statechange\" if there were changes AND we have a trigger\n // function. This allows us to not require that the target object be an\n // evented object.\n\n if (changes && isEvented(this)) {\n /**\n * An event triggered on an object that is both\n * {@link module:stateful|stateful} and {@link module:evented|evented}\n * indicating that its state has changed.\n *\n * @event module:stateful~StatefulMixin#statechanged\n * @type {Object}\n * @property {Object} changes\n * A hash containing the properties that were changed and\n * the values they were changed `from` and `to`.\n */\n this.trigger({\n changes: changes,\n type: 'statechanged'\n });\n }\n\n return changes;\n }\n };\n /**\n * Applies {@link module:stateful~StatefulMixin|StatefulMixin} to a target\n * object.\n *\n * If the target object is {@link module:evented|evented} and has a\n * `handleStateChanged` method, that method will be automatically bound to the\n * `statechanged` event on itself.\n *\n * @param {Object} target\n * The object to be made stateful.\n *\n * @param {Object} [defaultState]\n * A default set of properties to populate the newly-stateful object's\n * `state` property.\n *\n * @return {Object}\n * Returns the `target`.\n */\n\n function stateful(target, defaultState) {\n assign(target, StatefulMixin); // This happens after the mixing-in because we need to replace the `state`\n // added in that step.\n\n target.state = assign({}, target.state, defaultState); // Auto-bind the `handleStateChanged` method of the target object if it exists.\n\n if (typeof target.handleStateChanged === 'function' && isEvented(target)) {\n target.on('statechanged', target.handleStateChanged);\n }\n\n return target;\n }\n\n /**\n * @file to-title-case.js\n * @module to-title-case\n */\n\n /**\n * Uppercase the first letter of a string.\n *\n * @param {string} string\n * String to be uppercased\n *\n * @return {string}\n * The string with an uppercased first letter\n */\n function toTitleCase(string) {\n if (typeof string !== 'string') {\n return string;\n }\n\n return string.charAt(0).toUpperCase() + string.slice(1);\n }\n /**\n * Compares the TitleCase versions of the two strings for equality.\n *\n * @param {string} str1\n * The first string to compare\n *\n * @param {string} str2\n * The second string to compare\n *\n * @return {boolean}\n * Whether the TitleCase versions of the strings are equal\n */\n\n function titleCaseEquals(str1, str2) {\n return toTitleCase(str1) === toTitleCase(str2);\n }\n\n /**\n * @file merge-options.js\n * @module merge-options\n */\n /**\n * Merge two objects recursively.\n *\n * Performs a deep merge like\n * {@link https://lodash.com/docs/4.17.10#merge|lodash.merge}, but only merges\n * plain objects (not arrays, elements, or anything else).\n *\n * Non-plain object values will be copied directly from the right-most\n * argument.\n *\n * @static\n * @param {Object[]} sources\n * One or more objects to merge into a new object.\n *\n * @return {Object}\n * A new object that is the merged result of all sources.\n */\n\n function mergeOptions() {\n var result = {};\n\n for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {\n sources[_key] = arguments[_key];\n }\n\n sources.forEach(function (source) {\n if (!source) {\n return;\n }\n\n each(source, function (value, key) {\n if (!isPlain(value)) {\n result[key] = value;\n return;\n }\n\n if (!isPlain(result[key])) {\n result[key] = {};\n }\n\n result[key] = mergeOptions(result[key], value);\n });\n });\n return result;\n }\n\n /**\n * Player Component - Base class for all UI objects\n *\n * @file component.js\n */\n /**\n * Base class for all UI Components.\n * Components are UI objects which represent both a javascript object and an element\n * in the DOM. They can be children of other components, and can have\n * children themselves.\n *\n * Components can also use methods from {@link EventTarget}\n */\n\n var Component =\n /*#__PURE__*/\n function () {\n /**\n * A callback that is called when a component is ready. Does not have any\n * paramters and any callback value will be ignored.\n *\n * @callback Component~ReadyCallback\n * @this Component\n */\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Object[]} [options.children]\n * An array of children objects to intialize this component with. Children objects have\n * a name property that will be used if more than one component of the same type needs to be\n * added.\n *\n * @param {Component~ReadyCallback} [ready]\n * Function that gets called when the `Component` is ready.\n */\n function Component(player, options, ready) {\n // The component might be the player itself and we can't pass `this` to super\n if (!player && this.play) {\n this.player_ = player = this; // eslint-disable-line\n } else {\n this.player_ = player;\n } // Hold the reference to the parent component via `addChild` method\n\n\n this.parentComponent_ = null; // Make a copy of prototype.options_ to protect against overriding defaults\n\n this.options_ = mergeOptions({}, this.options_); // Updated options with supplied options\n\n options = this.options_ = mergeOptions(this.options_, options); // Get ID from options or options element if one is supplied\n\n this.id_ = options.id || options.el && options.el.id; // If there was no ID from the options, generate one\n\n if (!this.id_) {\n // Don't require the player ID function in the case of mock players\n var id = player && player.id && player.id() || 'no_player';\n this.id_ = id + \"_component_\" + newGUID();\n }\n\n this.name_ = options.name || null; // Create element if one wasn't provided in options\n\n if (options.el) {\n this.el_ = options.el;\n } else if (options.createEl !== false) {\n this.el_ = this.createEl();\n } // if evented is anything except false, we want to mixin in evented\n\n\n if (options.evented !== false) {\n // Make this an evented object and use `el_`, if available, as its event bus\n evented(this, {\n eventBusKey: this.el_ ? 'el_' : null\n });\n }\n\n stateful(this, this.constructor.defaultState);\n this.children_ = [];\n this.childIndex_ = {};\n this.childNameIndex_ = {}; // Add any child components in options\n\n if (options.initChildren !== false) {\n this.initChildren();\n }\n\n this.ready(ready); // Don't want to trigger ready here or it will before init is actually\n // finished for all children that run this constructor\n\n if (options.reportTouchActivity !== false) {\n this.enableTouchActivity();\n }\n }\n /**\n * Dispose of the `Component` and all child components.\n *\n * @fires Component#dispose\n */\n\n\n var _proto = Component.prototype;\n\n _proto.dispose = function dispose() {\n /**\n * Triggered when a `Component` is disposed.\n *\n * @event Component#dispose\n * @type {EventTarget~Event}\n *\n * @property {boolean} [bubbles=false]\n * set to false so that the close event does not\n * bubble up\n */\n this.trigger({\n type: 'dispose',\n bubbles: false\n }); // Dispose all children.\n\n if (this.children_) {\n for (var i = this.children_.length - 1; i >= 0; i--) {\n if (this.children_[i].dispose) {\n this.children_[i].dispose();\n }\n }\n } // Delete child references\n\n\n this.children_ = null;\n this.childIndex_ = null;\n this.childNameIndex_ = null;\n this.parentComponent_ = null;\n\n if (this.el_) {\n // Remove element from DOM\n if (this.el_.parentNode) {\n this.el_.parentNode.removeChild(this.el_);\n }\n\n removeData(this.el_);\n this.el_ = null;\n } // remove reference to the player after disposing of the element\n\n\n this.player_ = null;\n }\n /**\n * Return the {@link Player} that the `Component` has attached to.\n *\n * @return {Player}\n * The player that this `Component` has attached to.\n */\n ;\n\n _proto.player = function player() {\n return this.player_;\n }\n /**\n * Deep merge of options objects with new options.\n * > Note: When both `obj` and `options` contain properties whose values are objects.\n * The two properties get merged using {@link module:mergeOptions}\n *\n * @param {Object} obj\n * The object that contains new options.\n *\n * @return {Object}\n * A new object of `this.options_` and `obj` merged together.\n *\n * @deprecated since version 5\n */\n ;\n\n _proto.options = function options(obj) {\n log.warn('this.options() has been deprecated and will be moved to the constructor in 6.0');\n\n if (!obj) {\n return this.options_;\n }\n\n this.options_ = mergeOptions(this.options_, obj);\n return this.options_;\n }\n /**\n * Get the `Component`s DOM element\n *\n * @return {Element}\n * The DOM element for this `Component`.\n */\n ;\n\n _proto.el = function el() {\n return this.el_;\n }\n /**\n * Create the `Component`s DOM element.\n *\n * @param {string} [tagName]\n * Element's DOM node type. e.g. 'div'\n *\n * @param {Object} [properties]\n * An object of properties that should be set.\n *\n * @param {Object} [attributes]\n * An object of attributes that should be set.\n *\n * @return {Element}\n * The element that gets created.\n */\n ;\n\n _proto.createEl = function createEl$$1(tagName, properties, attributes) {\n return createEl(tagName, properties, attributes);\n }\n /**\n * Localize a string given the string in english.\n *\n * If tokens are provided, it'll try and run a simple token replacement on the provided string.\n * The tokens it looks for look like `{1}` with the index being 1-indexed into the tokens array.\n *\n * If a `defaultValue` is provided, it'll use that over `string`,\n * if a value isn't found in provided language files.\n * This is useful if you want to have a descriptive key for token replacement\n * but have a succinct localized string and not require `en.json` to be included.\n *\n * Currently, it is used for the progress bar timing.\n * ```js\n * {\n * \"progress bar timing: currentTime={1} duration={2}\": \"{1} of {2}\"\n * }\n * ```\n * It is then used like so:\n * ```js\n * this.localize('progress bar timing: currentTime={1} duration{2}',\n * [this.player_.currentTime(), this.player_.duration()],\n * '{1} of {2}');\n * ```\n *\n * Which outputs something like: `01:23 of 24:56`.\n *\n *\n * @param {string} string\n * The string to localize and the key to lookup in the language files.\n * @param {string[]} [tokens]\n * If the current item has token replacements, provide the tokens here.\n * @param {string} [defaultValue]\n * Defaults to `string`. Can be a default value to use for token replacement\n * if the lookup key is needed to be separate.\n *\n * @return {string}\n * The localized string or if no localization exists the english string.\n */\n ;\n\n _proto.localize = function localize(string, tokens, defaultValue) {\n if (defaultValue === void 0) {\n defaultValue = string;\n }\n\n var code = this.player_.language && this.player_.language();\n var languages = this.player_.languages && this.player_.languages();\n var language = languages && languages[code];\n var primaryCode = code && code.split('-')[0];\n var primaryLang = languages && languages[primaryCode];\n var localizedString = defaultValue;\n\n if (language && language[string]) {\n localizedString = language[string];\n } else if (primaryLang && primaryLang[string]) {\n localizedString = primaryLang[string];\n }\n\n if (tokens) {\n localizedString = localizedString.replace(/\\{(\\d+)\\}/g, function (match, index) {\n var value = tokens[index - 1];\n var ret = value;\n\n if (typeof value === 'undefined') {\n ret = match;\n }\n\n return ret;\n });\n }\n\n return localizedString;\n }\n /**\n * Return the `Component`s DOM element. This is where children get inserted.\n * This will usually be the the same as the element returned in {@link Component#el}.\n *\n * @return {Element}\n * The content element for this `Component`.\n */\n ;\n\n _proto.contentEl = function contentEl() {\n return this.contentEl_ || this.el_;\n }\n /**\n * Get this `Component`s ID\n *\n * @return {string}\n * The id of this `Component`\n */\n ;\n\n _proto.id = function id() {\n return this.id_;\n }\n /**\n * Get the `Component`s name. The name gets used to reference the `Component`\n * and is set during registration.\n *\n * @return {string}\n * The name of this `Component`.\n */\n ;\n\n _proto.name = function name() {\n return this.name_;\n }\n /**\n * Get an array of all child components\n *\n * @return {Array}\n * The children\n */\n ;\n\n _proto.children = function children() {\n return this.children_;\n }\n /**\n * Returns the child `Component` with the given `id`.\n *\n * @param {string} id\n * The id of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The child `Component` with the given `id` or undefined.\n */\n ;\n\n _proto.getChildById = function getChildById(id) {\n return this.childIndex_[id];\n }\n /**\n * Returns the child `Component` with the given `name`.\n *\n * @param {string} name\n * The name of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The child `Component` with the given `name` or undefined.\n */\n ;\n\n _proto.getChild = function getChild(name) {\n if (!name) {\n return;\n }\n\n name = toTitleCase(name);\n return this.childNameIndex_[name];\n }\n /**\n * Add a child `Component` inside the current `Component`.\n *\n *\n * @param {string|Component} child\n * The name or instance of a child to add.\n *\n * @param {Object} [options={}]\n * The key/value store of options that will get passed to children of\n * the child.\n *\n * @param {number} [index=this.children_.length]\n * The index to attempt to add a child into.\n *\n * @return {Component}\n * The `Component` that gets added as a child. When using a string the\n * `Component` will get created by this process.\n */\n ;\n\n _proto.addChild = function addChild(child, options, index) {\n if (options === void 0) {\n options = {};\n }\n\n if (index === void 0) {\n index = this.children_.length;\n }\n\n var component;\n var componentName; // If child is a string, create component with options\n\n if (typeof child === 'string') {\n componentName = toTitleCase(child);\n var componentClassName = options.componentClass || componentName; // Set name through options\n\n options.name = componentName; // Create a new object & element for this controls set\n // If there's no .player_, this is a player\n\n var ComponentClass = Component.getComponent(componentClassName);\n\n if (!ComponentClass) {\n throw new Error(\"Component \" + componentClassName + \" does not exist\");\n } // data stored directly on the videojs object may be\n // misidentified as a component to retain\n // backwards-compatibility with 4.x. check to make sure the\n // component class can be instantiated.\n\n\n if (typeof ComponentClass !== 'function') {\n return null;\n }\n\n component = new ComponentClass(this.player_ || this, options); // child is a component instance\n } else {\n component = child;\n }\n\n if (component.parentComponent_) {\n component.parentComponent_.removeChild(component);\n }\n\n this.children_.splice(index, 0, component);\n component.parentComponent_ = this;\n\n if (typeof component.id === 'function') {\n this.childIndex_[component.id()] = component;\n } // If a name wasn't used to create the component, check if we can use the\n // name function of the component\n\n\n componentName = componentName || component.name && toTitleCase(component.name());\n\n if (componentName) {\n this.childNameIndex_[componentName] = component;\n } // Add the UI object's element to the container div (box)\n // Having an element is not required\n\n\n if (typeof component.el === 'function' && component.el()) {\n var childNodes = this.contentEl().children;\n var refNode = childNodes[index] || null;\n this.contentEl().insertBefore(component.el(), refNode);\n } // Return so it can stored on parent object if desired.\n\n\n return component;\n }\n /**\n * Remove a child `Component` from this `Component`s list of children. Also removes\n * the child `Component`s element from this `Component`s element.\n *\n * @param {Component} component\n * The child `Component` to remove.\n */\n ;\n\n _proto.removeChild = function removeChild(component) {\n if (typeof component === 'string') {\n component = this.getChild(component);\n }\n\n if (!component || !this.children_) {\n return;\n }\n\n var childFound = false;\n\n for (var i = this.children_.length - 1; i >= 0; i--) {\n if (this.children_[i] === component) {\n childFound = true;\n this.children_.splice(i, 1);\n break;\n }\n }\n\n if (!childFound) {\n return;\n }\n\n component.parentComponent_ = null;\n this.childIndex_[component.id()] = null;\n this.childNameIndex_[component.name()] = null;\n var compEl = component.el();\n\n if (compEl && compEl.parentNode === this.contentEl()) {\n this.contentEl().removeChild(component.el());\n }\n }\n /**\n * Add and initialize default child `Component`s based upon options.\n */\n ;\n\n _proto.initChildren = function initChildren() {\n var _this = this;\n\n var children = this.options_.children;\n\n if (children) {\n // `this` is `parent`\n var parentOptions = this.options_;\n\n var handleAdd = function handleAdd(child) {\n var name = child.name;\n var opts = child.opts; // Allow options for children to be set at the parent options\n // e.g. videojs(id, { controlBar: false });\n // instead of videojs(id, { children: { controlBar: false });\n\n if (parentOptions[name] !== undefined) {\n opts = parentOptions[name];\n } // Allow for disabling default components\n // e.g. options['children']['posterImage'] = false\n\n\n if (opts === false) {\n return;\n } // Allow options to be passed as a simple boolean if no configuration\n // is necessary.\n\n\n if (opts === true) {\n opts = {};\n } // We also want to pass the original player options\n // to each component as well so they don't need to\n // reach back into the player for options later.\n\n\n opts.playerOptions = _this.options_.playerOptions; // Create and add the child component.\n // Add a direct reference to the child by name on the parent instance.\n // If two of the same component are used, different names should be supplied\n // for each\n\n var newChild = _this.addChild(name, opts);\n\n if (newChild) {\n _this[name] = newChild;\n }\n }; // Allow for an array of children details to passed in the options\n\n\n var workingChildren;\n var Tech = Component.getComponent('Tech');\n\n if (Array.isArray(children)) {\n workingChildren = children;\n } else {\n workingChildren = Object.keys(children);\n }\n\n workingChildren // children that are in this.options_ but also in workingChildren would\n // give us extra children we do not want. So, we want to filter them out.\n .concat(Object.keys(this.options_).filter(function (child) {\n return !workingChildren.some(function (wchild) {\n if (typeof wchild === 'string') {\n return child === wchild;\n }\n\n return child === wchild.name;\n });\n })).map(function (child) {\n var name;\n var opts;\n\n if (typeof child === 'string') {\n name = child;\n opts = children[name] || _this.options_[name] || {};\n } else {\n name = child.name;\n opts = child;\n }\n\n return {\n name: name,\n opts: opts\n };\n }).filter(function (child) {\n // we have to make sure that child.name isn't in the techOrder since\n // techs are registerd as Components but can't aren't compatible\n // See https://github.com/videojs/video.js/issues/2772\n var c = Component.getComponent(child.opts.componentClass || toTitleCase(child.name));\n return c && !Tech.isTech(c);\n }).forEach(handleAdd);\n }\n }\n /**\n * Builds the default DOM class name. Should be overriden by sub-components.\n *\n * @return {string}\n * The DOM class name for this object.\n *\n * @abstract\n */\n ;\n\n _proto.buildCSSClass = function buildCSSClass() {\n // Child classes can include a function that does:\n // return 'CLASS NAME' + this._super();\n return '';\n }\n /**\n * Bind a listener to the component's ready state.\n * Different from event listeners in that if the ready event has already happened\n * it will trigger the function immediately.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n ;\n\n _proto.ready = function ready(fn, sync) {\n if (sync === void 0) {\n sync = false;\n }\n\n if (!fn) {\n return;\n }\n\n if (!this.isReady_) {\n this.readyQueue_ = this.readyQueue_ || [];\n this.readyQueue_.push(fn);\n return;\n }\n\n if (sync) {\n fn.call(this);\n } else {\n // Call the function asynchronously by default for consistency\n this.setTimeout(fn, 1);\n }\n }\n /**\n * Trigger all the ready listeners for this `Component`.\n *\n * @fires Component#ready\n */\n ;\n\n _proto.triggerReady = function triggerReady() {\n this.isReady_ = true; // Ensure ready is triggered asynchronously\n\n this.setTimeout(function () {\n var readyQueue = this.readyQueue_; // Reset Ready Queue\n\n this.readyQueue_ = [];\n\n if (readyQueue && readyQueue.length > 0) {\n readyQueue.forEach(function (fn) {\n fn.call(this);\n }, this);\n } // Allow for using event listeners also\n\n /**\n * Triggered when a `Component` is ready.\n *\n * @event Component#ready\n * @type {EventTarget~Event}\n */\n\n\n this.trigger('ready');\n }, 1);\n }\n /**\n * Find a single DOM element matching a `selector`. This can be within the `Component`s\n * `contentEl()` or another custom context.\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelector`.\n *\n * @param {Element|string} [context=this.contentEl()]\n * A DOM element within which to query. Can also be a selector string in\n * which case the first matching element will get used as context. If\n * missing `this.contentEl()` gets used. If `this.contentEl()` returns\n * nothing it falls back to `document`.\n *\n * @return {Element|null}\n * the dom element that was found, or null\n *\n * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)\n */\n ;\n\n _proto.$ = function $$$1(selector, context) {\n return $(selector, context || this.contentEl());\n }\n /**\n * Finds all DOM element matching a `selector`. This can be within the `Component`s\n * `contentEl()` or another custom context.\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelectorAll`.\n *\n * @param {Element|string} [context=this.contentEl()]\n * A DOM element within which to query. Can also be a selector string in\n * which case the first matching element will get used as context. If\n * missing `this.contentEl()` gets used. If `this.contentEl()` returns\n * nothing it falls back to `document`.\n *\n * @return {NodeList}\n * a list of dom elements that were found\n *\n * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)\n */\n ;\n\n _proto.$$ = function $$$$1(selector, context) {\n return $$(selector, context || this.contentEl());\n }\n /**\n * Check if a component's element has a CSS class name.\n *\n * @param {string} classToCheck\n * CSS class name to check.\n *\n * @return {boolean}\n * - True if the `Component` has the class.\n * - False if the `Component` does not have the class`\n */\n ;\n\n _proto.hasClass = function hasClass$$1(classToCheck) {\n return hasClass(this.el_, classToCheck);\n }\n /**\n * Add a CSS class name to the `Component`s element.\n *\n * @param {string} classToAdd\n * CSS class name to add\n */\n ;\n\n _proto.addClass = function addClass$$1(classToAdd) {\n addClass(this.el_, classToAdd);\n }\n /**\n * Remove a CSS class name from the `Component`s element.\n *\n * @param {string} classToRemove\n * CSS class name to remove\n */\n ;\n\n _proto.removeClass = function removeClass$$1(classToRemove) {\n removeClass(this.el_, classToRemove);\n }\n /**\n * Add or remove a CSS class name from the component's element.\n * - `classToToggle` gets added when {@link Component#hasClass} would return false.\n * - `classToToggle` gets removed when {@link Component#hasClass} would return true.\n *\n * @param {string} classToToggle\n * The class to add or remove based on (@link Component#hasClass}\n *\n * @param {boolean|Dom~predicate} [predicate]\n * An {@link Dom~predicate} function or a boolean\n */\n ;\n\n _proto.toggleClass = function toggleClass$$1(classToToggle, predicate) {\n toggleClass(this.el_, classToToggle, predicate);\n }\n /**\n * Show the `Component`s element if it is hidden by removing the\n * 'vjs-hidden' class name from it.\n */\n ;\n\n _proto.show = function show() {\n this.removeClass('vjs-hidden');\n }\n /**\n * Hide the `Component`s element if it is currently showing by adding the\n * 'vjs-hidden` class name to it.\n */\n ;\n\n _proto.hide = function hide() {\n this.addClass('vjs-hidden');\n }\n /**\n * Lock a `Component`s element in its visible state by adding the 'vjs-lock-showing'\n * class name to it. Used during fadeIn/fadeOut.\n *\n * @private\n */\n ;\n\n _proto.lockShowing = function lockShowing() {\n this.addClass('vjs-lock-showing');\n }\n /**\n * Unlock a `Component`s element from its visible state by removing the 'vjs-lock-showing'\n * class name from it. Used during fadeIn/fadeOut.\n *\n * @private\n */\n ;\n\n _proto.unlockShowing = function unlockShowing() {\n this.removeClass('vjs-lock-showing');\n }\n /**\n * Get the value of an attribute on the `Component`s element.\n *\n * @param {string} attribute\n * Name of the attribute to get the value from.\n *\n * @return {string|null}\n * - The value of the attribute that was asked for.\n * - Can be an empty string on some browsers if the attribute does not exist\n * or has no value\n * - Most browsers will return null if the attibute does not exist or has\n * no value.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute}\n */\n ;\n\n _proto.getAttribute = function getAttribute$$1(attribute) {\n return getAttribute(this.el_, attribute);\n }\n /**\n * Set the value of an attribute on the `Component`'s element\n *\n * @param {string} attribute\n * Name of the attribute to set.\n *\n * @param {string} value\n * Value to set the attribute to.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute}\n */\n ;\n\n _proto.setAttribute = function setAttribute$$1(attribute, value) {\n setAttribute(this.el_, attribute, value);\n }\n /**\n * Remove an attribute from the `Component`s element.\n *\n * @param {string} attribute\n * Name of the attribute to remove.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute}\n */\n ;\n\n _proto.removeAttribute = function removeAttribute$$1(attribute) {\n removeAttribute(this.el_, attribute);\n }\n /**\n * Get or set the width of the component based upon the CSS styles.\n * See {@link Component#dimension} for more detailed information.\n *\n * @param {number|string} [num]\n * The width that you want to set postfixed with '%', 'px' or nothing.\n *\n * @param {boolean} [skipListeners]\n * Skip the componentresize event trigger\n *\n * @return {number|string}\n * The width when getting, zero if there is no width. Can be a string\n * postpixed with '%' or 'px'.\n */\n ;\n\n _proto.width = function width(num, skipListeners) {\n return this.dimension('width', num, skipListeners);\n }\n /**\n * Get or set the height of the component based upon the CSS styles.\n * See {@link Component#dimension} for more detailed information.\n *\n * @param {number|string} [num]\n * The height that you want to set postfixed with '%', 'px' or nothing.\n *\n * @param {boolean} [skipListeners]\n * Skip the componentresize event trigger\n *\n * @return {number|string}\n * The width when getting, zero if there is no width. Can be a string\n * postpixed with '%' or 'px'.\n */\n ;\n\n _proto.height = function height(num, skipListeners) {\n return this.dimension('height', num, skipListeners);\n }\n /**\n * Set both the width and height of the `Component` element at the same time.\n *\n * @param {number|string} width\n * Width to set the `Component`s element to.\n *\n * @param {number|string} height\n * Height to set the `Component`s element to.\n */\n ;\n\n _proto.dimensions = function dimensions(width, height) {\n // Skip componentresize listeners on width for optimization\n this.width(width, true);\n this.height(height);\n }\n /**\n * Get or set width or height of the `Component` element. This is the shared code\n * for the {@link Component#width} and {@link Component#height}.\n *\n * Things to know:\n * - If the width or height in an number this will return the number postfixed with 'px'.\n * - If the width/height is a percent this will return the percent postfixed with '%'\n * - Hidden elements have a width of 0 with `window.getComputedStyle`. This function\n * defaults to the `Component`s `style.width` and falls back to `window.getComputedStyle`.\n * See [this]{@link http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/}\n * for more information\n * - If you want the computed style of the component, use {@link Component#currentWidth}\n * and {@link {Component#currentHeight}\n *\n * @fires Component#componentresize\n *\n * @param {string} widthOrHeight\n 8 'width' or 'height'\n *\n * @param {number|string} [num]\n 8 New dimension\n *\n * @param {boolean} [skipListeners]\n * Skip componentresize event trigger\n *\n * @return {number}\n * The dimension when getting or 0 if unset\n */\n ;\n\n _proto.dimension = function dimension(widthOrHeight, num, skipListeners) {\n if (num !== undefined) {\n // Set to zero if null or literally NaN (NaN !== NaN)\n if (num === null || num !== num) {\n num = 0;\n } // Check if using css width/height (% or px) and adjust\n\n\n if (('' + num).indexOf('%') !== -1 || ('' + num).indexOf('px') !== -1) {\n this.el_.style[widthOrHeight] = num;\n } else if (num === 'auto') {\n this.el_.style[widthOrHeight] = '';\n } else {\n this.el_.style[widthOrHeight] = num + 'px';\n } // skipListeners allows us to avoid triggering the resize event when setting both width and height\n\n\n if (!skipListeners) {\n /**\n * Triggered when a component is resized.\n *\n * @event Component#componentresize\n * @type {EventTarget~Event}\n */\n this.trigger('componentresize');\n }\n\n return;\n } // Not setting a value, so getting it\n // Make sure element exists\n\n\n if (!this.el_) {\n return 0;\n } // Get dimension value from style\n\n\n var val = this.el_.style[widthOrHeight];\n var pxIndex = val.indexOf('px');\n\n if (pxIndex !== -1) {\n // Return the pixel value with no 'px'\n return parseInt(val.slice(0, pxIndex), 10);\n } // No px so using % or no style was set, so falling back to offsetWidth/height\n // If component has display:none, offset will return 0\n // TODO: handle display:none and no dimension style using px\n\n\n return parseInt(this.el_['offset' + toTitleCase(widthOrHeight)], 10);\n }\n /**\n * Get the computed width or the height of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @param {string} widthOrHeight\n * A string containing 'width' or 'height'. Whichever one you want to get.\n *\n * @return {number}\n * The dimension that gets asked for or 0 if nothing was set\n * for that dimension.\n */\n ;\n\n _proto.currentDimension = function currentDimension(widthOrHeight) {\n var computedWidthOrHeight = 0;\n\n if (widthOrHeight !== 'width' && widthOrHeight !== 'height') {\n throw new Error('currentDimension only accepts width or height value');\n }\n\n if (typeof window$1.getComputedStyle === 'function') {\n var computedStyle = window$1.getComputedStyle(this.el_);\n computedWidthOrHeight = computedStyle.getPropertyValue(widthOrHeight) || computedStyle[widthOrHeight];\n } // remove 'px' from variable and parse as integer\n\n\n computedWidthOrHeight = parseFloat(computedWidthOrHeight); // if the computed value is still 0, it's possible that the browser is lying\n // and we want to check the offset values.\n // This code also runs wherever getComputedStyle doesn't exist.\n\n if (computedWidthOrHeight === 0) {\n var rule = \"offset\" + toTitleCase(widthOrHeight);\n computedWidthOrHeight = this.el_[rule];\n }\n\n return computedWidthOrHeight;\n }\n /**\n * An object that contains width and height values of the `Component`s\n * computed style. Uses `window.getComputedStyle`.\n *\n * @typedef {Object} Component~DimensionObject\n *\n * @property {number} width\n * The width of the `Component`s computed style.\n *\n * @property {number} height\n * The height of the `Component`s computed style.\n */\n\n /**\n * Get an object that contains computed width and height values of the\n * component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {Component~DimensionObject}\n * The computed dimensions of the component's element.\n */\n ;\n\n _proto.currentDimensions = function currentDimensions() {\n return {\n width: this.currentDimension('width'),\n height: this.currentDimension('height')\n };\n }\n /**\n * Get the computed width of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {number}\n * The computed width of the component's element.\n */\n ;\n\n _proto.currentWidth = function currentWidth() {\n return this.currentDimension('width');\n }\n /**\n * Get the computed height of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {number}\n * The computed height of the component's element.\n */\n ;\n\n _proto.currentHeight = function currentHeight() {\n return this.currentDimension('height');\n }\n /**\n * Set the focus to this component\n */\n ;\n\n _proto.focus = function focus() {\n this.el_.focus();\n }\n /**\n * Remove the focus from this component\n */\n ;\n\n _proto.blur = function blur() {\n this.el_.blur();\n }\n /**\n * When this Component receives a `keydown` event which it does not process,\n * it passes the event to the Player for handling.\n *\n * @param {EventTarget~Event} event\n * The `keydown` event that caused this function to be called.\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n if (this.player_) {\n // We only stop propagation here because we want unhandled events to fall\n // back to the browser.\n event.stopPropagation();\n this.player_.handleKeyDown(event);\n }\n }\n /**\n * Many components used to have a `handleKeyPress` method, which was poorly\n * named because it listened to a `keydown` event. This method name now\n * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress`\n * will not see their method calls stop working.\n *\n * @param {EventTarget~Event} event\n * The event that caused this function to be called.\n */\n ;\n\n _proto.handleKeyPress = function handleKeyPress(event) {\n this.handleKeyDown(event);\n }\n /**\n * Emit a 'tap' events when touch event support gets detected. This gets used to\n * support toggling the controls through a tap on the video. They get enabled\n * because every sub-component would have extra overhead otherwise.\n *\n * @private\n * @fires Component#tap\n * @listens Component#touchstart\n * @listens Component#touchmove\n * @listens Component#touchleave\n * @listens Component#touchcancel\n * @listens Component#touchend\n */\n ;\n\n _proto.emitTapEvents = function emitTapEvents() {\n // Track the start time so we can determine how long the touch lasted\n var touchStart = 0;\n var firstTouch = null; // Maximum movement allowed during a touch event to still be considered a tap\n // Other popular libs use anywhere from 2 (hammer.js) to 15,\n // so 10 seems like a nice, round number.\n\n var tapMovementThreshold = 10; // The maximum length a touch can be while still being considered a tap\n\n var touchTimeThreshold = 200;\n var couldBeTap;\n this.on('touchstart', function (event) {\n // If more than one finger, don't consider treating this as a click\n if (event.touches.length === 1) {\n // Copy pageX/pageY from the object\n firstTouch = {\n pageX: event.touches[0].pageX,\n pageY: event.touches[0].pageY\n }; // Record start time so we can detect a tap vs. \"touch and hold\"\n\n touchStart = new Date().getTime(); // Reset couldBeTap tracking\n\n couldBeTap = true;\n }\n });\n this.on('touchmove', function (event) {\n // If more than one finger, don't consider treating this as a click\n if (event.touches.length > 1) {\n couldBeTap = false;\n } else if (firstTouch) {\n // Some devices will throw touchmoves for all but the slightest of taps.\n // So, if we moved only a small distance, this could still be a tap\n var xdiff = event.touches[0].pageX - firstTouch.pageX;\n var ydiff = event.touches[0].pageY - firstTouch.pageY;\n var touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);\n\n if (touchDistance > tapMovementThreshold) {\n couldBeTap = false;\n }\n }\n });\n\n var noTap = function noTap() {\n couldBeTap = false;\n }; // TODO: Listen to the original target. http://youtu.be/DujfpXOKUp8?t=13m8s\n\n\n this.on('touchleave', noTap);\n this.on('touchcancel', noTap); // When the touch ends, measure how long it took and trigger the appropriate\n // event\n\n this.on('touchend', function (event) {\n firstTouch = null; // Proceed only if the touchmove/leave/cancel event didn't happen\n\n if (couldBeTap === true) {\n // Measure how long the touch lasted\n var touchTime = new Date().getTime() - touchStart; // Make sure the touch was less than the threshold to be considered a tap\n\n if (touchTime < touchTimeThreshold) {\n // Don't let browser turn this into a click\n event.preventDefault();\n /**\n * Triggered when a `Component` is tapped.\n *\n * @event Component#tap\n * @type {EventTarget~Event}\n */\n\n this.trigger('tap'); // It may be good to copy the touchend event object and change the\n // type to tap, if the other event properties aren't exact after\n // Events.fixEvent runs (e.g. event.target)\n }\n }\n });\n }\n /**\n * This function reports user activity whenever touch events happen. This can get\n * turned off by any sub-components that wants touch events to act another way.\n *\n * Report user touch activity when touch events occur. User activity gets used to\n * determine when controls should show/hide. It is simple when it comes to mouse\n * events, because any mouse event should show the controls. So we capture mouse\n * events that bubble up to the player and report activity when that happens.\n * With touch events it isn't as easy as `touchstart` and `touchend` toggle player\n * controls. So touch events can't help us at the player level either.\n *\n * User activity gets checked asynchronously. So what could happen is a tap event\n * on the video turns the controls off. Then the `touchend` event bubbles up to\n * the player. Which, if it reported user activity, would turn the controls right\n * back on. We also don't want to completely block touch events from bubbling up.\n * Furthermore a `touchmove` event and anything other than a tap, should not turn\n * controls back on.\n *\n * @listens Component#touchstart\n * @listens Component#touchmove\n * @listens Component#touchend\n * @listens Component#touchcancel\n */\n ;\n\n _proto.enableTouchActivity = function enableTouchActivity() {\n // Don't continue if the root player doesn't support reporting user activity\n if (!this.player() || !this.player().reportUserActivity) {\n return;\n } // listener for reporting that the user is active\n\n\n var report = bind(this.player(), this.player().reportUserActivity);\n var touchHolding;\n this.on('touchstart', function () {\n report(); // For as long as the they are touching the device or have their mouse down,\n // we consider them active even if they're not moving their finger or mouse.\n // So we want to continue to update that they are active\n\n this.clearInterval(touchHolding); // report at the same interval as activityCheck\n\n touchHolding = this.setInterval(report, 250);\n });\n\n var touchEnd = function touchEnd(event) {\n report(); // stop the interval that maintains activity if the touch is holding\n\n this.clearInterval(touchHolding);\n };\n\n this.on('touchmove', report);\n this.on('touchend', touchEnd);\n this.on('touchcancel', touchEnd);\n }\n /**\n * A callback that has no parameters and is bound into `Component`s context.\n *\n * @callback Component~GenericCallback\n * @this Component\n */\n\n /**\n * Creates a function that runs after an `x` millisecond timeout. This function is a\n * wrapper around `window.setTimeout`. There are a few reasons to use this one\n * instead though:\n * 1. It gets cleared via {@link Component#clearTimeout} when\n * {@link Component#dispose} gets called.\n * 2. The function callback will gets turned into a {@link Component~GenericCallback}\n *\n * > Note: You can't use `window.clearTimeout` on the id returned by this function. This\n * will cause its dispose listener not to get cleaned up! Please use\n * {@link Component#clearTimeout} or {@link Component#dispose} instead.\n *\n * @param {Component~GenericCallback} fn\n * The function that will be run after `timeout`.\n *\n * @param {number} timeout\n * Timeout in milliseconds to delay before executing the specified function.\n *\n * @return {number}\n * Returns a timeout ID that gets used to identify the timeout. It can also\n * get used in {@link Component#clearTimeout} to clear the timeout that\n * was set.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout}\n */\n ;\n\n _proto.setTimeout = function setTimeout(fn, timeout) {\n var _this2 = this;\n\n // declare as variables so they are properly available in timeout function\n // eslint-disable-next-line\n var timeoutId, disposeFn;\n fn = bind(this, fn);\n timeoutId = window$1.setTimeout(function () {\n _this2.off('dispose', disposeFn);\n\n fn();\n }, timeout);\n\n disposeFn = function disposeFn() {\n return _this2.clearTimeout(timeoutId);\n };\n\n disposeFn.guid = \"vjs-timeout-\" + timeoutId;\n this.on('dispose', disposeFn);\n return timeoutId;\n }\n /**\n * Clears a timeout that gets created via `window.setTimeout` or\n * {@link Component#setTimeout}. If you set a timeout via {@link Component#setTimeout}\n * use this function instead of `window.clearTimout`. If you don't your dispose\n * listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} timeoutId\n * The id of the timeout to clear. The return value of\n * {@link Component#setTimeout} or `window.setTimeout`.\n *\n * @return {number}\n * Returns the timeout id that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearTimeout}\n */\n ;\n\n _proto.clearTimeout = function clearTimeout(timeoutId) {\n window$1.clearTimeout(timeoutId);\n\n var disposeFn = function disposeFn() {};\n\n disposeFn.guid = \"vjs-timeout-\" + timeoutId;\n this.off('dispose', disposeFn);\n return timeoutId;\n }\n /**\n * Creates a function that gets run every `x` milliseconds. This function is a wrapper\n * around `window.setInterval`. There are a few reasons to use this one instead though.\n * 1. It gets cleared via {@link Component#clearInterval} when\n * {@link Component#dispose} gets called.\n * 2. The function callback will be a {@link Component~GenericCallback}\n *\n * @param {Component~GenericCallback} fn\n * The function to run every `x` seconds.\n *\n * @param {number} interval\n * Execute the specified function every `x` milliseconds.\n *\n * @return {number}\n * Returns an id that can be used to identify the interval. It can also be be used in\n * {@link Component#clearInterval} to clear the interval.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval}\n */\n ;\n\n _proto.setInterval = function setInterval(fn, interval) {\n var _this3 = this;\n\n fn = bind(this, fn);\n var intervalId = window$1.setInterval(fn, interval);\n\n var disposeFn = function disposeFn() {\n return _this3.clearInterval(intervalId);\n };\n\n disposeFn.guid = \"vjs-interval-\" + intervalId;\n this.on('dispose', disposeFn);\n return intervalId;\n }\n /**\n * Clears an interval that gets created via `window.setInterval` or\n * {@link Component#setInterval}. If you set an inteval via {@link Component#setInterval}\n * use this function instead of `window.clearInterval`. If you don't your dispose\n * listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} intervalId\n * The id of the interval to clear. The return value of\n * {@link Component#setInterval} or `window.setInterval`.\n *\n * @return {number}\n * Returns the interval id that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearInterval}\n */\n ;\n\n _proto.clearInterval = function clearInterval(intervalId) {\n window$1.clearInterval(intervalId);\n\n var disposeFn = function disposeFn() {};\n\n disposeFn.guid = \"vjs-interval-\" + intervalId;\n this.off('dispose', disposeFn);\n return intervalId;\n }\n /**\n * Queues up a callback to be passed to requestAnimationFrame (rAF), but\n * with a few extra bonuses:\n *\n * - Supports browsers that do not support rAF by falling back to\n * {@link Component#setTimeout}.\n *\n * - The callback is turned into a {@link Component~GenericCallback} (i.e.\n * bound to the component).\n *\n * - Automatic cancellation of the rAF callback is handled if the component\n * is disposed before it is called.\n *\n * @param {Component~GenericCallback} fn\n * A function that will be bound to this component and executed just\n * before the browser's next repaint.\n *\n * @return {number}\n * Returns an rAF ID that gets used to identify the timeout. It can\n * also be used in {@link Component#cancelAnimationFrame} to cancel\n * the animation frame callback.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame}\n */\n ;\n\n _proto.requestAnimationFrame = function requestAnimationFrame(fn) {\n var _this4 = this;\n\n // declare as variables so they are properly available in rAF function\n // eslint-disable-next-line\n var id, disposeFn;\n\n if (this.supportsRaf_) {\n fn = bind(this, fn);\n id = window$1.requestAnimationFrame(function () {\n _this4.off('dispose', disposeFn);\n\n fn();\n });\n\n disposeFn = function disposeFn() {\n return _this4.cancelAnimationFrame(id);\n };\n\n disposeFn.guid = \"vjs-raf-\" + id;\n this.on('dispose', disposeFn);\n return id;\n } // Fall back to using a timer.\n\n\n return this.setTimeout(fn, 1000 / 60);\n }\n /**\n * Cancels a queued callback passed to {@link Component#requestAnimationFrame}\n * (rAF).\n *\n * If you queue an rAF callback via {@link Component#requestAnimationFrame},\n * use this function instead of `window.cancelAnimationFrame`. If you don't,\n * your dispose listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} id\n * The rAF ID to clear. The return value of {@link Component#requestAnimationFrame}.\n *\n * @return {number}\n * Returns the rAF ID that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/cancelAnimationFrame}\n */\n ;\n\n _proto.cancelAnimationFrame = function cancelAnimationFrame(id) {\n if (this.supportsRaf_) {\n window$1.cancelAnimationFrame(id);\n\n var disposeFn = function disposeFn() {};\n\n disposeFn.guid = \"vjs-raf-\" + id;\n this.off('dispose', disposeFn);\n return id;\n } // Fall back to using a timer.\n\n\n return this.clearTimeout(id);\n }\n /**\n * Register a `Component` with `videojs` given the name and the component.\n *\n * > NOTE: {@link Tech}s should not be registered as a `Component`. {@link Tech}s\n * should be registered using {@link Tech.registerTech} or\n * {@link videojs:videojs.registerTech}.\n *\n * > NOTE: This function can also be seen on videojs as\n * {@link videojs:videojs.registerComponent}.\n *\n * @param {string} name\n * The name of the `Component` to register.\n *\n * @param {Component} ComponentToRegister\n * The `Component` class to register.\n *\n * @return {Component}\n * The `Component` that was registered.\n */\n ;\n\n Component.registerComponent = function registerComponent(name, ComponentToRegister) {\n if (typeof name !== 'string' || !name) {\n throw new Error(\"Illegal component name, \\\"\" + name + \"\\\"; must be a non-empty string.\");\n }\n\n var Tech = Component.getComponent('Tech'); // We need to make sure this check is only done if Tech has been registered.\n\n var isTech = Tech && Tech.isTech(ComponentToRegister);\n var isComp = Component === ComponentToRegister || Component.prototype.isPrototypeOf(ComponentToRegister.prototype);\n\n if (isTech || !isComp) {\n var reason;\n\n if (isTech) {\n reason = 'techs must be registered using Tech.registerTech()';\n } else {\n reason = 'must be a Component subclass';\n }\n\n throw new Error(\"Illegal component, \\\"\" + name + \"\\\"; \" + reason + \".\");\n }\n\n name = toTitleCase(name);\n\n if (!Component.components_) {\n Component.components_ = {};\n }\n\n var Player = Component.getComponent('Player');\n\n if (name === 'Player' && Player && Player.players) {\n var players = Player.players;\n var playerNames = Object.keys(players); // If we have players that were disposed, then their name will still be\n // in Players.players. So, we must loop through and verify that the value\n // for each item is not null. This allows registration of the Player component\n // after all players have been disposed or before any were created.\n\n if (players && playerNames.length > 0 && playerNames.map(function (pname) {\n return players[pname];\n }).every(Boolean)) {\n throw new Error('Can not register Player component after player has been created.');\n }\n }\n\n Component.components_[name] = ComponentToRegister;\n return ComponentToRegister;\n }\n /**\n * Get a `Component` based on the name it was registered with.\n *\n * @param {string} name\n * The Name of the component to get.\n *\n * @return {Component}\n * The `Component` that got registered under the given name.\n *\n * @deprecated In `videojs` 6 this will not return `Component`s that were not\n * registered using {@link Component.registerComponent}. Currently we\n * check the global `videojs` object for a `Component` name and\n * return that if it exists.\n */\n ;\n\n Component.getComponent = function getComponent(name) {\n if (!name) {\n return;\n }\n\n name = toTitleCase(name);\n\n if (Component.components_ && Component.components_[name]) {\n return Component.components_[name];\n }\n };\n\n return Component;\n }();\n /**\n * Whether or not this component supports `requestAnimationFrame`.\n *\n * This is exposed primarily for testing purposes.\n *\n * @private\n * @type {Boolean}\n */\n\n\n Component.prototype.supportsRaf_ = typeof window$1.requestAnimationFrame === 'function' && typeof window$1.cancelAnimationFrame === 'function';\n Component.registerComponent('Component', Component);\n\n /**\n * @file browser.js\n * @module browser\n */\n var USER_AGENT = window$1.navigator && window$1.navigator.userAgent || '';\n var webkitVersionMap = /AppleWebKit\\/([\\d.]+)/i.exec(USER_AGENT);\n var appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;\n /**\n * Whether or not this device is an iPad.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var IS_IPAD = /iPad/i.test(USER_AGENT);\n /**\n * Whether or not this device is an iPhone.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n // The Facebook app's UIWebView identifies as both an iPhone and iPad, so\n // to identify iPhones, we need to exclude iPads.\n // http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/\n\n var IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD;\n /**\n * Whether or not this device is an iPod.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var IS_IPOD = /iPod/i.test(USER_AGENT);\n /**\n * Whether or not this is an iOS device.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;\n /**\n * The detected iOS version - or `null`.\n *\n * @static\n * @const\n * @type {string|null}\n */\n\n var IOS_VERSION = function () {\n var match = USER_AGENT.match(/OS (\\d+)_/i);\n\n if (match && match[1]) {\n return match[1];\n }\n\n return null;\n }();\n /**\n * Whether or not this is an Android device.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var IS_ANDROID = /Android/i.test(USER_AGENT);\n /**\n * The detected Android version - or `null`.\n *\n * @static\n * @const\n * @type {number|string|null}\n */\n\n var ANDROID_VERSION = function () {\n // This matches Android Major.Minor.Patch versions\n // ANDROID_VERSION is Major.Minor as a Number, if Minor isn't available, then only Major is returned\n var match = USER_AGENT.match(/Android (\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))*/i);\n\n if (!match) {\n return null;\n }\n\n var major = match[1] && parseFloat(match[1]);\n var minor = match[2] && parseFloat(match[2]);\n\n if (major && minor) {\n return parseFloat(match[1] + '.' + match[2]);\n } else if (major) {\n return major;\n }\n\n return null;\n }();\n /**\n * Whether or not this is a native Android browser.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebkitVersion < 537;\n /**\n * Whether or not this is Mozilla Firefox.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var IS_FIREFOX = /Firefox/i.test(USER_AGENT);\n /**\n * Whether or not this is Microsoft Edge.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var IS_EDGE = /Edge/i.test(USER_AGENT);\n /**\n * Whether or not this is Google Chrome.\n *\n * This will also be `true` for Chrome on iOS, which will have different support\n * as it is actually Safari under the hood.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var IS_CHROME = !IS_EDGE && (/Chrome/i.test(USER_AGENT) || /CriOS/i.test(USER_AGENT));\n /**\n * The detected Google Chrome version - or `null`.\n *\n * @static\n * @const\n * @type {number|null}\n */\n\n var CHROME_VERSION = function () {\n var match = USER_AGENT.match(/(Chrome|CriOS)\\/(\\d+)/);\n\n if (match && match[2]) {\n return parseFloat(match[2]);\n }\n\n return null;\n }();\n /**\n * The detected Internet Explorer version - or `null`.\n *\n * @static\n * @const\n * @type {number|null}\n */\n\n var IE_VERSION = function () {\n var result = /MSIE\\s(\\d+)\\.\\d/.exec(USER_AGENT);\n var version = result && parseFloat(result[1]);\n\n if (!version && /Trident\\/7.0/i.test(USER_AGENT) && /rv:11.0/.test(USER_AGENT)) {\n // IE 11 has a different user agent string than other IE versions\n version = 11.0;\n }\n\n return version;\n }();\n /**\n * Whether or not this is desktop Safari.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var IS_SAFARI = /Safari/i.test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE;\n /**\n * Whether or not this is any flavor of Safari - including iOS.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var IS_ANY_SAFARI = (IS_SAFARI || IS_IOS) && !IS_CHROME;\n /**\n * Whether or not this device is touch-enabled.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\n var TOUCH_ENABLED = isReal() && ('ontouchstart' in window$1 || window$1.navigator.maxTouchPoints || window$1.DocumentTouch && window$1.document instanceof window$1.DocumentTouch);\n\n var browser = /*#__PURE__*/Object.freeze({\n IS_IPAD: IS_IPAD,\n IS_IPHONE: IS_IPHONE,\n IS_IPOD: IS_IPOD,\n IS_IOS: IS_IOS,\n IOS_VERSION: IOS_VERSION,\n IS_ANDROID: IS_ANDROID,\n ANDROID_VERSION: ANDROID_VERSION,\n IS_NATIVE_ANDROID: IS_NATIVE_ANDROID,\n IS_FIREFOX: IS_FIREFOX,\n IS_EDGE: IS_EDGE,\n IS_CHROME: IS_CHROME,\n CHROME_VERSION: CHROME_VERSION,\n IE_VERSION: IE_VERSION,\n IS_SAFARI: IS_SAFARI,\n IS_ANY_SAFARI: IS_ANY_SAFARI,\n TOUCH_ENABLED: TOUCH_ENABLED\n });\n\n /**\n * @file time-ranges.js\n * @module time-ranges\n */\n\n /**\n * Returns the time for the specified index at the start or end\n * of a TimeRange object.\n *\n * @typedef {Function} TimeRangeIndex\n *\n * @param {number} [index=0]\n * The range number to return the time for.\n *\n * @return {number}\n * The time offset at the specified index.\n *\n * @deprecated The index argument must be provided.\n * In the future, leaving it out will throw an error.\n */\n\n /**\n * An object that contains ranges of time.\n *\n * @typedef {Object} TimeRange\n *\n * @property {number} length\n * The number of time ranges represented by this object.\n *\n * @property {module:time-ranges~TimeRangeIndex} start\n * Returns the time offset at which a specified time range begins.\n *\n * @property {module:time-ranges~TimeRangeIndex} end\n * Returns the time offset at which a specified time range ends.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges\n */\n\n /**\n * Check if any of the time ranges are over the maximum index.\n *\n * @private\n * @param {string} fnName\n * The function name to use for logging\n *\n * @param {number} index\n * The index to check\n *\n * @param {number} maxIndex\n * The maximum possible index\n *\n * @throws {Error} if the timeRanges provided are over the maxIndex\n */\n function rangeCheck(fnName, index, maxIndex) {\n if (typeof index !== 'number' || index < 0 || index > maxIndex) {\n throw new Error(\"Failed to execute '\" + fnName + \"' on 'TimeRanges': The index provided (\" + index + \") is non-numeric or out of bounds (0-\" + maxIndex + \").\");\n }\n }\n /**\n * Get the time for the specified index at the start or end\n * of a TimeRange object.\n *\n * @private\n * @param {string} fnName\n * The function name to use for logging\n *\n * @param {string} valueIndex\n * The property that should be used to get the time. should be\n * 'start' or 'end'\n *\n * @param {Array} ranges\n * An array of time ranges\n *\n * @param {Array} [rangeIndex=0]\n * The index to start the search at\n *\n * @return {number}\n * The time that offset at the specified index.\n *\n * @deprecated rangeIndex must be set to a value, in the future this will throw an error.\n * @throws {Error} if rangeIndex is more than the length of ranges\n */\n\n\n function getRange(fnName, valueIndex, ranges, rangeIndex) {\n rangeCheck(fnName, rangeIndex, ranges.length - 1);\n return ranges[rangeIndex][valueIndex];\n }\n /**\n * Create a time range object given ranges of time.\n *\n * @private\n * @param {Array} [ranges]\n * An array of time ranges.\n */\n\n\n function createTimeRangesObj(ranges) {\n if (ranges === undefined || ranges.length === 0) {\n return {\n length: 0,\n start: function start() {\n throw new Error('This TimeRanges object is empty');\n },\n end: function end() {\n throw new Error('This TimeRanges object is empty');\n }\n };\n }\n\n return {\n length: ranges.length,\n start: getRange.bind(null, 'start', 0, ranges),\n end: getRange.bind(null, 'end', 1, ranges)\n };\n }\n /**\n * Create a `TimeRange` object which mimics an\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges|HTML5 TimeRanges instance}.\n *\n * @param {number|Array[]} start\n * The start of a single range (a number) or an array of ranges (an\n * array of arrays of two numbers each).\n *\n * @param {number} end\n * The end of a single range. Cannot be used with the array form of\n * the `start` argument.\n */\n\n\n function createTimeRanges(start, end) {\n if (Array.isArray(start)) {\n return createTimeRangesObj(start);\n } else if (start === undefined || end === undefined) {\n return createTimeRangesObj();\n }\n\n return createTimeRangesObj([[start, end]]);\n }\n\n /**\n * @file buffer.js\n * @module buffer\n */\n /**\n * Compute the percentage of the media that has been buffered.\n *\n * @param {TimeRange} buffered\n * The current `TimeRange` object representing buffered time ranges\n *\n * @param {number} duration\n * Total duration of the media\n *\n * @return {number}\n * Percent buffered of the total duration in decimal form.\n */\n\n function bufferedPercent(buffered, duration) {\n var bufferedDuration = 0;\n var start;\n var end;\n\n if (!duration) {\n return 0;\n }\n\n if (!buffered || !buffered.length) {\n buffered = createTimeRanges(0, 0);\n }\n\n for (var i = 0; i < buffered.length; i++) {\n start = buffered.start(i);\n end = buffered.end(i); // buffered end can be bigger than duration by a very small fraction\n\n if (end > duration) {\n end = duration;\n }\n\n bufferedDuration += end - start;\n }\n\n return bufferedDuration / duration;\n }\n\n /**\n * @file fullscreen-api.js\n * @module fullscreen-api\n * @private\n */\n /**\n * Store the browser-specific methods for the fullscreen API.\n *\n * @type {Object}\n * @see [Specification]{@link https://fullscreen.spec.whatwg.org}\n * @see [Map Approach From Screenfull.js]{@link https://github.com/sindresorhus/screenfull.js}\n */\n\n var FullscreenApi = {}; // browser API methods\n\n var apiMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror', 'fullscreen'], // WebKit\n ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror', '-webkit-full-screen'], // Mozilla\n ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror', '-moz-full-screen'], // Microsoft\n ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError', '-ms-fullscreen']];\n var specApi = apiMap[0];\n var browserApi;\n var prefixedAPI = false; // determine the supported set of functions\n\n for (var i = 0; i < apiMap.length; i++) {\n // check for exitFullscreen function\n if (apiMap[i][1] in document) {\n browserApi = apiMap[i];\n break;\n }\n } // map the browser API names to the spec API names\n\n\n if (browserApi) {\n for (var _i = 0; _i < browserApi.length; _i++) {\n FullscreenApi[specApi[_i]] = browserApi[_i];\n }\n\n prefixedAPI = browserApi[0] === specApi[0];\n }\n\n /**\n * @file media-error.js\n */\n /**\n * A Custom `MediaError` class which mimics the standard HTML5 `MediaError` class.\n *\n * @param {number|string|Object|MediaError} value\n * This can be of multiple types:\n * - number: should be a standard error code\n * - string: an error message (the code will be 0)\n * - Object: arbitrary properties\n * - `MediaError` (native): used to populate a video.js `MediaError` object\n * - `MediaError` (video.js): will return itself if it's already a\n * video.js `MediaError` object.\n *\n * @see [MediaError Spec]{@link https://dev.w3.org/html5/spec-author-view/video.html#mediaerror}\n * @see [Encrypted MediaError Spec]{@link https://www.w3.org/TR/2013/WD-encrypted-media-20130510/#error-codes}\n *\n * @class MediaError\n */\n\n function MediaError(value) {\n // Allow redundant calls to this constructor to avoid having `instanceof`\n // checks peppered around the code.\n if (value instanceof MediaError) {\n return value;\n }\n\n if (typeof value === 'number') {\n this.code = value;\n } else if (typeof value === 'string') {\n // default code is zero, so this is a custom error\n this.message = value;\n } else if (isObject(value)) {\n // We assign the `code` property manually because native `MediaError` objects\n // do not expose it as an own/enumerable property of the object.\n if (typeof value.code === 'number') {\n this.code = value.code;\n }\n\n assign(this, value);\n }\n\n if (!this.message) {\n this.message = MediaError.defaultMessages[this.code] || '';\n }\n }\n /**\n * The error code that refers two one of the defined `MediaError` types\n *\n * @type {Number}\n */\n\n\n MediaError.prototype.code = 0;\n /**\n * An optional message that to show with the error. Message is not part of the HTML5\n * video spec but allows for more informative custom errors.\n *\n * @type {String}\n */\n\n MediaError.prototype.message = '';\n /**\n * An optional status code that can be set by plugins to allow even more detail about\n * the error. For example a plugin might provide a specific HTTP status code and an\n * error message for that code. Then when the plugin gets that error this class will\n * know how to display an error message for it. This allows a custom message to show\n * up on the `Player` error overlay.\n *\n * @type {Array}\n */\n\n MediaError.prototype.status = null;\n /**\n * Errors indexed by the W3C standard. The order **CANNOT CHANGE**! See the\n * specification listed under {@link MediaError} for more information.\n *\n * @enum {array}\n * @readonly\n * @property {string} 0 - MEDIA_ERR_CUSTOM\n * @property {string} 1 - MEDIA_ERR_ABORTED\n * @property {string} 2 - MEDIA_ERR_NETWORK\n * @property {string} 3 - MEDIA_ERR_DECODE\n * @property {string} 4 - MEDIA_ERR_SRC_NOT_SUPPORTED\n * @property {string} 5 - MEDIA_ERR_ENCRYPTED\n */\n\n MediaError.errorTypes = ['MEDIA_ERR_CUSTOM', 'MEDIA_ERR_ABORTED', 'MEDIA_ERR_NETWORK', 'MEDIA_ERR_DECODE', 'MEDIA_ERR_SRC_NOT_SUPPORTED', 'MEDIA_ERR_ENCRYPTED'];\n /**\n * The default `MediaError` messages based on the {@link MediaError.errorTypes}.\n *\n * @type {Array}\n * @constant\n */\n\n MediaError.defaultMessages = {\n 1: 'You aborted the media playback',\n 2: 'A network error caused the media download to fail part-way.',\n 3: 'The media playback was aborted due to a corruption problem or because the media used features your browser did not support.',\n 4: 'The media could not be loaded, either because the server or network failed or because the format is not supported.',\n 5: 'The media is encrypted and we do not have the keys to decrypt it.'\n }; // Add types as properties on MediaError\n // e.g. MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = 4;\n\n for (var errNum = 0; errNum < MediaError.errorTypes.length; errNum++) {\n MediaError[MediaError.errorTypes[errNum]] = errNum; // values should be accessible on both the class and instance\n\n MediaError.prototype[MediaError.errorTypes[errNum]] = errNum;\n } // jsdocs for instance/static members added above\n\n var tuple = SafeParseTuple;\n\n function SafeParseTuple(obj, reviver) {\n var json;\n var error = null;\n\n try {\n json = JSON.parse(obj, reviver);\n } catch (err) {\n error = err;\n }\n\n return [error, json];\n }\n\n /**\n * Returns whether an object is `Promise`-like (i.e. has a `then` method).\n *\n * @param {Object} value\n * An object that may or may not be `Promise`-like.\n *\n * @return {boolean}\n * Whether or not the object is `Promise`-like.\n */\n function isPromise(value) {\n return value !== undefined && value !== null && typeof value.then === 'function';\n }\n /**\n * Silence a Promise-like object.\n *\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n *\n * @param {Object} value\n * An object that may or may not be `Promise`-like.\n */\n\n function silencePromise(value) {\n if (isPromise(value)) {\n value.then(null, function (e) {});\n }\n }\n\n /**\n * @file text-track-list-converter.js Utilities for capturing text track state and\n * re-creating tracks based on a capture.\n *\n * @module text-track-list-converter\n */\n\n /**\n * Examine a single {@link TextTrack} and return a JSON-compatible javascript object that\n * represents the {@link TextTrack}'s state.\n *\n * @param {TextTrack} track\n * The text track to query.\n *\n * @return {Object}\n * A serializable javascript representation of the TextTrack.\n * @private\n */\n var trackToJson_ = function trackToJson_(track) {\n var ret = ['kind', 'label', 'language', 'id', 'inBandMetadataTrackDispatchType', 'mode', 'src'].reduce(function (acc, prop, i) {\n if (track[prop]) {\n acc[prop] = track[prop];\n }\n\n return acc;\n }, {\n cues: track.cues && Array.prototype.map.call(track.cues, function (cue) {\n return {\n startTime: cue.startTime,\n endTime: cue.endTime,\n text: cue.text,\n id: cue.id\n };\n })\n });\n return ret;\n };\n /**\n * Examine a {@link Tech} and return a JSON-compatible javascript array that represents the\n * state of all {@link TextTrack}s currently configured. The return array is compatible with\n * {@link text-track-list-converter:jsonToTextTracks}.\n *\n * @param {Tech} tech\n * The tech object to query\n *\n * @return {Array}\n * A serializable javascript representation of the {@link Tech}s\n * {@link TextTrackList}.\n */\n\n\n var textTracksToJson = function textTracksToJson(tech) {\n var trackEls = tech.$$('track');\n var trackObjs = Array.prototype.map.call(trackEls, function (t) {\n return t.track;\n });\n var tracks = Array.prototype.map.call(trackEls, function (trackEl) {\n var json = trackToJson_(trackEl.track);\n\n if (trackEl.src) {\n json.src = trackEl.src;\n }\n\n return json;\n });\n return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function (track) {\n return trackObjs.indexOf(track) === -1;\n }).map(trackToJson_));\n };\n /**\n * Create a set of remote {@link TextTrack}s on a {@link Tech} based on an array of javascript\n * object {@link TextTrack} representations.\n *\n * @param {Array} json\n * An array of `TextTrack` representation objects, like those that would be\n * produced by `textTracksToJson`.\n *\n * @param {Tech} tech\n * The `Tech` to create the `TextTrack`s on.\n */\n\n\n var jsonToTextTracks = function jsonToTextTracks(json, tech) {\n json.forEach(function (track) {\n var addedTrack = tech.addRemoteTextTrack(track).track;\n\n if (!track.src && track.cues) {\n track.cues.forEach(function (cue) {\n return addedTrack.addCue(cue);\n });\n }\n });\n return tech.textTracks();\n };\n\n var textTrackConverter = {\n textTracksToJson: textTracksToJson,\n jsonToTextTracks: jsonToTextTracks,\n trackToJson_: trackToJson_\n };\n\n var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\n function createCommonjsModule(fn, module) {\n \treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n }\n\n var keycode = createCommonjsModule(function (module, exports) {\n // Source: http://jsfiddle.net/vWx8V/\n // http://stackoverflow.com/questions/5603195/full-list-of-javascript-keycodes\n\n /**\n * Conenience method returns corresponding value for given keyName or keyCode.\n *\n * @param {Mixed} keyCode {Number} or keyName {String}\n * @return {Mixed}\n * @api public\n */\n function keyCode(searchInput) {\n // Keyboard Events\n if (searchInput && 'object' === typeof searchInput) {\n var hasKeyCode = searchInput.which || searchInput.keyCode || searchInput.charCode;\n if (hasKeyCode) searchInput = hasKeyCode;\n } // Numbers\n\n\n if ('number' === typeof searchInput) return names[searchInput]; // Everything else (cast to string)\n\n var search = String(searchInput); // check codes\n\n var foundNamedKey = codes[search.toLowerCase()];\n if (foundNamedKey) return foundNamedKey; // check aliases\n\n var foundNamedKey = aliases[search.toLowerCase()];\n if (foundNamedKey) return foundNamedKey; // weird character?\n\n if (search.length === 1) return search.charCodeAt(0);\n return undefined;\n }\n /**\n * Compares a keyboard event with a given keyCode or keyName.\n *\n * @param {Event} event Keyboard event that should be tested\n * @param {Mixed} keyCode {Number} or keyName {String}\n * @return {Boolean}\n * @api public\n */\n\n\n keyCode.isEventKey = function isEventKey(event, nameOrCode) {\n if (event && 'object' === typeof event) {\n var keyCode = event.which || event.keyCode || event.charCode;\n\n if (keyCode === null || keyCode === undefined) {\n return false;\n }\n\n if (typeof nameOrCode === 'string') {\n // check codes\n var foundNamedKey = codes[nameOrCode.toLowerCase()];\n\n if (foundNamedKey) {\n return foundNamedKey === keyCode;\n } // check aliases\n\n\n var foundNamedKey = aliases[nameOrCode.toLowerCase()];\n\n if (foundNamedKey) {\n return foundNamedKey === keyCode;\n }\n } else if (typeof nameOrCode === 'number') {\n return nameOrCode === keyCode;\n }\n\n return false;\n }\n };\n\n exports = module.exports = keyCode;\n /**\n * Get by name\n *\n * exports.code['enter'] // => 13\n */\n\n var codes = exports.code = exports.codes = {\n 'backspace': 8,\n 'tab': 9,\n 'enter': 13,\n 'shift': 16,\n 'ctrl': 17,\n 'alt': 18,\n 'pause/break': 19,\n 'caps lock': 20,\n 'esc': 27,\n 'space': 32,\n 'page up': 33,\n 'page down': 34,\n 'end': 35,\n 'home': 36,\n 'left': 37,\n 'up': 38,\n 'right': 39,\n 'down': 40,\n 'insert': 45,\n 'delete': 46,\n 'command': 91,\n 'left command': 91,\n 'right command': 93,\n 'numpad *': 106,\n 'numpad +': 107,\n 'numpad -': 109,\n 'numpad .': 110,\n 'numpad /': 111,\n 'num lock': 144,\n 'scroll lock': 145,\n 'my computer': 182,\n 'my calculator': 183,\n ';': 186,\n '=': 187,\n ',': 188,\n '-': 189,\n '.': 190,\n '/': 191,\n '`': 192,\n '[': 219,\n '\\\\': 220,\n ']': 221,\n \"'\": 222 // Helper aliases\n\n };\n var aliases = exports.aliases = {\n 'windows': 91,\n '⇧': 16,\n '⌥': 18,\n '⌃': 17,\n '⌘': 91,\n 'ctl': 17,\n 'control': 17,\n 'option': 18,\n 'pause': 19,\n 'break': 19,\n 'caps': 20,\n 'return': 13,\n 'escape': 27,\n 'spc': 32,\n 'spacebar': 32,\n 'pgup': 33,\n 'pgdn': 34,\n 'ins': 45,\n 'del': 46,\n 'cmd': 91\n /*!\n * Programatically add the following\n */\n // lower case chars\n\n };\n\n for (i = 97; i < 123; i++) {\n codes[String.fromCharCode(i)] = i - 32;\n } // numbers\n\n\n for (var i = 48; i < 58; i++) {\n codes[i - 48] = i;\n } // function keys\n\n\n for (i = 1; i < 13; i++) {\n codes['f' + i] = i + 111;\n } // numpad keys\n\n\n for (i = 0; i < 10; i++) {\n codes['numpad ' + i] = i + 96;\n }\n /**\n * Get by code\n *\n * exports.name[13] // => 'Enter'\n */\n\n\n var names = exports.names = exports.title = {}; // title for backward compat\n // Create reverse mapping\n\n for (i in codes) {\n names[codes[i]] = i;\n } // Add aliases\n\n\n for (var alias in aliases) {\n codes[alias] = aliases[alias];\n }\n });\n var keycode_1 = keycode.code;\n var keycode_2 = keycode.codes;\n var keycode_3 = keycode.aliases;\n var keycode_4 = keycode.names;\n var keycode_5 = keycode.title;\n\n var MODAL_CLASS_NAME = 'vjs-modal-dialog';\n /**\n * The `ModalDialog` displays over the video and its controls, which blocks\n * interaction with the player until it is closed.\n *\n * Modal dialogs include a \"Close\" button and will close when that button\n * is activated - or when ESC is pressed anywhere.\n *\n * @extends Component\n */\n\n var ModalDialog =\n /*#__PURE__*/\n function (_Component) {\n _inheritsLoose(ModalDialog, _Component);\n\n /**\n * Create an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Mixed} [options.content=undefined]\n * Provide customized content for this modal.\n *\n * @param {string} [options.description]\n * A text description for the modal, primarily for accessibility.\n *\n * @param {boolean} [options.fillAlways=false]\n * Normally, modals are automatically filled only the first time\n * they open. This tells the modal to refresh its content\n * every time it opens.\n *\n * @param {string} [options.label]\n * A text label for the modal, primarily for accessibility.\n *\n * @param {boolean} [options.pauseOnOpen=true]\n * If `true`, playback will will be paused if playing when\n * the modal opens, and resumed when it closes.\n *\n * @param {boolean} [options.temporary=true]\n * If `true`, the modal can only be opened once; it will be\n * disposed as soon as it's closed.\n *\n * @param {boolean} [options.uncloseable=false]\n * If `true`, the user will not be able to close the modal\n * through the UI in the normal ways. Programmatic closing is\n * still possible.\n */\n function ModalDialog(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n _this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = false;\n\n _this.closeable(!_this.options_.uncloseable);\n\n _this.content(_this.options_.content); // Make sure the contentEl is defined AFTER any children are initialized\n // because we only want the contents of the modal in the contentEl\n // (not the UI elements like the close button).\n\n\n _this.contentEl_ = createEl('div', {\n className: MODAL_CLASS_NAME + \"-content\"\n }, {\n role: 'document'\n });\n _this.descEl_ = createEl('p', {\n className: MODAL_CLASS_NAME + \"-description vjs-control-text\",\n id: _this.el().getAttribute('aria-describedby')\n });\n textContent(_this.descEl_, _this.description());\n\n _this.el_.appendChild(_this.descEl_);\n\n _this.el_.appendChild(_this.contentEl_);\n\n return _this;\n }\n /**\n * Create the `ModalDialog`'s DOM element\n *\n * @return {Element}\n * The DOM element that gets created.\n */\n\n\n var _proto = ModalDialog.prototype;\n\n _proto.createEl = function createEl$$1() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: this.buildCSSClass(),\n tabIndex: -1\n }, {\n 'aria-describedby': this.id() + \"_description\",\n 'aria-hidden': 'true',\n 'aria-label': this.label(),\n 'role': 'dialog'\n });\n };\n\n _proto.dispose = function dispose() {\n this.contentEl_ = null;\n this.descEl_ = null;\n this.previouslyActiveEl_ = null;\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n ;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return MODAL_CLASS_NAME + \" vjs-hidden \" + _Component.prototype.buildCSSClass.call(this);\n }\n /**\n * Returns the label string for this modal. Primarily used for accessibility.\n *\n * @return {string}\n * the localized or raw label of this modal.\n */\n ;\n\n _proto.label = function label() {\n return this.localize(this.options_.label || 'Modal Window');\n }\n /**\n * Returns the description string for this modal. Primarily used for\n * accessibility.\n *\n * @return {string}\n * The localized or raw description of this modal.\n */\n ;\n\n _proto.description = function description() {\n var desc = this.options_.description || this.localize('This is a modal window.'); // Append a universal closeability message if the modal is closeable.\n\n if (this.closeable()) {\n desc += ' ' + this.localize('This modal can be closed by pressing the Escape key or activating the close button.');\n }\n\n return desc;\n }\n /**\n * Opens the modal.\n *\n * @fires ModalDialog#beforemodalopen\n * @fires ModalDialog#modalopen\n */\n ;\n\n _proto.open = function open() {\n if (!this.opened_) {\n var player = this.player();\n /**\n * Fired just before a `ModalDialog` is opened.\n *\n * @event ModalDialog#beforemodalopen\n * @type {EventTarget~Event}\n */\n\n this.trigger('beforemodalopen');\n this.opened_ = true; // Fill content if the modal has never opened before and\n // never been filled.\n\n if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {\n this.fill();\n } // If the player was playing, pause it and take note of its previously\n // playing state.\n\n\n this.wasPlaying_ = !player.paused();\n\n if (this.options_.pauseOnOpen && this.wasPlaying_) {\n player.pause();\n }\n\n this.on('keydown', this.handleKeyDown); // Hide controls and note if they were enabled.\n\n this.hadControls_ = player.controls();\n player.controls(false);\n this.show();\n this.conditionalFocus_();\n this.el().setAttribute('aria-hidden', 'false');\n /**\n * Fired just after a `ModalDialog` is opened.\n *\n * @event ModalDialog#modalopen\n * @type {EventTarget~Event}\n */\n\n this.trigger('modalopen');\n this.hasBeenOpened_ = true;\n }\n }\n /**\n * If the `ModalDialog` is currently open or closed.\n *\n * @param {boolean} [value]\n * If given, it will open (`true`) or close (`false`) the modal.\n *\n * @return {boolean}\n * the current open state of the modaldialog\n */\n ;\n\n _proto.opened = function opened(value) {\n if (typeof value === 'boolean') {\n this[value ? 'open' : 'close']();\n }\n\n return this.opened_;\n }\n /**\n * Closes the modal, does nothing if the `ModalDialog` is\n * not open.\n *\n * @fires ModalDialog#beforemodalclose\n * @fires ModalDialog#modalclose\n */\n ;\n\n _proto.close = function close() {\n if (!this.opened_) {\n return;\n }\n\n var player = this.player();\n /**\n * Fired just before a `ModalDialog` is closed.\n *\n * @event ModalDialog#beforemodalclose\n * @type {EventTarget~Event}\n */\n\n this.trigger('beforemodalclose');\n this.opened_ = false;\n\n if (this.wasPlaying_ && this.options_.pauseOnOpen) {\n player.play();\n }\n\n this.off('keydown', this.handleKeyDown);\n\n if (this.hadControls_) {\n player.controls(true);\n }\n\n this.hide();\n this.el().setAttribute('aria-hidden', 'true');\n /**\n * Fired just after a `ModalDialog` is closed.\n *\n * @event ModalDialog#modalclose\n * @type {EventTarget~Event}\n */\n\n this.trigger('modalclose');\n this.conditionalBlur_();\n\n if (this.options_.temporary) {\n this.dispose();\n }\n }\n /**\n * Check to see if the `ModalDialog` is closeable via the UI.\n *\n * @param {boolean} [value]\n * If given as a boolean, it will set the `closeable` option.\n *\n * @return {boolean}\n * Returns the final value of the closable option.\n */\n ;\n\n _proto.closeable = function closeable(value) {\n if (typeof value === 'boolean') {\n var closeable = this.closeable_ = !!value;\n var close = this.getChild('closeButton'); // If this is being made closeable and has no close button, add one.\n\n if (closeable && !close) {\n // The close button should be a child of the modal - not its\n // content element, so temporarily change the content element.\n var temp = this.contentEl_;\n this.contentEl_ = this.el_;\n close = this.addChild('closeButton', {\n controlText: 'Close Modal Dialog'\n });\n this.contentEl_ = temp;\n this.on(close, 'close', this.close);\n } // If this is being made uncloseable and has a close button, remove it.\n\n\n if (!closeable && close) {\n this.off(close, 'close', this.close);\n this.removeChild(close);\n close.dispose();\n }\n }\n\n return this.closeable_;\n }\n /**\n * Fill the modal's content element with the modal's \"content\" option.\n * The content element will be emptied before this change takes place.\n */\n ;\n\n _proto.fill = function fill() {\n this.fillWith(this.content());\n }\n /**\n * Fill the modal's content element with arbitrary content.\n * The content element will be emptied before this change takes place.\n *\n * @fires ModalDialog#beforemodalfill\n * @fires ModalDialog#modalfill\n *\n * @param {Mixed} [content]\n * The same rules apply to this as apply to the `content` option.\n */\n ;\n\n _proto.fillWith = function fillWith(content) {\n var contentEl = this.contentEl();\n var parentEl = contentEl.parentNode;\n var nextSiblingEl = contentEl.nextSibling;\n /**\n * Fired just before a `ModalDialog` is filled with content.\n *\n * @event ModalDialog#beforemodalfill\n * @type {EventTarget~Event}\n */\n\n this.trigger('beforemodalfill');\n this.hasBeenFilled_ = true; // Detach the content element from the DOM before performing\n // manipulation to avoid modifying the live DOM multiple times.\n\n parentEl.removeChild(contentEl);\n this.empty();\n insertContent(contentEl, content);\n /**\n * Fired just after a `ModalDialog` is filled with content.\n *\n * @event ModalDialog#modalfill\n * @type {EventTarget~Event}\n */\n\n this.trigger('modalfill'); // Re-inject the re-filled content element.\n\n if (nextSiblingEl) {\n parentEl.insertBefore(contentEl, nextSiblingEl);\n } else {\n parentEl.appendChild(contentEl);\n } // make sure that the close button is last in the dialog DOM\n\n\n var closeButton = this.getChild('closeButton');\n\n if (closeButton) {\n parentEl.appendChild(closeButton.el_);\n }\n }\n /**\n * Empties the content element. This happens anytime the modal is filled.\n *\n * @fires ModalDialog#beforemodalempty\n * @fires ModalDialog#modalempty\n */\n ;\n\n _proto.empty = function empty() {\n /**\n * Fired just before a `ModalDialog` is emptied.\n *\n * @event ModalDialog#beforemodalempty\n * @type {EventTarget~Event}\n */\n this.trigger('beforemodalempty');\n emptyEl(this.contentEl());\n /**\n * Fired just after a `ModalDialog` is emptied.\n *\n * @event ModalDialog#modalempty\n * @type {EventTarget~Event}\n */\n\n this.trigger('modalempty');\n }\n /**\n * Gets or sets the modal content, which gets normalized before being\n * rendered into the DOM.\n *\n * This does not update the DOM or fill the modal, but it is called during\n * that process.\n *\n * @param {Mixed} [value]\n * If defined, sets the internal content value to be used on the\n * next call(s) to `fill`. This value is normalized before being\n * inserted. To \"clear\" the internal content value, pass `null`.\n *\n * @return {Mixed}\n * The current content of the modal dialog\n */\n ;\n\n _proto.content = function content(value) {\n if (typeof value !== 'undefined') {\n this.content_ = value;\n }\n\n return this.content_;\n }\n /**\n * conditionally focus the modal dialog if focus was previously on the player.\n *\n * @private\n */\n ;\n\n _proto.conditionalFocus_ = function conditionalFocus_() {\n var activeEl = document.activeElement;\n var playerEl = this.player_.el_;\n this.previouslyActiveEl_ = null;\n\n if (playerEl.contains(activeEl) || playerEl === activeEl) {\n this.previouslyActiveEl_ = activeEl;\n this.focus();\n }\n }\n /**\n * conditionally blur the element and refocus the last focused element\n *\n * @private\n */\n ;\n\n _proto.conditionalBlur_ = function conditionalBlur_() {\n if (this.previouslyActiveEl_) {\n this.previouslyActiveEl_.focus();\n this.previouslyActiveEl_ = null;\n }\n }\n /**\n * Keydown handler. Attached when modal is focused.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n // Do not allow keydowns to reach out of the modal dialog.\n event.stopPropagation();\n\n if (keycode.isEventKey(event, 'Escape') && this.closeable()) {\n event.preventDefault();\n this.close();\n return;\n } // exit early if it isn't a tab key\n\n\n if (!keycode.isEventKey(event, 'Tab')) {\n return;\n }\n\n var focusableEls = this.focusableEls_();\n var activeEl = this.el_.querySelector(':focus');\n var focusIndex;\n\n for (var i = 0; i < focusableEls.length; i++) {\n if (activeEl === focusableEls[i]) {\n focusIndex = i;\n break;\n }\n }\n\n if (document.activeElement === this.el_) {\n focusIndex = 0;\n }\n\n if (event.shiftKey && focusIndex === 0) {\n focusableEls[focusableEls.length - 1].focus();\n event.preventDefault();\n } else if (!event.shiftKey && focusIndex === focusableEls.length - 1) {\n focusableEls[0].focus();\n event.preventDefault();\n }\n }\n /**\n * get all focusable elements\n *\n * @private\n */\n ;\n\n _proto.focusableEls_ = function focusableEls_() {\n var allChildren = this.el_.querySelectorAll('*');\n return Array.prototype.filter.call(allChildren, function (child) {\n return (child instanceof window$1.HTMLAnchorElement || child instanceof window$1.HTMLAreaElement) && child.hasAttribute('href') || (child instanceof window$1.HTMLInputElement || child instanceof window$1.HTMLSelectElement || child instanceof window$1.HTMLTextAreaElement || child instanceof window$1.HTMLButtonElement) && !child.hasAttribute('disabled') || child instanceof window$1.HTMLIFrameElement || child instanceof window$1.HTMLObjectElement || child instanceof window$1.HTMLEmbedElement || child.hasAttribute('tabindex') && child.getAttribute('tabindex') !== -1 || child.hasAttribute('contenteditable');\n });\n };\n\n return ModalDialog;\n }(Component);\n /**\n * Default options for `ModalDialog` default options.\n *\n * @type {Object}\n * @private\n */\n\n\n ModalDialog.prototype.options_ = {\n pauseOnOpen: true,\n temporary: true\n };\n Component.registerComponent('ModalDialog', ModalDialog);\n\n /**\n * Common functionaliy between {@link TextTrackList}, {@link AudioTrackList}, and\n * {@link VideoTrackList}\n *\n * @extends EventTarget\n */\n\n var TrackList =\n /*#__PURE__*/\n function (_EventTarget) {\n _inheritsLoose(TrackList, _EventTarget);\n\n /**\n * Create an instance of this class\n *\n * @param {Track[]} tracks\n * A list of tracks to initialize the list with.\n *\n * @abstract\n */\n function TrackList(tracks) {\n var _this;\n\n if (tracks === void 0) {\n tracks = [];\n }\n\n _this = _EventTarget.call(this) || this;\n _this.tracks_ = [];\n /**\n * @memberof TrackList\n * @member {number} length\n * The current number of `Track`s in the this Trackist.\n * @instance\n */\n\n Object.defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), 'length', {\n get: function get() {\n return this.tracks_.length;\n }\n });\n\n for (var i = 0; i < tracks.length; i++) {\n _this.addTrack(tracks[i]);\n }\n\n return _this;\n }\n /**\n * Add a {@link Track} to the `TrackList`\n *\n * @param {Track} track\n * The audio, video, or text track to add to the list.\n *\n * @fires TrackList#addtrack\n */\n\n\n var _proto = TrackList.prototype;\n\n _proto.addTrack = function addTrack(track) {\n var index = this.tracks_.length;\n\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get: function get() {\n return this.tracks_[index];\n }\n });\n } // Do not add duplicate tracks\n\n\n if (this.tracks_.indexOf(track) === -1) {\n this.tracks_.push(track);\n /**\n * Triggered when a track is added to a track list.\n *\n * @event TrackList#addtrack\n * @type {EventTarget~Event}\n * @property {Track} track\n * A reference to track that was added.\n */\n\n this.trigger({\n track: track,\n type: 'addtrack',\n target: this\n });\n }\n }\n /**\n * Remove a {@link Track} from the `TrackList`\n *\n * @param {Track} rtrack\n * The audio, video, or text track to remove from the list.\n *\n * @fires TrackList#removetrack\n */\n ;\n\n _proto.removeTrack = function removeTrack(rtrack) {\n var track;\n\n for (var i = 0, l = this.length; i < l; i++) {\n if (this[i] === rtrack) {\n track = this[i];\n\n if (track.off) {\n track.off();\n }\n\n this.tracks_.splice(i, 1);\n break;\n }\n }\n\n if (!track) {\n return;\n }\n /**\n * Triggered when a track is removed from track list.\n *\n * @event TrackList#removetrack\n * @type {EventTarget~Event}\n * @property {Track} track\n * A reference to track that was removed.\n */\n\n\n this.trigger({\n track: track,\n type: 'removetrack',\n target: this\n });\n }\n /**\n * Get a Track from the TrackList by a tracks id\n *\n * @param {string} id - the id of the track to get\n * @method getTrackById\n * @return {Track}\n * @private\n */\n ;\n\n _proto.getTrackById = function getTrackById(id) {\n var result = null;\n\n for (var i = 0, l = this.length; i < l; i++) {\n var track = this[i];\n\n if (track.id === id) {\n result = track;\n break;\n }\n }\n\n return result;\n };\n\n return TrackList;\n }(EventTarget);\n /**\n * Triggered when a different track is selected/enabled.\n *\n * @event TrackList#change\n * @type {EventTarget~Event}\n */\n\n /**\n * Events that can be called with on + eventName. See {@link EventHandler}.\n *\n * @property {Object} TrackList#allowedEvents_\n * @private\n */\n\n\n TrackList.prototype.allowedEvents_ = {\n change: 'change',\n addtrack: 'addtrack',\n removetrack: 'removetrack'\n }; // emulate attribute EventHandler support to allow for feature detection\n\n for (var event in TrackList.prototype.allowedEvents_) {\n TrackList.prototype['on' + event] = null;\n }\n\n /**\n * Anywhere we call this function we diverge from the spec\n * as we only support one enabled audiotrack at a time\n *\n * @param {AudioTrackList} list\n * list to work on\n *\n * @param {AudioTrack} track\n * The track to skip\n *\n * @private\n */\n\n var disableOthers = function disableOthers(list, track) {\n for (var i = 0; i < list.length; i++) {\n if (!Object.keys(list[i]).length || track.id === list[i].id) {\n continue;\n } // another audio track is enabled, disable it\n\n\n list[i].enabled = false;\n }\n };\n /**\n * The current list of {@link AudioTrack} for a media file.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist}\n * @extends TrackList\n */\n\n\n var AudioTrackList =\n /*#__PURE__*/\n function (_TrackList) {\n _inheritsLoose(AudioTrackList, _TrackList);\n\n /**\n * Create an instance of this class.\n *\n * @param {AudioTrack[]} [tracks=[]]\n * A list of `AudioTrack` to instantiate the list with.\n */\n function AudioTrackList(tracks) {\n var _this;\n\n if (tracks === void 0) {\n tracks = [];\n }\n\n // make sure only 1 track is enabled\n // sorted from last index to first index\n for (var i = tracks.length - 1; i >= 0; i--) {\n if (tracks[i].enabled) {\n disableOthers(tracks, tracks[i]);\n break;\n }\n }\n\n _this = _TrackList.call(this, tracks) || this;\n _this.changing_ = false;\n return _this;\n }\n /**\n * Add an {@link AudioTrack} to the `AudioTrackList`.\n *\n * @param {AudioTrack} track\n * The AudioTrack to add to the list\n *\n * @fires TrackList#addtrack\n */\n\n\n var _proto = AudioTrackList.prototype;\n\n _proto.addTrack = function addTrack(track) {\n var _this2 = this;\n\n if (track.enabled) {\n disableOthers(this, track);\n }\n\n _TrackList.prototype.addTrack.call(this, track); // native tracks don't have this\n\n\n if (!track.addEventListener) {\n return;\n }\n\n track.enabledChange_ = function () {\n // when we are disabling other tracks (since we don't support\n // more than one track at a time) we will set changing_\n // to true so that we don't trigger additional change events\n if (_this2.changing_) {\n return;\n }\n\n _this2.changing_ = true;\n disableOthers(_this2, track);\n _this2.changing_ = false;\n\n _this2.trigger('change');\n };\n /**\n * @listens AudioTrack#enabledchange\n * @fires TrackList#change\n */\n\n\n track.addEventListener('enabledchange', track.enabledChange_);\n };\n\n _proto.removeTrack = function removeTrack(rtrack) {\n _TrackList.prototype.removeTrack.call(this, rtrack);\n\n if (rtrack.removeEventListener && rtrack.enabledChange_) {\n rtrack.removeEventListener('enabledchange', rtrack.enabledChange_);\n rtrack.enabledChange_ = null;\n }\n };\n\n return AudioTrackList;\n }(TrackList);\n\n /**\n * Un-select all other {@link VideoTrack}s that are selected.\n *\n * @param {VideoTrackList} list\n * list to work on\n *\n * @param {VideoTrack} track\n * The track to skip\n *\n * @private\n */\n\n var disableOthers$1 = function disableOthers(list, track) {\n for (var i = 0; i < list.length; i++) {\n if (!Object.keys(list[i]).length || track.id === list[i].id) {\n continue;\n } // another video track is enabled, disable it\n\n\n list[i].selected = false;\n }\n };\n /**\n * The current list of {@link VideoTrack} for a video.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist}\n * @extends TrackList\n */\n\n\n var VideoTrackList =\n /*#__PURE__*/\n function (_TrackList) {\n _inheritsLoose(VideoTrackList, _TrackList);\n\n /**\n * Create an instance of this class.\n *\n * @param {VideoTrack[]} [tracks=[]]\n * A list of `VideoTrack` to instantiate the list with.\n */\n function VideoTrackList(tracks) {\n var _this;\n\n if (tracks === void 0) {\n tracks = [];\n }\n\n // make sure only 1 track is enabled\n // sorted from last index to first index\n for (var i = tracks.length - 1; i >= 0; i--) {\n if (tracks[i].selected) {\n disableOthers$1(tracks, tracks[i]);\n break;\n }\n }\n\n _this = _TrackList.call(this, tracks) || this;\n _this.changing_ = false;\n /**\n * @member {number} VideoTrackList#selectedIndex\n * The current index of the selected {@link VideoTrack`}.\n */\n\n Object.defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), 'selectedIndex', {\n get: function get() {\n for (var _i = 0; _i < this.length; _i++) {\n if (this[_i].selected) {\n return _i;\n }\n }\n\n return -1;\n },\n set: function set() {}\n });\n return _this;\n }\n /**\n * Add a {@link VideoTrack} to the `VideoTrackList`.\n *\n * @param {VideoTrack} track\n * The VideoTrack to add to the list\n *\n * @fires TrackList#addtrack\n */\n\n\n var _proto = VideoTrackList.prototype;\n\n _proto.addTrack = function addTrack(track) {\n var _this2 = this;\n\n if (track.selected) {\n disableOthers$1(this, track);\n }\n\n _TrackList.prototype.addTrack.call(this, track); // native tracks don't have this\n\n\n if (!track.addEventListener) {\n return;\n }\n\n track.selectedChange_ = function () {\n if (_this2.changing_) {\n return;\n }\n\n _this2.changing_ = true;\n disableOthers$1(_this2, track);\n _this2.changing_ = false;\n\n _this2.trigger('change');\n };\n /**\n * @listens VideoTrack#selectedchange\n * @fires TrackList#change\n */\n\n\n track.addEventListener('selectedchange', track.selectedChange_);\n };\n\n _proto.removeTrack = function removeTrack(rtrack) {\n _TrackList.prototype.removeTrack.call(this, rtrack);\n\n if (rtrack.removeEventListener && rtrack.selectedChange_) {\n rtrack.removeEventListener('selectedchange', rtrack.selectedChange_);\n rtrack.selectedChange_ = null;\n }\n };\n\n return VideoTrackList;\n }(TrackList);\n\n /**\n * The current list of {@link TextTrack} for a media file.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist}\n * @extends TrackList\n */\n\n var TextTrackList =\n /*#__PURE__*/\n function (_TrackList) {\n _inheritsLoose(TextTrackList, _TrackList);\n\n function TextTrackList() {\n return _TrackList.apply(this, arguments) || this;\n }\n\n var _proto = TextTrackList.prototype;\n\n /**\n * Add a {@link TextTrack} to the `TextTrackList`\n *\n * @param {TextTrack} track\n * The text track to add to the list.\n *\n * @fires TrackList#addtrack\n */\n _proto.addTrack = function addTrack(track) {\n var _this = this;\n\n _TrackList.prototype.addTrack.call(this, track);\n\n if (!this.queueChange_) {\n this.queueChange_ = function () {\n return _this.queueTrigger('change');\n };\n }\n\n if (!this.triggerSelectedlanguagechange) {\n this.triggerSelectedlanguagechange_ = function () {\n return _this.trigger('selectedlanguagechange');\n };\n }\n /**\n * @listens TextTrack#modechange\n * @fires TrackList#change\n */\n\n\n track.addEventListener('modechange', this.queueChange_);\n var nonLanguageTextTrackKind = ['metadata', 'chapters'];\n\n if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {\n track.addEventListener('modechange', this.triggerSelectedlanguagechange_);\n }\n };\n\n _proto.removeTrack = function removeTrack(rtrack) {\n _TrackList.prototype.removeTrack.call(this, rtrack); // manually remove the event handlers we added\n\n\n if (rtrack.removeEventListener) {\n if (this.queueChange_) {\n rtrack.removeEventListener('modechange', this.queueChange_);\n }\n\n if (this.selectedlanguagechange_) {\n rtrack.removeEventListener('modechange', this.triggerSelectedlanguagechange_);\n }\n }\n };\n\n return TextTrackList;\n }(TrackList);\n\n /**\n * @file html-track-element-list.js\n */\n\n /**\n * The current list of {@link HtmlTrackElement}s.\n */\n var HtmlTrackElementList =\n /*#__PURE__*/\n function () {\n /**\n * Create an instance of this class.\n *\n * @param {HtmlTrackElement[]} [tracks=[]]\n * A list of `HtmlTrackElement` to instantiate the list with.\n */\n function HtmlTrackElementList(trackElements) {\n if (trackElements === void 0) {\n trackElements = [];\n }\n\n this.trackElements_ = [];\n /**\n * @memberof HtmlTrackElementList\n * @member {number} length\n * The current number of `Track`s in the this Trackist.\n * @instance\n */\n\n Object.defineProperty(this, 'length', {\n get: function get() {\n return this.trackElements_.length;\n }\n });\n\n for (var i = 0, length = trackElements.length; i < length; i++) {\n this.addTrackElement_(trackElements[i]);\n }\n }\n /**\n * Add an {@link HtmlTrackElement} to the `HtmlTrackElementList`\n *\n * @param {HtmlTrackElement} trackElement\n * The track element to add to the list.\n *\n * @private\n */\n\n\n var _proto = HtmlTrackElementList.prototype;\n\n _proto.addTrackElement_ = function addTrackElement_(trackElement) {\n var index = this.trackElements_.length;\n\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get: function get() {\n return this.trackElements_[index];\n }\n });\n } // Do not add duplicate elements\n\n\n if (this.trackElements_.indexOf(trackElement) === -1) {\n this.trackElements_.push(trackElement);\n }\n }\n /**\n * Get an {@link HtmlTrackElement} from the `HtmlTrackElementList` given an\n * {@link TextTrack}.\n *\n * @param {TextTrack} track\n * The track associated with a track element.\n *\n * @return {HtmlTrackElement|undefined}\n * The track element that was found or undefined.\n *\n * @private\n */\n ;\n\n _proto.getTrackElementByTrack_ = function getTrackElementByTrack_(track) {\n var trackElement_;\n\n for (var i = 0, length = this.trackElements_.length; i < length; i++) {\n if (track === this.trackElements_[i].track) {\n trackElement_ = this.trackElements_[i];\n break;\n }\n }\n\n return trackElement_;\n }\n /**\n * Remove a {@link HtmlTrackElement} from the `HtmlTrackElementList`\n *\n * @param {HtmlTrackElement} trackElement\n * The track element to remove from the list.\n *\n * @private\n */\n ;\n\n _proto.removeTrackElement_ = function removeTrackElement_(trackElement) {\n for (var i = 0, length = this.trackElements_.length; i < length; i++) {\n if (trackElement === this.trackElements_[i]) {\n if (this.trackElements_[i].track && typeof this.trackElements_[i].track.off === 'function') {\n this.trackElements_[i].track.off();\n }\n\n if (typeof this.trackElements_[i].off === 'function') {\n this.trackElements_[i].off();\n }\n\n this.trackElements_.splice(i, 1);\n break;\n }\n }\n };\n\n return HtmlTrackElementList;\n }();\n\n /**\n * @file text-track-cue-list.js\n */\n\n /**\n * @typedef {Object} TextTrackCueList~TextTrackCue\n *\n * @property {string} id\n * The unique id for this text track cue\n *\n * @property {number} startTime\n * The start time for this text track cue\n *\n * @property {number} endTime\n * The end time for this text track cue\n *\n * @property {boolean} pauseOnExit\n * Pause when the end time is reached if true.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcue}\n */\n\n /**\n * A List of TextTrackCues.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcuelist}\n */\n var TextTrackCueList =\n /*#__PURE__*/\n function () {\n /**\n * Create an instance of this class..\n *\n * @param {Array} cues\n * A list of cues to be initialized with\n */\n function TextTrackCueList(cues) {\n TextTrackCueList.prototype.setCues_.call(this, cues);\n /**\n * @memberof TextTrackCueList\n * @member {number} length\n * The current number of `TextTrackCue`s in the TextTrackCueList.\n * @instance\n */\n\n Object.defineProperty(this, 'length', {\n get: function get() {\n return this.length_;\n }\n });\n }\n /**\n * A setter for cues in this list. Creates getters\n * an an index for the cues.\n *\n * @param {Array} cues\n * An array of cues to set\n *\n * @private\n */\n\n\n var _proto = TextTrackCueList.prototype;\n\n _proto.setCues_ = function setCues_(cues) {\n var oldLength = this.length || 0;\n var i = 0;\n var l = cues.length;\n this.cues_ = cues;\n this.length_ = cues.length;\n\n var defineProp = function defineProp(index) {\n if (!('' + index in this)) {\n Object.defineProperty(this, '' + index, {\n get: function get() {\n return this.cues_[index];\n }\n });\n }\n };\n\n if (oldLength < l) {\n i = oldLength;\n\n for (; i < l; i++) {\n defineProp.call(this, i);\n }\n }\n }\n /**\n * Get a `TextTrackCue` that is currently in the `TextTrackCueList` by id.\n *\n * @param {string} id\n * The id of the cue that should be searched for.\n *\n * @return {TextTrackCueList~TextTrackCue|null}\n * A single cue or null if none was found.\n */\n ;\n\n _proto.getCueById = function getCueById(id) {\n var result = null;\n\n for (var i = 0, l = this.length; i < l; i++) {\n var cue = this[i];\n\n if (cue.id === id) {\n result = cue;\n break;\n }\n }\n\n return result;\n };\n\n return TextTrackCueList;\n }();\n\n /**\n * @file track-kinds.js\n */\n\n /**\n * All possible `VideoTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-videotrack-kind\n * @typedef VideoTrack~Kind\n * @enum\n */\n var VideoTrackKind = {\n alternative: 'alternative',\n captions: 'captions',\n main: 'main',\n sign: 'sign',\n subtitles: 'subtitles',\n commentary: 'commentary'\n };\n /**\n * All possible `AudioTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-audiotrack-kind\n * @typedef AudioTrack~Kind\n * @enum\n */\n\n var AudioTrackKind = {\n 'alternative': 'alternative',\n 'descriptions': 'descriptions',\n 'main': 'main',\n 'main-desc': 'main-desc',\n 'translation': 'translation',\n 'commentary': 'commentary'\n };\n /**\n * All possible `TextTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-kind\n * @typedef TextTrack~Kind\n * @enum\n */\n\n var TextTrackKind = {\n subtitles: 'subtitles',\n captions: 'captions',\n descriptions: 'descriptions',\n chapters: 'chapters',\n metadata: 'metadata'\n };\n /**\n * All possible `TextTrackMode`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackmode\n * @typedef TextTrack~Mode\n * @enum\n */\n\n var TextTrackMode = {\n disabled: 'disabled',\n hidden: 'hidden',\n showing: 'showing'\n };\n\n /**\n * A Track class that contains all of the common functionality for {@link AudioTrack},\n * {@link VideoTrack}, and {@link TextTrack}.\n *\n * > Note: This class should not be used directly\n *\n * @see {@link https://html.spec.whatwg.org/multipage/embedded-content.html}\n * @extends EventTarget\n * @abstract\n */\n\n var Track =\n /*#__PURE__*/\n function (_EventTarget) {\n _inheritsLoose(Track, _EventTarget);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {string} [options.kind='']\n * A valid kind for the track type you are creating.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @abstract\n */\n function Track(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _EventTarget.call(this) || this;\n var trackProps = {\n id: options.id || 'vjs_track_' + newGUID(),\n kind: options.kind || '',\n label: options.label || '',\n language: options.language || ''\n };\n /**\n * @memberof Track\n * @member {string} id\n * The id of this track. Cannot be changed after creation.\n * @instance\n *\n * @readonly\n */\n\n /**\n * @memberof Track\n * @member {string} kind\n * The kind of track that this is. Cannot be changed after creation.\n * @instance\n *\n * @readonly\n */\n\n /**\n * @memberof Track\n * @member {string} label\n * The label of this track. Cannot be changed after creation.\n * @instance\n *\n * @readonly\n */\n\n /**\n * @memberof Track\n * @member {string} language\n * The two letter language code for this track. Cannot be changed after\n * creation.\n * @instance\n *\n * @readonly\n */\n\n var _loop = function _loop(key) {\n Object.defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), key, {\n get: function get() {\n return trackProps[key];\n },\n set: function set() {}\n });\n };\n\n for (var key in trackProps) {\n _loop(key);\n }\n\n return _this;\n }\n\n return Track;\n }(EventTarget);\n\n /**\n * @file url.js\n * @module url\n */\n /**\n * @typedef {Object} url:URLObject\n *\n * @property {string} protocol\n * The protocol of the url that was parsed.\n *\n * @property {string} hostname\n * The hostname of the url that was parsed.\n *\n * @property {string} port\n * The port of the url that was parsed.\n *\n * @property {string} pathname\n * The pathname of the url that was parsed.\n *\n * @property {string} search\n * The search query of the url that was parsed.\n *\n * @property {string} hash\n * The hash of the url that was parsed.\n *\n * @property {string} host\n * The host of the url that was parsed.\n */\n\n /**\n * Resolve and parse the elements of a URL.\n *\n * @function\n * @param {String} url\n * The url to parse\n *\n * @return {url:URLObject}\n * An object of url details\n */\n\n var parseUrl = function parseUrl(url) {\n var props = ['protocol', 'hostname', 'port', 'pathname', 'search', 'hash', 'host']; // add the url to an anchor and let the browser parse the URL\n\n var a = document.createElement('a');\n a.href = url; // IE8 (and 9?) Fix\n // ie8 doesn't parse the URL correctly until the anchor is actually\n // added to the body, and an innerHTML is needed to trigger the parsing\n\n var addToBody = a.host === '' && a.protocol !== 'file:';\n var div;\n\n if (addToBody) {\n div = document.createElement('div');\n div.innerHTML = \"\";\n a = div.firstChild; // prevent the div from affecting layout\n\n div.setAttribute('style', 'display:none; position:absolute;');\n document.body.appendChild(div);\n } // Copy the specific URL properties to a new object\n // This is also needed for IE8 because the anchor loses its\n // properties when it's removed from the dom\n\n\n var details = {};\n\n for (var i = 0; i < props.length; i++) {\n details[props[i]] = a[props[i]];\n } // IE9 adds the port to the host property unlike everyone else. If\n // a port identifier is added for standard ports, strip it.\n\n\n if (details.protocol === 'http:') {\n details.host = details.host.replace(/:80$/, '');\n }\n\n if (details.protocol === 'https:') {\n details.host = details.host.replace(/:443$/, '');\n }\n\n if (!details.protocol) {\n details.protocol = window$1.location.protocol;\n }\n\n if (addToBody) {\n document.body.removeChild(div);\n }\n\n return details;\n };\n /**\n * Get absolute version of relative URL. Used to tell Flash the correct URL.\n *\n * @function\n * @param {string} url\n * URL to make absolute\n *\n * @return {string}\n * Absolute URL\n *\n * @see http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue\n */\n\n var getAbsoluteURL = function getAbsoluteURL(url) {\n // Check if absolute URL\n if (!url.match(/^https?:\\/\\//)) {\n // Convert to absolute URL. Flash hosted off-site needs an absolute URL.\n var div = document.createElement('div');\n div.innerHTML = \"x\";\n url = div.firstChild.href;\n }\n\n return url;\n };\n /**\n * Returns the extension of the passed file name. It will return an empty string\n * if passed an invalid path.\n *\n * @function\n * @param {string} path\n * The fileName path like '/path/to/file.mp4'\n *\n * @return {string}\n * The extension in lower case or an empty string if no\n * extension could be found.\n */\n\n var getFileExtension = function getFileExtension(path) {\n if (typeof path === 'string') {\n var splitPathRe = /^(\\/?)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?)(\\.([^\\.\\/\\?]+)))(?:[\\/]*|[\\?].*)$/i;\n var pathParts = splitPathRe.exec(path);\n\n if (pathParts) {\n return pathParts.pop().toLowerCase();\n }\n }\n\n return '';\n };\n /**\n * Returns whether the url passed is a cross domain request or not.\n *\n * @function\n * @param {string} url\n * The url to check.\n *\n * @return {boolean}\n * Whether it is a cross domain request or not.\n */\n\n var isCrossOrigin = function isCrossOrigin(url) {\n var winLoc = window$1.location;\n var urlInfo = parseUrl(url); // IE8 protocol relative urls will return ':' for protocol\n\n var srcProtocol = urlInfo.protocol === ':' ? winLoc.protocol : urlInfo.protocol; // Check if url is for another domain/origin\n // IE8 doesn't know location.origin, so we won't rely on it here\n\n var crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;\n return crossOrigin;\n };\n\n var Url = /*#__PURE__*/Object.freeze({\n parseUrl: parseUrl,\n getAbsoluteURL: getAbsoluteURL,\n getFileExtension: getFileExtension,\n isCrossOrigin: isCrossOrigin\n });\n\n var isFunction_1 = isFunction;\n var toString$1 = Object.prototype.toString;\n\n function isFunction(fn) {\n var string = toString$1.call(fn);\n return string === '[object Function]' || typeof fn === 'function' && string !== '[object RegExp]' || typeof window !== 'undefined' && ( // IE8 and below\n fn === window.setTimeout || fn === window.alert || fn === window.confirm || fn === window.prompt);\n }\n\n var trim_1 = createCommonjsModule(function (module, exports) {\n exports = module.exports = trim;\n\n function trim(str) {\n return str.replace(/^\\s*|\\s*$/g, '');\n }\n\n exports.left = function (str) {\n return str.replace(/^\\s*/, '');\n };\n\n exports.right = function (str) {\n return str.replace(/\\s*$/, '');\n };\n });\n var trim_2 = trim_1.left;\n var trim_3 = trim_1.right;\n\n var fnToStr = Function.prototype.toString;\n var constructorRegex = /^\\s*class\\b/;\n\n var isES6ClassFn = function isES6ClassFunction(value) {\n try {\n var fnStr = fnToStr.call(value);\n return constructorRegex.test(fnStr);\n } catch (e) {\n return false; // not a function\n }\n };\n\n var tryFunctionObject = function tryFunctionToStr(value) {\n try {\n if (isES6ClassFn(value)) {\n return false;\n }\n\n fnToStr.call(value);\n return true;\n } catch (e) {\n return false;\n }\n };\n\n var toStr = Object.prototype.toString;\n var fnClass = '[object Function]';\n var genClass = '[object GeneratorFunction]';\n var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';\n\n var isCallable = function isCallable(value) {\n if (!value) {\n return false;\n }\n\n if (typeof value !== 'function' && typeof value !== 'object') {\n return false;\n }\n\n if (typeof value === 'function' && !value.prototype) {\n return true;\n }\n\n if (hasToStringTag) {\n return tryFunctionObject(value);\n }\n\n if (isES6ClassFn(value)) {\n return false;\n }\n\n var strClass = toStr.call(value);\n return strClass === fnClass || strClass === genClass;\n };\n\n var toStr$1 = Object.prototype.toString;\n var hasOwnProperty = Object.prototype.hasOwnProperty;\n\n var forEachArray = function forEachArray(array, iterator, receiver) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (hasOwnProperty.call(array, i)) {\n if (receiver == null) {\n iterator(array[i], i, array);\n } else {\n iterator.call(receiver, array[i], i, array);\n }\n }\n }\n };\n\n var forEachString = function forEachString(string, iterator, receiver) {\n for (var i = 0, len = string.length; i < len; i++) {\n // no such thing as a sparse string.\n if (receiver == null) {\n iterator(string.charAt(i), i, string);\n } else {\n iterator.call(receiver, string.charAt(i), i, string);\n }\n }\n };\n\n var forEachObject = function forEachObject(object, iterator, receiver) {\n for (var k in object) {\n if (hasOwnProperty.call(object, k)) {\n if (receiver == null) {\n iterator(object[k], k, object);\n } else {\n iterator.call(receiver, object[k], k, object);\n }\n }\n }\n };\n\n var forEach = function forEach(list, iterator, thisArg) {\n if (!isCallable(iterator)) {\n throw new TypeError('iterator must be a function');\n }\n\n var receiver;\n\n if (arguments.length >= 3) {\n receiver = thisArg;\n }\n\n if (toStr$1.call(list) === '[object Array]') {\n forEachArray(list, iterator, receiver);\n } else if (typeof list === 'string') {\n forEachString(list, iterator, receiver);\n } else {\n forEachObject(list, iterator, receiver);\n }\n };\n\n var forEach_1 = forEach;\n\n var isArray = function isArray(arg) {\n return Object.prototype.toString.call(arg) === '[object Array]';\n };\n\n var parseHeaders = function parseHeaders(headers) {\n if (!headers) return {};\n var result = {};\n forEach_1(trim_1(headers).split('\\n'), function (row) {\n var index = row.indexOf(':'),\n key = trim_1(row.slice(0, index)).toLowerCase(),\n value = trim_1(row.slice(index + 1));\n\n if (typeof result[key] === 'undefined') {\n result[key] = value;\n } else if (isArray(result[key])) {\n result[key].push(value);\n } else {\n result[key] = [result[key], value];\n }\n });\n return result;\n };\n\n var immutable = extend;\n var hasOwnProperty$1 = Object.prototype.hasOwnProperty;\n\n function extend() {\n var target = {};\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (hasOwnProperty$1.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n }\n\n var xhr = createXHR;\n createXHR.XMLHttpRequest = window$1.XMLHttpRequest || noop;\n createXHR.XDomainRequest = \"withCredentials\" in new createXHR.XMLHttpRequest() ? createXHR.XMLHttpRequest : window$1.XDomainRequest;\n forEachArray$1([\"get\", \"put\", \"post\", \"patch\", \"head\", \"delete\"], function (method) {\n createXHR[method === \"delete\" ? \"del\" : method] = function (uri, options, callback) {\n options = initParams(uri, options, callback);\n options.method = method.toUpperCase();\n return _createXHR(options);\n };\n });\n\n function forEachArray$1(array, iterator) {\n for (var i = 0; i < array.length; i++) {\n iterator(array[i]);\n }\n }\n\n function isEmpty(obj) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) return false;\n }\n\n return true;\n }\n\n function initParams(uri, options, callback) {\n var params = uri;\n\n if (isFunction_1(options)) {\n callback = options;\n\n if (typeof uri === \"string\") {\n params = {\n uri: uri\n };\n }\n } else {\n params = immutable(options, {\n uri: uri\n });\n }\n\n params.callback = callback;\n return params;\n }\n\n function createXHR(uri, options, callback) {\n options = initParams(uri, options, callback);\n return _createXHR(options);\n }\n\n function _createXHR(options) {\n if (typeof options.callback === \"undefined\") {\n throw new Error(\"callback argument missing\");\n }\n\n var called = false;\n\n var callback = function cbOnce(err, response, body) {\n if (!called) {\n called = true;\n options.callback(err, response, body);\n }\n };\n\n function readystatechange() {\n if (xhr.readyState === 4) {\n setTimeout(loadFunc, 0);\n }\n }\n\n function getBody() {\n // Chrome with requestType=blob throws errors arround when even testing access to responseText\n var body = undefined;\n\n if (xhr.response) {\n body = xhr.response;\n } else {\n body = xhr.responseText || getXml(xhr);\n }\n\n if (isJson) {\n try {\n body = JSON.parse(body);\n } catch (e) {}\n }\n\n return body;\n }\n\n function errorFunc(evt) {\n clearTimeout(timeoutTimer);\n\n if (!(evt instanceof Error)) {\n evt = new Error(\"\" + (evt || \"Unknown XMLHttpRequest Error\"));\n }\n\n evt.statusCode = 0;\n return callback(evt, failureResponse);\n } // will load the data & process the response in a special response object\n\n\n function loadFunc() {\n if (aborted) return;\n var status;\n clearTimeout(timeoutTimer);\n\n if (options.useXDR && xhr.status === undefined) {\n //IE8 CORS GET successful response doesn't have a status field, but body is fine\n status = 200;\n } else {\n status = xhr.status === 1223 ? 204 : xhr.status;\n }\n\n var response = failureResponse;\n var err = null;\n\n if (status !== 0) {\n response = {\n body: getBody(),\n statusCode: status,\n method: method,\n headers: {},\n url: uri,\n rawRequest: xhr\n };\n\n if (xhr.getAllResponseHeaders) {\n //remember xhr can in fact be XDR for CORS in IE\n response.headers = parseHeaders(xhr.getAllResponseHeaders());\n }\n } else {\n err = new Error(\"Internal XMLHttpRequest Error\");\n }\n\n return callback(err, response, response.body);\n }\n\n var xhr = options.xhr || null;\n\n if (!xhr) {\n if (options.cors || options.useXDR) {\n xhr = new createXHR.XDomainRequest();\n } else {\n xhr = new createXHR.XMLHttpRequest();\n }\n }\n\n var key;\n var aborted;\n var uri = xhr.url = options.uri || options.url;\n var method = xhr.method = options.method || \"GET\";\n var body = options.body || options.data;\n var headers = xhr.headers = options.headers || {};\n var sync = !!options.sync;\n var isJson = false;\n var timeoutTimer;\n var failureResponse = {\n body: undefined,\n headers: {},\n statusCode: 0,\n method: method,\n url: uri,\n rawRequest: xhr\n };\n\n if (\"json\" in options && options.json !== false) {\n isJson = true;\n headers[\"accept\"] || headers[\"Accept\"] || (headers[\"Accept\"] = \"application/json\"); //Don't override existing accept header declared by user\n\n if (method !== \"GET\" && method !== \"HEAD\") {\n headers[\"content-type\"] || headers[\"Content-Type\"] || (headers[\"Content-Type\"] = \"application/json\"); //Don't override existing accept header declared by user\n\n body = JSON.stringify(options.json === true ? body : options.json);\n }\n }\n\n xhr.onreadystatechange = readystatechange;\n xhr.onload = loadFunc;\n xhr.onerror = errorFunc; // IE9 must have onprogress be set to a unique function.\n\n xhr.onprogress = function () {// IE must die\n };\n\n xhr.onabort = function () {\n aborted = true;\n };\n\n xhr.ontimeout = errorFunc;\n xhr.open(method, uri, !sync, options.username, options.password); //has to be after open\n\n if (!sync) {\n xhr.withCredentials = !!options.withCredentials;\n } // Cannot set timeout with sync request\n // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly\n // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent\n\n\n if (!sync && options.timeout > 0) {\n timeoutTimer = setTimeout(function () {\n if (aborted) return;\n aborted = true; //IE9 may still call readystatechange\n\n xhr.abort(\"timeout\");\n var e = new Error(\"XMLHttpRequest timeout\");\n e.code = \"ETIMEDOUT\";\n errorFunc(e);\n }, options.timeout);\n }\n\n if (xhr.setRequestHeader) {\n for (key in headers) {\n if (headers.hasOwnProperty(key)) {\n xhr.setRequestHeader(key, headers[key]);\n }\n }\n } else if (options.headers && !isEmpty(options.headers)) {\n throw new Error(\"Headers cannot be set on an XDomainRequest object\");\n }\n\n if (\"responseType\" in options) {\n xhr.responseType = options.responseType;\n }\n\n if (\"beforeSend\" in options && typeof options.beforeSend === \"function\") {\n options.beforeSend(xhr);\n } // Microsoft Edge browser sends \"undefined\" when send is called with undefined value.\n // XMLHttpRequest spec says to pass null as body to indicate no body\n // See https://github.com/naugtur/xhr/issues/100.\n\n\n xhr.send(body || null);\n return xhr;\n }\n\n function getXml(xhr) {\n if (xhr.responseType === \"document\") {\n return xhr.responseXML;\n }\n\n var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === \"parsererror\";\n\n if (xhr.responseType === \"\" && !firefoxBugTakenEffect) {\n return xhr.responseXML;\n }\n\n return null;\n }\n\n function noop() {}\n\n /**\n * Takes a webvtt file contents and parses it into cues\n *\n * @param {string} srcContent\n * webVTT file contents\n *\n * @param {TextTrack} track\n * TextTrack to add cues to. Cues come from the srcContent.\n *\n * @private\n */\n\n var parseCues = function parseCues(srcContent, track) {\n var parser = new window$1.WebVTT.Parser(window$1, window$1.vttjs, window$1.WebVTT.StringDecoder());\n var errors = [];\n\n parser.oncue = function (cue) {\n track.addCue(cue);\n };\n\n parser.onparsingerror = function (error) {\n errors.push(error);\n };\n\n parser.onflush = function () {\n track.trigger({\n type: 'loadeddata',\n target: track\n });\n };\n\n parser.parse(srcContent);\n\n if (errors.length > 0) {\n if (window$1.console && window$1.console.groupCollapsed) {\n window$1.console.groupCollapsed(\"Text Track parsing errors for \" + track.src);\n }\n\n errors.forEach(function (error) {\n return log.error(error);\n });\n\n if (window$1.console && window$1.console.groupEnd) {\n window$1.console.groupEnd();\n }\n }\n\n parser.flush();\n };\n /**\n * Load a `TextTrack` from a specified url.\n *\n * @param {string} src\n * Url to load track from.\n *\n * @param {TextTrack} track\n * Track to add cues to. Comes from the content at the end of `url`.\n *\n * @private\n */\n\n\n var loadTrack = function loadTrack(src, track) {\n var opts = {\n uri: src\n };\n var crossOrigin = isCrossOrigin(src);\n\n if (crossOrigin) {\n opts.cors = crossOrigin;\n }\n\n xhr(opts, bind(this, function (err, response, responseBody) {\n if (err) {\n return log.error(err, response);\n }\n\n track.loaded_ = true; // Make sure that vttjs has loaded, otherwise, wait till it finished loading\n // NOTE: this is only used for the alt/video.novtt.js build\n\n if (typeof window$1.WebVTT !== 'function') {\n if (track.tech_) {\n // to prevent use before define eslint error, we define loadHandler\n // as a let here\n var loadHandler;\n\n var errorHandler = function errorHandler() {\n log.error(\"vttjs failed to load, stopping trying to process \" + track.src);\n track.tech_.off('vttjsloaded', loadHandler);\n };\n\n loadHandler = function loadHandler() {\n track.tech_.off('vttjserror', errorHandler);\n return parseCues(responseBody, track);\n };\n\n track.tech_.one('vttjsloaded', loadHandler);\n track.tech_.one('vttjserror', errorHandler);\n }\n } else {\n parseCues(responseBody, track);\n }\n }));\n };\n /**\n * A representation of a single `TextTrack`.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrack}\n * @extends Track\n */\n\n\n var TextTrack =\n /*#__PURE__*/\n function (_Track) {\n _inheritsLoose(TextTrack, _Track);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} options={}\n * Object of option names and values\n *\n * @param {Tech} options.tech\n * A reference to the tech that owns this TextTrack.\n *\n * @param {TextTrack~Kind} [options.kind='subtitles']\n * A valid text track kind.\n *\n * @param {TextTrack~Mode} [options.mode='disabled']\n * A valid text track mode.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this TextTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {string} [options.srclang='']\n * A valid two character language code. An alternative, but deprioritized\n * version of `options.language`\n *\n * @param {string} [options.src]\n * A url to TextTrack cues.\n *\n * @param {boolean} [options.default]\n * If this track should default to on or off.\n */\n function TextTrack(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n if (!options.tech) {\n throw new Error('A tech was not provided.');\n }\n\n var settings = mergeOptions(options, {\n kind: TextTrackKind[options.kind] || 'subtitles',\n language: options.language || options.srclang || ''\n });\n var mode = TextTrackMode[settings.mode] || 'disabled';\n var default_ = settings.default;\n\n if (settings.kind === 'metadata' || settings.kind === 'chapters') {\n mode = 'hidden';\n }\n\n _this = _Track.call(this, settings) || this;\n _this.tech_ = settings.tech;\n _this.cues_ = [];\n _this.activeCues_ = [];\n var cues = new TextTrackCueList(_this.cues_);\n var activeCues = new TextTrackCueList(_this.activeCues_);\n var changed = false;\n var timeupdateHandler = bind(_assertThisInitialized(_assertThisInitialized(_this)), function () {\n // Accessing this.activeCues for the side-effects of updating itself\n // due to its nature as a getter function. Do not remove or cues will\n // stop updating!\n // Use the setter to prevent deletion from uglify (pure_getters rule)\n this.activeCues = this.activeCues;\n\n if (changed) {\n this.trigger('cuechange');\n changed = false;\n }\n });\n\n if (mode !== 'disabled') {\n _this.tech_.ready(function () {\n _this.tech_.on('timeupdate', timeupdateHandler);\n }, true);\n }\n\n Object.defineProperties(_assertThisInitialized(_assertThisInitialized(_this)), {\n /**\n * @memberof TextTrack\n * @member {boolean} default\n * If this track was set to be on or off by default. Cannot be changed after\n * creation.\n * @instance\n *\n * @readonly\n */\n default: {\n get: function get() {\n return default_;\n },\n set: function set() {}\n },\n\n /**\n * @memberof TextTrack\n * @member {string} mode\n * Set the mode of this TextTrack to a valid {@link TextTrack~Mode}. Will\n * not be set if setting to an invalid mode.\n * @instance\n *\n * @fires TextTrack#modechange\n */\n mode: {\n get: function get() {\n return mode;\n },\n set: function set(newMode) {\n var _this2 = this;\n\n if (!TextTrackMode[newMode]) {\n return;\n }\n\n mode = newMode;\n\n if (mode !== 'disabled') {\n this.tech_.ready(function () {\n _this2.tech_.on('timeupdate', timeupdateHandler);\n }, true);\n } else {\n this.tech_.off('timeupdate', timeupdateHandler);\n }\n /**\n * An event that fires when mode changes on this track. This allows\n * the TextTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec!\n *\n * @event TextTrack#modechange\n * @type {EventTarget~Event}\n */\n\n\n this.trigger('modechange');\n }\n },\n\n /**\n * @memberof TextTrack\n * @member {TextTrackCueList} cues\n * The text track cue list for this TextTrack.\n * @instance\n */\n cues: {\n get: function get() {\n if (!this.loaded_) {\n return null;\n }\n\n return cues;\n },\n set: function set() {}\n },\n\n /**\n * @memberof TextTrack\n * @member {TextTrackCueList} activeCues\n * The list text track cues that are currently active for this TextTrack.\n * @instance\n */\n activeCues: {\n get: function get() {\n if (!this.loaded_) {\n return null;\n } // nothing to do\n\n\n if (this.cues.length === 0) {\n return activeCues;\n }\n\n var ct = this.tech_.currentTime();\n var active = [];\n\n for (var i = 0, l = this.cues.length; i < l; i++) {\n var cue = this.cues[i];\n\n if (cue.startTime <= ct && cue.endTime >= ct) {\n active.push(cue);\n } else if (cue.startTime === cue.endTime && cue.startTime <= ct && cue.startTime + 0.5 >= ct) {\n active.push(cue);\n }\n }\n\n changed = false;\n\n if (active.length !== this.activeCues_.length) {\n changed = true;\n } else {\n for (var _i = 0; _i < active.length; _i++) {\n if (this.activeCues_.indexOf(active[_i]) === -1) {\n changed = true;\n }\n }\n }\n\n this.activeCues_ = active;\n activeCues.setCues_(this.activeCues_);\n return activeCues;\n },\n // /!\\ Keep this setter empty (see the timeupdate handler above)\n set: function set() {}\n }\n });\n\n if (settings.src) {\n _this.src = settings.src;\n loadTrack(settings.src, _assertThisInitialized(_assertThisInitialized(_this)));\n } else {\n _this.loaded_ = true;\n }\n\n return _this;\n }\n /**\n * Add a cue to the internal list of cues.\n *\n * @param {TextTrack~Cue} cue\n * The cue to add to our internal list\n */\n\n\n var _proto = TextTrack.prototype;\n\n _proto.addCue = function addCue(originalCue) {\n var cue = originalCue;\n\n if (window$1.vttjs && !(originalCue instanceof window$1.vttjs.VTTCue)) {\n cue = new window$1.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);\n\n for (var prop in originalCue) {\n if (!(prop in cue)) {\n cue[prop] = originalCue[prop];\n }\n } // make sure that `id` is copied over\n\n\n cue.id = originalCue.id;\n cue.originalCue_ = originalCue;\n }\n\n var tracks = this.tech_.textTracks();\n\n for (var i = 0; i < tracks.length; i++) {\n if (tracks[i] !== this) {\n tracks[i].removeCue(cue);\n }\n }\n\n this.cues_.push(cue);\n this.cues.setCues_(this.cues_);\n }\n /**\n * Remove a cue from our internal list\n *\n * @param {TextTrack~Cue} removeCue\n * The cue to remove from our internal list\n */\n ;\n\n _proto.removeCue = function removeCue(_removeCue) {\n var i = this.cues_.length;\n\n while (i--) {\n var cue = this.cues_[i];\n\n if (cue === _removeCue || cue.originalCue_ && cue.originalCue_ === _removeCue) {\n this.cues_.splice(i, 1);\n this.cues.setCues_(this.cues_);\n break;\n }\n }\n };\n\n return TextTrack;\n }(Track);\n /**\n * cuechange - One or more cues in the track have become active or stopped being active.\n */\n\n\n TextTrack.prototype.allowedEvents_ = {\n cuechange: 'cuechange'\n };\n\n /**\n * A representation of a single `AudioTrack`. If it is part of an {@link AudioTrackList}\n * only one `AudioTrack` in the list will be enabled at a time.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotrack}\n * @extends Track\n */\n\n var AudioTrack =\n /*#__PURE__*/\n function (_Track) {\n _inheritsLoose(AudioTrack, _Track);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {AudioTrack~Kind} [options.kind='']\n * A valid audio track kind\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {boolean} [options.enabled]\n * If this track is the one that is currently playing. If this track is part of\n * an {@link AudioTrackList}, only one {@link AudioTrack} will be enabled.\n */\n function AudioTrack(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n var settings = mergeOptions(options, {\n kind: AudioTrackKind[options.kind] || ''\n });\n _this = _Track.call(this, settings) || this;\n var enabled = false;\n /**\n * @memberof AudioTrack\n * @member {boolean} enabled\n * If this `AudioTrack` is enabled or not. When setting this will\n * fire {@link AudioTrack#enabledchange} if the state of enabled is changed.\n * @instance\n *\n * @fires VideoTrack#selectedchange\n */\n\n Object.defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), 'enabled', {\n get: function get() {\n return enabled;\n },\n set: function set(newEnabled) {\n // an invalid or unchanged value\n if (typeof newEnabled !== 'boolean' || newEnabled === enabled) {\n return;\n }\n\n enabled = newEnabled;\n /**\n * An event that fires when enabled changes on this track. This allows\n * the AudioTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec! Native tracks will do\n * this internally without an event.\n *\n * @event AudioTrack#enabledchange\n * @type {EventTarget~Event}\n */\n\n this.trigger('enabledchange');\n }\n }); // if the user sets this track to selected then\n // set selected to that true value otherwise\n // we keep it false\n\n if (settings.enabled) {\n _this.enabled = settings.enabled;\n }\n\n _this.loaded_ = true;\n return _this;\n }\n\n return AudioTrack;\n }(Track);\n\n /**\n * A representation of a single `VideoTrack`.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotrack}\n * @extends Track\n */\n\n var VideoTrack =\n /*#__PURE__*/\n function (_Track) {\n _inheritsLoose(VideoTrack, _Track);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {string} [options.kind='']\n * A valid {@link VideoTrack~Kind}\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {boolean} [options.selected]\n * If this track is the one that is currently playing.\n */\n function VideoTrack(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n var settings = mergeOptions(options, {\n kind: VideoTrackKind[options.kind] || ''\n });\n _this = _Track.call(this, settings) || this;\n var selected = false;\n /**\n * @memberof VideoTrack\n * @member {boolean} selected\n * If this `VideoTrack` is selected or not. When setting this will\n * fire {@link VideoTrack#selectedchange} if the state of selected changed.\n * @instance\n *\n * @fires VideoTrack#selectedchange\n */\n\n Object.defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), 'selected', {\n get: function get() {\n return selected;\n },\n set: function set(newSelected) {\n // an invalid or unchanged value\n if (typeof newSelected !== 'boolean' || newSelected === selected) {\n return;\n }\n\n selected = newSelected;\n /**\n * An event that fires when selected changes on this track. This allows\n * the VideoTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec! Native tracks will do\n * this internally without an event.\n *\n * @event VideoTrack#selectedchange\n * @type {EventTarget~Event}\n */\n\n this.trigger('selectedchange');\n }\n }); // if the user sets this track to selected then\n // set selected to that true value otherwise\n // we keep it false\n\n if (settings.selected) {\n _this.selected = settings.selected;\n }\n\n return _this;\n }\n\n return VideoTrack;\n }(Track);\n\n /**\n * @memberof HTMLTrackElement\n * @typedef {HTMLTrackElement~ReadyState}\n * @enum {number}\n */\n\n var NONE = 0;\n var LOADING = 1;\n var LOADED = 2;\n var ERROR = 3;\n /**\n * A single track represented in the DOM.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#htmltrackelement}\n * @extends EventTarget\n */\n\n var HTMLTrackElement =\n /*#__PURE__*/\n function (_EventTarget) {\n _inheritsLoose(HTMLTrackElement, _EventTarget);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} options={}\n * Object of option names and values\n *\n * @param {Tech} options.tech\n * A reference to the tech that owns this HTMLTrackElement.\n *\n * @param {TextTrack~Kind} [options.kind='subtitles']\n * A valid text track kind.\n *\n * @param {TextTrack~Mode} [options.mode='disabled']\n * A valid text track mode.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this TextTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {string} [options.srclang='']\n * A valid two character language code. An alternative, but deprioritized\n * vesion of `options.language`\n *\n * @param {string} [options.src]\n * A url to TextTrack cues.\n *\n * @param {boolean} [options.default]\n * If this track should default to on or off.\n */\n function HTMLTrackElement(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _EventTarget.call(this) || this;\n var readyState;\n var track = new TextTrack(options);\n _this.kind = track.kind;\n _this.src = track.src;\n _this.srclang = track.language;\n _this.label = track.label;\n _this.default = track.default;\n Object.defineProperties(_assertThisInitialized(_assertThisInitialized(_this)), {\n /**\n * @memberof HTMLTrackElement\n * @member {HTMLTrackElement~ReadyState} readyState\n * The current ready state of the track element.\n * @instance\n */\n readyState: {\n get: function get() {\n return readyState;\n }\n },\n\n /**\n * @memberof HTMLTrackElement\n * @member {TextTrack} track\n * The underlying TextTrack object.\n * @instance\n *\n */\n track: {\n get: function get() {\n return track;\n }\n }\n });\n readyState = NONE;\n /**\n * @listens TextTrack#loadeddata\n * @fires HTMLTrackElement#load\n */\n\n track.addEventListener('loadeddata', function () {\n readyState = LOADED;\n\n _this.trigger({\n type: 'load',\n target: _assertThisInitialized(_assertThisInitialized(_this))\n });\n });\n return _this;\n }\n\n return HTMLTrackElement;\n }(EventTarget);\n\n HTMLTrackElement.prototype.allowedEvents_ = {\n load: 'load'\n };\n HTMLTrackElement.NONE = NONE;\n HTMLTrackElement.LOADING = LOADING;\n HTMLTrackElement.LOADED = LOADED;\n HTMLTrackElement.ERROR = ERROR;\n\n /*\n * This file contains all track properties that are used in\n * player.js, tech.js, html5.js and possibly other techs in the future.\n */\n\n var NORMAL = {\n audio: {\n ListClass: AudioTrackList,\n TrackClass: AudioTrack,\n capitalName: 'Audio'\n },\n video: {\n ListClass: VideoTrackList,\n TrackClass: VideoTrack,\n capitalName: 'Video'\n },\n text: {\n ListClass: TextTrackList,\n TrackClass: TextTrack,\n capitalName: 'Text'\n }\n };\n Object.keys(NORMAL).forEach(function (type) {\n NORMAL[type].getterName = type + \"Tracks\";\n NORMAL[type].privateName = type + \"Tracks_\";\n });\n var REMOTE = {\n remoteText: {\n ListClass: TextTrackList,\n TrackClass: TextTrack,\n capitalName: 'RemoteText',\n getterName: 'remoteTextTracks',\n privateName: 'remoteTextTracks_'\n },\n remoteTextEl: {\n ListClass: HtmlTrackElementList,\n TrackClass: HTMLTrackElement,\n capitalName: 'RemoteTextTrackEls',\n getterName: 'remoteTextTrackEls',\n privateName: 'remoteTextTrackEls_'\n }\n };\n var ALL = mergeOptions(NORMAL, REMOTE);\n REMOTE.names = Object.keys(REMOTE);\n NORMAL.names = Object.keys(NORMAL);\n ALL.names = [].concat(REMOTE.names).concat(NORMAL.names);\n\n /**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\n\n /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */\n var _objCreate = Object.create || function () {\n function F() {}\n\n return function (o) {\n if (arguments.length !== 1) {\n throw new Error('Object.create shim only accepts one parameter.');\n }\n\n F.prototype = o;\n return new F();\n };\n }(); // Creates a new ParserError object from an errorData object. The errorData\n // object should have default code and message properties. The default message\n // property can be overriden by passing in a message parameter.\n // See ParsingError.Errors below for acceptable errors.\n\n\n function ParsingError(errorData, message) {\n this.name = \"ParsingError\";\n this.code = errorData.code;\n this.message = message || errorData.message;\n }\n\n ParsingError.prototype = _objCreate(Error.prototype);\n ParsingError.prototype.constructor = ParsingError; // ParsingError metadata for acceptable ParsingErrors.\n\n ParsingError.Errors = {\n BadSignature: {\n code: 0,\n message: \"Malformed WebVTT signature.\"\n },\n BadTimeStamp: {\n code: 1,\n message: \"Malformed time stamp.\"\n }\n }; // Try to parse input as a time stamp.\n\n function parseTimeStamp(input) {\n function computeSeconds(h, m, s, f) {\n return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;\n }\n\n var m = input.match(/^(\\d+):(\\d{2})(:\\d{2})?\\.(\\d{3})/);\n\n if (!m) {\n return null;\n }\n\n if (m[3]) {\n // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]\n return computeSeconds(m[1], m[2], m[3].replace(\":\", \"\"), m[4]);\n } else if (m[1] > 59) {\n // Timestamp takes the form of [hours]:[minutes].[milliseconds]\n // First position is hours as it's over 59.\n return computeSeconds(m[1], m[2], 0, m[4]);\n } else {\n // Timestamp takes the form of [minutes]:[seconds].[milliseconds]\n return computeSeconds(0, m[1], m[2], m[4]);\n }\n } // A settings object holds key/value pairs and will ignore anything but the first\n // assignment to a specific key.\n\n\n function Settings() {\n this.values = _objCreate(null);\n }\n\n Settings.prototype = {\n // Only accept the first assignment to any key.\n set: function set(k, v) {\n if (!this.get(k) && v !== \"\") {\n this.values[k] = v;\n }\n },\n // Return the value for a key, or a default value.\n // If 'defaultKey' is passed then 'dflt' is assumed to be an object with\n // a number of possible default values as properties where 'defaultKey' is\n // the key of the property that will be chosen; otherwise it's assumed to be\n // a single value.\n get: function get(k, dflt, defaultKey) {\n if (defaultKey) {\n return this.has(k) ? this.values[k] : dflt[defaultKey];\n }\n\n return this.has(k) ? this.values[k] : dflt;\n },\n // Check whether we have a value for a key.\n has: function has(k) {\n return k in this.values;\n },\n // Accept a setting if its one of the given alternatives.\n alt: function alt(k, v, a) {\n for (var n = 0; n < a.length; ++n) {\n if (v === a[n]) {\n this.set(k, v);\n break;\n }\n }\n },\n // Accept a setting if its a valid (signed) integer.\n integer: function integer(k, v) {\n if (/^-?\\d+$/.test(v)) {\n // integer\n this.set(k, parseInt(v, 10));\n }\n },\n // Accept a setting if its a valid percentage.\n percent: function percent(k, v) {\n var m;\n\n if (m = v.match(/^([\\d]{1,3})(\\.[\\d]*)?%$/)) {\n v = parseFloat(v);\n\n if (v >= 0 && v <= 100) {\n this.set(k, v);\n return true;\n }\n }\n\n return false;\n }\n }; // Helper function to parse input into groups separated by 'groupDelim', and\n // interprete each group as a key/value pair separated by 'keyValueDelim'.\n\n function parseOptions(input, callback, keyValueDelim, groupDelim) {\n var groups = groupDelim ? input.split(groupDelim) : [input];\n\n for (var i in groups) {\n if (typeof groups[i] !== \"string\") {\n continue;\n }\n\n var kv = groups[i].split(keyValueDelim);\n\n if (kv.length !== 2) {\n continue;\n }\n\n var k = kv[0];\n var v = kv[1];\n callback(k, v);\n }\n }\n\n function parseCue(input, cue, regionList) {\n // Remember the original input if we need to throw an error.\n var oInput = input; // 4.1 WebVTT timestamp\n\n function consumeTimeStamp() {\n var ts = parseTimeStamp(input);\n\n if (ts === null) {\n throw new ParsingError(ParsingError.Errors.BadTimeStamp, \"Malformed timestamp: \" + oInput);\n } // Remove time stamp from input.\n\n\n input = input.replace(/^[^\\sa-zA-Z-]+/, \"\");\n return ts;\n } // 4.4.2 WebVTT cue settings\n\n\n function consumeCueSettings(input, cue) {\n var settings = new Settings();\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"region\":\n // Find the last region we parsed with the same region id.\n for (var i = regionList.length - 1; i >= 0; i--) {\n if (regionList[i].id === v) {\n settings.set(k, regionList[i].region);\n break;\n }\n }\n\n break;\n\n case \"vertical\":\n settings.alt(k, v, [\"rl\", \"lr\"]);\n break;\n\n case \"line\":\n var vals = v.split(\",\"),\n vals0 = vals[0];\n settings.integer(k, vals0);\n settings.percent(k, vals0) ? settings.set(\"snapToLines\", false) : null;\n settings.alt(k, vals0, [\"auto\"]);\n\n if (vals.length === 2) {\n settings.alt(\"lineAlign\", vals[1], [\"start\", \"middle\", \"end\"]);\n }\n\n break;\n\n case \"position\":\n vals = v.split(\",\");\n settings.percent(k, vals[0]);\n\n if (vals.length === 2) {\n settings.alt(\"positionAlign\", vals[1], [\"start\", \"middle\", \"end\"]);\n }\n\n break;\n\n case \"size\":\n settings.percent(k, v);\n break;\n\n case \"align\":\n settings.alt(k, v, [\"start\", \"middle\", \"end\", \"left\", \"right\"]);\n break;\n }\n }, /:/, /\\s/); // Apply default values for any missing fields.\n\n cue.region = settings.get(\"region\", null);\n cue.vertical = settings.get(\"vertical\", \"\");\n cue.line = settings.get(\"line\", \"auto\");\n cue.lineAlign = settings.get(\"lineAlign\", \"start\");\n cue.snapToLines = settings.get(\"snapToLines\", true);\n cue.size = settings.get(\"size\", 100);\n cue.align = settings.get(\"align\", \"middle\");\n cue.position = settings.get(\"position\", {\n start: 0,\n left: 0,\n middle: 50,\n end: 100,\n right: 100\n }, cue.align);\n cue.positionAlign = settings.get(\"positionAlign\", {\n start: \"start\",\n left: \"start\",\n middle: \"middle\",\n end: \"end\",\n right: \"end\"\n }, cue.align);\n }\n\n function skipWhitespace() {\n input = input.replace(/^\\s+/, \"\");\n } // 4.1 WebVTT cue timings.\n\n\n skipWhitespace();\n cue.startTime = consumeTimeStamp(); // (1) collect cue start time\n\n skipWhitespace();\n\n if (input.substr(0, 3) !== \"-->\") {\n // (3) next characters must match \"-->\"\n throw new ParsingError(ParsingError.Errors.BadTimeStamp, \"Malformed time stamp (time stamps must be separated by '-->'): \" + oInput);\n }\n\n input = input.substr(3);\n skipWhitespace();\n cue.endTime = consumeTimeStamp(); // (5) collect cue end time\n // 4.1 WebVTT cue settings list.\n\n skipWhitespace();\n consumeCueSettings(input, cue);\n }\n\n var ESCAPE = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n \"‎\": \"\\u200E\",\n \"‏\": \"\\u200F\",\n \" \": \"\\xA0\"\n };\n var TAG_NAME = {\n c: \"span\",\n i: \"i\",\n b: \"b\",\n u: \"u\",\n ruby: \"ruby\",\n rt: \"rt\",\n v: \"span\",\n lang: \"span\"\n };\n var TAG_ANNOTATION = {\n v: \"title\",\n lang: \"lang\"\n };\n var NEEDS_PARENT = {\n rt: \"ruby\"\n }; // Parse content into a document fragment.\n\n function parseContent(window, input) {\n function nextToken() {\n // Check for end-of-string.\n if (!input) {\n return null;\n } // Consume 'n' characters from the input.\n\n\n function consume(result) {\n input = input.substr(result.length);\n return result;\n }\n\n var m = input.match(/^([^<]*)(<[^>]*>?)?/); // If there is some text before the next tag, return it, otherwise return\n // the tag.\n\n return consume(m[1] ? m[1] : m[2]);\n } // Unescape a string 's'.\n\n\n function unescape1(e) {\n return ESCAPE[e];\n }\n\n function unescape(s) {\n while (m = s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/)) {\n s = s.replace(m[0], unescape1);\n }\n\n return s;\n }\n\n function shouldAdd(current, element) {\n return !NEEDS_PARENT[element.localName] || NEEDS_PARENT[element.localName] === current.localName;\n } // Create an element for this tag.\n\n\n function createElement(type, annotation) {\n var tagName = TAG_NAME[type];\n\n if (!tagName) {\n return null;\n }\n\n var element = window.document.createElement(tagName);\n element.localName = tagName;\n var name = TAG_ANNOTATION[type];\n\n if (name && annotation) {\n element[name] = annotation.trim();\n }\n\n return element;\n }\n\n var rootDiv = window.document.createElement(\"div\"),\n current = rootDiv,\n t,\n tagStack = [];\n\n while ((t = nextToken()) !== null) {\n if (t[0] === '<') {\n if (t[1] === \"/\") {\n // If the closing tag matches, move back up to the parent node.\n if (tagStack.length && tagStack[tagStack.length - 1] === t.substr(2).replace(\">\", \"\")) {\n tagStack.pop();\n current = current.parentNode;\n } // Otherwise just ignore the end tag.\n\n\n continue;\n }\n\n var ts = parseTimeStamp(t.substr(1, t.length - 2));\n var node;\n\n if (ts) {\n // Timestamps are lead nodes as well.\n node = window.document.createProcessingInstruction(\"timestamp\", ts);\n current.appendChild(node);\n continue;\n }\n\n var m = t.match(/^<([^.\\s/0-9>]+)(\\.[^\\s\\\\>]+)?([^>\\\\]+)?(\\\\?)>?$/); // If we can't parse the tag, skip to the next tag.\n\n if (!m) {\n continue;\n } // Try to construct an element, and ignore the tag if we couldn't.\n\n\n node = createElement(m[1], m[3]);\n\n if (!node) {\n continue;\n } // Determine if the tag should be added based on the context of where it\n // is placed in the cuetext.\n\n\n if (!shouldAdd(current, node)) {\n continue;\n } // Set the class list (as a list of classes, separated by space).\n\n\n if (m[2]) {\n node.className = m[2].substr(1).replace('.', ' ');\n } // Append the node to the current node, and enter the scope of the new\n // node.\n\n\n tagStack.push(m[1]);\n current.appendChild(node);\n current = node;\n continue;\n } // Text nodes are leaf nodes.\n\n\n current.appendChild(window.document.createTextNode(unescape(t)));\n }\n\n return rootDiv;\n } // This is a list of all the Unicode characters that have a strong\n // right-to-left category. What this means is that these characters are\n // written right-to-left for sure. It was generated by pulling all the strong\n // right-to-left characters out of the Unicode data table. That table can\n // found at: http://www.unicode.org/Public/UNIDATA/UnicodeData.txt\n\n\n var strongRTLRanges = [[0x5be, 0x5be], [0x5c0, 0x5c0], [0x5c3, 0x5c3], [0x5c6, 0x5c6], [0x5d0, 0x5ea], [0x5f0, 0x5f4], [0x608, 0x608], [0x60b, 0x60b], [0x60d, 0x60d], [0x61b, 0x61b], [0x61e, 0x64a], [0x66d, 0x66f], [0x671, 0x6d5], [0x6e5, 0x6e6], [0x6ee, 0x6ef], [0x6fa, 0x70d], [0x70f, 0x710], [0x712, 0x72f], [0x74d, 0x7a5], [0x7b1, 0x7b1], [0x7c0, 0x7ea], [0x7f4, 0x7f5], [0x7fa, 0x7fa], [0x800, 0x815], [0x81a, 0x81a], [0x824, 0x824], [0x828, 0x828], [0x830, 0x83e], [0x840, 0x858], [0x85e, 0x85e], [0x8a0, 0x8a0], [0x8a2, 0x8ac], [0x200f, 0x200f], [0xfb1d, 0xfb1d], [0xfb1f, 0xfb28], [0xfb2a, 0xfb36], [0xfb38, 0xfb3c], [0xfb3e, 0xfb3e], [0xfb40, 0xfb41], [0xfb43, 0xfb44], [0xfb46, 0xfbc1], [0xfbd3, 0xfd3d], [0xfd50, 0xfd8f], [0xfd92, 0xfdc7], [0xfdf0, 0xfdfc], [0xfe70, 0xfe74], [0xfe76, 0xfefc], [0x10800, 0x10805], [0x10808, 0x10808], [0x1080a, 0x10835], [0x10837, 0x10838], [0x1083c, 0x1083c], [0x1083f, 0x10855], [0x10857, 0x1085f], [0x10900, 0x1091b], [0x10920, 0x10939], [0x1093f, 0x1093f], [0x10980, 0x109b7], [0x109be, 0x109bf], [0x10a00, 0x10a00], [0x10a10, 0x10a13], [0x10a15, 0x10a17], [0x10a19, 0x10a33], [0x10a40, 0x10a47], [0x10a50, 0x10a58], [0x10a60, 0x10a7f], [0x10b00, 0x10b35], [0x10b40, 0x10b55], [0x10b58, 0x10b72], [0x10b78, 0x10b7f], [0x10c00, 0x10c48], [0x1ee00, 0x1ee03], [0x1ee05, 0x1ee1f], [0x1ee21, 0x1ee22], [0x1ee24, 0x1ee24], [0x1ee27, 0x1ee27], [0x1ee29, 0x1ee32], [0x1ee34, 0x1ee37], [0x1ee39, 0x1ee39], [0x1ee3b, 0x1ee3b], [0x1ee42, 0x1ee42], [0x1ee47, 0x1ee47], [0x1ee49, 0x1ee49], [0x1ee4b, 0x1ee4b], [0x1ee4d, 0x1ee4f], [0x1ee51, 0x1ee52], [0x1ee54, 0x1ee54], [0x1ee57, 0x1ee57], [0x1ee59, 0x1ee59], [0x1ee5b, 0x1ee5b], [0x1ee5d, 0x1ee5d], [0x1ee5f, 0x1ee5f], [0x1ee61, 0x1ee62], [0x1ee64, 0x1ee64], [0x1ee67, 0x1ee6a], [0x1ee6c, 0x1ee72], [0x1ee74, 0x1ee77], [0x1ee79, 0x1ee7c], [0x1ee7e, 0x1ee7e], [0x1ee80, 0x1ee89], [0x1ee8b, 0x1ee9b], [0x1eea1, 0x1eea3], [0x1eea5, 0x1eea9], [0x1eeab, 0x1eebb], [0x10fffd, 0x10fffd]];\n\n function isStrongRTLChar(charCode) {\n for (var i = 0; i < strongRTLRanges.length; i++) {\n var currentRange = strongRTLRanges[i];\n\n if (charCode >= currentRange[0] && charCode <= currentRange[1]) {\n return true;\n }\n }\n\n return false;\n }\n\n function determineBidi(cueDiv) {\n var nodeStack = [],\n text = \"\",\n charCode;\n\n if (!cueDiv || !cueDiv.childNodes) {\n return \"ltr\";\n }\n\n function pushNodes(nodeStack, node) {\n for (var i = node.childNodes.length - 1; i >= 0; i--) {\n nodeStack.push(node.childNodes[i]);\n }\n }\n\n function nextTextNode(nodeStack) {\n if (!nodeStack || !nodeStack.length) {\n return null;\n }\n\n var node = nodeStack.pop(),\n text = node.textContent || node.innerText;\n\n if (text) {\n // TODO: This should match all unicode type B characters (paragraph\n // separator characters). See issue #115.\n var m = text.match(/^.*(\\n|\\r)/);\n\n if (m) {\n nodeStack.length = 0;\n return m[0];\n }\n\n return text;\n }\n\n if (node.tagName === \"ruby\") {\n return nextTextNode(nodeStack);\n }\n\n if (node.childNodes) {\n pushNodes(nodeStack, node);\n return nextTextNode(nodeStack);\n }\n }\n\n pushNodes(nodeStack, cueDiv);\n\n while (text = nextTextNode(nodeStack)) {\n for (var i = 0; i < text.length; i++) {\n charCode = text.charCodeAt(i);\n\n if (isStrongRTLChar(charCode)) {\n return \"rtl\";\n }\n }\n }\n\n return \"ltr\";\n }\n\n function computeLinePos(cue) {\n if (typeof cue.line === \"number\" && (cue.snapToLines || cue.line >= 0 && cue.line <= 100)) {\n return cue.line;\n }\n\n if (!cue.track || !cue.track.textTrackList || !cue.track.textTrackList.mediaElement) {\n return -1;\n }\n\n var track = cue.track,\n trackList = track.textTrackList,\n count = 0;\n\n for (var i = 0; i < trackList.length && trackList[i] !== track; i++) {\n if (trackList[i].mode === \"showing\") {\n count++;\n }\n }\n\n return ++count * -1;\n }\n\n function StyleBox() {} // Apply styles to a div. If there is no div passed then it defaults to the\n // div on 'this'.\n\n\n StyleBox.prototype.applyStyles = function (styles, div) {\n div = div || this.div;\n\n for (var prop in styles) {\n if (styles.hasOwnProperty(prop)) {\n div.style[prop] = styles[prop];\n }\n }\n };\n\n StyleBox.prototype.formatStyle = function (val, unit) {\n return val === 0 ? 0 : val + unit;\n }; // Constructs the computed display state of the cue (a div). Places the div\n // into the overlay which should be a block level element (usually a div).\n\n\n function CueStyleBox(window, cue, styleOptions) {\n StyleBox.call(this);\n this.cue = cue; // Parse our cue's text into a DOM tree rooted at 'cueDiv'. This div will\n // have inline positioning and will function as the cue background box.\n\n this.cueDiv = parseContent(window, cue.text);\n var styles = {\n color: \"rgba(255, 255, 255, 1)\",\n backgroundColor: \"rgba(0, 0, 0, 0.8)\",\n position: \"relative\",\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n display: \"inline\",\n writingMode: cue.vertical === \"\" ? \"horizontal-tb\" : cue.vertical === \"lr\" ? \"vertical-lr\" : \"vertical-rl\",\n unicodeBidi: \"plaintext\"\n };\n this.applyStyles(styles, this.cueDiv); // Create an absolutely positioned div that will be used to position the cue\n // div. Note, all WebVTT cue-setting alignments are equivalent to the CSS\n // mirrors of them except \"middle\" which is \"center\" in CSS.\n\n this.div = window.document.createElement(\"div\");\n styles = {\n direction: determineBidi(this.cueDiv),\n writingMode: cue.vertical === \"\" ? \"horizontal-tb\" : cue.vertical === \"lr\" ? \"vertical-lr\" : \"vertical-rl\",\n unicodeBidi: \"plaintext\",\n textAlign: cue.align === \"middle\" ? \"center\" : cue.align,\n font: styleOptions.font,\n whiteSpace: \"pre-line\",\n position: \"absolute\"\n };\n this.applyStyles(styles);\n this.div.appendChild(this.cueDiv); // Calculate the distance from the reference edge of the viewport to the text\n // position of the cue box. The reference edge will be resolved later when\n // the box orientation styles are applied.\n\n var textPos = 0;\n\n switch (cue.positionAlign) {\n case \"start\":\n textPos = cue.position;\n break;\n\n case \"middle\":\n textPos = cue.position - cue.size / 2;\n break;\n\n case \"end\":\n textPos = cue.position - cue.size;\n break;\n } // Horizontal box orientation; textPos is the distance from the left edge of the\n // area to the left edge of the box and cue.size is the distance extending to\n // the right from there.\n\n\n if (cue.vertical === \"\") {\n this.applyStyles({\n left: this.formatStyle(textPos, \"%\"),\n width: this.formatStyle(cue.size, \"%\")\n }); // Vertical box orientation; textPos is the distance from the top edge of the\n // area to the top edge of the box and cue.size is the height extending\n // downwards from there.\n } else {\n this.applyStyles({\n top: this.formatStyle(textPos, \"%\"),\n height: this.formatStyle(cue.size, \"%\")\n });\n }\n\n this.move = function (box) {\n this.applyStyles({\n top: this.formatStyle(box.top, \"px\"),\n bottom: this.formatStyle(box.bottom, \"px\"),\n left: this.formatStyle(box.left, \"px\"),\n right: this.formatStyle(box.right, \"px\"),\n height: this.formatStyle(box.height, \"px\"),\n width: this.formatStyle(box.width, \"px\")\n });\n };\n }\n\n CueStyleBox.prototype = _objCreate(StyleBox.prototype);\n CueStyleBox.prototype.constructor = CueStyleBox; // Represents the co-ordinates of an Element in a way that we can easily\n // compute things with such as if it overlaps or intersects with another Element.\n // Can initialize it with either a StyleBox or another BoxPosition.\n\n function BoxPosition(obj) {\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) && rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect(); // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n\n lh = rects ? Math.max(rects[0] && rects[0].height || 0, obj.height / rects.length) : 0;\n }\n\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || top + (obj.height || height);\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n } // Move the box along a particular axis. Optionally pass in an amount to move\n // the box. If no amount is passed then the default is the line height of the\n // box.\n\n\n BoxPosition.prototype.move = function (axis, toMove) {\n toMove = toMove !== undefined ? toMove : this.lineHeight;\n\n switch (axis) {\n case \"+x\":\n this.left += toMove;\n this.right += toMove;\n break;\n\n case \"-x\":\n this.left -= toMove;\n this.right -= toMove;\n break;\n\n case \"+y\":\n this.top += toMove;\n this.bottom += toMove;\n break;\n\n case \"-y\":\n this.top -= toMove;\n this.bottom -= toMove;\n break;\n }\n }; // Check if this box overlaps another box, b2.\n\n\n BoxPosition.prototype.overlaps = function (b2) {\n return this.left < b2.right && this.right > b2.left && this.top < b2.bottom && this.bottom > b2.top;\n }; // Check if this box overlaps any other boxes in boxes.\n\n\n BoxPosition.prototype.overlapsAny = function (boxes) {\n for (var i = 0; i < boxes.length; i++) {\n if (this.overlaps(boxes[i])) {\n return true;\n }\n }\n\n return false;\n }; // Check if this box is within another box.\n\n\n BoxPosition.prototype.within = function (container) {\n return this.top >= container.top && this.bottom <= container.bottom && this.left >= container.left && this.right <= container.right;\n }; // Check if this box is entirely within the container or it is overlapping\n // on the edge opposite of the axis direction passed. For example, if \"+x\" is\n // passed and the box is overlapping on the left edge of the container, then\n // return true.\n\n\n BoxPosition.prototype.overlapsOppositeAxis = function (container, axis) {\n switch (axis) {\n case \"+x\":\n return this.left < container.left;\n\n case \"-x\":\n return this.right > container.right;\n\n case \"+y\":\n return this.top < container.top;\n\n case \"-y\":\n return this.bottom > container.bottom;\n }\n }; // Find the percentage of the area that this box is overlapping with another\n // box.\n\n\n BoxPosition.prototype.intersectPercentage = function (b2) {\n var x = Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)),\n y = Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)),\n intersectArea = x * y;\n return intersectArea / (this.height * this.width);\n }; // Convert the positions from this box to CSS compatible positions using\n // the reference container's positions. This has to be done because this\n // box's positions are in reference to the viewport origin, whereas, CSS\n // values are in referecne to their respective edges.\n\n\n BoxPosition.prototype.toCSSCompatValues = function (reference) {\n return {\n top: this.top - reference.top,\n bottom: reference.bottom - this.bottom,\n left: this.left - reference.left,\n right: reference.right - this.right,\n height: this.height,\n width: this.width\n };\n }; // Get an object that represents the box's position without anything extra.\n // Can pass a StyleBox, HTMLElement, or another BoxPositon.\n\n\n BoxPosition.getSimpleBoxPosition = function (obj) {\n var height = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0;\n var width = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0;\n var top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0;\n obj = obj.div ? obj.div.getBoundingClientRect() : obj.tagName ? obj.getBoundingClientRect() : obj;\n var ret = {\n left: obj.left,\n right: obj.right,\n top: obj.top || top,\n height: obj.height || height,\n bottom: obj.bottom || top + (obj.height || height),\n width: obj.width || width\n };\n return ret;\n }; // Move a StyleBox to its specified, or next best, position. The containerBox\n // is the box that contains the StyleBox, such as a div. boxPositions are\n // a list of other boxes that the styleBox can't overlap with.\n\n\n function moveBoxToLinePosition(window, styleBox, containerBox, boxPositions) {\n // Find the best position for a cue box, b, on the video. The axis parameter\n // is a list of axis, the order of which, it will move the box along. For example:\n // Passing [\"+x\", \"-x\"] will move the box first along the x axis in the positive\n // direction. If it doesn't find a good position for it there it will then move\n // it along the x axis in the negative direction.\n function findBestPosition(b, axis) {\n var bestPosition,\n specifiedPosition = new BoxPosition(b),\n percentage = 1; // Highest possible so the first thing we get is better.\n\n for (var i = 0; i < axis.length; i++) {\n while (b.overlapsOppositeAxis(containerBox, axis[i]) || b.within(containerBox) && b.overlapsAny(boxPositions)) {\n b.move(axis[i]);\n } // We found a spot where we aren't overlapping anything. This is our\n // best position.\n\n\n if (b.within(containerBox)) {\n return b;\n }\n\n var p = b.intersectPercentage(containerBox); // If we're outside the container box less then we were on our last try\n // then remember this position as the best position.\n\n if (percentage > p) {\n bestPosition = new BoxPosition(b);\n percentage = p;\n } // Reset the box position to the specified position.\n\n\n b = new BoxPosition(specifiedPosition);\n }\n\n return bestPosition || specifiedPosition;\n }\n\n var boxPosition = new BoxPosition(styleBox),\n cue = styleBox.cue,\n linePos = computeLinePos(cue),\n axis = []; // If we have a line number to align the cue to.\n\n if (cue.snapToLines) {\n var size;\n\n switch (cue.vertical) {\n case \"\":\n axis = [\"+y\", \"-y\"];\n size = \"height\";\n break;\n\n case \"rl\":\n axis = [\"+x\", \"-x\"];\n size = \"width\";\n break;\n\n case \"lr\":\n axis = [\"-x\", \"+x\"];\n size = \"width\";\n break;\n }\n\n var step = boxPosition.lineHeight,\n position = step * Math.round(linePos),\n maxPosition = containerBox[size] + step,\n initialAxis = axis[0]; // If the specified intial position is greater then the max position then\n // clamp the box to the amount of steps it would take for the box to\n // reach the max position.\n\n if (Math.abs(position) > maxPosition) {\n position = position < 0 ? -1 : 1;\n position *= Math.ceil(maxPosition / step) * step;\n } // If computed line position returns negative then line numbers are\n // relative to the bottom of the video instead of the top. Therefore, we\n // need to increase our initial position by the length or width of the\n // video, depending on the writing direction, and reverse our axis directions.\n\n\n if (linePos < 0) {\n position += cue.vertical === \"\" ? containerBox.height : containerBox.width;\n axis = axis.reverse();\n } // Move the box to the specified position. This may not be its best\n // position.\n\n\n boxPosition.move(initialAxis, position);\n } else {\n // If we have a percentage line value for the cue.\n var calculatedPercentage = boxPosition.lineHeight / containerBox.height * 100;\n\n switch (cue.lineAlign) {\n case \"middle\":\n linePos -= calculatedPercentage / 2;\n break;\n\n case \"end\":\n linePos -= calculatedPercentage;\n break;\n } // Apply initial line position to the cue box.\n\n\n switch (cue.vertical) {\n case \"\":\n styleBox.applyStyles({\n top: styleBox.formatStyle(linePos, \"%\")\n });\n break;\n\n case \"rl\":\n styleBox.applyStyles({\n left: styleBox.formatStyle(linePos, \"%\")\n });\n break;\n\n case \"lr\":\n styleBox.applyStyles({\n right: styleBox.formatStyle(linePos, \"%\")\n });\n break;\n }\n\n axis = [\"+y\", \"-x\", \"+x\", \"-y\"]; // Get the box position again after we've applied the specified positioning\n // to it.\n\n boxPosition = new BoxPosition(styleBox);\n }\n\n var bestPosition = findBestPosition(boxPosition, axis);\n styleBox.move(bestPosition.toCSSCompatValues(containerBox));\n }\n\n function WebVTT$1() {} // Nothing\n // Helper to allow strings to be decoded instead of the default binary utf8 data.\n\n\n WebVTT$1.StringDecoder = function () {\n return {\n decode: function decode(data) {\n if (!data) {\n return \"\";\n }\n\n if (typeof data !== \"string\") {\n throw new Error(\"Error - expected string data.\");\n }\n\n return decodeURIComponent(encodeURIComponent(data));\n }\n };\n };\n\n WebVTT$1.convertCueToDOMTree = function (window, cuetext) {\n if (!window || !cuetext) {\n return null;\n }\n\n return parseContent(window, cuetext);\n };\n\n var FONT_SIZE_PERCENT = 0.05;\n var FONT_STYLE = \"sans-serif\";\n var CUE_BACKGROUND_PADDING = \"1.5%\"; // Runs the processing model over the cues and regions passed to it.\n // @param overlay A block level element (usually a div) that the computed cues\n // and regions will be placed into.\n\n WebVTT$1.processCues = function (window, cues, overlay) {\n if (!window || !cues || !overlay) {\n return null;\n } // Remove all previous children.\n\n\n while (overlay.firstChild) {\n overlay.removeChild(overlay.firstChild);\n }\n\n var paddedOverlay = window.document.createElement(\"div\");\n paddedOverlay.style.position = \"absolute\";\n paddedOverlay.style.left = \"0\";\n paddedOverlay.style.right = \"0\";\n paddedOverlay.style.top = \"0\";\n paddedOverlay.style.bottom = \"0\";\n paddedOverlay.style.margin = CUE_BACKGROUND_PADDING;\n overlay.appendChild(paddedOverlay); // Determine if we need to compute the display states of the cues. This could\n // be the case if a cue's state has been changed since the last computation or\n // if it has not been computed yet.\n\n function shouldCompute(cues) {\n for (var i = 0; i < cues.length; i++) {\n if (cues[i].hasBeenReset || !cues[i].displayState) {\n return true;\n }\n }\n\n return false;\n } // We don't need to recompute the cues' display states. Just reuse them.\n\n\n if (!shouldCompute(cues)) {\n for (var i = 0; i < cues.length; i++) {\n paddedOverlay.appendChild(cues[i].displayState);\n }\n\n return;\n }\n\n var boxPositions = [],\n containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay),\n fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100;\n var styleOptions = {\n font: fontSize + \"px \" + FONT_STYLE\n };\n\n (function () {\n var styleBox, cue;\n\n for (var i = 0; i < cues.length; i++) {\n cue = cues[i]; // Compute the intial position and styles of the cue div.\n\n styleBox = new CueStyleBox(window, cue, styleOptions);\n paddedOverlay.appendChild(styleBox.div); // Move the cue div to it's correct line position.\n\n moveBoxToLinePosition(window, styleBox, containerBox, boxPositions); // Remember the computed div so that we don't have to recompute it later\n // if we don't have too.\n\n cue.displayState = styleBox.div;\n boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox));\n }\n })();\n };\n\n WebVTT$1.Parser = function (window, vttjs, decoder) {\n if (!decoder) {\n decoder = vttjs;\n vttjs = {};\n }\n\n if (!vttjs) {\n vttjs = {};\n }\n\n this.window = window;\n this.vttjs = vttjs;\n this.state = \"INITIAL\";\n this.buffer = \"\";\n this.decoder = decoder || new TextDecoder(\"utf8\");\n this.regionList = [];\n };\n\n WebVTT$1.Parser.prototype = {\n // If the error is a ParsingError then report it to the consumer if\n // possible. If it's not a ParsingError then throw it like normal.\n reportOrThrowError: function reportOrThrowError(e) {\n if (e instanceof ParsingError) {\n this.onparsingerror && this.onparsingerror(e);\n } else {\n throw e;\n }\n },\n parse: function parse(data) {\n var self = this; // If there is no data then we won't decode it, but will just try to parse\n // whatever is in buffer already. This may occur in circumstances, for\n // example when flush() is called.\n\n if (data) {\n // Try to decode the data that we received.\n self.buffer += self.decoder.decode(data, {\n stream: true\n });\n }\n\n function collectNextLine() {\n var buffer = self.buffer;\n var pos = 0;\n\n while (pos < buffer.length && buffer[pos] !== '\\r' && buffer[pos] !== '\\n') {\n ++pos;\n }\n\n var line = buffer.substr(0, pos); // Advance the buffer early in case we fail below.\n\n if (buffer[pos] === '\\r') {\n ++pos;\n }\n\n if (buffer[pos] === '\\n') {\n ++pos;\n }\n\n self.buffer = buffer.substr(pos);\n return line;\n } // 3.4 WebVTT region and WebVTT region settings syntax\n\n\n function parseRegion(input) {\n var settings = new Settings();\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"id\":\n settings.set(k, v);\n break;\n\n case \"width\":\n settings.percent(k, v);\n break;\n\n case \"lines\":\n settings.integer(k, v);\n break;\n\n case \"regionanchor\":\n case \"viewportanchor\":\n var xy = v.split(',');\n\n if (xy.length !== 2) {\n break;\n } // We have to make sure both x and y parse, so use a temporary\n // settings object here.\n\n\n var anchor = new Settings();\n anchor.percent(\"x\", xy[0]);\n anchor.percent(\"y\", xy[1]);\n\n if (!anchor.has(\"x\") || !anchor.has(\"y\")) {\n break;\n }\n\n settings.set(k + \"X\", anchor.get(\"x\"));\n settings.set(k + \"Y\", anchor.get(\"y\"));\n break;\n\n case \"scroll\":\n settings.alt(k, v, [\"up\"]);\n break;\n }\n }, /=/, /\\s/); // Create the region, using default values for any values that were not\n // specified.\n\n if (settings.has(\"id\")) {\n var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)();\n region.width = settings.get(\"width\", 100);\n region.lines = settings.get(\"lines\", 3);\n region.regionAnchorX = settings.get(\"regionanchorX\", 0);\n region.regionAnchorY = settings.get(\"regionanchorY\", 100);\n region.viewportAnchorX = settings.get(\"viewportanchorX\", 0);\n region.viewportAnchorY = settings.get(\"viewportanchorY\", 100);\n region.scroll = settings.get(\"scroll\", \"\"); // Register the region.\n\n self.onregion && self.onregion(region); // Remember the VTTRegion for later in case we parse any VTTCues that\n // reference it.\n\n self.regionList.push({\n id: settings.get(\"id\"),\n region: region\n });\n }\n } // draft-pantos-http-live-streaming-20\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-3.5\n // 3.5 WebVTT\n\n\n function parseTimestampMap(input) {\n var settings = new Settings();\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"MPEGT\":\n settings.integer(k + 'S', v);\n break;\n\n case \"LOCA\":\n settings.set(k + 'L', parseTimeStamp(v));\n break;\n }\n }, /[^\\d]:/, /,/);\n self.ontimestampmap && self.ontimestampmap({\n \"MPEGTS\": settings.get(\"MPEGTS\"),\n \"LOCAL\": settings.get(\"LOCAL\")\n });\n } // 3.2 WebVTT metadata header syntax\n\n\n function parseHeader(input) {\n if (input.match(/X-TIMESTAMP-MAP/)) {\n // This line contains HLS X-TIMESTAMP-MAP metadata\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"X-TIMESTAMP-MAP\":\n parseTimestampMap(v);\n break;\n }\n }, /=/);\n } else {\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"Region\":\n // 3.3 WebVTT region metadata header syntax\n parseRegion(v);\n break;\n }\n }, /:/);\n }\n } // 5.1 WebVTT file parsing.\n\n\n try {\n var line;\n\n if (self.state === \"INITIAL\") {\n // We can't start parsing until we have the first line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n line = collectNextLine();\n var m = line.match(/^WEBVTT([ \\t].*)?$/);\n\n if (!m || !m[0]) {\n throw new ParsingError(ParsingError.Errors.BadSignature);\n }\n\n self.state = \"HEADER\";\n }\n\n var alreadyCollectedLine = false;\n\n while (self.buffer) {\n // We can't parse a line until we have the full line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n if (!alreadyCollectedLine) {\n line = collectNextLine();\n } else {\n alreadyCollectedLine = false;\n }\n\n switch (self.state) {\n case \"HEADER\":\n // 13-18 - Allow a header (metadata) under the WEBVTT line.\n if (/:/.test(line)) {\n parseHeader(line);\n } else if (!line) {\n // An empty line terminates the header and starts the body (cues).\n self.state = \"ID\";\n }\n\n continue;\n\n case \"NOTE\":\n // Ignore NOTE blocks.\n if (!line) {\n self.state = \"ID\";\n }\n\n continue;\n\n case \"ID\":\n // Check for the start of NOTE blocks.\n if (/^NOTE($|[ \\t])/.test(line)) {\n self.state = \"NOTE\";\n break;\n } // 19-29 - Allow any number of line terminators, then initialize new cue values.\n\n\n if (!line) {\n continue;\n }\n\n self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, \"\");\n self.state = \"CUE\"; // 30-39 - Check if self line contains an optional identifier or timing data.\n\n if (line.indexOf(\"-->\") === -1) {\n self.cue.id = line;\n continue;\n }\n\n // Process line as start of a cue.\n\n /*falls through*/\n\n case \"CUE\":\n // 40 - Collect cue timings and settings.\n try {\n parseCue(line, self.cue, self.regionList);\n } catch (e) {\n self.reportOrThrowError(e); // In case of an error ignore rest of the cue.\n\n self.cue = null;\n self.state = \"BADCUE\";\n continue;\n }\n\n self.state = \"CUETEXT\";\n continue;\n\n case \"CUETEXT\":\n var hasSubstring = line.indexOf(\"-->\") !== -1; // 34 - If we have an empty line then report the cue.\n // 35 - If we have the special substring '-->' then report the cue,\n // but do not collect the line as we need to process the current\n // one as a new cue.\n\n if (!line || hasSubstring && (alreadyCollectedLine = true)) {\n // We are done parsing self cue.\n self.oncue && self.oncue(self.cue);\n self.cue = null;\n self.state = \"ID\";\n continue;\n }\n\n if (self.cue.text) {\n self.cue.text += \"\\n\";\n }\n\n self.cue.text += line;\n continue;\n\n case \"BADCUE\":\n // BADCUE\n // 54-62 - Collect and discard the remaining cue.\n if (!line) {\n self.state = \"ID\";\n }\n\n continue;\n }\n }\n } catch (e) {\n self.reportOrThrowError(e); // If we are currently parsing a cue, report what we have.\n\n if (self.state === \"CUETEXT\" && self.cue && self.oncue) {\n self.oncue(self.cue);\n }\n\n self.cue = null; // Enter BADWEBVTT state if header was not parsed correctly otherwise\n // another exception occurred so enter BADCUE state.\n\n self.state = self.state === \"INITIAL\" ? \"BADWEBVTT\" : \"BADCUE\";\n }\n\n return this;\n },\n flush: function flush() {\n var self = this;\n\n try {\n // Finish decoding the stream.\n self.buffer += self.decoder.decode(); // Synthesize the end of the current cue or region.\n\n if (self.cue || self.state === \"HEADER\") {\n self.buffer += \"\\n\\n\";\n self.parse();\n } // If we've flushed, parsed, and we're still on the INITIAL state then\n // that means we don't have enough of the stream to parse the first\n // line.\n\n\n if (self.state === \"INITIAL\") {\n throw new ParsingError(ParsingError.Errors.BadSignature);\n }\n } catch (e) {\n self.reportOrThrowError(e);\n }\n\n self.onflush && self.onflush();\n return this;\n }\n };\n var vtt = WebVTT$1;\n\n /**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n var autoKeyword = \"auto\";\n var directionSetting = {\n \"\": 1,\n \"lr\": 1,\n \"rl\": 1\n };\n var alignSetting = {\n \"start\": 1,\n \"middle\": 1,\n \"end\": 1,\n \"left\": 1,\n \"right\": 1\n };\n\n function findDirectionSetting(value) {\n if (typeof value !== \"string\") {\n return false;\n }\n\n var dir = directionSetting[value.toLowerCase()];\n return dir ? value.toLowerCase() : false;\n }\n\n function findAlignSetting(value) {\n if (typeof value !== \"string\") {\n return false;\n }\n\n var align = alignSetting[value.toLowerCase()];\n return align ? value.toLowerCase() : false;\n }\n\n function VTTCue(startTime, endTime, text) {\n /**\n * Shim implementation specific properties. These properties are not in\n * the spec.\n */\n // Lets us know when the VTTCue's data has changed in such a way that we need\n // to recompute its display state. This lets us compute its display state\n // lazily.\n this.hasBeenReset = false;\n /**\n * VTTCue and TextTrackCue properties\n * http://dev.w3.org/html5/webvtt/#vttcue-interface\n */\n\n var _id = \"\";\n var _pauseOnExit = false;\n var _startTime = startTime;\n var _endTime = endTime;\n var _text = text;\n var _region = null;\n var _vertical = \"\";\n var _snapToLines = true;\n var _line = \"auto\";\n var _lineAlign = \"start\";\n var _position = 50;\n var _positionAlign = \"middle\";\n var _size = 50;\n var _align = \"middle\";\n Object.defineProperties(this, {\n \"id\": {\n enumerable: true,\n get: function get() {\n return _id;\n },\n set: function set(value) {\n _id = \"\" + value;\n }\n },\n \"pauseOnExit\": {\n enumerable: true,\n get: function get() {\n return _pauseOnExit;\n },\n set: function set(value) {\n _pauseOnExit = !!value;\n }\n },\n \"startTime\": {\n enumerable: true,\n get: function get() {\n return _startTime;\n },\n set: function set(value) {\n if (typeof value !== \"number\") {\n throw new TypeError(\"Start time must be set to a number.\");\n }\n\n _startTime = value;\n this.hasBeenReset = true;\n }\n },\n \"endTime\": {\n enumerable: true,\n get: function get() {\n return _endTime;\n },\n set: function set(value) {\n if (typeof value !== \"number\") {\n throw new TypeError(\"End time must be set to a number.\");\n }\n\n _endTime = value;\n this.hasBeenReset = true;\n }\n },\n \"text\": {\n enumerable: true,\n get: function get() {\n return _text;\n },\n set: function set(value) {\n _text = \"\" + value;\n this.hasBeenReset = true;\n }\n },\n \"region\": {\n enumerable: true,\n get: function get() {\n return _region;\n },\n set: function set(value) {\n _region = value;\n this.hasBeenReset = true;\n }\n },\n \"vertical\": {\n enumerable: true,\n get: function get() {\n return _vertical;\n },\n set: function set(value) {\n var setting = findDirectionSetting(value); // Have to check for false because the setting an be an empty string.\n\n if (setting === false) {\n throw new SyntaxError(\"An invalid or illegal string was specified.\");\n }\n\n _vertical = setting;\n this.hasBeenReset = true;\n }\n },\n \"snapToLines\": {\n enumerable: true,\n get: function get() {\n return _snapToLines;\n },\n set: function set(value) {\n _snapToLines = !!value;\n this.hasBeenReset = true;\n }\n },\n \"line\": {\n enumerable: true,\n get: function get() {\n return _line;\n },\n set: function set(value) {\n if (typeof value !== \"number\" && value !== autoKeyword) {\n throw new SyntaxError(\"An invalid number or illegal string was specified.\");\n }\n\n _line = value;\n this.hasBeenReset = true;\n }\n },\n \"lineAlign\": {\n enumerable: true,\n get: function get() {\n return _lineAlign;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n\n if (!setting) {\n throw new SyntaxError(\"An invalid or illegal string was specified.\");\n }\n\n _lineAlign = setting;\n this.hasBeenReset = true;\n }\n },\n \"position\": {\n enumerable: true,\n get: function get() {\n return _position;\n },\n set: function set(value) {\n if (value < 0 || value > 100) {\n throw new Error(\"Position must be between 0 and 100.\");\n }\n\n _position = value;\n this.hasBeenReset = true;\n }\n },\n \"positionAlign\": {\n enumerable: true,\n get: function get() {\n return _positionAlign;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n\n if (!setting) {\n throw new SyntaxError(\"An invalid or illegal string was specified.\");\n }\n\n _positionAlign = setting;\n this.hasBeenReset = true;\n }\n },\n \"size\": {\n enumerable: true,\n get: function get() {\n return _size;\n },\n set: function set(value) {\n if (value < 0 || value > 100) {\n throw new Error(\"Size must be between 0 and 100.\");\n }\n\n _size = value;\n this.hasBeenReset = true;\n }\n },\n \"align\": {\n enumerable: true,\n get: function get() {\n return _align;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n\n if (!setting) {\n throw new SyntaxError(\"An invalid or illegal string was specified.\");\n }\n\n _align = setting;\n this.hasBeenReset = true;\n }\n }\n });\n /**\n * Other spec defined properties\n */\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state\n\n this.displayState = undefined;\n }\n /**\n * VTTCue methods\n */\n\n\n VTTCue.prototype.getCueAsHTML = function () {\n // Assume WebVTT.convertCueToDOMTree is on the global.\n return WebVTT.convertCueToDOMTree(window, this.text);\n };\n\n var vttcue = VTTCue;\n\n /**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n var scrollSetting = {\n \"\": true,\n \"up\": true\n };\n\n function findScrollSetting(value) {\n if (typeof value !== \"string\") {\n return false;\n }\n\n var scroll = scrollSetting[value.toLowerCase()];\n return scroll ? value.toLowerCase() : false;\n }\n\n function isValidPercentValue(value) {\n return typeof value === \"number\" && value >= 0 && value <= 100;\n } // VTTRegion shim http://dev.w3.org/html5/webvtt/#vttregion-interface\n\n\n function VTTRegion() {\n var _width = 100;\n var _lines = 3;\n var _regionAnchorX = 0;\n var _regionAnchorY = 100;\n var _viewportAnchorX = 0;\n var _viewportAnchorY = 100;\n var _scroll = \"\";\n Object.defineProperties(this, {\n \"width\": {\n enumerable: true,\n get: function get() {\n return _width;\n },\n set: function set(value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"Width must be between 0 and 100.\");\n }\n\n _width = value;\n }\n },\n \"lines\": {\n enumerable: true,\n get: function get() {\n return _lines;\n },\n set: function set(value) {\n if (typeof value !== \"number\") {\n throw new TypeError(\"Lines must be set to a number.\");\n }\n\n _lines = value;\n }\n },\n \"regionAnchorY\": {\n enumerable: true,\n get: function get() {\n return _regionAnchorY;\n },\n set: function set(value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"RegionAnchorX must be between 0 and 100.\");\n }\n\n _regionAnchorY = value;\n }\n },\n \"regionAnchorX\": {\n enumerable: true,\n get: function get() {\n return _regionAnchorX;\n },\n set: function set(value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"RegionAnchorY must be between 0 and 100.\");\n }\n\n _regionAnchorX = value;\n }\n },\n \"viewportAnchorY\": {\n enumerable: true,\n get: function get() {\n return _viewportAnchorY;\n },\n set: function set(value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"ViewportAnchorY must be between 0 and 100.\");\n }\n\n _viewportAnchorY = value;\n }\n },\n \"viewportAnchorX\": {\n enumerable: true,\n get: function get() {\n return _viewportAnchorX;\n },\n set: function set(value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"ViewportAnchorX must be between 0 and 100.\");\n }\n\n _viewportAnchorX = value;\n }\n },\n \"scroll\": {\n enumerable: true,\n get: function get() {\n return _scroll;\n },\n set: function set(value) {\n var setting = findScrollSetting(value); // Have to check for false as an empty string is a legal value.\n\n if (setting === false) {\n throw new SyntaxError(\"An invalid or illegal string was specified.\");\n }\n\n _scroll = setting;\n }\n }\n });\n }\n\n var vttregion = VTTRegion;\n\n var browserIndex = createCommonjsModule(function (module) {\n /**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // Default exports for Node. Export the extended versions of VTTCue and\n // VTTRegion in Node since we likely want the capability to convert back and\n // forth between JSON. If we don't then it's not that big of a deal since we're\n // off browser.\n var vttjs = module.exports = {\n WebVTT: vtt,\n VTTCue: vttcue,\n VTTRegion: vttregion\n };\n window$1.vttjs = vttjs;\n window$1.WebVTT = vttjs.WebVTT;\n var cueShim = vttjs.VTTCue;\n var regionShim = vttjs.VTTRegion;\n var nativeVTTCue = window$1.VTTCue;\n var nativeVTTRegion = window$1.VTTRegion;\n\n vttjs.shim = function () {\n window$1.VTTCue = cueShim;\n window$1.VTTRegion = regionShim;\n };\n\n vttjs.restore = function () {\n window$1.VTTCue = nativeVTTCue;\n window$1.VTTRegion = nativeVTTRegion;\n };\n\n if (!window$1.VTTCue) {\n vttjs.shim();\n }\n });\n var browserIndex_1 = browserIndex.WebVTT;\n var browserIndex_2 = browserIndex.VTTCue;\n var browserIndex_3 = browserIndex.VTTRegion;\n\n /**\n * An Object containing a structure like: `{src: 'url', type: 'mimetype'}` or string\n * that just contains the src url alone.\n * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};`\n * `var SourceString = 'http://example.com/some-video.mp4';`\n *\n * @typedef {Object|string} Tech~SourceObject\n *\n * @property {string} src\n * The url to the source\n *\n * @property {string} type\n * The mime type of the source\n */\n\n /**\n * A function used by {@link Tech} to create a new {@link TextTrack}.\n *\n * @private\n *\n * @param {Tech} self\n * An instance of the Tech class.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @param {Object} [options={}]\n * An object with additional text track options\n *\n * @return {TextTrack}\n * The text track that was created.\n */\n\n function createTrackHelper(self, kind, label, language, options) {\n if (options === void 0) {\n options = {};\n }\n\n var tracks = self.textTracks();\n options.kind = kind;\n\n if (label) {\n options.label = label;\n }\n\n if (language) {\n options.language = language;\n }\n\n options.tech = self;\n var track = new ALL.text.TrackClass(options);\n tracks.addTrack(track);\n return track;\n }\n /**\n * This is the base class for media playback technology controllers, such as\n * {@link Flash} and {@link HTML5}\n *\n * @extends Component\n */\n\n\n var Tech =\n /*#__PURE__*/\n function (_Component) {\n _inheritsLoose(Tech, _Component);\n\n /**\n * Create an instance of this Tech.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} ready\n * Callback function to call when the `HTML5` Tech is ready.\n */\n function Tech(options, ready) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n if (ready === void 0) {\n ready = function ready() {};\n }\n\n // we don't want the tech to report user activity automatically.\n // This is done manually in addControlsListeners\n options.reportTouchActivity = false;\n _this = _Component.call(this, null, options, ready) || this; // keep track of whether the current source has played at all to\n // implement a very limited played()\n\n _this.hasStarted_ = false;\n\n _this.on('playing', function () {\n this.hasStarted_ = true;\n });\n\n _this.on('loadstart', function () {\n this.hasStarted_ = false;\n });\n\n ALL.names.forEach(function (name) {\n var props = ALL[name];\n\n if (options && options[props.getterName]) {\n _this[props.privateName] = options[props.getterName];\n }\n }); // Manually track progress in cases where the browser/flash player doesn't report it.\n\n if (!_this.featuresProgressEvents) {\n _this.manualProgressOn();\n } // Manually track timeupdates in cases where the browser/flash player doesn't report it.\n\n\n if (!_this.featuresTimeupdateEvents) {\n _this.manualTimeUpdatesOn();\n }\n\n ['Text', 'Audio', 'Video'].forEach(function (track) {\n if (options[\"native\" + track + \"Tracks\"] === false) {\n _this[\"featuresNative\" + track + \"Tracks\"] = false;\n }\n });\n\n if (options.nativeCaptions === false || options.nativeTextTracks === false) {\n _this.featuresNativeTextTracks = false;\n } else if (options.nativeCaptions === true || options.nativeTextTracks === true) {\n _this.featuresNativeTextTracks = true;\n }\n\n if (!_this.featuresNativeTextTracks) {\n _this.emulateTextTracks();\n }\n\n _this.autoRemoteTextTracks_ = new ALL.text.ListClass();\n\n _this.initTrackListeners(); // Turn on component tap events only if not using native controls\n\n\n if (!options.nativeControlsForTouch) {\n _this.emitTapEvents();\n }\n\n if (_this.constructor) {\n _this.name_ = _this.constructor.name || 'Unknown Tech';\n }\n\n return _this;\n }\n /**\n * A special function to trigger source set in a way that will allow player\n * to re-trigger if the player or tech are not ready yet.\n *\n * @fires Tech#sourceset\n * @param {string} src The source string at the time of the source changing.\n */\n\n\n var _proto = Tech.prototype;\n\n _proto.triggerSourceset = function triggerSourceset(src) {\n var _this2 = this;\n\n if (!this.isReady_) {\n // on initial ready we have to trigger source set\n // 1ms after ready so that player can watch for it.\n this.one('ready', function () {\n return _this2.setTimeout(function () {\n return _this2.triggerSourceset(src);\n }, 1);\n });\n }\n /**\n * Fired when the source is set on the tech causing the media element\n * to reload.\n *\n * @see {@link Player#event:sourceset}\n * @event Tech#sourceset\n * @type {EventTarget~Event}\n */\n\n\n this.trigger({\n src: src,\n type: 'sourceset'\n });\n }\n /* Fallbacks for unsupported event types\n ================================================================================ */\n\n /**\n * Polyfill the `progress` event for browsers that don't support it natively.\n *\n * @see {@link Tech#trackProgress}\n */\n ;\n\n _proto.manualProgressOn = function manualProgressOn() {\n this.on('durationchange', this.onDurationChange);\n this.manualProgress = true; // Trigger progress watching when a source begins loading\n\n this.one('ready', this.trackProgress);\n }\n /**\n * Turn off the polyfill for `progress` events that was created in\n * {@link Tech#manualProgressOn}\n */\n ;\n\n _proto.manualProgressOff = function manualProgressOff() {\n this.manualProgress = false;\n this.stopTrackingProgress();\n this.off('durationchange', this.onDurationChange);\n }\n /**\n * This is used to trigger a `progress` event when the buffered percent changes. It\n * sets an interval function that will be called every 500 milliseconds to check if the\n * buffer end percent has changed.\n *\n * > This function is called by {@link Tech#manualProgressOn}\n *\n * @param {EventTarget~Event} event\n * The `ready` event that caused this to run.\n *\n * @listens Tech#ready\n * @fires Tech#progress\n */\n ;\n\n _proto.trackProgress = function trackProgress(event) {\n this.stopTrackingProgress();\n this.progressInterval = this.setInterval(bind(this, function () {\n // Don't trigger unless buffered amount is greater than last time\n var numBufferedPercent = this.bufferedPercent();\n\n if (this.bufferedPercent_ !== numBufferedPercent) {\n /**\n * See {@link Player#progress}\n *\n * @event Tech#progress\n * @type {EventTarget~Event}\n */\n this.trigger('progress');\n }\n\n this.bufferedPercent_ = numBufferedPercent;\n\n if (numBufferedPercent === 1) {\n this.stopTrackingProgress();\n }\n }), 500);\n }\n /**\n * Update our internal duration on a `durationchange` event by calling\n * {@link Tech#duration}.\n *\n * @param {EventTarget~Event} event\n * The `durationchange` event that caused this to run.\n *\n * @listens Tech#durationchange\n */\n ;\n\n _proto.onDurationChange = function onDurationChange(event) {\n this.duration_ = this.duration();\n }\n /**\n * Get and create a `TimeRange` object for buffering.\n *\n * @return {TimeRange}\n * The time range object that was created.\n */\n ;\n\n _proto.buffered = function buffered() {\n return createTimeRanges(0, 0);\n }\n /**\n * Get the percentage of the current video that is currently buffered.\n *\n * @return {number}\n * A number from 0 to 1 that represents the decimal percentage of the\n * video that is buffered.\n *\n */\n ;\n\n _proto.bufferedPercent = function bufferedPercent$$1() {\n return bufferedPercent(this.buffered(), this.duration_);\n }\n /**\n * Turn off the polyfill for `progress` events that was created in\n * {@link Tech#manualProgressOn}\n * Stop manually tracking progress events by clearing the interval that was set in\n * {@link Tech#trackProgress}.\n */\n ;\n\n _proto.stopTrackingProgress = function stopTrackingProgress() {\n this.clearInterval(this.progressInterval);\n }\n /**\n * Polyfill the `timeupdate` event for browsers that don't support it.\n *\n * @see {@link Tech#trackCurrentTime}\n */\n ;\n\n _proto.manualTimeUpdatesOn = function manualTimeUpdatesOn() {\n this.manualTimeUpdates = true;\n this.on('play', this.trackCurrentTime);\n this.on('pause', this.stopTrackingCurrentTime);\n }\n /**\n * Turn off the polyfill for `timeupdate` events that was created in\n * {@link Tech#manualTimeUpdatesOn}\n */\n ;\n\n _proto.manualTimeUpdatesOff = function manualTimeUpdatesOff() {\n this.manualTimeUpdates = false;\n this.stopTrackingCurrentTime();\n this.off('play', this.trackCurrentTime);\n this.off('pause', this.stopTrackingCurrentTime);\n }\n /**\n * Sets up an interval function to track current time and trigger `timeupdate` every\n * 250 milliseconds.\n *\n * @listens Tech#play\n * @triggers Tech#timeupdate\n */\n ;\n\n _proto.trackCurrentTime = function trackCurrentTime() {\n if (this.currentTimeInterval) {\n this.stopTrackingCurrentTime();\n }\n\n this.currentTimeInterval = this.setInterval(function () {\n /**\n * Triggered at an interval of 250ms to indicated that time is passing in the video.\n *\n * @event Tech#timeupdate\n * @type {EventTarget~Event}\n */\n this.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n }); // 42 = 24 fps // 250 is what Webkit uses // FF uses 15\n }, 250);\n }\n /**\n * Stop the interval function created in {@link Tech#trackCurrentTime} so that the\n * `timeupdate` event is no longer triggered.\n *\n * @listens {Tech#pause}\n */\n ;\n\n _proto.stopTrackingCurrentTime = function stopTrackingCurrentTime() {\n this.clearInterval(this.currentTimeInterval); // #1002 - if the video ends right before the next timeupdate would happen,\n // the progress bar won't make it all the way to the end\n\n this.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n });\n }\n /**\n * Turn off all event polyfills, clear the `Tech`s {@link AudioTrackList},\n * {@link VideoTrackList}, and {@link TextTrackList}, and dispose of this Tech.\n *\n * @fires Component#dispose\n */\n ;\n\n _proto.dispose = function dispose() {\n // clear out all tracks because we can't reuse them between techs\n this.clearTracks(NORMAL.names); // Turn off any manual progress or timeupdate tracking\n\n if (this.manualProgress) {\n this.manualProgressOff();\n }\n\n if (this.manualTimeUpdates) {\n this.manualTimeUpdatesOff();\n }\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Clear out a single `TrackList` or an array of `TrackLists` given their names.\n *\n * > Note: Techs without source handlers should call this between sources for `video`\n * & `audio` tracks. You don't want to use them between tracks!\n *\n * @param {string[]|string} types\n * TrackList names to clear, valid names are `video`, `audio`, and\n * `text`.\n */\n ;\n\n _proto.clearTracks = function clearTracks(types) {\n var _this3 = this;\n\n types = [].concat(types); // clear out all tracks because we can't reuse them between techs\n\n types.forEach(function (type) {\n var list = _this3[type + \"Tracks\"]() || [];\n var i = list.length;\n\n while (i--) {\n var track = list[i];\n\n if (type === 'text') {\n _this3.removeRemoteTextTrack(track);\n }\n\n list.removeTrack(track);\n }\n });\n }\n /**\n * Remove any TextTracks added via addRemoteTextTrack that are\n * flagged for automatic garbage collection\n */\n ;\n\n _proto.cleanupAutoTextTracks = function cleanupAutoTextTracks() {\n var list = this.autoRemoteTextTracks_ || [];\n var i = list.length;\n\n while (i--) {\n var track = list[i];\n this.removeRemoteTextTrack(track);\n }\n }\n /**\n * Reset the tech, which will removes all sources and reset the internal readyState.\n *\n * @abstract\n */\n ;\n\n _proto.reset = function reset() {}\n /**\n * Get or set an error on the Tech.\n *\n * @param {MediaError} [err]\n * Error to set on the Tech\n *\n * @return {MediaError|null}\n * The current error object on the tech, or null if there isn't one.\n */\n ;\n\n _proto.error = function error(err) {\n if (err !== undefined) {\n this.error_ = new MediaError(err);\n this.trigger('error');\n }\n\n return this.error_;\n }\n /**\n * Returns the `TimeRange`s that have been played through for the current source.\n *\n * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`.\n * It only checks whether the source has played at all or not.\n *\n * @return {TimeRange}\n * - A single time range if this video has played\n * - An empty set of ranges if not.\n */\n ;\n\n _proto.played = function played() {\n if (this.hasStarted_) {\n return createTimeRanges(0, 0);\n }\n\n return createTimeRanges();\n }\n /**\n * Causes a manual time update to occur if {@link Tech#manualTimeUpdatesOn} was\n * previously called.\n *\n * @fires Tech#timeupdate\n */\n ;\n\n _proto.setCurrentTime = function setCurrentTime() {\n // improve the accuracy of manual timeupdates\n if (this.manualTimeUpdates) {\n /**\n * A manual `timeupdate` event.\n *\n * @event Tech#timeupdate\n * @type {EventTarget~Event}\n */\n this.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n });\n }\n }\n /**\n * Turn on listeners for {@link VideoTrackList}, {@link {AudioTrackList}, and\n * {@link TextTrackList} events.\n *\n * This adds {@link EventTarget~EventListeners} for `addtrack`, and `removetrack`.\n *\n * @fires Tech#audiotrackchange\n * @fires Tech#videotrackchange\n * @fires Tech#texttrackchange\n */\n ;\n\n _proto.initTrackListeners = function initTrackListeners() {\n var _this4 = this;\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link AudioTrackList}\n *\n * @event Tech#audiotrackchange\n * @type {EventTarget~Event}\n */\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link VideoTrackList}\n *\n * @event Tech#videotrackchange\n * @type {EventTarget~Event}\n */\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link TextTrackList}\n *\n * @event Tech#texttrackchange\n * @type {EventTarget~Event}\n */\n NORMAL.names.forEach(function (name) {\n var props = NORMAL[name];\n\n var trackListChanges = function trackListChanges() {\n _this4.trigger(name + \"trackchange\");\n };\n\n var tracks = _this4[props.getterName]();\n\n tracks.addEventListener('removetrack', trackListChanges);\n tracks.addEventListener('addtrack', trackListChanges);\n\n _this4.on('dispose', function () {\n tracks.removeEventListener('removetrack', trackListChanges);\n tracks.removeEventListener('addtrack', trackListChanges);\n });\n });\n }\n /**\n * Emulate TextTracks using vtt.js if necessary\n *\n * @fires Tech#vttjsloaded\n * @fires Tech#vttjserror\n */\n ;\n\n _proto.addWebVttScript_ = function addWebVttScript_() {\n var _this5 = this;\n\n if (window$1.WebVTT) {\n return;\n } // Initially, Tech.el_ is a child of a dummy-div wait until the Component system\n // signals that the Tech is ready at which point Tech.el_ is part of the DOM\n // before inserting the WebVTT script\n\n\n if (document.body.contains(this.el())) {\n // load via require if available and vtt.js script location was not passed in\n // as an option. novtt builds will turn the above require call into an empty object\n // which will cause this if check to always fail.\n if (!this.options_['vtt.js'] && isPlain(browserIndex) && Object.keys(browserIndex).length > 0) {\n this.trigger('vttjsloaded');\n return;\n } // load vtt.js via the script location option or the cdn of no location was\n // passed in\n\n\n var script = document.createElement('script');\n script.src = this.options_['vtt.js'] || 'https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js';\n\n script.onload = function () {\n /**\n * Fired when vtt.js is loaded.\n *\n * @event Tech#vttjsloaded\n * @type {EventTarget~Event}\n */\n _this5.trigger('vttjsloaded');\n };\n\n script.onerror = function () {\n /**\n * Fired when vtt.js was not loaded due to an error\n *\n * @event Tech#vttjsloaded\n * @type {EventTarget~Event}\n */\n _this5.trigger('vttjserror');\n };\n\n this.on('dispose', function () {\n script.onload = null;\n script.onerror = null;\n }); // but have not loaded yet and we set it to true before the inject so that\n // we don't overwrite the injected window.WebVTT if it loads right away\n\n window$1.WebVTT = true;\n this.el().parentNode.appendChild(script);\n } else {\n this.ready(this.addWebVttScript_);\n }\n }\n /**\n * Emulate texttracks\n *\n */\n ;\n\n _proto.emulateTextTracks = function emulateTextTracks() {\n var _this6 = this;\n\n var tracks = this.textTracks();\n var remoteTracks = this.remoteTextTracks();\n\n var handleAddTrack = function handleAddTrack(e) {\n return tracks.addTrack(e.track);\n };\n\n var handleRemoveTrack = function handleRemoveTrack(e) {\n return tracks.removeTrack(e.track);\n };\n\n remoteTracks.on('addtrack', handleAddTrack);\n remoteTracks.on('removetrack', handleRemoveTrack);\n this.addWebVttScript_();\n\n var updateDisplay = function updateDisplay() {\n return _this6.trigger('texttrackchange');\n };\n\n var textTracksChanges = function textTracksChanges() {\n updateDisplay();\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i];\n track.removeEventListener('cuechange', updateDisplay);\n\n if (track.mode === 'showing') {\n track.addEventListener('cuechange', updateDisplay);\n }\n }\n };\n\n textTracksChanges();\n tracks.addEventListener('change', textTracksChanges);\n tracks.addEventListener('addtrack', textTracksChanges);\n tracks.addEventListener('removetrack', textTracksChanges);\n this.on('dispose', function () {\n remoteTracks.off('addtrack', handleAddTrack);\n remoteTracks.off('removetrack', handleRemoveTrack);\n tracks.removeEventListener('change', textTracksChanges);\n tracks.removeEventListener('addtrack', textTracksChanges);\n tracks.removeEventListener('removetrack', textTracksChanges);\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i];\n track.removeEventListener('cuechange', updateDisplay);\n }\n });\n }\n /**\n * Create and returns a remote {@link TextTrack} object.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @return {TextTrack}\n * The TextTrack that gets created.\n */\n ;\n\n _proto.addTextTrack = function addTextTrack(kind, label, language) {\n if (!kind) {\n throw new Error('TextTrack kind is required but was not provided');\n }\n\n return createTrackHelper(this, kind, label, language);\n }\n /**\n * Create an emulated TextTrack for use by addRemoteTextTrack\n *\n * This is intended to be overridden by classes that inherit from\n * Tech in order to create native or custom TextTracks.\n *\n * @param {Object} options\n * The object should contain the options to initialize the TextTrack with.\n *\n * @param {string} [options.kind]\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata).\n *\n * @param {string} [options.label].\n * Label to identify the text track\n *\n * @param {string} [options.language]\n * Two letter language abbreviation.\n *\n * @return {HTMLTrackElement}\n * The track element that gets created.\n */\n ;\n\n _proto.createRemoteTextTrack = function createRemoteTextTrack(options) {\n var track = mergeOptions(options, {\n tech: this\n });\n return new REMOTE.remoteTextEl.TrackClass(track);\n }\n /**\n * Creates a remote text track object and returns an html track element.\n *\n * > Note: This can be an emulated {@link HTMLTrackElement} or a native one.\n *\n * @param {Object} options\n * See {@link Tech#createRemoteTextTrack} for more detailed properties.\n *\n * @param {boolean} [manualCleanup=true]\n * - When false: the TextTrack will be automatically removed from the video\n * element whenever the source changes\n * - When True: The TextTrack will have to be cleaned up manually\n *\n * @return {HTMLTrackElement}\n * An Html Track Element.\n *\n * @deprecated The default functionality for this function will be equivalent\n * to \"manualCleanup=false\" in the future. The manualCleanup parameter will\n * also be removed.\n */\n ;\n\n _proto.addRemoteTextTrack = function addRemoteTextTrack(options, manualCleanup) {\n var _this7 = this;\n\n if (options === void 0) {\n options = {};\n }\n\n var htmlTrackElement = this.createRemoteTextTrack(options);\n\n if (manualCleanup !== true && manualCleanup !== false) {\n // deprecation warning\n log.warn('Calling addRemoteTextTrack without explicitly setting the \"manualCleanup\" parameter to `true` is deprecated and default to `false` in future version of video.js');\n manualCleanup = true;\n } // store HTMLTrackElement and TextTrack to remote list\n\n\n this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);\n this.remoteTextTracks().addTrack(htmlTrackElement.track);\n\n if (manualCleanup !== true) {\n // create the TextTrackList if it doesn't exist\n this.ready(function () {\n return _this7.autoRemoteTextTracks_.addTrack(htmlTrackElement.track);\n });\n }\n\n return htmlTrackElement;\n }\n /**\n * Remove a remote text track from the remote `TextTrackList`.\n *\n * @param {TextTrack} track\n * `TextTrack` to remove from the `TextTrackList`\n */\n ;\n\n _proto.removeRemoteTextTrack = function removeRemoteTextTrack(track) {\n var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track); // remove HTMLTrackElement and TextTrack from remote list\n\n this.remoteTextTrackEls().removeTrackElement_(trackElement);\n this.remoteTextTracks().removeTrack(track);\n this.autoRemoteTextTracks_.removeTrack(track);\n }\n /**\n * Gets available media playback quality metrics as specified by the W3C's Media\n * Playback Quality API.\n *\n * @see [Spec]{@link https://wicg.github.io/media-playback-quality}\n *\n * @return {Object}\n * An object with supported media playback quality metrics\n *\n * @abstract\n */\n ;\n\n _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {\n return {};\n }\n /**\n * A method to set a poster from a `Tech`.\n *\n * @abstract\n */\n ;\n\n _proto.setPoster = function setPoster() {}\n /**\n * A method to check for the presence of the 'playsinline'