UNPKG

@s3bubble/player

Version:

Standalone S3Bubble DRM Media Player

2 lines 2.21 MB
/*! s3bubble 25-03-2022 */ function s3bubbleInit(){var r="https://s3bubbleapi.com",s={hasProp:function(e,t){for(var n in e)if(e.hasOwnProperty(n)){if(n===t&&""!==e[n]&&void 0!==e[n]&&null!==e[n]&&!1!==e[n])return e;if(e[n]instanceof Object&&s.hasProp(e[n],t))return e[n]}return null},extend:function(e,t){for(var n in t)"object"==typeof e[n]?s.extend(e[n],t[n]):e[n]=t[n];return e},setCookie:function(e,t,n){var r,n=n?((r=new Date).setTime(r.getTime()+24*n*60*60*1e3),"; expires="+r.toGMTString()):"";document.cookie=e+"="+t+n+";path=/"},extractHostname:function(e){e=-1<e.indexOf("//")?e.split("/")[2]:e.split("/")[0];return e=(e=e.split(":")[0]).split("?")[0]},isScrolledIntoView:function(e){var t;if(e.getBoundingClientRect())return t=e.getBoundingClientRect().top,e=e.getBoundingClientRect().bottom,t<window.innerHeight&&0<=e},isURL:function(e){var t=document.createElement("a");return t.href=e,t.host&&t.host!=window.location.host},setFontSize:function(e){if(document.getElementById(e.id)){var t=document.getElementById(e.id).offsetWidth,n=9999,r=1,i=9999,a=1;if(e.hasOwnProperty("elements"))for(var o,s=e.elements,l=s.length-1;0<=l;l--)s[l].hasOwnProperty("fontRatio")&&s[l].hasOwnProperty("el")&&(o=(n<t?n:t<r?r:t)/s[l].fontRatio,s[l].el.style.fontSize=Math.floor(i<o?i:o<a?a:o)+"px")}},isScriptAlreadyIncluded:function(e){for(var t=document.getElementsByTagName("script"),n=0;n<t.length;n++)if(t[n].getAttribute("src")==e)return!0;return!1},addScripts:function(){s.isScriptAlreadyIncluded("https://imasdk.googleapis.com/js/sdkloader/ima3.js")||((e=document.createElement("script")).type="text/javascript",e.defer=!0,e.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",document.head.appendChild(e)),s.isScriptAlreadyIncluded("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1")||((e=document.createElement("script")).type="text/javascript",e.defer=!0,e.src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",document.head.appendChild(e));for(var e,t,n=document.getElementsByClassName("s3bmedia"),r=0;r<n.length;r++)n[r].getAttribute("data-code")&&(t={type:n[r].getAttribute("data-type")?n[r].getAttribute("data-type"):"video",code:n[r].getAttribute("data-code"),options:{},meta:{}},n[r].getAttribute("data-is360")&&(t.is360=n[r].getAttribute("data-is360")),n[r].getAttribute("data-autoplay")&&(t.options.autoplay=!0),n[r].getAttribute("data-forceAutoplay")&&(t.options.forceAutoplay=!0),n[r].getAttribute("data-muted")&&(t.options.muted=!0),n[r].getAttribute("data-width")&&(t.options.width=n[r].getAttribute("data-width")),n[r].getAttribute("data-height")&&(t.options.height=n[r].getAttribute("data-height")),n[r].getAttribute("data-poster")&&(t.options.poster=n[r].getAttribute("data-poster")),n[r].getAttribute("data-subTitle")&&(t.meta.subTitle=n[r].getAttribute("data-subTitle")),n[r].getAttribute("data-title")&&(t.meta.title=n[r].getAttribute("data-title")),n[r].getAttribute("data-para")&&(t.meta.para=n[r].getAttribute("data-para")),n[r].getAttribute("data-showSocial")&&(t.meta.showSocial=!0),n[r].getAttribute("data-backButton")&&(t.meta.backButton=!0),n[r].id="s3bmedia-"+r,s3bubble("s3bmedia-"+r).media(t));for(var i,a=document.getElementsByClassName("s3bdrm"),o=0;o<a.length;o++)a[o].getAttribute("data-code")&&(i={type:a[o].getAttribute("data-type")?a[o].getAttribute("data-type"):"video",widevine:a[o].getAttribute("data-widevine"),playready:a[o].getAttribute("data-playready"),fairplay:a[o].getAttribute("data-fairplay"),assetid:a[o].getAttribute("data-assetid"),options:{},meta:{}},a[o].getAttribute("data-is360")&&(i.is360=a[o].getAttribute("data-is360")),a[o].getAttribute("data-autoplay")&&(i.options.autoplay=!0),a[o].getAttribute("data-forceAutoplay")&&(i.options.forceAutoplay=!0),a[o].getAttribute("data-muted")&&(i.options.muted=!0),a[o].getAttribute("data-width")&&(i.options.width=a[o].getAttribute("data-width")),a[o].getAttribute("data-height")&&(i.options.height=a[o].getAttribute("data-height")),a[o].getAttribute("data-poster")&&(i.options.poster=a[o].getAttribute("data-poster")),a[o].getAttribute("data-subTitle")&&(i.meta.subTitle=a[o].getAttribute("data-subTitle")),a[o].getAttribute("data-title")&&(i.meta.title=a[o].getAttribute("data-title")),a[o].getAttribute("data-para")&&(i.meta.para=a[o].getAttribute("data-para")),a[o].getAttribute("data-showSocial")&&(i.meta.showSocial=!0),a[o].getAttribute("data-backButton")&&(i.meta.backButton=!0),a[o].id="s3bdrm-"+r,s3bubble("s3bdrm-"+r).drm(i))},setParams:function(e){var t,n="";for(t in e)e.hasOwnProperty(t)&&(0<n.length&&(n+="&"),n+=encodeURI(t+"="+e[t]));return n},base64DecodeUint8Array:function(e){var t=window.atob(e),n=t.length,r=new Uint8Array(new ArrayBuffer(n));for(i=0;i<n;i++)r[i]=t.charCodeAt(i);return r},base64EncodeUint8Array:function(e){for(var t,n,r,i,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="",u=0;u<e.length;)r=(t=e[u++])>>2,i=(3&t)<<4|(t=u<e.length?e[u++]:Number.NaN)>>4,a=(15&t)<<2|(n=u<e.length?e[u++]:Number.NaN)>>6,o=63&n,isNaN(t)?a=o=64:isNaN(n)&&(o=64),l+=s.charAt(r)+s.charAt(i)+s.charAt(a)+s.charAt(o);return l},getData:function(e,i){e.location=location.host.indexOf("www.")&&location.host||location.host.replace("www.","");var t={"Content-Type":"application/x-www-form-urlencoded"};let n;n=window?.s3b?.api?(t.Authorization=window.s3b.api,{method:"GET",uri:r+"/player?code="+e.code,headers:t}):{method:"POST",body:s.setParams(e),uri:r+"/api/"+e.uri,headers:t},videojs.xhr(n,function(e,t,n){var r=t.body?JSON.parse(t.body):{message:"Connectivity Error: Please check your internet connection!"};200===t.statusCode?r.error?i({error:!0,message:r.message}):i(r):i({error:!0,message:r.message+" Status: "+t.statusCode})})},s3bubbleCleanFilename:function(t){if(""===t||void 0===t||!1===t)return null;try{return t=(t=(t=(t=decodeURIComponent(t)).replace(/\\/g,"")).replace(/\_/g," ")).replace(/\-/g," ")}catch(e){return t=(t=(t=t.replace(/\\/g,"")).replace(/\_/g," ")).replace(/\-/g," ")}},truncate:function(e,t){return e.length>t?e.substr(0,t-1)+"&hellip;":e},s3bubbleRgbToHex:function(e){return-1!==e.indexOf("#")?e:(e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):""}};return s}!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){"use strict";for(var n,l="7.17.0",i={},a=function(e,t){return i[e]=i[e]||[],t&&(i[e]=i[e].concat(t)),i[e]},s=function(e,t){t=a(e).indexOf(t);return!(t<=-1)&&(i[e]=i[e].slice(),i[e].splice(t,1),!0)},f={prefixed:!0},p=[["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"]],m=p[0],g=0;g<p.length;g++)if(p[g][1]in document){n=p[g];break}if(n){for(var y=0;y<n.length;y++)f[m[y]]=n[y];f.prefixed=n[0]!==m[0]}var v=[];var d=function t(n){function r(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i("log",s,t)}var i,a,o,s="info";return a=n,i=function(e,t,n){var r,t=o.levels[t],i=new RegExp("^("+t+")$");"log"!==e&&n.unshift(e.toUpperCase()+":"),n.unshift(a+":"),v&&(v.push([].concat(n)),r=v.length-1e3,v.splice(0,0<r?r:0)),!window.console||(r=(r=window.console[e])||"debug"!==e?r:window.console.info||window.console.log)&&t&&i.test(e)&&r[Array.isArray(n)?"apply":"call"](window.console,n)},(o=r).createLogger=function(e){return t(n+": "+e)},r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:s},r.level=function(e){if("string"==typeof e){if(!r.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');s=e}return s},(r.history=function(){return v?[].concat(v):[]}).filter=function(t){return(v||[]).filter(function(e){return new RegExp(".*"+t+".*").test(e[0])})},r.history.clear=function(){v&&(v.length=0)},r.history.disable=function(){null!==v&&(v.length=0,v=null)},r.history.enable=function(){null===v&&(v=[])},r.error=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i("error",s,t)},r.warn=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i("warn",s,t)},r.debug=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i("debug",s,t)},r}("VIDEOJS"),b=d.createLogger,T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e,t){return e(t={exports:{}},t.exports),t.exports}function A(e){return M(e)?Object.keys(e):[]}var w=E(function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},t.apply(this,arguments)}e.exports=t}),S=Object.prototype.toString;function C(t,n){A(t).forEach(function(e){return n(t[e],e)})}function x(n){for(var e=arguments.length,t=new Array(1<e?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Object.assign?w.apply(void 0,[n].concat(t)):(t.forEach(function(e){e&&C(e,function(e,t){n[t]=e})}),n)}function M(e){return!!e&&"object"==typeof e}function I(e){return M(e)&&"[object Object]"===S.call(e)&&e.constructor===Object}function R(e,t){if(!e||!t)return"";if("function"!=typeof window.getComputedStyle)return"";var n;try{n=window.getComputedStyle(e)}catch(e){return""}return n?n.getPropertyValue(t)||n[t]:""}var P=window.navigator&&window.navigator.userAgent||"",e=/AppleWebKit\/([\d.]+)/i.exec(P),e=e?parseFloat(e.pop()):null,D=/iPod/i.test(P),L=(L=P.match(/OS (\d+)_/i))&&L[1]?L[1]:null,O=/Android/i.test(P),N=function(){var e=P.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),k=O&&N<5&&e<537,F=/Firefox/i.test(P),B=/Edg/i.test(P),j=!B&&(/Chrome/i.test(P)||/CriOS/i.test(P)),U=(e=P.match(/(Chrome|CriOS)\/(\d+)/))&&e[2]?parseFloat(e[2]):null,H=e=!(e=(e=/MSIE\s(\d+)\.\d/.exec(P))&&parseFloat(e[1]))&&/Trident\/7.0/i.test(P)&&/rv:11.0/.test(P)?11:e,e=/Safari/i.test(P)&&!j&&!O&&!B,V=/Windows/i.test(P),z=Boolean(Z()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch)),q=/iPad/i.test(P)||e&&z&&!/iPhone/i.test(P),W=/iPhone/i.test(P)&&!q,Y=W||q||D,K=(e||Y)&&!j,D=Object.freeze({__proto__:null,IS_IPOD:D,IOS_VERSION:L,IS_ANDROID:O,ANDROID_VERSION:N,IS_NATIVE_ANDROID:k,IS_FIREFOX:F,IS_EDGE:B,IS_CHROME:j,CHROME_VERSION:U,IE_VERSION:H,IS_SAFARI:e,IS_WINDOWS:V,TOUCH_ENABLED:z,IS_IPAD:q,IS_IPHONE:W,IS_IOS:Y,IS_ANY_SAFARI:K});function X(e){return"string"==typeof e&&Boolean(e.trim())}function Q(e){if(0<=e.indexOf(" "))throw new Error("class has illegal whitespace characters")}function Z(){return document===window.document}function J(e){return M(e)&&1===e.nodeType}function $(){try{return window.parent!==window.self}catch(e){return!0}}function ee(n){return function(e,t){if(!X(e))return document[n](null);t=J(t=X(t)?document.querySelector(t):t)?t:document;return t[n]&&t[n](e)}}function te(e,n,t,r){void 0===e&&(e="div"),void 0===n&&(n={}),void 0===t&&(t={});var i=document.createElement(e);return Object.getOwnPropertyNames(n).forEach(function(e){var t=n[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(d.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+t+"."),i.setAttribute(e,t)):"textContent"===e?ne(i,t):i[e]===t&&"tabIndex"!==e||(i[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){i.setAttribute(e,t[e])}),r&&Te(i,r),i}function ne(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function re(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ie(e,t){return Q(t),e.classList?e.classList.contains(t):new RegExp("(^|\\s)"+t+"($|\\s)").test(e.className)}function ae(e,t){return e.classList?e.classList.add(t):ie(e,t)||(e.className=(e.className+" "+t).trim()),e}function oe(e,t){return e?(e.classList?e.classList.remove(t):(Q(t),e.className=e.className.split(/\s+/).filter(function(e){return e!==t}).join(" ")),e):(d.warn("removeClass was called with an element that doesn't exist"),null)}function se(e,t,n){var r=ie(e,t);if((n="boolean"!=typeof(n="function"==typeof n?n(e,t):n)?!r:n)!==r)return(n?ae:oe)(e,t),e}function le(n,r){Object.getOwnPropertyNames(r).forEach(function(e){var t=r[e];null==t||!1===t?n.removeAttribute(e):n.setAttribute(e,!0===t?"":t)})}function ue(e){var t={},n=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&0<e.attributes.length)for(var r=e.attributes,i=r.length-1;0<=i;i--){var a=r[i].name,o=r[i].value;"boolean"!=typeof e[a]&&-1===n.indexOf(","+a+",")||(o=null!==o),t[a]=o}return t}function ce(e,t){return e.getAttribute(t)}function de(e,t,n){e.setAttribute(t,n)}function he(e,t){e.removeAttribute(t)}function fe(){document.body.focus(),document.onselectstart=function(){return!1}}function pe(){document.onselectstart=function(){return!0}}function me(e){var t,n;if(e&&e.getBoundingClientRect&&e.parentNode)return t=e.getBoundingClientRect(),n={},["bottom","height","left","right","top","width"].forEach(function(e){void 0!==t[e]&&(n[e]=t[e])}),n.height||(n.height=parseFloat(R(e,"height"))),n.width||(n.width=parseFloat(R(e,"width"))),n}function ge(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,n=e.offsetHeight,r=0,i=0;e.offsetParent&&e!==document[f.fullscreenElement];)r+=e.offsetLeft,i+=e.offsetTop,e=e.offsetParent;return{left:r,top:i,width:t,height:n}}function ye(e,t){var n={x:0,y:0};if(Y)for(var r=e;r&&"html"!==r.nodeName.toLowerCase();){var i,a=R(r,"transform");/^matrix/.test(a)?(i=a.slice(7,-1).split(/,\s/).map(Number),n.x+=i[4],n.y+=i[5]):/^matrix3d/.test(a)&&(i=a.slice(9,-1).split(/,\s/).map(Number),n.x+=i[12],n.y+=i[13]),r=r.parentNode}var o={},s=ge(t.target),e=ge(e),l=e.width,c=e.height,u=t.offsetY-(e.top-s.top),s=t.offsetX-(e.left-s.left);return t.changedTouches&&(s=t.changedTouches[0].pageX-e.left,u=t.changedTouches[0].pageY+e.top,Y&&(s-=n.x,u-=n.y)),o.y=1-Math.max(0,Math.min(1,u/c)),o.x=Math.max(0,Math.min(1,s/l)),o}function ve(e){return M(e)&&3===e.nodeType}function _e(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function be(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(function(e){return J(e="function"==typeof e?e():e)||ve(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0}).filter(function(e){return e})}function Te(t,e){return be(e).forEach(function(e){return t.appendChild(e)}),t}function Ee(e,t){return Te(_e(e),t)}function Ae(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))}function we(){if(!1!==Se.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),n=Array.prototype.slice.call(document.getElementsByTagName("video-js")),r=e.concat(t,n);if(r&&0<r.length)for(var i=0,a=r.length;i<a;i++){var o=r[i];if(!o||!o.getAttribute){Re(1);break}void 0===o.player&&null!==o.getAttribute("data-setup")&&Se(o)}else Ie||Re(1)}}var Se,Ce=ee("querySelector"),xe=ee("querySelectorAll"),Me=Object.freeze({__proto__:null,isReal:Z,isEl:J,isInFrame:$,createEl:te,textContent:ne,prependTo:re,hasClass:ie,addClass:ae,removeClass:oe,toggleClass:se,setAttributes:le,getAttributes:ue,getAttribute:ce,setAttribute:de,removeAttribute:he,blockTextSelection:fe,unblockTextSelection:pe,getBoundingClientRect:me,findPosition:ge,getPointerPosition:ye,isTextNode:ve,emptyEl:_e,normalizeContent:be,appendContent:Te,insertContent:Ee,isSingleLeftClick:Ae,$:Ce,$$:xe}),Ie=!1;function Re(e,t){Z()&&(t&&(Se=t),window.setTimeout(we,e))}function Pe(){Ie=!0,window.removeEventListener("load",Pe)}Z()&&("complete"===document.readyState?Pe():window.addEventListener("load",Pe));function De(e){var t=document.createElement("style");return t.className=e,t}function Le(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t}var Oe=3;window.WeakMap||(Nt=function(){function e(){this.vdata="vdata"+Math.floor(window.performance&&window.performance.now()||Date.now()),this.data={}}var t=e.prototype;return t.set=function(e,t){var n=e[this.vdata]||Oe++;return e[this.vdata]||(e[this.vdata]=n),this.data[n]=t,this},t.get=function(e){var t=e[this.vdata];if(t)return this.data[t];d("We have no data for this element",e)},t.has=function(e){return e[this.vdata]in this.data},t.delete=function(e){var t=e[this.vdata];t&&(delete this.data[t],delete e[this.vdata])},e}());var Ne,ke=new(window.WeakMap?WeakMap:Nt);function Fe(e,t){var n;ke.has(e)&&(0===(n=ke.get(e)).handlers[t].length&&(delete n.handlers[t],e.removeEventListener?e.removeEventListener(t,n.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,n.dispatcher)),Object.getOwnPropertyNames(n.handlers).length<=0&&(delete n.handlers,delete n.dispatcher,delete n.disabled),0===Object.getOwnPropertyNames(n).length&&ke.delete(e))}function Be(t,n,e,r){e.forEach(function(e){t(n,e,r)})}function je(e){if(e.fixed_)return e;function t(){return!0}function n(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){var r,i,a,o=e||window.event;for(r in e={},o)"layerX"!==r&&"layerY"!==r&&"keyLocation"!==r&&"webkitMovementX"!==r&&"webkitMovementY"!==r&&("returnValue"===r&&o.preventDefault||(e[r]=o[r]));e.target||(e.target=e.srcElement||document),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){o.preventDefault&&o.preventDefault(),e.returnValue=!1,o.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){o.stopPropagation&&o.stopPropagation(),e.cancelBubble=!0,o.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=n,e.stopImmediatePropagation=function(){o.stopImmediatePropagation&&o.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=n,null!==e.clientX&&void 0!==e.clientX&&(i=document.documentElement,a=document.body,e.pageX=e.clientX+(i&&i.scrollLeft||a&&a.scrollLeft||0)-(i&&i.clientLeft||a&&a.clientLeft||0),e.pageY=e.clientY+(i&&i.scrollTop||a&&a.scrollTop||0)-(i&&i.clientTop||a&&a.clientTop||0)),e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}var Ue=["touchstart","touchmove"];function He(o,e,t){if(Array.isArray(e))return Be(He,o,e,t);ke.has(o)||ke.set(o,{});var s=ke.get(o);s.handlers||(s.handlers={}),s.handlers[e]||(s.handlers[e]=[]),t.guid||(t.guid=Oe++),s.handlers[e].push(t),s.dispatcher||(s.disabled=!1,s.dispatcher=function(e,t){if(!s.disabled){e=je(e);var n=s.handlers[e.type];if(n)for(var r=n.slice(0),i=0,a=r.length;i<a&&!e.isImmediatePropagationStopped();i++)try{r[i].call(o,e,t)}catch(e){d.error(e)}}}),1===s.handlers[e].length&&(o.addEventListener?(t=!1,function(){if("boolean"!=typeof Ne){Ne=!1;try{var e=Object.defineProperty({},"passive",{get:function(){Ne=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){}}return Ne}()&&-1<Ue.indexOf(e)&&(t={passive:!0}),o.addEventListener(e,s.dispatcher,t)):o.attachEvent&&o.attachEvent("on"+e,s.dispatcher))}function Ge(e,t,n){if(ke.has(e)){var r=ke.get(e);if(r.handlers){if(Array.isArray(t))return Be(Ge,e,t,n);var i=function(e,t){r.handlers[t]=[],Fe(e,t)};if(void 0!==t){var a=r.handlers[t];if(a)if(n){if(n.guid)for(var o=0;o<a.length;o++)a[o].guid===n.guid&&a.splice(o--,1);Fe(e,t)}else i(e,t)}else for(var s in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},s)&&i(e,s)}}}function Ve(e,t,n){var r=ke.has(e)?ke.get(e):{},i=e.parentNode||e.ownerDocument;return"string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=je(t),r.dispatcher&&r.dispatcher.call(e,t,n),i&&!t.isPropagationStopped()&&!0===t.bubbles?Ve.call(null,i,t,n):!i&&!t.defaultPrevented&&t.target&&t.target[t.type]&&(ke.has(t.target)||ke.set(t.target,{}),r=ke.get(t.target),t.target[t.type]&&(r.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),r.disabled=!1)),!t.defaultPrevented}function ze(e,t,n){if(Array.isArray(t))return Be(ze,e,t,n);function r(){Ge(e,t,r),n.apply(this,arguments)}r.guid=n.guid=n.guid||Oe++,He(e,t,r)}function qe(e,t,n){function r(){Ge(e,t,r),n.apply(this,arguments)}r.guid=n.guid=n.guid||Oe++,He(e,t,r)}function We(t,n){var r=window.performance.now();return function(){var e=window.performance.now();n<=e-r&&(t.apply(void 0,arguments),r=e)}}function Ye(r,i,a,o){function e(){var e=this,t=arguments,n=function(){n=s=null,a||r.apply(e,t)};!s&&a&&r.apply(e,t),o.clearTimeout(s),s=o.setTimeout(n,i)}var s;return void 0===o&&(o=window),e.cancel=function(){o.clearTimeout(s),s=null},e}function Ke(){}function Xe(e,t,n){if(!e||!e.nodeName&&!it(e))throw new Error("Invalid target for "+rt(t)+"#"+n+"; must be a DOM node or evented object.")}function Qe(e,t,n){if(!at(e))throw new Error("Invalid event type for "+rt(t)+"#"+n+"; must be a non-empty string or array.")}function Ze(e,t,n){if("function"!=typeof e)throw new Error("Invalid listener for "+rt(t)+"#"+n+"; must be a function.")}function Je(e,t,n){var r,i,a=t.length<3||t[0]===e||t[0]===e.eventBusEl_,t=a?(r=e.eventBusEl_,3<=t.length&&t.shift(),i=t[0],t[1]):(r=t[0],i=t[1],t[2]);return Xe(r,e,n),Qe(i,e,n),Ze(t,e,n),{isTargetingSelf:a,target:r,type:i,listener:t=nt(e,t)}}function $e(e,t,n,r){Xe(e,e,t),e.nodeName?tt[t](e,n,r):e[t](n,r)}var et,tt=Object.freeze({__proto__:null,fixEvent:je,on:He,off:Ge,trigger:Ve,one:ze,any:qe}),nt=function(e,t,n){t.guid||(t.guid=Oe++);e=t.bind(e);return e.guid=n?n+"_"+t.guid:t.guid,e},rt=(Ke.prototype.allowedEvents_={},Ke.prototype.addEventListener=Ke.prototype.on=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},He(this,e,t),this.addEventListener=n},Ke.prototype.removeEventListener=Ke.prototype.off=function(e,t){Ge(this,e,t)},Ke.prototype.one=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},ze(this,e,t),this.addEventListener=n},Ke.prototype.any=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},qe(this,e,t),this.addEventListener=n},Ke.prototype.dispatchEvent=Ke.prototype.trigger=function(e){var t=e.type||e;e=je(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Ve(this,e)},Ke.prototype.queueTrigger=function(e){var t=this,n=(et=et||new Map,e.type||e),r=et.get(this),i=(r||(r=new Map,et.set(this,r)),r.get(n)),i=(r.delete(n),window.clearTimeout(i),window.setTimeout(function(){0===r.size&&(r=null,et.delete(t)),t.trigger(e)},0));r.set(n,i)},function(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e)}),it=function(t){return t instanceof Ke||!!t.eventBusEl_&&["on","one","off","trigger"].every(function(e){return"function"==typeof t[e]})},at=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},ot={on:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i,a=Je(this,n,"on"),u=a.isTargetingSelf,o=a.target,s=a.type,l=a.listener;$e(o,"on",s,l),u||((i=function(){return e.off(o,s,l)}).guid=l.guid,(a=function(){return e.off("dispose",i)}).guid=l.guid,$e(this,"on","dispose",i),$e(o,"on","dispose",a))},one:function(){for(var i=this,e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=Je(this,t,"one"),a=r.isTargetingSelf,o=r.target,s=r.type,l=r.listener;a?$e(o,"one",s,l):((r=function e(){i.off(o,s,e);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];l.apply(null,n)}).guid=l.guid,$e(o,"one",s,r))},any:function(){for(var i=this,e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=Je(this,t,"any"),a=r.isTargetingSelf,o=r.target,s=r.type,l=r.listener;a?$e(o,"any",s,l):((r=function e(){i.off(o,s,e);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];l.apply(null,n)}).guid=l.guid,$e(o,"any",s,r))},off:function(e,t,n){!e||at(e)?Ge(this.eventBusEl_,e,t):(t=t,Xe(e=e,this,"off"),Qe(t,this,"off"),Ze(n,this,"off"),n=nt(this,n),this.off("dispose",n),e.nodeName?(Ge(e,t,n),Ge(e,"dispose",n)):it(e)&&(e.off(t,n),e.off("dispose",n)))},trigger:function(e,t){Xe(this.eventBusEl_,this,"trigger");var n=e&&"string"!=typeof e?e.type:e;if(!at(n)){n="Invalid event type for "+rt(this)+"#trigger; must be a non-empty string or object with a type key that has a non-empty value.";if(!e)throw new Error(n);(this.log||d).error(n)}return Ve(this.eventBusEl_,e,t)}};function st(e,t){t=(t=void 0===t?{}:t).eventBusKey;if(t){if(!e[t].nodeName)throw new Error('The eventBusKey "'+t+'" does not refer to an element.');e.eventBusEl_=e[t]}else e.eventBusEl_=te("span",{className:"vjs-event-bus"});return x(e,ot),e.eventedCallbacks&&e.eventedCallbacks.forEach(function(e){e()}),e.on("dispose",function(){e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&ke.has(e)&&ke.delete(e)}),window.setTimeout(function(){e.eventBusEl_=null},0)}),e}var lt={state:{},setState:function(e){var n,r=this;return C(e="function"==typeof e?e():e,function(e,t){r.state[t]!==e&&((n=n||{})[t]={from:r.state[t],to:e}),r.state[t]=e}),n&&it(this)&&this.trigger({changes:n,type:"statechanged"}),n}};function ut(e,t){return x(e,lt),e.state=x({},e.state,t),"function"==typeof e.handleStateChanged&&it(e)&&e.on("statechanged",e.handleStateChanged),e}function ct(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toLowerCase()})}function dt(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toUpperCase()})}function ht(){for(var n={},e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.forEach(function(e){e&&C(e,function(e,t){I(e)?(I(n[t])||(n[t]={}),n[t]=ht(n[t],e)):n[t]=e})}),n}var ft=window.Map||function(){function e(){this.map_={}}var t=e.prototype;return t.has=function(e){return e in this.map_},t.delete=function(e){var t=this.has(e);return delete this.map_[e],t},t.set=function(e,t){return this.map_[e]=t,this},t.forEach=function(e,t){for(var n in this.map_)e.call(t,this.map_[n],n,this)},e}(),pt=window.Set||function(){function e(){this.set_={}}var t=e.prototype;return t.has=function(e){return e in this.set_},t.delete=function(e){var t=this.has(e);return delete this.set_[e],t},t.add=function(e){return this.set_[e]=1,this},t.forEach=function(e,t){for(var n in this.set_)e.call(t,n,n,this)},e}(),u=function(){function o(e,t,n){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=ht({},this.options_),t=this.options_=ht(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+Oe++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),!1!==t.evented&&(st(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),ut(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new pt,this.setIntervalIds_=new pt,this.rafIds_=new pt,this.namedRafs_=new ft,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(n),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var e=o.prototype;return e.dispose=function(){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),this.el_=null),this.player_=null}},e.isDisposed=function(){return Boolean(this.isDisposed_)},e.player=function(){return this.player_},e.options=function(e){return e&&(this.options_=ht(this.options_,e)),this.options_},e.el=function(){return this.el_},e.createEl=function(e,t,n){return te(e,t,n)},e.localize=function(e,n,t){void 0===t&&(t=e);var r=this.player_.language&&this.player_.language(),i=this.player_.languages&&this.player_.languages(),a=i&&i[r],r=r&&r.split("-")[0],i=i&&i[r],r=t;return a&&a[e]?r=a[e]:i&&i[e]&&(r=i[e]),r=n?r.replace(/\{(\d+)\}/g,function(e,t){t=n[t-1];return void 0===t?e:t}):r},e.handleLanguagechange=function(){},e.contentEl=function(){return this.contentEl_||this.el_},e.id=function(){return this.id_},e.name=function(){return this.name_},e.children=function(){return this.children_},e.getChildById=function(e){return this.childIndex_[e]},e.getChild=function(e){if(e)return this.childNameIndex_[e]},e.getDescendant=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var t=t.reduce(function(e,t){return e.concat(t)},[]),r=this,i=0;i<t.length;i++)if(!(r=r.getChild(t[i]))||!r.getChild)return;return r},e.addChild=function(e,t,n){if(void 0===t&&(t={}),void 0===n&&(n=this.children_.length),"string"==typeof e){var r=dt(e),i=t.componentClass||r,a=(t.name=r,o.getComponent(i));if(!a)throw new Error("Component "+i+" does not exist");if("function"!=typeof a)return null;i=new a(this.player_||this,t)}else i=e;return i.parentComponent_&&i.parentComponent_.removeChild(i),this.children_.splice(n,0,i),i.parentComponent_=this,"function"==typeof i.id&&(this.childIndex_[i.id()]=i),(r=r||i.name&&dt(i.name()))&&(this.childNameIndex_[r]=i,this.childNameIndex_[ct(r)]=i),"function"==typeof i.el&&i.el()&&(a=null,this.children_[n+1]&&(this.children_[n+1].el_?a=this.children_[n+1].el_:J(this.children_[n+1])&&(a=this.children_[n+1])),this.contentEl().insertBefore(i.el(),a)),i},e.removeChild=function(e){if((e="string"==typeof e?this.getChild(e):e)&&this.children_){for(var t,n=!1,r=this.children_.length-1;0<=r;r--)if(this.children_[r]===e){n=!0,this.children_.splice(r,1);break}n&&(e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[dt(e.name())]=null,this.childNameIndex_[ct(e.name())]=null,(t=e.el())&&t.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el()))}},e.initChildren=function(){var n,t,e,r=this,i=this.options_.children;i&&(n=this.options_,t=o.getComponent("Tech"),(e=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter(function(t){return!e.some(function(e){return"string"==typeof e?t===e:t===e.name})})).map(function(e){var t,e="string"==typeof e?i[t=e]||r.options_[t]||{}:(t=e.name,e);return{name:t,opts:e}}).filter(function(e){e=o.getComponent(e.opts.componentClass||dt(e.name));return e&&!t.isTech(e)}).forEach(function(e){var t=e.name,e=e.opts;!1!==(e=void 0!==n[t]?n[t]:e)&&((e=!0===e?{}:e).playerOptions=r.options_.playerOptions,(e=r.addChild(t,e))&&(r[t]=e))}))},e.buildCSSClass=function(){return""},e.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))},e.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0<e.length&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)},e.$=function(e,t){return Ce(e,t||this.contentEl())},e.$$=function(e,t){return xe(e,t||this.contentEl())},e.hasClass=function(e){return ie(this.el_,e)},e.addClass=function(e){ae(this.el_,e)},e.removeClass=function(e){oe(this.el_,e)},e.toggleClass=function(e,t){se(this.el_,e,t)},e.show=function(){this.removeClass("vjs-hidden")},e.hide=function(){this.addClass("vjs-hidden")},e.lockShowing=function(){this.addClass("vjs-lock-showing")},e.unlockShowing=function(){this.removeClass("vjs-lock-showing")},e.getAttribute=function(e){return ce(this.el_,e)},e.setAttribute=function(e,t){de(this.el_,e,t)},e.removeAttribute=function(e){he(this.el_,e)},e.width=function(e,t){return this.dimension("width",e,t)},e.height=function(e,t){return this.dimension("height",e,t)},e.dimensions=function(e,t){this.width(e,!0),this.height(t)},e.dimension=function(e,t,n){if(void 0!==t)return-1!==(""+(t=null===t||t!=t?0:t)).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(n||this.trigger("componentresize"));if(!this.el_)return 0;t=this.el_.style[e],n=t.indexOf("px");return-1!==n?parseInt(t.slice(0,n),10):parseInt(this.el_["offset"+dt(e)],10)},e.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");return t=R(this.el_,e),0!==(t=parseFloat(t))&&!isNaN(t)||(e="offset"+dt(e),t=this.el_[e]),t},e.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},e.currentWidth=function(){return this.currentDimension("width")},e.currentHeight=function(){return this.currentDimension("height")},e.focus=function(){this.el_.focus()},e.blur=function(){this.el_.blur()},e.handleKeyDown=function(e){this.player_&&(e.stopPropagation(),this.player_.handleKeyDown(e))},e.handleKeyPress=function(e){this.handleKeyDown(e)},e.emitTapEvents=function(){function e(){n=!1}var n,t=0,r=null;this.on("touchstart",function(e){1===e.touches.length&&(r={pageX:e.touches[0].pageX,pageY:e.touches[0].pageY},t=window.performance.now(),n=!0)}),this.on("touchmove",function(e){var t;1<e.touches.length?n=!1:r&&(t=e.touches[0].pageX-r.pageX,e=e.touches[0].pageY-r.pageY,10<Math.sqrt(t*t+e*e)&&(n=!1))});this.on("touchleave",e),this.on("touchcancel",e),this.on("touchend",function(e){!(r=null)===n&&window.performance.now()-t<200&&(e.preventDefault(),this.trigger("tap"))})},e.enableTouchActivity=function(){var t,n,e;this.player()&&this.player().reportUserActivity&&(t=nt(this.player(),this.player().reportUserActivity),this.on("touchstart",function(){t(),this.clearInterval(n),n=this.setInterval(t,250)}),e=function(e){t(),this.clearInterval(n)},this.on("touchmove",t),this.on("touchend",e),this.on("touchcancel",e))},e.setTimeout=function(e,t){var n,r=this;return e=nt(this,e),this.clearTimersOnDispose_(),n=window.setTimeout(function(){r.setTimeoutIds_.has(n)&&r.setTimeoutIds_.delete(n),e()},t),this.setTimeoutIds_.add(n),n},e.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e},e.setInterval=function(e,t){e=nt(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e},e.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e},e.requestAnimationFrame=function(e){var t,n=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=nt(this,e),t=window.requestAnimationFrame(function(){n.rafIds_.has(t)&&n.rafIds_.delete(t),e()}),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},e.requestNamedAnimationFrame=function(e,t){var n,r=this;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=nt(this,t),n=this.requestAnimationFrame(function(){t(),r.namedRafs_.has(e)&&r.namedRafs_.delete(e)}),this.namedRafs_.set(e,n),e},e.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},e.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e):this.clearTimeout(e)},e.clearTimersOnDispose_=function(){var r=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(e){var t=e[0],n=e[1];r[t].forEach(function(e,t){return r[n](t)})}),r.clearingTimersOnDispose_=!1}))},o.registerComponent=function(e,t){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var n=o.getComponent("Tech"),n=n&&n.isTech(t),r=o===t||o.prototype.isPrototypeOf(t.prototype);if(n||!r)throw r=n?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+e+'"; '+r+".");e=dt(e),o.components_||(o.components_={});n=o.getComponent("Player");if("Player"===e&&n&&n.players){var i=n.players,r=Object.keys(i);if(i&&0<r.length&&r.map(function(e){return i[e]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return o.components_[e]=t,o.components_[ct(e)]=t},o.getComponent=function(e){if(e&&o.components_)return o.components_[e]},o}();u.prototype.supportsRaf_="function"==typeof window.requestAnimationFrame&&"function"==typeof window.cancelAnimationFrame,u.registerComponent("Component",u);var _=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};var h=function(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t};function mt(e,t,n,r){var i=r,a=n.length-1;if("number"!=typeof i||i<0||a<i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+i+") is non-numeric or out of bounds (0-"+a+").");return n[r][t]}function gt(e){var t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:mt.bind(null,"start",0,e),end:mt.bind(null,"end",1,e)};return window.Symbol&&window.Symbol.iterator&&(t[window.Symbol.iterator]=function(){return(e||[]).values()}),t}function yt(e,t){return Array.isArray(e)?gt(e):void 0===e||void 0===t?gt():gt([[e,t]])}function vt(e,t){var n,r,i=0;if(!t)return 0;e&&e.length||(e=yt(0,0));for(var a=0;a<e.length;a++)n=e.start(a),i+=(r=t<(r=e.end(a))?t:r)-n;return i/t}function _t(e){if(e instanceof _t)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:M(e)&&("number"==typeof e.code&&(this.code=e.code),x(this,e)),this.message||(this.message=_t.defaultMessages[this.code]||"")}_t.prototype.code=0,_t.prototype.message="",_t.prototype.status=null,_t.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],_t.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 bt=0;bt<_t.errorTypes.length;bt++)_t[_t.errorTypes[bt]]=bt,_t.prototype[_t.errorTypes[bt]]=bt;var Tt=function(e,t){var n,r=null;try{n=JSON.parse(e,t)}catch(e){r=e}return[r,n]};function Et(e){return null!=e&&"function"==typeof e.then}function At(e){Et(e)&&e.then(null,function(e){})}function wt(r){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(e,t,n){return r[t]&&(e[t]=r[t]),e},{cues:r.cues&&Array.prototype.map.call(r.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var St,Ct=function(e){var t=e.$$("track"),n=Array.prototype.map.call(t,function(e){return e.track});return Array.prototype.map.call(t,function(e){var t=wt(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===n.indexOf(e)}).map(wt))},xt=function(e,n){return e.forEach(function(e){var t=n.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(function(e){return t.addCue(e)})}),n.textTracks()},o=E(function(e,t){function n(e){if(!e||"object"!=typeof e||(t=e.which||e.keyCode||e.charCode)&&(e=t),"number"==typeof e)return s[e];var t=String(e),e=r[t.toLowerCase()];return e||((e=i[t.toLowerCase()])?e:1===t.length?t.charCodeAt(0):void 0)}n.isEventKey=function(e,t){if(e&&"object"==typeof e){e=e.which||e.keyCode||e.charCode;if(null==e)return!1;if("string"==typeof t){var n=r[t.toLowerCase()];if(n)return n===e;if(n=i[t.toLowerCase()])return n===e}else if("number"==typeof t)return t===e;return!1}};for(var r=(t=e.exports=n).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},i=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},a=97;a<123;a++)r[String.fromCharCode(a)]=a-32;for(var a=48;a<58;a++)r[a-48]=a;for(a=1;a<13;a++)r["f"+a]=a+111;for(a=0;a<10;a++)r["numpad "+a]=a+96;var o,s=t.names=t.title={};for(a in r)s[r[a]]=a;for(o in i)r[o]=i[o]}),Mt=(o.code,o.codes,o.aliases,o.names,o.title,"vjs-modal-dialog"),It=function(r){function e(e,t){var n=r.call(this,e,t)||this;return n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.close_=function(e){return n.close(e)},n.opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1,n.closeable(!n.options_.uncloseable),n.content(n.options_.content),n.contentEl_=te("div",{className:Mt+"-content"},{role:"document"}),n.descEl_=te("p",{className:Mt+"-description vjs-control-text",id:n.el().getAttribute("aria-describedby")}),ne(n.descEl_,n.description()),n.el_.appendChild(n.descEl_),n.el_.appendChild(n.contentEl_),n}h(e,r);var t=e.prototype;return t.createEl=function(){return r.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},t.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,r.prototype.dispose.call(this)},t.buildCSSClass=function(){return Mt+" vjs-hidden "+r.prototype.buildCSSClass.call(this)},t.label=function(){return this.localize(this.options_.label||"Modal Window")},t.description=function(){var e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e},t.open=function(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)},t.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},t.close=function(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose())},t.closeable=function(e){var t,n;return"boolean"==typeof e&&(e=this.closeable_=!!e,t=this.getChild("closeButton"),e&&!t&&(n=this.contentEl_,this.contentEl_=this.el_,t=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(t,"close",this.close_)),!e&&t&&(this.off(t,"close",this.close_),this.removeChild(t),t.dispose())),this.closeable_},t.fill=function(){this.fillWith(this.content())},t.fillWith=function(e){var t=this.contentEl(),n=t.parentNode,r=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(t),this.empty(),Ee(t,e),this.trigger("modalfill"),r?n.insertBefore(t,r):n.appendChild(t),this.getChild("closeButton"));e&&n.appendChild(e.el_)},t.empty=function(){this.trigger("beforemodalempty"),_e(this.contentEl()),this.trigger("modalempty")},t.content=function(e){return void 0!==e&&(this.content_=e),this.content_},t.conditionalFocus_=function(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())},t.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},t.handleKeyDown=function(e){if(e.stopPropagation(),o.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(o.isEventKey(e,"Tab")){for(var t,n=this.focusableEls_(),r=this.el_.querySelector(":focus"),i=0;i<n.length;i++)if(r===n[i]){t=i;break}document.activeElement===this.el_&&(t=0),e.shiftKey&&0===t?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||t!==n.length-1||(n[0].focus(),e.preventDefault())}},t.focusableEls_=function(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,function(e){return(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")})},e}(u),Rt=(It.prototype.options_={pauseOnOpen:!0,temporary:!0},u.registerComponent("ModalDialog",It),function(r){function e(e){var t;void 0===e&&(e=[]),(t=r.call(this)||this).tracks_=[],Object.defineProperty(_(t),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<e.length;n++)t.addTrack(e[n]);return t}h(e,r);var t=e.prototype;return t.addTrack=function(e){var t=this,n=this.tracks_.length;""+n in this||Object.defineProperty(this,n,{get:function(){return this.tracks_[n]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=function(){t.trigger({track:e,type:"labelchange",target:t})},it(e)&&e.addEventListener("labelchange",e.labelchange_)},t.removeTrack=function(e){for(var t,n=0,r=this.length;n<r;n++)if(this[n]===e){(t=this[n]).off&&t.off(),this.tracks_.splice(n,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},t.getTrackById=function(e){for(var t=null,n=0,r=this.length;n<r;n++){var i=this[n];if(i.id===e){t=i;break}}return t},e}(Ke));for(St in Rt.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"},Rt.prototype.allowedEvents_)Rt.prototype["on"+St]=null;function Pt(e,t){for(var n=0;n<e.length;n++)Object.keys(e[n]).length&&t.id!==e[n].id&&(e[n].enabled=!1)}function Dt(e,t){for(var n=0;n<e.length;n++)Object.keys(e[n]).length&&t.id!==e[n].id&&(e[n].selected=!1)}function Lt(e){for(var t=["protocol","hostname","port","pathname","search","hash","host"],n=document.createElement("a"),r=(n.href=e,{}),i=0;i<t.length;i++)r[t[i]]=n[t[i]];return"http:"===r.protocol&&(r.host=r.host.replace(/:80$/,"")),"https:"===r.protocol&&(r.host=r.host.replace(/:443$/,"")),r.protocol||(r.protocol=window.location.protocol),r.host||(r.host=window.location.host),r}function Ot(e){var t;return e.match(/^https?:\/\//)||((t=document.createElement("a")).href=e,e=t.href),e}var L=function(r){function e(e){for(var t,n=(e=void 0===e?[]:e).length-1;0<=n;n--)if(e[n].enabled){Pt(e,e[n]);break}return(t=r.call(this,e)||this).changing_=!1,t}h(e,r);var t=e.prototype;return t.addTrack=function(e){var t=this;e.enabled&&Pt(this,e),r.prototype.addTrack.call(this,e),e.addEventListener&&(e.enabledChange_=function(){t.changing_||(t.changing_=!0,Pt(t,e),t.changing_=!1,t.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))},t.removeTrack=function(e){r.prototype.removeTrack.call(this,e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)},e}(Rt),e=function(r){function e(e){for(var t,n=(e=void 0===e?[]:e).length-1;0<=n;n--)if(e[n].selected){Dt(e,e[n]);break}return(t=r.call(this,e)||this).changing_=!1,Object.defineProperty(_(t),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),t}h(e,r);var t=e.prototype;return t.addTrack=function(e){var t=this;e.selected&&Dt(this,e),r.prototype.addTrack.call(this,e),e.addEventListener&&(e.selectedChange_=function(){t.changing_||(t.changing_=!0,Dt(t,e),t.changing_=!1,t.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))},t.removeTrack=function(e){r.prototype.removeTrack.call(this,e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selecte