/*! For license information please see video.cjs.js.LICENSE.txt */ "use strict";var window$1=require("global/window"),document=require("global/document"),_extends=require("@babel/runtime/helpers/extends"),keycode=require("keycode"),_assertThisInitialized=require("@babel/runtime/helpers/assertThisInitialized"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),safeParseTuple=require("safe-json-parse/tuple"),XHR=require("@videojs/xhr"),vtt=require("videojs-vtt.js"),_construct=require("@babel/runtime/helpers/construct"),_inherits=require("@babel/runtime/helpers/inherits"),_resolveUrl=require("@videojs/vhs-utils/cjs/resolve-url.js"),m3u8Parser=require("m3u8-parser"),codecs_js=require("@videojs/vhs-utils/cjs/codecs.js"),mediaTypes_js=require("@videojs/vhs-utils/cjs/media-types.js"),byteHelpers=require("@videojs/vhs-utils/cjs/byte-helpers"),mpdParser=require("mpd-parser"),parseSidx=require("mux.js/lib/tools/parse-sidx"),id3Helpers=require("@videojs/vhs-utils/cjs/id3-helpers"),containers=require("@videojs/vhs-utils/cjs/containers"),clock=require("mux.js/lib/utils/clock");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}for(var browserApi,window__default=_interopDefaultLegacy(window$1),document__default=_interopDefaultLegacy(document),_extends__default=_interopDefaultLegacy(_extends),keycode__default=_interopDefaultLegacy(keycode),_assertThisInitialized__default=_interopDefaultLegacy(_assertThisInitialized),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),safeParseTuple__default=_interopDefaultLegacy(safeParseTuple),XHR__default=_interopDefaultLegacy(XHR),vtt__default=_interopDefaultLegacy(vtt),_construct__default=_interopDefaultLegacy(_construct),_inherits__default=_interopDefaultLegacy(_inherits),_resolveUrl__default=_interopDefaultLegacy(_resolveUrl),parseSidx__default=_interopDefaultLegacy(parseSidx),version$5="7.20.2",hooks_={},hooks=function(e,t){return hooks_[e]=hooks_[e]||[],t&&(hooks_[e]=hooks_[e].concat(t)),hooks_[e]},hook=function(e,t){hooks(e,t)},removeHook=function(e,t){var i=hooks(e).indexOf(t);return!(i<=-1||(hooks_[e]=hooks_[e].slice(),hooks_[e].splice(i,1),0))},hookOnce=function(e,t){hooks(e,[].concat(t).map((function(t){return function i(){return removeHook(e,i),t.apply(void 0,arguments)}})))},FullscreenApi={prefixed:!0},apiMap=[["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"]],specApi=apiMap[0],i=0;i0?o:0)}if(window__default.default.console){var l=window__default.default.console[i];l||"debug"!==i||(l=window__default.default.console.info||window__default.default.console.log),l&&a&&s.test(i)&&l[Array.isArray(r)?"apply":"call"](window__default.default.console,r)}}};function createLogger$1(e){var t,i="info",n=function(){for(var e=arguments.length,n=new Array(e),r=0;r1?t-1:0),n=1;n=0)throw new Error("class has illegal whitespace characters")}function classRegExp(e){return new RegExp("(^|\\s)"+e+"($|\\s)")}function isReal(){return document__default.default===window__default.default.document}function isEl(e){return isObject(e)&&1===e.nodeType}function isInFrame(){try{return window__default.default.parent!==window__default.default.self}catch(e){return!0}}function createQuerier(e){return function(t,i){if(!isNonBlankString(t))return document__default.default[e](null);isNonBlankString(i)&&(i=document__default.default.querySelector(i));var n=isEl(i)?i:document__default.default;return n[e]&&n[e](t)}}function createEl(e,t,i,n){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={});var r=document__default.default.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(log$1.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+i+"."),r.setAttribute(e,i)):"textContent"===e?textContent(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),n&&appendContent(r,n),r}function textContent(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function prependTo(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function hasClass(e,t){return throwIfWhitespace(t),e.classList?e.classList.contains(t):classRegExp(t).test(e.className)}function addClass(e,t){return e.classList?e.classList.add(t):hasClass(e,t)||(e.className=(e.className+" "+t).trim()),e}function removeClass(e,t){return e?(e.classList?e.classList.remove(t):(throwIfWhitespace(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e):(log$1.warn("removeClass was called with an element that doesn't exist"),null)}function toggleClass(e,t,i){var n=hasClass(e,t);if("function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=!n),i!==n)return i?addClass(e,t):removeClass(e,t),e}function setAttributes(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null==n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function getAttributes(e){var t={};if(e&&e.attributes&&e.attributes.length>0)for(var i=e.attributes,n=i.length-1;n>=0;n--){var r=i[n].name,a=i[n].value;"boolean"!=typeof e[r]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+r+",")||(a=null!==a),t[r]=a}return t}function getAttribute(e,t){return e.getAttribute(t)}function setAttribute(e,t,i){e.setAttribute(t,i)}function removeAttribute(e,t){e.removeAttribute(t)}function blockTextSelection(){document__default.default.body.focus(),document__default.default.onselectstart=function(){return!1}}function unblockTextSelection(){document__default.default.onselectstart=function(){return!0}}function getBoundingClientRect(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((function(e){void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(computedStyle(e,"height"))),i.width||(i.width=parseFloat(computedStyle(e,"width"))),i}}function findPosition(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,i=e.offsetHeight,n=0,r=0;e.offsetParent&&e!==document__default.default[FullscreenApi.fullscreenElement];)n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:n,top:r,width:t,height:i}}function getPointerPosition(e,t){var i={x:0,y:0};if(IS_IOS)for(var n=e;n&&"html"!==n.nodeName.toLowerCase();){var r=computedStyle(n,"transform");if(/^matrix/.test(r)){var a=r.slice(7,-1).split(/,\s/).map(Number);i.x+=a[4],i.y+=a[5]}else if(/^matrix3d/.test(r)){var s=r.slice(9,-1).split(/,\s/).map(Number);i.x+=s[12],i.y+=s[13]}n=n.parentNode}var o={},l=findPosition(t.target),u=findPosition(e),d=u.width,c=u.height,h=t.offsetY-(u.top-l.top),p=t.offsetX-(u.left-l.left);return t.changedTouches&&(p=t.changedTouches[0].pageX-u.left,h=t.changedTouches[0].pageY+u.top,IS_IOS&&(p-=i.x,h-=i.y)),o.y=1-Math.max(0,Math.min(1,h/c)),o.x=Math.max(0,Math.min(1,p/d)),o}function isTextNode(e){return isObject(e)&&3===e.nodeType}function emptyEl(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function normalizeContent(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return"function"==typeof e&&(e=e()),isEl(e)||isTextNode(e)?e:"string"==typeof e&&/\S/.test(e)?document__default.default.createTextNode(e):void 0})).filter((function(e){return e}))}function appendContent(e,t){return normalizeContent(t).forEach((function(t){return e.appendChild(t)})),e}function insertContent(e,t){return appendContent(emptyEl(e),t)}function isSingleLeftClick(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}var videojs$1,$=createQuerier("querySelector"),$$=createQuerier("querySelectorAll"),Dom=Object.freeze({__proto__:null,isReal:isReal,isEl:isEl,isInFrame:isInFrame,createEl:createEl,textContent:textContent,prependTo:prependTo,hasClass:hasClass,addClass:addClass,removeClass:removeClass,toggleClass:toggleClass,setAttributes:setAttributes,getAttributes:getAttributes,getAttribute:getAttribute,setAttribute:setAttribute,removeAttribute:removeAttribute,blockTextSelection:blockTextSelection,unblockTextSelection:unblockTextSelection,getBoundingClientRect:getBoundingClientRect,findPosition:findPosition,getPointerPosition:getPointerPosition,isTextNode:isTextNode,emptyEl:emptyEl,normalizeContent:normalizeContent,appendContent:appendContent,insertContent:insertContent,isSingleLeftClick:isSingleLeftClick,$:$,$$:$$}),_windowLoaded=!1,autoSetup=function(){if(!1!==videojs$1.options.autoSetup){var e=Array.prototype.slice.call(document__default.default.getElementsByTagName("video")),t=Array.prototype.slice.call(document__default.default.getElementsByTagName("audio")),i=Array.prototype.slice.call(document__default.default.getElementsByTagName("video-js")),n=e.concat(t,i);if(n&&n.length>0)for(var r=0,a=n.length;r-1&&(r={passive:!0}),e.addEventListener(t,n.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function off(e,t,i){if(DomData.has(e)){var n=DomData.get(e);if(n.handlers){if(Array.isArray(t))return _handleMultipleEvents(off,e,t,i);var r=function(e,t){n.handlers[t]=[],_cleanUpEvents(e,t)};if(void 0!==t){var a=n.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s=t&&(e.apply(void 0,arguments),i=n)}},debounce=function(e,t,i,n){var r;void 0===n&&(n=window__default.default);var a=function(){var a=this,s=arguments,o=function(){r=null,o=null,i||e.apply(a,s)};!r&&i&&e.apply(a,s),n.clearTimeout(r),r=n.setTimeout(o,t)};return a.cancel=function(){n.clearTimeout(r),r=null},a},EventTarget$2=function(){};EventTarget$2.prototype.allowedEvents_={},EventTarget$2.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},on(this,e,t),this.addEventListener=i},EventTarget$2.prototype.addEventListener=EventTarget$2.prototype.on,EventTarget$2.prototype.off=function(e,t){off(this,e,t)},EventTarget$2.prototype.removeEventListener=EventTarget$2.prototype.off,EventTarget$2.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},one(this,e,t),this.addEventListener=i},EventTarget$2.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},any(this,e,t),this.addEventListener=i},EventTarget$2.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=fixEvent(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),trigger(this,e)},EventTarget$2.prototype.dispatchEvent=EventTarget$2.prototype.trigger,EventTarget$2.prototype.queueTrigger=function(e){var t=this;EVENT_MAP||(EVENT_MAP=new Map);var i=e.type||e,n=EVENT_MAP.get(this);n||(n=new Map,EVENT_MAP.set(this,n));var r=n.get(i);n.delete(i),window__default.default.clearTimeout(r);var a=window__default.default.setTimeout((function(){0===n.size&&(n=null,EVENT_MAP.delete(t)),t.trigger(e)}),0);n.set(i,a)};var objName=function(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e},isEvented=function(e){return e instanceof EventTarget$2||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"==typeof e[t]}))},addEventedCallback=function(e,t){isEvented(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))},isValidEventType=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},validateTarget=function(e,t,i){if(!e||!e.nodeName&&!isEvented(e))throw new Error("Invalid target for "+objName(t)+"#"+i+"; must be a DOM node or evented object.")},validateEventType=function(e,t,i){if(!isValidEventType(e))throw new Error("Invalid event type for "+objName(t)+"#"+i+"; must be a non-empty string or array.")},validateListener=function(e,t,i){if("function"!=typeof e)throw new Error("Invalid listener for "+objName(t)+"#"+i+"; must be a function.")},normalizeListenArgs=function(e,t,i){var n,r,a,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return s?(n=e.eventBusEl_,t.length>=3&&t.shift(),r=t[0],a=t[1]):(n=t[0],r=t[1],a=t[2]),validateTarget(n,e,i),validateEventType(r,e,i),validateListener(a,e,i),{isTargetingSelf:s,target:n,type:r,listener:a=bind(e,a)}},listen=function(e,t,i,n){validateTarget(e,e,t),e.nodeName?Events[t](e,i,n):e[t](i,n)},EventedMixin={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(e){return e?(this.options_=mergeOptions$3(this.options_,e),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(e,t,i){return createEl(e,t,i)},t.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],s=n&&n.split("-")[0],o=r&&r[s],l=i;return a&&a[e]?l=a[e]:o&&o[e]&&(l=o[e]),t&&(l=l.replace(/\{(\d+)\}/g,(function(e,i){var n=t[i-1],r=n;return void 0===n&&(r=e),r}))),l},t.handleLanguagechange=function(){},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(e){return this.childIndex_[e]},t.getChild=function(e){if(e)return this.childNameIndex_[e]},t.getDescendant=function(){for(var e=arguments.length,t=new Array(e),i=0;i=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[toTitleCase$1(e.name())]=null,this.childNameIndex_[toLowerCase(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},t.initChildren=function(){var t=this,i=this.options_.children;if(i){var n,r=this.options_,a=e.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((function(e){var n,r;return"string"==typeof e?r=i[n=e]||t.options_[n]||{}:(n=e.name,r=e),{name:n,opts:r}})).filter((function(t){var i=e.getComponent(t.opts.componentClass||toTitleCase$1(t.name));return i&&!a.isTech(i)})).forEach((function(e){var i=e.name,n=e.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=t.options_.playerOptions;var a=t.addChild(i,n);a&&(t[i]=a)}}))}},t.buildCSSClass=function(){return""},t.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout((function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)},t.$=function(e,t){return $(e,t||this.contentEl())},t.$$=function(e,t){return $$(e,t||this.contentEl())},t.hasClass=function(e){return hasClass(this.el_,e)},t.addClass=function(e){addClass(this.el_,e)},t.removeClass=function(e){removeClass(this.el_,e)},t.toggleClass=function(e,t){toggleClass(this.el_,e,t)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(e){return getAttribute(this.el_,e)},t.setAttribute=function(e,t){setAttribute(this.el_,e,t)},t.removeAttribute=function(e){removeAttribute(this.el_,e)},t.width=function(e,t){return this.dimension("width",e,t)},t.height=function(e,t){return this.dimension("height",e,t)},t.dimensions=function(e,t){this.width(e,!0),this.height(t)},t.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+toTitleCase$1(e)],10)},t.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=computedStyle(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+toTitleCase$1(e);t=this.el_[i]}return t},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(e){this.player_&&(keycode__default.default.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))},t.handleKeyPress=function(e){this.handleKeyDown(e)},t.emitTapEvents=function(){var e,t=0,i=null;this.on("touchstart",(function(n){1===n.touches.length&&(i={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=window__default.default.performance.now(),e=!0)})),this.on("touchmove",(function(t){if(t.touches.length>1)e=!1;else if(i){var n=t.touches[0].pageX-i.pageX,r=t.touches[0].pageY-i.pageY;Math.sqrt(n*n+r*r)>10&&(e=!1)}}));var n=function(){e=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(n){i=null,!0===e&&window__default.default.performance.now()-t<200&&(n.preventDefault(),this.trigger("tap"))}))},t.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=bind(this.player(),this.player().reportUserActivity);this.on("touchstart",(function(){t(),this.clearInterval(e),e=this.setInterval(t,250)}));var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},t.setTimeout=function(e,t){var i,n=this;return e=bind(this,e),this.clearTimersOnDispose_(),i=window__default.default.setTimeout((function(){n.setTimeoutIds_.has(i)&&n.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i},t.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window__default.default.clearTimeout(e)),e},t.setInterval=function(e,t){e=bind(this,e),this.clearTimersOnDispose_();var i=window__default.default.setInterval(e,t);return this.setIntervalIds_.add(i),i},t.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window__default.default.clearInterval(e)),e},t.requestAnimationFrame=function(e){var t,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=bind(this,e),t=window__default.default.requestAnimationFrame((function(){i.rafIds_.has(t)&&i.rafIds_.delete(t),e()})),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},t.requestNamedAnimationFrame=function(e,t){var i=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=bind(this,t);var n=this.requestAnimationFrame((function(){t(),i.namedRafs_.has(e)&&i.namedRafs_.delete(e)}));return this.namedRafs_.set(e,n),e}},t.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},t.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),window__default.default.cancelAnimationFrame(e)),e):this.clearTimeout(e)},t.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((function(t){var i=t[0],n=t[1];e[i].forEach((function(t,i){return e[n](i)}))})),e.clearingTimersOnDispose_=!1})))},e.registerComponent=function(t,i){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var n=e.getComponent("Tech"),r=n&&n.isTech(i),a=e===i||e.prototype.isPrototypeOf(i.prototype);if(r||!a)throw new Error('Illegal component, "'+t+'"; '+(r?"techs must be registered using Tech.registerTech()":"must be a Component subclass")+".");t=toTitleCase$1(t),e.components_||(e.components_={});var s=e.getComponent("Player");if("Player"===t&&s&&s.players){var o=s.players,l=Object.keys(o);if(o&&l.length>0&&l.map((function(e){return o[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=i,e.components_[toLowerCase(t)]=i,i},e.getComponent=function(t){if(t&&e.components_)return e.components_[t]},e}();function rangeCheck(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}function getRange(e,t,i,n){return rangeCheck(e,n,i.length-1),i[n][t]}function createTimeRangesObj(e){var t;return t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:getRange.bind(null,"start",0,e),end:getRange.bind(null,"end",1,e)},window__default.default.Symbol&&window__default.default.Symbol.iterator&&(t[window__default.default.Symbol.iterator]=function(){return(e||[]).values()}),t}function createTimeRanges(e,t){return Array.isArray(e)?createTimeRangesObj(e):void 0===e||void 0===t?createTimeRangesObj():createTimeRangesObj([[e,t]])}function bufferedPercent(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=createTimeRanges(0,0));for(var a=0;at&&(n=t),r+=n-i;return r/t}function MediaError(e){if(e instanceof MediaError)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:isObject(e)&&("number"==typeof e.code&&(this.code=e.code),assign(this,e)),this.message||(this.message=MediaError.defaultMessages[this.code]||"")}Component$1.prototype.supportsRaf_="function"==typeof window__default.default.requestAnimationFrame&&"function"==typeof window__default.default.cancelAnimationFrame,Component$1.registerComponent("Component",Component$1),MediaError.prototype.code=0,MediaError.prototype.message="",MediaError.prototype.status=null,MediaError.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],MediaError.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var errNum=0;errNum=0;n--)if(t[n].enabled){disableOthers$1(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&disableOthers$1(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,disableOthers$1(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(TrackList),disableOthers=function(e,t){for(var i=0;i=0;n--)if(t[n].selected){disableOthers(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(_assertThisInitialized__default.default(i),"selectedIndex",{get:function(){for(var e=0;e0&&(window__default.default.console&&window__default.default.console.groupCollapsed&&window__default.default.console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach((function(e){return log$1.error(e)})),window__default.default.console&&window__default.default.console.groupEnd&&window__default.default.console.groupEnd()),i.flush()},loadTrack=function(e,t){var i={uri:e},n=isCrossOrigin(e);n&&(i.cors=n);var r="use-credentials"===t.tech_.crossOrigin();r&&(i.withCredentials=r),XHR__default.default(i,bind(this,(function(e,i,n){if(e)return log$1.error(e,i);t.loaded_=!0,"function"!=typeof window__default.default.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(function(e){if("vttjserror"!==e.type)return parseCues(n,t);log$1.error("vttjs failed to load, stopping trying to process "+t.src)})):parseCues(n,t)})))},TextTrack=function(e){function t(t){var i;if(void 0===t&&(t={}),!t.tech)throw new Error("A tech was not provided.");var n=mergeOptions$3(t,{kind:TextTrackKind[t.kind]||"subtitles",language:t.language||t.srclang||""}),r=TextTrackMode[n.mode]||"disabled",a=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=e.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var s=new TextTrackCueList(i.cues_),o=new TextTrackCueList(i.activeCues_),l=!1;return i.timeupdateHandler=bind(_assertThisInitialized__default.default(i),(function(){this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1),this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)):this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))})),i.tech_.one("dispose",(function(){i.stopTracking()})),"disabled"!==r&&i.startTracking(),Object.defineProperties(_assertThisInitialized__default.default(i),{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){TextTrackMode[e]&&r!==e&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||loadTrack(this.src,this),this.stopTracking(),"disabled"!==r&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(l=!1,t.length!==this.activeCues_.length)l=!0;else for(var a=0;a0)return void this.trigger("vttjsloaded");var t=document__default.default.createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=function(){e.trigger("vttjsloaded")},t.onerror=function(){e.trigger("vttjserror")},this.on("dispose",(function(){t.onload=null,t.onerror=null})),window__default.default.WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)},i.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e=0;r--){var a=e[r];a[t]&&a[t](n,i)}}function clearCacheForPlayer(e){middlewareInstances[e.id()]=null}function getOrCreateFactory(e,t){var i=middlewareInstances[e.id()],n=null;if(null==i)return n=t(e),middlewareInstances[e.id()]=[[t,n]],n;for(var r=0;r0;!this.player_.tech(!0)||(IE_VERSION||IS_EDGE)&&t||this.player_.tech(!0).focus(),this.player_.paused()?silencePromise(this.player_.play()):this.player_.pause()}},t}(ClickableComponent);Component$1.registerComponent("PosterImage",PosterImage);var darkGray="#222",lightGray="#ccc",fontMap={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 constructColor(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function tryUpdateStyle(e,t,i){try{e.style[t]=i}catch(e){return}}var TextTrackDisplay=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var a=function(e){return r.updateDisplay(e)};return t.on("loadstart",(function(e){return r.toggleDisplay(e)})),t.on("texttrackchange",a),t.on("loadedmetadata",(function(e){return r.preselectTrack(e)})),t.ready(bind(_assertThisInitialized__default.default(r),(function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",a),t.on("playerresize",a),window__default.default.addEventListener("orientationchange",a),t.on("dispose",(function(){return window__default.default.removeEventListener("orientationchange",a)}));for(var e=this.options_.playerOptions.tracks||[],i=0;i0;return silencePromise(t),void(!this.player_.tech(!0)||(IE_VERSION||IS_EDGE)&&i||this.player_.tech(!0).focus())}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(r){var a=function(){return r.focus()};isPromise(t)?t.then(a,(function(){})):this.setTimeout(a,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(Button);BigPlayButton.prototype.controlText_="Play Video",Component$1.registerComponent("BigPlayButton",BigPlayButton);var CloseButton=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){keycode__default.default.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(Button);Component$1.registerComponent("CloseButton",CloseButton);var PlayToggle=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",(function(e){return n.handlePlay(e)})),n.on(t,"pause",(function(e){return n.handlePause(e)})),i.replay&&n.on(t,"ended",(function(e){return n.handleEnded(e)})),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?silencePromise(this.player_.play()):this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(function(e){return t.handleSeeked(e)}))},t}(Button);PlayToggle.prototype.controlText_="Play",Component$1.registerComponent("PlayToggle",PlayToggle);var defaultImplementation=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=i="-"),(r=r>0||s>0?r+":":"")+(n=((r||a>=10)&&n<10?"0"+n:n)+":")+(i<10?"0"+i:i)},implementation=defaultImplementation;function setFormatTime(e){implementation=e}function resetFormatTime(){implementation=defaultImplementation}function formatTime(e,t){return void 0===t&&(t=e),implementation(e,t)}var TimeDisplay=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["timeupdate","ended"],(function(e){return n.updateContent(e)})),n.updateTextNode_(),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control"}),n=createEl("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return i.appendChild(n),this.contentEl_=createEl("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},i.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},i.updateTextNode_=function(e){var t=this;void 0===e&&(e=0),e=formatTime(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(function(){if(t.contentEl_){var e=t.textNode_;e&&t.contentEl_.firstChild!==e&&(e=null,log$1.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),t.textNode_=document__default.default.createTextNode(t.formattedTime_),t.textNode_&&(e?t.contentEl_.replaceChild(t.textNode_,e):t.contentEl_.appendChild(t.textNode_))}})))},i.updateContent=function(e){},t}(Component$1);TimeDisplay.prototype.labelText_="Time",TimeDisplay.prototype.controlText_="Time",Component$1.registerComponent("TimeDisplay",TimeDisplay);var CurrentTimeDisplay=function(e){function t(){return e.apply(this,arguments)||this}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)},t}(TimeDisplay);CurrentTimeDisplay.prototype.labelText_="Current Time",CurrentTimeDisplay.prototype.controlText_="Current Time",Component$1.registerComponent("CurrentTimeDisplay",CurrentTimeDisplay);var DurationDisplay=function(e){function t(t,i){var n,r=function(e){return n.updateContent(e)};return(n=e.call(this,t,i)||this).on(t,"durationchange",r),n.on(t,"loadstart",r),n.on(t,"loadedmetadata",r),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(TimeDisplay);DurationDisplay.prototype.labelText_="Duration",DurationDisplay.prototype.controlText_="Duration",Component$1.registerComponent("DurationDisplay",DurationDisplay);var TimeDivider=function(e){function t(){return e.apply(this,arguments)||this}return _inheritsLoose__default.default(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=e.prototype.createEl.call(this,"div"),n=e.prototype.createEl.call(this,"span",{textContent:"/"});return i.appendChild(n),t.appendChild(i),t},t}(Component$1);Component$1.registerComponent("TimeDivider",TimeDivider);var RemainingTimeDisplay=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",(function(e){return n.updateContent(e)})),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return!1!==this.options_.displayNegative&&t.insertBefore(createEl("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},t}(TimeDisplay);RemainingTimeDisplay.prototype.labelText_="Remaining Time",RemainingTimeDisplay.prototype.controlText_="Remaining Time",Component$1.registerComponent("RemainingTimeDisplay",RemainingTimeDisplay);var LiveDisplay=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",(function(e){return n.updateShowing(e)})),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=createEl("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(createEl("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document__default.default.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(Component$1);Component$1.registerComponent("LiveDisplay",LiveDisplay);var SeekToLive=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&(n.updateLiveEdgeStatusHandler_=function(e){return n.updateLiveEdgeStatus(e)},n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatusHandler_)),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=createEl("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,e.prototype.dispose.call(this)},t}(Button);SeekToLive.prototype.controlText_="Seek to live, currently playing live",Component$1.registerComponent("SeekToLive",SeekToLive);var clamp=function(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))},Slider=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseDown_=function(e){return n.handleMouseDown(e)},n.handleMouseUp_=function(e){return n.handleMouseUp(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleMouseMove_=function(e){return n.handleMouseMove(e)},n.update_=function(e){return n.update(e)},n.bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=assign({tabIndex:0},i),n=assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||IS_CHROME||e.preventDefault(),blockTextSelection(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;unblockTextSelection(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.update()},i.update=function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",(function(){var i=e.vertical()?"height":"width";e.bar.el().style[i]=(100*t).toFixed(2)+"%"}))),t}},i.getProgress=function(){return Number(clamp(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var t=getPointerPosition(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){keycode__default.default.isEventKey(t,"Left")||keycode__default.default.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):keycode__default.default.isEventKey(t,"Right")||keycode__default.default.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(Component$1);Component$1.registerComponent("Slider",Slider);var percentify=function(e,t){return clamp(e/t*100,0,100).toFixed(2)+"%"},LoadProgressBar=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",(function(e){return n.update(e)})),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),i=createEl("span",{className:"vjs-control-text"}),n=createEl("span",{textContent:this.localize("Loaded")}),r=document__default.default.createTextNode(": ");return this.percentageEl_=createEl("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),t},i.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",(function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),a=t.partEls_,s=percentify(r,n);t.percent_!==s&&(t.el_.style.width=s,textContent(t.percentageEl_,s),t.percent_=s);for(var o=0;oi.length;c--)t.el_.removeChild(a[c-1]);a.length=i.length}))},t}(Component$1);Component$1.registerComponent("LoadProgressBar",LoadProgressBar);var TimeTooltip=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=throttle(bind(_assertThisInitialized__default.default(n),n.update),UPDATE_REFRESH_INTERVAL),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=findPosition(this.el_),r=getBoundingClientRect(this.player_.el()),a=e.width*t;if(r&&n){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right),l=n.width/2;sn.width&&(l=n.width),l=Math.round(l),this.el_.style.right="-"+l+"px",this.write(i)}},i.write=function(e){textContent(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",(function(){var a,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),l=o-t*o;a=(l<1?"":"-")+formatTime(l,o)}else a=formatTime(i,s);r.update(e,t,a),n&&n()}))},t}(Component$1);Component$1.registerComponent("TimeTooltip",TimeTooltip);var PlayProgressBar=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=throttle(bind(_assertThisInitialized__default.default(n),n.update),UPDATE_REFRESH_INTERVAL),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(Component$1);PlayProgressBar.prototype.options_={children:[]},IS_IOS||IS_ANDROID||PlayProgressBar.prototype.options_.children.push("timeTooltip"),Component$1.registerComponent("PlayProgressBar",PlayProgressBar);var MouseTimeDisplay=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=throttle(bind(_assertThisInitialized__default.default(n),n.update),UPDATE_REFRESH_INTERVAL),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,(function(){i.el_.style.left=e.width*t+"px"}))},t}(Component$1);MouseTimeDisplay.prototype.options_={children:["timeTooltip"]},Component$1.registerComponent("MouseTimeDisplay",MouseTimeDisplay);var STEP_SECONDS=5,PAGE_KEY_MULTIPLIER=12,SeekBar=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.setEventHandlers_=function(){var e=this;this.update_=bind(this,this.update),this.update=throttle(this.update_,UPDATE_REFRESH_INTERVAL),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document__default.default&&"visibilityState"in document__default.default&&this.on(document__default.default,"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(e){"hidden"===document__default.default.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,UPDATE_REFRESH_INTERVAL))},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(t){var i=this;if("hidden"!==document__default.default.visibilityState){var n=e.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",(function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,r=i.player_.duration();t&&t.isLive()&&(r=i.player_.liveTracker.liveCurrentTime()),i.percent_!==n&&(i.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),i.percent_=n),i.currentTime_===e&&i.duration_===r||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[formatTime(e,r),formatTime(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(getBoundingClientRect(i.el()),i.getProgress())})),n}},i.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},i.handleMouseDown=function(t){isSingleLeftClick(t)&&(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},i.handleMouseMove=function(e,t){if(void 0===t&&(t=!1),isSingleLeftClick(e)){var i;t||this.player_.scrubbing()||this.player_.scrubbing(!0);var n=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(n>=.99)return void r.seekToLiveEdge();var a=r.seekableStart(),s=r.liveCurrentTime();if((i=a+n*r.liveWindow())>=s&&(i=s),i<=a&&(i=a+.1),i===1/0)return}else(i=n*this.player_.duration())===this.player_.duration()&&(i-=.1);this.userSeek_(i)}},i.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?silencePromise(this.player_.play()):this.update_()},i.stepForward=function(){this.userSeek_(this.player_.currentTime()+STEP_SECONDS)},i.stepBack=function(){this.userSeek_(this.player_.currentTime()-STEP_SECONDS)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(t){var i=this.player_.liveTracker;if(keycode__default.default.isEventKey(t,"Space")||keycode__default.default.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(keycode__default.default.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if(keycode__default.default.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(keycode__default.default(t))){t.preventDefault(),t.stopPropagation();var n=10*(keycode__default.default.codes[keycode__default.default(t)]-keycode__default.default.codes[0])/100;i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else keycode__default.default.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-STEP_SECONDS*PAGE_KEY_MULTIPLIER)):keycode__default.default.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+STEP_SECONDS*PAGE_KEY_MULTIPLIER)):e.prototype.handleKeyDown.call(this,t)},i.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document__default.default&&"visibilityState"in document__default.default&&this.off(document__default.default,"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},t}(Slider);SeekBar.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},IS_IOS||IS_ANDROID||SeekBar.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Component$1.registerComponent("SeekBar",SeekBar);var ProgressControl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=throttle(bind(_assertThisInitialized__default.default(n),n.handleMouseMove),UPDATE_REFRESH_INTERVAL),n.throttledHandleMouseSeek=throttle(bind(_assertThisInitialized__default.default(n),n.handleMouseSeek),UPDATE_REFRESH_INTERVAL),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.handleMouseDownHandler_=function(e){return n.handleMouseDown(e)},n.enable(),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(i||n){var r=t.el(),a=findPosition(r),s=getPointerPosition(r,e).x;s=clamp(s,0,1),n&&n.update(a,s),i&&i.update(a,t.getProgress())}}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){if(this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&silencePromise(this.player_.play())}},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.removeListenersAddedOnMousedownAndTouchstart=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},t}(Component$1);ProgressControl.prototype.options_={children:["seekBar"]},Component$1.registerComponent("ProgressControl",ProgressControl);var PictureInPictureToggle=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["enterpictureinpicture","leavepictureinpicture"],(function(e){return n.handlePictureInPictureChange(e)})),n.on(t,["disablepictureinpicturechanged","loadedmetadata"],(function(e){return n.handlePictureInPictureEnabledChange(e)})),n.on(t,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(function(){"audio"===t.currentType().substring(0,5)||t.audioPosterMode()||t.audioOnlyMode()?(t.isInPictureInPicture()&&t.exitPictureInPicture(),n.hide()):n.show()})),n.disable(),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},i.handlePictureInPictureEnabledChange=function(){document__default.default.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}(Button);PictureInPictureToggle.prototype.controlText_="Picture-in-Picture",Component$1.registerComponent("PictureInPictureToggle",PictureInPictureToggle);var FullscreenToggle=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"fullscreenchange",(function(e){return n.handleFullscreenChange(e)})),!1===document__default.default[t.fsApi_.fullscreenEnabled]&&n.disable(),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(Button);FullscreenToggle.prototype.controlText_="Fullscreen",Component$1.registerComponent("FullscreenToggle",FullscreenToggle);var checkVolumeSupport=function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))},VolumeLevel=function(e){function t(){return e.apply(this,arguments)||this}return _inheritsLoose__default.default(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return t.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),t},t}(Component$1);Component$1.registerComponent("VolumeLevel",VolumeLevel);var VolumeLevelTooltip=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=throttle(bind(_assertThisInitialized__default.default(n),n.update),UPDATE_REFRESH_INTERVAL),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i,n){if(!i){var r=getBoundingClientRect(this.el_),a=getBoundingClientRect(this.player_.el()),s=e.width*t;if(!a||!r)return;var o=e.left-a.left+s,l=e.width-s+(a.right-e.right),u=r.width/2;or.width&&(u=r.width),this.el_.style.right="-"+u+"px"}this.write(n+"%")},i.write=function(e){textContent(this.el_,e)},i.updateVolume=function(e,t,i,n,r){var a=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(function(){a.update(e,t,i,n.toFixed(0)),r&&r()}))},t}(Component$1);Component$1.registerComponent("VolumeLevelTooltip",VolumeLevelTooltip);var MouseVolumeLevelDisplay=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=throttle(bind(_assertThisInitialized__default.default(n),n.update),UPDATE_REFRESH_INTERVAL),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t,i){var n=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,(function(){i?n.el_.style.bottom=e.height*t+"px":n.el_.style.left=e.width*t+"px"}))},t}(Component$1);MouseVolumeLevelDisplay.prototype.options_={children:["volumeLevelTooltip"]},Component$1.registerComponent("MouseVolumeLevelDisplay",MouseVolumeLevelDisplay);var VolumeBar=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",(function(e){return n.updateLastVolume_(e)})),n.on(t,"volumechange",(function(e){return n.updateARIAAttributes(e)})),t.ready((function(){return n.updateARIAAttributes()})),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){isSingleLeftClick(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){var t=this.getChild("mouseVolumeLevelDisplay");if(t){var i=this.el(),n=getBoundingClientRect(i),r=this.vertical(),a=getPointerPosition(i,e);a=r?a.y:a.x,a=clamp(a,0,1),t.update(n,a,r)}isSingleLeftClick(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",(function(){0===e.player_.volume()&&e.player_.lastVolume_(t)}))},t}(Slider);VolumeBar.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},IS_IOS||IS_ANDROID||VolumeBar.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),VolumeBar.prototype.playerEvent="volumechange",Component$1.registerComponent("VolumeBar",VolumeBar);var VolumeControl=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,(void 0===i.volumeBar||isPlain(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),n=e.call(this,t,i)||this,checkVolumeSupport(_assertThisInitialized__default.default(n),t),n.throttledHandleMouseMove=throttle(bind(_assertThisInitialized__default.default(n),n.handleMouseMove),UPDATE_REFRESH_INTERVAL),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n.on("touchstart",(function(e){return n.handleMouseDown(e)})),n.on("mousemove",(function(e){return n.handleMouseMove(e)})),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(Component$1);VolumeControl.prototype.options_={children:["volumeBar"]},Component$1.registerComponent("VolumeControl",VolumeControl);var checkMuteSupport=function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))},MuteToggle=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,checkMuteSupport(_assertThisInitialized__default.default(n),t),n.on(t,["loadstart","volumechange"],(function(e){return n.update(e)})),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;IS_IOS&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)removeClass(this.el_,"vjs-vol-"+i);addClass(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(Button);MuteToggle.prototype.controlText_="Mute",Component$1.registerComponent("MuteToggle",MuteToggle);var VolumePanel=function(e){function t(t,i){var n;return void 0===i&&(i={}),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||isPlain(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).handleKeyPressHandler_=function(e){return n.handleKeyPress(e)},n.on(t,["loadstart"],(function(e){return n.volumePanelState_(e)})),n.on(n.muteToggle,"keyup",(function(e){return n.handleKeyPress(e)})),n.on(n.volumeControl,"keyup",(function(e){return n.handleVolumeControlKeyUp(e)})),n.on("keydown",(function(e){return n.handleKeyPress(e)})),n.on("mouseover",(function(e){return n.handleMouseOver(e)})),n.on("mouseout",(function(e){return n.handleMouseOut(e)})),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},i.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},i.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){keycode__default.default.isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),on(document__default.default,"keyup",this.handleKeyPressHandler_)},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),off(document__default.default,"keyup",this.handleKeyPressHandler_)},i.handleKeyPress=function(e){keycode__default.default.isEventKey(e,"Esc")&&this.handleMouseOut()},t}(Component$1);VolumePanel.prototype.options_={children:["muteToggle","volumeControl"]},Component$1.registerComponent("VolumePanel",VolumePanel);var Menu=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",(function(e){return n.handleKeyDown(e)})),n.boundHandleBlur_=function(e){return n.handleBlur(e)},n.boundHandleTapClick_=function(e){return n.handleTapClick(e)},n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.addEventListenerForItem=function(e){e instanceof Component$1&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof Component$1&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},i.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},i.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=createEl(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),on(i,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),i},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},i.handleBlur=function(e){var t=e.relatedTarget||document__default.default.activeElement;if(!this.children().some((function(e){return e.el()===t}))){var i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}},i.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter((function(t){return t.el()===e.target}))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},i.handleKeyDown=function(e){keycode__default.default.isEventKey(e,"Left")||keycode__default.default.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(keycode__default.default.isEventKey(e,"Right")||keycode__default.default.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},i.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},i.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},t}(Component$1);Component$1.registerComponent("Menu",Menu);var MenuButton=function(e){function t(t,i){var n;void 0===i&&(i={}),(n=e.call(this,t,i)||this).menuButton_=new Button(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=Button.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0;var a=function(e){return n.handleClick(e)};return n.handleMenuKeyUp_=function(e){return n.handleMenuKeyUp(e)},n.on(n.menuButton_,"tap",a),n.on(n.menuButton_,"click",a),n.on(n.menuButton_,"keydown",(function(e){return n.handleKeyDown(e)})),n.on(n.menuButton_,"mouseenter",(function(){n.addClass("vjs-hover"),n.menu.show(),on(document__default.default,"keyup",n.handleMenuKeyUp_)})),n.on("mouseleave",(function(e){return n.handleMouseLeave(e)})),n.on("keydown",(function(e){return n.handleSubmenuKeyDown(e)})),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))},i.createMenu=function(){var e=new Menu(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=createEl("li",{className:"vjs-menu-title",textContent:toTitleCase$1(this.options_.title),tabIndex:-1}),i=new Component$1(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n-1&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n-1&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(TextTrackMenuItem);Component$1.registerComponent("OffTextTrackMenuItem",OffTextTrackMenuItem);var TextTrackButton=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return _inheritsLoose__default.default(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=TextTrackMenuItem),this.label_&&(i=this.label_+" off"),e.push(new OffTextTrackMenuItem(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r-1){var s=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+a.kind+"-menu-item"),e.push(s)}}return e},t}(TrackButton);Component$1.registerComponent("TextTrackButton",TextTrackButton);var ChaptersTrackMenuItem=function(e){function t(t,i){var n,r=i.track,a=i.cue,s=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=a.text,i.selected=a.startTime<=s&&s=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(toTitleCase$1(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i-1&&(n.label_="captions"),n.menuButton_.controlText(toTitleCase$1(n.label_)),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new CaptionSettingsMenuItem(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t,SubsCapsMenuItem)},t}(TextTrackButton);SubsCapsButton.prototype.kinds_=["captions","subtitles"],SubsCapsButton.prototype.controlText_="Subtitles",Component$1.registerComponent("SubsCapsButton",SubsCapsButton);var AudioTrackMenuItem=function(e){function t(t,i){var n,r=i.track,a=t.audioTracks();i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=new Array(e),i=0;i=0;i--)t.push(new PlaybackRateMenuItem(this.player(),{rate:e[i]+"x"}));return t},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){var t=this.player().playbackRate(),i=this.playbackRates(),n=(i.indexOf(t)+1)%i.length;this.player().playbackRate(i[n])},i.handlePlaybackRateschange=function(e){this.update()},i.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},t}(MenuButton);PlaybackRateMenuButton.prototype.controlText_="Playback Rate",Component$1.registerComponent("PlaybackRateMenuButton",PlaybackRateMenuButton);var Spacer=function(e){function t(){return e.apply(this,arguments)||this}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(t,i,n){return void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i.className||(i.className=this.buildCSSClass()),e.prototype.createEl.call(this,t,i,n)},t}(Component$1);Component$1.registerComponent("Spacer",Spacer);var CustomControlSpacer=function(e){function t(){return e.apply(this,arguments)||this}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:" "})},t}(Spacer);Component$1.registerComponent("CustomControlSpacer",CustomControlSpacer);var ControlBar=function(e){function t(){return e.apply(this,arguments)||this}return _inheritsLoose__default.default(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(Component$1);ControlBar.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in document__default.default&&ControlBar.prototype.options_.children.splice(ControlBar.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Component$1.registerComponent("ControlBar",ControlBar);var ErrorDisplay=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",(function(e){return n.open(e)})),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(ModalDialog);ErrorDisplay.prototype.options_=_extends__default.default({},ModalDialog.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Component$1.registerComponent("ErrorDisplay",ErrorDisplay);var LOCAL_STORAGE_KEY$1="vjs-text-track-settings",COLOR_BLACK=["#000","Black"],COLOR_BLUE=["#00F","Blue"],COLOR_CYAN=["#0FF","Cyan"],COLOR_GREEN=["#0F0","Green"],COLOR_MAGENTA=["#F0F","Magenta"],COLOR_RED=["#F00","Red"],COLOR_WHITE=["#FFF","White"],COLOR_YELLOW=["#FF0","Yellow"],OPACITY_OPAQUE=["1","Opaque"],OPACITY_SEMI=["0.5","Semi-Transparent"],OPACITY_TRANS=["0","Transparent"],selectConfigs={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[COLOR_BLACK,COLOR_WHITE,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[OPACITY_OPAQUE,OPACITY_SEMI,OPACITY_TRANS]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[COLOR_WHITE,COLOR_BLACK,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[OPACITY_OPAQUE,OPACITY_SEMI]},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:[OPACITY_TRANS,OPACITY_SEMI,OPACITY_OPAQUE]}};function parseOptionValue(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}function getSelectedOptionValue(e,t){return parseOptionValue(e.options[e.options.selectedIndex].value,t)}function setSelectedOption(e,t,i){if(t)for(var n=0;n',this.localize(r.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 createEl("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return createEl("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 createEl("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 e.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e=this;return reduce(selectConfigs,(function(t,i,n){var r=getSelectedOptionValue(e.$(i.selector),i.parser);return void 0!==r&&(t[n]=r),t}),{})},i.setValues=function(e){var t=this;each(selectConfigs,(function(i,n){setSelectedOption(t.$(i.selector),e[n],i.parser)}))},i.setDefaults=function(){var e=this;each(selectConfigs,(function(t){var i=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=i}))},i.restoreSettings=function(){var e;try{e=JSON.parse(window__default.default.localStorage.getItem(LOCAL_STORAGE_KEY$1))}catch(e){log$1.warn(e)}e&&this.setValues(e)},i.saveSettings=function(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window__default.default.localStorage.setItem(LOCAL_STORAGE_KEY$1,JSON.stringify(e)):window__default.default.localStorage.removeItem(LOCAL_STORAGE_KEY$1)}catch(e){log$1.warn(e)}}},i.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},i.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()},t}(ModalDialog);Component$1.registerComponent("TextTrackSettings",TextTrackSettings);var ResizeManager=function(e){function t(t,i){var n,r=i.ResizeObserver||window__default.default.ResizeObserver;null===i.ResizeObserver&&(r=!1);var a=mergeOptions$3({createEl:!r,reportTouchActivity:!1},i);return(n=e.call(this,t,a)||this).ResizeObserver=i.ResizeObserver||window__default.default.ResizeObserver,n.loadListener_=null,n.resizeObserver_=null,n.debouncedHandler_=debounce((function(){n.resizeHandler()}),100,!1,_assertThisInitialized__default.default(n)),r?(n.resizeObserver_=new n.ResizeObserver(n.debouncedHandler_),n.resizeObserver_.observe(t.el())):(n.loadListener_=function(){if(n.el_&&n.el_.contentWindow){var e=n.debouncedHandler_,t=n.unloadListener_=function(){off(this,"resize",e),off(this,"unload",t),t=null};on(n.el_.contentWindow,"unload",t),on(n.el_.contentWindow,"resize",e)}},n.one("load",n.loadListener_)),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})},i.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},i.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,e.prototype.dispose.call(this)},t}(Component$1);Component$1.registerComponent("ResizeManager",ResizeManager);var defaults={trackingThreshold:20,liveTolerance:15},LiveTracker=function(e){function t(t,i){var n,r=mergeOptions$3(defaults,i,{createEl:!1});return(n=e.call(this,t,r)||this).handleVisibilityChange_=function(e){return n.handleVisibilityChange(e)},n.trackLiveHandler_=function(){return n.trackLive_()},n.handlePlay_=function(e){return n.handlePlay(e)},n.handleFirstTimeupdate_=function(e){return n.handleFirstTimeupdate(e)},n.handleSeeked_=function(e){return n.handleSeeked(e)},n.seekToLiveEdge_=function(e){return n.seekToLiveEdge(e)},n.reset_(),n.on(n.player_,"durationchange",(function(e){return n.handleDurationchange(e)})),n.on(n.player_,"canplay",(function(){return n.toggleTracking()})),IE_VERSION&&"hidden"in document__default.default&&"visibilityState"in document__default.default&&n.on(document__default.default,"visibilitychange",n.handleVisibilityChange_),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.handleVisibilityChange=function(){this.player_.duration()===1/0&&(document__default.default.hidden?this.stopTracking():this.startTracking())},i.trackLive_=function(){var e=this.player_.seekable();if(e&&e.length){var t=Number(window__default.default.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;var n=this.liveCurrentTime(),r=this.player_.currentTime(),a=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-r)>this.options_.liveTolerance;this.timeupdateSeen_&&n!==1/0||(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}},i.handleDurationchange=function(){this.toggleTracking()},i.toggleTracking=function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},i.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,UPDATE_REFRESH_INTERVAL),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))},i.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},i.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},i.reset_=function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)},i.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},i.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},i.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return"number"==typeof this.trackingInterval_},i.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},i.dispose=function(){this.off(document__default.default,"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),e.prototype.dispose.call(this)},t}(Component$1);Component$1.registerComponent("LiveTracker",LiveTracker);var canPlayType,sourcesetLoad=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var a=0;a=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready((function(){r.forEach((function(e){this.trigger(e)}),this)}))}},i.setScrubbing=function(e){this.isScrubbing_=e},i.scrubbing=function(){return this.isScrubbing_},i.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&IS_ANY_SAFARI?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){log$1(e,"Video is not ready. (Video.js)")}},i.duration=function(){var e=this;return this.el_.duration===1/0&&IS_ANDROID&&IS_CHROME&&0===this.el_.currentTime?(this.on("timeupdate",(function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))})),NaN):this.el_.duration||NaN},i.width=function(){return this.el_.offsetWidth},i.height=function(){return this.el_.offsetHeight},i.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",(function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)}))}},i.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var e=window__default.default.navigator&&window__default.default.navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},i.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)silencePromise(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}),0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},i.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},i.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},i.requestVideoFrameCallback=function(t){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(t):e.prototype.requestVideoFrameCallback.call(this,t)},i.cancelVideoFrameCallback=function(t){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(t):e.prototype.cancelVideoFrameCallback.call(this,t)},i.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},i.reset=function(){t.resetMediaElement(this.el_)},i.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.setControls=function(e){this.el_.controls=!!e},i.addTextTrack=function(t,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,n):e.prototype.addTextTrack.call(this,t,i,n)},i.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return e.prototype.createRemoteTextTrack.call(this,t);var i=document__default.default.createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i},i.addRemoteTextTrack=function(t,i){var n=e.prototype.addRemoteTextTrack.call(this,t,i);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},i.removeRemoteTextTrack=function(t){if(e.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),n=i.length;n--;)t!==i[n]&&t!==i[n].track||this.el().removeChild(i[n])},i.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window__default.default.performance&&"function"==typeof window__default.default.performance.now?e.creationTime=window__default.default.performance.now():window__default.default.performance&&window__default.default.performance.timing&&"number"==typeof window__default.default.performance.timing.navigationStart&&(e.creationTime=window__default.default.Date.now()-window__default.default.performance.timing.navigationStart),e},t}(Tech);defineLazyProperty(Html5,"TEST_VID",(function(){if(isReal()){var e=document__default.default.createElement("video"),t=document__default.default.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}})),Html5.isSupported=function(){try{Html5.TEST_VID.volume=.5}catch(e){return!1}return!(!Html5.TEST_VID||!Html5.TEST_VID.canPlayType)},Html5.canPlayType=function(e){return Html5.TEST_VID.canPlayType(e)},Html5.canPlaySource=function(e,t){return Html5.canPlayType(e.type)},Html5.canControlVolume=function(){try{var e=Html5.TEST_VID.volume;Html5.TEST_VID.volume=e/2+.1;var t=e!==Html5.TEST_VID.volume;return t&&IS_IOS?(window__default.default.setTimeout((function(){Html5&&Html5.prototype&&(Html5.prototype.featuresVolumeControl=e!==Html5.TEST_VID.volume)})),!1):t}catch(e){return!1}},Html5.canMuteVolume=function(){try{var e=Html5.TEST_VID.muted;return Html5.TEST_VID.muted=!e,Html5.TEST_VID.muted?setAttribute(Html5.TEST_VID,"muted","muted"):removeAttribute(Html5.TEST_VID,"muted","muted"),e!==Html5.TEST_VID.muted}catch(e){return!1}},Html5.canControlPlaybackRate=function(){if(IS_ANDROID&&IS_CHROME&&CHROME_VERSION<58)return!1;try{var e=Html5.TEST_VID.playbackRate;return Html5.TEST_VID.playbackRate=e/2+.1,e!==Html5.TEST_VID.playbackRate}catch(e){return!1}},Html5.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(document__default.default.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document__default.default.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document__default.default.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document__default.default.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},Html5.supportsNativeTextTracks=function(){return IS_ANY_SAFARI||IS_IOS&&IS_CHROME},Html5.supportsNativeVideoTracks=function(){return!(!Html5.TEST_VID||!Html5.TEST_VID.videoTracks)},Html5.supportsNativeAudioTracks=function(){return!(!Html5.TEST_VID||!Html5.TEST_VID.audioTracks)},Html5.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function(e){var t=e[0],i=e[1];defineLazyProperty(Html5.prototype,t,(function(){return Html5[i]()}),!0)})),Html5.prototype.featuresVolumeControl=Html5.canControlVolume(),Html5.prototype.movingMediaElementInDOM=!IS_IOS,Html5.prototype.featuresFullscreenResize=!0,Html5.prototype.featuresProgressEvents=!0,Html5.prototype.featuresTimeupdateEvents=!0,Html5.prototype.featuresVideoFrameCallback=!(!Html5.TEST_VID||!Html5.TEST_VID.requestVideoFrameCallback),Html5.patchCanPlayType=function(){ANDROID_VERSION>=4&&!IS_FIREFOX&&!IS_CHROME&&(canPlayType=Html5.TEST_VID&&Html5.TEST_VID.constructor.prototype.canPlayType,Html5.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":canPlayType.call(this,e)})},Html5.unpatchCanPlayType=function(){var e=Html5.TEST_VID.constructor.prototype.canPlayType;return canPlayType&&(Html5.TEST_VID.constructor.prototype.canPlayType=canPlayType),e},Html5.patchCanPlayType(),Html5.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},Html5.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){Html5.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){Html5.prototype["set"+toTitleCase$1(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){Html5.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){Html5.prototype["set"+toTitleCase$1(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){Html5.prototype[e]=function(){return this.el_[e]()}})),Tech.withSourceHandlers(Html5),Html5.nativeSourceHandler={},Html5.nativeSourceHandler.canPlayType=function(e){try{return Html5.TEST_VID.canPlayType(e)}catch(e){return""}},Html5.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Html5.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=getFileExtension(e.src);return Html5.nativeSourceHandler.canPlayType("video/"+i)}return""},Html5.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Html5.nativeSourceHandler.dispose=function(){},Html5.registerSourceHandler(Html5.nativeSourceHandler),Tech.registerTech("Html5",Html5);var TECH_EVENTS_RETRIGGER=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],TECH_EVENTS_QUEUE={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},BREAKPOINT_ORDER=["tiny","xsmall","small","medium","large","xlarge","huge"],BREAKPOINT_CLASSES={};BREAKPOINT_ORDER.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;BREAKPOINT_CLASSES[e]="vjs-layout-"+t}));var DEFAULT_BREAKPOINTS={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},Player=function(e){function t(i,n,r){var a;if(i.id=i.id||n.id||"vjs_video_"+newGUID(),(n=assign(t.getTagSettings(i),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language)if("function"==typeof i.closest){var s=i.closest("[lang]");s&&s.getAttribute&&(n.language=s.getAttribute("lang"))}else for(var o=i;o&&1===o.nodeType;){if(getAttributes(o).hasOwnProperty("lang")){n.language=o.getAttribute("lang");break}o=o.parentNode}if((a=e.call(this,null,n,r)||this).boundDocumentFullscreenChange_=function(e){return a.documentFullscreenChange_(e)},a.boundFullWindowOnEscKey_=function(e){return a.fullWindowOnEscKey(e)},a.boundUpdateStyleEl_=function(e){return a.updateStyleEl_(e)},a.boundApplyInitTime_=function(e){return a.applyInitTime_(e)},a.boundUpdateCurrentBreakpoint_=function(e){return a.updateCurrentBreakpoint_(e)},a.boundHandleTechClick_=function(e){return a.handleTechClick_(e)},a.boundHandleTechDoubleClick_=function(e){return a.handleTechDoubleClick_(e)},a.boundHandleTechTouchStart_=function(e){return a.handleTechTouchStart_(e)},a.boundHandleTechTouchMove_=function(e){return a.handleTechTouchMove_(e)},a.boundHandleTechTouchEnd_=function(e){return a.handleTechTouchEnd_(e)},a.boundHandleTechTap_=function(e){return a.handleTechTap_(e)},a.isFullscreen_=!1,a.log=createLogger(a.id_),a.fsApi_=FullscreenApi,a.isPosterFromTech_=!1,a.queuedCallbacks_=[],a.isReady_=!1,a.hasStarted_=!1,a.userActive_=!1,a.debugEnabled_=!1,a.audioOnlyMode_=!1,a.audioPosterMode_=!1,a.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!a.options_||!a.options_.techOrder||!a.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(a.tag=i,a.tagAttributes=i&&getAttributes(i),a.language(a.options_.language),n.languages){var l={};Object.getOwnPropertyNames(n.languages).forEach((function(e){l[e.toLowerCase()]=n.languages[e]})),a.languages_=l}else a.languages_=t.prototype.options_.languages;a.resetCache_(),a.poster_=n.poster||"",a.controls_=!!n.controls,i.controls=!1,i.removeAttribute("controls"),a.changingSrc_=!1,a.playCallbacks_=[],a.playTerminatedQueue_=[],i.hasAttribute("autoplay")?a.autoplay(!0):a.autoplay(a.options_.autoplay),n.plugins&&Object.keys(n.plugins).forEach((function(e){if("function"!=typeof a[e])throw new Error('plugin "'+e+'" does not exist')})),a.scrubbing_=!1,a.el_=a.createEl(),evented(_assertThisInitialized__default.default(a),{eventBusKey:"el_"}),a.fsApi_.requestFullscreen&&(on(document__default.default,a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_),a.on(a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_)),a.fluid_&&a.on(["playerreset","resize"],a.boundUpdateStyleEl_);var u=mergeOptions$3(a.options_);n.plugins&&Object.keys(n.plugins).forEach((function(e){a[e](n.plugins[e])})),n.debug&&a.debug(!0),a.options_.playerOptions=u,a.middleware_=[],a.playbackRates(n.playbackRates),a.initChildren(),a.isAudio("audio"===i.nodeName.toLowerCase()),a.controls()?a.addClass("vjs-controls-enabled"):a.addClass("vjs-controls-disabled"),a.el_.setAttribute("role","region"),a.isAudio()?a.el_.setAttribute("aria-label",a.localize("Audio Player")):a.el_.setAttribute("aria-label",a.localize("Video Player")),a.isAudio()&&a.addClass("vjs-audio"),a.flexNotSupported_()&&a.addClass("vjs-no-flex"),TOUCH_ENABLED&&a.addClass("vjs-touch-enabled"),IS_IOS||a.addClass("vjs-workinghover"),t.players[a.id_]=_assertThisInitialized__default.default(a);var d=version$5.split(".")[0];return a.addClass("vjs-v"+d),a.userActive(!0),a.reportUserActivity(),a.one("play",(function(e){return a.listenForUserActivity_(e)})),a.on("stageclick",(function(e){return a.handleStageClick_(e)})),a.on("keydown",(function(e){return a.handleKeyDown(e)})),a.on("languagechange",(function(e){return a.handleLanguagechange(e)})),a.breakpoints(a.options_.breakpoints),a.responsive(a.options_.responsive),a.on("ready",(function(){a.audioPosterMode(a.options_.audioPosterMode),a.audioOnlyMode(a.options_.audioOnlyMode)})),a}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.dispose=function(){var i=this;this.trigger("dispose"),this.off("dispose"),off(document__default.default,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),off(document__default.default,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),t.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),clearCacheForPlayer(this),ALL.names.forEach((function(e){var t=ALL[e],n=i[t.getterName]();n&&n.off&&n.off()})),e.prototype.dispose.call(this,{restoreEl:this.options_.restoreEl})},i.createEl=function(){var t,i=this.tag,n=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),r="video-js"===this.tag.tagName.toLowerCase();n?t=this.el_=i.parentNode:r||(t=this.el_=e.prototype.createEl.call(this,"div"));var a=getAttributes(i);if(r){for(t=this.el_=i,i=this.tag=document__default.default.createElement("video");t.children.length;)i.appendChild(t.firstChild);hasClass(t,"video-js")||addClass(t,"video-js"),t.appendChild(i),n=this.playerElIngest_=t,Object.keys(t).forEach((function(e){try{i[e]=t[e]}catch(e){}}))}if(i.setAttribute("tabindex","-1"),a.tabindex="-1",(IE_VERSION||IS_CHROME&&IS_WINDOWS)&&(i.setAttribute("role","application"),a.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in a&&delete a.width,"height"in a&&delete a.height,Object.getOwnPropertyNames(a).forEach((function(e){r&&"class"===e||t.setAttribute(e,a[e]),r&&i.setAttribute(e,a[e])})),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=t.player=this,this.addClass("vjs-paused"),!0!==window__default.default.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=createStyleElement("vjs-styles-dimensions");var s=$(".vjs-styles-defaults"),o=$("head");o.insertBefore(this.styleEl_,s?s.nextSibling:o.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);for(var l=i.getElementsByTagName("a"),u=0;u0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=n[1]/n[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),setTextContent(this.styleEl_,"\n ."+i+" {\n width: "+e+"px;\n height: "+t+"px;\n }\n\n ."+i+".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: "+100*r+"%;\n }\n ")}else{var a="number"==typeof this.width_?this.width_:this.options_.width,s="number"==typeof this.height_?this.height_:this.options_.height,o=this.tech_&&this.tech_.el();o&&(a>=0&&(o.width=a),s>=0&&(o.height=s))}},i.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=toTitleCase$1(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Tech.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(a=!1);var s={source:t,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset,Promise:this.options_.Promise};ALL.names.forEach((function(e){var t=ALL[e];s[t.getterName]=i[t.privateName]})),assign(s,this.options_[n]),assign(s,this.options_[r]),assign(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var o=Tech.getTech(e);if(!o)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new o(s),this.tech_.ready(bind(this,this.handleTechReady_),!0),textTrackConverter.jsonToTextTracks(this.textTracksJson_||[],this.tech_),TECH_EVENTS_RETRIGGER.forEach((function(e){i.on(i.tech_,e,(function(t){return i["handleTech"+toTitleCase$1(e)+"_"](t)}))})),Object.keys(TECH_EVENTS_QUEUE).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+TECH_EVENTS_QUEUE[e]+"_"].bind(i),event:t}):i["handleTech"+TECH_EVENTS_QUEUE[e]+"_"](t)}))})),this.on(this.tech_,"loadstart",(function(e){return i.handleTechLoadStart_(e)})),this.on(this.tech_,"sourceset",(function(e){return i.handleTechSourceset_(e)})),this.on(this.tech_,"waiting",(function(e){return i.handleTechWaiting_(e)})),this.on(this.tech_,"ended",(function(e){return i.handleTechEnded_(e)})),this.on(this.tech_,"seeking",(function(e){return i.handleTechSeeking_(e)})),this.on(this.tech_,"play",(function(e){return i.handleTechPlay_(e)})),this.on(this.tech_,"firstplay",(function(e){return i.handleTechFirstPlay_(e)})),this.on(this.tech_,"pause",(function(e){return i.handleTechPause_(e)})),this.on(this.tech_,"durationchange",(function(e){return i.handleTechDurationChange_(e)})),this.on(this.tech_,"fullscreenchange",(function(e,t){return i.handleTechFullscreenChange_(e,t)})),this.on(this.tech_,"fullscreenerror",(function(e,t){return i.handleTechFullscreenError_(e,t)})),this.on(this.tech_,"enterpictureinpicture",(function(e){return i.handleTechEnterPictureInPicture_(e)})),this.on(this.tech_,"leavepictureinpicture",(function(e){return i.handleTechLeavePictureInPicture_(e)})),this.on(this.tech_,"error",(function(e){return i.handleTechError_(e)})),this.on(this.tech_,"posterchange",(function(e){return i.handleTechPosterChange_(e)})),this.on(this.tech_,"textdata",(function(e){return i.handleTechTextData_(e)})),this.on(this.tech_,"ratechange",(function(e){return i.handleTechRateChange_(e)})),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||prependTo(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},i.unloadTech_=function(){var e=this;ALL.names.forEach((function(t){var i=ALL[t];e[i.privateName]=e[i.getterName]()})),this.textTracksJson_=textTrackConverter.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},i.tech=function(e){return void 0===e&&log$1.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},i.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)},i.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)},i.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},i.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())},i.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var i,n=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var n=t.play();if(isPromise(n))return n.catch((function(e){throw i(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))}))};if("any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():n():isPromise(i=this.play())&&(i=i.catch(n)),isPromise(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(){t.trigger({type:"autoplay-failure",autoplay:e})}))}},i.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=findMimetype(this,t)),this.cache_.source=mergeOptions$3({},e,{src:t,type:i});for(var n=this.cache_.sources.filter((function(e){return e.src&&e.src===t})),r=[],a=this.$$("source"),s=[],o=0;o0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((function(e){return e.callback(e.event)})),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},i.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",(function i(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))}))},i.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},i.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},i.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},i.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},i.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},i.handleTechFirstPlay_=function(){this.options_.starttime&&(log$1.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},i.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},i.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},i.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},i.handleTechClick_=function(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?silencePromise(this.play()):this.pause()))},i.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(function(t){return t.contains(e.target)}))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},i.handleTechTap_=function(){this.userActive(!this.userActive())},i.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},i.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},i.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},i.handleStageClick_=function(){this.reportUserActivity()},i.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},i.documentFullscreenChange_=function(e){var t=e.target.player;if(!t||t===this){var i=this.el(),n=document__default.default[this.fsApi_.fullscreenElement]===i;!n&&i.matches?n=i.matches(":"+this.fsApi_.fullscreen):!n&&i.msMatchesSelector&&(n=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}},i.handleTechFullscreenChange_=function(e,t){var i=this;t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",(function(){i.removeClass("vjs-ios-native-fs")}))),this.isFullscreen(t.isFullscreen))},i.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},i.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},i.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},i.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},i.handleTechError_=function(){var e=this.tech_.error();this.error(e)},i.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},i.getCache=function(){return this.cache_},i.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}},i.techCall_=function(e,t){this.ready((function(){if(e in allowedSetters)return set(this.middleware_,this.tech_,e,t);if(e in allowedMediators)return mediate(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw log$1(e),e}}),!0)},i.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in allowedGetters)return get(this.middleware_,this.tech_,e);if(e in allowedMediators)return mediate(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw log$1("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw log$1("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw log$1(t),t}}},i.play=function(){var e=this,t=this.options_.Promise||window__default.default.Promise;return t?new t((function(t){e.play_(t)})):this.play_()},i.play_=function(e){var t=this;void 0===e&&(e=silencePromise),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!IS_ANY_SAFARI&&!IS_IOS||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},i.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},i.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},i.pause=function(){this.techCall_("pause")},i.paused=function(){return!1!==this.techGet_("paused")},i.played=function(){return this.techGet_("played")||createTimeRanges(0,0)},i.scrubbing=function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},i.currentTime=function(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},i.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},i.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},i.remainingTime=function(){return this.duration()-this.currentTime()},i.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},i.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=createTimeRanges(0,0)),e},i.bufferedPercent=function(){return bufferedPercent(this.buffered(),this.duration())},i.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},i.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},i.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},i.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},i.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},i.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},i.isFullscreen=function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_},i.requestFullscreen=function(e){var t=this.options_.Promise||window__default.default.Promise;if(t){var i=this;return new t((function(t,n){function r(){i.off("fullscreenerror",s),i.off("fullscreenchange",a)}function a(){r(),t()}function s(e,t){r(),n(t)}i.one("fullscreenchange",a),i.one("fullscreenerror",s);var o=i.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(t,n))}))}return this.requestFullscreenHelper_()},i.requestFullscreenHelper_=function(e){var t,i=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then((function(){return i.isFullscreen(!0)}),(function(){return i.isFullscreen(!1)})),n}this.tech_.supportsFullScreen()&&1==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},i.exitFullscreen=function(){var e=this.options_.Promise||window__default.default.Promise;if(e){var t=this;return new e((function(e,i){function n(){t.off("fullscreenerror",a),t.off("fullscreenchange",r)}function r(){n(),e()}function a(e,t){n(),i(t)}t.one("fullscreenchange",r),t.one("fullscreenerror",a);var s=t.exitFullscreenHelper_();s&&(s.then(n,n),s.then(e,i))}))}return this.exitFullscreenHelper_()},i.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=document__default.default[this.fsApi_.exitFullscreen]();return t&&silencePromise(t.then((function(){return e.isFullscreen(!1)}))),t}this.tech_.supportsFullScreen()&&1==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},i.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document__default.default.documentElement.style.overflow,on(document__default.default,"keydown",this.boundFullWindowOnEscKey_),document__default.default.documentElement.style.overflow="hidden",addClass(document__default.default.body,"vjs-full-window"),this.trigger("enterFullWindow")},i.fullWindowOnEscKey=function(e){keycode__default.default.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},i.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,off(document__default.default,"keydown",this.boundFullWindowOnEscKey_),document__default.default.documentElement.style.overflow=this.docOrigOverflow,removeClass(document__default.default.body,"vjs-full-window"),this.trigger("exitFullWindow")},i.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},i.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},i.requestPictureInPicture=function(){if("pictureInPictureEnabled"in document__default.default&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},i.exitPictureInPicture=function(){if("pictureInPictureEnabled"in document__default.default)return document__default.default.exitPictureInPicture()},i.handleKeyDown=function(e){var t,i,n=this.options_.userActions;n&&n.hotkeys&&(t=this.el_.ownerDocument.activeElement,i=t.tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof n.hotkeys?n.hotkeys.call(this,e):this.handleHotkeys(e)))},i.handleHotkeys=function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},i=t.fullscreenKey,n=void 0===i?function(e){return keycode__default.default.isEventKey(e,"f")}:i,r=t.muteKey,a=void 0===r?function(e){return keycode__default.default.isEventKey(e,"m")}:r,s=t.playPauseKey,o=void 0===s?function(e){return keycode__default.default.isEventKey(e,"k")||keycode__default.default.isEventKey(e,"Space")}:s;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();var l=Component$1.getComponent("FullscreenToggle");!1!==document__default.default[this.fsApi_.fullscreenEnabled]&&l.prototype.handleClick.call(this,e)}else a.call(this,e)?(e.preventDefault(),e.stopPropagation(),Component$1.getComponent("MuteToggle").prototype.handleClick.call(this,e)):o.call(this,e)&&(e.preventDefault(),e.stopPropagation(),Component$1.getComponent("PlayToggle").prototype.handleClick.call(this,e))},i.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i1?i.handleSrc_(n.slice(1)):(i.changingSrc_=!1,i.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0),void i.triggerReady());setTech(r,i.tech_)})),this.options_.retryOnError&&n.length>1){var r=function(){i.error(null),i.handleSrc_(n.slice(1),!0)},a=function(){i.off("error",r)};this.one("error",r),this.one("playing",a),this.resetRetryOnError_=function(){i.off("error",r),i.off("playing",a)}}}else this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)},i.src=function(e){return this.handleSrc_(e,!1)},i.src_=function(e){var t=this,i=this.selectSource([e]);return!i||(titleCaseEquals(i.tech,this.techName_)?(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1):(this.changingSrc_=!0,this.loadTech_(i.tech,i.source),this.tech_.ready((function(){t.changingSrc_=!1})),!1))},i.load=function(){this.techCall_("load")},i.reset=function(){var e=this,t=this.options_.Promise||window__default.default.Promise;this.paused()||!t?this.doReset_():silencePromise(this.play().then((function(){return e.doReset_()})))},i.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),isEvented(this)&&this.trigger("playerreset")},i.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},i.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar||{},t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},i.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},i.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},i.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},i.currentSource=function(){return this.cache_.source||{}},i.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},i.currentType=function(){return this.currentSource()&&this.currentSource().type||""},i.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},i.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},i.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},i.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},i.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},i.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},i.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},i.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},i.error=function(e){var t=this;if(void 0===e)return this.error_||null;if(hooks("beforeerror").forEach((function(i){var n=i(t,e);isObject(n)&&!Array.isArray(n)||"string"==typeof n||"number"==typeof n||null===n?e=n:t.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){var i=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),void this.one("loadstart",(function(){this.off(["click","touchstart"],i)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new MediaError(e),this.addClass("vjs-error"),log$1.error("(CODE:"+this.error_.code+" "+MediaError.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),hooks("error").forEach((function(e){return e(t,t.error_)}))},i.reportUserActivity=function(e){this.userActivity_=!0},i.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},i.listenForUserActivity_=function(){var e,t,i,n=bind(this,this.reportUserActivity),r=function(t){n(),this.clearInterval(e)};this.on("mousedown",(function(){n(),this.clearInterval(e),e=this.setInterval(n,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())})),this.on("mouseup",r),this.on("mouseleave",r);var a,s=this.getChild("controlBar");!s||IS_IOS||IS_ANDROID||(s.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),s.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",n),this.on("keyup",n),this.setInterval((function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var e=this.options_.inactivityTimeout;e<=0||(a=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}}),250)},i.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},i.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},i.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},i.enableAudioOnlyUI_=function(){var e=this;this.addClass("vjs-audio-only-mode");var t=this.children(),i=this.getChild("ControlBar"),n=i&&i.currentHeight();t.forEach((function(t){t!==i&&t.el_&&!t.hasClass("vjs-hidden")&&(t.hide(),e.audioOnlyCache_.hiddenChildren.push(t))})),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(n),this.trigger("audioonlymodechange")},i.disableAudioOnlyUI_=function(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach((function(e){return e.show()})),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")},i.audioOnlyMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;this.audioOnlyMode_=e;var i=this.options_.Promise||window__default.default.Promise;if(i){if(e){var n=[];return this.isInPictureInPicture()&&n.push(this.exitPictureInPicture()),this.isFullscreen()&&n.push(this.exitFullscreen()),this.audioPosterMode()&&n.push(this.audioPosterMode(!1)),i.all(n).then((function(){return t.enableAudioOnlyUI_()}))}return i.resolve().then((function(){return t.disableAudioOnlyUI_()}))}e?(this.isInPictureInPicture()&&this.exitPictureInPicture(),this.isFullscreen()&&this.exitFullscreen(),this.enableAudioOnlyUI_()):this.disableAudioOnlyUI_()},i.enablePosterModeUI_=function(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.disablePosterModeUI_=function(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.audioPosterMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;this.audioPosterMode_=e;var i=this.options_.Promise||window__default.default.Promise;return i?e?this.audioOnlyMode()?this.audioOnlyMode(!1).then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.disablePosterModeUI_()})):e?(this.audioOnlyMode()&&this.audioOnlyMode(!1),void this.enablePosterModeUI_()):void this.disablePosterModeUI_()},i.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},i.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},i.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},i.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},i.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},i.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},i.language=function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),isEvented(this)&&this.trigger("languagechange"))},i.languages=function(){return mergeOptions$3(t.prototype.options_.languages,this.languages_)},i.toJSON=function(){var e=mergeOptions$3(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i"):function(){}},TIME_FUDGE_FACTOR=1/30,SAFE_TIME_DELTA=3*TIME_FUDGE_FACTOR,filterRanges=function(e,t){var i,n=[];if(e&&e.length)for(i=0;i=t}))},findNextRange=function(e,t){return filterRanges(e,(function(e){return e-TIME_FUDGE_FACTOR>=t}))},findGaps=function(e){if(e.length<2)return videojs.createTimeRanges();for(var t=[],i=1;i "+e.end(i));return t.join(", ")},timeUntilRebuffer=function(e,t,i){return void 0===i&&(i=1),((e.length?e.end(e.length-1):0)-t)/i},timeRangesToArray=function(e){for(var t=[],i=0;ia||(i+=t>r&&t<=a?a-t:a-r)}return i},createTimeRange=videojs.createTimeRange,segmentDurationWithParts=function(e,t){if(!t.preload)return t.duration;var i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},getPartsAndSegments=function(e){return(e.segments||[]).reduce((function(e,t,i){return t.parts?t.parts.forEach((function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e}),[])},getLastParts=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},getKnownPartCount=function(e){var t=e.preloadSegment;if(t){var i=t.parts;return(t.preloadHints||[]).reduce((function(e,t){return e+("PART"===t.type?1:0)}),0)+(i&&i.length?i.length:0)}},liveEdgeDelay=function(e,t){if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;var i=getLastParts(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},backwardDuration=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(void 0!==(r=e.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=segmentDurationWithParts(e,r),void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},forwardDuration=function(e,t){for(var i,n=0,r=t-e.mediaSequence;rr){var s=[r,n];n=s[0],r=s[1]}if(n<0){for(var o=n;o0)for(var h=u-1;h>=0;h--){var p=l[h];if(o+=p.duration,s){if(o<0)continue}else if(o+TIME_FUDGE_FACTOR<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-sumDurations({defaultDuration:t.targetDuration,durationList:l,startIndex:u,endIndex:h})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:i}}if(u<0){for(var f=u;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:i};u=0}for(var m=u;m0)continue}else if(o-TIME_FUDGE_FACTOR>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+sumDurations({defaultDuration:t.targetDuration,durationList:l,startIndex:u,endIndex:m})}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:i}},isBlacklisted=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},isIncompatible=function(e){return e.excludeUntil&&e.excludeUntil===1/0},isEnabled=function(e){var t=isBlacklisted(e);return!e.disabled&&!t},isDisabled=function(e){return e.disabled},isAes=function(e){for(var t=0;t-1&&s!==a.length-1&&(i._HLS_part=s),(s>-1||a.length)&&r--}i._HLS_msn=r}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){var o=new window__default.default.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&o.searchParams.set(e,i[e])})),e=o.toString()}return e},updateSegment=function(e,t){if(!e)return t;var i=mergeOptions$2(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(var n=0;n=500?4:2},this.trigger("error")},i.parseManifest_=function(e){var t=this,i=e.url,n=e.manifestString;return parseManifest({onwarn:function(e){var n=e.message;return t.logger_("m3u8-parser warn for "+i+": "+n)},oninfo:function(e){var n=e.message;return t.logger_("m3u8-parser info for "+i+": "+n)},manifestString:n,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},i.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url,r=e.id;this.request=null,this.state="HAVE_METADATA";var a=i||this.parseManifest_({url:n,manifestString:t});a.lastRequest=Date.now(),setupMediaPlaylist({playlist:a,uri:n,id:r});var s=updateMaster$1(this.master,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,s?(this.master=s,this.media_=this.master.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(refreshDelay(this.media(),!!s)),this.trigger("loadedplaylist")},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),window__default.default.clearTimeout(this.mediaUpdateTimeout),window__default.default.clearTimeout(this.finalRenditionTimeout),this.off()},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e,t){var i=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(window__default.default.clearTimeout(this.finalRenditionTimeout),t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=window__default.default.setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state,a=!this.media_||e.id!==this.media_.id,s=this.master.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(a&&(this.trigger("mediachanging"),"HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(refreshDelay(e,!0)),a){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){if(e.lastRequest=Date.now(),e.resolvedUri=resolveManifestRedirect(i.handleManifestRedirects,e.resolvedUri,n),t)return i.playlistRequestError(i.request,e,r);i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}},i.pause=function(){this.mediaUpdateTimeout&&(window__default.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},i.load=function(e){var t=this;this.mediaUpdateTimeout&&(window__default.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var i=this.media();if(e){var n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=window__default.default.setTimeout((function(){t.mediaUpdateTimeout=null,t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},i.updateMediaUpdateTimeout_=function(e){var t=this;this.mediaUpdateTimeout&&(window__default.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window__default.default.setTimeout((function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)}),e))},i.start=function(){var e=this;if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=window__default.default.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((function(){e.setupInitialPlaylist(e.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.src=resolveManifestRedirect(e.handleManifestRedirects,e.src,i);var n=e.parseManifest_({manifestString:i.responseText,url:e.src});e.setupInitialPlaylist(n)}}))},i.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri},i.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,addPropertiesToMaster(this.master,this.srcUri()),e.playlists.forEach((function(e){e.segments=getAllSegments(e),e.segments.forEach((function(t){resolveSegmentUris(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t=this.srcUri()||window__default.default.location.href;this.master=masterForMedia(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(EventTarget$1),videojsXHR=videojs.xhr,mergeOptions$1=videojs.mergeOptions,callbackWrapper=function(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),n(t,e)},xhrFactory=function(){var e=function e(t,i){t=mergeOptions$1({timeout:45e3},t);var n=e.beforeRequest||videojs.Vhs.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var a=(!0===videojs.Vhs.xhr.original?videojsXHR:videojs.Vhs.xhr)(t,(function(e,t){return callbackWrapper(a,e,t,i)})),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=t.uri,a.requestTime=Date.now(),a};return e.original=!0,e},byterangeStr=function(e){return"bytes="+e.offset+"-"+("bigint"==typeof e.offset||"bigint"==typeof e.length?window__default.default.BigInt(e.offset)+window__default.default.BigInt(e.length)-window__default.default.BigInt(1):e.offset+e.length-1)},segmentXhrHeaders=function(e){var t={};return e.byterange&&(t.Range=byterangeStr(e.byterange)),t},textRange=function(e,t){return e.start(t)+"-"+e.end(t)},formatHexString=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},formatAsciiString=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},createTransferableMessage=function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];byteHelpers.isArrayBufferView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},initSegmentId=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},segmentKeyId=function(e){return e.resolvedUri},hexDump=function(e){for(var t=Array.prototype.slice.call(e),i=16,n="",r=0;rnew Date(s.getTime()+1e3*o)?null:(i>s&&(n=a),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Playlist.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})},findSegmentForPlayerTime=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i,n=0,r=0;rn){if(e>n+a.duration*SEGMENT_END_FUDGE_PERCENT)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},getOffsetFromTimestamp=function(e,t){var i,n;try{i=new Date(e),n=new Date(t)}catch(e){}var r=i.getTime();return(n.getTime()-r)/1e3},verifyProgramDateTimeTags=function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t=d+u)return s(t,{response:o.subarray(u,u+d),status:i.status,uri:i.uri});n.request=n.vhs_.xhr({uri:a,responseType:"arraybuffer",headers:segmentXhrHeaders({byterange:e.sidx.byterange})},s)}))}else this.mediaRequest_=window__default.default.setTimeout((function(){return i(!1)}),0)},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window__default.default.clearTimeout(this.minimumUpdatePeriodTimeout_),window__default.default.clearTimeout(this.mediaRequest_),window__default.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},i.hasPendingRequest=function(){return this.request||this.mediaRequest_},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=this.state;if("string"==typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})})))},i.haveMetadata=function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},i.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window__default.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(window__default.default.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},i.load=function(e){var t=this;window__default.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var i=this.media();if(e){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=window__default.default.setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},i.start=function(){var e=this;this.started=!0,this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_(),e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=window__default.default.setTimeout((function(){return e.haveMaster_()}),0)},i.requestMaster_=function(e){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(!t.requestErrored_(i,n)){var r=n.responseText!==t.masterPlaylistLoader_.masterXml_;return t.masterPlaylistLoader_.masterXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now(),t.masterPlaylistLoader_.srcUrl=resolveManifestRedirect(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n),r?(t.handleMaster_(),void t.syncClientServerClock_((function(){return e(n,r)}))):e(n,r)}"HAVE_NOTHING"===t.state&&(t.started=!1)}))},i.syncClientServerClock_=function(e){var t=this,i=mpdParser.parseUTCTiming(this.masterPlaylistLoader_.masterXml_);return null===i?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.masterPlaylistLoader_.clientOffset_=i.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:resolveUrl(this.masterPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n)return t.masterPlaylistLoader_.clientOffset_=t.masterLoaded_-Date.now(),e();var a;a="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.masterPlaylistLoader_.clientOffset_=a-Date.now(),e()}})))},i.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},i.handleMaster_=function(){this.mediaRequest_=null;var e=this.masterPlaylistLoader_.master,t=parseMasterXml({masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=updateMaster(e,t,this.masterPlaylistLoader_.sidxMapping_)),this.masterPlaylistLoader_.master=t||e;var i=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0];return i&&i!==this.masterPlaylistLoader_.srcUrl&&(this.masterPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(t)},i.updateMinimumUpdatePeriodTimeout_=function(){var e=this.masterPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window__default.default.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);var t=e.master&&e.master.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_("found invalid minimumUpdatePeriod of "+t+", not setting a timeout"):this.createMUPTimeout_(t)},i.createMUPTimeout_=function(e){var t=this.masterPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window__default.default.setTimeout((function(){t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)},i.refreshXml_=function(){var e=this;this.requestMaster_((function(t,i){i&&(e.media_&&(e.media_=e.masterPlaylistLoader_.master.playlists[e.media_.id]),e.masterPlaylistLoader_.sidxMapping_=filterChangedSidxMappings(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.sidxMapping_),e.addSidxSegments_(e.media(),e.state,(function(t){e.refreshMedia_(e.media().id)})))}))},i.refreshMedia_=function(e){var t=this;if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMaster_&&this.handleMaster_();var i=this.masterPlaylistLoader_.master.playlists,n=!this.media_||this.media_!==i[e];n?this.media_=i[e]:this.trigger("playlistunchanged"),this.mediaUpdateTimeout||function e(){t.media().endList||(t.mediaUpdateTimeout=window__default.default.setTimeout((function(){t.trigger("mediaupdatetimeout"),e()}),refreshDelay(t.media(),Boolean(n))))}(),this.trigger("loadedplaylist")},t}(EventTarget),Config={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},stringToArrayBuffer=function(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),i=0;i-1)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},m=function(e){return t(S.hdlr,A[e])},f=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(S.mdhd,i)},p=function(e){return t(S.mdia,f(e),m(e.type),s(e))},a=function(e){return t(S.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},s=function(e){return t(S.minf,"video"===e.type?t(S.vmhd,P):t(S.smhd,L),i(),_(e))},o=function(e,i){for(var n=[],r=i.length;r--;)n[r]=y(i[r]);return t.apply(null,[S.moof,a(e)].concat(n))},l=function(e){for(var i=e.length,n=[];i--;)n[i]=c(e[i]);return t.apply(null,[S.moov,d(4294967295)].concat(n).concat(u(e)))},u=function(e){for(var i=e.length,n=[];i--;)n[i]=T(e[i]);return t.apply(null,[S.mvex].concat(n))},d=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t(S.mvhd,i)},g=function(e){var i,n,r=e.samples||[],a=new Uint8Array(4+r.length);for(n=0;n>>8),s.push(255&r[i].byteLength),s=s.concat(Array.prototype.slice.call(r[i]));for(i=0;i>>8),o.push(255&a[i].byteLength),o=o.concat(Array.prototype.slice.call(a[i]));if(n=[S.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(S.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),t(S.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var l=e.sarRatio[0],u=e.sarRatio[1];n.push(t(S.pasp,new Uint8Array([(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l,(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u])))}return t.apply(null,n)},N=function(e){return t(S.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]),n(e))},h=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(S.tkhd,i)},y=function(e){var i,n,r,a,s,o;return i=t(S.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/W),o=Math.floor(e.baseMediaDecodeTime%W),n=t(S.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(r=b(e,92),t(S.traf,i,n,r)):(a=g(e),r=b(e,a.length+92),t(S.traf,i,n,r,a))},c=function(e){return e.duration=e.duration||4294967295,t(S.trak,h(e),p(e))},T=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(S.trex,i)},j=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},F=function(e,i){var n,r,a,s,o,l;for(i+=20+16*(s=e.samples||[]).length,a=j(s,i),(r=new Uint8Array(a.length+16*s.length)).set(a),n=a.length,l=0;l>>24,r[n++]=(16711680&o.duration)>>>16,r[n++]=(65280&o.duration)>>>8,r[n++]=255&o.duration,r[n++]=(4278190080&o.size)>>>24,r[n++]=(16711680&o.size)>>>16,r[n++]=(65280&o.size)>>>8,r[n++]=255&o.size,r[n++]=o.flags.isLeading<<2|o.flags.dependsOn,r[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[n++]=61440&o.flags.degradationPriority,r[n++]=15&o.flags.degradationPriority,r[n++]=(4278190080&o.compositionTimeOffset)>>>24,r[n++]=(16711680&o.compositionTimeOffset)>>>16,r[n++]=(65280&o.compositionTimeOffset)>>>8,r[n++]=255&o.compositionTimeOffset;return t(S.trun,r)},B=function(e,i){var n,r,a,s,o,l;for(i+=20+8*(s=e.samples||[]).length,a=j(s,i),(n=new Uint8Array(a.length+8*s.length)).set(a),r=a.length,l=0;l>>24,n[r++]=(16711680&o.duration)>>>16,n[r++]=(65280&o.duration)>>>8,n[r++]=255&o.duration,n[r++]=(4278190080&o.size)>>>24,n[r++]=(16711680&o.size)>>>16,n[r++]=(65280&o.size)>>>8,n[r++]=255&o.size;return t(S.trun,n)},b=function(e,t){return"audio"===e.type?B(e,t):F(e,t)},r=function(){return t(S.ftyp,E,C,E,k)};var $,G,z,K,Q,Y,X,J,Z=function(e){return t(S.mdat,e)},ee=o,te=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ie=[33,16,5,32,164,27],ne=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],re=function(e){for(var t=[];e--;)t.push(0);return t},ae=9e4;Y=function(e,t){return G(Q(e,t))},X=function(e,t){return z(K(e),t)},J=function(e,t,i){return K(i?e:e-t)};var se=ae,oe=G=function(e){return e*ae},le=(z=function(e,t){return e*t},K=function(e){return e/ae}),ue=(Q=function(e,t){return e/t},Y),de=X,ce=J,he=function(e,t,i,n){var r,a,s,o,l,u=0,d=0,c=0;if(t.length&&(r=ue(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(se/(e.samplerate/1024)),i&&n&&(u=r-Math.max(i,n),c=(d=Math.floor(u/a))*a),!(d<1||c>45e3))){for((s=function(){if(!$){var e={96e3:[ie,[227,64],re(154),[56]],88200:[ie,[231],re(170),[56]],64e3:[ie,[248,192],re(240),[56]],48e3:[ie,[255,192],re(268),[55,148,128],re(54),[112]],44100:[ie,[255,192],re(268),[55,163,128],re(84),[112]],32e3:[ie,[255,192],re(268),[55,234],re(226),[112]],24e3:[ie,[255,192],re(268),[55,255,128],re(268),[111,112],re(126),[224]],16e3:[ie,[255,192],re(268),[55,255,128],re(268),[111,255],re(269),[223,108],re(195),[1,192]],12e3:[ne,re(268),[3,127,248],re(268),[6,255,240],re(268),[13,255,224],re(268),[27,253,128],re(259),[56]],11025:[ne,re(268),[3,127,248],re(268),[6,255,240],re(268),[13,255,224],re(268),[27,255,192],re(268),[55,175,128],re(108),[112]],8e3:[ne,re(268),[3,121,16],re(47),[7]]};t=e,$=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})}var t;return $}()[e.samplerate])||(s=t[0].data),o=0;o=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},ye.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},ye.prototype.addText=function(e){this.rows[this.rowIdx]+=e},ye.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var Te=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new ye(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};Te.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new ye(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Te.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Te.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var be=function e(t){t=t||{},e.prototype.init.call(this);var i,n=this,r=t.captionServices||{},a={};Object.keys(r).forEach((function(e){i=r[e],/^SERVICE/.test(e)&&(a[e]=i.encoding)})),this.serviceEncodings=a,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(n.new708Packet(),n.add708Bytes(e)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(e))}};be.prototype=new H,be.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},be.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},be.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,r=0,a=t[r++];for(e.seq=a>>6,e.sizeCode=63&a;r>5)&&n>0&&(i=a=t[r++]),this.pushServiceBlock(i,r,n),n>0&&(r+=n-1)},be.prototype.pushServiceBlock=function(e,t,i){var n,r=t,a=this.current708Packet.data,s=this.services[e];for(s||(s=this.initService(e,r));r>5,a.rowLock=(16&n)>>4,a.columnLock=(8&n)>>3,a.priority=7&n,n=i[++e],a.relativePositioning=(128&n)>>7,a.anchorVertical=127&n,n=i[++e],a.anchorHorizontal=n,n=i[++e],a.anchorPoint=(240&n)>>4,a.rowCount=15&n,n=i[++e],a.columnCount=63&n,n=i[++e],a.windowStyle=(56&n)>>3,a.penStyle=7&n,a.virtualRowCount=a.rowCount+1,e},be.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.winAttr;return n=i[++e],r.fillOpacity=(192&n)>>6,r.fillRed=(48&n)>>4,r.fillGreen=(12&n)>>2,r.fillBlue=3&n,n=i[++e],r.borderType=(192&n)>>6,r.borderRed=(48&n)>>4,r.borderGreen=(12&n)>>2,r.borderBlue=3&n,n=i[++e],r.borderType+=(128&n)>>5,r.wordWrap=(64&n)>>6,r.printDirection=(48&n)>>4,r.scrollDirection=(12&n)>>2,r.justify=3&n,n=i[++e],r.effectSpeed=(240&n)>>4,r.effectDirection=(12&n)>>2,r.displayEffect=3&n,e},be.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},be.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},be.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<>4,r.offset=(12&n)>>2,r.penSize=3&n,n=i[++e],r.italics=(128&n)>>7,r.underline=(64&n)>>6,r.edgeType=(56&n)>>3,r.fontStyle=7&n,e},be.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penColor;return n=i[++e],r.fgOpacity=(192&n)>>6,r.fgRed=(48&n)>>4,r.fgGreen=(12&n)>>2,r.fgBlue=3&n,n=i[++e],r.bgOpacity=(192&n)>>6,r.bgRed=(48&n)>>4,r.bgGreen=(12&n)>>2,r.bgBlue=3&n,n=i[++e],r.edgeRed=(48&n)>>4,r.edgeGreen=(12&n)>>2,r.edgeBlue=3&n,e},be.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],r.row=15&n,n=i[++e],r.column=63&n,e},be.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Se={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},Ee=function(e){return null===e?"":(e=Se[e]||e,String.fromCharCode(e))},Ce=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ke=function(){for(var e=[],t=15;t--;)e.push("");return e},we=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=ke();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=ke();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=ke()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))a=Ee((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=Ee((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=Ce.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=Ee(n),a+=Ee(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};we.prototype=new H,we.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch(e){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},we.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=ke(),this.nonDisplayed_=ke(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},we.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},we.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},we.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},we.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},we.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},we.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},we.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},we.prototype.isNormalChar=function(e){return e>=32&&e<=127},we.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=ke(),this.displayed_=ke()),void 0!==t&&t!==this.row_)for(var i=0;i"}),"");this[this.mode_](e,i)},we.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+""}),"");this.formatting_=[],this[this.mode_](e,t)}},we.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},we.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},we.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},xe=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||Pe,this.push=function(e){this.type_!==Pe&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=Le(e.dts,n),e.pts=Le(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};xe.prototype=new H;var Oe,De=xe,Re=Le,Me=function(e,t,i){var n,r="";for(n=t;n>>2;d*=4,d+=3&u[7],o.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=s}while(i>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Ae.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ae.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new H,je.STREAM_TYPES={h264:27,adts:15},(He=function(){var e,t=this,i=!1,n={data:[],size:0},r={data:[],size:0},a={data:[],size:0},s=function(e,i,n){var r,a,s=new Uint8Array(e.size),o={type:i},l=0,u=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,l=0;l>>3,c.pts*=4,c.pts+=(6&d[13])>>>1,c.dts=c.pts,64&h&&(c.dts=(14&d[14])<<27|(255&d[15])<<20|(254&d[16])<<12|(255&d[17])<<5|(254&d[18])>>>3,c.dts*=4,c.dts+=(6&d[18])>>>1)),c.data=d.subarray(9+d[8])),r="video"===i||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};He.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case Ae.H264_STREAM_TYPE:e=n,t="video";break;case Ae.ADTS_STREAM_TYPE:e=r,t="audio";break;case Ae.METADATA_STREAM_TYPE:e=a,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(r,"audio"),s(a,"timed-metadata")},this.flush=function(){if(!i&&e){var n={type:"metadata",tracks:[]};null!==e.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new H;var $e={PAT_PID:0,MP2T_PACKET_LENGTH:We,TransportPacketStream:Fe,TransportParseStream:je,ElementaryStream:He,TimestampRolloverStream:qe,CaptionStream:Ie.CaptionStream,Cea608Stream:Ie.Cea608Stream,Cea708Stream:Ie.Cea708Stream,MetadataStream:Ve};for(var Ge in Ae)Ae.hasOwnProperty(Ge)&&($e[Ge]=Ae[Ge]);var ze,Ke=$e,Qe=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(ze=function(e){var t,i=0;ze.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+e+" to "+t+" in frame "+i+" outside syncword"})},this.push=function(n){var r,a,s,o,l,u=0;if(e||(i=0),"audio"===n.type){var d;for(t&&t.length?(s=t,(t=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),t.set(n.data,s.byteLength)):t=n.data;u+7>5,l=9e4*(o=1024*(1+(3&t[u+6])))/Qe[(60&t[u+2])>>>2],t.byteLength-u>>6&3),channelcount:(1&t[u+2])<<2|(192&t[u+3])>>>6,samplerate:Qe[(60&t[u+2])>>>2],samplingfrequencyindex:(60&t[u+2])>>>2,samplesize:16,data:t.subarray(u+7+a,u+r)}),i++,u+=r}else"number"!=typeof d&&(d=u),u++;"number"==typeof d&&(this.skipWarn_(d,u),d=null),t=t.subarray(u)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new H;var Ye,Xe,Je,Ze=ze,et=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Xe=function(){var e,t,i=0;Xe.prototype.init.call(this),this.push=function(n){var r;t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;for(var a=t.byteLength;i3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new H,Je={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Ye=function(){var e,t,i,n,r,a,s,o=new Xe;Ye.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(s){var o={trackId:t,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(e,t){var i,n=8,r=8;for(i=0;i=0?i:0,(16&e[t+5])>>4?i+20:i+10},at=function e(t,i){return t.length-i<10||t[i]!=="I".charCodeAt(0)||t[i+1]!=="D".charCodeAt(0)||t[i+2]!=="3".charCodeAt(0)?i:e(t,i+=rt(t,i))},st=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},ot={isLikelyAacData:function(e){var t=at(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:rt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=st(e.subarray(10,14)));do{if((i=st(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r>>2;return(s*=4)+(3&a[7])}break}}t+=10,t+=i}while(t=3;)if(e[l]!=="I".charCodeAt(0)||e[l+1]!=="D".charCodeAt(0)||e[l+2]!=="3".charCodeAt(0))if(255!=(255&e[l])||240!=(240&e[l+1]))l++;else{if(e.length-l<7)break;if(l+(o=ot.parseAdtsSize(e,l))>e.length)break;a={type:"audio",data:e.subarray(l,l+o),pts:t,dts:t},this.trigger("data",a),l+=o}else{if(e.length-l<10)break;if(l+(o=ot.parseId3TagSize(e,l))>e.length)break;r={type:"timed-metadata",data:e.subarray(l,l+o)},this.trigger("data",r),l+=o}n=e.length-l,e=n>0?e.subarray(l):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new H;var lt,ut,dt,ct,ht=tt,pt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],ft=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],mt=it.H264Stream,gt=ot.isLikelyAacData,_t=function(e,t){t.stream=e,this.trigger("log",t)},vt=function(e,t){for(var i=Object.keys(t),n=0;n=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))}(n,e,r),e.baseMediaDecodeTime=fe(e,t.keepOriginalTimestamps),p=he(e,o,a,s),e.samples=function(e){var t,i,n=[];for(t=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e}(r)),s.length){var p;if(!(p=t.alignGopsAtEnd?this.alignGopsAtEnd_(r):this.alignGopsAtStart_(r)))return this.gopCache_.unshift({gop:r.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");pe(e),r=p}me(e,r),e.samples=function(e,t){var i,n,r,a,s,o=t||0,l=[];for(i=0;i=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,a,o,l,u;for(a=e.byteLength,o=e.nalCount,l=e.duration,t=i=0;tn.pts?t++:(i++,a-=r.byteLength,o-=r.nalCount,l-=r.duration);return 0===i?e:i===e.length?null:((u=e.slice(i)).byteLength=a,u.duration=l,u.nalCount=o,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(e){var t,i,n,r,a,o,l;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=s[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(l=o?i:a))return e;var u=e.slice(l),d=u.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return u.byteLength=d.byteLength,u.duration=d.duration,u.nalCount=d.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){s=e}}).prototype=new H,(ct=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ct.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new H,ct.prototype.flush=function(e){var t,i,n,a,s,o,u,d,c=0,h={captions:[],captionStreams:{},metadata:[],info:{}},p=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(p=this.videoTrack.timelineStartInfo.pts,ft.forEach((function(e){h.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(p=this.audioTrack.timelineStartInfo.pts,pt.forEach((function(e){h.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?h.type=this.pendingTracks[0].type:h.type="combined",this.emittedTracks+=this.pendingTracks.length,s=this.pendingTracks,o=void 0,u=void 0,d=void 0,u=r(),d=l(s),(o=new Uint8Array(u.byteLength+d.byteLength)).set(u),o.set(d,u.byteLength),n=o,h.initSegment=new Uint8Array(n.byteLength),h.initSegment.set(n),h.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},ct.prototype.setRemux=function(e){this.remuxTracks=e},(dt=function(e){var t,i,n=this,r=!0;dt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new Ke.MetadataStream,r.aacStream=new ht,r.audioTimestampRolloverStream=new Ke.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Ke.TimestampRolloverStream("timed-metadata"),r.adtsStream=new Ze,r.coalesceStream=new ct(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(a){"timed-metadata"!==a.type&&"audio"!==a.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new ut(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),vt(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Ke.MetadataStream,r.packetStream=new Ke.TransportPacketStream,r.parseStream=new Ke.TransportParseStream,r.elementaryStream=new Ke.ElementaryStream,r.timestampRolloverStream=new Ke.TimestampRolloverStream,r.adtsStream=new Ze,r.h264Stream=new mt,r.captionStream=new Ke.CaptionStream(e),r.coalesceStream=new ct(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new lt(t,e),r.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new ut(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),vt(this,r)},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,pe(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,pe(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=gt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new H;var bt,St={Transmuxer:dt,VideoSegmentStream:lt,AudioSegmentStream:ut,AUDIO_PROPERTIES:pt,VIDEO_PROPERTIES:ft,generateSegmentTimingInfo:Tt},Et=function(e){return e>>>0},Ct=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])},kt=Et,wt=function e(t,i){var n,r,a,s,o,l=[];if(!i.length)return null;for(n=0;n1?n+r:t.byteLength,a===i[0]&&(1===i.length?l.push(t.subarray(n+8,s)):(o=e(t.subarray(n+8,s),i.slice(1))).length&&(l=l.concat(o))),n=s;return l},It=Et,At=q.getUint64,Pt=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]}},Lt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},xt="undefined"!=typeof window?window:void 0!==Lt?Lt:"undefined"!=typeof self?self:{},Ot=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a0?function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=At(e.subarray(4)):t.baseMediaDecodeTime=It(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t}(l[0]).baseMediaDecodeTime:0,d=wt(a,["trun"]);t===o&&d.length>0&&(i=function(e,t,i){var n,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),l={logs:[],seiNals:[]};for(r=0;r+40;){var l=t.shift();this.parse(l,a,s)}return(o=function(e,t,i){if(null===t)return null;var n=Mt(e,t)[t]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(e,i,n))&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Nt=Et,Bt=function(e){return("00"+e.toString(16)).slice(-2)},Ft=q.getUint64,jt=function(e,t){var i=wt(t,["moof","traf"]).reduce((function(t,i){var n,r,a=wt(i,["tfhd"])[0],s=Nt(a[4]<<24|a[5]<<16|a[6]<<8|a[7]),o=e[s]||9e4,l=wt(i,["tfdt"])[0],u=new DataView(l.buffer,l.byteOffset,l.byteLength);return"bigint"==typeof(n=1===l[0]?Ft(l.subarray(4,12)):u.getUint32(4))?r=n/xt.BigInt(o):"number"!=typeof n||isNaN(n)||(r=n/o),r11?(r.codec+=".",r.codec+=Bt(d[9]),r.codec+=Bt(d[10]),r.codec+=Bt(d[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(d=c.subarray(28),"esds"===Ct(d.subarray(4,8))&&d.length>20&&0!==d[19]?(r.codec+="."+Bt(d[19]),r.codec+="."+Bt(d[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var h=wt(e,["mdia","mdhd"])[0];h&&(r.timescale=bt(h)),i.push(r)})),i},Vt=(bt=function(e){var t=0===e[0]?12:20;return Nt(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},function(e){var t=31&e[1];return(t<<=8)|e[2]}),qt=function(e){return!!(64&e[1])},Wt=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},$t=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Gt={parseType:function(e,t){var i=Vt(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=qt(e),i=4+Wt(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=qt(e),n=4+Wt(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var a=12+((15&e[n+10])<<8|e[n+11]);a=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+Wt(e),i=e.subarray(t),n=0,r=0,a=!1;r3&&"slice_layer_without_partitioning_rbsp_idr"===$t(31&i[r+3])&&(a=!0),a}},zt=Re,Kt={};Kt.ts=Gt,Kt.aac=ot;var Qt=se,Yt=188,Xt=71,Jt=function(e,t,i){for(var n,r,a,s,o=0,l=Yt,u=!1;l<=e.byteLength;)if(e[o]!==Xt||e[l]!==Xt&&l!==e.byteLength)o++,l++;else{switch(n=e.subarray(o,l),Kt.ts.parseType(n,t.pid)){case"pes":r=Kt.ts.parsePesType(n,t.table),a=Kt.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=Kt.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),u=!0)}if(u)break;o+=Yt,l+=Yt}for(o=(l=e.byteLength)-Yt,u=!1;o>=0;)if(e[o]!==Xt||e[l]!==Xt&&l!==e.byteLength)o--,l--;else{switch(n=e.subarray(o,l),Kt.ts.parseType(n,t.pid)){case"pes":r=Kt.ts.parsePesType(n,t.table),a=Kt.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=Kt.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),u=!0)}if(u)break;o-=Yt,l-=Yt}},Zt=function(e,t,i){for(var n,r,a,s,o,l,u,d=0,c=Yt,h=!1,p={data:[],size:0};c=0;)if(e[d]!==Xt||e[c]!==Xt)d--,c--;else{switch(n=e.subarray(d,c),Kt.ts.parseType(n,t.pid)){case"pes":r=Kt.ts.parsePesType(n,t.table),a=Kt.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=Kt.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),h=!0)}if(h)break;d-=Yt,c-=Yt}},ei=function(e,t){var i;return(i=Kt.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,a=null,s=0,o=0;e.length-o>=3;){switch(Kt.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=Kt.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=Kt.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=Kt.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=Kt.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var l=Qt/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*l,pts:a+1024*n*l}]}}(e):function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=Yt;r1)return logFn$1("multiple "+e+" codecs found as attributes: "+t[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(t[e]=null);t[e]=t[e][0]})),t},codecCount=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},codecsForPlaylist=function(e,t){var i=t.attributes||{},n=unwrapCodecList(getCodecs(t)||[]);if(isMaat(e,t)&&!n.audio&&!isMuxed(e,t)){var r=unwrapCodecList(codecs_js.codecsFromDefault(e,i.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},logFn=logger("PlaylistSelector"),representationToString=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},safeGetComputedStyle=function(e,t){if(!e)return"";var i=window__default.default.getComputedStyle(e);return i?i[t]:""},stableSort=function(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))},comparePlaylistBandwidth=function(e,t){var i,n;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||window__default.default.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),i-(n||window__default.default.Number.MAX_VALUE)},comparePlaylistResolution=function(e,t){var i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||window__default.default.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),i===(n=n||window__default.default.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},simpleSelector=function(e,t,i,n,r,a){if(e){var s={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r},o=e.playlists;Playlist.isAudioOnly(e)&&(o=a.getAudioTrackPlaylists_(),s.audioOnly=!0);var l=o.map((function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||window__default.default.Number.MAX_VALUE,width:t,height:i,playlist:e}}));stableSort(l,(function(e,t){return e.bandwidth-t.bandwidth}));var u=(l=l.filter((function(e){return!Playlist.isIncompatible(e.playlist)}))).filter((function(e){return Playlist.isEnabled(e.playlist)}));u.length||(u=l.filter((function(e){return!Playlist.isDisabled(e.playlist)})));var d=u.filter((function(e){return e.bandwidth*Config.BANDWIDTH_VARIANCEi||e.height>n}))).filter((function(e){return e.width===_[0].width&&e.height===_[0].height})),c=v[v.length-1],y=v.filter((function(e){return e.bandwidth===c.bandwidth}))[0]),a.experimentalLeastPixelDiffSelector){var S=m.map((function(e){return e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e}));stableSort(S,(function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff})),T=S[0]}var E=T||y||b||h||u[0]||l[0];if(E&&E.playlist){var C="sortedPlaylistReps";return T?C="leastPixelDiffRep":y?C="resolutionPlusOneRep":b?C="resolutionBestRep":h?C="bandwidthBestRep":u[0]&&(C="enabledPlaylistReps"),logFn("choosing "+representationToString(E)+" using "+C+" with options",s),E.playlist}return logFn("could not choose a playlist with options",s),null}},lastBandwidthSelector=function(){var e=this.useDevicePixelRatio&&window__default.default.devicePixelRatio||1;return simpleSelector(this.playlists.master,this.systemBandwidth,parseInt(safeGetComputedStyle(this.tech_.el(),"width"),10)*e,parseInt(safeGetComputedStyle(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},movingAverageBandwidthSelector=function(e){var t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var n=this.useDevicePixelRatio&&window__default.default.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),simpleSelector(this.playlists.master,t,parseInt(safeGetComputedStyle(this.tech_.el(),"width"),10)*n,parseInt(safeGetComputedStyle(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},minRebufferMaxBandwidthSelector=function(e){var t=e.master,i=e.currentTime,n=e.bandwidth,r=e.duration,a=e.segmentDuration,s=e.timeUntilRebuffer,o=e.currentTimeline,l=e.syncController,u=t.playlists.filter((function(e){return!Playlist.isIncompatible(e)})),d=u.filter(Playlist.isEnabled);d.length||(d=u.filter((function(e){return!Playlist.isDisabled(e)})));var c=d.filter(Playlist.hasAttribute.bind(null,"BANDWIDTH")).map((function(e){var t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:Playlist.estimateSegmentRequestTime(a,n,e)*t-s}})),h=c.filter((function(e){return e.rebufferingImpact<=0}));return stableSort(h,(function(e,t){return comparePlaylistBandwidth(t.playlist,e.playlist)})),h.length?h[0]:(stableSort(c,(function(e,t){return e.rebufferingImpact-t.rebufferingImpact})),c[0]||null)},lowestBitrateCompatibleVariantSelector=function(){var e=this,t=this.playlists.master.playlists.filter(Playlist.isEnabled);return stableSort(t,(function(e,t){return comparePlaylistBandwidth(e,t)})),t.filter((function(t){return!!codecsForPlaylist(e.playlists.master,t).video}))[0]||null},concatSegments=function(e){var t,i=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach((function(e){t.set(e,i),i+=e.byteLength}))),t},createCaptionsTrackIfNotExists=function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"});var n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);var r=t.textTracks().getTrackById(n);if(r)e[i]=r;else{var a=i,s=i,o=!1,l=(t.options_.vhs&&t.options_.vhs.captionServices||{})[n];l&&(a=l.label,s=l.language,o=l.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:n,default:o,label:a,language:s},!1).track}}},addCaptionData=function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var r=window__default.default.WebKitDataCue||window__default.default.VTTCue;i.forEach((function(e){var i=e.stream;t[i].addCue(new r(e.startTime+n,e.endTime+n,e.text))}))}},deprecateOldCue=function(e){Object.defineProperties(e.frame,{id:{get:function(){return videojs.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return videojs.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return videojs.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})},addMetadata=function(e){var t=e.inbandTextTracks,i=e.metadataArray,n=e.timestampOffset,r=e.videoDuration;if(i){var a=window__default.default.WebKitDataCue||window__default.default.VTTCue,s=t.metadataTrack_;if(s&&(i.forEach((function(e){var t=e.cueTime+n;!("number"!=typeof t||window__default.default.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((function(e){var i=new a(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,deprecateOldCue(i),s.addCue(i)}))})),s.cues&&s.cues.length)){for(var o=s.cues,l=[],u=0;u=e&&r.endTime<=t&&i.removeCue(r)},removeDuplicateCuesFromTrack=function(e){var t=e.cues;if(t)for(var i=0;i1&&n.push(t[a]);n.length&&n.forEach((function(t){return e.removeCue(t)}))}},gopsSafeToAlignWith=function(e,t,i){if(null==t||!e.length)return[];var n,r=Math.ceil((t-i+3)*clock.ONE_SECOND_IN_TS);for(n=0;nr);n++);return e.slice(n)},updateGopBuffer=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var n=t[0].pts,r=0;r=n);r++);return e.slice(0,r).concat(t)},removeGopBuffer=function(e,t,i,n){for(var r=Math.ceil((t-n)*clock.ONE_SECOND_IN_TS),a=Math.ceil((i-n)*clock.ONE_SECOND_IN_TS),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var l=o+1;l--&&!(e[l].pts<=r););return l=Math.max(l,0),s.splice(l,o-l+1),s},shallowEqual=function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;var i=Object.keys(e).sort(),n=Object.keys(t).sort();if(i.length!==n.length)return!1;for(var r=0;ri))return a}return 0===n.length?0:n[n.length-1]},MIN_BACK_BUFFER=1,CHECK_BUFFER_DELAY=500,finite=function(e){return"number"==typeof e&&isFinite(e)},MIN_SEGMENT_DURATION_TO_SAVE_STATS=1/60,illegalMediaSwitch=function(e,t,i){return"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null},safeBackBufferTrimTime=function(e,t,i){var n=t-Config.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));var r=t-i;return Math.min(r,n)},segmentInfoString=function(e){var t=e.startOfSegment,i=e.duration,n=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,l=a.segments,u=void 0===l?[]:l,d=e.mediaIndex,c=e.partIndex,h=e.timeline,p=u.length-1,f="mediaIndex/partIndex increment";e.getMediaInfoForTime?f="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(f="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(f+=" with independent "+e.independent);var m="number"==typeof c,g=e.segment.uri?"segment":"pre-segment",_=m?getKnownPartCount({preloadSegment:n})-1:0;return g+" ["+(s+d)+"/"+(s+p)+"]"+(m?" part ["+c+"/"+_+"]":"")+" segment start/end ["+n.start+" => "+n.end+"]"+(m?" part start/end ["+r.start+" => "+r.end+"]":"")+" startOfSegment ["+t+"] duration ["+i+"] timeline ["+h+"] selected by ["+f+"] playlist ["+o+"]"},timingInfoPropertyForMedia=function(e){return e+"TimingInfo"},timestampOffsetForSegment=function(e){var t=e.segmentTimeline,i=e.currentTimeline,n=e.startOfSegment,r=e.buffered;return e.overrideCheck||t!==i?tt&&(t=r)}})),"bigint"==typeof t&&ti+TIME_FUDGE_FACTOR},getTroublesomeSegmentDurationMessage=function(e,t){if("hls"!==t)return null;var i=mediaDuration({audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo});if(!i)return null;var n=e.playlist.targetDuration,r=segmentTooLong({segmentDuration:i,maxDuration:2*n}),a=segmentTooLong({segmentDuration:i,maxDuration:n}),s="Segment with index "+e.mediaIndex+" from playlist "+e.playlist.id+" has a duration of "+i+" when the reported duration is "+e.duration+" and the target duration is "+n+". For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";return r||a?{severity:r?"warn":"info",message:s}:null},SegmentLoader=function(e){function t(t,i){var n;if(n=e.call(this)||this,!t)throw new TypeError("Initialization settings are required");if("function"!=typeof t.currentTime)throw new TypeError("No currentTime getter specified");if(!t.mediaSource)throw new TypeError("No MediaSource specified");return n.bandwidth=t.bandwidth,n.throughput={rate:0,count:0},n.roundTrip=NaN,n.resetStats_(),n.mediaIndex=null,n.partIndex=null,n.hasPlayed_=t.hasPlayed,n.currentTime_=t.currentTime,n.seekable_=t.seekable,n.seeking_=t.seeking,n.duration_=t.duration,n.mediaSource_=t.mediaSource,n.vhs_=t.vhs,n.loaderType_=t.loaderType,n.currentMediaInfo_=void 0,n.startingMediaInfo_=void 0,n.segmentMetadataTrack_=t.segmentMetadataTrack,n.goalBufferLength_=t.goalBufferLength,n.sourceType_=t.sourceType,n.sourceUpdater_=t.sourceUpdater,n.inbandTextTracks_=t.inbandTextTracks,n.state_="INIT",n.timelineChangeController_=t.timelineChangeController,n.shouldSaveSegmentTimingInfo_=!0,n.parse708captions_=t.parse708captions,n.useDtsForTimestampOffset_=t.useDtsForTimestampOffset,n.captionServices_=t.captionServices,n.experimentalExactManifestTimings=t.experimentalExactManifestTimings,n.checkBufferTimeout_=null,n.error_=void 0,n.currentTimeline_=-1,n.pendingSegment_=null,n.xhrOptions_=null,n.pendingSegments_=[],n.audioDisabled_=!1,n.isPendingTimestampOffset_=!1,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=videojs.browser.IE_VERSION>=11,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",(function(){n.isEndOfStream_()||(n.ended_=!1)})),n.fetchAtBuffer_=!1,n.logger_=logger("SegmentLoader["+n.loaderType_+"]"),Object.defineProperty(_assertThisInitialized__default.default(n),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",(function(){n.hasEnoughInfoToLoad_()&&n.processLoadQueue_(),n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),n}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return segmentTransmuxer.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},i.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},i.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window__default.default.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},i.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},i.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},i.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,window__default.default.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},i.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},i.error=function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},i.endOfStream=function(){this.ended_=!0,this.transmuxer_&&segmentTransmuxer.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},i.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return videojs.createTimeRanges();if("main"===this.loaderType_){var t=e.hasAudio,i=e.hasVideo,n=e.isMuxed;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=initSegmentId(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e},i.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=segmentKeyId(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r},i.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},i.load=function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.playlist=function(e,t){if(void 0===t&&(t={}),e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");var a=e.mediaSequence-i.mediaSequence;if(this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var s=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!s.parts||!s.parts.length||!s.parts[this.partIndex])){var o=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=o}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}},i.pause=function(){this.checkBufferTimeout_&&(window__default.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},i.paused=function(){return null===this.checkBufferTimeout_},i.resetEverything=function(e){this.ended_=!1,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))},i.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},i.resyncLoader=function(){this.transmuxer_&&segmentTransmuxer.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},i.remove=function(e,t,i,n){if(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r=1,a=function(){0==--r&&i()};for(var s in!n&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,a)),(n||"main"===this.loaderType_)&&(this.gopBuffer_=removeGopBuffer(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a)),this.inbandTextTracks_)removeCuesFromTrack(e,t,this.inbandTextTracks_[s]);removeCuesFromTrack(e,t,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")},i.monitorBuffer_=function(){this.checkBufferTimeout_&&window__default.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window__default.default.setTimeout(this.monitorBufferTick_.bind(this),1)},i.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window__default.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window__default.default.setTimeout(this.monitorBufferTick_.bind(this),CHECK_BUFFER_DELAY)},i.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}},i.isEndOfStream_=function(e,t,i){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===i&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var n="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&a},i.chooseNextRequest_=function(){var e=this.buffered_(),t=lastBufferedEnd(e)||0,i=timeAheadOf(e,this.currentTime_()),n=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var s={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(s.isSyncRequest)s.mediaIndex=getSyncSegmentCandidate(this.currentTimeline_,a,t);else if(null!==this.mediaIndex){var o=a[this.mediaIndex],l="number"==typeof this.partIndex?this.partIndex:-1;s.startOfSegment=o.end?o.end:t,o.parts&&o.parts[l+1]?(s.mediaIndex=this.mediaIndex,s.partIndex=l+1):s.mediaIndex=this.mediaIndex+1}else{var u=Playlist.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),d=u.segmentIndex,c=u.startTime,h=u.partIndex;s.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),s.mediaIndex=d,s.startOfSegment=c,s.partIndex=h}var p=a[s.mediaIndex],f=p&&"number"==typeof s.partIndex&&p.parts&&p.parts[s.partIndex];if(!p||"number"==typeof s.partIndex&&!f)return null;if("number"!=typeof s.partIndex&&p.parts&&(s.partIndex=0,f=p.parts[0]),!i&&f&&!f.independent)if(0===s.partIndex){var m=a[s.mediaIndex-1],g=m.parts&&m.parts.length&&m.parts[m.parts.length-1];g&&g.independent&&(s.mediaIndex-=1,s.partIndex=m.parts.length-1,s.independent="previous segment")}else p.parts[s.partIndex-1].independent&&(s.partIndex-=1,s.independent="previous part");var _=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return s.mediaIndex>=a.length-1&&_&&!this.seeking_()?null:this.generateSegmentInfo_(s)},i.generateSegmentInfo_=function(e){var t=e.independent,i=e.playlist,n=e.mediaIndex,r=e.startOfSegment,a=e.isSyncRequest,s=e.partIndex,o=e.forceTimestampOffset,l=e.getMediaInfoForTime,u=i.segments[n],d="number"==typeof s&&u.parts[s],c={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||u.resolvedUri,mediaIndex:n,partIndex:d?s:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:d&&d.duration||u.duration,segment:u,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:l,independent:t},h=void 0!==o?o:this.isPendingTimestampOffset_;c.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:u.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:h});var p=lastBufferedEnd(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(c.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(c.gopsToAlignWith=gopsSafeToAlignWith(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),c},i.timestampOffsetForSegment_=function(e){return timestampOffsetForSegment(e)},i.earlyAbortWhenNeeded_=function(e){if(!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&!(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)){var t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=Playlist.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),a=timeUntilRebuffer(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(!(r<=a)){var s=minRebufferMaxBandwidthSelector({master:this.vhs_.playlists.master,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var o=r-a-s.rebufferingImpact,l=.5;a<=TIME_FUDGE_FACTOR&&(l=1),!s.playlist||s.playlist.uri===this.playlist_.uri||o "+s+" for "+e),createCaptionsTrackIfNotExists(l,i.vhs_.tech_,e),removeCuesFromTrack(a,s,l[e]),addCaptionData({captionArray:o,inbandTextTracks:l,timestampOffset:n})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")},i.handleId3_=function(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();createMetadataTrackIfNotExists(this.inbandTextTracks_,i,this.vhs_.tech_),addMetadata({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:this.duration_()})}else this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i))},i.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach((function(e){return e()})),this.metadataQueue_.caption.forEach((function(e){return e()})),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},i.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach((function(e){return e()}))},i.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach((function(e){return e()}))},i.hasEnoughInfoToLoad_=function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!(!e||this.getCurrentMediaInfo_()&&shouldWaitForTimelineChange({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.getCurrentMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),e&&e.trackInfo||this.currentMediaInfo_},i.getMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),this.getCurrentMediaInfo_(e)||this.startingMediaInfo_},i.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed;return!(n&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo||shouldWaitForTimelineChange({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.handleData_=function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(!this.callQueue_.length&&this.hasEnoughInfoToAppend_()){var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[timingInfoPropertyForMedia(t.type)].start;else{var n,r=this.getCurrentMediaInfo_(),a="main"===this.loaderType_&&r&&r.hasVideo;a&&(n=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:a,firstVideoFrameTimeForData:n,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});var s=this.chooseNextRequest_();if(s.mediaIndex!==i.mediaIndex||s.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}else this.callQueue_.push(this.handleData_.bind(this,e,t))},i.updateAppendInitSegmentStatus=function(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)},i.getInitSegmentAndUpdateState_=function(e){var t=e.type,i=e.initSegment,n=e.map,r=e.playlist;if(n){var a=initSegmentId(n);if(this.activeInitSegmentId_===a)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=a}return i&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,i):null},i.handleQuotaExceededError_=function(e,t){var i=this,n=e.segmentInfo,r=e.type,a=e.bytes,s=this.sourceUpdater_.audioBuffered(),o=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+timeRangesToArray(s).join(", ")),o.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+timeRangesToArray(o).join(", "));var l=s.length?s.start(0):0,u=s.length?s.end(s.length-1):0,d=o.length?o.start(0):0,c=o.length?o.end(o.length-1):0;if(u-l<=MIN_BACK_BUFFER&&c-d<=MIN_BACK_BUFFER)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+a.byteLength+", audio buffer: "+timeRangesToArray(s).join(", ")+", video buffer: "+timeRangesToArray(o).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:n,type:r,bytes:a}));var h=this.currentTime_()-MIN_BACK_BUFFER;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+h),this.remove(0,h,(function(){i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in "+MIN_BACK_BUFFER+"s"),i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=window__default.default.setTimeout((function(){i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),i.quotaExceededErrorRetryTimeout_=null,i.processCallQueue_()}),1e3*MIN_BACK_BUFFER)}),!0)},i.handleAppendError_=function(e,t){var i=e.segmentInfo,n=e.type,r=e.bytes;t&&(t.code!==QUOTA_EXCEEDED_ERR?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(n+" append of "+r.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:i,type:n,bytes:r}))},i.appendToSourceBuffer_=function(e){var t=e.segmentInfo,i=e.type,n=e.initSegment,r=e.data,a=e.bytes;if(!a){var s=[r],o=r.byteLength;n&&(s.unshift(n),o+=n.byteLength),a=concatSegments({bytes:o,segments:s})}this.sourceUpdater_.appendBuffer({segmentInfo:t,type:i,bytes:a},this.handleAppendError_.bind(this,{segmentInfo:t,type:i,bytes:a}))},i.handleSegmentTimingInfo_=function(e,t,i){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var n=this.pendingSegment_.segment,r=e+"TimingInfo";n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}},i.appendData_=function(e,t){var i=t.type,n=t.data;if(n&&n.byteLength&&("audio"!==i||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}},i.loadSegment_=function(e){var t=this;this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((function(){var i=_extends__default.default({},e,{forceTimestampOffset:!0});_extends__default.default(e,t.generateSegmentInfo_(i)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)}))},i.updateTransmuxerAndRequestSegment_=function(e){var t=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,a=e.timeline!==this.currentTimeline_&&e.timeline>0,s=n||r&&a;this.logger_("Requesting "+segmentInfoString(e)),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=mediaSegmentRequest({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:s,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(i){var n=i.message,r=i.level,a=i.stream;t.logger_(segmentInfoString(e)+" logged from transmuxer stream "+a+" as a "+r+": "+n)}})},i.trimBackBuffer_=function(e){var t=safeBackBufferTrimTime(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)},i.createSimplifiedSegmentObj_=function(e){var t=e.segment,i=e.part,n={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},r=e.playlist.segments[e.mediaIndex-1];if(r&&r.timeline===t.timeline&&(r.videoTimingInfo?n.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(n.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key){var a=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=a}return t.map&&(n.map=this.initSegmentForMap(t.map)),n},i.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},i.saveBandwidthRelatedStats_=function(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e3*e.playlist.targetDuration,a=n&&n.end&&this.currentTime_()-n.end>3*e.playlist.partTargetDuration;if(r||a)return this.logger_("bad "+(r?"segment":"part")+" "+segmentInfoString(e)),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}else this.logger_("Throwing away un-appended sync request "+segmentInfoString(e))},i.recordThroughput_=function(e){if(e.duration=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e},i.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},i.segmentRequestFinished_=function(e,t,i){var n=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===REQUEST_ERRORS.TIMEOUT&&this.handleTimeout_(),e.code===REQUEST_ERRORS.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),this.state="APPENDING",this.trigger("appending");var a=r.segment;if(a.map&&(a.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof window__default.default.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var s,o=function(){n.subtitlesTrack_.tech_.off("vttjsloaded",s),n.stopForError({message:"Error loading vtt.js"})};return s=function(){n.subtitlesTrack_.tech_.off("vttjserror",o),n.segmentRequestFinished_(e,t,i)},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",s),void this.subtitlesTrack_.tech_.one("vttjserror",o)}a.requested=!0;try{this.parseVTTCues_(r)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,r.cues.forEach((function(e){n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_?new window__default.default.VTTCue(e.startTime,e.endTime,e.text):e)})),removeDuplicateCuesFromTrack(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},i.handleData_=function(){},i.updateTimingInfoEnd_=function(){},i.parseVTTCues_=function(e){var t,i=!1;"function"==typeof window__default.default.TextDecoder?t=new window__default.default.TextDecoder("utf8"):(t=window__default.default.WebVTT.StringDecoder(),i=!0);var n=new window__default.default.WebVTT.Parser(window__default.default,window__default.default.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){e.timestampmap=t},n.onparsingerror=function(e){videojs.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;i&&(r=uint8ToUtf8(r)),n.parse(r)}var a=e.bytes;i&&(a=uint8ToUtf8(a)),n.parse(a),n.flush()},i.updateTimeMapping_=function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,a=r.MPEGTS/clock.ONE_SECOND_IN_TS-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=a,e.endTime+=a})),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}else n.empty=!0},t}(SegmentLoader),findAdCue=function(e,t){for(var i=e.cues,n=0;n=r.adStartTime&&t<=r.adEndTime)return r}return null},updateAdCues=function(e,t,i){if(void 0===i&&(i=0),e.segments)for(var n,r=i,a=0;a=h)&&(s=h,a={time:c,segmentIndex:u.segmentIndex,partIndex:u.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o=c)&&(s=c,a={time:d.time,segmentIndex:l,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],SyncController=function(e){function t(t){var i;return(i=e.call(this)||this).timelines=[],i.discontinuities=[],i.timelineToDatetimeMappings={},i.logger_=logger("SyncController"),i}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.getSyncPoint=function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null},i.getExpiredTime=function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+sumDurations({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))},i.runStrategies_=function(e,t,i,n){for(var r=[],a=0;aMAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC)videojs.log.warn("Not saving expired segment info. Media sequence gap "+i+" is too large.");else for(var n=i-1;n>=0;n--){var r=e.segments[n];if(r&&void 0!==r.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},i.setDateTimeMappingForStart=function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}},i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i),r=t.segment;n&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start}));var a=r.dateTimeObject;r.discontinuity&&i&&a&&(this.timelineToDatetimeMappings[r.timeline]=-a.getTime()/1e3)},i.timestampOffsetForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].time},i.mappingForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping},i.calculateSegmentTimeMapping_=function(e,t,i){var n,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+o.time+"] [mapping: "+o.mapping+"]")),n=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=n,s.end=r),(!a.start||no){var l;l=s<0?i.start-sumDurations({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+sumDurations({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:l,accuracy:o}}}},i.dispose=function(){this.trigger("dispose"),this.off()},t}(videojs.EventTarget),TimelineChangeController=function(e){function t(){var t;return(t=e.call(this)||this).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.lastTimelineChanges_[t]={type:t,from:i,to:n},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(videojs.EventTarget),workerCode=transform(getWorkerString((function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var i=t((function(e){function t(e,t){for(var i=0;i-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n>7))^e]=e;for(t=i=0;!c[t];t^=n||1,i=f[i]||1)for(a=(a=i^i<<1^i<<2^i<<3^i<<4)>>8^255&a^99,c[t]=a,h[a]=t,o=16843009*p[r=p[n=p[t]]]^65537*r^257*n^16843008*t,s=257*p[a]^16843008*a,e=0;e<4;e++)u[e][t]=s=s<<24^s>>>8,d[e][a]=o=o<<24^o>>>8;for(e=0;e<5;e++)u[e]=u[e].slice(0),d[e]=d[e].slice(0);return l}()),this._tables=[[s[0][0].slice(),s[0][1].slice(),s[0][2].slice(),s[0][3].slice(),s[0][4].slice()],[s[1][0].slice(),s[1][1].slice(),s[1][2].slice(),s[1][3].slice(),s[1][4].slice()]];var r=this._tables[0][4],a=this._tables[1],o=e.length,l=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");var u=e.slice(0),d=[];for(this._key=[u,d],t=o;t<4*o+28;t++)n=u[t-1],(t%o==0||8===o&&t%o==4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],t%o==0&&(n=n<<8^n>>>24^l<<24,l=l<<1^283*(l>>7))),u[t]=u[t-o]^n;for(i=0;t;i++,t--)n=u[3&i?t:t-4],d[i]=t<=4||i<4?n:a[0][r[n>>>24]]^a[1][r[n>>16&255]]^a[2][r[n>>8&255]]^a[3][r[255&n]]}return e.prototype.decrypt=function(e,t,i,n,r,a){var s,o,l,u,d=this._key[1],c=e^d[0],h=n^d[1],p=i^d[2],f=t^d[3],m=d.length/4-2,g=4,_=this._tables[1],v=_[0],y=_[1],T=_[2],b=_[3],S=_[4];for(u=0;u>>24]^y[h>>16&255]^T[p>>8&255]^b[255&f]^d[g],o=v[h>>>24]^y[p>>16&255]^T[f>>8&255]^b[255&c]^d[g+1],l=v[p>>>24]^y[f>>16&255]^T[c>>8&255]^b[255&h]^d[g+2],f=v[f>>>24]^y[c>>16&255]^T[h>>8&255]^b[255&p]^d[g+3],g+=4,c=s,h=o,p=l;for(u=0;u<4;u++)r[(3&-u)+a]=S[c>>>24]<<24^S[h>>16&255]<<16^S[p>>8&255]<<8^S[255&f]^d[g++],s=c,c=h,h=p,p=f,f=s},e}(),l=function(e){function t(){var t;return(t=e.call(this,a)||this).jobs=[],t.delay=1,t.timeout_=null,t}r(t,e);var i=t.prototype;return i.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(a),u=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},d=function(){function e(t,i,n,r){var a=e.STEP,s=new Int32Array(t.buffer),o=new Uint8Array(t.byteLength),d=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(s.subarray(d,d+a),i,n,o)),d=a;d>2),m=new o(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),_=new Int32Array(g.buffer);for(n=i[0],r=i[1],a=i[2],s=i[3],p=0;p=0&&(t="main-desc"),t},stopLoaders=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},startLoaders=function(e,t){t.activePlaylistLoader=e,e.load()},onGroupChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.getActiveGroup(),l=a.activePlaylistLoader,u=a.lastGroup_;o&&u&&o.id===u.id||(a.lastGroup_=o,a.lastTrack_=s,stopLoaders(n,a),o&&!o.isMasterPlaylist&&(o.playlistLoader?(n.resyncLoader(),startLoaders(o.playlistLoader,a)):l&&r.resetEverything()))}},onGroupChanging=function(e,t){return function(){var i=t.segmentLoaders[e];t.mediaTypes[e].lastGroup_=null,i.abort(),i.pause()}},onTrackChanged=function(e,t){return function(){var i=t.masterPlaylistLoader,n=t.segmentLoaders,r=n[e],a=n.main,s=t.mediaTypes[e],o=s.activeTrack(),l=s.getActiveGroup(),u=s.activePlaylistLoader,d=s.lastTrack_;if((!d||!o||d.id!==o.id)&&(s.lastGroup_=l,s.lastTrack_=o,stopLoaders(r,s),l)){if(l.isMasterPlaylist){if(!o||!d||o.id===d.id)return;var c=t.vhs.masterPlaylistController_,h=c.selectPlaylist();if(c.media()===h)return;return s.logger_("track change. Switching master audio from "+d.id+" to "+o.id),i.pause(),a.resetEverything(),void c.fastQualityChange_(h)}if("AUDIO"===e){if(!l.playlistLoader)return a.setAudio(!0),void a.resetEverything();r.setAudio(!0),a.setAudio(!1)}u!==l.playlistLoader?(r.track&&r.track(o),r.resetEverything(),startLoaders(l.playlistLoader,s)):startLoaders(l.playlistLoader,s)}}},onError={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;stopLoaders(i,n);var a=n.activeTrack(),s=n.activeGroup(),o=(s.filter((function(e){return e.default}))[0]||s[0]).id,l=n.tracks[o];if(a!==l){for(var u in videojs.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[u].enabled=n.tracks[u]===l;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];videojs.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),stopLoaders(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},setupListeners={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",onError[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",onError[e](e,i))}},initialize={AUDIO:function(e,t){var i=t.vhs,n=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],l=o.groups,u=o.tracks,d=o.logger_,c=t.masterPlaylistLoader,h=isAudioOnly(c.master);for(var p in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}},h&&(s[e].main.default.playlists=c.master.playlists)),s[e])for(var f in l[p]||(l[p]=[]),s[e][p]){var m=s[e][p][f],g=void 0;if(h?(d("AUDIO group '"+p+"' label '"+f+"' is a master playlist"),m.isMasterPlaylist=!0,g=null):g="vhs-json"===n&&m.playlists?new PlaylistLoader(m.playlists[0],i,a):m.resolvedUri?new PlaylistLoader(m.resolvedUri,i,a):m.playlists&&"dash"===n?new DashPlaylistLoader(m.playlists[0],i,a,c):null,m=videojs.mergeOptions({id:f,playlistLoader:g},m),setupListeners[e](e,m.playlistLoader,t),l[p].push(m),void 0===u[f]){var _=new videojs.AudioTrack({id:f,kind:audioTrackKind_(m),enabled:!1,language:m.language,default:m.default,label:f});u[f]=_}}r.on("error",onError[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,l=t.mediaTypes[e],u=l.groups,d=l.tracks,c=t.masterPlaylistLoader;for(var h in o[e])for(var p in u[h]||(u[h]=[]),o[e][h])if(!o[e][h][p].forced){var f=o[e][h][p],m=void 0;if("hls"===r)m=new PlaylistLoader(f.resolvedUri,n,s);else if("dash"===r){if(!f.playlists.filter((function(e){return e.excludeUntil!==1/0})).length)return;m=new DashPlaylistLoader(f.playlists[0],n,s,c)}else"vhs-json"===r&&(m=new PlaylistLoader(f.playlists?f.playlists[0]:f.resolvedUri,n,s));if(f=videojs.mergeOptions({id:p,playlistLoader:m},f),setupListeners[e](e,f.playlistLoader,t),u[h].push(f),void 0===d[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;d[p]=g}}a.on("error",onError[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in n[e])for(var l in a[o]||(a[o]=[]),n[e][o]){var u=n[e][o][l];if(/^(?:CC|SERVICE)/.test(u.instreamId)){var d=i.options_.vhs&&i.options_.vhs.captionServices||{},c={label:l,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(d[c.instreamId]&&(c=videojs.mergeOptions(c,d[c.instreamId])),void 0===c.default&&delete c.default,a[o].push(videojs.mergeOptions({id:l},u)),void 0===s[l]){var h=i.addRemoteTextTrack({id:c.instreamId,kind:"captions",default:c.default,language:c.language,label:c.label},!1).track;s[l]=h}}}}},groupMatch=function e(t,i){for(var n=0;n1&&isAudioOnly(t.master))for(var l=0;l "+r.id;if(!t)return u(d+" as current playlist is not set"),!0;if(r.id===t.id)return!1;var c=Boolean(findRange(i,n).length);if(!t.endList)return c||"number"!=typeof t.partTargetDuration?(u(d+" as current playlist is live"),!0):(u("not "+d+" as current playlist is live llhls, but currentTime isn't in buffered."),!1);var h=timeAheadOf(i,n),p=l?Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Config.MAX_BUFFER_LOW_WATER_LINE;if(om)&&h>=a){var _=d+" as forwardBuffer >= bufferLowWaterLine ("+h+" >= "+a+")";return l&&(_+=" and next bandwidth > current bandwidth ("+f+" > "+m+")"),u(_),!0}return u("not "+d+" as no switching criteria met"),!1},MasterPlaylistController=function(e){function t(t){var i;i=e.call(this)||this;var n=t.src,r=t.handleManifestRedirects,a=t.withCredentials,s=t.tech,o=t.bandwidth,l=t.externVhs,u=t.useCueTags,d=t.blacklistDuration,c=t.enableLowInitialPlaylist,h=t.sourceType,p=t.cacheEncryptionKeys,f=t.experimentalBufferBasedABR,m=t.experimentalLeastPixelDiffSelector,g=t.captionServices;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");var _=t.maxPlaylistRetries;null==_&&(_=1/0),Vhs$1=l,i.experimentalBufferBasedABR=Boolean(f),i.experimentalLeastPixelDiffSelector=Boolean(m),i.withCredentials=a,i.tech_=s,i.vhs_=s.vhs,i.sourceType_=h,i.useCueTags_=u,i.blacklistDuration=d,i.maxPlaylistRetries=_,i.enableLowInitialPlaylist=c,i.useCueTags_&&(i.cueTagsTrack_=i.tech_.addTextTrack("metadata","ad-cues"),i.cueTagsTrack_.inBandMetadataTrackDispatchType=""),i.requestOptions_={withCredentials:a,handleManifestRedirects:r,maxPlaylistRetries:_,timeout:null},i.on("error",i.pauseLoading),i.mediaTypes_=createMediaTypes(),i.mediaSource=new window__default.default.MediaSource,i.handleDurationChange_=i.handleDurationChange_.bind(_assertThisInitialized__default.default(i)),i.handleSourceOpen_=i.handleSourceOpen_.bind(_assertThisInitialized__default.default(i)),i.handleSourceEnded_=i.handleSourceEnded_.bind(_assertThisInitialized__default.default(i)),i.mediaSource.addEventListener("durationchange",i.handleDurationChange_),i.mediaSource.addEventListener("sourceopen",i.handleSourceOpen_),i.mediaSource.addEventListener("sourceended",i.handleSourceEnded_),i.seekable_=videojs.createTimeRanges(),i.hasPlayed_=!1,i.syncController_=new SyncController(t),i.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,i.decrypter_=new Decrypter,i.sourceUpdater_=new SourceUpdater(i.mediaSource),i.inbandTextTracks_={},i.timelineChangeController_=new TimelineChangeController;var v={vhs:i.vhs_,parse708captions:t.parse708captions,useDtsForTimestampOffset:t.useDtsForTimestampOffset,captionServices:g,mediaSource:i.mediaSource,currentTime:i.tech_.currentTime.bind(i.tech_),seekable:function(){return i.seekable()},seeking:function(){return i.tech_.seeking()},duration:function(){return i.duration()},hasPlayed:function(){return i.hasPlayed_},goalBufferLength:function(){return i.goalBufferLength()},bandwidth:o,syncController:i.syncController_,decrypter:i.decrypter_,sourceType:i.sourceType_,inbandTextTracks:i.inbandTextTracks_,cacheEncryptionKeys:p,sourceUpdater:i.sourceUpdater_,timelineChangeController:i.timelineChangeController_,experimentalExactManifestTimings:t.experimentalExactManifestTimings};i.masterPlaylistLoader_="dash"===i.sourceType_?new DashPlaylistLoader(n,i.vhs_,i.requestOptions_):new PlaylistLoader(n,i.vhs_,i.requestOptions_),i.setupMasterPlaylistLoaderListeners_(),i.mainSegmentLoader_=new SegmentLoader(videojs.mergeOptions(v,{segmentMetadataTrack:i.segmentMetadataTrack_,loaderType:"main"}),t),i.audioSegmentLoader_=new SegmentLoader(videojs.mergeOptions(v,{loaderType:"audio"}),t),i.subtitleSegmentLoader_=new VTTSegmentLoader(videojs.mergeOptions(v,{loaderType:"vtt",featuresNativeTextTracks:i.tech_.featuresNativeTextTracks}),t),i.setupSegmentLoaderListeners_(),i.experimentalBufferBasedABR&&(i.masterPlaylistLoader_.one("loadedplaylist",(function(){return i.startABRTimer_()})),i.tech_.on("pause",(function(){return i.stopABRTimer_()})),i.tech_.on("play",(function(){return i.startABRTimer_()}))),loaderStats.forEach((function(e){i[e+"_"]=sumLoaderStat.bind(_assertThisInitialized__default.default(i),e)})),i.logger_=logger("MPC"),i.triggeredFmp4Usage=!1,"none"===i.tech_.preload()?(i.loadOnPlay_=function(){i.loadOnPlay_=null,i.masterPlaylistLoader_.load()},i.tech_.one("play",i.loadOnPlay_)):i.masterPlaylistLoader_.load(),i.timeToLoadedData__=-1,i.mainAppendsToLoadedData__=-1,i.audioAppendsToLoadedData__=-1;var y="none"===i.tech_.preload()?"play":"loadstart";return i.tech_.one(y,(function(){var e=Date.now();i.tech_.one("loadeddata",(function(){i.timeToLoadedData__=Date.now()-e,i.mainAppendsToLoadedData__=i.mainSegmentLoader_.mediaAppends,i.audioAppendsToLoadedData__=i.audioSegmentLoader_.mediaAppends}))})),i}_inheritsLoose__default.default(t,e);var i=t.prototype;return i.mainAppendsToLoadedData_=function(){return this.mainAppendsToLoadedData__},i.audioAppendsToLoadedData_=function(){return this.audioAppendsToLoadedData__},i.appendsToLoadedData_=function(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t},i.timeToLoadedData_=function(){return this.timeToLoadedData__},i.checkABR_=function(){var e=this.selectPlaylist();e&&this.shouldSwitchToMedia_(e)&&this.switchMedia_(e,"abr")},i.switchMedia_=function(e,t,i){var n=this.media(),r=n&&(n.id||n.uri),a=e.id||e.uri;r&&r!==a&&(this.logger_("switch media "+r+" -> "+a+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,i)},i.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=window__default.default.setInterval((function(){return e.checkABR_()}),250)},i.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window__default.default.clearInterval(this.abrTimer_),this.abrTimer_=null)},i.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var i,n=e.mediaGroups.AUDIO,r=Object.keys(n);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{var a=n.main||r.length&&n[r[0]];for(var s in a)if(a[s].default){i={label:s};break}}if(!i)return t;var o=[];for(var l in n)if(n[l][i.label]){var u=n[l][i.label];if(u.playlists&&u.playlists.length)o.push.apply(o,u.playlists);else if(u.uri)o.push(u);else if(e.playlists.length)for(var d=0;d1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},i.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine(),a=this.tech_.buffered();return shouldSwitchToMedia({buffered:a,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},i.setupSegmentLoaderListeners_=function(){var e=this;this.experimentalBufferBasedABR||(this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist();e.shouldSwitchToMedia_(t)&&e.switchMedia_(t,"bandwidthupdate"),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")}))),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("appenderror",(function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("ended",(function(){e.logger_("main segment loader ended"),e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(t){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},ABORT_EARLY_BLACKLIST_SECONDS))}));var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()}))},i.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},i.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},i.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},i.fastQualityChange_=function(e){var t=this;void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((function(){videojs.browser.IE_VERSION||videojs.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")},i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()this.maxPlaylistRetries?1/0:Date.now()+1e3*t,i.excludeUntil=n,e.reason&&(i.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var l=this.selectPlaylist();if(!l)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var u=e.internal?this.logger_:videojs.log.warn,d=e.message?" "+e.message:"";u((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+d+" Switching to playlist "+l.id+"."),l.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),l.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var c=l.targetDuration/2*1e3||5e3,h="number"==typeof l.lastRequest&&Date.now()-l.lastRequest<=c;return this.switchMedia_(l,"exclude",s||h)},i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},i.delegateLoaders_=function(e,t){var i=this,n=[],r="all"===e;(r||"main"===e)&&n.push(this.masterPlaylistLoader_);var a=[];(r||"audio"===e)&&a.push("AUDIO"),(r||"subtitle"===e)&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach((function(e){var t=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader;t&&n.push(t)})),["main","audio","subtitle"].forEach((function(t){var r=i[t+"SegmentLoader_"];!r||e!==t&&"all"!==e||n.push(r)})),n.forEach((function(e){return t.forEach((function(t){"function"==typeof e[t]&&e[t]()}))}))},i.setCurrentTime=function(e){var t=findRange(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0},i.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Vhs$1.Playlist.duration(e):1/0:0},i.seekable=function(){return this.seekable_},i.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n=this.masterPlaylistLoader_.master,r=Vhs$1.Playlist.seekable(t,i,Vhs$1.Playlist.liveEdgeDelay(n,t));if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=Vhs$1.Playlist.seekable(t,i,Vhs$1.Playlist.liveEdgeDelay(n,t))).length)return}var a,s;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),s=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=videojs.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)0&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}},i.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()},i.master=function(){return this.masterPlaylistLoader_.master},i.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},i.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)},i.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};t.video=t.main;var i=codecsForPlaylist(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||codecs_js.DEFAULT_VIDEO_CODEC),t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||codecs_js.DEFAULT_AUDIO_CODEC)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r)&&(n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||codecs_js.DEFAULT_AUDIO_CODEC,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),n.audio||n.video){var a,s={};if(["video","audio"].forEach((function(e){if(n.hasOwnProperty(e)&&(r=t[e].isFmp4,o=n[e],!(r?codecs_js.browserSupportsCodec(o):codecs_js.muxerSupportsCodec(o)))){var i=t[e].isFmp4?"browser":"muxer";s[i]=s[i]||[],s[i].push(n[e]),"audio"===e&&(a=i)}var r,o})),r&&a&&this.media().attributes.AUDIO){var o=this.media().attributes.AUDIO;this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===o&&t!==e.media()&&(t.excludeUntil=1/0)})),this.logger_("excluding audio group "+o+" as "+a+' does not support codec(s): "'+n.audio+'"')}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var l=[];if(["video","audio"].forEach((function(t){var i=(codecs_js.parseCodecs(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(codecs_js.parseCodecs(n[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&l.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+n[t]+'"')})),l.length)return void this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+l.join(", ")+".",blacklistDuration:1/0,internal:!0})}return n}var u=Object.keys(s).reduce((function(e,t){return e&&(e+=", "),e+(t+' does not support codec(s): "')+s[t].join(",")+'"'}),"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:u,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},i.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}},i.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,i=[];Object.keys(t).forEach((function(n){var r=t[n];if(-1===i.indexOf(r.id)){i.push(r.id);var a=codecsForPlaylist(e.master,r),s=[];!a.audio||codecs_js.muxerSupportsCodec(a.audio)||codecs_js.browserSupportsCodec(a.audio)||s.push("audio codec "+a.audio),!a.video||codecs_js.muxerSupportsCodec(a.video)||codecs_js.browserSupportsCodec(a.video)||s.push("video codec "+a.video),a.text&&"stpp.ttml.im1t"===a.text&&s.push("text codec "+a.text),s.length&&(r.excludeUntil=1/0,e.logger_("excluding "+r.id+" for unsupported: "+s.join(", ")))}}))},i.excludeIncompatibleVariants_=function(e){var t=this,i=[],n=this.master().playlists,r=unwrapCodecList(codecs_js.parseCodecs(e)),a=codecCount(r),s=r.video&&codecs_js.parseCodecs(r.video)[0]||null,o=r.audio&&codecs_js.parseCodecs(r.audio)[0]||null;Object.keys(n).forEach((function(e){var r=n[e];if(-1===i.indexOf(r.id)&&r.excludeUntil!==1/0){i.push(r.id);var l=[],u=codecsForPlaylist(t.masterPlaylistLoader_.master,r),d=codecCount(u);if(u.audio||u.video){if(d!==a&&l.push('codec count "'+d+'" !== "'+a+'"'),!t.sourceUpdater_.canChangeType()){var c=u.video&&codecs_js.parseCodecs(u.video)[0]||null,h=u.audio&&codecs_js.parseCodecs(u.audio)[0]||null;c&&s&&c.type.toLowerCase()!==s.type.toLowerCase()&&l.push('video codec "'+c.type+'" !== "'+s.type+'"'),h&&o&&h.type.toLowerCase()!==o.type.toLowerCase()&&l.push('audio codec "'+h.type+'" !== "'+o.type+'"')}l.length&&(r.excludeUntil=1/0,t.logger_("blacklisting "+r.id+": "+l.join(" && ")))}}}))},i.updateAdCues_=function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),updateAdCues(e,this.cueTagsTrack_,t)},i.goalBufferLength=function(){var e=this.tech_.currentTime(),t=Config.GOAL_BUFFER_LENGTH,i=Config.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Config.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)},i.bufferLowWaterLine=function(){var e=this.tech_.currentTime(),t=Config.BUFFER_LOW_WATER_LINE,i=Config.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Config.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.experimentalBufferBasedABR?r:n)},i.bufferHighWaterLine=function(){return Config.BUFFER_HIGH_WATER_LINE},t}(videojs.EventTarget),enableFunction=function(e,t,i){return function(n){var r=e.master.playlists[t],a=isIncompatible(r),s=isEnabled(r);return void 0===n?s:(n?delete r.disabled:r.disabled=!0,n===s||a||(i(),n?e.trigger("renditionenabled"):e.trigger("renditiondisabled")),n)}},Representation=function(e,t,i){var n=e.masterPlaylistController_,r=n[(e.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(n);if(t.attributes){var a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH}this.codecs=codecsForPlaylist(n.master(),t),this.playlist=t,this.id=i,this.enabled=enableFunction(e.playlists,t.id,r)},renditionSelectionMixin=function(e){e.representations=function(){var t=e.masterPlaylistController_.master(),i=isAudioOnly(t)?e.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((function(e){return!isIncompatible(e)})).map((function(t,i){return new Representation(e,t,t.id)})):[]}},timerCancelEvents=["seeking","seeked","pause","playing","error"],PlaybackWatcher=function(){function e(e){var t=this;this.masterPlaylistController_=e.masterPlaylistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=logger("PlaybackWatcher"),this.logger_("initialize");var i=function(){return t.monitorCurrentTime_()},n=function(){return t.monitorCurrentTime_()},r=function(){return t.techWaiting_()},a=function(){return t.cancelTimer_()},s=this.masterPlaylistController_,o=["main","subtitle","audio"],l={};o.forEach((function(e){l[e]={reset:function(){return t.resetSegmentDownloads_(e)},updateend:function(){return t.checkSegmentDownloads_(e)}},s[e+"SegmentLoader_"].on("appendsdone",l[e].updateend),s[e+"SegmentLoader_"].on("playlistupdate",l[e].reset),t.tech_.on(["seeked","seeking"],l[e].reset)}));var u=function(e){["main","audio"].forEach((function(i){s[i+"SegmentLoader_"][e]("appended",t.seekingAppendCheck_)}))};this.seekingAppendCheck_=function(){t.fixesBadSeeks_()&&(t.consecutiveUpdates=0,t.lastRecordedTime=t.tech_.currentTime(),u("off"))},this.clearSeekingAppendCheck_=function(){return u("off")},this.watchForBadSeeking_=function(){t.clearSeekingAppendCheck_(),u("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(timerCancelEvents,a),this.tech_.on("canplay",n),this.tech_.one("play",i),this.dispose=function(){t.clearSeekingAppendCheck_(),t.logger_("dispose"),t.tech_.off("waiting",r),t.tech_.off(timerCancelEvents,a),t.tech_.off("canplay",n),t.tech_.off("play",i),t.tech_.off("seeking",t.watchForBadSeeking_),t.tech_.off("seeked",t.clearSeekingAppendCheck_),o.forEach((function(e){s[e+"SegmentLoader_"].off("appendsdone",l[e].updateend),s[e+"SegmentLoader_"].off("playlistupdate",l[e].reset),t.tech_.off(["seeked","seeking"],l[e].reset)})),t.checkCurrentTimeTimeout_&&window__default.default.clearTimeout(t.checkCurrentTimeTimeout_),t.cancelTimer_()}}var t=e.prototype;return t.monitorCurrentTime_=function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window__default.default.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window__default.default.setTimeout(this.monitorCurrentTime_.bind(this),250)},t.resetSegmentDownloads_=function(e){var t=this.masterPlaylistController_[e+"SegmentLoader_"];this[e+"StalledDownloads_"]>0&&this.logger_("resetting possible stalled download count for "+e+" loader"),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=isRangeDifferent(this[e+"Buffered_"],n);this[e+"Buffered_"]=n,r?this.resetSegmentDownloads_(e):(this[e+"StalledDownloads_"]++,this.logger_("found #"+this[e+"StalledDownloads_"]+" "+e+" appends that did not increase buffer (possible stalled download)",{playlistId:i.playlist_&&i.playlist_.id,buffered:timeRangesToArray(n)}),this[e+"StalledDownloads_"]<10||(this.logger_(e+" loader stalled download exclusion"),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:"vhs-"+e+"-download-exclusion"}),"subtitle"!==e&&t.blacklistCurrentPlaylist({message:"Excessive "+e+" segment downloading detected."},1/0)))},t.checkCurrentTime_=function(){if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+SAFE_TIME_DELTA>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),i=this.tech_.currentTime();if(this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){var n=t.start(0);e=n+(n===t.end(0)?0:SAFE_TIME_DELTA)}if(void 0!==e)return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+printableRange(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;for(var r=this.masterPlaylistController_.sourceUpdater_,a=this.tech_.buffered(),s=r.audioBuffer?r.audioBuffered():null,o=r.videoBuffer?r.videoBuffered():null,l=this.media(),u=l.partTargetDuration?l.partTargetDuration:2*(l.targetDuration-TIME_FUDGE_FACTOR),d=[s,o],c=0;c "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"}),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;var a=findNextRange(r,t);if(a.length>0){var s=a.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+a.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1},t.afterSeekableWindow_=function(e,t,i,n){if(void 0===n&&(n=!1),!e.length)return!1;var r=e.end(e.length-1)+SAFE_TIME_DELTA;return!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:a}}return null},e}(),defaultOptions={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},initPlugin=function e(t,i){var n=0,r=0,a=videojs.mergeOptions(defaultOptions,i);t.ready((function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})}));var s=function(){r&&t.currentTime(r)},o=function(e){null!=e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},l=function(){return Date.now()-n<1e3*a.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):a.getSource&&"function"==typeof a.getSource?(n=Date.now(),a.getSource.call(t,o)):void videojs.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},u=function e(){t.off("loadedmetadata",s),t.off("error",l),t.off("dispose",e)};t.on("error",l),t.on("dispose",u),t.reloadSourceOnError=function(i){u(),e(t,i)}},reloadSourceOnError=function(e){initPlugin(this,e)},version$4="2.14.2",version$3="6.0.1",version$2="0.21.1",version$1="4.7.1",version="3.1.3",Vhs={PlaylistLoader:PlaylistLoader,Playlist:Playlist,utils:utils,STANDARD_PLAYLIST_SELECTOR:lastBandwidthSelector,INITIAL_PLAYLIST_SELECTOR:lowestBitrateCompatibleVariantSelector,lastBandwidthSelector:lastBandwidthSelector,movingAverageBandwidthSelector:movingAverageBandwidthSelector,comparePlaylistBandwidth:comparePlaylistBandwidth,comparePlaylistResolution:comparePlaylistResolution,xhr:xhrFactory()};Object.keys(Config).forEach((function(e){Object.defineProperty(Vhs,e,{get:function(){return videojs.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),Config[e]},set:function(t){videojs.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?videojs.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):Config[e]=t}})}));var LOCAL_STORAGE_KEY="videojs-vhs",handleVhsMediaChange=function(e,t){for(var i=t.media(),n=-1,r=0;r=i&&e>=i?Math.max(e,n):n}return e},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){videojs.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return i.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return i.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return i.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return timeRangesToArray(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return timeRangesToArray(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&updateVhsLocalStorage({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){renditionSelectionMixin(i)})),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",(function(){i.setupEme_()})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.masterPlaylistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=window__default.default.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},i.createKeySessions_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),waitForKeySessionCreation({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.master.playlists}).then((function(){e.logger_("created EME key session"),e.masterPlaylistController_.sourceUpdater_.initializedEme()})).catch((function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})}))},i.handleWaitingForKey_=function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()},i.setupEme_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,i=setupEmeOptions({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});this.player_.tech_.on("keystatuschange",(function(t){"output-restricted"===t.status&&e.masterPlaylistController_.blacklistCurrentPlaylist({playlist:e.masterPlaylistController_.media(),message:"DRM keystatus changed to "+t.status+". Playlist will fail to play. Check for HDCP content.",blacklistDuration:1/0})})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==videojs.browser.IE_VERSION&&i?this.createKeySessions_():this.masterPlaylistController_.sourceUpdater_.initializedEme()},i.setupQualityLevels_=function(){var e=this,t=videojs.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){handleVhsLoadedMetadata(e.qualityLevels_,e)})),this.playlists.on("mediachange",(function(){handleVhsMediaChange(e.qualityLevels_,e.playlists)})))},t.version=function(){return{"@videojs/http-streaming":version$4,"mux.js":version$3,"mpd-parser":version$2,"m3u8-parser":version$1,"aes-decrypter":version}},i.version=function(){return this.constructor.version()},i.canChangeType=function(){return SourceUpdater.canChangeType()},i.play=function(){this.masterPlaylistController_.play()},i.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},i.duration=function(){return this.masterPlaylistController_.duration()},i.seekable=function(){return this.masterPlaylistController_.seekable()},i.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&window__default.default.URL.revokeObjectURL&&(window__default.default.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),e.prototype.dispose.call(this)},i.convertToProgramTime=function(e,t){return getProgramTime({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},i.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),seekToProgramTime({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},t}(Component),VhsSourceHandler={name:"videojs-http-streaming",VERSION:version$4,canHandleSource:function(e,t){void 0===t&&(t={});var i=videojs.mergeOptions(videojs.options,t);return VhsSourceHandler.canPlayType(e.type,i)},handleSource:function(e,t,i){void 0===i&&(i={});var n=videojs.mergeOptions(videojs.options,i);return t.vhs=new VhsHandler(e,t,n),videojs.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return videojs.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=xhrFactory(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){void 0===t&&(t={});var i=videojs.mergeOptions(videojs.options,t),n=i.vhs,r=(n=void 0===n?{}:n).overrideNative,a=void 0===r?!videojs.browser.IS_ANY_SAFARI:r,s=i.hls,o=(s=void 0===s?{}:s).overrideNative,l=void 0!==o&&o,u=mediaTypes_js.simpleTypeFromSourceType(e);return u&&(!Vhs.supportsTypeNatively(u)||l||a)?"maybe":""}},supportsNativeMediaSources=function(){return codecs_js.browserSupportsCodec("avc1.4d400d,mp4a.40.2")};if(supportsNativeMediaSources()&&videojs.getTech("Html5").registerSourceHandler(VhsSourceHandler,0),videojs.VhsHandler=VhsHandler,Object.defineProperty(videojs,"HlsHandler",{get:function(){return videojs.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),VhsHandler},configurable:!0}),videojs.VhsSourceHandler=VhsSourceHandler,Object.defineProperty(videojs,"HlsSourceHandler",{get:function(){return videojs.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),VhsSourceHandler},configurable:!0}),videojs.Vhs=Vhs,Object.defineProperty(videojs,"Hls",{get:function(){return videojs.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),Vhs},configurable:!0}),videojs.use||(videojs.registerComponent("Hls",Vhs),videojs.registerComponent("Vhs",Vhs)),videojs.options.vhs=videojs.options.vhs||{},videojs.options.hls=videojs.options.hls||{},!videojs.getPlugin||!videojs.getPlugin("reloadSourceOnError")){var registerPlugin=videojs.registerPlugin||videojs.plugin;registerPlugin("reloadSourceOnError",reloadSourceOnError)}module.exports=videojs;