!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.videojs=e()}(this,function(){function t(t,e){Ee(t).forEach(function(r){return e(t[r],r)})}function e(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ee(t).reduce(function(r,n){return e(r,t[n],n)},r)}function r(e){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments[3],i=Gt.createElement(t);return Object.getOwnPropertyNames(e).forEach(function(t){var r=e[t];-1!==t.indexOf("aria-")||"role"===t||"type"===t?(xe.warn(Pe(Ae,t,r)),i.setAttribute(t,r)):"textContent"===t?y(i,r):i[t]=r}),Object.getOwnPropertyNames(r).forEach(function(t){i.setAttribute(t,r[t])}),n&&D(i,n),i}function y(t,e){return void 0===t.textContent?t.innerText=e:t.textContent=e,t}function g(t,e){e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}function m(t,e){return c(e),t.classList?t.classList.contains(e):u(e).test(t.className)}function _(t,e){return t.classList?t.classList.add(e):m(t,e)||(t.className=(t.className+" "+e).trim()),t}function b(t,e){return t.classList?t.classList.remove(e):(c(e),t.className=t.className.split(/\s+/).filter(function(t){return t!==e}).join(" ")),t}function T(t,e,r){var n=m(t,e);if("function"==typeof r&&(r=r(t,e)),"boolean"!=typeof r&&(r=!n),r!==n)return r?_(t,e):b(t,e),t}function C(t,e){Object.getOwnPropertyNames(e).forEach(function(r){var n=e[r];null===n||void 0===n||!1===n?t.removeAttribute(r):t.setAttribute(r,!0===n?"":n)})}function k(t){var e={};if(t&&t.attributes&&t.attributes.length>0)for(var r=t.attributes,n=r.length-1;n>=0;n--){var i=r[n].name,o=r[n].value;"boolean"!=typeof t[i]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+i+",")||(o=null!==o),e[i]=o}return e}function E(t,e){return t.getAttribute(e)}function S(t,e,r){t.setAttribute(e,r)}function w(t,e){t.removeAttribute(e)}function x(){Gt.body.focus(),Gt.onselectstart=function(){return!1}}function j(){Gt.onselectstart=function(){return!0}}function P(t){if(t&&t.getBoundingClientRect&&t.parentNode){var e=t.getBoundingClientRect(),r={};return["bottom","height","left","right","top","width"].forEach(function(t){void 0!==e[t]&&(r[t]=e[t])}),r.height||(r.height=parseFloat(a(t,"height"))),r.width||(r.width=parseFloat(a(t,"width"))),r}}function A(t){var e=void 0;if(t.getBoundingClientRect&&t.parentNode&&(e=t.getBoundingClientRect()),!e)return{left:0,top:0};var r=Gt.documentElement,n=Gt.body,i=r.clientLeft||n.clientLeft||0,o=Wt.pageXOffset||n.scrollLeft,s=e.left+o-i,a=r.clientTop||n.clientTop||0,l=Wt.pageYOffset||n.scrollTop,c=e.top+l-a;return{left:Math.round(s),top:Math.round(c)}}function O(t,e){var r={},n=A(t),i=t.offsetWidth,o=t.offsetHeight,s=n.top,a=n.left,l=e.pageY,c=e.pageX;return e.changedTouches&&(c=e.changedTouches[0].pageX,l=e.changedTouches[0].pageY),r.y=Math.max(0,Math.min(1,(s-l+o)/o)),r.x=Math.max(0,Math.min(1,(c-a)/i)),r}function M(t){return n(t)&&3===t.nodeType}function N(t){for(;t.firstChild;)t.removeChild(t.firstChild);return t}function I(t){return"function"==typeof t&&(t=t()),(Array.isArray(t)?t:[t]).map(function(t){return"function"==typeof t&&(t=t()),p(t)||M(t)?t:"string"==typeof t&&/\S/.test(t)?Gt.createTextNode(t):void 0}).filter(function(t){return t})}function D(t,e){return I(e).forEach(function(e){return t.appendChild(e)}),t}function L(t,e){return D(N(t),e)}function R(t){return void 0===t.button&&void 0===t.buttons||(0===t.button&&void 0===t.buttons||(9===pe||0===t.button&&1===t.buttons))}function F(){return Ie++}function B(t){var e=t[Le];return e||(e=t[Le]=F()),De[e]||(De[e]={}),De[e]}function H(t){var e=t[Le];return!!e&&!!Object.getOwnPropertyNames(De[e]).length}function V(t){var e=t[Le];if(e){delete De[e];try{delete t[Le]}catch(e){t.removeAttribute?t.removeAttribute(Le):t[Le]=null}}}function z(t,e){var r=B(t);0===r.handlers[e].length&&(delete r.handlers[e],t.removeEventListener?t.removeEventListener(e,r.dispatcher,!1):t.detachEvent&&t.detachEvent("on"+e,r.dispatcher)),Object.getOwnPropertyNames(r.handlers).length<=0&&(delete r.handlers,delete r.dispatcher,delete r.disabled),0===Object.getOwnPropertyNames(r).length&&V(t)}function W(t,e,r,n){r.forEach(function(r){t(e,r,n)})}function U(t){function e(){return!0}function r(){return!1}if(!t||!t.isPropagationStopped){var n=t||Wt.event;t={};for(var i in n)"layerX"!==i&&"layerY"!==i&&"keyLocation"!==i&&"webkitMovementX"!==i&&"webkitMovementY"!==i&&("returnValue"===i&&n.preventDefault||(t[i]=n[i]));if(t.target||(t.target=t.srcElement||Gt),t.relatedTarget||(t.relatedTarget=t.fromElement===t.target?t.toElement:t.fromElement),t.preventDefault=function(){n.preventDefault&&n.preventDefault(),t.returnValue=!1,n.returnValue=!1,t.defaultPrevented=!0},t.defaultPrevented=!1,t.stopPropagation=function(){n.stopPropagation&&n.stopPropagation(),t.cancelBubble=!0,n.cancelBubble=!0,t.isPropagationStopped=e},t.isPropagationStopped=r,t.stopImmediatePropagation=function(){n.stopImmediatePropagation&&n.stopImmediatePropagation(),t.isImmediatePropagationStopped=e,t.stopPropagation()},t.isImmediatePropagationStopped=r,null!==t.clientX&&void 0!==t.clientX){var o=Gt.documentElement,s=Gt.body;t.pageX=t.clientX+(o&&o.scrollLeft||s&&s.scrollLeft||0)-(o&&o.clientLeft||s&&s.clientLeft||0),t.pageY=t.clientY+(o&&o.scrollTop||s&&s.scrollTop||0)-(o&&o.clientTop||s&&s.clientTop||0)}t.which=t.charCode||t.keyCode,null!==t.button&&void 0!==t.button&&(t.button=1&t.button?0:4&t.button?1:2&t.button?2:0)}return t}function q(t,e,r){if(Array.isArray(e))return W(q,t,e,r);var n=B(t);if(n.handlers||(n.handlers={}),n.handlers[e]||(n.handlers[e]=[]),r.guid||(r.guid=F()),n.handlers[e].push(r),n.dispatcher||(n.disabled=!1,n.dispatcher=function(e,r){if(!n.disabled){e=U(e);var i=n.handlers[e.type];if(i)for(var o=i.slice(0),s=0,a=o.length;s-1&&(i={passive:!0}),t.addEventListener(e,n.dispatcher,i)}else t.attachEvent&&t.attachEvent("on"+e,n.dispatcher)}function K(t,e,r){if(H(t)){var n=B(t);if(n.handlers){if(Array.isArray(e))return W(K,t,e,r);var i=function(t,e){n.handlers[e]=[],z(t,e)};if(void 0!==e){var o=n.handlers[e];if(o){if(!r)return void i(t,e);if(r.guid)for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:{},n=e.eventBusKey;if(n){if(!t[n].nodeName)throw new Error('The eventBusKey "'+n+'" does not refer to an element.');t.eventBusEl_=t[n]}else t.eventBusEl_=v("span",{className:"vjs-event-bus"});return r(t,rr),t.on("dispose",function(){t.off(),Wt.setTimeout(function(){t.eventBusEl_=null},0)}),t}function J(t,e){return r(t,nr),t.state=r({},t.state,e),"function"==typeof t.handleStateChanged&&$e(t)&&t.on("statechanged",t.handleStateChanged),t}function Q(t){return"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.slice(1)}function Z(t,e){return Q(t)===Q(e)}function tt(){for(var e={},r=arguments.length,n=Array(r),o=0;or)throw new Error("Failed to execute '"+t+"' on 'TimeRanges': The index provided ("+e+") is non-numeric or out of bounds (0-"+r+").")}function rt(t,e,r,n){return et(t,n,r.length-1),r[n][e]}function nt(t){return void 0===t||0===t.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:t.length,start:rt.bind(null,"start",0,t),end:rt.bind(null,"end",1,t)}}function it(t,e){return Array.isArray(t)?nt(t):void 0===t||void 0===e?nt():nt([[t,e]])}function ot(t,e){var r=0,n=void 0,i=void 0;if(!e)return 0;t&&t.length||(t=it(0,0));for(var o=0;oe&&(i=e),r+=i-n;return r/e}function st(t){if(t instanceof st)return t;"number"==typeof t?this.code=t:"string"==typeof t?this.message=t:n(t)&&("number"==typeof t.code&&(this.code=t.code),r(this,t)),this.message||(this.message=st.defaultMessages[this.code]||"")}function at(t,e){var r,n=null;try{r=JSON.parse(t,e)}catch(t){n=t}return[n,r]}function lt(t){return void 0!==t&&null!==t&&"function"==typeof t.then}function ct(t){lt(t)&&t.then(null,function(t){})}function ut(t){var e=Br.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}function ht(){for(var t={},e=0;e0&&(u=setTimeout(function(){if(!c){c=!0,a.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",n(t)}},t.timeout)),a.setRequestHeader)for(l in f)f.hasOwnProperty(l)&&a.setRequestHeader(l,f[l]);else if(t.headers&&!pt(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(a.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(a),a.send(d||null),a}function yt(t){if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;return""!==t.responseType||e?null:t.responseXML}function gt(){}function mt(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=t.textTracks();i.kind=e,r&&(i.label=r),n&&(i.language=n),i.tech=t;var s=new gn.text.TrackClass(i);return o.addTrack(s),s}function _t(t,e){bn[t]=bn[t]||[],bn[t].push(e)}function bt(t,e,r){t.setTimeout(function(){return Pt(e,bn[e.type],r,t)},1)}function Tt(t,e){t.forEach(function(t){return t.setTech&&t.setTech(e)})}function Ct(t,e,r){return t.reduceRight(St(r),e[r]())}function kt(t,e,r,n){return e[r](t.reduce(St(r),n))}function Et(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i="call"+Q(r),o=t.reduce(St(i),n),s=o===Cn,a=s?null:e[r](o);return wt(t,r,a,s),a}function St(t){return function(e,r){return e===Cn?Cn:r[t]?r[t](e):e}}function wt(t,e,r,n){for(var i=t.length-1;i>=0;i--){var o=t[i];o[e]&&o[e](n,r)}}function xt(t){Tn[t.id()]=null}function jt(t,e){var r=Tn[t.id()],n=null;if(void 0===r||null===r)return n=e(t),Tn[t.id()]=[[e,n]],n;for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments[2],i=arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=e[0],l=e.slice(1);if("string"==typeof a)Pt(t,bn[a],n,i,o,s);else if(a){var c=jt(i,a);if(!c.setSource)return o.push(c),Pt(t,l,n,i,o,s);c.setSource(r({},t),function(e,r){if(e)return Pt(t,l,n,i,o,s);o.push(c),Pt(r,t.type===r.type?l:bn[r.type],n,i,o,s)})}else l.length?Pt(t,l,n,i,o,s):s?n(t,o):Pt(t,bn["*"],n,i,o,!0)}function At(t){var e=xn(t.src);return!t.type&&e&&(t.type=e),t}function Ot(t,e){var r=void 0;if(4===t.length)r=t[1]+t[1]+t[2]+t[2]+t[3]+t[3];else{if(7!==t.length)throw new Error("Invalid color code provided, "+t+"; must be formatted as e.g. #f0e or #f604e2.");r=t.slice(1)}return"rgba("+parseInt(r.slice(0,2),16)+","+parseInt(r.slice(2,4),16)+","+parseInt(r.slice(4,6),16)+","+e+")"}function Mt(t,e,r){try{t.style[e]=r}catch(t){return}}function Nt(t){Vn=t}function It(){Vn=Hn}function Dt(t,e){if(e&&(t=e(t)),t&&"none"!==t)return t}function Lt(t,e){return Dt(t.options[t.options.selectedIndex].value,e)}function Rt(t,e,r){if(e)for(var n=0;n0)for(var i=0,o=t.length;i0)for(var s=0,a=e.length;s0)for(var l=0,c=r.length;l0)for(var u=0,p=n.length;u=e&&(t.apply(void 0,arguments),r=n)}},Xe=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Wt,i=void 0,o=function(){n.clearTimeout(i),i=null},s=function(){var o=this,s=arguments,a=function(){i=null,a=null,r||t.apply(o,s)};!i&&r&&t.apply(o,s),n.clearTimeout(i),i=n.setTimeout(a,e)};return s.cancel=o,s},Ge=function(){};Ge.prototype.allowedEvents_={},Ge.prototype.on=function(t,e){var r=this.addEventListener;this.addEventListener=function(){},q(this,t,e),this.addEventListener=r},Ge.prototype.addEventListener=Ge.prototype.on,Ge.prototype.off=function(t,e){K(this,t,e)},Ge.prototype.removeEventListener=Ge.prototype.off,Ge.prototype.one=function(t,e){var r=this.addEventListener;this.addEventListener=function(){},G(this,t,e),this.addEventListener=r},Ge.prototype.trigger=function(t){var e=t.type||t;"string"==typeof t&&(t={type:e}),t=U(t),this.allowedEvents_[e]&&this["on"+e]&&this["on"+e](t),X(this,t)},Ge.prototype.dispatchEvent=Ge.prototype.trigger;var $e=function(t){return t instanceof Ge||!!t.eventBusEl_&&["on","one","off","trigger"].every(function(e){return"function"==typeof t[e]})},Ye=function(t){return"string"==typeof t&&/\S/.test(t)||Array.isArray(t)&&!!t.length},Je=function(t){if(!t.nodeName&&!$e(t))throw new Error("Invalid target; must be a DOM node or evented object.")},Qe=function(t){if(!Ye(t))throw new Error("Invalid event type; must be a non-empty string or array.")},Ze=function(t){if("function"!=typeof t)throw new Error("Invalid listener; must be a function.")},tr=function(t,e){var r=e.length<3||e[0]===t||e[0]===t.eventBusEl_,n=void 0,i=void 0,o=void 0;return r?(n=t.eventBusEl_,e.length>=3&&e.shift(),i=e[0],o=e[1]):(n=e[0],i=e[1],o=e[2]),Je(n),Qe(i),Ze(o),o=qe(t,o),{isTargetingSelf:r,target:n,type:i,listener:o}},er=function(t,e,r,n){Je(t),t.nodeName?Be[e](t,r,n):t[e](r,n)},rr={on:function(){for(var t=this,e=arguments.length,r=Array(e),n=0;n=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),V(this.el_),this.el_=null),this.player_=null},t.prototype.player=function(){return this.player_},t.prototype.options=function(t){return xe.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"),t?(this.options_=tt(this.options_,t),this.options_):this.options_},t.prototype.el=function(){return this.el_},t.prototype.createEl=function(t,e,r){return v(t,e,r)},t.prototype.localize=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,n=this.player_.language&&this.player_.language(),i=this.player_.languages&&this.player_.languages(),o=i&&i[n],s=n&&n.split("-")[0],a=i&&i[s],l=r;return o&&o[t]?l=o[t]:a&&a[t]&&(l=a[t]),e&&(l=l.replace(/\{(\d+)\}/g,function(t,r){var n=e[r-1],i=n;return void 0===n&&(i=t),i})),l},t.prototype.contentEl=function(){return this.contentEl_||this.el_},t.prototype.id=function(){return this.id_},t.prototype.name=function(){return this.name_},t.prototype.children=function(){return this.children_},t.prototype.getChildById=function(t){return this.childIndex_[t]},t.prototype.getChild=function(t){if(t)return t=Q(t),this.childNameIndex_[t]},t.prototype.addChild=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.children_.length,i=void 0,o=void 0;if("string"==typeof e){o=Q(e);var s=r.componentClass||o;r.name=o;var a=t.getComponent(s);if(!a)throw new Error("Component "+s+" does not exist");if("function"!=typeof a)return null;i=new a(this.player_||this,r)}else i=e;if(this.children_.splice(n,0,i),"function"==typeof i.id&&(this.childIndex_[i.id()]=i),o=o||i.name&&Q(i.name()),o&&(this.childNameIndex_[o]=i),"function"==typeof i.el&&i.el()){var l=this.contentEl().children,c=l[n]||null;this.contentEl().insertBefore(i.el(),c)}return i},t.prototype.removeChild=function(t){if("string"==typeof t&&(t=this.getChild(t)),t&&this.children_){for(var e=!1,r=this.children_.length-1;r>=0;r--)if(this.children_[r]===t){e=!0,this.children_.splice(r,1);break}if(e){this.childIndex_[t.id()]=null,this.childNameIndex_[t.name()]=null;var n=t.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(t.el())}}},t.prototype.initChildren=function(){var e=this,r=this.options_.children;if(r){var n=this.options_,i=function(t){var r=t.name,i=t.opts;if(void 0!==n[r]&&(i=n[r]),!1!==i){!0===i&&(i={}),i.playerOptions=e.options_.playerOptions;var o=e.addChild(r,i);o&&(e[r]=o)}},o=void 0,s=t.getComponent("Tech");o=Array.isArray(r)?r:Object.keys(r),o.concat(Object.keys(this.options_).filter(function(t){return!o.some(function(e){return"string"==typeof e?t===e:t===e.name})})).map(function(t){var n=void 0,i=void 0;return"string"==typeof t?(n=t,i=r[n]||e.options_[n]||{}):(n=t.name,i=t),{name:n,opts:i}}).filter(function(e){var r=t.getComponent(e.opts.componentClass||Q(e.name));return r&&!s.isTech(r)}).forEach(i)}},t.prototype.buildCSSClass=function(){return""},t.prototype.ready=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t)return this.isReady_?void(e?t.call(this):this.setTimeout(t,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(t))},t.prototype.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var t=this.readyQueue_;this.readyQueue_=[],t&&t.length>0&&t.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)},t.prototype.$=function(t,e){return Oe(t,e||this.contentEl())},t.prototype.$$=function(t,e){return Me(t,e||this.contentEl())},t.prototype.hasClass=function(t){return m(this.el_,t)},t.prototype.addClass=function(t){_(this.el_,t)},t.prototype.removeClass=function(t){b(this.el_,t)},t.prototype.toggleClass=function(t,e){T(this.el_,t,e)},t.prototype.show=function(){this.removeClass("vjs-hidden")},t.prototype.hide=function(){this.addClass("vjs-hidden")},t.prototype.lockShowing=function(){this.addClass("vjs-lock-showing")},t.prototype.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.prototype.getAttribute=function(t){return E(this.el_,t)},t.prototype.setAttribute=function(t,e){S(this.el_,t,e)},t.prototype.removeAttribute=function(t){w(this.el_,t)},t.prototype.width=function(t,e){return this.dimension("width",t,e)},t.prototype.height=function(t,e){return this.dimension("height",t,e)},t.prototype.dimensions=function(t,e){this.width(t,!0),this.height(e)},t.prototype.dimension=function(t,e,r){if(void 0!==e)return null!==e&&e===e||(e=0),-1!==(""+e).indexOf("%")||-1!==(""+e).indexOf("px")?this.el_.style[t]=e:this.el_.style[t]="auto"===e?"":e+"px",void(r||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[t],i=n.indexOf("px");return-1!==i?parseInt(n.slice(0,i),10):parseInt(this.el_["offset"+Q(t)],10)},t.prototype.currentDimension=function(t){var e=0;if("width"!==t&&"height"!==t)throw new Error("currentDimension only accepts width or height value");if("function"==typeof Wt.getComputedStyle){var r=Wt.getComputedStyle(this.el_);e=r.getPropertyValue(t)||r[t]}if(0===(e=parseFloat(e))){var n="offset"+Q(t);e=this.el_[n]}return e},t.prototype.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.prototype.currentWidth=function(){ return this.currentDimension("width")},t.prototype.currentHeight=function(){return this.currentDimension("height")},t.prototype.focus=function(){this.el_.focus()},t.prototype.blur=function(){this.el_.blur()},t.prototype.emitTapEvents=function(){var t=0,e=null,r=void 0;this.on("touchstart",function(n){1===n.touches.length&&(e={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=(new Date).getTime(),r=!0)}),this.on("touchmove",function(t){if(t.touches.length>1)r=!1;else if(e){var n=t.touches[0].pageX-e.pageX,i=t.touches[0].pageY-e.pageY,o=Math.sqrt(n*n+i*i);o>10&&(r=!1)}});var n=function(){r=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",function(n){if(e=null,!0===r){(new Date).getTime()-t<200&&(n.preventDefault(),this.trigger("tap"))}})},t.prototype.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var t=qe(this.player(),this.player().reportUserActivity),e=void 0;this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});var r=function(r){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",r),this.on("touchcancel",r)}},t.prototype.setTimeout=function(t,e){var r,n,i=this;return t=qe(this,t),r=Wt.setTimeout(function(){i.off("dispose",n),t()},e),n=function(){return i.clearTimeout(r)},n.guid="vjs-timeout-"+r,this.on("dispose",n),r},t.prototype.clearTimeout=function(t){Wt.clearTimeout(t);var e=function(){};return e.guid="vjs-timeout-"+t,this.off("dispose",e),t},t.prototype.setInterval=function(t,e){var r=this;t=qe(this,t);var n=Wt.setInterval(t,e),i=function(){return r.clearInterval(n)};return i.guid="vjs-interval-"+n,this.on("dispose",i),n},t.prototype.clearInterval=function(t){Wt.clearInterval(t);var e=function(){};return e.guid="vjs-interval-"+t,this.off("dispose",e),t},t.prototype.requestAnimationFrame=function(t){var e,r,n=this;return this.supportsRaf_?(t=qe(this,t),e=Wt.requestAnimationFrame(function(){n.off("dispose",r),t()}),r=function(){return n.cancelAnimationFrame(e)},r.guid="vjs-raf-"+e,this.on("dispose",r),e):this.setTimeout(t,1e3/60)},t.prototype.cancelAnimationFrame=function(t){if(this.supportsRaf_){Wt.cancelAnimationFrame(t);var e=function(){};return e.guid="vjs-raf-"+t,this.off("dispose",e),t}return this.clearTimeout(t)},t.registerComponent=function(e,r){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var n=t.getComponent("Tech"),i=n&&n.isTech(r),o=t===r||t.prototype.isPrototypeOf(r.prototype);if(i||!o){var s=void 0;throw s=i?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+e+'"; '+s+".")}e=Q(e),t.components_||(t.components_={});var a=t.getComponent("Player");if("Player"===e&&a&&a.players){var l=a.players,c=Object.keys(l);if(l&&c.length>0&&c.map(function(t){return l[t]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return t.components_[e]=r,r},t.getComponent=function(e){if(e)return e=Q(e),t.components_&&t.components_[e]?t.components_[e]:void 0},t}();ir.prototype.supportsRaf_="function"==typeof Wt.requestAnimationFrame&&"function"==typeof Wt.cancelAnimationFrame,ir.registerComponent("Component",ir);for(var or={},sr=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],ar=sr[0],lr=void 0,cr=0;cr0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_e(this,e);var o=Te(this,t.call(this));if(!i&&(i=o,he)){i=Gt.createElement("custom");for(var s in e.prototype)"constructor"!==s&&(i[s]=e.prototype[s])}i.tracks_=[],Object.defineProperty(i,"length",{get:function(){return this.tracks_.length}});for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:[];_e(this,e);for(var o=void 0,s=i.length-1;s>=0;s--)if(i[s].enabled){Tr(i,i[s]);break}if(he){o=Gt.createElement("custom");for(var a in _r.prototype)"constructor"!==a&&(o[a]=_r.prototype[a]);for(var l in e.prototype)"constructor"!==l&&(o[l]=e.prototype[l])}return o=r=Te(this,t.call(this,i,o)),o.changing_=!1,n=o,Te(r,n)}return be(e,t),e.prototype.addTrack=function(e){var r=this;e.enabled&&Tr(this,e),t.prototype.addTrack.call(this,e),e.addEventListener&&e.addEventListener("enabledchange",function(){r.changing_||(r.changing_=!0,Tr(r,e),r.changing_=!1,r.trigger("change"))})},e}(_r),kr=function(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:[];_e(this,e);for(var o=void 0,s=i.length-1;s>=0;s--)if(i[s].selected){kr(i,i[s]);break}if(he){o=Gt.createElement("custom");for(var a in _r.prototype)"constructor"!==a&&(o[a]=_r.prototype[a]);for(var l in e.prototype)"constructor"!==l&&(o[l]=e.prototype[l])}return o=r=Te(this,t.call(this,i,o)),o.changing_=!1,Object.defineProperty(o,"selectedIndex",{get:function(){for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:[];_e(this,e);var o=void 0;if(he){o=Gt.createElement("custom");for(var s in _r.prototype)"constructor"!==s&&(o[s]=_r.prototype[s]);for(var a in e.prototype)"constructor"!==a&&(o[a]=e.prototype[a])}return o=r=Te(this,t.call(this,i,o)),n=o,Te(r,n)}return be(e,t),e.prototype.addTrack=function(e){t.prototype.addTrack.call(this,e),e.addEventListener("modechange",qe(this,function(){this.trigger("change")})),-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",qe(this,function(){this.trigger("selectedlanguagechange")}))},e}(_r),wr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];_e(this,t);var r=this;if(he){r=Gt.createElement("custom");for(var n in t.prototype)"constructor"!==n&&(r[n]=t.prototype[n])}r.trackElements_=[],Object.defineProperty(r,"length",{get:function(){return this.trackElements_.length}});for(var i=0,o=e.length;i0&&void 0!==arguments[0]?arguments[0]:{};_e(this,e);var i=Te(this,t.call(this)),o=i;if(he){o=Gt.createElement("custom");for(var s in e.prototype)"constructor"!==s&&(o[s]=e.prototype[s])}var a={id:n.id||"vjs_track_"+F(),kind:n.kind||"",label:n.label||"",language:n.language||""};for(var l in a)!function(t){Object.defineProperty(o,t,{get:function(){return a[t]},set:function(){}})}(l);return r=o,Te(i,r)}return be(e,t),e}(Ge),Nr=function(t){var e=["protocol","hostname","port","pathname","search","hash","host"],r=Gt.createElement("a");r.href=t;var n=""===r.host&&"file:"!==r.protocol,i=void 0;n&&(i=Gt.createElement("div"),i.innerHTML='',r=i.firstChild,i.setAttribute("style","display:none; position:absolute;"),Gt.body.appendChild(i));for(var o={},s=0;sx',t=e.firstChild.href}return t},Dr=function(t){if("string"==typeof t){var e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i,r=e.exec(t);if(r)return r.pop().toLowerCase()}return""},Lr=function(t){var e=Wt.location,r=Nr(t);return(":"===r.protocol?e.protocol:r.protocol)+r.host!==e.protocol+e.host},Rr=(Object.freeze||Object)({parseUrl:Nr,getAbsoluteURL:Ir,getFileExtension:Dr,isCrossOrigin:Lr}),Fr=ut,Br=Object.prototype.toString,Hr=function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){function r(t){return t.replace(/^\s*|\s*$/g,"")}e=t.exports=r,e.left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}}),Vr=Function.prototype.toString,zr=/^\s*class\b/,Wr=function(t){try{var e=Vr.call(t);return zr.test(e)}catch(t){return!1}},Ur=function(t){try{return!Wr(t)&&(Vr.call(t),!0)}catch(t){return!1}},qr=Object.prototype.toString,Kr="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,Xr=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if("function"==typeof t&&!t.prototype)return!0;if(Kr)return Ur(t);if(Wr(t))return!1;var e=qr.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e},Gr=Object.prototype.toString,$r=Object.prototype.hasOwnProperty,Yr=function(t,e,r){for(var n=0,i=t.length;n=3&&(n=r),"[object Array]"===Gr.call(t)?Yr(t,e,n):"string"==typeof t?Jr(t,e,n):Qr(t,e,n)},tn=Zr,en=function(t){return"[object Array]"===Object.prototype.toString.call(t)},rn=function(t){if(!t)return{};var e={};return tn(Hr(t).split("\n"),function(t){var r=t.indexOf(":"),n=Hr(t.slice(0,r)).toLowerCase(),i=Hr(t.slice(r+1));void 0===e[n]?e[n]=i:en(e[n])?e[n].push(i):e[n]=[e[n],i]}),e},nn=ht,on=Object.prototype.hasOwnProperty,sn=ft;ft.XMLHttpRequest=Wt.XMLHttpRequest||gt,ft.XDomainRequest="withCredentials"in new ft.XMLHttpRequest?ft.XMLHttpRequest:Wt.XDomainRequest,function(t,e){for(var r=0;r0&&(Wt.console&&Wt.console.groupCollapsed&&Wt.console.groupCollapsed("Text Track parsing errors for "+e.src),n.forEach(function(t){return xe.error(t)}),Wt.console&&Wt.console.groupEnd&&Wt.console.groupEnd()),r.flush()},ln=function(t,e){var r={uri:t},n=Lr(t);n&&(r.cors=n),sn(r,qe(this,function(t,r,n){if(t)return xe.error(t,r);if(e.loaded_=!0,"function"!=typeof Wt.WebVTT){if(e.tech_){var i=function(){return an(n,e)};e.tech_.on("vttjsloaded",i),e.tech_.on("vttjserror",function(){xe.error("vttjs failed to load, stopping trying to process "+e.src),e.tech_.off("vttjsloaded",i)})}}else an(n,e)}))},cn=function(t){function e(){var r,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(_e(this,e),!i.tech)throw new Error("A tech was not provided.");var o=tt(i,{kind:Ar[i.kind]||"subtitles",language:i.language||i.srclang||""}),s=Or[o.mode]||"disabled",a=o.default;"metadata"!==o.kind&&"chapters"!==o.kind||(s="hidden");var l=r=Te(this,t.call(this,o));if(l.tech_=o.tech,he)for(var c in e.prototype)"constructor"!==c&&(l[c]=e.prototype[c]);l.cues_=[],l.activeCues_=[];var u=new xr(l.cues_),h=new xr(l.activeCues_),p=!1,d=qe(l,function(){this.activeCues=this.activeCues,p&&(this.trigger("cuechange"),p=!1)});return"disabled"!==s&&l.tech_.ready(function(){l.tech_.on("timeupdate",d)},!0),Object.defineProperty(l,"default",{get:function(){return a},set:function(){}}),Object.defineProperty(l,"mode",{get:function(){return s},set:function(t){var e=this;Or[t]&&(s=t,"disabled"!==s?this.tech_.ready(function(){e.tech_.on("timeupdate",d)},!0):this.tech_.off("timeupdate",d),this.trigger("modechange"))}}),Object.defineProperty(l,"cues",{get:function(){return this.loaded_?u:null},set:function(){}}),Object.defineProperty(l,"activeCues",{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return h;for(var t=this.tech_.currentTime(),e=[],r=0,n=this.cues.length;r=t?e.push(i):i.startTime===i.endTime&&i.startTime<=t&&i.startTime+.5>=t&&e.push(i)}if(p=!1,e.length!==this.activeCues_.length)p=!0;else for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};_e(this,e);var o=tt(i,{kind:Pr[i.kind]||""}),s=r=Te(this,t.call(this,o)),a=!1;if(he)for(var l in e.prototype)"constructor"!==l&&(s[l]=e.prototype[l]);return Object.defineProperty(s,"enabled",{get:function(){return a},set:function(t){"boolean"==typeof t&&t!==a&&(a=t,this.trigger("enabledchange"))}}),o.enabled&&(s.enabled=o.enabled),s.loaded_=!0,n=s,Te(r,n)}return be(e,t),e}(Mr),hn=function(t){function e(){var r,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_e(this,e);var o=tt(i,{kind:jr[i.kind]||""}),s=r=Te(this,t.call(this,o)),a=!1;if(he)for(var l in e.prototype)"constructor"!==l&&(s[l]=e.prototype[l]);return Object.defineProperty(s,"selected",{get:function(){return a},set:function(t){"boolean"==typeof t&&t!==a&&(a=t,this.trigger("selectedchange"))}}),o.selected&&(s.selected=o.selected),n=s,Te(r,n)}return be(e,t),e}(Mr),pn=0,dn=2,fn=function(t){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_e(this,e);var n=Te(this,t.call(this)),i=void 0,o=n;if(he){o=Gt.createElement("custom");for(var s in e.prototype)"constructor"!==s&&(o[s]=e.prototype[s])}var a=new cn(r);if(o.kind=a.kind,o.src=a.src,o.srclang=a.language,o.label=a.label,o.default=a.default,Object.defineProperty(o,"readyState",{get:function(){return i}}),Object.defineProperty(o,"track",{get:function(){return a}}),i=pn,a.addEventListener("loadeddata",function(){i=dn,o.trigger({type:"load",target:o})}),he){var l;return l=o,Te(n,l)}return n}return be(e,t),e}(Ge);fn.prototype.allowedEvents_={load:"load"},fn.NONE=pn,fn.LOADING=1,fn.LOADED=dn,fn.ERROR=3;var vn={audio:{ListClass:Cr,TrackClass:un,capitalName:"Audio"},video:{ListClass:Er,TrackClass:hn,capitalName:"Video"},text:{ListClass:Sr,TrackClass:cn,capitalName:"Text"}};Object.keys(vn).forEach(function(t){vn[t].getterName=t+"Tracks",vn[t].privateName=t+"Tracks_"});var yn={remoteText:{ListClass:Sr,TrackClass:cn,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:wr,TrackClass:fn,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},gn=tt(vn,yn);yn.names=Object.keys(yn),vn.names=Object.keys(vn),gn.names=[].concat(yn.names).concat(vn.names);var mn={},_n=function(t){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};_e(this,e),r.reportTouchActivity=!1;var i=Te(this,t.call(this,null,r,n));return i.hasStarted_=!1,i.on("playing",function(){this.hasStarted_=!0}),i.on("loadstart",function(){this.hasStarted_=!1}),gn.names.forEach(function(t){var e=gn[t];r&&r[e.getterName]&&(i[e.privateName]=r[e.getterName])}),i.featuresProgressEvents||i.manualProgressOn(),i.featuresTimeupdateEvents||i.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(t){!1===r["native"+t+"Tracks"]&&(i["featuresNative"+t+"Tracks"]=!1)}),!1===r.nativeCaptions||!1===r.nativeTextTracks?i.featuresNativeTextTracks=!1:!0!==r.nativeCaptions&&!0!==r.nativeTextTracks||(i.featuresNativeTextTracks=!0),i.featuresNativeTextTracks||i.emulateTextTracks(),i.autoRemoteTextTracks_=new gn.text.ListClass,i.initTrackListeners(),r.nativeControlsForTouch||i.emitTapEvents(),i.constructor&&(i.name_=i.constructor.name||"Unknown Tech"),i}return be(e,t),e.prototype.triggerSourceset=function(t){var e=this;this.isReady_||this.one("ready",function(){return e.setTimeout(function(){return e.triggerSourceset(t)},1)}),this.trigger({src:t,type:"sourceset"})},e.prototype.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},e.prototype.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},e.prototype.trackProgress=function(t){this.stopTrackingProgress(),this.progressInterval=this.setInterval(qe(this,function(){var t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,1===t&&this.stopTrackingProgress()}),500)},e.prototype.onDurationChange=function(t){this.duration_=this.duration()},e.prototype.buffered=function(){return it(0,0)},e.prototype.bufferedPercent=function(){return ot(this.buffered(),this.duration_)},e.prototype.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},e.prototype.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},e.prototype.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},e.prototype.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},e.prototype.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},e.prototype.dispose=function(){this.clearTracks(vn.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),t.prototype.dispose.call(this)},e.prototype.clearTracks=function(t){var e=this;t=[].concat(t),t.forEach(function(t){for(var r=e[t+"Tracks"]()||[],n=r.length;n--;){var i=r[n];"text"===t&&e.removeRemoteTextTrack(i),r.removeTrack(i)}})},e.prototype.cleanupAutoTextTracks=function(){for(var t=this.autoRemoteTextTracks_||[],e=t.length;e--;){var r=t[e];this.removeRemoteTextTrack(r)}},e.prototype.reset=function(){},e.prototype.error=function(t){return void 0!==t&&(this.error_=new st(t),this.trigger("error")),this.error_},e.prototype.played=function(){return this.hasStarted_?it(0,0):it()},e.prototype.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},e.prototype.initTrackListeners=function(){var t=this;vn.names.forEach(function(e){var r=vn[e],n=function(){t.trigger(e+"trackchange")},i=t[r.getterName]();i.addEventListener("removetrack",n),i.addEventListener("addtrack",n),t.on("dispose",function(){i.removeEventListener("removetrack",n),i.removeEventListener("addtrack",n)})})},e.prototype.addWebVttScript_=function(){var t=this;if(!Wt.WebVTT)if(Gt.body.contains(this.el())){if(!this.options_["vtt.js"]&&i(mn)&&Object.keys(mn).length>0)return void this.trigger("vttjsloaded");var e=Gt.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.12.4/vtt.min.js",e.onload=function(){t.trigger("vttjsloaded")},e.onerror=function(){t.trigger("vttjserror")},this.on("dispose",function(){e.onload=null,e.onerror=null}),Wt.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)},e.prototype.emulateTextTracks=function(){var t=this,e=this.textTracks(),r=this.remoteTextTracks(),n=function(t){return e.addTrack(t.track)},i=function(t){return e.removeTrack(t.track)};r.on("addtrack",n),r.on("removetrack",i),this.addWebVttScript_();var o=function(){return t.trigger("texttrackchange")},s=function(){o();for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:{},r=arguments[1],n=this.createRemoteTextTrack(e);return!0!==r&&!1!==r&&(xe.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),r=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==r&&this.ready(function(){return t.autoRemoteTextTracks_.addTrack(n.track)}),n},e.prototype.removeRemoteTextTrack=function(t){var e=this.remoteTextTrackEls().getTrackElementByTrack_(t);this.remoteTextTrackEls().removeTrackElement_(e),this.remoteTextTracks().removeTrack(t),this.autoRemoteTextTracks_.removeTrack(t)},e.prototype.getVideoPlaybackQuality=function(){return{}},e.prototype.setPoster=function(){},e.prototype.playsinline=function(){},e.prototype.setPlaysinline=function(){},e.prototype.canPlayType=function(){return""},e.canPlayType=function(){return""},e.canPlaySource=function(t,r){return e.canPlayType(t.type)},e.isTech=function(t){ return t.prototype instanceof e||t instanceof e||t===e},e.registerTech=function(t,r){if(e.techs_||(e.techs_={}),!e.isTech(r))throw new Error("Tech "+t+" must be a Tech");if(!e.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!e.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return t=Q(t),e.techs_[t]=r,"Tech"!==t&&e.defaultTechOrder_.push(t),r},e.getTech=function(t){if(t)return t=Q(t),e.techs_&&e.techs_[t]?e.techs_[t]:Wt&&Wt.videojs&&Wt.videojs[t]?(xe.warn("The "+t+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),Wt.videojs[t]):void 0},e}(ir);gn.names.forEach(function(t){var e=gn[t];_n.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}}),_n.prototype.featuresVolumeControl=!0,_n.prototype.featuresMuteControl=!0,_n.prototype.featuresFullscreenResize=!1,_n.prototype.featuresPlaybackRate=!1,_n.prototype.featuresProgressEvents=!1,_n.prototype.featuresSourceset=!1,_n.prototype.featuresTimeupdateEvents=!1,_n.prototype.featuresNativeTextTracks=!1,_n.withSourceHandlers=function(t){t.registerSourceHandler=function(e,r){var n=t.sourceHandlers;n||(n=t.sourceHandlers=[]),void 0===r&&(r=n.length),n.splice(r,0,e)},t.canPlayType=function(e){for(var r=t.sourceHandlers||[],n=void 0,i=0;i0&&void 0!==arguments[0]?arguments[0]:"",e=Dr(t);return wn[e.toLowerCase()]||""},jn=function(t,e){if(!e)return"";if(t.cache_.source.src===e&&t.cache_.source.type)return t.cache_.source.type;var r=t.cache_.sources.filter(function(t){return t.src===e});if(r.length)return r[0].type;for(var n=t.$$("source"),i=0;i0&&void 0!==arguments[0]?arguments[0]:"div",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=r({innerHTML:'',className:this.buildCSSClass(),tabIndex:0},n),"button"===e&&xe.error("Creating a ClickableComponent with an HTML element of "+e+" is not supported; use a Button instead."),i=r({role:"button"},i),this.tabIndex_=n.tabIndex;var o=t.prototype.createEl.call(this,e,n,i);return this.createControlTextEl(o),o},e.prototype.dispose=function(){this.controlTextEl_=null,t.prototype.dispose.call(this)},e.prototype.createControlTextEl=function(t){return this.controlTextEl_=v("span",{className:"vjs-control-text"},{"aria-live":"polite"}),t&&t.appendChild(this.controlTextEl_),this.controlText(this.controlText_,t),this.controlTextEl_},e.prototype.controlText=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(void 0===t)return this.controlText_||"Need Text";var r=this.localize(t);this.controlText_=t,y(this.controlTextEl_,r),this.nonIconControl||e.setAttribute("title",r)},e.prototype.buildCSSClass=function(){return"vjs-control vjs-button "+t.prototype.buildCSSClass.call(this)},e.prototype.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur))},e.prototype.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off(["tap","click"],this.handleClick),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur)},e.prototype.handleClick=function(t){},e.prototype.handleFocus=function(t){q(Gt,"keydown",qe(this,this.handleKeyPress))},e.prototype.handleKeyPress=function(e){32===e.which||13===e.which?(e.preventDefault(),this.trigger("click")):t.prototype.handleKeyPress&&t.prototype.handleKeyPress.call(this,e)},e.prototype.handleBlur=function(t){K(Gt,"keydown",qe(this,this.handleKeyPress))},e}(ir);ir.registerComponent("ClickableComponent",On);var Mn=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.update(),r.on("posterchange",qe(i,i.update)),i}return be(e,t),e.prototype.dispose=function(){this.player().off("posterchange",this.update),t.prototype.dispose.call(this)},e.prototype.createEl=function(){var t=v("div",{className:"vjs-poster",tabIndex:-1});return ye||(this.fallbackImg_=v("img"),t.appendChild(this.fallbackImg_)),t},e.prototype.update=function(t){var e=this.player().poster();this.setSrc(e),e?this.show():this.hide()},e.prototype.setSrc=function(t){if(this.fallbackImg_)this.fallbackImg_.src=t;else{var e="";t&&(e='url("'+t+'")'),this.el_.style.backgroundImage=e}},e.prototype.handleClick=function(t){this.player_.controls()&&(this.player_.paused()?ct(this.player_.play()):this.player_.pause())},e}(On);ir.registerComponent("PosterImage",Mn);var Nn={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'},In=function(t){function e(r,n,i){_e(this,e);var o=Te(this,t.call(this,r,n,i)),s=qe(o,o.updateDisplay);return r.on("loadstart",qe(o,o.toggleDisplay)),r.on("texttrackchange",s),r.on("loadstart",qe(o,o.preselectTrack)),r.ready(qe(o,function(){if(r.tech_&&r.tech_.featuresNativeTextTracks)return void this.hide();r.on("fullscreenchange",s),r.on("playerresize",s),Wt.addEventListener&&Wt.addEventListener("orientationchange",s),r.on("dispose",function(){return Wt.removeEventListener("orientationchange",s)});for(var t=this.options_.playerOptions.tracks||[],e=0;e1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t="button",e=r({innerHTML:'',className:this.buildCSSClass()},e),n=r({type:"button"},n);var i=ir.prototype.createEl.call(this,t,e,n);return this.createControlTextEl(i),i},e.prototype.addChild=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.constructor.name;return xe.warn("Adding an actionable (user controllable) child to a Button ("+r+") is not supported; use a ClickableComponent instead."),ir.prototype.addChild.call(this,t,e)},e.prototype.enable=function(){t.prototype.enable.call(this),this.el_.removeAttribute("disabled")},e.prototype.disable=function(){t.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},e.prototype.handleKeyPress=function(e){32!==e.which&&13!==e.which&&t.prototype.handleKeyPress.call(this,e)},e}(On);ir.registerComponent("Button",Ln);var Rn=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.mouseused_=!1,i.on("mousedown",i.handleMouseDown),i}return be(e,t),e.prototype.buildCSSClass=function(){return"vjs-big-play-button"},e.prototype.handleClick=function(t){var e=this.player_.play();if(this.mouseused_&&t.clientX&&t.clientY)return void ct(e);var r=this.player_.getChild("controlBar"),n=r&&r.getChild("playToggle");if(!n)return void this.player_.focus();var i=function(){return n.focus()};lt(e)?e.then(i,function(){}):this.setTimeout(i,1)},e.prototype.handleKeyPress=function(e){this.mouseused_=!1,t.prototype.handleKeyPress.call(this,e)},e.prototype.handleMouseDown=function(t){this.mouseused_=!0},e}(Ln);Rn.prototype.controlText_="Play Video",ir.registerComponent("BigPlayButton",Rn);var Fn=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.controlText(n&&n.controlText||i.localize("Close")),i}return be(e,t),e.prototype.buildCSSClass=function(){return"vjs-close-button "+t.prototype.buildCSSClass.call(this)},e.prototype.handleClick=function(t){this.trigger({type:"close",bubbles:!1})},e}(Ln);ir.registerComponent("CloseButton",Fn);var Bn=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.on(r,"play",i.handlePlay),i.on(r,"pause",i.handlePause),i.on(r,"ended",i.handleEnded),i}return be(e,t),e.prototype.buildCSSClass=function(){return"vjs-play-control "+t.prototype.buildCSSClass.call(this)},e.prototype.handleClick=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.prototype.handleSeeked=function(t){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(t):this.handlePlay(t)},e.prototype.handlePlay=function(t){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},e.prototype.handlePause=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},e.prototype.handleEnded=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},e}(Ln);Bn.prototype.controlText_="Play",ir.registerComponent("PlayToggle",Bn);var Hn=function(t,e){t=t<0?0:t;var r=Math.floor(t%60),n=Math.floor(t/60%60),i=Math.floor(t/3600),o=Math.floor(e/60%60),s=Math.floor(e/3600);return(isNaN(t)||t===1/0)&&(i=n=r="-"),i=i>0||s>0?i+":":"",n=((i||o>=10)&&n<10?"0"+n:n)+":",r=r<10?"0"+r:r,i+n+r},Vn=Hn,zn=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return Vn(t,e)},Wn=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.throttledUpdateContent=Ke(qe(i,i.updateContent),25),i.on(r,"timeupdate",i.throttledUpdateContent),i}return be(e,t),e.prototype.createEl=function(e){var r=this.buildCSSClass(),n=t.prototype.createEl.call(this,"div",{className:r+" vjs-time-control vjs-control",innerHTML:''+this.localize(this.labelText_)+" "});return this.contentEl_=v("span",{className:r+"-display"},{"aria-live":"off"}),this.updateTextNode_(),n.appendChild(this.contentEl_),n},e.prototype.dispose=function(){this.contentEl_=null,this.textNode_=null,t.prototype.dispose.call(this)},e.prototype.updateTextNode_=function(){if(this.contentEl_){for(;this.contentEl_.firstChild;)this.contentEl_.removeChild(this.contentEl_.firstChild);this.textNode_=Gt.createTextNode(this.formattedTime_||this.formatTime_(0)),this.contentEl_.appendChild(this.textNode_)}},e.prototype.formatTime_=function(t){return zn(t)},e.prototype.updateFormattedTime_=function(t){var e=this.formatTime_(t);e!==this.formattedTime_&&(this.formattedTime_=e,this.requestAnimationFrame(this.updateTextNode_))},e.prototype.updateContent=function(t){},e}(ir);Wn.prototype.labelText_="Time",Wn.prototype.controlText_="Time",ir.registerComponent("TimeDisplay",Wn);var Un=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.on(r,"ended",i.handleEnded),i}return be(e,t),e.prototype.buildCSSClass=function(){return"vjs-current-time"},e.prototype.updateContent=function(t){var e=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(e)},e.prototype.handleEnded=function(t){this.player_.duration()&&this.updateFormattedTime_(this.player_.duration())},e}(Wn);Un.prototype.labelText_="Current Time",Un.prototype.controlText_="Current Time",ir.registerComponent("CurrentTimeDisplay",Un);var qn=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.on(r,"durationchange",i.updateContent),i.on(r,"loadedmetadata",i.throttledUpdateContent),i}return be(e,t),e.prototype.buildCSSClass=function(){return"vjs-duration"},e.prototype.updateContent=function(t){var e=this.player_.duration();e&&this.duration_!==e&&(this.duration_=e,this.updateFormattedTime_(e))},e}(Wn);qn.prototype.labelText_="Duration",qn.prototype.controlText_="Duration",ir.registerComponent("DurationDisplay",qn);var Kn=function(t){function e(){return _e(this,e),Te(this,t.apply(this,arguments))}return be(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"
/
"})},e}(ir);ir.registerComponent("TimeDivider",Kn);var Xn=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.on(r,"durationchange",i.throttledUpdateContent),i.on(r,"ended",i.handleEnded),i}return be(e,t),e.prototype.buildCSSClass=function(){return"vjs-remaining-time"},e.prototype.formatTime_=function(e){return"-"+t.prototype.formatTime_.call(this,e)},e.prototype.updateContent=function(t){this.player_.duration()&&(this.player_.remainingTimeDisplay?this.updateFormattedTime_(this.player_.remainingTimeDisplay()):this.updateFormattedTime_(this.player_.remainingTime()))},e.prototype.handleEnded=function(t){this.player_.duration()&&this.updateFormattedTime_(0)},e}(Wn);Xn.prototype.labelText_="Remaining Time",Xn.prototype.controlText_="Remaining Time",ir.registerComponent("RemainingTimeDisplay",Xn);var Gn=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.updateShowing(),i.on(i.player(),"durationchange",i.updateShowing),i}return be(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=v("div",{className:"vjs-live-display",innerHTML:''+this.localize("Stream Type")+" "+this.localize("LIVE")},{"aria-live":"off"}),e.appendChild(this.contentEl_),e},e.prototype.dispose=function(){this.contentEl_=null,t.prototype.dispose.call(this)},e.prototype.updateShowing=function(t){this.player().duration()===1/0?this.show():this.hide()},e}(ir);ir.registerComponent("LiveDisplay",Gn);var $n=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.bar=i.getChild(i.options_.barName),i.vertical(!!i.options_.vertical),i.enable(),i}return be(e,t),e.prototype.enabled=function(){return this.enabled_},e.prototype.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown),this.on("touchstart",this.handleMouseDown),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur),this.on("click",this.handleClick),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},e.prototype.disable=function(){if(this.enabled()){var t=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown),this.off("touchstart",this.handleMouseDown),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur),this.off("click",this.handleClick),this.off(this.player_,"controlsvisible",this.update),this.off(t,"mousemove",this.handleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchmove",this.handleMouseMove),this.off(t,"touchend",this.handleMouseUp),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},e.prototype.createEl=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.className=n.className+" vjs-slider",n=r({tabIndex:0},n),i=r({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},i),t.prototype.createEl.call(this,e,n,i)},e.prototype.handleMouseDown=function(t){var e=this.bar.el_.ownerDocument;"mousedown"===t.type&&t.preventDefault(),"touchstart"!==t.type||ce||t.preventDefault(),x(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(e,"mousemove",this.handleMouseMove),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchmove",this.handleMouseMove),this.on(e,"touchend",this.handleMouseUp),this.handleMouseMove(t)},e.prototype.handleMouseMove=function(t){},e.prototype.handleMouseUp=function(){var t=this.bar.el_.ownerDocument;j(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchmove",this.handleMouseMove),this.off(t,"touchend",this.handleMouseUp),this.update()},e.prototype.update=function(){if(this.el_){var t=this.getPercent(),e=this.bar;if(e){("number"!=typeof t||t!==t||t<0||t===1/0)&&(t=0);var r=(100*t).toFixed(2)+"%",n=e.el().style;return this.vertical()?n.height=r:n.width=r,t}}},e.prototype.calculateDistance=function(t){var e=O(this.el_,t);return this.vertical()?e.y:e.x},e.prototype.handleFocus=function(){this.on(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},e.prototype.handleKeyPress=function(t){37===t.which||40===t.which?(t.preventDefault(),this.stepBack()):38!==t.which&&39!==t.which||(t.preventDefault(),this.stepForward())},e.prototype.handleBlur=function(){this.off(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},e.prototype.handleClick=function(t){t.stopImmediatePropagation(),t.preventDefault()},e.prototype.vertical=function(t){if(void 0===t)return this.vertical_||!1;this.vertical_=!!t,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},e}(ir);ir.registerComponent("Slider",$n);var Yn=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.partEls_=[],i.on(r,"progress",i.update),i}return be(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:''+this.localize("Loaded")+": 0%"})},e.prototype.dispose=function(){this.partEls_=null,t.prototype.dispose.call(this)},e.prototype.update=function(t){var e=this.player_.buffered(),r=this.player_.duration(),n=this.player_.bufferedEnd(),i=this.partEls_,o=function(t,e){var r=t/e||0;return 100*(r>=1?1:r)+"%"};this.el_.style.width=o(n,r);for(var s=0;se.length;u--)this.el_.removeChild(i[u-1]);i.length=e.length},e}(ir);ir.registerComponent("LoadProgressBar",Yn);var Jn=function(t){function e(){return _e(this,e),Te(this,t.apply(this,arguments))}return be(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"})},e.prototype.update=function(t,e,r){var n=P(this.el_),i=P(this.player_.el()),o=t.width*e;if(i&&n){var s=t.left-i.left+o,a=t.width-o+(i.right-t.right),l=n.width/2;sn.width&&(l=n.width),this.el_.style.right="-"+l+"px",y(this.el_,r)}},e}(ir);ir.registerComponent("TimeTooltip",Jn);var Qn=function(t){function e(){return _e(this,e),Te(this,t.apply(this,arguments))}return be(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar",innerHTML:''+this.localize("Progress")+": 0%"})},e.prototype.update=function(t,e){var r=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var n=r.player_.scrubbing()?r.player_.getCache().currentTime:r.player_.currentTime(),i=zn(n,r.player_.duration()),o=r.getChild("timeTooltip");o&&o.update(t,e,i)})},e}(ir);Qn.prototype.options_={children:[]},pe&&!(pe>8)||ee||ne||Qn.prototype.options_.children.push("timeTooltip"),ir.registerComponent("PlayProgressBar",Qn);var Zn=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.update=Ke(qe(i,i.update),25),i}return be(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},e.prototype.update=function(t,e){var r=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var n=r.player_.duration(),i=zn(e*n,n);r.el_.style.left=t.width*e+"px",r.getChild("timeTooltip").update(t,e,i)})},e}(ir);Zn.prototype.options_={children:["timeTooltip"]},ir.registerComponent("MouseTimeDisplay",Zn);var ti=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.setEventHandlers_(),i}return be(e,t),e.prototype.setEventHandlers_=function(){var t=this;this.update=Ke(qe(this,this.update),30),this.on(this.player_,"timeupdate",this.update),this.on(this.player_,"ended",this.handleEnded),this.updateInterval=null,this.on(this.player_,["playing"],function(){t.clearInterval(t.updateInterval),t.updateInterval=t.setInterval(function(){t.requestAnimationFrame(function(){t.update()})},30)}),this.on(this.player_,["ended","pause","waiting"],function(){t.clearInterval(t.updateInterval)}),this.on(this.player_,["timeupdate","ended"],this.update)},e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},e.prototype.update_=function(t,e){var r=this.player_.duration();this.el_.setAttribute("aria-valuenow",(100*e).toFixed(2)),this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[zn(t,r),zn(r,r)],"{1} of {2}")),this.bar.update(P(this.el_),e)},e.prototype.update=function(e){var r=t.prototype.update.call(this);return this.update_(this.getCurrentTime_(),r),r},e.prototype.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},e.prototype.handleEnded=function(t){this.update_(this.player_.duration(),1)},e.prototype.getPercent=function(){var t=this.getCurrentTime_()/this.player_.duration();return t>=1?1:t},e.prototype.handleMouseDown=function(e){R(e)&&(e.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),t.prototype.handleMouseDown.call(this,e))},e.prototype.handleMouseMove=function(t){if(R(t)){var e=this.calculateDistance(t)*this.player_.duration();e===this.player_.duration()&&(e-=.1),this.player_.currentTime(e)}},e.prototype.enable=function(){t.prototype.enable.call(this);var e=this.getChild("mouseTimeDisplay");e&&e.show()},e.prototype.disable=function(){t.prototype.disable.call(this);var e=this.getChild("mouseTimeDisplay");e&&e.hide()},e.prototype.handleMouseUp=function(e){t.prototype.handleMouseUp.call(this,e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying&&ct(this.player_.play())},e.prototype.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},e.prototype.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},e.prototype.handleAction=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.prototype.handleKeyPress=function(e){32===e.which||13===e.which?(e.preventDefault(),this.handleAction(e)):t.prototype.handleKeyPress&&t.prototype.handleKeyPress.call(this,e)},e}($n);ti.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},pe&&!(pe>8)||ee||ne||ti.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),ti.prototype.playerEvent="timeupdate",ir.registerComponent("SeekBar",ti);var ei=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.handleMouseMove=Ke(qe(i,i.handleMouseMove),25),i.throttledHandleMouseSeek=Ke(qe(i,i.handleMouseSeek),25),i.enable(),i}return be(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},e.prototype.handleMouseMove=function(t){var e=this.getChild("seekBar");if(e){var r=e.getChild("mouseTimeDisplay"),n=e.el(),i=P(n),o=O(n,t).x;o>1?o=1:o<0&&(o=0),r&&r.update(i,o)}},e.prototype.handleMouseSeek=function(t){var e=this.getChild("seekBar");e&&e.handleMouseMove(t)},e.prototype.enabled=function(){return this.enabled_},e.prototype.disable=function(){this.children().forEach(function(t){return t.disable&&t.disable()}),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},e.prototype.enable=function(){this.children().forEach(function(t){return t.enable&&t.enable()}),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},e.prototype.handleMouseDown=function(t){var e=this.el_.ownerDocument,r=this.getChild("seekBar");r&&r.handleMouseDown(t),this.on(e,"mousemove",this.throttledHandleMouseSeek),this.on(e,"touchmove",this.throttledHandleMouseSeek),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchend",this.handleMouseUp)},e.prototype.handleMouseUp=function(t){var e=this.el_.ownerDocument,r=this.getChild("seekBar");r&&r.handleMouseUp(t),this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchend",this.handleMouseUp)},e}(ir);ei.prototype.options_={children:["seekBar"]},ir.registerComponent("ProgressControl",ei);var ri=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.on(r,"fullscreenchange",i.handleFullscreenChange),!1===Gt[or.fullscreenEnabled]&&i.disable(),i}return be(e,t),e.prototype.buildCSSClass=function(){return"vjs-fullscreen-control "+t.prototype.buildCSSClass.call(this)},e.prototype.handleFullscreenChange=function(t){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},e.prototype.handleClick=function(t){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},e}(Ln);ri.prototype.controlText_="Fullscreen",ir.registerComponent("FullscreenToggle",ri);var ni=function(t,e){e.tech_&&!e.tech_.featuresVolumeControl&&t.addClass("vjs-hidden"),t.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})},ii=function(t){function e(){ return _e(this,e),Te(this,t.apply(this,arguments))}return be(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:''})},e}(ir);ir.registerComponent("VolumeLevel",ii);var oi=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.on("slideractive",i.updateLastVolume_),i.on(r,"volumechange",i.updateARIAAttributes),r.ready(function(){return i.updateARIAAttributes()}),i}return be(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},e.prototype.handleMouseDown=function(e){R(e)&&t.prototype.handleMouseDown.call(this,e)},e.prototype.handleMouseMove=function(t){R(t)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(t)))},e.prototype.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},e.prototype.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},e.prototype.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},e.prototype.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},e.prototype.updateARIAAttributes=function(t){var e=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",e),this.el_.setAttribute("aria-valuetext",e+"%")},e.prototype.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},e.prototype.updateLastVolume_=function(){var t=this,e=this.player_.volume();this.one("sliderinactive",function(){0===t.player_.volume()&&t.player_.lastVolume_(e)})},e}($n);oi.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},oi.prototype.playerEvent="volumechange",ir.registerComponent("VolumeBar",oi);var si=function(t){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_e(this,e),n.vertical=n.vertical||!1,(void 0===n.volumeBar||i(n.volumeBar))&&(n.volumeBar=n.volumeBar||{},n.volumeBar.vertical=n.vertical);var o=Te(this,t.call(this,r,n));return ni(o,r),o.throttledHandleMouseMove=Ke(qe(o,o.handleMouseMove),25),o.on("mousedown",o.handleMouseDown),o.on("touchstart",o.handleMouseDown),o.on(o.volumeBar,["focus","slideractive"],function(){o.volumeBar.addClass("vjs-slider-active"),o.addClass("vjs-slider-active"),o.trigger("slideractive")}),o.on(o.volumeBar,["blur","sliderinactive"],function(){o.volumeBar.removeClass("vjs-slider-active"),o.removeClass("vjs-slider-active"),o.trigger("sliderinactive")}),o}return be(e,t),e.prototype.createEl=function(){var e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),t.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+e})},e.prototype.handleMouseDown=function(t){var e=this.el_.ownerDocument;this.on(e,"mousemove",this.throttledHandleMouseMove),this.on(e,"touchmove",this.throttledHandleMouseMove),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchend",this.handleMouseUp)},e.prototype.handleMouseUp=function(t){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseMove),this.off(e,"touchmove",this.throttledHandleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchend",this.handleMouseUp)},e.prototype.handleMouseMove=function(t){this.volumeBar.handleMouseMove(t)},e}(ir);si.prototype.options_={children:["volumeBar"]},ir.registerComponent("VolumeControl",si);var ai=function(t,e){e.tech_&&!e.tech_.featuresMuteControl&&t.addClass("vjs-hidden"),t.on(e,"loadstart",function(){e.tech_.featuresMuteControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})},li=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return ai(i,r),i.on(r,["loadstart","volumechange"],i.update),i}return be(e,t),e.prototype.buildCSSClass=function(){return"vjs-mute-control "+t.prototype.buildCSSClass.call(this)},e.prototype.handleClick=function(t){var e=this.player_.volume(),r=this.player_.lastVolume_();if(0===e){var n=r<.1?.1:r;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},e.prototype.update=function(t){this.updateIcon_(),this.updateControlText_()},e.prototype.updateIcon_=function(){var t=this.player_.volume(),e=3;ee&&this.player_.muted(this.player_.tech_.el_.muted),0===t||this.player_.muted()?e=0:t<.33?e=1:t<.67&&(e=2);for(var r=0;r<4;r++)b(this.el_,"vjs-vol-"+r);_(this.el_,"vjs-vol-"+e)},e.prototype.updateControlText_=function(){var t=this.player_.muted()||0===this.player_.volume(),e=t?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},e}(Ln);li.prototype.controlText_="Mute",ir.registerComponent("MuteToggle",li);var ci=function(t){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_e(this,e),void 0!==n.inline?n.inline=n.inline:n.inline=!0,(void 0===n.volumeControl||i(n.volumeControl))&&(n.volumeControl=n.volumeControl||{},n.volumeControl.vertical=!n.inline);var o=Te(this,t.call(this,r,n));return o.on(r,["loadstart"],o.volumePanelState_),o.on(o.volumeControl,["slideractive"],o.sliderActive_),o.on(o.volumeControl,["sliderinactive"],o.sliderInactive_),o}return be(e,t),e.prototype.sliderActive_=function(){this.addClass("vjs-slider-active")},e.prototype.sliderInactive_=function(){this.removeClass("vjs-slider-active")},e.prototype.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},e.prototype.createEl=function(){var e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),t.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+e})},e}(ir);ci.prototype.options_={children:["muteToggle","volumeControl"]},ir.registerComponent("VolumePanel",ci);var ui=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return n&&(i.menuButton_=n.menuButton),i.focusedChild_=-1,i.on("keydown",i.handleKeyPress),i}return be(e,t),e.prototype.addItem=function(t){this.addChild(t),t.on("click",qe(this,function(e){this.menuButton_&&(this.menuButton_.unpressButton(),"CaptionSettingsMenuItem"!==t.name()&&this.menuButton_.focus())}))},e.prototype.createEl=function(){var e=this.options_.contentElType||"ul";this.contentEl_=v(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var r=t.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return r.appendChild(this.contentEl_),q(r,"click",function(t){t.preventDefault(),t.stopImmediatePropagation()}),r},e.prototype.dispose=function(){this.contentEl_=null,t.prototype.dispose.call(this)},e.prototype.handleKeyPress=function(t){37===t.which||40===t.which?(t.preventDefault(),this.stepForward()):38!==t.which&&39!==t.which||(t.preventDefault(),this.stepBack())},e.prototype.stepForward=function(){var t=0;void 0!==this.focusedChild_&&(t=this.focusedChild_+1),this.focus(t)},e.prototype.stepBack=function(){var t=0;void 0!==this.focusedChild_&&(t=this.focusedChild_-1),this.focus(t)},e.prototype.focus=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.children().slice();e.length&&e[0].className&&/vjs-menu-title/.test(e[0].className)&&e.shift(),e.length>0&&(t<0?t=0:t>=e.length&&(t=e.length-1),this.focusedChild_=t,e[t].el_.focus())},e}(ir);ir.registerComponent("Menu",ui);var hi=function(t){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_e(this,e);var i=Te(this,t.call(this,r,n));i.menuButton_=new Ln(r,n),i.menuButton_.controlText(i.controlText_),i.menuButton_.el_.setAttribute("aria-haspopup","true");var o=Ln.prototype.buildCSSClass();return i.menuButton_.el_.className=i.buildCSSClass()+" "+o,i.menuButton_.removeClass("vjs-control"),i.addChild(i.menuButton_),i.update(),i.enabled_=!0,i.on(i.menuButton_,"tap",i.handleClick),i.on(i.menuButton_,"click",i.handleClick),i.on(i.menuButton_,"focus",i.handleFocus),i.on(i.menuButton_,"blur",i.handleBlur),i.on("keydown",i.handleSubmenuKeyPress),i}return be(e,t),e.prototype.update=function(){var t=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=t,this.addChild(t),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},e.prototype.createMenu=function(){var t=new ui(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var e=v("li",{className:"vjs-menu-title",innerHTML:Q(this.options_.title),tabIndex:-1});this.hideThreshold_+=1,t.children_.unshift(e),g(e,t.contentEl())}if(this.items=this.createItems(),this.items)for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:this.menuButton_.el();return this.menuButton_.controlText(t,e)},e.prototype.handleClick=function(t){this.one(this.menu.contentEl(),"mouseleave",qe(this,function(t){this.unpressButton(),this.el_.blur()})),this.buttonPressed_?this.unpressButton():this.pressButton()},e.prototype.focus=function(){this.menuButton_.focus()},e.prototype.blur=function(){this.menuButton_.blur()},e.prototype.handleFocus=function(){q(Gt,"keydown",qe(this,this.handleKeyPress))},e.prototype.handleBlur=function(){K(Gt,"keydown",qe(this,this.handleKeyPress))},e.prototype.handleKeyPress=function(t){27===t.which||9===t.which?(this.buttonPressed_&&this.unpressButton(),9!==t.which&&(t.preventDefault(),this.menuButton_.el_.focus())):38!==t.which&&40!==t.which||this.buttonPressed_||(this.pressButton(),t.preventDefault())},e.prototype.handleSubmenuKeyPress=function(t){27!==t.which&&9!==t.which||(this.buttonPressed_&&this.unpressButton(),9!==t.which&&(t.preventDefault(),this.menuButton_.el_.focus()))},e.prototype.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),ee&&d())return;this.menu.focus()}},e.prototype.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},e.prototype.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},e.prototype.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},e}(ir);ir.registerComponent("MenuButton",hi);var pi=function(t){function e(r,n){_e(this,e);var i=n.tracks,o=Te(this,t.call(this,r,n));if(o.items.length<=1&&o.hide(),!i)return Te(o);var s=qe(o,o.update);return i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),o.player_.on("ready",s),o.player_.on("dispose",function(){i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s)}),o}return be(e,t),e}(hi);ir.registerComponent("TrackButton",pi);var di=function(t){function e(r,n){_e(this,e);var i=Te(this,t.call(this,r,n));return i.selectable=n.selectable,i.isSelected_=n.selected||!1,i.multiSelectable=n.multiSelectable,i.selected(i.isSelected_),i.selectable?i.multiSelectable?i.el_.setAttribute("role","menuitemcheckbox"):i.el_.setAttribute("role","menuitemradio"):i.el_.setAttribute("role","menuitem"),i}return be(e,t),e.prototype.createEl=function(e,n,i){return this.nonIconControl=!0,t.prototype.createEl.call(this,"li",r({className:"vjs-menu-item",innerHTML:''+this.localize(this.options_.label)+"",tabIndex:-1},n),i)},e.prototype.handleClick=function(t){this.selected(!0)},e.prototype.selected=function(t){this.selectable&&(t?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))},e}(On);ir.registerComponent("MenuItem",di);var fi=function(t){function e(r,n){_e(this,e);var i=n.track,o=r.textTracks();n.label=i.label||i.language||"Unknown",n.selected="showing"===i.mode;var s=Te(this,t.call(this,r,n));s.track=i;var a=function(){for(var t=arguments.length,e=Array(t),r=0;r-1?"showing"!==s.mode&&(s.mode="showing"):"disabled"!==s.mode&&(s.mode="disabled")}},e.prototype.handleTracksChange=function(t){var e="showing"===this.track.mode;e!==this.isSelected_&&this.selected(e)},e.prototype.handleSelectedLanguageChange=function(t){if("showing"===this.track.mode){var e=this.player_.cache_.selectedLanguage;if(e&&e.enabled&&e.language===this.track.language&&e.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},e.prototype.dispose=function(){this.track=null,t.prototype.dispose.call(this)},e}(di);ir.registerComponent("TextTrackMenuItem",fi);var vi=function(t){function e(r,n){return _e(this,e),n.track={player:r,kind:n.kind,kinds:n.kinds,default:!1,mode:"disabled"},n.kinds||(n.kinds=[n.kind]),n.label?n.track.label=n.label:n.track.label=n.kinds.join(" and ")+" off",n.selectable=!0,n.multiSelectable=!1,Te(this,t.call(this,r,n))}return be(e,t),e.prototype.handleTracksChange=function(t){for(var e=this.player().textTracks(),r=!0,n=0,i=e.length;n-1&&"showing"===o.mode){r=!1;break}}r!==this.isSelected_&&this.selected(r)},e.prototype.handleSelectedLanguageChange=function(t){for(var e=this.player().textTracks(),r=!0,n=0,i=e.length;n-1&&"showing"===o.mode){r=!1;break}}r&&(this.player_.cache_.selectedLanguage={enabled:!1})},e}(fi);ir.registerComponent("OffTextTrackMenuItem",vi);var yi=function(t){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _e(this,e),n.tracks=r.textTracks(),Te(this,t.call(this,r,n))}return be(e,t),e.prototype.createItems=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fi,r=void 0;this.label_&&(r=this.label_+" off"),t.push(new vi(this.player_,{kinds:this.kinds_,kind:this.kind_,label:r})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var i=0;i-1){var s=new e(this.player_,{track:o,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+o.kind+"-menu-item"),t.push(s)}}return t},e}(pi);ir.registerComponent("TextTrackButton",yi);var gi=function(t){function e(r,n){_e(this,e);var i=n.track,o=n.cue,s=r.currentTime();n.selectable=!0,n.multiSelectable=!1,n.label=o.text,n.selected=o.startTime<=s&&s=0;e--){var r=t[e];if(r.kind===this.kind_)return r}},e.prototype.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Q(this.kind_))},e.prototype.createMenu=function(){return this.options_.title=this.getMenuCaption(),t.prototype.createMenu.call(this)},e.prototype.createItems=function(){var t=[];if(!this.track_)return t;var e=this.track_.cues;if(!e)return t;for(var r=0,n=e.length;r