86 lines
456 KiB
JavaScript
86 lines
456 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Clappr=t()}(this,(function(){"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function n(n){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?t(Object(r),!0).forEach((function(t){e(n,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}))}return n}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?c(e):t}function h(e,t,n){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],i=!0,r=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function p(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var a=t[r];if(e.call(i,a,r,t))return a;r++}}}),Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}),Object.values||(Object.values=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=e[t[n]];return i}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(null!=r)for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])}return n},writable:!0,configurable:!0}),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var a=t[r];if(e.call(i,a,r,t))return r;r++}return-1},configurable:!0,writable:!0});var g,v={mp4:"data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAC721kYXQhEAUgpBv/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3pwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCEQBSCkG//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADengAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAsJtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAALwABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAB7HRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAIAAAAAAAAALwAAAAAAAAAAAAAAAQEAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAAC8AAAAAAAEAAAAAAWRtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAAKxEAAAIAFXEAAAAAAAtaGRscgAAAAAAAAAAc291bgAAAAAAAAAAAAAAAFNvdW5kSGFuZGxlcgAAAAEPbWluZgAAABBzbWhkAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAADTc3RibAAAAGdzdHNkAAAAAAAAAAEAAABXbXA0YQAAAAAAAAABAAAAAAAAAAAAAgAQAAAAAKxEAAAAAAAzZXNkcwAAAAADgICAIgACAASAgIAUQBUAAAAAAfQAAAHz+QWAgIACEhAGgICAAQIAAAAYc3R0cwAAAAAAAAABAAAAAgAABAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAIAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAFzAAABdAAAABRzdGNvAAAAAAAAAAEAAAAsAAAAYnVkdGEAAABabWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAtaWxzdAAAACWpdG9vAAAAHWRhdGEAAAABAAAAAExhdmY1Ni40MC4xMDE="},m=function(){var e,t,n,i,r,a=[],o=a.concat,s=a.filter,l=a.slice,u=window.document,c={},d={},h={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},f=/^\s*<(\w+|!)[^>]*>/,p=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,g=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,v=/^(?:body|html)$/i,m=/([A-Z])/g,y=["val","css","html","text","data","width","height","offset"],A=u.createElement("table"),b=u.createElement("tr"),E={tr:u.createElement("tbody"),tbody:A,thead:A,tfoot:A,td:b,th:b,"*":u.createElement("div")},T=/complete|loaded|interactive/,k=/^[\w-]*$/,_={},S=_.toString,C={},w=u.createElement("div"),R={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},O=Array.isArray||function(e){return e instanceof Array};function L(e){return null==e?String(e):_[S.call(e)]||"object"}function D(e){return"function"==L(e)}function I(e){return null!=e&&e==e.window}function P(e){return null!=e&&e.nodeType==e.DOCUMENT_NODE}function x(e){return"object"==L(e)}function N(e){return x(e)&&!I(e)&&Object.getPrototypeOf(e)==Object.prototype}function M(e){var n=!!e&&"length"in e&&e.length,i=t.type(e);return"function"!=i&&!I(e)&&("array"==i||0===n||"number"==typeof n&&n>0&&n-1 in e)}function F(e){return e.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function B(e){return e in d?d[e]:d[e]=new RegExp("(^|\\s)"+e+"(\\s|$)")}function U(e,t){return"number"!=typeof t||h[F(e)]?t:t+"px"}function j(e){return"children"in e?l.call(e.children):t.map(e.childNodes,(function(e){if(1==e.nodeType)return e}))}function V(e,t){var n,i=e?e.length:0;for(n=0;n<i;n++)this[n]=e[n];this.length=i,this.selector=t||""}function K(t,n,i){for(e in n)i&&(N(n[e])||O(n[e]))?(N(n[e])&&!N(t[e])&&(t[e]={}),O(n[e])&&!O(t[e])&&(t[e]=[]),K(t[e],n[e],i)):void 0!==n[e]&&(t[e]=n[e])}function G(e,n){return null==n?t(e):t(e).filter(n)}function Y(e,t,n,i){return D(t)?t.call(e,n,i):t}function H(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function $(e,t){var n=e.className||"",i=n&&void 0!==n.baseVal;if(void 0===t)return i?n.baseVal:n;i?n.baseVal=t:e.className=t}function z(e){try{return e?"true"==e||"false"!=e&&("null"==e?null:+e+""==e?+e:/^[\[\{]/.test(e)?t.parseJSON(e):e):e}catch(t){return e}}function W(e,t){t(e);for(var n=0,i=e.childNodes.length;n<i;n++)W(e.childNodes[n],t)}return C.matches=function(e,t){if(!t||!e||1!==e.nodeType)return!1;var n=e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.matchesSelector;if(n)return n.call(e,t);var i,r=e.parentNode,a=!r;return a&&(r=w).appendChild(e),i=~C.qsa(r,t).indexOf(e),a&&w.removeChild(e),i},i=function(e){return e.replace(/-+(.)?/g,(function(e,t){return t?t.toUpperCase():""}))},r=function(e){return s.call(e,(function(t,n){return e.indexOf(t)==n}))},C.fragment=function(e,n,i){var r,a,o;return p.test(e)&&(r=t(u.createElement(RegExp.$1))),r||(e.replace&&(e=e.replace(g,"<$1></$2>")),void 0===n&&(n=f.test(e)&&RegExp.$1),n in E||(n="*"),(o=E[n]).innerHTML=""+e,r=t.each(l.call(o.childNodes),(function(){o.removeChild(this)}))),N(i)&&(a=t(r),t.each(i,(function(e,t){y.indexOf(e)>-1?a[e](t):a.attr(e,t)}))),r},C.Z=function(e,t){return new V(e,t)},C.isZ=function(e){return e instanceof C.Z},C.init=function(e,n){var i,r;if(!e)return C.Z();if("string"==typeof e)if("<"==(e=e.trim())[0]&&f.test(e))i=C.fragment(e,RegExp.$1,n),e=null;else{if(void 0!==n)return t(n).find(e);i=C.qsa(u,e)}else{if(D(e))return t(u).ready(e);if(C.isZ(e))return e;if(O(e))r=e,i=s.call(r,(function(e){return null!=e}));else if(x(e))i=[e],e=null;else if(f.test(e))i=C.fragment(e.trim(),RegExp.$1,n),e=null;else{if(void 0!==n)return t(n).find(e);i=C.qsa(u,e)}}return C.Z(i,e)},(t=function(e,t){return C.init(e,t)}).extend=function(e){var t,n=l.call(arguments,1);return"boolean"==typeof e&&(t=e,e=n.shift()),n.forEach((function(n){K(e,n,t)})),e},C.qsa=function(e,t){var n,i="#"==t[0],r=!i&&"."==t[0],a=i||r?t.slice(1):t,o=k.test(a);return e.getElementById&&o&&i?(n=e.getElementById(a))?[n]:[]:1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType?[]:l.call(o&&!i&&e.getElementsByClassName?r?e.getElementsByClassName(a):e.getElementsByTagName(t):e.querySelectorAll(t))},t.contains=u.documentElement.contains?function(e,t){return e!==t&&e.contains(t)}:function(e,t){for(;t&&(t=t.parentNode);)if(t===e)return!0;return!1},t.type=L,t.isFunction=D,t.isWindow=I,t.isArray=O,t.isPlainObject=N,t.isEmptyObject=function(e){var t;for(t in e)return!1;return!0},t.isNumeric=function(e){var t=Number(e),n=typeof e;return null!=e&&"boolean"!=n&&("string"!=n||e.length)&&!isNaN(t)&&isFinite(t)||!1},t.inArray=function(e,t,n){return a.indexOf.call(t,e,n)},t.camelCase=i,t.trim=function(e){return null==e?"":String.prototype.trim.call(e)},t.uuid=0,t.support={},t.expr={},t.noop=function(){},t.map=function(e,n){var i,r,a,o,s=[];if(M(e))for(r=0;r<e.length;r++)null!=(i=n(e[r],r))&&s.push(i);else for(a in e)null!=(i=n(e[a],a))&&s.push(i);return(o=s).length>0?t.fn.concat.apply([],o):o},t.each=function(e,t){var n,i;if(M(e)){for(n=0;n<e.length;n++)if(!1===t.call(e[n],n,e[n]))return e}else for(i in e)if(!1===t.call(e[i],i,e[i]))return e;return e},t.grep=function(e,t){return s.call(e,t)},window.JSON&&(t.parseJSON=JSON.parse),t.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),(function(e,t){_["[object "+t+"]"]=t.toLowerCase()})),t.fn={constructor:C.Z,length:0,forEach:a.forEach,reduce:a.reduce,push:a.push,sort:a.sort,splice:a.splice,indexOf:a.indexOf,concat:function(){var e,t,n=[];for(e=0;e<arguments.length;e++)t=arguments[e],n[e]=C.isZ(t)?t.toArray():t;return o.apply(C.isZ(this)?this.toArray():this,n)},map:function(e){return t(t.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return t(l.apply(this,arguments))},ready:function(e){return T.test(u.readyState)&&u.body?e(t):u.addEventListener("DOMContentLoaded",(function(){e(t)}),!1),this},get:function(e){return void 0===e?l.call(this):this[e>=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each((function(){null!=this.parentNode&&this.parentNode.removeChild(this)}))},each:function(e){return a.every.call(this,(function(t,n){return!1!==e.call(t,n,t)})),this},filter:function(e){return D(e)?this.not(this.not(e)):t(s.call(this,(function(t){return C.matches(t,e)})))},add:function(e,n){return t(r(this.concat(t(e,n))))},is:function(e){return this.length>0&&C.matches(this[0],e)},not:function(e){var n=[];if(D(e)&&void 0!==e.call)this.each((function(t){e.call(this,t)||n.push(this)}));else{var i="string"==typeof e?this.filter(e):M(e)&&D(e.item)?l.call(e):t(e);this.forEach((function(e){i.indexOf(e)<0&&n.push(e)}))}return t(n)},has:function(e){return this.filter((function(){return x(e)?t.contains(this,e):t(this).find(e).size()}))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},first:function(){var e=this[0];return e&&!x(e)?e:t(e)},last:function(){var e=this[this.length-1];return e&&!x(e)?e:t(e)},find:function(e){var n=this;return e?"object"==typeof e?t(e).filter((function(){var e=this;return a.some.call(n,(function(n){return t.contains(n,e)}))})):1==this.length?t(C.qsa(this[0],e)):this.map((function(){return C.qsa(this,e)})):t()},closest:function(e,n){var i=[],r="object"==typeof e&&t(e);return this.each((function(t,a){for(;a&&!(r?r.indexOf(a)>=0:C.matches(a,e));)a=a!==n&&!P(a)&&a.parentNode;a&&i.indexOf(a)<0&&i.push(a)})),t(i)},parents:function(e){for(var n=[],i=this;i.length>0;)i=t.map(i,(function(e){if((e=e.parentNode)&&!P(e)&&n.indexOf(e)<0)return n.push(e),e}));return G(n,e)},parent:function(e){return G(r(this.pluck("parentNode")),e)},children:function(e){return G(this.map((function(){return j(this)})),e)},contents:function(){return this.map((function(){return this.contentDocument||l.call(this.childNodes)}))},siblings:function(e){return G(this.map((function(e,t){return s.call(j(t.parentNode),(function(e){return e!==t}))})),e)},empty:function(){return this.each((function(){this.innerHTML=""}))},pluck:function(e){return t.map(this,(function(t){return t[e]}))},show:function(){return this.each((function(){var e,t,n;"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=(e=this.nodeName,c[e]||(t=u.createElement(e),u.body.appendChild(t),n=getComputedStyle(t,"").getPropertyValue("display"),t.parentNode.removeChild(t),"none"==n&&(n="block"),c[e]=n),c[e]))}))},replaceWith:function(e){return this.before(e).remove()},wrap:function(e){var n=D(e);if(this[0]&&!n)var i=t(e).get(0),r=i.parentNode||this.length>1;return this.each((function(a){t(this).wrapAll(n?e.call(this,a):r?i.cloneNode(!0):i)}))},wrapAll:function(e){if(this[0]){var n;for(t(this[0]).before(e=t(e));(n=e.children()).length;)e=n.first();t(e).append(this)}return this},wrapInner:function(e){var n=D(e);return this.each((function(i){var r=t(this),a=r.contents(),o=n?e.call(this,i):e;a.length?a.wrapAll(o):r.append(o)}))},unwrap:function(){return this.parent().each((function(){t(this).replaceWith(t(this).children())})),this},clone:function(){return this.map((function(){return this.cloneNode(!0)}))},hide:function(){return this.css("display","none")},toggle:function(e){return this.each((function(){var n=t(this);(void 0===e?"none"==n.css("display"):e)?n.show():n.hide()}))},prev:function(e){return t(this.pluck("previousElementSibling")).filter(e||"*")},next:function(e){return t(this.pluck("nextElementSibling")).filter(e||"*")},html:function(e){return 0 in arguments?this.each((function(n){var i=this.innerHTML;t(this).empty().append(Y(this,e,n,i))})):0 in this?this[0].innerHTML:null},text:function(e){return 0 in arguments?this.each((function(t){var n=Y(this,e,t,this.textContent);this.textContent=null==n?"":""+n})):0 in this?this.pluck("textContent").join(""):null},attr:function(t,n){var i;return"string"!=typeof t||1 in arguments?this.each((function(i){if(1===this.nodeType)if(x(t))for(e in t)H(this,e,t[e]);else H(this,t,Y(this,n,i,this.getAttribute(t)))})):0 in this&&1==this[0].nodeType&&null!=(i=this[0].getAttribute(t))?i:void 0},removeAttr:function(e){return this.each((function(){1===this.nodeType&&e.split(" ").forEach((function(e){H(this,e)}),this)}))},prop:function(e,t){return e=R[e]||e,1 in arguments?this.each((function(n){this[e]=Y(this,t,n,this[e])})):this[0]&&this[0][e]},removeProp:function(e){return e=R[e]||e,this.each((function(){delete this[e]}))},data:function(e,t){var n="data-"+e.replace(m,"-$1").toLowerCase(),i=1 in arguments?this.attr(n,t):this.attr(n);return null!==i?z(i):void 0},val:function(e){return 0 in arguments?(null==e&&(e=""),this.each((function(t){this.value=Y(this,e,t,this.value)}))):this[0]&&(this[0].multiple?t(this[0]).find("option").filter((function(){return this.selected})).pluck("value"):this[0].value)},offset:function(e){if(e)return this.each((function(n){var i=t(this),r=Y(this,e,n,i.offset()),a=i.offsetParent().offset(),o={top:r.top-a.top,left:r.left-a.left};"static"==i.css("position")&&(o.position="relative"),i.css(o)}));if(!this.length)return null;if(u.documentElement!==this[0]&&!t.contains(u.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+window.pageXOffset,top:n.top+window.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(n,r){if(arguments.length<2){var a=this[0];if("string"==typeof n){if(!a)return;return a.style[i(n)]||getComputedStyle(a,"").getPropertyValue(n)}if(O(n)){if(!a)return;var o={},s=getComputedStyle(a,"");return t.each(n,(function(e,t){o[t]=a.style[i(t)]||s.getPropertyValue(t)})),o}}var l="";if("string"==L(n))r||0===r?l=F(n)+":"+U(n,r):this.each((function(){this.style.removeProperty(F(n))}));else for(e in n)n[e]||0===n[e]?l+=F(e)+":"+U(e,n[e])+";":this.each((function(){this.style.removeProperty(F(e))}));return this.each((function(){this.style.cssText+=";"+l}))},index:function(e){return e?this.indexOf(t(e)[0]):this.parent().children().indexOf(this[0])},hasClass:function(e){return!!e&&a.some.call(this,(function(e){return this.test($(e))}),B(e))},addClass:function(e){return e?this.each((function(i){if("className"in this){n=[];var r=$(this);Y(this,e,i,r).split(/\s+/g).forEach((function(e){t(this).hasClass(e)||n.push(e)}),this),n.length&&$(this,r+(r?" ":"")+n.join(" "))}})):this},removeClass:function(e){return this.each((function(t){if("className"in this){if(void 0===e)return $(this,"");n=$(this),Y(this,e,t,n).split(/\s+/g).forEach((function(e){n=n.replace(B(e)," ")})),$(this,n.trim())}}))},toggleClass:function(e,n){return e?this.each((function(i){var r=t(this);Y(this,e,i,$(this)).split(/\s+/g).forEach((function(e){(void 0===n?!r.hasClass(e):n)?r.addClass(e):r.removeClass(e)}))})):this},scrollTop:function(e){if(this.length){var t="scrollTop"in this[0];return void 0===e?t?this[0].scrollTop:this[0].pageYOffset:this.each(t?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var t="scrollLeft"in this[0];return void 0===e?t?this[0].scrollLeft:this[0].pageXOffset:this.each(t?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var e=this[0],n=this.offsetParent(),i=this.offset(),r=v.test(n[0].nodeName)?{top:0,left:0}:n.offset();return i.top-=parseFloat(t(e).css("margin-top"))||0,i.left-=parseFloat(t(e).css("margin-left"))||0,r.top+=parseFloat(t(n[0]).css("border-top-width"))||0,r.left+=parseFloat(t(n[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent||u.body;e&&!v.test(e.nodeName)&&"static"==t(e).css("position");)e=e.offsetParent;return e}))}},t.fn.detach=t.fn.remove,["width","height"].forEach((function(e){var n=e.replace(/./,(function(e){return e[0].toUpperCase()}));t.fn[e]=function(i){var r,a=this[0];return void 0===i?I(a)?a["inner"+n]:P(a)?a.documentElement["scroll"+n]:(r=this.offset())&&r[e]:this.each((function(n){(a=t(this)).css(e,Y(this,i,n,a[e]()))}))}})),["after","prepend","before","append"].forEach((function(e,n){var i=n%2;t.fn[e]=function(){var e,r,a=t.map(arguments,(function(n){var i=[];return"array"==(e=L(n))?(n.forEach((function(e){return void 0!==e.nodeType?i.push(e):t.zepto.isZ(e)?i=i.concat(e.get()):void(i=i.concat(C.fragment(e)))})),i):"object"==e||null==n?n:C.fragment(n)})),o=this.length>1;return a.length<1?this:this.each((function(e,s){r=i?s:s.parentNode,s=0==n?s.nextSibling:1==n?s.firstChild:2==n?s:null;var l=t.contains(u.documentElement,r);a.forEach((function(e){if(o)e=e.cloneNode(!0);else if(!r)return t(e).remove();r.insertBefore(e,s),l&&W(e,(function(e){if(!(null==e.nodeName||"SCRIPT"!==e.nodeName.toUpperCase()||e.type&&"text/javascript"!==e.type||e.src)){var t=e.ownerDocument?e.ownerDocument.defaultView:window;t.eval.call(t,e.innerHTML)}}))}))}))},t.fn[i?e+"To":"insert"+(n?"Before":"After")]=function(n){return t(n)[e](this),this}})),C.Z.prototype=V.prototype=t.fn,C.uniq=r,C.deserializeValue=z,t.zepto=C,t}();window.Zepto=m,void 0===window.$&&(window.$=m),function(e){var t,n,i=+new Date,r=window.document,a=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,o=/^(?:text|application)\/javascript/i,s=/^(?:text|application)\/xml/i,l=/^\s*$/,u=r.createElement("a");function c(t,n,i,a){if(t.global)return function(t,n,i){var r=e.Event(n);return e(t).trigger(r,i),!r.isDefaultPrevented()}(n||r,i,a)}function d(e,t){var n=t.context;if(!1===t.beforeSend.call(n,e,t)||!1===c(t,n,"ajaxBeforeSend",[e,t]))return!1;c(t,n,"ajaxSend",[e,t])}function h(e,t,n,i){var r=n.context;n.success.call(r,e,"success",t),i&&i.resolveWith(r,[e,"success",t]),c(n,r,"ajaxSuccess",[t,n,e]),p("success",t,n)}function f(e,t,n,i,r){var a=i.context;i.error.call(a,n,t,e),r&&r.rejectWith(a,[n,t,e]),c(i,a,"ajaxError",[n,i,e||t]),p(t,n,i)}function p(t,n,i){var r=i.context;i.complete.call(r,n,t),c(i,r,"ajaxComplete",[n,i]),function(t){t.global&&!--e.active&&c(t,null,"ajaxStop")}(i)}function g(){}function v(e,t){return""==t?e:(e+"&"+t).replace(/[&?]{1,2}/,"?")}function m(t,n,i,r){return e.isFunction(n)&&(r=i,i=n,n=void 0),e.isFunction(i)||(r=i,i=void 0),{url:t,data:n,success:i,dataType:r}}u.href=window.location.href,e.active=0,e.ajaxJSONP=function(t,n){if(!("type"in t))return e.ajax(t);var a,o,s=t.jsonpCallback,l=(e.isFunction(s)?s():s)||"Zepto"+i++,u=r.createElement("script"),c=window[l],p=function(t){e(u).triggerHandler("error",t||"abort")},g={abort:p};return n&&n.promise(g),e(u).on("load error",(function(i,r){clearTimeout(o),e(u).off().remove(),"error"!=i.type&&a?h(a[0],g,t,n):f(null,r||"error",g,t,n),window[l]=c,a&&e.isFunction(c)&&c(a[0]),c=a=void 0})),!1===d(g,t)?(p("abort"),g):(window[l]=function(){a=arguments},u.src=t.url.replace(/\?(.+)=\?/,"?$1="+l),r.head.appendChild(u),t.timeout>0&&(o=setTimeout((function(){p("timeout")}),t.timeout)),g)},e.ajaxSettings={type:"GET",beforeSend:g,success:g,error:g,complete:g,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:"application/json",xml:"application/xml, text/xml",html:"text/html",text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:g},e.ajax=function(i){var a,p,m=e.extend({},i||{}),y=e.Deferred&&e.Deferred();for(t in e.ajaxSettings)void 0===m[t]&&(m[t]=e.ajaxSettings[t]);!function(t){t.global&&0==e.active++&&c(t,null,"ajaxStart")}(m),m.crossDomain||((a=r.createElement("a")).href=m.url,a.href=a.href,m.crossDomain=u.protocol+"//"+u.host!=a.protocol+"//"+a.host),m.url||(m.url=window.location.toString()),(p=m.url.indexOf("#"))>-1&&(m.url=m.url.slice(0,p)),function(t){t.processData&&t.data&&"string"!=e.type(t.data)&&(t.data=e.param(t.data,t.traditional)),!t.data||t.type&&"GET"!=t.type.toUpperCase()&&"jsonp"!=t.dataType||(t.url=v(t.url,t.data),t.data=void 0)}(m);var A=m.dataType,b=/\?.+=\?/.test(m.url);if(b&&(A="jsonp"),!1!==m.cache&&(i&&!0===i.cache||"script"!=A&&"jsonp"!=A)||(m.url=v(m.url,"_="+Date.now())),"jsonp"==A)return b||(m.url=v(m.url,m.jsonp?m.jsonp+"=?":!1===m.jsonp?"":"callback=?")),e.ajaxJSONP(m,y);var E,T=m.accepts[A],k={},_=function(e,t){k[e.toLowerCase()]=[e,t]},S=/^([\w-]+:)\/\//.test(m.url)?RegExp.$1:window.location.protocol,C=m.xhr(),w=C.setRequestHeader;if(y&&y.promise(C),m.crossDomain||_("X-Requested-With","XMLHttpRequest"),_("Accept",T||"*/*"),(T=m.mimeType||T)&&(T.indexOf(",")>-1&&(T=T.split(",",2)[0]),C.overrideMimeType&&C.overrideMimeType(T)),(m.contentType||!1!==m.contentType&&m.data&&"GET"!=m.type.toUpperCase())&&_("Content-Type",m.contentType||"application/x-www-form-urlencoded"),m.headers)for(n in m.headers)_(n,m.headers[n]);if(C.setRequestHeader=_,C.onreadystatechange=function(){if(4==C.readyState){C.onreadystatechange=g,clearTimeout(E);var t,n=!1;if(C.status>=200&&C.status<300||304==C.status||0==C.status&&"file:"==S){if(A=A||function(e){return e&&(e=e.split(";",2)[0]),e&&("text/html"==e?"html":"application/json"==e?"json":o.test(e)?"script":s.test(e)&&"xml")||"text"}(m.mimeType||C.getResponseHeader("content-type")),"arraybuffer"==C.responseType||"blob"==C.responseType)t=C.response;else{t=C.responseText;try{t=function(e,t,n){if(n.dataFilter==g)return e;var i=n.context;return n.dataFilter.call(i,e,t)}(t,A,m),"script"==A?(0,eval)(t):"xml"==A?t=C.responseXML:"json"==A&&(t=l.test(t)?null:e.parseJSON(t))}catch(e){n=e}if(n)return f(n,"parsererror",C,m,y)}h(t,C,m,y)}else f(C.statusText||null,C.status?"error":"abort",C,m,y)}},!1===d(C,m))return C.abort(),f(null,"abort",C,m,y),C;var R=!("async"in m)||m.async;if(C.open(m.type,m.url,R,m.username,m.password),m.xhrFields)for(n in m.xhrFields)C[n]=m.xhrFields[n];for(n in k)w.apply(C,k[n]);return m.timeout>0&&(E=setTimeout((function(){C.onreadystatechange=g,C.abort(),f(null,"timeout",C,m,y)}),m.timeout)),C.send(m.data?m.data:null),C},e.get=function(){return e.ajax(m.apply(null,arguments))},e.post=function(){var t=m.apply(null,arguments);return t.type="POST",e.ajax(t)},e.getJSON=function(){var t=m.apply(null,arguments);return t.dataType="json",e.ajax(t)},e.fn.load=function(t,n,i){if(!this.length)return this;var r,o=this,s=t.split(/\s/),l=m(t,n,i),u=l.success;return s.length>1&&(l.url=s[0],r=s[1]),l.success=function(t){o.html(r?e("<div>").html(t.replace(a,"")).find(r):t),u&&u.apply(o,arguments)},e.ajax(l),this};var y=encodeURIComponent;e.param=function(t,n){var i=[];return i.add=function(t,n){e.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(y(t)+"="+y(n))},function t(n,i,r,a){var o,s=e.isArray(i),l=e.isPlainObject(i);e.each(i,(function(i,u){o=e.type(u),a&&(i=r?a:a+"["+(l||"object"==o||"array"==o?i:"")+"]"),!a&&s?n.add(u.name,u.value):"array"==o||!r&&"object"==o?t(n,u,r,i):n.add(i,u)}))}(i,t,n),i.join("&").replace(/%20/g,"+")}}(m),(g=m).Callbacks=function(e){e=g.extend({},e);var t,n,i,r,a,o,s=[],l=!e.once&&[],u=function(d){for(t=e.memory&&d,n=!0,o=r||0,r=0,a=s.length,i=!0;s&&o<a;++o)if(!1===s[o].apply(d[0],d[1])&&e.stopOnFalse){t=!1;break}i=!1,s&&(l?l.length&&u(l.shift()):t?s.length=0:c.disable())},c={add:function(){if(s){var n=s.length,o=function(t){g.each(t,(function(t,n){"function"==typeof n?e.unique&&c.has(n)||s.push(n):n&&n.length&&"string"!=typeof n&&o(n)}))};o(arguments),i?a=s.length:t&&(r=n,u(t))}return this},remove:function(){return s&&g.each(arguments,(function(e,t){for(var n;(n=g.inArray(t,s,n))>-1;)s.splice(n,1),i&&(n<=a&&--a,n<=o&&--o)})),this},has:function(e){return!(!s||!(e?g.inArray(e,s)>-1:s.length))},empty:function(){return a=s.length=0,this},disable:function(){return s=l=t=void 0,this},disabled:function(){return!s},lock:function(){return l=void 0,t||c.disable(),this},locked:function(){return!l},fireWith:function(e,t){return!s||n&&!l||(t=[e,(t=t||[]).slice?t.slice():t],i?l.push(t):u(t)),this},fire:function(){return c.fireWith(this,arguments)},fired:function(){return!!n}};return c},function(e){var t=Array.prototype.slice;function n(t){var i=[["resolve","done",e.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",e.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",e.Callbacks({memory:1})]],r="pending",a={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var t=arguments;return n((function(n){e.each(i,(function(i,r){var s=e.isFunction(t[i])&&t[i];o[r[1]]((function(){var t=s&&s.apply(this,arguments);if(t&&e.isFunction(t.promise))t.promise().done(n.resolve).fail(n.reject).progress(n.notify);else{var i=this===a?n.promise():this,o=s?[t]:arguments;n[r[0]+"With"](i,o)}}))})),t=null})).promise()},promise:function(t){return null!=t?e.extend(t,a):a}},o={};return e.each(i,(function(e,t){var n=t[2],s=t[3];a[t[1]]=n.add,s&&n.add((function(){r=s}),i[1^e][2].disable,i[2][2].lock),o[t[0]]=function(){return o[t[0]+"With"](this===o?a:this,arguments),this},o[t[0]+"With"]=n.fireWith})),a.promise(o),t&&t.call(o,o),o}e.when=function(i){var r,a,o,s=t.call(arguments),l=s.length,u=0,c=1!==l||i&&e.isFunction(i.promise)?l:0,d=1===c?i:n(),h=function(e,n,i){return function(a){n[e]=this,i[e]=arguments.length>1?t.call(arguments):a,i===r?d.notifyWith(n,i):--c||d.resolveWith(n,i)}};if(l>1)for(r=new Array(l),a=new Array(l),o=new Array(l);u<l;++u)s[u]&&e.isFunction(s[u].promise)?s[u].promise().done(h(u,o,s)).fail(d.reject).progress(h(u,a,r)):--c;return c||d.resolveWith(o,s),d.promise()},e.Deferred=n}(m),function(e){var t=1,n=Array.prototype.slice,i=e.isFunction,r=function(e){return"string"==typeof e},a={},o={},s="onfocusin"in window,l={focus:"focusin",blur:"focusout"},u={mouseenter:"mouseover",mouseleave:"mouseout"};function c(e){return e._zid||(e._zid=t++)}function d(e,t,n,i){if((t=h(t)).ns)var r=(o=t.ns,new RegExp("(?:^| )"+o.replace(" "," .* ?")+"(?: |$)"));var o;return(a[c(e)]||[]).filter((function(e){return e&&(!t.e||e.e==t.e)&&(!t.ns||r.test(e.ns))&&(!n||c(e.fn)===c(n))&&(!i||e.sel==i)}))}function h(e){var t=(""+e).split(".");return{e:t[0],ns:t.slice(1).sort().join(" ")}}function f(e,t){return e.del&&!s&&e.e in l||!!t}function p(e){return u[e]||s&&l[e]||e}function g(t,n,i,r,o,s,l){var d=c(t),g=a[d]||(a[d]=[]);n.split(/\s/).forEach((function(n){if("ready"==n)return e(document).ready(i);var a=h(n);a.fn=i,a.sel=o,a.e in u&&(i=function(t){var n=t.relatedTarget;if(!n||n!==this&&!e.contains(this,n))return a.fn.apply(this,arguments)}),a.del=s;var c=s||i;a.proxy=function(e){if(!(e=E(e)).isImmediatePropagationStopped()){e.data=r;var n=c.apply(t,null==e._args?[e]:[e].concat(e._args));return!1===n&&(e.preventDefault(),e.stopPropagation()),n}},a.i=g.length,g.push(a),"addEventListener"in t&&t.addEventListener(p(a.e),a.proxy,f(a,l))}))}function v(e,t,n,i,r){var o=c(e);(t||"").split(/\s/).forEach((function(t){d(e,t,n,i).forEach((function(t){delete a[o][t.i],"removeEventListener"in e&&e.removeEventListener(p(t.e),t.proxy,f(t,r))}))}))}o.click=o.mousedown=o.mouseup=o.mousemove="MouseEvents",e.event={add:g,remove:v},e.proxy=function(t,a){var o=2 in arguments&&n.call(arguments,2);if(i(t)){var s=function(){return t.apply(a,o?o.concat(n.call(arguments)):arguments)};return s._zid=c(t),s}if(r(a))return o?(o.unshift(t[a],t),e.proxy.apply(null,o)):e.proxy(t[a],t);throw new TypeError("expected function")},e.fn.bind=function(e,t,n){return this.on(e,t,n)},e.fn.unbind=function(e,t){return this.off(e,t)},e.fn.one=function(e,t,n,i){return this.on(e,t,n,i,1)};var m=function(){return!0},y=function(){return!1},A=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,b={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};function E(t,n){return!n&&t.isDefaultPrevented||(n||(n=t),e.each(b,(function(e,i){var r=n[e];t[e]=function(){return this[i]=m,r&&r.apply(n,arguments)},t[i]=y})),t.timeStamp||(t.timeStamp=Date.now()),(void 0!==n.defaultPrevented?n.defaultPrevented:"returnValue"in n?!1===n.returnValue:n.getPreventDefault&&n.getPreventDefault())&&(t.isDefaultPrevented=m)),t}function T(e){var t,n={originalEvent:e};for(t in e)A.test(t)||void 0===e[t]||(n[t]=e[t]);return E(n,e)}e.fn.delegate=function(e,t,n){return this.on(t,e,n)},e.fn.undelegate=function(e,t,n){return this.off(t,e,n)},e.fn.live=function(t,n){return e(document.body).delegate(this.selector,t,n),this},e.fn.die=function(t,n){return e(document.body).undelegate(this.selector,t,n),this},e.fn.on=function(t,a,o,s,l){var u,c,d=this;return t&&!r(t)?(e.each(t,(function(e,t){d.on(e,a,o,t,l)})),d):(r(a)||i(s)||!1===s||(s=o,o=a,a=void 0),void 0!==s&&!1!==o||(s=o,o=void 0),!1===s&&(s=y),d.each((function(i,r){l&&(u=function(e){return v(r,e.type,s),s.apply(this,arguments)}),a&&(c=function(t){var i,o=e(t.target).closest(a,r).get(0);if(o&&o!==r)return i=e.extend(T(t),{currentTarget:o,liveFired:r}),(u||s).apply(o,[i].concat(n.call(arguments,1)))}),g(r,t,s,o,a,c||u)})))},e.fn.off=function(t,n,a){var o=this;return t&&!r(t)?(e.each(t,(function(e,t){o.off(e,n,t)})),o):(r(n)||i(a)||!1===a||(a=n,n=void 0),!1===a&&(a=y),o.each((function(){v(this,t,a,n)})))},e.fn.trigger=function(t,n){return(t=r(t)||e.isPlainObject(t)?e.Event(t):E(t))._args=n,this.each((function(){t.type in l&&"function"==typeof this[t.type]?this[t.type]():"dispatchEvent"in this?this.dispatchEvent(t):e(this).triggerHandler(t,n)}))},e.fn.triggerHandler=function(t,n){var i,a;return this.each((function(o,s){(i=T(r(t)?e.Event(t):t))._args=n,i.target=s,e.each(d(s,t.type||t),(function(e,t){if(a=t.proxy(i),i.isImmediatePropagationStopped())return!1}))})),a},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach((function(t){e.fn[t]=function(e){return 0 in arguments?this.bind(t,e):this.trigger(t)}})),e.Event=function(e,t){r(e)||(e=(t=e).type);var n=document.createEvent(o[e]||"Events"),i=!0;if(t)for(var a in t)"bubbles"==a?i=!!t[a]:n[a]=t[a];return n.initEvent(e,i,!0),E(n)}}(m),function(){try{getComputedStyle(void 0)}catch(t){var e=getComputedStyle;window.getComputedStyle=function(t,n){try{return e(t,n)}catch(e){return null}}}}(),function(e){var t=e.zepto,n=t.qsa,i=t.matches;function r(t){return!(!(t=e(t)).width()&&!t.height())&&"none"!==t.css("display")}var a=e.expr[":"]={visible:function(){if(r(this))return this},hidden:function(){if(!r(this))return this},selected:function(){if(this.selected)return this},checked:function(){if(this.checked)return this},parent:function(){return this.parentNode},first:function(e){if(0===e)return this},last:function(e,t){if(e===t.length-1)return this},eq:function(e,t,n){if(e===n)return this},contains:function(t,n,i){if(e(this).text().indexOf(i)>-1)return this},has:function(e,n,i){if(t.qsa(this,i).length)return this}},o=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),s=/^\s*>/,l="Zepto"+ +new Date;function u(e,t){e=e.replace(/=#\]/g,'="#"]');var n,i,r=o.exec(e);if(r&&r[2]in a&&(n=a[r[2]],i=r[3],e=r[1],i)){var s=Number(i);i=isNaN(s)?i.replace(/^["']|["']$/g,""):s}return t(e,n,i)}t.qsa=function(i,r){return u(r,(function(a,o,u){try{var c;!a&&o?a="*":s.test(a)&&(c=e(i).addClass(l),a="."+l+" "+a);var d=n(i,a)}catch(e){throw console.error("error performing selector: %o",r),e}finally{c&&c.removeClass(l)}return o?t.uniq(e.map(d,(function(e,t){return o.call(e,t,d,u)}))):d}))},t.matches=function(e,t){return u(t,(function(t,n,r){return(!t||i(e,t))&&(!n||n.call(e,null,r)===e)}))}}(m);var y,A,b,E=m,T=[{name:"Chromium",group:"Chrome",identifier:"Chromium/([0-9.]*)"},{name:"Chrome Mobile",group:"Chrome",identifier:"Chrome/([0-9.]*) Mobile",versionIdentifier:"Chrome/([0-9.]*)"},{name:"Chrome",group:"Chrome",identifier:"Chrome/([0-9.]*)"},{name:"Chrome for iOS",group:"Chrome",identifier:"CriOS/([0-9.]*)"},{name:"Android Browser",group:"Chrome",identifier:"CrMo/([0-9.]*)"},{name:"Firefox",group:"Firefox",identifier:"Firefox/([0-9.]*)"},{name:"Opera Mini",group:"Opera",identifier:"Opera Mini/([0-9.]*)"},{name:"Opera",group:"Opera",identifier:"Opera ([0-9.]*)"},{name:"Opera",group:"Opera",identifier:"Opera/([0-9.]*)",versionIdentifier:"Version/([0-9.]*)"},{name:"IEMobile",group:"Explorer",identifier:"IEMobile/([0-9.]*)"},{name:"Internet Explorer",group:"Explorer",identifier:"MSIE ([a-zA-Z0-9.]*)"},{name:"Internet Explorer",group:"Explorer",identifier:"Trident/([0-9.]*)",versionIdentifier:"rv:([0-9.]*)"},{name:"Spartan",group:"Spartan",identifier:"Edge/([0-9.]*)",versionIdentifier:"Edge/([0-9.]*)"},{name:"Safari",group:"Safari",identifier:"Safari/([0-9.]*)",versionIdentifier:"Version/([0-9.]*)"}],k=[{name:"Windows 2000",group:"Windows",identifier:"Windows NT 5.0",version:"5.0"},{name:"Windows XP",group:"Windows",identifier:"Windows NT 5.1",version:"5.1"},{name:"Windows Vista",group:"Windows",identifier:"Windows NT 6.0",version:"6.0"},{name:"Windows 7",group:"Windows",identifier:"Windows NT 6.1",version:"7.0"},{name:"Windows 8",group:"Windows",identifier:"Windows NT 6.2",version:"8.0"},{name:"Windows 8.1",group:"Windows",identifier:"Windows NT 6.3",version:"8.1"},{name:"Windows 10",group:"Windows",identifier:"Windows NT 10.0",version:"10.0"},{name:"Windows Phone",group:"Windows Phone",identifier:"Windows Phone ([0-9.]*)"},{name:"Windows Phone",group:"Windows Phone",identifier:"Windows Phone OS ([0-9.]*)"},{name:"Windows",group:"Windows",identifier:"Windows"},{name:"Chrome OS",group:"Chrome OS",identifier:"CrOS"},{name:"Android",group:"Android",identifier:"Android",versionIdentifier:"Android ([a-zA-Z0-9.-]*)"},{name:"iPad",group:"iOS",identifier:"iPad",versionIdentifier:"OS ([0-9_]*)",versionSeparator:"[_|.]"},{name:"iPod",group:"iOS",identifier:"iPod",versionIdentifier:"OS ([0-9_]*)",versionSeparator:"[_|.]"},{name:"iPhone",group:"iOS",identifier:"iPhone OS",versionIdentifier:"OS ([0-9_]*)",versionSeparator:"[_|.]"},{name:"Mac OS X High Sierra",group:"Mac OS",identifier:"Mac OS X (10([_|.])13([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Sierra",group:"Mac OS",identifier:"Mac OS X (10([_|.])12([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X El Capitan",group:"Mac OS",identifier:"Mac OS X (10([_|.])11([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Yosemite",group:"Mac OS",identifier:"Mac OS X (10([_|.])10([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Mavericks",group:"Mac OS",identifier:"Mac OS X (10([_|.])9([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Mountain Lion",group:"Mac OS",identifier:"Mac OS X (10([_|.])8([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Lion",group:"Mac OS",identifier:"Mac OS X (10([_|.])7([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Snow Leopard",group:"Mac OS",identifier:"Mac OS X (10([_|.])6([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Leopard",group:"Mac OS",identifier:"Mac OS X (10([_|.])5([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Tiger",group:"Mac OS",identifier:"Mac OS X (10([_|.])4([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Panther",group:"Mac OS",identifier:"Mac OS X (10([_|.])3([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Jaguar",group:"Mac OS",identifier:"Mac OS X (10([_|.])2([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Puma",group:"Mac OS",identifier:"Mac OS X (10([_|.])1([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Cheetah",group:"Mac OS",identifier:"Mac OS X (10([_|.])0([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS",group:"Mac OS",identifier:"Mac OS"},{name:"Ubuntu",group:"Linux",identifier:"Ubuntu",versionIdentifier:"Ubuntu/([0-9.]*)"},{name:"Debian",group:"Linux",identifier:"Debian"},{name:"Gentoo",group:"Linux",identifier:"Gentoo"},{name:"Linux",group:"Linux",identifier:"Linux"},{name:"BlackBerry",group:"BlackBerry",identifier:"BlackBerry"}],_={},S=function(e,t){var n=e.split(".",2);t.fullVersion=e,n[0]&&(t.majorVersion=parseInt(n[0])),n[1]&&(t.minorVersion=parseInt(n[1]))},C=function(e,t,n){var i="["==t.substr(0,1)?new RegExp(t,"g"):t,r=e.split(i,2);"."!=t&&(e=e.replace(new RegExp(t,"g"),".")),n.fullVersion=e,r&&r[0]&&(n.majorVersion=parseInt(r[0])),r&&r[1]&&(n.minorVersion=parseInt(r[1]))},w=function(e){var t,n=e.match(/\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(n[1]))return t=/\brv[ :]+(\d+)/g.exec(e)||[],{name:"IE",version:parseInt(t[1]||"")};if("Chrome"===n[1]){if(null!=(t=e.match(/\bOPR\/(\d+)/)))return{name:"Opera",version:parseInt(t[1])};if(null!=(t=e.match(/\bEdge\/(\d+)/)))return{name:"Edge",version:parseInt(t[1])}}else/android/i.test(e)&&(t=e.match(/version\/(\d+)/i))&&(n.splice(1,1,"Android WebView"),n.splice(2,1,t[1]));return{name:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"])[0],version:parseInt(n[1])}}(navigator.userAgent);function R(e,t){if(t)for(var n in t){var i=Object.getOwnPropertyDescriptor(t,n);i?Object.defineProperty(e,n,i):e[n]=t[n]}return e}function O(e,t){var n=function(e){function n(){var e,i;r(this,n);for(var a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];return i=d(this,(e=l(n)).call.apply(e,[this].concat(o))),t.initialize&&t.initialize.apply(c(i),o),i}return s(n,e),n}(e);return R(n.prototype,t),n}_.isEdge=/edge/i.test(navigator.userAgent),_.isChrome=/chrome|CriOS/i.test(navigator.userAgent)&&!_.isEdge,_.isSafari=/safari/i.test(navigator.userAgent)&&!_.isChrome&&!_.isEdge,_.isFirefox=/firefox/i.test(navigator.userAgent),_.isLegacyIE=!!window.ActiveXObject,_.isIE=_.isLegacyIE||/trident.*rv:1\d/i.test(navigator.userAgent),_.isIE11=/trident.*rv:11/i.test(navigator.userAgent),_.isChromecast=_.isChrome&&/CrKey/i.test(navigator.userAgent),_.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Mobile Safari|Opera Mini/i.test(navigator.userAgent),_.isiOS=/iPad|iPhone|iPod/i.test(navigator.userAgent),_.isAndroid=/Android/i.test(navigator.userAgent),_.isWindowsPhone=/Windows Phone/i.test(navigator.userAgent),_.isWin8App=/MSAppHost/i.test(navigator.userAgent),_.isWiiU=/WiiU/i.test(navigator.userAgent),_.isPS4=/PlayStation 4/i.test(navigator.userAgent),_.hasLocalstorage=function(){try{return localStorage.setItem("clappr","clappr"),localStorage.removeItem("clappr"),!0}catch(e){return!1}}(),_.hasFlash=function(){try{return!!new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){return!(!navigator.mimeTypes||void 0===navigator.mimeTypes["application/x-shockwave-flash"]||!navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)}}(),_.name=w.name,_.version=w.version,_.userAgent=navigator.userAgent,_.data=function(){var e={},t=_.userAgent.toLowerCase(),n=!0,i=!1,r=void 0;try{for(var a,o=T[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value,l=new RegExp(s.identifier.toLowerCase()).exec(t);if(null!=l&&l[1]){if(e.name=s.name,e.group=s.group,s.versionIdentifier){var u=new RegExp(s.versionIdentifier.toLowerCase()).exec(t);null!=u&&u[1]&&S(u[1],e)}else S(l[1],e);break}}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return e}(),_.os=function(){var e={},t=_.userAgent.toLowerCase(),n=!0,i=!1,r=void 0;try{for(var a,o=k[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value,l=new RegExp(s.identifier.toLowerCase()).exec(t);if(null!=l){if(e.name=s.name,e.group=s.group,s.version)C(s.version,s.versionSeparator?s.versionSeparator:".",e);else if(l[1])C(l[1],s.versionSeparator?s.versionSeparator:".",e);else if(s.versionIdentifier){var u=new RegExp(s.versionIdentifier.toLowerCase()).exec(t);null!=u&&u[1]&&C(u[1],s.versionSeparator?s.versionSeparator:".",e)}break}}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return e}(),_.viewport=((y={}).width=E(window).width(),y.height=E(window).height(),y),_.device=(A=_.userAgent,(b=/\((iP(?:hone|ad|od))?(?:[^;]*; ){0,2}([^)]+(?=\)))/.exec(A))&&(b[1]||b[2])||""),void 0!==window.orientation&&function(){switch(window.orientation){case-90:case 90:_.viewport.orientation="landscape";break;default:_.viewport.orientation="portrait"}}();var L={fullscreenElement:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},requestFullscreen:function(e){e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.querySelector&&e.querySelector("video")&&e.querySelector("video").webkitEnterFullScreen?e.querySelector("video").webkitEnterFullScreen():e.webkitEnterFullScreen&&e.webkitEnterFullScreen()},cancelFullscreen:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e.exitFullscreen?e.exitFullscreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.webkitExitFullscreen?e.webkitExitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.msExitFullscreen&&e.msExitFullscreen()},fullscreenEnabled:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},D=function(){function e(){r(this,e)}return o(e,null,[{key:"_defaultConfig",value:function(){return{volume:{value:100,parse:parseInt}}}},{key:"_defaultValueFor",value:function(e){try{return this._defaultConfig()[e].parse(this._defaultConfig()[e].value)}catch(e){return}}},{key:"_createKeyspace",value:function(e){return"clappr.".concat(document.domain,".").concat(e)}},{key:"restore",value:function(e){return _.hasLocalstorage&&localStorage[this._createKeyspace(e)]?this._defaultConfig()[e].parse(localStorage[this._createKeyspace(e)]):this._defaultValueFor(e)}},{key:"persist",value:function(e,t){if(_.hasLocalstorage)try{return localStorage[this._createKeyspace(e)]=t,!0}catch(e){return!1}}}]),e}(),I=function(){function e(){r(this,e)}return o(e,null,[{key:"parse",value:function(e){for(var t,n=/\+/g,i=/([^&=]+)=?([^&]*)/g,r=function(e){return decodeURIComponent(e.replace(n," "))},a={};t=i.exec(e);)a[r(t[1]).toLowerCase()]=r(t[2]);return a}},{key:"params",get:function(){var e=window.location.search.substring(1);return e!==this.query&&(this._urlParams=this.parse(e),this.query=e),this._urlParams}},{key:"hashParams",get:function(){var e=window.location.hash.substring(1);return e!==this.hash&&(this._hashParams=this.parse(e),this.hash=e),this._hashParams}}]),e}();function P(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"t",t=0,n=I.params[e]||I.hashParams[e]||"",i=n.match(/[0-9]+[hms]+/g)||[];if(i.length>0){var r={h:3600,m:60,s:1};i.forEach((function(e){if(e){var n=e[e.length-1],i=parseInt(e.slice(0,e.length-1),10);t+=i*r[n]}}))}else n&&(t=parseInt(n,10));return t}var x={};function N(e){return x[e]||(x[e]=0),e+ ++x[e]}function M(e){return e-parseFloat(e)+1>=0}function F(){var e=document.getElementsByTagName("script");return e.length?e[e.length-1].src:""}var B=(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}).bind(window),U=(window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout).bind(window);function j(){return window.navigator&&window.navigator.language}function V(e,t){var n=(t=Object.assign({inline:!1,muted:!1,timeout:250,type:"video",source:v.mp4,element:null},t)).element?t.element:document.createElement(t.type);n.muted=t.muted,!0===t.muted&&n.setAttribute("muted","muted"),!0===t.inline&&n.setAttribute("playsinline","playsinline"),n.src=t.source;var i=n.play(),r=setTimeout((function(){a(!1,new Error("Timeout ".concat(t.timeout," ms has been reached")))}),t.timeout),a=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;clearTimeout(r),e(t,n)};void 0!==i?i.then((function(){return a(!0)})).catch((function(e){return a(!1,e)})):a(!0)}var K=[],G=function(){function e(){r(this,e)}return o(e,null,[{key:"configure",value:function(e){this.options=E.extend(this.options,e)}},{key:"create",value:function(e){return this.options.recycleVideo&&"video"===e&&K.length>0?K.shift():document.createElement(e)}},{key:"garbage",value:function(e){this.options.recycleVideo&&"VIDEO"===e.tagName.toUpperCase()&&(E(e).children().remove(),Object.values(e.attributes).forEach((function(t){return e.removeAttribute(t.name)})),K.push(e))}}]),e}();G.options={recycleVideo:!1};var Y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;r(this,e),this.delay=t,this.lastTime=0}return o(e,[{key:"handle",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=(new Date).getTime(),r=i-this.lastTime;r<this.delay&&r>0&&(t(),n&&e.preventDefault()),this.lastTime=i}}]),e}(),H={Config:D,Fullscreen:L,QueryString:I,DomRecycler:G,assign:R,extend:O,formatTime:function(e,t){if(!isFinite(e))return"--:--";e*=1e3;var n=(e=parseInt(e/1e3))%60,i=(e=parseInt(e/60))%60,r=(e=parseInt(e/60))%24,a=parseInt(e/24),o="";return a&&a>0&&(o+=a+":",r<1&&(o+="00:")),(r&&r>0||t)&&(o+=("0"+r).slice(-2)+":"),o+=("0"+i).slice(-2)+":",(o+=("0"+n).slice(-2)).trim()},seekStringToSeconds:P,uniqueId:N,currentScriptUrl:F,isNumber:M,requestAnimationFrame:B,cancelAnimationFrame:U,getBrowserLanguage:j,now:function(){return window.performance&&window.performance.now?performance.now():Date.now()},removeArrayItem:function(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)},listContainsIgnoreCase:function(e,t){return void 0!==e&&void 0!==t&&void 0!==t.find((function(t){return e.toLowerCase()===t.toLowerCase()}))},canAutoPlayMedia:V,Media:v,DoubleEventHandler:Y},$="font-weight: bold; font-size: 13px;",z="color: #ff8000;"+$,W="color: #ff0000;"+$,q=["color: #0000ff;font-weight: bold; font-size: 13px;","color: #006600;font-weight: bold; font-size: 13px;",z,W,W],X=["debug","info","warn","error","disabled"],Z=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;r(this,e),this.BLACKLIST=["timeupdate","playback:timeupdate","playback:progress","container:hover","container:timeupdate","container:progress"],this.level=t,this.offLevel=n}return o(e,[{key:"debug",value:function(e){this.log(e,0,Array.prototype.slice.call(arguments,1))}},{key:"info",value:function(e){this.log(e,1,Array.prototype.slice.call(arguments,1))}},{key:"warn",value:function(e){this.log(e,2,Array.prototype.slice.call(arguments,1))}},{key:"error",value:function(e){this.log(e,3,Array.prototype.slice.call(arguments,1))}},{key:"onOff",value:function(){this.level===this.offLevel?this.level=this.previousLevel:(this.previousLevel=this.level,this.level=this.offLevel),window.console&&window.console.log&&window.console.log("%c[Clappr.Log] set log level to "+X[this.level],z)}},{key:"level",value:function(e){this.level=e}},{key:"log",value:function(e,t,n){if(!(this.BLACKLIST.indexOf(n[0])>=0||t<this.level)){n||(n=e,e=null);var i=q[t],r="";e&&(r="["+e+"]"),window.console&&window.console.log&&window.console.log.apply(console,["%c["+X[t]+"]"+r,i].concat(n))}}}]),e}();Z.LEVEL_DEBUG=0,Z.LEVEL_INFO=1,Z.LEVEL_WARN=2,Z.LEVEL_ERROR=3,Z.getInstance=function(){return void 0===this._instance&&(this._instance=new this),this._instance},Z.setLevel=function(e){this.getInstance().level=e},Z.debug=function(){this.getInstance().debug.apply(this.getInstance(),arguments)},Z.info=function(){this.getInstance().info.apply(this.getInstance(),arguments)},Z.warn=function(){this.getInstance().warn.apply(this.getInstance(),arguments)},Z.error=function(){this.getInstance().error.apply(this.getInstance(),arguments)};var Q=Array.prototype.slice,J=/\s+/,ee=function(e,t,n,r){if(!n)return!0;if("object"===i(n)){for(var a in n)e[t].apply(e,[a,n[a]].concat(r));return!1}if(J.test(n)){for(var o=n.split(J),s=0,l=o.length;s<l;s++)e[t].apply(e,[o[s]].concat(r));return!1}return!0},te=function(e,t,n,i){var r,a=-1,o=e.length,s=t[0],l=t[1],u=t[2];!function c(){try{switch(t.length){case 0:for(;++a<o;)(r=e[a]).callback.call(r.ctx);return;case 1:for(;++a<o;)(r=e[a]).callback.call(r.ctx,s);return;case 2:for(;++a<o;)(r=e[a]).callback.call(r.ctx,s,l);return;case 3:for(;++a<o;)(r=e[a]).callback.call(r.ctx,s,l,u);return;default:for(;++a<o;)(r=e[a]).callback.apply(r.ctx,t);return}}catch(e){Z.error.apply(Z,[n,"error on event",i,"trigger","-",e]),c()}}()},ne=function(){function e(){r(this,e)}return o(e,[{key:"on",value:function(e,t,n){return ee(this,"on",e,[t,n])&&t?(this._events||(this._events={}),(this._events[e]||(this._events[e]=[])).push({callback:t,context:n,ctx:n||this}),this):this}},{key:"once",value:function(e,t,n){var i,r=this;if(!ee(this,"once",e,[t,n])||!t)return this;var a=function(){return r.off(e,i)};return i=function(){a(),t.apply(this,arguments)},this.on(e,i,n)}},{key:"off",value:function(e,t,n){var i,r,a,o,s,l,u,c;if(!this._events||!ee(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events=void 0,this;for(s=0,l=(o=e?[e]:Object.keys(this._events)).length;s<l;s++)if(e=o[s],a=this._events[e]){if(this._events[e]=i=[],t||n)for(u=0,c=a.length;u<c;u++)r=a[u],(t&&t!==r.callback&&t!==r.callback._callback||n&&n!==r.context)&&i.push(r);i.length||delete this._events[e]}return this}},{key:"trigger",value:function(e){var t=this.name||this.constructor.name;if(Z.debug.apply(Z,[t].concat(Array.prototype.slice.call(arguments))),!this._events)return this;var n=Q.call(arguments,1);if(!ee(this,"trigger",e,n))return this;var i=this._events[e],r=this._events.all;return i&&te(i,n,t,e),r&&te(r,arguments,t,e),this}},{key:"stopListening",value:function(e,t,n){var r=this._listeningTo;if(!r)return this;var a=!t&&!n;for(var o in n||"object"!==i(t)||(n=this),e&&((r={})[e._listenId]=e),r)(e=r[o]).off(t,n,this),(a||0===Object.keys(e._events).length)&&delete this._listeningTo[o];return this}}],[{key:"register",value:function(t){e.Custom||(e.Custom={});var n="string"==typeof t&&t.toUpperCase().trim();n&&!e.Custom[n]?e.Custom[n]=n.toLowerCase().split("_").map((function(e,t){return 0===t?e:e=e[0].toUpperCase()+e.slice(1)})).join(""):Z.error("Events","Error when register event: "+t)}},{key:"listAvailableCustomEvents",value:function(){return e.Custom||(e.Custom={}),Object.keys(e.Custom).filter((function(t){return"string"==typeof e.Custom[t]}))}}]),e}(),ie={listenTo:"on",listenToOnce:"once"};Object.keys(ie).forEach((function(e){ne.prototype[e]=function(t,n,r){return(this._listeningTo||(this._listeningTo={}))[t._listenId||(t._listenId=N("l"))]=t,r||"object"!==i(n)||(r=this),t[ie[e]](n,r,this),this}})),ne.PLAYER_READY="ready",ne.PLAYER_RESIZE="resize",ne.PLAYER_FULLSCREEN="fullscreen",ne.PLAYER_PLAY="play",ne.PLAYER_PAUSE="pause",ne.PLAYER_STOP="stop",ne.PLAYER_ENDED="ended",ne.PLAYER_SEEK="seek",ne.PLAYER_ERROR="playererror",ne.ERROR="error",ne.PLAYER_TIMEUPDATE="timeupdate",ne.PLAYER_VOLUMEUPDATE="volumeupdate",ne.PLAYER_SUBTITLE_AVAILABLE="subtitleavailable",ne.PLAYBACK_PROGRESS="playback:progress",ne.PLAYBACK_TIMEUPDATE="playback:timeupdate",ne.PLAYBACK_READY="playback:ready",ne.PLAYBACK_BUFFERING="playback:buffering",ne.PLAYBACK_BUFFERFULL="playback:bufferfull",ne.PLAYBACK_SETTINGSUPDATE="playback:settingsupdate",ne.PLAYBACK_LOADEDMETADATA="playback:loadedmetadata",ne.PLAYBACK_HIGHDEFINITIONUPDATE="playback:highdefinitionupdate",ne.PLAYBACK_BITRATE="playback:bitrate",ne.PLAYBACK_LEVELS_AVAILABLE="playback:levels:available",ne.PLAYBACK_LEVEL_SWITCH_START="playback:levels:switch:start",ne.PLAYBACK_LEVEL_SWITCH_END="playback:levels:switch:end",ne.PLAYBACK_PLAYBACKSTATE="playback:playbackstate",ne.PLAYBACK_DVR="playback:dvr",ne.PLAYBACK_MEDIACONTROL_DISABLE="playback:mediacontrol:disable",ne.PLAYBACK_MEDIACONTROL_ENABLE="playback:mediacontrol:enable",ne.PLAYBACK_ENDED="playback:ended",ne.PLAYBACK_PLAY_INTENT="playback:play:intent",ne.PLAYBACK_PLAY="playback:play",ne.PLAYBACK_PAUSE="playback:pause",ne.PLAYBACK_SEEK="playback:seek",ne.PLAYBACK_SEEKED="playback:seeked",ne.PLAYBACK_STOP="playback:stop",ne.PLAYBACK_ERROR="playback:error",ne.PLAYBACK_STATS_ADD="playback:stats:add",ne.PLAYBACK_FRAGMENT_LOADED="playback:fragment:loaded",ne.PLAYBACK_LEVEL_SWITCH="playback:level:switch",ne.PLAYBACK_SUBTITLE_AVAILABLE="playback:subtitle:available",ne.PLAYBACK_SUBTITLE_CHANGED="playback:subtitle:changed",ne.CORE_CONTAINERS_CREATED="core:containers:created",ne.CORE_ACTIVE_CONTAINER_CHANGED="core:active:container:changed",ne.CORE_OPTIONS_CHANGE="core:options:change",ne.CORE_READY="core:ready",ne.CORE_FULLSCREEN="core:fullscreen",ne.CORE_RESIZE="core:resize",ne.CORE_SCREEN_ORIENTATION_CHANGED="core:screen:orientation:changed",ne.CORE_MOUSE_MOVE="core:mousemove",ne.CORE_MOUSE_LEAVE="core:mouseleave",ne.CONTAINER_PLAYBACKSTATE="container:playbackstate",ne.CONTAINER_PLAYBACKDVRSTATECHANGED="container:dvr",ne.CONTAINER_BITRATE="container:bitrate",ne.CONTAINER_STATS_REPORT="container:stats:report",ne.CONTAINER_DESTROYED="container:destroyed",ne.CONTAINER_READY="container:ready",ne.CONTAINER_RESIZE="container:resize",ne.CONTAINER_ERROR="container:error",ne.CONTAINER_LOADEDMETADATA="container:loadedmetadata",ne.CONTAINER_SUBTITLE_AVAILABLE="container:subtitle:available",ne.CONTAINER_SUBTITLE_CHANGED="container:subtitle:changed",ne.CONTAINER_TIMEUPDATE="container:timeupdate",ne.CONTAINER_PROGRESS="container:progress",ne.CONTAINER_PLAY="container:play",ne.CONTAINER_STOP="container:stop",ne.CONTAINER_PAUSE="container:pause",ne.CONTAINER_ENDED="container:ended",ne.CONTAINER_CLICK="container:click",ne.CONTAINER_DBLCLICK="container:dblclick",ne.CONTAINER_CONTEXTMENU="container:contextmenu",ne.CONTAINER_MOUSE_ENTER="container:mouseenter",ne.CONTAINER_MOUSE_LEAVE="container:mouseleave",ne.CONTAINER_SEEK="container:seek",ne.CONTAINER_SEEKED="container:seeked",ne.CONTAINER_VOLUME="container:volume",ne.CONTAINER_FULLSCREEN="container:fullscreen",ne.CONTAINER_STATE_BUFFERING="container:state:buffering",ne.CONTAINER_STATE_BUFFERFULL="container:state:bufferfull",ne.CONTAINER_SETTINGSUPDATE="container:settingsupdate",ne.CONTAINER_HIGHDEFINITIONUPDATE="container:highdefinitionupdate",ne.CONTAINER_MEDIACONTROL_SHOW="container:mediacontrol:show",ne.CONTAINER_MEDIACONTROL_HIDE="container:mediacontrol:hide",ne.CONTAINER_MEDIACONTROL_DISABLE="container:mediacontrol:disable",ne.CONTAINER_MEDIACONTROL_ENABLE="container:mediacontrol:enable",ne.CONTAINER_STATS_ADD="container:stats:add",ne.CONTAINER_OPTIONS_CHANGE="container:options:change",ne.MEDIACONTROL_RENDERED="mediacontrol:rendered",ne.MEDIACONTROL_FULLSCREEN="mediacontrol:fullscreen",ne.MEDIACONTROL_SHOW="mediacontrol:show",ne.MEDIACONTROL_HIDE="mediacontrol:hide",ne.MEDIACONTROL_MOUSEMOVE_SEEKBAR="mediacontrol:mousemove:seekbar",ne.MEDIACONTROL_MOUSELEAVE_SEEKBAR="mediacontrol:mouseleave:seekbar",ne.MEDIACONTROL_PLAYING="mediacontrol:playing",ne.MEDIACONTROL_NOTPLAYING="mediacontrol:notplaying",ne.MEDIACONTROL_CONTAINERCHANGED="mediacontrol:containerchanged",ne.MEDIACONTROL_OPTIONS_CHANGE="mediacontrol:options:change";var re=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(this,t),(e=d(this,l(t).call(this,n)))._options=n,e.uniqueId=N("o"),e}return s(t,e),o(t,[{key:"options",get:function(){return this._options}}]),t}(ne),ae=/^(\S+)\s*(.*)$/,oe=function(e){function t(e){var n;return r(this,t),(n=d(this,l(t).call(this,e))).cid=N("c"),n._ensureElement(),n.delegateEvents(),n}return s(t,e),o(t,[{key:"tagName",get:function(){return"div"}},{key:"events",get:function(){return{}}},{key:"attributes",get:function(){return{}}}]),o(t,[{key:"$",value:function(e){return this.$el.find(e)}},{key:"render",value:function(){return this}},{key:"destroy",value:function(){return this.$el.remove(),this.stopListening(),this.undelegateEvents(),this}},{key:"setElement",value:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=E.zepto.isZ(e)?e:E(e),this.el=this.$el[0],!1!==t&&this.delegateEvents(),this}},{key:"delegateEvents",value:function(e){if(!e&&!(e=this.events))return this;for(var t in this.undelegateEvents(),e){var n=e[t];if(n&&n.constructor!==Function&&(n=this[e[t]]),n){var i=t.match(ae),r=i[1],a=i[2];r+=".delegateEvents"+this.cid,""===a?this.$el.on(r,n.bind(this)):this.$el.on(r,a,n.bind(this))}}return this}},{key:"undelegateEvents",value:function(){return this.$el.off(".delegateEvents"+this.cid),this}},{key:"_ensureElement",value:function(){if(this.el)this.setElement(this.el,!1);else{var e=E.extend({},this.attributes);this.id&&(e.id=this.id),this.className&&(e.class=this.className);var t=E(G.create(this.tagName)).attr(e);this.setElement(t,!1)}}}]),t}(re),se=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;return r(this,t),(e=d(this,l(t).call(this,n))).core=i,e}return s(t,e),o(t,[{key:"name",get:function(){return"error"}}],[{key:"Levels",get:function(){return{FATAL:"FATAL",WARN:"WARN",INFO:"INFO"}}}]),o(t,[{key:"createError",value:function(e){this.core?this.core.trigger(ne.ERROR,e):Z.warn(this.name,"Core is not set. Error: ",e)}}]),t}(re),le={createError:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{useCodePrefix:!0},n=this.constructor&&this.constructor.type||"",i=this.name||n,r=this.i18n||this.core&&this.core.i18n||this.container&&this.container.i18n,a="".concat(i,":").concat(e&&e.code||"unknown"),o={description:"",level:se.Levels.FATAL,origin:i,scope:n,raw:{}},s=Object.assign({},o,e,{code:t.useCodePrefix?a:e.code});if(r&&s.level==se.Levels.FATAL&&!s.UI){var l={title:r.t("default_error_title"),message:r.t("default_error_message")};s.UI=l}return this.playerError?this.playerError.createError(s):Z.warn(i,"PlayerError is not defined. Error: ",s),s}},ue=function(e){function t(e){var n;return r(this,t),(n=d(this,l(t).call(this,e.options))).core=e,n.enabled=!0,n.bindEvents(),n.render(),n}return s(t,e),o(t,[{key:"playerError",get:function(){return this.core.playerError}}]),o(t,[{key:"bindEvents",value:function(){}},{key:"getExternalInterface",value:function(){return{}}},{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.$el.show(),this.enabled=!0)}},{key:"disable",value:function(){this.stopListening(),this.$el.hide(),this.enabled=!1}},{key:"render",value:function(){return this}}]),t}(oe);function ce(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}Object.assign(ue.prototype,le),ue.extend=function(e){return O(ue,e)},ue.type="core";ce(".container[data-container] {\n position: absolute;\n background-color: black;\n height: 100%;\n width: 100%;\n max-width: 100%; }\n .container[data-container] .chromeless {\n cursor: default; }\n\n[data-player]:not(.nocursor) .container[data-container]:not(.chromeless).pointer-enabled {\n cursor: pointer; }\n");var de=function(e){function t(e,n,i){var a;return r(this,t),(a=d(this,l(t).call(this,e)))._i18n=n,a.currentTime=0,a.volume=100,a.playback=e.playback,a.playerError=i,a.settings=E.extend({},a.playback.settings),a.isReady=!1,a.mediaControlDisabled=!1,a.plugins=[a.playback],a.dblTapHandler=new Y(500),a.clickTimer=null,a.clickDelay=200,a.bindEvents(),a}return s(t,e),o(t,[{key:"name",get:function(){return"Container"}},{key:"attributes",get:function(){return{class:"container","data-container":""}}},{key:"events",get:function(){return{click:"clicked",dblclick:"dblClicked",touchend:"dblTap",contextmenu:"onContextMenu",mouseenter:"mouseEnter",mouseleave:"mouseLeave"}}},{key:"ended",get:function(){return this.playback.ended}},{key:"buffering",get:function(){return this.playback.buffering}},{key:"i18n",get:function(){return this._i18n}},{key:"hasClosedCaptionsTracks",get:function(){return this.playback.hasClosedCaptionsTracks}},{key:"closedCaptionsTracks",get:function(){return this.playback.closedCaptionsTracks}},{key:"closedCaptionsTrackId",get:function(){return this.playback.closedCaptionsTrackId},set:function(e){this.playback.closedCaptionsTrackId=e}}]),o(t,[{key:"bindEvents",value:function(){this.listenTo(this.playback,ne.PLAYBACK_PROGRESS,this.onProgress),this.listenTo(this.playback,ne.PLAYBACK_TIMEUPDATE,this.timeUpdated),this.listenTo(this.playback,ne.PLAYBACK_READY,this.ready),this.listenTo(this.playback,ne.PLAYBACK_BUFFERING,this.onBuffering),this.listenTo(this.playback,ne.PLAYBACK_BUFFERFULL,this.bufferfull),this.listenTo(this.playback,ne.PLAYBACK_SETTINGSUPDATE,this.settingsUpdate),this.listenTo(this.playback,ne.PLAYBACK_LOADEDMETADATA,this.loadedMetadata),this.listenTo(this.playback,ne.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinitionUpdate),this.listenTo(this.playback,ne.PLAYBACK_BITRATE,this.updateBitrate),this.listenTo(this.playback,ne.PLAYBACK_PLAYBACKSTATE,this.playbackStateChanged),this.listenTo(this.playback,ne.PLAYBACK_DVR,this.playbackDvrStateChanged),this.listenTo(this.playback,ne.PLAYBACK_MEDIACONTROL_DISABLE,this.disableMediaControl),this.listenTo(this.playback,ne.PLAYBACK_MEDIACONTROL_ENABLE,this.enableMediaControl),this.listenTo(this.playback,ne.PLAYBACK_SEEKED,this.onSeeked),this.listenTo(this.playback,ne.PLAYBACK_ENDED,this.onEnded),this.listenTo(this.playback,ne.PLAYBACK_PLAY,this.playing),this.listenTo(this.playback,ne.PLAYBACK_PAUSE,this.paused),this.listenTo(this.playback,ne.PLAYBACK_STOP,this.stopped),this.listenTo(this.playback,ne.PLAYBACK_ERROR,this.error),this.listenTo(this.playback,ne.PLAYBACK_SUBTITLE_AVAILABLE,this.subtitleAvailable),this.listenTo(this.playback,ne.PLAYBACK_SUBTITLE_CHANGED,this.subtitleChanged)}},{key:"subtitleAvailable",value:function(){this.trigger(ne.CONTAINER_SUBTITLE_AVAILABLE)}},{key:"subtitleChanged",value:function(e){this.trigger(ne.CONTAINER_SUBTITLE_CHANGED,e)}},{key:"playbackStateChanged",value:function(e){this.trigger(ne.CONTAINER_PLAYBACKSTATE,e)}},{key:"playbackDvrStateChanged",value:function(e){this.settings=this.playback.settings,this.dvrInUse=e,this.trigger(ne.CONTAINER_PLAYBACKDVRSTATECHANGED,e)}},{key:"updateBitrate",value:function(e){this.trigger(ne.CONTAINER_BITRATE,e)}},{key:"statsReport",value:function(e){this.trigger(ne.CONTAINER_STATS_REPORT,e)}},{key:"getPlaybackType",value:function(){return this.playback.getPlaybackType()}},{key:"isDvrEnabled",value:function(){return!!this.playback.dvrEnabled}},{key:"isDvrInUse",value:function(){return!!this.dvrInUse}},{key:"destroy",value:function(){this.disableResizeObserver(),this.trigger(ne.CONTAINER_DESTROYED,this,this.name),this.stopListening(),this.plugins.forEach((function(e){return e.destroy()})),this.$el.remove()}},{key:"setStyle",value:function(e){this.$el.css(e)}},{key:"animate",value:function(e,t){return this.$el.animate(e,t).promise()}},{key:"ready",value:function(){this.isReady=!0,this.trigger(ne.CONTAINER_READY,this.name)}},{key:"isPlaying",value:function(){return this.playback.isPlaying()}},{key:"getStartTimeOffset",value:function(){return this.playback.getStartTimeOffset()}},{key:"getCurrentTime",value:function(){return this.currentTime}},{key:"getDuration",value:function(){return this.playback.getDuration()}},{key:"error",value:function(e){this.isReady||this.ready(),this.trigger(ne.CONTAINER_ERROR,e,this.name)}},{key:"loadedMetadata",value:function(e){this.trigger(ne.CONTAINER_LOADEDMETADATA,e)}},{key:"timeUpdated",value:function(e){this.currentTime=e.current,this.trigger(ne.CONTAINER_TIMEUPDATE,e,this.name)}},{key:"onProgress",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.trigger.apply(this,[ne.CONTAINER_PROGRESS].concat(t,[this.name]))}},{key:"playing",value:function(){this.trigger(ne.CONTAINER_PLAY,this.name)}},{key:"paused",value:function(){this.trigger(ne.CONTAINER_PAUSE,this.name)}},{key:"play",value:function(){this.playback.play()}},{key:"stop",value:function(){this.playback.stop(),this.currentTime=0}},{key:"pause",value:function(){this.playback.pause()}},{key:"onEnded",value:function(){this.trigger(ne.CONTAINER_ENDED,this,this.name),this.currentTime=0}},{key:"stopped",value:function(){this.trigger(ne.CONTAINER_STOP)}},{key:"clicked",value:function(){var e=this;this.options.chromeless&&!this.options.allowUserInteraction||(this.clickTimer=setTimeout((function(){e.clickTimer&&e.trigger(ne.CONTAINER_CLICK,e,e.name)}),this.clickDelay))}},{key:"cancelClicked",value:function(){clearTimeout(this.clickTimer),this.clickTimer=null}},{key:"dblClicked",value:function(){this.options.chromeless&&!this.options.allowUserInteraction||(this.cancelClicked(),this.trigger(ne.CONTAINER_DBLCLICK,this,this.name))}},{key:"dblTap",value:function(e){var t=this;this.options.chromeless&&!this.options.allowUserInteraction||this.dblTapHandler.handle(e,(function(){t.cancelClicked(),t.trigger(ne.CONTAINER_DBLCLICK,t,t.name)}))}},{key:"onContextMenu",value:function(e){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(ne.CONTAINER_CONTEXTMENU,e,this.name)}},{key:"seek",value:function(e){this.trigger(ne.CONTAINER_SEEK,e,this.name),this.playback.seek(e)}},{key:"onSeeked",value:function(){this.trigger(ne.CONTAINER_SEEKED,this.name)}},{key:"seekPercentage",value:function(e){var t=this.getDuration();if(e>=0&&e<=100){var n=t*(e/100);this.seek(n)}}},{key:"setVolume",value:function(e){this.volume=parseFloat(e),this.trigger(ne.CONTAINER_VOLUME,this.volume,this.name),this.playback.volume(this.volume)}},{key:"fullscreen",value:function(){this.trigger(ne.CONTAINER_FULLSCREEN,this.name)}},{key:"onBuffering",value:function(){this.trigger(ne.CONTAINER_STATE_BUFFERING,this.name)}},{key:"bufferfull",value:function(){this.trigger(ne.CONTAINER_STATE_BUFFERFULL,this.name)}},{key:"addPlugin",value:function(e){this.plugins.push(e)}},{key:"hasPlugin",value:function(e){return!!this.getPlugin(e)}},{key:"getPlugin",value:function(e){return this.plugins.filter((function(t){return t.name===e}))[0]}},{key:"mouseEnter",value:function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(ne.CONTAINER_MOUSE_ENTER)}},{key:"mouseLeave",value:function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(ne.CONTAINER_MOUSE_LEAVE)}},{key:"settingsUpdate",value:function(){this.settings=this.playback.settings,this.trigger(ne.CONTAINER_SETTINGSUPDATE)}},{key:"highDefinitionUpdate",value:function(e){this.trigger(ne.CONTAINER_HIGHDEFINITIONUPDATE,e)}},{key:"isHighDefinitionInUse",value:function(){return this.playback.isHighDefinitionInUse()}},{key:"disableMediaControl",value:function(){this.mediaControlDisabled||(this.mediaControlDisabled=!0,this.trigger(ne.CONTAINER_MEDIACONTROL_DISABLE))}},{key:"enableMediaControl",value:function(){this.mediaControlDisabled&&(this.mediaControlDisabled=!1,this.trigger(ne.CONTAINER_MEDIACONTROL_ENABLE))}},{key:"updateStyle",value:function(){!this.options.chromeless||this.options.allowUserInteraction?this.$el.removeClass("chromeless"):this.$el.addClass("chromeless")}},{key:"enableResizeObserver",value:function(){var e=this;this.disableResizeObserver(),this.resizeObserverInterval=setInterval((function(){return e.checkResize()}),500)}},{key:"disableResizeObserver",value:function(){this.resizeObserverInterval&&clearInterval(this.resizeObserverInterval)}},{key:"checkResize",value:function(){var e={width:this.el.clientWidth,height:this.el.clientHeight},t=this.currentSize||{},n=t.width;(t.height!==e.height||n!==e.width)&&(this.currentSize=e,this.trigger(ne.CONTAINER_RESIZE,e))}},{key:"configure",value:function(e){this._options=E.extend(this._options,e),this.updateStyle(),this.playback.configure(this.options),this.trigger(ne.CONTAINER_OPTIONS_CHANGE)}},{key:"render",value:function(){return this.$el.append(this.playback.render().el),this.updateStyle(),this.checkResize(),this.enableResizeObserver(),this}}]),t}(oe);Object.assign(de.prototype,le);var he=function(e){function t(e,n,i){var a;return r(this,t),(a=d(this,l(t).call(this,e))).settings={},a._i18n=n,a.playerError=i,a._consented=!1,a}return s(t,e),o(t,[{key:"isAudioOnly",get:function(){return!1}},{key:"isAdaptive",get:function(){return!1}},{key:"ended",get:function(){return!1}},{key:"i18n",get:function(){return this._i18n}},{key:"buffering",get:function(){return!1}}]),o(t,[{key:"consent",value:function(e){"function"==typeof e&&e()}},{key:"play",value:function(){}},{key:"pause",value:function(){}},{key:"stop",value:function(){}},{key:"seek",value:function(e){}},{key:"seekPercentage",value:function(e){}},{key:"getStartTimeOffset",value:function(){return 0}},{key:"getDuration",value:function(){return 0}},{key:"isPlaying",value:function(){return!1}},{key:"getPlaybackType",value:function(){return t.NO_OP}},{key:"isHighDefinitionInUse",value:function(){return!1}},{key:"mute",value:function(){}},{key:"unmute",value:function(){}},{key:"volume",value:function(e){}},{key:"configure",value:function(e){this._options=E.extend(this._options,e)}},{key:"attemptAutoPlay",value:function(){var e=this;this.canAutoPlay((function(t,n){t&&e.play()}))}},{key:"canAutoPlay",value:function(e){e(!0,null)}},{key:"isReady",get:function(){return!1}},{key:"hasClosedCaptionsTracks",get:function(){return this.closedCaptionsTracks.length>0}},{key:"closedCaptionsTracks",get:function(){return[]}},{key:"closedCaptionsTrackId",get:function(){return-1},set:function(e){}}]),t}(oe);Object.assign(he.prototype,le),he.extend=function(e){return O(he,e)},he.canPlay=function(e,t){return!1},he.VOD="vod",he.AOD="aod",he.LIVE="live",he.NO_OP="no_op",he.type="playback";var fe=function(e){function t(e,n,i,a){var o;return r(this,t),(o=d(this,l(t).call(this,e)))._i18n=i,o.loader=n,o.playerError=a,o}return s(t,e),o(t,[{key:"options",get:function(){return this._options},set:function(e){this._options=e}}]),o(t,[{key:"createContainers",value:function(){var e=this;return E.Deferred((function(t){t.resolve(e.options.sources.map((function(t){return e.createContainer(t)})))}))}},{key:"findPlaybackPlugin",value:function(e,t){return this.loader.playbackPlugins.filter((function(n){return n.canPlay(e,t)}))[0]}},{key:"createContainer",value:function(e){var t=null,n=this.options.mimeType;"object"===i(e)?(t=e.source.toString(),e.mimeType&&(n=e.mimeType)):t=e.toString(),t.match(/^\/\//)&&(t=window.location.protocol+t);var r=E.extend({},this.options,{src:t,mimeType:n}),a=this.findPlaybackPlugin(t,n),o=a?new a(r,this._i18n,this.playerError):new he;r=E.extend({},r,{playback:o});var s=new de(r,this._i18n,this.playerError),l=E.Deferred();return l.promise(s),this.addContainerPlugins(s),this.listenToOnce(s,ne.CONTAINER_READY,(function(){return l.resolve(s)})),s}},{key:"addContainerPlugins",value:function(e){this.loader.containerPlugins.forEach((function(t){e.addPlugin(new t(e))}))}}]),t}(re);ce('[data-player] {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n transform: translate3d(0, 0, 0);\n position: relative;\n margin: 0;\n padding: 0;\n border: 0;\n font-style: normal;\n font-weight: normal;\n text-align: center;\n overflow: hidden;\n font-size: 100%;\n font-family: "Roboto", "Open Sans", Arial, sans-serif;\n text-shadow: 0 0 0;\n box-sizing: border-box; }\n [data-player] div, [data-player] span, [data-player] applet, [data-player] object, [data-player] iframe,\n [data-player] h1, [data-player] h2, [data-player] h3, [data-player] h4, [data-player] h5, [data-player] h6, [data-player] p, [data-player] blockquote, [data-player] pre,\n [data-player] a, [data-player] abbr, [data-player] acronym, [data-player] address, [data-player] big, [data-player] cite, [data-player] code,\n [data-player] del, [data-player] dfn, [data-player] em, [data-player] img, [data-player] ins, [data-player] kbd, [data-player] q, [data-player] s, [data-player] samp,\n [data-player] small, [data-player] strike, [data-player] strong, [data-player] sub, [data-player] sup, [data-player] tt, [data-player] var,\n [data-player] b, [data-player] u, [data-player] i, [data-player] center,\n [data-player] dl, [data-player] dt, [data-player] dd, [data-player] ol, [data-player] ul, [data-player] li,\n [data-player] fieldset, [data-player] form, [data-player] label, [data-player] legend,\n [data-player] table, [data-player] caption, [data-player] tbody, [data-player] tfoot, [data-player] thead, [data-player] tr, [data-player] th, [data-player] td,\n [data-player] article, [data-player] aside, [data-player] canvas, [data-player] details, [data-player] embed,\n [data-player] figure, [data-player] figcaption, [data-player] footer, [data-player] header, [data-player] hgroup,\n [data-player] menu, [data-player] nav, [data-player] output, [data-player] ruby, [data-player] section, [data-player] summary,\n [data-player] time, [data-player] mark, [data-player] audio, [data-player] video {\n margin: 0;\n padding: 0;\n border: 0;\n font: inherit;\n font-size: 100%;\n vertical-align: baseline; }\n [data-player] table {\n border-collapse: collapse;\n border-spacing: 0; }\n [data-player] caption, [data-player] th, [data-player] td {\n text-align: left;\n font-weight: normal;\n vertical-align: middle; }\n [data-player] q, [data-player] blockquote {\n quotes: none; }\n [data-player] q:before, [data-player] q:after, [data-player] blockquote:before, [data-player] blockquote:after {\n content: "";\n content: none; }\n [data-player] a img {\n border: none; }\n [data-player]:focus {\n outline: 0; }\n [data-player] * {\n max-width: none;\n box-sizing: inherit;\n float: none; }\n [data-player] div {\n display: block; }\n [data-player].fullscreen {\n width: 100% !important;\n height: 100% !important;\n top: 0;\n left: 0; }\n [data-player].nocursor {\n cursor: none; }\n\n.clappr-style {\n display: none !important; }\n');var pe=function(e){function t(e){var n;return r(this,t),(n=d(this,l(t).call(this,e))).playerError=new se(e,c(n)),n.configureDomRecycler(),n.firstResize=!0,n.plugins=[],n.containers=[],n._boundFullscreenHandler=function(){return n.handleFullscreenChange()},E(document).bind("fullscreenchange",n._boundFullscreenHandler),E(document).bind("MSFullscreenChange",n._boundFullscreenHandler),E(document).bind("mozfullscreenchange",n._boundFullscreenHandler),_.isMobile&&E(window).bind("resize",(function(e){n.handleWindowResize(e)})),n}return s(t,e),o(t,[{key:"events",get:function(){return{webkitfullscreenchange:"handleFullscreenChange",mousemove:"onMouseMove",mouseleave:"onMouseLeave"}}},{key:"attributes",get:function(){return{"data-player":"",tabindex:9999}}},{key:"isReady",get:function(){return!!this.ready}},{key:"i18n",get:function(){return this.getPlugin("strings")||{t:function(e){return e}}}},{key:"mediaControl",get:function(){return this._mediaControl||(this._mediaControl=this.getPlugin("media_control"))||this.dummyMediaControl}},{key:"dummyMediaControl",get:function(){return this._dummyMediaControl||(this._dummyMediaControl=new ue(this)),this._dummyMediaControl}},{key:"activeContainer",get:function(){return this._activeContainer},set:function(e){this._activeContainer=e,this.trigger(ne.CORE_ACTIVE_CONTAINER_CHANGED,this._activeContainer)}},{key:"activePlayback",get:function(){return this.activeContainer&&this.activeContainer.playback}}]),o(t,[{key:"configureDomRecycler",value:function(){var e=this.options&&this.options.playback&&this.options.playback.recycleVideo;G.configure({recycleVideo:e})}},{key:"createContainers",value:function(e){this.defer=E.Deferred(),this.defer.promise(this),this.containerFactory=new fe(e,e.loader,this.i18n,this.playerError),this.prepareContainers()}},{key:"prepareContainers",value:function(){var e=this;this.containerFactory.createContainers().then((function(t){return e.setupContainers(t)})).then((function(t){return e.resolveOnContainersReady(t)}))}},{key:"updateSize",value:function(){this.isFullscreen()?this.setFullscreen():this.setPlayerSize()}},{key:"setFullscreen",value:function(){_.isiOS||(this.$el.addClass("fullscreen"),this.$el.removeAttr("style"),this.previousSize={width:this.options.width,height:this.options.height},this.currentSize={width:E(window).width(),height:E(window).height()})}},{key:"setPlayerSize",value:function(){this.$el.removeClass("fullscreen"),this.currentSize=this.previousSize,this.previousSize={width:E(window).width(),height:E(window).height()},this.resize(this.currentSize)}},{key:"resize",value:function(e){M(e.height)||M(e.width)?(this.el.style.height="".concat(e.height,"px"),this.el.style.width="".concat(e.width,"px")):(this.el.style.height="".concat(e.height),this.el.style.width="".concat(e.width)),this.previousSize={width:this.options.width,height:this.options.height},this.options.width=e.width,this.options.height=e.height,this.currentSize=e,this.triggerResize(this.currentSize)}},{key:"enableResizeObserver",value:function(){var e=this;this.disableResizeObserver();this.resizeObserverInterval=setInterval((function(){e.triggerResize({width:e.el.clientWidth,height:e.el.clientHeight})}),500)}},{key:"triggerResize",value:function(e){(this.firstResize||this.oldHeight!==e.height||this.oldWidth!==e.width)&&(this.oldHeight=e.height,this.oldWidth=e.width,this.computedSize=e,this.firstResize=!1,this.trigger(ne.CORE_RESIZE,e))}},{key:"disableResizeObserver",value:function(){this.resizeObserverInterval&&clearInterval(this.resizeObserverInterval),this.resizeObserverInterval=null}},{key:"resolveOnContainersReady",value:function(e){var t=this;E.when.apply(E,e).done((function(){t.defer.resolve(t),t.ready=!0,t.trigger(ne.CORE_READY)}))}},{key:"addPlugin",value:function(e){this.plugins.push(e)}},{key:"hasPlugin",value:function(e){return!!this.getPlugin(e)}},{key:"getPlugin",value:function(e){return this.plugins.filter((function(t){return t.name===e}))[0]}},{key:"load",value:function(e,t){this.options.mimeType=t,e=e&&e.constructor===Array?e:[e],this.options.sources=e,this.containers.forEach((function(e){return e.destroy()})),this.containerFactory.options=E.extend(this.options,{sources:e}),this.prepareContainers()}},{key:"destroy",value:function(){this.disableResizeObserver(),this.containers.forEach((function(e){return e.destroy()})),this.plugins.forEach((function(e){return e.destroy()})),this.$el.remove(),E(document).unbind("fullscreenchange",this._boundFullscreenHandler),E(document).unbind("MSFullscreenChange",this._boundFullscreenHandler),E(document).unbind("mozfullscreenchange",this._boundFullscreenHandler),this.stopListening()}},{key:"handleFullscreenChange",value:function(){this.trigger(ne.CORE_FULLSCREEN,this.isFullscreen()),this.updateSize()}},{key:"handleWindowResize",value:function(e){var t=window.innerWidth>window.innerHeight?"landscape":"portrait";this._screenOrientation!==t&&(this._screenOrientation=t,this.triggerResize({width:this.el.clientWidth,height:this.el.clientHeight}),this.trigger(ne.CORE_SCREEN_ORIENTATION_CHANGED,{event:e,orientation:this._screenOrientation}))}},{key:"removeContainer",value:function(e){this.stopListening(e),this.containers=this.containers.filter((function(t){return t!==e}))}},{key:"setupContainer",value:function(e){this.listenTo(e,ne.CONTAINER_DESTROYED,this.removeContainer),this.containers.push(e)}},{key:"setupContainers",value:function(e){return e.forEach(this.setupContainer.bind(this)),this.trigger(ne.CORE_CONTAINERS_CREATED),this.renderContainers(),this.activeContainer=e[0],this.render(),this.appendToParent(),this.containers}},{key:"renderContainers",value:function(){var e=this;this.containers.forEach((function(t){return e.el.appendChild(t.render().el)}))}},{key:"createContainer",value:function(e,t){var n=this.containerFactory.createContainer(e,t);return this.setupContainer(n),this.el.appendChild(n.render().el),n}},{key:"getCurrentContainer",value:function(){return this.activeContainer}},{key:"getCurrentPlayback",value:function(){return this.activePlayback}},{key:"getPlaybackType",value:function(){return this.activeContainer&&this.activeContainer.getPlaybackType()}},{key:"isFullscreen",value:function(){var e=L.fullscreenElement();if(!e)return!1;var t=this.activePlayback&&this.activePlayback.el;return e===this.el||e===t}},{key:"toggleFullscreen",value:function(){if(this.isFullscreen())L.cancelFullscreen(),!_.isiOS&&this.$el.removeClass("fullscreen nocursor");else{var e=_.isiOS?this.activePlayback&&this.activePlayback.el:this.el;if(!e)return;L.requestFullscreen(e),!_.isiOS&&this.$el.addClass("fullscreen")}}},{key:"onMouseMove",value:function(e){this.trigger(ne.CORE_MOUSE_MOVE,e)}},{key:"onMouseLeave",value:function(e){this.trigger(ne.CORE_MOUSE_LEAVE,e)}},{key:"configure",value:function(e){var t=this;this._options=E.extend(this._options,e),this.configureDomRecycler();var n=e.source||e.sources;n&&this.load(n,e.mimeType||this.options.mimeType),this.trigger(ne.CORE_OPTIONS_CHANGE,e),this.containers.forEach((function(e){return e.configure(t.options)}))}},{key:"appendToParent",value:function(){!(this.$el.parent()&&this.$el.parent().length)&&this.$el.appendTo(this.options.parentElement)}},{key:"render",value:function(){this.options.width=this.options.width||this.$el.width(),this.options.height=this.options.height||this.$el.height();var e={width:this.options.width,height:this.options.height};return this.previousSize=this.currentSize=this.computedSize=e,this.updateSize(),this.enableResizeObserver(),this}}]),t}(oe);Object.assign(pe.prototype,le);var ge,ve=function(e){function t(e){var n;return r(this,t),(n=d(this,l(t).call(this))).player=e,n._options=e.options,n}return s(t,e),o(t,[{key:"loader",get:function(){return this.player.loader}}]),o(t,[{key:"create",value:function(){return this.options.loader=this.loader,this.core=new pe(this.options),this.addCorePlugins(),this.core.createContainers(this.options),this.core}},{key:"addCorePlugins",value:function(){var e=this;return this.loader.corePlugins.forEach((function(t){var n=new t(e.core);e.core.addPlugin(n),e.setupExternalInterface(n)})),this.core}},{key:"setupExternalInterface",value:function(e){var t=e.getExternalInterface();for(var n in t)this.player[n]=t[n].bind(e)}}]),t}(re),me=/(\d+)(?:\.(\d+))?(?:\.(\d+))?/,ye=function(){function e(t,n,i){r(this,e),this.major=parseInt(t||0,10),this.minor=parseInt(n||0,10),this.patch=parseInt(i||0,10)}return o(e,null,[{key:"parse",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=t.match(me)||[],i=f(n,4),r=i[1],a=i[2],o=i[3];return void 0===r?null:new e(r,a,o)}}]),o(e,[{key:"compare",value:function(e){var t=this.major-e.major;return t=(t=t||this.minor-e.minor)||this.patch-e.patch}},{key:"inc",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"patch";return void 0!==this[e]&&(this[e]+=1),this}},{key:"satisfies",value:function(e,t){return this.compare(e)>=0&&(!t||this.compare(t)<0)}},{key:"toString",value:function(){return"".concat(this.major,".").concat(this.minor,".").concat(this.patch)}}]),e}(),Ae=function(e,t){return e&&t?Object.entries(e).filter((function(e){return f(e,2)[1].type===t})).reduce((function(e,t){var n=f(t,2),i=n[0],r=n[1];return e[i]=r,e}),{}):{}},be=(ge={plugins:{},playbacks:[]},function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;r(this,e),this.playerId=n,this.playbackPlugins=p(ge.playbacks);var i=e.registeredPlugins,a=i.core,o=i.container;this.containerPlugins=Object.values(o),this.corePlugins=Object.values(a),Array.isArray(t)||this.validateExternalPluginsType(t),this.addExternalPlugins(t)}return o(e,null,[{key:"checkVersionSupport",value:function(e){var t=e.prototype,n=t.supportedVersion,i=t.name;if(!n||!n.min)return Z.warn("Loader","missing version information for ".concat(i)),!1;var r=n.max?ye.parse(n.max):ye.parse(n.min).inc("minor"),a=ye.parse(n.min);return!!ye.parse("0.4.11").satisfies(a,r)||(Z.warn("Loader","unsupported plugin ".concat(i,": Clappr version ").concat("0.4.11"," does not match required range [").concat(a,",").concat(r,")")),!1)}},{key:"registerPlugin",value:function(t){if(!t||!t.prototype.name)return Z.warn("Loader","missing information to register plugin: ".concat(t)),!1;e.checkVersionSupport(t);var n=ge.plugins;if(!n)return!1;var i=n[t.prototype.name];return i&&Z.warn("Loader","overriding plugin entry: ".concat(t.prototype.name," - ").concat(i)),n[t.prototype.name]=t,!0}},{key:"registerPlayback",value:function(t){if(!t||!t.prototype.name)return!1;e.checkVersionSupport(t);var n=ge.playbacks,i=n.findIndex((function(e){return e.name===t.prototype.name}));if(i>=0){var r=n[i];n.splice(i,1),Z.warn("Loader","overriding playback entry: ".concat(r.name," - ").concat(r))}return ge.playbacks=[t].concat(p(n)),!0}},{key:"unregisterPlugin",value:function(e){if(!e)return!1;var t=ge.plugins;return!!t[e]&&(delete t[e],!0)}},{key:"unregisterPlayback",value:function(e){if(!e)return!1;var t=ge.playbacks,n=t.findIndex((function(t){return t.prototype.name===e}));return!(n<0||(t.splice(n,1),ge.playbacks=t,0))}},{key:"clearPlugins",value:function(){ge.plugins={}}},{key:"clearPlaybacks",value:function(){ge.playbacks=[]}},{key:"registeredPlaybacks",get:function(){return p(ge.playbacks)}},{key:"registeredPlugins",get:function(){var e=ge.plugins;return{core:Ae(e,"core"),container:Ae(e,"container")}}}]),o(e,[{key:"groupPluginsByType",value:function(e){return Array.isArray(e)&&(e=e.reduce((function(e,t){return e[t.type]||(e[t.type]=[]),e[t.type].push(t),e}),{})),e}},{key:"removeDups",value:function(e){var t=e.reduceRight((function(e,t){return e[t.prototype.name]&&delete e[t.prototype.name],e[t.prototype.name]=t,e}),Object.create(null)),n=[];for(var i in t)n.unshift(t[i]);return n}},{key:"addExternalPlugins",value:function(t){if((t=this.groupPluginsByType(t)).playback){var n=t.playback.filter((function(t){return e.checkVersionSupport(t),!0}));this.playbackPlugins=this.removeDups(n.concat(this.playbackPlugins))}if(t.container){var i=t.container.filter((function(t){return e.checkVersionSupport(t),!0}));this.containerPlugins=this.removeDups(i.concat(this.containerPlugins))}if(t.core){var r=t.core.filter((function(t){return e.checkVersionSupport(t),!0}));this.corePlugins=this.removeDups(r.concat(this.corePlugins))}}},{key:"validateExternalPluginsType",value:function(e){["playback","container","core"].forEach((function(t){(e[t]||[]).forEach((function(e){var n="external "+e.type+" plugin on "+t+" array";if(e.type!==t)throw new ReferenceError(n)}))}))}}]),e}()),Ee=F().replace(/\/[^/]+$/,""),Te=function(e){function t(e){var n;r(this,t),n=d(this,l(t).call(this,e));var i={playerId:N(""),persistConfig:!0,width:640,height:360,baseUrl:Ee,allowUserInteraction:_.isMobile,playback:{recycleVideo:!0}};return n._options=E.extend(i,e),n.options.sources=n._normalizeSources(e),n.options.chromeless||(n.options.allowUserInteraction=!0),n.options.allowUserInteraction||(n.options.disableKeyboardShortcuts=!0),n._registerOptionEventListeners(n.options.events),n._coreFactory=new ve(c(n)),n.options.parentId?n.setParentId(n.options.parentId):n.options.parent&&n.attachTo(n.options.parent),n}return s(t,e),o(t,[{key:"loader",set:function(e){this._loader=e},get:function(){return this._loader||(this._loader=new be(this.options.plugins||{},this.options.playerId)),this._loader}},{key:"ended",get:function(){return this.core.activeContainer.ended}},{key:"buffering",get:function(){return this.core.activeContainer.buffering}},{key:"isReady",get:function(){return!!this._ready}},{key:"eventsMapping",get:function(){return{onReady:ne.PLAYER_READY,onResize:ne.PLAYER_RESIZE,onPlay:ne.PLAYER_PLAY,onPause:ne.PLAYER_PAUSE,onStop:ne.PLAYER_STOP,onEnded:ne.PLAYER_ENDED,onSeek:ne.PLAYER_SEEK,onError:ne.PLAYER_ERROR,onTimeUpdate:ne.PLAYER_TIMEUPDATE,onVolumeUpdate:ne.PLAYER_VOLUMEUPDATE,onSubtitleAvailable:ne.PLAYER_SUBTITLE_AVAILABLE}}}]),o(t,[{key:"setParentId",value:function(e){var t=document.querySelector(e);return t&&this.attachTo(t),this}},{key:"attachTo",value:function(e){return this.options.parentElement=e,this.core=this._coreFactory.create(),this._addEventListeners(),this}},{key:"_addEventListeners",value:function(){return this.core.isReady?this._onReady():this.listenToOnce(this.core,ne.CORE_READY,this._onReady),this.listenTo(this.core,ne.CORE_ACTIVE_CONTAINER_CHANGED,this._containerChanged),this.listenTo(this.core,ne.CORE_FULLSCREEN,this._onFullscreenChange),this.listenTo(this.core,ne.CORE_RESIZE,this._onResize),this}},{key:"_addContainerEventListeners",value:function(){var e=this.core.activeContainer;return e&&(this.listenTo(e,ne.CONTAINER_PLAY,this._onPlay),this.listenTo(e,ne.CONTAINER_PAUSE,this._onPause),this.listenTo(e,ne.CONTAINER_STOP,this._onStop),this.listenTo(e,ne.CONTAINER_ENDED,this._onEnded),this.listenTo(e,ne.CONTAINER_SEEK,this._onSeek),this.listenTo(e,ne.CONTAINER_ERROR,this._onError),this.listenTo(e,ne.CONTAINER_TIMEUPDATE,this._onTimeUpdate),this.listenTo(e,ne.CONTAINER_VOLUME,this._onVolumeUpdate),this.listenTo(e,ne.CONTAINER_SUBTITLE_AVAILABLE,this._onSubtitleAvailable)),this}},{key:"_registerOptionEventListeners",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Object.keys(t).length>0;return i&&Object.keys(n).forEach((function(t){var i=e.eventsMapping[t];i&&e.off(i,n[t])})),Object.keys(t).forEach((function(n){var i=e.eventsMapping[n];if(i){var r=t[n];(r="function"==typeof r&&r)&&e.on(i,r)}})),this}},{key:"_containerChanged",value:function(){this.stopListening(),this._addEventListeners()}},{key:"_onReady",value:function(){this._ready=!0,this._addContainerEventListeners(),this.trigger(ne.PLAYER_READY)}},{key:"_onFullscreenChange",value:function(e){this.trigger(ne.PLAYER_FULLSCREEN,e)}},{key:"_onVolumeUpdate",value:function(e){this.trigger(ne.PLAYER_VOLUMEUPDATE,e)}},{key:"_onSubtitleAvailable",value:function(){this.trigger(ne.PLAYER_SUBTITLE_AVAILABLE)}},{key:"_onResize",value:function(e){this.trigger(ne.PLAYER_RESIZE,e)}},{key:"_onPlay",value:function(){this.trigger(ne.PLAYER_PLAY)}},{key:"_onPause",value:function(){this.trigger(ne.PLAYER_PAUSE)}},{key:"_onStop",value:function(){this.trigger(ne.PLAYER_STOP,this.getCurrentTime())}},{key:"_onEnded",value:function(){this.trigger(ne.PLAYER_ENDED)}},{key:"_onSeek",value:function(e){this.trigger(ne.PLAYER_SEEK,e)}},{key:"_onTimeUpdate",value:function(e){this.trigger(ne.PLAYER_TIMEUPDATE,e)}},{key:"_onError",value:function(e){this.trigger(ne.PLAYER_ERROR,e)}},{key:"_normalizeSources",value:function(e){var t=e.sources||(void 0!==e.source?[e.source]:[]);return 0===t.length?[{source:"",mimeType:""}]:t}},{key:"resize",value:function(e){return this.core.resize(e),this}},{key:"load",value:function(e,t,n){return void 0!==n&&this.configure({autoPlay:!!n}),this.core.load(e,t),this}},{key:"destroy",value:function(){return this.stopListening(),this.core.destroy(),this}},{key:"consent",value:function(e){this.core.getCurrentPlayback().consent(e)}},{key:"play",value:function(){return this.core.activeContainer.play(),this}},{key:"pause",value:function(){return this.core.activeContainer.pause(),this}},{key:"stop",value:function(){return this.core.activeContainer.stop(),this}},{key:"seek",value:function(e){return this.core.activeContainer.seek(e),this}},{key:"seekPercentage",value:function(e){return this.core.activeContainer.seekPercentage(e),this}},{key:"mute",value:function(){return this.core.activePlayback.mute(),this}},{key:"unmute",value:function(){return this.core.activePlayback.unmute(),this}},{key:"isPlaying",value:function(){return this.core.activeContainer.isPlaying()}},{key:"isDvrEnabled",value:function(){return this.core.activeContainer.isDvrEnabled()}},{key:"isDvrInUse",value:function(){return this.core.activeContainer.isDvrInUse()}},{key:"configure",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._registerOptionEventListeners(e.events,this.options.events),this.core.configure(e),this}},{key:"getPlugin",value:function(e){return this.core.plugins.concat(this.core.activeContainer.plugins).filter((function(t){return t.name===e}))[0]}},{key:"getCurrentTime",value:function(){return this.core.activeContainer.getCurrentTime()}},{key:"getStartTimeOffset",value:function(){return this.core.activeContainer.getStartTimeOffset()}},{key:"getDuration",value:function(){return this.core.activeContainer.getDuration()}}]),t}(re);Object.assign(Te.prototype,le);var ke=function(e){function t(e){var n;return r(this,t),(n=d(this,l(t).call(this,e.options))).container=e,n.enabled=!0,n.bindEvents(),n}return s(t,e),o(t,[{key:"playerError",get:function(){return this.container.playerError}}]),o(t,[{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.enabled=!0)}},{key:"disable",value:function(){this.enabled&&(this.stopListening(),this.enabled=!1)}},{key:"bindEvents",value:function(){}},{key:"destroy",value:function(){this.stopListening()}}]),t}(re);Object.assign(ke.prototype,le),ke.extend=function(e){return O(ke,e)},ke.type="container";var _e=function(e){function t(e){var n;return r(this,t),(n=d(this,l(t).call(this,e.options))).core=e,n.enabled=!0,n.bindEvents(),n}return s(t,e),o(t,[{key:"playerError",get:function(){return this.core.playerError}}]),o(t,[{key:"bindEvents",value:function(){}},{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.enabled=!0)}},{key:"disable",value:function(){this.enabled&&(this.stopListening(),this.enabled=!1)}},{key:"getExternalInterface",value:function(){return{}}},{key:"destroy",value:function(){this.stopListening()}}]),t}(re);Object.assign(_e.prototype,le),_e.extend=function(e){return O(_e,e)},_e.type="core";var Se=function(e){function t(e){var n;return r(this,t),(n=d(this,l(t).call(this,e.options))).container=e,n.enabled=!0,n.bindEvents(),n}return s(t,e),o(t,[{key:"playerError",get:function(){return this.container.playerError}}]),o(t,[{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.$el.show(),this.enabled=!0)}},{key:"disable",value:function(){this.stopListening(),this.$el.hide(),this.enabled=!1}},{key:"bindEvents",value:function(){}}]),t}(oe);Object.assign(Se.prototype,le),Se.extend=function(e){return O(Se,e)},Se.type="container";var Ce="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function we(){throw new Error("setTimeout has not been defined")}function Re(){throw new Error("clearTimeout has not been defined")}var Oe=we,Le=Re;function De(e){if(Oe===setTimeout)return setTimeout(e,0);if((Oe===we||!Oe)&&setTimeout)return Oe=setTimeout,setTimeout(e,0);try{return Oe(e,0)}catch(t){try{return Oe.call(null,e,0)}catch(t){return Oe.call(this,e,0)}}}"function"==typeof Ce.setTimeout&&(Oe=setTimeout),"function"==typeof Ce.clearTimeout&&(Le=clearTimeout);var Ie,Pe=[],xe=!1,Ne=-1;function Me(){xe&&Ie&&(xe=!1,Ie.length?Pe=Ie.concat(Pe):Ne=-1,Pe.length&&Fe())}function Fe(){if(!xe){var e=De(Me);xe=!0;for(var t=Pe.length;t;){for(Ie=Pe,Pe=[];++Ne<t;)Ie&&Ie[Ne].run();Ne=-1,t=Pe.length}Ie=null,xe=!1,function(e){if(Le===clearTimeout)return clearTimeout(e);if((Le===Re||!Le)&&clearTimeout)return Le=clearTimeout,clearTimeout(e);try{Le(e)}catch(t){try{return Le.call(null,e)}catch(t){return Le.call(this,e)}}}(e)}}function Be(e,t){this.fun=e,this.array=t}Be.prototype.run=function(){this.fun.apply(null,this.array)};var Ue=Ce.performance||{},je=(Ue.now||Ue.mozNow||Ue.msNow||Ue.oNow||Ue.webkitNow,{evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g}),Ve=/(.)^/,Ke={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},Ge=/\\|'|\r|\n|\t|\u2028|\u2029/g,Ye={"&":"&","<":"<",">":">",'"':""","'":"'"},He=new RegExp("[&<>\"']","g"),$e=function(e){return null===e?"":(""+e).replace(He,(function(e){return Ye[e]}))},ze=0,We=function(e,t){var n,i=new RegExp([(je.escape||Ve).source,(je.interpolate||Ve).source,(je.evaluate||Ve).source].join("|")+"|$","g"),r=0,a="__p+='";e.replace(i,(function(t,n,i,o,s){return a+=e.slice(r,s).replace(Ge,(function(e){return"\\"+Ke[e]})),n&&(a+="'+\n((__t=("+n+"))==null?'':escapeExpr(__t))+\n'"),i&&(a+="'+\n((__t=("+i+"))==null?'':__t)+\n'"),o&&(a+="';\n"+o+"\n__p+='"),r=s+t.length,t})),a+="';\n",je.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n//# sourceURL=/microtemplates/source["+ze+++"]";try{n=new Function(je.variable||"obj","escapeExpr",a)}catch(e){throw e.source=a,e}if(t)return n(t,$e);var o=function(e){return n.call(this,e,$e)};return o.source="function("+(je.variable||"obj")+"){\n"+a+"}",o};We.settings=je;ce("[data-html5-video] {\n position: absolute;\n height: 100%;\n width: 100%;\n display: block; }\n");var qe={mp4:["avc1.42E01E","avc1.58A01E","avc1.4D401E","avc1.64001E","mp4v.20.8","mp4v.20.240","mp4a.40.2"].map((function(e){return'video/mp4; codecs="'+e+', mp4a.40.2"'})),ogg:['video/ogg; codecs="theora, vorbis"','video/ogg; codecs="dirac"','video/ogg; codecs="theora, speex"'],"3gpp":['video/3gpp; codecs="mp4v.20.8, samr"'],webm:['video/webm; codecs="vp8, vorbis"'],mkv:['video/x-matroska; codecs="theora, vorbis"'],m3u8:["application/x-mpegurl"]};qe.ogv=qe.ogg,qe["3gp"]=qe["3gpp"];var Xe={wav:["audio/wav"],mp3:["audio/mp3",'audio/mpeg;codecs="mp3"'],aac:['audio/mp4;codecs="mp4a.40.5"'],oga:["audio/ogg"]},Ze=Object.keys(Xe).reduce((function(e,t){return[].concat(p(e),p(Xe[t]))}),[]),Qe={code:"unknown",message:"unknown"},Je=function(e){function t(){var e,n;r(this,t);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];(n=d(this,(e=l(t)).call.apply(e,[this].concat(a))))._destroyed=!1,n._loadStarted=!1,n._isBuffering=!1,n._playheadMoving=!1,n._playheadMovingTimer=null,n._stopped=!1,n._ccTrackId=-1,n._setupSrc(n.options.src),n.options.playback||(n.options.playback=n.options||{}),n.options.playback.disableContextMenu=n.options.playback.disableContextMenu||n.options.disableVideoTagContextMenu;var s,u=n.options.playback,c=u.preload||(_.isSafari?"auto":n.options.preload);return n.options.poster&&("string"==typeof n.options.poster?s=n.options.poster:"string"==typeof n.options.poster.url&&(s=n.options.poster.url)),E.extend(n.el,{muted:n.options.mute,defaultMuted:n.options.mute,loop:n.options.loop,poster:s,preload:c||"metadata",crossOrigin:u.crossOrigin,"x-webkit-playsinline":u.playInline}),(u.controls||n.options.useVideoTagDefaultControls)&&n.$el.attr("controls",""),u.playInline&&n.$el.attr({playsinline:"playsinline"}),u.crossOrigin&&n.$el.attr({crossorigin:u.crossOrigin}),n.settings={default:["seekbar"]},n.settings.left=["playpause","position","duration"],n.settings.right=["fullscreen","volume","hd-indicator"],u.externalTracks&&n._setupExternalTracks(u.externalTracks),n.options.autoPlay&&n.attemptAutoPlay(),n}return s(t,e),o(t,[{key:"name",get:function(){return"html5_video"}},{key:"supportedVersion",get:function(){return{min:"0.4.11"}}},{key:"tagName",get:function(){return this.isAudioOnly?"audio":"video"}},{key:"isAudioOnly",get:function(){var e=this.options.src,n=t._mimeTypesForUrl(e,Xe,this.options.mimeType);return this.options.playback&&this.options.playback.audioOnly||this.options.audioOnly||Ze.indexOf(n[0])>=0}},{key:"attributes",get:function(){return{"data-html5-video":""}}},{key:"events",get:function(){return{canplay:"_onCanPlay",canplaythrough:"_handleBufferingEvents",durationchange:"_onDurationChange",ended:"_onEnded",error:"_onError",loadeddata:"_onLoadedData",loadedmetadata:"_onLoadedMetadata",pause:"_onPause",playing:"_onPlaying",progress:"_onProgress",seeking:"_onSeeking",seeked:"_onSeeked",stalled:"_handleBufferingEvents",timeupdate:"_onTimeUpdate",waiting:"_onWaiting"}}},{key:"ended",get:function(){return this.el.ended}},{key:"buffering",get:function(){return this._isBuffering}}]),o(t,[{key:"configure",value:function(e){h(l(t.prototype),"configure",this).call(this,e),this.el.loop=!!e.loop}},{key:"attemptAutoPlay",value:function(){var e=this;this.canAutoPlay((function(t,n){n&&Z.warn(e.name,"autoplay error.",{result:t,error:n}),t&&function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Pe.push(new Be(e,t)),1!==Pe.length||xe||De(Fe)}((function(){return!e._destroyed&&e.play()}))}))}},{key:"canAutoPlay",value:function(e){this.options.disableCanAutoPlay&&e(!0,null);var t={timeout:this.options.autoPlayTimeout||500,inline:this.options.playback.playInline||!1,muted:this.options.mute||!1};_.isMobile&&G.options.recycleVideo&&(t.element=this.el),V(e,t)}},{key:"_setupExternalTracks",value:function(e){this._externalTracks=e.map((function(e){return{kind:e.kind||"subtitles",label:e.label,lang:e.lang,src:e.src}}))}},{key:"_setupSrc",value:function(e){this.el.src!==e&&(this._ccIsSetup=!1,this.el.src=e,this._src=this.el.src)}},{key:"_onLoadedMetadata",value:function(e){this._handleBufferingEvents(),this.trigger(ne.PLAYBACK_LOADEDMETADATA,{duration:e.target.duration,data:e}),this._updateSettings();var t=void 0===this._options.autoSeekFromUrl||this._options.autoSeekFromUrl;this.getPlaybackType()!==he.LIVE&&t&&this._checkInitialSeek()}},{key:"_onDurationChange",value:function(){this._updateSettings(),this._onTimeUpdate(),this._onProgress()}},{key:"_updateSettings",value:function(){this.getPlaybackType()===he.VOD||this.getPlaybackType()===he.AOD?this.settings.left=["playpause","position","duration"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(ne.PLAYBACK_SETTINGSUPDATE)}},{key:"isSeekEnabled",value:function(){return isFinite(this.getDuration())}},{key:"getPlaybackType",value:function(){var e="audio"===this.tagName?he.AOD:he.VOD;return[0,void 0,1/0].indexOf(this.el.duration)>=0?he.LIVE:e}},{key:"isHighDefinitionInUse",value:function(){return!1}},{key:"consent",value:function(e){var n=this;if(this.isPlaying())h(l(t.prototype),"consent",this).call(this,e);else{var i=function i(){n.el.removeEventListener("loadedmetadata",i,!1),n.el.removeEventListener("error",i,!1),h(l(t.prototype),"consent",n).call(n,e)};this.el.addEventListener("loadedmetadata",i,!1),this.el.addEventListener("error",i,!1),this.el.load()}}},{key:"play",value:function(){this.trigger(ne.PLAYBACK_PLAY_INTENT),this._stopped=!1,this._setupSrc(this._src),this._handleBufferingEvents();var e=this.el.play();e&&e.catch&&e.catch((function(){}))}},{key:"pause",value:function(){this.el.pause()}},{key:"stop",value:function(){this.pause(),this._stopped=!0,this.el.removeAttribute("src"),this.el.load(),this._stopPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(ne.PLAYBACK_STOP)}},{key:"volume",value:function(e){0===e?(this.$el.attr({muted:"true"}),this.el.muted=!0):(this.$el.attr({muted:null}),this.el.muted=!1,this.el.volume=e/100)}},{key:"mute",value:function(){this.el.muted=!0}},{key:"unmute",value:function(){this.el.muted=!1}},{key:"isMuted",value:function(){return!0===this.el.muted||0===this.el.volume}},{key:"isPlaying",value:function(){return!this.el.paused&&!this.el.ended}},{key:"_startPlayheadMovingChecks",value:function(){null===this._playheadMovingTimer&&(this._playheadMovingTimeOnCheck=null,this._determineIfPlayheadMoving(),this._playheadMovingTimer=setInterval(this._determineIfPlayheadMoving.bind(this),500))}},{key:"_stopPlayheadMovingChecks",value:function(){null!==this._playheadMovingTimer&&(clearInterval(this._playheadMovingTimer),this._playheadMovingTimer=null,this._playheadMoving=!1)}},{key:"_determineIfPlayheadMoving",value:function(){var e=this._playheadMovingTimeOnCheck,t=this.el.currentTime;this._playheadMoving=e!==t,this._playheadMovingTimeOnCheck=t,this._handleBufferingEvents()}},{key:"_onWaiting",value:function(){this._loadStarted=!0,this._handleBufferingEvents()}},{key:"_onLoadedData",value:function(){this._loadStarted=!0,this._handleBufferingEvents()}},{key:"_onCanPlay",value:function(){this._handleBufferingEvents()}},{key:"_onPlaying",value:function(){this._checkForClosedCaptions(),this._startPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(ne.PLAYBACK_PLAY)}},{key:"_onPause",value:function(){this._stopPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(ne.PLAYBACK_PAUSE)}},{key:"_onSeeking",value:function(){this._handleBufferingEvents(),this.trigger(ne.PLAYBACK_SEEK)}},{key:"_onSeeked",value:function(){this._handleBufferingEvents(),this.trigger(ne.PLAYBACK_SEEKED)}},{key:"_onEnded",value:function(){this._handleBufferingEvents(),this.trigger(ne.PLAYBACK_ENDED,this.name)}},{key:"_handleBufferingEvents",value:function(){var e=!this.el.ended&&!this.el.paused,t=this._loadStarted&&!this.el.ended&&!this._stopped&&(e&&!this._playheadMoving||this.el.readyState<this.el.HAVE_FUTURE_DATA);this._isBuffering!==t&&(this._isBuffering=t,t?this.trigger(ne.PLAYBACK_BUFFERING,this.name):this.trigger(ne.PLAYBACK_BUFFERFULL,this.name))}},{key:"_onError",value:function(){var e=this.el.error||Qe,t=e.code,n=e.message,i=t===Qe.code,r=this.createError({code:t,description:n,raw:this.el.error,level:i?se.Levels.WARN:se.Levels.FATAL});i?Z.warn(this.name,"HTML5 unknown error: ",r):this.trigger(ne.PLAYBACK_ERROR,r)}},{key:"destroy",value:function(){this._destroyed=!0,this.handleTextTrackChange&&this.el.textTracks.removeEventListener("change",this.handleTextTrackChange),h(l(t.prototype),"destroy",this).call(this),this.el.removeAttribute("src"),this.el.load(),this._src=null,G.garbage(this.el)}},{key:"seek",value:function(e){this.el.currentTime=e}},{key:"seekPercentage",value:function(e){var t=this.el.duration*(e/100);this.seek(t)}},{key:"_checkInitialSeek",value:function(){var e=P();0!==e&&this.seek(e)}},{key:"getCurrentTime",value:function(){return this.el.currentTime}},{key:"getDuration",value:function(){return this.el.duration}},{key:"_onTimeUpdate",value:function(){this.getPlaybackType()===he.LIVE?this.trigger(ne.PLAYBACK_TIMEUPDATE,{current:1,total:1},this.name):this.trigger(ne.PLAYBACK_TIMEUPDATE,{current:this.el.currentTime,total:this.el.duration},this.name)}},{key:"_onProgress",value:function(){if(this.el.buffered.length){for(var e=[],t=0,n=0;n<this.el.buffered.length;n++)e=[].concat(p(e),[{start:this.el.buffered.start(n),end:this.el.buffered.end(n)}]),this.el.currentTime>=e[n].start&&this.el.currentTime<=e[n].end&&(t=n);var i={start:e[t].start,current:e[t].end,total:this.el.duration};this.trigger(ne.PLAYBACK_PROGRESS,i,e)}}},{key:"_typeFor",value:function(e){var n=t._mimeTypesForUrl(e,qe,this.options.mimeType);return 0===n.length&&(n=t._mimeTypesForUrl(e,Xe,this.options.mimeType)),(n[0]||"").split(";")[0]}},{key:"_ready",value:function(){this._isReadyState||(this._isReadyState=!0,this.trigger(ne.PLAYBACK_READY,this.name))}},{key:"_checkForClosedCaptions",value:function(){if(this.isHTML5Video&&!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(ne.PLAYBACK_SUBTITLE_AVAILABLE);var e=this.closedCaptionsTrackId;this.closedCaptionsTrackId=e,this.handleTextTrackChange=this._handleTextTrackChange.bind(this),this.el.textTracks.addEventListener("change",this.handleTextTrackChange)}this._ccIsSetup=!0}}},{key:"_handleTextTrackChange",value:function(){var e=this.closedCaptionsTracks.find((function(e){return"showing"===e.track.mode}))||{id:-1};this._ccTrackId!==e.id&&(this._ccTrackId=e.id,this.trigger(ne.PLAYBACK_SUBTITLE_CHANGED,{id:e.id}))}},{key:"render",value:function(){return this.options.playback.disableContextMenu&&this.$el.on("contextmenu",(function(){return!1})),this._externalTracks&&this._externalTracks.length>0&&this.$el.html(this.template({tracks:this._externalTracks})),this._ready(),this}},{key:"isReady",get:function(){return this._isReadyState}},{key:"isHTML5Video",get:function(){return this.name===t.prototype.name}},{key:"closedCaptionsTracks",get:function(){var e=0;return(this.el.textTracks?Array.from(this.el.textTracks):[]).filter((function(e){return"subtitles"===e.kind||"captions"===e.kind})).map((function(t){return{id:e++,name:t.label,track:t}}))}},{key:"closedCaptionsTrackId",get:function(){return this._ccTrackId},set:function(e){if(M(e)){var t,n=this.closedCaptionsTracks;if(-1!==e){if(!(t=n.find((function(t){return t.id===e}))))return;if("showing"===t.track.mode)return}n.filter((function(e){return"hidden"!==e.track.mode})).forEach((function(e){return e.track.mode="hidden"})),t&&(t.track.mode="showing"),this._ccTrackId=e,this.trigger(ne.PLAYBACK_SUBTITLE_CHANGED,{id:e})}}},{key:"template",get:function(){return We('<% for (var i = 0; i < tracks.length; i++) { %>\n <track data-html5-video-track="<%= i %>" kind="<%= tracks[i].kind %>" label="<%= tracks[i].label %>" srclang="<%= tracks[i].lang %>" src="<%= tracks[i].src %>">\n<% }; %>\n')}}]),t}(he);Je._mimeTypesForUrl=function(e,t,n){var i=(e.split("?")[0].match(/.*\.(.*)$/)||[])[1],r=n||i&&t[i.toLowerCase()]||[];return r.constructor===Array?r:[r]},Je._canPlay=function(e,t,n,i){var r=Je._mimeTypesForUrl(n,t,i),a=document.createElement(e);return!!r.filter((function(e){return!!a.canPlayType(e).replace(/no/,"")}))[0]},Je.canPlay=function(e,t){return Je._canPlay("audio",Xe,e,t)||Je._canPlay("video",qe,e,t)};var et=function(e){function t(){return r(this,t),d(this,l(t).apply(this,arguments))}return s(t,e),o(t,[{key:"updateSettings",value:function(){this.settings.left=["playpause","position","duration"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(ne.PLAYBACK_SETTINGSUPDATE)}},{key:"getPlaybackType",value:function(){return he.AOD}},{key:"name",get:function(){return"html5_audio"}},{key:"supportedVersion",get:function(){return{min:"0.4.11"}}},{key:"tagName",get:function(){return"audio"}},{key:"isAudioOnly",get:function(){return!0}}]),t}(Je);et.canPlay=function(e,t){return Je._canPlay("audio",{wav:["audio/wav"],mp3:["audio/mp3",'audio/mpeg;codecs="mp3"'],aac:['audio/mp4;codecs="mp4a.40.5"'],oga:["audio/ogg"]},e,t)};ce("[data-html-img] {\n max-width: 100%;\n max-height: 100%; }\n");var tt=function(e){function t(e){var n;return r(this,t),(n=d(this,l(t).call(this,e))).el.src=e.src,n}return s(t,e),o(t,[{key:"getPlaybackType",value:function(){return he.NO_OP}},{key:"name",get:function(){return"html_img"}},{key:"supportedVersion",get:function(){return{min:"0.4.11"}}},{key:"tagName",get:function(){return"img"}},{key:"attributes",get:function(){return{"data-html-img":""}}},{key:"events",get:function(){return{load:"_onLoad",abort:"_onError",error:"_onError"}}}]),o(t,[{key:"render",value:function(){return this.trigger(ne.PLAYBACK_READY,this.name),this}},{key:"_onLoad",value:function(){this.trigger(ne.PLAYBACK_ENDED,this.name)}},{key:"_onError",value:function(e){var t="error"===e.type?"load error":"loading aborted";this.trigger(ne.PLAYBACK_ERROR,{message:t},this.name)}}]),t}(he);tt.canPlay=function(e){return/\.(png|jpg|jpeg|gif|bmp|tiff|pgm|pnm|webp)(|\?.*)$/i.test(e)};ce("[data-no-op] {\n position: absolute;\n height: 100%;\n width: 100%;\n text-align: center; }\n\n[data-no-op] p[data-no-op-msg] {\n position: absolute;\n text-align: center;\n font-size: 25px;\n left: 0;\n right: 0;\n color: white;\n padding: 10px;\n /* center vertically */\n top: 50%;\n transform: translateY(-50%);\n max-height: 100%;\n overflow: auto; }\n\n[data-no-op] canvas[data-no-op-canvas] {\n background-color: #777;\n height: 100%;\n width: 100%; }\n");var nt=function(e){function t(){var e,n;r(this,t);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return(n=d(this,(e=l(t)).call.apply(e,[this].concat(a))))._noiseFrameNum=-1,n}return s(t,e),o(t,[{key:"name",get:function(){return"no_op"}},{key:"supportedVersion",get:function(){return{min:"0.4.11"}}},{key:"template",get:function(){return We("<canvas data-no-op-canvas></canvas>\n<p data-no-op-msg><%=message%></p><p>\n</p>")}},{key:"attributes",get:function(){return{"data-no-op":""}}}]),o(t,[{key:"render",value:function(){var e=this.options.playbackNotSupportedMessage||this.i18n.t("playback_not_supported");this.$el.html(this.template({message:e})),this.trigger(ne.PLAYBACK_READY,this.name);var t=!(!this.options.poster||!this.options.poster.showForNoOp);return!this.options.autoPlay&&t||this._animate(),this}},{key:"_noise",value:function(){if(this._noiseFrameNum=(this._noiseFrameNum+1)%5,!this._noiseFrameNum){var e,t=this.context.createImageData(this.context.canvas.width,this.context.canvas.height);try{e=new Uint32Array(t.data.buffer)}catch(r){e=new Uint32Array(this.context.canvas.width*this.context.canvas.height*4);for(var n=t.data,i=0;i<n.length;i++)e[i]=n[i]}for(var r=e.length,a=6*Math.random()+4,o=0,s=0,l=0;l<r;){if(o<0)o=a*Math.random(),s=255*Math.pow(Math.random(),.4)<<24;o-=1,e[l++]=s}this.context.putImageData(t,0,0)}}},{key:"_loop",value:function(){var e=this;this._stop||(this._noise(),this._animationHandle=B((function(){return e._loop()})))}},{key:"destroy",value:function(){this._animationHandle&&(U(this._animationHandle),this._stop=!0)}},{key:"_animate",value:function(){this.canvas=this.$el.find("canvas[data-no-op-canvas]")[0],this.context=this.canvas.getContext("2d"),this._loop()}}]),t}(he);nt.canPlay=function(e){return!0};var it={getStyleFor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{baseUrl:""};return E('<style class="clappr-style"></style>').html(We(e.toString())(t))}},rt=function(e){function t(e){var n;return r(this,t),(n=d(this,l(t).call(this,e)))._initializeMessages(),n}return s(t,e),o(t,[{key:"name",get:function(){return"strings"}},{key:"supportedVersion",get:function(){return{min:"0.4.11"}}}]),o(t,[{key:"t",value:function(e){var t=this._language(),n=this._messages.en;return(t&&this._messages[t]||n)[e]||n[e]||e}},{key:"_language",value:function(){return this.core.options.language||j()}},{key:"_initializeMessages",value:function(){this._messages=E.extend(!0,{en:{live:"live",back_to_live:"back to live",disabled:"Disabled",playback_not_supported:"Your browser does not support the playback of this video. Please try using a different browser.",default_error_title:"Could not play video.",default_error_message:"There was a problem trying to load the video."},pt:{live:"ao vivo",back_to_live:"voltar para o ao vivo",disabled:"Desativado",playback_not_supported:"Seu navegador não supporta a reprodução deste video. Por favor, tente usar um navegador diferente.",default_error_title:"Não foi possível reproduzir o vídeo.",default_error_message:"Ocorreu um problema ao tentar carregar o vídeo."},es:{live:"vivo",back_to_live:"volver en vivo",disabled:"Discapacitado",playback_not_supported:"Su navegador no soporta la reproducción de un video. Por favor, trate de usar un navegador diferente."},ru:{live:"прямой эфир",back_to_live:"к прямому эфиру",disabled:"Отключено",playback_not_supported:"Ваш браузер не поддерживает воспроизведение этого видео. Пожалуйста, попробуйте другой браузер."},fr:{live:"en direct",back_to_live:"retour au direct",disabled:"Désactivé",playback_not_supported:"Votre navigateur ne supporte pas la lecture de cette vidéo. Merci de tenter sur un autre navigateur.",default_error_title:"Impossible de lire la vidéo.",default_error_message:"Un problème est survenu lors du chargement de la vidéo."},tr:{live:"canlı",back_to_live:"canlı yayına dön",disabled:"Engelli",playback_not_supported:"Tarayıcınız bu videoyu oynatma desteğine sahip değil. Lütfen farklı bir tarayıcı ile deneyin."},et:{live:"Otseülekanne",back_to_live:"Tagasi otseülekande juurde",disabled:"Keelatud",playback_not_supported:"Teie brauser ei toeta selle video taasesitust. Proovige kasutada muud brauserit."},ar:{live:"مباشر",back_to_live:"الرجوع إلى المباشر",disabled:"معطّل",playback_not_supported:"المتصفح الذي تستخدمه لا يدعم تشغيل هذا الفيديو. الرجاء إستخدام متصفح آخر.",default_error_title:"غير قادر الى التشغيل.",default_error_message:"حدثت مشكلة أثناء تحميل الفيديو."}},this.core.options.strings||{}),this._messages["pt-BR"]=this._messages.pt,this._messages["en-US"]=this._messages.en,this._messages["es-419"]=this._messages.es,this._messages["fr-FR"]=this._messages.fr,this._messages["tr-TR"]=this._messages.tr,this._messages["et-EE"]=this._messages.et,this._messages["ar-IQ"]=this._messages.ar}}]),t}(_e),at=function(e){function t(){return r(this,t),d(this,l(t).apply(this,arguments))}return s(t,e),o(t,[{key:"bindEvents",value:function(){this.listenTo(this.core,ne.CORE_CONTAINERS_CREATED,this.onContainersCreated)}},{key:"onContainersCreated",value:function(){var e=this.core.containers.filter((function(e){return"no_op"!==e.playback.name}))[0]||this.core.containers[0];e&&this.core.containers.forEach((function(t){t!==e&&t.destroy()}))}},{key:"name",get:function(){return"sources"}},{key:"supportedVersion",get:function(){return{min:"0.4.11"}}}]),t}(_e);be.registerPlugin(rt),be.registerPlugin(at),be.registerPlayback(nt),be.registerPlayback(tt),be.registerPlayback(et),be.registerPlayback(Je);var ot={Player:Te,Events:ne,Browser:_,ContainerPlugin:ke,UIContainerPlugin:Se,CorePlugin:_e,UICorePlugin:ue,Playback:he,Container:de,Core:pe,PlayerError:se,Loader:be,BaseObject:re,UIObject:oe,Utils:H,HTML5Audio:et,HTML5Video:Je,HTMLImg:tt,Log:Z,Styler:it,version:"0.4.11",template:We,$:E};function st(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function ut(e,t,n){return t&<(e.prototype,t),n&<(e,n),e}function ct(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ht(e,t)}function dt(e){return(dt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ht(e,t){return(ht=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ft(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pt(e,t,n){return(pt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=dt(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}var gt=function(e){function t(e){return st(this,t),ft(this,dt(t).call(this,e))}return ct(t,e),ut(t,[{key:"name",get:function(){return"click_to_pause"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}}]),ut(t,[{key:"bindEvents",value:function(){this.listenTo(this.container,ne.CONTAINER_CLICK,this.click),this.listenTo(this.container,ne.CONTAINER_SETTINGSUPDATE,this.settingsUpdate)}},{key:"click",value:function(){(this.container.getPlaybackType()!==he.LIVE||this.container.isDvrEnabled())&&(this.container.isPlaying()?this.container.pause():this.container.play())}},{key:"settingsUpdate",value:function(){var e=this.container.getPlaybackType()!==he.LIVE||this.container.isDvrEnabled();if(e!==this.pointerEnabled){var t=e?"addClass":"removeClass";this.container.$el[t]("pointer-enabled"),this.pointerEnabled=e}}}]),t}(ke);function vt(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}vt(".cc-controls[data-cc-controls] {\n float: right;\n position: relative;\n display: none; }\n .cc-controls[data-cc-controls].available {\n display: block; }\n .cc-controls[data-cc-controls] .cc-button {\n padding: 6px !important; }\n .cc-controls[data-cc-controls] .cc-button.enabled {\n display: block;\n opacity: 1.0; }\n .cc-controls[data-cc-controls] .cc-button.enabled:hover {\n opacity: 1.0;\n text-shadow: none; }\n .cc-controls[data-cc-controls] > ul {\n list-style-type: none;\n position: absolute;\n bottom: 25px;\n border: 1px solid black;\n display: none;\n background-color: #e6e6e6; }\n .cc-controls[data-cc-controls] li {\n font-size: 10px; }\n .cc-controls[data-cc-controls] li[data-title] {\n background-color: #c3c2c2;\n padding: 5px; }\n .cc-controls[data-cc-controls] li a {\n color: #444;\n padding: 2px 10px;\n display: block;\n text-decoration: none; }\n .cc-controls[data-cc-controls] li a:hover {\n background-color: #555;\n color: white; }\n .cc-controls[data-cc-controls] li a:hover a {\n color: white;\n text-decoration: none; }\n .cc-controls[data-cc-controls] li.current a {\n color: #f00; }\n");var mt=function(e){function t(e){var n;st(this,t),n=ft(this,dt(t).call(this,e));var i=e.options.closedCaptionsConfig;return n._title=i&&i.title?i.title:null,n._ariaLabel=i&&i.ariaLabel?i.ariaLabel:"cc-button",n._labelCb=i&&i.labelCallback&&"function"==typeof i.labelCallback?i.labelCallback:function(e){return e.name},n}return ct(t,e),ut(t,[{key:"name",get:function(){return"closed_captions"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}},{key:"template",get:function(){return We('<button type="button" class="cc-button media-control-button media-control-icon" data-cc-button aria-label="<%= ariaLabel %>"></button>\n<ul>\n <% if (title) { %>\n <li data-title><%= title %></li>\n <% }; %>\n <li><a href="#" data-cc-select="-1"><%= disabledLabel %></a></li>\n <% for (var i = 0; i < tracks.length; i++) { %>\n <li><a href="#" data-cc-select="<%= tracks[i].id %>"><%= tracks[i].label %></a></li>\n <% }; %>\n</ul>\n')}},{key:"events",get:function(){return{"click [data-cc-button]":"toggleContextMenu","click [data-cc-select]":"onTrackSelect"}}},{key:"attributes",get:function(){return{class:"cc-controls","data-cc-controls":""}}}]),ut(t,[{key:"bindEvents",value:function(){this.bindCoreEvents(),this.bindContainerEvents()}},{key:"bindCoreEvents",value:function(){var e=this;this.core.mediaControl.settings?(this.listenTo(this.core,ne.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged),this.listenTo(this.core.mediaControl,ne.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,ne.MEDIACONTROL_HIDE,this.hideContextMenu)):setTimeout((function(){return e.bindCoreEvents()}),100)}},{key:"bindContainerEvents",value:function(){this.container=this.core.activeContainer,this.container&&(this.listenTo(this.container,ne.CONTAINER_SUBTITLE_AVAILABLE,this.onSubtitleAvailable),this.listenTo(this.container,ne.CONTAINER_SUBTITLE_CHANGED,this.onSubtitleChanged),this.listenTo(this.container,ne.CONTAINER_STOP,this.onContainerStop))}},{key:"onContainerStop",value:function(){this.ccAvailable(!1)}},{key:"containerChanged",value:function(){this.ccAvailable(!1),this.stopListening(),this.bindEvents()}},{key:"onSubtitleAvailable",value:function(){this.renderCcButton(),this.ccAvailable(!0)}},{key:"onSubtitleChanged",value:function(e){this.setCurrentContextMenuElement(e.id)}},{key:"onTrackSelect",value:function(e){var t=parseInt(e.target.dataset.ccSelect,10);return this.container.closedCaptionsTrackId=t,this.hideContextMenu(),e.stopPropagation(),!1}},{key:"ccAvailable",value:function(e){var t=e?"addClass":"removeClass";this.$el[t]("available")}},{key:"toggleContextMenu",value:function(){this.$el.find("ul").toggle()}},{key:"hideContextMenu",value:function(){this.$el.find("ul").hide()}},{key:"contextMenuElement",value:function(e){return this.$el.find("ul a"+(isNaN(e)?"":'[data-cc-select="'+e+'"]')).parent()}},{key:"setCurrentContextMenuElement",value:function(e){if(this._trackId!==e){this.contextMenuElement().removeClass("current"),this.contextMenuElement(e).addClass("current");var t=e>-1?"addClass":"removeClass";this.$ccButton[t]("enabled"),this._trackId=e}}},{key:"renderCcButton",value:function(){for(var e=this.container?this.container.closedCaptionsTracks:[],t=0;t<e.length;t++)e[t].label=this._labelCb(e[t]);this.$el.html(this.template({ariaLabel:this._ariaLabel,disabledLabel:this.core.i18n.t("disabled"),title:this._title,tracks:e})),this.$ccButton=this.$el.find("button.cc-button[data-cc-button]"),this.$ccButton.append('<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 49 41.8" style="enable-background:new 0 0 49 41.8;" xml:space="preserve">\n<path d="M47.1,0H3.2C1.6,0,0,1.2,0,2.8v31.5C0,35.9,1.6,37,3.2,37h11.9l3.2,1.9l4.7,2.7c0.9,0.5,2-0.1,2-1.1V37h22.1\n\tc1.6,0,1.9-1.1,1.9-2.7V2.8C49,1.2,48.7,0,47.1,0z M7.2,18.6c0-4.8,3.5-9.3,9.9-9.3c4.8,0,7.1,2.7,7.1,2.7l-2.5,4\n\tc0,0-1.7-1.7-4.2-1.7c-2.8,0-4.3,2.1-4.3,4.3c0,2.1,1.5,4.4,4.5,4.4c2.5,0,4.9-2.1,4.9-2.1l2.2,4.2c0,0-2.7,2.9-7.6,2.9\n\tC10.8,27.9,7.2,23.5,7.2,18.6z M36.9,27.9c-6.4,0-9.9-4.4-9.9-9.3c0-4.8,3.5-9.3,9.9-9.3C41.7,9.3,44,12,44,12l-2.5,4\n\tc0,0-1.7-1.7-4.2-1.7c-2.8,0-4.3,2.1-4.3,4.3c0,2.1,1.5,4.4,4.5,4.4c2.5,0,4.9-2.1,4.9-2.1l2.2,4.2C44.5,25,41.9,27.9,36.9,27.9z"/>\n</svg>'),this.$el.append(this.style)}},{key:"render",value:function(){this.renderCcButton();var e=this.core.mediaControl.$el.find("button[data-fullscreen]");return e[0]?this.$el.insertAfter(e):this.core.mediaControl.$el.find(".media-control-right-panel[data-media-control]").prepend(this.$el),this}}]),t}(ue);vt('.dvr-controls[data-dvr-controls] {\n display: inline-block;\n float: left;\n color: #fff;\n line-height: 32px;\n font-size: 10px;\n font-weight: bold;\n margin-left: 6px; }\n .dvr-controls[data-dvr-controls] .live-info {\n cursor: default;\n font-family: "Roboto", "Open Sans", Arial, sans-serif;\n text-transform: uppercase; }\n .dvr-controls[data-dvr-controls] .live-info:before {\n content: "";\n display: inline-block;\n position: relative;\n width: 7px;\n height: 7px;\n border-radius: 3.5px;\n margin-right: 3.5px;\n background-color: #ff0101; }\n .dvr-controls[data-dvr-controls] .live-info.disabled {\n opacity: 0.3; }\n .dvr-controls[data-dvr-controls] .live-info.disabled:before {\n background-color: #fff; }\n .dvr-controls[data-dvr-controls] .live-button {\n cursor: pointer;\n outline: none;\n display: none;\n border: 0;\n color: #fff;\n background-color: transparent;\n height: 32px;\n padding: 0;\n opacity: 0.7;\n font-family: "Roboto", "Open Sans", Arial, sans-serif;\n text-transform: uppercase;\n transition: all 0.1s ease; }\n .dvr-controls[data-dvr-controls] .live-button:before {\n content: "";\n display: inline-block;\n position: relative;\n width: 7px;\n height: 7px;\n border-radius: 3.5px;\n margin-right: 3.5px;\n background-color: #fff; }\n .dvr-controls[data-dvr-controls] .live-button:hover {\n opacity: 1;\n text-shadow: rgba(255, 255, 255, 0.75) 0 0 5px; }\n\n.dvr .dvr-controls[data-dvr-controls] .live-info {\n display: none; }\n\n.dvr .dvr-controls[data-dvr-controls] .live-button {\n display: block; }\n\n.dvr.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar] {\n background-color: #005aff; }\n\n.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar] {\n background-color: #ff0101; }\n');var yt=function(e){function t(e){var n;return st(this,t),(n=ft(this,dt(t).call(this,e))).settingsUpdate(),n}return ct(t,e),ut(t,[{key:"template",get:function(){return We('<div class="live-info"><%= live %></div>\n<button type="button" class="live-button" aria-label="<%= backToLive %>"><%= backToLive %></button>\n')}},{key:"name",get:function(){return"dvr_controls"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}},{key:"events",get:function(){return{"click .live-button":"click"}}},{key:"attributes",get:function(){return{class:"dvr-controls","data-dvr-controls":""}}}]),ut(t,[{key:"bindEvents",value:function(){this.bindCoreEvents(),this.bindContainerEvents()}},{key:"bindCoreEvents",value:function(){var e=this;this.core.mediaControl.settings?(this.listenTo(this.core.mediaControl,ne.MEDIACONTROL_CONTAINERCHANGED,this.containerChanged),this.listenTo(this.core.mediaControl,ne.MEDIACONTROL_RENDERED,this.settingsUpdate),this.listenTo(this.core,ne.CORE_OPTIONS_CHANGE,this.render)):setTimeout((function(){return e.bindCoreEvents()}),100)}},{key:"bindContainerEvents",value:function(){this.core.activeContainer&&(this.listenToOnce(this.core.activeContainer,ne.CONTAINER_TIMEUPDATE,this.render),this.listenTo(this.core.activeContainer,ne.CONTAINER_PLAYBACKDVRSTATECHANGED,this.dvrChanged))}},{key:"containerChanged",value:function(){this.stopListening(),this.bindEvents()}},{key:"dvrChanged",value:function(e){this.core.getPlaybackType()===he.LIVE&&(this.settingsUpdate(),this.core.mediaControl.$el.addClass("live"),e?(this.core.mediaControl.$el.addClass("dvr"),this.core.mediaControl.$el.find(".media-control-indicator[data-position], .media-control-indicator[data-duration]").hide()):this.core.mediaControl.$el.removeClass("dvr"))}},{key:"click",value:function(){var e=this.core.mediaControl,t=e.container;t.isPlaying()||t.play(),e.$el.hasClass("dvr")&&t.seek(t.getDuration())}},{key:"settingsUpdate",value:function(){var e=this;this.stopListening(),this.core.mediaControl.$el.removeClass("live"),this.shouldRender()&&(this.render(),this.$el.click((function(){return e.click()}))),this.bindEvents()}},{key:"shouldRender",value:function(){return(void 0===this.core.options.useDvrControls||!!this.core.options.useDvrControls)&&this.core.getPlaybackType()===he.LIVE}},{key:"render",value:function(){return this.$el.html(this.template({live:this.core.i18n.t("live"),backToLive:this.core.i18n.t("back_to_live")})),this.shouldRender()&&(this.core.mediaControl.$el.addClass("live"),this.core.mediaControl.$(".media-control-left-panel[data-media-control]").append(this.$el)),this}}]),t}(ue),At=function(e){function t(){return st(this,t),ft(this,dt(t).apply(this,arguments))}return ct(t,e),ut(t,[{key:"bindEvents",value:function(){this.listenTo(this.core,ne.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged);var e=this.core.activeContainer;e&&(this.listenTo(e,ne.CONTAINER_ENDED,this.ended),this.listenTo(e,ne.CONTAINER_STOP,this.ended))}},{key:"containerChanged",value:function(){this.stopListening(),this.bindEvents()}},{key:"ended",value:function(){(void 0===this.core.options.exitFullscreenOnEnd||this.core.options.exitFullscreenOnEnd)&&this.core.isFullscreen()&&this.core.toggleFullscreen()}},{key:"name",get:function(){return"end_video"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}}]),t}(_e);vt("div.player-error-screen {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n color: #CCCACA;\n position: absolute;\n top: 0;\n height: 100%;\n width: 100%;\n background-color: rgba(0, 0, 0, 0.7);\n z-index: 2000;\n display: flex;\n flex-direction: column;\n justify-content: center; }\n div.player-error-screen__content[data-error-screen] {\n font-size: 14px;\n color: #CCCACA;\n margin-top: 45px; }\n div.player-error-screen__title[data-error-screen] {\n font-weight: bold;\n line-height: 30px;\n font-size: 18px; }\n div.player-error-screen__message[data-error-screen] {\n width: 90%;\n margin: 0 auto; }\n div.player-error-screen__code[data-error-screen] {\n font-size: 13px;\n margin-top: 15px; }\n div.player-error-screen__reload {\n cursor: pointer;\n width: 30px;\n margin: 15px auto 0; }\n");var bt=function(e){function t(e){var n;return st(this,t),(n=ft(this,dt(t).call(this,e))).options.disableErrorScreen?ft(n,n.disable()):n}return ct(t,e),ut(t,[{key:"name",get:function(){return"error_screen"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}},{key:"template",get:function(){return We('<div class="player-error-screen__content" data-error-screen>\n <% if (icon) { %>\n <div class="player-error-screen__icon" data-error-screen><%= icon %></div>\n <% } %>\n <div class="player-error-screen__title" data-error-screen><%= title %></div>\n <div class="player-error-screen__message" data-error-screen><%= message %></div>\n <div class="player-error-screen__code" data-error-screen>Error code: <%= code %></div>\n <div class="player-error-screen__reload" data-error-screen><%= reloadIcon %></div>\n</div>\n')}},{key:"container",get:function(){return this.core.getCurrentContainer()}},{key:"attributes",get:function(){return{class:"player-error-screen","data-error-screen":""}}}]),ut(t,[{key:"bindEvents",value:function(){this.listenTo(this.core,ne.ERROR,this.onError),this.listenTo(this.core,ne.CORE_ACTIVE_CONTAINER_CHANGED,this.onContainerChanged)}},{key:"bindReload",value:function(){this.reloadButton=this.$el.find(".player-error-screen__reload"),this.reloadButton&&this.reloadButton.on("click",this.reload.bind(this))}},{key:"reload",value:function(){var e=this;this.listenToOnce(this.core,ne.CORE_READY,(function(){return e.container.play()})),this.core.load(this.options.sources,this.options.mimeType),this.unbindReload()}},{key:"unbindReload",value:function(){this.reloadButton&&this.reloadButton.off("click")}},{key:"onContainerChanged",value:function(){this.err=null,this.unbindReload(),this.hide()}},{key:"onError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.level===se.Levels.FATAL&&(this.err=e,this.container.disableMediaControl(),this.container.stop(),this.show())}},{key:"show",value:function(){this.render(),this.$el.show()}},{key:"hide",value:function(){this.$el.hide()}},{key:"render",value:function(){if(this.err)return this.$el.html(this.template({title:this.err.UI.title,message:this.err.UI.message,code:this.err.code,icon:this.err.UI.icon||"",reloadIcon:'<svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/>\n <path d="M0 0h24v24H0z" fill="none"/>\n</svg>'})),this.core.$el.append(this.el),this.bindReload(),this}}]),t}(ue),Et='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill="#010101" d="M1.425.35L14.575 8l-13.15 7.65V.35z"/>\n</svg>',Tt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M1.712 14.76H6.43V1.24H1.71v13.52zm7.86-13.52v13.52h4.716V1.24H9.573z"/>\n</svg>',kt=E('link[rel="shortcut icon"]'),_t=function(e){function t(e){var n;return st(this,t),(n=ft(this,dt(t).call(this,e)))._container=null,n.configure(),n}return ct(t,e),ut(t,[{key:"name",get:function(){return"favicon"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}},{key:"oldIcon",get:function(){return kt}}]),ut(t,[{key:"configure",value:function(){this.core.options.changeFavicon?this.enabled||(this.stopListening(this.core,ne.CORE_OPTIONS_CHANGE),this.enable()):this.enabled&&(this.disable(),this.listenTo(this.core,ne.CORE_OPTIONS_CHANGE,this.configure))}},{key:"bindEvents",value:function(){this.listenTo(this.core,ne.CORE_OPTIONS_CHANGE,this.configure),this.listenTo(this.core,ne.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged),this.core.activeContainer&&this.containerChanged()}},{key:"containerChanged",value:function(){this._container&&this.stopListening(this._container),this._container=this.core.activeContainer,this.listenTo(this._container,ne.CONTAINER_PLAY,this.setPlayIcon),this.listenTo(this._container,ne.CONTAINER_PAUSE,this.setPauseIcon),this.listenTo(this._container,ne.CONTAINER_STOP,this.resetIcon),this.listenTo(this._container,ne.CONTAINER_ENDED,this.resetIcon),this.listenTo(this._container,ne.CONTAINER_ERROR,this.resetIcon),this.resetIcon()}},{key:"disable",value:function(){pt(dt(t.prototype),"disable",this).call(this),this.resetIcon()}},{key:"destroy",value:function(){pt(dt(t.prototype),"destroy",this).call(this),this.resetIcon()}},{key:"createIcon",value:function(e){var t=E("<canvas/>");t[0].width=16,t[0].height=16;var n=t[0].getContext("2d");n.fillStyle="#000";var i=E(e).find("path").attr("d"),r=new Path2D(i);n.fill(r);var a=E('<link rel="shortcut icon" type="image/png"/>');return a.attr("href",t[0].toDataURL("image/png")),a}},{key:"setPlayIcon",value:function(){this.playIcon||(this.playIcon=this.createIcon(Et)),this.changeIcon(this.playIcon)}},{key:"setPauseIcon",value:function(){this.pauseIcon||(this.pauseIcon=this.createIcon(Tt)),this.changeIcon(this.pauseIcon)}},{key:"resetIcon",value:function(){E('link[rel="shortcut icon"]').remove(),E("head").append(this.oldIcon)}},{key:"changeIcon",value:function(e){e&&(E('link[rel="shortcut icon"]').remove(),E("head").append(e))}}]),t}(_e),St=function(e){function t(e){var n;return st(this,t),(n=ft(this,dt(t).call(this,e))).container.options.gaAccount&&(n.account=n.container.options.gaAccount,n.trackerName=n.container.options.gaTrackerName?n.container.options.gaTrackerName+".":"Clappr.",n.domainName=n.container.options.gaDomainName,n.currentHDState=void 0,n.embedScript()),n}return ct(t,e),ut(t,[{key:"name",get:function(){return"google_analytics"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}}]),ut(t,[{key:"embedScript",value:function(){var e=this;if(window._gat)this.addEventListeners();else{var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("async","async"),t.setAttribute("src","//www.google-analytics.com/ga.js"),t.onload=function(){return e.addEventListeners()},document.body.appendChild(t)}}},{key:"addEventListeners",value:function(){var e=this;this.container&&(this.listenTo(this.container,ne.CONTAINER_READY,this.onReady),this.listenTo(this.container,ne.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,ne.CONTAINER_STOP,this.onStop),this.listenTo(this.container,ne.CONTAINER_PAUSE,this.onPause),this.listenTo(this.container,ne.CONTAINER_ENDED,this.onEnded),this.listenTo(this.container,ne.CONTAINER_STATE_BUFFERING,this.onBuffering),this.listenTo(this.container,ne.CONTAINER_STATE_BUFFERFULL,this.onBufferFull),this.listenTo(this.container,ne.CONTAINER_ERROR,this.onError),this.listenTo(this.container,ne.CONTAINER_PLAYBACKSTATE,this.onPlaybackChanged),this.listenTo(this.container,ne.CONTAINER_VOLUME,(function(t){return e.onVolumeChanged(t)})),this.listenTo(this.container,ne.CONTAINER_SEEK,(function(t){return e.onSeek(t)})),this.listenTo(this.container,ne.CONTAINER_FULL_SCREEN,this.onFullscreen),this.listenTo(this.container,ne.CONTAINER_HIGHDEFINITIONUPDATE,this.onHD),this.listenTo(this.container,ne.CONTAINER_PLAYBACKDVRSTATECHANGED,this.onDVR)),_gaq.push([this.trackerName+"_setAccount",this.account]),this.domainName&&_gaq.push([this.trackerName+"_setDomainName",this.domainName])}},{key:"onReady",value:function(){this.push(["Video","Playback",this.container.playback.name])}},{key:"onPlay",value:function(){this.push(["Video","Play",this.container.playback.src])}},{key:"onStop",value:function(){this.push(["Video","Stop",this.container.playback.src])}},{key:"onEnded",value:function(){this.push(["Video","Ended",this.container.playback.src])}},{key:"onBuffering",value:function(){this.push(["Video","Buffering",this.container.playback.src])}},{key:"onBufferFull",value:function(){this.push(["Video","Bufferfull",this.container.playback.src])}},{key:"onError",value:function(){this.push(["Video","Error",this.container.playback.src])}},{key:"onHD",value:function(e){var t=e?"ON":"OFF";t!==this.currentHDState&&(this.currentHDState=t,this.push(["Video","HD - "+t,this.container.playback.src]))}},{key:"onPlaybackChanged",value:function(e){null!==e.type&&this.push(["Video","Playback Type - "+e.type,this.container.playback.src])}},{key:"onDVR",value:function(e){var t=e?"ON":"OFF";this.push(["Interaction","DVR - "+t,this.container.playback.src])}},{key:"onPause",value:function(){this.push(["Video","Pause",this.container.playback.src])}},{key:"onSeek",value:function(){this.push(["Video","Seek",this.container.playback.src])}},{key:"onVolumeChanged",value:function(){this.push(["Interaction","Volume",this.container.playback.src])}},{key:"onFullscreen",value:function(){this.push(["Interaction","Fullscreen",this.container.playback.src])}},{key:"push",value:function(e){var t=[this.trackerName+"_trackEvent"].concat(e);_gaq.push(t)}}]),t}(ke),Ct="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function wt(){throw new Error("setTimeout has not been defined")}function Rt(){throw new Error("clearTimeout has not been defined")}var Ot=wt,Lt=Rt;function Dt(e){if(Ot===setTimeout)return setTimeout(e,0);if((Ot===wt||!Ot)&&setTimeout)return Ot=setTimeout,setTimeout(e,0);try{return Ot(e,0)}catch(t){try{return Ot.call(null,e,0)}catch(t){return Ot.call(this,e,0)}}}"function"==typeof Ct.setTimeout&&(Ot=setTimeout),"function"==typeof Ct.clearTimeout&&(Lt=clearTimeout);var It,Pt=[],xt=!1,Nt=-1;function Mt(){xt&&It&&(xt=!1,It.length?Pt=It.concat(Pt):Nt=-1,Pt.length&&Ft())}function Ft(){if(!xt){var e=Dt(Mt);xt=!0;for(var t=Pt.length;t;){for(It=Pt,Pt=[];++Nt<t;)It&&It[Nt].run();Nt=-1,t=Pt.length}It=null,xt=!1,function(e){if(Lt===clearTimeout)return clearTimeout(e);if((Lt===Rt||!Lt)&&clearTimeout)return Lt=clearTimeout,clearTimeout(e);try{Lt(e)}catch(t){try{return Lt.call(null,e)}catch(t){return Lt.call(this,e)}}}(e)}}function Bt(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Pt.push(new Ut(e,t)),1!==Pt.length||xt||Dt(Ft)}function Ut(e,t){this.fun=e,this.array=t}Ut.prototype.run=function(){this.fun.apply(null,this.array)};var jt=Ct.performance||{},Vt=(jt.now||jt.mozNow||jt.msNow||jt.oNow||jt.webkitNow,function(e){this.element=e||window.document,this.initialize()});Vt.KEY_NAMES_BY_CODE={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"caps_lock",27:"esc",32:"space",37:"left",38:"up",39:"right",40:"down",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},Vt.KEY_CODES_BY_NAME={},function(){for(var e in Vt.KEY_NAMES_BY_CODE)Object.prototype.hasOwnProperty.call(Vt.KEY_NAMES_BY_CODE,e)&&(Vt.KEY_CODES_BY_NAME[Vt.KEY_NAMES_BY_CODE[e]]=+e)}(),Vt.MODIFIERS=["shift","ctrl","alt"],Vt.registerEvent=document.addEventListener?function(e,t,n){e.addEventListener(t,n,!1)}:document.attachEvent?function(e,t,n){e.attachEvent("on"+t,n)}:void 0,Vt.unregisterEvent=document.removeEventListener?function(e,t,n){e.removeEventListener(t,n,!1)}:document.detachEvent?function(e,t,n){e.detachEvent("on"+t,n)}:void 0,Vt.stringContains=function(e,t){return-1!==e.indexOf(t)},Vt.neatString=function(e){return e.replace(/^\s+|\s+$/g,"").replace(/\s+/g," ")},Vt.capitalize=function(e){return e.toLowerCase().replace(/^./,(function(e){return e.toUpperCase()}))},Vt.isString=function(e){return Vt.stringContains(Object.prototype.toString.call(e),"String")},Vt.arrayIncludes=Array.prototype.indexOf?function(e,t){return-1!==e.indexOf(t)}:function(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return!0;return!1},Vt.extractModifiers=function(e){var t,n;for(t=[],n=0;n<Vt.MODIFIERS.length;n++)Vt.stringContains(e,Vt.MODIFIERS[n])&&t.push(Vt.MODIFIERS[n]);return t},Vt.extractKey=function(e){var t,n;for(t=Vt.neatString(e).split(" "),n=0;n<t.length;n++)if(!Vt.arrayIncludes(Vt.MODIFIERS,t[n]))return t[n]},Vt.modifiersAndKey=function(e){var t,n;return Vt.stringContains(e,"any")?Vt.neatString(e).split(" ").slice(0,2).join(" "):(t=Vt.extractModifiers(e),(n=Vt.extractKey(e))&&!Vt.arrayIncludes(Vt.MODIFIERS,n)&&t.push(n),t.join(" "))},Vt.keyName=function(e){return Vt.KEY_NAMES_BY_CODE[e+""]},Vt.keyCode=function(e){return+Vt.KEY_CODES_BY_NAME[e]},Vt.prototype.initialize=function(){var e,t=this;for(this.lastKeyCode=-1,this.lastModifiers={},e=0;e<Vt.MODIFIERS.length;e++)this.lastModifiers[Vt.MODIFIERS[e]]=!1;this.keysDown={any:[]},this.keysUp={any:[]},this.downHandler=this.handler("down"),this.upHandler=this.handler("up"),Vt.registerEvent(this.element,"keydown",this.downHandler),Vt.registerEvent(this.element,"keyup",this.upHandler),Vt.registerEvent(window,"unload",(function e(){Vt.unregisterEvent(t.element,"keydown",t.downHandler),Vt.unregisterEvent(t.element,"keyup",t.upHandler),Vt.unregisterEvent(window,"unload",e)}))},Vt.prototype.handler=function(e){var t=this;return function(n){var i,r,a;for(n=n||window.event,t.lastKeyCode=n.keyCode,i=0;i<Vt.MODIFIERS.length;i++)t.lastModifiers[Vt.MODIFIERS[i]]=n[Vt.MODIFIERS[i]+"Key"];for(Vt.arrayIncludes(Vt.MODIFIERS,Vt.keyName(t.lastKeyCode))&&(t.lastModifiers[Vt.keyName(t.lastKeyCode)]=!0),r=t["keys"+Vt.capitalize(e)],i=0;i<r.any.length;i++)!1===r.any[i](n)&&n.preventDefault&&n.preventDefault();if(r[a=t.lastModifiersAndKey()])for(i=0;i<r[a].length;i++)!1===r[a][i](n)&&n.preventDefault&&n.preventDefault()}},Vt.prototype.registerKeys=function(e,t,n){var i,r,a=this["keys"+Vt.capitalize(e)];for(Vt.isString(t)&&(t=[t]),i=0;i<t.length;i++)r=t[i],a[r=Vt.modifiersAndKey(r+"")]?a[r].push(n):a[r]=[n];return this},Vt.prototype.unregisterKeys=function(e,t,n){var i,r,a,o=this["keys"+Vt.capitalize(e)];for(Vt.isString(t)&&(t=[t]),i=0;i<t.length;i++)if(a=t[i],a=Vt.modifiersAndKey(a+""),null===n)delete o[a];else if(o[a])for(r=0;r<o[a].length;r++)if(String(o[a][r])===String(n)){o[a].splice(r,1);break}return this},Vt.prototype.off=function(e){return this.unregisterKeys("down",e,null)},Vt.prototype.delegate=function(e,t,n){return null!==n||void 0!==n?this.registerKeys(e,t,n):this.unregisterKeys(e,t,n)},Vt.prototype.down=function(e,t){return this.delegate("down",e,t)},Vt.prototype.up=function(e,t){return this.delegate("up",e,t)},Vt.prototype.lastKey=function(e){return e?this.lastModifiers[e]:Vt.keyName(this.lastKeyCode)},Vt.prototype.lastModifiersAndKey=function(){var e,t;for(e=[],t=0;t<Vt.MODIFIERS.length;t++)this.lastKey(Vt.MODIFIERS[t])&&e.push(Vt.MODIFIERS[t]);return Vt.arrayIncludes(e,this.lastKey())||e.push(this.lastKey()),e.join(" ")};var Kt={Kibo:Vt};vt('.media-control-notransition {\n transition: none !important; }\n\n.media-control[data-media-control] {\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: 9999;\n pointer-events: none; }\n .media-control[data-media-control].dragging {\n pointer-events: auto;\n cursor: -webkit-grabbing !important;\n cursor: grabbing !important;\n cursor: url("closed-hand.cur"), move; }\n .media-control[data-media-control].dragging * {\n cursor: -webkit-grabbing !important;\n cursor: grabbing !important;\n cursor: url("closed-hand.cur"), move; }\n .media-control[data-media-control] .media-control-background[data-background] {\n position: absolute;\n height: 40%;\n width: 100%;\n bottom: 0;\n background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));\n transition: opacity 0.6s ease-out; }\n .media-control[data-media-control] .media-control-icon {\n line-height: 0;\n letter-spacing: 0;\n speak: none;\n color: #fff;\n opacity: 0.5;\n vertical-align: middle;\n text-align: left;\n transition: all 0.1s ease; }\n .media-control[data-media-control] .media-control-icon:hover {\n color: white;\n opacity: 0.75;\n text-shadow: rgba(255, 255, 255, 0.8) 0 0 5px; }\n .media-control[data-media-control].media-control-hide .media-control-background[data-background] {\n opacity: 0; }\n .media-control[data-media-control].media-control-hide .media-control-layer[data-controls] {\n bottom: -50px; }\n .media-control[data-media-control].media-control-hide .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] {\n opacity: 0; }\n .media-control[data-media-control] .media-control-layer[data-controls] {\n position: absolute;\n bottom: 7px;\n width: 100%;\n height: 32px;\n font-size: 0;\n vertical-align: middle;\n pointer-events: auto;\n transition: bottom 0.4s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-left-panel[data-media-control] {\n position: absolute;\n top: 0;\n left: 4px;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-center-panel[data-media-control] {\n height: 100%;\n text-align: center;\n line-height: 32px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-right-panel[data-media-control] {\n position: absolute;\n top: 0;\n right: 4px;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button {\n background-color: transparent;\n border: 0;\n margin: 0 6px;\n padding: 0;\n cursor: pointer;\n display: inline-block;\n width: 32px;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button svg {\n width: 100%;\n height: 22px; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button svg path {\n fill: white; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button:focus {\n outline: none; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-play] {\n float: left;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-pause] {\n float: left;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-stop] {\n float: left;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-fullscreen] {\n float: right;\n background-color: transparent;\n border: 0;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator] {\n background-color: transparent;\n border: 0;\n cursor: default;\n display: none;\n float: right;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled {\n display: block;\n opacity: 1.0; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled:hover {\n opacity: 1.0;\n text-shadow: none; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause] {\n float: left; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop] {\n float: left; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position], .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration] {\n display: inline-block;\n font-size: 10px;\n color: white;\n cursor: default;\n line-height: 32px;\n position: relative; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position] {\n margin: 0 6px 0 7px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration] {\n color: rgba(255, 255, 255, 0.5);\n margin-right: 6px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration]:before {\n content: "|";\n margin-right: 7px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] {\n position: absolute;\n top: -20px;\n left: 0;\n display: inline-block;\n vertical-align: middle;\n width: 100%;\n height: 25px;\n cursor: pointer; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] {\n width: 100%;\n height: 1px;\n position: relative;\n top: 12px;\n background-color: #666666; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-1[data-seekbar] {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n background-color: #c2c2c2;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar] {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n background-color: #005aff;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-hover[data-seekbar] {\n opacity: 0;\n position: absolute;\n top: -3px;\n width: 5px;\n height: 7px;\n background-color: rgba(255, 255, 255, 0.5);\n transition: opacity 0.1s ease; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]:hover .bar-background[data-seekbar] .bar-hover[data-seekbar] {\n opacity: 1; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled {\n cursor: default; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled:hover .bar-background[data-seekbar] .bar-hover[data-seekbar] {\n opacity: 0; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] {\n position: absolute;\n transform: translateX(-50%);\n top: 2px;\n left: 0;\n width: 20px;\n height: 20px;\n opacity: 1;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] .bar-scrubber-icon[data-seekbar] {\n position: absolute;\n left: 6px;\n top: 6px;\n width: 8px;\n height: 8px;\n border-radius: 10px;\n box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.2);\n background-color: white; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] {\n float: right;\n display: inline-block;\n height: 32px;\n cursor: pointer;\n margin: 0 6px;\n box-sizing: border-box; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] {\n float: left;\n bottom: 0; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume] {\n background-color: transparent;\n border: 0;\n box-sizing: content-box;\n width: 32px;\n height: 32px;\n opacity: 0.5; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]:hover {\n opacity: 0.75; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume] svg {\n height: 24px;\n position: relative;\n top: 3px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume] svg path {\n fill: white; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume].muted svg {\n margin-left: 2px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] {\n float: left;\n position: relative;\n overflow: hidden;\n top: 6px;\n width: 42px;\n height: 18px;\n padding: 3px 0;\n transition: width .2s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] {\n height: 1px;\n position: relative;\n top: 7px;\n margin: 0 3px;\n background-color: #666666; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] .bar-fill-1[data-volume] {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n background-color: #c2c2c2;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] .bar-fill-2[data-volume] {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n background-color: #005aff;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] .bar-hover[data-volume] {\n opacity: 0;\n position: absolute;\n top: -3px;\n width: 5px;\n height: 7px;\n background-color: rgba(255, 255, 255, 0.5);\n transition: opacity 0.1s ease; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-scrubber[data-volume] {\n position: absolute;\n transform: translateX(-50%);\n top: 0px;\n left: 0;\n width: 20px;\n height: 20px;\n opacity: 1;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-scrubber[data-volume] .bar-scrubber-icon[data-volume] {\n position: absolute;\n left: 6px;\n top: 6px;\n width: 8px;\n height: 8px;\n border-radius: 10px;\n box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.2);\n background-color: white; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume] {\n float: left;\n width: 4px;\n padding-left: 2px;\n height: 12px;\n opacity: 0.5;\n box-shadow: inset 2px 0 0 white;\n transition: transform .2s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume].fill {\n box-shadow: inset 2px 0 0 #fff;\n opacity: 1; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:nth-of-type(1) {\n padding-left: 0; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:hover {\n transform: scaleY(1.5); }\n .media-control[data-media-control].w320 .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume].volume-bar-hide {\n width: 0;\n height: 12px;\n top: 9px;\n padding: 0; }\n');var Gt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M1.712 1.24h12.6v13.52h-12.6z"/>\n</svg>',Yt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M11.5 11h-.002v1.502L7.798 10H4.5V6h3.297l3.7-2.502V4.5h.003V11zM11 4.49L7.953 6.5H5v3h2.953L11 11.51V4.49z"/>\n</svg>',Ht='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill="#010101" d="M7.156 8L4 11.156V8.5H3V13h4.5v-1H4.844L8 8.844 7.156 8zM8.5 3v1h2.657L8 7.157 8.846 8 12 4.844V7.5h1V3H8.5z"/>\n</svg>',$t=H.Config,zt=H.Fullscreen,Wt=H.formatTime,qt=H.extend,Xt=H.removeArrayItem,Zt=function(e){function t(e){var n;return st(this,t),(n=ft(this,dt(t).call(this,e))).persistConfig=n.options.persistConfig,n.currentPositionValue=null,n.currentDurationValue=null,n.keepVisible=!1,n.fullScreenOnVideoTagSupported=null,n.setInitialVolume(),n.settings={left:["play","stop","pause"],right:["volume"],default:["position","seekbar","duration"]},n.kibo=new Vt(n.options.focusElement),n.bindKeyEvents(),n.container?E.isEmptyObject(n.container.settings)||(n.settings=E.extend({},n.container.settings)):n.settings={},n.userDisabled=!1,(n.container&&n.container.mediaControlDisabled||n.options.chromeless)&&n.disable(),n.stopDragHandler=function(e){return n.stopDrag(e)},n.updateDragHandler=function(e){return n.updateDrag(e)},E(document).bind("mouseup",n.stopDragHandler),E(document).bind("mousemove",n.updateDragHandler),n}return ct(t,e),ut(t,[{key:"name",get:function(){return"media_control"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}},{key:"disabled",get:function(){var e=this.container&&this.container.getPlaybackType()===he.NO_OP;return this.userDisabled||e}},{key:"container",get:function(){return this.core&&this.core.activeContainer}},{key:"playback",get:function(){return this.core&&this.core.activePlayback}},{key:"attributes",get:function(){return{class:"media-control","data-media-control":""}}},{key:"events",get:function(){return{"click [data-play]":"play","click [data-pause]":"pause","click [data-playpause]":"togglePlayPause","click [data-stop]":"stop","click [data-playstop]":"togglePlayStop","click [data-fullscreen]":"toggleFullscreen","click .bar-container[data-seekbar]":"seek","click .bar-container[data-volume]":"onVolumeClick","click .drawer-icon[data-volume]":"toggleMute","mouseenter .drawer-container[data-volume]":"showVolumeBar","mouseleave .drawer-container[data-volume]":"hideVolumeBar","mousedown .bar-container[data-volume]":"startVolumeDrag","mousemove .bar-container[data-volume]":"mousemoveOnVolumeBar","mousedown .bar-scrubber[data-seekbar]":"startSeekDrag","mousemove .bar-container[data-seekbar]":"mousemoveOnSeekBar","mouseleave .bar-container[data-seekbar]":"mouseleaveOnSeekBar","mouseenter .media-control-layer[data-controls]":"setUserKeepVisible","mouseleave .media-control-layer[data-controls]":"resetUserKeepVisible"}}},{key:"template",get:function(){return We('<div class="media-control-background" data-background></div>\n<div class="media-control-layer" data-controls>\n <% var renderBar = function(name) { %>\n <div class="bar-container" data-<%= name %>>\n <div class="bar-background" data-<%= name %>>\n <div class="bar-fill-1" data-<%= name %>></div>\n <div class="bar-fill-2" data-<%= name %>></div>\n <div class="bar-hover" data-<%= name %>></div>\n </div>\n <div class="bar-scrubber" data-<%= name %>>\n <div class="bar-scrubber-icon" data-<%= name %>></div>\n </div>\n </div>\n <% }; %>\n <% var renderSegmentedBar = function(name, segments) {\n segments = segments || 10; %>\n <div class="bar-container" data-<%= name %>>\n <% for (var i = 0; i < segments; i++) { %>\n <div class="segmented-bar-element" data-<%= name %>></div>\n <% } %>\n </div>\n <% }; %>\n <% var renderDrawer = function(name, renderContent) { %>\n <div class="drawer-container" data-<%= name %>>\n <div class="drawer-icon-container" data-<%= name %>>\n <div class="drawer-icon media-control-icon" data-<%= name %>></div>\n <span class="drawer-text" data-<%= name %>></span>\n </div>\n <% renderContent(name); %>\n </div>\n <% }; %>\n <% var renderIndicator = function(name) { %>\n <div class="media-control-indicator" data-<%= name %>></div>\n <% }; %>\n <% var renderButton = function(name) { %>\n <button type="button" class="media-control-button media-control-icon" data-<%= name %> aria-label="<%= name %>"></button>\n <% }; %>\n <% var templates = {\n bar: renderBar,\n segmentedBar: renderSegmentedBar,\n };\n var render = function(settingsList) {\n settingsList.forEach(function(setting) {\n if(setting === "seekbar") {\n renderBar(setting);\n } else if (setting === "volume") {\n renderDrawer(setting, settings.volumeBarTemplate ? templates[settings.volumeBarTemplate] : function(name) { return renderSegmentedBar(name); });\n } else if (setting === "duration" || setting === "position") {\n renderIndicator(setting);\n } else {\n renderButton(setting);\n }\n });\n }; %>\n <% if (settings.default && settings.default.length) { %>\n <div class="media-control-center-panel" data-media-control>\n <% render(settings.default); %>\n </div>\n <% } %>\n <% if (settings.left && settings.left.length) { %>\n <div class="media-control-left-panel" data-media-control>\n <% render(settings.left); %>\n </div>\n <% } %>\n <% if (settings.right && settings.right.length) { %>\n <div class="media-control-right-panel" data-media-control>\n <% render(settings.right); %>\n </div>\n <% } %>\n</div>\n')}},{key:"volume",get:function(){return this.container&&this.container.isReady?this.container.volume:this.intendedVolume}},{key:"muted",get:function(){return 0===this.volume}}]),ut(t,[{key:"getExternalInterface",value:function(){var e=this;return{setVolume:this.setVolume,getVolume:function(){return e.volume}}}},{key:"bindEvents",value:function(){var e=this;this.stopListening(),this.listenTo(this.core,ne.CORE_ACTIVE_CONTAINER_CHANGED,this.onActiveContainerChanged),this.listenTo(this.core,ne.CORE_MOUSE_MOVE,this.show),this.listenTo(this.core,ne.CORE_MOUSE_LEAVE,(function(){return e.hide(e.options.hideMediaControlDelay)})),this.listenTo(this.core,ne.CORE_FULLSCREEN,this.show),this.listenTo(this.core,ne.CORE_OPTIONS_CHANGE,this.configure),this.listenTo(this.core,ne.CORE_RESIZE,this.playerResize),this.bindContainerEvents()}},{key:"bindContainerEvents",value:function(){this.container&&(this.listenTo(this.container,ne.CONTAINER_PLAY,this.changeTogglePlay),this.listenTo(this.container,ne.CONTAINER_PAUSE,this.changeTogglePlay),this.listenTo(this.container,ne.CONTAINER_STOP,this.changeTogglePlay),this.listenTo(this.container,ne.CONTAINER_DBLCLICK,this.toggleFullscreen),this.listenTo(this.container,ne.CONTAINER_TIMEUPDATE,this.onTimeUpdate),this.listenTo(this.container,ne.CONTAINER_PROGRESS,this.updateProgressBar),this.listenTo(this.container,ne.CONTAINER_SETTINGSUPDATE,this.settingsUpdate),this.listenTo(this.container,ne.CONTAINER_PLAYBACKDVRSTATECHANGED,this.settingsUpdate),this.listenTo(this.container,ne.CONTAINER_HIGHDEFINITIONUPDATE,this.highDefinitionUpdate),this.listenTo(this.container,ne.CONTAINER_MEDIACONTROL_DISABLE,this.disable),this.listenTo(this.container,ne.CONTAINER_MEDIACONTROL_ENABLE,this.enable),this.listenTo(this.container,ne.CONTAINER_ENDED,this.ended),this.listenTo(this.container,ne.CONTAINER_VOLUME,this.onVolumeChanged),this.listenTo(this.container,ne.CONTAINER_OPTIONS_CHANGE,this.setInitialVolume),"video"===this.container.playback.el.nodeName.toLowerCase()&&this.listenToOnce(this.container,ne.CONTAINER_LOADEDMETADATA,this.onLoadedMetadataOnVideoTag))}},{key:"disable",value:function(){this.userDisabled=!0,this.hide(),this.unbindKeyEvents(),this.$el.hide()}},{key:"enable",value:function(){this.options.chromeless||(this.userDisabled=!1,this.bindKeyEvents(),this.show())}},{key:"play",value:function(){this.container&&this.container.play()}},{key:"pause",value:function(){this.container&&this.container.pause()}},{key:"stop",value:function(){this.container&&this.container.stop()}},{key:"setInitialVolume",value:function(){var e=this.persistConfig?$t.restore("volume"):100,t=this.container&&this.container.options||this.options;this.setVolume(t.mute?0:e,!0)}},{key:"onVolumeChanged",value:function(){this.updateVolumeUI()}},{key:"onLoadedMetadataOnVideoTag",value:function(){var e=this.playback&&this.playback.el;!zt.fullscreenEnabled()&&e.webkitSupportsFullscreen&&(this.fullScreenOnVideoTagSupported=!0,this.settingsUpdate())}},{key:"updateVolumeUI",value:function(){if(this.rendered){this.$volumeBarContainer.find(".bar-fill-2").css({});var e=this.$volumeBarContainer.width(),t=this.$volumeBarBackground.width(),n=(e-t)/2,i=t*this.volume/100+n;this.$volumeBarFill.css({width:"".concat(this.volume,"%")}),this.$volumeBarScrubber.css({left:i}),this.$volumeBarContainer.find(".segmented-bar-element").removeClass("fill");var r=Math.ceil(this.volume/10);this.$volumeBarContainer.find(".segmented-bar-element").slice(0,r).addClass("fill"),this.$volumeIcon.html(""),this.$volumeIcon.removeClass("muted"),this.muted?(this.$volumeIcon.append('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M9.75 11.51L6.7 9.5H3.75v-3H6.7L9.75 4.49v.664l.497.498V3.498L6.547 6H3.248v4h3.296l3.7 2.502v-2.154l-.497.5v.662zm3-5.165L12.404 6l-1.655 1.653L9.093 6l-.346.345L10.402 8 8.747 9.654l.346.347 1.655-1.653L12.403 10l.348-.346L11.097 8l1.655-1.655z"/>\n</svg>'),this.$volumeIcon.addClass("muted")):this.$volumeIcon.append(Yt),this.applyButtonStyle(this.$volumeIcon)}}},{key:"changeTogglePlay",value:function(){this.$playPauseToggle.html(""),this.$playStopToggle.html(""),this.container&&this.container.isPlaying()?(this.$playPauseToggle.append(Tt),this.$playStopToggle.append(Gt),this.trigger(ne.MEDIACONTROL_PLAYING)):(this.$playPauseToggle.append(Et),this.$playStopToggle.append(Et),this.trigger(ne.MEDIACONTROL_NOTPLAYING),_.isMobile&&this.show()),this.applyButtonStyle(this.$playPauseToggle),this.applyButtonStyle(this.$playStopToggle)}},{key:"mousemoveOnSeekBar",value:function(e){if(this.settings.seekEnabled){var t=e.pageX-this.$seekBarContainer.offset().left-this.$seekBarHover.width()/2;this.$seekBarHover.css({left:t})}this.trigger(ne.MEDIACONTROL_MOUSEMOVE_SEEKBAR,e)}},{key:"mouseleaveOnSeekBar",value:function(e){this.trigger(ne.MEDIACONTROL_MOUSELEAVE_SEEKBAR,e)}},{key:"onVolumeClick",value:function(e){this.setVolume(this.getVolumeFromUIEvent(e))}},{key:"mousemoveOnVolumeBar",value:function(e){this.draggingVolumeBar&&this.setVolume(this.getVolumeFromUIEvent(e))}},{key:"playerResize",value:function(e){this.$fullscreenToggle.html("");var t=this.core.isFullscreen()?'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill="#010101" d="M13.5 3.344l-.844-.844L9.5 5.656V3h-1v4.5H13v-1h-2.656L13.5 3.344zM3 9.5h2.656L2.5 12.656l.844.844L6.5 10.344V13h1V8.5H3v1z"/>\n</svg>':Ht;this.$fullscreenToggle.append(t),this.applyButtonStyle(this.$fullscreenToggle),0!==this.$el.find(".media-control").length&&this.$el.removeClass("w320"),(e.width<=320||this.options.hideVolumeBar)&&this.$el.addClass("w320")}},{key:"togglePlayPause",value:function(){return this.container.isPlaying()?this.container.pause():this.container.play(),!1}},{key:"togglePlayStop",value:function(){this.container.isPlaying()?this.container.stop():this.container.play()}},{key:"startSeekDrag",value:function(e){this.settings.seekEnabled&&(this.draggingSeekBar=!0,this.$el.addClass("dragging"),this.$seekBarLoaded.addClass("media-control-notransition"),this.$seekBarPosition.addClass("media-control-notransition"),this.$seekBarScrubber.addClass("media-control-notransition"),e&&e.preventDefault())}},{key:"startVolumeDrag",value:function(e){this.draggingVolumeBar=!0,this.$el.addClass("dragging"),e&&e.preventDefault()}},{key:"stopDrag",value:function(e){this.draggingSeekBar&&this.seek(e),this.$el.removeClass("dragging"),this.$seekBarLoaded.removeClass("media-control-notransition"),this.$seekBarPosition.removeClass("media-control-notransition"),this.$seekBarScrubber.removeClass("media-control-notransition dragging"),this.draggingSeekBar=!1,this.draggingVolumeBar=!1}},{key:"updateDrag",value:function(e){if(this.draggingSeekBar){e.preventDefault();var t=(e.pageX-this.$seekBarContainer.offset().left)/this.$seekBarContainer.width()*100;t=Math.min(100,Math.max(t,0)),this.setSeekPercentage(t)}else this.draggingVolumeBar&&(e.preventDefault(),this.setVolume(this.getVolumeFromUIEvent(e)))}},{key:"getVolumeFromUIEvent",value:function(e){return(e.pageX-this.$volumeBarContainer.offset().left)/this.$volumeBarContainer.width()*100}},{key:"toggleMute",value:function(){this.setVolume(this.muted?100:0)}},{key:"setVolume",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e=Math.min(100,Math.max(e,0)),this.intendedVolume=e,this.persistConfig&&!n&&$t.persist("volume",e);var i=function(){t.container&&t.container.isReady?t.container.setVolume(e):t.listenToOnce(t.container,ne.CONTAINER_READY,(function(){t.container.setVolume(e)}))};this.container?i():this.listenToOnce(this,ne.MEDIACONTROL_CONTAINERCHANGED,(function(){return i()}))}},{key:"toggleFullscreen",value:function(){this.trigger(ne.MEDIACONTROL_FULLSCREEN,this.name),this.container.fullscreen(),this.core.toggleFullscreen(),this.resetUserKeepVisible()}},{key:"onActiveContainerChanged",value:function(){this.fullScreenOnVideoTagSupported=null,this.bindEvents(),this.setInitialVolume(),this.changeTogglePlay(),this.bindContainerEvents(),this.settingsUpdate(),this.container&&this.container.trigger(ne.CONTAINER_PLAYBACKDVRSTATECHANGED,this.container.isDvrInUse()),this.container&&this.container.mediaControlDisabled&&this.disable(),this.trigger(ne.MEDIACONTROL_CONTAINERCHANGED)}},{key:"showVolumeBar",value:function(){this.hideVolumeId&&clearTimeout(this.hideVolumeId),this.$volumeBarContainer.removeClass("volume-bar-hide")}},{key:"hideVolumeBar",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:400;this.$volumeBarContainer&&(this.draggingVolumeBar?this.hideVolumeId=setTimeout((function(){return e.hideVolumeBar()}),t):(this.hideVolumeId&&clearTimeout(this.hideVolumeId),this.hideVolumeId=setTimeout((function(){return e.$volumeBarContainer.addClass("volume-bar-hide")}),t)))}},{key:"ended",value:function(){this.changeTogglePlay()}},{key:"updateProgressBar",value:function(e){var t=e.start/e.total*100,n=e.current/e.total*100;this.$seekBarLoaded.css({left:"".concat(t,"%"),width:"".concat(n-t,"%")})}},{key:"onTimeUpdate",value:function(e){if(!this.draggingSeekBar){var t=e.current<0?e.total:e.current;this.currentPositionValue=t,this.currentDurationValue=e.total,this.renderSeekBar()}}},{key:"renderSeekBar",value:function(){if(null!==this.currentPositionValue&&null!==this.currentDurationValue){this.currentSeekBarPercentage=100,this.container&&(this.container.getPlaybackType()!==he.LIVE||this.container.isDvrInUse())&&(this.currentSeekBarPercentage=this.currentPositionValue/this.currentDurationValue*100),this.setSeekPercentage(this.currentSeekBarPercentage);var e=Wt(this.currentPositionValue),t=Wt(this.currentDurationValue);e!==this.displayedPosition&&(this.$position.text(e),this.displayedPosition=e),t!==this.displayedDuration&&(this.$duration.text(t),this.displayedDuration=t)}}},{key:"seek",value:function(e){if(this.settings.seekEnabled){var t=(e.pageX-this.$seekBarContainer.offset().left)/this.$seekBarContainer.width()*100;return t=Math.min(100,Math.max(t,0)),this.container&&this.container.seekPercentage(t),this.setSeekPercentage(t),!1}}},{key:"setKeepVisible",value:function(){this.keepVisible=!0}},{key:"resetKeepVisible",value:function(){this.keepVisible=!1}},{key:"setUserKeepVisible",value:function(){this.userKeepVisible=!0}},{key:"resetUserKeepVisible",value:function(){this.userKeepVisible=!1}},{key:"isVisible",value:function(){return!this.$el.hasClass("media-control-hide")}},{key:"show",value:function(e){var t=this;if(!this.disabled){var n=e&&e.clientX!==this.lastMouseX&&e.clientY!==this.lastMouseY;(!e||n||navigator.userAgent.match(/firefox/i))&&(clearTimeout(this.hideId),this.$el.show(),this.trigger(ne.MEDIACONTROL_SHOW,this.name),this.container&&this.container.trigger(ne.CONTAINER_MEDIACONTROL_SHOW,this.name),this.$el.removeClass("media-control-hide"),this.hideId=setTimeout((function(){return t.hide()}),2e3),e&&(this.lastMouseX=e.clientX,this.lastMouseY=e.clientY));this.updateCursorStyle(!0)}}},{key:"hide",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.isVisible()){var n=t||2e3;if(clearTimeout(this.hideId),this.disabled||!1!==this.options.hideMediaControl){var i=this.userKeepVisible||this.keepVisible,r=this.draggingSeekBar||this.draggingVolumeBar;if(!this.disabled&&(t||i||r))this.hideId=setTimeout((function(){return e.hide()}),n);else{this.trigger(ne.MEDIACONTROL_HIDE,this.name),this.container&&this.container.trigger(ne.CONTAINER_MEDIACONTROL_HIDE,this.name),this.$el.addClass("media-control-hide"),this.hideVolumeBar(0);var a=!1;this.updateCursorStyle(a)}}}}},{key:"updateCursorStyle",value:function(e){e?this.core.$el.removeClass("nocursor"):this.core.isFullscreen()&&this.core.$el.addClass("nocursor")}},{key:"settingsUpdate",value:function(){var e=this.getSettings();!e||this.fullScreenOnVideoTagSupported||zt.fullscreenEnabled()||(e.default&&Xt(e.default,"fullscreen"),e.left&&Xt(e.left,"fullscreen"),e.right&&Xt(e.right,"fullscreen")),JSON.stringify(this.settings)!==JSON.stringify(e)&&(this.settings=e,this.render())}},{key:"getSettings",value:function(){return E.extend(!0,{},this.container&&this.container.settings)}},{key:"highDefinitionUpdate",value:function(e){this.isHD=e;var t=e?"addClass":"removeClass";this.$hdIndicator[t]("enabled")}},{key:"createCachedElements",value:function(){var e=this.$el.find(".media-control-layer");this.$duration=e.find(".media-control-indicator[data-duration]"),this.$fullscreenToggle=e.find("button.media-control-button[data-fullscreen]"),this.$playPauseToggle=e.find("button.media-control-button[data-playpause]"),this.$playStopToggle=e.find("button.media-control-button[data-playstop]"),this.$position=e.find(".media-control-indicator[data-position]"),this.$seekBarContainer=e.find(".bar-container[data-seekbar]"),this.$seekBarHover=e.find(".bar-hover[data-seekbar]"),this.$seekBarLoaded=e.find(".bar-fill-1[data-seekbar]"),this.$seekBarPosition=e.find(".bar-fill-2[data-seekbar]"),this.$seekBarScrubber=e.find(".bar-scrubber[data-seekbar]"),this.$volumeBarContainer=e.find(".bar-container[data-volume]"),this.$volumeContainer=e.find(".drawer-container[data-volume]"),this.$volumeIcon=e.find(".drawer-icon[data-volume]"),this.$volumeBarBackground=this.$el.find(".bar-background[data-volume]"),this.$volumeBarFill=this.$el.find(".bar-fill-1[data-volume]"),this.$volumeBarScrubber=this.$el.find(".bar-scrubber[data-volume]"),this.$hdIndicator=this.$el.find("button.media-control-button[data-hd-indicator]"),this.resetIndicators(),this.initializeIcons()}},{key:"resetIndicators",value:function(){this.displayedPosition=this.$position.text(),this.displayedDuration=this.$duration.text()}},{key:"initializeIcons",value:function(){var e=this.$el.find(".media-control-layer");e.find("button.media-control-button[data-play]").append(Et),e.find("button.media-control-button[data-pause]").append(Tt),e.find("button.media-control-button[data-stop]").append(Gt),this.$playPauseToggle.append(Et),this.$playStopToggle.append(Et),this.$volumeIcon.append(Yt),this.$fullscreenToggle.append(Ht),this.$hdIndicator.append('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill="#010101" d="M5.375 7.062H2.637V4.26H.502v7.488h2.135V8.9h2.738v2.848h2.133V4.26H5.375v2.802zm5.97-2.81h-2.84v7.496h2.798c2.65 0 4.195-1.607 4.195-3.77v-.022c0-2.162-1.523-3.704-4.154-3.704zm2.06 3.758c0 1.21-.81 1.896-2.03 1.896h-.83V6.093h.83c1.22 0 2.03.696 2.03 1.896v.02z"/>\n</svg>')}},{key:"setSeekPercentage",value:function(e){e=Math.max(Math.min(e,100),0),this.displayedSeekBarPercentage!==e&&(this.displayedSeekBarPercentage=e,this.$seekBarPosition.removeClass("media-control-notransition"),this.$seekBarScrubber.removeClass("media-control-notransition"),this.$seekBarPosition.css({width:"".concat(e,"%")}),this.$seekBarScrubber.css({left:"".concat(e,"%")}))}},{key:"seekRelative",value:function(e){if(this.settings.seekEnabled){var t=this.container.getCurrentTime(),n=this.container.getDuration(),i=Math.min(Math.max(t+e,0),n);i=Math.min(100*i/n,100),this.container.seekPercentage(i)}}},{key:"bindKeyAndShow",value:function(e,t){var n=this;this.kibo.down(e,(function(){return n.show(),t()}))}},{key:"bindKeyEvents",value:function(){var e=this;if(!_.isMobile&&!this.options.disableKeyboardShortcuts){this.unbindKeyEvents(),this.kibo=new Vt(this.options.focusElement||this.options.parentElement),this.bindKeyAndShow("space",(function(){return e.togglePlayPause()})),this.bindKeyAndShow("left",(function(){return e.seekRelative(-5)})),this.bindKeyAndShow("right",(function(){return e.seekRelative(5)})),this.bindKeyAndShow("shift left",(function(){return e.seekRelative(-10)})),this.bindKeyAndShow("shift right",(function(){return e.seekRelative(10)})),this.bindKeyAndShow("shift ctrl left",(function(){return e.seekRelative(-15)})),this.bindKeyAndShow("shift ctrl right",(function(){return e.seekRelative(15)}));["1","2","3","4","5","6","7","8","9","0"].forEach((function(t){e.bindKeyAndShow(t,(function(){e.settings.seekEnabled&&e.container&&e.container.seekPercentage(10*t)}))}))}}},{key:"unbindKeyEvents",value:function(){this.kibo&&(this.kibo.off("space"),this.kibo.off("left"),this.kibo.off("right"),this.kibo.off("shift left"),this.kibo.off("shift right"),this.kibo.off("shift ctrl left"),this.kibo.off("shift ctrl right"),this.kibo.off(["1","2","3","4","5","6","7","8","9","0"]))}},{key:"parseColors",value:function(){if(this.options.mediacontrol){this.buttonsColor=this.options.mediacontrol.buttons;var e=this.options.mediacontrol.seekbar;this.$el.find(".bar-fill-2[data-seekbar]").css("background-color",e),this.$el.find(".media-control-icon svg path").css("fill",this.buttonsColor),this.$el.find(".segmented-bar-element[data-volume]").css("boxShadow","inset 2px 0 0 "+this.buttonsColor)}}},{key:"applyButtonStyle",value:function(e){this.buttonsColor&&e&&E(e).find("svg path").css("fill",this.buttonsColor)}},{key:"destroy",value:function(){E(document).unbind("mouseup",this.stopDragHandler),E(document).unbind("mousemove",this.updateDragHandler),this.unbindKeyEvents(),this.stopListening(),pt(dt(t.prototype),"destroy",this).call(this)}},{key:"configure",value:function(e){this.options.chromeless||e.source||e.sources?this.disable():this.enable(),this.trigger(ne.MEDIACONTROL_OPTIONS_CHANGE)}},{key:"render",value:function(){var e=this,t=this.options.hideMediaControlDelay||2e3;this.settings&&this.$el.html(this.template({settings:this.settings})),this.createCachedElements(),this.$playPauseToggle.addClass("paused"),this.$playStopToggle.addClass("stopped"),this.changeTogglePlay(),this.container&&(this.hideId=setTimeout((function(){return e.hide()}),t),this.disabled&&this.hide()),_.isSafari&&_.isMobile&&(_.version<10?this.$volumeContainer.css("display","none"):this.$volumeBarContainer.css("display","none")),this.$seekBarPosition.addClass("media-control-notransition"),this.$seekBarScrubber.addClass("media-control-notransition");var n=0;return this.displayedSeekBarPercentage&&(n=this.displayedSeekBarPercentage),this.displayedSeekBarPercentage=null,this.setSeekPercentage(n),Bt((function(){!e.settings.seekEnabled&&e.$seekBarContainer.addClass("seek-disabled"),!_.isMobile&&!e.options.disableKeyboardShortcuts&&e.bindKeyEvents(),e.playerResize({width:e.options.width,height:e.options.height}),e.hideVolumeBar(0)})),this.parseColors(),this.highDefinitionUpdate(this.isHD),this.core.$el.append(this.el),this.rendered=!0,this.updateVolumeUI(),this.trigger(ne.MEDIACONTROL_RENDERED),this}}]),t}(ue);Zt.extend=function(e){return qt(Zt,e)};vt(".player-poster[data-poster] {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n height: 100%;\n width: 100%;\n z-index: 998;\n top: 0;\n left: 0;\n background-color: transparent;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: 50% 50%; }\n .player-poster[data-poster].clickable {\n cursor: pointer; }\n .player-poster[data-poster]:hover .play-wrapper[data-poster] {\n opacity: 1; }\n .player-poster[data-poster] .play-wrapper[data-poster] {\n width: 100%;\n height: 25%;\n margin: 0 auto;\n opacity: 0.75;\n transition: opacity 0.1s ease; }\n .player-poster[data-poster] .play-wrapper[data-poster] svg {\n height: 100%; }\n .player-poster[data-poster] .play-wrapper[data-poster] svg path {\n fill: #fff; }\n");var Qt=function(e){function t(e){var n;return st(this,t),(n=ft(this,dt(t).call(this,e))).hasStartedPlaying=!1,n.playRequested=!1,n.render(),Bt((function(){return n.update()})),n}return ct(t,e),ut(t,[{key:"name",get:function(){return"poster"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}},{key:"template",get:function(){return We('<div class="play-wrapper" data-poster></div>\n')}},{key:"shouldRender",get:function(){var e=!(!this.options.poster||!this.options.poster.showForNoOp);return"html_img"!==this.container.playback.name&&(this.container.playback.getPlaybackType()!==he.NO_OP||e)}},{key:"attributes",get:function(){return{class:"player-poster","data-poster":""}}},{key:"events",get:function(){return{click:"clicked"}}},{key:"showOnVideoEnd",get:function(){return!this.options.poster||this.options.poster.showOnVideoEnd||void 0===this.options.poster.showOnVideoEnd}}]),ut(t,[{key:"bindEvents",value:function(){this.listenTo(this.container,ne.CONTAINER_STOP,this.onStop),this.listenTo(this.container,ne.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,ne.CONTAINER_STATE_BUFFERING,this.update),this.listenTo(this.container,ne.CONTAINER_STATE_BUFFERFULL,this.update),this.listenTo(this.container,ne.CONTAINER_OPTIONS_CHANGE,this.render),this.listenTo(this.container,ne.CONTAINER_ERROR,this.onError),this.showOnVideoEnd&&this.listenTo(this.container,ne.CONTAINER_ENDED,this.onStop)}},{key:"onError",value:function(e){this.hasFatalError=e.level===se.Levels.FATAL,this.hasFatalError&&(this.hasStartedPlaying=!1,this.playRequested=!1,this.showPlayButton())}},{key:"onPlay",value:function(){this.hasStartedPlaying=!0,this.update()}},{key:"onStop",value:function(){this.hasStartedPlaying=!1,this.playRequested=!1,this.update()}},{key:"updatePlayButton",value:function(e){!e||this.options.chromeless&&!this.options.allowUserInteraction?this.hidePlayButton():this.showPlayButton()}},{key:"showPlayButton",value:function(){this.hasFatalError&&!this.options.disableErrorScreen||(this.$playButton.show(),this.$el.addClass("clickable"))}},{key:"hidePlayButton",value:function(){this.$playButton.hide(),this.$el.removeClass("clickable")}},{key:"clicked",value:function(){if(!this.hasStartedPlaying)return this.options.chromeless&&!this.options.allowUserInteraction||(this.playRequested=!0,this.update(),this.container.play()),!1}},{key:"shouldHideOnPlay",value:function(){return!this.container.playback.isAudioOnly}},{key:"update",value:function(){if(this.shouldRender){var e=!this.playRequested&&!this.hasStartedPlaying&&!this.container.buffering;this.updatePlayButton(e),this.updatePoster()}}},{key:"updatePoster",value:function(){this.hasStartedPlaying?this.hidePoster():this.showPoster()}},{key:"showPoster",value:function(){this.container.disableMediaControl(),this.$el.show()}},{key:"hidePoster",value:function(){this.container.enableMediaControl(),this.shouldHideOnPlay()&&this.$el.hide()}},{key:"render",value:function(){if(this.shouldRender){if(this.$el.html(this.template()),this.options.poster&&void 0===this.options.poster.custom){var e=this.options.poster.url||this.options.poster;this.$el.css({"background-image":"url("+e+")"})}else this.options.poster&&this.$el.css({background:this.options.poster.custom});this.container.$el.append(this.el),this.$playWrapper=this.$el.find(".play-wrapper"),this.$playWrapper.append(Et),this.$playButton=this.$playWrapper.find("svg"),this.$playButton.addClass("poster-icon"),this.$playButton.attr("data-poster","");var t=this.options.mediacontrol&&this.options.mediacontrol.buttons;return t&&this.$el.find("svg path").css("fill",t),this.options.mediacontrol&&this.options.mediacontrol.buttons&&(t=this.options.mediacontrol.buttons,this.$playButton.css("color",t)),this.update(),this}}}]),t}(Se);vt('.seek-time[data-seek-time] {\n position: absolute;\n white-space: nowrap;\n height: 20px;\n line-height: 20px;\n font-size: 0;\n left: -100%;\n bottom: 55px;\n background-color: rgba(2, 2, 2, 0.5);\n z-index: 9999;\n transition: opacity 0.1s ease; }\n .seek-time[data-seek-time].hidden[data-seek-time] {\n opacity: 0; }\n .seek-time[data-seek-time] [data-seek-time] {\n display: inline-block;\n color: white;\n font-size: 10px;\n padding-left: 7px;\n padding-right: 7px;\n vertical-align: top; }\n .seek-time[data-seek-time] [data-duration] {\n display: inline-block;\n color: rgba(255, 255, 255, 0.5);\n font-size: 10px;\n padding-right: 7px;\n vertical-align: top; }\n .seek-time[data-seek-time] [data-duration]:before {\n content: "|";\n margin-right: 7px; }\n');var Jt=H.formatTime,en=function(e){function t(e){var n;return st(this,t),(n=ft(this,dt(t).call(this,e))).hoveringOverSeekBar=!1,n.hoverPosition=null,n.duration=null,n.firstFragDateTime=null,n.actualLiveTime=!!n.mediaControl.options.actualLiveTime,n.actualLiveTime&&(n.mediaControl.options.actualLiveServerTime?n.actualLiveServerTimeDiff=(new Date).getTime()-new Date(n.mediaControl.options.actualLiveServerTime).getTime():n.actualLiveServerTimeDiff=0),n}return ct(t,e),ut(t,[{key:"name",get:function(){return"seek_time"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}},{key:"template",get:function(){return We("<span data-seek-time></span>\n<span data-duration></span>\n")}},{key:"attributes",get:function(){return{class:"seek-time","data-seek-time":""}}},{key:"mediaControl",get:function(){return this.core.mediaControl}},{key:"mediaControlContainer",get:function(){return this.mediaControl.container}},{key:"isLiveStreamWithDvr",get:function(){return this.mediaControlContainer&&this.mediaControlContainer.getPlaybackType()===he.LIVE&&this.mediaControlContainer.isDvrEnabled()}},{key:"durationShown",get:function(){return this.isLiveStreamWithDvr&&!this.actualLiveTime}},{key:"useActualLiveTime",get:function(){return this.actualLiveTime&&this.isLiveStreamWithDvr}}]),ut(t,[{key:"bindEvents",value:function(){this.listenTo(this.mediaControl,ne.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.mediaControl,ne.MEDIACONTROL_MOUSEMOVE_SEEKBAR,this.showTime),this.listenTo(this.mediaControl,ne.MEDIACONTROL_MOUSELEAVE_SEEKBAR,this.hideTime),this.listenTo(this.mediaControl,ne.MEDIACONTROL_CONTAINERCHANGED,this.onContainerChanged),this.mediaControlContainer&&(this.listenTo(this.mediaControlContainer,ne.CONTAINER_PLAYBACKDVRSTATECHANGED,this.update),this.listenTo(this.mediaControlContainer,ne.CONTAINER_TIMEUPDATE,this.updateDuration))}},{key:"onContainerChanged",value:function(){this.stopListening(),this.bindEvents()}},{key:"updateDuration",value:function(e){this.duration=e.total,this.firstFragDateTime=e.firstFragDateTime,this.update()}},{key:"showTime",value:function(e){this.hoveringOverSeekBar=!0,this.calculateHoverPosition(e),this.update()}},{key:"hideTime",value:function(){this.hoveringOverSeekBar=!1,this.update()}},{key:"calculateHoverPosition",value:function(e){var t=e.pageX-this.mediaControl.$seekBarContainer.offset().left;this.hoverPosition=Math.min(1,Math.max(t/this.mediaControl.$seekBarContainer.width(),0))}},{key:"getSeekTime",value:function(){var e,t,n,i;return this.useActualLiveTime?(this.firstFragDateTime?(i=new Date(this.firstFragDateTime),(n=new Date(this.firstFragDateTime)).setHours(0,0,0,0),t=(i.getTime()-n.getTime())/1e3+this.duration):(n=new Date((new Date).getTime()-this.actualLiveServerTimeDiff),t=((i=new Date(n))-n.setHours(0,0,0,0))/1e3),(e=t-this.duration+this.hoverPosition*this.duration)<0&&(e+=86400)):e=this.hoverPosition*this.duration,{seekTime:e,secondsSinceMidnight:t}}},{key:"update",value:function(){if(this.rendered)if(this.shouldBeVisible()){var e=this.getSeekTime(),t=Jt(e.seekTime,this.useActualLiveTime);if(t!==this.displayedSeekTime&&(this.$seekTimeEl.text(t),this.displayedSeekTime=t),this.durationShown){this.$durationEl.show();var n=Jt(this.actualLiveTime?e.secondsSinceMidnight:this.duration,this.actualLiveTime);n!==this.displayedDuration&&(this.$durationEl.text(n),this.displayedDuration=n)}else this.$durationEl.hide();this.$el.show();var i=this.mediaControl.$seekBarContainer.width(),r=this.$el.width(),a=this.hoverPosition*i;a-=r/2,a=Math.max(0,Math.min(a,i-r)),this.$el.css("left",a)}else this.$el.hide(),this.$el.css("left","-100%")}},{key:"shouldBeVisible",value:function(){return this.mediaControlContainer&&this.mediaControlContainer.settings.seekEnabled&&this.hoveringOverSeekBar&&null!==this.hoverPosition&&null!==this.duration}},{key:"render",value:function(){this.rendered=!0,this.displayedDuration=null,this.displayedSeekTime=null,this.$el.html(this.template()),this.$el.hide(),this.mediaControl.$el.append(this.el),this.$seekTimeEl=this.$el.find("[data-seek-time]"),this.$durationEl=this.$el.find("[data-duration]"),this.$durationEl.hide(),this.update()}}]),t}(ue);vt(".spinner-three-bounce[data-spinner] {\n position: absolute;\n margin: 0 auto;\n width: 70px;\n text-align: center;\n z-index: 999;\n left: 0;\n right: 0;\n margin-left: auto;\n margin-right: auto;\n /* center vertically */\n top: 50%;\n transform: translateY(-50%); }\n .spinner-three-bounce[data-spinner] > div {\n width: 18px;\n height: 18px;\n background-color: #FFFFFF;\n border-radius: 100%;\n display: inline-block;\n -webkit-animation: bouncedelay 1.4s infinite ease-in-out;\n animation: bouncedelay 1.4s infinite ease-in-out;\n /* Prevent first frame from flickering when animation starts */\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both; }\n .spinner-three-bounce[data-spinner] [data-bounce1] {\n -webkit-animation-delay: -0.32s;\n animation-delay: -0.32s; }\n .spinner-three-bounce[data-spinner] [data-bounce2] {\n -webkit-animation-delay: -0.16s;\n animation-delay: -0.16s; }\n\n@-webkit-keyframes bouncedelay {\n 0%, 80%, 100% {\n transform: scale(0); }\n 40% {\n transform: scale(1); } }\n\n@keyframes bouncedelay {\n 0%, 80%, 100% {\n transform: scale(0); }\n 40% {\n transform: scale(1); } }\n");var tn=function(e){function t(e){var n;return st(this,t),(n=ft(this,dt(t).call(this,e))).template=We("<div data-bounce1></div><div data-bounce2></div><div data-bounce3></div>\n"),n.showTimeout=null,n.listenTo(n.container,ne.CONTAINER_STATE_BUFFERING,n.onBuffering),n.listenTo(n.container,ne.CONTAINER_STATE_BUFFERFULL,n.onBufferFull),n.listenTo(n.container,ne.CONTAINER_STOP,n.onStop),n.listenTo(n.container,ne.CONTAINER_ENDED,n.onStop),n.listenTo(n.container,ne.CONTAINER_ERROR,n.onStop),n.render(),n}return ct(t,e),ut(t,[{key:"name",get:function(){return"spinner"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}},{key:"attributes",get:function(){return{"data-spinner":"",class:"spinner-three-bounce"}}}]),ut(t,[{key:"onBuffering",value:function(){this.show()}},{key:"onBufferFull",value:function(){this.hide()}},{key:"onStop",value:function(){this.hide()}},{key:"show",value:function(){var e=this;null===this.showTimeout&&(this.showTimeout=setTimeout((function(){return e.$el.show()}),300))}},{key:"hide",value:function(){null!==this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.$el.hide()}},{key:"render",value:function(){return this.$el.html(this.template()),this.container.$el.append(this.$el),this.$el.hide(),this.container.buffering&&this.onBuffering(),this}}]),t}(Se),nn=function(e){function t(e){var n;return st(this,t),(n=ft(this,dt(t).call(this,e))).setInitialAttrs(),n.reportInterval=n.options.reportInterval||5e3,n.state="IDLE",n}return ct(t,e),ut(t,[{key:"name",get:function(){return"stats"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}}]),ut(t,[{key:"bindEvents",value:function(){this.listenTo(this.container.playback,ne.PLAYBACK_PLAY,this.onPlay),this.listenTo(this.container,ne.CONTAINER_STOP,this.onStop),this.listenTo(this.container,ne.CONTAINER_ENDED,this.onStop),this.listenTo(this.container,ne.CONTAINER_DESTROYED,this.onStop),this.listenTo(this.container,ne.CONTAINER_STATE_BUFFERING,this.onBuffering),this.listenTo(this.container,ne.CONTAINER_STATE_BUFFERFULL,this.onBufferFull),this.listenTo(this.container,ne.CONTAINER_STATS_ADD,this.onStatsAdd),this.listenTo(this.container,ne.CONTAINER_BITRATE,this.onStatsAdd),this.listenTo(this.container.playback,ne.PLAYBACK_STATS_ADD,this.onStatsAdd)}},{key:"setInitialAttrs",value:function(){this.firstPlay=!0,this.startupTime=0,this.rebufferingTime=0,this.watchingTime=0,this.rebuffers=0,this.externalMetrics={}}},{key:"onPlay",value:function(){this.state="PLAYING",this.watchingTimeInit=Date.now(),this.intervalId||(this.intervalId=setInterval(this.report.bind(this),this.reportInterval))}},{key:"onStop",value:function(){clearInterval(this.intervalId),this.report(),this.intervalId=void 0,this.state="STOPPED"}},{key:"onBuffering",value:function(){this.firstPlay?this.startupTimeInit=Date.now():this.rebufferingTimeInit=Date.now(),this.state="BUFFERING",this.rebuffers++}},{key:"onBufferFull",value:function(){this.firstPlay&&this.startupTimeInit?(this.firstPlay=!1,this.startupTime=Date.now()-this.startupTimeInit,this.watchingTimeInit=Date.now()):this.rebufferingTimeInit&&(this.rebufferingTime+=this.getRebufferingTime()),this.rebufferingTimeInit=void 0,this.state="PLAYING"}},{key:"getRebufferingTime",value:function(){return Date.now()-this.rebufferingTimeInit}},{key:"getWatchingTime",value:function(){return Date.now()-this.watchingTimeInit-this.rebufferingTime}},{key:"isRebuffering",value:function(){return!!this.rebufferingTimeInit}},{key:"onStatsAdd",value:function(e){E.extend(this.externalMetrics,e)}},{key:"getStats",value:function(){var e={startupTime:this.startupTime,rebuffers:this.rebuffers,rebufferingTime:this.isRebuffering()?this.rebufferingTime+this.getRebufferingTime():this.rebufferingTime,watchingTime:this.isRebuffering()?this.getWatchingTime()-this.getRebufferingTime():this.getWatchingTime()};return E.extend(e,this.externalMetrics),e}},{key:"report",value:function(){this.container.statsReport(this.getStats())}}]),t}(ke);vt(".clappr-watermark[data-watermark] {\n position: absolute;\n min-width: 70px;\n max-width: 200px;\n width: 12%;\n text-align: center;\n z-index: 10; }\n\n.clappr-watermark[data-watermark] a {\n outline: none;\n cursor: pointer; }\n\n.clappr-watermark[data-watermark] img {\n max-width: 100%; }\n\n.clappr-watermark[data-watermark-bottom-left] {\n bottom: 10px;\n left: 10px; }\n\n.clappr-watermark[data-watermark-bottom-right] {\n bottom: 10px;\n right: 42px; }\n\n.clappr-watermark[data-watermark-top-left] {\n top: 10px;\n left: 10px; }\n\n.clappr-watermark[data-watermark-top-right] {\n top: 10px;\n right: 37px; }\n");for(var rn={ClickToPause:gt,ClosedCaptions:mt,DVRControls:yt,EndVideo:At,ErrorScreen:bt,Favicon:_t,GoogleAnalytics:St,MediaControl:Zt,Poster:Qt,SeekTime:en,SpinnerThreeBounce:tn,Stats:nn,WaterMark:function(e){function t(e){var n;return st(this,t),(n=ft(this,dt(t).call(this,e))).configure(),n}return ct(t,e),ut(t,[{key:"name",get:function(){return"watermark"}},{key:"supportedVersion",get:function(){return{min:"0.4.9"}}},{key:"template",get:function(){return We('<div class="clappr-watermark" data-watermark data-watermark-<%=position %>>\n<% if(typeof imageLink !== \'undefined\') { %>\n<a target="_blank" href="<%= imageLink %>">\n<% } %>\n<img src="<%= imageUrl %>">\n<% if(typeof imageLink !== \'undefined\') { %>\n</a>\n<% } %>\n</div>\n')}}]),ut(t,[{key:"bindEvents",value:function(){this.listenTo(this.container,ne.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,ne.CONTAINER_STOP,this.onStop),this.listenTo(this.container,ne.CONTAINER_OPTIONS_CHANGE,this.configure)}},{key:"configure",value:function(){this.position=this.options.position||"bottom-right",this.options.watermark?(this.imageUrl=this.options.watermark,this.imageLink=this.options.watermarkLink,this.render()):this.$el.remove()}},{key:"onPlay",value:function(){this.hidden||this.$el.show()}},{key:"onStop",value:function(){this.$el.hide()}},{key:"render",value:function(){this.$el.hide();var e={position:this.position,imageUrl:this.imageUrl,imageLink:this.imageLink};return this.$el.html(this.template(e)),this.container.$el.append(this.$el),this}}]),t}(Se)},an=0,on=Object.values(rn);an<on.length;an++){var sn=on[an];be.registerPlugin(sn)}var ln=n({},ot,{ClickToPause:rn.ClickToPause,ClosedCaptions:rn.ClosedCaptions,DVRControls:rn.DVRControls,EndVideo:rn.EndVideo,ErrorScreen:rn.ErrorScreen,Favicon:rn.Favicon,GoogleAnalytics:rn.GoogleAnalytics,MediaControl:rn.MediaControl,Poster:rn.Poster,SeekTime:rn.SeekTime,SpinnerThreeBounce:rn.SpinnerThreeBounce,Stats:rn.Stats,WaterMark:rn.WaterMark,Vendor:Kt,Plugins:rn,version:"0.4.0"});function un(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cn(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function dn(e,t,n){return t&&cn(e.prototype,t),n&&cn(e,n),e}function hn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function pn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(n),!0).forEach((function(t){hn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gn(e){return(gn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function vn(e,t){return(vn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function mn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function yn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=gn(e);if(t){var r=gn(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return mn(this,n)}}function An(e,t,n){return(An="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=gn(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function bn(e){return function(e){if(Array.isArray(e))return En(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return En(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return En(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function En(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Tn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kn=Tn(function(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}((function(e,t){var n;"undefined"!=typeof window&&(n=function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/eventemitter3/index.js ***!
|
||
\*********************************************/
|
||
/*! no static exports found */
|
||
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){var i=Object.prototype.hasOwnProperty,r="~";function a(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,i,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,i||e,a),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function u(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(r=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},u.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=new Array(a);i<a;i++)o[i]=n[i].fn;return o},u.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var l,u,c=this._events[s],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var h,f=c.length;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,n);break;case 4:c[u].fn.call(c[u].context,t,n,i);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c[u].fn.apply(c[u].context,l)}}return!0},u.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},u.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},u.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return l(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||i&&!o.once||n&&o.context!==n||l(this,a);else{for(var s=0,u=[],c=o.length;s<c;s++)(o[s].fn!==t||i&&!o[s].once||n&&o[s].context!==n)&&u.push(o[s]);u.length?this._events[a]=1===u.length?u[0]:u:l(this,a)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&l(this,t)):(this._events=new a,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=r,u.EventEmitter=u,e.exports=u},"./node_modules/url-toolkit/src/url-toolkit.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/url-toolkit/src/url-toolkit.js ***!
|
||
\*****************************************************/
|
||
/*! no static exports found */
|
||
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){var i,r,a,o,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,r=/^([^\/?#]*)(.*)$/,a=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=s.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=s.normalizePath(i.path),s.buildURLFromParts(i)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return n.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=r.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;u.path=s.normalizePath(d)}else u.path=o.path,a.params||(u.params=o.params,a.query||(u.query=o.query));return null===u.path&&(u.path=n.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(u)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(a,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s},"./node_modules/webworkify-webpack/index.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/webworkify-webpack/index.js ***!
|
||
\**************************************************/
|
||
/*! no static exports found */
|
||
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){function i(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n.oe=function(e){throw console.error(e),e};var i=n(n.s=ENTRY_MODULE);return i.default||i}var r="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function a(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function o(e,t,i){var o={};o[i]=[];var s=t.toString(),l=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return o;for(var u,c=l[1],d=new RegExp("(\\\\n|\\W)"+a(c)+r,"g");u=d.exec(s);)"dll-reference"!==u[3]&&o[i].push(u[3]);for(d=new RegExp("\\("+a(c)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)'+r,"g");u=d.exec(s);)e[u[2]]||(o[i].push(u[1]),e[u[2]]=n(u[1]).m),o[u[2]]=o[u[2]]||[],o[u[2]].push(u[4]);for(var h,f=Object.keys(o),p=0;p<f.length;p++)for(var g=0;g<o[f[p]].length;g++)h=o[f[p]][g],isNaN(1*h)||(o[f[p]][g]=1*o[f[p]][g]);return o}function s(e){return Object.keys(e).reduce((function(t,n){return t||e[n].length>0}),!1)}e.exports=function(e,t){t=t||{};var r={main:n.m},a=t.all?{main:Object.keys(r.main)}:function(e,t){for(var n={main:[t]},i={main:[]},r={main:{}};s(n);)for(var a=Object.keys(n),l=0;l<a.length;l++){var u=a[l],c=n[u].pop();if(r[u]=r[u]||{},!r[u][c]&&e[u][c]){r[u][c]=!0,i[u]=i[u]||[],i[u].push(c);for(var d=o(e,e[u][c],u),h=Object.keys(d),f=0;f<h.length;f++)n[h[f]]=n[h[f]]||[],n[h[f]]=n[h[f]].concat(d[h[f]])}}return i}(r,e),l="";Object.keys(a).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;a[e][t];)t++;a[e].push(t),r[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",l=l+"var "+e+" = ("+i.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+a[e].map((function(t){return JSON.stringify(t)+": "+r[e][t].toString()})).join(",")+"});\n"})),l=l+"new (("+i.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+a.main.map((function(e){return JSON.stringify(e)+": "+r.main[e].toString()})).join(",")+"}))(self);";var u=new window.Blob([l],{type:"text/javascript"});if(t.bare)return u;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),d=new window.Worker(c);return d.objectURL=c,d}},"./src/crypt/decrypter.js":
|
||
/*!********************************************!*\
|
||
!*** ./src/crypt/decrypter.js + 3 modules ***!
|
||
\********************************************/
|
||
/*! exports provided: default */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/hls.ts */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/hls.ts */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/hls.ts */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/hls.ts */function(e,t,n){n.r(t);var i=function(){function e(e,t){this.subtle=e,this.aesIV=t}return e.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)},e}(),r=function(){function e(e,t){this.subtle=e,this.key=t}return e.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},e}(),a=function(){function e(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),n=new Uint32Array(4),i=0;i<4;i++)n[i]=t.getUint32(4*i);return n},t.initTable=function(){var e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],r=n[1],a=n[2],o=n[3],s=this.invSubMix,l=s[0],u=s[1],c=s[2],d=s[3],h=new Uint32Array(256),f=0,p=0,g=0;for(g=0;g<256;g++)h[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,e[f]=v,t[v]=f;var m=h[f],y=h[m],A=h[y],b=257*h[v]^16843008*v;i[f]=b<<24|b>>>8,r[f]=b<<16|b>>>16,a[f]=b<<8|b>>>24,o[f]=b,b=16843009*A^65537*y^257*m^16843008*f,l[v]=b<<24|b>>>8,u[v]=b<<16|b>>>16,c[v]=b<<8|b>>>24,d[v]=b,f?(f=m^h[h[h[A^m]]],p^=h[h[p]]):f=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),n=!0,i=0;i<t.length&&n;)n=t[i]===this.key[i],i++;if(!n){this.key=t;var r=this.keySize=t.length;if(4!==r&&6!==r&&8!==r)throw new Error("Invalid aes key size="+r);var a,o,s,l,u=this.ksRows=4*(r+6+1),c=this.keySchedule=new Uint32Array(u),d=this.invKeySchedule=new Uint32Array(u),h=this.sBox,f=this.rcon,p=this.invSubMix,g=p[0],v=p[1],m=p[2],y=p[3];for(a=0;a<u;a++)a<r?s=c[a]=t[a]:(l=s,a%r==0?(l=h[(l=l<<8|l>>>24)>>>24]<<24|h[l>>>16&255]<<16|h[l>>>8&255]<<8|h[255&l],l^=f[a/r|0]<<24):r>6&&a%r==4&&(l=h[l>>>24]<<24|h[l>>>16&255]<<16|h[l>>>8&255]<<8|h[255&l]),c[a]=s=(c[a-r]^l)>>>0);for(o=0;o<u;o++)a=u-o,l=3&o?c[a]:c[a-4],d[o]=o<4||a<=4?l:g[h[l>>>24]]^v[h[l>>>16&255]]^m[h[l>>>8&255]]^y[h[255&l]],d[o]=d[o]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,n,i){for(var r,a,o,s,l,u,c,d,h,f,p,g,v,m,y,A,b,E=this.keySize+6,T=this.invKeySchedule,k=this.invSBox,_=this.invSubMix,S=_[0],C=_[1],w=_[2],R=_[3],O=this.uint8ArrayToUint32Array_(n),L=O[0],D=O[1],I=O[2],P=O[3],x=new Int32Array(e),N=new Int32Array(x.length),M=this.networkToHostOrderSwap;t<x.length;){for(h=M(x[t]),f=M(x[t+1]),p=M(x[t+2]),g=M(x[t+3]),l=h^T[0],u=g^T[1],c=p^T[2],d=f^T[3],v=4,m=1;m<E;m++)r=S[l>>>24]^C[u>>16&255]^w[c>>8&255]^R[255&d]^T[v],a=S[u>>>24]^C[c>>16&255]^w[d>>8&255]^R[255&l]^T[v+1],o=S[c>>>24]^C[d>>16&255]^w[l>>8&255]^R[255&u]^T[v+2],s=S[d>>>24]^C[l>>16&255]^w[u>>8&255]^R[255&c]^T[v+3],l=r,u=a,c=o,d=s,v+=4;r=k[l>>>24]<<24^k[u>>16&255]<<16^k[c>>8&255]<<8^k[255&d]^T[v],a=k[u>>>24]<<24^k[c>>16&255]<<16^k[d>>8&255]<<8^k[255&l]^T[v+1],o=k[c>>>24]<<24^k[d>>16&255]<<16^k[l>>8&255]<<8^k[255&u]^T[v+2],s=k[d>>>24]<<24^k[l>>16&255]<<16^k[u>>8&255]<<8^k[255&c]^T[v+3],v+=3,N[t]=M(r^L),N[t+1]=M(s^D),N[t+2]=M(o^I),N[t+3]=M(a^P),L=h,D=f,I=p,P=g,t+=4}return i?(y=N.buffer,A=y.byteLength,(b=A&&new DataView(y).getUint8(A-1))?y.slice(0,A-b):y):N.buffer},t.destroy=function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0},e}(),o=n("./src/errors.ts"),s=n("./src/utils/logger.js"),l=n("./src/events.js"),u=n("./src/utils/get-self-scope.js"),c=Object(u.getSelfScope)(),d=function(){function e(e,t,n){var i=(void 0===n?{}:n).removePKCS7Padding,r=void 0===i||i;if(this.logEnabled=!0,this.observer=e,this.config=t,this.removePKCS7Padding=r,r)try{var a=c.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(e){}this.disableWebCrypto=!this.subtle}var t=e.prototype;return t.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},t.decrypt=function(e,t,n,o){var l=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(s.logger.log("JS AES decrypt"),this.logEnabled=!1);var u=this.decryptor;u||(this.decryptor=u=new a),u.expandKey(t),o(u.decrypt(e,0,n,this.removePKCS7Padding))}else{this.logEnabled&&(s.logger.log("WebCrypto AES decrypt"),this.logEnabled=!1);var c=this.subtle;this.key!==t&&(this.key=t,this.fastAesKey=new r(c,t)),this.fastAesKey.expandKey().then((function(r){new i(c,n).decrypt(e,r).catch((function(i){l.onWebCryptoError(i,e,t,n,o)})).then((function(e){o(e)}))})).catch((function(i){l.onWebCryptoError(i,e,t,n,o)}))}},t.onWebCryptoError=function(e,t,n,i,r){this.config.enableSoftwareAES?(s.logger.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(t,n,i,r)):(s.logger.error("decrypting error : "+e.message),this.observer.trigger(l.default.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:e.message}))},t.destroy=function(){var e=this.decryptor;e&&(e.destroy(),this.decryptor=void 0)},e}();t.default=d},"./src/demux/demuxer-inline.js":
|
||
/*!**************************************************!*\
|
||
!*** ./src/demux/demuxer-inline.js + 12 modules ***!
|
||
\**************************************************/
|
||
/*! exports provided: default */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/hls.ts */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/hls.ts */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/hls.ts */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/hls.ts */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/hls.ts */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number-isFinite.js because of ./src/hls.ts */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/hls.ts */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/hls.ts */function(e,t,n){n.r(t);var i=n("./src/events.js"),r=n("./src/errors.ts"),a=n("./src/crypt/decrypter.js"),o=n("./src/polyfills/number-isFinite.js"),s=n("./src/utils/logger.js"),l=n("./src/utils/get-self-scope.js");function u(e,t){return 255===e[t]&&240==(246&e[t+1])}function c(e,t){return 1&e[t+1]?7:9}function d(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function h(e,t){return!!(t+1<e.length&&u(e,t))}function f(e,t){if(h(e,t)){var n=c(e,t);t+5<e.length&&(n=d(e,t));var i=t+n;if(i===e.length||i+1<e.length&&u(e,i))return!0}return!1}function p(e,t,n,a,o){if(!e.samplerate){var l=function(e,t,n,a){var o,l,u,c,d,h=navigator.userAgent.toLowerCase(),f=a,p=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];if(o=1+((192&t[n+2])>>>6),!((l=(60&t[n+2])>>>2)>p.length-1))return c=(1&t[n+2])<<2,c|=(192&t[n+3])>>>6,s.logger.log("manifest codec:"+a+",ADTS data:type:"+o+",sampleingIndex:"+l+"["+p[l]+"Hz],channelConfig:"+c),/firefox/i.test(h)?l>=6?(o=5,d=new Array(4),u=l-3):(o=2,d=new Array(2),u=l):-1!==h.indexOf("android")?(o=2,d=new Array(2),u=l):(o=5,d=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&l>=6?u=l-3:((a&&-1!==a.indexOf("mp4a.40.2")&&(l>=6&&1===c||/vivaldi/i.test(h))||!a&&1===c)&&(o=2,d=new Array(2)),u=l)),d[0]=o<<3,d[0]|=(14&l)>>1,d[1]|=(1&l)<<7,d[1]|=c<<3,5===o&&(d[1]|=(14&u)>>1,d[2]=(1&u)<<7,d[2]|=8,d[3]=0),{config:d,samplerate:p[l],channelCount:c,codec:"mp4a.40."+o,manifestCodec:f};e.trigger(i.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+l})}(t,n,a,o);e.config=l.config,e.samplerate=l.samplerate,e.channelCount=l.channelCount,e.codec=l.codec,e.manifestCodec=l.manifestCodec,s.logger.log("parsed codec:"+e.codec+",rate:"+l.samplerate+",nb channel:"+l.channelCount)}}function g(e){return 9216e4/e}function v(e,t,n,i,r){var a=function(e,t,n,i,r){var a,o,s=e.length;if(a=c(e,t),o=d(e,t),(o-=a)>0&&t+a+o<=s)return{headerLength:a,frameLength:o,stamp:n+i*r}}(t,n,i,r,g(e.samplerate));if(a){var o=a.stamp,s=a.headerLength,l=a.frameLength,u={unit:t.subarray(n+s,n+s+l),pts:o,dts:o};return e.samples.push(u),{sample:u,length:l+s}}}var m=n("./src/demux/id3.js"),y=function(){function e(e,t,n){this.observer=e,this.config=n,this.remuxer=t}var t=e.prototype;return t.resetInitSegment=function(e,t,n,i){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}},t.resetTimeStamp=function(){},e.probe=function(e){if(!e)return!1;for(var t=(m.default.getID3Data(e,0)||[]).length,n=e.length;t<n;t++)if(f(e,t))return s.logger.log("ADTS sync word found !"),!0;return!1},t.append=function(e,t,n,i){for(var r=this._audioTrack,a=m.default.getID3Data(e,0)||[],l=m.default.getTimeStamp(a),u=Object(o.isFiniteNumber)(l)?90*l:9e4*t,c=0,d=u,f=e.length,g=a.length,y=[{pts:d,dts:d,data:a}];g<f-1;)if(h(e,g)&&g+5<f){p(r,this.observer,e,g,r.manifestCodec);var A=v(r,e,g,u,c);if(!A){s.logger.log("Unable to parse AAC frame");break}g+=A.length,d=A.sample.pts,c++}else m.default.isHeader(e,g)?(a=m.default.getID3Data(e,g),y.push({pts:d,dts:d,data:a}),g+=a.length):g++;this.remuxer.remux(r,{samples:[]},{samples:y,inputTimeScale:9e4},{samples:[]},t,n,i)},t.destroy=function(){},e}(),A=n("./src/demux/mp4demuxer.js"),b={BitratesMap:[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],SamplesCoefficients:[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],BytesInSlot:[0,1,1,4],appendFrame:function(e,t,n,i,r){if(!(n+24>t.length)){var a=this.parseHeader(t,n);if(a&&n+a.frameLength<=t.length){var o=i+r*(9e4*a.samplesPerFrame/a.sampleRate),s={unit:t.subarray(n,n+a.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(s),{sample:s,length:a.frameLength}}}},parseHeader:function(e,t){var n=e[t+1]>>3&3,i=e[t+1]>>1&3,r=e[t+2]>>4&15,a=e[t+2]>>2&3,o=e[t+2]>>1&1;if(1!==n&&0!==r&&15!==r&&3!==a){var s=3===n?3-i:3===i?3:4,l=1e3*b.BitratesMap[14*s+r-1],u=3===n?0:2===n?1:2,c=b.SamplingRateMap[3*u+a],d=e[t+3]>>6==3?1:2,h=b.SamplesCoefficients[n][i],f=b.BytesInSlot[i],p=8*h*f;return{sampleRate:c,channelCount:d,frameLength:parseInt(h*l/c+o,10)*f,samplesPerFrame:p}}},isHeaderPattern:function(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])},isHeader:function(e,t){return!!(t+1<e.length&&this.isHeaderPattern(e,t))},probe:function(e,t){if(t+1<e.length&&this.isHeaderPattern(e,t)){var n=this.parseHeader(e,t),i=4;n&&n.frameLength&&(i=n.frameLength);var r=t+i;if(r===e.length||r+1<e.length&&this.isHeaderPattern(e,r))return!0}return!1}},E=b,T=function(){function e(e){this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,n=e.byteLength-t,i=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");i.set(e.subarray(n,n+r)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r},t.skipBits=function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),n=this.word>>>32-t;return e>32&&s.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),(t=e-t)>0&&this.bitsAvailable?n<<t|this.readBits(t):n},t.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){var t,n=8,i=8;for(t=0;t<e;t++)0!==i&&(i=(n+this.readEG()+256)%256),n=0===i?n:i},t.readSPS=function(){var e,t,n,i,r,a,o,s=0,l=0,u=0,c=0,d=this.readUByte.bind(this),h=this.readBits.bind(this),f=this.readUEG.bind(this),p=this.readBoolean.bind(this),g=this.skipBits.bind(this),v=this.skipEG.bind(this),m=this.skipUEG.bind(this),y=this.skipScalingList.bind(this);if(d(),e=d(),h(5),g(3),d(),m(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var A=f();if(3===A&&g(1),m(),m(),g(1),p())for(a=3!==A?8:12,o=0;o<a;o++)p()&&y(o<6?16:64)}m();var b=f();if(0===b)f();else if(1===b)for(g(1),v(),v(),t=f(),o=0;o<t;o++)v();m(),g(1),n=f(),i=f(),0===(r=h(1))&&g(1),g(1),p()&&(s=f(),l=f(),u=f(),c=f());var E=[1,1];if(p()&&p())switch(d()){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:E=[d()<<8|d(),d()<<8|d()]}return{width:Math.ceil(16*(n+1)-2*s-2*l),height:(2-r)*(i+1)*16-(r?2:4)*(u+c),pixelRatio:E}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}(),k=function(){function e(e,t,n,i){this.decryptdata=n,this.discardEPB=i,this.decrypter=new a.default(e,t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e,t){this.decrypter.decrypt(e,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,t)},t.decryptAacSample=function(e,t,n,i){var r=e[t].unit,a=r.subarray(16,r.length-r.length%16),o=a.buffer.slice(a.byteOffset,a.byteOffset+a.length),s=this;this.decryptBuffer(o,(function(a){a=new Uint8Array(a),r.set(a,16),i||s.decryptAacSamples(e,t+1,n)}))},t.decryptAacSamples=function(e,t,n){for(;;t++){if(t>=e.length)return void n();if(!(e[t].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(e,t,n,i),!i)return}}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,n=new Int8Array(t),i=0,r=32;r<=e.length-16;r+=160,i+=16)n.set(e.subarray(r,r+16),i);return n},t.getAvcDecryptedUnit=function(e,t){t=new Uint8Array(t);for(var n=0,i=32;i<=e.length-16;i+=160,n+=16)e.set(t.subarray(n,n+16),i);return e},t.decryptAvcSample=function(e,t,n,i,r,a){var o=this.discardEPB(r.data),s=this.getAvcEncryptedData(o),l=this;this.decryptBuffer(s.buffer,(function(s){r.data=l.getAvcDecryptedUnit(o,s),a||l.decryptAvcSamples(e,t,n+1,i)}))},t.decryptAvcSamples=function(e,t,n,i){for(;;t++,n=0){if(t>=e.length)return void i();for(var r=e[t].units;!(n>=r.length);n++){var a=r[n];if(!(a.length<=48||1!==a.type&&5!==a.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(e,t,n,i,a,o),!o)return}}}},e}(),_={video:1,audio:2,id3:3,text:4},S=function(){function e(e,t,n,i){this.observer=e,this.config=n,this.typeSupported=i,this.remuxer=t,this.sampleAes=null}var t=e.prototype;return t.setDecryptData=function(e){null!=e&&null!=e.key&&"SAMPLE-AES"===e.method?this.sampleAes=new k(this.observer,this.config,e,this.discardEPB):this.sampleAes=null},e.probe=function(t){var n=e._syncOffset(t);return!(n<0||(n&&s.logger.warn("MPEG2-TS detected but first sync word found @ offset "+n+", junk ahead ?"),0))},e._syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),n=0;n<t;){if(71===e[n]&&71===e[n+188]&&71===e[n+376])return n;n++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:_[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:"video"===e?0:void 0,isAAC:"audio"===e||void 0,duration:"audio"===e?t:void 0}},t.resetInitSegment=function(t,n,i,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=e.createTrack("video",r),this._audioTrack=e.createTrack("audio",r),this._id3Track=e.createTrack("id3",r),this._txtTrack=e.createTrack("text",r),this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=n,this.videoCodec=i,this._duration=r},t.resetTimeStamp=function(){},t.append=function(t,n,a,o){var l,u,c,d,h,f=t.length,p=!1;this.contiguous=a;var g=this.pmtParsed,v=this._avcTrack,m=this._audioTrack,y=this._id3Track,A=v.pid,b=m.pid,E=y.pid,T=this._pmtId,k=v.pesData,_=m.pesData,S=y.pesData,C=this._parsePAT,w=this._parsePMT,R=this._parsePES,O=this._parseAVCPES.bind(this),L=this._parseAACPES.bind(this),D=this._parseMPEGPES.bind(this),I=this._parseID3PES.bind(this),P=e._syncOffset(t);for(f-=(f+P)%188,l=P;l<f;l+=188)if(71===t[l]){if(u=!!(64&t[l+1]),c=((31&t[l+1])<<8)+t[l+2],(48&t[l+3])>>4>1){if((d=l+5+t[l+4])===l+188)continue}else d=l+4;switch(c){case A:u&&(k&&(h=R(k))&&O(h,!1),k={data:[],size:0}),k&&(k.data.push(t.subarray(d,l+188)),k.size+=l+188-d);break;case b:u&&(_&&(h=R(_))&&(m.isAAC?L(h):D(h)),_={data:[],size:0}),_&&(_.data.push(t.subarray(d,l+188)),_.size+=l+188-d);break;case E:u&&(S&&(h=R(S))&&I(h),S={data:[],size:0}),S&&(S.data.push(t.subarray(d,l+188)),S.size+=l+188-d);break;case 0:u&&(d+=t[d]+1),T=this._pmtId=C(t,d);break;case T:u&&(d+=t[d]+1);var x=w(t,d,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);(A=x.avc)>0&&(v.pid=A),(b=x.audio)>0&&(m.pid=b,m.isAAC=x.isAAC),(E=x.id3)>0&&(y.pid=E),p&&!g&&(s.logger.log("reparse from beginning"),p=!1,l=P-188),g=this.pmtParsed=!0;break;case 17:case 8191:break;default:p=!0}}else this.observer.trigger(i.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});k&&(h=R(k))?(O(h,!0),v.pesData=null):v.pesData=k,_&&(h=R(_))?(m.isAAC?L(h):D(h),m.pesData=null):(_&&_.size&&s.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=_),S&&(h=R(S))?(I(h),y.pesData=null):y.pesData=S,null==this.sampleAes?this.remuxer.remux(m,v,y,this._txtTrack,n,a,o):this.decryptAndRemux(m,v,y,this._txtTrack,n,a,o)},t.decryptAndRemux=function(e,t,n,i,r,a,o){if(e.samples&&e.isAAC){var s=this;this.sampleAes.decryptAacSamples(e.samples,0,(function(){s.decryptAndRemuxAvc(e,t,n,i,r,a,o)}))}else this.decryptAndRemuxAvc(e,t,n,i,r,a,o)},t.decryptAndRemuxAvc=function(e,t,n,i,r,a,o){if(t.samples){var s=this;this.sampleAes.decryptAvcSamples(t.samples,0,0,(function(){s.remuxer.remux(e,t,n,i,r,a,o)}))}else this.remuxer.remux(e,t,n,i,r,a,o)},t.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},t._parsePAT=function(e,t){return(31&e[t+10])<<8|e[t+11]},t._parsePMT=function(e,t,n,i){var r,a,o={audio:-1,avc:-1,id3:-1,isAAC:!0};for(r=t+3+((15&e[t+1])<<8|e[t+2])-4,t+=12+((15&e[t+10])<<8|e[t+11]);t<r;){switch(a=(31&e[t+1])<<8|e[t+2],e[t]){case 207:if(!i){s.logger.log("unknown stream type:"+e[t]);break}case 15:-1===o.audio&&(o.audio=a);break;case 21:-1===o.id3&&(o.id3=a);break;case 219:if(!i){s.logger.log("unknown stream type:"+e[t]);break}case 27:-1===o.avc&&(o.avc=a);break;case 3:case 4:n?-1===o.audio&&(o.audio=a,o.isAAC=!1):s.logger.log("MPEG audio found, not supported in this browser for now");break;case 36:s.logger.warn("HEVC stream type found, not supported for now");break;default:s.logger.log("unknown stream type:"+e[t])}t+=5+((15&e[t+3])<<8|e[t+4])}return o},t._parsePES=function(e){var t,n,i,r,a,o,l,u,c=0,d=e.data;if(!e||0===e.size)return null;for(;d[0].length<19&&d.length>1;){var h=new Uint8Array(d[0].length+d[1].length);h.set(d[0]),h.set(d[1],d[0].length),d[0]=h,d.splice(1,1)}if(1===((t=d[0])[0]<<16)+(t[1]<<8)+t[2]){if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;if(192&(n=t[7])&&((o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2)>4294967295&&(o-=8589934592),64&n?((l=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>4294967295&&(l-=8589934592),o-l>54e5&&(s.logger.warn(Math.round((o-l)/9e4)+"s delta between PTS and DTS, align them"),o=l)):l=o),u=(r=t[8])+9,e.size<=u)return null;e.size-=u,a=new Uint8Array(e.size);for(var f=0,p=d.length;f<p;f++){var g=(t=d[f]).byteLength;if(u){if(u>g){u-=g;continue}t=t.subarray(u),g-=u,u=0}a.set(t,c),c+=g}return i&&(i-=r+3),{data:a,pts:o,dts:l,len:i}}return null},t.pushAccesUnit=function(e,t){if(e.units.length&&e.frame){var n=t.samples,i=n.length;if(isNaN(e.pts)){if(!i)return void t.dropped++;var r=n[i-1];e.pts=r.pts,e.dts=r.dts}!this.config.forceKeyFrameOnDiscontinuity||!0===e.key||t.sps&&(i||this.contiguous)?(e.id=i,n.push(e)):t.dropped++}e.debug.length&&s.logger.log(e.pts+"/"+e.dts+":"+e.debug)},t._parseAVCPES=function(e,t){var n,i,r,a=this,o=this._avcTrack,s=this._parseAVCNALu(e.data),l=this.avcSample,u=!1,c=this.pushAccesUnit.bind(this),d=function(e,t,n,i){return{key:e,pts:t,dts:n,units:[],debug:i}};e.data=null,l&&s.length&&!o.audFound&&(c(l,o),l=this.avcSample=d(!1,e.pts,e.dts,"")),s.forEach((function(t){switch(t.type){case 1:i=!0,l||(l=a.avcSample=d(!0,e.pts,e.dts,"")),l.frame=!0;var s=t.data;if(u&&s.length>4){var h=new T(s).readSliceType();2!==h&&4!==h&&7!==h&&9!==h||(l.key=!0)}break;case 5:i=!0,l||(l=a.avcSample=d(!0,e.pts,e.dts,"")),l.key=!0,l.frame=!0;break;case 6:i=!0,(n=new T(a.discardEPB(t.data))).readUByte();for(var f=0,p=0,g=!1,v=0;!g&&n.bytesAvailable>1;){f=0;do{f+=v=n.readUByte()}while(255===v);p=0;do{p+=v=n.readUByte()}while(255===v);if(4===f&&0!==n.bytesAvailable){if(g=!0,181===n.readUByte()&&49===n.readUShort()&&1195456820===n.readUInt()&&3===n.readUByte()){var y=n.readUByte(),A=31&y,b=[y,n.readUByte()];for(r=0;r<A;r++)b.push(n.readUByte()),b.push(n.readUByte()),b.push(n.readUByte());a._insertSampleInOrder(a._txtTrack.samples,{type:3,pts:e.pts,bytes:b})}}else if(5===f&&0!==n.bytesAvailable){if(g=!0,p>16){var E=[];for(r=0;r<16;r++)E.push(n.readUByte().toString(16)),3!==r&&5!==r&&7!==r&&9!==r||E.push("-");var k=p-16,_=new Uint8Array(k);for(r=0;r<k;r++)_[r]=n.readUByte();a._insertSampleInOrder(a._txtTrack.samples,{pts:e.pts,payloadType:f,uuid:E.join(""),userDataBytes:_,userData:Object(m.utf8ArrayToStr)(_.buffer)})}}else if(p<n.bytesAvailable)for(r=0;r<p;r++)n.readUByte()}break;case 7:if(i=!0,u=!0,!o.sps){var S=(n=new T(t.data)).readSPS();o.width=S.width,o.height=S.height,o.pixelRatio=S.pixelRatio,o.sps=[t.data],o.duration=a._duration;var C=t.data.subarray(1,4),w="avc1.";for(r=0;r<3;r++){var R=C[r].toString(16);R.length<2&&(R="0"+R),w+=R}o.codec=w}break;case 8:i=!0,o.pps||(o.pps=[t.data]);break;case 9:i=!1,o.audFound=!0,l&&c(l,o),l=a.avcSample=d(!1,e.pts,e.dts,"");break;case 12:i=!1;break;default:i=!1,l&&(l.debug+="unknown NAL "+t.type+" ")}l&&i&&l.units.push(t)})),t&&l&&(c(l,o),this.avcSample=null)},t._insertSampleInOrder=function(e,t){var n=e.length;if(n>0){if(t.pts>=e[n-1].pts)e.push(t);else for(var i=n-1;i>=0;i--)if(t.pts<e[i].pts){e.splice(i,0,t);break}}else e.push(t)},t._getLastNalUnit=function(){var e,t=this.avcSample;if(!t||0===t.units.length){var n=this._avcTrack.samples;t=n[n.length-1]}if(t){var i=t.units;e=i[i.length-1]}return e},t._parseAVCNALu=function(e){var t,n,i,r,a=0,o=e.byteLength,s=this._avcTrack,l=s.naluState||0,u=l,c=[],d=-1;for(-1===l&&(d=0,r=31&e[0],l=0,a=1);a<o;)if(t=e[a++],l)if(1!==l)if(t)if(1===t){if(d>=0)i={data:e.subarray(d,a-l-1),type:r},c.push(i);else{var h=this._getLastNalUnit();if(h&&(u&&a<=4-u&&h.state&&(h.data=h.data.subarray(0,h.data.byteLength-u)),(n=a-l-1)>0)){var f=new Uint8Array(h.data.byteLength+n);f.set(h.data,0),f.set(e.subarray(0,n),h.data.byteLength),h.data=f}}a<o?(d=a,r=31&e[a],l=0):l=-1}else l=0;else l=3;else l=t?0:2;else l=t?0:1;if(d>=0&&l>=0&&(i={data:e.subarray(d,o),type:r,state:l},c.push(i)),0===c.length){var p=this._getLastNalUnit();if(p){var g=new Uint8Array(p.data.byteLength+e.byteLength);g.set(p.data,0),g.set(e,p.data.byteLength),p.data=g}}return s.naluState=l,c},t.discardEPB=function(e){for(var t,n,i=e.byteLength,r=[],a=1;a<i-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=i-r.length,n=new Uint8Array(t);var o=0;for(a=0;a<t;o++,a++)o===r[0]&&(o++,r.shift()),n[a]=e[o];return n},t._parseAACPES=function(e){var t,n,a,o,l,u,c,d=this._audioTrack,f=e.data,m=e.pts,y=this.aacOverFlow,A=this.aacLastPTS;if(y){var b=new Uint8Array(y.byteLength+f.byteLength);b.set(y,0),b.set(f,y.byteLength),f=b}for(a=0,l=f.length;a<l-1&&!h(f,a);a++);if(!a||(a<l-1?(u="AAC PES did not start with ADTS header,offset:"+a,c=!1):(u="no ADTS header found in AAC PES",c=!0),s.logger.warn("parsing error:"+u),this.observer.trigger(i.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:c,reason:u}),!c)){if(p(d,this.observer,f,a,this.audioCodec),n=0,t=g(d.samplerate),y&&A){var E=A+t;Math.abs(E-m)>1&&(s.logger.log("AAC: align PTS for overlapping frames by "+Math.round((E-m)/90)),m=E)}for(;a<l;){if(h(f,a)){if(a+5<l){var T=v(d,f,a,m,n);if(T){a+=T.length,o=T.sample.pts,n++;continue}}break}a++}y=a<l?f.subarray(a,l):null,this.aacOverFlow=y,this.aacLastPTS=o}},t._parseMPEGPES=function(e){for(var t=e.data,n=t.length,i=0,r=0,a=e.pts;r<n;)if(E.isHeader(t,r)){var o=E.appendFrame(this._audioTrack,t,r,a,i);if(!o)break;r+=o.length,i++}else r++},t._parseID3PES=function(e){this._id3Track.samples.push(e)},e}(),C=function(){function e(e,t,n){this.observer=e,this.config=n,this.remuxer=t}var t=e.prototype;return t.resetInitSegment=function(e,t,n,i){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}},t.resetTimeStamp=function(){},e.probe=function(e){var t,n,i=m.default.getID3Data(e,0);if(i&&void 0!==m.default.getTimeStamp(i))for(t=i.length,n=Math.min(e.length-1,t+100);t<n;t++)if(E.probe(e,t))return s.logger.log("MPEG Audio sync word found !"),!0;return!1},t.append=function(e,t,n,i){for(var r=m.default.getID3Data(e,0),a=m.default.getTimeStamp(r),o=a?90*a:9e4*t,s=r.length,l=e.length,u=0,c=0,d=this._audioTrack,h=[{pts:o,dts:o,data:r}];s<l;)if(E.isHeader(e,s)){var f=E.appendFrame(d,e,s,o,u);if(!f)break;s+=f.length,c=f.sample.pts,u++}else m.default.isHeader(e,s)?(r=m.default.getID3Data(e,s),h.push({pts:c,dts:c,data:r}),s+=r.length):s++;this.remuxer.remux(d,{samples:[]},{samples:h,inputTimeScale:9e4},{samples:[]},t,n,i)},t.destroy=function(){},e}(),w=function(){function e(){}return e.getSilentFrame=function(e,t){switch(e){case"mp4a.40.2":if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}(),R=Math.pow(2,32)-1,O=function(){function e(){}return e.init=function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var n=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:n,audio:i};var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),s=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,o,l,o,s),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,r))},e.box=function(e){for(var t,n=Array.prototype.slice.call(arguments,1),i=8,r=n.length,a=r;r--;)i+=n[r].byteLength;for((t=new Uint8Array(i))[0]=i>>24&255,t[1]=i>>16&255,t[2]=i>>8&255,t[3]=255&i,t.set(e,4),r=0,i=8;r<a;r++)t.set(n[r],i),i+=n[r].byteLength;return t},e.hdlr=function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])},e.mdat=function(t){return e.box(e.types.mdat,t)},e.mdhd=function(t,n){n*=t;var i=Math.floor(n/(R+1)),r=Math.floor(n%(R+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,n,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,n))},e.moov=function(t){for(var n=t.length,i=[];n--;)i[n]=e.trak(t[n]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))},e.mvex=function(t){for(var n=t.length,i=[];n--;)i[n]=e.trex(t[n]);return e.box.apply(null,[e.types.mvex].concat(i))},e.mvhd=function(t,n){n*=t;var i=Math.floor(n/(R+1)),r=Math.floor(n%(R+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,a)},e.sdtp=function(t){var n,i,r=t.samples||[],a=new Uint8Array(4+r.length);for(i=0;i<r.length;i++)n=r[i].flags,a[i+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return e.box(e.types.sdtp,a)},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))},e.avc1=function(t){var n,i,r,a=[],o=[];for(n=0;n<t.sps.length;n++)r=(i=t.sps[n]).byteLength,a.push(r>>>8&255),a.push(255&r),a=a.concat(Array.prototype.slice.call(i));for(n=0;n<t.pps.length;n++)r=(i=t.pps[n]).byteLength,o.push(r>>>8&255),o.push(255&r),o=o.concat(Array.prototype.slice.call(i));var s=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(o))),l=t.width,u=t.height,c=t.pixelRatio[0],d=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,d>>24,d>>16&255,d>>8&255,255&d])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.mp4a=function(t){var n=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var n=t.samplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]))},e.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var n=t.id,i=t.duration*t.timescale,r=t.width,a=t.height,o=Math.floor(i/(R+1)),s=Math.floor(i%(R+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,a>>8&255,255&a,0,0]))},e.traf=function(t,n){var i=e.sdtp(t),r=t.id,a=Math.floor(n/(R+1)),o=Math.floor(n%(R+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o])),e.trun(t,i.length+16+20+8+16+8+8),i)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var n=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,n){var i,r,a,o,s,l,u=t.samples||[],c=u.length,d=12+16*c,h=new Uint8Array(d);for(n+=8+d,h.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0),i=0;i<c;i++)a=(r=u[i]).duration,o=r.size,s=r.flags,l=r.cts,h.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,h)},e.initSegment=function(t){e.types||e.init();var n,i=e.moov(t);return(n=new Uint8Array(e.FTYP.byteLength+i.byteLength)).set(e.FTYP),n.set(i,e.FTYP.byteLength),n},e}();function L(e,t,n,i){void 0===n&&(n=1),void 0===i&&(i=!1);var r=e*t*n;return i?Math.round(r):r}function D(e,t){return void 0===t&&(t=!1),L(e,1e3,1/9e4,t)}function I(e,t){return void 0===t&&(t=1),L(e,9e4,1/t)}var P,x=I(10),N=I(.2),M=function(){function e(e,t,n,i){this.observer=e,this.config=t,this.typeSupported=n;var r=navigator.userAgent;this.isSafari=i&&i.indexOf("Apple")>-1&&r&&!r.match("CriOS"),this.ISGenerated=!1}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this._initPTS=this._initDTS=e},t.resetInitSegment=function(){this.ISGenerated=!1},t.remux=function(e,t,n,r,a,o,l){if(this.ISGenerated||this.generateIS(e,t,a),this.ISGenerated){var u=e.samples.length,c=t.samples.length,d=a,h=a;if(u&&c){var f=(e.samples[0].pts-t.samples[0].pts)/t.inputTimeScale;d+=Math.max(0,f),h+=Math.max(0,-f)}if(u){e.timescale||(s.logger.warn("regenerate InitSegment as audio detected"),this.generateIS(e,t,a));var p,g=this.remuxAudio(e,d,o,l);c&&(g&&(p=g.endPTS-g.startPTS),t.timescale||(s.logger.warn("regenerate InitSegment as video detected"),this.generateIS(e,t,a)),this.remuxVideo(t,h,o,p,l))}else if(c){var v=this.remuxVideo(t,h,o,0,l);v&&e.codec&&this.remuxEmptyAudio(e,d,o,v)}}n.samples.length&&this.remuxID3(n,a),r.samples.length&&this.remuxText(r,a),this.observer.trigger(i.default.FRAG_PARSED)},t.generateIS=function(e,t,n){var a,o,l=this.observer,u=e.samples,c=t.samples,d=this.typeSupported,h="audio/mp4",f={},p={tracks:f},g=void 0===this._initPTS;if(g&&(a=o=1/0),e.config&&u.length&&(e.timescale=e.samplerate,s.logger.log("audio sampling rate : "+e.samplerate),e.isAAC||(d.mpeg?(h="audio/mpeg",e.codec=""):d.mp3&&(e.codec="mp3")),f.audio={container:h,codec:e.codec,initSegment:!e.isAAC&&d.mpeg?new Uint8Array:O.initSegment([e]),metadata:{channelCount:e.channelCount}},g&&(a=o=u[0].pts-e.inputTimeScale*n)),t.sps&&t.pps&&c.length){var v=t.inputTimeScale;t.timescale=v,f.video={container:"video/mp4",codec:t.codec,initSegment:O.initSegment([t]),metadata:{width:t.width,height:t.height}},g&&(a=Math.min(a,c[0].pts-v*n),o=Math.min(o,c[0].dts-v*n),this.observer.trigger(i.default.INIT_PTS_FOUND,{initPTS:a}))}Object.keys(f).length?(l.trigger(i.default.FRAG_PARSING_INIT_SEGMENT,p),this.ISGenerated=!0,g&&(this._initPTS=a,this._initDTS=o)):l.trigger(i.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},t.remuxVideo=function(e,t,n,a,o){var l,u,c,d,h,f,p,g=8,v=e.timescale,m=e.samples,y=[],A=m.length,b=this._PTSNormalize,E=this._initPTS,T=this.nextAvcDts,k=this.isSafari;if(0!==A){k&&(n|=m.length&&T&&(o&&Math.abs(t-T/v)<.1||Math.abs(m[0].pts-T-E)<v/5)),n||(T=t*v),m.forEach((function(e){e.pts=b(e.pts-E,T),e.dts=b(e.dts-E,T)})),m.sort((function(e,t){var n=e.dts-t.dts,i=e.pts-t.pts;return n||i||e.id-t.id}));var _=m.reduce((function(e,t){return Math.max(Math.min(e,t.pts-t.dts),-1*N)}),0);if(_<0){s.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+D(_,!0)+" ms to overcome this issue");for(var S=0;S<m.length;S++)m[S].dts+=_}var C=m[0];h=Math.max(C.dts,0),d=Math.max(C.pts,0);var w=h-T;n&&w&&(w>1?s.logger.log("AVC: "+D(w,!0)+" ms hole between fragments detected,filling it"):w<-1&&s.logger.log("AVC: "+D(-w,!0)+" ms overlapping between fragments detected"),h=T,m[0].dts=h,d=Math.max(d-w,T),m[0].pts=d,s.logger.log("Video: PTS/DTS adjusted: "+D(d,!0)+"/"+D(h,!0)+", delta: "+D(w,!0)+" ms")),C=m[m.length-1],p=Math.max(C.dts,0),f=Math.max(C.pts,0,p),k&&(l=Math.round((p-h)/(m.length-1)));for(var R=0,L=0,I=0;I<A;I++){for(var P=m[I],x=P.units,M=x.length,F=0,B=0;B<M;B++)F+=x[B].data.length;L+=F,R+=M,P.length=F,P.dts=k?h+I*l:Math.max(P.dts,h),P.pts=Math.max(P.pts,P.dts)}var U=L+4*R+8;try{u=new Uint8Array(U)}catch(e){return void this.observer.trigger(i.default.ERROR,{type:r.ErrorTypes.MUX_ERROR,details:r.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:U,reason:"fail allocating video mdat "+U})}var j=new DataView(u.buffer);j.setUint32(0,U),u.set(O.types.mdat,4);for(var V=0;V<A;V++){for(var K=m[V],G=K.units,Y=0,H=void 0,$=0,z=G.length;$<z;$++){var W=G[$],q=W.data,X=W.data.byteLength;j.setUint32(g,X),g+=4,u.set(q,g),g+=X,Y+=4+X}if(k)H=Math.max(0,l*Math.round((K.pts-K.dts)/l));else{if(V<A-1)l=m[V+1].dts-K.dts;else{var Z=this.config,Q=K.dts-m[V>0?V-1:V].dts;if(Z.stretchShortVideoTrack){var J=Z.maxBufferHole,ee=Math.floor(J*v),te=(a?d+a*v:this.nextAudioPts)-K.pts;te>ee?((l=te-Q)<0&&(l=Q),s.logger.log("It is approximately "+D(te,!1)+" ms to the next segment; using duration "+D(l,!1)+" ms for the last video frame.")):l=Q}else l=Q}H=Math.round(K.pts-K.dts)}y.push({size:Y,duration:l,cts:H,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:K.key?2:1,isNonSync:K.key?0:1}})}this.nextAvcDts=p+l;var ne=e.dropped;if(e.nbNalu=0,e.dropped=0,y.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var ie=y[0].flags;ie.dependsOn=2,ie.isNonSync=0}e.samples=y,c=O.moof(e.sequenceNumber++,h,e),e.samples=[];var re={data1:c,data2:u,startPTS:d/v,endPTS:(f+l)/v,startDTS:h/v,endDTS:this.nextAvcDts/v,type:"video",hasAudio:!1,hasVideo:!0,nb:y.length,dropped:ne};return this.observer.trigger(i.default.FRAG_PARSING_DATA,re),re}},t.remuxAudio=function(e,t,n,a){var o,l,u,c,d,h,f=e.inputTimeScale,p=e.timescale,g=f/p,v=(e.isAAC?1024:1152)*g,m=this._PTSNormalize,y=this._initPTS,A=!e.isAAC&&this.typeSupported.mpeg,b=A?0:8,E=e.samples,T=[],k=this.nextAudioPts;if(n|=E.length&&k&&(a&&Math.abs(t-k/f)<.1||Math.abs(E[0].pts-k-y)<20*v),E.forEach((function(e){e.pts=e.dts=m(e.pts-y,t*f)})),0!==(E=E.filter((function(e){return e.pts>=0}))).length){if(n||(k=a?t*f:E[0].pts),e.isAAC)for(var _=this.config.maxAudioFramesDrift,S=0,C=k;S<E.length;){var R,L=E[S];if((R=L.pts-C)<=-_*v)s.logger.warn("Dropping 1 audio frame @ "+D(C,!0)+" ms due to "+D(R,!0)+" ms overlap."),E.splice(S,1);else if(R>=_*v&&R<x&&C){var I=Math.round(R/v);s.logger.warn("Injecting "+I+" audio frames @ "+D(C,!0)+" ms due to "+D(C,!0)+" ms gap.");for(var P=0;P<I;P++){var N=Math.max(C,0);(l=w.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(s.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),l=L.unit.subarray()),E.splice(S,0,{unit:l,pts:N,dts:N}),C+=v,S++}L.pts=L.dts=C,C+=v,S++}else L.pts=L.dts=C,C+=v,S++}for(var M=E.length,F=0;M--;)F+=E[M].unit.byteLength;for(var B=0,U=E.length;B<U;B++){var j=E[B],V=j.unit,K=j.pts;if(void 0!==h)o.duration=Math.round((K-h)/g);else{var G=K-k,Y=0;if(n&&e.isAAC&&G){if(G>0&&G<x)Y=Math.round((K-k)/v),s.logger.log(D(G,!0)+" ms hole between AAC samples detected,filling it"),Y>0&&((l=w.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(l=V.subarray()),F+=Y*l.length);else if(G<-12){s.logger.log("drop overlapping AAC sample, expected/parsed/delta: "+D(k,!0)+" ms / "+D(K,!0)+" ms / "+D(-G,!0)+" ms"),F-=V.byteLength;continue}K=k}if(d=K,!(F>0))return;F+=b;try{u=new Uint8Array(F)}catch(e){return void this.observer.trigger(i.default.ERROR,{type:r.ErrorTypes.MUX_ERROR,details:r.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:F,reason:"fail allocating audio mdat "+F})}A||(new DataView(u.buffer).setUint32(0,F),u.set(O.types.mdat,4));for(var H=0;H<Y;H++)(l=w.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(s.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),l=V.subarray()),u.set(l,b),b+=l.byteLength,o={size:l.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},T.push(o)}u.set(V,b);var $=V.byteLength;b+=$,o={size:$,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},T.push(o),h=K}var z=0;if((M=T.length)>=2&&(z=T[M-2].duration,o.duration=z),M){this.nextAudioPts=k=h+g*z,e.samples=T,c=A?new Uint8Array:O.moof(e.sequenceNumber++,d/g,e),e.samples=[];var W=d/f,q=k/f,X={data1:c,data2:u,startPTS:W,endPTS:q,startDTS:W,endDTS:q,type:"audio",hasAudio:!0,hasVideo:!1,nb:M};return this.observer.trigger(i.default.FRAG_PARSING_DATA,X),X}return null}},t.remuxEmptyAudio=function(e,t,n,i){var r=e.inputTimeScale,a=r/(e.samplerate?e.samplerate:r),o=this.nextAudioPts,l=(void 0!==o?o:i.startDTS*r)+this._initDTS,u=i.endDTS*r+this._initDTS,c=1024*a,d=Math.ceil((u-l)/c),h=w.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(s.logger.warn("remux empty Audio"),h){for(var f=[],p=0;p<d;p++){var g=l+p*c;f.push({unit:h,pts:g,dts:g})}e.samples=f,this.remuxAudio(e,t,n)}else s.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!")},t.remuxID3=function(e){var t,n=e.samples.length,r=e.inputTimeScale,a=this._initPTS,o=this._initDTS;if(n){for(var s=0;s<n;s++)(t=e.samples[s]).pts=(t.pts-a)/r,t.dts=(t.dts-o)/r;this.observer.trigger(i.default.FRAG_PARSING_METADATA,{samples:e.samples})}e.samples=[]},t.remuxText=function(e){e.samples.sort((function(e,t){return e.pts-t.pts}));var t,n=e.samples.length,r=e.inputTimeScale,a=this._initPTS;if(n){for(var o=0;o<n;o++)(t=e.samples[o]).pts=(t.pts-a)/r;this.observer.trigger(i.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[]},t._PTSNormalize=function(e,t){var n;if(void 0===t)return e;for(n=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=n;return e},e}(),F=function(){function e(e){this.observer=e}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(){},t.resetInitSegment=function(){},t.remux=function(e,t,n,r,a,o,s,l){var u=this.observer,c="";e&&(c+="audio"),t&&(c+="video"),u.trigger(i.default.FRAG_PARSING_DATA,{data1:l,startPTS:a,startDTS:a,type:c,hasAudio:!!e,hasVideo:!!t,nb:1,dropped:0}),u.trigger(i.default.FRAG_PARSED)},e}(),B=Object(l.getSelfScope)();try{P=B.performance.now.bind(B.performance)}catch(e){s.logger.debug("Unable to use Performance API on this environment"),P=B.Date.now}var U=function(){function e(e,t,n,i){this.observer=e,this.typeSupported=t,this.config=n,this.vendor=i}var t=e.prototype;return t.destroy=function(){var e=this.demuxer;e&&e.destroy()},t.push=function(e,t,n,r,o,s,l,u,c,d,h,f){var p=this;if(e.byteLength>0&&null!=t&&null!=t.key&&"AES-128"===t.method){var g=this.decrypter;null==g&&(g=this.decrypter=new a.default(this.observer,this.config));var v=P();g.decrypt(e,t.key.buffer,t.iv.buffer,(function(e){var a=P();p.observer.trigger(i.default.FRAG_DECRYPTED,{stats:{tstart:v,tdecrypt:a}}),p.pushDecrypted(new Uint8Array(e),t,new Uint8Array(n),r,o,s,l,u,c,d,h,f)}))}else this.pushDecrypted(new Uint8Array(e),t,new Uint8Array(n),r,o,s,l,u,c,d,h,f)},t.pushDecrypted=function(e,t,n,a,o,s,l,u,c,d,h,f){var p=this.demuxer;if(!p||(l||u)&&!this.probe(e)){for(var g=this.observer,v=this.typeSupported,m=this.config,b=[{demux:S,remux:M},{demux:A.default,remux:F},{demux:y,remux:M},{demux:C,remux:M}],E=0,T=b.length;E<T;E++){var k=b[E],_=k.demux.probe;if(_(e)){var w=this.remuxer=new k.remux(g,m,v,this.vendor);p=new k.demux(g,w,m,v),this.probe=_;break}}if(!p)return void g.trigger(i.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=p}var R=this.remuxer;(l||u)&&(p.resetInitSegment(n,a,o,d),R.resetInitSegment()),l&&(p.resetTimeStamp(f),R.resetTimeStamp(f)),"function"==typeof p.setDecryptData&&p.setDecryptData(t),p.append(e,s,c,h)},e}();t.default=U},"./src/demux/demuxer-worker.js":
|
||
/*!*************************************!*\
|
||
!*** ./src/demux/demuxer-worker.js ***!
|
||
\*************************************/
|
||
/*! exports provided: default */
|
||
/*! ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./src/demux/demuxer.js (referenced with require.resolve) */function(e,t,n){n.r(t);var i=n(/*! ../demux/demuxer-inline */"./src/demux/demuxer-inline.js"),r=n(/*! ../events */"./src/events.js"),a=n(/*! ../utils/logger */"./src/utils/logger.js"),o=n(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");t.default=function(e){var t=new o.EventEmitter;t.trigger=function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];t.emit.apply(t,[e,e].concat(i))},t.off=function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];t.removeListener.apply(t,[e].concat(i))};var n=function(t,n){e.postMessage({event:t,data:n})};e.addEventListener("message",(function(r){var o=r.data;switch(o.cmd){case"init":var s=JSON.parse(o.config);e.demuxer=new i.default(t,o.typeSupported,s,o.vendor),Object(a.enableLogs)(s.debug),n("init",null);break;case"demux":e.demuxer.push(o.data,o.decryptdata,o.initSegment,o.audioCodec,o.videoCodec,o.timeOffset,o.discontinuity,o.trackSwitch,o.contiguous,o.duration,o.accurateTimeOffset,o.defaultInitPTS)}})),t.on(r.default.FRAG_DECRYPTED,n),t.on(r.default.FRAG_PARSING_INIT_SEGMENT,n),t.on(r.default.FRAG_PARSED,n),t.on(r.default.ERROR,n),t.on(r.default.FRAG_PARSING_METADATA,n),t.on(r.default.FRAG_PARSING_USERDATA,n),t.on(r.default.INIT_PTS_FOUND,n),t.on(r.default.FRAG_PARSING_DATA,(function(t,n){var i=[],r={event:t,data:n};n.data1&&(r.data1=n.data1.buffer,i.push(n.data1.buffer),delete n.data1),n.data2&&(r.data2=n.data2.buffer,i.push(n.data2.buffer),delete n.data2),e.postMessage(r,i)}))}},"./src/demux/id3.js":
|
||
/*!**************************!*\
|
||
!*** ./src/demux/id3.js ***!
|
||
\**************************/
|
||
/*! exports provided: default, utf8ArrayToStr */function(e,t,n){n.r(t),n.d(t,"utf8ArrayToStr",(function(){return s}));var i,r=n(/*! ../utils/get-self-scope */"./src/utils/get-self-scope.js"),a=function(){function e(){}return e.isHeader=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},e.isFooter=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},e.getID3Data=function(t,n){for(var i=n,r=0;e.isHeader(t,n);)r+=10,r+=e._readSize(t,n+6),e.isFooter(t,n+10)&&(r+=10),n+=r;if(r>0)return t.subarray(i,i+r)},e._readSize=function(e,t){var n=0;return n=(127&e[t])<<21,n|=(127&e[t+1])<<14,n|=(127&e[t+2])<<7,n|=127&e[t+3]},e.getTimeStamp=function(t){for(var n=e.getID3Frames(t),i=0;i<n.length;i++){var r=n[i];if(e.isTimeStampFrame(r))return e._readTimeStamp(r)}},e.isTimeStampFrame=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},e._getFrameData=function(t){var n=String.fromCharCode(t[0],t[1],t[2],t[3]),i=e._readSize(t,4);return{type:n,size:i,data:t.subarray(10,10+i)}},e.getID3Frames=function(t){for(var n=0,i=[];e.isHeader(t,n);){for(var r=e._readSize(t,n+6),a=(n+=10)+r;n+8<a;){var o=e._getFrameData(t.subarray(n)),s=e._decodeFrame(o);s&&i.push(s),n+=o.size+10}e.isFooter(t,n)&&(n+=10)}return i},e._decodeFrame=function(t){return"PRIV"===t.type?e._decodePrivFrame(t):"T"===t.type[0]?e._decodeTextFrame(t):"W"===t.type[0]?e._decodeURLFrame(t):void 0},e._readTimeStamp=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),n=1&t[3],i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,n&&(i+=47721858.84),Math.round(i)}},e._decodePrivFrame=function(t){if(!(t.size<2)){var n=e._utf8ArrayToStr(t.data,!0),i=new Uint8Array(t.data.subarray(n.length+1));return{key:t.type,info:n,data:i.buffer}}},e._decodeTextFrame=function(t){if(!(t.size<2)){if("TXXX"===t.type){var n=1,i=e._utf8ArrayToStr(t.data.subarray(n),!0);n+=i.length+1;var r=e._utf8ArrayToStr(t.data.subarray(n));return{key:t.type,info:i,data:r}}var a=e._utf8ArrayToStr(t.data.subarray(1));return{key:t.type,data:a}}},e._decodeURLFrame=function(t){if("WXXX"===t.type){if(t.size<2)return;var n=1,i=e._utf8ArrayToStr(t.data.subarray(n));n+=i.length+1;var r=e._utf8ArrayToStr(t.data.subarray(n));return{key:t.type,info:i,data:r}}var a=e._utf8ArrayToStr(t.data);return{key:t.type,data:a}},e._utf8ArrayToStr=function(e,t){void 0===t&&(t=!1);var n=o();if(n){var i=n.decode(e);if(t){var r=i.indexOf("\0");return-1!==r?i.substring(0,r):i}return i.replace(/\0/g,"")}for(var a,s,l,u=e.length,c="",d=0;d<u;){if(0===(a=e[d++])&&t)return c;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(a);break;case 12:case 13:s=e[d++],c+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=e[d++],l=e[d++],c+=String.fromCharCode((15&a)<<12|(63&s)<<6|(63&l)<<0)}}return c},e}();function o(){var e=Object(r.getSelfScope)();return i||void 0===e.TextDecoder||(i=new e.TextDecoder("utf-8")),i}var s=a._utf8ArrayToStr;t.default=a},"./src/demux/mp4demuxer.js":
|
||
/*!*********************************!*\
|
||
!*** ./src/demux/mp4demuxer.js ***!
|
||
\*********************************/
|
||
/*! exports provided: default */function(e,t,n){n.r(t);var i=n(/*! ../utils/logger */"./src/utils/logger.js"),r=n(/*! ../events */"./src/events.js"),a=Math.pow(2,32)-1,o=function(){function e(e,t){this.observer=e,this.remuxer=t}var t=e.prototype;return t.resetTimeStamp=function(e){this.initPTS=e},t.resetInitSegment=function(t,n,i,a){if(t&&t.byteLength){var o=this.initData=e.parseInitSegment(t);null==n&&(n="mp4a.40.5"),null==i&&(i="avc1.42e01e");var s={};o.audio&&o.video?s.audiovideo={container:"video/mp4",codec:n+","+i,initSegment:a?t:null}:(o.audio&&(s.audio={container:"audio/mp4",codec:n,initSegment:a?t:null}),o.video&&(s.video={container:"video/mp4",codec:i,initSegment:a?t:null})),this.observer.trigger(r.default.FRAG_PARSING_INIT_SEGMENT,{tracks:s})}else n&&(this.audioCodec=n),i&&(this.videoCodec=i)},e.probe=function(t){return e.findBox({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},e.bin2str=function(e){return String.fromCharCode.apply(null,e)},e.readUint16=function(e,t){e.data&&(t+=e.start,e=e.data);var n=e[t]<<8|e[t+1];return n<0?65536+n:n},e.readUint32=function(e,t){e.data&&(t+=e.start,e=e.data);var n=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return n<0?4294967296+n:n},e.writeUint32=function(e,t,n){e.data&&(t+=e.start,e=e.data),e[t]=n>>24,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n},e.findBox=function(t,n){var i,r,a,o,s,l,u=[];if(t.data?(s=t.start,a=t.end,t=t.data):(s=0,a=t.byteLength),!n.length)return null;for(i=s;i<a;)l=(r=e.readUint32(t,i))>1?i+r:a,e.bin2str(t.subarray(i+4,i+8))===n[0]&&(1===n.length?u.push({data:t,start:i+8,end:l}):(o=e.findBox({data:t,start:i+8,end:l},n.slice(1))).length&&(u=u.concat(o))),i=l;return u},e.parseSegmentIndex=function(t){var n,i=e.findBox(t,["moov"])[0],r=i?i.end:null,a=0,o=e.findBox(t,["sidx"]);if(!o||!o[0])return null;n=[];var s=(o=o[0]).data[0];a=0===s?8:16;var l=e.readUint32(o,a);a+=4,a+=0===s?8:16,a+=2;var u=o.end+0,c=e.readUint16(o,a);a+=2;for(var d=0;d<c;d++){var h=a,f=e.readUint32(o,h);h+=4;var p=2147483647&f;if(1==(2147483648&f)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var g=e.readUint32(o,h);h+=4,n.push({referenceSize:p,subsegmentDuration:g,info:{duration:g/l,start:u,end:u+p-1}}),u+=p,a=h+=4}return{earliestPresentationTime:0,timescale:l,version:s,referencesCount:c,references:n,moovEndOffset:r}},e.parseInitSegment=function(t){var n=[];return e.findBox(t,["moov","trak"]).forEach((function(t){var r=e.findBox(t,["tkhd"])[0];if(r){var a=r.data[r.start],o=0===a?12:20,s=e.readUint32(r,o),l=e.findBox(t,["mdia","mdhd"])[0];if(l){o=0===(a=l.data[l.start])?12:20;var u=e.readUint32(l,o),c=e.findBox(t,["mdia","hdlr"])[0];if(c){var d={soun:"audio",vide:"video"}[e.bin2str(c.data.subarray(c.start+8,c.start+12))];if(d){var h=e.findBox(t,["mdia","minf","stbl","stsd"]);if(h.length){h=h[0];var f=e.bin2str(h.data.subarray(h.start+12,h.start+16));i.logger.log("MP4Demuxer:"+d+":"+f+" found")}n[s]={timescale:u,type:d},n[d]={timescale:u,id:s}}}}}})),n},e.getStartDTS=function(t,n){var i,r,a;return i=e.findBox(n,["moof","traf"]),r=[].concat.apply([],i.map((function(n){return e.findBox(n,["tfhd"]).map((function(i){var r,a;return r=e.readUint32(i,4),a=t[r].timescale||9e4,e.findBox(n,["tfdt"]).map((function(t){var n,i;return n=t.data[t.start],i=e.readUint32(t,4),1===n&&(i*=Math.pow(2,32),i+=e.readUint32(t,8)),i}))[0]/a}))}))),a=Math.min.apply(null,r),isFinite(a)?a:0},e.offsetStartDTS=function(t,n,i){e.findBox(n,["moof","traf"]).map((function(n){return e.findBox(n,["tfhd"]).map((function(r){var o=e.readUint32(r,4),s=t[o].timescale||9e4;e.findBox(n,["tfdt"]).map((function(t){var n=t.data[t.start],r=e.readUint32(t,4);if(0===n)e.writeUint32(t,4,r-i*s);else{r*=Math.pow(2,32),r+=e.readUint32(t,8),r-=i*s,r=Math.max(r,0);var o=Math.floor(r/(a+1)),l=Math.floor(r%(a+1));e.writeUint32(t,4,o),e.writeUint32(t,8,l)}}))}))}))},t.append=function(t,n,i,a){var o=this.initData;o||(this.resetInitSegment(t,this.audioCodec,this.videoCodec,!1),o=this.initData);var s,l=this.initPTS;if(void 0===l){var u=e.getStartDTS(o,t);this.initPTS=l=u-n,this.observer.trigger(r.default.INIT_PTS_FOUND,{initPTS:l})}e.offsetStartDTS(o,t,l),s=e.getStartDTS(o,t),this.remuxer.remux(o.audio,o.video,null,null,s,i,a,t)},t.destroy=function(){},e}();t.default=o},"./src/errors.ts":
|
||
/*!***********************!*\
|
||
!*** ./src/errors.ts ***!
|
||
\***********************/
|
||
/*! exports provided: ErrorTypes, ErrorDetails */function(e,t,n){var i,r;n.r(t),n.d(t,"ErrorTypes",(function(){return i})),n.d(t,"ErrorDetails",(function(){return r})),function(e){e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError"}(i||(i={})),function(e){e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException"}(r||(r={}))},"./src/events.js":
|
||
/*!***********************!*\
|
||
!*** ./src/events.js ***!
|
||
\***********************/
|
||
/*! exports provided: default */function(e,t,n){n.r(t),t.default={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition",LIVE_BACK_BUFFER_REACHED:"hlsLiveBackBufferReached"}},"./src/hls.ts":
|
||
/*!*********************************!*\
|
||
!*** ./src/hls.ts + 50 modules ***!
|
||
\*********************************/
|
||
/*! exports provided: default */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/demux/demuxer-worker.js */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/demuxer-inline.js because of ./src/demux/demuxer-worker.js */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/demux/demuxer-worker.js */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/demux/demuxer-worker.js */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/demux/demuxer-worker.js */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/demux/demuxer-worker.js */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number-isFinite.js because of ./src/demux/demuxer-worker.js */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/demux/demuxer-worker.js */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/demux/demuxer-worker.js */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/eventemitter3/index.js (<- Module is not an ECMAScript module) */
|
||
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/url-toolkit/src/url-toolkit.js (<- Module is not an ECMAScript module) */function(e,t,n){n.r(t);var i={};n.r(i),n.d(i,"newCue",(function(){return vt}));var r,a,o=n("./node_modules/url-toolkit/src/url-toolkit.js"),s=n("./src/errors.ts"),l=n("./src/polyfills/number-isFinite.js"),u=n("./src/events.js"),c=n("./src/utils/logger.js"),d={hlsEventGeneric:!0,hlsHandlerDestroying:!0,hlsHandlerDestroyed:!0},h=function(){function e(e){this.hls=void 0,this.handledEvents=void 0,this.useGenericHandler=void 0,this.hls=e,this.onEvent=this.onEvent.bind(this);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.handledEvents=n,this.useGenericHandler=!0,this.registerListeners()}var t=e.prototype;return t.destroy=function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()},t.onHandlerDestroying=function(){},t.onHandlerDestroyed=function(){},t.isEventHandler=function(){return"object"==typeof this.handledEvents&&this.handledEvents.length&&"function"==typeof this.onEvent},t.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEach((function(e){if(d[e])throw new Error("Forbidden event-name: "+e);this.hls.on(e,this.onEvent)}),this)},t.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach((function(e){this.hls.off(e,this.onEvent)}),this)},t.onEvent=function(e,t){this.onEventGeneric(e,t)},t.onEventGeneric=function(e,t){try{(function(e,t){var n="on"+e.replace("hls","");if("function"!=typeof this[n])throw new Error("Event "+e+" has no generic handler in this "+this.constructor.name+" class (tried "+n+")");return this[n].bind(this,t)}).call(this,e,t).call()}catch(t){c.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}},e}();!function(e){e.MANIFEST="manifest",e.LEVEL="level",e.AUDIO_TRACK="audioTrack",e.SUBTITLE_TRACK="subtitleTrack"}(r||(r={})),function(e){e.MAIN="main",e.AUDIO="audio",e.SUBTITLE="subtitle"}(a||(a={}));var f=n("./src/demux/mp4demuxer.js");function p(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var g,v=function(){function e(e,t){this._uri=null,this.baseuri=void 0,this.reluri=void 0,this.method=null,this.key=null,this.iv=null,this.baseuri=e,this.reluri=t}var t,n,i;return t=e,(n=[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=Object(o.buildAbsoluteURL)(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}])&&p(t.prototype,n),i&&p(t,i),e}();function m(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}!function(e){e.AUDIO="audio",e.VIDEO="video"}(g||(g={}));var y=function(){function e(){var e;this._url=null,this._byteRange=null,this._decryptdata=null,this._elementaryStreams=((e={})[g.AUDIO]=!1,e[g.VIDEO]=!1,e),this.deltaPTS=0,this.rawProgramDateTime=null,this.programDateTime=null,this.title=null,this.tagList=[],this.cc=void 0,this.type=void 0,this.relurl=void 0,this.baseurl=void 0,this.duration=void 0,this.start=void 0,this.sn=0,this.urlId=0,this.level=0,this.levelkey=void 0,this.loader=void 0}var t,n,i,r=e.prototype;return r.setByteRange=function(e,t){var n=e.split("@",2),i=[];1===n.length?i[0]=t?t.byteRangeEndOffset:0:i[0]=parseInt(n[1]),i[1]=parseInt(n[0])+i[0],this._byteRange=i},r.addElementaryStream=function(e){this._elementaryStreams[e]=!0},r.hasElementaryStream=function(e){return!0===this._elementaryStreams[e]},r.createInitializationVector=function(e){for(var t=new Uint8Array(16),n=12;n<16;n++)t[n]=e>>8*(15-n)&255;return t},r.setDecryptDataFromLevelKey=function(e,t){var n=e;return e&&e.method&&e.uri&&!e.iv&&((n=new v(e.baseuri,e.reluri)).method=e.method,n.iv=this.createInitializationVector(t)),n},t=e,(n=[{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=Object(o.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(e){this._url=e}},{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var e=this.sn;"number"!=typeof e&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&c.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)}return this._decryptdata}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(l.isFiniteNumber)(this.programDateTime))return null;var e=Object(l.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){return!(!this.decryptdata||null===this.decryptdata.uri||null!==this.decryptdata.key)}}])&&m(t.prototype,n),i&&m(t,i),e}();function A(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var b=function(){function e(e){this.endCC=0,this.endSN=0,this.fragments=[],this.initSegment=null,this.live=!0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=e,this.version=null}var t,n,i;return t=e,(n=[{key:"hasProgramDateTime",get:function(){return!(!this.fragments[0]||!Object(l.isFiniteNumber)(this.fragments[0].programDateTime))}}])&&A(t.prototype,n),i&&A(t,i),e}(),E=/^(\d+)x(\d+)$/,T=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,k=function(){function e(t){for(var n in"string"==typeof t&&(t=e.parseAttrList(t)),t)t.hasOwnProperty(n)&&(this[n]=t[n])}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var n=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(2*i,2*i+2),16);return n}return null},t.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.enumeratedString=function(e){return this[e]},t.decimalResolution=function(e){var t=E.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,n={};for(T.lastIndex=0;null!==(t=T.exec(e));){var i=t[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),n[t[1]]=i}return n},e}(),_={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0}};function S(e,t){return MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}var C=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,w=/#EXT-X-MEDIA:(.*)/g,R=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)([\S+ ?]+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),O=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-("0.4.0"):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/,L=/\.(mp4|m4s|m4v|m4a)$/i,D=function(){function e(){}return e.findGroup=function(e,t){for(var n=0;n<e.length;n++){var i=e[n];if(i.id===t)return i}},e.convertAVC1ToAVCOTI=function(e){var t,n=e.split(".");return n.length>2?(t=n.shift()+".",t+=parseInt(n.shift()).toString(16),t+=("000"+parseInt(n.shift()).toString(16)).substr(-4)):t=e,t},e.resolve=function(e,t){return o.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.parseMasterPlaylist=function(t,n){var i,r=[];function a(e,t){["video","audio"].forEach((function(n){var i=e.filter((function(e){return function(e,t){var n=_[t];return!!n&&!0===n[e.slice(0,4)]}(e,n)}));if(i.length){var r=i.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)}));t[n+"Codec"]=r.length>0?r[0]:i[0],e=e.filter((function(e){return-1===i.indexOf(e)}))}})),t.unknownCodecs=e}for(C.lastIndex=0;null!=(i=C.exec(t));){var o={},s=o.attrs=new k(i[1]);o.url=e.resolve(i[2],n);var l=s.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),o.bitrate=s.decimalInteger("AVERAGE-BANDWIDTH")||s.decimalInteger("BANDWIDTH"),o.name=s.NAME,a([].concat((s.CODECS||"").split(/[ ,]+/)),o),o.videoCodec&&-1!==o.videoCodec.indexOf("avc1")&&(o.videoCodec=e.convertAVC1ToAVCOTI(o.videoCodec)),r.push(o)}return r},e.parseMasterPlaylistMedia=function(t,n,i,r){var a;void 0===r&&(r=[]);var o=[],s=0;for(w.lastIndex=0;null!==(a=w.exec(t));){var l=new k(a[1]);if(l.TYPE===i){var u={id:s++,groupId:l["GROUP-ID"],name:l.NAME||l.LANGUAGE,type:i,default:"YES"===l.DEFAULT,autoselect:"YES"===l.AUTOSELECT,forced:"YES"===l.FORCED,lang:l.LANGUAGE};if(l.URI&&(u.url=e.resolve(l.URI,n)),r.length){var c=e.findGroup(r,u.groupId);u.audioCodec=c?c.codec:r[0].codec}o.push(u)}}return o},e.parseLevelPlaylist=function(e,t,n,i,r){var a,o,s,u=0,d=0,h=new b(t),f=0,p=null,g=new y,m=null;for(R.lastIndex=0;null!==(a=R.exec(e));){var A=a[1];if(A){g.duration=parseFloat(A);var E=(" "+a[2]).slice(1);g.title=E||null,g.tagList.push(E?["INF",A,E]:["INF",A])}else if(a[3]){if(Object(l.isFiniteNumber)(g.duration)){var T=u++;g.type=i,g.start=d,s&&(g.levelkey=s),g.sn=T,g.level=n,g.cc=f,g.urlId=r,g.baseurl=t,g.relurl=(" "+a[3]).slice(1),I(g,p),h.fragments.push(g),p=g,d+=g.duration,g=new y}}else if(a[4]){var _=(" "+a[4]).slice(1);p?g.setByteRange(_,p):g.setByteRange(_)}else if(a[5])g.rawProgramDateTime=(" "+a[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),null===m&&(m=h.fragments.length);else{if(!(a=a[0].match(O))){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(o=1;o<a.length&&void 0===a[o];o++);var S=(" "+a[o+1]).slice(1),C=(" "+a[o+2]).slice(1);switch(a[o]){case"#":g.tagList.push(C?[S,C]:[S]);break;case"PLAYLIST-TYPE":h.type=S.toUpperCase();break;case"MEDIA-SEQUENCE":u=h.startSN=parseInt(S);break;case"TARGETDURATION":h.targetduration=parseFloat(S);break;case'"0.4.0"':h.version=parseInt(S);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"DIS":f++,g.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":f=parseInt(S);break;case"KEY":var w=new k(S),D=w.enumeratedString("METHOD"),P=w.URI,x=w.hexadecimalInteger("IV");D&&(s=new v(t,P),P&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(D)>=0&&(s.method=D,s.key=null,s.iv=x));break;case"START":var N=new k(S).decimalFloatingPoint("TIME-OFFSET");Object(l.isFiniteNumber)(N)&&(h.startTimeOffset=N);break;case"MAP":var M=new k(S);g.relurl=M.URI,M.BYTERANGE&&g.setByteRange(M.BYTERANGE),g.baseurl=t,g.level=n,g.type=i,g.sn="initSegment",h.initSegment=g,(g=new y).rawProgramDateTime=h.initSegment.rawProgramDateTime;break;default:c.logger.warn("line parsed but not handled: "+a)}}}return(g=p)&&!g.relurl&&(h.fragments.pop(),d-=g.duration),h.totalduration=d,h.averagetargetduration=d/h.fragments.length,h.endSN=u-1,h.startCC=h.fragments[0]?h.fragments[0].cc:0,h.endCC=f,!h.initSegment&&h.fragments.length&&h.fragments.every((function(e){return L.test(e.relurl)}))&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(g=new y).relurl=h.fragments[0].relurl,g.baseurl=t,g.level=n,g.type=i,g.sn="initSegment",h.initSegment=g,h.needSidxRanges=!0),m&&function(e,t){for(var n=e[t],i=t-1;i>=0;i--){var r=e[i];r.programDateTime=n.programDateTime-1e3*r.duration,n=r}}(h.fragments,m),h},e}();function I(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Object(l.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}var P=window.performance,x=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MANIFEST_LOADING,u.default.LEVEL_LOADING,u.default.AUDIO_TRACK_LOADING,u.default.SUBTITLE_TRACK_LOADING)||this).loaders={},n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i.canHaveQualityLevels=function(e){return e!==r.AUDIO_TRACK&&e!==r.SUBTITLE_TRACK},i.mapContextToLevelType=function(e){switch(e.type){case r.AUDIO_TRACK:return a.AUDIO;case r.SUBTITLE_TRACK:return a.SUBTITLE;default:return a.MAIN}},i.getResponseUrl=function(e,t){var n=e.url;return void 0!==n&&0!==n.indexOf("data:")||(n=t.url),n};var o=i.prototype;return o.createInternalLoader=function(e){var t=this.hls.config,n=t.pLoader,i=t.loader,r=new(n||i)(t);return e.loader=r,this.loaders[e.type]=r,r},o.getInternalLoader=function(e){return this.loaders[e.type]},o.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},o.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},o.destroy=function(){this.destroyInternalLoaders(),e.prototype.destroy.call(this)},o.onManifestLoading=function(e){this.load({url:e.url,type:r.MANIFEST,level:0,id:null,responseType:"text"})},o.onLevelLoading=function(e){this.load({url:e.url,type:r.LEVEL,level:e.level,id:e.id,responseType:"text"})},o.onAudioTrackLoading=function(e){this.load({url:e.url,type:r.AUDIO_TRACK,level:null,id:e.id,responseType:"text"})},o.onSubtitleTrackLoading=function(e){this.load({url:e.url,type:r.SUBTITLE_TRACK,level:null,id:e.id,responseType:"text"})},o.load=function(e){var t=this.hls.config;c.logger.debug("Loading playlist of type "+e.type+", level: "+e.level+", id: "+e.id);var n,i,a,o,s=this.getInternalLoader(e);if(s){var l=s.context;if(l&&l.url===e.url)return c.logger.trace("playlist request ongoing"),!1;c.logger.warn("aborting previous loader for type: "+e.type),s.abort()}switch(e.type){case r.MANIFEST:n=t.manifestLoadingMaxRetry,i=t.manifestLoadingTimeOut,a=t.manifestLoadingRetryDelay,o=t.manifestLoadingMaxRetryTimeout;break;case r.LEVEL:n=0,o=0,a=0,i=t.levelLoadingTimeOut;break;default:n=t.levelLoadingMaxRetry,i=t.levelLoadingTimeOut,a=t.levelLoadingRetryDelay,o=t.levelLoadingMaxRetryTimeout}s=this.createInternalLoader(e);var u={timeout:i,maxRetry:n,retryDelay:a,maxRetryDelay:o},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return c.logger.debug("Calling internal loader delegate for URL: "+e.url),s.load(e,u,d),!0},o.loadsuccess=function(e,t,n,i){if(void 0===i&&(i=null),n.isSidxRequest)return this._handleSidxRequest(e,n),void this._handlePlaylistLoaded(e,t,n,i);if(this.resetInternalLoader(n.type),"string"!=typeof e.data)throw new Error('expected responseType of "text" for PlaylistLoader');var r=e.data;t.tload=P.now(),0===r.indexOf("#EXTM3U")?r.indexOf("#EXTINF:")>0||r.indexOf("#EXT-X-TARGETDURATION:")>0?this._handleTrackOrLevelPlaylist(e,t,n,i):this._handleMasterPlaylist(e,t,n,i):this._handleManifestParsingError(e,n,"no EXTM3U delimiter",i)},o.loaderror=function(e,t,n){void 0===n&&(n=null),this._handleNetworkError(t,n,!1,e)},o.loadtimeout=function(e,t,n){void 0===n&&(n=null),this._handleNetworkError(t,n,!0)},o._handleMasterPlaylist=function(e,t,n,r){var a=this.hls,o=e.data,s=i.getResponseUrl(e,n),l=D.parseMasterPlaylist(o,s);if(l.length){var d=l.map((function(e){return{id:e.attrs.AUDIO,codec:e.audioCodec}})),h=D.parseMasterPlaylistMedia(o,s,"AUDIO",d),f=D.parseMasterPlaylistMedia(o,s,"SUBTITLES");if(h.length){var p=!1;h.forEach((function(e){e.url||(p=!0)})),!1===p&&l[0].audioCodec&&!l[0].attrs.AUDIO&&(c.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),h.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1}))}a.trigger(u.default.MANIFEST_LOADED,{levels:l,audioTracks:h,subtitles:f,url:s,stats:t,networkDetails:r})}else this._handleManifestParsingError(e,n,"no level found in manifest",r)},o._handleTrackOrLevelPlaylist=function(e,t,n,a){var o=this.hls,s=n.id,c=n.level,d=n.type,h=i.getResponseUrl(e,n),f=Object(l.isFiniteNumber)(s)?s:0,p=Object(l.isFiniteNumber)(c)?c:f,g=i.mapContextToLevelType(n),v=D.parseLevelPlaylist(e.data,h,p,g,f);if(v.tload=t.tload,d===r.MANIFEST){var m={url:h,details:v};o.trigger(u.default.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:h,stats:t,networkDetails:a})}if(t.tparsed=P.now(),v.needSidxRanges){var y=v.initSegment.url;this.load({url:y,isSidxRequest:!0,type:d,level:c,levelDetails:v,id:s,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}else n.levelDetails=v,this._handlePlaylistLoaded(e,t,n,a)},o._handleSidxRequest=function(e,t){if("string"==typeof e.data)throw new Error("sidx request must be made with responseType of array buffer");var n=f.default.parseSegmentIndex(new Uint8Array(e.data));if(n){var i=n.references,r=t.levelDetails;i.forEach((function(e,t){var n=e.info;if(r){var i=r.fragments[t];0===i.byteRange.length&&i.setByteRange(String(1+n.end-n.start)+"@"+String(n.start))}})),r&&r.initSegment.setByteRange(String(n.moovEndOffset)+"@0")}},o._handleManifestParsingError=function(e,t,n,i){this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:e.url,reason:n,networkDetails:i})},o._handleNetworkError=function(e,t,n,i){var a,o;void 0===n&&(n=!1),void 0===i&&(i=null),c.logger.info("A network error occured while loading a "+e.type+"-type playlist");var l=this.getInternalLoader(e);switch(e.type){case r.MANIFEST:a=n?s.ErrorDetails.MANIFEST_LOAD_TIMEOUT:s.ErrorDetails.MANIFEST_LOAD_ERROR,o=!0;break;case r.LEVEL:a=n?s.ErrorDetails.LEVEL_LOAD_TIMEOUT:s.ErrorDetails.LEVEL_LOAD_ERROR,o=!1;break;case r.AUDIO_TRACK:a=n?s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,o=!1;break;default:o=!1}l&&(l.abort(),this.resetInternalLoader(e.type));var d={type:s.ErrorTypes.NETWORK_ERROR,details:a,fatal:o,url:e.url,loader:l,context:e,networkDetails:t};i&&(d.response=i),this.hls.trigger(u.default.ERROR,d)},o._handlePlaylistLoaded=function(e,t,n,a){var o=n.type,s=n.level,l=n.id,c=n.levelDetails;if(c&&c.targetduration)if(i.canHaveQualityLevels(n.type))this.hls.trigger(u.default.LEVEL_LOADED,{details:c,level:s||0,id:l||0,stats:t,networkDetails:a});else switch(o){case r.AUDIO_TRACK:this.hls.trigger(u.default.AUDIO_TRACK_LOADED,{details:c,id:l,stats:t,networkDetails:a});break;case r.SUBTITLE_TRACK:this.hls.trigger(u.default.SUBTITLE_TRACK_LOADED,{details:c,id:l,stats:t,networkDetails:a})}else this._handleManifestParsingError(e,n,"invalid target duration",a)},i}(h),N=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.FRAG_LOADING)||this).loaders={},n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){var t=this.loaders;for(var n in t){var i=t[n];i&&i.destroy()}this.loaders={},e.prototype.destroy.call(this)},r.onFragLoading=function(e){var t=e.frag,n=t.type,i=this.loaders,r=this.hls.config,a=r.fLoader,o=r.loader;t.loaded=0;var s,u,d,h=i[n];h&&(c.logger.warn("abort previous fragment loader for type: "+n),h.abort()),h=i[n]=t.loader=r.fLoader?new a(r):new o(r),s={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1};var f=t.byteRangeStartOffset,p=t.byteRangeEndOffset;Object(l.isFiniteNumber)(f)&&Object(l.isFiniteNumber)(p)&&(s.rangeStart=f,s.rangeEnd=p),u={timeout:r.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:r.fragLoadingMaxRetryTimeout},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},h.load(s,u,d)},r.loadsuccess=function(e,t,n,i){void 0===i&&(i=null);var r=e.data,a=n.frag;a.loader=void 0,this.loaders[a.type]=void 0,this.hls.trigger(u.default.FRAG_LOADED,{payload:r,frag:a,stats:t,networkDetails:i})},r.loaderror=function(e,t,n){void 0===n&&(n=null);var i=t.frag,r=i.loader;r&&r.abort(),this.loaders[i.type]=void 0,this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t.frag,response:e,networkDetails:n})},r.loadtimeout=function(e,t,n){void 0===n&&(n=null);var i=t.frag,r=i.loader;r&&r.abort(),this.loaders[i.type]=void 0,this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t.frag,networkDetails:n})},r.loadprogress=function(e,t,n,i){void 0===i&&(i=null);var r=t.frag;r.loaded=e.loaded,this.hls.trigger(u.default.FRAG_LOAD_PROGRESS,{frag:r,stats:e,networkDetails:i})},i}(h),M=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.KEY_LOADING)||this).loaders={},n.decryptkey=null,n.decrypturl=null,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){for(var t in this.loaders){var n=this.loaders[t];n&&n.destroy()}this.loaders={},e.prototype.destroy.call(this)},r.onKeyLoading=function(e){var t=e.frag,n=t.type,i=this.loaders[n];if(t.decryptdata){var r=t.decryptdata.uri;if(r!==this.decrypturl||null===this.decryptkey){var a=this.hls.config;if(i&&(c.logger.warn("abort previous key loader for type:"+n),i.abort()),!r)return void c.logger.warn("key uri is falsy");t.loader=this.loaders[n]=new a.loader(a),this.decrypturl=r,this.decryptkey=null;var o={url:r,frag:t,responseType:"arraybuffer"},s={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.loader.load(o,s,l)}else this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(u.default.KEY_LOADED,{frag:t}))}else c.logger.warn("Missing decryption data on fragment in onKeyLoading")},r.loadsuccess=function(e,t,n){var i=n.frag;i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=void 0,delete this.loaders[i.type],this.hls.trigger(u.default.KEY_LOADED,{frag:i})):c.logger.error("after key load, decryptdata unset")},r.loaderror=function(e,t){var n=t.frag,i=n.loader;i&&i.abort(),delete this.loaders[n.type],this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:n,response:e})},r.loadtimeout=function(e,t){var n=t.frag,i=n.loader;i&&i.abort(),delete this.loaders[n.type],this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:n})},i}(h),F="NOT_LOADED",B="APPENDING",U="PARTIAL",j="OK",V=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.BUFFER_APPENDED,u.default.FRAG_BUFFERED,u.default.FRAG_LOADED)||this).bufferPadding=.2,n.fragments=Object.create(null),n.timeRanges=Object.create(null),n.config=t.config,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.config=null,h.prototype.destroy.call(this),e.prototype.destroy.call(this)},r.getBufferedFrag=function(e,t){var n=this.fragments,i=Object.keys(n).filter((function(i){var r=n[i];if(r.body.type!==t)return!1;if(!r.buffered)return!1;var a=r.body;return a.startPTS<=e&&e<=a.endPTS}));if(0===i.length)return null;var r=i.pop();return n[r].body},r.detectEvictedFragments=function(e,t){var n,i,r=this;Object.keys(this.fragments).forEach((function(a){var o=r.fragments[a];if(!0===o.buffered){var s=o.range[e];if(s){n=s.time;for(var l=0;l<n.length;l++)if(i=n[l],!1===r.isTimeBuffered(i.startPTS,i.endPTS,t)){r.removeFragment(o.body);break}}}}))},r.detectPartialFragments=function(e){var t=this,n=this.getFragmentKey(e),i=this.fragments[n];i&&(i.buffered=!0,Object.keys(this.timeRanges).forEach((function(n){if(e.hasElementaryStream(n)){var r=t.timeRanges[n];i.range[n]=t.getBufferedTimes(e.startPTS,e.endPTS,r)}})))},r.getBufferedTimes=function(e,t,n){for(var i,r,a=[],o=!1,s=0;s<n.length;s++){if(i=n.start(s)-this.bufferPadding,r=n.end(s)+this.bufferPadding,e>=i&&t<=r){a.push({startPTS:Math.max(e,n.start(s)),endPTS:Math.min(t,n.end(s))});break}if(e<r&&t>i)a.push({startPTS:Math.max(e,n.start(s)),endPTS:Math.min(t,n.end(s))}),o=!0;else if(t<=i)break}return{time:a,partial:o}},r.getFragmentKey=function(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn},r.getPartialFragment=function(e){var t,n,i,r=this,a=null,o=0;return Object.keys(this.fragments).forEach((function(s){var l=r.fragments[s];r.isPartial(l)&&(n=l.body.startPTS-r.bufferPadding,i=l.body.endPTS+r.bufferPadding,e>=n&&e<=i&&(t=Math.min(e-n,i-e),o<=t&&(a=l.body,o=t)))})),a},r.getState=function(e){var t=this.getFragmentKey(e),n=this.fragments[t],i=F;return void 0!==n&&(i=n.buffered?!0===this.isPartial(n)?U:j:B),i},r.isPartial=function(e){return!0===e.buffered&&(void 0!==e.range.video&&!0===e.range.video.partial||void 0!==e.range.audio&&!0===e.range.audio.partial)},r.isTimeBuffered=function(e,t,n){for(var i,r,a=0;a<n.length;a++){if(i=n.start(a)-this.bufferPadding,r=n.end(a)+this.bufferPadding,e>=i&&t<=r)return!0;if(t<=i)return!1}return!1},r.onFragLoaded=function(e){var t=e.frag;Object(l.isFiniteNumber)(t.sn)&&!t.bitrateTest&&(this.fragments[this.getFragmentKey(t)]={body:t,range:Object.create(null),buffered:!1})},r.onBufferAppended=function(e){var t=this;this.timeRanges=e.timeRanges,Object.keys(this.timeRanges).forEach((function(e){var n=t.timeRanges[e];t.detectEvictedFragments(e,n)}))},r.onFragBuffered=function(e){this.detectPartialFragments(e.frag)},r.hasFragment=function(e){var t=this.getFragmentKey(e);return void 0!==this.fragments[t]},r.removeFragment=function(e){var t=this.getFragmentKey(e);delete this.fragments[t]},r.removeAllFragments=function(){this.fragments=Object.create(null)},i}(h),K={search:function(e,t){for(var n=0,i=e.length-1,r=null,a=null;n<=i;){var o=t(a=e[r=(n+i)/2|0]);if(o>0)n=r+1;else{if(!(o<0))return a;i=r-1}}return null}},G=function(){function e(){}return e.isBuffered=function(e,t){try{if(e)for(var n=e.buffered,i=0;i<n.length;i++)if(t>=n.start(i)&&t<=n.end(i))return!0}catch(e){}return!1},e.bufferInfo=function(e,t,n){try{if(e){var i,r=e.buffered,a=[];for(i=0;i<r.length;i++)a.push({start:r.start(i),end:r.end(i)});return this.bufferedInfo(a,t,n)}}catch(e){}return{len:0,start:t,end:t,nextStart:void 0}},e.bufferedInfo=function(e,t,n){e.sort((function(e,t){var n=e.start-t.start;return n||t.end-e.end}));var i=[];if(n)for(var r=0;r<e.length;r++){var a=i.length;if(a){var o=i[a-1].end;e[r].start-o<n?e[r].end>o&&(i[a-1].end=e[r].end):i.push(e[r])}else i.push(e[r])}else i=e;for(var s,l=0,u=t,c=t,d=0;d<i.length;d++){var h=i[d].start,f=i[d].end;if(t+n>=h&&t<f)u=h,l=(c=f)-t;else if(t+n<h){s=h;break}}return{len:l,start:u,end:c,nextStart:s}},e}(),Y=n("./node_modules/eventemitter3/index.js"),H=n("./node_modules/webworkify-webpack/index.js"),$=n("./src/demux/demuxer-inline.js");function z(){return window.MediaSource||window.WebKitMediaSource}var W=n("./src/utils/get-self-scope.js"),q=function(e){var t,n;function i(){return e.apply(this,arguments)||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i.prototype.trigger=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.emit.apply(this,[e,e].concat(n))},i}(Y.EventEmitter),X=Object(W.getSelfScope)(),Z=z()||{isTypeSupported:function(){return!1}},Q=function(){function e(e,t){var n=this;this.hls=e,this.id=t;var i=this.observer=new q,r=e.config,a=function(t,i){(i=i||{}).frag=n.frag,i.id=n.id,e.trigger(t,i)};i.on(u.default.FRAG_DECRYPTED,a),i.on(u.default.FRAG_PARSING_INIT_SEGMENT,a),i.on(u.default.FRAG_PARSING_DATA,a),i.on(u.default.FRAG_PARSED,a),i.on(u.default.ERROR,a),i.on(u.default.FRAG_PARSING_METADATA,a),i.on(u.default.FRAG_PARSING_USERDATA,a),i.on(u.default.INIT_PTS_FOUND,a);var o={mp4:Z.isTypeSupported("video/mp4"),mpeg:Z.isTypeSupported("audio/mpeg"),mp3:Z.isTypeSupported('audio/mp4; codecs="mp3"')},l=navigator.vendor;if(r.enableWorker&&"undefined"!=typeof Worker){var d;c.logger.log("demuxing in webworker");try{d=this.w=H(/*! ../demux/demuxer-worker.js */"./src/demux/demuxer-worker.js"),this.onwmsg=this.onWorkerMessage.bind(this),d.addEventListener("message",this.onwmsg),d.onerror=function(t){e.trigger(u.default.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},d.postMessage({cmd:"init",typeSupported:o,vendor:l,id:t,config:JSON.stringify(r)})}catch(e){c.logger.warn("Error in worker:",e),c.logger.error("Error while initializing DemuxerWorker, fallback on DemuxerInline"),d&&X.URL.revokeObjectURL(d.objectURL),this.demuxer=new $.default(i,o,r,l),this.w=void 0}}else this.demuxer=new $.default(i,o,r,l)}var t=e.prototype;return t.destroy=function(){var e=this.w;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.w=null;else{var t=this.demuxer;t&&(t.destroy(),this.demuxer=null)}var n=this.observer;n&&(n.removeAllListeners(),this.observer=null)},t.push=function(e,t,n,i,r,a,o,s){var u=this.w,d=Object(l.isFiniteNumber)(r.startPTS)?r.startPTS:r.start,h=r.decryptdata,f=this.frag,p=!(f&&r.cc===f.cc),g=!(f&&r.level===f.level),v=f&&r.sn===f.sn+1,m=!g&&v;if(p&&c.logger.log(this.id+":discontinuity detected"),g&&c.logger.log(this.id+":switch detected"),this.frag=r,u)u.postMessage({cmd:"demux",data:e,decryptdata:h,initSegment:t,audioCodec:n,videoCodec:i,timeOffset:d,discontinuity:p,trackSwitch:g,contiguous:m,duration:a,accurateTimeOffset:o,defaultInitPTS:s},e instanceof ArrayBuffer?[e]:[]);else{var y=this.demuxer;y&&y.push(e,h,t,n,i,d,p,g,m,a,o,s)}},t.onWorkerMessage=function(e){var t=e.data,n=this.hls;switch(t.event){case"init":X.URL.revokeObjectURL(this.w.objectURL);break;case u.default.FRAG_PARSING_DATA:t.data.data1=new Uint8Array(t.data1),t.data2&&(t.data.data2=new Uint8Array(t.data2));default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,n.trigger(t.event,t.data)}},e}();function J(e,t,n){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(n);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(n)}}function ee(e,t,n){var i=e[t],r=e[n],a=r.startPTS;Object(l.isFiniteNumber)(a)?n>t?(i.duration=a-i.start,i.duration<0&&c.logger.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(r.duration=i.start-a,r.duration<0&&c.logger.warn("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!")):r.start=n>t?i.start+i.duration:Math.max(i.start-r.duration,0)}function te(e,t,n,i,r,a){var o=n;if(Object(l.isFiniteNumber)(t.startPTS)){var s=Math.abs(t.startPTS-n);Object(l.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(s,t.deltaPTS):t.deltaPTS=s,o=Math.max(n,t.startPTS),n=Math.min(n,t.startPTS),i=Math.max(i,t.endPTS),r=Math.min(r,t.startDTS),a=Math.max(a,t.endDTS)}var u=n-t.start;t.start=t.startPTS=n,t.maxStartPTS=o,t.endPTS=i,t.startDTS=r,t.endDTS=a,t.duration=i-n;var c,d,h,f=t.sn;if(!e||f<e.startSN||f>e.endSN)return 0;for(c=f-e.startSN,(d=e.fragments)[c]=t,h=c;h>0;h--)ee(d,h,h-1);for(h=c;h<d.length-1;h++)ee(d,h,h+1);return e.PTSKnown=!0,u}function ne(e,t){t.initSegment&&e.initSegment&&(t.initSegment=e.initSegment);var n,i=0;if(ie(e,t,(function(e,r){i=e.cc-r.cc,Object(l.isFiniteNumber)(e.startPTS)&&(r.start=r.startPTS=e.startPTS,r.endPTS=e.endPTS,r.duration=e.duration,r.backtracked=e.backtracked,r.dropped=e.dropped,n=r),t.PTSKnown=!0})),t.PTSKnown){if(i){c.logger.log("discontinuity sliding from playlist, take drift into account");for(var r=t.fragments,a=0;a<r.length;a++)r[a].cc+=i}n?te(t,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):function(e,t){var n=t.startSN-e.startSN,i=e.fragments,r=t.fragments;if(!(n<0||n>i.length))for(var a=0;a<r.length;a++)r[a].start+=i[n].start}(e,t),t.PTSKnown=e.PTSKnown}}function ie(e,t,n){if(e&&t)for(var i=Math.max(e.startSN,t.startSN)-t.startSN,r=Math.min(e.endSN,t.endSN)-t.startSN,a=t.startSN-e.startSN,o=i;o<=r;o++){var s=e.fragments[a+o],l=t.fragments[o];if(!s||!l)break;n(s,l,o)}}function re(e,t,n){var i=1e3*(t.averagetargetduration?t.averagetargetduration:t.targetduration),r=i/2;return e&&t.endSN===e.endSN&&(i=r),n&&(i=Math.max(r,i-(window.performance.now()-n))),Math.round(i)}var ae={toString:function(e){for(var t="",n=e.length,i=0;i<n;i++)t+="["+e.start(i).toFixed(3)+","+e.end(i).toFixed(3)+"]";return t}};function oe(e,t){t.fragments.forEach((function(t){if(t){var n=t.start+e;t.start=t.startPTS=n,t.endPTS=n+t.duration}})),t.PTSKnown=!0}function se(e,t,n){!function(e,t,n){if(function(e,t,n){var i=!1;return t&&t.details&&n&&(n.endCC>n.startCC||e&&e.cc<n.startCC)&&(i=!0),i}(e,n,t)){var i=function(e,t){var n=e.fragments,i=t.fragments;if(i.length&&n.length){var r=function(e,t){for(var n=null,i=0;i<e.length;i+=1){var r=e[i];if(r&&r.cc===t){n=r;break}}return n}(n,i[0].cc);if(r&&(!r||r.startPTS))return r;c.logger.log("No frag in previous level to align on")}else c.logger.log("No fragments to align")}(n.details,t);i&&(c.logger.log("Adjusting PTS using last level due to CC increase within current level"),oe(i.start,t))}}(e,n,t),!n.PTSKnown&&t&&function(e,t){if(t&&t.fragments.length){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;var n=t.fragments[0].programDateTime,i=(e.fragments[0].programDateTime-n)/1e3+t.fragments[0].start;Object(l.isFiniteNumber)(i)&&(c.logger.log("adjusting PTS using programDateTime delta, sliding:"+i.toFixed(3)),oe(i,e))}}(n,t.details)}function le(e,t,n){if(null===t||!Array.isArray(e)||!e.length||!Object(l.isFiniteNumber)(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;n=n||0;for(var i=0;i<e.length;++i){var r=e[i];if(de(t,n,r))return r}return null}function ue(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=0);var r=e?t[e.sn-t[0].sn+1]:null;return r&&!ce(n,i,r)?r:K.search(t,ce.bind(null,n,i))}function ce(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0);var i=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-i<=e?1:n.start-i>e&&n.start?-1:0}function de(e,t,n){var i=1e3*Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return(n.endProgramDateTime||0)-i>e}var he=function(){function e(e,t,n,i){this.config=e,this.media=t,this.fragmentTracker=n,this.hls=i,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1}var t=e.prototype;return t.poll=function(e){var t=this.config,n=this.media,i=this.stalled,r=n.currentTime,a=n.seeking,o=this.seeking&&!a,s=!this.seeking&&a;if(this.seeking=a,r===e){if((s||o)&&(this.stalled=null),!n.paused&&!n.ended&&0!==n.playbackRate&&n.buffered.length){var l=G.bufferInfo(n,r,0),u=l.len>0,d=l.nextStart||0;if(u||d){if(a){if(l.len>2||!d||d-r>2)return;this.moved=!1}if(!this.moved&&this.stalled){var h=Math.max(d,l.start||0)-r;if(h>0&&h<=2)return void this._trySkipBufferHole(null)}var f=self.performance.now();if(null!==i){var p=f-i;!a&&p>=250&&this._reportStall(l.len);var g=G.bufferInfo(n,r,t.maxBufferHole);this._tryFixBufferStall(g,p)}else this.stalled=f}}}else if(this.moved=!0,null!==i){if(this.stallReported){var v=self.performance.now()-i;c.logger.warn("playback not stuck anymore @"+r+", after "+Math.round(v)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},t._tryFixBufferStall=function(e,t){var n=this.config,i=this.fragmentTracker,r=this.media.currentTime,a=i.getPartialFragment(r);a&&this._trySkipBufferHole(a)||e.len>n.maxBufferHole&&t>1e3*n.highBufferWatchdogPeriod&&(c.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,n=this.media;this.stallReported||(this.stallReported=!0,c.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer"),t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,n=this.hls,i=this.media,r=i.currentTime,a=0,o=0;o<i.buffered.length;o++){var l=i.buffered.start(o);if(r+t.maxBufferHole>=a&&r<l){var d=Math.max(l+.05,i.currentTime+.1);return c.logger.warn("skipping hole, adjusting currentTime from "+r+" to "+d),this.moved=!0,this.stalled=null,i.currentTime=d,e&&n.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+r+" to "+d,frag:e}),d}a=i.buffered.end(o)}return 0},t._tryNudgeBuffer=function(){var e=this.config,t=this.hls,n=this.media,i=n.currentTime,r=(this.nudgeRetry||0)+1;if(this.nudgeRetry=r,r<e.nudgeMaxRetry){var a=i+r*e.nudgeOffset;c.logger.warn("Nudging 'currentTime' from "+i+" to "+a),n.currentTime=a,t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else c.logger.error("Playhead still not moving while enough data buffered @"+i+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},e}();function fe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var pe=function(e){var t,n;function i(t){for(var n,i=arguments.length,r=new Array(i>1?i-1:0),a=1;a<i;a++)r[a-1]=arguments[a];return(n=e.call.apply(e,[this,t].concat(r))||this)._boundTick=void 0,n._tickTimer=null,n._tickInterval=null,n._tickCallCount=0,n._boundTick=n.tick.bind(fe(n)),n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},r.hasInterval=function(){return!!this._tickInterval},r.hasNextTick=function(){return!!this._tickTimer},r.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},r.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},r.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},r.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&(this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)),this._tickCallCount=0)},r.doTick=function(){},i}(h),ge="STOPPED",ve="STARTING",me="IDLE",ye="PAUSED",Ae="KEY_LOADING",be="FRAG_LOADING",Ee="FRAG_LOADING_WAITING_RETRY",Te="WAITING_TRACK",ke="PARSING",_e="PARSED",Se="BUFFER_FLUSHING",Ce="ENDED",we="ERROR",Re="WAITING_INIT_PTS",Oe="WAITING_LEVEL",Le=function(e){var t,n;function i(){return e.apply(this,arguments)||this}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.doTick=function(){},r.startLoad=function(){},r.stopLoad=function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragmentTracker.removeFragment(e)),this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=ge},r._streamEnded=function(e,t){var n=this.fragCurrent,i=this.fragmentTracker;if(!t.live&&n&&!n.backtracked&&n.sn===t.endSN&&!e.nextStart){var r=i.getState(n);return r===U||r===j}return!1},r.onMediaSeeking=function(){var e=this.config,t=this.media,n=this.mediaBuffer,i=this.state,r=t?t.currentTime:null,a=G.bufferInfo(n||t,r,this.config.maxBufferHole);if(Object(l.isFiniteNumber)(r)&&c.logger.log("media seeking to "+r.toFixed(3)),i===be){var o=this.fragCurrent;if(0===a.len&&o){var s=e.maxFragLookUpTolerance,u=o.start-s,d=o.start+o.duration+s;r<u||r>d?(o.loader&&(c.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),o.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=me):c.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else i===Ce&&(0===a.len&&(this.fragPrevious=null,this.fragCurrent=null),this.state=me);t&&(this.lastCurrentTime=r),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=r),this.tick()},r.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},r.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this)},r.onHandlerDestroyed=function(){this.state=ge,this.fragmentTracker=null},r.computeLivePosition=function(e,t){var n=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;return e+Math.max(0,t.totalduration-n)},i}(pe);function De(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ie,Pe=function(e){var t,n;function i(t,n){var i;return(i=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.MANIFEST_LOADING,u.default.MANIFEST_PARSED,u.default.LEVEL_LOADED,u.default.KEY_LOADED,u.default.FRAG_LOADED,u.default.FRAG_LOAD_EMERGENCY_ABORTED,u.default.FRAG_PARSING_INIT_SEGMENT,u.default.FRAG_PARSING_DATA,u.default.FRAG_PARSED,u.default.ERROR,u.default.AUDIO_TRACK_SWITCHING,u.default.AUDIO_TRACK_SWITCHED,u.default.BUFFER_CREATED,u.default.BUFFER_APPENDED,u.default.BUFFER_FLUSHED)||this).fragmentTracker=n,i.config=t.config,i.audioCodecSwap=!1,i._state=ge,i.stallReported=!1,i.gapController=null,i.altAudio=!1,i}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,o,d,h=i.prototype;return h.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,n=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var i=n.startLevel;-1===i&&(i=0,this.bitrateTest=!0),this.level=n.nextLoadLevel=i,this.loadedmetadata=!1}t>0&&-1===e&&(c.logger.log("override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=me,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this.forceStartLoad=!0,this.state=ge},h.stopLoad=function(){this.forceStartLoad=!1,e.prototype.stopLoad.call(this)},h.doTick=function(){switch(this.state){case Se:this.fragLoadError=0;break;case me:this._doTickIdle();break;case Oe:var e=this.levels[this.level];e&&e.details&&(this.state=me);break;case Ee:var t=window.performance.now(),n=this.retryDate;(!n||t>=n||this.media&&this.media.seeking)&&(c.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=me)}this._checkBuffer(),this._checkFragmentChanged()},h._doTickIdle=function(){var e=this.hls,t=e.config,n=this.media;if(void 0!==this.levelLastLoaded&&(n||!this.startFragRequested&&t.startFragPrefetch)){var i;i=this.loadedmetadata?n.currentTime:this.nextLoadPosition;var r=e.nextLoadLevel,a=this.levels[r];if(a){var o,s=a.bitrate;o=s?Math.max(8*t.maxBufferSize/s,t.maxBufferLength):t.maxBufferLength,o=Math.min(o,t.maxMaxBufferLength);var l=G.bufferInfo(this.mediaBuffer?this.mediaBuffer:n,i,t.maxBufferHole),d=l.len;if(!(d>=o)){c.logger.trace("buffer length of "+d.toFixed(3)+" is below max of "+o.toFixed(3)+". checking for more payload ..."),this.level=e.nextLoadLevel=r;var h=a.details;if(!h||h.live&&this.levelLastLoaded!==r)this.state=Oe;else{if(this._streamEnded(l,h)){var f={};return this.altAudio&&(f.type="video"),this.hls.trigger(u.default.BUFFER_EOS,f),void(this.state=Ce)}this._fetchPayloadOrEos(i,l,h)}}}}},h._fetchPayloadOrEos=function(e,t,n){var i=this.fragPrevious,r=this.level,a=n.fragments,o=a.length;if(0!==o){var s,l=a[0].start,u=a[o-1].start+a[o-1].duration,d=t.end;if(n.initSegment&&!n.initSegment.data)s=n.initSegment;else if(n.live){var h=this.config.initialLiveManifestSize;if(o<h)return void c.logger.warn("Can not start playback of a level, reason: not enough fragments "+o+" < "+h);if(null===(s=this._ensureFragmentAtLivePoint(n,d,l,u,i,a,o)))return}else d<l&&(s=a[0]);s||(s=this._findFragment(l,i,o,a,d,u,n)),s&&(s.encrypted?(c.logger.log("Loading key for "+s.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+r),this._loadKey(s)):(c.logger.log("Loading "+s.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+r+", currentTime:"+e.toFixed(3)+",bufferEnd:"+d.toFixed(3)),this._loadFragment(s)))}},h._ensureFragmentAtLivePoint=function(e,t,n,i,r,a,o){var s,l=this.hls.config,u=this.media,d=void 0!==l.liveMaxLatencyDuration?l.liveMaxLatencyDuration:l.liveMaxLatencyDurationCount*e.targetduration;if(t<Math.max(n-l.maxFragLookUpTolerance,i-d)){var h=this.liveSyncPosition=this.computeLivePosition(n,e);t=h,u&&!u.paused&&u.readyState&&u.duration>h&&h>u.currentTime&&(c.logger.log("buffer end: "+t.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+h.toFixed(3)),u.currentTime=h),this.nextLoadPosition=h}if(e.PTSKnown&&t>i&&u&&u.readyState)return null;if(this.startFragRequested&&!e.PTSKnown){if(r)if(e.hasProgramDateTime)c.logger.log("live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),s=le(a,r.endProgramDateTime,l.maxFragLookUpTolerance);else{var f=r.sn+1;if(f>=e.startSN&&f<=e.endSN){var p=a[f-e.startSN];r.cc===p.cc&&(s=p,c.logger.log("live playlist, switching playlist, load frag with next SN: "+s.sn))}s||(s=K.search(a,(function(e){return r.cc-e.cc})))&&c.logger.log("live playlist, switching playlist, load frag with same CC: "+s.sn)}s||(s=a[Math.min(o-1,Math.round(o/2))],c.logger.log("live playlist, switching playlist, unknown, load middle frag : "+s.sn))}return s},h._findFragment=function(e,t,n,i,r,a,o){var s,l=this.hls.config;if(s=r<a?ue(t,i,r,r>a-l.maxFragLookUpTolerance?0:l.maxFragLookUpTolerance):i[n-1]){var u=s.sn-o.startSN,d=t&&s.level===t.level,h=i[u-1],f=i[u+1];if(t&&s.sn===t.sn)if(d&&!s.backtracked)if(s.sn<o.endSN){var p=t.deltaPTS;p&&p>l.maxBufferHole&&t.dropped&&u?(s=h,c.logger.warn("Previous fragment was dropped with large PTS gap between audio and video. Maybe fragment is not starting with a keyframe? Loading previous one to try to overcome this")):(s=f,c.logger.log("Re-loading fragment with SN: "+s.sn))}else s=null;else s.backtracked&&(f&&f.backtracked?(c.logger.warn("Already backtracked from fragment "+f.sn+", will not backtrack to fragment "+s.sn+". Loading fragment "+f.sn),s=f):(c.logger.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),s.dropped=0,h?(s=h).backtracked=!0:u&&(s=null)))}return s},h._loadKey=function(e){this.state=Ae,this.hls.trigger(u.default.KEY_LOADING,{frag:e})},h._loadFragment=function(e){var t=this.fragmentTracker.getState(e);this.fragCurrent=e,"initSegment"!==e.sn&&(this.startFragRequested=!0),Object(l.isFiniteNumber)(e.sn)&&!e.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),e.backtracked||t===F||t===U?(e.autoLevel=this.hls.autoLevelEnabled,e.bitrateTest=this.bitrateTest,this.hls.trigger(u.default.FRAG_LOADING,{frag:e}),this.demuxer||(this.demuxer=new Q(this.hls,"main")),this.state=be):t===B&&this._reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e)},h.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,a.MAIN)},h.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.endPTS+.5):null},h._checkFragmentChanged=function(){var e,t,n=this.media;if(n&&n.readyState&&!1===n.seeking&&((t=n.currentTime)>this.lastCurrentTime&&(this.lastCurrentTime=t),G.isBuffered(n,t)?e=this.getBufferedFrag(t):G.isBuffered(n,t+.1)&&(e=this.getBufferedFrag(t+.1)),e)){var i=e;if(i!==this.fragPlaying){this.hls.trigger(u.default.FRAG_CHANGED,{frag:i});var r=i.level;this.fragPlaying&&this.fragPlaying.level===r||this.hls.trigger(u.default.LEVEL_SWITCHED,{level:r}),this.fragPlaying=i}}},h.immediateLevelSwitch=function(){if(c.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var e,t=this.media;t?(e=t.paused,t.pause()):e=!0,this.previouslyPaused=e}var n=this.fragCurrent;n&&n.loader&&n.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},h.immediateLevelSwitchEnd=function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,G.isBuffered(e,e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())},h.nextLevelSwitch=function(){var e=this.media;if(e&&e.readyState){var t,n,i;if((n=this.getBufferedFrag(e.currentTime))&&n.startPTS>1&&this.flushMainBuffer(0,n.startPTS-1),e.paused)t=0;else{var r=this.hls.nextLoadLevel,a=this.levels[r],o=this.fragLastKbps;t=o&&this.fragCurrent?this.fragCurrent.duration*a.bitrate/(1e3*o)+1:0}if((i=this.getBufferedFrag(e.currentTime+t))&&(i=this.followingBufferedFrag(i))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(i.maxStartPTS,Number.POSITIVE_INFINITY)}}},h.flushMainBuffer=function(e,t){this.state=Se;var n={startOffset:e,endOffset:t};this.altAudio&&(n.type="video"),this.hls.trigger(u.default.BUFFER_FLUSHING,n)},h.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);var n=this.config;this.levels&&n.autoStartLoad&&this.hls.startLoad(n.startPosition),this.gapController=new he(n,t,this.fragmentTracker,this.hls)},h.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(c.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.levels;t&&t.forEach((function(e){e.details&&e.details.fragments.forEach((function(e){e.backtracked=void 0}))})),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.fragmentTracker.removeAllFragments(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},h.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:void 0;Object(l.isFiniteNumber)(t)&&c.logger.log("media seeked to "+t.toFixed(3)),this.tick()},h.onManifestLoading=function(){c.logger.log("trigger BUFFER_RESET"),this.hls.trigger(u.default.BUFFER_RESET),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0},h.onManifestParsed=function(e){var t,n=!1,i=!1;e.levels.forEach((function(e){(t=e.audioCodec)&&(-1!==t.indexOf("mp4a.40.2")&&(n=!0),-1!==t.indexOf("mp4a.40.5")&&(i=!0))})),this.audioCodecSwitch=n&&i,this.audioCodecSwitch&&c.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.altAudio=e.altAudio,this.levels=e.levels,this.startFragRequested=!1;var r=this.config;(r.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(r.startPosition)},h.onLevelLoaded=function(e){var t=e.details,n=e.level,i=this.levels[this.levelLastLoaded],r=this.levels[n],a=t.totalduration,o=0;if(c.logger.log("level "+n+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),t.live){var s=r.details;s&&t.fragments.length>0?(ne(s,t),o=t.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,s),t.PTSKnown&&Object(l.isFiniteNumber)(o)?c.logger.log("live playlist sliding:"+o.toFixed(3)):(c.logger.log("live playlist - outdated PTS, unknown sliding"),se(this.fragPrevious,i,t))):(c.logger.log("live playlist - first load, unknown sliding"),t.PTSKnown=!1,se(this.fragPrevious,i,t))}else t.PTSKnown=!1;if(r.details=t,this.levelLastLoaded=n,this.hls.trigger(u.default.LEVEL_UPDATED,{details:t,level:n}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var d=t.startTimeOffset;Object(l.isFiniteNumber)(d)?(d<0&&(c.logger.log("negative start time offset "+d+", count from end of last fragment"),d=o+a+d),c.logger.log("start time offset found in playlist, adjust startPosition to "+d),this.startPosition=d):t.live?(this.startPosition=this.computeLivePosition(o,t),c.logger.log("configure startPosition to "+this.startPosition)):this.startPosition=0,this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===Oe&&(this.state=me),this.tick()},h.onKeyLoaded=function(){this.state===Ae&&(this.state=me,this.tick())},h.onFragLoaded=function(e){var t=this.fragCurrent,n=this.hls,i=this.levels,r=this.media,a=e.frag;if(this.state===be&&t&&"main"===a.type&&a.level===t.level&&a.sn===t.sn){var o=e.stats,s=i[t.level],l=s.details;if(this.bitrateTest=!1,this.stats=o,c.logger.log("Loaded "+t.sn+" of ["+l.startSN+" ,"+l.endSN+"],level "+t.level),a.bitrateTest&&n.nextLoadLevel)this.state=me,this.startFragRequested=!1,o.tparsed=o.tbuffered=window.performance.now(),n.trigger(u.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else if("initSegment"===a.sn)this.state=me,o.tparsed=o.tbuffered=window.performance.now(),l.initSegment.data=e.payload,n.trigger(u.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else{c.logger.log("Parsing "+t.sn+" of ["+l.startSN+" ,"+l.endSN+"],level "+t.level+", cc "+t.cc),this.state=ke,this.pendingBuffering=!0,this.appended=!1,a.bitrateTest&&(a.bitrateTest=!1,this.fragmentTracker.onFragLoaded({frag:a}));var d=!(r&&r.seeking)&&(l.PTSKnown||!l.live),h=l.initSegment?l.initSegment.data:[],f=this._getAudioCodec(s);(this.demuxer=this.demuxer||new Q(this.hls,"main")).push(e.payload,h,f,s.videoCodec,t,l.totalduration,d)}}this.fragLoadError=0},h.onFragParsingInitSegment=function(e){var t=this.fragCurrent,n=e.frag;if(t&&"main"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===ke){var i,r,a=e.tracks;if(a.audio&&this.altAudio&&delete a.audio,r=a.audio){var o=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(c.logger.log("swapping playlist audio codec"),o=-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==r.metadata.channelCount&&-1===s.indexOf("firefox")&&(o="mp4a.40.5"),-1!==s.indexOf("android")&&"audio/mpeg"!==r.container&&(o="mp4a.40.2",c.logger.log("Android: force audio codec to "+o)),r.levelCodec=o,r.id=e.id}for(i in(r=a.video)&&(r.levelCodec=this.levels[this.level].videoCodec,r.id=e.id),this.hls.trigger(u.default.BUFFER_CODECS,a),a){r=a[i],c.logger.log("main track:"+i+",container:"+r.container+",codecs[level/parsed]=["+r.levelCodec+"/"+r.codec+"]");var l=r.initSegment;l&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(u.default.BUFFER_APPENDING,{type:i,data:l,parent:"main",content:"initSegment"}))}this.tick()}},h.onFragParsingData=function(e){var t=this,n=this.fragCurrent,i=e.frag;if(n&&"main"===e.id&&i.sn===n.sn&&i.level===n.level&&("audio"!==e.type||!this.altAudio)&&this.state===ke){var r=this.levels[this.level],a=n;if(Object(l.isFiniteNumber)(e.endPTS)||(e.endPTS=e.startPTS+n.duration,e.endDTS=e.startDTS+n.duration),!0===e.hasAudio&&a.addElementaryStream(g.AUDIO),!0===e.hasVideo&&a.addElementaryStream(g.VIDEO),c.logger.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0)),"video"===e.type)if(a.dropped=e.dropped,a.dropped)if(a.backtracked)c.logger.warn("Already backtracked on this fragment, appending with the gap",a.sn);else{var o=r.details;if(!o||a.sn!==o.startSN)return c.logger.warn("missing video frame(s), backtracking fragment",a.sn),this.fragmentTracker.removeFragment(a),a.backtracked=!0,this.nextLoadPosition=e.startPTS,this.state=me,this.fragPrevious=a,void this.tick();c.logger.warn("missing video frame(s) on first frag, appending with gap",a.sn)}else a.backtracked=!1;var s=te(r.details,a,e.startPTS,e.endPTS,e.startDTS,e.endDTS),d=this.hls;d.trigger(u.default.LEVEL_PTS_UPDATED,{details:r.details,level:this.level,drift:s,type:e.type,start:e.startPTS,end:e.endPTS}),[e.data1,e.data2].forEach((function(n){n&&n.length&&t.state===ke&&(t.appended=!0,t.pendingBuffering=!0,d.trigger(u.default.BUFFER_APPENDING,{type:e.type,data:n,parent:"main",content:"data"}))})),this.tick()}},h.onFragParsed=function(e){var t=this.fragCurrent,n=e.frag;t&&"main"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===ke&&(this.stats.tparsed=window.performance.now(),this.state=_e,this._checkAppendedParsed())},h.onAudioTrackSwitching=function(e){var t=!!e.url,n=e.id;if(!t){if(this.mediaBuffer!==this.media){c.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i.loader&&(c.logger.log("switching to main audio track, cancel main fragment load"),i.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=me}var r=this.hls;r.trigger(u.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),r.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:n}),this.altAudio=!1}},h.onAudioTrackSwitched=function(e){var t=e.id,n=!!this.hls.audioTracks[t].url;if(n){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(c.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=n,this.tick()},h.onBufferCreated=function(e){var t,n,i=e.tracks,r=!1;for(var a in i){var o=i[a];"main"===o.id?(n=a,t=o,"video"===a&&(this.videoBuffer=i[a].buffer)):r=!0}r&&t?(c.logger.log("alternate track found, use "+n+".buffered to schedule main fragment loading"),this.mediaBuffer=t.buffer):this.mediaBuffer=this.media},h.onBufferAppended=function(e){if("main"===e.parent){var t=this.state;t!==ke&&t!==_e||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},h._checkAppendedParsed=function(){if(!(this.state!==_e||this.appended&&this.pendingBuffering)){var e=this.fragCurrent;if(e){var t=this.mediaBuffer?this.mediaBuffer:this.media;c.logger.log("main buffered : "+ae.toString(t.buffered)),this.fragPrevious=e;var n=this.stats;n.tbuffered=window.performance.now(),this.fragLastKbps=Math.round(8*n.total/(n.tbuffered-n.tfirst)),this.hls.trigger(u.default.FRAG_BUFFERED,{stats:n,frag:e,id:"main"}),this.state=me}this.tick()}},h.onError=function(e){var t=e.frag||this.fragCurrent;if(!t||"main"===t.type){var n=!!this.media&&G.isBuffered(this.media,this.media.currentTime)&&G.isBuffered(this.media,this.media.currentTime+.5);switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:if(!e.fatal)if(this.fragLoadError+1<=this.config.fragLoadingMaxRetry){var i=Math.min(Math.pow(2,this.fragLoadError)*this.config.fragLoadingRetryDelay,this.config.fragLoadingMaxRetryTimeout);c.logger.warn("mediaController: frag loading failed, retry in "+i+" ms"),this.retryDate=window.performance.now()+i,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.fragLoadError++,this.state=Ee}else c.logger.error("mediaController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=we;break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==we&&(e.fatal?(this.state=we,c.logger.warn("streamController: "+e.details+",switch to "+this.state+" state ...")):e.levelRetry||this.state!==Oe||(this.state=me));break;case s.ErrorDetails.BUFFER_FULL_ERROR:"main"!==e.parent||this.state!==ke&&this.state!==_e||(n?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=me):(c.logger.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},h._reduceMaxBufferLength=function(e){var t=this.config;return t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,c.logger.warn("main:reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},h._checkBuffer=function(){var e=this.media;if(e&&0!==e.readyState){var t=(this.mediaBuffer?this.mediaBuffer:e).buffered;!this.loadedmetadata&&t.length?(this.loadedmetadata=!0,this._seekToStartPos()):this.immediateSwitch?this.immediateLevelSwitchEnd():this.gapController.poll(this.lastCurrentTime,t)}},h.onFragLoadEmergencyAborted=function(){this.state=me,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},h.onBufferFlushed=function(){var e=this.mediaBuffer?this.mediaBuffer:this.media;e&&this.fragmentTracker.detectEvictedFragments(g.VIDEO,e.buffered),this.state=me,this.fragPrevious=null},h.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},h._seekToStartPos=function(){var e=this.media,t=e.currentTime,n=e.seeking?t:this.startPosition;t!==n&&n>=0&&(c.logger.log("target start position not buffered, seek to buffered.start(0) "+n+" from current time "+t+" "),e.currentTime=n)},h._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&(c.logger.log("swapping playlist audio codec"),t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),t},r=i,(o=[{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,c.logger.log("main stream-controller: "+t+"->"+e),this.hls.trigger(u.default.STREAM_STATE_TRANSITION,{previousState:t,nextState:e})}},get:function(){return this._state}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getBufferedFrag(e.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;return e?this.followingBufferedFrag(this.getBufferedFrag(e.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(e){this._liveSyncPosition=e}}])&&De(r.prototype,o),d&&De(r,d),i}(Le);function xe(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ne=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MANIFEST_LOADED,u.default.LEVEL_LOADED,u.default.AUDIO_TRACK_SWITCHED,u.default.FRAG_LOADED,u.default.ERROR)||this).canload=!1,n.currentLevelIndex=null,n.manualLevelIndex=-1,n.timer=null,Ie=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,l=i.prototype;return l.onHandlerDestroying=function(){this.clearTimer(),this.manualLevelIndex=-1},l.clearTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},l.startLoad=function(){var e=this._levels;this.canload=!0,this.levelRetryCount=0,e&&e.forEach((function(e){e.loadError=0;var t=e.details;t&&t.live&&(e.details=void 0)})),null!==this.timer&&this.loadLevel()},l.stopLoad=function(){this.canload=!1},l.onManifestLoaded=function(e){var t,n=[],i=[],r={},a=null,o=!1,l=!1;if(e.levels.forEach((function(e){var t=e.attrs;e.loadError=0,e.fragmentError=!1,o=o||!!e.videoCodec,l=l||!!e.audioCodec,Ie&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0),(a=r[e.bitrate])?a.url.push(e.url):(e.url=[e.url],e.urlId=0,r[e.bitrate]=e,n.push(e)),t&&(t.AUDIO&&(l=!0,J(a||e,"audio",t.AUDIO)),t.SUBTITLES&&J(a||e,"text",t.SUBTITLES))})),o&&l&&(n=n.filter((function(e){return!!e.videoCodec}))),n=n.filter((function(e){var t=e.audioCodec,n=e.videoCodec;return(!t||S(t,"audio"))&&(!n||S(n,"video"))})),e.audioTracks&&(i=e.audioTracks.filter((function(e){return!e.audioCodec||S(e.audioCodec,"audio")}))).forEach((function(e,t){e.id=t})),n.length>0){t=n[0].bitrate,n.sort((function(e,t){return e.bitrate-t.bitrate})),this._levels=n;for(var d=0;d<n.length;d++)if(n[d].bitrate===t){this._firstLevel=d,c.logger.log("manifest loaded,"+n.length+" level(s) found, first bitrate:"+t);break}this.hls.trigger(u.default.MANIFEST_PARSED,{levels:n,audioTracks:i,firstLevel:this._firstLevel,stats:e.stats,audio:l,video:o,altAudio:i.some((function(e){return!!e.url}))})}else this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},l.setLevelInternal=function(e){var t=this._levels,n=this.hls;if(e>=0&&e<t.length){if(this.clearTimer(),this.currentLevelIndex!==e){c.logger.log("switching to level "+e),this.currentLevelIndex=e;var i=t[e];i.level=e,n.trigger(u.default.LEVEL_SWITCHING,i)}var r=t[e],a=r.details;if(!a||a.live){var o=r.urlId;n.trigger(u.default.LEVEL_LOADING,{url:r.url[o],level:e,id:o})}}else n.trigger(u.default.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:!1,reason:"invalid level idx"})},l.onError=function(e){if(e.fatal)e.type===s.ErrorTypes.NETWORK_ERROR&&this.clearTimer();else{var t,n=!1,i=!1;switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:t=e.frag.level,i=!0;break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:t=e.context.level,n=!0;break;case s.ErrorDetails.REMUX_ALLOC_ERROR:t=e.level,n=!0}void 0!==t&&this.recoverLevel(e,t,n,i)}},l.recoverLevel=function(e,t,n,i){var r,a,o,s=this,l=this.hls.config,u=e.details,d=this._levels[t];if(d.loadError++,d.fragmentError=i,n){if(!(this.levelRetryCount+1<=l.levelLoadingMaxRetry))return c.logger.error("level controller, cannot recover from "+u+" error"),this.currentLevelIndex=null,this.clearTimer(),void(e.fatal=!0);a=Math.min(Math.pow(2,this.levelRetryCount)*l.levelLoadingRetryDelay,l.levelLoadingMaxRetryTimeout),this.timer=setTimeout((function(){return s.loadLevel()}),a),e.levelRetry=!0,this.levelRetryCount++,c.logger.warn("level controller, "+u+", retry in "+a+" ms, current retry count is "+this.levelRetryCount)}(n||i)&&((r=d.url.length)>1&&d.loadError<r?(d.urlId=(d.urlId+1)%r,d.details=void 0,c.logger.warn("level controller, "+u+" for level "+t+": switching to redundant URL-id "+d.urlId)):-1===this.manualLevelIndex?(o=0===t?this._levels.length-1:t-1,c.logger.warn("level controller, "+u+": switch to "+o),this.hls.nextAutoLevel=this.currentLevelIndex=o):i&&(c.logger.warn("level controller, "+u+": reload a fragment"),this.currentLevelIndex=null))},l.onFragLoaded=function(e){var t=e.frag;if(void 0!==t&&"main"===t.type){var n=this._levels[t.level];void 0!==n&&(n.fragmentError=!1,n.loadError=0,this.levelRetryCount=0)}},l.onLevelLoaded=function(e){var t=this,n=e.level,i=e.details;if(n===this.currentLevelIndex){var r=this._levels[n];if(r.fragmentError||(r.loadError=0,this.levelRetryCount=0),i.live){var a=re(r.details,i,e.stats.trequest);c.logger.log("live playlist, reload in "+Math.round(a)+" ms"),this.timer=setTimeout((function(){return t.loadLevel()}),a)}else this.clearTimer()}},l.onAudioTrackSwitched=function(e){var t=this.hls.audioTracks[e.id].groupId,n=this.hls.levels[this.currentLevelIndex];if(n&&n.audioGroupIds){for(var i=-1,r=0;r<n.audioGroupIds.length;r++)if(n.audioGroupIds[r]===t){i=r;break}i!==n.urlId&&(n.urlId=i,this.startLoad())}},l.loadLevel=function(){if(c.logger.debug("call to loadLevel"),null!==this.currentLevelIndex&&this.canload){var e=this._levels[this.currentLevelIndex];if("object"==typeof e&&e.url.length>0){var t=this.currentLevelIndex,n=e.urlId,i=e.url[n];c.logger.log("Attempt loading level index "+t+" with URL-id "+n),this.hls.trigger(u.default.LEVEL_LOADING,{url:i,level:t,id:n})}}},r=i,(a=[{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;t&&(e=Math.min(e,t.length-1),this.currentLevelIndex===e&&t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}])&&xe(r.prototype,a),o&&xe(r,o),i}(h),Me=n("./src/demux/id3.js");function Fe(e,t){var n;try{n=new Event("addtrack")}catch(e){(n=document.createEvent("Event")).initEvent("addtrack",!1,!1)}n.track=e,t.dispatchEvent(n)}function Be(e){if(e&&e.cues)for(;e.cues.length>0;)e.removeCue(e.cues[0])}var Ue=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.FRAG_PARSING_METADATA,u.default.LIVE_BACK_BUFFER_REACHED)||this).id3Track=void 0,n.media=void 0,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){h.prototype.destroy.call(this)},r.onMediaAttached=function(e){this.media=e.media,this.media},r.onMediaDetaching=function(){Be(this.id3Track),this.id3Track=void 0,this.media=void 0},r.getID3Track=function(e){for(var t=0;t<e.length;t++){var n=e[t];if("metadata"===n.kind&&"id3"===n.label)return Fe(n,this.media),n}return this.media.addTextTrack("metadata","id3")},r.onFragParsingMetadata=function(e){var t=e.frag,n=e.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var i=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,r=0;r<n.length;r++){var a=Me.default.getID3Frames(n[r].data);if(a){var o=n[r].pts,s=r<n.length-1?n[r+1].pts:t.endPTS;o===s?s+=1e-4:o>s&&(c.logger.warn("detected an id3 sample with endTime < startTime, adjusting endTime to (startTime + 0.25)"),s=o+.25);for(var l=0;l<a.length;l++){var u=a[l];if(!Me.default.isTimeStampFrame(u)){var d=new i(o,s,"");d.value=u,this.id3Track.addCue(d)}}}}},r.onLiveBackBufferReached=function(e){var t=e.bufferEnd,n=this.id3Track;if(n&&n.cues&&n.cues.length){var i=function(e,t){if(t<e[0].endTime)return e[0];if(t>e[e.length-1].endTime)return e[e.length-1];for(var n=0,i=e.length-1;n<=i;){var r=Math.floor((i+n)/2);if(t<e[r].endTime)i=r-1;else{if(!(t>e[r].endTime))return e[r];n=r+1}}return e[n].endTime-t<t-e[i].endTime?e[n]:e[i]}(n.cues,t);if(i)for(;n.cues[0]!==i;)n.removeCue(n.cues[0])}},i}(h),je=function(){function e(e){this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=0,this.totalWeight_=0}var t=e.prototype;return t.sample=function(e,t){var n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/e}return this.estimate_},e}(),Ve=function(){function e(e,t,n,i){this.hls=void 0,this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.hls=e,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new je(t),this.fast_=new je(n)}var t=e.prototype;return t.sample=function(e,t){var n=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/n;this.fast_.sample(n,i),this.slow_.sample(n,i)},t.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.destroy=function(){},e}();function Ke(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ge=window.performance,Ye=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.FRAG_LOADING,u.default.FRAG_LOADED,u.default.FRAG_BUFFERED,u.default.ERROR)||this).lastLoadedFragLevel=0,n._nextAutoLevel=-1,n.hls=t,n.timer=null,n._bwEstimator=null,n.onCheck=n._abandonRulesCheck.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n)),n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,d=i.prototype;return d.destroy=function(){this.clearTimer(),h.prototype.destroy.call(this)},d.onFragLoading=function(e){var t=e.frag;if("main"===t.type&&(this.timer||(this.fragCurrent=t,this.timer=setInterval(this.onCheck,100)),!this._bwEstimator)){var n,i,r=this.hls,a=r.config,o=t.level;r.levels[o].details.live?(n=a.abrEwmaFastLive,i=a.abrEwmaSlowLive):(n=a.abrEwmaFastVoD,i=a.abrEwmaSlowVoD),this._bwEstimator=new Ve(r,i,n,a.abrEwmaDefaultEstimate)}},d._abandonRulesCheck=function(){var e=this.hls,t=e.media,n=this.fragCurrent;if(n){var i=n.loader,r=e.minAutoLevel;if(!i||i.stats&&i.stats.aborted)return c.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);var a=i.stats;if(t&&a&&(!t.paused&&0!==t.playbackRate||!t.readyState)&&n.autoLevel&&n.level){var o=Ge.now()-a.trequest,s=Math.abs(t.playbackRate);if(o>500*n.duration/s){var l=e.levels,d=Math.max(1,a.bw?a.bw/8:1e3*a.loaded/o),h=l[n.level],f=h.realBitrate?Math.max(h.realBitrate,h.bitrate):h.bitrate,p=a.total?a.total:Math.max(a.loaded,Math.round(n.duration*f/8)),g=t.currentTime,v=(p-a.loaded)/d,m=(G.bufferInfo(t,g,e.config.maxBufferHole).end-g)/s;if(m<2*n.duration/s&&v>m){var y;for(y=n.level-1;y>r;y--){var A=l[y].realBitrate?Math.max(l[y].realBitrate,l[y].bitrate):l[y].bitrate;if(n.duration*A/(6.4*d)<m)break}void 0<v&&(c.logger.warn("loading too slow, abort fragment loading and switch to level "+y+":fragLoadedDelay["+y+"]<fragLoadedDelay["+(n.level-1)+"];bufferStarvationDelay:"+(void 0).toFixed(1)+"<"+v.toFixed(1)+":"+m.toFixed(1)),e.nextLoadLevel=y,this._bwEstimator.sample(o,a.loaded),i.abort(),this.clearTimer(),e.trigger(u.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,stats:a}))}}}}},d.onFragLoaded=function(e){var t=e.frag;if("main"===t.type&&Object(l.isFiniteNumber)(t.sn)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var n=this.hls.levels[t.level],i=(n.loaded?n.loaded.bytes:0)+e.stats.loaded,r=(n.loaded?n.loaded.duration:0)+e.frag.duration;n.loaded={bytes:i,duration:r},n.realBitrate=Math.round(8*i/r)}if(e.frag.bitrateTest){var a=e.stats;a.tparsed=a.tbuffered=a.tload,this.onFragBuffered(e)}}},d.onFragBuffered=function(e){var t=e.stats,n=e.frag;if(!0!==t.aborted&&"main"===n.type&&Object(l.isFiniteNumber)(n.sn)&&(!n.bitrateTest||t.tload===t.tbuffered)){var i=t.tparsed-t.trequest;c.logger.log("latency/loading/parsing/append/kbps:"+Math.round(t.tfirst-t.trequest)+"/"+Math.round(t.tload-t.tfirst)+"/"+Math.round(t.tparsed-t.tload)+"/"+Math.round(t.tbuffered-t.tparsed)+"/"+Math.round(8*t.loaded/(t.tbuffered-t.trequest))),this._bwEstimator.sample(i,t.loaded),t.bwEstimate=this._bwEstimator.getEstimate(),n.bitrateTest?this.bitrateTestDelay=i/1e3:this.bitrateTestDelay=0}},d.onError=function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},d.clearTimer=function(){clearInterval(this.timer),this.timer=null},d._findBestLevel=function(e,t,n,i,r,a,o,s,l){for(var u=r;u>=i;u--){var d=l[u];if(d){var h=d.details,f=h?h.totalduration/h.fragments.length:t,p=!!h&&h.live,g=void 0;g=u<=e?o*n:s*n;var v=l[u].realBitrate?Math.max(l[u].realBitrate,l[u].bitrate):l[u].bitrate,m=v*f/g;if(c.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(g)+"/"+v+"/"+f+"/"+a+"/"+m),g>v&&(!m||p&&!this.bitrateTestDelay||m<a))return u}}return-1},r=i,(a=[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this._bwEstimator;if(!(-1===e||t&&t.canEstimate()))return e;var n=this._nextABRAutoLevel;return-1!==e&&(n=Math.min(e,n)),n},set:function(e){this._nextAutoLevel=e}},{key:"_nextABRAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,n=e.levels,i=e.config,r=e.minAutoLevel,a=e.media,o=this.lastLoadedFragLevel,s=this.fragCurrent?this.fragCurrent.duration:0,l=a?a.currentTime:0,u=a&&0!==a.playbackRate?Math.abs(a.playbackRate):1,d=this._bwEstimator?this._bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,h=(G.bufferInfo(a,l,i.maxBufferHole).end-l)/u,f=this._findBestLevel(o,s,d,r,t,h,i.abrBandWidthFactor,i.abrBandWidthUpFactor,n);if(f>=0)return f;c.logger.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var p=s?Math.min(s,i.maxStarvationDelay):i.maxStarvationDelay,g=i.abrBandWidthFactor,v=i.abrBandWidthUpFactor;if(0===h){var m=this.bitrateTestDelay;m&&(p=(s?Math.min(s,i.maxLoadingDelay):i.maxLoadingDelay)-m,c.logger.trace("bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*p)+" ms"),g=v=1)}return f=this._findBestLevel(o,s,d,r,t,h+p,g,v,n),Math.max(f,0)}}])&&Ke(r.prototype,a),o&&Ke(r,o),i}(h),He=z(),$e=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.MANIFEST_PARSED,u.default.BUFFER_RESET,u.default.BUFFER_APPENDING,u.default.BUFFER_CODECS,u.default.BUFFER_EOS,u.default.BUFFER_FLUSHING,u.default.LEVEL_PTS_UPDATED,u.default.LEVEL_UPDATED)||this)._msDuration=null,n._levelDuration=null,n._levelTargetDuration=10,n._live=null,n._objectUrl=null,n._needsFlush=!1,n._needsEos=!1,n.config=void 0,n.audioTimestampOffset=void 0,n.bufferCodecEventsExpected=0,n._bufferCodecEventsTotal=0,n.media=null,n.mediaSource=null,n.segments=[],n.parent=void 0,n.appending=!1,n.appended=0,n.appendError=0,n.flushBufferCounter=0,n.tracks={},n.pendingTracks={},n.sourceBuffer={},n.flushRange=[],n._onMediaSourceOpen=function(){c.logger.log("media source opened"),n.hls.trigger(u.default.MEDIA_ATTACHED,{media:n.media});var e=n.mediaSource;e&&e.removeEventListener("sourceopen",n._onMediaSourceOpen),n.checkPendingTracks()},n._onMediaSourceClose=function(){c.logger.log("media source closed")},n._onMediaSourceEnded=function(){c.logger.log("media source ended")},n._onSBUpdateEnd=function(){if(n.audioTimestampOffset&&n.sourceBuffer.audio){var e=n.sourceBuffer.audio;c.logger.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+n.audioTimestampOffset),e.timestampOffset=n.audioTimestampOffset,delete n.audioTimestampOffset}n._needsFlush&&n.doFlush(),n._needsEos&&n.checkEos(),n.appending=!1;var t=n.parent,i=n.segments.reduce((function(e,n){return n.parent===t?e+1:e}),0),r={},a=n.sourceBuffer;for(var o in a){var s=a[o];if(!s)throw Error("handling source buffer update end error: source buffer for "+o+" uninitilized and unable to update buffered TimeRanges.");r[o]=s.buffered}n.hls.trigger(u.default.BUFFER_APPENDED,{parent:t,pending:i,timeRanges:r}),n._needsFlush||n.doAppending(),n.updateMediaElementDuration(),0===i&&n.flushLiveBackBuffer()},n._onSBUpdateError=function(e){c.logger.error("sourceBuffer error:",e),n.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})},n.config=t.config,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){h.prototype.destroy.call(this)},r.onLevelPtsUpdated=function(e){var t=e.type,n=this.tracks.audio;if("audio"===t&&n&&"audio/mpeg"===n.container){var i=this.sourceBuffer.audio;if(!i)throw Error("Level PTS Updated and source buffer for audio uninitalized");if(Math.abs(i.timestampOffset-e.start)>.1){var r=i.updating;try{i.abort()}catch(e){c.logger.warn("can not abort audio buffer: "+e)}r?this.audioTimestampOffset=e.start:(c.logger.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+e.start),i.timestampOffset=e.start)}}},r.onManifestParsed=function(e){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=e.altAudio?2:1,c.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},r.onMediaAttaching=function(e){var t=this.media=e.media;if(t&&He){var n=this.mediaSource=new He;n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),t.src=window.URL.createObjectURL(n),this._objectUrl=t.src}},r.onMediaDetaching=function(){c.logger.log("media source detaching");var e=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(e){c.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),this.media&&(this._objectUrl&&window.URL.revokeObjectURL(this._objectUrl),this.media.src===this._objectUrl?(this.media.removeAttribute("src"),this.media.load()):c.logger.warn("media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.hls.trigger(u.default.MEDIA_DETACHED)},r.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.pendingTracks,n=Object.keys(t).length;(n&&!e||2===n)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},r.onBufferReset=function(){var e=this.sourceBuffer;for(var t in e){var n=e[t];try{n&&(this.mediaSource&&this.mediaSource.removeSourceBuffer(n),n.removeEventListener("updateend",this._onSBUpdateEnd),n.removeEventListener("error",this._onSBUpdateError))}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},r.onBufferCodecs=function(e){var t=this;Object.keys(this.sourceBuffer).length||(Object.keys(e).forEach((function(n){t.pendingTracks[n]=e[n]})),this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},r.createSourceBuffers=function(e){var t=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");for(var i in e)if(!t[i]){var r=e[i];if(!r)throw Error("source buffer exists for track "+i+", however track does not");var a=r.levelCodec||r.codec,o=r.container+";codecs="+a;c.logger.log("creating sourceBuffer("+o+")");try{var l=t[i]=n.addSourceBuffer(o);l.addEventListener("updateend",this._onSBUpdateEnd),l.addEventListener("error",this._onSBUpdateError),this.tracks[i]={buffer:l,codec:a,id:r.id,container:r.container,levelCodec:r.levelCodec}}catch(e){c.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:o})}}this.hls.trigger(u.default.BUFFER_CREATED,{tracks:this.tracks})},r.onBufferAppending=function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())},r.onBufferEos=function(e){for(var t in this.sourceBuffer)if(!e.type||e.type===t){var n=this.sourceBuffer[t];n&&!n.ended&&(n.ended=!0,c.logger.log(t+" sourceBuffer now EOS"))}this.checkEos()},r.checkEos=function(){var e=this.sourceBuffer,t=this.mediaSource;if(t&&"open"===t.readyState){for(var n in e){var i=e[n];if(i){if(!i.ended)return;if(i.updating)return void(this._needsEos=!0)}}c.logger.log("all media data are available, signal endOfStream() to MediaSource and stop loading fragment");try{t.endOfStream()}catch(e){c.logger.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1}else this._needsEos=!1},r.onBufferFlushing=function(e){e.type?this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}):(this.flushRange.push({start:e.startOffset,end:e.endOffset,type:"video"}),this.flushRange.push({start:e.startOffset,end:e.endOffset,type:"audio"})),this.flushBufferCounter=0,this.doFlush()},r.flushLiveBackBuffer=function(){if(this._live){var e=this.config.liveBackBufferLength;if(isFinite(e)&&!(e<0))if(this.media)for(var t=this.media.currentTime,n=this.sourceBuffer,i=Object.keys(n),r=t-Math.max(e,this._levelTargetDuration),a=i.length-1;a>=0;a--){var o=i[a],s=n[o];if(s){var l=s.buffered;l.length>0&&r>l.start(0)&&this.removeBufferRange(o,s,0,r)&&this.hls.trigger(u.default.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r})}}else c.logger.error("flushLiveBackBuffer called without attaching media")}},r.onLevelUpdated=function(e){var t=e.details;t.fragments.length>0&&(this._levelDuration=t.totalduration+t.fragments[0].start,this._levelTargetDuration=t.averagetargetduration||t.targetduration||10,this._live=t.live,this.updateMediaElementDuration())},r.updateMediaElementDuration=function(){var e,t=this.config;if(null!==this._levelDuration&&this.media&&this.mediaSource&&this.sourceBuffer&&0!==this.media.readyState&&"open"===this.mediaSource.readyState){for(var n in this.sourceBuffer){var i=this.sourceBuffer[n];if(i&&!0===i.updating)return}e=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===t.liveDurationInfinity?(c.logger.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>e||!Object(l.isFiniteNumber)(e))&&(c.logger.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},r.doFlush=function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end,e.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,n=this.sourceBuffer;try{for(var i in n){var r=n[i];r&&(t+=r.buffered.length)}}catch(e){c.logger.error("error while accessing sourceBuffer.buffered")}this.appended=t,this.hls.trigger(u.default.BUFFER_FLUSHED)}},r.doAppending=function(){var e=this.config,t=this.hls,n=this.segments,i=this.sourceBuffer;if(Object.keys(i).length){if(!this.media||this.media.error)return this.segments=[],void c.logger.error("trying to append although a media error occured, flush segment and abort");if(!this.appending){var r=n.shift();if(r)try{var a=i[r.type];if(!a)return void this._onSBUpdateEnd();if(a.updating)return void n.unshift(r);a.ended=!1,this.parent=r.parent,a.appendBuffer(r.data),this.appendError=0,this.appended++,this.appending=!0}catch(i){c.logger.error("error while trying to append buffer:"+i.message),n.unshift(r);var o={type:s.ErrorTypes.MEDIA_ERROR,parent:r.parent,details:"",fatal:!1};22===i.code?(this.segments=[],o.details=s.ErrorDetails.BUFFER_FULL_ERROR):(this.appendError++,o.details=s.ErrorDetails.BUFFER_APPEND_ERROR,this.appendError>e.appendErrorMaxRetry&&(c.logger.log("fail "+e.appendErrorMaxRetry+" times to append segment in sourceBuffer"),this.segments=[],o.fatal=!0)),t.trigger(u.default.ERROR,o)}}}},r.flushBuffer=function(e,t,n){var i=this.sourceBuffer;if(!Object.keys(i).length)return!0;var r="null";if(this.media&&(r=this.media.currentTime.toFixed(3)),c.logger.log("flushBuffer,pos/start/end: "+r+"/"+e+"/"+t),this.flushBufferCounter>=this.appended)return c.logger.warn("abort flushing too many retries"),!0;var a=i[n];if(a){if(a.ended=!1,a.updating)return c.logger.warn("cannot flush, sb updating in progress"),!1;if(this.removeBufferRange(n,a,e,t))return this.flushBufferCounter++,!1}return c.logger.log("buffer flushed"),!0},r.removeBufferRange=function(e,t,n,i){try{for(var r=0;r<t.buffered.length;r++){var a=t.buffered.start(r),o=t.buffered.end(r),s=Math.max(a,n),l=Math.min(o,i);if(Math.min(l,o)-s>.5){var u="null";return this.media&&(u=this.media.currentTime.toString()),c.logger.log("sb remove "+e+" ["+s+","+l+"], of ["+a+","+o+"], pos:"+u),t.remove(s,l),!0}}}catch(e){c.logger.warn("removeBufferRange failed",e)}return!1},i}(h);function ze(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var We=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.FPS_DROP_LEVEL_CAPPING,u.default.MEDIA_ATTACHING,u.default.MANIFEST_PARSED,u.default.BUFFER_CODECS,u.default.MEDIA_DETACHING)||this).autoLevelCapping=Number.POSITIVE_INFINITY,n.firstLevel=null,n.levels=[],n.media=null,n.restrictedLevels=[],n.timer=null,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,s=i.prototype;return s.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this.stopCapping())},s.onFpsDropLevelCapping=function(e){i.isLevelAllowed(e.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(e.droppedLevel)},s.onMediaAttaching=function(e){this.media=e.media instanceof window.HTMLVideoElement?e.media:null},s.onManifestParsed=function(e){var t=this.hls;this.restrictedLevels=[],this.levels=e.levels,this.firstLevel=e.firstLevel,t.config.capLevelToPlayerSize&&e.video&&this.startCapping()},s.onBufferCodecs=function(e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},s.onLevelsUpdated=function(e){this.levels=e.levels},s.onMediaDetaching=function(){this.stopCapping()},s.detectPlayerSize=function(){if(this.media){var e=this.levels?this.levels.length:0;if(e){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e-1),t.autoLevelCapping>this.autoLevelCapping&&t.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},s.getMaxLevel=function(e){var t=this;if(!this.levels)return-1;var n=this.levels.filter((function(n,r){return i.isLevelAllowed(r,t.restrictedLevels)&&r<=e}));return i.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)},s.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},s.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer),this.timer=null)},i.isLevelAllowed=function(e,t){return void 0===t&&(t=[]),-1===t.indexOf(e)},i.getMaxLevelByMediaSize=function(e,t,n){if(!e||e&&!e.length)return-1;for(var i,r,a=e.length-1,o=0;o<e.length;o+=1){var s=e[o];if((s.width>=t||s.height>=n)&&(i=s,!(r=e[o+1])||i.width!==r.width||i.height!==r.height)){a=o;break}}return a},r=i,o=[{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}}],(a=[{key:"mediaWidth",get:function(){var e,t=this.media;return t&&(e=t.width||t.clientWidth||t.offsetWidth,e*=i.contentScaleFactor),e}},{key:"mediaHeight",get:function(){var e,t=this.media;return t&&(e=t.height||t.clientHeight||t.offsetHeight,e*=i.contentScaleFactor),e}}])&&ze(r.prototype,a),o&&ze(r,o),i}(h),qe=window.performance,Xe=function(e){var t,n;function i(t){return e.call(this,t,u.default.MEDIA_ATTACHING)||this}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},r.onMediaAttaching=function(e){var t=this.hls.config;t.capLevelOnFPSDrop&&("function"==typeof(this.video=e.media instanceof window.HTMLVideoElement?e.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),t.fpsDroppedMonitoringPeriod))},r.checkFPS=function(e,t,n){var i=qe.now();if(t){if(this.lastTime){var r=i-this.lastTime,a=n-this.lastDroppedFrames,o=t-this.lastDecodedFrames,s=1e3*a/r,l=this.hls;if(l.trigger(u.default.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:n}),s>0&&a>l.config.fpsDroppedMonitoringThreshold*o){var d=l.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=d)&&(d-=1,l.trigger(u.default.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:l.currentLevel}),l.autoLevelCapping=d,l.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,this.lastDecodedFrames=t}},r.checkFPSInterval=function(){var e=this.video;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},i}(h),Ze=window,Qe=Ze.performance,Je=Ze.XMLHttpRequest,et=function(){function e(e){e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}var t=e.prototype;return t.destroy=function(){this.abort(),this.loader=null},t.abort=function(){var e=this.loader;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null},t.load=function(e,t,n){this.context=e,this.config=t,this.callbacks=n,this.stats={trequest:Qe.now(),retry:0},this.retryDelay=t.retryDelay,this.loadInternal()},t.loadInternal=function(){var e,t=this.context;e=this.loader=new Je;var n=this.stats;n.tfirst=0,n.loaded=0;var i=this.xhrSetup;try{if(i)try{i(e,t.url)}catch(n){e.open("GET",t.url,!0),i(e,t.url)}e.readyState||e.open("GET",t.url,!0)}catch(n){return void this.callbacks.onError({code:e.status,text:n.message},t,e)}t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()},t.readystatechange=function(e){var t=e.currentTarget,n=t.readyState,i=this.stats,r=this.context,a=this.config;if(!i.aborted&&n>=2)if(window.clearTimeout(this.requestTimeout),0===i.tfirst&&(i.tfirst=Math.max(Qe.now(),i.trequest)),4===n){var o=t.status;if(o>=200&&o<300){var s,l;i.tload=Math.max(i.tfirst,Qe.now()),l="arraybuffer"===r.responseType?(s=t.response).byteLength:(s=t.responseText).length,i.loaded=i.total=l;var u={url:t.responseURL,data:s};this.callbacks.onSuccess(u,i,r,t)}else i.retry>=a.maxRetry||o>=400&&o<499?(c.logger.error(o+" while loading "+r.url),this.callbacks.onError({code:o,text:t.statusText},r,t)):(c.logger.warn(o+" while loading "+r.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),i.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),a.timeout)},t.loadtimeout=function(){c.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},t.loadprogress=function(e){var t=e.currentTarget,n=this.stats;n.loaded=e.loaded,e.lengthComputable&&(n.total=e.total);var i=this.callbacks.onProgress;i&&i(n,this.context,null,t)},e}();function tt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var nt=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MANIFEST_LOADING,u.default.MANIFEST_PARSED,u.default.AUDIO_TRACK_LOADED,u.default.AUDIO_TRACK_SWITCHED,u.default.LEVEL_LOADED,u.default.ERROR)||this)._trackId=-1,n._selectDefaultTrack=!0,n.tracks=[],n.trackIdBlacklist=Object.create(null),n.audioGroupId=null,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,l=i.prototype;return l.onManifestLoading=function(){this.tracks=[],this._trackId=-1,this._selectDefaultTrack=!0},l.onManifestParsed=function(e){var t=this.tracks=e.audioTracks||[];this.hls.trigger(u.default.AUDIO_TRACKS_UPDATED,{audioTracks:t}),this._selectAudioGroup(this.hls.nextLoadLevel)},l.onAudioTrackLoaded=function(e){if(e.id>=this.tracks.length)c.logger.warn("Invalid audio track id:",e.id);else{if(c.logger.log("audioTrack "+e.id+" loaded"),this.tracks[e.id].details=e.details,e.details.live&&!this.hasInterval()){var t=1e3*e.details.targetduration;this.setInterval(t)}!e.details.live&&this.hasInterval()&&this.clearInterval()}},l.onAudioTrackSwitched=function(e){var t=this.tracks[e.id].groupId;t&&this.audioGroupId!==t&&(this.audioGroupId=t)},l.onLevelLoaded=function(e){this._selectAudioGroup(e.level)},l.onError=function(e){e.type===s.ErrorTypes.NETWORK_ERROR&&(e.fatal&&this.clearInterval(),e.details===s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&(c.logger.warn("Network failure on audio-track id:",e.context.id),this._handleLoadError()))},l._setAudioTrack=function(e){if(this._trackId===e&&this.tracks[this._trackId].details)c.logger.debug("Same id as current audio-track passed, and track details available -> no-op");else if(e<0||e>=this.tracks.length)c.logger.warn("Invalid id passed to audio-track controller");else{var t=this.tracks[e];c.logger.log("Now switching to audio-track index "+e),this.clearInterval(),this._trackId=e;var n=t.url,i=t.type,r=t.id;this.hls.trigger(u.default.AUDIO_TRACK_SWITCHING,{id:r,type:i,url:n}),this._loadTrackDetailsIfNeeded(t)}},l.doTick=function(){this._updateTrack(this._trackId)},l._selectAudioGroup=function(e){var t=this.hls.levels[e];if(t&&t.audioGroupIds){var n=t.audioGroupIds[t.urlId];this.audioGroupId!==n&&(this.audioGroupId=n,this._selectInitialAudioTrack())}},l._selectInitialAudioTrack=function(){var e=this,t=this.tracks;if(t.length){var n=this.tracks[this._trackId],i=null;if(n&&(i=n.name),this._selectDefaultTrack){var r=t.filter((function(e){return e.default}));r.length?t=r:c.logger.warn("No default audio tracks defined")}var a=!1,o=function(){t.forEach((function(t){a||e.audioGroupId&&t.groupId!==e.audioGroupId||i&&i!==t.name||(e._setAudioTrack(t.id),a=!0)}))};o(),a||(i=null,o()),a||(c.logger.error("No track found for running audio group-ID: "+this.audioGroupId),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))}},l._needsTrackLoading=function(e){var t=e.details,n=e.url;return!(t&&!t.live||!n)},l._loadTrackDetailsIfNeeded=function(e){if(this._needsTrackLoading(e)){var t=e.url,n=e.id;c.logger.log("loading audio-track playlist for id: "+n),this.hls.trigger(u.default.AUDIO_TRACK_LOADING,{url:t,id:n})}},l._updateTrack=function(e){if(!(e<0||e>=this.tracks.length)){this.clearInterval(),this._trackId=e,c.logger.log("trying to update audio-track "+e);var t=this.tracks[e];this._loadTrackDetailsIfNeeded(t)}},l._handleLoadError=function(){this.trackIdBlacklist[this._trackId]=!0;var e=this._trackId,t=this.tracks[e],n=t.name,i=t.language,r=t.groupId;c.logger.warn("Loading failed on audio track id: "+e+", group-id: "+r+', name/language: "'+n+'" / "'+i+'"');for(var a=e,o=0;o<this.tracks.length;o++)if(!this.trackIdBlacklist[o]&&this.tracks[o].name===n){a=o;break}a!==e?(c.logger.log("Attempting audio-track fallback id:",a,"group-id:",this.tracks[a].groupId),this._setAudioTrack(a)):c.logger.warn('No fallback audio-track found for name/language: "'+n+'" / "'+i+'"')},r=i,(a=[{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this._trackId},set:function(e){this._setAudioTrack(e),this._selectDefaultTrack=!1}}])&&tt(r.prototype,a),o&&tt(r,o),i}(pe);function it(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var rt=window.performance,at=function(e){var t,n;function i(t,n){var i;return(i=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.AUDIO_TRACKS_UPDATED,u.default.AUDIO_TRACK_SWITCHING,u.default.AUDIO_TRACK_LOADED,u.default.KEY_LOADED,u.default.FRAG_LOADED,u.default.FRAG_PARSING_INIT_SEGMENT,u.default.FRAG_PARSING_DATA,u.default.FRAG_PARSED,u.default.ERROR,u.default.BUFFER_RESET,u.default.BUFFER_CREATED,u.default.BUFFER_APPENDED,u.default.BUFFER_FLUSHED,u.default.INIT_PTS_FOUND)||this).fragmentTracker=n,i.config=t.config,i.audioCodecSwap=!1,i._state=ge,i.initPTS=[],i.waitingFragment=null,i.videoTrackCC=null,i}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,d=i.prototype;return d.onInitPtsFound=function(e){var t=e.id,n=e.frag.cc,i=e.initPTS;"main"===t&&(this.initPTS[n]=i,this.videoTrackCC=n,c.logger.log("InitPTS for cc: "+n+" found from video track: "+i),this.state===Re&&this.tick())},d.startLoad=function(e){if(this.tracks){var t=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,t>0&&-1===e?(c.logger.log("audio:override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=me):(this.lastCurrentTime=this.startPosition?this.startPosition:e,this.state=ve),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=e,this.state=ge},d.doTick=function(){var e,t,n,i=this.hls,r=i.config;switch(this.state){case we:case ye:case Se:break;case ve:this.state=Te,this.loadedmetadata=!1;break;case me:var a=this.tracks;if(!a)break;if(!this.media&&(this.startFragRequested||!r.startFragPrefetch))break;if(this.loadedmetadata)e=this.media.currentTime;else if(void 0===(e=this.nextLoadPosition))break;var o=this.mediaBuffer?this.mediaBuffer:this.media,s=this.videoBuffer?this.videoBuffer:this.media,d=G.bufferInfo(o,e,r.maxBufferHole),h=G.bufferInfo(s,e,r.maxBufferHole),f=d.len,p=d.end,g=this.fragPrevious,v=Math.min(r.maxBufferLength,r.maxMaxBufferLength),m=Math.max(v,h.len),y=this.audioSwitch,A=this.trackId;if((f<m||y)&&A<a.length){if(void 0===(n=a[A].details)){this.state=Te;break}if(!y&&this._streamEnded(d,n))return this.hls.trigger(u.default.BUFFER_EOS,{type:"audio"}),void(this.state=Ce);var b,E=n.fragments,T=E.length,k=E[0].start,_=E[T-1].start+E[T-1].duration;if(y)if(n.live&&!n.PTSKnown)c.logger.log("switching audiotrack, live stream, unknown PTS,load first fragment"),p=0;else if(p=e,n.PTSKnown&&e<k){if(!(d.end>k||d.nextStart))return;c.logger.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=k+.05}if(n.initSegment&&!n.initSegment.data)b=n.initSegment;else if(p<=k){if(b=E[0],null!==this.videoTrackCC&&b.cc!==this.videoTrackCC&&(b=function(e,t){return K.search(e,(function(e){return e.cc<t?1:e.cc>t?-1:0}))}(E,this.videoTrackCC)),n.live&&b.loadIdx&&b.loadIdx===this.fragLoadIdx){var S=d.nextStart?d.nextStart:k;return c.logger.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(S+.05)),void(this.media.currentTime=S+.05)}}else{var C,w=r.maxFragLookUpTolerance,R=g?E[g.sn-E[0].sn+1]:void 0,O=function(e){var t=Math.min(w,e.duration);return e.start+e.duration-t<=p?1:e.start-t>p&&e.start?-1:0};p<_?(p>_-w&&(w=0),C=R&&!O(R)?R:K.search(E,O)):C=E[T-1],C&&(b=C,k=C.start,g&&b.level===g.level&&b.sn===g.sn&&(b.sn<n.endSN?(b=E[b.sn+1-n.startSN],c.logger.log("SN just loaded, load next one: "+b.sn)):b=null))}b&&(b.encrypted?(c.logger.log("Loading key for "+b.sn+" of ["+n.startSN+" ,"+n.endSN+"],track "+A),this.state=Ae,i.trigger(u.default.KEY_LOADING,{frag:b})):(c.logger.log("Loading "+b.sn+", cc: "+b.cc+" of ["+n.startSN+" ,"+n.endSN+"],track "+A+", currentTime:"+e+",bufferEnd:"+p.toFixed(3)),this.fragCurrent=b,(y||this.fragmentTracker.getState(b)===F)&&("initSegment"!==b.sn&&(this.startFragRequested=!0),Object(l.isFiniteNumber)(b.sn)&&(this.nextLoadPosition=b.start+b.duration),i.trigger(u.default.FRAG_LOADING,{frag:b}),this.state=be)))}break;case Te:(t=this.tracks[this.trackId])&&t.details&&(this.state=me);break;case Ee:var L=rt.now(),D=this.retryDate,I=(o=this.media)&&o.seeking;(!D||L>=D||I)&&(c.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=me);break;case Re:var P=this.videoTrackCC;if(void 0===this.initPTS[P])break;var x=this.waitingFragment;if(x){var N=x.frag.cc;P!==N?(t=this.tracks[this.trackId]).details&&t.details.live&&(c.logger.warn("Waiting fragment CC ("+N+") does not match video track CC ("+P+")"),this.waitingFragment=null,this.state=me):(this.state=be,this.onFragLoaded(this.waitingFragment),this.waitingFragment=null)}else this.state=me}},d.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended);var n=this.config;this.tracks&&n.autoStartLoad&&this.startLoad(n.startPosition)},d.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(c.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},d.onAudioTracksUpdated=function(e){c.logger.log("audio tracks updated"),this.tracks=e.audioTracks},d.onAudioTrackSwitching=function(e){var t=!!e.url;this.trackId=e.id,this.fragCurrent=null,this.state=ye,this.waitingFragment=null,t?this.setInterval(100):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),t&&(this.audioSwitch=!0,this.state=me),this.tick()},d.onAudioTrackLoaded=function(e){var t=e.details,n=e.id,i=this.tracks[n],r=t.totalduration,a=0;if(c.logger.log("track "+n+" loaded ["+t.startSN+","+t.endSN+"],duration:"+r),t.live){var o=i.details;o&&t.fragments.length>0?(ne(o,t),a=t.fragments[0].start,t.PTSKnown?c.logger.log("live audio playlist sliding:"+a.toFixed(3)):c.logger.log("live audio playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,c.logger.log("live audio playlist - first load, unknown sliding"))}else t.PTSKnown=!1;if(i.details=t,!this.startFragRequested){if(-1===this.startPosition){var s=t.startTimeOffset;Object(l.isFiniteNumber)(s)?(c.logger.log("start time offset found in playlist, adjust startPosition to "+s),this.startPosition=s):t.live?(this.startPosition=this.computeLivePosition(a,t),c.logger.log("compute startPosition for audio-track to "+this.startPosition)):this.startPosition=0}this.nextLoadPosition=this.startPosition}this.state===Te&&(this.state=me),this.tick()},d.onKeyLoaded=function(){this.state===Ae&&(this.state=me,this.tick())},d.onFragLoaded=function(e){var t=this.fragCurrent,n=e.frag;if(this.state===be&&t&&"audio"===n.type&&n.level===t.level&&n.sn===t.sn){var i=this.tracks[this.trackId],r=i.details,a=r.totalduration,o=t.level,s=t.sn,l=t.cc,d=this.config.defaultAudioCodec||i.audioCodec||"mp4a.40.2",h=this.stats=e.stats;if("initSegment"===s)this.state=me,h.tparsed=h.tbuffered=rt.now(),r.initSegment.data=e.payload,this.hls.trigger(u.default.FRAG_BUFFERED,{stats:h,frag:t,id:"audio"}),this.tick();else{this.state=ke,this.appended=!1,this.demuxer||(this.demuxer=new Q(this.hls,"audio"));var f=this.initPTS[l],p=r.initSegment?r.initSegment.data:[];r.initSegment||void 0!==f?(this.pendingBuffering=!0,c.logger.log("Demuxing "+s+" of ["+r.startSN+" ,"+r.endSN+"],track "+o),this.demuxer.push(e.payload,p,d,null,t,a,!1,f)):(c.logger.log("unknown video PTS for continuity counter "+l+", waiting for video PTS before demuxing audio frag "+s+" of ["+r.startSN+" ,"+r.endSN+"],track "+o),this.waitingFragment=e,this.state=Re)}}this.fragLoadError=0},d.onFragParsingInitSegment=function(e){var t=this.fragCurrent,n=e.frag;if(t&&"audio"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===ke){var i,r=e.tracks;if(r.video&&delete r.video,i=r.audio){i.levelCodec=i.codec,i.id=e.id,this.hls.trigger(u.default.BUFFER_CODECS,r),c.logger.log("audio track:audio,container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var a=i.initSegment;if(a){var o={type:"audio",data:a,parent:"audio",content:"initSegment"};this.audioSwitch?this.pendingData=[o]:(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(u.default.BUFFER_APPENDING,o))}this.tick()}}},d.onFragParsingData=function(e){var t=this,n=this.fragCurrent,i=e.frag;if(n&&"audio"===e.id&&"audio"===e.type&&i.sn===n.sn&&i.level===n.level&&this.state===ke){var r=this.trackId,a=this.tracks[r],o=this.hls;Object(l.isFiniteNumber)(e.endPTS)||(e.endPTS=e.startPTS+n.duration,e.endDTS=e.startDTS+n.duration),n.addElementaryStream(g.AUDIO),c.logger.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),te(a.details,n,e.startPTS,e.endPTS);var d=this.audioSwitch,h=this.media,f=!1;if(d)if(h&&h.readyState){var p=h.currentTime;c.logger.log("switching audio track : currentTime:"+p),p>=e.startPTS&&(c.logger.log("switching audio track : flushing all audio"),this.state=Se,o.trigger(u.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),f=!0,this.audioSwitch=!1,o.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:r}))}else this.audioSwitch=!1,o.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:r});var v=this.pendingData;if(!v)return c.logger.warn("Apparently attempt to enqueue media payload without codec initialization data upfront"),void o.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:null,fatal:!0});this.audioSwitch||([e.data1,e.data2].forEach((function(t){t&&t.length&&v.push({type:e.type,data:t,parent:"audio",content:"data"})})),!f&&v.length&&(v.forEach((function(e){t.state===ke&&(t.pendingBuffering=!0,t.hls.trigger(u.default.BUFFER_APPENDING,e))})),this.pendingData=[],this.appended=!0)),this.tick()}},d.onFragParsed=function(e){var t=this.fragCurrent,n=e.frag;t&&"audio"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===ke&&(this.stats.tparsed=rt.now(),this.state=_e,this._checkAppendedParsed())},d.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},d.onBufferCreated=function(e){var t=e.tracks.audio;t&&(this.mediaBuffer=t.buffer,this.loadedmetadata=!0),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},d.onBufferAppended=function(e){if("audio"===e.parent){var t=this.state;t!==ke&&t!==_e||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},d._checkAppendedParsed=function(){if(!(this.state!==_e||this.appended&&this.pendingBuffering)){var e=this.fragCurrent,t=this.stats,n=this.hls;if(e){this.fragPrevious=e,t.tbuffered=rt.now(),n.trigger(u.default.FRAG_BUFFERED,{stats:t,frag:e,id:"audio"});var i=this.mediaBuffer?this.mediaBuffer:this.media;i&&c.logger.log("audio buffered : "+ae.toString(i.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,n.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=me}this.tick()}},d.onError=function(e){var t=e.frag;if(!t||"audio"===t.type)switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:var n=e.frag;if(n&&"audio"!==n.type)break;if(!e.fatal){var i=this.fragLoadError;i?i++:i=1;var r=this.config;if(i<=r.fragLoadingMaxRetry){this.fragLoadError=i;var a=Math.min(Math.pow(2,i-1)*r.fragLoadingRetryDelay,r.fragLoadingMaxRetryTimeout);c.logger.warn("AudioStreamController: frag loading failed, retry in "+a+" ms"),this.retryDate=rt.now()+a,this.state=Ee}else c.logger.error("AudioStreamController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=we}break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==we&&(this.state=e.fatal?we:me,c.logger.warn("AudioStreamController: "+e.details+" while loading frag, now switching to "+this.state+" state ..."));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===e.parent&&(this.state===ke||this.state===_e)){var o=this.mediaBuffer,l=this.media.currentTime;if(o&&G.isBuffered(o,l)&&G.isBuffered(o,l+.5)){var d=this.config;d.maxMaxBufferLength>=d.maxBufferLength&&(d.maxMaxBufferLength/=2,c.logger.warn("AudioStreamController: reduce max buffer length to "+d.maxMaxBufferLength+"s")),this.state=me}else c.logger.warn("AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=Se,this.hls.trigger(u.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})}}},d.onBufferFlushed=function(){var e=this,t=this.pendingData;t&&t.length?(c.logger.log("AudioStreamController: appending pending audio data after buffer flushed"),t.forEach((function(t){e.hls.trigger(u.default.BUFFER_APPENDING,t)})),this.appended=!0,this.pendingData=[],this.state=_e):(this.state=me,this.fragPrevious=null,this.tick())},r=i,(a=[{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,c.logger.log("audio stream:"+t+"->"+e)}},get:function(){return this._state}}])&&it(r.prototype,a),o&&it(r,o),i}(Le),ot=function(){if("undefined"!=typeof window&&window.VTTCue)return window.VTTCue;var e={"":!0,lr:!0,rl:!0},t={start:!0,middle:!0,end:!0,left:!0,right:!0};function n(e){return"string"==typeof e&&!!t[e.toLowerCase()]&&e.toLowerCase()}function i(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}function r(t,r,a){var o=this,s={enumerable:!0};o.hasBeenReset=!1;var l="",u=!1,c=t,d=r,h=a,f=null,p="",g=!0,v="auto",m="start",y=50,A="middle",b=50,E="middle";Object.defineProperty(o,"id",i({},s,{get:function(){return l},set:function(e){l=""+e}})),Object.defineProperty(o,"pauseOnExit",i({},s,{get:function(){return u},set:function(e){u=!!e}})),Object.defineProperty(o,"startTime",i({},s,{get:function(){return c},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");c=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",i({},s,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",i({},s,{get:function(){return h},set:function(e){h=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",i({},s,{get:function(){return f},set:function(e){f=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",i({},s,{get:function(){return p},set:function(t){var n=function(t){return"string"==typeof t&&!!e[t.toLowerCase()]&&t.toLowerCase()}(t);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");p=n,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",i({},s,{get:function(){return g},set:function(e){g=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",i({},s,{get:function(){return v},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",i({},s,{get:function(){return m},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",i({},s,{get:function(){return y},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",i({},s,{get:function(){return A},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");A=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",i({},s,{get:function(){return b},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",i({},s,{get:function(){return E},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");E=t,this.hasBeenReset=!0}})),o.displayState=void 0}return r.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},r}(),st=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}};function lt(){this.window=window,this.state="INITIAL",this.buffer="",this.decoder=new st,this.regionList=[]}function ut(){this.values=Object.create(null)}function ct(e,t,n,i){var r=i?e.split(i):[e];for(var a in r)if("string"==typeof r[a]){var o=r[a].split(n);2===o.length&&t(o[0],o[1])}}ut.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,n){for(var i=0;i<n.length;++i)if(t===n[i]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var dt=new ot(0,0,0),ht="middle"===dt.align?"middle":"center";function ft(e,t,n){var i=e;function r(){var t=function(e){function t(e,t,n,i){return 3600*(0|e)+60*(0|t)+(0|n)+(0|i)/1e3}var n=e.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return n?n[3]?t(n[1],n[2],n[3].replace(":",""),n[4]):n[1]>59?t(n[1],n[2],0,n[4]):t(0,n[1],n[2],n[4]):null}(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.substr(3),a(),t.endTime=r(),a(),function(e,t){var i=new ut;ct(e,(function(e,t){switch(e){case"region":for(var r=n.length-1;r>=0;r--)if(n[r].id===t){i.set(e,n[r].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),o=a[0];i.integer(e,o),i.percent(e,o)&&i.set("snapToLines",!1),i.alt(e,o,["auto"]),2===a.length&&i.alt("lineAlign",a[1],["start",ht,"end"]);break;case"position":a=t.split(","),i.percent(e,a[0]),2===a.length&&i.alt("positionAlign",a[1],["start",ht,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",ht,"end","left","right"])}}),/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var r=i.get("line","auto");"auto"===r&&-1===dt.line&&(r=-1),t.line=r,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",ht);var a=i.get("position","auto");"auto"===a&&50===dt.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}(e,t)}function pt(e){return e.replace(/<br(?: \/)?>/gi,"\n")}lt.prototype={parse:function(e){var t=this;function n(){var e=t.buffer,n=0;for(e=pt(e);n<e.length&&"\r"!==e[n]&&"\n"!==e[n];)++n;var i=e.substr(0,n);return"\r"===e[n]&&++n,"\n"===e[n]&&++n,t.buffer=e.substr(n),i}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var i;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var r=(i=n()).match(/^()?WEBVTT([ \t].*)?$/);if(!r||!r[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var a=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:i=n(),t.state){case"HEADER":/:/.test(i)?ct(i,(function(e,t){}),/:/):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new ot(0,0,""),t.state="CUE",-1===i.indexOf("--\x3e")){t.cue.id=i;continue}case"CUE":try{ft(i,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==i.indexOf("--\x3e");if(!i||o&&(a=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=i;continue;case"BADCUE":i||(t.state="ID");continue}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){try{if(this.buffer+=this.decoder.decode(),(this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state)throw new Error("Malformed WebVTT signature.")}catch(e){throw e}return this.onflush&&this.onflush(),this}};var gt=lt;function vt(e,t,n,i){for(var r,a,o,s,l,u=window.VTTCue||TextTrackCue,c=0;c<i.rows.length;c++)if(o=!0,s=0,l="",!(r=i.rows[c]).isEmpty()){for(var d=0;d<r.chars.length;d++)r.chars[d].uchar.match(/\s/)&&o?s++:(l+=r.chars[d].uchar,o=!1);r.cueStartTime=t,t===n&&(n+=1e-4),a=new u(t,n,pt(l.trim())),s>=16?s--:s++,navigator.userAgent.match(/Firefox\//)?a.line=c+1:a.line=c>7?c-2:c+1,a.align="left",a.position=Math.max(0,Math.min(100,s/32*100)),e.addCue(a)}}var mt,yt={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},At=function(e){var t=e;return yt.hasOwnProperty(e)&&(t=yt[e]),String.fromCharCode(t)},bt={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Et={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Tt={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},kt={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_t=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];!function(e){e[e.ERROR=0]="ERROR",e[e.TEXT=1]="TEXT",e[e.WARNING=2]="WARNING",e[e.INFO=2]="INFO",e[e.DEBUG=3]="DEBUG",e[e.DATA=3]="DATA"}(mt||(mt={}));var St={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(e){this.time=e},log:function(e,t){this.verboseFilter[e],this.verboseLevel}},Ct=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].toString(16));return t},wt=function(){function e(e,t,n,i,r){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=n||!1,this.background=i||"black",this.flash=r||!1}var t=e.prototype;return t.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},t.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],n=0;n<t.length;n++){var i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}},t.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},t.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},t.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},t.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},e}(),Rt=function(){function e(e,t,n,i,r,a){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new wt(t,n,i,r,a)}var t=e.prototype;return t.reset=function(){this.uchar=" ",this.penState.reset()},t.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},t.setPenState=function(e){this.penState.copy(e)},t.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},t.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},t.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},e}(),Ot=function(){function e(){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.chars=[];for(var e=0;e<100;e++)this.chars.push(new Rt);this.pos=0,this.currPenState=new wt}var t=e.prototype;return t.equals=function(e){for(var t=!0,n=0;n<100;n++)if(!this.chars[n].equals(e.chars[n])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<100;t++)this.chars[t].copy(e.chars[t])},t.isEmpty=function(){for(var e=!0,t=0;t<100;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},t.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(St.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(St.log("ERROR","Too large cursor position "+this.pos),this.pos=100)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var n=this.pos+1;n<t+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(t)},t.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},t.insertChar=function(e){e>=144&&this.backSpace();var t=At(e);this.pos>=100?St.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t<100;t++)this.chars[t].reset()},t.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.getTextString=function(){for(var e=[],t=!0,n=0;n<100;n++){var i=this.chars[n].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e}(),Lt=function(){function e(){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.rows=[];for(var e=0;e<15;e++)this.rows.push(new Ot);this.currRow=14,this.nrRollUpRows=null,this.reset()}var t=e.prototype;return t.reset=function(){for(var e=0;e<15;e++)this.rows[e].clear();this.currRow=14},t.equals=function(e){for(var t=!0,n=0;n<15;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<15;t++)this.rows[t].copy(e.rows[t])},t.isEmpty=function(){for(var e=!0,t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},t.backSpace=function(){this.rows[this.currRow].backSpace()},t.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},t.insertChar=function(e){this.rows[this.currRow].insertChar(e)},t.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},t.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},t.setCursor=function(e){St.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)},t.setPAC=function(e){St.log("INFO","pacData = "+JSON.stringify(e));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var n=0;n<15;n++)this.rows[n].clear();var i=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){var a=r.rows[i].cueStartTime;if(a&&St.time&&a<St.time)for(var o=0;o<this.nrRollUpRows;o++)this.rows[t-this.nrRollUpRows+o+1].copy(r.rows[i+o])}}this.currRow=t;var s=this.rows[this.currRow];if(null!==e.indent){var l=e.indent,u=Math.max(l-1,0);s.setCursor(e.indent),e.color=s.chars[u].penState.foreground}var c={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(c)},t.setBkgData=function(e){St.log("INFO","bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},t.setRollUpRows=function(e){this.nrRollUpRows=e},t.rollUp=function(){if(null!==this.nrRollUpRows){St.log("TEXT",this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),St.log("INFO","Rolling up")}else St.log("DEBUG","roll_up but nrRollUpRows not set yet")},t.getDisplayText=function(e){e=e||!1;for(var t=[],n="",i=-1,r=0;r<15;r++){var a=this.rows[r].getTextString();a&&(i=r+1,e?t.push("Row "+i+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(n=e?"["+t.join(" | ")+"]":t.join("\n")),n},t.getTextAndFormat=function(){return this.rows},e}(),Dt=function(){function e(e,t){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.lastCueEndTime=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Lt,this.nonDisplayedMemory=new Lt,this.lastOutputScreen=new Lt,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,St.log("INFO","MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";St.log("INFO",n+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(St.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},t.ccRCL=function(){St.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},t.ccBS=function(){St.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},t.ccAOF=function(){},t.ccAON=function(){},t.ccDER=function(){St.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},t.ccRU=function(e){St.log("INFO","RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},t.ccFON=function(){St.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},t.ccRDC=function(){St.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},t.ccTR=function(){St.log("INFO","TR"),this.setMode("MODE_TEXT")},t.ccRTD=function(){St.log("INFO","RTD"),this.setMode("MODE_TEXT")},t.ccEDM=function(){St.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},t.ccCR=function(){St.log("INFO","CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},t.ccENM=function(){St.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},t.ccEOC=function(){if(St.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,St.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},t.ccTO=function(e){St.log("INFO","TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},t.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var n=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}St.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=St.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e}(),It=function(){function e(e,t,n){this.field=void 0,this.outputs=void 0,this.channels=void 0,this.currChNr=void 0,this.lastCmdA=void 0,this.lastCmdB=void 0,this.lastTime=void 0,this.dataCounters=void 0,this.field=e||1,this.outputs=[t,n],this.channels=[new Dt(1,t),new Dt(2,n)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var n,i,r,a=!1;this.lastTime=e,St.setTime(e);for(var o=0;o<t.length;o+=2)i=127&t[o],r=127&t[o+1],0!==i||0!==r?(St.log("DATA","["+Ct([t[o],t[o+1]])+"] -> ("+Ct([i,r])+")"),(n=this.parseCmd(i,r))||(n=this.parseMidrow(i,r)),n||(n=this.parsePAC(i,r)),n||(n=this.parseBackgroundAttributes(i,r)),n||(a=this.parseChars(i,r))&&(this.currChNr&&this.currChNr>=0?this.channels[this.currChNr-1].insertChars(a):St.log("WARNING","No channel found yet. TEXT-MODE?")),n?this.dataCounters.cmd+=2:a?this.dataCounters.char+=2:(this.dataCounters.other+=2,St.log("WARNING","Couldn't parse cleaned data "+Ct([i,r])+" orig: "+Ct([t[o],t[o+1]])))):this.dataCounters.padding+=2},t.parseCmd=function(e,t){var n=null;if(!((20===e||28===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,St.log("DEBUG","Repeated command ("+Ct([e,t])+") is dropped"),!0;n=20===e||23===e?1:2;var i=this.channels[n-1];return 20===e||28===e?32===t?i.ccRCL():33===t?i.ccBS():34===t?i.ccAOF():35===t?i.ccAON():36===t?i.ccDER():37===t?i.ccRU(2):38===t?i.ccRU(3):39===t?i.ccRU(4):40===t?i.ccFON():41===t?i.ccRDC():42===t?i.ccTR():43===t?i.ccRTD():44===t?i.ccEDM():45===t?i.ccCR():46===t?i.ccENM():47===t&&i.ccEOC():i.ccTO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},t.parseMidrow=function(e,t){var n=null;return(17===e||25===e)&&t>=32&&t<=47&&((n=17===e?1:2)!==this.currChNr?(St.log("ERROR","Mismatch channel in midrow parsing"),!1):(this.channels[n-1].ccMIDROW(t),St.log("DEBUG","MIDROW ("+Ct([e,t])+")"),!0))},t.parsePAC=function(e,t){var n,i=null;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,!0;n=e<=23?1:2,i=t>=64&&t<=95?1===n?bt[e]:Tt[e]:1===n?Et[e]:kt[e];var r=this.interpretPAC(i,t);return this.channels[n-1].setPAC(r),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},t.interpretPAC=function(e,t){var n=t,i={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-64,i.underline=1==(1&n),n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((n-16)/2),i},t.parseChars=function(e,t){var n=null,i=null,r=null;if(e>=25?(n=2,r=e-8):(n=1,r=e),r>=17&&r<=19){var a=t;a=17===r?t+80:18===r?t+112:t+144,St.log("INFO","Special char '"+At(a)+"' in channel "+n),i=[a]}else e>=32&&e<=127&&(i=0===t?[e]:[e,t]);if(i){var o=Ct(i);St.log("DEBUG","Char codes = "+o.join(",")),this.lastCmdA=null,this.lastCmdB=null}return i},t.parseBackgroundAttributes=function(e,t){var n,i,r;return((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47)&&(n={},16===e||24===e?(i=Math.floor((t-32)/2),n.background=_t[i],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0)),r=e<24?1:2,this.channels[r-1].setBkgData(n),this.lastCmdA=null,this.lastCmdB=null,!0)},t.reset=function(){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].reset();this.lastCmdA=null,this.lastCmdB=null},t.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].cueSplitAtTime(e)},e}(),Pt=function(){function e(e,t){this.timelineController=void 0,this.trackName=void 0,this.startTime=void 0,this.endTime=void 0,this.screen=void 0,this.timelineController=e,this.trackName=t,this.startTime=null,this.endTime=null,this.screen=null}var t=e.prototype;return t.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen),this.startTime=null)},t.newCue=function(e,t,n){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)},e}(),xt=function(e,t,n){return e.substr(n||0,t.length)===t},Nt=function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return(t>>>0).toString()},Mt={parse:function(e,t,n,i,r,a){var o,s=Object(Me.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),u="00:00.000",c=0,d=0,h=0,f=[],p=!0,g=!1,v=new gt;v.oncue=function(e){var t=n[i],r=n.ccOffset;t&&t.new&&(void 0!==d?r=n.ccOffset=t.start:function(e,t,n){var i=e[t],r=e[i.prevCC];if(!r||!r.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;r&&r.new;)e.ccOffset+=i.start-r.start,i.new=!1,r=e[(i=r).prevCC];e.presentationOffset=n}(n,i,h)),h&&(r=h-n.presentationOffset),g&&(e.startTime+=r-d,e.endTime+=r-d),e.id=Nt(e.startTime.toString())+Nt(e.endTime.toString())+Nt(e.text),e.text=decodeURIComponent(encodeURIComponent(e.text)),e.endTime>0&&f.push(e)},v.onparsingerror=function(e){o=e},v.onflush=function(){o&&a?a(o):r(f)},s.forEach((function(e){if(p){if(xt(e,"X-TIMESTAMP-MAP=")){p=!1,g=!0,e.substr(16).split(",").forEach((function(e){xt(e,"LOCAL:")?u=e.substr(6):xt(e,"MPEGTS:")&&(c=parseInt(e.substr(7)))}));try{t+(9e4*n[i].start||0)<0&&(t+=8589934592),c-=t,d=function(e){var t=parseInt(e.substr(-3)),n=parseInt(e.substr(-6,2)),i=parseInt(e.substr(-9,2)),r=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;if(!(Object(l.isFiniteNumber)(t)&&Object(l.isFiniteNumber)(n)&&Object(l.isFiniteNumber)(i)&&Object(l.isFiniteNumber)(r)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*n,t+=6e4*i,t+=36e5*r}(u)/1e3,h=c/9e4}catch(e){g=!1,o=e}return}""===e&&(p=!1)}v.parse(e+"\n")})),v.flush()}};function Ft(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bt(e,t){return e&&e.label===t.name&&!(e.textTrack1||e.textTrack2)}var Ut=function(e){var t,n;function i(t){var n;if((n=e.call(this,t,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.FRAG_PARSING_USERDATA,u.default.FRAG_DECRYPTED,u.default.MANIFEST_LOADING,u.default.MANIFEST_LOADED,u.default.FRAG_LOADED,u.default.INIT_PTS_FOUND)||this).media=null,n.config=void 0,n.enabled=!0,n.Cues=void 0,n.textTracks=[],n.tracks=[],n.initPTS=[],n.unparsedVttFrags=[],n.cueRanges=[],n.captionsTracks={},n.captionsProperties=void 0,n.cea608Parser=void 0,n.lastSn=-1,n.prevCC=-1,n.vttCCs=null,n.hls=t,n.config=t.config,n.Cues=t.config.cueHandler,n.captionsProperties={textTrack1:{label:n.config.captionsTextTrack1Label,languageCode:n.config.captionsTextTrack1LanguageCode},textTrack2:{label:n.config.captionsTextTrack2Label,languageCode:n.config.captionsTextTrack2LanguageCode}},n.config.enableCEA708Captions){var i=new Pt(Ft(n),"textTrack1"),r=new Pt(Ft(n),"textTrack2");n.cea608Parser=new It(0,i,r)}return n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.addCues=function(e,t,n,i){for(var r,a,o,s,l=this.cueRanges,u=!1,c=l.length;c--;){var d=l[c],h=(r=d[0],a=d[1],o=t,s=n,Math.min(a,s)-Math.max(r,o));if(h>=0&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],n),u=!0,h/(n-t)>.5))return}u||l.push([t,n]),this.Cues.newCue(this.captionsTracks[e],t,n,i)},r.onInitPtsFound=function(e){var t=this,n=e.frag,i=e.id,r=e.initPTS,a=this.unparsedVttFrags;"main"===i&&(this.initPTS[n.cc]=r),a.length&&(this.unparsedVttFrags=[],a.forEach((function(e){t.onFragLoaded(e)})))},r.getExistingTrack=function(e){var t=this.media;if(t)for(var n=0;n<t.textTracks.length;n++){var i=t.textTracks[n];if(i[e])return i}return null},r.createCaptionsTrack=function(e){var t=this.captionsProperties,n=this.captionsTracks,i=this.media,r=t[e],a=r.label,o=r.languageCode;if(!n[e]){var s=this.getExistingTrack(e);if(s)n[e]=s,Be(n[e]),Fe(n[e],i);else{var l=this.createTextTrack("captions",a,o);l&&(l[e]=!0,n[e]=l)}}},r.createTextTrack=function(e,t,n){var i=this.media;if(i)return i.addTextTrack(e,t,n)},r.destroy=function(){e.prototype.destroy.call(this)},r.onMediaAttaching=function(e){this.media=e.media,this._cleanTracks()},r.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach((function(t){Be(e[t]),delete e[t]}))},r.onManifestLoading=function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this._cleanTracks()},r._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var n=0;n<t.length;n++)Be(t[n])}},r.onManifestLoaded=function(e){var t=this;if(this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.cueRanges=[],this.config.enableWebVTT){this.tracks=e.subtitles||[];var n=this.media?this.media.textTracks:[];this.tracks.forEach((function(e,i){var r;if(i<n.length){for(var a=null,o=0;o<n.length;o++)if(Bt(n[o],e)){a=n[o];break}a&&(r=a)}r||(r=t.createTextTrack("subtitles",e.name,e.lang)),e.default?r.mode=t.hls.subtitleDisplay?"showing":"hidden":r.mode="disabled",t.textTracks.push(r)}))}},r.onFragLoaded=function(e){var t=e.frag,n=e.payload,i=this.cea608Parser,r=this.initPTS,a=this.lastSn,o=this.unparsedVttFrags;if("main"===t.type){var s=t.sn;t.sn!==a+1&&i&&i.reset(),this.lastSn=s}else if("subtitle"===t.type)if(n.byteLength){if(!Object(l.isFiniteNumber)(r[t.cc]))return o.push(e),void(r.length&&this.hls.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t}));var c=t.decryptdata;null!=c&&null!=c.key&&"AES-128"===c.method||this._parseVTTs(t,n)}else this.hls.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t})},r._parseVTTs=function(e,t){var n=this.hls,i=this.prevCC,r=this.textTracks,a=this.vttCCs;a[e.cc]||(a[e.cc]={start:e.start,prevCC:i,new:!0},this.prevCC=e.cc),Mt.parse(t,this.initPTS[e.cc],a,e.cc,(function(t){var i=r[e.level];"disabled"!==i.mode?(t.forEach((function(e){if(!i.cues.getCueById(e.id))try{if(i.addCue(e),!i.cues.getCueById(e.id))throw new Error("addCue is failed for: "+e)}catch(n){c.logger.debug("Failed occurred on adding cues: "+n);var t=new window.TextTrackCue(e.startTime,e.endTime,e.text);t.id=e.id,i.addCue(t)}})),n.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})):n.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})}),(function(t){c.logger.log("Failed to parse VTT cue: "+t),n.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})}))},r.onFragDecrypted=function(e){var t=e.frag,n=e.payload;if("subtitle"===t.type){if(!Object(l.isFiniteNumber)(this.initPTS[t.cc]))return void this.unparsedVttFrags.push(e);this._parseVTTs(t,n)}},r.onFragParsingUserdata=function(e){if(this.enabled&&this.cea608Parser)for(var t=0;t<e.samples.length;t++){var n=e.samples[t].bytes;if(n){var i=this.extractCea608Data(n);this.cea608Parser.addData(e.samples[t].pts,i)}}},r.extractCea608Data=function(e){for(var t,n,i,r=31&e[0],a=2,o=[],s=0;s<r;s++)t=e[a++],n=127&e[a++],i=127&e[a++],0===n&&0===i||0!=(4&t)&&0==(3&t)&&(o.push(n),o.push(i));return o},i}(h);function jt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Vt(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];"subtitles"===i.kind&&i.label&&t.push(e[n])}return t}var Kt,Gt=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.MANIFEST_LOADED,u.default.SUBTITLE_TRACK_LOADED)||this).tracks=[],n.trackId=-1,n.media=null,n.stopped=!0,n.subtitleDisplay=!0,n.queuedDefaultTrack=null,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,s=i.prototype;return s.destroy=function(){h.prototype.destroy.call(this)},s.onMediaAttached=function(e){var t=this;this.media=e.media,this.media&&(Object(l.isFiniteNumber)(this.queuedDefaultTrack)&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=null),this.trackChangeListener=this._onTextTracksChanged.bind(this),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.subtitlePollingInterval=setInterval((function(){t.trackChangeListener()}),500):this.media.textTracks.addEventListener("change",this.trackChangeListener))},s.onMediaDetaching=function(){this.media&&(this.useTextTrackPolling?clearInterval(this.subtitlePollingInterval):this.media.textTracks.removeEventListener("change",this.trackChangeListener),Object(l.isFiniteNumber)(this.subtitleTrack)&&(this.queuedDefaultTrack=this.subtitleTrack),Vt(this.media.textTracks).forEach((function(e){Be(e)})),this.subtitleTrack=-1,this.media=null)},s.onManifestLoaded=function(e){var t=this,n=e.subtitles||[];this.tracks=n,this.hls.trigger(u.default.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:n}),n.forEach((function(e){e.default&&(t.media?t.subtitleTrack=e.id:t.queuedDefaultTrack=e.id)}))},s.onSubtitleTrackLoaded=function(e){var t=this,n=e.id,i=e.details,r=this.trackId,a=this.tracks,o=a[r];if(n>=a.length||n!==r||!o||this.stopped)this._clearReloadTimer();else if(c.logger.log("subtitle track "+n+" loaded"),i.live){var s=re(o.details,i,e.stats.trequest);c.logger.log("Reloading live subtitle playlist in "+s+"ms"),this.timer=setTimeout((function(){t._loadCurrentTrack()}),s)}else this._clearReloadTimer()},s.startLoad=function(){this.stopped=!1,this._loadCurrentTrack()},s.stopLoad=function(){this.stopped=!0,this._clearReloadTimer()},s._clearReloadTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},s._loadCurrentTrack=function(){var e=this.trackId,t=this.tracks,n=this.hls,i=t[e];e<0||!i||i.details&&!i.details.live||(c.logger.log("Loading subtitle track "+e),n.trigger(u.default.SUBTITLE_TRACK_LOADING,{url:i.url,id:e}))},s._toggleTrackModes=function(e){var t=this.media,n=this.subtitleDisplay,i=this.trackId;if(t){var r=Vt(t.textTracks);if(-1===e)[].slice.call(r).forEach((function(e){e.mode="disabled"}));else{var a=r[i];a&&(a.mode="disabled")}var o=r[e];o&&(o.mode=n?"showing":"hidden")}},s._setSubtitleTrackInternal=function(e){var t=this.hls,n=this.tracks;!Object(l.isFiniteNumber)(e)||e<-1||e>=n.length||(this.trackId=e,c.logger.log("Switching to subtitle track "+e),t.trigger(u.default.SUBTITLE_TRACK_SWITCH,{id:e}),this._loadCurrentTrack())},s._onTextTracksChanged=function(){if(this.media){for(var e=-1,t=Vt(this.media.textTracks),n=0;n<t.length;n++)if("hidden"===t[n].mode)e=n;else if("showing"===t[n].mode){e=n;break}this.subtitleTrack=e}},r=i,(a=[{key:"subtitleTracks",get:function(){return this.tracks}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.trackId!==e&&(this._toggleTrackModes(e),this._setSubtitleTrackInternal(e))}}])&&jt(r.prototype,a),o&&jt(r,o),i}(h),Yt=n("./src/crypt/decrypter.js"),Ht=window.performance,$t=function(e){var t,n;function i(t,n){var i;return(i=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.ERROR,u.default.KEY_LOADED,u.default.FRAG_LOADED,u.default.SUBTITLE_TRACKS_UPDATED,u.default.SUBTITLE_TRACK_SWITCH,u.default.SUBTITLE_TRACK_LOADED,u.default.SUBTITLE_FRAG_PROCESSED,u.default.LEVEL_UPDATED)||this).fragmentTracker=n,i.config=t.config,i.state=ge,i.tracks=[],i.tracksBuffered=[],i.currentTrackId=-1,i.decrypter=new Yt.default(t,t.config),i.lastAVStart=0,i._onMediaSeeking=i.onMediaSeeking.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i)),i}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.onSubtitleFragProcessed=function(e){var t=e.frag,n=e.success;if(this.fragPrevious=t,this.state=me,n){var i=this.tracksBuffered[this.currentTrackId];if(i){for(var r,a=t.start,o=0;o<i.length;o++)if(a>=i[o].start&&a<=i[o].end){r=i[o];break}var s=t.start+t.duration;r?r.end=s:(r={start:a,end:s},i.push(r))}}},r.onMediaAttached=function(e){var t=e.media;this.media=t,t.addEventListener("seeking",this._onMediaSeeking),this.state=me},r.onMediaDetaching=function(){var e=this;this.media&&(this.media.removeEventListener("seeking",this._onMediaSeeking),this.fragmentTracker.removeAllFragments(),this.currentTrackId=-1,this.tracks.forEach((function(t){e.tracksBuffered[t.id]=[]})),this.media=null,this.state=ge)},r.onError=function(e){var t=e.frag;t&&"subtitle"===t.type&&(this.state=me)},r.onSubtitleTracksUpdated=function(e){var t=this;c.logger.log("subtitle tracks updated"),this.tracksBuffered=[],this.tracks=e.subtitleTracks,this.tracks.forEach((function(e){t.tracksBuffered[e.id]=[]}))},r.onSubtitleTrackSwitch=function(e){if(this.currentTrackId=e.id,this.tracks&&this.tracks.length&&-1!==this.currentTrackId){var t=this.tracks[this.currentTrackId];t&&t.details&&this.setInterval(500)}else this.clearInterval()},r.onSubtitleTrackLoaded=function(e){var t=e.id,n=e.details,i=this.currentTrackId,r=this.tracks,a=r[i];t>=r.length||t!==i||!a||(n.live&&function(e,t,n){void 0===n&&(n=0);var i=-1;ie(e,t,(function(e,t,n){t.start=e.start,i=n}));var r=t.fragments;if(i<0)r.forEach((function(e){e.start+=n}));else for(var a=i+1;a<r.length;a++)r[a].start=r[a-1].start+r[a-1].duration}(a.details,n,this.lastAVStart),a.details=n,this.setInterval(500))},r.onKeyLoaded=function(){this.state===Ae&&(this.state=me)},r.onFragLoaded=function(e){var t=this.fragCurrent,n=e.frag.decryptdata,i=e.frag,r=this.hls;if(this.state===be&&t&&"subtitle"===e.frag.type&&t.sn===e.frag.sn&&e.payload.byteLength>0&&n&&n.key&&"AES-128"===n.method){var a=Ht.now();this.decrypter.decrypt(e.payload,n.key.buffer,n.iv.buffer,(function(e){var t=Ht.now();r.trigger(u.default.FRAG_DECRYPTED,{frag:i,payload:e,stats:{tstart:a,tdecrypt:t}})}))}},r.onLevelUpdated=function(e){var t=e.details.fragments;this.lastAVStart=t.length?t[0].start:0},r.doTick=function(){if(this.media)switch(this.state){case me:var e=this.config,t=this.currentTrackId,n=this.fragmentTracker,i=this.media,r=this.tracks;if(!r||!r[t]||!r[t].details)break;var a,o=e.maxBufferHole,s=e.maxFragLookUpTolerance,l=Math.min(e.maxBufferLength,e.maxMaxBufferLength),d=G.bufferedInfo(this._getBuffered(),i.currentTime,o),h=d.end,f=d.len,p=r[t].details,g=p.fragments,v=g.length,m=g[v-1].start+g[v-1].duration;if(f>l)return;var y=this.fragPrevious;h<m?(y&&p.hasProgramDateTime&&(a=le(g,y.endProgramDateTime,s)),a||(a=ue(y,g,h,s))):a=g[v-1],a&&a.encrypted?(c.logger.log("Loading key for "+a.sn),this.state=Ae,this.hls.trigger(u.default.KEY_LOADING,{frag:a})):a&&n.getState(a)===F&&(this.fragCurrent=a,this.state=be,this.hls.trigger(u.default.FRAG_LOADING,{frag:a}))}else this.state=me},r.stopLoad=function(){this.lastAVStart=0,e.prototype.stopLoad.call(this)},r._getBuffered=function(){return this.tracksBuffered[this.currentTrackId]||[]},r.onMediaSeeking=function(){this.fragPrevious=null},i}(Le);!function(e){e.WIDEVINE="com.widevine.alpha",e.PLAYREADY="com.microsoft.playready"}(Kt||(Kt={}));var zt="undefined"!=typeof window&&window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null;function Wt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xt=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){qt(e,t,n[t])}))}return e}({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,liveDurationInfinity:!1,liveBackBufferLength:1/0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:et,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,abrController:Ye,bufferController:$e,capLevelController:We,fpsController:Xe,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,requestMediaKeySystemAccessFunc:zt},{cueHandler:i,enableCEA708Captions:!0,enableWebVTT:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es"},{subtitleStreamController:$t,subtitleTrackController:Gt,timelineController:Ut,audioStreamController:at,audioTrackController:nt,emeController:function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHED,u.default.MANIFEST_PARSED)||this)._widevineLicenseUrl=void 0,n._licenseXhrSetup=void 0,n._emeEnabled=void 0,n._requestMediaKeySystemAccess=void 0,n._config=void 0,n._mediaKeysList=[],n._media=null,n._hasSetMediaKeys=!1,n._requestLicenseFailureCount=0,n._onMediaEncrypted=function(e){c.logger.log('Media is encrypted using "'+e.initDataType+'" init data type'),n._attemptSetMediaKeys(),n._generateRequestWithPreferredKeySession(e.initDataType,e.initData)},n._config=t.config,n._widevineLicenseUrl=n._config.widevineLicenseUrl,n._licenseXhrSetup=n._config.licenseXhrSetup,n._emeEnabled=n._config.emeEnabled,n._requestMediaKeySystemAccess=n._config.requestMediaKeySystemAccessFunc,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,l=i.prototype;return l.getLicenseServerUrl=function(e){switch(e){case Kt.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+e+'"')},l._attemptKeySystemAccess=function(e,t,n){var i=this,r=function(e,t,n){switch(e){case Kt.WIDEVINE:return function(e,t){var n={videoCapabilities:[]};return t.forEach((function(e){n.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"'})})),[n]}(0,n);default:throw new Error("Unknown key-system: "+e)}}(e,0,n);c.logger.log("Requesting encrypted media key-system access"),this.requestMediaKeySystemAccess(e,r).then((function(t){i._onMediaKeySystemAccessObtained(e,t)})).catch((function(t){c.logger.error('Failed to obtain key-system "'+e+'" access:',t)}))},l._onMediaKeySystemAccessObtained=function(e,t){var n=this;c.logger.log('Access for key-system "'+e+'" obtained');var i={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e};this._mediaKeysList.push(i),t.createMediaKeys().then((function(t){i.mediaKeys=t,c.logger.log('Media-keys created for key-system "'+e+'"'),n._onMediaKeysCreated()})).catch((function(e){c.logger.error("Failed to create media-keys:",e)}))},l._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach((function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))}))},l._onNewMediaKeySession=function(e){var t=this;c.logger.log("New key-system session "+e.sessionId),e.addEventListener("message",(function(n){t._onKeySessionMessage(e,n.message)}),!1)},l._onKeySessionMessage=function(e,t){c.logger.log("Got EME message event, creating license request"),this._requestLicense(t,(function(t){c.logger.log("Received license data (length: "+(t?t.byteLength:t)+"), updating key-session"),e.update(t)}))},l._attemptSetMediaKeys=function(){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys)return c.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});c.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},l._generateRequestWithPreferredKeySession=function(e,t){var n=this,i=this._mediaKeysList[0];if(!i)return c.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(i.mediaKeysSessionInitialized)c.logger.warn("Key-Session already initialized but requested again");else{var r=i.mediaKeysSession;if(!r)return c.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});if(!t)return c.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});c.logger.log('Generating key-session request for "'+e+'" init data type'),i.mediaKeysSessionInitialized=!0,r.generateRequest(e,t).then((function(){c.logger.debug("Key-session generation succeeded")})).catch((function(e){c.logger.error("Error generating key-session request:",e),n.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},l._createLicenseXhr=function(e,t,n){var i=new XMLHttpRequest,r=this._licenseXhrSetup;try{if(r)try{r(i,e)}catch(t){i.open("POST",e,!0),r(i,e)}i.readyState||i.open("POST",e,!0)}catch(e){throw new Error("issue setting up KeySystem license XHR "+e)}return i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,e,t,n),i},l._onLicenseRequestReadyStageChange=function(e,t,n,i){switch(e.readyState){case 4:if(200===e.status)this._requestLicenseFailureCount=0,c.logger.log("License request succeeded"),"arraybuffer"!==e.responseType&&c.logger.warn("xhr response type was not set to the expected arraybuffer for license request"),i(e.response);else{if(c.logger.error("License Request XHR failed ("+t+"). Status: "+e.status+" ("+e.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>3)return void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var r=3-this._requestLicenseFailureCount+1;c.logger.warn("Retrying license request, "+r+" attempts left"),this._requestLicense(n,i)}}},l._generateLicenseRequestChallenge=function(e,t){switch(e.mediaKeySystemDomain){case Kt.WIDEVINE:return t}throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},l._requestLicense=function(e,t){c.logger.log("Requesting content license for key-system");var n=this._mediaKeysList[0];if(!n)return c.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var i=this.getLicenseServerUrl(n.mediaKeySystemDomain),r=this._createLicenseXhr(i,e,t);c.logger.log("Sending license request to URL: "+i);var a=this._generateLicenseRequestChallenge(n,e);r.send(a)}catch(e){c.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},l.onMediaAttached=function(e){if(this._emeEnabled){var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)}},l.onMediaDetached=function(){this._media&&(this._media.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null)},l.onManifestParsed=function(e){if(this._emeEnabled){var t=e.levels.map((function(e){return e.audioCodec})),n=e.levels.map((function(e){return e.videoCodec}));this._attemptKeySystemAccess(Kt.WIDEVINE,t,n)}},r=i,(a=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&Wt(r.prototype,a),o&&Wt(r,o),i}(h)});function Zt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Jt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function en(e,t,n){return t&&Jt(e.prototype,t),n&&Jt(e,n),e}n.d(t,"default",(function(){return tn}));var tn=function(e){var t,n;function i(t){var n;void 0===t&&(t={}),(n=e.call(this)||this).config=void 0,n._autoLevelCapping=void 0,n.abrController=void 0,n.capLevelController=void 0,n.levelController=void 0,n.streamController=void 0,n.networkControllers=void 0,n.audioTrackController=void 0,n.subtitleTrackController=void 0,n.emeController=void 0,n.coreComponents=void 0,n.media=null,n.url=null;var r=i.DefaultConfig;if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");n.config=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){Zt(e,t,n[t])}))}return e}({},r,t);var a=Qt(n).config;if(void 0!==a.liveMaxLatencyDurationCount&&a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==a.liveMaxLatencyDuration&&(void 0===a.liveSyncDuration||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');Object(c.enableLogs)(a.debug),n._autoLevelCapping=-1;var o=n.abrController=new a.abrController(Qt(n)),s=new a.bufferController(Qt(n)),l=n.capLevelController=new a.capLevelController(Qt(n)),u=new a.fpsController(Qt(n)),d=new x(Qt(n)),h=new N(Qt(n)),f=new M(Qt(n)),p=new Ue(Qt(n)),g=n.levelController=new Ne(Qt(n)),v=new V(Qt(n)),m=[g,n.streamController=new Pe(Qt(n),v)],y=a.audioStreamController;y&&m.push(new y(Qt(n),v)),n.networkControllers=m;var A=[d,h,f,o,s,l,u,p,v];if(y=a.audioTrackController){var b=new y(Qt(n));n.audioTrackController=b,A.push(b)}if(y=a.subtitleTrackController){var E=new y(Qt(n));n.subtitleTrackController=E,m.push(E)}if(y=a.emeController){var T=new y(Qt(n));n.emeController=T,A.push(T)}return(y=a.subtitleStreamController)&&m.push(new y(Qt(n),v)),(y=a.timelineController)&&A.push(new y(Qt(n))),n.coreComponents=A,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i.isSupported=function(){return function(){var e=z();if(!e)return!1;var t=self.SourceBuffer||self.WebKitSourceBuffer,n=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return!!n&&!!i}()},en(i,null,[{key:"version",get:function(){return"0.13.2"}},{key:"Events",get:function(){return u.default}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return i.defaultConfig?i.defaultConfig:Xt},set:function(e){i.defaultConfig=e}}]);var r=i.prototype;return r.destroy=function(){c.logger.log("destroy"),this.trigger(u.default.DESTROYING),this.detachMedia(),this.coreComponents.concat(this.networkControllers).forEach((function(e){e.destroy()})),this.url=null,this.removeAllListeners(),this._autoLevelCapping=-1},r.attachMedia=function(e){c.logger.log("attachMedia"),this.media=e,this.trigger(u.default.MEDIA_ATTACHING,{media:e})},r.detachMedia=function(){c.logger.log("detachMedia"),this.trigger(u.default.MEDIA_DETACHING),this.media=null},r.loadSource=function(e){e=o.buildAbsoluteURL(window.location.href,e,{alwaysNormalize:!0}),c.logger.log("loadSource:"+e),this.url=e,this.trigger(u.default.MANIFEST_LOADING,{url:e})},r.startLoad=function(e){void 0===e&&(e=-1),c.logger.log("startLoad("+e+")"),this.networkControllers.forEach((function(t){t.startLoad(e)}))},r.stopLoad=function(){c.logger.log("stopLoad"),this.networkControllers.forEach((function(e){e.stopLoad()}))},r.swapAudioCodec=function(){c.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},r.recoverMediaError=function(){c.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),e&&this.attachMedia(e)},en(i,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){c.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){c.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){c.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){c.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){c.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){c.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e}},{key:"bandwidthEstimate",get:function(){var e=this.abrController._bwEstimator;return e?e.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var e=this.levels,t=this.config.minAutoBitrate,n=e?e.length:0,i=0;i<n;i++)if((e[i].realBitrate?Math.max(e[i].realBitrate,e[i].bitrate):e[i].bitrate)>t)return i;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}}]),i}(q);tn.defaultConfig=void 0},"./src/polyfills/number-isFinite.js":
|
||
/*!******************************************!*\
|
||
!*** ./src/polyfills/number-isFinite.js ***!
|
||
\******************************************/
|
||
/*! exports provided: isFiniteNumber */function(e,t,n){n.r(t),n.d(t,"isFiniteNumber",(function(){return i}));var i=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)}},"./src/utils/get-self-scope.js":
|
||
/*!*************************************!*\
|
||
!*** ./src/utils/get-self-scope.js ***!
|
||
\*************************************/
|
||
/*! exports provided: getSelfScope */function(e,t,n){function i(){return"undefined"==typeof window?self:window}n.r(t),n.d(t,"getSelfScope",(function(){return i}))},"./src/utils/logger.js":
|
||
/*!*****************************!*\
|
||
!*** ./src/utils/logger.js ***!
|
||
\*****************************/
|
||
/*! exports provided: enableLogs, logger */function(e,t,n){n.r(t),n.d(t,"enableLogs",(function(){return c})),n.d(t,"logger",(function(){return d}));var i=n(/*! ./get-self-scope */"./src/utils/get-self-scope.js");function r(){}var a={trace:r,debug:r,log:r,warn:r,info:r,error:r},o=a;function s(e,t){return t="["+e+"] > "+t}var l=Object(i.getSelfScope)();function u(e){var t=l.console[e];return t?function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];i[0]&&(i[0]=s(e,i[0])),t.apply(l.console,i)}:r}var c=function(e){if(l.console&&!0===e||"object"==typeof e){!function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];n.forEach((function(t){o[t]=e[t]?e[t].bind(e):u(t)}))}(e,"debug","log","info","warn","error");try{o.log()}catch(e){o=a}}else o=a},d=o}}).default},e.exports=n())}))),_n=H.now,Sn=H.assign,Cn=H.listContainsIgnoreCase,wn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vn(e,t)}(n,e);var t=yn(n);function n(){var e;un(this,n);for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];return(e=t.call.apply(t,[this].concat(r))).options.playback=pn(pn({},e.options),e.options.playback),e._minDvrSize=void 0===e.options.hlsMinimumDvrSize?60:e.options.hlsMinimumDvrSize,e._extrapolatedWindowNumSegments=e.options.playback&&void 0!==e.options.playback.extrapolatedWindowNumSegments?e.options.playback.extrapolatedWindowNumSegments:2,e._playbackType=he.VOD,e._lastTimeUpdate={current:0,total:0},e._lastDuration=null,e._playableRegionStartTime=0,e._localStartTimeCorrelation=null,e._localEndTimeCorrelation=null,e._playableRegionDuration=0,e._programDateTime=0,e._durationExcludesAfterLiveSyncPoint=!1,e._segmentTargetDuration=null,e._playlistType=null,e._recoverAttemptsRemaining=e.options.hlsRecoverAttempts||16,e}return dn(n,[{key:"name",get:function(){return"hls"}},{key:"supportedVersion",get:function(){return{min:"0.4.11"}}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel},set:function(e){this._currentLevel=e,this.trigger(ne.PLAYBACK_LEVEL_SWITCH_START),this.options.playback.hlsUseNextLevel?this._hls.nextLevel=this._currentLevel:this._hls.currentLevel=this._currentLevel}},{key:"isReady",get:function(){return this._isReadyState}},{key:"_startTime",get:function(){return this._playbackType===he.LIVE&&"EVENT"!==this._playlistType?this._extrapolatedStartTime:this._playableRegionStartTime}},{key:"_now",get:function(){return _n()}},{key:"_extrapolatedStartTime",get:function(){if(!this._localStartTimeCorrelation)return this._playableRegionStartTime;var e=this._localStartTimeCorrelation,t=this._now-e.local,n=(e.remote+t)/1e3;return Math.min(n,this._playableRegionStartTime+this._extrapolatedWindowDuration)}},{key:"_extrapolatedEndTime",get:function(){var e=this._playableRegionStartTime+this._playableRegionDuration;if(!this._localEndTimeCorrelation)return e;var t=this._localEndTimeCorrelation,n=this._now-t.local,i=(t.remote+n)/1e3;return Math.max(e-this._extrapolatedWindowDuration,Math.min(i,e))}},{key:"_duration",get:function(){return this._extrapolatedEndTime-this._startTime}},{key:"_extrapolatedWindowDuration",get:function(){return null===this._segmentTargetDuration?0:this._extrapolatedWindowNumSegments*this._segmentTargetDuration}}],[{key:"HLSJS",get:function(){return kn}}]),dn(n,[{key:"_setup",value:function(){var e=this;this._ccIsSetup=!1,this._ccTracksUpdated=!1,this._hls=new kn(Sn({},this.options.playback.hlsjsConfig)),this._hls.once(kn.Events.MEDIA_ATTACHED,(function(){return e._hls.loadSource(e.options.src)})),this._hls.on(kn.Events.LEVEL_LOADED,(function(t,n){return e._updatePlaybackType(t,n)})),this._hls.on(kn.Events.LEVEL_UPDATED,(function(t,n){return e._onLevelUpdated(t,n)})),this._hls.on(kn.Events.LEVEL_SWITCHING,(function(t,n){return e._onLevelSwitch(t,n)})),this._hls.on(kn.Events.FRAG_LOADED,(function(t,n){return e._onFragmentLoaded(t,n)})),this._hls.on(kn.Events.ERROR,(function(t,n){return e._onHLSJSError(t,n)})),this._hls.on(kn.Events.SUBTITLE_TRACK_LOADED,(function(t,n){return e._onSubtitleLoaded(t,n)})),this._hls.on(kn.Events.SUBTITLE_TRACKS_UPDATED,(function(){return e._ccTracksUpdated=!0})),this._hls.attachMedia(this.el)}},{key:"render",value:function(){return this._ready(),An(gn(n.prototype),"render",this).call(this)}},{key:"_ready",value:function(){this._isReadyState=!0,this.trigger(ne.PLAYBACK_READY,this.name)}},{key:"_recover",value:function(e,t,n){if(this._recoveredDecodingError)if(this._recoveredAudioCodecError){Z.error("hlsjs: failed to recover",{evt:e,data:t}),n.level=se.Levels.FATAL;var i=this.createError(n);this.trigger(ne.PLAYBACK_ERROR,i),this.stop()}else this._recoveredAudioCodecError=!0,this._hls.swapAudioCodec(),this._hls.recoverMediaError();else this._recoveredDecodingError=!0,this._hls.recoverMediaError()}},{key:"_setupSrc",value:function(e){}},{key:"_startTimeUpdateTimer",value:function(){var e=this;this._timeUpdateTimer||(this._timeUpdateTimer=setInterval((function(){e._onDurationChange(),e._onTimeUpdate()}),100))}},{key:"_stopTimeUpdateTimer",value:function(){this._timeUpdateTimer&&(clearInterval(this._timeUpdateTimer),this._timeUpdateTimer=null)}},{key:"getProgramDateTime",value:function(){return this._programDateTime}},{key:"getDuration",value:function(){return this._duration}},{key:"getCurrentTime",value:function(){return Math.max(0,this.el.currentTime-this._startTime)}},{key:"getStartTimeOffset",value:function(){return this._startTime}},{key:"seekPercentage",value:function(e){var t=this._duration;e>0&&(t=this._duration*(e/100)),this.seek(t)}},{key:"seek",value:function(e){e<0&&(Z.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),e=this.getDuration()),this.dvrEnabled&&this._updateDvr(e<this.getDuration()-3),e+=this._startTime,An(gn(n.prototype),"seek",this).call(this,e)}},{key:"seekToLivePoint",value:function(){this.seek(this.getDuration())}},{key:"_updateDvr",value:function(e){this.trigger(ne.PLAYBACK_DVR,e),this.trigger(ne.PLAYBACK_STATS_ADD,{dvr:e})}},{key:"_updateSettings",value:function(){this._playbackType===he.VOD?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(ne.PLAYBACK_SETTINGSUPDATE)}},{key:"_onHLSJSError",value:function(e,t){var n,i={code:"".concat(t.type,"_").concat(t.details),description:"".concat(this.name," error: type: ").concat(t.type,", details: ").concat(t.details),raw:t};if(t.response&&(i.description+=", response: ".concat(JSON.stringify(t.response))),t.fatal)if(this._recoverAttemptsRemaining>0)switch(this._recoverAttemptsRemaining-=1,t.type){case kn.ErrorTypes.NETWORK_ERROR:switch(t.details){case kn.ErrorDetails.MANIFEST_LOAD_ERROR:case kn.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case kn.ErrorDetails.MANIFEST_PARSING_ERROR:case kn.ErrorDetails.LEVEL_LOAD_ERROR:case kn.ErrorDetails.LEVEL_LOAD_TIMEOUT:Z.error("hlsjs: unrecoverable network fatal error.",{evt:e,data:t}),n=this.createError(i),this.trigger(ne.PLAYBACK_ERROR,n),this.stop();break;default:Z.warn("hlsjs: trying to recover from network error.",{evt:e,data:t}),i.level=se.Levels.WARN,this._hls.startLoad()}break;case kn.ErrorTypes.MEDIA_ERROR:Z.warn("hlsjs: trying to recover from media error.",{evt:e,data:t}),i.level=se.Levels.WARN,this._recover(e,t,i);break;default:Z.error("hlsjs: could not recover from error.",{evt:e,data:t}),n=this.createError(i),this.trigger(ne.PLAYBACK_ERROR,n),this.stop()}else Z.error("hlsjs: could not recover from error after maximum number of attempts.",{evt:e,data:t}),n=this.createError(i),this.trigger(ne.PLAYBACK_ERROR,n),this.stop();else{if(this.options.playback.triggerFatalErrorOnResourceDenied&&this._keyIsDenied(t))return Z.error("hlsjs: could not load decrypt key.",{evt:e,data:t}),n=this.createError(i),this.trigger(ne.PLAYBACK_ERROR,n),void this.stop();i.level=se.Levels.WARN,Z.warn("hlsjs: non-fatal error occurred",{evt:e,data:t})}}},{key:"_keyIsDenied",value:function(e){return e.type===kn.ErrorTypes.NETWORK_ERROR&&e.details===kn.ErrorDetails.KEY_LOAD_ERROR&&e.response&&e.response.code>=400}},{key:"_onTimeUpdate",value:function(){var e={current:this.getCurrentTime(),total:this.getDuration(),firstFragDateTime:this.getProgramDateTime()};this._lastTimeUpdate&&e.current===this._lastTimeUpdate.current&&e.total===this._lastTimeUpdate.total||(this._lastTimeUpdate=e,this.trigger(ne.PLAYBACK_TIMEUPDATE,e,this.name))}},{key:"_onDurationChange",value:function(){var e=this.getDuration();this._lastDuration!==e&&(this._lastDuration=e,An(gn(n.prototype),"_onDurationChange",this).call(this))}},{key:"_onProgress",value:function(){if(this.el.buffered.length){for(var e=[],t=0,n=0;n<this.el.buffered.length;n++)e=[].concat(bn(e),[{start:Math.max(0,this.el.buffered.start(n)-this._playableRegionStartTime),end:Math.max(0,this.el.buffered.end(n)-this._playableRegionStartTime)}]),this.el.currentTime>=e[n].start&&this.el.currentTime<=e[n].end&&(t=n);var i={start:e[t].start,current:e[t].end,total:this.getDuration()};this.trigger(ne.PLAYBACK_PROGRESS,i,e)}}},{key:"play",value:function(){this._hls||this._setup(),An(gn(n.prototype),"play",this).call(this),this._startTimeUpdateTimer()}},{key:"pause",value:function(){this._hls&&(An(gn(n.prototype),"pause",this).call(this),this.dvrEnabled&&this._updateDvr(!0))}},{key:"stop",value:function(){this._stopTimeUpdateTimer(),this._hls&&(An(gn(n.prototype),"stop",this).call(this),this._hls.destroy(),delete this._hls)}},{key:"destroy",value:function(){this._stopTimeUpdateTimer(),this._hls&&(this._hls.destroy(),delete this._hls),An(gn(n.prototype),"destroy",this).call(this)}},{key:"_updatePlaybackType",value:function(e,t){this._playbackType=t.details.live?he.LIVE:he.VOD,this._onLevelUpdated(e,t),this._ccTracksUpdated&&this._playbackType===he.LIVE&&this.hasClosedCaptionsTracks&&this._onSubtitleLoaded()}},{key:"_fillLevels",value:function(){this._levels=this._hls.levels.map((function(e,t){return{id:t,level:e,label:"".concat(e.bitrate/1e3,"Kbps")}})),this.trigger(ne.PLAYBACK_LEVELS_AVAILABLE,this._levels)}},{key:"_onLevelUpdated",value:function(e,t){this._segmentTargetDuration=t.details.targetduration,this._playlistType=t.details.type||null;var n=!1,i=!1,r=t.details.fragments,a=this._playableRegionStartTime,o=this._playableRegionDuration;if(0!==r.length){if(r[0].rawProgramDateTime&&(this._programDateTime=r[0].rawProgramDateTime),this._playableRegionStartTime!==r[0].start&&(n=!0,this._playableRegionStartTime=r[0].start),n)if(this._localStartTimeCorrelation){var s=this._localStartTimeCorrelation,l=this._now-s.local,u=(s.remote+l)/1e3;u<r[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*r[0].start}:u>a+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(r[0].start,a+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(r[0].start+this._extrapolatedWindowDuration/2)};var c=t.details.totalduration;if(this._playbackType===he.LIVE){var d=t.details.targetduration*((this.options.playback.hlsjsConfig||{}).liveSyncDurationCount||kn.DefaultConfig.liveSyncDurationCount);d<=c?(c-=d,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}c!==this._playableRegionDuration&&(i=!0,this._playableRegionDuration=c);var h=r[0].start+c,f=a+o;if(h!==f)if(this._localEndTimeCorrelation){var p=this._localEndTimeCorrelation,g=this._now-p.local,v=(p.remote+g)/1e3;v>h?this._localEndTimeCorrelation={local:this._now,remote:1e3*h}:v<h-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(h-this._extrapolatedWindowDuration)}:v>f&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*f})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*h};i&&this._onDurationChange(),n&&this._onProgress()}}},{key:"_onFragmentLoaded",value:function(e,t){this.trigger(ne.PLAYBACK_FRAGMENT_LOADED,t)}},{key:"_onSubtitleLoaded",value:function(){if(!this._ccIsSetup){this.trigger(ne.PLAYBACK_SUBTITLE_AVAILABLE);var e=this._playbackType===he.LIVE?-1:this.closedCaptionsTrackId;this.closedCaptionsTrackId=e,this._ccIsSetup=!0}}},{key:"_onLevelSwitch",value:function(e,t){this.levels.length||this._fillLevels(),this.trigger(ne.PLAYBACK_LEVEL_SWITCH_END),this.trigger(ne.PLAYBACK_LEVEL_SWITCH,t);var n=this._hls.levels[t.level];n&&(this.highDefinition=n.height>=720||n.bitrate/1e3>=2e3,this.trigger(ne.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(ne.PLAYBACK_BITRATE,{height:n.height,width:n.width,bandwidth:n.bitrate,bitrate:n.bitrate,level:t.level}))}},{key:"getPlaybackType",value:function(){return this._playbackType}},{key:"isSeekEnabled",value:function(){return this._playbackType===he.VOD||this.dvrEnabled}},{key:"dvrEnabled",get:function(){return this._durationExcludesAfterLiveSyncPoint&&this._duration>=this._minDvrSize&&this.getPlaybackType()===he.LIVE}}]),n}(Je);return wn.canPlay=function(e,t){var n=e.split("?")[0].match(/.*\.(.*)$/)||[],i=n.length>1&&"m3u8"===n[1].toLowerCase()||Cn(t,["application/vnd.apple.mpegurl","application/x-mpegURL"]);return!(!kn.isSupported()||!i)},ln.Loader.registerPlayback(wn),n({},ln,{HLS:wn})}));
|
||
//# sourceMappingURL=clappr.min.js.map
|