From 615c40bf8fc8efb52330b04c1419c770e47a355c Mon Sep 17 00:00:00 2001 From: Anton Schubert Date: Fri, 4 Sep 2020 20:14:48 +0200 Subject: update voc-player --- assets/voc-player/player.js | 2 +- assets/voc-player/player.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'assets/voc-player') diff --git a/assets/voc-player/player.js b/assets/voc-player/player.js index 661f7c0..f660d7d 100644 --- a/assets/voc-player/player.js +++ b/assets/voc-player/player.js @@ -1447,5 +1447,5 @@ function dc(){}function fc(){Mu?console.debug("EmeEncryptionSchemePolyfill: Alre /*!******************************************************************************************!*\ !*** external {"amd":"clappr","commonjs":"clappr","commonjs2":"clappr","root":"Clappr"} ***! \******************************************************************************************/ -/*! no static exports found */function(module,exports){eval("module.exports = __WEBPACK_EXTERNAL_MODULE_clappr__;\n\n//# sourceURL=webpack://AudioTrackSelector/external_%7B%22amd%22:%22clappr%22,%22commonjs%22:%22clappr%22,%22commonjs2%22:%22clappr%22,%22root%22:%22Clappr%22%7D?")}}).default},module.exports=factory(__webpack_require__(0))},function(e,t,r){var n=r(5),i=r(6);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var o={insert:"head",singleton:!1};n(i,o);e.exports=i.locals||{}},function(e,t,r){"use strict";var n,i=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},o=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),a=[];function s(e){for(var t=-1,r=0;rdiv{background-color:#ccc}.clappr-watermark[data-watermark]{transition:opacity 0.5s ease-out;width:8%;min-width:50px;max-width:100px}.clappr-watermark[data-watermark].clappr-watermark-hide{opacity:0}.clappr-watermark[data-watermark-top-left]{top:0px;left:15px;text-align:left}@media (min-width: 768px){.clappr-watermark[data-watermark-top-left]{top:10px;left:30px}}\n",""]),e.exports=t},function(e,t,r){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=function(e,t){var r=e[1]||"",n=e[3];if(!n)return r;if(t&&"function"==typeof btoa){var i=(a=n,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(l," */")),o=n.sources.map((function(e){return"/*# sourceURL=".concat(n.sourceRoot||"").concat(e," */")}));return[r].concat(o).concat([i]).join("\n")}var a,s,l;return[r].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(n)for(var o=0;o").css({position:"absolute","z-index":"999",width:"100%",height:"100%","background-image":"url("+this.background+")","background-size":"18%","background-repeat":"no-repeat","background-color":"black","background-position":"center","text-align":"center","font-weight":"bold",color:"#eee"});var o=t("
").css({position:"absolute",width:"100%","padding-bottom":"5%",bottom:0}).append(t("

").text(r).css({"font-size":"2em"})).append(t("

").text(n).css({"font-size":"1.2em",margin:"15px"}));this._err.append(o),this.container&&this.container.$el.prepend(this._err)}},{key:"onError",value:function(e){var t=this;if(this.container){var r=this.options.errorPlugin.onError,n=null;r&&"function"==typeof r&&(n=r(e,(function(){t.hide(),t.container.getPlugin("click_to_pause").enable()}))),this.show(n),this.container.getPlugin("click_to_pause").disable()}}}]),r}(i.a.ContainerPlugin),_=function(e){return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};new Headers;return fetch("https://media.ccc.de/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({operationName:e,query:t,variables:r})}).then((function(e){var t=e.body.getReader(),r="",n=new TextDecoder("utf-8");return t.read().then((function e(i){var o=i.done,a=i.value;return o?JSON.parse(r):(r+=n.decode(a),t.read().then(e))}))}))}("LectureBySlug",'\n query LectureBySlug {\n lectureBySlug(slug: "'.concat(e,'") {\n originalLanguage\n videos {\n label\n url\n mimeType\n }\n }\n }\n ')).then((function(e){if(!e.data.lectureBySlug)throw new Error("Lecture could not be found");return e.data.lectureBySlug.videos.map((function(e){var t=e.label,r=e.url;return{label:t,mimeType:e.mimeType,source:r}}))}))};function A(e){return(A="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 E(e,t){for(var r=0;rdiv{background-color:#ccc}.clappr-watermark[data-watermark]{transition:opacity 0.5s ease-out;width:8%;min-width:50px;max-width:100px}.clappr-watermark[data-watermark].clappr-watermark-hide{opacity:0}.clappr-watermark[data-watermark-top-left]{top:0px;left:15px;text-align:left}@media (min-width: 768px){.clappr-watermark[data-watermark-top-left]{top:10px;left:30px}}\n",""]),e.exports=t},function(e,t,r){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=function(e,t){var r=e[1]||"",n=e[3];if(!n)return r;if(t&&"function"==typeof btoa){var i=(a=n,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(l," */")),o=n.sources.map((function(e){return"/*# sourceURL=".concat(n.sourceRoot||"").concat(e," */")}));return[r].concat(o).concat([i]).join("\n")}var a,s,l;return[r].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(n)for(var o=0;o").css({position:"absolute","z-index":"999",width:"100%",height:"100%","background-image":"url("+this.background+")","background-size":"18%","background-repeat":"no-repeat","background-color":"black","background-position":"center","text-align":"center","font-weight":"bold",color:"#eee"});var o=t("

").css({position:"absolute",width:"100%","padding-bottom":"5%",bottom:0}).append(t("

").text(r).css({"font-size":"2em"})).append(t("

").text(n).css({"font-size":"1.2em",margin:"15px"}));this._err.append(o),this.container&&this.container.$el.prepend(this._err)}},{key:"onError",value:function(e){var t=this;if(this.container){var r=this.options.errorPlugin.onError,n=null;r&&"function"==typeof r&&(n=r(e,(function(){t.hide(),t.container.getPlugin("click_to_pause").enable()}))),this.show(n),this.container.getPlugin("click_to_pause").disable()}}}]),r}(i.a.ContainerPlugin),_=function(e){return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};new Headers;return fetch("https://media.ccc.de/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({operationName:e,query:t,variables:r})}).then((function(e){var t=e.body.getReader(),r="",n=new TextDecoder("utf-8");return t.read().then((function e(i){var o=i.done,a=i.value;return o?JSON.parse(r):(r+=n.decode(a),t.read().then(e))}))}))}("LectureBySlug",'\n query LectureBySlug {\n lectureBySlug(slug: "'.concat(e,'") {\n originalLanguage\n videos {\n label\n url\n mimeType\n }\n }\n }\n ')).then((function(e){if(!e.data.lectureBySlug)throw new Error("Lecture could not be found");return e.data.lectureBySlug.videos.map((function(e){var t=e.label,r=e.url;return{label:t,mimeType:e.mimeType,source:r}}))}))};function A(e){return(A="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 E(e,t){for(var r=0;r]*>/,\n singleTagRE = /^<(\\w+)\\s*\\/?>(?:<\\/\\1>|)$/,\n tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/ig,\n rootNodeRE = /^(?:body|html)$/i,\n capitalRE = /([A-Z])/g,\n\n // special attributes that should be get/set via method calls\n methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'],\n\n adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ],\n table = document.createElement('table'),\n tableRow = document.createElement('tr'),\n containers = {\n 'tr': document.createElement('tbody'),\n 'tbody': table, 'thead': table, 'tfoot': table,\n 'td': tableRow, 'th': tableRow,\n '*': document.createElement('div')\n },\n readyRE = /complete|loaded|interactive/,\n simpleSelectorRE = /^[\\w-]*$/,\n class2type = {},\n toString = class2type.toString,\n zepto = {},\n camelize, uniq,\n tempParent = document.createElement('div'),\n propMap = {\n 'tabindex': 'tabIndex',\n 'readonly': 'readOnly',\n 'for': 'htmlFor',\n 'class': 'className',\n 'maxlength': 'maxLength',\n 'cellspacing': 'cellSpacing',\n 'cellpadding': 'cellPadding',\n 'rowspan': 'rowSpan',\n 'colspan': 'colSpan',\n 'usemap': 'useMap',\n 'frameborder': 'frameBorder',\n 'contenteditable': 'contentEditable'\n },\n isArray = Array.isArray ||\n function(object){ return object instanceof Array }\n\n zepto.matches = function(element, selector) {\n if (!selector || !element || element.nodeType !== 1) return false\n var matchesSelector = element.matches || element.webkitMatchesSelector ||\n element.mozMatchesSelector || element.oMatchesSelector ||\n element.matchesSelector\n if (matchesSelector) return matchesSelector.call(element, selector)\n // fall back to performing a selector:\n var match, parent = element.parentNode, temp = !parent\n if (temp) (parent = tempParent).appendChild(element)\n match = ~zepto.qsa(parent, selector).indexOf(element)\n temp && tempParent.removeChild(element)\n return match\n }\n\n function type(obj) {\n return obj == null ? String(obj) :\n class2type[toString.call(obj)] || \"object\"\n }\n\n function isFunction(value) { return type(value) == \"function\" }\n function isWindow(obj) { return obj != null && obj == obj.window }\n function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE }\n function isObject(obj) { return type(obj) == \"object\" }\n function isPlainObject(obj) {\n return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype\n }\n\n function likeArray(obj) {\n var length = !!obj && 'length' in obj && obj.length,\n type = $.type(obj)\n\n return 'function' != type && !isWindow(obj) && (\n 'array' == type || length === 0 ||\n (typeof length == 'number' && length > 0 && (length - 1) in obj)\n )\n }\n\n function compact(array) { return filter.call(array, function(item){ return item != null }) }\n function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array }\n camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) }\n function dasherize(str) {\n return str.replace(/::/g, '/')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')\n .replace(/([a-z\\d])([A-Z])/g, '$1_$2')\n .replace(/_/g, '-')\n .toLowerCase()\n }\n uniq = function(array){ return filter.call(array, function(item, idx){ return array.indexOf(item) == idx }) }\n\n function classRE(name) {\n return name in classCache ?\n classCache[name] : (classCache[name] = new RegExp('(^|\\\\s)' + name + '(\\\\s|$)'))\n }\n\n function maybeAddPx(name, value) {\n return (typeof value == \"number\" && !cssNumber[dasherize(name)]) ? value + \"px\" : value\n }\n\n function defaultDisplay(nodeName) {\n var element, display\n if (!elementDisplay[nodeName]) {\n element = document.createElement(nodeName)\n document.body.appendChild(element)\n display = getComputedStyle(element, '').getPropertyValue(\"display\")\n element.parentNode.removeChild(element)\n display == \"none\" && (display = \"block\")\n elementDisplay[nodeName] = display\n }\n return elementDisplay[nodeName]\n }\n\n function children(element) {\n return 'children' in element ?\n slice.call(element.children) :\n $.map(element.childNodes, function(node){ if (node.nodeType == 1) return node })\n }\n\n function Z(dom, selector) {\n var i, len = dom ? dom.length : 0\n for (i = 0; i < len; i++) this[i] = dom[i]\n this.length = len\n this.selector = selector || ''\n }\n\n // `$.zepto.fragment` takes a html string and an optional tag name\n // to generate DOM nodes from the given html string.\n // The generated DOM nodes are returned as an array.\n // This function can be overridden in plugins for example to make\n // it compatible with browsers that don't support the DOM fully.\n zepto.fragment = function(html, name, properties) {\n var dom, nodes, container\n\n // A special case optimization for a single tag\n if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1))\n\n if (!dom) {\n if (html.replace) html = html.replace(tagExpanderRE, \"<$1>\")\n if (name === undefined) name = fragmentRE.test(html) && RegExp.$1\n if (!(name in containers)) name = '*'\n\n container = containers[name]\n container.innerHTML = '' + html\n dom = $.each(slice.call(container.childNodes), function(){\n container.removeChild(this)\n })\n }\n\n if (isPlainObject(properties)) {\n nodes = $(dom)\n $.each(properties, function(key, value) {\n if (methodAttributes.indexOf(key) > -1) nodes[key](value)\n else nodes.attr(key, value)\n })\n }\n\n return dom\n }\n\n // `$.zepto.Z` swaps out the prototype of the given `dom` array\n // of nodes with `$.fn` and thus supplying all the Zepto functions\n // to the array. This method can be overridden in plugins.\n zepto.Z = function(dom, selector) {\n return new Z(dom, selector)\n }\n\n // `$.zepto.isZ` should return `true` if the given object is a Zepto\n // collection. This method can be overridden in plugins.\n zepto.isZ = function(object) {\n return object instanceof zepto.Z\n }\n\n // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and\n // takes a CSS selector and an optional context (and handles various\n // special cases).\n // This method can be overridden in plugins.\n zepto.init = function(selector, context) {\n var dom\n // If nothing given, return an empty Zepto collection\n if (!selector) return zepto.Z()\n // Optimize for string selectors\n else if (typeof selector == 'string') {\n selector = selector.trim()\n // If it's a html fragment, create nodes from it\n // Note: In both Chrome 21 and Firefox 15, DOM error 12\n // is thrown if the fragment doesn't begin with <\n if (selector[0] == '<' && fragmentRE.test(selector))\n dom = zepto.fragment(selector, RegExp.$1, context), selector = null\n // If there's a context, create a collection on that context first, and select\n // nodes from there\n else if (context !== undefined) return $(context).find(selector)\n // If it's a CSS selector, use it to select nodes.\n else dom = zepto.qsa(document, selector)\n }\n // If a function is given, call it when the DOM is ready\n else if (isFunction(selector)) return $(document).ready(selector)\n // If a Zepto collection is given, just return it\n else if (zepto.isZ(selector)) return selector\n else {\n // normalize array if an array of nodes is given\n if (isArray(selector)) dom = compact(selector)\n // Wrap DOM nodes.\n else if (isObject(selector))\n dom = [selector], selector = null\n // If it's a html fragment, create nodes from it\n else if (fragmentRE.test(selector))\n dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null\n // If there's a context, create a collection on that context first, and select\n // nodes from there\n else if (context !== undefined) return $(context).find(selector)\n // And last but no least, if it's a CSS selector, use it to select nodes.\n else dom = zepto.qsa(document, selector)\n }\n // create a new Zepto collection from the nodes found\n return zepto.Z(dom, selector)\n }\n\n // `$` will be the base `Zepto` object. When calling this\n // function just call `$.zepto.init, which makes the implementation\n // details of selecting nodes and creating Zepto collections\n // patchable in plugins.\n $ = function(selector, context){\n return zepto.init(selector, context)\n }\n\n function extend(target, source, deep) {\n for (key in source)\n if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {\n if (isPlainObject(source[key]) && !isPlainObject(target[key]))\n target[key] = {}\n if (isArray(source[key]) && !isArray(target[key]))\n target[key] = []\n extend(target[key], source[key], deep)\n }\n else if (source[key] !== undefined) target[key] = source[key]\n }\n\n // Copy all but undefined properties from one or more\n // objects to the `target` object.\n $.extend = function(target){\n var deep, args = slice.call(arguments, 1)\n if (typeof target == 'boolean') {\n deep = target\n target = args.shift()\n }\n args.forEach(function(arg){ extend(target, arg, deep) })\n return target\n }\n\n // `$.zepto.qsa` is Zepto's CSS selector implementation which\n // uses `document.querySelectorAll` and optimizes for some special cases, like `#id`.\n // This method can be overridden in plugins.\n zepto.qsa = function(element, selector){\n var found,\n maybeID = selector[0] == '#',\n maybeClass = !maybeID && selector[0] == '.',\n nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked\n isSimple = simpleSelectorRE.test(nameOnly)\n return (element.getElementById && isSimple && maybeID) ? // Safari DocumentFragment doesn't have getElementById\n ( (found = element.getElementById(nameOnly)) ? [found] : [] ) :\n (element.nodeType !== 1 && element.nodeType !== 9 && element.nodeType !== 11) ? [] :\n slice.call(\n isSimple && !maybeID && element.getElementsByClassName ? // DocumentFragment doesn't have getElementsByClassName/TagName\n maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class\n element.getElementsByTagName(selector) : // Or a tag\n element.querySelectorAll(selector) // Or it's not simple, and we need to query all\n )\n }\n\n function filtered(nodes, selector) {\n return selector == null ? $(nodes) : $(nodes).filter(selector)\n }\n\n $.contains = document.documentElement.contains ?\n function(parent, node) {\n return parent !== node && parent.contains(node)\n } :\n function(parent, node) {\n while (node && (node = node.parentNode))\n if (node === parent) return true\n return false\n }\n\n function funcArg(context, arg, idx, payload) {\n return isFunction(arg) ? arg.call(context, idx, payload) : arg\n }\n\n function setAttribute(node, name, value) {\n value == null ? node.removeAttribute(name) : node.setAttribute(name, value)\n }\n\n // access className property while respecting SVGAnimatedString\n function className(node, value){\n var klass = node.className || '',\n svg = klass && klass.baseVal !== undefined\n\n if (value === undefined) return svg ? klass.baseVal : klass\n svg ? (klass.baseVal = value) : (node.className = value)\n }\n\n // \"true\" => true\n // \"false\" => false\n // \"null\" => null\n // \"42\" => 42\n // \"42.5\" => 42.5\n // \"08\" => \"08\"\n // JSON => parse if valid\n // String => self\n function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }\n\n $.type = type\n $.isFunction = isFunction\n $.isWindow = isWindow\n $.isArray = isArray\n $.isPlainObject = isPlainObject\n\n $.isEmptyObject = function(obj) {\n var name\n for (name in obj) return false\n return true\n }\n\n $.isNumeric = function(val) {\n var num = Number(val), type = typeof val\n return val != null && type != 'boolean' &&\n (type != 'string' || val.length) &&\n !isNaN(num) && isFinite(num) || false\n }\n\n $.inArray = function(elem, array, i){\n return emptyArray.indexOf.call(array, elem, i)\n }\n\n $.camelCase = camelize\n $.trim = function(str) {\n return str == null ? \"\" : String.prototype.trim.call(str)\n }\n\n // plugin compatibility\n $.uuid = 0\n $.support = { }\n $.expr = { }\n $.noop = function() {}\n\n $.map = function(elements, callback){\n var value, values = [], i, key\n if (likeArray(elements))\n for (i = 0; i < elements.length; i++) {\n value = callback(elements[i], i)\n if (value != null) values.push(value)\n }\n else\n for (key in elements) {\n value = callback(elements[key], key)\n if (value != null) values.push(value)\n }\n return flatten(values)\n }\n\n $.each = function(elements, callback){\n var i, key\n if (likeArray(elements)) {\n for (i = 0; i < elements.length; i++)\n if (callback.call(elements[i], i, elements[i]) === false) return elements\n } else {\n for (key in elements)\n if (callback.call(elements[key], key, elements[key]) === false) return elements\n }\n\n return elements\n }\n\n $.grep = function(elements, callback){\n return filter.call(elements, callback)\n }\n\n if (window.JSON) $.parseJSON = JSON.parse\n\n // Populate the class2type map\n $.each(\"Boolean Number String Function Array Date RegExp Object Error\".split(\" \"), function(i, name) {\n class2type[ \"[object \" + name + \"]\" ] = name.toLowerCase()\n })\n\n // Define methods that will be available on all\n // Zepto collections\n $.fn = {\n constructor: zepto.Z,\n length: 0,\n\n // Because a collection acts like an array\n // copy over these useful array functions.\n forEach: emptyArray.forEach,\n reduce: emptyArray.reduce,\n push: emptyArray.push,\n sort: emptyArray.sort,\n splice: emptyArray.splice,\n indexOf: emptyArray.indexOf,\n concat: function(){\n var i, value, args = []\n for (i = 0; i < arguments.length; i++) {\n value = arguments[i]\n args[i] = zepto.isZ(value) ? value.toArray() : value\n }\n return concat.apply(zepto.isZ(this) ? this.toArray() : this, args)\n },\n\n // `map` and `slice` in the jQuery API work differently\n // from their array counterparts\n map: function(fn){\n return $($.map(this, function(el, i){ return fn.call(el, i, el) }))\n },\n slice: function(){\n return $(slice.apply(this, arguments))\n },\n\n ready: function(callback){\n // need to check if document.body exists for IE as that browser reports\n // document ready when it hasn't yet created the body element\n if (readyRE.test(document.readyState) && document.body) callback($)\n else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false)\n return this\n },\n get: function(idx){\n return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length]\n },\n toArray: function(){ return this.get() },\n size: function(){\n return this.length\n },\n remove: function(){\n return this.each(function(){\n if (this.parentNode != null)\n this.parentNode.removeChild(this)\n })\n },\n each: function(callback){\n emptyArray.every.call(this, function(el, idx){\n return callback.call(el, idx, el) !== false\n })\n return this\n },\n filter: function(selector){\n if (isFunction(selector)) return this.not(this.not(selector))\n return $(filter.call(this, function(element){\n return zepto.matches(element, selector)\n }))\n },\n add: function(selector,context){\n return $(uniq(this.concat($(selector,context))))\n },\n is: function(selector){\n return this.length > 0 && zepto.matches(this[0], selector)\n },\n not: function(selector){\n var nodes=[]\n if (isFunction(selector) && selector.call !== undefined)\n this.each(function(idx){\n if (!selector.call(this,idx)) nodes.push(this)\n })\n else {\n var excludes = typeof selector == 'string' ? this.filter(selector) :\n (likeArray(selector) && isFunction(selector.item)) ? slice.call(selector) : $(selector)\n this.forEach(function(el){\n if (excludes.indexOf(el) < 0) nodes.push(el)\n })\n }\n return $(nodes)\n },\n has: function(selector){\n return this.filter(function(){\n return isObject(selector) ?\n $.contains(this, selector) :\n $(this).find(selector).size()\n })\n },\n eq: function(idx){\n return idx === -1 ? this.slice(idx) : this.slice(idx, + idx + 1)\n },\n first: function(){\n var el = this[0]\n return el && !isObject(el) ? el : $(el)\n },\n last: function(){\n var el = this[this.length - 1]\n return el && !isObject(el) ? el : $(el)\n },\n find: function(selector){\n var result, $this = this\n if (!selector) result = $()\n else if (typeof selector == 'object')\n result = $(selector).filter(function(){\n var node = this\n return emptyArray.some.call($this, function(parent){\n return $.contains(parent, node)\n })\n })\n else if (this.length == 1) result = $(zepto.qsa(this[0], selector))\n else result = this.map(function(){ return zepto.qsa(this, selector) })\n return result\n },\n closest: function(selector, context){\n var nodes = [], collection = typeof selector == 'object' && $(selector)\n this.each(function(_, node){\n while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector)))\n node = node !== context && !isDocument(node) && node.parentNode\n if (node && nodes.indexOf(node) < 0) nodes.push(node)\n })\n return $(nodes)\n },\n parents: function(selector){\n var ancestors = [], nodes = this\n while (nodes.length > 0)\n nodes = $.map(nodes, function(node){\n if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {\n ancestors.push(node)\n return node\n }\n })\n return filtered(ancestors, selector)\n },\n parent: function(selector){\n return filtered(uniq(this.pluck('parentNode')), selector)\n },\n children: function(selector){\n return filtered(this.map(function(){ return children(this) }), selector)\n },\n contents: function() {\n return this.map(function() { return this.contentDocument || slice.call(this.childNodes) })\n },\n siblings: function(selector){\n return filtered(this.map(function(i, el){\n return filter.call(children(el.parentNode), function(child){ return child!==el })\n }), selector)\n },\n empty: function(){\n return this.each(function(){ this.innerHTML = '' })\n },\n // `pluck` is borrowed from Prototype.js\n pluck: function(property){\n return $.map(this, function(el){ return el[property] })\n },\n show: function(){\n return this.each(function(){\n this.style.display == \"none\" && (this.style.display = '')\n if (getComputedStyle(this, '').getPropertyValue(\"display\") == \"none\")\n this.style.display = defaultDisplay(this.nodeName)\n })\n },\n replaceWith: function(newContent){\n return this.before(newContent).remove()\n },\n wrap: function(structure){\n var func = isFunction(structure)\n if (this[0] && !func)\n var dom = $(structure).get(0),\n clone = dom.parentNode || this.length > 1\n\n return this.each(function(index){\n $(this).wrapAll(\n func ? structure.call(this, index) :\n clone ? dom.cloneNode(true) : dom\n )\n })\n },\n wrapAll: function(structure){\n if (this[0]) {\n $(this[0]).before(structure = $(structure))\n var children\n // drill down to the inmost element\n while ((children = structure.children()).length) structure = children.first()\n $(structure).append(this)\n }\n return this\n },\n wrapInner: function(structure){\n var func = isFunction(structure)\n return this.each(function(index){\n var self = $(this), contents = self.contents(),\n dom = func ? structure.call(this, index) : structure\n contents.length ? contents.wrapAll(dom) : self.append(dom)\n })\n },\n unwrap: function(){\n this.parent().each(function(){\n $(this).replaceWith($(this).children())\n })\n return this\n },\n clone: function(){\n return this.map(function(){ return this.cloneNode(true) })\n },\n hide: function(){\n return this.css(\"display\", \"none\")\n },\n toggle: function(setting){\n return this.each(function(){\n var el = $(this)\n ;(setting === undefined ? el.css(\"display\") == \"none\" : setting) ? el.show() : el.hide()\n })\n },\n prev: function(selector){ return $(this.pluck('previousElementSibling')).filter(selector || '*') },\n next: function(selector){ return $(this.pluck('nextElementSibling')).filter(selector || '*') },\n html: function(html){\n return 0 in arguments ?\n this.each(function(idx){\n var originHtml = this.innerHTML\n $(this).empty().append( funcArg(this, html, idx, originHtml) )\n }) :\n (0 in this ? this[0].innerHTML : null)\n },\n text: function(text){\n return 0 in arguments ?\n this.each(function(idx){\n var newText = funcArg(this, text, idx, this.textContent)\n this.textContent = newText == null ? '' : ''+newText\n }) :\n (0 in this ? this.pluck('textContent').join(\"\") : null)\n },\n attr: function(name, value){\n var result\n return (typeof name == 'string' && !(1 in arguments)) ?\n (0 in this && this[0].nodeType == 1 && (result = this[0].getAttribute(name)) != null ? result : undefined) :\n this.each(function(idx){\n if (this.nodeType !== 1) return\n if (isObject(name)) for (key in name) setAttribute(this, key, name[key])\n else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name)))\n })\n },\n removeAttr: function(name){\n return this.each(function(){ this.nodeType === 1 && name.split(' ').forEach(function(attribute){\n setAttribute(this, attribute)\n }, this)})\n },\n prop: function(name, value){\n name = propMap[name] || name\n return (1 in arguments) ?\n this.each(function(idx){\n this[name] = funcArg(this, value, idx, this[name])\n }) :\n (this[0] && this[0][name])\n },\n removeProp: function(name){\n name = propMap[name] || name\n return this.each(function(){ delete this[name] })\n },\n data: function(name, value){\n var attrName = 'data-' + name.replace(capitalRE, '-$1').toLowerCase()\n\n var data = (1 in arguments) ?\n this.attr(attrName, value) :\n this.attr(attrName)\n\n return data !== null ? deserializeValue(data) : undefined\n },\n val: function(value){\n if (0 in arguments) {\n if (value == null) value = \"\"\n return this.each(function(idx){\n this.value = funcArg(this, value, idx, this.value)\n })\n } else {\n return this[0] && (this[0].multiple ?\n $(this[0]).find('option').filter(function(){ return this.selected }).pluck('value') :\n this[0].value)\n }\n },\n offset: function(coordinates){\n if (coordinates) return this.each(function(index){\n var $this = $(this),\n coords = funcArg(this, coordinates, index, $this.offset()),\n parentOffset = $this.offsetParent().offset(),\n props = {\n top: coords.top - parentOffset.top,\n left: coords.left - parentOffset.left\n }\n\n if ($this.css('position') == 'static') props['position'] = 'relative'\n $this.css(props)\n })\n if (!this.length) return null\n if (document.documentElement !== this[0] && !$.contains(document.documentElement, this[0]))\n return {top: 0, left: 0}\n var obj = this[0].getBoundingClientRect()\n return {\n left: obj.left + window.pageXOffset,\n top: obj.top + window.pageYOffset,\n width: Math.round(obj.width),\n height: Math.round(obj.height)\n }\n },\n css: function(property, value){\n if (arguments.length < 2) {\n var element = this[0]\n if (typeof property == 'string') {\n if (!element) return\n return element.style[camelize(property)] || getComputedStyle(element, '').getPropertyValue(property)\n } else if (isArray(property)) {\n if (!element) return\n var props = {}\n var computedStyle = getComputedStyle(element, '')\n $.each(property, function(_, prop){\n props[prop] = (element.style[camelize(prop)] || computedStyle.getPropertyValue(prop))\n })\n return props\n }\n }\n\n var css = ''\n if (type(property) == 'string') {\n if (!value && value !== 0)\n this.each(function(){ this.style.removeProperty(dasherize(property)) })\n else\n css = dasherize(property) + \":\" + maybeAddPx(property, value)\n } else {\n for (key in property)\n if (!property[key] && property[key] !== 0)\n this.each(function(){ this.style.removeProperty(dasherize(key)) })\n else\n css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';'\n }\n\n return this.each(function(){ this.style.cssText += ';' + css })\n },\n index: function(element){\n return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0])\n },\n hasClass: function(name){\n if (!name) return false\n return emptyArray.some.call(this, function(el){\n return this.test(className(el))\n }, classRE(name))\n },\n addClass: function(name){\n if (!name) return this\n return this.each(function(idx){\n if (!('className' in this)) return\n classList = []\n var cls = className(this), newName = funcArg(this, name, idx, cls)\n newName.split(/\\s+/g).forEach(function(klass){\n if (!$(this).hasClass(klass)) classList.push(klass)\n }, this)\n classList.length && className(this, cls + (cls ? \" \" : \"\") + classList.join(\" \"))\n })\n },\n removeClass: function(name){\n return this.each(function(idx){\n if (!('className' in this)) return\n if (name === undefined) return className(this, '')\n classList = className(this)\n funcArg(this, name, idx, classList).split(/\\s+/g).forEach(function(klass){\n classList = classList.replace(classRE(klass), \" \")\n })\n className(this, classList.trim())\n })\n },\n toggleClass: function(name, when){\n if (!name) return this\n return this.each(function(idx){\n var $this = $(this), names = funcArg(this, name, idx, className(this))\n names.split(/\\s+/g).forEach(function(klass){\n (when === undefined ? !$this.hasClass(klass) : when) ?\n $this.addClass(klass) : $this.removeClass(klass)\n })\n })\n },\n scrollTop: function(value){\n if (!this.length) return\n var hasScrollTop = 'scrollTop' in this[0]\n if (value === undefined) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset\n return this.each(hasScrollTop ?\n function(){ this.scrollTop = value } :\n function(){ this.scrollTo(this.scrollX, value) })\n },\n scrollLeft: function(value){\n if (!this.length) return\n var hasScrollLeft = 'scrollLeft' in this[0]\n if (value === undefined) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset\n return this.each(hasScrollLeft ?\n function(){ this.scrollLeft = value } :\n function(){ this.scrollTo(value, this.scrollY) })\n },\n position: function() {\n if (!this.length) return\n\n var elem = this[0],\n // Get *real* offsetParent\n offsetParent = this.offsetParent(),\n // Get correct offsets\n offset = this.offset(),\n parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset()\n\n // Subtract element margins\n // note: when an element has margin: auto the offsetLeft and marginLeft\n // are the same in Safari causing offset.left to incorrectly be 0\n offset.top -= parseFloat( $(elem).css('margin-top') ) || 0\n offset.left -= parseFloat( $(elem).css('margin-left') ) || 0\n\n // Add offsetParent borders\n parentOffset.top += parseFloat( $(offsetParent[0]).css('border-top-width') ) || 0\n parentOffset.left += parseFloat( $(offsetParent[0]).css('border-left-width') ) || 0\n\n // Subtract the two offsets\n return {\n top: offset.top - parentOffset.top,\n left: offset.left - parentOffset.left\n }\n },\n offsetParent: function() {\n return this.map(function(){\n var parent = this.offsetParent || document.body\n while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css(\"position\") == \"static\")\n parent = parent.offsetParent\n return parent\n })\n }\n }\n\n // for now\n $.fn.detach = $.fn.remove\n\n // Generate the `width` and `height` functions\n ;['width', 'height'].forEach(function(dimension){\n var dimensionProperty =\n dimension.replace(/./, function(m){ return m[0].toUpperCase() })\n\n $.fn[dimension] = function(value){\n var offset, el = this[0]\n if (value === undefined) return isWindow(el) ? el['inner' + dimensionProperty] :\n isDocument(el) ? el.documentElement['scroll' + dimensionProperty] :\n (offset = this.offset()) && offset[dimension]\n else return this.each(function(idx){\n el = $(this)\n el.css(dimension, funcArg(this, value, idx, el[dimension]()))\n })\n }\n })\n\n function traverseNode(node, fun) {\n fun(node)\n for (var i = 0, len = node.childNodes.length; i < len; i++)\n traverseNode(node.childNodes[i], fun)\n }\n\n // Generate the `after`, `prepend`, `before`, `append`,\n // `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods.\n adjacencyOperators.forEach(function(operator, operatorIndex) {\n var inside = operatorIndex % 2 //=> prepend, append\n\n $.fn[operator] = function(){\n // arguments can be nodes, arrays of nodes, Zepto objects and HTML strings\n var argType, nodes = $.map(arguments, function(arg) {\n var arr = []\n argType = type(arg)\n if (argType == \"array\") {\n arg.forEach(function(el) {\n if (el.nodeType !== undefined) return arr.push(el)\n else if ($.zepto.isZ(el)) return arr = arr.concat(el.get())\n arr = arr.concat(zepto.fragment(el))\n })\n return arr\n }\n return argType == \"object\" || arg == null ?\n arg : zepto.fragment(arg)\n }),\n parent, copyByClone = this.length > 1\n if (nodes.length < 1) return this\n\n return this.each(function(_, target){\n parent = inside ? target : target.parentNode\n\n // convert all methods to a \"before\" operation\n target = operatorIndex == 0 ? target.nextSibling :\n operatorIndex == 1 ? target.firstChild :\n operatorIndex == 2 ? target :\n null\n\n var parentInDocument = $.contains(document.documentElement, parent)\n\n nodes.forEach(function(node){\n if (copyByClone) node = node.cloneNode(true)\n else if (!parent) return $(node).remove()\n\n parent.insertBefore(node, target)\n if (parentInDocument) traverseNode(node, function(el){\n if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' &&\n (!el.type || el.type === 'text/javascript') && !el.src){\n var target = el.ownerDocument ? el.ownerDocument.defaultView : window\n target['eval'].call(target, el.innerHTML)\n }\n })\n })\n })\n }\n\n // after => insertAfter\n // prepend => prependTo\n // before => insertBefore\n // append => appendTo\n $.fn[inside ? operator+'To' : 'insert'+(operatorIndex ? 'Before' : 'After')] = function(html){\n $(html)[operator](this)\n return this\n }\n })\n\n zepto.Z.prototype = Z.prototype = $.fn\n\n // Export internal API functions in the `$.zepto` namespace\n zepto.uniq = uniq\n zepto.deserializeValue = deserializeValue\n $.zepto = zepto\n\n return $\n})()\n\nwindow.Zepto = Zepto\nwindow.$ === undefined && (window.$ = Zepto)\n\n;(function($){\n var jsonpID = +new Date(),\n document = window.document,\n key,\n name,\n rscript = /)<[^<]*)*<\\/script>/gi,\n scriptTypeRE = /^(?:text|application)\\/javascript/i,\n xmlTypeRE = /^(?:text|application)\\/xml/i,\n jsonType = 'application/json',\n htmlType = 'text/html',\n blankRE = /^\\s*$/,\n originAnchor = document.createElement('a')\n\n originAnchor.href = window.location.href\n\n // trigger a custom event and return false if it was cancelled\n function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }\n\n // trigger an Ajax \"global\" event\n function triggerGlobal(settings, context, eventName, data) {\n if (settings.global) return triggerAndReturn(context || document, eventName, data)\n }\n\n // Number of active Ajax requests\n $.active = 0\n\n function ajaxStart(settings) {\n if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart')\n }\n function ajaxStop(settings) {\n if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop')\n }\n\n // triggers an extra global event \"ajaxBeforeSend\" that's like \"ajaxSend\" but cancelable\n function ajaxBeforeSend(xhr, settings) {\n var context = settings.context\n if (settings.beforeSend.call(context, xhr, settings) === false ||\n triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false)\n return false\n\n triggerGlobal(settings, context, 'ajaxSend', [xhr, settings])\n }\n function ajaxSuccess(data, xhr, settings, deferred) {\n var context = settings.context, status = 'success'\n settings.success.call(context, data, status, xhr)\n if (deferred) deferred.resolveWith(context, [data, status, xhr])\n triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data])\n ajaxComplete(status, xhr, settings)\n }\n // type: \"timeout\", \"error\", \"abort\", \"parsererror\"\n function ajaxError(error, type, xhr, settings, deferred) {\n var context = settings.context\n settings.error.call(context, xhr, type, error)\n if (deferred) deferred.rejectWith(context, [xhr, type, error])\n triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type])\n ajaxComplete(type, xhr, settings)\n }\n // status: \"success\", \"notmodified\", \"error\", \"timeout\", \"abort\", \"parsererror\"\n function ajaxComplete(status, xhr, settings) {\n var context = settings.context\n settings.complete.call(context, xhr, status)\n triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings])\n ajaxStop(settings)\n }\n\n function ajaxDataFilter(data, type, settings) {\n if (settings.dataFilter == empty) return data\n var context = settings.context\n return settings.dataFilter.call(context, data, type)\n }\n\n // Empty function, used as default callback\n function empty() {}\n\n $.ajaxJSONP = function(options, deferred){\n if (!('type' in options)) return $.ajax(options)\n\n var _callbackName = options.jsonpCallback,\n callbackName = ($.isFunction(_callbackName) ?\n _callbackName() : _callbackName) || ('Zepto' + (jsonpID++)),\n script = document.createElement('script'),\n originalCallback = window[callbackName],\n responseData,\n abort = function(errorType) {\n $(script).triggerHandler('error', errorType || 'abort')\n },\n xhr = { abort: abort }, abortTimeout\n\n if (deferred) deferred.promise(xhr)\n\n $(script).on('load error', function(e, errorType){\n clearTimeout(abortTimeout)\n $(script).off().remove()\n\n if (e.type == 'error' || !responseData) {\n ajaxError(null, errorType || 'error', xhr, options, deferred)\n } else {\n ajaxSuccess(responseData[0], xhr, options, deferred)\n }\n\n window[callbackName] = originalCallback\n if (responseData && $.isFunction(originalCallback))\n originalCallback(responseData[0])\n\n originalCallback = responseData = undefined\n })\n\n if (ajaxBeforeSend(xhr, options) === false) {\n abort('abort')\n return xhr\n }\n\n window[callbackName] = function(){\n responseData = arguments\n }\n\n script.src = options.url.replace(/\\?(.+)=\\?/, '?$1=' + callbackName)\n document.head.appendChild(script)\n\n if (options.timeout > 0) abortTimeout = setTimeout(function(){\n abort('timeout')\n }, options.timeout)\n\n return xhr\n }\n\n $.ajaxSettings = {\n // Default type of request\n type: 'GET',\n // Callback that is executed before request\n beforeSend: empty,\n // Callback that is executed if the request succeeds\n success: empty,\n // Callback that is executed the the server drops error\n error: empty,\n // Callback that is executed on request complete (both: error and success)\n complete: empty,\n // The context for the callbacks\n context: null,\n // Whether to trigger \"global\" Ajax events\n global: true,\n // Transport\n xhr: function () {\n return new window.XMLHttpRequest()\n },\n // MIME types mapping\n // IIS returns Javascript as \"application/x-javascript\"\n accepts: {\n script: 'text/javascript, application/javascript, application/x-javascript',\n json: jsonType,\n xml: 'application/xml, text/xml',\n html: htmlType,\n text: 'text/plain'\n },\n // Whether the request is to another domain\n crossDomain: false,\n // Default timeout\n timeout: 0,\n // Whether data should be serialized to string\n processData: true,\n // Whether the browser should be allowed to cache GET responses\n cache: true,\n //Used to handle the raw response data of XMLHttpRequest.\n //This is a pre-filtering function to sanitize the response.\n //The sanitized response should be returned\n dataFilter: empty\n }\n\n function mimeToDataType(mime) {\n if (mime) mime = mime.split(';', 2)[0]\n return mime && ( mime == htmlType ? 'html' :\n mime == jsonType ? 'json' :\n scriptTypeRE.test(mime) ? 'script' :\n xmlTypeRE.test(mime) && 'xml' ) || 'text'\n }\n\n function appendQuery(url, query) {\n if (query == '') return url\n return (url + '&' + query).replace(/[&?]{1,2}/, '?')\n }\n\n // serialize payload and append it to the URL for GET requests\n function serializeData(options) {\n if (options.processData && options.data && $.type(options.data) != \"string\")\n options.data = $.param(options.data, options.traditional)\n if (options.data && (!options.type || options.type.toUpperCase() == 'GET' || 'jsonp' == options.dataType))\n options.url = appendQuery(options.url, options.data), options.data = undefined\n }\n\n $.ajax = function(options){\n var settings = $.extend({}, options || {}),\n deferred = $.Deferred && $.Deferred(),\n urlAnchor, hashIndex\n for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key]\n\n ajaxStart(settings)\n\n if (!settings.crossDomain) {\n urlAnchor = document.createElement('a')\n urlAnchor.href = settings.url\n // cleans up URL for .href (IE only), see https://github.com/madrobby/zepto/pull/1049\n urlAnchor.href = urlAnchor.href\n settings.crossDomain = (originAnchor.protocol + '//' + originAnchor.host) !== (urlAnchor.protocol + '//' + urlAnchor.host)\n }\n\n if (!settings.url) settings.url = window.location.toString()\n if ((hashIndex = settings.url.indexOf('#')) > -1) settings.url = settings.url.slice(0, hashIndex)\n serializeData(settings)\n\n var dataType = settings.dataType, hasPlaceholder = /\\?.+=\\?/.test(settings.url)\n if (hasPlaceholder) dataType = 'jsonp'\n\n if (settings.cache === false || (\n (!options || options.cache !== true) &&\n ('script' == dataType || 'jsonp' == dataType)\n ))\n settings.url = appendQuery(settings.url, '_=' + Date.now())\n\n if ('jsonp' == dataType) {\n if (!hasPlaceholder)\n settings.url = appendQuery(settings.url,\n settings.jsonp ? (settings.jsonp + '=?') : settings.jsonp === false ? '' : 'callback=?')\n return $.ajaxJSONP(settings, deferred)\n }\n\n var mime = settings.accepts[dataType],\n headers = { },\n setHeader = function(name, value) { headers[name.toLowerCase()] = [name, value] },\n protocol = /^([\\w-]+:)\\/\\//.test(settings.url) ? RegExp.$1 : window.location.protocol,\n xhr = settings.xhr(),\n nativeSetHeader = xhr.setRequestHeader,\n abortTimeout\n\n if (deferred) deferred.promise(xhr)\n\n if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest')\n setHeader('Accept', mime || '*/*')\n if (mime = settings.mimeType || mime) {\n if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0]\n xhr.overrideMimeType && xhr.overrideMimeType(mime)\n }\n if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET'))\n setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded')\n\n if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name])\n xhr.setRequestHeader = setHeader\n\n xhr.onreadystatechange = function(){\n if (xhr.readyState == 4) {\n xhr.onreadystatechange = empty\n clearTimeout(abortTimeout)\n var result, error = false\n if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) {\n dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'))\n\n if (xhr.responseType == 'arraybuffer' || xhr.responseType == 'blob')\n result = xhr.response\n else {\n result = xhr.responseText\n\n try {\n // http://perfectionkills.com/global-eval-what-are-the-options/\n // sanitize response accordingly if data filter callback provided\n result = ajaxDataFilter(result, dataType, settings)\n if (dataType == 'script') (1,eval)(result)\n else if (dataType == 'xml') result = xhr.responseXML\n else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result)\n } catch (e) { error = e }\n\n if (error) return ajaxError(error, 'parsererror', xhr, settings, deferred)\n }\n\n ajaxSuccess(result, xhr, settings, deferred)\n } else {\n ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred)\n }\n }\n }\n\n if (ajaxBeforeSend(xhr, settings) === false) {\n xhr.abort()\n ajaxError(null, 'abort', xhr, settings, deferred)\n return xhr\n }\n\n var async = 'async' in settings ? settings.async : true\n xhr.open(settings.type, settings.url, async, settings.username, settings.password)\n\n if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name]\n\n for (name in headers) nativeSetHeader.apply(xhr, headers[name])\n\n if (settings.timeout > 0) abortTimeout = setTimeout(function(){\n xhr.onreadystatechange = empty\n xhr.abort()\n ajaxError(null, 'timeout', xhr, settings, deferred)\n }, settings.timeout)\n\n // avoid sending empty string (#319)\n xhr.send(settings.data ? settings.data : null)\n return xhr\n }\n\n // handle optional data/success arguments\n function parseArguments(url, data, success, dataType) {\n if ($.isFunction(data)) dataType = success, success = data, data = undefined\n if (!$.isFunction(success)) dataType = success, success = undefined\n return {\n url: url\n , data: data\n , success: success\n , dataType: dataType\n }\n }\n\n $.get = function(/* url, data, success, dataType */){\n return $.ajax(parseArguments.apply(null, arguments))\n }\n\n $.post = function(/* url, data, success, dataType */){\n var options = parseArguments.apply(null, arguments)\n options.type = 'POST'\n return $.ajax(options)\n }\n\n $.getJSON = function(/* url, data, success */){\n var options = parseArguments.apply(null, arguments)\n options.dataType = 'json'\n return $.ajax(options)\n }\n\n $.fn.load = function(url, data, success){\n if (!this.length) return this\n var self = this, parts = url.split(/\\s/), selector,\n options = parseArguments(url, data, success),\n callback = options.success\n if (parts.length > 1) options.url = parts[0], selector = parts[1]\n options.success = function(response){\n self.html(selector ?\n $('

').html(response.replace(rscript, \"\")).find(selector)\n : response)\n callback && callback.apply(self, arguments)\n }\n $.ajax(options)\n return this\n }\n\n var escape = encodeURIComponent\n\n function serialize(params, obj, traditional, scope){\n var type, array = $.isArray(obj), hash = $.isPlainObject(obj)\n $.each(obj, function(key, value) {\n type = $.type(value)\n if (scope) key = traditional ? scope :\n scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']'\n // handle data in serializeArray() format\n if (!scope && array) params.add(value.name, value.value)\n // recurse into nested objects\n else if (type == \"array\" || (!traditional && type == \"object\"))\n serialize(params, value, traditional, key)\n else params.add(key, value)\n })\n }\n\n $.param = function(obj, traditional){\n var params = []\n params.add = function(key, value) {\n if ($.isFunction(value)) value = value()\n if (value == null) value = \"\"\n this.push(escape(key) + '=' + escape(value))\n }\n serialize(params, obj, traditional)\n return params.join('&').replace(/%20/g, '+')\n }\n})(Zepto)\n\n;(function($){\n // Create a collection of callbacks to be fired in a sequence, with configurable behaviour\n // Option flags:\n // - once: Callbacks fired at most one time.\n // - memory: Remember the most recent context and arguments\n // - stopOnFalse: Cease iterating over callback list\n // - unique: Permit adding at most one instance of the same callback\n $.Callbacks = function(options) {\n options = $.extend({}, options)\n\n var memory, // Last fire value (for non-forgettable lists)\n fired, // Flag to know if list was already fired\n firing, // Flag to know if list is currently firing\n firingStart, // First callback to fire (used internally by add and fireWith)\n firingLength, // End of the loop when firing\n firingIndex, // Index of currently firing callback (modified by remove if needed)\n list = [], // Actual callback list\n stack = !options.once && [], // Stack of fire calls for repeatable lists\n fire = function(data) {\n memory = options.memory && data\n fired = true\n firingIndex = firingStart || 0\n firingStart = 0\n firingLength = list.length\n firing = true\n for ( ; list && firingIndex < firingLength ; ++firingIndex ) {\n if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {\n memory = false\n break\n }\n }\n firing = false\n if (list) {\n if (stack) stack.length && fire(stack.shift())\n else if (memory) list.length = 0\n else Callbacks.disable()\n }\n },\n\n Callbacks = {\n add: function() {\n if (list) {\n var start = list.length,\n add = function(args) {\n $.each(args, function(_, arg){\n if (typeof arg === \"function\") {\n if (!options.unique || !Callbacks.has(arg)) list.push(arg)\n }\n else if (arg && arg.length && typeof arg !== 'string') add(arg)\n })\n }\n add(arguments)\n if (firing) firingLength = list.length\n else if (memory) {\n firingStart = start\n fire(memory)\n }\n }\n return this\n },\n remove: function() {\n if (list) {\n $.each(arguments, function(_, arg){\n var index\n while ((index = $.inArray(arg, list, index)) > -1) {\n list.splice(index, 1)\n // Handle firing indexes\n if (firing) {\n if (index <= firingLength) --firingLength\n if (index <= firingIndex) --firingIndex\n }\n }\n })\n }\n return this\n },\n has: function(fn) {\n return !!(list && (fn ? $.inArray(fn, list) > -1 : list.length))\n },\n empty: function() {\n firingLength = list.length = 0\n return this\n },\n disable: function() {\n list = stack = memory = undefined\n return this\n },\n disabled: function() {\n return !list\n },\n lock: function() {\n stack = undefined\n if (!memory) Callbacks.disable()\n return this\n },\n locked: function() {\n return !stack\n },\n fireWith: function(context, args) {\n if (list && (!fired || stack)) {\n args = args || []\n args = [context, args.slice ? args.slice() : args]\n if (firing) stack.push(args)\n else fire(args)\n }\n return this\n },\n fire: function() {\n return Callbacks.fireWith(this, arguments)\n },\n fired: function() {\n return !!fired\n }\n }\n\n return Callbacks\n }\n})(Zepto)\n\n;(function($){\n var slice = Array.prototype.slice\n\n function Deferred(func) {\n var tuples = [\n // action, add listener, listener list, final state\n [ \"resolve\", \"done\", $.Callbacks({once:1, memory:1}), \"resolved\" ],\n [ \"reject\", \"fail\", $.Callbacks({once:1, memory:1}), \"rejected\" ],\n [ \"notify\", \"progress\", $.Callbacks({memory:1}) ]\n ],\n state = \"pending\",\n promise = {\n state: function() {\n return state\n },\n always: function() {\n deferred.done(arguments).fail(arguments)\n return this\n },\n then: function(/* fnDone [, fnFailed [, fnProgress]] */) {\n var fns = arguments\n return Deferred(function(defer){\n $.each(tuples, function(i, tuple){\n var fn = $.isFunction(fns[i]) && fns[i]\n deferred[tuple[1]](function(){\n var returned = fn && fn.apply(this, arguments)\n if (returned && $.isFunction(returned.promise)) {\n returned.promise()\n .done(defer.resolve)\n .fail(defer.reject)\n .progress(defer.notify)\n } else {\n var context = this === promise ? defer.promise() : this,\n values = fn ? [returned] : arguments\n defer[tuple[0] + \"With\"](context, values)\n }\n })\n })\n fns = null\n }).promise()\n },\n\n promise: function(obj) {\n return obj != null ? $.extend( obj, promise ) : promise\n }\n },\n deferred = {}\n\n $.each(tuples, function(i, tuple){\n var list = tuple[2],\n stateString = tuple[3]\n\n promise[tuple[1]] = list.add\n\n if (stateString) {\n list.add(function(){\n state = stateString\n }, tuples[i^1][2].disable, tuples[2][2].lock)\n }\n\n deferred[tuple[0]] = function(){\n deferred[tuple[0] + \"With\"](this === deferred ? promise : this, arguments)\n return this\n }\n deferred[tuple[0] + \"With\"] = list.fireWith\n })\n\n promise.promise(deferred)\n if (func) func.call(deferred, deferred)\n return deferred\n }\n\n $.when = function(sub) {\n var resolveValues = slice.call(arguments),\n len = resolveValues.length,\n i = 0,\n remain = len !== 1 || (sub && $.isFunction(sub.promise)) ? len : 0,\n deferred = remain === 1 ? sub : Deferred(),\n progressValues, progressContexts, resolveContexts,\n updateFn = function(i, ctx, val){\n return function(value){\n ctx[i] = this\n val[i] = arguments.length > 1 ? slice.call(arguments) : value\n if (val === progressValues) {\n deferred.notifyWith(ctx, val)\n } else if (!(--remain)) {\n deferred.resolveWith(ctx, val)\n }\n }\n }\n\n if (len > 1) {\n progressValues = new Array(len)\n progressContexts = new Array(len)\n resolveContexts = new Array(len)\n for ( ; i < len; ++i ) {\n if (resolveValues[i] && $.isFunction(resolveValues[i].promise)) {\n resolveValues[i].promise()\n .done(updateFn(i, resolveContexts, resolveValues))\n .fail(deferred.reject)\n .progress(updateFn(i, progressContexts, progressValues))\n } else {\n --remain\n }\n }\n }\n if (!remain) deferred.resolveWith(resolveContexts, resolveValues)\n return deferred.promise()\n }\n\n $.Deferred = Deferred\n})(Zepto)\n\n;(function($){\n var _zid = 1, undefined,\n slice = Array.prototype.slice,\n isFunction = $.isFunction,\n isString = function(obj){ return typeof obj == 'string' },\n handlers = {},\n specialEvents={},\n focusinSupported = 'onfocusin' in window,\n focus = { focus: 'focusin', blur: 'focusout' },\n hover = { mouseenter: 'mouseover', mouseleave: 'mouseout' }\n\n specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents'\n\n function zid(element) {\n return element._zid || (element._zid = _zid++)\n }\n function findHandlers(element, event, fn, selector) {\n event = parse(event)\n if (event.ns) var matcher = matcherFor(event.ns)\n return (handlers[zid(element)] || []).filter(function(handler) {\n return handler\n && (!event.e || handler.e == event.e)\n && (!event.ns || matcher.test(handler.ns))\n && (!fn || zid(handler.fn) === zid(fn))\n && (!selector || handler.sel == selector)\n })\n }\n function parse(event) {\n var parts = ('' + event).split('.')\n return {e: parts[0], ns: parts.slice(1).sort().join(' ')}\n }\n function matcherFor(ns) {\n return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)')\n }\n\n function eventCapture(handler, captureSetting) {\n return handler.del &&\n (!focusinSupported && (handler.e in focus)) ||\n !!captureSetting\n }\n\n function realEvent(type) {\n return hover[type] || (focusinSupported && focus[type]) || type\n }\n\n function add(element, events, fn, data, selector, delegator, capture){\n var id = zid(element), set = (handlers[id] || (handlers[id] = []))\n events.split(/\\s/).forEach(function(event){\n if (event == 'ready') return $(document).ready(fn)\n var handler = parse(event)\n handler.fn = fn\n handler.sel = selector\n // emulate mouseenter, mouseleave\n if (handler.e in hover) fn = function(e){\n var related = e.relatedTarget\n if (!related || (related !== this && !$.contains(this, related)))\n return handler.fn.apply(this, arguments)\n }\n handler.del = delegator\n var callback = delegator || fn\n handler.proxy = function(e){\n e = compatible(e)\n if (e.isImmediatePropagationStopped()) return\n e.data = data\n var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args))\n if (result === false) e.preventDefault(), e.stopPropagation()\n return result\n }\n handler.i = set.length\n set.push(handler)\n if ('addEventListener' in element)\n element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))\n })\n }\n function remove(element, events, fn, selector, capture){\n var id = zid(element)\n ;(events || '').split(/\\s/).forEach(function(event){\n findHandlers(element, event, fn, selector).forEach(function(handler){\n delete handlers[id][handler.i]\n if ('removeEventListener' in element)\n element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))\n })\n })\n }\n\n $.event = { add: add, remove: remove }\n\n $.proxy = function(fn, context) {\n var args = (2 in arguments) && slice.call(arguments, 2)\n if (isFunction(fn)) {\n var proxyFn = function(){ return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments) }\n proxyFn._zid = zid(fn)\n return proxyFn\n } else if (isString(context)) {\n if (args) {\n args.unshift(fn[context], fn)\n return $.proxy.apply(null, args)\n } else {\n return $.proxy(fn[context], fn)\n }\n } else {\n throw new TypeError(\"expected function\")\n }\n }\n\n $.fn.bind = function(event, data, callback){\n return this.on(event, data, callback)\n }\n $.fn.unbind = function(event, callback){\n return this.off(event, callback)\n }\n $.fn.one = function(event, selector, data, callback){\n return this.on(event, selector, data, callback, 1)\n }\n\n var returnTrue = function(){return true},\n returnFalse = function(){return false},\n ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,\n eventMethods = {\n preventDefault: 'isDefaultPrevented',\n stopImmediatePropagation: 'isImmediatePropagationStopped',\n stopPropagation: 'isPropagationStopped'\n }\n\n function compatible(event, source) {\n if (source || !event.isDefaultPrevented) {\n source || (source = event)\n\n $.each(eventMethods, function(name, predicate) {\n var sourceMethod = source[name]\n event[name] = function(){\n this[predicate] = returnTrue\n return sourceMethod && sourceMethod.apply(source, arguments)\n }\n event[predicate] = returnFalse\n })\n\n event.timeStamp || (event.timeStamp = Date.now())\n\n if (source.defaultPrevented !== undefined ? source.defaultPrevented :\n 'returnValue' in source ? source.returnValue === false :\n source.getPreventDefault && source.getPreventDefault())\n event.isDefaultPrevented = returnTrue\n }\n return event\n }\n\n function createProxy(event) {\n var key, proxy = { originalEvent: event }\n for (key in event)\n if (!ignoreProperties.test(key) && event[key] !== undefined) proxy[key] = event[key]\n\n return compatible(proxy, event)\n }\n\n $.fn.delegate = function(selector, event, callback){\n return this.on(event, selector, callback)\n }\n $.fn.undelegate = function(selector, event, callback){\n return this.off(event, selector, callback)\n }\n\n $.fn.live = function(event, callback){\n $(document.body).delegate(this.selector, event, callback)\n return this\n }\n $.fn.die = function(event, callback){\n $(document.body).undelegate(this.selector, event, callback)\n return this\n }\n\n $.fn.on = function(event, selector, data, callback, one){\n var autoRemove, delegator, $this = this\n if (event && !isString(event)) {\n $.each(event, function(type, fn){\n $this.on(type, selector, data, fn, one)\n })\n return $this\n }\n\n if (!isString(selector) && !isFunction(callback) && callback !== false)\n callback = data, data = selector, selector = undefined\n if (callback === undefined || data === false)\n callback = data, data = undefined\n\n if (callback === false) callback = returnFalse\n\n return $this.each(function(_, element){\n if (one) autoRemove = function(e){\n remove(element, e.type, callback)\n return callback.apply(this, arguments)\n }\n\n if (selector) delegator = function(e){\n var evt, match = $(e.target).closest(selector, element).get(0)\n if (match && match !== element) {\n evt = $.extend(createProxy(e), {currentTarget: match, liveFired: element})\n return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1)))\n }\n }\n\n add(element, event, callback, data, selector, delegator || autoRemove)\n })\n }\n $.fn.off = function(event, selector, callback){\n var $this = this\n if (event && !isString(event)) {\n $.each(event, function(type, fn){\n $this.off(type, selector, fn)\n })\n return $this\n }\n\n if (!isString(selector) && !isFunction(callback) && callback !== false)\n callback = selector, selector = undefined\n\n if (callback === false) callback = returnFalse\n\n return $this.each(function(){\n remove(this, event, callback, selector)\n })\n }\n\n $.fn.trigger = function(event, args){\n event = (isString(event) || $.isPlainObject(event)) ? $.Event(event) : compatible(event)\n event._args = args\n return this.each(function(){\n // handle focus(), blur() by calling them directly\n if (event.type in focus && typeof this[event.type] == \"function\") this[event.type]()\n // items in the collection might not be DOM elements\n else if ('dispatchEvent' in this) this.dispatchEvent(event)\n else $(this).triggerHandler(event, args)\n })\n }\n\n // triggers event handlers on current element just as if an event occurred,\n // doesn't trigger an actual event, doesn't bubble\n $.fn.triggerHandler = function(event, args){\n var e, result\n this.each(function(i, element){\n e = createProxy(isString(event) ? $.Event(event) : event)\n e._args = args\n e.target = element\n $.each(findHandlers(element, event.type || event), function(i, handler){\n result = handler.proxy(e)\n if (e.isImmediatePropagationStopped()) return false\n })\n })\n return result\n }\n\n // shortcut methods for `.bind(event, fn)` for each event type\n ;('focusin focusout focus blur load resize scroll unload click dblclick '+\n 'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave '+\n 'change select keydown keypress keyup error').split(' ').forEach(function(event) {\n $.fn[event] = function(callback) {\n return (0 in arguments) ?\n this.bind(event, callback) :\n this.trigger(event)\n }\n })\n\n $.Event = function(type, props) {\n if (!isString(type)) props = type, type = props.type\n var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true\n if (props) for (var name in props) (name == 'bubbles') ? (bubbles = !!props[name]) : (event[name] = props[name])\n event.initEvent(type, bubbles, true)\n return compatible(event)\n }\n\n})(Zepto)\n\n;(function(){\n // getComputedStyle shouldn't freak out when called\n // without a valid element as argument\n try {\n getComputedStyle(undefined)\n } catch(e) {\n var nativeGetComputedStyle = getComputedStyle\n window.getComputedStyle = function(element, pseudoElement){\n try {\n return nativeGetComputedStyle(element, pseudoElement)\n } catch(e) {\n return null\n }\n }\n }\n})()\n\n;(function($){\n var zepto = $.zepto, oldQsa = zepto.qsa, oldMatches = zepto.matches\n\n function visible(elem){\n elem = $(elem)\n return !!(elem.width() || elem.height()) && elem.css(\"display\") !== \"none\"\n }\n\n // Implements a subset from:\n // http://api.jquery.com/category/selectors/jquery-selector-extensions/\n //\n // Each filter function receives the current index, all nodes in the\n // considered set, and a value if there were parentheses. The value\n // of `this` is the node currently being considered. The function returns the\n // resulting node(s), null, or undefined.\n //\n // Complex selectors are not supported:\n // li:has(label:contains(\"foo\")) + li:has(label:contains(\"bar\"))\n // ul.inner:first > li\n var filters = $.expr[':'] = {\n visible: function(){ if (visible(this)) return this },\n hidden: function(){ if (!visible(this)) return this },\n selected: function(){ if (this.selected) return this },\n checked: function(){ if (this.checked) return this },\n parent: function(){ return this.parentNode },\n first: function(idx){ if (idx === 0) return this },\n last: function(idx, nodes){ if (idx === nodes.length - 1) return this },\n eq: function(idx, _, value){ if (idx === value) return this },\n contains: function(idx, _, text){ if ($(this).text().indexOf(text) > -1) return this },\n has: function(idx, _, sel){ if (zepto.qsa(this, sel).length) return this }\n }\n\n var filterRe = new RegExp('(.*):(\\\\w+)(?:\\\\(([^)]+)\\\\))?$\\\\s*'),\n childRe = /^\\s*>/,\n classTag = 'Zepto' + (+new Date())\n\n function process(sel, fn) {\n // quote the hash in `a[href^=#]` expression\n sel = sel.replace(/=#\\]/g, '=\"#\"]')\n var filter, arg, match = filterRe.exec(sel)\n if (match && match[2] in filters) {\n filter = filters[match[2]], arg = match[3]\n sel = match[1]\n if (arg) {\n var num = Number(arg)\n if (isNaN(num)) arg = arg.replace(/^[\"']|[\"']$/g, '')\n else arg = num\n }\n }\n return fn(sel, filter, arg)\n }\n\n zepto.qsa = function(node, selector) {\n return process(selector, function(sel, filter, arg){\n try {\n var taggedParent\n if (!sel && filter) sel = '*'\n else if (childRe.test(sel))\n // support \"> *\" child queries by tagging the parent node with a\n // unique class and prepending that classname onto the selector\n taggedParent = $(node).addClass(classTag), sel = '.'+classTag+' '+sel\n\n var nodes = oldQsa(node, sel)\n } catch(e) {\n console.error('error performing selector: %o', selector)\n throw e\n } finally {\n if (taggedParent) taggedParent.removeClass(classTag)\n }\n return !filter ? nodes :\n zepto.uniq($.map(nodes, function(n, i){ return filter.call(n, i, nodes, arg) }))\n })\n }\n\n zepto.matches = function(node, selector){\n return process(selector, function(sel, filter, arg){\n return (!sel || oldMatches(node, sel)) &&\n (!filter || filter.call(node, null, arg) === node)\n })\n }\n})(Zepto)\nmodule.exports = Zepto\n\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/array/from.js\":\n/*!*******************************************************!*\\\n !*** ./node_modules/core-js/library/fn/array/from.js ***!\n \\*******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ../../modules/es6.string.iterator */ \"./node_modules/core-js/library/modules/es6.string.iterator.js\");\n__webpack_require__(/*! ../../modules/es6.array.from */ \"./node_modules/core-js/library/modules/es6.array.from.js\");\nmodule.exports = __webpack_require__(/*! ../../modules/_core */ \"./node_modules/core-js/library/modules/_core.js\").Array.from;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/get-iterator.js\":\n/*!*********************************************************!*\\\n !*** ./node_modules/core-js/library/fn/get-iterator.js ***!\n \\*********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ../modules/web.dom.iterable */ \"./node_modules/core-js/library/modules/web.dom.iterable.js\");\n__webpack_require__(/*! ../modules/es6.string.iterator */ \"./node_modules/core-js/library/modules/es6.string.iterator.js\");\nmodule.exports = __webpack_require__(/*! ../modules/core.get-iterator */ \"./node_modules/core-js/library/modules/core.get-iterator.js\");\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/json/stringify.js\":\n/*!***********************************************************!*\\\n !*** ./node_modules/core-js/library/fn/json/stringify.js ***!\n \\***********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar core = __webpack_require__(/*! ../../modules/_core */ \"./node_modules/core-js/library/modules/_core.js\")\n , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify});\nmodule.exports = function stringify(it){ // eslint-disable-line no-unused-vars\n return $JSON.stringify.apply($JSON, arguments);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/object/assign.js\":\n/*!**********************************************************!*\\\n !*** ./node_modules/core-js/library/fn/object/assign.js ***!\n \\**********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ../../modules/es6.object.assign */ \"./node_modules/core-js/library/modules/es6.object.assign.js\");\nmodule.exports = __webpack_require__(/*! ../../modules/_core */ \"./node_modules/core-js/library/modules/_core.js\").Object.assign;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/object/create.js\":\n/*!**********************************************************!*\\\n !*** ./node_modules/core-js/library/fn/object/create.js ***!\n \\**********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ../../modules/es6.object.create */ \"./node_modules/core-js/library/modules/es6.object.create.js\");\nvar $Object = __webpack_require__(/*! ../../modules/_core */ \"./node_modules/core-js/library/modules/_core.js\").Object;\nmodule.exports = function create(P, D){\n return $Object.create(P, D);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/object/define-property.js\":\n/*!*******************************************************************!*\\\n !*** ./node_modules/core-js/library/fn/object/define-property.js ***!\n \\*******************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ../../modules/es6.object.define-property */ \"./node_modules/core-js/library/modules/es6.object.define-property.js\");\nvar $Object = __webpack_require__(/*! ../../modules/_core */ \"./node_modules/core-js/library/modules/_core.js\").Object;\nmodule.exports = function defineProperty(it, key, desc){\n return $Object.defineProperty(it, key, desc);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/object/get-own-property-descriptor.js\":\n/*!*******************************************************************************!*\\\n !*** ./node_modules/core-js/library/fn/object/get-own-property-descriptor.js ***!\n \\*******************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ../../modules/es6.object.get-own-property-descriptor */ \"./node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js\");\nvar $Object = __webpack_require__(/*! ../../modules/_core */ \"./node_modules/core-js/library/modules/_core.js\").Object;\nmodule.exports = function getOwnPropertyDescriptor(it, key){\n return $Object.getOwnPropertyDescriptor(it, key);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/object/keys.js\":\n/*!********************************************************!*\\\n !*** ./node_modules/core-js/library/fn/object/keys.js ***!\n \\********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ../../modules/es6.object.keys */ \"./node_modules/core-js/library/modules/es6.object.keys.js\");\nmodule.exports = __webpack_require__(/*! ../../modules/_core */ \"./node_modules/core-js/library/modules/_core.js\").Object.keys;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/object/set-prototype-of.js\":\n/*!********************************************************************!*\\\n !*** ./node_modules/core-js/library/fn/object/set-prototype-of.js ***!\n \\********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ../../modules/es6.object.set-prototype-of */ \"./node_modules/core-js/library/modules/es6.object.set-prototype-of.js\");\nmodule.exports = __webpack_require__(/*! ../../modules/_core */ \"./node_modules/core-js/library/modules/_core.js\").Object.setPrototypeOf;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/symbol/index.js\":\n/*!*********************************************************!*\\\n !*** ./node_modules/core-js/library/fn/symbol/index.js ***!\n \\*********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ../../modules/es6.symbol */ \"./node_modules/core-js/library/modules/es6.symbol.js\");\n__webpack_require__(/*! ../../modules/es6.object.to-string */ \"./node_modules/core-js/library/modules/es6.object.to-string.js\");\n__webpack_require__(/*! ../../modules/es7.symbol.async-iterator */ \"./node_modules/core-js/library/modules/es7.symbol.async-iterator.js\");\n__webpack_require__(/*! ../../modules/es7.symbol.observable */ \"./node_modules/core-js/library/modules/es7.symbol.observable.js\");\nmodule.exports = __webpack_require__(/*! ../../modules/_core */ \"./node_modules/core-js/library/modules/_core.js\").Symbol;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/fn/symbol/iterator.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/fn/symbol/iterator.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ../../modules/es6.string.iterator */ \"./node_modules/core-js/library/modules/es6.string.iterator.js\");\n__webpack_require__(/*! ../../modules/web.dom.iterable */ \"./node_modules/core-js/library/modules/web.dom.iterable.js\");\nmodule.exports = __webpack_require__(/*! ../../modules/_wks-ext */ \"./node_modules/core-js/library/modules/_wks-ext.js\").f('iterator');\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_a-function.js\":\n/*!*************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_a-function.js ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = function(it){\n if(typeof it != 'function')throw TypeError(it + ' is not a function!');\n return it;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_add-to-unscopables.js\":\n/*!*********************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_add-to-unscopables.js ***!\n \\*********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = function(){ /* empty */ };\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_an-object.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_an-object.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar isObject = __webpack_require__(/*! ./_is-object */ \"./node_modules/core-js/library/modules/_is-object.js\");\nmodule.exports = function(it){\n if(!isObject(it))throw TypeError(it + ' is not an object!');\n return it;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_array-includes.js\":\n/*!*****************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_array-includes.js ***!\n \\*****************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = __webpack_require__(/*! ./_to-iobject */ \"./node_modules/core-js/library/modules/_to-iobject.js\")\n , toLength = __webpack_require__(/*! ./_to-length */ \"./node_modules/core-js/library/modules/_to-length.js\")\n , toIndex = __webpack_require__(/*! ./_to-index */ \"./node_modules/core-js/library/modules/_to-index.js\");\nmodule.exports = function(IS_INCLUDES){\n return function($this, el, fromIndex){\n var O = toIObject($this)\n , length = toLength(O.length)\n , index = toIndex(fromIndex, length)\n , value;\n // Array#includes uses SameValueZero equality algorithm\n if(IS_INCLUDES && el != el)while(length > index){\n value = O[index++];\n if(value != value)return true;\n // Array#toIndex ignores holes, Array#includes - not\n } else for(;length > index; index++)if(IS_INCLUDES || index in O){\n if(O[index] === el)return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_classof.js\":\n/*!**********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_classof.js ***!\n \\**********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = __webpack_require__(/*! ./_cof */ \"./node_modules/core-js/library/modules/_cof.js\")\n , TAG = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/library/modules/_wks.js\")('toStringTag')\n // ES3 wrong here\n , ARG = cof(function(){ return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function(it, key){\n try {\n return it[key];\n } catch(e){ /* empty */ }\n};\n\nmodule.exports = function(it){\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_cof.js\":\n/*!******************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_cof.js ***!\n \\******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar toString = {}.toString;\n\nmodule.exports = function(it){\n return toString.call(it).slice(8, -1);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_core.js\":\n/*!*******************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_core.js ***!\n \\*******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar core = module.exports = {version: '2.4.0'};\nif(typeof __e == 'number')__e = core; // eslint-disable-line no-undef\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_create-property.js\":\n/*!******************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_create-property.js ***!\n \\******************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar $defineProperty = __webpack_require__(/*! ./_object-dp */ \"./node_modules/core-js/library/modules/_object-dp.js\")\n , createDesc = __webpack_require__(/*! ./_property-desc */ \"./node_modules/core-js/library/modules/_property-desc.js\");\n\nmodule.exports = function(object, index, value){\n if(index in object)$defineProperty.f(object, index, createDesc(0, value));\n else object[index] = value;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_ctx.js\":\n/*!******************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_ctx.js ***!\n \\******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// optional / simple context binding\nvar aFunction = __webpack_require__(/*! ./_a-function */ \"./node_modules/core-js/library/modules/_a-function.js\");\nmodule.exports = function(fn, that, length){\n aFunction(fn);\n if(that === undefined)return fn;\n switch(length){\n case 1: return function(a){\n return fn.call(that, a);\n };\n case 2: return function(a, b){\n return fn.call(that, a, b);\n };\n case 3: return function(a, b, c){\n return fn.call(that, a, b, c);\n };\n }\n return function(/* ...args */){\n return fn.apply(that, arguments);\n };\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_defined.js\":\n/*!**********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_defined.js ***!\n \\**********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function(it){\n if(it == undefined)throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_descriptors.js\":\n/*!**************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_descriptors.js ***!\n \\**************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// Thank's IE8 for his funny defineProperty\nmodule.exports = !__webpack_require__(/*! ./_fails */ \"./node_modules/core-js/library/modules/_fails.js\")(function(){\n return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;\n});\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_dom-create.js\":\n/*!*************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_dom-create.js ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar isObject = __webpack_require__(/*! ./_is-object */ \"./node_modules/core-js/library/modules/_is-object.js\")\n , document = __webpack_require__(/*! ./_global */ \"./node_modules/core-js/library/modules/_global.js\").document\n // in old IE typeof document.createElement is 'object'\n , is = isObject(document) && isObject(document.createElement);\nmodule.exports = function(it){\n return is ? document.createElement(it) : {};\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_enum-bug-keys.js\":\n/*!****************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_enum-bug-keys.js ***!\n \\****************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_enum-keys.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_enum-keys.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// all enumerable object keys, includes symbols\nvar getKeys = __webpack_require__(/*! ./_object-keys */ \"./node_modules/core-js/library/modules/_object-keys.js\")\n , gOPS = __webpack_require__(/*! ./_object-gops */ \"./node_modules/core-js/library/modules/_object-gops.js\")\n , pIE = __webpack_require__(/*! ./_object-pie */ \"./node_modules/core-js/library/modules/_object-pie.js\");\nmodule.exports = function(it){\n var result = getKeys(it)\n , getSymbols = gOPS.f;\n if(getSymbols){\n var symbols = getSymbols(it)\n , isEnum = pIE.f\n , i = 0\n , key;\n while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key);\n } return result;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_export.js\":\n/*!*********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_export.js ***!\n \\*********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar global = __webpack_require__(/*! ./_global */ \"./node_modules/core-js/library/modules/_global.js\")\n , core = __webpack_require__(/*! ./_core */ \"./node_modules/core-js/library/modules/_core.js\")\n , ctx = __webpack_require__(/*! ./_ctx */ \"./node_modules/core-js/library/modules/_ctx.js\")\n , hide = __webpack_require__(/*! ./_hide */ \"./node_modules/core-js/library/modules/_hide.js\")\n , PROTOTYPE = 'prototype';\n\nvar $export = function(type, name, source){\n var IS_FORCED = type & $export.F\n , IS_GLOBAL = type & $export.G\n , IS_STATIC = type & $export.S\n , IS_PROTO = type & $export.P\n , IS_BIND = type & $export.B\n , IS_WRAP = type & $export.W\n , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})\n , expProto = exports[PROTOTYPE]\n , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]\n , key, own, out;\n if(IS_GLOBAL)source = name;\n for(key in source){\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n if(own && key in exports)continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]\n // bind timers to global for call from export context\n : IS_BIND && own ? ctx(out, global)\n // wrap global constructors for prevent change them in library\n : IS_WRAP && target[key] == out ? (function(C){\n var F = function(a, b, c){\n if(this instanceof C){\n switch(arguments.length){\n case 0: return new C;\n case 1: return new C(a);\n case 2: return new C(a, b);\n } return new C(a, b, c);\n } return C.apply(this, arguments);\n };\n F[PROTOTYPE] = C[PROTOTYPE];\n return F;\n // make static versions for prototype methods\n })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%\n if(IS_PROTO){\n (exports.virtual || (exports.virtual = {}))[key] = out;\n // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%\n if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);\n }\n }\n};\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library` \nmodule.exports = $export;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_fails.js\":\n/*!********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_fails.js ***!\n \\********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = function(exec){\n try {\n return !!exec();\n } catch(e){\n return true;\n }\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_global.js\":\n/*!*********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_global.js ***!\n \\*********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();\nif(typeof __g == 'number')__g = global; // eslint-disable-line no-undef\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_has.js\":\n/*!******************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_has.js ***!\n \\******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function(it, key){\n return hasOwnProperty.call(it, key);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_hide.js\":\n/*!*******************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_hide.js ***!\n \\*******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar dP = __webpack_require__(/*! ./_object-dp */ \"./node_modules/core-js/library/modules/_object-dp.js\")\n , createDesc = __webpack_require__(/*! ./_property-desc */ \"./node_modules/core-js/library/modules/_property-desc.js\");\nmodule.exports = __webpack_require__(/*! ./_descriptors */ \"./node_modules/core-js/library/modules/_descriptors.js\") ? function(object, key, value){\n return dP.f(object, key, createDesc(1, value));\n} : function(object, key, value){\n object[key] = value;\n return object;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_html.js\":\n/*!*******************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_html.js ***!\n \\*******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(/*! ./_global */ \"./node_modules/core-js/library/modules/_global.js\").document && document.documentElement;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_ie8-dom-define.js\":\n/*!*****************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_ie8-dom-define.js ***!\n \\*****************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = !__webpack_require__(/*! ./_descriptors */ \"./node_modules/core-js/library/modules/_descriptors.js\") && !__webpack_require__(/*! ./_fails */ \"./node_modules/core-js/library/modules/_fails.js\")(function(){\n return Object.defineProperty(__webpack_require__(/*! ./_dom-create */ \"./node_modules/core-js/library/modules/_dom-create.js\")('div'), 'a', {get: function(){ return 7; }}).a != 7;\n});\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_iobject.js\":\n/*!**********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_iobject.js ***!\n \\**********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = __webpack_require__(/*! ./_cof */ \"./node_modules/core-js/library/modules/_cof.js\");\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_is-array-iter.js\":\n/*!****************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_is-array-iter.js ***!\n \\****************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// check on default Array iterator\nvar Iterators = __webpack_require__(/*! ./_iterators */ \"./node_modules/core-js/library/modules/_iterators.js\")\n , ITERATOR = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/library/modules/_wks.js\")('iterator')\n , ArrayProto = Array.prototype;\n\nmodule.exports = function(it){\n return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_is-array.js\":\n/*!***********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_is-array.js ***!\n \\***********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 7.2.2 IsArray(argument)\nvar cof = __webpack_require__(/*! ./_cof */ \"./node_modules/core-js/library/modules/_cof.js\");\nmodule.exports = Array.isArray || function isArray(arg){\n return cof(arg) == 'Array';\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_is-object.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_is-object.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = function(it){\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_iter-call.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_iter-call.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// call something on iterator step with safe closing on error\nvar anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/library/modules/_an-object.js\");\nmodule.exports = function(iterator, fn, value, entries){\n try {\n return entries ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch(e){\n var ret = iterator['return'];\n if(ret !== undefined)anObject(ret.call(iterator));\n throw e;\n }\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_iter-create.js\":\n/*!**************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_iter-create.js ***!\n \\**************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar create = __webpack_require__(/*! ./_object-create */ \"./node_modules/core-js/library/modules/_object-create.js\")\n , descriptor = __webpack_require__(/*! ./_property-desc */ \"./node_modules/core-js/library/modules/_property-desc.js\")\n , setToStringTag = __webpack_require__(/*! ./_set-to-string-tag */ \"./node_modules/core-js/library/modules/_set-to-string-tag.js\")\n , IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\n__webpack_require__(/*! ./_hide */ \"./node_modules/core-js/library/modules/_hide.js\")(IteratorPrototype, __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/library/modules/_wks.js\")('iterator'), function(){ return this; });\n\nmodule.exports = function(Constructor, NAME, next){\n Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_iter-define.js\":\n/*!**************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_iter-define.js ***!\n \\**************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar LIBRARY = __webpack_require__(/*! ./_library */ \"./node_modules/core-js/library/modules/_library.js\")\n , $export = __webpack_require__(/*! ./_export */ \"./node_modules/core-js/library/modules/_export.js\")\n , redefine = __webpack_require__(/*! ./_redefine */ \"./node_modules/core-js/library/modules/_redefine.js\")\n , hide = __webpack_require__(/*! ./_hide */ \"./node_modules/core-js/library/modules/_hide.js\")\n , has = __webpack_require__(/*! ./_has */ \"./node_modules/core-js/library/modules/_has.js\")\n , Iterators = __webpack_require__(/*! ./_iterators */ \"./node_modules/core-js/library/modules/_iterators.js\")\n , $iterCreate = __webpack_require__(/*! ./_iter-create */ \"./node_modules/core-js/library/modules/_iter-create.js\")\n , setToStringTag = __webpack_require__(/*! ./_set-to-string-tag */ \"./node_modules/core-js/library/modules/_set-to-string-tag.js\")\n , getPrototypeOf = __webpack_require__(/*! ./_object-gpo */ \"./node_modules/core-js/library/modules/_object-gpo.js\")\n , ITERATOR = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/library/modules/_wks.js\")('iterator')\n , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`\n , FF_ITERATOR = '@@iterator'\n , KEYS = 'keys'\n , VALUES = 'values';\n\nvar returnThis = function(){ return this; };\n\nmodule.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){\n $iterCreate(Constructor, NAME, next);\n var getMethod = function(kind){\n if(!BUGGY && kind in proto)return proto[kind];\n switch(kind){\n case KEYS: return function keys(){ return new Constructor(this, kind); };\n case VALUES: return function values(){ return new Constructor(this, kind); };\n } return function entries(){ return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator'\n , DEF_VALUES = DEFAULT == VALUES\n , VALUES_BUG = false\n , proto = Base.prototype\n , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]\n , $default = $native || getMethod(DEFAULT)\n , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined\n , $anyNative = NAME == 'Array' ? proto.entries || $native : $native\n , methods, key, IteratorPrototype;\n // Fix native\n if($anyNative){\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base));\n if(IteratorPrototype !== Object.prototype){\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if(DEF_VALUES && $native && $native.name !== VALUES){\n VALUES_BUG = true;\n $default = function values(){ return $native.call(this); };\n }\n // Define iterator\n if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if(DEFAULT){\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if(FORCED)for(key in methods){\n if(!(key in proto))redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_iter-detect.js\":\n/*!**************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_iter-detect.js ***!\n \\**************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar ITERATOR = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/library/modules/_wks.js\")('iterator')\n , SAFE_CLOSING = false;\n\ntry {\n var riter = [7][ITERATOR]();\n riter['return'] = function(){ SAFE_CLOSING = true; };\n Array.from(riter, function(){ throw 2; });\n} catch(e){ /* empty */ }\n\nmodule.exports = function(exec, skipClosing){\n if(!skipClosing && !SAFE_CLOSING)return false;\n var safe = false;\n try {\n var arr = [7]\n , iter = arr[ITERATOR]();\n iter.next = function(){ return {done: safe = true}; };\n arr[ITERATOR] = function(){ return iter; };\n exec(arr);\n } catch(e){ /* empty */ }\n return safe;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_iter-step.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_iter-step.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = function(done, value){\n return {value: value, done: !!done};\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_iterators.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_iterators.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = {};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_keyof.js\":\n/*!********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_keyof.js ***!\n \\********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar getKeys = __webpack_require__(/*! ./_object-keys */ \"./node_modules/core-js/library/modules/_object-keys.js\")\n , toIObject = __webpack_require__(/*! ./_to-iobject */ \"./node_modules/core-js/library/modules/_to-iobject.js\");\nmodule.exports = function(object, el){\n var O = toIObject(object)\n , keys = getKeys(O)\n , length = keys.length\n , index = 0\n , key;\n while(length > index)if(O[key = keys[index++]] === el)return key;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_library.js\":\n/*!**********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_library.js ***!\n \\**********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = true;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_meta.js\":\n/*!*******************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_meta.js ***!\n \\*******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar META = __webpack_require__(/*! ./_uid */ \"./node_modules/core-js/library/modules/_uid.js\")('meta')\n , isObject = __webpack_require__(/*! ./_is-object */ \"./node_modules/core-js/library/modules/_is-object.js\")\n , has = __webpack_require__(/*! ./_has */ \"./node_modules/core-js/library/modules/_has.js\")\n , setDesc = __webpack_require__(/*! ./_object-dp */ \"./node_modules/core-js/library/modules/_object-dp.js\").f\n , id = 0;\nvar isExtensible = Object.isExtensible || function(){\n return true;\n};\nvar FREEZE = !__webpack_require__(/*! ./_fails */ \"./node_modules/core-js/library/modules/_fails.js\")(function(){\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function(it){\n setDesc(it, META, {value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n }});\n};\nvar fastKey = function(it, create){\n // return primitive with prefix\n if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if(!has(it, META)){\n // can't set metadata to uncaught frozen object\n if(!isExtensible(it))return 'F';\n // not necessary to add metadata\n if(!create)return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function(it, create){\n if(!has(it, META)){\n // can't set metadata to uncaught frozen object\n if(!isExtensible(it))return true;\n // not necessary to add metadata\n if(!create)return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function(it){\n if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-assign.js\":\n/*!****************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-assign.js ***!\n \\****************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n// 19.1.2.1 Object.assign(target, source, ...)\nvar getKeys = __webpack_require__(/*! ./_object-keys */ \"./node_modules/core-js/library/modules/_object-keys.js\")\n , gOPS = __webpack_require__(/*! ./_object-gops */ \"./node_modules/core-js/library/modules/_object-gops.js\")\n , pIE = __webpack_require__(/*! ./_object-pie */ \"./node_modules/core-js/library/modules/_object-pie.js\")\n , toObject = __webpack_require__(/*! ./_to-object */ \"./node_modules/core-js/library/modules/_to-object.js\")\n , IObject = __webpack_require__(/*! ./_iobject */ \"./node_modules/core-js/library/modules/_iobject.js\")\n , $assign = Object.assign;\n\n// should work with symbols and should have deterministic property order (V8 bug)\nmodule.exports = !$assign || __webpack_require__(/*! ./_fails */ \"./node_modules/core-js/library/modules/_fails.js\")(function(){\n var A = {}\n , B = {}\n , S = Symbol()\n , K = 'abcdefghijklmnopqrst';\n A[S] = 7;\n K.split('').forEach(function(k){ B[k] = k; });\n return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;\n}) ? function assign(target, source){ // eslint-disable-line no-unused-vars\n var T = toObject(target)\n , aLen = arguments.length\n , index = 1\n , getSymbols = gOPS.f\n , isEnum = pIE.f;\n while(aLen > index){\n var S = IObject(arguments[index++])\n , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)\n , length = keys.length\n , j = 0\n , key;\n while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];\n } return T;\n} : $assign;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-create.js\":\n/*!****************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-create.js ***!\n \\****************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/library/modules/_an-object.js\")\n , dPs = __webpack_require__(/*! ./_object-dps */ \"./node_modules/core-js/library/modules/_object-dps.js\")\n , enumBugKeys = __webpack_require__(/*! ./_enum-bug-keys */ \"./node_modules/core-js/library/modules/_enum-bug-keys.js\")\n , IE_PROTO = __webpack_require__(/*! ./_shared-key */ \"./node_modules/core-js/library/modules/_shared-key.js\")('IE_PROTO')\n , Empty = function(){ /* empty */ }\n , PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function(){\n // Thrash, waste and sodomy: IE GC bug\n var iframe = __webpack_require__(/*! ./_dom-create */ \"./node_modules/core-js/library/modules/_dom-create.js\")('iframe')\n , i = enumBugKeys.length\n , lt = '<'\n , gt = '>'\n , iframeDocument;\n iframe.style.display = 'none';\n __webpack_require__(/*! ./_html */ \"./node_modules/core-js/library/modules/_html.js\").appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties){\n var result;\n if(O !== null){\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty;\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-dp.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-dp.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/library/modules/_an-object.js\")\n , IE8_DOM_DEFINE = __webpack_require__(/*! ./_ie8-dom-define */ \"./node_modules/core-js/library/modules/_ie8-dom-define.js\")\n , toPrimitive = __webpack_require__(/*! ./_to-primitive */ \"./node_modules/core-js/library/modules/_to-primitive.js\")\n , dP = Object.defineProperty;\n\nexports.f = __webpack_require__(/*! ./_descriptors */ \"./node_modules/core-js/library/modules/_descriptors.js\") ? Object.defineProperty : function defineProperty(O, P, Attributes){\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if(IE8_DOM_DEFINE)try {\n return dP(O, P, Attributes);\n } catch(e){ /* empty */ }\n if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');\n if('value' in Attributes)O[P] = Attributes.value;\n return O;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-dps.js\":\n/*!*************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-dps.js ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar dP = __webpack_require__(/*! ./_object-dp */ \"./node_modules/core-js/library/modules/_object-dp.js\")\n , anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/library/modules/_an-object.js\")\n , getKeys = __webpack_require__(/*! ./_object-keys */ \"./node_modules/core-js/library/modules/_object-keys.js\");\n\nmodule.exports = __webpack_require__(/*! ./_descriptors */ \"./node_modules/core-js/library/modules/_descriptors.js\") ? Object.defineProperties : function defineProperties(O, Properties){\n anObject(O);\n var keys = getKeys(Properties)\n , length = keys.length\n , i = 0\n , P;\n while(length > i)dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-gopd.js\":\n/*!**************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-gopd.js ***!\n \\**************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar pIE = __webpack_require__(/*! ./_object-pie */ \"./node_modules/core-js/library/modules/_object-pie.js\")\n , createDesc = __webpack_require__(/*! ./_property-desc */ \"./node_modules/core-js/library/modules/_property-desc.js\")\n , toIObject = __webpack_require__(/*! ./_to-iobject */ \"./node_modules/core-js/library/modules/_to-iobject.js\")\n , toPrimitive = __webpack_require__(/*! ./_to-primitive */ \"./node_modules/core-js/library/modules/_to-primitive.js\")\n , has = __webpack_require__(/*! ./_has */ \"./node_modules/core-js/library/modules/_has.js\")\n , IE8_DOM_DEFINE = __webpack_require__(/*! ./_ie8-dom-define */ \"./node_modules/core-js/library/modules/_ie8-dom-define.js\")\n , gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = __webpack_require__(/*! ./_descriptors */ \"./node_modules/core-js/library/modules/_descriptors.js\") ? gOPD : function getOwnPropertyDescriptor(O, P){\n O = toIObject(O);\n P = toPrimitive(P, true);\n if(IE8_DOM_DEFINE)try {\n return gOPD(O, P);\n } catch(e){ /* empty */ }\n if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-gopn-ext.js\":\n/*!******************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-gopn-ext.js ***!\n \\******************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nvar toIObject = __webpack_require__(/*! ./_to-iobject */ \"./node_modules/core-js/library/modules/_to-iobject.js\")\n , gOPN = __webpack_require__(/*! ./_object-gopn */ \"./node_modules/core-js/library/modules/_object-gopn.js\").f\n , toString = {}.toString;\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function(it){\n try {\n return gOPN(it);\n } catch(e){\n return windowNames.slice();\n }\n};\n\nmodule.exports.f = function getOwnPropertyNames(it){\n return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));\n};\n\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-gopn.js\":\n/*!**************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-gopn.js ***!\n \\**************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = __webpack_require__(/*! ./_object-keys-internal */ \"./node_modules/core-js/library/modules/_object-keys-internal.js\")\n , hiddenKeys = __webpack_require__(/*! ./_enum-bug-keys */ \"./node_modules/core-js/library/modules/_enum-bug-keys.js\").concat('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){\n return $keys(O, hiddenKeys);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-gops.js\":\n/*!**************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-gops.js ***!\n \\**************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nexports.f = Object.getOwnPropertySymbols;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-gpo.js\":\n/*!*************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-gpo.js ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = __webpack_require__(/*! ./_has */ \"./node_modules/core-js/library/modules/_has.js\")\n , toObject = __webpack_require__(/*! ./_to-object */ \"./node_modules/core-js/library/modules/_to-object.js\")\n , IE_PROTO = __webpack_require__(/*! ./_shared-key */ \"./node_modules/core-js/library/modules/_shared-key.js\")('IE_PROTO')\n , ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function(O){\n O = toObject(O);\n if(has(O, IE_PROTO))return O[IE_PROTO];\n if(typeof O.constructor == 'function' && O instanceof O.constructor){\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-keys-internal.js\":\n/*!***********************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-keys-internal.js ***!\n \\***********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar has = __webpack_require__(/*! ./_has */ \"./node_modules/core-js/library/modules/_has.js\")\n , toIObject = __webpack_require__(/*! ./_to-iobject */ \"./node_modules/core-js/library/modules/_to-iobject.js\")\n , arrayIndexOf = __webpack_require__(/*! ./_array-includes */ \"./node_modules/core-js/library/modules/_array-includes.js\")(false)\n , IE_PROTO = __webpack_require__(/*! ./_shared-key */ \"./node_modules/core-js/library/modules/_shared-key.js\")('IE_PROTO');\n\nmodule.exports = function(object, names){\n var O = toIObject(object)\n , i = 0\n , result = []\n , key;\n for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while(names.length > i)if(has(O, key = names[i++])){\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-keys.js\":\n/*!**************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-keys.js ***!\n \\**************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = __webpack_require__(/*! ./_object-keys-internal */ \"./node_modules/core-js/library/modules/_object-keys-internal.js\")\n , enumBugKeys = __webpack_require__(/*! ./_enum-bug-keys */ \"./node_modules/core-js/library/modules/_enum-bug-keys.js\");\n\nmodule.exports = Object.keys || function keys(O){\n return $keys(O, enumBugKeys);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-pie.js\":\n/*!*************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-pie.js ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nexports.f = {}.propertyIsEnumerable;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_object-sap.js\":\n/*!*************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_object-sap.js ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// most Object methods by ES6 should accept primitives\nvar $export = __webpack_require__(/*! ./_export */ \"./node_modules/core-js/library/modules/_export.js\")\n , core = __webpack_require__(/*! ./_core */ \"./node_modules/core-js/library/modules/_core.js\")\n , fails = __webpack_require__(/*! ./_fails */ \"./node_modules/core-js/library/modules/_fails.js\");\nmodule.exports = function(KEY, exec){\n var fn = (core.Object || {})[KEY] || Object[KEY]\n , exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_property-desc.js\":\n/*!****************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_property-desc.js ***!\n \\****************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = function(bitmap, value){\n return {\n enumerable : !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable : !(bitmap & 4),\n value : value\n };\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_redefine.js\":\n/*!***********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_redefine.js ***!\n \\***********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(/*! ./_hide */ \"./node_modules/core-js/library/modules/_hide.js\");\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_set-proto.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_set-proto.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nvar isObject = __webpack_require__(/*! ./_is-object */ \"./node_modules/core-js/library/modules/_is-object.js\")\n , anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/library/modules/_an-object.js\");\nvar check = function(O, proto){\n anObject(O);\n if(!isObject(proto) && proto !== null)throw TypeError(proto + \": can't set as prototype!\");\n};\nmodule.exports = {\n set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line\n function(test, buggy, set){\n try {\n set = __webpack_require__(/*! ./_ctx */ \"./node_modules/core-js/library/modules/_ctx.js\")(Function.call, __webpack_require__(/*! ./_object-gopd */ \"./node_modules/core-js/library/modules/_object-gopd.js\").f(Object.prototype, '__proto__').set, 2);\n set(test, []);\n buggy = !(test instanceof Array);\n } catch(e){ buggy = true; }\n return function setPrototypeOf(O, proto){\n check(O, proto);\n if(buggy)O.__proto__ = proto;\n else set(O, proto);\n return O;\n };\n }({}, false) : undefined),\n check: check\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_set-to-string-tag.js\":\n/*!********************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_set-to-string-tag.js ***!\n \\********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar def = __webpack_require__(/*! ./_object-dp */ \"./node_modules/core-js/library/modules/_object-dp.js\").f\n , has = __webpack_require__(/*! ./_has */ \"./node_modules/core-js/library/modules/_has.js\")\n , TAG = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/library/modules/_wks.js\")('toStringTag');\n\nmodule.exports = function(it, tag, stat){\n if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_shared-key.js\":\n/*!*************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_shared-key.js ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar shared = __webpack_require__(/*! ./_shared */ \"./node_modules/core-js/library/modules/_shared.js\")('keys')\n , uid = __webpack_require__(/*! ./_uid */ \"./node_modules/core-js/library/modules/_uid.js\");\nmodule.exports = function(key){\n return shared[key] || (shared[key] = uid(key));\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_shared.js\":\n/*!*********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_shared.js ***!\n \\*********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar global = __webpack_require__(/*! ./_global */ \"./node_modules/core-js/library/modules/_global.js\")\n , SHARED = '__core-js_shared__'\n , store = global[SHARED] || (global[SHARED] = {});\nmodule.exports = function(key){\n return store[key] || (store[key] = {});\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_string-at.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_string-at.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar toInteger = __webpack_require__(/*! ./_to-integer */ \"./node_modules/core-js/library/modules/_to-integer.js\")\n , defined = __webpack_require__(/*! ./_defined */ \"./node_modules/core-js/library/modules/_defined.js\");\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function(TO_STRING){\n return function(that, pos){\n var s = String(defined(that))\n , i = toInteger(pos)\n , l = s.length\n , a, b;\n if(i < 0 || i >= l)return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_to-index.js\":\n/*!***********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_to-index.js ***!\n \\***********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar toInteger = __webpack_require__(/*! ./_to-integer */ \"./node_modules/core-js/library/modules/_to-integer.js\")\n , max = Math.max\n , min = Math.min;\nmodule.exports = function(index, length){\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_to-integer.js\":\n/*!*************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_to-integer.js ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n// 7.1.4 ToInteger\nvar ceil = Math.ceil\n , floor = Math.floor;\nmodule.exports = function(it){\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_to-iobject.js\":\n/*!*************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_to-iobject.js ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = __webpack_require__(/*! ./_iobject */ \"./node_modules/core-js/library/modules/_iobject.js\")\n , defined = __webpack_require__(/*! ./_defined */ \"./node_modules/core-js/library/modules/_defined.js\");\nmodule.exports = function(it){\n return IObject(defined(it));\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_to-length.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_to-length.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 7.1.15 ToLength\nvar toInteger = __webpack_require__(/*! ./_to-integer */ \"./node_modules/core-js/library/modules/_to-integer.js\")\n , min = Math.min;\nmodule.exports = function(it){\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_to-object.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_to-object.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 7.1.13 ToObject(argument)\nvar defined = __webpack_require__(/*! ./_defined */ \"./node_modules/core-js/library/modules/_defined.js\");\nmodule.exports = function(it){\n return Object(defined(it));\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_to-primitive.js\":\n/*!***************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_to-primitive.js ***!\n \\***************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = __webpack_require__(/*! ./_is-object */ \"./node_modules/core-js/library/modules/_is-object.js\");\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function(it, S){\n if(!isObject(it))return it;\n var fn, val;\n if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;\n if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_uid.js\":\n/*!******************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_uid.js ***!\n \\******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar id = 0\n , px = Math.random();\nmodule.exports = function(key){\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_wks-define.js\":\n/*!*************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_wks-define.js ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar global = __webpack_require__(/*! ./_global */ \"./node_modules/core-js/library/modules/_global.js\")\n , core = __webpack_require__(/*! ./_core */ \"./node_modules/core-js/library/modules/_core.js\")\n , LIBRARY = __webpack_require__(/*! ./_library */ \"./node_modules/core-js/library/modules/_library.js\")\n , wksExt = __webpack_require__(/*! ./_wks-ext */ \"./node_modules/core-js/library/modules/_wks-ext.js\")\n , defineProperty = __webpack_require__(/*! ./_object-dp */ \"./node_modules/core-js/library/modules/_object-dp.js\").f;\nmodule.exports = function(name){\n var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});\n if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_wks-ext.js\":\n/*!**********************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_wks-ext.js ***!\n \\**********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports.f = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/library/modules/_wks.js\");\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/_wks.js\":\n/*!******************************************************!*\\\n !*** ./node_modules/core-js/library/modules/_wks.js ***!\n \\******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar store = __webpack_require__(/*! ./_shared */ \"./node_modules/core-js/library/modules/_shared.js\")('wks')\n , uid = __webpack_require__(/*! ./_uid */ \"./node_modules/core-js/library/modules/_uid.js\")\n , Symbol = __webpack_require__(/*! ./_global */ \"./node_modules/core-js/library/modules/_global.js\").Symbol\n , USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function(name){\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/core.get-iterator-method.js\":\n/*!**************************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/core.get-iterator-method.js ***!\n \\**************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar classof = __webpack_require__(/*! ./_classof */ \"./node_modules/core-js/library/modules/_classof.js\")\n , ITERATOR = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/library/modules/_wks.js\")('iterator')\n , Iterators = __webpack_require__(/*! ./_iterators */ \"./node_modules/core-js/library/modules/_iterators.js\");\nmodule.exports = __webpack_require__(/*! ./_core */ \"./node_modules/core-js/library/modules/_core.js\").getIteratorMethod = function(it){\n if(it != undefined)return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/core.get-iterator.js\":\n/*!*******************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/core.get-iterator.js ***!\n \\*******************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/library/modules/_an-object.js\")\n , get = __webpack_require__(/*! ./core.get-iterator-method */ \"./node_modules/core-js/library/modules/core.get-iterator-method.js\");\nmodule.exports = __webpack_require__(/*! ./_core */ \"./node_modules/core-js/library/modules/_core.js\").getIterator = function(it){\n var iterFn = get(it);\n if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!');\n return anObject(iterFn.call(it));\n};\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.array.from.js\":\n/*!****************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.array.from.js ***!\n \\****************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar ctx = __webpack_require__(/*! ./_ctx */ \"./node_modules/core-js/library/modules/_ctx.js\")\n , $export = __webpack_require__(/*! ./_export */ \"./node_modules/core-js/library/modules/_export.js\")\n , toObject = __webpack_require__(/*! ./_to-object */ \"./node_modules/core-js/library/modules/_to-object.js\")\n , call = __webpack_require__(/*! ./_iter-call */ \"./node_modules/core-js/library/modules/_iter-call.js\")\n , isArrayIter = __webpack_require__(/*! ./_is-array-iter */ \"./node_modules/core-js/library/modules/_is-array-iter.js\")\n , toLength = __webpack_require__(/*! ./_to-length */ \"./node_modules/core-js/library/modules/_to-length.js\")\n , createProperty = __webpack_require__(/*! ./_create-property */ \"./node_modules/core-js/library/modules/_create-property.js\")\n , getIterFn = __webpack_require__(/*! ./core.get-iterator-method */ \"./node_modules/core-js/library/modules/core.get-iterator-method.js\");\n\n$export($export.S + $export.F * !__webpack_require__(/*! ./_iter-detect */ \"./node_modules/core-js/library/modules/_iter-detect.js\")(function(iter){ Array.from(iter); }), 'Array', {\n // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)\n from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){\n var O = toObject(arrayLike)\n , C = typeof this == 'function' ? this : Array\n , aLen = arguments.length\n , mapfn = aLen > 1 ? arguments[1] : undefined\n , mapping = mapfn !== undefined\n , index = 0\n , iterFn = getIterFn(O)\n , length, result, step, iterator;\n if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);\n // if object isn't iterable or it's array with default iterator - use simple case\n if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){\n for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){\n createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);\n }\n } else {\n length = toLength(O.length);\n for(result = new C(length); length > index; index++){\n createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);\n }\n }\n result.length = index;\n return result;\n }\n});\n\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.array.iterator.js\":\n/*!********************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.array.iterator.js ***!\n \\********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar addToUnscopables = __webpack_require__(/*! ./_add-to-unscopables */ \"./node_modules/core-js/library/modules/_add-to-unscopables.js\")\n , step = __webpack_require__(/*! ./_iter-step */ \"./node_modules/core-js/library/modules/_iter-step.js\")\n , Iterators = __webpack_require__(/*! ./_iterators */ \"./node_modules/core-js/library/modules/_iterators.js\")\n , toIObject = __webpack_require__(/*! ./_to-iobject */ \"./node_modules/core-js/library/modules/_to-iobject.js\");\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = __webpack_require__(/*! ./_iter-define */ \"./node_modules/core-js/library/modules/_iter-define.js\")(Array, 'Array', function(iterated, kind){\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function(){\n var O = this._t\n , kind = this._k\n , index = this._i++;\n if(!O || index >= O.length){\n this._t = undefined;\n return step(1);\n }\n if(kind == 'keys' )return step(0, index);\n if(kind == 'values')return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.object.assign.js\":\n/*!*******************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.object.assign.js ***!\n \\*******************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 19.1.3.1 Object.assign(target, source)\nvar $export = __webpack_require__(/*! ./_export */ \"./node_modules/core-js/library/modules/_export.js\");\n\n$export($export.S + $export.F, 'Object', {assign: __webpack_require__(/*! ./_object-assign */ \"./node_modules/core-js/library/modules/_object-assign.js\")});\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.object.create.js\":\n/*!*******************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.object.create.js ***!\n \\*******************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar $export = __webpack_require__(/*! ./_export */ \"./node_modules/core-js/library/modules/_export.js\")\n// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\n$export($export.S, 'Object', {create: __webpack_require__(/*! ./_object-create */ \"./node_modules/core-js/library/modules/_object-create.js\")});\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.object.define-property.js\":\n/*!****************************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.object.define-property.js ***!\n \\****************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar $export = __webpack_require__(/*! ./_export */ \"./node_modules/core-js/library/modules/_export.js\");\n// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)\n$export($export.S + $export.F * !__webpack_require__(/*! ./_descriptors */ \"./node_modules/core-js/library/modules/_descriptors.js\"), 'Object', {defineProperty: __webpack_require__(/*! ./_object-dp */ \"./node_modules/core-js/library/modules/_object-dp.js\").f});\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js\":\n/*!****************************************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js ***!\n \\****************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)\nvar toIObject = __webpack_require__(/*! ./_to-iobject */ \"./node_modules/core-js/library/modules/_to-iobject.js\")\n , $getOwnPropertyDescriptor = __webpack_require__(/*! ./_object-gopd */ \"./node_modules/core-js/library/modules/_object-gopd.js\").f;\n\n__webpack_require__(/*! ./_object-sap */ \"./node_modules/core-js/library/modules/_object-sap.js\")('getOwnPropertyDescriptor', function(){\n return function getOwnPropertyDescriptor(it, key){\n return $getOwnPropertyDescriptor(toIObject(it), key);\n };\n});\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.object.keys.js\":\n/*!*****************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.object.keys.js ***!\n \\*****************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 19.1.2.14 Object.keys(O)\nvar toObject = __webpack_require__(/*! ./_to-object */ \"./node_modules/core-js/library/modules/_to-object.js\")\n , $keys = __webpack_require__(/*! ./_object-keys */ \"./node_modules/core-js/library/modules/_object-keys.js\");\n\n__webpack_require__(/*! ./_object-sap */ \"./node_modules/core-js/library/modules/_object-sap.js\")('keys', function(){\n return function keys(it){\n return $keys(toObject(it));\n };\n});\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.object.set-prototype-of.js\":\n/*!*****************************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.object.set-prototype-of.js ***!\n \\*****************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 19.1.3.19 Object.setPrototypeOf(O, proto)\nvar $export = __webpack_require__(/*! ./_export */ \"./node_modules/core-js/library/modules/_export.js\");\n$export($export.S, 'Object', {setPrototypeOf: __webpack_require__(/*! ./_set-proto */ \"./node_modules/core-js/library/modules/_set-proto.js\").set});\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.object.to-string.js\":\n/*!**********************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.object.to-string.js ***!\n \\**********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.string.iterator.js\":\n/*!*********************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.string.iterator.js ***!\n \\*********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar $at = __webpack_require__(/*! ./_string-at */ \"./node_modules/core-js/library/modules/_string-at.js\")(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\n__webpack_require__(/*! ./_iter-define */ \"./node_modules/core-js/library/modules/_iter-define.js\")(String, 'String', function(iterated){\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function(){\n var O = this._t\n , index = this._i\n , point;\n if(index >= O.length)return {value: undefined, done: true};\n point = $at(O, index);\n this._i += point.length;\n return {value: point, done: false};\n});\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es6.symbol.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es6.symbol.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n// ECMAScript 6 symbols shim\nvar global = __webpack_require__(/*! ./_global */ \"./node_modules/core-js/library/modules/_global.js\")\n , has = __webpack_require__(/*! ./_has */ \"./node_modules/core-js/library/modules/_has.js\")\n , DESCRIPTORS = __webpack_require__(/*! ./_descriptors */ \"./node_modules/core-js/library/modules/_descriptors.js\")\n , $export = __webpack_require__(/*! ./_export */ \"./node_modules/core-js/library/modules/_export.js\")\n , redefine = __webpack_require__(/*! ./_redefine */ \"./node_modules/core-js/library/modules/_redefine.js\")\n , META = __webpack_require__(/*! ./_meta */ \"./node_modules/core-js/library/modules/_meta.js\").KEY\n , $fails = __webpack_require__(/*! ./_fails */ \"./node_modules/core-js/library/modules/_fails.js\")\n , shared = __webpack_require__(/*! ./_shared */ \"./node_modules/core-js/library/modules/_shared.js\")\n , setToStringTag = __webpack_require__(/*! ./_set-to-string-tag */ \"./node_modules/core-js/library/modules/_set-to-string-tag.js\")\n , uid = __webpack_require__(/*! ./_uid */ \"./node_modules/core-js/library/modules/_uid.js\")\n , wks = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/library/modules/_wks.js\")\n , wksExt = __webpack_require__(/*! ./_wks-ext */ \"./node_modules/core-js/library/modules/_wks-ext.js\")\n , wksDefine = __webpack_require__(/*! ./_wks-define */ \"./node_modules/core-js/library/modules/_wks-define.js\")\n , keyOf = __webpack_require__(/*! ./_keyof */ \"./node_modules/core-js/library/modules/_keyof.js\")\n , enumKeys = __webpack_require__(/*! ./_enum-keys */ \"./node_modules/core-js/library/modules/_enum-keys.js\")\n , isArray = __webpack_require__(/*! ./_is-array */ \"./node_modules/core-js/library/modules/_is-array.js\")\n , anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/library/modules/_an-object.js\")\n , toIObject = __webpack_require__(/*! ./_to-iobject */ \"./node_modules/core-js/library/modules/_to-iobject.js\")\n , toPrimitive = __webpack_require__(/*! ./_to-primitive */ \"./node_modules/core-js/library/modules/_to-primitive.js\")\n , createDesc = __webpack_require__(/*! ./_property-desc */ \"./node_modules/core-js/library/modules/_property-desc.js\")\n , _create = __webpack_require__(/*! ./_object-create */ \"./node_modules/core-js/library/modules/_object-create.js\")\n , gOPNExt = __webpack_require__(/*! ./_object-gopn-ext */ \"./node_modules/core-js/library/modules/_object-gopn-ext.js\")\n , $GOPD = __webpack_require__(/*! ./_object-gopd */ \"./node_modules/core-js/library/modules/_object-gopd.js\")\n , $DP = __webpack_require__(/*! ./_object-dp */ \"./node_modules/core-js/library/modules/_object-dp.js\")\n , $keys = __webpack_require__(/*! ./_object-keys */ \"./node_modules/core-js/library/modules/_object-keys.js\")\n , gOPD = $GOPD.f\n , dP = $DP.f\n , gOPN = gOPNExt.f\n , $Symbol = global.Symbol\n , $JSON = global.JSON\n , _stringify = $JSON && $JSON.stringify\n , PROTOTYPE = 'prototype'\n , HIDDEN = wks('_hidden')\n , TO_PRIMITIVE = wks('toPrimitive')\n , isEnum = {}.propertyIsEnumerable\n , SymbolRegistry = shared('symbol-registry')\n , AllSymbols = shared('symbols')\n , OPSymbols = shared('op-symbols')\n , ObjectProto = Object[PROTOTYPE]\n , USE_NATIVE = typeof $Symbol == 'function'\n , QObject = global.QObject;\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDesc = DESCRIPTORS && $fails(function(){\n return _create(dP({}, 'a', {\n get: function(){ return dP(this, 'a', {value: 7}).a; }\n })).a != 7;\n}) ? function(it, key, D){\n var protoDesc = gOPD(ObjectProto, key);\n if(protoDesc)delete ObjectProto[key];\n dP(it, key, D);\n if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc);\n} : dP;\n\nvar wrap = function(tag){\n var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);\n sym._k = tag;\n return sym;\n};\n\nvar isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){\n return typeof it == 'symbol';\n} : function(it){\n return it instanceof $Symbol;\n};\n\nvar $defineProperty = function defineProperty(it, key, D){\n if(it === ObjectProto)$defineProperty(OPSymbols, key, D);\n anObject(it);\n key = toPrimitive(key, true);\n anObject(D);\n if(has(AllSymbols, key)){\n if(!D.enumerable){\n if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {}));\n it[HIDDEN][key] = true;\n } else {\n if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;\n D = _create(D, {enumerable: createDesc(0, false)});\n } return setSymbolDesc(it, key, D);\n } return dP(it, key, D);\n};\nvar $defineProperties = function defineProperties(it, P){\n anObject(it);\n var keys = enumKeys(P = toIObject(P))\n , i = 0\n , l = keys.length\n , key;\n while(l > i)$defineProperty(it, key = keys[i++], P[key]);\n return it;\n};\nvar $create = function create(it, P){\n return P === undefined ? _create(it) : $defineProperties(_create(it), P);\n};\nvar $propertyIsEnumerable = function propertyIsEnumerable(key){\n var E = isEnum.call(this, key = toPrimitive(key, true));\n if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false;\n return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;\n};\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){\n it = toIObject(it);\n key = toPrimitive(key, true);\n if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return;\n var D = gOPD(it, key);\n if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;\n return D;\n};\nvar $getOwnPropertyNames = function getOwnPropertyNames(it){\n var names = gOPN(toIObject(it))\n , result = []\n , i = 0\n , key;\n while(names.length > i){\n if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key);\n } return result;\n};\nvar $getOwnPropertySymbols = function getOwnPropertySymbols(it){\n var IS_OP = it === ObjectProto\n , names = gOPN(IS_OP ? OPSymbols : toIObject(it))\n , result = []\n , i = 0\n , key;\n while(names.length > i){\n if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]);\n } return result;\n};\n\n// 19.4.1.1 Symbol([description])\nif(!USE_NATIVE){\n $Symbol = function Symbol(){\n if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');\n var tag = uid(arguments.length > 0 ? arguments[0] : undefined);\n var $set = function(value){\n if(this === ObjectProto)$set.call(OPSymbols, value);\n if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;\n setSymbolDesc(this, tag, createDesc(1, value));\n };\n if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set});\n return wrap(tag);\n };\n redefine($Symbol[PROTOTYPE], 'toString', function toString(){\n return this._k;\n });\n\n $GOPD.f = $getOwnPropertyDescriptor;\n $DP.f = $defineProperty;\n __webpack_require__(/*! ./_object-gopn */ \"./node_modules/core-js/library/modules/_object-gopn.js\").f = gOPNExt.f = $getOwnPropertyNames;\n __webpack_require__(/*! ./_object-pie */ \"./node_modules/core-js/library/modules/_object-pie.js\").f = $propertyIsEnumerable;\n __webpack_require__(/*! ./_object-gops */ \"./node_modules/core-js/library/modules/_object-gops.js\").f = $getOwnPropertySymbols;\n\n if(DESCRIPTORS && !__webpack_require__(/*! ./_library */ \"./node_modules/core-js/library/modules/_library.js\")){\n redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);\n }\n\n wksExt.f = function(name){\n return wrap(wks(name));\n }\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});\n\nfor(var symbols = (\n // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14\n 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'\n).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);\n\nfor(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);\n\n$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {\n // 19.4.2.1 Symbol.for(key)\n 'for': function(key){\n return has(SymbolRegistry, key += '')\n ? SymbolRegistry[key]\n : SymbolRegistry[key] = $Symbol(key);\n },\n // 19.4.2.5 Symbol.keyFor(sym)\n keyFor: function keyFor(key){\n if(isSymbol(key))return keyOf(SymbolRegistry, key);\n throw TypeError(key + ' is not a symbol!');\n },\n useSetter: function(){ setter = true; },\n useSimple: function(){ setter = false; }\n});\n\n$export($export.S + $export.F * !USE_NATIVE, 'Object', {\n // 19.1.2.2 Object.create(O [, Properties])\n create: $create,\n // 19.1.2.4 Object.defineProperty(O, P, Attributes)\n defineProperty: $defineProperty,\n // 19.1.2.3 Object.defineProperties(O, Properties)\n defineProperties: $defineProperties,\n // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor,\n // 19.1.2.7 Object.getOwnPropertyNames(O)\n getOwnPropertyNames: $getOwnPropertyNames,\n // 19.1.2.8 Object.getOwnPropertySymbols(O)\n getOwnPropertySymbols: $getOwnPropertySymbols\n});\n\n// 24.3.2 JSON.stringify(value [, replacer [, space]])\n$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){\n var S = $Symbol();\n // MS Edge converts symbol values to JSON as {}\n // WebKit converts symbol values to JSON as null\n // V8 throws on boxed symbols\n return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';\n})), 'JSON', {\n stringify: function stringify(it){\n if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined\n var args = [it]\n , i = 1\n , replacer, $replacer;\n while(arguments.length > i)args.push(arguments[i++]);\n replacer = args[1];\n if(typeof replacer == 'function')$replacer = replacer;\n if($replacer || !isArray(replacer))replacer = function(key, value){\n if($replacer)value = $replacer.call(this, key, value);\n if(!isSymbol(value))return value;\n };\n args[1] = replacer;\n return _stringify.apply($JSON, args);\n }\n});\n\n// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)\n$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(/*! ./_hide */ \"./node_modules/core-js/library/modules/_hide.js\")($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);\n// 19.4.3.5 Symbol.prototype[@@toStringTag]\nsetToStringTag($Symbol, 'Symbol');\n// 20.2.1.9 Math[@@toStringTag]\nsetToStringTag(Math, 'Math', true);\n// 24.3.3 JSON[@@toStringTag]\nsetToStringTag(global.JSON, 'JSON', true);\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es7.symbol.async-iterator.js\":\n/*!***************************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es7.symbol.async-iterator.js ***!\n \\***************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ./_wks-define */ \"./node_modules/core-js/library/modules/_wks-define.js\")('asyncIterator');\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/es7.symbol.observable.js\":\n/*!***********************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/es7.symbol.observable.js ***!\n \\***********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ./_wks-define */ \"./node_modules/core-js/library/modules/_wks-define.js\")('observable');\n\n/***/ }),\n\n/***/ \"./node_modules/core-js/library/modules/web.dom.iterable.js\":\n/*!******************************************************************!*\\\n !*** ./node_modules/core-js/library/modules/web.dom.iterable.js ***!\n \\******************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(/*! ./es6.array.iterator */ \"./node_modules/core-js/library/modules/es6.array.iterator.js\");\nvar global = __webpack_require__(/*! ./_global */ \"./node_modules/core-js/library/modules/_global.js\")\n , hide = __webpack_require__(/*! ./_hide */ \"./node_modules/core-js/library/modules/_hide.js\")\n , Iterators = __webpack_require__(/*! ./_iterators */ \"./node_modules/core-js/library/modules/_iterators.js\")\n , TO_STRING_TAG = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/library/modules/_wks.js\")('toStringTag');\n\nfor(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){\n var NAME = collections[i]\n , Collection = global[NAME]\n , proto = Collection && Collection.prototype;\n if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = Iterators.Array;\n}\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/components/container/public/style.scss\":\n/*!***************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/components/container/public/style.scss ***!\n \\***************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \".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\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/components/core/public/style.scss\":\n/*!**********************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/components/core/public/style.scss ***!\n \\**********************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \"[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 -webkit-transform: translate3d(0, 0, 0);\\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\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/playbacks/base_flash_playback/public/flash.scss\":\n/*!************************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/playbacks/base_flash_playback/public/flash.scss ***!\n \\************************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \".clappr-flash-playback[data-flash-playback] {\\n display: block;\\n position: absolute;\\n top: 0;\\n left: 0;\\n height: 100%;\\n width: 100%;\\n pointer-events: none; }\\n\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/playbacks/html5_video/public/style.scss\":\n/*!****************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/playbacks/html5_video/public/style.scss ***!\n \\****************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \"[data-html5-video] {\\n position: absolute;\\n height: 100%;\\n width: 100%;\\n display: block; }\\n\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/playbacks/html_img/public/style.scss\":\n/*!*************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/playbacks/html_img/public/style.scss ***!\n \\*************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \"[data-html-img] {\\n max-width: 100%;\\n max-height: 100%; }\\n\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/playbacks/no_op/public/style.scss\":\n/*!**********************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/playbacks/no_op/public/style.scss ***!\n \\**********************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \"[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 -webkit-transform: translateY(-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\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/closed_captions/public/closed_captions.scss\":\n/*!****************************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/closed_captions/public/closed_captions.scss ***!\n \\****************************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \".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\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/dvr_controls/public/dvr_controls.scss\":\n/*!**********************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/dvr_controls/public/dvr_controls.scss ***!\n \\**********************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \".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\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/error_screen/public/error_screen.scss\":\n/*!**********************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/error_screen/public/error_screen.scss ***!\n \\**********************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \"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: -webkit-box;\\n display: -ms-flexbox;\\n display: flex;\\n -webkit-box-orient: vertical;\\n -webkit-box-direction: normal;\\n -ms-flex-direction: column;\\n flex-direction: column;\\n -webkit-box-pack: center;\\n -ms-flex-pack: center;\\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\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/media_control/public/media-control.scss\":\n/*!************************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/media_control/public/media-control.scss ***!\n \\************************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar escape = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/url/escape.js */ \"./node_modules/css-loader/lib/url/escape.js\");\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \".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(\" + escape(__webpack_require__(/*! ./closed-hand.cur */ \"./src/plugins/media_control/public/closed-hand.cur\")) + \"), move; }\\n .media-control[data-media-control].dragging * {\\n cursor: -webkit-grabbing !important;\\n cursor: grabbing !important;\\n cursor: url(\" + escape(__webpack_require__(/*! ./closed-hand.cur */ \"./src/plugins/media_control/public/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 -webkit-transform: translateX(-50%);\\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 -webkit-transform: translateX(-50%);\\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: -webkit-transform .2s ease-out;\\n transition: transform .2s ease-out;\\n transition: transform .2s ease-out, -webkit-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 -webkit-transform: scaleY(1.5);\\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\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/poster/public/poster.scss\":\n/*!**********************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/poster/public/poster.scss ***!\n \\**********************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \".player-poster[data-poster] {\\n display: -webkit-box;\\n display: -ms-flexbox;\\n display: flex;\\n -webkit-box-pack: center;\\n -ms-flex-pack: center;\\n justify-content: center;\\n -webkit-box-align: center;\\n -ms-flex-align: 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: #000;\\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\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/seek_time/public/seek_time.scss\":\n/*!****************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/seek_time/public/seek_time.scss ***!\n \\****************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \".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\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/spinner_three_bounce/public/spinner.scss\":\n/*!*************************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/spinner_three_bounce/public/spinner.scss ***!\n \\*************************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \".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 -webkit-transform: translateY(-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 -webkit-transform: scale(0);\\n transform: scale(0); }\\n 40% {\\n -webkit-transform: scale(1);\\n transform: scale(1); } }\\n\\n@keyframes bouncedelay {\\n 0%, 80%, 100% {\\n -webkit-transform: scale(0);\\n transform: scale(0); }\\n 40% {\\n -webkit-transform: scale(1);\\n transform: scale(1); } }\\n\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/watermark/public/watermark.scss\":\n/*!****************************************************************************************************************************************************************************************************************************!*\\\n !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/plugins/watermark/public/watermark.scss ***!\n \\****************************************************************************************************************************************************************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \".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\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/lib/css-base.js\":\n/*!*************************************************!*\\\n !*** ./node_modules/css-loader/lib/css-base.js ***!\n \\*************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n/***/ }),\n\n/***/ \"./node_modules/css-loader/lib/url/escape.js\":\n/*!***************************************************!*\\\n !*** ./node_modules/css-loader/lib/url/escape.js ***!\n \\***************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = function escape(url) {\n if (typeof url !== 'string') {\n return url\n }\n // If url is already wrapped in quotes, remove them\n if (/^['\"].*['\"]$/.test(url)) {\n url = url.slice(1, -1);\n }\n // Should url be wrapped?\n // See https://drafts.csswg.org/css-values-3/#urls\n if (/[\"'() \\t\\n]/.test(url)) {\n return '\"' + url.replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n') + '\"'\n }\n\n return url\n}\n\n\n/***/ }),\n\n/***/ \"./node_modules/hls.js/dist/hls.js\":\n/*!*****************************************!*\\\n !*** ./node_modules/hls.js/dist/hls.js ***!\n \\*****************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\ntypeof window !== \"undefined\" &&\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(true)\n\t\tmodule.exports = factory();\n\telse {}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/dist/\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./src/hls.js\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"./node_modules/eventemitter3/index.js\":\n/*!*********************************************!*\\\n !*** ./node_modules/eventemitter3/index.js ***!\n \\*********************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif (true) {\n module.exports = EventEmitter;\n}\n\n\n/***/ }),\n\n/***/ \"./node_modules/node-libs-browser/node_modules/events/events.js\":\n/*!**********************************************************************!*\\\n !*** ./node_modules/node-libs-browser/node_modules/events/events.js ***!\n \\**********************************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports) {\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n\n/***/ }),\n\n/***/ \"./node_modules/url-toolkit/src/url-toolkit.js\":\n/*!*****************************************************!*\\\n !*** ./node_modules/url-toolkit/src/url-toolkit.js ***!\n \\*****************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n// see https://tools.ietf.org/html/rfc1808\n\n/* jshint ignore:start */\n(function(root) { \n/* jshint ignore:end */\n\n var URL_REGEX = /^((?:[a-zA-Z0-9+\\-.]+:)?)(\\/\\/[^\\/?#]*)?((?:[^\\/\\?#]*\\/)*.*?)??(;.*?)?(\\?.*?)?(#.*?)?$/;\n var FIRST_SEGMENT_REGEX = /^([^\\/?#]*)(.*)$/;\n var SLASH_DOT_REGEX = /(?:\\/|^)\\.(?=\\/)/g;\n var SLASH_DOT_DOT_REGEX = /(?:\\/|^)\\.\\.\\/(?!\\.\\.\\/).*?(?=\\/)/g;\n\n var URLToolkit = { // jshint ignore:line\n // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //\n // E.g\n // With opts.alwaysNormalize = false (default, spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g\n // With opts.alwaysNormalize = true (not spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/g\n buildAbsoluteURL: function(baseURL, relativeURL, opts) {\n opts = opts || {};\n // remove any remaining space and CRLF\n baseURL = baseURL.trim();\n relativeURL = relativeURL.trim();\n if (!relativeURL) {\n // 2a) If the embedded URL is entirely empty, it inherits the\n // entire base URL (i.e., is set equal to the base URL)\n // and we are done.\n if (!opts.alwaysNormalize) {\n return baseURL;\n }\n var basePartsForNormalise = URLToolkit.parseURL(baseURL);\n if (!basePartsForNormalise) {\n throw new Error('Error trying to parse base URL.');\n }\n basePartsForNormalise.path = URLToolkit.normalizePath(basePartsForNormalise.path);\n return URLToolkit.buildURLFromParts(basePartsForNormalise);\n }\n var relativeParts = URLToolkit.parseURL(relativeURL);\n if (!relativeParts) {\n throw new Error('Error trying to parse relative URL.');\n }\n if (relativeParts.scheme) {\n // 2b) If the embedded URL starts with a scheme name, it is\n // interpreted as an absolute URL and we are done.\n if (!opts.alwaysNormalize) {\n return relativeURL;\n }\n relativeParts.path = URLToolkit.normalizePath(relativeParts.path);\n return URLToolkit.buildURLFromParts(relativeParts);\n }\n var baseParts = URLToolkit.parseURL(baseURL);\n if (!baseParts) {\n throw new Error('Error trying to parse base URL.');\n }\n if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') {\n // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc\n // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a'\n var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);\n baseParts.netLoc = pathParts[1];\n baseParts.path = pathParts[2];\n }\n if (baseParts.netLoc && !baseParts.path) {\n baseParts.path = '/';\n }\n var builtParts = {\n // 2c) Otherwise, the embedded URL inherits the scheme of\n // the base URL.\n scheme: baseParts.scheme,\n netLoc: relativeParts.netLoc,\n path: null,\n params: relativeParts.params,\n query: relativeParts.query,\n fragment: relativeParts.fragment\n };\n if (!relativeParts.netLoc) {\n // 3) If the embedded URL's is non-empty, we skip to\n // Step 7. Otherwise, the embedded URL inherits the \n // (if any) of the base URL.\n builtParts.netLoc = baseParts.netLoc;\n // 4) If the embedded URL path is preceded by a slash \"/\", the\n // path is not relative and we skip to Step 7.\n if (relativeParts.path[0] !== '/') {\n if (!relativeParts.path) {\n // 5) If the embedded URL path is empty (and not preceded by a\n // slash), then the embedded URL inherits the base URL path\n builtParts.path = baseParts.path;\n // 5a) if the embedded URL's is non-empty, we skip to\n // step 7; otherwise, it inherits the of the base\n // URL (if any) and\n if (!relativeParts.params) {\n builtParts.params = baseParts.params;\n // 5b) if the embedded URL's is non-empty, we skip to\n // step 7; otherwise, it inherits the of the base\n // URL (if any) and we skip to step 7.\n if (!relativeParts.query) {\n builtParts.query = baseParts.query;\n }\n }\n } else {\n // 6) The last segment of the base URL's path (anything\n // following the rightmost slash \"/\", or the entire path if no\n // slash is present) is removed and the embedded URL's path is\n // appended in its place.\n var baseURLPath = baseParts.path;\n var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + relativeParts.path;\n builtParts.path = URLToolkit.normalizePath(newPath);\n }\n }\n }\n if (builtParts.path === null) {\n builtParts.path = opts.alwaysNormalize ? URLToolkit.normalizePath(relativeParts.path) : relativeParts.path;\n }\n return URLToolkit.buildURLFromParts(builtParts);\n },\n parseURL: function(url) {\n var parts = URL_REGEX.exec(url);\n if (!parts) {\n return null;\n }\n return {\n scheme: parts[1] || '',\n netLoc: parts[2] || '',\n path: parts[3] || '',\n params: parts[4] || '',\n query: parts[5] || '',\n fragment: parts[6] || ''\n };\n },\n normalizePath: function(path) {\n // The following operations are\n // then applied, in order, to the new path:\n // 6a) All occurrences of \"./\", where \".\" is a complete path\n // segment, are removed.\n // 6b) If the path ends with \".\" as a complete path segment,\n // that \".\" is removed.\n path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, '');\n // 6c) All occurrences of \"/../\", where is a\n // complete path segment not equal to \"..\", are removed.\n // Removal of these path segments is performed iteratively,\n // removing the leftmost matching pattern on each iteration,\n // until no matching pattern remains.\n // 6d) If the path ends with \"/..\", where is a\n // complete path segment not equal to \"..\", that\n // \"/..\" is removed.\n while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length) {} // jshint ignore:line\n return path.split('').reverse().join('');\n },\n buildURLFromParts: function(parts) {\n return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment;\n }\n };\n\n/* jshint ignore:start */\n if(true)\n module.exports = URLToolkit;\n else {}\n})(this);\n/* jshint ignore:end */\n\n\n/***/ }),\n\n/***/ \"./node_modules/webworkify-webpack/index.js\":\n/*!**************************************************!*\\\n !*** ./node_modules/webworkify-webpack/index.js ***!\n \\**************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\nfunction webpackBootstrapFunc (modules) {\n/******/ // The module cache\n/******/ var installedModules = {};\n\n/******/ // The require function\n/******/ function __webpack_require__(moduleId) {\n\n/******/ // Check if module is in cache\n/******/ if(installedModules[moduleId])\n/******/ return installedModules[moduleId].exports;\n\n/******/ // Create a new module (and put it into the cache)\n/******/ var module = installedModules[moduleId] = {\n/******/ i: moduleId,\n/******/ l: false,\n/******/ exports: {}\n/******/ };\n\n/******/ // Execute the module function\n/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ // Flag the module as loaded\n/******/ module.l = true;\n\n/******/ // Return the exports of the module\n/******/ return module.exports;\n/******/ }\n\n/******/ // expose the modules object (__webpack_modules__)\n/******/ __webpack_require__.m = modules;\n\n/******/ // expose the module cache\n/******/ __webpack_require__.c = installedModules;\n\n/******/ // identity function for calling harmony imports with the correct context\n/******/ __webpack_require__.i = function(value) { return value; };\n\n/******/ // define getter function for harmony exports\n/******/ __webpack_require__.d = function(exports, name, getter) {\n/******/ if(!__webpack_require__.o(exports, name)) {\n/******/ Object.defineProperty(exports, name, {\n/******/ configurable: false,\n/******/ enumerable: true,\n/******/ get: getter\n/******/ });\n/******/ }\n/******/ };\n\n/******/ // define __esModule on exports\n/******/ __webpack_require__.r = function(exports) {\n/******/ Object.defineProperty(exports, '__esModule', { value: true });\n/******/ };\n\n/******/ // getDefaultExport function for compatibility with non-harmony modules\n/******/ __webpack_require__.n = function(module) {\n/******/ var getter = module && module.__esModule ?\n/******/ function getDefault() { return module['default']; } :\n/******/ function getModuleExports() { return module; };\n/******/ __webpack_require__.d(getter, 'a', getter);\n/******/ return getter;\n/******/ };\n\n/******/ // Object.prototype.hasOwnProperty.call\n/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n/******/ // __webpack_public_path__\n/******/ __webpack_require__.p = \"/\";\n\n/******/ // on error function for async loading\n/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n var f = __webpack_require__(__webpack_require__.s = ENTRY_MODULE)\n return f.default || f // try to call default if defined to also support babel esmodule exports\n}\n\nvar moduleNameReqExp = '[\\\\.|\\\\-|\\\\+|\\\\w|\\/|@]+'\nvar dependencyRegExp = '\\\\((\\/\\\\*.*?\\\\*\\/)?\\s?.*?(' + moduleNameReqExp + ').*?\\\\)' // additional chars when output.pathinfo is true\n\n// http://stackoverflow.com/a/2593661/130442\nfunction quoteRegExp (str) {\n return (str + '').replace(/[.?*+^$[\\]\\\\(){}|-]/g, '\\\\$&')\n}\n\nfunction isNumeric(n) {\n return !isNaN(1 * n); // 1 * n converts integers, integers as string (\"123\"), 1e3 and \"1e3\" to integers and strings to NaN\n}\n\nfunction getModuleDependencies (sources, module, queueName) {\n var retval = {}\n retval[queueName] = []\n\n var fnString = module.toString()\n var wrapperSignature = fnString.match(/^function\\s?\\(\\w+,\\s*\\w+,\\s*(\\w+)\\)/)\n if (!wrapperSignature) return retval\n var webpackRequireName = wrapperSignature[1]\n\n // main bundle deps\n var re = new RegExp('(\\\\\\\\n|\\\\W)' + quoteRegExp(webpackRequireName) + dependencyRegExp, 'g')\n var match\n while ((match = re.exec(fnString))) {\n if (match[3] === 'dll-reference') continue\n retval[queueName].push(match[3])\n }\n\n // dll deps\n re = new RegExp('\\\\(' + quoteRegExp(webpackRequireName) + '\\\\(\"(dll-reference\\\\s(' + moduleNameReqExp + '))\"\\\\)\\\\)' + dependencyRegExp, 'g')\n while ((match = re.exec(fnString))) {\n if (!sources[match[2]]) {\n retval[queueName].push(match[1])\n sources[match[2]] = __webpack_require__(match[1]).m\n }\n retval[match[2]] = retval[match[2]] || []\n retval[match[2]].push(match[4])\n }\n\n // convert 1e3 back to 1000 - this can be important after uglify-js converted 1000 to 1e3\n var keys = Object.keys(retval);\n for (var i = 0; i < keys.length; i++) {\n for (var j = 0; j < retval[keys[i]].length; j++) {\n if (isNumeric(retval[keys[i]][j])) {\n retval[keys[i]][j] = 1 * retval[keys[i]][j];\n }\n }\n }\n\n return retval\n}\n\nfunction hasValuesInQueues (queues) {\n var keys = Object.keys(queues)\n return keys.reduce(function (hasValues, key) {\n return hasValues || queues[key].length > 0\n }, false)\n}\n\nfunction getRequiredModules (sources, moduleId) {\n var modulesQueue = {\n main: [moduleId]\n }\n var requiredModules = {\n main: []\n }\n var seenModules = {\n main: {}\n }\n\n while (hasValuesInQueues(modulesQueue)) {\n var queues = Object.keys(modulesQueue)\n for (var i = 0; i < queues.length; i++) {\n var queueName = queues[i]\n var queue = modulesQueue[queueName]\n var moduleToCheck = queue.pop()\n seenModules[queueName] = seenModules[queueName] || {}\n if (seenModules[queueName][moduleToCheck] || !sources[queueName][moduleToCheck]) continue\n seenModules[queueName][moduleToCheck] = true\n requiredModules[queueName] = requiredModules[queueName] || []\n requiredModules[queueName].push(moduleToCheck)\n var newModules = getModuleDependencies(sources, sources[queueName][moduleToCheck], queueName)\n var newModulesKeys = Object.keys(newModules)\n for (var j = 0; j < newModulesKeys.length; j++) {\n modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]] || []\n modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]].concat(newModules[newModulesKeys[j]])\n }\n }\n }\n\n return requiredModules\n}\n\nmodule.exports = function (moduleId, options) {\n options = options || {}\n var sources = {\n main: __webpack_require__.m\n }\n\n var requiredModules = options.all ? { main: Object.keys(sources.main) } : getRequiredModules(sources, moduleId)\n\n var src = ''\n\n Object.keys(requiredModules).filter(function (m) { return m !== 'main' }).forEach(function (module) {\n var entryModule = 0\n while (requiredModules[module][entryModule]) {\n entryModule++\n }\n requiredModules[module].push(entryModule)\n sources[module][entryModule] = '(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })'\n src = src + 'var ' + module + ' = (' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(entryModule)) + ')({' + requiredModules[module].map(function (id) { return '' + JSON.stringify(id) + ': ' + sources[module][id].toString() }).join(',') + '});\\n'\n })\n\n src = src + 'new ((' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(moduleId)) + ')({' + requiredModules.main.map(function (id) { return '' + JSON.stringify(id) + ': ' + sources.main[id].toString() }).join(',') + '}))(self);'\n\n var blob = new window.Blob([src], { type: 'text/javascript' })\n if (options.bare) { return blob }\n\n var URL = window.URL || window.webkitURL || window.mozURL || window.msURL\n\n var workerUrl = URL.createObjectURL(blob)\n var worker = new window.Worker(workerUrl)\n worker.objectURL = workerUrl\n\n return worker\n}\n\n\n/***/ }),\n\n/***/ \"./src/config.js\":\n/*!***********************!*\\\n !*** ./src/config.js ***!\n \\***********************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * HLS config\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar abr_controller_1 = __webpack_require__(/*! ./controller/abr-controller */ \"./src/controller/abr-controller.js\");\nvar buffer_controller_1 = __webpack_require__(/*! ./controller/buffer-controller */ \"./src/controller/buffer-controller.js\");\nvar cap_level_controller_1 = __webpack_require__(/*! ./controller/cap-level-controller */ \"./src/controller/cap-level-controller.js\");\nvar fps_controller_1 = __webpack_require__(/*! ./controller/fps-controller */ \"./src/controller/fps-controller.js\");\nvar xhr_loader_1 = __webpack_require__(/*! ./utils/xhr-loader */ \"./src/utils/xhr-loader.js\");\n// import FetchLoader from './utils/fetch-loader';\nvar audio_track_controller_1 = __webpack_require__(/*! ./controller/audio-track-controller */ \"./src/controller/audio-track-controller.js\");\nvar audio_stream_controller_1 = __webpack_require__(/*! ./controller/audio-stream-controller */ \"./src/controller/audio-stream-controller.js\");\nvar Cues = __webpack_require__(/*! ./utils/cues */ \"./src/utils/cues.js\");\nvar timeline_controller_1 = __webpack_require__(/*! ./controller/timeline-controller */ \"./src/controller/timeline-controller.js\");\nvar subtitle_track_controller_1 = __webpack_require__(/*! ./controller/subtitle-track-controller */ \"./src/controller/subtitle-track-controller.js\");\nvar subtitle_stream_controller_1 = __webpack_require__(/*! ./controller/subtitle-stream-controller */ \"./src/controller/subtitle-stream-controller.js\");\nvar eme_controller_1 = __webpack_require__(/*! ./controller/eme-controller */ \"./src/controller/eme-controller.js\");\nvar mediakeys_helper_1 = __webpack_require__(/*! ./utils/mediakeys-helper */ \"./src/utils/mediakeys-helper.js\");\nexports.hlsDefaultConfig = {\n autoStartLoad: true,\n startPosition: -1,\n defaultAudioCodec: undefined,\n debug: false,\n capLevelOnFPSDrop: false,\n capLevelToPlayerSize: false,\n initialLiveManifestSize: 1,\n maxBufferLength: 30,\n maxBufferSize: 60 * 1000 * 1000,\n maxBufferHole: 0.5,\n lowBufferWatchdogPeriod: 0.5,\n highBufferWatchdogPeriod: 3,\n nudgeOffset: 0.1,\n nudgeMaxRetry: 3,\n maxFragLookUpTolerance: 0.25,\n liveSyncDurationCount: 3,\n liveMaxLatencyDurationCount: Infinity,\n liveSyncDuration: undefined,\n liveMaxLatencyDuration: undefined,\n liveDurationInfinity: false,\n liveBackBufferLength: Infinity,\n maxMaxBufferLength: 600,\n enableWorker: true,\n enableSoftwareAES: true,\n manifestLoadingTimeOut: 10000,\n manifestLoadingMaxRetry: 1,\n manifestLoadingRetryDelay: 1000,\n manifestLoadingMaxRetryTimeout: 64000,\n startLevel: undefined,\n levelLoadingTimeOut: 10000,\n levelLoadingMaxRetry: 4,\n levelLoadingRetryDelay: 1000,\n levelLoadingMaxRetryTimeout: 64000,\n fragLoadingTimeOut: 20000,\n fragLoadingMaxRetry: 6,\n fragLoadingRetryDelay: 1000,\n fragLoadingMaxRetryTimeout: 64000,\n startFragPrefetch: false,\n fpsDroppedMonitoringPeriod: 5000,\n fpsDroppedMonitoringThreshold: 0.2,\n appendErrorMaxRetry: 3,\n loader: xhr_loader_1.default,\n // loader: FetchLoader,\n fLoader: undefined,\n pLoader: undefined,\n xhrSetup: undefined,\n licenseXhrSetup: undefined,\n // fetchSetup: undefined,\n abrController: abr_controller_1.default,\n bufferController: buffer_controller_1.default,\n capLevelController: cap_level_controller_1.default,\n fpsController: fps_controller_1.default,\n stretchShortVideoTrack: false,\n maxAudioFramesDrift: 1,\n forceKeyFrameOnDiscontinuity: true,\n abrEwmaFastLive: 3,\n abrEwmaSlowLive: 9,\n abrEwmaFastVoD: 3,\n abrEwmaSlowVoD: 9,\n abrEwmaDefaultEstimate: 5e5,\n abrBandWidthFactor: 0.95,\n abrBandWidthUpFactor: 0.7,\n abrMaxWithRealBitrate: false,\n maxStarvationDelay: 4,\n maxLoadingDelay: 4,\n minAutoBitrate: 0,\n emeEnabled: false,\n widevineLicenseUrl: undefined,\n requestMediaKeySystemAccessFunc: mediakeys_helper_1.requestMediaKeySystemAccess // used by eme-controller\n};\nif (true) {\n exports.hlsDefaultConfig.subtitleStreamController = subtitle_stream_controller_1.SubtitleStreamController;\n exports.hlsDefaultConfig.subtitleTrackController = subtitle_track_controller_1.default;\n exports.hlsDefaultConfig.timelineController = timeline_controller_1.default;\n exports.hlsDefaultConfig.cueHandler = Cues; // used by timeline-controller\n exports.hlsDefaultConfig.enableCEA708Captions = true; // used by timeline-controller\n exports.hlsDefaultConfig.enableWebVTT = true; // used by timeline-controller\n exports.hlsDefaultConfig.captionsTextTrack1Label = 'English'; // used by timeline-controller\n exports.hlsDefaultConfig.captionsTextTrack1LanguageCode = 'en'; // used by timeline-controller\n exports.hlsDefaultConfig.captionsTextTrack2Label = 'Spanish'; // used by timeline-controller\n exports.hlsDefaultConfig.captionsTextTrack2LanguageCode = 'es'; // used by timeline-controller\n}\nif (true) {\n exports.hlsDefaultConfig.audioStreamController = audio_stream_controller_1.default;\n exports.hlsDefaultConfig.audioTrackController = audio_track_controller_1.default;\n}\nif (true) {\n exports.hlsDefaultConfig.emeController = eme_controller_1.default;\n}\n\n\n/***/ }),\n\n/***/ \"./src/controller/abr-controller.js\":\n/*!******************************************!*\\\n !*** ./src/controller/abr-controller.js ***!\n \\******************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\n/*\n * simple ABR Controller\n * - compute next level based on last fragment bw heuristics\n * - implement an abandon rules triggered if we have less than 2 frag buffered and if computed bw shows that we risk buffer stalling\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar buffer_helper_1 = __webpack_require__(/*! ../utils/buffer-helper */ \"./src/utils/buffer-helper.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar ewma_bandwidth_estimator_1 = __webpack_require__(/*! ../utils/ewma-bandwidth-estimator */ \"./src/utils/ewma-bandwidth-estimator.js\");\nvar performance = window.performance;\nvar AbrController = /** @class */ (function (_super) {\n __extends(AbrController, _super);\n function AbrController(hls) {\n var _this = _super.call(this, hls, events_1.default.FRAG_LOADING, events_1.default.FRAG_LOADED, events_1.default.FRAG_BUFFERED, events_1.default.ERROR) || this;\n _this.lastLoadedFragLevel = 0;\n _this._nextAutoLevel = -1;\n _this.hls = hls;\n _this.timer = null;\n _this._bwEstimator = null;\n _this.onCheck = _this._abandonRulesCheck.bind(_this);\n return _this;\n }\n AbrController.prototype.destroy = function () {\n this.clearTimer();\n event_handler_1.default.prototype.destroy.call(this);\n };\n AbrController.prototype.onFragLoading = function (data) {\n var frag = data.frag;\n if (frag.type === 'main') {\n if (!this.timer) {\n this.fragCurrent = frag;\n this.timer = setInterval(this.onCheck, 100);\n }\n // lazy init of BwEstimator, rationale is that we use different params for Live/VoD\n // so we need to wait for stream manifest / playlist type to instantiate it.\n if (!this._bwEstimator) {\n var hls_1 = this.hls;\n var config = hls_1.config;\n var level = frag.level;\n var isLive = hls_1.levels[level].details.live;\n var ewmaFast = void 0, ewmaSlow = void 0;\n if (isLive) {\n ewmaFast = config.abrEwmaFastLive;\n ewmaSlow = config.abrEwmaSlowLive;\n }\n else {\n ewmaFast = config.abrEwmaFastVoD;\n ewmaSlow = config.abrEwmaSlowVoD;\n }\n this._bwEstimator = new ewma_bandwidth_estimator_1.default(hls_1, ewmaSlow, ewmaFast, config.abrEwmaDefaultEstimate);\n }\n }\n };\n AbrController.prototype._abandonRulesCheck = function () {\n /*\n monitor fragment retrieval time...\n we compute expected time of arrival of the complete fragment.\n we compare it to expected time of buffer starvation\n */\n var hls = this.hls;\n var video = hls.media;\n var frag = this.fragCurrent;\n if (!frag) {\n return;\n }\n var loader = frag.loader;\n var minAutoLevel = hls.minAutoLevel;\n // if loader has been destroyed or loading has been aborted, stop timer and return\n if (!loader || (loader.stats && loader.stats.aborted)) {\n logger_1.logger.warn('frag loader destroy or aborted, disarm abandonRules');\n this.clearTimer();\n // reset forced auto level value so that next level will be selected\n this._nextAutoLevel = -1;\n return;\n }\n var stats = loader.stats;\n /* only monitor frag retrieval time if\n (video not paused OR first fragment being loaded(ready state === HAVE_NOTHING = 0)) AND autoswitching enabled AND not lowest level (=> means that we have several levels) */\n if (video && stats && ((!video.paused && (video.playbackRate !== 0)) || !video.readyState) && frag.autoLevel && frag.level) {\n var requestDelay = performance.now() - stats.trequest, playbackRate = Math.abs(video.playbackRate);\n // monitor fragment load progress after half of expected fragment duration,to stabilize bitrate\n if (requestDelay > (500 * frag.duration / playbackRate)) {\n var levels = hls.levels, loadRate = Math.max(1, stats.bw ? stats.bw / 8 : stats.loaded * 1000 / requestDelay), // byte/s; at least 1 byte/s to avoid division by zero\n // compute expected fragment length using frag duration and level bitrate. also ensure that expected len is gte than already loaded size\n level = levels[frag.level], levelBitrate = level.realBitrate ? Math.max(level.realBitrate, level.bitrate) : level.bitrate, expectedLen = stats.total ? stats.total : Math.max(stats.loaded, Math.round(frag.duration * levelBitrate / 8)), pos = video.currentTime, fragLoadedDelay = (expectedLen - stats.loaded) / loadRate, bufferStarvationDelay = (buffer_helper_1.BufferHelper.bufferInfo(video, pos, hls.config.maxBufferHole).end - pos) / playbackRate;\n // consider emergency switch down only if we have less than 2 frag buffered AND\n // time to finish loading current fragment is bigger than buffer starvation delay\n // ie if we risk buffer starvation if bw does not increase quickly\n if ((bufferStarvationDelay < (2 * frag.duration / playbackRate)) && (fragLoadedDelay > bufferStarvationDelay)) {\n var fragLevelNextLoadedDelay = void 0, nextLoadLevel = void 0;\n // lets iterate through lower level and try to find the biggest one that could avoid rebuffering\n // we start from current level - 1 and we step down , until we find a matching level\n for (nextLoadLevel = frag.level - 1; nextLoadLevel > minAutoLevel; nextLoadLevel--) {\n // compute time to load next fragment at lower level\n // 0.8 : consider only 80% of current bw to be conservative\n // 8 = bits per byte (bps/Bps)\n var levelNextBitrate = levels[nextLoadLevel].realBitrate ? Math.max(levels[nextLoadLevel].realBitrate, levels[nextLoadLevel].bitrate) : levels[nextLoadLevel].bitrate;\n fragLevelNextLoadedDelay = frag.duration * levelNextBitrate / (8 * 0.8 * loadRate);\n if (fragLevelNextLoadedDelay < bufferStarvationDelay) {\n // we found a lower level that be rebuffering free with current estimated bw !\n break;\n }\n }\n // only emergency switch down if it takes less time to load new fragment at lowest level instead\n // of finishing loading current one ...\n if (fragLevelNextLoadedDelay < fragLoadedDelay) {\n logger_1.logger.warn(\"loading too slow, abort fragment loading and switch to level \" + nextLoadLevel + \":fragLoadedDelay[\" + nextLoadLevel + \"]= 0) {\n return bestLevel;\n }\n else {\n logger_1.logger.trace('rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering');\n // not possible to get rid of rebuffering ... let's try to find level that will guarantee less than maxStarvationDelay of rebuffering\n // if no matching level found, logic will return 0\n var maxStarvationDelay = currentFragDuration ? Math.min(currentFragDuration, config.maxStarvationDelay) : config.maxStarvationDelay, bwFactor = config.abrBandWidthFactor, bwUpFactor = config.abrBandWidthUpFactor;\n if (bufferStarvationDelay === 0) {\n // in case buffer is empty, let's check if previous fragment was loaded to perform a bitrate test\n var bitrateTestDelay = this.bitrateTestDelay;\n if (bitrateTestDelay) {\n // if it is the case, then we need to adjust our max starvation delay using maxLoadingDelay config value\n // max video loading delay used in automatic start level selection :\n // in that mode ABR controller will ensure that video loading time (ie the time to fetch the first fragment at lowest quality level +\n // the time to fetch the fragment at the appropriate quality level is less than ```maxLoadingDelay``` )\n // cap maxLoadingDelay and ensure it is not bigger 'than bitrate test' frag duration\n var maxLoadingDelay = currentFragDuration ? Math.min(currentFragDuration, config.maxLoadingDelay) : config.maxLoadingDelay;\n maxStarvationDelay = maxLoadingDelay - bitrateTestDelay;\n logger_1.logger.trace(\"bitrate test took \" + Math.round(1000 * bitrateTestDelay) + \"ms, set first fragment max fetchDuration to \" + Math.round(1000 * maxStarvationDelay) + \" ms\");\n // don't use conservative factor on bitrate test\n bwFactor = bwUpFactor = 1;\n }\n }\n bestLevel = this._findBestLevel(currentLevel, currentFragDuration, avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay + maxStarvationDelay, bwFactor, bwUpFactor, levels);\n return Math.max(bestLevel, 0);\n }\n },\n enumerable: true,\n configurable: true\n });\n AbrController.prototype._findBestLevel = function (currentLevel, currentFragDuration, currentBw, minAutoLevel, maxAutoLevel, maxFetchDuration, bwFactor, bwUpFactor, levels) {\n for (var i = maxAutoLevel; i >= minAutoLevel; i--) {\n var levelInfo = levels[i];\n if (!levelInfo) {\n continue;\n }\n var levelDetails = levelInfo.details, avgDuration = levelDetails ? levelDetails.totalduration / levelDetails.fragments.length : currentFragDuration, live = levelDetails ? levelDetails.live : false, adjustedbw = void 0;\n // follow algorithm captured from stagefright :\n // https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/httplive/LiveSession.cpp\n // Pick the highest bandwidth stream below or equal to estimated bandwidth.\n // consider only 80% of the available bandwidth, but if we are switching up,\n // be even more conservative (70%) to avoid overestimating and immediately\n // switching back.\n if (i <= currentLevel) {\n adjustedbw = bwFactor * currentBw;\n }\n else {\n adjustedbw = bwUpFactor * currentBw;\n }\n var bitrate = levels[i].realBitrate ? Math.max(levels[i].realBitrate, levels[i].bitrate) : levels[i].bitrate, fetchDuration = bitrate * avgDuration / adjustedbw;\n logger_1.logger.trace(\"level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: \" + i + \"/\" + Math.round(adjustedbw) + \"/\" + bitrate + \"/\" + avgDuration + \"/\" + maxFetchDuration + \"/\" + fetchDuration);\n // if adjusted bw is greater than level bitrate AND\n if (adjustedbw > bitrate &&\n // fragment fetchDuration unknown OR live stream OR fragment fetchDuration less than max allowed fetch duration, then this level matches\n // we don't account for max Fetch Duration for live streams, this is to avoid switching down when near the edge of live sliding window ...\n // special case to support startLevel = -1 (bitrateTest) on live streams : in that case we should not exit loop so that _findBestLevel will return -1\n (!fetchDuration || (live && !this.bitrateTestDelay) || fetchDuration < maxFetchDuration)) {\n // as we are looping from highest to lowest, this will return the best achievable quality level\n return i;\n }\n }\n // not enough time budget even with quality level 0 ... rebuffering might happen\n return -1;\n };\n return AbrController;\n}(event_handler_1.default));\nexports.default = AbrController;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/controller/audio-stream-controller.js\":\n/*!***************************************************!*\\\n !*** ./src/controller/audio-stream-controller.js ***!\n \\***************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\n/*\n * Audio Stream Controller\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar binary_search_1 = __webpack_require__(/*! ../utils/binary-search */ \"./src/utils/binary-search.js\");\nvar buffer_helper_1 = __webpack_require__(/*! ../utils/buffer-helper */ \"./src/utils/buffer-helper.js\");\nvar demuxer_1 = __webpack_require__(/*! ../demux/demuxer */ \"./src/demux/demuxer.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar LevelHelper = __webpack_require__(/*! ./level-helper */ \"./src/controller/level-helper.js\");\nvar time_ranges_1 = __webpack_require__(/*! ../utils/time-ranges */ \"./src/utils/time-ranges.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar discontinuities_1 = __webpack_require__(/*! ../utils/discontinuities */ \"./src/utils/discontinuities.js\");\nvar fragment_tracker_1 = __webpack_require__(/*! ./fragment-tracker */ \"./src/controller/fragment-tracker.js\");\nvar fragment_1 = __webpack_require__(/*! ../loader/fragment */ \"./src/loader/fragment.js\");\nvar base_stream_controller_1 = __webpack_require__(/*! ./base-stream-controller */ \"./src/controller/base-stream-controller.js\");\nvar performance = window.performance;\nvar TICK_INTERVAL = 100; // how often to tick in ms\nvar AudioStreamController = /** @class */ (function (_super) {\n __extends(AudioStreamController, _super);\n function AudioStreamController(hls, fragmentTracker) {\n var _this = _super.call(this, hls, events_1.default.MEDIA_ATTACHED, events_1.default.MEDIA_DETACHING, events_1.default.AUDIO_TRACKS_UPDATED, events_1.default.AUDIO_TRACK_SWITCHING, events_1.default.AUDIO_TRACK_LOADED, events_1.default.KEY_LOADED, events_1.default.FRAG_LOADED, events_1.default.FRAG_PARSING_INIT_SEGMENT, events_1.default.FRAG_PARSING_DATA, events_1.default.FRAG_PARSED, events_1.default.ERROR, events_1.default.BUFFER_RESET, events_1.default.BUFFER_CREATED, events_1.default.BUFFER_APPENDED, events_1.default.BUFFER_FLUSHED, events_1.default.INIT_PTS_FOUND) || this;\n _this.fragmentTracker = fragmentTracker;\n _this.config = hls.config;\n _this.audioCodecSwap = false;\n _this._state = base_stream_controller_1.State.STOPPED;\n _this.initPTS = [];\n _this.waitingFragment = null;\n _this.videoTrackCC = null;\n return _this;\n }\n AudioStreamController.prototype.onHandlerDestroying = function () {\n this.stopLoad();\n _super.prototype.onHandlerDestroying.call(this);\n };\n AudioStreamController.prototype.onHandlerDestroyed = function () {\n this.state = base_stream_controller_1.State.STOPPED;\n this.fragmentTracker = null;\n _super.prototype.onHandlerDestroyed.call(this);\n };\n // Signal that video PTS was found\n AudioStreamController.prototype.onInitPtsFound = function (data) {\n var demuxerId = data.id, cc = data.frag.cc, initPTS = data.initPTS;\n if (demuxerId === 'main') {\n // Always update the new INIT PTS\n // Can change due level switch\n this.initPTS[cc] = initPTS;\n this.videoTrackCC = cc;\n logger_1.logger.log(\"InitPTS for cc: \" + cc + \" found from video track: \" + initPTS);\n // If we are waiting we need to demux/remux the waiting frag\n // With the new initPTS\n if (this.state === base_stream_controller_1.State.WAITING_INIT_PTS) {\n this.tick();\n }\n }\n };\n AudioStreamController.prototype.startLoad = function (startPosition) {\n if (this.tracks) {\n var lastCurrentTime = this.lastCurrentTime;\n this.stopLoad();\n this.setInterval(TICK_INTERVAL);\n this.fragLoadError = 0;\n if (lastCurrentTime > 0 && startPosition === -1) {\n logger_1.logger.log(\"audio:override startPosition with lastCurrentTime @\" + lastCurrentTime.toFixed(3));\n this.state = base_stream_controller_1.State.IDLE;\n }\n else {\n this.lastCurrentTime = this.startPosition ? this.startPosition : startPosition;\n this.state = base_stream_controller_1.State.STARTING;\n }\n this.nextLoadPosition = this.startPosition = this.lastCurrentTime;\n this.tick();\n }\n else {\n this.startPosition = startPosition;\n this.state = base_stream_controller_1.State.STOPPED;\n }\n };\n AudioStreamController.prototype.stopLoad = function () {\n var frag = this.fragCurrent;\n if (frag) {\n if (frag.loader) {\n frag.loader.abort();\n }\n this.fragmentTracker.removeFragment(frag);\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n this.state = base_stream_controller_1.State.STOPPED;\n };\n Object.defineProperty(AudioStreamController.prototype, \"state\", {\n get: function () {\n return this._state;\n },\n set: function (nextState) {\n if (this.state !== nextState) {\n var previousState = this.state;\n this._state = nextState;\n logger_1.logger.log(\"audio stream:\" + previousState + \"->\" + nextState);\n }\n },\n enumerable: true,\n configurable: true\n });\n AudioStreamController.prototype.doTick = function () {\n var pos, track, trackDetails, hls = this.hls, config = hls.config;\n // logger.log('audioStream:' + this.state);\n switch (this.state) {\n case base_stream_controller_1.State.ERROR:\n // don't do anything in error state to avoid breaking further ...\n case base_stream_controller_1.State.PAUSED:\n // don't do anything in paused state either ...\n case base_stream_controller_1.State.BUFFER_FLUSHING:\n break;\n case base_stream_controller_1.State.STARTING:\n this.state = base_stream_controller_1.State.WAITING_TRACK;\n this.loadedmetadata = false;\n break;\n case base_stream_controller_1.State.IDLE:\n var tracks = this.tracks;\n // audio tracks not received => exit loop\n if (!tracks) {\n break;\n }\n // if video not attached AND\n // start fragment already requested OR start frag prefetch disable\n // exit loop\n // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop\n if (!this.media &&\n (this.startFragRequested || !config.startFragPrefetch)) {\n break;\n }\n // determine next candidate fragment to be loaded, based on current position and\n // end of buffer position\n // if we have not yet loaded any fragment, start loading from start position\n if (this.loadedmetadata) {\n pos = this.media.currentTime;\n }\n else {\n pos = this.nextLoadPosition;\n if (pos === undefined) {\n break;\n }\n }\n var media = this.mediaBuffer ? this.mediaBuffer : this.media, videoBuffer = this.videoBuffer ? this.videoBuffer : this.media, bufferInfo = buffer_helper_1.BufferHelper.bufferInfo(media, pos, config.maxBufferHole), mainBufferInfo = buffer_helper_1.BufferHelper.bufferInfo(videoBuffer, pos, config.maxBufferHole), bufferLen = bufferInfo.len, bufferEnd_1 = bufferInfo.end, fragPrevious = this.fragPrevious, \n // ensure we buffer at least config.maxBufferLength (default 30s) or config.maxMaxBufferLength (default: 600s)\n // whichever is smaller.\n // once we reach that threshold, don't buffer more than video (mainBufferInfo.len)\n maxConfigBuffer = Math.min(config.maxBufferLength, config.maxMaxBufferLength), maxBufLen = Math.max(maxConfigBuffer, mainBufferInfo.len), audioSwitch = this.audioSwitch, trackId = this.trackId;\n // if buffer length is less than maxBufLen try to load a new fragment\n if ((bufferLen < maxBufLen || audioSwitch) && trackId < tracks.length) {\n trackDetails = tracks[trackId].details;\n // if track info not retrieved yet, switch state and wait for track retrieval\n if (typeof trackDetails === 'undefined') {\n this.state = base_stream_controller_1.State.WAITING_TRACK;\n break;\n }\n if (!audioSwitch && this._streamEnded(bufferInfo, trackDetails)) {\n this.hls.trigger(events_1.default.BUFFER_EOS, { type: 'audio' });\n this.state = base_stream_controller_1.State.ENDED;\n return;\n }\n // find fragment index, contiguous with end of buffer position\n var fragments = trackDetails.fragments, fragLen = fragments.length, start = fragments[0].start, end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration, frag = void 0;\n // When switching audio track, reload audio as close as possible to currentTime\n if (audioSwitch) {\n if (trackDetails.live && !trackDetails.PTSKnown) {\n logger_1.logger.log('switching audiotrack, live stream, unknown PTS,load first fragment');\n bufferEnd_1 = 0;\n }\n else {\n bufferEnd_1 = pos;\n // if currentTime (pos) is less than alt audio playlist start time, it means that alt audio is ahead of currentTime\n if (trackDetails.PTSKnown && pos < start) {\n // if everything is buffered from pos to start or if audio buffer upfront, let's seek to start\n if (bufferInfo.end > start || bufferInfo.nextStart) {\n logger_1.logger.log('alt audio track ahead of main track, seek to start of alt audio track');\n this.media.currentTime = start + 0.05;\n }\n else {\n return;\n }\n }\n }\n }\n if (trackDetails.initSegment && !trackDetails.initSegment.data) {\n frag = trackDetails.initSegment;\n } // eslint-disable-line brace-style\n // if bufferEnd before start of playlist, load first fragment\n else if (bufferEnd_1 <= start) {\n frag = fragments[0];\n if (this.videoTrackCC !== null && frag.cc !== this.videoTrackCC) {\n // Ensure we find a fragment which matches the continuity of the video track\n frag = discontinuities_1.findFragWithCC(fragments, this.videoTrackCC);\n }\n if (trackDetails.live && frag.loadIdx && frag.loadIdx === this.fragLoadIdx) {\n // we just loaded this first fragment, and we are still lagging behind the start of the live playlist\n // let's force seek to start\n var nextBuffered = bufferInfo.nextStart ? bufferInfo.nextStart : start;\n logger_1.logger.log(\"no alt audio available @currentTime:\" + this.media.currentTime + \", seeking @\" + (nextBuffered + 0.05));\n this.media.currentTime = nextBuffered + 0.05;\n return;\n }\n }\n else {\n var foundFrag = void 0;\n var maxFragLookUpTolerance_1 = config.maxFragLookUpTolerance;\n var fragNext = fragPrevious ? fragments[fragPrevious.sn - fragments[0].sn + 1] : undefined;\n var fragmentWithinToleranceTest = function (candidate) {\n // offset should be within fragment boundary - config.maxFragLookUpTolerance\n // this is to cope with situations like\n // bufferEnd = 9.991\n // frag[Ø] : [0,10]\n // frag[1] : [10,20]\n // bufferEnd is within frag[0] range ... although what we are expecting is to return frag[1] here\n // frag start frag start+duration\n // |-----------------------------|\n // <---> <--->\n // ...--------><-----------------------------><---------....\n // previous frag matching fragment next frag\n // return -1 return 0 return 1\n // logger.log(`level/sn/start/end/bufEnd:${level}/${candidate.sn}/${candidate.start}/${(candidate.start+candidate.duration)}/${bufferEnd}`);\n // Set the lookup tolerance to be small enough to detect the current segment - ensures we don't skip over very small segments\n var candidateLookupTolerance = Math.min(maxFragLookUpTolerance_1, candidate.duration);\n if ((candidate.start + candidate.duration - candidateLookupTolerance) <= bufferEnd_1) {\n return 1;\n }\n else if (candidate.start - candidateLookupTolerance > bufferEnd_1 && candidate.start) {\n // if maxFragLookUpTolerance will have negative value then don't return -1 for first element\n return -1;\n }\n return 0;\n };\n if (bufferEnd_1 < end) {\n if (bufferEnd_1 > end - maxFragLookUpTolerance_1) {\n maxFragLookUpTolerance_1 = 0;\n }\n // Prefer the next fragment if it's within tolerance\n if (fragNext && !fragmentWithinToleranceTest(fragNext)) {\n foundFrag = fragNext;\n }\n else {\n foundFrag = binary_search_1.default.search(fragments, fragmentWithinToleranceTest);\n }\n }\n else {\n // reach end of playlist\n foundFrag = fragments[fragLen - 1];\n }\n if (foundFrag) {\n frag = foundFrag;\n start = foundFrag.start;\n // logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) {\n if (frag.sn < trackDetails.endSN) {\n frag = fragments[frag.sn + 1 - trackDetails.startSN];\n logger_1.logger.log(\"SN just loaded, load next one: \" + frag.sn);\n }\n else {\n frag = null;\n }\n }\n }\n }\n if (frag) {\n // logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));\n if (frag.encrypted) {\n logger_1.logger.log(\"Loading key for \" + frag.sn + \" of [\" + trackDetails.startSN + \" ,\" + trackDetails.endSN + \"],track \" + trackId);\n this.state = base_stream_controller_1.State.KEY_LOADING;\n hls.trigger(events_1.default.KEY_LOADING, { frag: frag });\n }\n else {\n logger_1.logger.log(\"Loading \" + frag.sn + \", cc: \" + frag.cc + \" of [\" + trackDetails.startSN + \" ,\" + trackDetails.endSN + \"],track \" + trackId + \", currentTime:\" + pos + \",bufferEnd:\" + bufferEnd_1.toFixed(3));\n // only load if fragment is not loaded or if in audio switch\n // we force a frag loading in audio switch as fragment tracker might not have evicted previous frags in case of quick audio switch\n this.fragCurrent = frag;\n if (audioSwitch || this.fragmentTracker.getState(frag) === fragment_tracker_1.FragmentState.NOT_LOADED) {\n this.startFragRequested = true;\n if (Number.isFinite(frag.sn)) {\n this.nextLoadPosition = frag.start + frag.duration;\n }\n hls.trigger(events_1.default.FRAG_LOADING, { frag: frag });\n this.state = base_stream_controller_1.State.FRAG_LOADING;\n }\n }\n }\n }\n break;\n case base_stream_controller_1.State.WAITING_TRACK:\n track = this.tracks[this.trackId];\n // check if playlist is already loaded\n if (track && track.details) {\n this.state = base_stream_controller_1.State.IDLE;\n }\n break;\n case base_stream_controller_1.State.FRAG_LOADING_WAITING_RETRY:\n var now = performance.now();\n var retryDate = this.retryDate;\n media = this.media;\n var isSeeking = media && media.seeking;\n // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading\n if (!retryDate || (now >= retryDate) || isSeeking) {\n logger_1.logger.log('audioStreamController: retryDate reached, switch back to IDLE state');\n this.state = base_stream_controller_1.State.IDLE;\n }\n break;\n case base_stream_controller_1.State.WAITING_INIT_PTS:\n var videoTrackCC = this.videoTrackCC;\n if (this.initPTS[videoTrackCC] === undefined) {\n break;\n }\n // Ensure we don't get stuck in the WAITING_INIT_PTS state if the waiting frag CC doesn't match any initPTS\n var waitingFrag = this.waitingFragment;\n if (waitingFrag) {\n var waitingFragCC = waitingFrag.frag.cc;\n if (videoTrackCC !== waitingFragCC) {\n track = this.tracks[this.trackId];\n if (track.details && track.details.live) {\n logger_1.logger.warn(\"Waiting fragment CC (\" + waitingFragCC + \") does not match video track CC (\" + videoTrackCC + \")\");\n this.waitingFragment = null;\n this.state = base_stream_controller_1.State.IDLE;\n }\n }\n else {\n this.state = base_stream_controller_1.State.FRAG_LOADING;\n this.onFragLoaded(this.waitingFragment);\n this.waitingFragment = null;\n }\n }\n else {\n this.state = base_stream_controller_1.State.IDLE;\n }\n break;\n case base_stream_controller_1.State.STOPPED:\n case base_stream_controller_1.State.FRAG_LOADING:\n case base_stream_controller_1.State.PARSING:\n case base_stream_controller_1.State.PARSED:\n case base_stream_controller_1.State.ENDED:\n break;\n default:\n break;\n }\n };\n AudioStreamController.prototype.onMediaAttached = function (data) {\n var media = this.media = this.mediaBuffer = data.media;\n this.onvseeking = this.onMediaSeeking.bind(this);\n this.onvended = this.onMediaEnded.bind(this);\n media.addEventListener('seeking', this.onvseeking);\n media.addEventListener('ended', this.onvended);\n var config = this.config;\n if (this.tracks && config.autoStartLoad) {\n this.startLoad(config.startPosition);\n }\n };\n AudioStreamController.prototype.onMediaDetaching = function () {\n var media = this.media;\n if (media && media.ended) {\n logger_1.logger.log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n }\n // remove video listeners\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n this.media = this.mediaBuffer = this.videoBuffer = null;\n this.loadedmetadata = false;\n this.stopLoad();\n };\n AudioStreamController.prototype.onAudioTracksUpdated = function (data) {\n logger_1.logger.log('audio tracks updated');\n this.tracks = data.audioTracks;\n };\n AudioStreamController.prototype.onAudioTrackSwitching = function (data) {\n // if any URL found on new audio track, it is an alternate audio track\n var altAudio = !!data.url;\n this.trackId = data.id;\n this.fragCurrent = null;\n this.state = base_stream_controller_1.State.PAUSED;\n this.waitingFragment = null;\n // destroy useless demuxer when switching audio to main\n if (!altAudio) {\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n }\n else {\n // switching to audio track, start timer if not already started\n this.setInterval(TICK_INTERVAL);\n }\n // should we switch tracks ?\n if (altAudio) {\n this.audioSwitch = true;\n // main audio track are handled by stream-controller, just do something if switching to alt audio track\n this.state = base_stream_controller_1.State.IDLE;\n }\n this.tick();\n };\n AudioStreamController.prototype.onAudioTrackLoaded = function (data) {\n var newDetails = data.details, trackId = data.id, track = this.tracks[trackId], duration = newDetails.totalduration, sliding = 0;\n logger_1.logger.log(\"track \" + trackId + \" loaded [\" + newDetails.startSN + \",\" + newDetails.endSN + \"],duration:\" + duration);\n if (newDetails.live) {\n var curDetails = track.details;\n if (curDetails && newDetails.fragments.length > 0) {\n // we already have details for that level, merge them\n LevelHelper.mergeDetails(curDetails, newDetails);\n sliding = newDetails.fragments[0].start;\n // TODO\n // this.liveSyncPosition = this.computeLivePosition(sliding, curDetails);\n if (newDetails.PTSKnown) {\n logger_1.logger.log(\"live audio playlist sliding:\" + sliding.toFixed(3));\n }\n else {\n logger_1.logger.log('live audio playlist - outdated PTS, unknown sliding');\n }\n }\n else {\n newDetails.PTSKnown = false;\n logger_1.logger.log('live audio playlist - first load, unknown sliding');\n }\n }\n else {\n newDetails.PTSKnown = false;\n }\n track.details = newDetails;\n // compute start position\n if (!this.startFragRequested) {\n // compute start position if set to -1. use it straight away if value is defined\n if (this.startPosition === -1) {\n // first, check if start time offset has been set in playlist, if yes, use this value\n var startTimeOffset = newDetails.startTimeOffset;\n if (Number.isFinite(startTimeOffset)) {\n logger_1.logger.log(\"start time offset found in playlist, adjust startPosition to \" + startTimeOffset);\n this.startPosition = startTimeOffset;\n }\n else {\n this.startPosition = 0;\n }\n }\n this.nextLoadPosition = this.startPosition;\n }\n // only switch batck to IDLE state if we were waiting for track to start downloading a new fragment\n if (this.state === base_stream_controller_1.State.WAITING_TRACK) {\n this.state = base_stream_controller_1.State.IDLE;\n }\n // trigger handler right now\n this.tick();\n };\n AudioStreamController.prototype.onKeyLoaded = function () {\n if (this.state === base_stream_controller_1.State.KEY_LOADING) {\n this.state = base_stream_controller_1.State.IDLE;\n this.tick();\n }\n };\n AudioStreamController.prototype.onFragLoaded = function (data) {\n var fragCurrent = this.fragCurrent, fragLoaded = data.frag;\n if (this.state === base_stream_controller_1.State.FRAG_LOADING &&\n fragCurrent &&\n fragLoaded.type === 'audio' &&\n fragLoaded.level === fragCurrent.level &&\n fragLoaded.sn === fragCurrent.sn) {\n var track = this.tracks[this.trackId], details = track.details, duration = details.totalduration, trackId = fragCurrent.level, sn = fragCurrent.sn, cc = fragCurrent.cc, audioCodec = this.config.defaultAudioCodec || track.audioCodec || 'mp4a.40.2', stats = this.stats = data.stats;\n if (sn === 'initSegment') {\n this.state = base_stream_controller_1.State.IDLE;\n stats.tparsed = stats.tbuffered = performance.now();\n details.initSegment.data = data.payload;\n this.hls.trigger(events_1.default.FRAG_BUFFERED, { stats: stats, frag: fragCurrent, id: 'audio' });\n this.tick();\n }\n else {\n this.state = base_stream_controller_1.State.PARSING;\n // transmux the MPEG-TS data to ISO-BMFF segments\n this.appended = false;\n if (!this.demuxer) {\n this.demuxer = new demuxer_1.default(this.hls, 'audio');\n }\n // Check if we have video initPTS\n // If not we need to wait for it\n var initPTS = this.initPTS[cc];\n var initSegmentData = details.initSegment ? details.initSegment.data : [];\n if (details.initSegment || initPTS !== undefined) {\n this.pendingBuffering = true;\n logger_1.logger.log(\"Demuxing \" + sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],track \" + trackId);\n // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live)\n var accurateTimeOffset = false; // details.PTSKnown || !details.live;\n this.demuxer.push(data.payload, initSegmentData, audioCodec, null, fragCurrent, duration, accurateTimeOffset, initPTS);\n }\n else {\n logger_1.logger.log(\"unknown video PTS for continuity counter \" + cc + \", waiting for video PTS before demuxing audio frag \" + sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],track \" + trackId);\n this.waitingFragment = data;\n this.state = base_stream_controller_1.State.WAITING_INIT_PTS;\n }\n }\n }\n this.fragLoadError = 0;\n };\n AudioStreamController.prototype.onFragParsingInitSegment = function (data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent &&\n data.id === 'audio' &&\n fragNew.sn === fragCurrent.sn &&\n fragNew.level === fragCurrent.level &&\n this.state === base_stream_controller_1.State.PARSING) {\n var tracks = data.tracks, track = void 0;\n // delete any video track found on audio demuxer\n if (tracks.video) {\n delete tracks.video;\n }\n // include levelCodec in audio and video tracks\n track = tracks.audio;\n if (track) {\n track.levelCodec = track.codec;\n track.id = data.id;\n this.hls.trigger(events_1.default.BUFFER_CODECS, tracks);\n logger_1.logger.log(\"audio track:audio,container:\" + track.container + \",codecs[level/parsed]=[\" + track.levelCodec + \"/\" + track.codec + \"]\");\n var initSegment = track.initSegment;\n if (initSegment) {\n var appendObj = { type: 'audio', data: initSegment, parent: 'audio', content: 'initSegment' };\n if (this.audioSwitch) {\n this.pendingData = [appendObj];\n }\n else {\n this.appended = true;\n // arm pending Buffering flag before appending a segment\n this.pendingBuffering = true;\n this.hls.trigger(events_1.default.BUFFER_APPENDING, appendObj);\n }\n }\n // trigger handler right now\n this.tick();\n }\n }\n };\n AudioStreamController.prototype.onFragParsingData = function (data) {\n var _this = this;\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent &&\n data.id === 'audio' &&\n data.type === 'audio' &&\n fragNew.sn === fragCurrent.sn &&\n fragNew.level === fragCurrent.level &&\n this.state === base_stream_controller_1.State.PARSING) {\n var trackId = this.trackId, track = this.tracks[trackId], hls_1 = this.hls;\n if (!Number.isFinite(data.endPTS)) {\n data.endPTS = data.startPTS + fragCurrent.duration;\n data.endDTS = data.startDTS + fragCurrent.duration;\n }\n fragCurrent.addElementaryStream(fragment_1.default.ElementaryStreamTypes.AUDIO);\n logger_1.logger.log(\"parsed \" + data.type + \",PTS:[\" + data.startPTS.toFixed(3) + \",\" + data.endPTS.toFixed(3) + \"],DTS:[\" + data.startDTS.toFixed(3) + \"/\" + data.endDTS.toFixed(3) + \"],nb:\" + data.nb);\n LevelHelper.updateFragPTSDTS(track.details, fragCurrent, data.startPTS, data.endPTS);\n var audioSwitch = this.audioSwitch, media = this.media, appendOnBufferFlush = false;\n // Only flush audio from old audio tracks when PTS is known on new audio track\n if (audioSwitch && media) {\n if (media.readyState) {\n var currentTime = media.currentTime;\n logger_1.logger.log('switching audio track : currentTime:' + currentTime);\n if (currentTime >= data.startPTS) {\n logger_1.logger.log('switching audio track : flushing all audio');\n this.state = base_stream_controller_1.State.BUFFER_FLUSHING;\n hls_1.trigger(events_1.default.BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: 'audio' });\n appendOnBufferFlush = true;\n // Lets announce that the initial audio track switch flush occur\n this.audioSwitch = false;\n hls_1.trigger(events_1.default.AUDIO_TRACK_SWITCHED, { id: trackId });\n }\n }\n else {\n // Lets announce that the initial audio track switch flush occur\n this.audioSwitch = false;\n hls_1.trigger(events_1.default.AUDIO_TRACK_SWITCHED, { id: trackId });\n }\n }\n var pendingData_1 = this.pendingData;\n if (!pendingData_1) {\n logger_1.logger.warn('Apparently attempt to enqueue media payload without codec initialization data upfront');\n hls_1.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MEDIA_ERROR, details: null, fatal: true });\n return;\n }\n if (!this.audioSwitch) {\n [data.data1, data.data2].forEach(function (buffer) {\n if (buffer && buffer.length) {\n pendingData_1.push({ type: data.type, data: buffer, parent: 'audio', content: 'data' });\n }\n });\n if (!appendOnBufferFlush && pendingData_1.length) {\n pendingData_1.forEach(function (appendObj) {\n // only append in PARSING state (rationale is that an appending error could happen synchronously on first segment appending)\n // in that case it is useless to append following segments\n if (_this.state === base_stream_controller_1.State.PARSING) {\n // arm pending Buffering flag before appending a segment\n _this.pendingBuffering = true;\n _this.hls.trigger(events_1.default.BUFFER_APPENDING, appendObj);\n }\n });\n this.pendingData = [];\n this.appended = true;\n }\n }\n // trigger handler right now\n this.tick();\n }\n };\n AudioStreamController.prototype.onFragParsed = function (data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent &&\n data.id === 'audio' &&\n fragNew.sn === fragCurrent.sn &&\n fragNew.level === fragCurrent.level &&\n this.state === base_stream_controller_1.State.PARSING) {\n this.stats.tparsed = performance.now();\n this.state = base_stream_controller_1.State.PARSED;\n this._checkAppendedParsed();\n }\n };\n AudioStreamController.prototype.onBufferReset = function () {\n // reset reference to sourcebuffers\n this.mediaBuffer = this.videoBuffer = null;\n this.loadedmetadata = false;\n };\n AudioStreamController.prototype.onBufferCreated = function (data) {\n var audioTrack = data.tracks.audio;\n if (audioTrack) {\n this.mediaBuffer = audioTrack.buffer;\n this.loadedmetadata = true;\n }\n if (data.tracks.video) {\n this.videoBuffer = data.tracks.video.buffer;\n }\n };\n AudioStreamController.prototype.onBufferAppended = function (data) {\n if (data.parent === 'audio') {\n var state = this.state;\n if (state === base_stream_controller_1.State.PARSING || state === base_stream_controller_1.State.PARSED) {\n // check if all buffers have been appended\n this.pendingBuffering = (data.pending > 0);\n this._checkAppendedParsed();\n }\n }\n };\n AudioStreamController.prototype._checkAppendedParsed = function () {\n // trigger handler right now\n if (this.state === base_stream_controller_1.State.PARSED && (!this.appended || !this.pendingBuffering)) {\n var frag = this.fragCurrent, stats = this.stats, hls_2 = this.hls;\n if (frag) {\n this.fragPrevious = frag;\n stats.tbuffered = performance.now();\n hls_2.trigger(events_1.default.FRAG_BUFFERED, { stats: stats, frag: frag, id: 'audio' });\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n logger_1.logger.log(\"audio buffered : \" + time_ranges_1.default.toString(media.buffered));\n if (this.audioSwitch && this.appended) {\n this.audioSwitch = false;\n hls_2.trigger(events_1.default.AUDIO_TRACK_SWITCHED, { id: this.trackId });\n }\n this.state = base_stream_controller_1.State.IDLE;\n }\n this.tick();\n }\n };\n AudioStreamController.prototype.onError = function (data) {\n var frag = data.frag;\n // don't handle frag error not related to audio fragment\n if (frag && frag.type !== 'audio') {\n return;\n }\n switch (data.details) {\n case errors_1.ErrorDetails.FRAG_LOAD_ERROR:\n case errors_1.ErrorDetails.FRAG_LOAD_TIMEOUT:\n var frag_1 = data.frag;\n // don't handle frag error not related to audio fragment\n if (frag_1 && frag_1.type !== 'audio') {\n break;\n }\n if (!data.fatal) {\n var loadError = this.fragLoadError;\n if (loadError) {\n loadError++;\n }\n else {\n loadError = 1;\n }\n var config = this.config;\n if (loadError <= config.fragLoadingMaxRetry) {\n this.fragLoadError = loadError;\n // exponential backoff capped to config.fragLoadingMaxRetryTimeout\n var delay = Math.min(Math.pow(2, loadError - 1) * config.fragLoadingRetryDelay, config.fragLoadingMaxRetryTimeout);\n logger_1.logger.warn(\"AudioStreamController: frag loading failed, retry in \" + delay + \" ms\");\n this.retryDate = performance.now() + delay;\n // retry loading state\n this.state = base_stream_controller_1.State.FRAG_LOADING_WAITING_RETRY;\n }\n else {\n logger_1.logger.error(\"AudioStreamController: \" + data.details + \" reaches max retry, redispatch as fatal ...\");\n // switch error to fatal\n data.fatal = true;\n this.state = base_stream_controller_1.State.ERROR;\n }\n }\n break;\n case errors_1.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:\n case errors_1.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:\n case errors_1.ErrorDetails.KEY_LOAD_ERROR:\n case errors_1.ErrorDetails.KEY_LOAD_TIMEOUT:\n // when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received\n if (this.state !== base_stream_controller_1.State.ERROR) {\n // if fatal error, stop processing, otherwise move to IDLE to retry loading\n this.state = data.fatal ? base_stream_controller_1.State.ERROR : base_stream_controller_1.State.IDLE;\n logger_1.logger.warn(\"AudioStreamController: \" + data.details + \" while loading frag, now switching to \" + this.state + \" state ...\");\n }\n break;\n case errors_1.ErrorDetails.BUFFER_FULL_ERROR:\n // if in appending state\n if (data.parent === 'audio' && (this.state === base_stream_controller_1.State.PARSING || this.state === base_stream_controller_1.State.PARSED)) {\n var media = this.mediaBuffer, currentTime = this.media.currentTime, mediaBuffered = media && buffer_helper_1.BufferHelper.isBuffered(media, currentTime) && buffer_helper_1.BufferHelper.isBuffered(media, currentTime + 0.5);\n // reduce max buf len if current position is buffered\n if (mediaBuffered) {\n var config = this.config;\n if (config.maxMaxBufferLength >= config.maxBufferLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n config.maxMaxBufferLength /= 2;\n logger_1.logger.warn(\"AudioStreamController: reduce max buffer length to \" + config.maxMaxBufferLength + \"s\");\n }\n this.state = base_stream_controller_1.State.IDLE;\n }\n else {\n // current position is not buffered, but browser is still complaining about buffer full error\n // this happens on IE/Edge, refer to https://github.com/video-dev/hls.js/pull/708\n // in that case flush the whole audio buffer to recover\n logger_1.logger.warn('AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer');\n this.fragCurrent = null;\n // flush everything\n this.state = base_stream_controller_1.State.BUFFER_FLUSHING;\n this.hls.trigger(events_1.default.BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: 'audio' });\n }\n }\n break;\n default:\n break;\n }\n };\n AudioStreamController.prototype.onBufferFlushed = function () {\n var _this = this;\n var pendingData = this.pendingData;\n if (pendingData && pendingData.length) {\n logger_1.logger.log('AudioStreamController: appending pending audio data after buffer flushed');\n pendingData.forEach(function (appendObj) {\n _this.hls.trigger(events_1.default.BUFFER_APPENDING, appendObj);\n });\n this.appended = true;\n this.pendingData = [];\n this.state = base_stream_controller_1.State.PARSED;\n }\n else {\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = base_stream_controller_1.State.IDLE;\n // reset reference to frag\n this.fragPrevious = null;\n this.tick();\n }\n };\n return AudioStreamController;\n}(base_stream_controller_1.default));\nexports.default = AudioStreamController;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/controller/audio-track-controller.js\":\n/*!**************************************************!*\\\n !*** ./src/controller/audio-track-controller.js ***!\n \\**************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar task_loop_1 = __webpack_require__(/*! ../task-loop */ \"./src/task-loop.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\n/**\n * @class AudioTrackController\n * @implements {EventHandler}\n *\n * Handles main manifest and audio-track metadata loaded,\n * owns and exposes the selectable audio-tracks data-models.\n *\n * Exposes internal interface to select available audio-tracks.\n *\n * Handles errors on loading audio-track playlists. Manages fallback mechanism\n * with redundants tracks (group-IDs).\n *\n * Handles level-loading and group-ID switches for video (fallback on video levels),\n * and eventually adapts the audio-track group-ID to match.\n *\n * @fires AUDIO_TRACK_LOADING\n * @fires AUDIO_TRACK_SWITCHING\n * @fires AUDIO_TRACKS_UPDATED\n * @fires ERROR\n *\n */\nvar AudioTrackController = /** @class */ (function (_super) {\n __extends(AudioTrackController, _super);\n function AudioTrackController(hls) {\n var _this = _super.call(this, hls, events_1.default.MANIFEST_LOADING, events_1.default.MANIFEST_PARSED, events_1.default.AUDIO_TRACK_LOADED, events_1.default.AUDIO_TRACK_SWITCHED, events_1.default.LEVEL_LOADED, events_1.default.ERROR) || this;\n /**\n * @private\n * Currently selected index in `tracks`\n * @member {number} trackId\n */\n _this._trackId = -1;\n /**\n * @private\n * If should select tracks according to default track attribute\n * @member {boolean} _selectDefaultTrack\n */\n _this._selectDefaultTrack = true;\n /**\n * @public\n * All tracks available\n * @member {AudioTrack[]}\n */\n _this.tracks = [];\n /**\n * @public\n * List of blacklisted audio track IDs (that have caused failure)\n * @member {number[]}\n */\n _this.trackIdBlacklist = Object.create(null);\n /**\n * @public\n * The currently running group ID for audio\n * (we grab this on manifest-parsed and new level-loaded)\n * @member {string}\n */\n _this.audioGroupId = null;\n return _this;\n }\n /**\n * Reset audio tracks on new manifest loading.\n */\n AudioTrackController.prototype.onManifestLoading = function () {\n this.tracks = [];\n this._trackId = -1;\n this._selectDefaultTrack = true;\n };\n /**\n * Store tracks data from manifest parsed data.\n *\n * Trigger AUDIO_TRACKS_UPDATED event.\n *\n * @param {*} data\n */\n AudioTrackController.prototype.onManifestParsed = function (data) {\n var tracks = this.tracks = data.audioTracks || [];\n this.hls.trigger(events_1.default.AUDIO_TRACKS_UPDATED, { audioTracks: tracks });\n };\n /**\n * Store track details of loaded track in our data-model.\n *\n * Set-up metadata update interval task for live-mode streams.\n *\n * @param {} data\n */\n AudioTrackController.prototype.onAudioTrackLoaded = function (data) {\n if (data.id >= this.tracks.length) {\n logger_1.logger.warn('Invalid audio track id:', data.id);\n return;\n }\n logger_1.logger.log(\"audioTrack \" + data.id + \" loaded\");\n this.tracks[data.id].details = data.details;\n // check if current playlist is a live playlist\n // and if we have already our reload interval setup\n if (data.details.live && !this.hasInterval()) {\n // if live playlist we will have to reload it periodically\n // set reload period to playlist target duration\n var updatePeriodMs = data.details.targetduration * 1000;\n this.setInterval(updatePeriodMs);\n }\n if (!data.details.live && this.hasInterval()) {\n // playlist is not live and timer is scheduled: cancel it\n this.clearInterval();\n }\n };\n /**\n * Update the internal group ID to any audio-track we may have set manually\n * or because of a failure-handling fallback.\n *\n * Quality-levels should update to that group ID in this case.\n *\n * @param {*} data\n */\n AudioTrackController.prototype.onAudioTrackSwitched = function (data) {\n var audioGroupId = this.tracks[data.id].groupId;\n if (audioGroupId && (this.audioGroupId !== audioGroupId)) {\n this.audioGroupId = audioGroupId;\n }\n };\n /**\n * When a level gets loaded, if it has redundant audioGroupIds (in the same ordinality as it's redundant URLs)\n * we are setting our audio-group ID internally to the one set, if it is different from the group ID currently set.\n *\n * If group-ID got update, we re-select the appropriate audio-track with this group-ID matching the currently\n * selected one (based on NAME property).\n *\n * @param {*} data\n */\n AudioTrackController.prototype.onLevelLoaded = function (data) {\n // FIXME: crashes because currentLevel is undefined\n // const levelInfo = this.hls.levels[this.hls.currentLevel];\n var levelInfo = this.hls.levels[data.level];\n if (!levelInfo.audioGroupIds) {\n return;\n }\n var audioGroupId = levelInfo.audioGroupIds[levelInfo.urlId];\n if (this.audioGroupId !== audioGroupId) {\n this.audioGroupId = audioGroupId;\n this._selectInitialAudioTrack();\n }\n };\n /**\n * Handle network errors loading audio track manifests\n * and also pausing on any netwok errors.\n *\n * @param {ErrorEventData} data\n */\n AudioTrackController.prototype.onError = function (data) {\n // Only handle network errors\n if (data.type !== errors_1.ErrorTypes.NETWORK_ERROR) {\n return;\n }\n // If fatal network error, cancel update task\n if (data.fatal) {\n this.clearInterval();\n }\n // If not an audio-track loading error don't handle further\n if (data.details !== errors_1.ErrorDetails.AUDIO_TRACK_LOAD_ERROR) {\n return;\n }\n logger_1.logger.warn('Network failure on audio-track id:', data.context.id);\n this._handleLoadError();\n };\n Object.defineProperty(AudioTrackController.prototype, \"audioTracks\", {\n /**\n * @type {AudioTrack[]} Audio-track list we own\n */\n get: function () {\n return this.tracks;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AudioTrackController.prototype, \"audioTrack\", {\n /**\n * @type {number} Index into audio-tracks list of currently selected track.\n */\n get: function () {\n return this._trackId;\n },\n /**\n * Select current track by index\n */\n set: function (newId) {\n this._setAudioTrack(newId);\n // If audio track is selected from API then don't choose from the manifest default track\n this._selectDefaultTrack = false;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * @private\n * @param {number} newId\n */\n AudioTrackController.prototype._setAudioTrack = function (newId) {\n // noop on same audio track id as already set\n if (this._trackId === newId && this.tracks[this._trackId].details) {\n logger_1.logger.debug('Same id as current audio-track passed, and track details available -> no-op');\n return;\n }\n // check if level idx is valid\n if (newId < 0 || newId >= this.tracks.length) {\n logger_1.logger.warn('Invalid id passed to audio-track controller');\n return;\n }\n var audioTrack = this.tracks[newId];\n logger_1.logger.log(\"Now switching to audio-track index \" + newId);\n // stopping live reloading timer if any\n this.clearInterval();\n this._trackId = newId;\n var url = audioTrack.url, type = audioTrack.type, id = audioTrack.id;\n this.hls.trigger(events_1.default.AUDIO_TRACK_SWITCHING, { id: id, type: type, url: url });\n this._loadTrackDetailsIfNeeded(audioTrack);\n };\n /**\n * @override\n */\n AudioTrackController.prototype.doTick = function () {\n this._updateTrack(this._trackId);\n };\n /**\n * Select initial track\n * @private\n */\n AudioTrackController.prototype._selectInitialAudioTrack = function () {\n var _this = this;\n var tracks = this.tracks;\n if (!tracks.length) {\n return;\n }\n var currentAudioTrack = this.tracks[this._trackId];\n var name = null;\n if (currentAudioTrack) {\n name = currentAudioTrack.name;\n }\n // Pre-select default tracks if there are any\n if (this._selectDefaultTrack) {\n var defaultTracks = tracks.filter(function (track) { return track.default; });\n if (defaultTracks.length) {\n tracks = defaultTracks;\n }\n else {\n logger_1.logger.warn('No default audio tracks defined');\n }\n }\n var trackFound = false;\n var traverseTracks = function () {\n // Select track with right group ID\n tracks.forEach(function (track) {\n if (trackFound) {\n return;\n }\n // We need to match the (pre-)selected group ID\n // and the NAME of the current track.\n if ((!_this.audioGroupId || track.groupId === _this.audioGroupId) &&\n (!name || name === track.name)) {\n // If there was a previous track try to stay with the same `NAME`.\n // It should be unique across tracks of same group, and consistent through redundant track groups.\n _this._setAudioTrack(track.id);\n trackFound = true;\n }\n });\n };\n traverseTracks();\n if (!trackFound) {\n name = null;\n traverseTracks();\n }\n if (!trackFound) {\n logger_1.logger.error(\"No track found for running audio group-ID: \" + this.audioGroupId);\n this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.MEDIA_ERROR,\n details: errors_1.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,\n fatal: true\n });\n }\n };\n /**\n * @private\n * @param {AudioTrack} audioTrack\n * @returns {boolean}\n */\n AudioTrackController.prototype._needsTrackLoading = function (audioTrack) {\n var details = audioTrack.details, url = audioTrack.url;\n if (!details || details.live) {\n // check if we face an audio track embedded in main playlist (audio track without URI attribute)\n return !!url;\n }\n return false;\n };\n /**\n * @private\n * @param {AudioTrack} audioTrack\n */\n AudioTrackController.prototype._loadTrackDetailsIfNeeded = function (audioTrack) {\n if (this._needsTrackLoading(audioTrack)) {\n var url = audioTrack.url, id = audioTrack.id;\n // track not retrieved yet, or live playlist we need to (re)load it\n logger_1.logger.log(\"loading audio-track playlist for id: \" + id);\n this.hls.trigger(events_1.default.AUDIO_TRACK_LOADING, { url: url, id: id });\n }\n };\n /**\n * @private\n * @param {number} newId\n */\n AudioTrackController.prototype._updateTrack = function (newId) {\n // check if level idx is valid\n if (newId < 0 || newId >= this.tracks.length) {\n return;\n }\n // stopping live reloading timer if any\n this.clearInterval();\n this._trackId = newId;\n logger_1.logger.log(\"trying to update audio-track \" + newId);\n var audioTrack = this.tracks[newId];\n this._loadTrackDetailsIfNeeded(audioTrack);\n };\n /**\n * @private\n */\n AudioTrackController.prototype._handleLoadError = function () {\n // First, let's black list current track id\n this.trackIdBlacklist[this._trackId] = true;\n // Let's try to fall back on a functional audio-track with the same group ID\n var previousId = this._trackId;\n var _a = this.tracks[previousId], name = _a.name, language = _a.language, groupId = _a.groupId;\n logger_1.logger.warn(\"Loading failed on audio track id: \" + previousId + \", group-id: \" + groupId + \", name/language: \\\"\" + name + \"\\\" / \\\"\" + language + \"\\\"\");\n // Find a non-blacklisted track ID with the same NAME\n // At least a track that is not blacklisted, thus on another group-ID.\n var newId = previousId;\n for (var i = 0; i < this.tracks.length; i++) {\n if (this.trackIdBlacklist[i]) {\n continue;\n }\n var newTrack = this.tracks[i];\n if (newTrack.name === name) {\n newId = i;\n break;\n }\n }\n if (newId === previousId) {\n logger_1.logger.warn(\"No fallback audio-track found for name/language: \\\"\" + name + \"\\\" / \\\"\" + language + \"\\\"\");\n return;\n }\n logger_1.logger.log('Attempting audio-track fallback id:', newId, 'group-id:', this.tracks[newId].groupId);\n this._setAudioTrack(newId);\n };\n return AudioTrackController;\n}(task_loop_1.default));\nexports.default = AudioTrackController;\n\n\n/***/ }),\n\n/***/ \"./src/controller/base-stream-controller.js\":\n/*!**************************************************!*\\\n !*** ./src/controller/base-stream-controller.js ***!\n \\**************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar task_loop_1 = __webpack_require__(/*! ../task-loop */ \"./src/task-loop.js\");\nvar fragment_tracker_1 = __webpack_require__(/*! ./fragment-tracker */ \"./src/controller/fragment-tracker.js\");\nvar buffer_helper_1 = __webpack_require__(/*! ../utils/buffer-helper */ \"./src/utils/buffer-helper.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nexports.State = {\n STOPPED: 'STOPPED',\n STARTING: 'STARTING',\n IDLE: 'IDLE',\n PAUSED: 'PAUSED',\n KEY_LOADING: 'KEY_LOADING',\n FRAG_LOADING: 'FRAG_LOADING',\n FRAG_LOADING_WAITING_RETRY: 'FRAG_LOADING_WAITING_RETRY',\n WAITING_TRACK: 'WAITING_TRACK',\n PARSING: 'PARSING',\n PARSED: 'PARSED',\n BUFFER_FLUSHING: 'BUFFER_FLUSHING',\n ENDED: 'ENDED',\n ERROR: 'ERROR',\n WAITING_INIT_PTS: 'WAITING_INIT_PTS',\n WAITING_LEVEL: 'WAITING_LEVEL'\n};\nvar BaseStreamController = /** @class */ (function (_super) {\n __extends(BaseStreamController, _super);\n function BaseStreamController() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BaseStreamController.prototype.doTick = function () { };\n BaseStreamController.prototype._streamEnded = function (bufferInfo, levelDetails) {\n var _a = this, fragCurrent = _a.fragCurrent, fragmentTracker = _a.fragmentTracker;\n // we just got done loading the final fragment and there is no other buffered range after ...\n // rationale is that in case there are any buffered ranges after, it means that there are unbuffered portion in between\n // so we should not switch to ENDED in that case, to be able to buffer them\n // dont switch to ENDED if we need to backtrack last fragment\n if (!levelDetails.live && fragCurrent && !fragCurrent.backtracked && fragCurrent.sn === levelDetails.endSN && !bufferInfo.nextStart) {\n var fragState = fragmentTracker.getState(fragCurrent);\n return fragState === fragment_tracker_1.FragmentState.PARTIAL || fragState === fragment_tracker_1.FragmentState.OK;\n }\n return false;\n };\n BaseStreamController.prototype.onMediaSeeking = function () {\n var _a = this, config = _a.config, media = _a.media, mediaBuffer = _a.mediaBuffer, state = _a.state;\n var currentTime = media ? media.currentTime : null;\n var bufferInfo = buffer_helper_1.BufferHelper.bufferInfo(mediaBuffer || media, currentTime, this.config.maxBufferHole);\n if (Number.isFinite(currentTime)) {\n logger_1.logger.log(\"media seeking to \" + currentTime.toFixed(3));\n }\n if (state === exports.State.FRAG_LOADING) {\n var fragCurrent = this.fragCurrent;\n // check if we are seeking to a unbuffered area AND if frag loading is in progress\n if (bufferInfo.len === 0 && fragCurrent) {\n var tolerance = config.maxFragLookUpTolerance;\n var fragStartOffset = fragCurrent.start - tolerance;\n var fragEndOffset = fragCurrent.start + fragCurrent.duration + tolerance;\n // check if we seek position will be out of currently loaded frag range : if out cancel frag load, if in, don't do anything\n if (currentTime < fragStartOffset || currentTime > fragEndOffset) {\n if (fragCurrent.loader) {\n logger_1.logger.log('seeking outside of buffer while fragment load in progress, cancel fragment load');\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n this.fragPrevious = null;\n // switch to IDLE state to load new fragment\n this.state = exports.State.IDLE;\n }\n else {\n logger_1.logger.log('seeking outside of buffer but within currently loaded fragment range');\n }\n }\n }\n else if (state === exports.State.ENDED) {\n // if seeking to unbuffered area, clean up fragPrevious\n if (bufferInfo.len === 0) {\n this.fragPrevious = null;\n this.fragCurrent = null;\n }\n // switch to IDLE state to check for potential new fragment\n this.state = exports.State.IDLE;\n }\n if (media) {\n this.lastCurrentTime = currentTime;\n }\n // in case seeking occurs although no media buffered, adjust startPosition and nextLoadPosition to seek target\n if (!this.loadedmetadata) {\n this.nextLoadPosition = this.startPosition = currentTime;\n }\n // tick to speed up processing\n this.tick();\n };\n BaseStreamController.prototype.onMediaEnded = function () {\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n };\n return BaseStreamController;\n}(task_loop_1.default));\nexports.default = BaseStreamController;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/controller/buffer-controller.js\":\n/*!*********************************************!*\\\n !*** ./src/controller/buffer-controller.js ***!\n \\*********************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\n/*\n * Buffer Controller\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar mediasource_helper_1 = __webpack_require__(/*! ../utils/mediasource-helper */ \"./src/utils/mediasource-helper.js\");\nvar MediaSource = mediasource_helper_1.getMediaSource();\nvar BufferController = /** @class */ (function (_super) {\n __extends(BufferController, _super);\n function BufferController(hls) {\n var _this = _super.call(this, hls, events_1.default.MEDIA_ATTACHING, events_1.default.MEDIA_DETACHING, events_1.default.MANIFEST_PARSED, events_1.default.BUFFER_RESET, events_1.default.BUFFER_APPENDING, events_1.default.BUFFER_CODECS, events_1.default.BUFFER_EOS, events_1.default.BUFFER_FLUSHING, events_1.default.LEVEL_PTS_UPDATED, events_1.default.LEVEL_UPDATED) || this;\n // the value that we have set mediasource.duration to\n // (the actual duration may be tweaked slighly by the browser)\n _this._msDuration = null;\n // the value that we want to set mediaSource.duration to\n _this._levelDuration = null;\n // the target duration of the current media playlist\n _this._levelTargetDuration = 10;\n // current stream state: true - for live broadcast, false - for VoD content\n _this._live = null;\n // cache the self generated object url to detect hijack of video tag\n _this._objectUrl = null;\n // The number of BUFFER_CODEC events received before any sourceBuffers are created\n _this.bufferCodecEventsExpected = 0;\n // Source Buffer listeners\n _this.onsbue = _this.onSBUpdateEnd.bind(_this);\n _this.onsbe = _this.onSBUpdateError.bind(_this);\n _this.pendingTracks = {};\n _this.tracks = {};\n return _this;\n }\n BufferController.prototype.destroy = function () {\n event_handler_1.default.prototype.destroy.call(this);\n };\n BufferController.prototype.onLevelPtsUpdated = function (data) {\n var type = data.type;\n var audioTrack = this.tracks.audio;\n // Adjusting `SourceBuffer.timestampOffset` (desired point in the timeline where the next frames should be appended)\n // in Chrome browser when we detect MPEG audio container and time delta between level PTS and `SourceBuffer.timestampOffset`\n // is greater than 100ms (this is enough to handle seek for VOD or level change for LIVE videos). At the time of change we issue\n // `SourceBuffer.abort()` and adjusting `SourceBuffer.timestampOffset` if `SourceBuffer.updating` is false or awaiting `updateend`\n // event if SB is in updating state.\n // More info here: https://github.com/video-dev/hls.js/issues/332#issuecomment-257986486\n if (type === 'audio' && audioTrack && audioTrack.container === 'audio/mpeg') { // Chrome audio mp3 track\n var audioBuffer = this.sourceBuffer.audio;\n var delta = Math.abs(audioBuffer.timestampOffset - data.start);\n // adjust timestamp offset if time delta is greater than 100ms\n if (delta > 0.1) {\n var updating = audioBuffer.updating;\n try {\n audioBuffer.abort();\n }\n catch (err) {\n logger_1.logger.warn('can not abort audio buffer: ' + err);\n }\n if (!updating) {\n logger_1.logger.warn('change mpeg audio timestamp offset from ' + audioBuffer.timestampOffset + ' to ' + data.start);\n audioBuffer.timestampOffset = data.start;\n }\n else {\n this.audioTimestampOffset = data.start;\n }\n }\n }\n };\n BufferController.prototype.onManifestParsed = function (data) {\n // in case of alt audio 2 BUFFER_CODECS events will be triggered, one per stream controller\n // sourcebuffers will be created all at once when the expected nb of tracks will be reached\n // in case alt audio is not used, only one BUFFER_CODEC event will be fired from main stream controller\n // it will contain the expected nb of source buffers, no need to compute it\n this.bufferCodecEventsExpected = data.altAudio ? 2 : 1;\n logger_1.logger.log(this.bufferCodecEventsExpected + \" bufferCodec event(s) expected\");\n };\n BufferController.prototype.onMediaAttaching = function (data) {\n var media = this.media = data.media;\n if (media) {\n // setup the media source\n var ms = this.mediaSource = new MediaSource();\n // Media Source listeners\n this.onmso = this.onMediaSourceOpen.bind(this);\n this.onmse = this.onMediaSourceEnded.bind(this);\n this.onmsc = this.onMediaSourceClose.bind(this);\n ms.addEventListener('sourceopen', this.onmso);\n ms.addEventListener('sourceended', this.onmse);\n ms.addEventListener('sourceclose', this.onmsc);\n // link video and media Source\n media.src = window.URL.createObjectURL(ms);\n // cache the locally generated object url\n this._objectUrl = media.src;\n }\n };\n BufferController.prototype.onMediaDetaching = function () {\n logger_1.logger.log('media source detaching');\n var ms = this.mediaSource;\n if (ms) {\n if (ms.readyState === 'open') {\n try {\n // endOfStream could trigger exception if any sourcebuffer is in updating state\n // we don't really care about checking sourcebuffer state here,\n // as we are anyway detaching the MediaSource\n // let's just avoid this exception to propagate\n ms.endOfStream();\n }\n catch (err) {\n logger_1.logger.warn(\"onMediaDetaching:\" + err.message + \" while calling endOfStream\");\n }\n }\n ms.removeEventListener('sourceopen', this.onmso);\n ms.removeEventListener('sourceended', this.onmse);\n ms.removeEventListener('sourceclose', this.onmsc);\n // Detach properly the MediaSource from the HTMLMediaElement as\n // suggested in https://github.com/w3c/media-source/issues/53.\n if (this.media) {\n window.URL.revokeObjectURL(this._objectUrl);\n // clean up video tag src only if it's our own url. some external libraries might\n // hijack the video tag and change its 'src' without destroying the Hls instance first\n if (this.media.src === this._objectUrl) {\n this.media.removeAttribute('src');\n this.media.load();\n }\n else {\n logger_1.logger.warn('media.src was changed by a third party - skip cleanup');\n }\n }\n this.mediaSource = null;\n this.media = null;\n this._objectUrl = null;\n this.pendingTracks = {};\n this.tracks = {};\n this.sourceBuffer = {};\n this.flushRange = [];\n this.segments = [];\n this.appended = 0;\n }\n this.onmso = this.onmse = this.onmsc = null;\n this.hls.trigger(events_1.default.MEDIA_DETACHED);\n };\n BufferController.prototype.onMediaSourceOpen = function () {\n logger_1.logger.log('media source opened');\n this.hls.trigger(events_1.default.MEDIA_ATTACHED, { media: this.media });\n var mediaSource = this.mediaSource;\n if (mediaSource) {\n // once received, don't listen anymore to sourceopen event\n mediaSource.removeEventListener('sourceopen', this.onmso);\n }\n this.checkPendingTracks();\n };\n BufferController.prototype.checkPendingTracks = function () {\n var _a = this, bufferCodecEventsExpected = _a.bufferCodecEventsExpected, pendingTracks = _a.pendingTracks;\n // Check if we've received all of the expected bufferCodec events. When none remain, create all the sourceBuffers at once.\n // This is important because the MSE spec allows implementations to throw QuotaExceededErrors if creating new sourceBuffers after\n // data has been appended to existing ones.\n // 2 tracks is the max (one for audio, one for video). If we've reach this max go ahead and create the buffers.\n var pendingTracksCount = Object.keys(pendingTracks).length;\n if ((pendingTracksCount && !bufferCodecEventsExpected) || pendingTracksCount === 2) {\n // ok, let's create them now !\n this.createSourceBuffers(pendingTracks);\n this.pendingTracks = {};\n // append any pending segments now !\n this.doAppending();\n }\n };\n BufferController.prototype.onMediaSourceClose = function () {\n logger_1.logger.log('media source closed');\n };\n BufferController.prototype.onMediaSourceEnded = function () {\n logger_1.logger.log('media source ended');\n };\n BufferController.prototype.onSBUpdateEnd = function () {\n // update timestampOffset\n if (this.audioTimestampOffset) {\n var audioBuffer = this.sourceBuffer.audio;\n logger_1.logger.warn(\"change mpeg audio timestamp offset from \" + audioBuffer.timestampOffset + \" to \" + this.audioTimestampOffset);\n audioBuffer.timestampOffset = this.audioTimestampOffset;\n delete this.audioTimestampOffset;\n }\n if (this._needsFlush) {\n this.doFlush();\n }\n if (this._needsEos) {\n this.checkEos();\n }\n this.appending = false;\n var parent = this.parent;\n // count nb of pending segments waiting for appending on this sourcebuffer\n var pending = this.segments.reduce(function (counter, segment) { return (segment.parent === parent) ? counter + 1 : counter; }, 0);\n // this.sourceBuffer is better to use than media.buffered as it is closer to the PTS data from the fragments\n var timeRanges = {};\n var sourceBuffer = this.sourceBuffer;\n for (var streamType in sourceBuffer) {\n timeRanges[streamType] = sourceBuffer[streamType].buffered;\n }\n this.hls.trigger(events_1.default.BUFFER_APPENDED, { parent: parent, pending: pending, timeRanges: timeRanges });\n // don't append in flushing mode\n if (!this._needsFlush) {\n this.doAppending();\n }\n this.updateMediaElementDuration();\n // appending goes first\n if (pending === 0) {\n this.flushLiveBackBuffer();\n }\n };\n BufferController.prototype.onSBUpdateError = function (event) {\n logger_1.logger.error('sourceBuffer error:', event);\n // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // this error might not always be fatal (it is fatal if decode error is set, in that case\n // it will be followed by a mediaElement error ...)\n this.hls.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MEDIA_ERROR, details: errors_1.ErrorDetails.BUFFER_APPENDING_ERROR, fatal: false });\n // we don't need to do more than that, as accordin to the spec, updateend will be fired just after\n };\n BufferController.prototype.onBufferReset = function () {\n var sourceBuffer = this.sourceBuffer;\n for (var type in sourceBuffer) {\n var sb = sourceBuffer[type];\n try {\n this.mediaSource.removeSourceBuffer(sb);\n sb.removeEventListener('updateend', this.onsbue);\n sb.removeEventListener('error', this.onsbe);\n }\n catch (err) {\n }\n }\n this.sourceBuffer = {};\n this.flushRange = [];\n this.segments = [];\n this.appended = 0;\n };\n BufferController.prototype.onBufferCodecs = function (tracks) {\n var _this = this;\n // if source buffer(s) not created yet, appended buffer tracks in this.pendingTracks\n // if sourcebuffers already created, do nothing ...\n if (Object.keys(this.sourceBuffer).length) {\n return;\n }\n Object.keys(tracks).forEach(function (trackName) {\n _this.pendingTracks[trackName] = tracks[trackName];\n });\n var mediaSource = this.mediaSource;\n this.bufferCodecEventsExpected = Math.max(this.bufferCodecEventsExpected - 1, 0);\n if (mediaSource && mediaSource.readyState === 'open') {\n this.checkPendingTracks();\n }\n };\n BufferController.prototype.createSourceBuffers = function (tracks) {\n var sourceBuffer = this.sourceBuffer, mediaSource = this.mediaSource;\n for (var trackName in tracks) {\n if (!sourceBuffer[trackName]) {\n var track = tracks[trackName];\n // use levelCodec as first priority\n var codec = track.levelCodec || track.codec;\n var mimeType = track.container + \";codecs=\" + codec;\n logger_1.logger.log(\"creating sourceBuffer(\" + mimeType + \")\");\n try {\n var sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType);\n sb.addEventListener('updateend', this.onsbue);\n sb.addEventListener('error', this.onsbe);\n this.tracks[trackName] = { codec: codec, container: track.container };\n track.buffer = sb;\n }\n catch (err) {\n logger_1.logger.error(\"error while trying to add sourceBuffer:\" + err.message);\n this.hls.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MEDIA_ERROR, details: errors_1.ErrorDetails.BUFFER_ADD_CODEC_ERROR, fatal: false, err: err, mimeType: mimeType });\n }\n }\n }\n this.hls.trigger(events_1.default.BUFFER_CREATED, { tracks: tracks });\n };\n BufferController.prototype.onBufferAppending = function (data) {\n if (!this._needsFlush) {\n if (!this.segments) {\n this.segments = [data];\n }\n else {\n this.segments.push(data);\n }\n this.doAppending();\n }\n };\n BufferController.prototype.onBufferAppendFail = function (data) {\n logger_1.logger.error('sourceBuffer error:', data.event);\n // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // this error might not always be fatal (it is fatal if decode error is set, in that case\n // it will be followed by a mediaElement error ...)\n this.hls.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MEDIA_ERROR, details: errors_1.ErrorDetails.BUFFER_APPENDING_ERROR, fatal: false });\n };\n // on BUFFER_EOS mark matching sourcebuffer(s) as ended and trigger checkEos()\n BufferController.prototype.onBufferEos = function (data) {\n var sb = this.sourceBuffer;\n var dataType = data.type;\n for (var type in sb) {\n if (!dataType || type === dataType) {\n if (!sb[type].ended) {\n sb[type].ended = true;\n logger_1.logger.log(type + \" sourceBuffer now EOS\");\n }\n }\n }\n this.checkEos();\n };\n // if all source buffers are marked as ended, signal endOfStream() to MediaSource.\n BufferController.prototype.checkEos = function () {\n var sb = this.sourceBuffer, mediaSource = this.mediaSource;\n if (!mediaSource || mediaSource.readyState !== 'open') {\n this._needsEos = false;\n return;\n }\n for (var type in sb) {\n var sbobj = sb[type];\n if (!sbobj.ended) {\n return;\n }\n if (sbobj.updating) {\n this._needsEos = true;\n return;\n }\n }\n logger_1.logger.log('all media data are available, signal endOfStream() to MediaSource and stop loading fragment');\n // Notify the media element that it now has all of the media data\n try {\n mediaSource.endOfStream();\n }\n catch (e) {\n logger_1.logger.warn('exception while calling mediaSource.endOfStream()');\n }\n this._needsEos = false;\n };\n BufferController.prototype.onBufferFlushing = function (data) {\n this.flushRange.push({ start: data.startOffset, end: data.endOffset, type: data.type });\n // attempt flush immediately\n this.flushBufferCounter = 0;\n this.doFlush();\n };\n BufferController.prototype.flushLiveBackBuffer = function () {\n // clear back buffer for live only\n if (!this._live) {\n return;\n }\n var liveBackBufferLength = this.hls.config.liveBackBufferLength;\n if (!isFinite(liveBackBufferLength) || liveBackBufferLength < 0) {\n return;\n }\n var currentTime = this.media.currentTime;\n var sourceBuffer = this.sourceBuffer;\n var bufferTypes = Object.keys(sourceBuffer);\n var targetBackBufferPosition = currentTime - Math.max(liveBackBufferLength, this._levelTargetDuration);\n for (var index = bufferTypes.length - 1; index >= 0; index--) {\n var bufferType = bufferTypes[index], buffered = sourceBuffer[bufferType].buffered;\n // when target buffer start exceeds actual buffer start\n if (buffered.length > 0 && targetBackBufferPosition > buffered.start(0)) {\n // remove buffer up until current time minus minimum back buffer length (removing buffer too close to current\n // time will lead to playback freezing)\n // credits for level target duration - https://github.com/videojs/http-streaming/blob/3132933b6aa99ddefab29c10447624efd6fd6e52/src/segment-loader.js#L91\n this.removeBufferRange(bufferType, sourceBuffer[bufferType], 0, targetBackBufferPosition);\n }\n }\n };\n BufferController.prototype.onLevelUpdated = function (_a) {\n var details = _a.details;\n if (details.fragments.length > 0) {\n this._levelDuration = details.totalduration + details.fragments[0].start;\n this._levelTargetDuration = details.averagetargetduration || details.targetduration || 10;\n this._live = details.live;\n this.updateMediaElementDuration();\n }\n };\n /**\n * Update Media Source duration to current level duration or override to Infinity if configuration parameter\n * 'liveDurationInfinity` is set to `true`\n * More details: https://github.com/video-dev/hls.js/issues/355\n */\n BufferController.prototype.updateMediaElementDuration = function () {\n var config = this.hls.config;\n var duration;\n if (this._levelDuration === null ||\n !this.media ||\n !this.mediaSource ||\n !this.sourceBuffer ||\n this.media.readyState === 0 ||\n this.mediaSource.readyState !== 'open') {\n return;\n }\n for (var type in this.sourceBuffer) {\n if (this.sourceBuffer[type].updating === true) {\n // can't set duration whilst a buffer is updating\n return;\n }\n }\n duration = this.media.duration;\n // initialise to the value that the media source is reporting\n if (this._msDuration === null) {\n this._msDuration = this.mediaSource.duration;\n }\n if (this._live === true && config.liveDurationInfinity === true) {\n // Override duration to Infinity\n logger_1.logger.log('Media Source duration is set to Infinity');\n this._msDuration = this.mediaSource.duration = Infinity;\n }\n else if ((this._levelDuration > this._msDuration && this._levelDuration > duration) || !Number.isFinite(duration)) {\n // levelDuration was the last value we set.\n // not using mediaSource.duration as the browser may tweak this value\n // only update Media Source duration if its value increase, this is to avoid\n // flushing already buffered portion when switching between quality level\n logger_1.logger.log(\"Updating Media Source duration to \" + this._levelDuration.toFixed(3));\n this._msDuration = this.mediaSource.duration = this._levelDuration;\n }\n };\n BufferController.prototype.doFlush = function () {\n // loop through all buffer ranges to flush\n while (this.flushRange.length) {\n var range = this.flushRange[0];\n // flushBuffer will abort any buffer append in progress and flush Audio/Video Buffer\n if (this.flushBuffer(range.start, range.end, range.type)) {\n // range flushed, remove from flush array\n this.flushRange.shift();\n this.flushBufferCounter = 0;\n }\n else {\n this._needsFlush = true;\n // avoid looping, wait for SB update end to retrigger a flush\n return;\n }\n }\n if (this.flushRange.length === 0) {\n // everything flushed\n this._needsFlush = false;\n // let's recompute this.appended, which is used to avoid flush looping\n var appended = 0;\n var sourceBuffer = this.sourceBuffer;\n try {\n for (var type in sourceBuffer) {\n appended += sourceBuffer[type].buffered.length;\n }\n }\n catch (error) {\n // error could be thrown while accessing buffered, in case sourcebuffer has already been removed from MediaSource\n // this is harmess at this stage, catch this to avoid reporting an internal exception\n logger_1.logger.error('error while accessing sourceBuffer.buffered');\n }\n this.appended = appended;\n this.hls.trigger(events_1.default.BUFFER_FLUSHED);\n }\n };\n BufferController.prototype.doAppending = function () {\n var _a = this, hls = _a.hls, segments = _a.segments, sourceBuffer = _a.sourceBuffer;\n if (Object.keys(sourceBuffer).length) {\n if (this.media.error) {\n this.segments = [];\n logger_1.logger.error('trying to append although a media error occured, flush segment and abort');\n return;\n }\n if (this.appending) {\n // logger.log(`sb appending in progress`);\n return;\n }\n if (segments && segments.length) {\n var segment = segments.shift();\n try {\n var type = segment.type, sb = sourceBuffer[type];\n if (sb) {\n if (!sb.updating) {\n // reset sourceBuffer ended flag before appending segment\n sb.ended = false;\n // logger.log(`appending ${segment.content} ${type} SB, size:${segment.data.length}, ${segment.parent}`);\n this.parent = segment.parent;\n sb.appendBuffer(segment.data);\n this.appendError = 0;\n this.appended++;\n this.appending = true;\n }\n else {\n segments.unshift(segment);\n }\n }\n else {\n // in case we don't have any source buffer matching with this segment type,\n // it means that Mediasource fails to create sourcebuffer\n // discard this segment, and trigger update end\n this.onSBUpdateEnd();\n }\n }\n catch (err) {\n // in case any error occured while appending, put back segment in segments table\n logger_1.logger.error(\"error while trying to append buffer:\" + err.message);\n segments.unshift(segment);\n var event_1 = { type: errors_1.ErrorTypes.MEDIA_ERROR, parent: segment.parent };\n if (err.code !== 22) {\n if (this.appendError) {\n this.appendError++;\n }\n else {\n this.appendError = 1;\n }\n event_1.details = errors_1.ErrorDetails.BUFFER_APPEND_ERROR;\n /* with UHD content, we could get loop of quota exceeded error until\n browser is able to evict some data from sourcebuffer. retrying help recovering this\n */\n if (this.appendError > hls.config.appendErrorMaxRetry) {\n logger_1.logger.log(\"fail \" + hls.config.appendErrorMaxRetry + \" times to append segment in sourceBuffer\");\n this.segments = [];\n event_1.fatal = true;\n hls.trigger(events_1.default.ERROR, event_1);\n }\n else {\n event_1.fatal = false;\n hls.trigger(events_1.default.ERROR, event_1);\n }\n }\n else {\n // QuotaExceededError: http://www.w3.org/TR/html5/infrastructure.html#quotaexceedederror\n // let's stop appending any segments, and report BUFFER_FULL_ERROR error\n this.segments = [];\n event_1.details = errors_1.ErrorDetails.BUFFER_FULL_ERROR;\n event_1.fatal = false;\n hls.trigger(events_1.default.ERROR, event_1);\n }\n }\n }\n }\n };\n /*\n flush specified buffered range,\n return true once range has been flushed.\n as sourceBuffer.remove() is asynchronous, flushBuffer will be retriggered on sourceBuffer update end\n */\n BufferController.prototype.flushBuffer = function (startOffset, endOffset, typeIn) {\n var sb;\n var sourceBuffer = this.sourceBuffer;\n if (Object.keys(sourceBuffer).length) {\n logger_1.logger.log(\"flushBuffer,pos/start/end: \" + this.media.currentTime.toFixed(3) + \"/\" + startOffset + \"/\" + endOffset);\n // safeguard to avoid infinite looping : don't try to flush more than the nb of appended segments\n if (this.flushBufferCounter < this.appended) {\n for (var type in sourceBuffer) {\n // check if sourcebuffer type is defined (typeIn): if yes, let's only flush this one\n // if no, let's flush all sourcebuffers\n if (typeIn && type !== typeIn) {\n continue;\n }\n sb = sourceBuffer[type];\n // we are going to flush buffer, mark source buffer as 'not ended'\n sb.ended = false;\n if (!sb.updating) {\n if (this.removeBufferRange(type, sb, startOffset, endOffset)) {\n this.flushBufferCounter++;\n return false;\n }\n }\n else {\n logger_1.logger.warn('cannot flush, sb updating in progress');\n return false;\n }\n }\n }\n else {\n logger_1.logger.warn('abort flushing too many retries');\n }\n logger_1.logger.log('buffer flushed');\n }\n // everything flushed !\n return true;\n };\n /**\n * Removes first buffered range from provided source buffer that lies within given start and end offsets.\n *\n * @param type Type of the source buffer, logging purposes only.\n * @param sb Target SourceBuffer instance.\n * @param startOffset\n * @param endOffset\n *\n * @returns {boolean} True when source buffer remove requested.\n */\n BufferController.prototype.removeBufferRange = function (type, sb, startOffset, endOffset) {\n try {\n for (var i = 0; i < sb.buffered.length; i++) {\n var bufStart = sb.buffered.start(i);\n var bufEnd = sb.buffered.end(i);\n var removeStart = Math.max(bufStart, startOffset);\n var removeEnd = Math.min(bufEnd, endOffset);\n /* sometimes sourcebuffer.remove() does not flush\n the exact expected time range.\n to avoid rounding issues/infinite loop,\n only flush buffer range of length greater than 500ms.\n */\n if (Math.min(removeEnd, bufEnd) - removeStart > 0.5) {\n logger_1.logger.log(\"sb remove \" + type + \" [\" + removeStart + \",\" + removeEnd + \"], of [\" + bufStart + \",\" + bufEnd + \"], pos:\" + this.media.currentTime);\n sb.remove(removeStart, removeEnd);\n return true;\n }\n }\n }\n catch (error) {\n logger_1.logger.warn('removeBufferRange failed', error);\n }\n return false;\n };\n return BufferController;\n}(event_handler_1.default));\nexports.default = BufferController;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/controller/cap-level-controller.js\":\n/*!************************************************!*\\\n !*** ./src/controller/cap-level-controller.js ***!\n \\************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\n/*\n * cap stream level to media size dimension controller\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar CapLevelController = /** @class */ (function (_super) {\n __extends(CapLevelController, _super);\n function CapLevelController(hls) {\n var _this = _super.call(this, hls, events_1.default.FPS_DROP_LEVEL_CAPPING, events_1.default.MEDIA_ATTACHING, events_1.default.MANIFEST_PARSED, events_1.default.BUFFER_CODECS, events_1.default.MEDIA_DETACHING) || this;\n _this.autoLevelCapping = Number.POSITIVE_INFINITY;\n _this.firstLevel = null;\n _this.levels = [];\n _this.media = null;\n _this.restrictedLevels = [];\n _this.timer = null;\n return _this;\n }\n CapLevelController.prototype.destroy = function () {\n if (this.hls.config.capLevelToPlayerSize) {\n this.media = null;\n this._stopCapping();\n }\n };\n CapLevelController.prototype.onFpsDropLevelCapping = function (data) {\n // Don't add a restricted level more than once\n if (CapLevelController.isLevelAllowed(data.droppedLevel, this.restrictedLevels)) {\n this.restrictedLevels.push(data.droppedLevel);\n }\n };\n CapLevelController.prototype.onMediaAttaching = function (data) {\n this.media = data.media instanceof window.HTMLVideoElement ? data.media : null;\n };\n CapLevelController.prototype.onManifestParsed = function (data) {\n var hls = this.hls;\n this.restrictedLevels = [];\n this.levels = data.levels;\n this.firstLevel = data.firstLevel;\n if (hls.config.capLevelToPlayerSize && data.video) {\n // Start capping immediately if the manifest has signaled video codecs\n this._startCapping();\n }\n };\n // Only activate capping when playing a video stream; otherwise, multi-bitrate audio-only streams will be restricted\n // to the first level\n CapLevelController.prototype.onBufferCodecs = function (data) {\n var hls = this.hls;\n if (hls.config.capLevelToPlayerSize && data.video) {\n // If the manifest did not signal a video codec capping has been deferred until we're certain video is present\n this._startCapping();\n }\n };\n CapLevelController.prototype.onLevelsUpdated = function (data) {\n this.levels = data.levels;\n };\n CapLevelController.prototype.onMediaDetaching = function () {\n this._stopCapping();\n };\n CapLevelController.prototype.detectPlayerSize = function () {\n if (this.media) {\n var levelsLength = this.levels ? this.levels.length : 0;\n if (levelsLength) {\n var hls_1 = this.hls;\n hls_1.autoLevelCapping = this.getMaxLevel(levelsLength - 1);\n if (hls_1.autoLevelCapping > this.autoLevelCapping) {\n // if auto level capping has a higher value for the previous one, flush the buffer using nextLevelSwitch\n // usually happen when the user go to the fullscreen mode.\n hls_1.streamController.nextLevelSwitch();\n }\n this.autoLevelCapping = hls_1.autoLevelCapping;\n }\n }\n };\n /*\n * returns level should be the one with the dimensions equal or greater than the media (player) dimensions (so the video will be downscaled)\n */\n CapLevelController.prototype.getMaxLevel = function (capLevelIndex) {\n var _this = this;\n if (!this.levels) {\n return -1;\n }\n var validLevels = this.levels.filter(function (level, index) {\n return CapLevelController.isLevelAllowed(index, _this.restrictedLevels) && index <= capLevelIndex;\n });\n return CapLevelController.getMaxLevelByMediaSize(validLevels, this.mediaWidth, this.mediaHeight);\n };\n CapLevelController.prototype._startCapping = function () {\n if (this.timer) {\n // Don't reset capping if started twice; this can happen if the manifest signals a video codec\n return;\n }\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n this.hls.firstLevel = this.getMaxLevel(this.firstLevel);\n clearInterval(this.timer);\n this.timer = setInterval(this.detectPlayerSize.bind(this), 1000);\n this.detectPlayerSize();\n };\n CapLevelController.prototype._stopCapping = function () {\n this.restrictedLevels = [];\n this.firstLevel = null;\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n if (this.timer) {\n this.timer = clearInterval(this.timer);\n this.timer = null;\n }\n };\n Object.defineProperty(CapLevelController.prototype, \"mediaWidth\", {\n get: function () {\n var width;\n var media = this.media;\n if (media) {\n width = media.width || media.clientWidth || media.offsetWidth;\n width *= CapLevelController.contentScaleFactor;\n }\n return width;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CapLevelController.prototype, \"mediaHeight\", {\n get: function () {\n var height;\n var media = this.media;\n if (media) {\n height = media.height || media.clientHeight || media.offsetHeight;\n height *= CapLevelController.contentScaleFactor;\n }\n return height;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CapLevelController, \"contentScaleFactor\", {\n get: function () {\n var pixelRatio = 1;\n try {\n pixelRatio = window.devicePixelRatio;\n }\n catch (e) { }\n return pixelRatio;\n },\n enumerable: true,\n configurable: true\n });\n CapLevelController.isLevelAllowed = function (level, restrictedLevels) {\n if (restrictedLevels === void 0) { restrictedLevels = []; }\n return restrictedLevels.indexOf(level) === -1;\n };\n CapLevelController.getMaxLevelByMediaSize = function (levels, width, height) {\n if (!levels || (levels && !levels.length)) {\n return -1;\n }\n // Levels can have the same dimensions but differing bandwidths - since levels are ordered, we can look to the next\n // to determine whether we've chosen the greatest bandwidth for the media's dimensions\n var atGreatestBandiwdth = function (curLevel, nextLevel) {\n if (!nextLevel) {\n return true;\n }\n return curLevel.width !== nextLevel.width || curLevel.height !== nextLevel.height;\n };\n // If we run through the loop without breaking, the media's dimensions are greater than every level, so default to\n // the max level\n var maxLevelIndex = levels.length - 1;\n for (var i = 0; i < levels.length; i += 1) {\n var level = levels[i];\n if ((level.width >= width || level.height >= height) && atGreatestBandiwdth(level, levels[i + 1])) {\n maxLevelIndex = i;\n break;\n }\n }\n return maxLevelIndex;\n };\n return CapLevelController;\n}(event_handler_1.default));\nexports.default = CapLevelController;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/controller/eme-controller.js\":\n/*!******************************************!*\\\n !*** ./src/controller/eme-controller.js ***!\n \\******************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * @author Stephan Hesse | \n *\n * DRM support for Hls.js\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar XMLHttpRequest = window.XMLHttpRequest;\nvar MAX_LICENSE_REQUEST_FAILURES = 3;\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestMediaKeySystemAccess\n */\nvar KeySystems = {\n WIDEVINE: 'com.widevine.alpha',\n PLAYREADY: 'com.microsoft.playready'\n};\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySystemConfiguration\n * @param {Array} audioCodecs List of required audio codecs to support\n * @param {Array} videoCodecs List of required video codecs to support\n * @param {object} drmSystemOptions Optional parameters/requirements for the key-system\n * @returns {Array} An array of supported configurations\n */\nvar createWidevineMediaKeySystemConfigurations = function (audioCodecs, videoCodecs, drmSystemOptions) {\n var baseConfig = {\n // initDataTypes: ['keyids', 'mp4'],\n // label: \"\",\n // persistentState: \"not-allowed\", // or \"required\" ?\n // distinctiveIdentifier: \"not-allowed\", // or \"required\" ?\n // sessionTypes: ['temporary'],\n videoCapabilities: [\n // { contentType: 'video/mp4; codecs=\"avc1.42E01E\"' }\n ]\n };\n videoCodecs.forEach(function (codec) {\n baseConfig.videoCapabilities.push({\n contentType: \"video/mp4; codecs=\\\"\" + codec + \"\\\"\"\n });\n });\n return [\n baseConfig\n ];\n};\n/**\n * The idea here is to handle key-system (and their respective platforms) specific configuration differences\n * in order to work with the local requestMediaKeySystemAccess method.\n *\n * We can also rule-out platform-related key-system support at this point by throwing an error or returning null.\n *\n * @param {string} keySystem Identifier for the key-system, see `KeySystems` enum\n * @param {Array} audioCodecs List of required audio codecs to support\n * @param {Array} videoCodecs List of required video codecs to support\n * @returns {Array | null} A non-empty Array of MediaKeySystemConfiguration objects or `null`\n */\nvar getSupportedMediaKeySystemConfigurations = function (keySystem, audioCodecs, videoCodecs) {\n switch (keySystem) {\n case KeySystems.WIDEVINE:\n return createWidevineMediaKeySystemConfigurations(audioCodecs, videoCodecs);\n default:\n throw Error('Unknown key-system: ' + keySystem);\n }\n};\n/**\n * Controller to deal with encrypted media extensions (EME)\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API\n *\n * @class\n * @constructor\n */\nvar EMEController = /** @class */ (function (_super) {\n __extends(EMEController, _super);\n /**\n * @constructs\n * @param {Hls} hls Our Hls.js instance\n */\n function EMEController(hls) {\n var _this = _super.call(this, hls, events_1.default.MEDIA_ATTACHED, events_1.default.MANIFEST_PARSED) || this;\n _this._widevineLicenseUrl = hls.config.widevineLicenseUrl;\n _this._licenseXhrSetup = hls.config.licenseXhrSetup;\n _this._emeEnabled = hls.config.emeEnabled;\n _this._requestMediaKeySystemAccess = hls.config.requestMediaKeySystemAccessFunc;\n _this._mediaKeysList = [];\n _this._media = null;\n _this._hasSetMediaKeys = false;\n _this._isMediaEncrypted = false;\n _this._requestLicenseFailureCount = 0;\n return _this;\n }\n /**\n *\n * @param {string} keySystem Identifier for the key-system, see `KeySystems` enum\n * @returns {string} License server URL for key-system (if any configured, otherwise causes error)\n */\n EMEController.prototype.getLicenseServerUrl = function (keySystem) {\n var url;\n switch (keySystem) {\n case KeySystems.WIDEVINE:\n url = this._widevineLicenseUrl;\n break;\n default:\n url = null;\n break;\n }\n if (!url) {\n logger_1.logger.error(\"No license server URL configured for key-system \\\"\" + keySystem + \"\\\"\");\n this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.KEY_SYSTEM_ERROR,\n details: errors_1.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,\n fatal: true\n });\n }\n return url;\n };\n /**\n * Requests access object and adds it to our list upon success\n * @private\n * @param {string} keySystem System ID (see `KeySystems`)\n * @param {Array} audioCodecs List of required audio codecs to support\n * @param {Array} videoCodecs List of required video codecs to support\n */\n EMEController.prototype._attemptKeySystemAccess = function (keySystem, audioCodecs, videoCodecs) {\n // TODO: add other DRM \"options\"\n var _this = this;\n var mediaKeySystemConfigs = getSupportedMediaKeySystemConfigurations(keySystem, audioCodecs, videoCodecs);\n if (!mediaKeySystemConfigs) {\n logger_1.logger.warn('Can not create config for key-system (maybe because platform is not supported):', keySystem);\n return;\n }\n logger_1.logger.log('Requesting encrypted media key-system access');\n // expecting interface like window.navigator.requestMediaKeySystemAccess\n this.requestMediaKeySystemAccess(keySystem, mediaKeySystemConfigs)\n .then(function (mediaKeySystemAccess) {\n _this._onMediaKeySystemAccessObtained(keySystem, mediaKeySystemAccess);\n })\n .catch(function (err) {\n logger_1.logger.error(\"Failed to obtain key-system \\\"\" + keySystem + \"\\\" access:\", err);\n });\n };\n Object.defineProperty(EMEController.prototype, \"requestMediaKeySystemAccess\", {\n get: function () {\n if (!this._requestMediaKeySystemAccess) {\n throw new Error('No requestMediaKeySystemAccess function configured');\n }\n return this._requestMediaKeySystemAccess;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Handles obtaining access to a key-system\n *\n * @param {string} keySystem\n * @param {MediaKeySystemAccess} mediaKeySystemAccess https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySystemAccess\n */\n EMEController.prototype._onMediaKeySystemAccessObtained = function (keySystem, mediaKeySystemAccess) {\n var _this = this;\n logger_1.logger.log(\"Access for key-system \\\"\" + keySystem + \"\\\" obtained\");\n var mediaKeysListItem = {\n mediaKeys: null,\n mediaKeysSession: null,\n mediaKeysSessionInitialized: false,\n mediaKeySystemAccess: mediaKeySystemAccess,\n mediaKeySystemDomain: keySystem\n };\n this._mediaKeysList.push(mediaKeysListItem);\n mediaKeySystemAccess.createMediaKeys()\n .then(function (mediaKeys) {\n mediaKeysListItem.mediaKeys = mediaKeys;\n logger_1.logger.log(\"Media-keys created for key-system \\\"\" + keySystem + \"\\\"\");\n _this._onMediaKeysCreated();\n })\n .catch(function (err) {\n logger_1.logger.error('Failed to create media-keys:', err);\n });\n };\n /**\n * Handles key-creation (represents access to CDM). We are going to create key-sessions upon this\n * for all existing keys where no session exists yet.\n */\n EMEController.prototype._onMediaKeysCreated = function () {\n var _this = this;\n // check for all key-list items if a session exists, otherwise, create one\n this._mediaKeysList.forEach(function (mediaKeysListItem) {\n if (!mediaKeysListItem.mediaKeysSession) {\n mediaKeysListItem.mediaKeysSession = mediaKeysListItem.mediaKeys.createSession();\n _this._onNewMediaKeySession(mediaKeysListItem.mediaKeysSession);\n }\n });\n };\n /**\n *\n * @param {*} keySession\n */\n EMEController.prototype._onNewMediaKeySession = function (keySession) {\n var _this = this;\n logger_1.logger.log(\"New key-system session \" + keySession.sessionId);\n keySession.addEventListener('message', function (event) {\n _this._onKeySessionMessage(keySession, event.message);\n }, false);\n };\n EMEController.prototype._onKeySessionMessage = function (keySession, message) {\n logger_1.logger.log('Got EME message event, creating license request');\n this._requestLicense(message, function (data) {\n logger_1.logger.log('Received license data, updating key-session');\n keySession.update(data);\n });\n };\n EMEController.prototype._onMediaEncrypted = function (initDataType, initData) {\n logger_1.logger.log(\"Media is encrypted using \\\"\" + initDataType + \"\\\" init data type\");\n this._isMediaEncrypted = true;\n this._mediaEncryptionInitDataType = initDataType;\n this._mediaEncryptionInitData = initData;\n this._attemptSetMediaKeys();\n this._generateRequestWithPreferredKeySession();\n };\n EMEController.prototype._attemptSetMediaKeys = function () {\n if (!this._hasSetMediaKeys) {\n // FIXME: see if we can/want/need-to really to deal with several potential key-sessions?\n var keysListItem = this._mediaKeysList[0];\n if (!keysListItem || !keysListItem.mediaKeys) {\n logger_1.logger.error('Fatal: Media is encrypted but no CDM access or no keys have been obtained yet');\n this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.KEY_SYSTEM_ERROR,\n details: errors_1.ErrorDetails.KEY_SYSTEM_NO_KEYS,\n fatal: true\n });\n return;\n }\n logger_1.logger.log('Setting keys for encrypted media');\n this._media.setMediaKeys(keysListItem.mediaKeys);\n this._hasSetMediaKeys = true;\n }\n };\n EMEController.prototype._generateRequestWithPreferredKeySession = function () {\n var _this = this;\n // FIXME: see if we can/want/need-to really to deal with several potential key-sessions?\n var keysListItem = this._mediaKeysList[0];\n if (!keysListItem) {\n logger_1.logger.error('Fatal: Media is encrypted but not any key-system access has been obtained yet');\n this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.KEY_SYSTEM_ERROR,\n details: errors_1.ErrorDetails.KEY_SYSTEM_NO_ACCESS,\n fatal: true\n });\n return;\n }\n if (keysListItem.mediaKeysSessionInitialized) {\n logger_1.logger.warn('Key-Session already initialized but requested again');\n return;\n }\n var keySession = keysListItem.mediaKeysSession;\n if (!keySession) {\n logger_1.logger.error('Fatal: Media is encrypted but no key-session existing');\n this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.KEY_SYSTEM_ERROR,\n details: errors_1.ErrorDetails.KEY_SYSTEM_NO_SESSION,\n fatal: true\n });\n }\n var initDataType = this._mediaEncryptionInitDataType;\n var initData = this._mediaEncryptionInitData;\n logger_1.logger.log(\"Generating key-session request for \\\"\" + initDataType + \"\\\" init data type\");\n keysListItem.mediaKeysSessionInitialized = true;\n keySession.generateRequest(initDataType, initData)\n .then(function () {\n logger_1.logger.debug('Key-session generation succeeded');\n })\n .catch(function (err) {\n logger_1.logger.error('Error generating key-session request:', err);\n _this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.KEY_SYSTEM_ERROR,\n details: errors_1.ErrorDetails.KEY_SYSTEM_NO_SESSION,\n fatal: false\n });\n });\n };\n /**\n * @param {string} url License server URL\n * @param {ArrayBuffer} keyMessage Message data issued by key-system\n * @param {function} callback Called when XHR has succeeded\n * @returns {XMLHttpRequest} Unsent (but opened state) XHR object\n */\n EMEController.prototype._createLicenseXhr = function (url, keyMessage, callback) {\n var xhr = new XMLHttpRequest();\n var licenseXhrSetup = this._licenseXhrSetup;\n try {\n if (licenseXhrSetup) {\n try {\n licenseXhrSetup(xhr, url);\n }\n catch (e) {\n // let's try to open before running setup\n xhr.open('POST', url, true);\n licenseXhrSetup(xhr, url);\n }\n }\n // if licenseXhrSetup did not yet call open, let's do it now\n if (!xhr.readyState) {\n xhr.open('POST', url, true);\n }\n }\n catch (e) {\n // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS\n logger_1.logger.error('Error setting up key-system license XHR', e);\n this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.KEY_SYSTEM_ERROR,\n details: errors_1.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,\n fatal: true\n });\n return;\n }\n xhr.responseType = 'arraybuffer';\n xhr.onreadystatechange =\n this._onLicenseRequestReadyStageChange.bind(this, xhr, url, keyMessage, callback);\n return xhr;\n };\n /**\n * @param {XMLHttpRequest} xhr\n * @param {string} url License server URL\n * @param {ArrayBuffer} keyMessage Message data issued by key-system\n * @param {function} callback Called when XHR has succeeded\n *\n */\n EMEController.prototype._onLicenseRequestReadyStageChange = function (xhr, url, keyMessage, callback) {\n switch (xhr.readyState) {\n case 4:\n if (xhr.status === 200) {\n this._requestLicenseFailureCount = 0;\n logger_1.logger.log('License request succeeded');\n callback(xhr.response);\n }\n else {\n logger_1.logger.error(\"License Request XHR failed (\" + url + \"). Status: \" + xhr.status + \" (\" + xhr.statusText + \")\");\n this._requestLicenseFailureCount++;\n if (this._requestLicenseFailureCount <= MAX_LICENSE_REQUEST_FAILURES) {\n var attemptsLeft = MAX_LICENSE_REQUEST_FAILURES - this._requestLicenseFailureCount + 1;\n logger_1.logger.warn(\"Retrying license request, \" + attemptsLeft + \" attempts left\");\n this._requestLicense(keyMessage, callback);\n return;\n }\n this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.KEY_SYSTEM_ERROR,\n details: errors_1.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,\n fatal: true\n });\n }\n break;\n }\n };\n /**\n * @param {object} keysListItem\n * @param {ArrayBuffer} keyMessage\n * @returns {ArrayBuffer} Challenge data posted to license server\n */\n EMEController.prototype._generateLicenseRequestChallenge = function (keysListItem, keyMessage) {\n var challenge;\n if (keysListItem.mediaKeySystemDomain === KeySystems.PLAYREADY) {\n logger_1.logger.error('PlayReady is not supported (yet)');\n // from https://github.com/MicrosoftEdge/Demos/blob/master/eme/scripts/demo.js\n /*\n if (this.licenseType !== this.LICENSE_TYPE_WIDEVINE) {\n // For PlayReady CDMs, we need to dig the Challenge out of the XML.\n var keyMessageXml = new DOMParser().parseFromString(String.fromCharCode.apply(null, new Uint16Array(keyMessage)), 'application/xml');\n if (keyMessageXml.getElementsByTagName('Challenge')[0]) {\n challenge = atob(keyMessageXml.getElementsByTagName('Challenge')[0].childNodes[0].nodeValue);\n } else {\n throw 'Cannot find in key message';\n }\n var headerNames = keyMessageXml.getElementsByTagName('name');\n var headerValues = keyMessageXml.getElementsByTagName('value');\n if (headerNames.length !== headerValues.length) {\n throw 'Mismatched header / pair in key message';\n }\n for (var i = 0; i < headerNames.length; i++) {\n xhr.setRequestHeader(headerNames[i].childNodes[0].nodeValue, headerValues[i].childNodes[0].nodeValue);\n }\n }\n */\n }\n else if (keysListItem.mediaKeySystemDomain === KeySystems.WIDEVINE) {\n // For Widevine CDMs, the challenge is the keyMessage.\n challenge = keyMessage;\n }\n else {\n logger_1.logger.error('Unsupported key-system:', keysListItem.mediaKeySystemDomain);\n }\n return challenge;\n };\n EMEController.prototype._requestLicense = function (keyMessage, callback) {\n logger_1.logger.log('Requesting content license for key-system');\n var keysListItem = this._mediaKeysList[0];\n if (!keysListItem) {\n logger_1.logger.error('Fatal error: Media is encrypted but no key-system access has been obtained yet');\n this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.KEY_SYSTEM_ERROR,\n details: errors_1.ErrorDetails.KEY_SYSTEM_NO_ACCESS,\n fatal: true\n });\n return;\n }\n var url = this.getLicenseServerUrl(keysListItem.mediaKeySystemDomain);\n var xhr = this._createLicenseXhr(url, keyMessage, callback);\n logger_1.logger.log(\"Sending license request to URL: \" + url);\n xhr.send(this._generateLicenseRequestChallenge(keysListItem, keyMessage));\n };\n EMEController.prototype.onMediaAttached = function (data) {\n var _this = this;\n if (!this._emeEnabled) {\n return;\n }\n var media = data.media;\n // keep reference of media\n this._media = media;\n // FIXME: also handle detaching media !\n media.addEventListener('encrypted', function (e) {\n _this._onMediaEncrypted(e.initDataType, e.initData);\n });\n };\n EMEController.prototype.onManifestParsed = function (data) {\n if (!this._emeEnabled) {\n return;\n }\n var audioCodecs = data.levels.map(function (level) { return level.audioCodec; });\n var videoCodecs = data.levels.map(function (level) { return level.videoCodec; });\n this._attemptKeySystemAccess(KeySystems.WIDEVINE, audioCodecs, videoCodecs);\n };\n return EMEController;\n}(event_handler_1.default));\nexports.default = EMEController;\n\n\n/***/ }),\n\n/***/ \"./src/controller/fps-controller.js\":\n/*!******************************************!*\\\n !*** ./src/controller/fps-controller.js ***!\n \\******************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/*\n * FPS Controller\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar performance = window.performance;\nvar FPSController = /** @class */ (function (_super) {\n __extends(FPSController, _super);\n function FPSController(hls) {\n return _super.call(this, hls, events_1.default.MEDIA_ATTACHING) || this;\n }\n FPSController.prototype.destroy = function () {\n if (this.timer) {\n clearInterval(this.timer);\n }\n this.isVideoPlaybackQualityAvailable = false;\n };\n FPSController.prototype.onMediaAttaching = function (data) {\n var config = this.hls.config;\n if (config.capLevelOnFPSDrop) {\n var video_1 = this.video = data.media instanceof window.HTMLVideoElement ? data.media : null;\n if (typeof video_1.getVideoPlaybackQuality === 'function') {\n this.isVideoPlaybackQualityAvailable = true;\n }\n clearInterval(this.timer);\n this.timer = setInterval(this.checkFPSInterval.bind(this), config.fpsDroppedMonitoringPeriod);\n }\n };\n FPSController.prototype.checkFPS = function (video, decodedFrames, droppedFrames) {\n var currentTime = performance.now();\n if (decodedFrames) {\n if (this.lastTime) {\n var currentPeriod = currentTime - this.lastTime, currentDropped = droppedFrames - this.lastDroppedFrames, currentDecoded = decodedFrames - this.lastDecodedFrames, droppedFPS = 1000 * currentDropped / currentPeriod, hls_1 = this.hls;\n hls_1.trigger(events_1.default.FPS_DROP, { currentDropped: currentDropped, currentDecoded: currentDecoded, totalDroppedFrames: droppedFrames });\n if (droppedFPS > 0) {\n // logger.log('checkFPS : droppedFPS/decodedFPS:' + droppedFPS/(1000 * currentDecoded / currentPeriod));\n if (currentDropped > hls_1.config.fpsDroppedMonitoringThreshold * currentDecoded) {\n var currentLevel = hls_1.currentLevel;\n logger_1.logger.warn('drop FPS ratio greater than max allowed value for currentLevel: ' + currentLevel);\n if (currentLevel > 0 && (hls_1.autoLevelCapping === -1 || hls_1.autoLevelCapping >= currentLevel)) {\n currentLevel = currentLevel - 1;\n hls_1.trigger(events_1.default.FPS_DROP_LEVEL_CAPPING, { level: currentLevel, droppedLevel: hls_1.currentLevel });\n hls_1.autoLevelCapping = currentLevel;\n hls_1.streamController.nextLevelSwitch();\n }\n }\n }\n }\n this.lastTime = currentTime;\n this.lastDroppedFrames = droppedFrames;\n this.lastDecodedFrames = decodedFrames;\n }\n };\n FPSController.prototype.checkFPSInterval = function () {\n var video = this.video;\n if (video) {\n if (this.isVideoPlaybackQualityAvailable) {\n var videoPlaybackQuality = video.getVideoPlaybackQuality();\n this.checkFPS(video, videoPlaybackQuality.totalVideoFrames, videoPlaybackQuality.droppedVideoFrames);\n }\n else {\n this.checkFPS(video, video.webkitDecodedFrameCount, video.webkitDroppedFrameCount);\n }\n }\n };\n return FPSController;\n}(event_handler_1.default));\nexports.default = FPSController;\n\n\n/***/ }),\n\n/***/ \"./src/controller/fragment-finders.js\":\n/*!********************************************!*\\\n !*** ./src/controller/fragment-finders.js ***!\n \\********************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar binary_search_1 = __webpack_require__(/*! ../utils/binary-search */ \"./src/utils/binary-search.js\");\n/**\n * Returns first fragment whose endPdt value exceeds the given PDT.\n * @param {Array} fragments - The array of candidate fragments\n * @param {number|null} [PDTValue = null] - The PDT value which must be exceeded\n * @param {number} [maxFragLookUpTolerance = 0] - The amount of time that a fragment's start/end can be within in order to be considered contiguous\n * @returns {*|null} fragment - The best matching fragment\n */\nfunction findFragmentByPDT(fragments, PDTValue, maxFragLookUpTolerance) {\n if (!Array.isArray(fragments) || !fragments.length || !Number.isFinite(PDTValue)) {\n return null;\n }\n // if less than start\n if (PDTValue < fragments[0].programDateTime) {\n return null;\n }\n if (PDTValue >= fragments[fragments.length - 1].endProgramDateTime) {\n return null;\n }\n maxFragLookUpTolerance = maxFragLookUpTolerance || 0;\n for (var seg = 0; seg < fragments.length; ++seg) {\n var frag = fragments[seg];\n if (pdtWithinToleranceTest(PDTValue, maxFragLookUpTolerance, frag)) {\n return frag;\n }\n }\n return null;\n}\nexports.findFragmentByPDT = findFragmentByPDT;\n/**\n * Finds a fragment based on the SN of the previous fragment; or based on the needs of the current buffer.\n * This method compensates for small buffer gaps by applying a tolerance to the start of any candidate fragment, thus\n * breaking any traps which would cause the same fragment to be continuously selected within a small range.\n * @param {*} fragPrevious - The last frag successfully appended\n * @param {Array} fragments - The array of candidate fragments\n * @param {number} [bufferEnd = 0] - The end of the contiguous buffered range the playhead is currently within\n * @param {number} maxFragLookUpTolerance - The amount of time that a fragment's start/end can be within in order to be considered contiguous\n * @returns {*} foundFrag - The best matching fragment\n */\nfunction findFragmentByPTS(fragPrevious, fragments, bufferEnd, maxFragLookUpTolerance) {\n if (bufferEnd === void 0) { bufferEnd = 0; }\n if (maxFragLookUpTolerance === void 0) { maxFragLookUpTolerance = 0; }\n var fragNext = fragPrevious ? fragments[fragPrevious.sn - fragments[0].sn + 1] : null;\n // Prefer the next fragment if it's within tolerance\n if (fragNext && !fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, fragNext)) {\n return fragNext;\n }\n return binary_search_1.default.search(fragments, fragmentWithinToleranceTest.bind(null, bufferEnd, maxFragLookUpTolerance));\n}\nexports.findFragmentByPTS = findFragmentByPTS;\n/**\n * The test function used by the findFragmentBySn's BinarySearch to look for the best match to the current buffer conditions.\n * @param {*} candidate - The fragment to test\n * @param {number} [bufferEnd = 0] - The end of the current buffered range the playhead is currently within\n * @param {number} [maxFragLookUpTolerance = 0] - The amount of time that a fragment's start can be within in order to be considered contiguous\n * @returns {number} - 0 if it matches, 1 if too low, -1 if too high\n */\nfunction fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, candidate) {\n if (bufferEnd === void 0) { bufferEnd = 0; }\n if (maxFragLookUpTolerance === void 0) { maxFragLookUpTolerance = 0; }\n // offset should be within fragment boundary - config.maxFragLookUpTolerance\n // this is to cope with situations like\n // bufferEnd = 9.991\n // frag[Ø] : [0,10]\n // frag[1] : [10,20]\n // bufferEnd is within frag[0] range ... although what we are expecting is to return frag[1] here\n // frag start frag start+duration\n // |-----------------------------|\n // <---> <--->\n // ...--------><-----------------------------><---------....\n // previous frag matching fragment next frag\n // return -1 return 0 return 1\n // logger.log(`level/sn/start/end/bufEnd:${level}/${candidate.sn}/${candidate.start}/${(candidate.start+candidate.duration)}/${bufferEnd}`);\n // Set the lookup tolerance to be small enough to detect the current segment - ensures we don't skip over very small segments\n var candidateLookupTolerance = Math.min(maxFragLookUpTolerance, candidate.duration + (candidate.deltaPTS ? candidate.deltaPTS : 0));\n if (candidate.start + candidate.duration - candidateLookupTolerance <= bufferEnd) {\n return 1;\n }\n else if (candidate.start - candidateLookupTolerance > bufferEnd && candidate.start) {\n // if maxFragLookUpTolerance will have negative value then don't return -1 for first element\n return -1;\n }\n return 0;\n}\nexports.fragmentWithinToleranceTest = fragmentWithinToleranceTest;\n/**\n * The test function used by the findFragmentByPdt's BinarySearch to look for the best match to the current buffer conditions.\n * This function tests the candidate's program date time values, as represented in Unix time\n * @param {*} candidate - The fragment to test\n * @param {number} [pdtBufferEnd = 0] - The Unix time representing the end of the current buffered range\n * @param {number} [maxFragLookUpTolerance = 0] - The amount of time that a fragment's start can be within in order to be considered contiguous\n * @returns {boolean} True if contiguous, false otherwise\n */\nfunction pdtWithinToleranceTest(pdtBufferEnd, maxFragLookUpTolerance, candidate) {\n var candidateLookupTolerance = Math.min(maxFragLookUpTolerance, candidate.duration + (candidate.deltaPTS ? candidate.deltaPTS : 0)) * 1000;\n return candidate.endProgramDateTime - candidateLookupTolerance > pdtBufferEnd;\n}\nexports.pdtWithinToleranceTest = pdtWithinToleranceTest;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/controller/fragment-tracker.js\":\n/*!********************************************!*\\\n !*** ./src/controller/fragment-tracker.js ***!\n \\********************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nexports.FragmentState = {\n NOT_LOADED: 'NOT_LOADED',\n APPENDING: 'APPENDING',\n PARTIAL: 'PARTIAL',\n OK: 'OK'\n};\nvar FragmentTracker = /** @class */ (function (_super) {\n __extends(FragmentTracker, _super);\n function FragmentTracker(hls) {\n var _this = _super.call(this, hls, events_1.default.BUFFER_APPENDED, events_1.default.FRAG_BUFFERED, events_1.default.FRAG_LOADED) || this;\n _this.bufferPadding = 0.2;\n _this.fragments = Object.create(null);\n _this.timeRanges = Object.create(null);\n _this.config = hls.config;\n return _this;\n }\n FragmentTracker.prototype.destroy = function () {\n this.fragments = null;\n this.timeRanges = null;\n this.config = null;\n event_handler_1.default.prototype.destroy.call(this);\n _super.prototype.destroy.call(this);\n };\n /**\n * Return a Fragment that match the position and levelType.\n * If not found any Fragment, return null\n * @param {number} position\n * @param {LevelType} levelType\n * @returns {Fragment|null}\n */\n FragmentTracker.prototype.getBufferedFrag = function (position, levelType) {\n var fragments = this.fragments;\n var bufferedFrags = Object.keys(fragments).filter(function (key) {\n var fragmentEntity = fragments[key];\n if (fragmentEntity.body.type !== levelType) {\n return false;\n }\n if (!fragmentEntity.buffered) {\n return false;\n }\n var frag = fragmentEntity.body;\n return frag.startPTS <= position && position <= frag.endPTS;\n });\n if (bufferedFrags.length === 0) {\n return null;\n }\n else {\n // https://github.com/video-dev/hls.js/pull/1545#discussion_r166229566\n var bufferedFragKey = bufferedFrags.pop();\n return fragments[bufferedFragKey].body;\n }\n };\n /**\n * Partial fragments effected by coded frame eviction will be removed\n * The browser will unload parts of the buffer to free up memory for new buffer data\n * Fragments will need to be reloaded when the buffer is freed up, removing partial fragments will allow them to reload(since there might be parts that are still playable)\n * @param {String} elementaryStream The elementaryStream of media this is (eg. video/audio)\n * @param {TimeRanges} timeRange TimeRange object from a sourceBuffer\n */\n FragmentTracker.prototype.detectEvictedFragments = function (elementaryStream, timeRange) {\n var _this = this;\n var fragmentTimes, time;\n // Check if any flagged fragments have been unloaded\n Object.keys(this.fragments).forEach(function (key) {\n var fragmentEntity = _this.fragments[key];\n if (fragmentEntity.buffered === true) {\n var esData = fragmentEntity.range[elementaryStream];\n if (esData) {\n fragmentTimes = esData.time;\n for (var i = 0; i < fragmentTimes.length; i++) {\n time = fragmentTimes[i];\n if (_this.isTimeBuffered(time.startPTS, time.endPTS, timeRange) === false) {\n // Unregister partial fragment as it needs to load again to be reused\n _this.removeFragment(fragmentEntity.body);\n break;\n }\n }\n }\n }\n });\n };\n /**\n * Checks if the fragment passed in is loaded in the buffer properly\n * Partially loaded fragments will be registered as a partial fragment\n * @param {Object} fragment Check the fragment against all sourceBuffers loaded\n */\n FragmentTracker.prototype.detectPartialFragments = function (fragment) {\n var _this = this;\n var fragKey = this.getFragmentKey(fragment);\n var fragmentEntity = this.fragments[fragKey];\n if (fragmentEntity) {\n fragmentEntity.buffered = true;\n Object.keys(this.timeRanges).forEach(function (elementaryStream) {\n if (fragment.hasElementaryStream(elementaryStream)) {\n var timeRange = _this.timeRanges[elementaryStream];\n // Check for malformed fragments\n // Gaps need to be calculated for each elementaryStream\n fragmentEntity.range[elementaryStream] = _this.getBufferedTimes(fragment.startPTS, fragment.endPTS, timeRange);\n }\n });\n }\n };\n FragmentTracker.prototype.getBufferedTimes = function (startPTS, endPTS, timeRange) {\n var fragmentTimes = [];\n var startTime, endTime;\n var fragmentPartial = false;\n for (var i = 0; i < timeRange.length; i++) {\n startTime = timeRange.start(i) - this.bufferPadding;\n endTime = timeRange.end(i) + this.bufferPadding;\n if (startPTS >= startTime && endPTS <= endTime) {\n // Fragment is entirely contained in buffer\n // No need to check the other timeRange times since it's completely playable\n fragmentTimes.push({\n startPTS: Math.max(startPTS, timeRange.start(i)),\n endPTS: Math.min(endPTS, timeRange.end(i))\n });\n break;\n }\n else if (startPTS < endTime && endPTS > startTime) {\n // Check for intersection with buffer\n // Get playable sections of the fragment\n fragmentTimes.push({\n startPTS: Math.max(startPTS, timeRange.start(i)),\n endPTS: Math.min(endPTS, timeRange.end(i))\n });\n fragmentPartial = true;\n }\n else if (endPTS <= startTime) {\n // No need to check the rest of the timeRange as it is in order\n break;\n }\n }\n return {\n time: fragmentTimes,\n partial: fragmentPartial\n };\n };\n FragmentTracker.prototype.getFragmentKey = function (fragment) {\n return fragment.type + \"_\" + fragment.level + \"_\" + fragment.urlId + \"_\" + fragment.sn;\n };\n /**\n * Gets the partial fragment for a certain time\n * @param {Number} time\n * @returns {Object} fragment Returns a partial fragment at a time or null if there is no partial fragment\n */\n FragmentTracker.prototype.getPartialFragment = function (time) {\n var _this = this;\n var timePadding, startTime, endTime;\n var bestFragment = null;\n var bestOverlap = 0;\n Object.keys(this.fragments).forEach(function (key) {\n var fragmentEntity = _this.fragments[key];\n if (_this.isPartial(fragmentEntity)) {\n startTime = fragmentEntity.body.startPTS - _this.bufferPadding;\n endTime = fragmentEntity.body.endPTS + _this.bufferPadding;\n if (time >= startTime && time <= endTime) {\n // Use the fragment that has the most padding from start and end time\n timePadding = Math.min(time - startTime, endTime - time);\n if (bestOverlap <= timePadding) {\n bestFragment = fragmentEntity.body;\n bestOverlap = timePadding;\n }\n }\n }\n });\n return bestFragment;\n };\n /**\n * @param {Object} fragment The fragment to check\n * @returns {String} Returns the fragment state when a fragment never loaded or if it partially loaded\n */\n FragmentTracker.prototype.getState = function (fragment) {\n var fragKey = this.getFragmentKey(fragment);\n var fragmentEntity = this.fragments[fragKey];\n var state = exports.FragmentState.NOT_LOADED;\n if (fragmentEntity !== undefined) {\n if (!fragmentEntity.buffered) {\n state = exports.FragmentState.APPENDING;\n }\n else if (this.isPartial(fragmentEntity) === true) {\n state = exports.FragmentState.PARTIAL;\n }\n else {\n state = exports.FragmentState.OK;\n }\n }\n return state;\n };\n FragmentTracker.prototype.isPartial = function (fragmentEntity) {\n return fragmentEntity.buffered === true &&\n ((fragmentEntity.range.video !== undefined && fragmentEntity.range.video.partial === true) ||\n (fragmentEntity.range.audio !== undefined && fragmentEntity.range.audio.partial === true));\n };\n FragmentTracker.prototype.isTimeBuffered = function (startPTS, endPTS, timeRange) {\n var startTime, endTime;\n for (var i = 0; i < timeRange.length; i++) {\n startTime = timeRange.start(i) - this.bufferPadding;\n endTime = timeRange.end(i) + this.bufferPadding;\n if (startPTS >= startTime && endPTS <= endTime) {\n return true;\n }\n if (endPTS <= startTime) {\n // No need to check the rest of the timeRange as it is in order\n return false;\n }\n }\n return false;\n };\n /**\n * Fires when a fragment loading is completed\n */\n FragmentTracker.prototype.onFragLoaded = function (e) {\n var fragment = e.frag;\n // don't track initsegment (for which sn is not a number)\n // don't track frags used for bitrateTest, they're irrelevant.\n if (Number.isFinite(fragment.sn) && !fragment.bitrateTest) {\n this.fragments[this.getFragmentKey(fragment)] = {\n body: fragment,\n range: Object.create(null),\n buffered: false\n };\n }\n };\n /**\n * Fires when the buffer is updated\n */\n FragmentTracker.prototype.onBufferAppended = function (e) {\n var _this = this;\n // Store the latest timeRanges loaded in the buffer\n this.timeRanges = e.timeRanges;\n Object.keys(this.timeRanges).forEach(function (elementaryStream) {\n var timeRange = _this.timeRanges[elementaryStream];\n _this.detectEvictedFragments(elementaryStream, timeRange);\n });\n };\n /**\n * Fires after a fragment has been loaded into the source buffer\n */\n FragmentTracker.prototype.onFragBuffered = function (e) {\n this.detectPartialFragments(e.frag);\n };\n /**\n * Return true if fragment tracker has the fragment.\n * @param {Object} fragment\n * @returns {boolean}\n */\n FragmentTracker.prototype.hasFragment = function (fragment) {\n var fragKey = this.getFragmentKey(fragment);\n return this.fragments[fragKey] !== undefined;\n };\n /**\n * Remove a fragment from fragment tracker until it is loaded again\n * @param {Object} fragment The fragment to remove\n */\n FragmentTracker.prototype.removeFragment = function (fragment) {\n var fragKey = this.getFragmentKey(fragment);\n delete this.fragments[fragKey];\n };\n /**\n * Remove all fragments from fragment tracker.\n */\n FragmentTracker.prototype.removeAllFragments = function () {\n this.fragments = Object.create(null);\n };\n return FragmentTracker;\n}(event_handler_1.default));\nexports.FragmentTracker = FragmentTracker;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/controller/gap-controller.js\":\n/*!******************************************!*\\\n !*** ./src/controller/gap-controller.js ***!\n \\******************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar buffer_helper_1 = __webpack_require__(/*! ../utils/buffer-helper */ \"./src/utils/buffer-helper.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar stallDebounceInterval = 1000;\nvar jumpThreshold = 0.5; // tolerance needed as some browsers stalls playback before reaching buffered range end\nvar GapController = /** @class */ (function () {\n function GapController(config, media, fragmentTracker, hls) {\n this.config = config;\n this.media = media;\n this.fragmentTracker = fragmentTracker;\n this.hls = hls;\n this.stallReported = false;\n }\n /**\n * Checks if the playhead is stuck within a gap, and if so, attempts to free it.\n * A gap is an unbuffered range between two buffered ranges (or the start and the first buffered range).\n * @param lastCurrentTime\n * @param buffered\n */\n GapController.prototype.poll = function (lastCurrentTime, buffered) {\n var _a = this, config = _a.config, media = _a.media;\n var currentTime = media.currentTime;\n var tnow = window.performance.now();\n if (currentTime !== lastCurrentTime) {\n // The playhead is now moving, but was previously stalled\n if (this.stallReported) {\n logger_1.logger.warn(\"playback not stuck anymore @\" + currentTime + \", after \" + Math.round(tnow - this.stalled) + \"ms\");\n this.stallReported = false;\n }\n this.stalled = null;\n this.nudgeRetry = 0;\n return;\n }\n if (media.ended || !media.buffered.length || media.readyState > 2) {\n return;\n }\n if (media.seeking && buffer_helper_1.BufferHelper.isBuffered(media, currentTime)) {\n return;\n }\n // The playhead isn't moving but it should be\n // Allow some slack time to for small stalls to resolve themselves\n var stalledDuration = tnow - this.stalled;\n var bufferInfo = buffer_helper_1.BufferHelper.bufferInfo(media, currentTime, config.maxBufferHole);\n if (!this.stalled) {\n this.stalled = tnow;\n return;\n }\n else if (stalledDuration >= stallDebounceInterval) {\n // Report stalling after trying to fix\n this._reportStall(bufferInfo.len);\n }\n this._tryFixBufferStall(bufferInfo, stalledDuration);\n };\n /**\n * Detects and attempts to fix known buffer stalling issues.\n * @param bufferInfo - The properties of the current buffer.\n * @param stalledDuration - The amount of time Hls.js has been stalling for.\n * @private\n */\n GapController.prototype._tryFixBufferStall = function (bufferInfo, stalledDuration) {\n var _a = this, config = _a.config, fragmentTracker = _a.fragmentTracker, media = _a.media;\n var currentTime = media.currentTime;\n var partial = fragmentTracker.getPartialFragment(currentTime);\n if (partial) {\n // Try to skip over the buffer hole caused by a partial fragment\n // This method isn't limited by the size of the gap between buffered ranges\n this._trySkipBufferHole(partial);\n }\n if (bufferInfo.len > jumpThreshold && stalledDuration > config.highBufferWatchdogPeriod * 1000) {\n // Try to nudge currentTime over a buffer hole if we've been stalling for the configured amount of seconds\n // We only try to jump the hole if it's under the configured size\n // Reset stalled so to rearm watchdog timer\n this.stalled = null;\n this._tryNudgeBuffer();\n }\n };\n /**\n * Triggers a BUFFER_STALLED_ERROR event, but only once per stall period.\n * @param bufferLen - The playhead distance from the end of the current buffer segment.\n * @private\n */\n GapController.prototype._reportStall = function (bufferLen) {\n var _a = this, hls = _a.hls, media = _a.media, stallReported = _a.stallReported;\n if (!stallReported) {\n // Report stalled error once\n this.stallReported = true;\n logger_1.logger.warn(\"Playback stalling at @\" + media.currentTime + \" due to low buffer\");\n hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.MEDIA_ERROR,\n details: errors_1.ErrorDetails.BUFFER_STALLED_ERROR,\n fatal: false,\n buffer: bufferLen\n });\n }\n };\n /**\n * Attempts to fix buffer stalls by jumping over known gaps caused by partial fragments\n * @param partial - The partial fragment found at the current time (where playback is stalling).\n * @private\n */\n GapController.prototype._trySkipBufferHole = function (partial) {\n var _a = this, hls = _a.hls, media = _a.media;\n var currentTime = media.currentTime;\n var lastEndTime = 0;\n // Check if currentTime is between unbuffered regions of partial fragments\n for (var i = 0; i < media.buffered.length; i++) {\n var startTime = media.buffered.start(i);\n if (currentTime >= lastEndTime && currentTime < startTime) {\n media.currentTime = Math.max(startTime, media.currentTime + 0.1);\n logger_1.logger.warn(\"skipping hole, adjusting currentTime from \" + currentTime + \" to \" + media.currentTime);\n this.stalled = null;\n hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.MEDIA_ERROR,\n details: errors_1.ErrorDetails.BUFFER_SEEK_OVER_HOLE,\n fatal: false,\n reason: \"fragment loaded with buffer holes, seeking from \" + currentTime + \" to \" + media.currentTime,\n frag: partial\n });\n return;\n }\n lastEndTime = media.buffered.end(i);\n }\n };\n /**\n * Attempts to fix buffer stalls by advancing the mediaElement's current time by a small amount.\n * @private\n */\n GapController.prototype._tryNudgeBuffer = function () {\n var _a = this, config = _a.config, hls = _a.hls, media = _a.media;\n var currentTime = media.currentTime;\n var nudgeRetry = (this.nudgeRetry || 0) + 1;\n this.nudgeRetry = nudgeRetry;\n if (nudgeRetry < config.nudgeMaxRetry) {\n var targetTime = currentTime + nudgeRetry * config.nudgeOffset;\n logger_1.logger.log(\"adjust currentTime from \" + currentTime + \" to \" + targetTime);\n // playback stalled in buffered area ... let's nudge currentTime to try to overcome this\n media.currentTime = targetTime;\n hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.MEDIA_ERROR,\n details: errors_1.ErrorDetails.BUFFER_NUDGE_ON_STALL,\n fatal: false\n });\n }\n else {\n logger_1.logger.error(\"still stuck in high buffer @\" + currentTime + \" after \" + config.nudgeMaxRetry + \", raise fatal error\");\n hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.MEDIA_ERROR,\n details: errors_1.ErrorDetails.BUFFER_STALLED_ERROR,\n fatal: true\n });\n }\n };\n return GapController;\n}());\nexports.default = GapController;\n\n\n/***/ }),\n\n/***/ \"./src/controller/id3-track-controller.js\":\n/*!************************************************!*\\\n !*** ./src/controller/id3-track-controller.js ***!\n \\************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/*\n * id3 metadata track controller\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar id3_1 = __webpack_require__(/*! ../demux/id3 */ \"./src/demux/id3.js\");\nvar texttrack_utils_1 = __webpack_require__(/*! ../utils/texttrack-utils */ \"./src/utils/texttrack-utils.js\");\nvar ID3TrackController = /** @class */ (function (_super) {\n __extends(ID3TrackController, _super);\n function ID3TrackController(hls) {\n var _this = _super.call(this, hls, events_1.default.MEDIA_ATTACHED, events_1.default.MEDIA_DETACHING, events_1.default.FRAG_PARSING_METADATA) || this;\n _this.id3Track = undefined;\n _this.media = undefined;\n return _this;\n }\n ID3TrackController.prototype.destroy = function () {\n event_handler_1.default.prototype.destroy.call(this);\n };\n // Add ID3 metatadata text track.\n ID3TrackController.prototype.onMediaAttached = function (data) {\n this.media = data.media;\n if (!this.media) {\n }\n };\n ID3TrackController.prototype.onMediaDetaching = function () {\n texttrack_utils_1.clearCurrentCues(this.id3Track);\n this.id3Track = undefined;\n this.media = undefined;\n };\n ID3TrackController.prototype.getID3Track = function (textTracks) {\n for (var i = 0; i < textTracks.length; i++) {\n var textTrack = textTracks[i];\n if (textTrack.kind === 'metadata' && textTrack.label === 'id3') {\n // send 'addtrack' when reusing the textTrack for metadata,\n // same as what we do for captions\n texttrack_utils_1.sendAddTrackEvent(textTrack, this.media);\n return textTrack;\n }\n }\n return this.media.addTextTrack('metadata', 'id3');\n };\n ID3TrackController.prototype.onFragParsingMetadata = function (data) {\n var fragment = data.frag;\n var samples = data.samples;\n // create track dynamically\n if (!this.id3Track) {\n this.id3Track = this.getID3Track(this.media.textTracks);\n this.id3Track.mode = 'hidden';\n }\n // Attempt to recreate Safari functionality by creating\n // WebKitDataCue objects when available and store the decoded\n // ID3 data in the value property of the cue\n var Cue = window.WebKitDataCue || window.VTTCue || window.TextTrackCue;\n for (var i = 0; i < samples.length; i++) {\n var frames_1 = id3_1.default.getID3Frames(samples[i].data);\n if (frames_1) {\n var startTime = samples[i].pts;\n var endTime = i < samples.length - 1 ? samples[i + 1].pts : fragment.endPTS;\n // Give a slight bump to the endTime if it's equal to startTime to avoid a SyntaxError in IE\n if (startTime === endTime) {\n endTime += 0.0001;\n }\n for (var j = 0; j < frames_1.length; j++) {\n var frame = frames_1[j];\n // Safari doesn't put the timestamp frame in the TextTrack\n if (!id3_1.default.isTimeStampFrame(frame)) {\n var cue = new Cue(startTime, endTime, '');\n cue.value = frame;\n this.id3Track.addCue(cue);\n }\n }\n }\n }\n };\n return ID3TrackController;\n}(event_handler_1.default));\nexports.default = ID3TrackController;\n\n\n/***/ }),\n\n/***/ \"./src/controller/level-controller.js\":\n/*!********************************************!*\\\n !*** ./src/controller/level-controller.js ***!\n \\********************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/*\n * Level Controller\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar codecs_1 = __webpack_require__(/*! ../utils/codecs */ \"./src/utils/codecs.js\");\nvar level_helper_1 = __webpack_require__(/*! ./level-helper */ \"./src/controller/level-helper.js\");\nvar performance = window.performance;\nvar chromeOrFirefox;\nvar LevelController = /** @class */ (function (_super) {\n __extends(LevelController, _super);\n function LevelController(hls) {\n var _this = _super.call(this, hls, events_1.default.MANIFEST_LOADED, events_1.default.LEVEL_LOADED, events_1.default.AUDIO_TRACK_SWITCHED, events_1.default.FRAG_LOADED, events_1.default.ERROR) || this;\n _this.canload = false;\n _this.currentLevelIndex = null;\n _this.manualLevelIndex = -1;\n _this.timer = null;\n chromeOrFirefox = /chrome|firefox/.test(navigator.userAgent.toLowerCase());\n return _this;\n }\n LevelController.prototype.onHandlerDestroying = function () {\n this.clearTimer();\n this.manualLevelIndex = -1;\n };\n LevelController.prototype.clearTimer = function () {\n if (this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n };\n LevelController.prototype.startLoad = function () {\n var levels = this._levels;\n this.canload = true;\n this.levelRetryCount = 0;\n // clean up live level details to force reload them, and reset load errors\n if (levels) {\n levels.forEach(function (level) {\n level.loadError = 0;\n var levelDetails = level.details;\n if (levelDetails && levelDetails.live) {\n level.details = undefined;\n }\n });\n }\n // speed up live playlist refresh if timer exists\n if (this.timer !== null) {\n this.loadLevel();\n }\n };\n LevelController.prototype.stopLoad = function () {\n this.canload = false;\n };\n LevelController.prototype.onManifestLoaded = function (data) {\n var levels = [];\n var audioTracks = [];\n var bitrateStart;\n var levelSet = {};\n var levelFromSet = null;\n var videoCodecFound = false;\n var audioCodecFound = false;\n // regroup redundant levels together\n data.levels.forEach(function (level) {\n var attributes = level.attrs;\n level.loadError = 0;\n level.fragmentError = false;\n videoCodecFound = videoCodecFound || !!level.videoCodec;\n audioCodecFound = audioCodecFound || !!level.audioCodec;\n // erase audio codec info if browser does not support mp4a.40.34.\n // demuxer will autodetect codec and fallback to mpeg/audio\n if (chromeOrFirefox && level.audioCodec && level.audioCodec.indexOf('mp4a.40.34') !== -1) {\n level.audioCodec = undefined;\n }\n levelFromSet = levelSet[level.bitrate]; // FIXME: we would also have to match the resolution here\n if (!levelFromSet) {\n level.url = [level.url];\n level.urlId = 0;\n levelSet[level.bitrate] = level;\n levels.push(level);\n }\n else {\n levelFromSet.url.push(level.url);\n }\n if (attributes) {\n if (attributes.AUDIO) {\n audioCodecFound = true;\n level_helper_1.addGroupId(levelFromSet || level, 'audio', attributes.AUDIO);\n }\n if (attributes.SUBTITLES) {\n level_helper_1.addGroupId(levelFromSet || level, 'text', attributes.SUBTITLES);\n }\n }\n });\n // remove audio-only level if we also have levels with audio+video codecs signalled\n if (videoCodecFound && audioCodecFound) {\n levels = levels.filter(function (_a) {\n var videoCodec = _a.videoCodec;\n return !!videoCodec;\n });\n }\n // only keep levels with supported audio/video codecs\n levels = levels.filter(function (_a) {\n var audioCodec = _a.audioCodec, videoCodec = _a.videoCodec;\n return (!audioCodec || codecs_1.isCodecSupportedInMp4(audioCodec, 'audio')) && (!videoCodec || codecs_1.isCodecSupportedInMp4(videoCodec, 'video'));\n });\n if (data.audioTracks) {\n audioTracks = data.audioTracks.filter(function (track) { return !track.audioCodec || codecs_1.isCodecSupportedInMp4(track.audioCodec, 'audio'); });\n // Reassign id's after filtering since they're used as array indices\n audioTracks.forEach(function (track, index) {\n track.id = index;\n });\n }\n if (levels.length > 0) {\n // start bitrate is the first bitrate of the manifest\n bitrateStart = levels[0].bitrate;\n // sort level on bitrate\n levels.sort(function (a, b) { return a.bitrate - b.bitrate; });\n this._levels = levels;\n // find index of first level in sorted levels\n for (var i = 0; i < levels.length; i++) {\n if (levels[i].bitrate === bitrateStart) {\n this._firstLevel = i;\n logger_1.logger.log(\"manifest loaded,\" + levels.length + \" level(s) found, first bitrate:\" + bitrateStart);\n break;\n }\n }\n // Audio is only alternate if manifest include a URI along with the audio group tag\n this.hls.trigger(events_1.default.MANIFEST_PARSED, {\n levels: levels,\n audioTracks: audioTracks,\n firstLevel: this._firstLevel,\n stats: data.stats,\n audio: audioCodecFound,\n video: videoCodecFound,\n altAudio: audioTracks.some(function (t) { return !!t.url; })\n });\n }\n else {\n this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.MEDIA_ERROR,\n details: errors_1.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,\n fatal: true,\n url: this.hls.url,\n reason: 'no level with compatible codecs found in manifest'\n });\n }\n };\n Object.defineProperty(LevelController.prototype, \"levels\", {\n get: function () {\n return this._levels;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LevelController.prototype, \"level\", {\n get: function () {\n return this.currentLevelIndex;\n },\n set: function (newLevel) {\n var levels = this._levels;\n if (levels) {\n newLevel = Math.min(newLevel, levels.length - 1);\n if (this.currentLevelIndex !== newLevel || !levels[newLevel].details) {\n this.setLevelInternal(newLevel);\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n LevelController.prototype.setLevelInternal = function (newLevel) {\n var levels = this._levels;\n var hls = this.hls;\n // check if level idx is valid\n if (newLevel >= 0 && newLevel < levels.length) {\n // stopping live reloading timer if any\n this.clearTimer();\n if (this.currentLevelIndex !== newLevel) {\n logger_1.logger.log(\"switching to level \" + newLevel);\n this.currentLevelIndex = newLevel;\n var levelProperties = levels[newLevel];\n levelProperties.level = newLevel;\n hls.trigger(events_1.default.LEVEL_SWITCHING, levelProperties);\n }\n var level = levels[newLevel];\n var levelDetails = level.details;\n // check if we need to load playlist for this level\n if (!levelDetails || levelDetails.live) {\n // level not retrieved yet, or live playlist we need to (re)load it\n var urlId = level.urlId;\n hls.trigger(events_1.default.LEVEL_LOADING, { url: level.url[urlId], level: newLevel, id: urlId });\n }\n }\n else {\n // invalid level id given, trigger error\n hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.OTHER_ERROR,\n details: errors_1.ErrorDetails.LEVEL_SWITCH_ERROR,\n level: newLevel,\n fatal: false,\n reason: 'invalid level idx'\n });\n }\n };\n Object.defineProperty(LevelController.prototype, \"manualLevel\", {\n get: function () {\n return this.manualLevelIndex;\n },\n set: function (newLevel) {\n this.manualLevelIndex = newLevel;\n if (this._startLevel === undefined) {\n this._startLevel = newLevel;\n }\n if (newLevel !== -1) {\n this.level = newLevel;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LevelController.prototype, \"firstLevel\", {\n get: function () {\n return this._firstLevel;\n },\n set: function (newLevel) {\n this._firstLevel = newLevel;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LevelController.prototype, \"startLevel\", {\n get: function () {\n // hls.startLevel takes precedence over config.startLevel\n // if none of these values are defined, fallback on this._firstLevel (first quality level appearing in variant manifest)\n if (this._startLevel === undefined) {\n var configStartLevel = this.hls.config.startLevel;\n if (configStartLevel !== undefined) {\n return configStartLevel;\n }\n else {\n return this._firstLevel;\n }\n }\n else {\n return this._startLevel;\n }\n },\n set: function (newLevel) {\n this._startLevel = newLevel;\n },\n enumerable: true,\n configurable: true\n });\n LevelController.prototype.onError = function (data) {\n if (data.fatal) {\n if (data.type === errors_1.ErrorTypes.NETWORK_ERROR) {\n this.clearTimer();\n }\n return;\n }\n var levelError = false, fragmentError = false;\n var levelIndex;\n // try to recover not fatal errors\n switch (data.details) {\n case errors_1.ErrorDetails.FRAG_LOAD_ERROR:\n case errors_1.ErrorDetails.FRAG_LOAD_TIMEOUT:\n case errors_1.ErrorDetails.KEY_LOAD_ERROR:\n case errors_1.ErrorDetails.KEY_LOAD_TIMEOUT:\n levelIndex = data.frag.level;\n fragmentError = true;\n break;\n case errors_1.ErrorDetails.LEVEL_LOAD_ERROR:\n case errors_1.ErrorDetails.LEVEL_LOAD_TIMEOUT:\n levelIndex = data.context.level;\n levelError = true;\n break;\n case errors_1.ErrorDetails.REMUX_ALLOC_ERROR:\n levelIndex = data.level;\n levelError = true;\n break;\n }\n if (levelIndex !== undefined) {\n this.recoverLevel(data, levelIndex, levelError, fragmentError);\n }\n };\n /**\n * Switch to a redundant stream if any available.\n * If redundant stream is not available, emergency switch down if ABR mode is enabled.\n *\n * @param {Object} errorEvent\n * @param {Number} levelIndex current level index\n * @param {Boolean} levelError\n * @param {Boolean} fragmentError\n */\n // FIXME Find a better abstraction where fragment/level retry management is well decoupled\n LevelController.prototype.recoverLevel = function (errorEvent, levelIndex, levelError, fragmentError) {\n var _this = this;\n var config = this.hls.config;\n var errorDetails = errorEvent.details;\n var level = this._levels[levelIndex];\n var redundantLevels, delay, nextLevel;\n level.loadError++;\n level.fragmentError = fragmentError;\n if (levelError) {\n if ((this.levelRetryCount + 1) <= config.levelLoadingMaxRetry) {\n // exponential backoff capped to max retry timeout\n delay = Math.min(Math.pow(2, this.levelRetryCount) * config.levelLoadingRetryDelay, config.levelLoadingMaxRetryTimeout);\n // Schedule level reload\n this.timer = setTimeout(function () { return _this.loadLevel(); }, delay);\n // boolean used to inform stream controller not to switch back to IDLE on non fatal error\n errorEvent.levelRetry = true;\n this.levelRetryCount++;\n logger_1.logger.warn(\"level controller, \" + errorDetails + \", retry in \" + delay + \" ms, current retry count is \" + this.levelRetryCount);\n }\n else {\n logger_1.logger.error(\"level controller, cannot recover from \" + errorDetails + \" error\");\n this.currentLevelIndex = null;\n // stopping live reloading timer if any\n this.clearTimer();\n // switch error to fatal\n errorEvent.fatal = true;\n return;\n }\n }\n // Try any redundant streams if available for both errors: level and fragment\n // If level.loadError reaches redundantLevels it means that we tried them all, no hope => let's switch down\n if (levelError || fragmentError) {\n redundantLevels = level.url.length;\n if (redundantLevels > 1 && level.loadError < redundantLevels) {\n level.urlId = (level.urlId + 1) % redundantLevels;\n level.details = undefined;\n logger_1.logger.warn(\"level controller, \" + errorDetails + \" for level \" + levelIndex + \": switching to redundant URL-id \" + level.urlId);\n // console.log('Current audio track group ID:', this.hls.audioTracks[this.hls.audioTrack].groupId);\n // console.log('New video quality level audio group id:', level.attrs.AUDIO);\n }\n else {\n // Search for available level\n if (this.manualLevelIndex === -1) {\n // When lowest level has been reached, let's start hunt from the top\n nextLevel = (levelIndex === 0) ? this._levels.length - 1 : levelIndex - 1;\n logger_1.logger.warn(\"level controller, \" + errorDetails + \": switch to \" + nextLevel);\n this.hls.nextAutoLevel = this.currentLevelIndex = nextLevel;\n }\n else if (fragmentError) {\n // Allow fragment retry as long as configuration allows.\n // reset this._level so that another call to set level() will trigger again a frag load\n logger_1.logger.warn(\"level controller, \" + errorDetails + \": reload a fragment\");\n this.currentLevelIndex = null;\n }\n }\n }\n };\n // reset errors on the successful load of a fragment\n LevelController.prototype.onFragLoaded = function (_a) {\n var frag = _a.frag;\n if (frag !== undefined && frag.type === 'main') {\n var level = this._levels[frag.level];\n if (level !== undefined) {\n level.fragmentError = false;\n level.loadError = 0;\n this.levelRetryCount = 0;\n }\n }\n };\n LevelController.prototype.onLevelLoaded = function (data) {\n var _this = this;\n var levelId = data.level;\n // only process level loaded events matching with expected level\n if (levelId !== this.currentLevelIndex) {\n return;\n }\n var curLevel = this._levels[levelId];\n // reset level load error counter on successful level loaded only if there is no issues with fragments\n if (!curLevel.fragmentError) {\n curLevel.loadError = 0;\n this.levelRetryCount = 0;\n }\n var newDetails = data.details;\n // if current playlist is a live playlist, arm a timer to reload it\n if (newDetails.live) {\n var targetdurationMs = 1000 * (newDetails.averagetargetduration ? newDetails.averagetargetduration : newDetails.targetduration);\n var reloadInterval = targetdurationMs, curDetails = curLevel.details;\n if (curDetails && newDetails.endSN === curDetails.endSN) {\n // follow HLS Spec, If the client reloads a Playlist file and finds that it has not\n // changed then it MUST wait for a period of one-half the target\n // duration before retrying.\n reloadInterval /= 2;\n logger_1.logger.log('same live playlist, reload twice faster');\n }\n // decrement reloadInterval with level loading delay\n reloadInterval -= performance.now() - data.stats.trequest;\n // in any case, don't reload more than half of target duration\n reloadInterval = Math.max(targetdurationMs / 2, Math.round(reloadInterval));\n logger_1.logger.log(\"live playlist, reload in \" + Math.round(reloadInterval) + \" ms\");\n this.timer = setTimeout(function () { return _this.loadLevel(); }, reloadInterval);\n }\n else {\n this.clearTimer();\n }\n };\n LevelController.prototype.onAudioTrackSwitched = function (data) {\n var audioGroupId = this.hls.audioTracks[data.id].groupId;\n var currentLevel = this.hls.levels[this.currentLevelIndex];\n if (!currentLevel) {\n return;\n }\n if (currentLevel.audioGroupIds) {\n var urlId = currentLevel.audioGroupIds.findIndex(function (groupId) { return groupId === audioGroupId; });\n if (urlId !== currentLevel.urlId) {\n currentLevel.urlId = urlId;\n this.startLoad();\n }\n }\n };\n LevelController.prototype.loadLevel = function () {\n logger_1.logger.debug('call to loadLevel');\n if (this.currentLevelIndex !== null && this.canload) {\n var levelObject = this._levels[this.currentLevelIndex];\n if (typeof levelObject === 'object' &&\n levelObject.url.length > 0) {\n var level = this.currentLevelIndex;\n var id = levelObject.urlId;\n var url = levelObject.url[id];\n logger_1.logger.log(\"Attempt loading level index \" + level + \" with URL-id \" + id);\n // console.log('Current audio track group ID:', this.hls.audioTracks[this.hls.audioTrack].groupId);\n // console.log('New video quality level audio group id:', levelObject.attrs.AUDIO, level);\n this.hls.trigger(events_1.default.LEVEL_LOADING, { url: url, level: level, id: id });\n }\n }\n };\n Object.defineProperty(LevelController.prototype, \"nextLoadLevel\", {\n get: function () {\n if (this.manualLevelIndex !== -1) {\n return this.manualLevelIndex;\n }\n else {\n return this.hls.nextAutoLevel;\n }\n },\n set: function (nextLevel) {\n this.level = nextLevel;\n if (this.manualLevelIndex === -1) {\n this.hls.nextAutoLevel = nextLevel;\n }\n },\n enumerable: true,\n configurable: true\n });\n return LevelController;\n}(event_handler_1.default));\nexports.default = LevelController;\n\n\n/***/ }),\n\n/***/ \"./src/controller/level-helper.js\":\n/*!****************************************!*\\\n !*** ./src/controller/level-helper.js ***!\n \\****************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\n/**\n * @module LevelHelper\n *\n * Providing methods dealing with playlist sliding and drift\n *\n * TODO: Create an actual `Level` class/model that deals with all this logic in an object-oriented-manner.\n *\n * */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nfunction addGroupId(level, type, id) {\n switch (type) {\n case 'audio':\n if (!level.audioGroupIds) {\n level.audioGroupIds = [];\n }\n level.audioGroupIds.push(id);\n break;\n case 'text':\n if (!level.textGroupIds) {\n level.textGroupIds = [];\n }\n level.textGroupIds.push(id);\n break;\n }\n}\nexports.addGroupId = addGroupId;\nfunction updatePTS(fragments, fromIdx, toIdx) {\n var fragFrom = fragments[fromIdx], fragTo = fragments[toIdx], fragToPTS = fragTo.startPTS;\n // if we know startPTS[toIdx]\n if (Number.isFinite(fragToPTS)) {\n // update fragment duration.\n // it helps to fix drifts between playlist reported duration and fragment real duration\n if (toIdx > fromIdx) {\n fragFrom.duration = fragToPTS - fragFrom.start;\n if (fragFrom.duration < 0) {\n logger_1.logger.warn(\"negative duration computed for frag \" + fragFrom.sn + \",level \" + fragFrom.level + \", there should be some duration drift between playlist and fragment!\");\n }\n }\n else {\n fragTo.duration = fragFrom.start - fragToPTS;\n if (fragTo.duration < 0) {\n logger_1.logger.warn(\"negative duration computed for frag \" + fragTo.sn + \",level \" + fragTo.level + \", there should be some duration drift between playlist and fragment!\");\n }\n }\n }\n else {\n // we dont know startPTS[toIdx]\n if (toIdx > fromIdx) {\n fragTo.start = fragFrom.start + fragFrom.duration;\n }\n else {\n fragTo.start = Math.max(fragFrom.start - fragTo.duration, 0);\n }\n }\n}\nexports.updatePTS = updatePTS;\nfunction updateFragPTSDTS(details, frag, startPTS, endPTS, startDTS, endDTS) {\n // update frag PTS/DTS\n var maxStartPTS = startPTS;\n if (Number.isFinite(frag.startPTS)) {\n // delta PTS between audio and video\n var deltaPTS = Math.abs(frag.startPTS - startPTS);\n if (!Number.isFinite(frag.deltaPTS)) {\n frag.deltaPTS = deltaPTS;\n }\n else {\n frag.deltaPTS = Math.max(deltaPTS, frag.deltaPTS);\n }\n maxStartPTS = Math.max(startPTS, frag.startPTS);\n startPTS = Math.min(startPTS, frag.startPTS);\n endPTS = Math.max(endPTS, frag.endPTS);\n startDTS = Math.min(startDTS, frag.startDTS);\n endDTS = Math.max(endDTS, frag.endDTS);\n }\n var drift = startPTS - frag.start;\n frag.start = frag.startPTS = startPTS;\n frag.maxStartPTS = maxStartPTS;\n frag.endPTS = endPTS;\n frag.startDTS = startDTS;\n frag.endDTS = endDTS;\n frag.duration = endPTS - startPTS;\n var sn = frag.sn;\n // exit if sn out of range\n if (!details || sn < details.startSN || sn > details.endSN) {\n return 0;\n }\n var fragIdx, fragments, i;\n fragIdx = sn - details.startSN;\n fragments = details.fragments;\n // update frag reference in fragments array\n // rationale is that fragments array might not contain this frag object.\n // this will happen if playlist has been refreshed between frag loading and call to updateFragPTSDTS()\n // if we don't update frag, we won't be able to propagate PTS info on the playlist\n // resulting in invalid sliding computation\n fragments[fragIdx] = frag;\n // adjust fragment PTS/duration from seqnum-1 to frag 0\n for (i = fragIdx; i > 0; i--) {\n updatePTS(fragments, i, i - 1);\n }\n // adjust fragment PTS/duration from seqnum to last frag\n for (i = fragIdx; i < fragments.length - 1; i++) {\n updatePTS(fragments, i, i + 1);\n }\n details.PTSKnown = true;\n return drift;\n}\nexports.updateFragPTSDTS = updateFragPTSDTS;\nfunction mergeDetails(oldDetails, newDetails) {\n var start = Math.max(oldDetails.startSN, newDetails.startSN) - newDetails.startSN, end = Math.min(oldDetails.endSN, newDetails.endSN) - newDetails.startSN, delta = newDetails.startSN - oldDetails.startSN, oldfragments = oldDetails.fragments, newfragments = newDetails.fragments, ccOffset = 0, PTSFrag;\n // potentially retrieve cached initsegment\n if (newDetails.initSegment && oldDetails.initSegment) {\n newDetails.initSegment = oldDetails.initSegment;\n }\n // check if old/new playlists have fragments in common\n if (end < start) {\n newDetails.PTSKnown = false;\n return;\n }\n // loop through overlapping SN and update startPTS , cc, and duration if any found\n for (var i = start; i <= end; i++) {\n var oldFrag = oldfragments[delta + i], newFrag = newfragments[i];\n if (newFrag && oldFrag) {\n ccOffset = oldFrag.cc - newFrag.cc;\n if (Number.isFinite(oldFrag.startPTS)) {\n newFrag.start = newFrag.startPTS = oldFrag.startPTS;\n newFrag.endPTS = oldFrag.endPTS;\n newFrag.duration = oldFrag.duration;\n newFrag.backtracked = oldFrag.backtracked;\n newFrag.dropped = oldFrag.dropped;\n PTSFrag = newFrag;\n }\n }\n }\n if (ccOffset) {\n logger_1.logger.log('discontinuity sliding from playlist, take drift into account');\n for (i = 0; i < newfragments.length; i++) {\n newfragments[i].cc += ccOffset;\n }\n }\n // if at least one fragment contains PTS info, recompute PTS information for all fragments\n if (PTSFrag) {\n updateFragPTSDTS(newDetails, PTSFrag, PTSFrag.startPTS, PTSFrag.endPTS, PTSFrag.startDTS, PTSFrag.endDTS);\n }\n else {\n // ensure that delta is within oldfragments range\n // also adjust sliding in case delta is 0 (we could have old=[50-60] and new=old=[50-61])\n // in that case we also need to adjust start offset of all fragments\n if (delta >= 0 && delta < oldfragments.length) {\n // adjust start by sliding offset\n var sliding = oldfragments[delta].start;\n for (i = 0; i < newfragments.length; i++) {\n newfragments[i].start += sliding;\n }\n }\n }\n // if we are here, it means we have fragments overlapping between\n // old and new level. reliable PTS info is thus relying on old level\n newDetails.PTSKnown = oldDetails.PTSKnown;\n}\nexports.mergeDetails = mergeDetails;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/controller/stream-controller.js\":\n/*!*********************************************!*\\\n !*** ./src/controller/stream-controller.js ***!\n \\*********************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\n/*\n * Stream Controller\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar binary_search_1 = __webpack_require__(/*! ../utils/binary-search */ \"./src/utils/binary-search.js\");\nvar buffer_helper_1 = __webpack_require__(/*! ../utils/buffer-helper */ \"./src/utils/buffer-helper.js\");\nvar demuxer_1 = __webpack_require__(/*! ../demux/demuxer */ \"./src/demux/demuxer.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar fragment_tracker_1 = __webpack_require__(/*! ./fragment-tracker */ \"./src/controller/fragment-tracker.js\");\nvar fragment_1 = __webpack_require__(/*! ../loader/fragment */ \"./src/loader/fragment.js\");\nvar playlist_loader_1 = __webpack_require__(/*! ../loader/playlist-loader */ \"./src/loader/playlist-loader.js\");\nvar LevelHelper = __webpack_require__(/*! ./level-helper */ \"./src/controller/level-helper.js\");\nvar time_ranges_1 = __webpack_require__(/*! ../utils/time-ranges */ \"./src/utils/time-ranges.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar discontinuities_1 = __webpack_require__(/*! ../utils/discontinuities */ \"./src/utils/discontinuities.js\");\nvar fragment_finders_1 = __webpack_require__(/*! ./fragment-finders */ \"./src/controller/fragment-finders.js\");\nvar gap_controller_1 = __webpack_require__(/*! ./gap-controller */ \"./src/controller/gap-controller.js\");\nvar base_stream_controller_1 = __webpack_require__(/*! ./base-stream-controller */ \"./src/controller/base-stream-controller.js\");\nvar TICK_INTERVAL = 100; // how often to tick in ms\nvar StreamController = /** @class */ (function (_super) {\n __extends(StreamController, _super);\n function StreamController(hls, fragmentTracker) {\n var _this = _super.call(this, hls, events_1.default.MEDIA_ATTACHED, events_1.default.MEDIA_DETACHING, events_1.default.MANIFEST_LOADING, events_1.default.MANIFEST_PARSED, events_1.default.LEVEL_LOADED, events_1.default.KEY_LOADED, events_1.default.FRAG_LOADED, events_1.default.FRAG_LOAD_EMERGENCY_ABORTED, events_1.default.FRAG_PARSING_INIT_SEGMENT, events_1.default.FRAG_PARSING_DATA, events_1.default.FRAG_PARSED, events_1.default.ERROR, events_1.default.AUDIO_TRACK_SWITCHING, events_1.default.AUDIO_TRACK_SWITCHED, events_1.default.BUFFER_CREATED, events_1.default.BUFFER_APPENDED, events_1.default.BUFFER_FLUSHED) || this;\n _this.fragmentTracker = fragmentTracker;\n _this.config = hls.config;\n _this.audioCodecSwap = false;\n _this._state = base_stream_controller_1.State.STOPPED;\n _this.stallReported = false;\n _this.gapController = null;\n return _this;\n }\n StreamController.prototype.onHandlerDestroying = function () {\n this.stopLoad();\n _super.prototype.onHandlerDestroying.call(this);\n };\n StreamController.prototype.onHandlerDestroyed = function () {\n this.state = base_stream_controller_1.State.STOPPED;\n this.fragmentTracker = null;\n _super.prototype.onHandlerDestroyed.call(this);\n };\n StreamController.prototype.startLoad = function (startPosition) {\n if (this.levels) {\n var lastCurrentTime = this.lastCurrentTime, hls_1 = this.hls;\n this.stopLoad();\n this.setInterval(TICK_INTERVAL);\n this.level = -1;\n this.fragLoadError = 0;\n if (!this.startFragRequested) {\n // determine load level\n var startLevel = hls_1.startLevel;\n if (startLevel === -1) {\n // -1 : guess start Level by doing a bitrate test by loading first fragment of lowest quality level\n startLevel = 0;\n this.bitrateTest = true;\n }\n // set new level to playlist loader : this will trigger start level load\n // hls.nextLoadLevel remains until it is set to a new value or until a new frag is successfully loaded\n this.level = hls_1.nextLoadLevel = startLevel;\n this.loadedmetadata = false;\n }\n // if startPosition undefined but lastCurrentTime set, set startPosition to last currentTime\n if (lastCurrentTime > 0 && startPosition === -1) {\n logger_1.logger.log(\"override startPosition with lastCurrentTime @\" + lastCurrentTime.toFixed(3));\n startPosition = lastCurrentTime;\n }\n this.state = base_stream_controller_1.State.IDLE;\n this.nextLoadPosition = this.startPosition = this.lastCurrentTime = startPosition;\n this.tick();\n }\n else {\n this.forceStartLoad = true;\n this.state = base_stream_controller_1.State.STOPPED;\n }\n };\n StreamController.prototype.stopLoad = function () {\n var frag = this.fragCurrent;\n if (frag) {\n if (frag.loader) {\n frag.loader.abort();\n }\n this.fragmentTracker.removeFragment(frag);\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n this.clearInterval();\n this.state = base_stream_controller_1.State.STOPPED;\n this.forceStartLoad = false;\n };\n StreamController.prototype.doTick = function () {\n switch (this.state) {\n case base_stream_controller_1.State.BUFFER_FLUSHING:\n // in buffer flushing state, reset fragLoadError counter\n this.fragLoadError = 0;\n break;\n case base_stream_controller_1.State.IDLE:\n this._doTickIdle();\n break;\n case base_stream_controller_1.State.WAITING_LEVEL:\n var level = this.levels[this.level];\n // check if playlist is already loaded\n if (level && level.details) {\n this.state = base_stream_controller_1.State.IDLE;\n }\n break;\n case base_stream_controller_1.State.FRAG_LOADING_WAITING_RETRY:\n var now = window.performance.now();\n var retryDate = this.retryDate;\n // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading\n if (!retryDate || (now >= retryDate) || (this.media && this.media.seeking)) {\n logger_1.logger.log('mediaController: retryDate reached, switch back to IDLE state');\n this.state = base_stream_controller_1.State.IDLE;\n }\n break;\n case base_stream_controller_1.State.ERROR:\n case base_stream_controller_1.State.STOPPED:\n case base_stream_controller_1.State.FRAG_LOADING:\n case base_stream_controller_1.State.PARSING:\n case base_stream_controller_1.State.PARSED:\n case base_stream_controller_1.State.ENDED:\n break;\n default:\n break;\n }\n // check buffer\n this._checkBuffer();\n // check/update current fragment\n this._checkFragmentChanged();\n };\n // Ironically the \"idle\" state is the on we do the most logic in it seems ....\n // NOTE: Maybe we could rather schedule a check for buffer length after half of the currently\n // played segment, or on pause/play/seek instead of naively checking every 100ms?\n StreamController.prototype._doTickIdle = function () {\n var hls = this.hls, config = hls.config, media = this.media;\n // if start level not parsed yet OR\n // if video not attached AND start fragment already requested OR start frag prefetch disable\n // exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment\n if (this.levelLastLoaded === undefined || (!media && (this.startFragRequested || !config.startFragPrefetch))) {\n return;\n }\n // if we have not yet loaded any fragment, start loading from start position\n var pos;\n if (this.loadedmetadata) {\n pos = media.currentTime;\n }\n else {\n pos = this.nextLoadPosition;\n }\n // determine next load level\n var level = hls.nextLoadLevel, levelInfo = this.levels[level];\n if (!levelInfo) {\n return;\n }\n var levelBitrate = levelInfo.bitrate, maxBufLen;\n // compute max Buffer Length that we could get from this load level, based on level bitrate. don't buffer more than 60 MB and more than 30s\n if (levelBitrate) {\n maxBufLen = Math.max(8 * config.maxBufferSize / levelBitrate, config.maxBufferLength);\n }\n else {\n maxBufLen = config.maxBufferLength;\n }\n maxBufLen = Math.min(maxBufLen, config.maxMaxBufferLength);\n // determine next candidate fragment to be loaded, based on current position and end of buffer position\n // ensure up to `config.maxMaxBufferLength` of buffer upfront\n var bufferInfo = buffer_helper_1.BufferHelper.bufferInfo(this.mediaBuffer ? this.mediaBuffer : media, pos, config.maxBufferHole), bufferLen = bufferInfo.len;\n // Stay idle if we are still with buffer margins\n if (bufferLen >= maxBufLen) {\n return;\n }\n // if buffer length is less than maxBufLen try to load a new fragment ...\n logger_1.logger.trace(\"buffer length of \" + bufferLen.toFixed(3) + \" is below max of \" + maxBufLen.toFixed(3) + \". checking for more payload ...\");\n // set next load level : this will trigger a playlist load if needed\n this.level = hls.nextLoadLevel = level;\n var levelDetails = levelInfo.details;\n // if level info not retrieved yet, switch state and wait for level retrieval\n // if live playlist, ensure that new playlist has been refreshed to avoid loading/try to load\n // a useless and outdated fragment (that might even introduce load error if it is already out of the live playlist)\n if (!levelDetails || (levelDetails.live && this.levelLastLoaded !== level)) {\n this.state = base_stream_controller_1.State.WAITING_LEVEL;\n return;\n }\n if (this._streamEnded(bufferInfo, levelDetails)) {\n var data = {};\n if (this.altAudio) {\n data.type = 'video';\n }\n this.hls.trigger(events_1.default.BUFFER_EOS, data);\n this.state = base_stream_controller_1.State.ENDED;\n return;\n }\n // if we have the levelDetails for the selected variant, lets continue enrichen our stream (load keys/fragments or trigger EOS, etc..)\n this._fetchPayloadOrEos(pos, bufferInfo, levelDetails);\n };\n StreamController.prototype._fetchPayloadOrEos = function (pos, bufferInfo, levelDetails) {\n var fragPrevious = this.fragPrevious, level = this.level, fragments = levelDetails.fragments, fragLen = fragments.length;\n // empty playlist\n if (fragLen === 0) {\n return;\n }\n // find fragment index, contiguous with end of buffer position\n var start = fragments[0].start, end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration, bufferEnd = bufferInfo.end, frag;\n if (levelDetails.initSegment && !levelDetails.initSegment.data) {\n frag = levelDetails.initSegment;\n }\n else {\n // in case of live playlist we need to ensure that requested position is not located before playlist start\n if (levelDetails.live) {\n var initialLiveManifestSize = this.config.initialLiveManifestSize;\n if (fragLen < initialLiveManifestSize) {\n logger_1.logger.warn(\"Can not start playback of a level, reason: not enough fragments \" + fragLen + \" < \" + initialLiveManifestSize);\n return;\n }\n frag = this._ensureFragmentAtLivePoint(levelDetails, bufferEnd, start, end, fragPrevious, fragments, fragLen);\n // if it explicitely returns null don't load any fragment and exit function now\n if (frag === null) {\n return;\n }\n }\n else {\n // VoD playlist: if bufferEnd before start of playlist, load first fragment\n if (bufferEnd < start) {\n frag = fragments[0];\n }\n }\n }\n if (!frag) {\n frag = this._findFragment(start, fragPrevious, fragLen, fragments, bufferEnd, end, levelDetails);\n }\n if (frag) {\n if (frag.encrypted) {\n logger_1.logger.log(\"Loading key for \" + frag.sn + \" of [\" + levelDetails.startSN + \" ,\" + levelDetails.endSN + \"],level \" + level);\n this._loadKey(frag);\n }\n else {\n logger_1.logger.log(\"Loading \" + frag.sn + \" of [\" + levelDetails.startSN + \" ,\" + levelDetails.endSN + \"],level \" + level + \", currentTime:\" + pos.toFixed(3) + \",bufferEnd:\" + bufferEnd.toFixed(3));\n this._loadFragment(frag);\n }\n }\n };\n StreamController.prototype._ensureFragmentAtLivePoint = function (levelDetails, bufferEnd, start, end, fragPrevious, fragments, fragLen) {\n var config = this.hls.config, media = this.media;\n var frag;\n // check if requested position is within seekable boundaries :\n // logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.media.seeking}`);\n var maxLatency = config.liveMaxLatencyDuration !== undefined ? config.liveMaxLatencyDuration : config.liveMaxLatencyDurationCount * levelDetails.targetduration;\n if (bufferEnd < Math.max(start - config.maxFragLookUpTolerance, end - maxLatency)) {\n var liveSyncPosition = this.liveSyncPosition = this.computeLivePosition(start, levelDetails);\n logger_1.logger.log(\"buffer end: \" + bufferEnd.toFixed(3) + \" is located too far from the end of live sliding playlist, reset currentTime to : \" + liveSyncPosition.toFixed(3));\n bufferEnd = liveSyncPosition;\n if (media && media.readyState && media.duration > liveSyncPosition) {\n media.currentTime = liveSyncPosition;\n }\n this.nextLoadPosition = liveSyncPosition;\n }\n // if end of buffer greater than live edge, don't load any fragment\n // this could happen if live playlist intermittently slides in the past.\n // level 1 loaded [182580161,182580167]\n // level 1 loaded [182580162,182580169]\n // Loading 182580168 of [182580162 ,182580169],level 1 ..\n // Loading 182580169 of [182580162 ,182580169],level 1 ..\n // level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168\n // level 1 loaded [182580164,182580171]\n //\n // don't return null in case media not loaded yet (readystate === 0)\n if (levelDetails.PTSKnown && bufferEnd > end && media && media.readyState) {\n return null;\n }\n if (this.startFragRequested && !levelDetails.PTSKnown) {\n /* we are switching level on live playlist, but we don't have any PTS info for that quality level ...\n try to load frag matching with next SN.\n even if SN are not synchronized between playlists, loading this frag will help us\n compute playlist sliding and find the right one after in case it was not the right consecutive one */\n if (fragPrevious) {\n if (levelDetails.hasProgramDateTime) {\n // Relies on PDT in order to switch bitrates (Support EXT-X-DISCONTINUITY without EXT-X-DISCONTINUITY-SEQUENCE)\n logger_1.logger.log(\"live playlist, switching playlist, load frag with same PDT: \" + fragPrevious.programDateTime);\n frag = fragment_finders_1.findFragmentByPDT(fragments, fragPrevious.endProgramDateTime, config.maxFragLookUpTolerance);\n }\n else {\n // Uses buffer and sequence number to calculate switch segment (required if using EXT-X-DISCONTINUITY-SEQUENCE)\n var targetSN = fragPrevious.sn + 1;\n if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) {\n var fragNext = fragments[targetSN - levelDetails.startSN];\n if (fragPrevious.cc === fragNext.cc) {\n frag = fragNext;\n logger_1.logger.log(\"live playlist, switching playlist, load frag with next SN: \" + frag.sn);\n }\n }\n // next frag SN not available (or not with same continuity counter)\n // look for a frag sharing the same CC\n if (!frag) {\n frag = binary_search_1.default.search(fragments, function (frag) {\n return fragPrevious.cc - frag.cc;\n });\n if (frag) {\n logger_1.logger.log(\"live playlist, switching playlist, load frag with same CC: \" + frag.sn);\n }\n }\n }\n }\n if (!frag) {\n /* we have no idea about which fragment should be loaded.\n so let's load mid fragment. it will help computing playlist sliding and find the right one\n */\n frag = fragments[Math.min(fragLen - 1, Math.round(fragLen / 2))];\n logger_1.logger.log(\"live playlist, switching playlist, unknown, load middle frag : \" + frag.sn);\n }\n }\n return frag;\n };\n StreamController.prototype._findFragment = function (start, fragPrevious, fragLen, fragments, bufferEnd, end, levelDetails) {\n var config = this.hls.config;\n var frag;\n if (bufferEnd < end) {\n var lookupTolerance = (bufferEnd > end - config.maxFragLookUpTolerance) ? 0 : config.maxFragLookUpTolerance;\n // Remove the tolerance if it would put the bufferEnd past the actual end of stream\n // Uses buffer and sequence number to calculate switch segment (required if using EXT-X-DISCONTINUITY-SEQUENCE)\n frag = fragment_finders_1.findFragmentByPTS(fragPrevious, fragments, bufferEnd, lookupTolerance);\n }\n else {\n // reach end of playlist\n frag = fragments[fragLen - 1];\n }\n if (frag) {\n var curSNIdx = frag.sn - levelDetails.startSN;\n var sameLevel = fragPrevious && frag.level === fragPrevious.level;\n var prevFrag = fragments[curSNIdx - 1];\n var nextFrag = fragments[curSNIdx + 1];\n // logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n if (fragPrevious && frag.sn === fragPrevious.sn) {\n if (sameLevel && !frag.backtracked) {\n if (frag.sn < levelDetails.endSN) {\n var deltaPTS = fragPrevious.deltaPTS;\n // if there is a significant delta between audio and video, larger than max allowed hole,\n // and if previous remuxed fragment did not start with a keyframe. (fragPrevious.dropped)\n // let's try to load previous fragment again to get last keyframe\n // then we will reload again current fragment (that way we should be able to fill the buffer hole ...)\n if (deltaPTS && deltaPTS > config.maxBufferHole && fragPrevious.dropped && curSNIdx) {\n frag = prevFrag;\n logger_1.logger.warn('SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this');\n }\n else {\n frag = nextFrag;\n logger_1.logger.log(\"SN just loaded, load next one: \" + frag.sn, frag);\n }\n }\n else {\n frag = null;\n }\n }\n else if (frag.backtracked) {\n // Only backtrack a max of 1 consecutive fragment to prevent sliding back too far when little or no frags start with keyframes\n if (nextFrag && nextFrag.backtracked) {\n logger_1.logger.warn(\"Already backtracked from fragment \" + nextFrag.sn + \", will not backtrack to fragment \" + frag.sn + \". Loading fragment \" + nextFrag.sn);\n frag = nextFrag;\n }\n else {\n // If a fragment has dropped frames and it's in a same level/sequence, load the previous fragment to try and find the keyframe\n // Reset the dropped count now since it won't be reset until we parse the fragment again, which prevents infinite backtracking on the same segment\n logger_1.logger.warn('Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe');\n frag.dropped = 0;\n if (prevFrag) {\n frag = prevFrag;\n frag.backtracked = true;\n }\n else if (curSNIdx) {\n // can't backtrack on very first fragment\n frag = null;\n }\n }\n }\n }\n }\n return frag;\n };\n StreamController.prototype._loadKey = function (frag) {\n this.state = base_stream_controller_1.State.KEY_LOADING;\n this.hls.trigger(events_1.default.KEY_LOADING, { frag: frag });\n };\n StreamController.prototype._loadFragment = function (frag) {\n // Check if fragment is not loaded\n var fragState = this.fragmentTracker.getState(frag);\n this.fragCurrent = frag;\n this.startFragRequested = true;\n // Don't update nextLoadPosition for fragments which are not buffered\n if (Number.isFinite(frag.sn) && !frag.bitrateTest) {\n this.nextLoadPosition = frag.start + frag.duration;\n }\n // Allow backtracked fragments to load\n if (frag.backtracked || fragState === fragment_tracker_1.FragmentState.NOT_LOADED || fragState === fragment_tracker_1.FragmentState.PARTIAL) {\n frag.autoLevel = this.hls.autoLevelEnabled;\n frag.bitrateTest = this.bitrateTest;\n this.hls.trigger(events_1.default.FRAG_LOADING, { frag: frag });\n // lazy demuxer init, as this could take some time ... do it during frag loading\n if (!this.demuxer) {\n this.demuxer = new demuxer_1.default(this.hls, 'main');\n }\n this.state = base_stream_controller_1.State.FRAG_LOADING;\n }\n else if (fragState === fragment_tracker_1.FragmentState.APPENDING) {\n // Lower the buffer size and try again\n if (this._reduceMaxBufferLength(frag.duration)) {\n this.fragmentTracker.removeFragment(frag);\n }\n }\n };\n Object.defineProperty(StreamController.prototype, \"state\", {\n get: function () {\n return this._state;\n },\n set: function (nextState) {\n if (this.state !== nextState) {\n var previousState = this.state;\n this._state = nextState;\n logger_1.logger.log(\"main stream:\" + previousState + \"->\" + nextState);\n this.hls.trigger(events_1.default.STREAM_STATE_TRANSITION, { previousState: previousState, nextState: nextState });\n }\n },\n enumerable: true,\n configurable: true\n });\n StreamController.prototype.getBufferedFrag = function (position) {\n return this.fragmentTracker.getBufferedFrag(position, playlist_loader_1.default.LevelType.MAIN);\n };\n Object.defineProperty(StreamController.prototype, \"currentLevel\", {\n get: function () {\n var media = this.media;\n if (media) {\n var frag = this.getBufferedFrag(media.currentTime);\n if (frag) {\n return frag.level;\n }\n }\n return -1;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(StreamController.prototype, \"nextBufferedFrag\", {\n get: function () {\n var media = this.media;\n if (media) {\n // first get end range of current fragment\n return this.followingBufferedFrag(this.getBufferedFrag(media.currentTime));\n }\n else {\n return null;\n }\n },\n enumerable: true,\n configurable: true\n });\n StreamController.prototype.followingBufferedFrag = function (frag) {\n if (frag) {\n // try to get range of next fragment (500ms after this range)\n return this.getBufferedFrag(frag.endPTS + 0.5);\n }\n return null;\n };\n Object.defineProperty(StreamController.prototype, \"nextLevel\", {\n get: function () {\n var frag = this.nextBufferedFrag;\n if (frag) {\n return frag.level;\n }\n else {\n return -1;\n }\n },\n enumerable: true,\n configurable: true\n });\n StreamController.prototype._checkFragmentChanged = function () {\n var fragPlayingCurrent, currentTime, video = this.media;\n if (video && video.readyState && video.seeking === false) {\n currentTime = video.currentTime;\n /* if video element is in seeked state, currentTime can only increase.\n (assuming that playback rate is positive ...)\n As sometimes currentTime jumps back to zero after a\n media decode error, check this, to avoid seeking back to\n wrong position after a media decode error\n */\n if (currentTime > this.lastCurrentTime) {\n this.lastCurrentTime = currentTime;\n }\n if (buffer_helper_1.BufferHelper.isBuffered(video, currentTime)) {\n fragPlayingCurrent = this.getBufferedFrag(currentTime);\n }\n else if (buffer_helper_1.BufferHelper.isBuffered(video, currentTime + 0.1)) {\n /* ensure that FRAG_CHANGED event is triggered at startup,\n when first video frame is displayed and playback is paused.\n add a tolerance of 100ms, in case current position is not buffered,\n check if current pos+100ms is buffered and use that buffer range\n for FRAG_CHANGED event reporting */\n fragPlayingCurrent = this.getBufferedFrag(currentTime + 0.1);\n }\n if (fragPlayingCurrent) {\n var fragPlaying = fragPlayingCurrent;\n if (fragPlaying !== this.fragPlaying) {\n this.hls.trigger(events_1.default.FRAG_CHANGED, { frag: fragPlaying });\n var fragPlayingLevel = fragPlaying.level;\n if (!this.fragPlaying || this.fragPlaying.level !== fragPlayingLevel) {\n this.hls.trigger(events_1.default.LEVEL_SWITCHED, { level: fragPlayingLevel });\n }\n this.fragPlaying = fragPlaying;\n }\n }\n }\n };\n /*\n on immediate level switch :\n - pause playback if playing\n - cancel any pending load request\n - and trigger a buffer flush\n */\n StreamController.prototype.immediateLevelSwitch = function () {\n logger_1.logger.log('immediateLevelSwitch');\n if (!this.immediateSwitch) {\n this.immediateSwitch = true;\n var media = this.media, previouslyPaused = void 0;\n if (media) {\n previouslyPaused = media.paused;\n media.pause();\n }\n else {\n // don't restart playback after instant level switch in case media not attached\n previouslyPaused = true;\n }\n this.previouslyPaused = previouslyPaused;\n }\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // flush everything\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n };\n /**\n * on immediate level switch end, after new fragment has been buffered:\n * - nudge video decoder by slightly adjusting video currentTime (if currentTime buffered)\n * - resume the playback if needed\n */\n StreamController.prototype.immediateLevelSwitchEnd = function () {\n var media = this.media;\n if (media && media.buffered.length) {\n this.immediateSwitch = false;\n if (buffer_helper_1.BufferHelper.isBuffered(media, media.currentTime)) {\n // only nudge if currentTime is buffered\n media.currentTime -= 0.0001;\n }\n if (!this.previouslyPaused) {\n media.play();\n }\n }\n };\n /**\n * try to switch ASAP without breaking video playback:\n * in order to ensure smooth but quick level switching,\n * we need to find the next flushable buffer range\n * we should take into account new segment fetch time\n */\n StreamController.prototype.nextLevelSwitch = function () {\n var media = this.media;\n // ensure that media is defined and that metadata are available (to retrieve currentTime)\n if (media && media.readyState) {\n var fetchdelay = void 0, fragPlayingCurrent = void 0, nextBufferedFrag = void 0;\n fragPlayingCurrent = this.getBufferedFrag(media.currentTime);\n if (fragPlayingCurrent && fragPlayingCurrent.startPTS > 1) {\n // flush buffer preceding current fragment (flush until current fragment start offset)\n // minus 1s to avoid video freezing, that could happen if we flush keyframe of current video ...\n this.flushMainBuffer(0, fragPlayingCurrent.startPTS - 1);\n }\n if (!media.paused) {\n // add a safety delay of 1s\n var nextLevelId = this.hls.nextLoadLevel, nextLevel = this.levels[nextLevelId], fragLastKbps = this.fragLastKbps;\n if (fragLastKbps && this.fragCurrent) {\n fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1;\n }\n else {\n fetchdelay = 0;\n }\n }\n else {\n fetchdelay = 0;\n }\n // logger.log('fetchdelay:'+fetchdelay);\n // find buffer range that will be reached once new fragment will be fetched\n nextBufferedFrag = this.getBufferedFrag(media.currentTime + fetchdelay);\n if (nextBufferedFrag) {\n // we can flush buffer range following this one without stalling playback\n nextBufferedFrag = this.followingBufferedFrag(nextBufferedFrag);\n if (nextBufferedFrag) {\n // if we are here, we can also cancel any loading/demuxing in progress, as they are useless\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // start flush position is the start PTS of next buffered frag.\n // we use frag.naxStartPTS which is max(audio startPTS, video startPTS).\n // in case there is a small PTS Delta between audio and video, using maxStartPTS avoids flushing last samples from current fragment\n this.flushMainBuffer(nextBufferedFrag.maxStartPTS, Number.POSITIVE_INFINITY);\n }\n }\n }\n };\n StreamController.prototype.flushMainBuffer = function (startOffset, endOffset) {\n this.state = base_stream_controller_1.State.BUFFER_FLUSHING;\n var flushScope = { startOffset: startOffset, endOffset: endOffset };\n // if alternate audio tracks are used, only flush video, otherwise flush everything\n if (this.altAudio) {\n flushScope.type = 'video';\n }\n this.hls.trigger(events_1.default.BUFFER_FLUSHING, flushScope);\n };\n StreamController.prototype.onMediaAttached = function (data) {\n var media = this.media = this.mediaBuffer = data.media;\n this.onvseeking = this.onMediaSeeking.bind(this);\n this.onvseeked = this.onMediaSeeked.bind(this);\n this.onvended = this.onMediaEnded.bind(this);\n media.addEventListener('seeking', this.onvseeking);\n media.addEventListener('seeked', this.onvseeked);\n media.addEventListener('ended', this.onvended);\n var config = this.config;\n if (this.levels && config.autoStartLoad) {\n this.hls.startLoad(config.startPosition);\n }\n this.gapController = new gap_controller_1.default(config, media, this.fragmentTracker, this.hls);\n };\n StreamController.prototype.onMediaDetaching = function () {\n var media = this.media;\n if (media && media.ended) {\n logger_1.logger.log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n }\n // reset fragment backtracked flag\n var levels = this.levels;\n if (levels) {\n levels.forEach(function (level) {\n if (level.details) {\n level.details.fragments.forEach(function (fragment) {\n fragment.backtracked = undefined;\n });\n }\n });\n }\n // remove video listeners\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('seeked', this.onvseeked);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n this.media = this.mediaBuffer = null;\n this.loadedmetadata = false;\n this.stopLoad();\n };\n StreamController.prototype.onMediaSeeked = function () {\n var media = this.media, currentTime = media ? media.currentTime : undefined;\n if (Number.isFinite(currentTime)) {\n logger_1.logger.log(\"media seeked to \" + currentTime.toFixed(3));\n }\n // tick to speed up FRAGMENT_PLAYING triggering\n this.tick();\n };\n StreamController.prototype.onManifestLoading = function () {\n // reset buffer on manifest loading\n logger_1.logger.log('trigger BUFFER_RESET');\n this.hls.trigger(events_1.default.BUFFER_RESET);\n this.fragmentTracker.removeAllFragments();\n this.stalled = false;\n this.startPosition = this.lastCurrentTime = 0;\n };\n StreamController.prototype.onManifestParsed = function (data) {\n var aac = false, heaac = false, codec;\n data.levels.forEach(function (level) {\n // detect if we have different kind of audio codecs used amongst playlists\n codec = level.audioCodec;\n if (codec) {\n if (codec.indexOf('mp4a.40.2') !== -1) {\n aac = true;\n }\n if (codec.indexOf('mp4a.40.5') !== -1) {\n heaac = true;\n }\n }\n });\n this.audioCodecSwitch = (aac && heaac);\n if (this.audioCodecSwitch) {\n logger_1.logger.log('both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC');\n }\n this.levels = data.levels;\n this.startFragRequested = false;\n var config = this.config;\n if (config.autoStartLoad || this.forceStartLoad) {\n this.hls.startLoad(config.startPosition);\n }\n };\n StreamController.prototype.onLevelLoaded = function (data) {\n var newDetails = data.details;\n var newLevelId = data.level;\n var lastLevel = this.levels[this.levelLastLoaded];\n var curLevel = this.levels[newLevelId];\n var duration = newDetails.totalduration;\n var sliding = 0;\n logger_1.logger.log(\"level \" + newLevelId + \" loaded [\" + newDetails.startSN + \",\" + newDetails.endSN + \"],duration:\" + duration);\n if (newDetails.live) {\n var curDetails = curLevel.details;\n if (curDetails && newDetails.fragments.length > 0) {\n // we already have details for that level, merge them\n LevelHelper.mergeDetails(curDetails, newDetails);\n sliding = newDetails.fragments[0].start;\n this.liveSyncPosition = this.computeLivePosition(sliding, curDetails);\n if (newDetails.PTSKnown && Number.isFinite(sliding)) {\n logger_1.logger.log(\"live playlist sliding:\" + sliding.toFixed(3));\n }\n else {\n logger_1.logger.log('live playlist - outdated PTS, unknown sliding');\n discontinuities_1.alignStream(this.fragPrevious, lastLevel, newDetails);\n }\n }\n else {\n logger_1.logger.log('live playlist - first load, unknown sliding');\n newDetails.PTSKnown = false;\n discontinuities_1.alignStream(this.fragPrevious, lastLevel, newDetails);\n }\n }\n else {\n newDetails.PTSKnown = false;\n }\n // override level info\n curLevel.details = newDetails;\n this.levelLastLoaded = newLevelId;\n this.hls.trigger(events_1.default.LEVEL_UPDATED, { details: newDetails, level: newLevelId });\n if (this.startFragRequested === false) {\n // compute start position if set to -1. use it straight away if value is defined\n if (this.startPosition === -1 || this.lastCurrentTime === -1) {\n // first, check if start time offset has been set in playlist, if yes, use this value\n var startTimeOffset = newDetails.startTimeOffset;\n if (Number.isFinite(startTimeOffset)) {\n if (startTimeOffset < 0) {\n logger_1.logger.log(\"negative start time offset \" + startTimeOffset + \", count from end of last fragment\");\n startTimeOffset = sliding + duration + startTimeOffset;\n }\n logger_1.logger.log(\"start time offset found in playlist, adjust startPosition to \" + startTimeOffset);\n this.startPosition = startTimeOffset;\n }\n else {\n // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3)\n if (newDetails.live) {\n this.startPosition = this.computeLivePosition(sliding, newDetails);\n logger_1.logger.log(\"configure startPosition to \" + this.startPosition);\n }\n else {\n this.startPosition = 0;\n }\n }\n this.lastCurrentTime = this.startPosition;\n }\n this.nextLoadPosition = this.startPosition;\n }\n // only switch batck to IDLE state if we were waiting for level to start downloading a new fragment\n if (this.state === base_stream_controller_1.State.WAITING_LEVEL) {\n this.state = base_stream_controller_1.State.IDLE;\n }\n // trigger handler right now\n this.tick();\n };\n StreamController.prototype.onKeyLoaded = function () {\n if (this.state === base_stream_controller_1.State.KEY_LOADING) {\n this.state = base_stream_controller_1.State.IDLE;\n this.tick();\n }\n };\n StreamController.prototype.onFragLoaded = function (data) {\n var _a = this, fragCurrent = _a.fragCurrent, hls = _a.hls, levels = _a.levels, media = _a.media;\n var fragLoaded = data.frag;\n if (this.state === base_stream_controller_1.State.FRAG_LOADING &&\n fragCurrent &&\n fragLoaded.type === 'main' &&\n fragLoaded.level === fragCurrent.level &&\n fragLoaded.sn === fragCurrent.sn) {\n var stats = data.stats;\n var currentLevel = levels[fragCurrent.level];\n var details = currentLevel.details;\n // reset frag bitrate test in any case after frag loaded event\n // if this frag was loaded to perform a bitrate test AND if hls.nextLoadLevel is greater than 0\n // then this means that we should be able to load a fragment at a higher quality level\n this.bitrateTest = false;\n this.stats = stats;\n logger_1.logger.log(\"Loaded \" + fragCurrent.sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],level \" + fragCurrent.level);\n if (fragLoaded.bitrateTest && hls.nextLoadLevel) {\n // switch back to IDLE state ... we just loaded a fragment to determine adequate start bitrate and initialize autoswitch algo\n this.state = base_stream_controller_1.State.IDLE;\n this.startFragRequested = false;\n stats.tparsed = stats.tbuffered = window.performance.now();\n hls.trigger(events_1.default.FRAG_BUFFERED, { stats: stats, frag: fragCurrent, id: 'main' });\n this.tick();\n }\n else if (fragLoaded.sn === 'initSegment') {\n this.state = base_stream_controller_1.State.IDLE;\n stats.tparsed = stats.tbuffered = window.performance.now();\n details.initSegment.data = data.payload;\n hls.trigger(events_1.default.FRAG_BUFFERED, { stats: stats, frag: fragCurrent, id: 'main' });\n this.tick();\n }\n else {\n logger_1.logger.log(\"Parsing \" + fragCurrent.sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],level \" + fragCurrent.level + \", cc \" + fragCurrent.cc);\n this.state = base_stream_controller_1.State.PARSING;\n this.pendingBuffering = true;\n this.appended = false;\n // Bitrate test frags are not usually buffered so the fragment tracker ignores them. If Hls.js decides to buffer\n // it (and therefore ends up at this line), then the fragment tracker needs to be manually informed.\n if (fragLoaded.bitrateTest) {\n fragLoaded.bitrateTest = false;\n this.fragmentTracker.onFragLoaded({\n frag: fragLoaded\n });\n }\n // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live) and if media is not seeking (this is to overcome potential timestamp drifts between playlists and fragments)\n var accurateTimeOffset = !(media && media.seeking) && (details.PTSKnown || !details.live);\n var initSegmentData = details.initSegment ? details.initSegment.data : [];\n var audioCodec = this._getAudioCodec(currentLevel);\n // transmux the MPEG-TS data to ISO-BMFF segments\n var demuxer = this.demuxer = this.demuxer || new demuxer_1.default(this.hls, 'main');\n demuxer.push(data.payload, initSegmentData, audioCodec, currentLevel.videoCodec, fragCurrent, details.totalduration, accurateTimeOffset);\n }\n }\n this.fragLoadError = 0;\n };\n StreamController.prototype.onFragParsingInitSegment = function (data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent &&\n data.id === 'main' &&\n fragNew.sn === fragCurrent.sn &&\n fragNew.level === fragCurrent.level &&\n this.state === base_stream_controller_1.State.PARSING) {\n var tracks = data.tracks, trackName = void 0, track = void 0;\n // if audio track is expected to come from audio stream controller, discard any coming from main\n if (tracks.audio && this.altAudio) {\n delete tracks.audio;\n }\n // include levelCodec in audio and video tracks\n track = tracks.audio;\n if (track) {\n var audioCodec = this.levels[this.level].audioCodec, ua = navigator.userAgent.toLowerCase();\n if (audioCodec && this.audioCodecSwap) {\n logger_1.logger.log('swapping playlist audio codec');\n if (audioCodec.indexOf('mp4a.40.5') !== -1) {\n audioCodec = 'mp4a.40.2';\n }\n else {\n audioCodec = 'mp4a.40.5';\n }\n }\n // in case AAC and HE-AAC audio codecs are signalled in manifest\n // force HE-AAC , as it seems that most browsers prefers that way,\n // except for mono streams OR on FF\n // these conditions might need to be reviewed ...\n if (this.audioCodecSwitch) {\n // don't force HE-AAC if mono stream\n if (track.metadata.channelCount !== 1 &&\n // don't force HE-AAC if firefox\n ua.indexOf('firefox') === -1) {\n audioCodec = 'mp4a.40.5';\n }\n }\n // HE-AAC is broken on Android, always signal audio codec as AAC even if variant manifest states otherwise\n if (ua.indexOf('android') !== -1 && track.container !== 'audio/mpeg') { // Exclude mpeg audio\n audioCodec = 'mp4a.40.2';\n logger_1.logger.log(\"Android: force audio codec to \" + audioCodec);\n }\n track.levelCodec = audioCodec;\n track.id = data.id;\n }\n track = tracks.video;\n if (track) {\n track.levelCodec = this.levels[this.level].videoCodec;\n track.id = data.id;\n }\n this.hls.trigger(events_1.default.BUFFER_CODECS, tracks);\n // loop through tracks that are going to be provided to bufferController\n for (trackName in tracks) {\n track = tracks[trackName];\n logger_1.logger.log(\"main track:\" + trackName + \",container:\" + track.container + \",codecs[level/parsed]=[\" + track.levelCodec + \"/\" + track.codec + \"]\");\n var initSegment = track.initSegment;\n if (initSegment) {\n this.appended = true;\n // arm pending Buffering flag before appending a segment\n this.pendingBuffering = true;\n this.hls.trigger(events_1.default.BUFFER_APPENDING, { type: trackName, data: initSegment, parent: 'main', content: 'initSegment' });\n }\n }\n // trigger handler right now\n this.tick();\n }\n };\n StreamController.prototype.onFragParsingData = function (data) {\n var _this = this;\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent &&\n data.id === 'main' &&\n fragNew.sn === fragCurrent.sn &&\n fragNew.level === fragCurrent.level &&\n !(data.type === 'audio' && this.altAudio) && // filter out main audio if audio track is loaded through audio stream controller\n this.state === base_stream_controller_1.State.PARSING) {\n var level = this.levels[this.level], frag = fragCurrent;\n if (!Number.isFinite(data.endPTS)) {\n data.endPTS = data.startPTS + fragCurrent.duration;\n data.endDTS = data.startDTS + fragCurrent.duration;\n }\n if (data.hasAudio === true) {\n frag.addElementaryStream(fragment_1.default.ElementaryStreamTypes.AUDIO);\n }\n if (data.hasVideo === true) {\n frag.addElementaryStream(fragment_1.default.ElementaryStreamTypes.VIDEO);\n }\n logger_1.logger.log(\"Parsed \" + data.type + \",PTS:[\" + data.startPTS.toFixed(3) + \",\" + data.endPTS.toFixed(3) + \"],DTS:[\" + data.startDTS.toFixed(3) + \"/\" + data.endDTS.toFixed(3) + \"],nb:\" + data.nb + \",dropped:\" + (data.dropped || 0));\n // Detect gaps in a fragment and try to fix it by finding a keyframe in the previous fragment (see _findFragments)\n if (data.type === 'video') {\n frag.dropped = data.dropped;\n if (frag.dropped) {\n if (!frag.backtracked) {\n var levelDetails = level.details;\n if (levelDetails && frag.sn === levelDetails.startSN) {\n logger_1.logger.warn('missing video frame(s) on first frag, appending with gap', frag.sn);\n }\n else {\n logger_1.logger.warn('missing video frame(s), backtracking fragment', frag.sn);\n // Return back to the IDLE state without appending to buffer\n // Causes findFragments to backtrack a segment and find the keyframe\n // Audio fragments arriving before video sets the nextLoadPosition, causing _findFragments to skip the backtracked fragment\n this.fragmentTracker.removeFragment(frag);\n frag.backtracked = true;\n this.nextLoadPosition = data.startPTS;\n this.state = base_stream_controller_1.State.IDLE;\n this.fragPrevious = frag;\n this.tick();\n return;\n }\n }\n else {\n logger_1.logger.warn('Already backtracked on this fragment, appending with the gap', frag.sn);\n }\n }\n else {\n // Only reset the backtracked flag if we've loaded the frag without any dropped frames\n frag.backtracked = false;\n }\n }\n var drift = LevelHelper.updateFragPTSDTS(level.details, frag, data.startPTS, data.endPTS, data.startDTS, data.endDTS), hls_2 = this.hls;\n hls_2.trigger(events_1.default.LEVEL_PTS_UPDATED, { details: level.details, level: this.level, drift: drift, type: data.type, start: data.startPTS, end: data.endPTS });\n // has remuxer dropped video frames located before first keyframe ?\n [data.data1, data.data2].forEach(function (buffer) {\n // only append in PARSING state (rationale is that an appending error could happen synchronously on first segment appending)\n // in that case it is useless to append following segments\n if (buffer && buffer.length && _this.state === base_stream_controller_1.State.PARSING) {\n _this.appended = true;\n // arm pending Buffering flag before appending a segment\n _this.pendingBuffering = true;\n hls_2.trigger(events_1.default.BUFFER_APPENDING, { type: data.type, data: buffer, parent: 'main', content: 'data' });\n }\n });\n // trigger handler right now\n this.tick();\n }\n };\n StreamController.prototype.onFragParsed = function (data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent &&\n data.id === 'main' &&\n fragNew.sn === fragCurrent.sn &&\n fragNew.level === fragCurrent.level &&\n this.state === base_stream_controller_1.State.PARSING) {\n this.stats.tparsed = window.performance.now();\n this.state = base_stream_controller_1.State.PARSED;\n this._checkAppendedParsed();\n }\n };\n StreamController.prototype.onAudioTrackSwitching = function (data) {\n // if any URL found on new audio track, it is an alternate audio track\n var altAudio = !!data.url, trackId = data.id;\n // if we switch on main audio, ensure that main fragment scheduling is synced with media.buffered\n // don't do anything if we switch to alt audio: audio stream controller is handling it.\n // we will just have to change buffer scheduling on audioTrackSwitched\n if (!altAudio) {\n if (this.mediaBuffer !== this.media) {\n logger_1.logger.log('switching on main audio, use media.buffered to schedule main fragment loading');\n this.mediaBuffer = this.media;\n var fragCurrent = this.fragCurrent;\n // we need to refill audio buffer from main: cancel any frag loading to speed up audio switch\n if (fragCurrent.loader) {\n logger_1.logger.log('switching to main audio track, cancel main fragment load');\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n this.fragPrevious = null;\n // destroy demuxer to force init segment generation (following audio switch)\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n // switch to IDLE state to load new fragment\n this.state = base_stream_controller_1.State.IDLE;\n }\n var hls_3 = this.hls;\n // switching to main audio, flush all audio and trigger track switched\n hls_3.trigger(events_1.default.BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: 'audio' });\n hls_3.trigger(events_1.default.AUDIO_TRACK_SWITCHED, { id: trackId });\n this.altAudio = false;\n }\n };\n StreamController.prototype.onAudioTrackSwitched = function (data) {\n var trackId = data.id, altAudio = !!this.hls.audioTracks[trackId].url;\n if (altAudio) {\n var videoBuffer = this.videoBuffer;\n // if we switched on alternate audio, ensure that main fragment scheduling is synced with video sourcebuffer buffered\n if (videoBuffer && this.mediaBuffer !== videoBuffer) {\n logger_1.logger.log('switching on alternate audio, use video.buffered to schedule main fragment loading');\n this.mediaBuffer = videoBuffer;\n }\n }\n this.altAudio = altAudio;\n this.tick();\n };\n StreamController.prototype.onBufferCreated = function (data) {\n var tracks = data.tracks, mediaTrack, name, alternate = false;\n for (var type in tracks) {\n var track = tracks[type];\n if (track.id === 'main') {\n name = type;\n mediaTrack = track;\n // keep video source buffer reference\n if (type === 'video') {\n this.videoBuffer = tracks[type].buffer;\n }\n }\n else {\n alternate = true;\n }\n }\n if (alternate && mediaTrack) {\n logger_1.logger.log(\"alternate track found, use \" + name + \".buffered to schedule main fragment loading\");\n this.mediaBuffer = mediaTrack.buffer;\n }\n else {\n this.mediaBuffer = this.media;\n }\n };\n StreamController.prototype.onBufferAppended = function (data) {\n if (data.parent === 'main') {\n var state = this.state;\n if (state === base_stream_controller_1.State.PARSING || state === base_stream_controller_1.State.PARSED) {\n // check if all buffers have been appended\n this.pendingBuffering = (data.pending > 0);\n this._checkAppendedParsed();\n }\n }\n };\n StreamController.prototype._checkAppendedParsed = function () {\n // trigger handler right now\n if (this.state === base_stream_controller_1.State.PARSED && (!this.appended || !this.pendingBuffering)) {\n var frag = this.fragCurrent;\n if (frag) {\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n logger_1.logger.log(\"main buffered : \" + time_ranges_1.default.toString(media.buffered));\n this.fragPrevious = frag;\n var stats = this.stats;\n stats.tbuffered = window.performance.now();\n // we should get rid of this.fragLastKbps\n this.fragLastKbps = Math.round(8 * stats.total / (stats.tbuffered - stats.tfirst));\n this.hls.trigger(events_1.default.FRAG_BUFFERED, { stats: stats, frag: frag, id: 'main' });\n this.state = base_stream_controller_1.State.IDLE;\n }\n this.tick();\n }\n };\n StreamController.prototype.onError = function (data) {\n var frag = data.frag || this.fragCurrent;\n // don't handle frag error not related to main fragment\n if (frag && frag.type !== 'main') {\n return;\n }\n // 0.5 : tolerance needed as some browsers stalls playback before reaching buffered end\n var mediaBuffered = !!this.media && buffer_helper_1.BufferHelper.isBuffered(this.media, this.media.currentTime) && buffer_helper_1.BufferHelper.isBuffered(this.media, this.media.currentTime + 0.5);\n switch (data.details) {\n case errors_1.ErrorDetails.FRAG_LOAD_ERROR:\n case errors_1.ErrorDetails.FRAG_LOAD_TIMEOUT:\n case errors_1.ErrorDetails.KEY_LOAD_ERROR:\n case errors_1.ErrorDetails.KEY_LOAD_TIMEOUT:\n if (!data.fatal) {\n // keep retrying until the limit will be reached\n if ((this.fragLoadError + 1) <= this.config.fragLoadingMaxRetry) {\n // exponential backoff capped to config.fragLoadingMaxRetryTimeout\n var delay = Math.min(Math.pow(2, this.fragLoadError) * this.config.fragLoadingRetryDelay, this.config.fragLoadingMaxRetryTimeout);\n logger_1.logger.warn(\"mediaController: frag loading failed, retry in \" + delay + \" ms\");\n this.retryDate = window.performance.now() + delay;\n // retry loading state\n // if loadedmetadata is not set, it means that we are emergency switch down on first frag\n // in that case, reset startFragRequested flag\n if (!this.loadedmetadata) {\n this.startFragRequested = false;\n this.nextLoadPosition = this.startPosition;\n }\n this.fragLoadError++;\n this.state = base_stream_controller_1.State.FRAG_LOADING_WAITING_RETRY;\n }\n else {\n logger_1.logger.error(\"mediaController: \" + data.details + \" reaches max retry, redispatch as fatal ...\");\n // switch error to fatal\n data.fatal = true;\n this.state = base_stream_controller_1.State.ERROR;\n }\n }\n break;\n case errors_1.ErrorDetails.LEVEL_LOAD_ERROR:\n case errors_1.ErrorDetails.LEVEL_LOAD_TIMEOUT:\n if (this.state !== base_stream_controller_1.State.ERROR) {\n if (data.fatal) {\n // if fatal error, stop processing\n this.state = base_stream_controller_1.State.ERROR;\n logger_1.logger.warn(\"streamController: \" + data.details + \",switch to \" + this.state + \" state ...\");\n }\n else {\n // in case of non fatal error while loading level, if level controller is not retrying to load level , switch back to IDLE\n if (!data.levelRetry && this.state === base_stream_controller_1.State.WAITING_LEVEL) {\n this.state = base_stream_controller_1.State.IDLE;\n }\n }\n }\n break;\n case errors_1.ErrorDetails.BUFFER_FULL_ERROR:\n // if in appending state\n if (data.parent === 'main' && (this.state === base_stream_controller_1.State.PARSING || this.state === base_stream_controller_1.State.PARSED)) {\n // reduce max buf len if current position is buffered\n if (mediaBuffered) {\n this._reduceMaxBufferLength(this.config.maxBufferLength);\n this.state = base_stream_controller_1.State.IDLE;\n }\n else {\n // current position is not buffered, but browser is still complaining about buffer full error\n // this happens on IE/Edge, refer to https://github.com/video-dev/hls.js/pull/708\n // in that case flush the whole buffer to recover\n logger_1.logger.warn('buffer full error also media.currentTime is not buffered, flush everything');\n this.fragCurrent = null;\n // flush everything\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n }\n }\n break;\n default:\n break;\n }\n };\n StreamController.prototype._reduceMaxBufferLength = function (minLength) {\n var config = this.config;\n if (config.maxMaxBufferLength >= minLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n config.maxMaxBufferLength /= 2;\n logger_1.logger.warn(\"main:reduce max buffer length to \" + config.maxMaxBufferLength + \"s\");\n return true;\n }\n return false;\n };\n /**\n * Checks the health of the buffer and attempts to resolve playback stalls.\n * @private\n */\n StreamController.prototype._checkBuffer = function () {\n var media = this.media;\n if (!media || media.readyState === 0) {\n // Exit early if we don't have media or if the media hasn't bufferd anything yet (readyState 0)\n return;\n }\n var mediaBuffer = this.mediaBuffer ? this.mediaBuffer : media;\n var buffered = mediaBuffer.buffered;\n if (!this.loadedmetadata && buffered.length) {\n this.loadedmetadata = true;\n this._seekToStartPos();\n }\n else if (this.immediateSwitch) {\n this.immediateLevelSwitchEnd();\n }\n else {\n this.gapController.poll(this.lastCurrentTime, buffered);\n }\n };\n StreamController.prototype.onFragLoadEmergencyAborted = function () {\n this.state = base_stream_controller_1.State.IDLE;\n // if loadedmetadata is not set, it means that we are emergency switch down on first frag\n // in that case, reset startFragRequested flag\n if (!this.loadedmetadata) {\n this.startFragRequested = false;\n this.nextLoadPosition = this.startPosition;\n }\n this.tick();\n };\n StreamController.prototype.onBufferFlushed = function () {\n /* after successful buffer flushing, filter flushed fragments from bufferedFrags\n use mediaBuffered instead of media (so that we will check against video.buffered ranges in case of alt audio track)\n */\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n if (media) {\n // filter fragments potentially evicted from buffer. this is to avoid memleak on live streams\n this.fragmentTracker.detectEvictedFragments(fragment_1.default.ElementaryStreamTypes.VIDEO, media.buffered);\n }\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = base_stream_controller_1.State.IDLE;\n // reset reference to frag\n this.fragPrevious = null;\n };\n StreamController.prototype.swapAudioCodec = function () {\n this.audioCodecSwap = !this.audioCodecSwap;\n };\n StreamController.prototype.computeLivePosition = function (sliding, levelDetails) {\n var targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * levelDetails.targetduration;\n return sliding + Math.max(0, levelDetails.totalduration - targetLatency);\n };\n /**\n * Seeks to the set startPosition if not equal to the mediaElement's current time.\n * @private\n */\n StreamController.prototype._seekToStartPos = function () {\n var media = this.media;\n var currentTime = media.currentTime;\n // only adjust currentTime if different from startPosition or if startPosition not buffered\n // at that stage, there should be only one buffered range, as we reach that code after first fragment has been buffered\n var startPosition = media.seeking ? currentTime : this.startPosition;\n // if currentTime not matching with expected startPosition or startPosition not buffered but close to first buffered\n if (currentTime !== startPosition) {\n // if startPosition not buffered, let's seek to buffered.start(0)\n logger_1.logger.log(\"target start position not buffered, seek to buffered.start(0) \" + startPosition + \" from current time \" + currentTime + \" \");\n media.currentTime = startPosition;\n }\n };\n StreamController.prototype._getAudioCodec = function (currentLevel) {\n var audioCodec = this.config.defaultAudioCodec || currentLevel.audioCodec;\n if (this.audioCodecSwap) {\n logger_1.logger.log('swapping playlist audio codec');\n if (audioCodec) {\n if (audioCodec.indexOf('mp4a.40.5') !== -1) {\n audioCodec = 'mp4a.40.2';\n }\n else {\n audioCodec = 'mp4a.40.5';\n }\n }\n }\n return audioCodec;\n };\n Object.defineProperty(StreamController.prototype, \"liveSyncPosition\", {\n get: function () {\n return this._liveSyncPosition;\n },\n set: function (value) {\n this._liveSyncPosition = value;\n },\n enumerable: true,\n configurable: true\n });\n return StreamController;\n}(base_stream_controller_1.default));\nexports.default = StreamController;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/controller/subtitle-stream-controller.js\":\n/*!******************************************************!*\\\n !*** ./src/controller/subtitle-stream-controller.js ***!\n \\******************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * @class SubtitleStreamController\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar decrypter_1 = __webpack_require__(/*! ../crypt/decrypter */ \"./src/crypt/decrypter.js\");\nvar task_loop_1 = __webpack_require__(/*! ../task-loop */ \"./src/task-loop.js\");\nvar buffer_helper_1 = __webpack_require__(/*! ../utils/buffer-helper */ \"./src/utils/buffer-helper.js\");\nvar fragment_finders_1 = __webpack_require__(/*! ./fragment-finders */ \"./src/controller/fragment-finders.js\");\nvar fragment_tracker_1 = __webpack_require__(/*! ./fragment-tracker */ \"./src/controller/fragment-tracker.js\");\nvar performance = window.performance;\nexports.SubtitleStreamControllerState = {\n STOPPED: 'STOPPED',\n IDLE: 'IDLE',\n KEY_LOADING: 'KEY_LOADING',\n FRAG_LOADING: 'FRAG_LOADING'\n};\nvar State = exports.SubtitleStreamControllerState;\nvar TICK_INTERVAL = 500; // how often to tick in ms\nvar SubtitleStreamController = /** @class */ (function (_super) {\n __extends(SubtitleStreamController, _super);\n function SubtitleStreamController(hls, fragmentTracker) {\n var _this = _super.call(this, hls, events_1.default.MEDIA_ATTACHED, events_1.default.MEDIA_DETACHING, events_1.default.ERROR, events_1.default.KEY_LOADED, events_1.default.FRAG_LOADED, events_1.default.SUBTITLE_TRACKS_UPDATED, events_1.default.SUBTITLE_TRACK_SWITCH, events_1.default.SUBTITLE_TRACK_LOADED, events_1.default.SUBTITLE_FRAG_PROCESSED) || this;\n _this.fragmentTracker = fragmentTracker;\n _this.config = hls.config;\n _this.state = State.STOPPED;\n _this.tracks = [];\n _this.tracksBuffered = [];\n _this.currentTrackId = -1;\n _this.decrypter = new decrypter_1.default(hls, hls.config);\n return _this;\n }\n SubtitleStreamController.prototype.onHandlerDestroyed = function () {\n this.fragmentTracker = null;\n this.state = State.STOPPED;\n _super.prototype.onHandlerDestroyed.call(this);\n };\n SubtitleStreamController.prototype.onSubtitleFragProcessed = function (data) {\n this.state = State.IDLE;\n if (!data.success) {\n return;\n }\n var buffered = this.tracksBuffered[this.currentTrackId];\n var frag = data.frag;\n this.fragPrevious = frag;\n if (!buffered) {\n return;\n }\n // Create/update a buffered array matching the interface used by BufferHelper.bufferedInfo\n // so we can re-use the logic used to detect how much have been buffered\n // FIXME: put this in a utility function or proper object for time-ranges manipulation?\n var timeRange;\n for (var i = 0; i < buffered.length; i++) {\n if (frag.start >= buffered[i].start && frag.start <= buffered[i].end) {\n timeRange = buffered[i];\n break;\n }\n }\n if (timeRange) {\n timeRange.end = frag.start + frag.duration;\n }\n else {\n buffered.push({\n start: frag.start,\n end: frag.start + frag.duration\n });\n }\n };\n SubtitleStreamController.prototype.onMediaAttached = function (data) {\n this.media = data.media;\n this.state = State.IDLE;\n };\n SubtitleStreamController.prototype.onMediaDetaching = function () {\n this.media = null;\n this.state = State.STOPPED;\n };\n // If something goes wrong, procede to next frag, if we were processing one.\n SubtitleStreamController.prototype.onError = function (data) {\n var frag = data.frag;\n // don't handle error not related to subtitle fragment\n if (!frag || frag.type !== 'subtitle') {\n return;\n }\n this.state = State.IDLE;\n };\n // Got all new subtitle tracks.\n SubtitleStreamController.prototype.onSubtitleTracksUpdated = function (data) {\n var _this = this;\n logger_1.logger.log('subtitle tracks updated');\n this.tracksBuffered = [];\n this.tracks = data.subtitleTracks;\n this.tracks.forEach(function (track) {\n _this.tracksBuffered[track.id] = [];\n });\n };\n SubtitleStreamController.prototype.onSubtitleTrackSwitch = function (data) {\n this.currentTrackId = data.id;\n if (!this.tracks || this.currentTrackId === -1) {\n this.clearInterval();\n return;\n }\n // Check if track has the necessary details to load fragments\n var currentTrack = this.tracks[this.currentTrackId];\n if (currentTrack && currentTrack.details) {\n this.setInterval(TICK_INTERVAL);\n }\n };\n // Got a new set of subtitle fragments.\n SubtitleStreamController.prototype.onSubtitleTrackLoaded = function (data) {\n var id = data.id, details = data.details;\n if (!this.tracks) {\n logger_1.logger.warn('Can not update subtitle details, no tracks found');\n return;\n }\n if (this.tracks[id]) {\n logger_1.logger.log('Updating subtitle track details');\n this.tracks[id].details = details;\n }\n this.setInterval(TICK_INTERVAL);\n };\n SubtitleStreamController.prototype.onKeyLoaded = function () {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n }\n };\n SubtitleStreamController.prototype.onFragLoaded = function (data) {\n var fragCurrent = this.fragCurrent;\n var decryptData = data.frag.decryptdata;\n var fragLoaded = data.frag;\n var hls = this.hls;\n if (this.state === State.FRAG_LOADING &&\n fragCurrent &&\n data.frag.type === 'subtitle' &&\n fragCurrent.sn === data.frag.sn) {\n // check to see if the payload needs to be decrypted\n if (data.payload.byteLength > 0 && (decryptData && decryptData.key && decryptData.method === 'AES-128')) {\n var startTime_1 = performance.now();\n // decrypt the subtitles\n this.decrypter.decrypt(data.payload, decryptData.key.buffer, decryptData.iv.buffer, function (decryptedData) {\n var endTime = performance.now();\n hls.trigger(events_1.default.FRAG_DECRYPTED, { frag: fragLoaded, payload: decryptedData, stats: { tstart: startTime_1, tdecrypt: endTime } });\n });\n }\n }\n };\n SubtitleStreamController.prototype.doTick = function () {\n if (!this.media) {\n this.state = State.IDLE;\n return;\n }\n switch (this.state) {\n case State.IDLE:\n var tracks = this.tracks;\n var trackId = this.currentTrackId;\n if (!tracks || !tracks[trackId] || !tracks[trackId].details) {\n break;\n }\n var trackDetails = tracks[trackId].details;\n var config = this.config;\n var maxBufferHole = config.maxBufferHole;\n var maxConfigBuffer = Math.min(config.maxBufferLength, config.maxMaxBufferLength);\n var maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n var bufferedInfo = buffer_helper_1.BufferHelper.bufferedInfo(this._getBuffered(), this.media.currentTime, maxBufferHole);\n var bufferEnd = bufferedInfo.end;\n var bufferLen = bufferedInfo.len;\n var fragments = trackDetails.fragments;\n var fragLen = fragments.length;\n var end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration;\n var foundFrag = void 0;\n if (bufferLen < maxConfigBuffer && bufferEnd < end) {\n foundFrag = fragment_finders_1.findFragmentByPTS(this.fragPrevious, fragments, bufferEnd, maxFragLookUpTolerance);\n }\n else if (trackDetails.hasProgramDateTime && this.fragPrevious) {\n foundFrag = fragment_finders_1.findFragmentByPDT(fragments, this.fragPrevious.endProgramDateTime, maxFragLookUpTolerance);\n }\n if (foundFrag && foundFrag.encrypted) {\n logger_1.logger.log(\"Loading key for \" + foundFrag.sn);\n this.state = State.KEY_LOADING;\n this.hls.trigger(events_1.default.KEY_LOADING, { frag: foundFrag });\n }\n else if (foundFrag && this.fragmentTracker.getState(foundFrag) === fragment_tracker_1.FragmentState.NOT_LOADED) {\n // only load if fragment is not loaded\n foundFrag.trackId = trackId; // Frags don't know their subtitle track ID, so let's just add that...\n this.fragCurrent = foundFrag;\n this.state = State.FRAG_LOADING;\n this.hls.trigger(events_1.default.FRAG_LOADING, { frag: foundFrag });\n }\n }\n };\n SubtitleStreamController.prototype._getBuffered = function () {\n return this.tracksBuffered[this.currentTrackId] || [];\n };\n return SubtitleStreamController;\n}(task_loop_1.default));\nexports.SubtitleStreamController = SubtitleStreamController;\n\n\n/***/ }),\n\n/***/ \"./src/controller/subtitle-track-controller.js\":\n/*!*****************************************************!*\\\n !*** ./src/controller/subtitle-track-controller.js ***!\n \\*****************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/*\n * subtitle track controller\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nfunction filterSubtitleTracks(textTrackList) {\n var tracks = [];\n for (var i = 0; i < textTrackList.length; i++) {\n if (textTrackList[i].kind === 'subtitles') {\n tracks.push(textTrackList[i]);\n }\n }\n return tracks;\n}\nvar SubtitleTrackController = /** @class */ (function (_super) {\n __extends(SubtitleTrackController, _super);\n function SubtitleTrackController(hls) {\n var _this = _super.call(this, hls, events_1.default.MEDIA_ATTACHED, events_1.default.MEDIA_DETACHING, events_1.default.MANIFEST_LOADING, events_1.default.MANIFEST_LOADED, events_1.default.SUBTITLE_TRACK_LOADED) || this;\n _this.tracks = [];\n _this.trackId = -1;\n _this.media = null;\n /**\n * @member {boolean} subtitleDisplay Enable/disable subtitle display rendering\n */\n _this.subtitleDisplay = true;\n return _this;\n }\n SubtitleTrackController.prototype._onTextTracksChanged = function () {\n // Media is undefined when switching streams via loadSource()\n if (!this.media) {\n return;\n }\n var trackId = -1;\n var tracks = filterSubtitleTracks(this.media.textTracks);\n for (var id = 0; id < tracks.length; id++) {\n if (tracks[id].mode === 'hidden') {\n // Do not break in case there is a following track with showing.\n trackId = id;\n }\n else if (tracks[id].mode === 'showing') {\n trackId = id;\n break;\n }\n }\n // Setting current subtitleTrack will invoke code.\n this.subtitleTrack = trackId;\n };\n SubtitleTrackController.prototype.destroy = function () {\n event_handler_1.default.prototype.destroy.call(this);\n };\n // Listen for subtitle track change, then extract the current track ID.\n SubtitleTrackController.prototype.onMediaAttached = function (data) {\n var _this = this;\n this.media = data.media;\n if (!this.media) {\n return;\n }\n if (this.queuedDefaultTrack) {\n this.subtitleTrack = this.queuedDefaultTrack;\n delete this.queuedDefaultTrack;\n }\n this.trackChangeListener = this._onTextTracksChanged.bind(this);\n this.useTextTrackPolling = !(this.media.textTracks && 'onchange' in this.media.textTracks);\n if (this.useTextTrackPolling) {\n this.subtitlePollingInterval = setInterval(function () {\n _this.trackChangeListener();\n }, 500);\n }\n else {\n this.media.textTracks.addEventListener('change', this.trackChangeListener);\n }\n };\n SubtitleTrackController.prototype.onMediaDetaching = function () {\n if (!this.media) {\n return;\n }\n if (this.useTextTrackPolling) {\n clearInterval(this.subtitlePollingInterval);\n }\n else {\n this.media.textTracks.removeEventListener('change', this.trackChangeListener);\n }\n this.media = null;\n };\n // Reset subtitle tracks on manifest loading\n SubtitleTrackController.prototype.onManifestLoading = function () {\n this.tracks = [];\n this.trackId = -1;\n };\n // Fired whenever a new manifest is loaded.\n SubtitleTrackController.prototype.onManifestLoaded = function (data) {\n var _this = this;\n var tracks = data.subtitles || [];\n this.tracks = tracks;\n this.trackId = -1;\n this.hls.trigger(events_1.default.SUBTITLE_TRACKS_UPDATED, { subtitleTracks: tracks });\n // loop through available subtitle tracks and autoselect default if needed\n // TODO: improve selection logic to handle forced, etc\n tracks.forEach(function (track) {\n if (track.default) {\n // setting this.subtitleTrack will trigger internal logic\n // if media has not been attached yet, it will fail\n // we keep a reference to the default track id\n // and we'll set subtitleTrack when onMediaAttached is triggered\n if (_this.media) {\n _this.subtitleTrack = track.id;\n }\n else {\n _this.queuedDefaultTrack = track.id;\n }\n }\n });\n };\n // Trigger subtitle track playlist reload.\n SubtitleTrackController.prototype.onTick = function () {\n var trackId = this.trackId;\n var subtitleTrack = this.tracks[trackId];\n if (!subtitleTrack) {\n return;\n }\n var details = subtitleTrack.details;\n // check if we need to load playlist for this subtitle Track\n if (!details || details.live) {\n // track not retrieved yet, or live playlist we need to (re)load it\n logger_1.logger.log(\"(re)loading playlist for subtitle track \" + trackId);\n this.hls.trigger(events_1.default.SUBTITLE_TRACK_LOADING, { url: subtitleTrack.url, id: trackId });\n }\n };\n SubtitleTrackController.prototype.onSubtitleTrackLoaded = function (data) {\n var _this = this;\n if (data.id < this.tracks.length) {\n logger_1.logger.log(\"subtitle track \" + data.id + \" loaded\");\n this.tracks[data.id].details = data.details;\n // check if current playlist is a live playlist\n if (data.details.live && !this.timer) {\n // if live playlist we will have to reload it periodically\n // set reload period to playlist target duration\n this.timer = setInterval(function () {\n _this.onTick();\n }, 1000 * data.details.targetduration, this);\n }\n if (!data.details.live && this.timer) {\n // playlist is not live and timer is armed : stopping it\n this._stopTimer();\n }\n }\n };\n Object.defineProperty(SubtitleTrackController.prototype, \"subtitleTracks\", {\n /** get alternate subtitle tracks list from playlist **/\n get: function () {\n return this.tracks;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SubtitleTrackController.prototype, \"subtitleTrack\", {\n /** get index of the selected subtitle track (index in subtitle track lists) **/\n get: function () {\n return this.trackId;\n },\n /** select a subtitle track, based on its index in subtitle track lists**/\n set: function (subtitleTrackId) {\n if (this.trackId !== subtitleTrackId) {\n this._toggleTrackModes(subtitleTrackId);\n this.setSubtitleTrackInternal(subtitleTrackId);\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\n * This method is responsible for validating the subtitle index and periodically reloading if live.\n * Dispatches the SUBTITLE_TRACK_SWITCH event, which instructs the subtitle-stream-controller to load the selected track.\n * @param newId - The id of the subtitle track to activate.\n */\n SubtitleTrackController.prototype.setSubtitleTrackInternal = function (newId) {\n var _a = this, hls = _a.hls, tracks = _a.tracks;\n if (typeof newId !== 'number' || newId < -1 || newId >= tracks.length) {\n return;\n }\n this._stopTimer();\n this.trackId = newId;\n logger_1.logger.log(\"switching to subtitle track \" + newId);\n hls.trigger(events_1.default.SUBTITLE_TRACK_SWITCH, { id: newId });\n if (newId === -1) {\n return;\n }\n // check if we need to load playlist for this subtitle Track\n var subtitleTrack = tracks[newId];\n var details = subtitleTrack.details;\n if (!details || details.live) {\n // track not retrieved yet, or live playlist we need to (re)load it\n logger_1.logger.log(\"(re)loading playlist for subtitle track \" + newId);\n hls.trigger(events_1.default.SUBTITLE_TRACK_LOADING, { url: subtitleTrack.url, id: newId });\n }\n };\n SubtitleTrackController.prototype._stopTimer = function () {\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n };\n /**\n * Disables the old subtitleTrack and sets current mode on the next subtitleTrack.\n * This operates on the DOM textTracks.\n * A value of -1 will disable all subtitle tracks.\n * @param newId - The id of the next track to enable\n * @private\n */\n SubtitleTrackController.prototype._toggleTrackModes = function (newId) {\n var _a = this, media = _a.media, subtitleDisplay = _a.subtitleDisplay, trackId = _a.trackId;\n if (!media) {\n return;\n }\n var textTracks = filterSubtitleTracks(media.textTracks);\n if (newId === -1) {\n [].slice.call(textTracks).forEach(function (track) {\n track.mode = 'disabled';\n });\n }\n else {\n var oldTrack = textTracks[trackId];\n if (oldTrack) {\n oldTrack.mode = 'disabled';\n }\n }\n var nextTrack = textTracks[newId];\n if (nextTrack) {\n nextTrack.mode = subtitleDisplay ? 'showing' : 'hidden';\n }\n };\n return SubtitleTrackController;\n}(event_handler_1.default));\nexports.default = SubtitleTrackController;\n\n\n/***/ }),\n\n/***/ \"./src/controller/timeline-controller.js\":\n/*!***********************************************!*\\\n !*** ./src/controller/timeline-controller.js ***!\n \\***********************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\n/*\n * Timeline Controller\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar cea_608_parser_1 = __webpack_require__(/*! ../utils/cea-608-parser */ \"./src/utils/cea-608-parser.js\");\nvar output_filter_1 = __webpack_require__(/*! ../utils/output-filter */ \"./src/utils/output-filter.js\");\nvar webvtt_parser_1 = __webpack_require__(/*! ../utils/webvtt-parser */ \"./src/utils/webvtt-parser.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar texttrack_utils_1 = __webpack_require__(/*! ../utils/texttrack-utils */ \"./src/utils/texttrack-utils.js\");\nfunction canReuseVttTextTrack(inUseTrack, manifestTrack) {\n return inUseTrack && inUseTrack.label === manifestTrack.name && !(inUseTrack.textTrack1 || inUseTrack.textTrack2);\n}\nfunction intersection(x1, x2, y1, y2) {\n return Math.min(x2, y2) - Math.max(x1, y1);\n}\nvar TimelineController = /** @class */ (function (_super) {\n __extends(TimelineController, _super);\n function TimelineController(hls) {\n var _this = _super.call(this, hls, events_1.default.MEDIA_ATTACHING, events_1.default.MEDIA_DETACHING, events_1.default.FRAG_PARSING_USERDATA, events_1.default.FRAG_DECRYPTED, events_1.default.MANIFEST_LOADING, events_1.default.MANIFEST_LOADED, events_1.default.FRAG_LOADED, events_1.default.LEVEL_SWITCHING, events_1.default.INIT_PTS_FOUND) || this;\n _this.hls = hls;\n _this.config = hls.config;\n _this.enabled = true;\n _this.Cues = hls.config.cueHandler;\n _this.textTracks = [];\n _this.tracks = [];\n _this.unparsedVttFrags = [];\n _this.initPTS = [];\n _this.cueRanges = [];\n _this.captionsTracks = {};\n _this.captionsProperties = {\n textTrack1: {\n label: _this.config.captionsTextTrack1Label,\n languageCode: _this.config.captionsTextTrack1LanguageCode\n },\n textTrack2: {\n label: _this.config.captionsTextTrack2Label,\n languageCode: _this.config.captionsTextTrack2LanguageCode\n }\n };\n if (_this.config.enableCEA708Captions) {\n var channel1 = new output_filter_1.default(_this, 'textTrack1');\n var channel2 = new output_filter_1.default(_this, 'textTrack2');\n _this.cea608Parser = new cea_608_parser_1.default(0, channel1, channel2);\n }\n return _this;\n }\n TimelineController.prototype.addCues = function (trackName, startTime, endTime, screen) {\n // skip cues which overlap more than 50% with previously parsed time ranges\n var ranges = this.cueRanges;\n var merged = false;\n for (var i = ranges.length; i--;) {\n var cueRange = ranges[i];\n var overlap = intersection(cueRange[0], cueRange[1], startTime, endTime);\n if (overlap >= 0) {\n cueRange[0] = Math.min(cueRange[0], startTime);\n cueRange[1] = Math.max(cueRange[1], endTime);\n merged = true;\n if ((overlap / (endTime - startTime)) > 0.5) {\n return;\n }\n }\n }\n if (!merged) {\n ranges.push([startTime, endTime]);\n }\n this.Cues.newCue(this.captionsTracks[trackName], startTime, endTime, screen);\n };\n // Triggered when an initial PTS is found; used for synchronisation of WebVTT.\n TimelineController.prototype.onInitPtsFound = function (data) {\n var _this = this;\n if (data.id === 'main') {\n this.initPTS[data.frag.cc] = data.initPTS;\n }\n // Due to asynchronous processing, initial PTS may arrive later than the first VTT fragments are loaded.\n // Parse any unparsed fragments upon receiving the initial PTS.\n if (this.unparsedVttFrags.length) {\n var unparsedVttFrags = this.unparsedVttFrags;\n this.unparsedVttFrags = [];\n unparsedVttFrags.forEach(function (frag) {\n _this.onFragLoaded(frag);\n });\n }\n };\n TimelineController.prototype.getExistingTrack = function (trackName) {\n var media = this.media;\n if (media) {\n for (var i = 0; i < media.textTracks.length; i++) {\n var textTrack = media.textTracks[i];\n if (textTrack[trackName]) {\n return textTrack;\n }\n }\n }\n return null;\n };\n TimelineController.prototype.createCaptionsTrack = function (trackName) {\n var _a = this.captionsProperties[trackName], label = _a.label, languageCode = _a.languageCode;\n var captionsTracks = this.captionsTracks;\n if (!captionsTracks[trackName]) {\n // Enable reuse of existing text track.\n var existingTrack = this.getExistingTrack(trackName);\n if (!existingTrack) {\n var textTrack = this.createTextTrack('captions', label, languageCode);\n if (textTrack) {\n // Set a special property on the track so we know it's managed by Hls.js\n textTrack[trackName] = true;\n captionsTracks[trackName] = textTrack;\n }\n }\n else {\n captionsTracks[trackName] = existingTrack;\n texttrack_utils_1.clearCurrentCues(captionsTracks[trackName]);\n texttrack_utils_1.sendAddTrackEvent(captionsTracks[trackName], this.media);\n }\n }\n };\n TimelineController.prototype.createTextTrack = function (kind, label, lang) {\n var media = this.media;\n if (media) {\n return media.addTextTrack(kind, label, lang);\n }\n };\n TimelineController.prototype.destroy = function () {\n event_handler_1.default.prototype.destroy.call(this);\n };\n TimelineController.prototype.onMediaAttaching = function (data) {\n this.media = data.media;\n this._cleanTracks();\n };\n TimelineController.prototype.onMediaDetaching = function () {\n var captionsTracks = this.captionsTracks;\n Object.keys(captionsTracks).forEach(function (trackName) {\n texttrack_utils_1.clearCurrentCues(captionsTracks[trackName]);\n delete captionsTracks[trackName];\n });\n };\n TimelineController.prototype.onManifestLoading = function () {\n this.lastSn = -1; // Detect discontiguity in fragment parsing\n this.prevCC = -1;\n this.vttCCs = {\n ccOffset: 0,\n presentationOffset: 0,\n 0: {\n start: 0, prevCC: -1, new: false\n }\n };\n this._cleanTracks();\n };\n TimelineController.prototype._cleanTracks = function () {\n // clear outdated subtitles\n var media = this.media;\n if (media) {\n var textTracks = media.textTracks;\n if (textTracks) {\n for (var i = 0; i < textTracks.length; i++) {\n texttrack_utils_1.clearCurrentCues(textTracks[i]);\n }\n }\n }\n };\n TimelineController.prototype.onManifestLoaded = function (data) {\n var _this = this;\n this.textTracks = [];\n this.unparsedVttFrags = this.unparsedVttFrags || [];\n this.initPTS = [];\n this.cueRanges = [];\n if (this.config.enableWebVTT) {\n this.tracks = data.subtitles || [];\n var inUseTracks_1 = this.media ? this.media.textTracks : [];\n this.tracks.forEach(function (track, index) {\n var textTrack;\n if (index < inUseTracks_1.length) {\n var inUseTrack = [].slice.call(inUseTracks_1).find(function (inUseTrack) { return canReuseVttTextTrack(inUseTrack, track); });\n // Reuse tracks with the same label, but do not reuse 608/708 tracks\n if (inUseTrack) {\n textTrack = inUseTrack;\n }\n }\n if (!textTrack) {\n textTrack = _this.createTextTrack('subtitles', track.name, track.lang);\n }\n if (track.default) {\n textTrack.mode = _this.hls.subtitleDisplay ? 'showing' : 'hidden';\n }\n else {\n textTrack.mode = 'disabled';\n }\n _this.textTracks.push(textTrack);\n });\n }\n };\n TimelineController.prototype.onLevelSwitching = function () {\n this.enabled = this.hls.currentLevel.closedCaptions !== 'NONE';\n };\n TimelineController.prototype.onFragLoaded = function (data) {\n var frag = data.frag, payload = data.payload;\n if (frag.type === 'main') {\n var sn = frag.sn;\n // if this frag isn't contiguous, clear the parser so cues with bad start/end times aren't added to the textTrack\n if (sn !== this.lastSn + 1) {\n var cea608Parser = this.cea608Parser;\n if (cea608Parser) {\n cea608Parser.reset();\n }\n }\n this.lastSn = sn;\n } // eslint-disable-line brace-style\n // If fragment is subtitle type, parse as WebVTT.\n else if (frag.type === 'subtitle') {\n if (payload.byteLength) {\n // We need an initial synchronisation PTS. Store fragments as long as none has arrived.\n if (!Number.isFinite(this.initPTS[frag.cc])) {\n this.unparsedVttFrags.push(data);\n if (this.initPTS.length) {\n // finish unsuccessfully, otherwise the subtitle-stream-controller could be blocked from loading new frags.\n this.hls.trigger(events_1.default.SUBTITLE_FRAG_PROCESSED, { success: false, frag: frag });\n }\n return;\n }\n var decryptData = frag.decryptdata;\n // If the subtitles are not encrypted, parse VTTs now. Otherwise, we need to wait.\n if ((decryptData == null) || (decryptData.key == null) || (decryptData.method !== 'AES-128')) {\n this._parseVTTs(frag, payload);\n }\n }\n else {\n // In case there is no payload, finish unsuccessfully.\n this.hls.trigger(events_1.default.SUBTITLE_FRAG_PROCESSED, { success: false, frag: frag });\n }\n }\n };\n TimelineController.prototype._parseVTTs = function (frag, payload) {\n var vttCCs = this.vttCCs;\n if (!vttCCs[frag.cc]) {\n vttCCs[frag.cc] = { start: frag.start, prevCC: this.prevCC, new: true };\n this.prevCC = frag.cc;\n }\n var textTracks = this.textTracks, hls = this.hls;\n // Parse the WebVTT file contents.\n webvtt_parser_1.default.parse(payload, this.initPTS[frag.cc], vttCCs, frag.cc, function (cues) {\n var currentTrack = textTracks[frag.trackId];\n // WebVTTParser.parse is an async method and if the currently selected text track mode is set to \"disabled\"\n // before parsing is done then don't try to access currentTrack.cues.getCueById as cues will be null\n // and trying to access getCueById method of cues will throw an exception\n if (currentTrack.mode === 'disabled') {\n hls.trigger(events_1.default.SUBTITLE_FRAG_PROCESSED, { success: false, frag: frag });\n return;\n }\n // Add cues and trigger event with success true.\n cues.forEach(function (cue) {\n // Sometimes there are cue overlaps on segmented vtts so the same\n // cue can appear more than once in different vtt files.\n // This avoid showing duplicated cues with same timecode and text.\n if (!currentTrack.cues.getCueById(cue.id)) {\n try {\n currentTrack.addCue(cue);\n }\n catch (err) {\n var textTrackCue = new window.TextTrackCue(cue.startTime, cue.endTime, cue.text);\n textTrackCue.id = cue.id;\n currentTrack.addCue(textTrackCue);\n }\n }\n });\n hls.trigger(events_1.default.SUBTITLE_FRAG_PROCESSED, { success: true, frag: frag });\n }, function (e) {\n // Something went wrong while parsing. Trigger event with success false.\n logger_1.logger.log(\"Failed to parse VTT cue: \" + e);\n hls.trigger(events_1.default.SUBTITLE_FRAG_PROCESSED, { success: false, frag: frag });\n });\n };\n TimelineController.prototype.onFragDecrypted = function (data) {\n var decryptedData = data.payload, frag = data.frag;\n if (frag.type === 'subtitle') {\n if (!Number.isFinite(this.initPTS[frag.cc])) {\n this.unparsedVttFrags.push(data);\n return;\n }\n this._parseVTTs(frag, decryptedData);\n }\n };\n TimelineController.prototype.onFragParsingUserdata = function (data) {\n // push all of the CEA-708 messages into the interpreter\n // immediately. It will create the proper timestamps based on our PTS value\n if (this.enabled && this.config.enableCEA708Captions) {\n for (var i = 0; i < data.samples.length; i++) {\n var ccdatas = this.extractCea608Data(data.samples[i].bytes);\n this.cea608Parser.addData(data.samples[i].pts, ccdatas);\n }\n }\n };\n TimelineController.prototype.extractCea608Data = function (byteArray) {\n var count = byteArray[0] & 31;\n var position = 2;\n var tmpByte, ccbyte1, ccbyte2, ccValid, ccType;\n var actualCCBytes = [];\n for (var j = 0; j < count; j++) {\n tmpByte = byteArray[position++];\n ccbyte1 = 0x7F & byteArray[position++];\n ccbyte2 = 0x7F & byteArray[position++];\n ccValid = (4 & tmpByte) !== 0;\n ccType = 3 & tmpByte;\n if (ccbyte1 === 0 && ccbyte2 === 0) {\n continue;\n }\n if (ccValid) {\n if (ccType === 0) { // || ccType === 1\n actualCCBytes.push(ccbyte1);\n actualCCBytes.push(ccbyte2);\n }\n }\n }\n return actualCCBytes;\n };\n return TimelineController;\n}(event_handler_1.default));\nexports.default = TimelineController;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/crypt/aes-crypto.js\":\n/*!*********************************!*\\\n !*** ./src/crypt/aes-crypto.js ***!\n \\*********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar AESCrypto = /** @class */ (function () {\n function AESCrypto(subtle, iv) {\n this.subtle = subtle;\n this.aesIV = iv;\n }\n AESCrypto.prototype.decrypt = function (data, key) {\n return this.subtle.decrypt({ name: 'AES-CBC', iv: this.aesIV }, key, data);\n };\n return AESCrypto;\n}());\nexports.default = AESCrypto;\n\n\n/***/ }),\n\n/***/ \"./src/crypt/aes-decryptor.js\":\n/*!************************************!*\\\n !*** ./src/crypt/aes-decryptor.js ***!\n \\************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// PKCS7\nfunction removePadding(buffer) {\n var outputBytes = buffer.byteLength;\n var paddingBytes = outputBytes && (new DataView(buffer)).getUint8(outputBytes - 1);\n if (paddingBytes) {\n return buffer.slice(0, outputBytes - paddingBytes);\n }\n else {\n return buffer;\n }\n}\nexports.removePadding = removePadding;\nvar AESDecryptor = /** @class */ (function () {\n function AESDecryptor() {\n // Static after running initTable\n this.rcon = [0x0, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n this.subMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)];\n this.invSubMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)];\n this.sBox = new Uint32Array(256);\n this.invSBox = new Uint32Array(256);\n // Changes during runtime\n this.key = new Uint32Array(0);\n this.initTable();\n }\n // Using view.getUint32() also swaps the byte order.\n AESDecryptor.prototype.uint8ArrayToUint32Array_ = function (arrayBuffer) {\n var view = new DataView(arrayBuffer);\n var newArray = new Uint32Array(4);\n for (var i = 0; i < 4; i++) {\n newArray[i] = view.getUint32(i * 4);\n }\n return newArray;\n };\n AESDecryptor.prototype.initTable = function () {\n var sBox = this.sBox;\n var invSBox = this.invSBox;\n var subMix = this.subMix;\n var subMix0 = subMix[0];\n var subMix1 = subMix[1];\n var subMix2 = subMix[2];\n var subMix3 = subMix[3];\n var invSubMix = this.invSubMix;\n var invSubMix0 = invSubMix[0];\n var invSubMix1 = invSubMix[1];\n var invSubMix2 = invSubMix[2];\n var invSubMix3 = invSubMix[3];\n var d = new Uint32Array(256);\n var x = 0;\n var xi = 0;\n var i = 0;\n for (i = 0; i < 256; i++) {\n if (i < 128) {\n d[i] = i << 1;\n }\n else {\n d[i] = (i << 1) ^ 0x11b;\n }\n }\n for (i = 0; i < 256; i++) {\n var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);\n sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;\n sBox[x] = sx;\n invSBox[sx] = x;\n // Compute multiplication\n var x2 = d[x];\n var x4 = d[x2];\n var x8 = d[x4];\n // Compute sub/invSub bytes, mix columns tables\n var t = (d[sx] * 0x101) ^ (sx * 0x1010100);\n subMix0[x] = (t << 24) | (t >>> 8);\n subMix1[x] = (t << 16) | (t >>> 16);\n subMix2[x] = (t << 8) | (t >>> 24);\n subMix3[x] = t;\n // Compute inv sub bytes, inv mix columns tables\n t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);\n invSubMix0[sx] = (t << 24) | (t >>> 8);\n invSubMix1[sx] = (t << 16) | (t >>> 16);\n invSubMix2[sx] = (t << 8) | (t >>> 24);\n invSubMix3[sx] = t;\n // Compute next counter\n if (!x) {\n x = xi = 1;\n }\n else {\n x = x2 ^ d[d[d[x8 ^ x2]]];\n xi ^= d[d[xi]];\n }\n }\n };\n AESDecryptor.prototype.expandKey = function (keyBuffer) {\n // convert keyBuffer to Uint32Array\n var key = this.uint8ArrayToUint32Array_(keyBuffer);\n var sameKey = true;\n var offset = 0;\n while (offset < key.length && sameKey) {\n sameKey = (key[offset] === this.key[offset]);\n offset++;\n }\n if (sameKey) {\n return;\n }\n this.key = key;\n var keySize = this.keySize = key.length;\n if (keySize !== 4 && keySize !== 6 && keySize !== 8) {\n throw new Error('Invalid aes key size=' + keySize);\n }\n var ksRows = this.ksRows = (keySize + 6 + 1) * 4;\n var ksRow;\n var invKsRow;\n var keySchedule = this.keySchedule = new Uint32Array(ksRows);\n var invKeySchedule = this.invKeySchedule = new Uint32Array(ksRows);\n var sbox = this.sBox;\n var rcon = this.rcon;\n var invSubMix = this.invSubMix;\n var invSubMix0 = invSubMix[0];\n var invSubMix1 = invSubMix[1];\n var invSubMix2 = invSubMix[2];\n var invSubMix3 = invSubMix[3];\n var prev;\n var t;\n for (ksRow = 0; ksRow < ksRows; ksRow++) {\n if (ksRow < keySize) {\n prev = keySchedule[ksRow] = key[ksRow];\n continue;\n }\n t = prev;\n if (ksRow % keySize === 0) {\n // Rot word\n t = (t << 8) | (t >>> 24);\n // Sub word\n t = (sbox[t >>> 24] << 24) | (sbox[(t >>> 16) & 0xff] << 16) | (sbox[(t >>> 8) & 0xff] << 8) | sbox[t & 0xff];\n // Mix Rcon\n t ^= rcon[(ksRow / keySize) | 0] << 24;\n }\n else if (keySize > 6 && ksRow % keySize === 4) {\n // Sub word\n t = (sbox[t >>> 24] << 24) | (sbox[(t >>> 16) & 0xff] << 16) | (sbox[(t >>> 8) & 0xff] << 8) | sbox[t & 0xff];\n }\n keySchedule[ksRow] = prev = (keySchedule[ksRow - keySize] ^ t) >>> 0;\n }\n for (invKsRow = 0; invKsRow < ksRows; invKsRow++) {\n ksRow = ksRows - invKsRow;\n if (invKsRow & 3) {\n t = keySchedule[ksRow];\n }\n else {\n t = keySchedule[ksRow - 4];\n }\n if (invKsRow < 4 || ksRow <= 4) {\n invKeySchedule[invKsRow] = t;\n }\n else {\n invKeySchedule[invKsRow] = invSubMix0[sbox[t >>> 24]] ^ invSubMix1[sbox[(t >>> 16) & 0xff]] ^ invSubMix2[sbox[(t >>> 8) & 0xff]] ^ invSubMix3[sbox[t & 0xff]];\n }\n invKeySchedule[invKsRow] = invKeySchedule[invKsRow] >>> 0;\n }\n };\n // Adding this as a method greatly improves performance.\n AESDecryptor.prototype.networkToHostOrderSwap = function (word) {\n return (word << 24) | ((word & 0xff00) << 8) | ((word & 0xff0000) >> 8) | (word >>> 24);\n };\n AESDecryptor.prototype.decrypt = function (inputArrayBuffer, offset, aesIV, removePKCS7Padding) {\n var nRounds = this.keySize + 6;\n var invKeySchedule = this.invKeySchedule;\n var invSBOX = this.invSBox;\n var invSubMix = this.invSubMix;\n var invSubMix0 = invSubMix[0];\n var invSubMix1 = invSubMix[1];\n var invSubMix2 = invSubMix[2];\n var invSubMix3 = invSubMix[3];\n var initVector = this.uint8ArrayToUint32Array_(aesIV);\n var initVector0 = initVector[0];\n var initVector1 = initVector[1];\n var initVector2 = initVector[2];\n var initVector3 = initVector[3];\n var inputInt32 = new Int32Array(inputArrayBuffer);\n var outputInt32 = new Int32Array(inputInt32.length);\n var t0, t1, t2, t3;\n var s0, s1, s2, s3;\n var inputWords0, inputWords1, inputWords2, inputWords3;\n var ksRow, i;\n var swapWord = this.networkToHostOrderSwap;\n while (offset < inputInt32.length) {\n inputWords0 = swapWord(inputInt32[offset]);\n inputWords1 = swapWord(inputInt32[offset + 1]);\n inputWords2 = swapWord(inputInt32[offset + 2]);\n inputWords3 = swapWord(inputInt32[offset + 3]);\n s0 = inputWords0 ^ invKeySchedule[0];\n s1 = inputWords3 ^ invKeySchedule[1];\n s2 = inputWords2 ^ invKeySchedule[2];\n s3 = inputWords1 ^ invKeySchedule[3];\n ksRow = 4;\n // Iterate through the rounds of decryption\n for (i = 1; i < nRounds; i++) {\n t0 = invSubMix0[s0 >>> 24] ^ invSubMix1[(s1 >> 16) & 0xff] ^ invSubMix2[(s2 >> 8) & 0xff] ^ invSubMix3[s3 & 0xff] ^ invKeySchedule[ksRow];\n t1 = invSubMix0[s1 >>> 24] ^ invSubMix1[(s2 >> 16) & 0xff] ^ invSubMix2[(s3 >> 8) & 0xff] ^ invSubMix3[s0 & 0xff] ^ invKeySchedule[ksRow + 1];\n t2 = invSubMix0[s2 >>> 24] ^ invSubMix1[(s3 >> 16) & 0xff] ^ invSubMix2[(s0 >> 8) & 0xff] ^ invSubMix3[s1 & 0xff] ^ invKeySchedule[ksRow + 2];\n t3 = invSubMix0[s3 >>> 24] ^ invSubMix1[(s0 >> 16) & 0xff] ^ invSubMix2[(s1 >> 8) & 0xff] ^ invSubMix3[s2 & 0xff] ^ invKeySchedule[ksRow + 3];\n // Update state\n s0 = t0;\n s1 = t1;\n s2 = t2;\n s3 = t3;\n ksRow = ksRow + 4;\n }\n // Shift rows, sub bytes, add round key\n t0 = ((invSBOX[s0 >>> 24] << 24) ^ (invSBOX[(s1 >> 16) & 0xff] << 16) ^ (invSBOX[(s2 >> 8) & 0xff] << 8) ^ invSBOX[s3 & 0xff]) ^ invKeySchedule[ksRow];\n t1 = ((invSBOX[s1 >>> 24] << 24) ^ (invSBOX[(s2 >> 16) & 0xff] << 16) ^ (invSBOX[(s3 >> 8) & 0xff] << 8) ^ invSBOX[s0 & 0xff]) ^ invKeySchedule[ksRow + 1];\n t2 = ((invSBOX[s2 >>> 24] << 24) ^ (invSBOX[(s3 >> 16) & 0xff] << 16) ^ (invSBOX[(s0 >> 8) & 0xff] << 8) ^ invSBOX[s1 & 0xff]) ^ invKeySchedule[ksRow + 2];\n t3 = ((invSBOX[s3 >>> 24] << 24) ^ (invSBOX[(s0 >> 16) & 0xff] << 16) ^ (invSBOX[(s1 >> 8) & 0xff] << 8) ^ invSBOX[s2 & 0xff]) ^ invKeySchedule[ksRow + 3];\n ksRow = ksRow + 3;\n // Write\n outputInt32[offset] = swapWord(t0 ^ initVector0);\n outputInt32[offset + 1] = swapWord(t3 ^ initVector1);\n outputInt32[offset + 2] = swapWord(t2 ^ initVector2);\n outputInt32[offset + 3] = swapWord(t1 ^ initVector3);\n // reset initVector to last 4 unsigned int\n initVector0 = inputWords0;\n initVector1 = inputWords1;\n initVector2 = inputWords2;\n initVector3 = inputWords3;\n offset = offset + 4;\n }\n return removePKCS7Padding ? removePadding(outputInt32.buffer) : outputInt32.buffer;\n };\n AESDecryptor.prototype.destroy = function () {\n this.key = undefined;\n this.keySize = undefined;\n this.ksRows = undefined;\n this.sBox = undefined;\n this.invSBox = undefined;\n this.subMix = undefined;\n this.invSubMix = undefined;\n this.keySchedule = undefined;\n this.invKeySchedule = undefined;\n this.rcon = undefined;\n };\n return AESDecryptor;\n}());\nexports.default = AESDecryptor;\n\n\n/***/ }),\n\n/***/ \"./src/crypt/decrypter.js\":\n/*!********************************!*\\\n !*** ./src/crypt/decrypter.js ***!\n \\********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar aes_crypto_1 = __webpack_require__(/*! ./aes-crypto */ \"./src/crypt/aes-crypto.js\");\nvar fast_aes_key_1 = __webpack_require__(/*! ./fast-aes-key */ \"./src/crypt/fast-aes-key.js\");\nvar aes_decryptor_1 = __webpack_require__(/*! ./aes-decryptor */ \"./src/crypt/aes-decryptor.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar get_self_scope_1 = __webpack_require__(/*! ../utils/get-self-scope */ \"./src/utils/get-self-scope.js\");\n// see https://stackoverflow.com/a/11237259/589493\nvar global = get_self_scope_1.getSelfScope(); // safeguard for code that might run both on worker and main thread\nvar Decrypter = /** @class */ (function () {\n function Decrypter(observer, config, _a) {\n var _b = (_a === void 0 ? {} : _a).removePKCS7Padding, removePKCS7Padding = _b === void 0 ? true : _b;\n this.logEnabled = true;\n this.observer = observer;\n this.config = config;\n this.removePKCS7Padding = removePKCS7Padding;\n // built in decryptor expects PKCS7 padding\n if (removePKCS7Padding) {\n try {\n var browserCrypto = global.crypto;\n if (browserCrypto) {\n this.subtle = browserCrypto.subtle || browserCrypto.webkitSubtle;\n }\n }\n catch (e) { }\n }\n this.disableWebCrypto = !this.subtle;\n }\n Decrypter.prototype.isSync = function () {\n return (this.disableWebCrypto && this.config.enableSoftwareAES);\n };\n Decrypter.prototype.decrypt = function (data, key, iv, callback) {\n var _this = this;\n if (this.disableWebCrypto && this.config.enableSoftwareAES) {\n if (this.logEnabled) {\n logger_1.logger.log('JS AES decrypt');\n this.logEnabled = false;\n }\n var decryptor = this.decryptor;\n if (!decryptor) {\n this.decryptor = decryptor = new aes_decryptor_1.default();\n }\n decryptor.expandKey(key);\n callback(decryptor.decrypt(data, 0, iv, this.removePKCS7Padding));\n }\n else {\n if (this.logEnabled) {\n logger_1.logger.log('WebCrypto AES decrypt');\n this.logEnabled = false;\n }\n var subtle_1 = this.subtle;\n if (this.key !== key) {\n this.key = key;\n this.fastAesKey = new fast_aes_key_1.default(subtle_1, key);\n }\n this.fastAesKey.expandKey()\n .then(function (aesKey) {\n // decrypt using web crypto\n var crypto = new aes_crypto_1.default(subtle_1, iv);\n crypto.decrypt(data, aesKey)\n .catch(function (err) {\n _this.onWebCryptoError(err, data, key, iv, callback);\n })\n .then(function (result) {\n callback(result);\n });\n })\n .catch(function (err) {\n _this.onWebCryptoError(err, data, key, iv, callback);\n });\n }\n };\n Decrypter.prototype.onWebCryptoError = function (err, data, key, iv, callback) {\n if (this.config.enableSoftwareAES) {\n logger_1.logger.log('WebCrypto Error, disable WebCrypto API');\n this.disableWebCrypto = true;\n this.logEnabled = true;\n this.decrypt(data, key, iv, callback);\n }\n else {\n logger_1.logger.error(\"decrypting error : \" + err.message);\n this.observer.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MEDIA_ERROR, details: errors_1.ErrorDetails.FRAG_DECRYPT_ERROR, fatal: true, reason: err.message });\n }\n };\n Decrypter.prototype.destroy = function () {\n var decryptor = this.decryptor;\n if (decryptor) {\n decryptor.destroy();\n this.decryptor = undefined;\n }\n };\n return Decrypter;\n}());\nexports.default = Decrypter;\n\n\n/***/ }),\n\n/***/ \"./src/crypt/fast-aes-key.js\":\n/*!***********************************!*\\\n !*** ./src/crypt/fast-aes-key.js ***!\n \\***********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar FastAESKey = /** @class */ (function () {\n function FastAESKey(subtle, key) {\n this.subtle = subtle;\n this.key = key;\n }\n FastAESKey.prototype.expandKey = function () {\n return this.subtle.importKey('raw', this.key, { name: 'AES-CBC' }, false, ['encrypt', 'decrypt']);\n };\n return FastAESKey;\n}());\nexports.default = FastAESKey;\n\n\n/***/ }),\n\n/***/ \"./src/demux/aacdemuxer.js\":\n/*!*********************************!*\\\n !*** ./src/demux/aacdemuxer.js ***!\n \\*********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * AAC demuxer\n */\nvar ADTS = __webpack_require__(/*! ./adts */ \"./src/demux/adts.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar id3_1 = __webpack_require__(/*! ../demux/id3 */ \"./src/demux/id3.js\");\nvar AACDemuxer = /** @class */ (function () {\n function AACDemuxer(observer, remuxer, config) {\n this.observer = observer;\n this.config = config;\n this.remuxer = remuxer;\n }\n AACDemuxer.prototype.resetInitSegment = function (initSegment, audioCodec, videoCodec, duration) {\n this._audioTrack = { container: 'audio/adts', type: 'audio', id: 0, sequenceNumber: 0, isAAC: true, samples: [], len: 0, manifestCodec: audioCodec, duration: duration, inputTimeScale: 90000 };\n };\n AACDemuxer.prototype.resetTimeStamp = function () {\n };\n AACDemuxer.probe = function (data) {\n if (!data) {\n return false;\n }\n // Check for the ADTS sync word\n // Look for ADTS header | 1111 1111 | 1111 X00X | where X can be either 0 or 1\n // Layer bits (position 14 and 15) in header should be always 0 for ADTS\n // More info https://wiki.multimedia.cx/index.php?title=ADTS\n var id3Data = id3_1.default.getID3Data(data, 0) || [];\n var offset = id3Data.length;\n for (var length_1 = data.length; offset < length_1; offset++) {\n if (ADTS.probe(data, offset)) {\n logger_1.logger.log('ADTS sync word found !');\n return true;\n }\n }\n return false;\n };\n // feed incoming data to the front of the parsing pipeline\n AACDemuxer.prototype.append = function (data, timeOffset, contiguous, accurateTimeOffset) {\n var track = this._audioTrack;\n var id3Data = id3_1.default.getID3Data(data, 0) || [];\n var timestamp = id3_1.default.getTimeStamp(id3Data);\n var pts = Number.isFinite(timestamp) ? timestamp * 90 : timeOffset * 90000;\n var frameIndex = 0;\n var stamp = pts;\n var length = data.length;\n var offset = id3Data.length;\n var id3Samples = [{ pts: stamp, dts: stamp, data: id3Data }];\n while (offset < length - 1) {\n if (ADTS.isHeader(data, offset) && (offset + 5) < length) {\n ADTS.initTrackConfig(track, this.observer, data, offset, track.manifestCodec);\n var frame = ADTS.appendFrame(track, data, offset, pts, frameIndex);\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n }\n else {\n logger_1.logger.log('Unable to parse AAC frame');\n break;\n }\n }\n else if (id3_1.default.isHeader(data, offset)) {\n id3Data = id3_1.default.getID3Data(data, offset);\n id3Samples.push({ pts: stamp, dts: stamp, data: id3Data });\n offset += id3Data.length;\n }\n else {\n // nothing found, keep looking\n offset++;\n }\n }\n this.remuxer.remux(track, { samples: [] }, { samples: id3Samples, inputTimeScale: 90000 }, { samples: [] }, timeOffset, contiguous, accurateTimeOffset);\n };\n AACDemuxer.prototype.destroy = function () {\n };\n return AACDemuxer;\n}());\nexports.default = AACDemuxer;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/demux/adts.js\":\n/*!***************************!*\\\n !*** ./src/demux/adts.js ***!\n \\***************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * ADTS parser helper\n */\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nfunction getAudioConfig(observer, data, offset, audioCodec) {\n var adtsObjectType, // :int\n adtsSampleingIndex, // :int\n adtsExtensionSampleingIndex, // :int\n adtsChanelConfig, // :int\n config, userAgent = navigator.userAgent.toLowerCase(), manifestCodec = audioCodec, adtsSampleingRates = [\n 96000, 88200,\n 64000, 48000,\n 44100, 32000,\n 24000, 22050,\n 16000, 12000,\n 11025, 8000,\n 7350\n ];\n // byte 2\n adtsObjectType = ((data[offset + 2] & 0xC0) >>> 6) + 1;\n adtsSampleingIndex = ((data[offset + 2] & 0x3C) >>> 2);\n if (adtsSampleingIndex > adtsSampleingRates.length - 1) {\n observer.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MEDIA_ERROR, details: errors_1.ErrorDetails.FRAG_PARSING_ERROR, fatal: true, reason: \"invalid ADTS sampling index:\" + adtsSampleingIndex });\n return;\n }\n adtsChanelConfig = ((data[offset + 2] & 0x01) << 2);\n // byte 3\n adtsChanelConfig |= ((data[offset + 3] & 0xC0) >>> 6);\n logger_1.logger.log(\"manifest codec:\" + audioCodec + \",ADTS data:type:\" + adtsObjectType + \",sampleingIndex:\" + adtsSampleingIndex + \"[\" + adtsSampleingRates[adtsSampleingIndex] + \"Hz],channelConfig:\" + adtsChanelConfig);\n // firefox: freq less than 24kHz = AAC SBR (HE-AAC)\n if (/firefox/i.test(userAgent)) {\n if (adtsSampleingIndex >= 6) {\n adtsObjectType = 5;\n config = new Array(4);\n // HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies\n // there is a factor 2 between frame sample rate and output sample rate\n // multiply frequency by 2 (see table below, equivalent to substract 3)\n adtsExtensionSampleingIndex = adtsSampleingIndex - 3;\n }\n else {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\n }\n // Android : always use AAC\n }\n else if (userAgent.indexOf('android') !== -1) {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\n }\n else {\n /* for other browsers (Chrome/Vivaldi/Opera ...)\n always force audio type to be HE-AAC SBR, as some browsers do not support audio codec switch properly (like Chrome ...)\n */\n adtsObjectType = 5;\n config = new Array(4);\n // if (manifest codec is HE-AAC or HE-AACv2) OR (manifest codec not specified AND frequency less than 24kHz)\n if ((audioCodec && ((audioCodec.indexOf('mp4a.40.29') !== -1) ||\n (audioCodec.indexOf('mp4a.40.5') !== -1))) ||\n (!audioCodec && adtsSampleingIndex >= 6)) {\n // HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies\n // there is a factor 2 between frame sample rate and output sample rate\n // multiply frequency by 2 (see table below, equivalent to substract 3)\n adtsExtensionSampleingIndex = adtsSampleingIndex - 3;\n }\n else {\n // if (manifest codec is AAC) AND (frequency less than 24kHz AND nb channel is 1) OR (manifest codec not specified and mono audio)\n // Chrome fails to play back with low frequency AAC LC mono when initialized with HE-AAC. This is not a problem with stereo.\n if (audioCodec && audioCodec.indexOf('mp4a.40.2') !== -1 && ((adtsSampleingIndex >= 6 && adtsChanelConfig === 1) ||\n /vivaldi/i.test(userAgent)) ||\n (!audioCodec && adtsChanelConfig === 1)) {\n adtsObjectType = 2;\n config = new Array(2);\n }\n adtsExtensionSampleingIndex = adtsSampleingIndex;\n }\n }\n /* refer to http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio#Audio_Specific_Config\n ISO 14496-3 (AAC).pdf - Table 1.13 — Syntax of AudioSpecificConfig()\n Audio Profile / Audio Object Type\n 0: Null\n 1: AAC Main\n 2: AAC LC (Low Complexity)\n 3: AAC SSR (Scalable Sample Rate)\n 4: AAC LTP (Long Term Prediction)\n 5: SBR (Spectral Band Replication)\n 6: AAC Scalable\n sampling freq\n 0: 96000 Hz\n 1: 88200 Hz\n 2: 64000 Hz\n 3: 48000 Hz\n 4: 44100 Hz\n 5: 32000 Hz\n 6: 24000 Hz\n 7: 22050 Hz\n 8: 16000 Hz\n 9: 12000 Hz\n 10: 11025 Hz\n 11: 8000 Hz\n 12: 7350 Hz\n 13: Reserved\n 14: Reserved\n 15: frequency is written explictly\n Channel Configurations\n These are the channel configurations:\n 0: Defined in AOT Specifc Config\n 1: 1 channel: front-center\n 2: 2 channels: front-left, front-right\n */\n // audioObjectType = profile => profile, the MPEG-4 Audio Object Type minus 1\n config[0] = adtsObjectType << 3;\n // samplingFrequencyIndex\n config[0] |= (adtsSampleingIndex & 0x0E) >> 1;\n config[1] |= (adtsSampleingIndex & 0x01) << 7;\n // channelConfiguration\n config[1] |= adtsChanelConfig << 3;\n if (adtsObjectType === 5) {\n // adtsExtensionSampleingIndex\n config[1] |= (adtsExtensionSampleingIndex & 0x0E) >> 1;\n config[2] = (adtsExtensionSampleingIndex & 0x01) << 7;\n // adtsObjectType (force to 2, chrome is checking that object type is less than 5 ???\n // https://chromium.googlesource.com/chromium/src.git/+/master/media/formats/mp4/aac.cc\n config[2] |= 2 << 2;\n config[3] = 0;\n }\n return { config: config, samplerate: adtsSampleingRates[adtsSampleingIndex], channelCount: adtsChanelConfig, codec: ('mp4a.40.' + adtsObjectType), manifestCodec: manifestCodec };\n}\nexports.getAudioConfig = getAudioConfig;\nfunction isHeaderPattern(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xf6) === 0xf0;\n}\nexports.isHeaderPattern = isHeaderPattern;\nfunction getHeaderLength(data, offset) {\n return (data[offset + 1] & 0x01 ? 7 : 9);\n}\nexports.getHeaderLength = getHeaderLength;\nfunction getFullFrameLength(data, offset) {\n return ((data[offset + 3] & 0x03) << 11) |\n (data[offset + 4] << 3) |\n ((data[offset + 5] & 0xE0) >>> 5);\n}\nexports.getFullFrameLength = getFullFrameLength;\nfunction isHeader(data, offset) {\n // Look for ADTS header | 1111 1111 | 1111 X00X | where X can be either 0 or 1\n // Layer bits (position 14 and 15) in header should be always 0 for ADTS\n // More info https://wiki.multimedia.cx/index.php?title=ADTS\n if (offset + 1 < data.length && isHeaderPattern(data, offset)) {\n return true;\n }\n return false;\n}\nexports.isHeader = isHeader;\nfunction probe(data, offset) {\n // same as isHeader but we also check that ADTS frame follows last ADTS frame\n // or end of data is reached\n if (offset + 1 < data.length && isHeaderPattern(data, offset)) {\n // ADTS header Length\n var headerLength = getHeaderLength(data, offset);\n // ADTS frame Length\n var frameLength = headerLength;\n if (offset + 5 < data.length) {\n frameLength = getFullFrameLength(data, offset);\n }\n var newOffset = offset + frameLength;\n if (newOffset === data.length || (newOffset + 1 < data.length && isHeaderPattern(data, newOffset))) {\n return true;\n }\n }\n return false;\n}\nexports.probe = probe;\nfunction initTrackConfig(track, observer, data, offset, audioCodec) {\n if (!track.samplerate) {\n var config = getAudioConfig(observer, data, offset, audioCodec);\n track.config = config.config;\n track.samplerate = config.samplerate;\n track.channelCount = config.channelCount;\n track.codec = config.codec;\n track.manifestCodec = config.manifestCodec;\n logger_1.logger.log(\"parsed codec:\" + track.codec + \",rate:\" + config.samplerate + \",nb channel:\" + config.channelCount);\n }\n}\nexports.initTrackConfig = initTrackConfig;\nfunction getFrameDuration(samplerate) {\n return 1024 * 90000 / samplerate;\n}\nexports.getFrameDuration = getFrameDuration;\nfunction parseFrameHeader(data, offset, pts, frameIndex, frameDuration) {\n var headerLength, frameLength, stamp;\n var length = data.length;\n // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header\n headerLength = getHeaderLength(data, offset);\n // retrieve frame size\n frameLength = getFullFrameLength(data, offset);\n frameLength -= headerLength;\n if ((frameLength > 0) && ((offset + headerLength + frameLength) <= length)) {\n stamp = pts + frameIndex * frameDuration;\n // logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n return { headerLength: headerLength, frameLength: frameLength, stamp: stamp };\n }\n return undefined;\n}\nexports.parseFrameHeader = parseFrameHeader;\nfunction appendFrame(track, data, offset, pts, frameIndex) {\n var frameDuration = getFrameDuration(track.samplerate);\n var header = parseFrameHeader(data, offset, pts, frameIndex, frameDuration);\n if (header) {\n var stamp = header.stamp;\n var headerLength = header.headerLength;\n var frameLength = header.frameLength;\n // logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n var aacSample = {\n unit: data.subarray(offset + headerLength, offset + headerLength + frameLength),\n pts: stamp,\n dts: stamp\n };\n track.samples.push(aacSample);\n track.len += frameLength;\n return { sample: aacSample, length: frameLength + headerLength };\n }\n return undefined;\n}\nexports.appendFrame = appendFrame;\n\n\n/***/ }),\n\n/***/ \"./src/demux/demuxer-inline.js\":\n/*!*************************************!*\\\n !*** ./src/demux/demuxer-inline.js ***!\n \\*************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n *\n * inline demuxer: probe fragments and instantiate\n * appropriate demuxer depending on content type (TSDemuxer, AACDemuxer, ...)\n *\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar decrypter_1 = __webpack_require__(/*! ../crypt/decrypter */ \"./src/crypt/decrypter.js\");\nvar aacdemuxer_1 = __webpack_require__(/*! ../demux/aacdemuxer */ \"./src/demux/aacdemuxer.js\");\nvar mp4demuxer_1 = __webpack_require__(/*! ../demux/mp4demuxer */ \"./src/demux/mp4demuxer.js\");\nvar tsdemuxer_1 = __webpack_require__(/*! ../demux/tsdemuxer */ \"./src/demux/tsdemuxer.js\");\nvar mp3demuxer_1 = __webpack_require__(/*! ../demux/mp3demuxer */ \"./src/demux/mp3demuxer.js\");\nvar mp4_remuxer_1 = __webpack_require__(/*! ../remux/mp4-remuxer */ \"./src/remux/mp4-remuxer.js\");\nvar passthrough_remuxer_1 = __webpack_require__(/*! ../remux/passthrough-remuxer */ \"./src/remux/passthrough-remuxer.js\");\nvar get_self_scope_1 = __webpack_require__(/*! ../utils/get-self-scope */ \"./src/utils/get-self-scope.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\n// see https://stackoverflow.com/a/11237259/589493\nvar global = get_self_scope_1.getSelfScope(); // safeguard for code that might run both on worker and main thread\nvar now;\n// performance.now() not available on WebWorker, at least on Safari Desktop\ntry {\n now = global.performance.now.bind(global.performance);\n}\ncatch (err) {\n logger_1.logger.debug('Unable to use Performance API on this environment');\n now = global.Date.now;\n}\nvar DemuxerInline = /** @class */ (function () {\n function DemuxerInline(observer, typeSupported, config, vendor) {\n this.observer = observer;\n this.typeSupported = typeSupported;\n this.config = config;\n this.vendor = vendor;\n }\n DemuxerInline.prototype.destroy = function () {\n var demuxer = this.demuxer;\n if (demuxer) {\n demuxer.destroy();\n }\n };\n DemuxerInline.prototype.push = function (data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS) {\n var _this = this;\n if ((data.byteLength > 0) && (decryptdata != null) && (decryptdata.key != null) && (decryptdata.method === 'AES-128')) {\n var decrypter = this.decrypter;\n if (decrypter == null) {\n decrypter = this.decrypter = new decrypter_1.default(this.observer, this.config);\n }\n var startTime_1 = now();\n decrypter.decrypt(data, decryptdata.key.buffer, decryptdata.iv.buffer, function (decryptedData) {\n var endTime = now();\n _this.observer.trigger(events_1.default.FRAG_DECRYPTED, { stats: { tstart: startTime_1, tdecrypt: endTime } });\n _this.pushDecrypted(new Uint8Array(decryptedData), decryptdata, new Uint8Array(initSegment), audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n });\n }\n else {\n this.pushDecrypted(new Uint8Array(data), decryptdata, new Uint8Array(initSegment), audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n }\n };\n DemuxerInline.prototype.pushDecrypted = function (data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS) {\n var demuxer = this.demuxer;\n if (!demuxer ||\n // in case of continuity change, or track switch\n // we might switch from content type (AAC container to TS container, or TS to fmp4 for example)\n // so let's check that current demuxer is still valid\n ((discontinuity || trackSwitch) && !this.probe(data))) {\n var observer = this.observer;\n var typeSupported = this.typeSupported;\n var config = this.config;\n // probing order is TS/AAC/MP3/MP4\n var muxConfig = [\n { demux: tsdemuxer_1.default, remux: mp4_remuxer_1.default },\n { demux: mp4demuxer_1.default, remux: passthrough_remuxer_1.default },\n { demux: aacdemuxer_1.default, remux: mp4_remuxer_1.default },\n { demux: mp3demuxer_1.default, remux: mp4_remuxer_1.default }\n ];\n // probe for content type\n for (var i = 0, len = muxConfig.length; i < len; i++) {\n var mux = muxConfig[i];\n var probe = mux.demux.probe;\n if (probe(data)) {\n var remuxer_1 = this.remuxer = new mux.remux(observer, config, typeSupported, this.vendor);\n demuxer = new mux.demux(observer, remuxer_1, config, typeSupported);\n this.probe = probe;\n break;\n }\n }\n if (!demuxer) {\n observer.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MEDIA_ERROR, details: errors_1.ErrorDetails.FRAG_PARSING_ERROR, fatal: true, reason: 'no demux matching with content found' });\n return;\n }\n this.demuxer = demuxer;\n }\n var remuxer = this.remuxer;\n if (discontinuity || trackSwitch) {\n demuxer.resetInitSegment(initSegment, audioCodec, videoCodec, duration);\n remuxer.resetInitSegment();\n }\n if (discontinuity) {\n demuxer.resetTimeStamp(defaultInitPTS);\n remuxer.resetTimeStamp(defaultInitPTS);\n }\n if (typeof demuxer.setDecryptData === 'function') {\n demuxer.setDecryptData(decryptdata);\n }\n demuxer.append(data, timeOffset, contiguous, accurateTimeOffset);\n };\n return DemuxerInline;\n}());\nexports.default = DemuxerInline;\n\n\n/***/ }),\n\n/***/ \"./src/demux/demuxer-worker.js\":\n/*!*************************************!*\\\n !*** ./src/demux/demuxer-worker.js ***!\n \\*************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/* demuxer web worker.\n * - listen to worker message, and trigger DemuxerInline upon reception of Fragments.\n * - provides MP4 Boxes back to main thread using [transferable objects](https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast) in order to minimize message passing overhead.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar demuxer_inline_1 = __webpack_require__(/*! ../demux/demuxer-inline */ \"./src/demux/demuxer-inline.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar events_2 = __webpack_require__(/*! events */ \"./node_modules/node-libs-browser/node_modules/events/events.js\");\nvar DemuxerWorker = function (self) {\n // observer setup\n var observer = new events_2.EventEmitter();\n observer.trigger = function trigger(event) {\n var data = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n data[_i - 1] = arguments[_i];\n }\n observer.emit.apply(observer, [event, event].concat(data));\n };\n observer.off = function off(event) {\n var data = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n data[_i - 1] = arguments[_i];\n }\n observer.removeListener.apply(observer, [event].concat(data));\n };\n var forwardMessage = function (ev, data) {\n self.postMessage({ event: ev, data: data });\n };\n self.addEventListener('message', function (ev) {\n var data = ev.data;\n // console.log('demuxer cmd:' + data.cmd);\n switch (data.cmd) {\n case 'init':\n var config = JSON.parse(data.config);\n self.demuxer = new demuxer_inline_1.default(observer, data.typeSupported, config, data.vendor);\n logger_1.enableLogs(config.debug);\n // signal end of worker init\n forwardMessage('init', null);\n break;\n case 'demux':\n self.demuxer.push(data.data, data.decryptdata, data.initSegment, data.audioCodec, data.videoCodec, data.timeOffset, data.discontinuity, data.trackSwitch, data.contiguous, data.duration, data.accurateTimeOffset, data.defaultInitPTS);\n break;\n default:\n break;\n }\n });\n // forward events to main thread\n observer.on(events_1.default.FRAG_DECRYPTED, forwardMessage);\n observer.on(events_1.default.FRAG_PARSING_INIT_SEGMENT, forwardMessage);\n observer.on(events_1.default.FRAG_PARSED, forwardMessage);\n observer.on(events_1.default.ERROR, forwardMessage);\n observer.on(events_1.default.FRAG_PARSING_METADATA, forwardMessage);\n observer.on(events_1.default.FRAG_PARSING_USERDATA, forwardMessage);\n observer.on(events_1.default.INIT_PTS_FOUND, forwardMessage);\n // special case for FRAG_PARSING_DATA: pass data1/data2 as transferable object (no copy)\n observer.on(events_1.default.FRAG_PARSING_DATA, function (ev, data) {\n var transferable = [];\n var message = { event: ev, data: data };\n if (data.data1) {\n message.data1 = data.data1.buffer;\n transferable.push(data.data1.buffer);\n delete data.data1;\n }\n if (data.data2) {\n message.data2 = data.data2.buffer;\n transferable.push(data.data2.buffer);\n delete data.data2;\n }\n self.postMessage(message, transferable);\n });\n};\nexports.default = DemuxerWorker;\n\n\n/***/ }),\n\n/***/ \"./src/demux/demuxer.js\":\n/*!******************************!*\\\n !*** ./src/demux/demuxer.js ***!\n \\******************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar work = __webpack_require__(/*! webworkify-webpack */ \"./node_modules/webworkify-webpack/index.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar demuxer_inline_1 = __webpack_require__(/*! ../demux/demuxer-inline */ \"./src/demux/demuxer-inline.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar mediasource_helper_1 = __webpack_require__(/*! ../utils/mediasource-helper */ \"./src/utils/mediasource-helper.js\");\nvar get_self_scope_1 = __webpack_require__(/*! ../utils/get-self-scope */ \"./src/utils/get-self-scope.js\");\nvar observer_1 = __webpack_require__(/*! ../observer */ \"./src/observer.js\");\n// see https://stackoverflow.com/a/11237259/589493\nvar global = get_self_scope_1.getSelfScope(); // safeguard for code that might run both on worker and main thread\nvar MediaSource = mediasource_helper_1.getMediaSource();\nvar Demuxer = /** @class */ (function () {\n function Demuxer(hls, id) {\n var _this = this;\n this.hls = hls;\n this.id = id;\n var observer = this.observer = new observer_1.Observer();\n var config = hls.config;\n var forwardMessage = function (ev, data) {\n data = data || {};\n data.frag = _this.frag;\n data.id = _this.id;\n hls.trigger(ev, data);\n };\n // forward events to main thread\n observer.on(events_1.default.FRAG_DECRYPTED, forwardMessage);\n observer.on(events_1.default.FRAG_PARSING_INIT_SEGMENT, forwardMessage);\n observer.on(events_1.default.FRAG_PARSING_DATA, forwardMessage);\n observer.on(events_1.default.FRAG_PARSED, forwardMessage);\n observer.on(events_1.default.ERROR, forwardMessage);\n observer.on(events_1.default.FRAG_PARSING_METADATA, forwardMessage);\n observer.on(events_1.default.FRAG_PARSING_USERDATA, forwardMessage);\n observer.on(events_1.default.INIT_PTS_FOUND, forwardMessage);\n var typeSupported = {\n mp4: MediaSource.isTypeSupported('video/mp4'),\n mpeg: MediaSource.isTypeSupported('audio/mpeg'),\n mp3: MediaSource.isTypeSupported('audio/mp4; codecs=\"mp3\"')\n };\n // navigator.vendor is not always available in Web Worker\n // refer to https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/navigator\n var vendor = navigator.vendor;\n if (config.enableWorker && (typeof (Worker) !== 'undefined')) {\n logger_1.logger.log('demuxing in webworker');\n var w = void 0;\n try {\n w = this.w = work(/*require.resolve*/(/*! ../demux/demuxer-worker.js */ \"./src/demux/demuxer-worker.js\"));\n this.onwmsg = this.onWorkerMessage.bind(this);\n w.addEventListener('message', this.onwmsg);\n w.onerror = function (event) {\n hls.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.OTHER_ERROR, details: errors_1.ErrorDetails.INTERNAL_EXCEPTION, fatal: true, event: 'demuxerWorker', err: { message: event.message + ' (' + event.filename + ':' + event.lineno + ')' } });\n };\n w.postMessage({ cmd: 'init', typeSupported: typeSupported, vendor: vendor, id: id, config: JSON.stringify(config) });\n }\n catch (err) {\n logger_1.logger.warn('Error in worker:', err);\n logger_1.logger.error('Error while initializing DemuxerWorker, fallback on DemuxerInline');\n if (w) {\n // revoke the Object URL that was used to create demuxer worker, so as not to leak it\n global.URL.revokeObjectURL(w.objectURL);\n }\n this.demuxer = new demuxer_inline_1.default(observer, typeSupported, config, vendor);\n this.w = undefined;\n }\n }\n else {\n this.demuxer = new demuxer_inline_1.default(observer, typeSupported, config, vendor);\n }\n }\n Demuxer.prototype.destroy = function () {\n var w = this.w;\n if (w) {\n w.removeEventListener('message', this.onwmsg);\n w.terminate();\n this.w = null;\n }\n else {\n var demuxer = this.demuxer;\n if (demuxer) {\n demuxer.destroy();\n this.demuxer = null;\n }\n }\n var observer = this.observer;\n if (observer) {\n observer.removeAllListeners();\n this.observer = null;\n }\n };\n Demuxer.prototype.push = function (data, initSegment, audioCodec, videoCodec, frag, duration, accurateTimeOffset, defaultInitPTS) {\n var w = this.w;\n var timeOffset = Number.isFinite(frag.startPTS) ? frag.startPTS : frag.start;\n var decryptdata = frag.decryptdata;\n var lastFrag = this.frag;\n var discontinuity = !(lastFrag && (frag.cc === lastFrag.cc));\n var trackSwitch = !(lastFrag && (frag.level === lastFrag.level));\n var nextSN = lastFrag && (frag.sn === (lastFrag.sn + 1));\n var contiguous = !trackSwitch && nextSN;\n if (discontinuity) {\n logger_1.logger.log(this.id + \":discontinuity detected\");\n }\n if (trackSwitch) {\n logger_1.logger.log(this.id + \":switch detected\");\n }\n this.frag = frag;\n if (w) {\n // post fragment payload as transferable objects for ArrayBuffer (no copy)\n w.postMessage({ cmd: 'demux', data: data, decryptdata: decryptdata, initSegment: initSegment, audioCodec: audioCodec, videoCodec: videoCodec, timeOffset: timeOffset, discontinuity: discontinuity, trackSwitch: trackSwitch, contiguous: contiguous, duration: duration, accurateTimeOffset: accurateTimeOffset, defaultInitPTS: defaultInitPTS }, data instanceof ArrayBuffer ? [data] : []);\n }\n else {\n var demuxer = this.demuxer;\n if (demuxer) {\n demuxer.push(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n }\n }\n };\n Demuxer.prototype.onWorkerMessage = function (ev) {\n var data = ev.data, hls = this.hls;\n switch (data.event) {\n case 'init':\n // revoke the Object URL that was used to create demuxer worker, so as not to leak it\n global.URL.revokeObjectURL(this.w.objectURL);\n break;\n // special case for FRAG_PARSING_DATA: data1 and data2 are transferable objects\n case events_1.default.FRAG_PARSING_DATA:\n data.data.data1 = new Uint8Array(data.data1);\n if (data.data2) {\n data.data.data2 = new Uint8Array(data.data2);\n }\n /* falls through */\n default:\n data.data = data.data || {};\n data.data.frag = this.frag;\n data.data.id = this.id;\n hls.trigger(data.event, data.data);\n break;\n }\n };\n return Demuxer;\n}());\nexports.default = Demuxer;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/demux/exp-golomb.js\":\n/*!*********************************!*\\\n !*** ./src/demux/exp-golomb.js ***!\n \\*********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.\n*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar ExpGolomb = /** @class */ (function () {\n function ExpGolomb(data) {\n this.data = data;\n // the number of bytes left to examine in this.data\n this.bytesAvailable = data.byteLength;\n // the current word being examined\n this.word = 0; // :uint\n // the number of bits left to examine in the current word\n this.bitsAvailable = 0; // :uint\n }\n // ():void\n ExpGolomb.prototype.loadWord = function () {\n var data = this.data, bytesAvailable = this.bytesAvailable, position = data.byteLength - bytesAvailable, workingBytes = new Uint8Array(4), availableBytes = Math.min(4, bytesAvailable);\n if (availableBytes === 0) {\n throw new Error('no bytes available');\n }\n workingBytes.set(data.subarray(position, position + availableBytes));\n this.word = new DataView(workingBytes.buffer).getUint32(0);\n // track the amount of this.data that has been processed\n this.bitsAvailable = availableBytes * 8;\n this.bytesAvailable -= availableBytes;\n };\n // (count:int):void\n ExpGolomb.prototype.skipBits = function (count) {\n var skipBytes; // :int\n if (this.bitsAvailable > count) {\n this.word <<= count;\n this.bitsAvailable -= count;\n }\n else {\n count -= this.bitsAvailable;\n skipBytes = count >> 3;\n count -= (skipBytes >> 3);\n this.bytesAvailable -= skipBytes;\n this.loadWord();\n this.word <<= count;\n this.bitsAvailable -= count;\n }\n };\n // (size:int):uint\n ExpGolomb.prototype.readBits = function (size) {\n var bits = Math.min(this.bitsAvailable, size), // :uint\n valu = this.word >>> (32 - bits); // :uint\n if (size > 32) {\n logger_1.logger.error('Cannot read more than 32 bits at a time');\n }\n this.bitsAvailable -= bits;\n if (this.bitsAvailable > 0) {\n this.word <<= bits;\n }\n else if (this.bytesAvailable > 0) {\n this.loadWord();\n }\n bits = size - bits;\n if (bits > 0 && this.bitsAvailable) {\n return valu << bits | this.readBits(bits);\n }\n else {\n return valu;\n }\n };\n // ():uint\n ExpGolomb.prototype.skipLZ = function () {\n var leadingZeroCount; // :uint\n for (leadingZeroCount = 0; leadingZeroCount < this.bitsAvailable; ++leadingZeroCount) {\n if ((this.word & (0x80000000 >>> leadingZeroCount)) !== 0) {\n // the first bit of working word is 1\n this.word <<= leadingZeroCount;\n this.bitsAvailable -= leadingZeroCount;\n return leadingZeroCount;\n }\n }\n // we exhausted word and still have not found a 1\n this.loadWord();\n return leadingZeroCount + this.skipLZ();\n };\n // ():void\n ExpGolomb.prototype.skipUEG = function () {\n this.skipBits(1 + this.skipLZ());\n };\n // ():void\n ExpGolomb.prototype.skipEG = function () {\n this.skipBits(1 + this.skipLZ());\n };\n // ():uint\n ExpGolomb.prototype.readUEG = function () {\n var clz = this.skipLZ(); // :uint\n return this.readBits(clz + 1) - 1;\n };\n // ():int\n ExpGolomb.prototype.readEG = function () {\n var valu = this.readUEG(); // :int\n if (0x01 & valu) {\n // the number is odd if the low order bit is set\n return (1 + valu) >>> 1; // add 1 to make it even, and divide by 2\n }\n else {\n return -1 * (valu >>> 1); // divide by two then make it negative\n }\n };\n // Some convenience functions\n // :Boolean\n ExpGolomb.prototype.readBoolean = function () {\n return this.readBits(1) === 1;\n };\n // ():int\n ExpGolomb.prototype.readUByte = function () {\n return this.readBits(8);\n };\n // ():int\n ExpGolomb.prototype.readUShort = function () {\n return this.readBits(16);\n };\n // ():int\n ExpGolomb.prototype.readUInt = function () {\n return this.readBits(32);\n };\n /**\n * Advance the ExpGolomb decoder past a scaling list. The scaling\n * list is optionally transmitted as part of a sequence parameter\n * set and is not relevant to transmuxing.\n * @param count {number} the number of entries in this scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */\n ExpGolomb.prototype.skipScalingList = function (count) {\n var lastScale = 8, nextScale = 8, j, deltaScale;\n for (j = 0; j < count; j++) {\n if (nextScale !== 0) {\n deltaScale = this.readEG();\n nextScale = (lastScale + deltaScale + 256) % 256;\n }\n lastScale = (nextScale === 0) ? lastScale : nextScale;\n }\n };\n /**\n * Read a sequence parameter set and return some interesting video\n * properties. A sequence parameter set is the H264 metadata that\n * describes the properties of upcoming video frames.\n * @param data {Uint8Array} the bytes of a sequence parameter set\n * @return {object} an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */\n ExpGolomb.prototype.readSPS = function () {\n var frameCropLeftOffset = 0, frameCropRightOffset = 0, frameCropTopOffset = 0, frameCropBottomOffset = 0, profileIdc, profileCompat, levelIdc, numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1, picHeightInMapUnitsMinus1, frameMbsOnlyFlag, scalingListCount, i, readUByte = this.readUByte.bind(this), readBits = this.readBits.bind(this), readUEG = this.readUEG.bind(this), readBoolean = this.readBoolean.bind(this), skipBits = this.skipBits.bind(this), skipEG = this.skipEG.bind(this), skipUEG = this.skipUEG.bind(this), skipScalingList = this.skipScalingList.bind(this);\n readUByte();\n profileIdc = readUByte(); // profile_idc\n profileCompat = readBits(5); // constraint_set[0-4]_flag, u(5)\n skipBits(3); // reserved_zero_3bits u(3),\n levelIdc = readUByte(); // level_idc u(8)\n skipUEG(); // seq_parameter_set_id\n // some profiles have more optional data we don't need\n if (profileIdc === 100 ||\n profileIdc === 110 ||\n profileIdc === 122 ||\n profileIdc === 244 ||\n profileIdc === 44 ||\n profileIdc === 83 ||\n profileIdc === 86 ||\n profileIdc === 118 ||\n profileIdc === 128) {\n var chromaFormatIdc = readUEG();\n if (chromaFormatIdc === 3) {\n skipBits(1);\n } // separate_colour_plane_flag\n skipUEG(); // bit_depth_luma_minus8\n skipUEG(); // bit_depth_chroma_minus8\n skipBits(1); // qpprime_y_zero_transform_bypass_flag\n if (readBoolean()) { // seq_scaling_matrix_present_flag\n scalingListCount = (chromaFormatIdc !== 3) ? 8 : 12;\n for (i = 0; i < scalingListCount; i++) {\n if (readBoolean()) { // seq_scaling_list_present_flag[ i ]\n if (i < 6) {\n skipScalingList(16);\n }\n else {\n skipScalingList(64);\n }\n }\n }\n }\n }\n skipUEG(); // log2_max_frame_num_minus4\n var picOrderCntType = readUEG();\n if (picOrderCntType === 0) {\n readUEG(); // log2_max_pic_order_cnt_lsb_minus4\n }\n else if (picOrderCntType === 1) {\n skipBits(1); // delta_pic_order_always_zero_flag\n skipEG(); // offset_for_non_ref_pic\n skipEG(); // offset_for_top_to_bottom_field\n numRefFramesInPicOrderCntCycle = readUEG();\n for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) {\n skipEG();\n } // offset_for_ref_frame[ i ]\n }\n skipUEG(); // max_num_ref_frames\n skipBits(1); // gaps_in_frame_num_value_allowed_flag\n picWidthInMbsMinus1 = readUEG();\n picHeightInMapUnitsMinus1 = readUEG();\n frameMbsOnlyFlag = readBits(1);\n if (frameMbsOnlyFlag === 0) {\n skipBits(1);\n } // mb_adaptive_frame_field_flag\n skipBits(1); // direct_8x8_inference_flag\n if (readBoolean()) { // frame_cropping_flag\n frameCropLeftOffset = readUEG();\n frameCropRightOffset = readUEG();\n frameCropTopOffset = readUEG();\n frameCropBottomOffset = readUEG();\n }\n var pixelRatio = [1, 1];\n if (readBoolean()) {\n // vui_parameters_present_flag\n if (readBoolean()) {\n // aspect_ratio_info_present_flag\n var aspectRatioIdc = readUByte();\n switch (aspectRatioIdc) {\n case 1:\n pixelRatio = [1, 1];\n break;\n case 2:\n pixelRatio = [12, 11];\n break;\n case 3:\n pixelRatio = [10, 11];\n break;\n case 4:\n pixelRatio = [16, 11];\n break;\n case 5:\n pixelRatio = [40, 33];\n break;\n case 6:\n pixelRatio = [24, 11];\n break;\n case 7:\n pixelRatio = [20, 11];\n break;\n case 8:\n pixelRatio = [32, 11];\n break;\n case 9:\n pixelRatio = [80, 33];\n break;\n case 10:\n pixelRatio = [18, 11];\n break;\n case 11:\n pixelRatio = [15, 11];\n break;\n case 12:\n pixelRatio = [64, 33];\n break;\n case 13:\n pixelRatio = [160, 99];\n break;\n case 14:\n pixelRatio = [4, 3];\n break;\n case 15:\n pixelRatio = [3, 2];\n break;\n case 16:\n pixelRatio = [2, 1];\n break;\n case 255: {\n pixelRatio = [readUByte() << 8 | readUByte(), readUByte() << 8 | readUByte()];\n break;\n }\n }\n }\n }\n return {\n width: Math.ceil((((picWidthInMbsMinus1 + 1) * 16) - frameCropLeftOffset * 2 - frameCropRightOffset * 2)),\n height: ((2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16) - ((frameMbsOnlyFlag ? 2 : 4) * (frameCropTopOffset + frameCropBottomOffset)),\n pixelRatio: pixelRatio\n };\n };\n ExpGolomb.prototype.readSliceType = function () {\n // skip NALu type\n this.readUByte();\n // discard first_mb_in_slice\n this.readUEG();\n // return slice_type\n return this.readUEG();\n };\n return ExpGolomb;\n}());\nexports.default = ExpGolomb;\n\n\n/***/ }),\n\n/***/ \"./src/demux/id3.js\":\n/*!**************************!*\\\n !*** ./src/demux/id3.js ***!\n \\**************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * ID3 parser\n */\nvar ID3 = /** @class */ (function () {\n function ID3() {\n }\n /**\n * Returns true if an ID3 header can be found at offset in data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {boolean} - True if an ID3 header is found\n */\n ID3.isHeader = function (data, offset) {\n /*\n * http://id3.org/id3v2.3.0\n * [0] = 'I'\n * [1] = 'D'\n * [2] = '3'\n * [3,4] = {Version}\n * [5] = {Flags}\n * [6-9] = {ID3 Size}\n *\n * An ID3v2 tag can be detected with the following pattern:\n * $49 44 33 yy yy xx zz zz zz zz\n * Where yy is less than $FF, xx is the 'flags' byte and zz is less than $80\n */\n if (offset + 10 <= data.length) {\n // look for 'ID3' identifier\n if (data[offset] === 0x49 && data[offset + 1] === 0x44 && data[offset + 2] === 0x33) {\n // check version is within range\n if (data[offset + 3] < 0xFF && data[offset + 4] < 0xFF) {\n // check size is within range\n if (data[offset + 6] < 0x80 && data[offset + 7] < 0x80 && data[offset + 8] < 0x80 && data[offset + 9] < 0x80) {\n return true;\n }\n }\n }\n }\n return false;\n };\n /**\n * Returns true if an ID3 footer can be found at offset in data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {boolean} - True if an ID3 footer is found\n */\n ID3.isFooter = function (data, offset) {\n /*\n * The footer is a copy of the header, but with a different identifier\n */\n if (offset + 10 <= data.length) {\n // look for '3DI' identifier\n if (data[offset] === 0x33 && data[offset + 1] === 0x44 && data[offset + 2] === 0x49) {\n // check version is within range\n if (data[offset + 3] < 0xFF && data[offset + 4] < 0xFF) {\n // check size is within range\n if (data[offset + 6] < 0x80 && data[offset + 7] < 0x80 && data[offset + 8] < 0x80 && data[offset + 9] < 0x80) {\n return true;\n }\n }\n }\n }\n return false;\n };\n /**\n * Returns any adjacent ID3 tags found in data starting at offset, as one block of data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {Uint8Array} - The block of data containing any ID3 tags found\n */\n ID3.getID3Data = function (data, offset) {\n var front = offset;\n var length = 0;\n while (ID3.isHeader(data, offset)) {\n // ID3 header is 10 bytes\n length += 10;\n var size = ID3._readSize(data, offset + 6);\n length += size;\n if (ID3.isFooter(data, offset + 10)) {\n // ID3 footer is 10 bytes\n length += 10;\n }\n offset += length;\n }\n if (length > 0) {\n return data.subarray(front, front + length);\n }\n return undefined;\n };\n ID3._readSize = function (data, offset) {\n var size = 0;\n size = ((data[offset] & 0x7f) << 21);\n size |= ((data[offset + 1] & 0x7f) << 14);\n size |= ((data[offset + 2] & 0x7f) << 7);\n size |= (data[offset + 3] & 0x7f);\n return size;\n };\n /**\n * Searches for the Elementary Stream timestamp found in the ID3 data chunk\n * @param {Uint8Array} data - Block of data containing one or more ID3 tags\n * @return {number} - The timestamp\n */\n ID3.getTimeStamp = function (data) {\n var frames = ID3.getID3Frames(data);\n for (var i = 0; i < frames.length; i++) {\n var frame = frames[i];\n if (ID3.isTimeStampFrame(frame)) {\n return ID3._readTimeStamp(frame);\n }\n }\n return undefined;\n };\n /**\n * Returns true if the ID3 frame is an Elementary Stream timestamp frame\n * @param {ID3 frame} frame\n */\n ID3.isTimeStampFrame = function (frame) {\n return (frame && frame.key === 'PRIV' && frame.info === 'com.apple.streaming.transportStreamTimestamp');\n };\n ID3._getFrameData = function (data) {\n /*\n Frame ID $xx xx xx xx (four characters)\n Size $xx xx xx xx\n Flags $xx xx\n */\n var type = String.fromCharCode(data[0], data[1], data[2], data[3]);\n var size = ID3._readSize(data, 4);\n // skip frame id, size, and flags\n var offset = 10;\n return { type: type, size: size, data: data.subarray(offset, offset + size) };\n };\n /**\n * Returns an array of ID3 frames found in all the ID3 tags in the id3Data\n * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags\n * @return {ID3 frame[]} - Array of ID3 frame objects\n */\n ID3.getID3Frames = function (id3Data) {\n var offset = 0;\n var frames = [];\n while (ID3.isHeader(id3Data, offset)) {\n var size = ID3._readSize(id3Data, offset + 6);\n // skip past ID3 header\n offset += 10;\n var end = offset + size;\n // loop through frames in the ID3 tag\n while (offset + 8 < end) {\n var frameData = ID3._getFrameData(id3Data.subarray(offset));\n var frame = ID3._decodeFrame(frameData);\n if (frame) {\n frames.push(frame);\n }\n // skip frame header and frame data\n offset += frameData.size + 10;\n }\n if (ID3.isFooter(id3Data, offset)) {\n offset += 10;\n }\n }\n return frames;\n };\n ID3._decodeFrame = function (frame) {\n if (frame.type === 'PRIV') {\n return ID3._decodePrivFrame(frame);\n }\n else if (frame.type[0] === 'T') {\n return ID3._decodeTextFrame(frame);\n }\n else if (frame.type[0] === 'W') {\n return ID3._decodeURLFrame(frame);\n }\n return undefined;\n };\n ID3._readTimeStamp = function (timeStampFrame) {\n if (timeStampFrame.data.byteLength === 8) {\n var data = new Uint8Array(timeStampFrame.data);\n // timestamp is 33 bit expressed as a big-endian eight-octet number,\n // with the upper 31 bits set to zero.\n var pts33Bit = data[3] & 0x1;\n var timestamp = (data[4] << 23) +\n (data[5] << 15) +\n (data[6] << 7) +\n data[7];\n timestamp /= 45;\n if (pts33Bit) {\n timestamp += 47721858.84;\n } // 2^32 / 90\n return Math.round(timestamp);\n }\n return undefined;\n };\n ID3._decodePrivFrame = function (frame) {\n /*\n Format: \\0\n */\n if (frame.size < 2) {\n return undefined;\n }\n var owner = ID3._utf8ArrayToStr(frame.data, true);\n var privateData = new Uint8Array(frame.data.subarray(owner.length + 1));\n return { key: frame.type, info: owner, data: privateData.buffer };\n };\n ID3._decodeTextFrame = function (frame) {\n if (frame.size < 2) {\n return undefined;\n }\n if (frame.type === 'TXXX') {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Description}\\0{Value}\n */\n var index = 1;\n var description = ID3._utf8ArrayToStr(frame.data.subarray(index));\n index += description.length + 1;\n var value = ID3._utf8ArrayToStr(frame.data.subarray(index));\n return { key: frame.type, info: description, data: value };\n }\n else {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Value}\n */\n var text = ID3._utf8ArrayToStr(frame.data.subarray(1));\n return { key: frame.type, data: text };\n }\n };\n ID3._decodeURLFrame = function (frame) {\n if (frame.type === 'WXXX') {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Description}\\0{URL}\n */\n if (frame.size < 2) {\n return undefined;\n }\n var index = 1;\n var description = ID3._utf8ArrayToStr(frame.data.subarray(index));\n index += description.length + 1;\n var value = ID3._utf8ArrayToStr(frame.data.subarray(index));\n return { key: frame.type, info: description, data: value };\n }\n else {\n /*\n Format:\n [0-?] = {URL}\n */\n var url = ID3._utf8ArrayToStr(frame.data);\n return { key: frame.type, data: url };\n }\n };\n // http://stackoverflow.com/questions/8936984/uint8array-to-string-in-javascript/22373197\n // http://www.onicos.com/staff/iz/amuse/javascript/expert/utf.txt\n /* utf.js - UTF-8 <=> UTF-16 convertion\n *\n * Copyright (C) 1999 Masanao Izumo \n * Version: 1.0\n * LastModified: Dec 25 1999\n * This library is free. You can redistribute it and/or modify it.\n */\n ID3._utf8ArrayToStr = function (array, exitOnNull) {\n if (exitOnNull === void 0) { exitOnNull = false; }\n var len = array.length;\n var c;\n var char2;\n var char3;\n var out = '';\n var i = 0;\n while (i < len) {\n c = array[i++];\n if (c === 0x00 && exitOnNull) {\n return out;\n }\n else if (c === 0x00 || c === 0x03) {\n // If the character is 3 (END_OF_TEXT) or 0 (NULL) then skip it\n continue;\n }\n switch (c >> 4) {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c);\n break;\n case 12:\n case 13:\n // 110x xxxx 10xx xxxx\n char2 = array[i++];\n out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));\n break;\n case 14:\n // 1110 xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++];\n char3 = array[i++];\n out += String.fromCharCode(((c & 0x0F) << 12) |\n ((char2 & 0x3F) << 6) |\n ((char3 & 0x3F) << 0));\n break;\n default:\n }\n }\n return out;\n };\n return ID3;\n}());\nvar utf8ArrayToStr = ID3._utf8ArrayToStr;\nexports.utf8ArrayToStr = utf8ArrayToStr;\nexports.default = ID3;\n\n\n/***/ }),\n\n/***/ \"./src/demux/mp3demuxer.js\":\n/*!*********************************!*\\\n !*** ./src/demux/mp3demuxer.js ***!\n \\*********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * MP3 demuxer\n */\nvar id3_1 = __webpack_require__(/*! ../demux/id3 */ \"./src/demux/id3.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar mpegaudio_1 = __webpack_require__(/*! ./mpegaudio */ \"./src/demux/mpegaudio.js\");\nvar MP3Demuxer = /** @class */ (function () {\n function MP3Demuxer(observer, remuxer, config) {\n this.observer = observer;\n this.config = config;\n this.remuxer = remuxer;\n }\n MP3Demuxer.prototype.resetInitSegment = function (initSegment, audioCodec, videoCodec, duration) {\n this._audioTrack = { container: 'audio/mpeg', type: 'audio', id: -1, sequenceNumber: 0, isAAC: false, samples: [], len: 0, manifestCodec: audioCodec, duration: duration, inputTimeScale: 90000 };\n };\n MP3Demuxer.prototype.resetTimeStamp = function () {\n };\n MP3Demuxer.probe = function (data) {\n // check if data contains ID3 timestamp and MPEG sync word\n var offset, length;\n var id3Data = id3_1.default.getID3Data(data, 0);\n if (id3Data && id3_1.default.getTimeStamp(id3Data) !== undefined) {\n // Look for MPEG header | 1111 1111 | 111X XYZX | where X can be either 0 or 1 and Y or Z should be 1\n // Layer bits (position 14 and 15) in header should be always different from 0 (Layer I or Layer II or Layer III)\n // More info http://www.mp3-tech.org/programmer/frame_header.html\n for (offset = id3Data.length, length = Math.min(data.length - 1, offset + 100); offset < length; offset++) {\n if (mpegaudio_1.default.probe(data, offset)) {\n logger_1.logger.log('MPEG Audio sync word found !');\n return true;\n }\n }\n }\n return false;\n };\n // feed incoming data to the front of the parsing pipeline\n MP3Demuxer.prototype.append = function (data, timeOffset, contiguous, accurateTimeOffset) {\n var id3Data = id3_1.default.getID3Data(data, 0);\n var timestamp = id3_1.default.getTimeStamp(id3Data);\n var pts = timestamp ? 90 * timestamp : timeOffset * 90000;\n var offset = id3Data.length;\n var length = data.length;\n var frameIndex = 0, stamp = 0;\n var track = this._audioTrack;\n var id3Samples = [{ pts: pts, dts: pts, data: id3Data }];\n while (offset < length) {\n if (mpegaudio_1.default.isHeader(data, offset)) {\n var frame = mpegaudio_1.default.appendFrame(track, data, offset, pts, frameIndex);\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n }\n else {\n // logger.log('Unable to parse Mpeg audio frame');\n break;\n }\n }\n else if (id3_1.default.isHeader(data, offset)) {\n id3Data = id3_1.default.getID3Data(data, offset);\n id3Samples.push({ pts: stamp, dts: stamp, data: id3Data });\n offset += id3Data.length;\n }\n else {\n // nothing found, keep looking\n offset++;\n }\n }\n this.remuxer.remux(track, { samples: [] }, { samples: id3Samples, inputTimeScale: 90000 }, { samples: [] }, timeOffset, contiguous, accurateTimeOffset);\n };\n MP3Demuxer.prototype.destroy = function () {\n };\n return MP3Demuxer;\n}());\nexports.default = MP3Demuxer;\n\n\n/***/ }),\n\n/***/ \"./src/demux/mp4demuxer.js\":\n/*!*********************************!*\\\n !*** ./src/demux/mp4demuxer.js ***!\n \\*********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * MP4 demuxer\n */\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar UINT32_MAX = Math.pow(2, 32) - 1;\nvar MP4Demuxer = /** @class */ (function () {\n function MP4Demuxer(observer, remuxer) {\n this.observer = observer;\n this.remuxer = remuxer;\n }\n MP4Demuxer.prototype.resetTimeStamp = function (initPTS) {\n this.initPTS = initPTS;\n };\n MP4Demuxer.prototype.resetInitSegment = function (initSegment, audioCodec, videoCodec, duration) {\n // jshint unused:false\n if (initSegment && initSegment.byteLength) {\n var initData = this.initData = MP4Demuxer.parseInitSegment(initSegment);\n // default audio codec if nothing specified\n // TODO : extract that from initsegment\n if (audioCodec == null) {\n audioCodec = 'mp4a.40.5';\n }\n if (videoCodec == null) {\n videoCodec = 'avc1.42e01e';\n }\n var tracks = {};\n if (initData.audio && initData.video) {\n tracks.audiovideo = { container: 'video/mp4', codec: audioCodec + ',' + videoCodec, initSegment: duration ? initSegment : null };\n }\n else {\n if (initData.audio) {\n tracks.audio = { container: 'audio/mp4', codec: audioCodec, initSegment: duration ? initSegment : null };\n }\n if (initData.video) {\n tracks.video = { container: 'video/mp4', codec: videoCodec, initSegment: duration ? initSegment : null };\n }\n }\n this.observer.trigger(events_1.default.FRAG_PARSING_INIT_SEGMENT, { tracks: tracks });\n }\n else {\n if (audioCodec) {\n this.audioCodec = audioCodec;\n }\n if (videoCodec) {\n this.videoCodec = videoCodec;\n }\n }\n };\n MP4Demuxer.probe = function (data) {\n // ensure we find a moof box in the first 16 kB\n return MP4Demuxer.findBox({ data: data, start: 0, end: Math.min(data.length, 16384) }, ['moof']).length > 0;\n };\n MP4Demuxer.bin2str = function (buffer) {\n return String.fromCharCode.apply(null, buffer);\n };\n MP4Demuxer.readUint16 = function (buffer, offset) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n var val = buffer[offset] << 8 |\n buffer[offset + 1];\n return val < 0 ? 65536 + val : val;\n };\n MP4Demuxer.readUint32 = function (buffer, offset) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n var val = buffer[offset] << 24 |\n buffer[offset + 1] << 16 |\n buffer[offset + 2] << 8 |\n buffer[offset + 3];\n return val < 0 ? 4294967296 + val : val;\n };\n MP4Demuxer.writeUint32 = function (buffer, offset, value) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n buffer[offset] = value >> 24;\n buffer[offset + 1] = (value >> 16) & 0xff;\n buffer[offset + 2] = (value >> 8) & 0xff;\n buffer[offset + 3] = value & 0xff;\n };\n // Find the data for a box specified by its path\n MP4Demuxer.findBox = function (data, path) {\n var results = [], i, size, type, end, subresults, start, endbox;\n if (data.data) {\n start = data.start;\n end = data.end;\n data = data.data;\n }\n else {\n start = 0;\n end = data.byteLength;\n }\n if (!path.length) {\n // short-circuit the search for empty paths\n return null;\n }\n for (i = start; i < end;) {\n size = MP4Demuxer.readUint32(data, i);\n type = MP4Demuxer.bin2str(data.subarray(i + 4, i + 8));\n endbox = size > 1 ? i + size : end;\n if (type === path[0]) {\n if (path.length === 1) {\n // this is the end of the path and we've found the box we were\n // looking for\n results.push({ data: data, start: i + 8, end: endbox });\n }\n else {\n // recursively search for the next box along the path\n subresults = MP4Demuxer.findBox({ data: data, start: i + 8, end: endbox }, path.slice(1));\n if (subresults.length) {\n results = results.concat(subresults);\n }\n }\n }\n i = endbox;\n }\n // we've finished searching all of data\n return results;\n };\n MP4Demuxer.parseSegmentIndex = function (initSegment) {\n var moov = MP4Demuxer.findBox(initSegment, ['moov'])[0];\n var moovEndOffset = moov ? moov.end : null; // we need this in case we need to chop of garbage of the end of current data\n var index = 0;\n var sidx = MP4Demuxer.findBox(initSegment, ['sidx']);\n var references;\n if (!sidx || !sidx[0]) {\n return null;\n }\n references = [];\n sidx = sidx[0];\n var version = sidx.data[0];\n // set initial offset, we skip the reference ID (not needed)\n index = version === 0 ? 8 : 16;\n var timescale = MP4Demuxer.readUint32(sidx, index);\n index += 4;\n // TODO: parse earliestPresentationTime and firstOffset\n // usually zero in our case\n var earliestPresentationTime = 0;\n var firstOffset = 0;\n if (version === 0) {\n index += 8;\n }\n else {\n index += 16;\n }\n // skip reserved\n index += 2;\n var startByte = sidx.end + firstOffset;\n var referencesCount = MP4Demuxer.readUint16(sidx, index);\n index += 2;\n for (var i = 0; i < referencesCount; i++) {\n var referenceIndex = index;\n var referenceInfo = MP4Demuxer.readUint32(sidx, referenceIndex);\n referenceIndex += 4;\n var referenceSize = referenceInfo & 0x7FFFFFFF;\n var referenceType = (referenceInfo & 0x80000000) >>> 31;\n if (referenceType === 1) {\n console.warn('SIDX has hierarchical references (not supported)');\n return;\n }\n var subsegmentDuration = MP4Demuxer.readUint32(sidx, referenceIndex);\n referenceIndex += 4;\n references.push({\n referenceSize: referenceSize,\n subsegmentDuration: subsegmentDuration,\n info: {\n duration: subsegmentDuration / timescale,\n start: startByte,\n end: startByte + referenceSize - 1\n }\n });\n startByte += referenceSize;\n // Skipping 1 bit for |startsWithSap|, 3 bits for |sapType|, and 28 bits\n // for |sapDelta|.\n referenceIndex += 4;\n // skip to next ref\n index = referenceIndex;\n }\n return {\n earliestPresentationTime: earliestPresentationTime,\n timescale: timescale,\n version: version,\n referencesCount: referencesCount,\n references: references,\n moovEndOffset: moovEndOffset\n };\n };\n /**\n * Parses an MP4 initialization segment and extracts stream type and\n * timescale values for any declared tracks. Timescale values indicate the\n * number of clock ticks per second to assume for time-based values\n * elsewhere in the MP4.\n *\n * To determine the start time of an MP4, you need two pieces of\n * information: the timescale unit and the earliest base media decode\n * time. Multiple timescales can be specified within an MP4 but the\n * base media decode time is always expressed in the timescale from\n * the media header box for the track:\n * ```\n * moov > trak > mdia > mdhd.timescale\n * moov > trak > mdia > hdlr\n * ```\n * @param init {Uint8Array} the bytes of the init segment\n * @return {object} a hash of track type to timescale values or null if\n * the init segment is malformed.\n */\n MP4Demuxer.parseInitSegment = function (initSegment) {\n var result = [];\n var traks = MP4Demuxer.findBox(initSegment, ['moov', 'trak']);\n traks.forEach(function (trak) {\n var tkhd = MP4Demuxer.findBox(trak, ['tkhd'])[0];\n if (tkhd) {\n var version = tkhd.data[tkhd.start];\n var index = version === 0 ? 12 : 20;\n var trackId = MP4Demuxer.readUint32(tkhd, index);\n var mdhd = MP4Demuxer.findBox(trak, ['mdia', 'mdhd'])[0];\n if (mdhd) {\n version = mdhd.data[mdhd.start];\n index = version === 0 ? 12 : 20;\n var timescale = MP4Demuxer.readUint32(mdhd, index);\n var hdlr = MP4Demuxer.findBox(trak, ['mdia', 'hdlr'])[0];\n if (hdlr) {\n var hdlrType = MP4Demuxer.bin2str(hdlr.data.subarray(hdlr.start + 8, hdlr.start + 12));\n var type = { 'soun': 'audio', 'vide': 'video' }[hdlrType];\n if (type) {\n // extract codec info. TODO : parse codec details to be able to build MIME type\n var codecBox = MP4Demuxer.findBox(trak, ['mdia', 'minf', 'stbl', 'stsd']);\n if (codecBox.length) {\n codecBox = codecBox[0];\n var codecType = MP4Demuxer.bin2str(codecBox.data.subarray(codecBox.start + 12, codecBox.start + 16));\n logger_1.logger.log(\"MP4Demuxer:\" + type + \":\" + codecType + \" found\");\n }\n result[trackId] = { timescale: timescale, type: type };\n result[type] = { timescale: timescale, id: trackId };\n }\n }\n }\n }\n });\n return result;\n };\n /**\n * Determine the base media decode start time, in seconds, for an MP4\n * fragment. If multiple fragments are specified, the earliest time is\n * returned.\n *\n * The base media decode time can be parsed from track fragment\n * metadata:\n * ```\n * moof > traf > tfdt.baseMediaDecodeTime\n * ```\n * It requires the timescale value from the mdhd to interpret.\n *\n * @param timescale {object} a hash of track ids to timescale values.\n * @return {number} the earliest base media decode start time for the\n * fragment, in seconds\n */\n MP4Demuxer.getStartDTS = function (initData, fragment) {\n var trafs, baseTimes, result;\n // we need info from two childrend of each track fragment box\n trafs = MP4Demuxer.findBox(fragment, ['moof', 'traf']);\n // determine the start times for each track\n baseTimes = [].concat.apply([], trafs.map(function (traf) {\n return MP4Demuxer.findBox(traf, ['tfhd']).map(function (tfhd) {\n var id, scale, baseTime;\n // get the track id from the tfhd\n id = MP4Demuxer.readUint32(tfhd, 4);\n // assume a 90kHz clock if no timescale was specified\n scale = initData[id].timescale || 90e3;\n // get the base media decode time from the tfdt\n baseTime = MP4Demuxer.findBox(traf, ['tfdt']).map(function (tfdt) {\n var version, result;\n version = tfdt.data[tfdt.start];\n result = MP4Demuxer.readUint32(tfdt, 4);\n if (version === 1) {\n result *= Math.pow(2, 32);\n result += MP4Demuxer.readUint32(tfdt, 8);\n }\n return result;\n })[0];\n // convert base time to seconds\n return baseTime / scale;\n });\n }));\n // return the minimum\n result = Math.min.apply(null, baseTimes);\n return isFinite(result) ? result : 0;\n };\n MP4Demuxer.offsetStartDTS = function (initData, fragment, timeOffset) {\n MP4Demuxer.findBox(fragment, ['moof', 'traf']).map(function (traf) {\n return MP4Demuxer.findBox(traf, ['tfhd']).map(function (tfhd) {\n // get the track id from the tfhd\n var id = MP4Demuxer.readUint32(tfhd, 4);\n // assume a 90kHz clock if no timescale was specified\n var timescale = initData[id].timescale || 90e3;\n // get the base media decode time from the tfdt\n MP4Demuxer.findBox(traf, ['tfdt']).map(function (tfdt) {\n var version = tfdt.data[tfdt.start];\n var baseMediaDecodeTime = MP4Demuxer.readUint32(tfdt, 4);\n if (version === 0) {\n MP4Demuxer.writeUint32(tfdt, 4, baseMediaDecodeTime - timeOffset * timescale);\n }\n else {\n baseMediaDecodeTime *= Math.pow(2, 32);\n baseMediaDecodeTime += MP4Demuxer.readUint32(tfdt, 8);\n baseMediaDecodeTime -= timeOffset * timescale;\n baseMediaDecodeTime = Math.max(baseMediaDecodeTime, 0);\n var upper = Math.floor(baseMediaDecodeTime / (UINT32_MAX + 1));\n var lower = Math.floor(baseMediaDecodeTime % (UINT32_MAX + 1));\n MP4Demuxer.writeUint32(tfdt, 4, upper);\n MP4Demuxer.writeUint32(tfdt, 8, lower);\n }\n });\n });\n });\n };\n // feed incoming data to the front of the parsing pipeline\n MP4Demuxer.prototype.append = function (data, timeOffset, contiguous, accurateTimeOffset) {\n var initData = this.initData;\n if (!initData) {\n this.resetInitSegment(data, this.audioCodec, this.videoCodec, false);\n initData = this.initData;\n }\n var startDTS, initPTS = this.initPTS;\n if (initPTS === undefined) {\n var startDTS_1 = MP4Demuxer.getStartDTS(initData, data);\n this.initPTS = initPTS = startDTS_1 - timeOffset;\n this.observer.trigger(events_1.default.INIT_PTS_FOUND, { initPTS: initPTS });\n }\n MP4Demuxer.offsetStartDTS(initData, data, initPTS);\n startDTS = MP4Demuxer.getStartDTS(initData, data);\n this.remuxer.remux(initData.audio, initData.video, null, null, startDTS, contiguous, accurateTimeOffset, data);\n };\n MP4Demuxer.prototype.destroy = function () { };\n return MP4Demuxer;\n}());\nexports.default = MP4Demuxer;\n\n\n/***/ }),\n\n/***/ \"./src/demux/mpegaudio.js\":\n/*!********************************!*\\\n !*** ./src/demux/mpegaudio.js ***!\n \\********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * MPEG parser helper\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar MpegAudio = {\n BitratesMap: [\n 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,\n 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,\n 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,\n 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,\n 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160\n ],\n SamplingRateMap: [44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000],\n SamplesCoefficients: [\n // MPEG 2.5\n [\n 0,\n 72,\n 144,\n 12 // Layer1\n ],\n // Reserved\n [\n 0,\n 0,\n 0,\n 0 // Layer1\n ],\n // MPEG 2\n [\n 0,\n 72,\n 144,\n 12 // Layer1\n ],\n // MPEG 1\n [\n 0,\n 144,\n 144,\n 12 // Layer1\n ]\n ],\n BytesInSlot: [\n 0,\n 1,\n 1,\n 4 // Layer1\n ],\n appendFrame: function (track, data, offset, pts, frameIndex) {\n // Using http://www.datavoyage.com/mpgscript/mpeghdr.htm as a reference\n if (offset + 24 > data.length) {\n return undefined;\n }\n var header = this.parseHeader(data, offset);\n if (header && offset + header.frameLength <= data.length) {\n var frameDuration = header.samplesPerFrame * 90000 / header.sampleRate;\n var stamp = pts + frameIndex * frameDuration;\n var sample = { unit: data.subarray(offset, offset + header.frameLength), pts: stamp, dts: stamp };\n track.config = [];\n track.channelCount = header.channelCount;\n track.samplerate = header.sampleRate;\n track.samples.push(sample);\n track.len += header.frameLength;\n return { sample: sample, length: header.frameLength };\n }\n return undefined;\n },\n parseHeader: function (data, offset) {\n var headerB = (data[offset + 1] >> 3) & 3;\n var headerC = (data[offset + 1] >> 1) & 3;\n var headerE = (data[offset + 2] >> 4) & 15;\n var headerF = (data[offset + 2] >> 2) & 3;\n var headerG = (data[offset + 2] >> 1) & 1;\n if (headerB !== 1 && headerE !== 0 && headerE !== 15 && headerF !== 3) {\n var columnInBitrates = headerB === 3 ? (3 - headerC) : (headerC === 3 ? 3 : 4);\n var bitRate = MpegAudio.BitratesMap[columnInBitrates * 14 + headerE - 1] * 1000;\n var columnInSampleRates = headerB === 3 ? 0 : headerB === 2 ? 1 : 2;\n var sampleRate = MpegAudio.SamplingRateMap[columnInSampleRates * 3 + headerF];\n var channelCount = data[offset + 3] >> 6 === 3 ? 1 : 2; // If bits of channel mode are `11` then it is a single channel (Mono)\n var sampleCoefficient = MpegAudio.SamplesCoefficients[headerB][headerC];\n var bytesInSlot = MpegAudio.BytesInSlot[headerC];\n var samplesPerFrame = sampleCoefficient * 8 * bytesInSlot;\n var frameLength = parseInt(sampleCoefficient * bitRate / sampleRate + headerG, 10) * bytesInSlot;\n return { sampleRate: sampleRate, channelCount: channelCount, frameLength: frameLength, samplesPerFrame: samplesPerFrame };\n }\n return undefined;\n },\n isHeaderPattern: function (data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xe0) === 0xe0 && (data[offset + 1] & 0x06) !== 0x00;\n },\n isHeader: function (data, offset) {\n // Look for MPEG header | 1111 1111 | 111X XYZX | where X can be either 0 or 1 and Y or Z should be 1\n // Layer bits (position 14 and 15) in header should be always different from 0 (Layer I or Layer II or Layer III)\n // More info http://www.mp3-tech.org/programmer/frame_header.html\n if (offset + 1 < data.length && this.isHeaderPattern(data, offset)) {\n return true;\n }\n return false;\n },\n probe: function (data, offset) {\n // same as isHeader but we also check that MPEG frame follows last MPEG frame\n // or end of data is reached\n if (offset + 1 < data.length && this.isHeaderPattern(data, offset)) {\n // MPEG header Length\n var headerLength = 4;\n // MPEG frame Length\n var header = this.parseHeader(data, offset);\n var frameLength = headerLength;\n if (header && header.frameLength) {\n frameLength = header.frameLength;\n }\n var newOffset = offset + frameLength;\n if (newOffset === data.length || (newOffset + 1 < data.length && this.isHeaderPattern(data, newOffset))) {\n return true;\n }\n }\n return false;\n }\n};\nexports.default = MpegAudio;\n\n\n/***/ }),\n\n/***/ \"./src/demux/sample-aes.js\":\n/*!*********************************!*\\\n !*** ./src/demux/sample-aes.js ***!\n \\*********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * SAMPLE-AES decrypter\n*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar decrypter_1 = __webpack_require__(/*! ../crypt/decrypter */ \"./src/crypt/decrypter.js\");\nvar SampleAesDecrypter = /** @class */ (function () {\n function SampleAesDecrypter(observer, config, decryptdata, discardEPB) {\n this.decryptdata = decryptdata;\n this.discardEPB = discardEPB;\n this.decrypter = new decrypter_1.default(observer, config, { removePKCS7Padding: false });\n }\n SampleAesDecrypter.prototype.decryptBuffer = function (encryptedData, callback) {\n this.decrypter.decrypt(encryptedData, this.decryptdata.key.buffer, this.decryptdata.iv.buffer, callback);\n };\n // AAC - encrypt all full 16 bytes blocks starting from offset 16\n SampleAesDecrypter.prototype.decryptAacSample = function (samples, sampleIndex, callback, sync) {\n var curUnit = samples[sampleIndex].unit;\n var encryptedData = curUnit.subarray(16, curUnit.length - curUnit.length % 16);\n var encryptedBuffer = encryptedData.buffer.slice(encryptedData.byteOffset, encryptedData.byteOffset + encryptedData.length);\n var localthis = this;\n this.decryptBuffer(encryptedBuffer, function (decryptedData) {\n decryptedData = new Uint8Array(decryptedData);\n curUnit.set(decryptedData, 16);\n if (!sync) {\n localthis.decryptAacSamples(samples, sampleIndex + 1, callback);\n }\n });\n };\n SampleAesDecrypter.prototype.decryptAacSamples = function (samples, sampleIndex, callback) {\n for (;; sampleIndex++) {\n if (sampleIndex >= samples.length) {\n callback();\n return;\n }\n if (samples[sampleIndex].unit.length < 32) {\n continue;\n }\n var sync = this.decrypter.isSync();\n this.decryptAacSample(samples, sampleIndex, callback, sync);\n if (!sync) {\n return;\n }\n }\n };\n // AVC - encrypt one 16 bytes block out of ten, starting from offset 32\n SampleAesDecrypter.prototype.getAvcEncryptedData = function (decodedData) {\n var encryptedDataLen = Math.floor((decodedData.length - 48) / 160) * 16 + 16;\n var encryptedData = new Int8Array(encryptedDataLen);\n var outputPos = 0;\n for (var inputPos = 32; inputPos <= decodedData.length - 16; inputPos += 160, outputPos += 16) {\n encryptedData.set(decodedData.subarray(inputPos, inputPos + 16), outputPos);\n }\n return encryptedData;\n };\n SampleAesDecrypter.prototype.getAvcDecryptedUnit = function (decodedData, decryptedData) {\n decryptedData = new Uint8Array(decryptedData);\n var inputPos = 0;\n for (var outputPos = 32; outputPos <= decodedData.length - 16; outputPos += 160, inputPos += 16) {\n decodedData.set(decryptedData.subarray(inputPos, inputPos + 16), outputPos);\n }\n return decodedData;\n };\n SampleAesDecrypter.prototype.decryptAvcSample = function (samples, sampleIndex, unitIndex, callback, curUnit, sync) {\n var decodedData = this.discardEPB(curUnit.data);\n var encryptedData = this.getAvcEncryptedData(decodedData);\n var localthis = this;\n this.decryptBuffer(encryptedData.buffer, function (decryptedData) {\n curUnit.data = localthis.getAvcDecryptedUnit(decodedData, decryptedData);\n if (!sync) {\n localthis.decryptAvcSamples(samples, sampleIndex, unitIndex + 1, callback);\n }\n });\n };\n SampleAesDecrypter.prototype.decryptAvcSamples = function (samples, sampleIndex, unitIndex, callback) {\n for (;; sampleIndex++, unitIndex = 0) {\n if (sampleIndex >= samples.length) {\n callback();\n return;\n }\n var curUnits = samples[sampleIndex].units;\n for (;; unitIndex++) {\n if (unitIndex >= curUnits.length) {\n break;\n }\n var curUnit = curUnits[unitIndex];\n if (curUnit.length <= 48 || (curUnit.type !== 1 && curUnit.type !== 5)) {\n continue;\n }\n var sync = this.decrypter.isSync();\n this.decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit, sync);\n if (!sync) {\n return;\n }\n }\n }\n };\n return SampleAesDecrypter;\n}());\nexports.default = SampleAesDecrypter;\n\n\n/***/ }),\n\n/***/ \"./src/demux/tsdemuxer.js\":\n/*!********************************!*\\\n !*** ./src/demux/tsdemuxer.js ***!\n \\********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * highly optimized TS demuxer:\n * parse PAT, PMT\n * extract PES packet from audio and video PIDs\n * extract AVC/H264 NAL units and AAC/ADTS samples from PES packet\n * trigger the remuxer upon parsing completion\n * it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart the MediaSource.\n * it also controls the remuxing process :\n * upon discontinuity or level switch detection, it will also notifies the remuxer so that it can reset its state.\n*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ADTS = __webpack_require__(/*! ./adts */ \"./src/demux/adts.js\");\nvar mpegaudio_1 = __webpack_require__(/*! ./mpegaudio */ \"./src/demux/mpegaudio.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar exp_golomb_1 = __webpack_require__(/*! ./exp-golomb */ \"./src/demux/exp-golomb.js\");\nvar sample_aes_1 = __webpack_require__(/*! ./sample-aes */ \"./src/demux/sample-aes.js\");\n// import Hex from '../utils/hex';\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\n// We are using fixed track IDs for driving the MP4 remuxer\n// instead of following the TS PIDs.\n// There is no reason not to do this and some browsers/SourceBuffer-demuxers\n// may not like if there are TrackID \"switches\"\n// See https://github.com/video-dev/hls.js/issues/1331\n// Here we are mapping our internal track types to constant MP4 track IDs\n// With MSE currently one can only have one track of each, and we are muxing\n// whatever video/audio rendition in them.\nvar RemuxerTrackIdConfig = {\n video: 1,\n audio: 2,\n id3: 3,\n text: 4\n};\nvar TSDemuxer = /** @class */ (function () {\n function TSDemuxer(observer, remuxer, config, typeSupported) {\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n this.remuxer = remuxer;\n this.sampleAes = null;\n }\n TSDemuxer.prototype.setDecryptData = function (decryptdata) {\n if ((decryptdata != null) && (decryptdata.key != null) && (decryptdata.method === 'SAMPLE-AES')) {\n this.sampleAes = new sample_aes_1.default(this.observer, this.config, decryptdata, this.discardEPB);\n }\n else {\n this.sampleAes = null;\n }\n };\n TSDemuxer.probe = function (data) {\n var syncOffset = TSDemuxer._syncOffset(data);\n if (syncOffset < 0) {\n return false;\n }\n else {\n if (syncOffset) {\n logger_1.logger.warn(\"MPEG2-TS detected but first sync word found @ offset \" + syncOffset + \", junk ahead ?\");\n }\n return true;\n }\n };\n TSDemuxer._syncOffset = function (data) {\n // scan 1000 first bytes\n var scanwindow = Math.min(1000, data.length - 3 * 188);\n var i = 0;\n while (i < scanwindow) {\n // a TS fragment should contain at least 3 TS packets, a PAT, a PMT, and one PID, each starting with 0x47\n if (data[i] === 0x47 && data[i + 188] === 0x47 && data[i + 2 * 188] === 0x47) {\n return i;\n }\n else {\n i++;\n }\n }\n return -1;\n };\n /**\n * Creates a track model internal to demuxer used to drive remuxing input\n *\n * @param {string} type 'audio' | 'video' | 'id3' | 'text'\n * @param {number} duration\n * @return {object} TSDemuxer's internal track model\n */\n TSDemuxer.createTrack = function (type, duration) {\n return {\n container: type === 'video' || type === 'audio' ? 'video/mp2t' : undefined,\n type: type,\n id: RemuxerTrackIdConfig[type],\n pid: -1,\n inputTimeScale: 90000,\n sequenceNumber: 0,\n samples: [],\n len: 0,\n dropped: type === 'video' ? 0 : undefined,\n isAAC: type === 'audio' ? true : undefined,\n duration: type === 'audio' ? duration : undefined\n };\n };\n /**\n * Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)\n * Resets all internal track instances of the demuxer.\n *\n * @override Implements generic demuxing/remuxing interface (see DemuxerInline)\n * @param {object} initSegment\n * @param {string} audioCodec\n * @param {string} videoCodec\n * @param {number} duration (in TS timescale = 90kHz)\n */\n TSDemuxer.prototype.resetInitSegment = function (initSegment, audioCodec, videoCodec, duration) {\n this.pmtParsed = false;\n this._pmtId = -1;\n this._avcTrack = TSDemuxer.createTrack('video', duration);\n this._audioTrack = TSDemuxer.createTrack('audio', duration);\n this._id3Track = TSDemuxer.createTrack('id3', duration);\n this._txtTrack = TSDemuxer.createTrack('text', duration);\n // flush any partial content\n this.aacOverFlow = null;\n this.aacLastPTS = null;\n this.avcSample = null;\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this._duration = duration;\n };\n /**\n *\n * @override\n */\n TSDemuxer.prototype.resetTimeStamp = function () { };\n // feed incoming data to the front of the parsing pipeline\n TSDemuxer.prototype.append = function (data, timeOffset, contiguous, accurateTimeOffset) {\n var start, len = data.length, stt, pid, atf, offset, pes, unknownPIDs = false;\n this.contiguous = contiguous;\n var pmtParsed = this.pmtParsed, avcTrack = this._avcTrack, audioTrack = this._audioTrack, id3Track = this._id3Track, avcId = avcTrack.pid, audioId = audioTrack.pid, id3Id = id3Track.pid, pmtId = this._pmtId, avcData = avcTrack.pesData, audioData = audioTrack.pesData, id3Data = id3Track.pesData, parsePAT = this._parsePAT, parsePMT = this._parsePMT, parsePES = this._parsePES, parseAVCPES = this._parseAVCPES.bind(this), parseAACPES = this._parseAACPES.bind(this), parseMPEGPES = this._parseMPEGPES.bind(this), parseID3PES = this._parseID3PES.bind(this);\n var syncOffset = TSDemuxer._syncOffset(data);\n // don't parse last TS packet if incomplete\n len -= (len + syncOffset) % 188;\n // loop through TS packets\n for (start = syncOffset; start < len; start += 188) {\n if (data[start] === 0x47) {\n stt = !!(data[start + 1] & 0x40);\n // pid is a 13-bit field starting at the last bit of TS[1]\n pid = ((data[start + 1] & 0x1f) << 8) + data[start + 2];\n atf = (data[start + 3] & 0x30) >> 4;\n // if an adaption field is present, its length is specified by the fifth byte of the TS packet header.\n if (atf > 1) {\n offset = start + 5 + data[start + 4];\n // continue if there is only adaptation field\n if (offset === (start + 188)) {\n continue;\n }\n }\n else {\n offset = start + 4;\n }\n switch (pid) {\n case avcId:\n if (stt) {\n if (avcData && (pes = parsePES(avcData)) && pes.pts !== undefined) {\n parseAVCPES(pes, false);\n }\n avcData = { data: [], size: 0 };\n }\n if (avcData) {\n avcData.data.push(data.subarray(offset, start + 188));\n avcData.size += start + 188 - offset;\n }\n break;\n case audioId:\n if (stt) {\n if (audioData && (pes = parsePES(audioData)) && pes.pts !== undefined) {\n if (audioTrack.isAAC) {\n parseAACPES(pes);\n }\n else {\n parseMPEGPES(pes);\n }\n }\n audioData = { data: [], size: 0 };\n }\n if (audioData) {\n audioData.data.push(data.subarray(offset, start + 188));\n audioData.size += start + 188 - offset;\n }\n break;\n case id3Id:\n if (stt) {\n if (id3Data && (pes = parsePES(id3Data)) && pes.pts !== undefined) {\n parseID3PES(pes);\n }\n id3Data = { data: [], size: 0 };\n }\n if (id3Data) {\n id3Data.data.push(data.subarray(offset, start + 188));\n id3Data.size += start + 188 - offset;\n }\n break;\n case 0:\n if (stt) {\n offset += data[offset] + 1;\n }\n pmtId = this._pmtId = parsePAT(data, offset);\n break;\n case pmtId:\n if (stt) {\n offset += data[offset] + 1;\n }\n var parsedPIDs = parsePMT(data, offset, this.typeSupported.mpeg === true || this.typeSupported.mp3 === true, this.sampleAes != null);\n // only update track id if track PID found while parsing PMT\n // this is to avoid resetting the PID to -1 in case\n // track PID transiently disappears from the stream\n // this could happen in case of transient missing audio samples for example\n // NOTE this is only the PID of the track as found in TS,\n // but we are not using this for MP4 track IDs.\n avcId = parsedPIDs.avc;\n if (avcId > 0) {\n avcTrack.pid = avcId;\n }\n audioId = parsedPIDs.audio;\n if (audioId > 0) {\n audioTrack.pid = audioId;\n audioTrack.isAAC = parsedPIDs.isAAC;\n }\n id3Id = parsedPIDs.id3;\n if (id3Id > 0) {\n id3Track.pid = id3Id;\n }\n if (unknownPIDs && !pmtParsed) {\n logger_1.logger.log('reparse from beginning');\n unknownPIDs = false;\n // we set it to -188, the += 188 in the for loop will reset start to 0\n start = syncOffset - 188;\n }\n pmtParsed = this.pmtParsed = true;\n break;\n case 17:\n case 0x1fff:\n break;\n default:\n unknownPIDs = true;\n break;\n }\n }\n else {\n this.observer.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MEDIA_ERROR, details: errors_1.ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'TS packet did not start with 0x47' });\n }\n }\n // try to parse last PES packets\n if (avcData && (pes = parsePES(avcData)) && pes.pts !== undefined) {\n parseAVCPES(pes, true);\n avcTrack.pesData = null;\n }\n else {\n // either avcData null or PES truncated, keep it for next frag parsing\n avcTrack.pesData = avcData;\n }\n if (audioData && (pes = parsePES(audioData)) && pes.pts !== undefined) {\n if (audioTrack.isAAC) {\n parseAACPES(pes);\n }\n else {\n parseMPEGPES(pes);\n }\n audioTrack.pesData = null;\n }\n else {\n if (audioData && audioData.size) {\n logger_1.logger.log('last AAC PES packet truncated,might overlap between fragments');\n }\n // either audioData null or PES truncated, keep it for next frag parsing\n audioTrack.pesData = audioData;\n }\n if (id3Data && (pes = parsePES(id3Data)) && pes.pts !== undefined) {\n parseID3PES(pes);\n id3Track.pesData = null;\n }\n else {\n // either id3Data null or PES truncated, keep it for next frag parsing\n id3Track.pesData = id3Data;\n }\n if (this.sampleAes == null) {\n this.remuxer.remux(audioTrack, avcTrack, id3Track, this._txtTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n else {\n this.decryptAndRemux(audioTrack, avcTrack, id3Track, this._txtTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n TSDemuxer.prototype.decryptAndRemux = function (audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n if (audioTrack.samples && audioTrack.isAAC) {\n var localthis_1 = this;\n this.sampleAes.decryptAacSamples(audioTrack.samples, 0, function () {\n localthis_1.decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n });\n }\n else {\n this.decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n TSDemuxer.prototype.decryptAndRemuxAvc = function (audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n if (videoTrack.samples) {\n var localthis_2 = this;\n this.sampleAes.decryptAvcSamples(videoTrack.samples, 0, 0, function () {\n localthis_2.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n });\n }\n else {\n this.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n TSDemuxer.prototype.destroy = function () {\n this._initPTS = this._initDTS = undefined;\n this._duration = 0;\n };\n TSDemuxer.prototype._parsePAT = function (data, offset) {\n // skip the PSI header and parse the first PMT entry\n return (data[offset + 10] & 0x1F) << 8 | data[offset + 11];\n // logger.log('PMT PID:' + this._pmtId);\n };\n TSDemuxer.prototype._parsePMT = function (data, offset, mpegSupported, isSampleAes) {\n var sectionLength, tableEnd, programInfoLength, pid, result = { audio: -1, avc: -1, id3: -1, isAAC: true };\n sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];\n tableEnd = offset + 3 + sectionLength - 4;\n // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n programInfoLength = (data[offset + 10] & 0x0f) << 8 | data[offset + 11];\n // advance the offset to the first entry in the mapping table\n offset += 12 + programInfoLength;\n while (offset < tableEnd) {\n pid = (data[offset + 1] & 0x1F) << 8 | data[offset + 2];\n switch (data[offset]) {\n case 0xcf: // SAMPLE-AES AAC\n if (!isSampleAes) {\n logger_1.logger.log('unkown stream type:' + data[offset]);\n break;\n }\n /* falls through */\n // ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio)\n case 0x0f:\n // logger.log('AAC PID:' + pid);\n if (result.audio === -1) {\n result.audio = pid;\n }\n break;\n // Packetized metadata (ID3)\n case 0x15:\n // logger.log('ID3 PID:' + pid);\n if (result.id3 === -1) {\n result.id3 = pid;\n }\n break;\n case 0xdb: // SAMPLE-AES AVC\n if (!isSampleAes) {\n logger_1.logger.log('unkown stream type:' + data[offset]);\n break;\n }\n /* falls through */\n // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)\n case 0x1b:\n // logger.log('AVC PID:' + pid);\n if (result.avc === -1) {\n result.avc = pid;\n }\n break;\n // ISO/IEC 11172-3 (MPEG-1 audio)\n // or ISO/IEC 13818-3 (MPEG-2 halved sample rate audio)\n case 0x03:\n case 0x04:\n // logger.log('MPEG PID:' + pid);\n if (!mpegSupported) {\n logger_1.logger.log('MPEG audio found, not supported in this browser for now');\n }\n else if (result.audio === -1) {\n result.audio = pid;\n result.isAAC = false;\n }\n break;\n case 0x24:\n logger_1.logger.warn('HEVC stream type found, not supported for now');\n break;\n default:\n logger_1.logger.log('unkown stream type:' + data[offset]);\n break;\n }\n // move to the next table entry\n // skip past the elementary stream descriptors, if present\n offset += ((data[offset + 3] & 0x0F) << 8 | data[offset + 4]) + 5;\n }\n return result;\n };\n TSDemuxer.prototype._parsePES = function (stream) {\n var i = 0, frag, pesFlags, pesPrefix, pesLen, pesHdrLen, pesData, pesPts, pesDts, payloadStartOffset, data = stream.data;\n // safety check\n if (!stream || stream.size === 0) {\n return null;\n }\n // we might need up to 19 bytes to read PES header\n // if first chunk of data is less than 19 bytes, let's merge it with following ones until we get 19 bytes\n // usually only one merge is needed (and this is rare ...)\n while (data[0].length < 19 && data.length > 1) {\n var newData = new Uint8Array(data[0].length + data[1].length);\n newData.set(data[0]);\n newData.set(data[1], data[0].length);\n data[0] = newData;\n data.splice(1, 1);\n }\n // retrieve PTS/DTS from first fragment\n frag = data[0];\n pesPrefix = (frag[0] << 16) + (frag[1] << 8) + frag[2];\n if (pesPrefix === 1) {\n pesLen = (frag[4] << 8) + frag[5];\n // if PES parsed length is not zero and greater than total received length, stop parsing. PES might be truncated\n // minus 6 : PES header size\n if (pesLen && pesLen > stream.size - 6) {\n return null;\n }\n pesFlags = frag[7];\n if (pesFlags & 0xC0) {\n /* PES header described here : http://dvd.sourceforge.net/dvdinfo/pes-hdr.html\n as PTS / DTS is 33 bit we cannot use bitwise operator in JS,\n as Bitwise operators treat their operands as a sequence of 32 bits */\n pesPts = (frag[9] & 0x0E) * 536870912 + // 1 << 29\n (frag[10] & 0xFF) * 4194304 + // 1 << 22\n (frag[11] & 0xFE) * 16384 + // 1 << 14\n (frag[12] & 0xFF) * 128 + // 1 << 7\n (frag[13] & 0xFE) / 2;\n // check if greater than 2^32 -1\n if (pesPts > 4294967295) {\n // decrement 2^33\n pesPts -= 8589934592;\n }\n if (pesFlags & 0x40) {\n pesDts = (frag[14] & 0x0E) * 536870912 + // 1 << 29\n (frag[15] & 0xFF) * 4194304 + // 1 << 22\n (frag[16] & 0xFE) * 16384 + // 1 << 14\n (frag[17] & 0xFF) * 128 + // 1 << 7\n (frag[18] & 0xFE) / 2;\n // check if greater than 2^32 -1\n if (pesDts > 4294967295) {\n // decrement 2^33\n pesDts -= 8589934592;\n }\n if (pesPts - pesDts > 60 * 90000) {\n logger_1.logger.warn(Math.round((pesPts - pesDts) / 90000) + \"s delta between PTS and DTS, align them\");\n pesPts = pesDts;\n }\n }\n else {\n pesDts = pesPts;\n }\n }\n pesHdrLen = frag[8];\n // 9 bytes : 6 bytes for PES header + 3 bytes for PES extension\n payloadStartOffset = pesHdrLen + 9;\n stream.size -= payloadStartOffset;\n // reassemble PES packet\n pesData = new Uint8Array(stream.size);\n for (var j = 0, dataLen = data.length; j < dataLen; j++) {\n frag = data[j];\n var len = frag.byteLength;\n if (payloadStartOffset) {\n if (payloadStartOffset > len) {\n // trim full frag if PES header bigger than frag\n payloadStartOffset -= len;\n continue;\n }\n else {\n // trim partial frag if PES header smaller than frag\n frag = frag.subarray(payloadStartOffset);\n len -= payloadStartOffset;\n payloadStartOffset = 0;\n }\n }\n pesData.set(frag, i);\n i += len;\n }\n if (pesLen) {\n // payload size : remove PES header + PES extension\n pesLen -= pesHdrLen + 3;\n }\n return { data: pesData, pts: pesPts, dts: pesDts, len: pesLen };\n }\n else {\n return null;\n }\n };\n TSDemuxer.prototype.pushAccesUnit = function (avcSample, avcTrack) {\n if (avcSample.units.length && avcSample.frame) {\n var samples = avcTrack.samples;\n var nbSamples = samples.length;\n // only push AVC sample if starting with a keyframe is not mandatory OR\n // if keyframe already found in this fragment OR\n // keyframe found in last fragment (track.sps) AND\n // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous\n if (!this.config.forceKeyFrameOnDiscontinuity ||\n avcSample.key === true ||\n (avcTrack.sps && (nbSamples || this.contiguous))) {\n avcSample.id = nbSamples;\n samples.push(avcSample);\n }\n else {\n // dropped samples, track it\n avcTrack.dropped++;\n }\n }\n if (avcSample.debug.length) {\n logger_1.logger.log(avcSample.pts + '/' + avcSample.dts + ':' + avcSample.debug);\n }\n };\n TSDemuxer.prototype._parseAVCPES = function (pes, last) {\n var _this = this;\n // logger.log('parse new PES');\n var track = this._avcTrack, units = this._parseAVCNALu(pes.data), debug = false, expGolombDecoder, avcSample = this.avcSample, push, spsfound = false, i, pushAccesUnit = this.pushAccesUnit.bind(this), createAVCSample = function (key, pts, dts, debug) {\n return { key: key, pts: pts, dts: dts, units: [], debug: debug };\n };\n // free pes.data to save up some memory\n pes.data = null;\n // if new NAL units found and last sample still there, let's push ...\n // this helps parsing streams with missing AUD (only do this if AUD never found)\n if (avcSample && units.length && !track.audFound) {\n pushAccesUnit(avcSample, track);\n avcSample = this.avcSample = createAVCSample(false, pes.pts, pes.dts, '');\n }\n units.forEach(function (unit) {\n switch (unit.type) {\n // NDR\n case 1:\n push = true;\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n if (debug) {\n avcSample.debug += 'NDR ';\n }\n avcSample.frame = true;\n var data = unit.data;\n // only check slice type to detect KF in case SPS found in same packet (any keyframe is preceded by SPS ...)\n if (spsfound && data.length > 4) {\n // retrieve slice type by parsing beginning of NAL unit (follow H264 spec, slice_header definition) to detect keyframe embedded in NDR\n var sliceType = new exp_golomb_1.default(data).readSliceType();\n // 2 : I slice, 4 : SI slice, 7 : I slice, 9: SI slice\n // SI slice : A slice that is coded using intra prediction only and using quantisation of the prediction samples.\n // An SI slice can be coded such that its decoded samples can be constructed identically to an SP slice.\n // I slice: A slice that is not an SI slice that is decoded using intra prediction only.\n // if (sliceType === 2 || sliceType === 7) {\n if (sliceType === 2 || sliceType === 4 || sliceType === 7 || sliceType === 9) {\n avcSample.key = true;\n }\n }\n break;\n // IDR\n case 5:\n push = true;\n // handle PES not starting with AUD\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n if (debug) {\n avcSample.debug += 'IDR ';\n }\n avcSample.key = true;\n avcSample.frame = true;\n break;\n // SEI\n case 6:\n push = true;\n if (debug && avcSample) {\n avcSample.debug += 'SEI ';\n }\n expGolombDecoder = new exp_golomb_1.default(_this.discardEPB(unit.data));\n // skip frameType\n expGolombDecoder.readUByte();\n var payloadType = 0;\n var payloadSize = 0;\n var endOfCaptions = false;\n var b = 0;\n while (!endOfCaptions && expGolombDecoder.bytesAvailable > 1) {\n payloadType = 0;\n do {\n b = expGolombDecoder.readUByte();\n payloadType += b;\n } while (b === 0xFF);\n // Parse payload size.\n payloadSize = 0;\n do {\n b = expGolombDecoder.readUByte();\n payloadSize += b;\n } while (b === 0xFF);\n // TODO: there can be more than one payload in an SEI packet...\n // TODO: need to read type and size in a while loop to get them all\n if (payloadType === 4 && expGolombDecoder.bytesAvailable !== 0) {\n endOfCaptions = true;\n var countryCode = expGolombDecoder.readUByte();\n if (countryCode === 181) {\n var providerCode = expGolombDecoder.readUShort();\n if (providerCode === 49) {\n var userStructure = expGolombDecoder.readUInt();\n if (userStructure === 0x47413934) {\n var userDataType = expGolombDecoder.readUByte();\n // Raw CEA-608 bytes wrapped in CEA-708 packet\n if (userDataType === 3) {\n var firstByte = expGolombDecoder.readUByte();\n var secondByte = expGolombDecoder.readUByte();\n var totalCCs = 31 & firstByte;\n var byteArray = [firstByte, secondByte];\n for (i = 0; i < totalCCs; i++) {\n // 3 bytes per CC\n byteArray.push(expGolombDecoder.readUByte());\n byteArray.push(expGolombDecoder.readUByte());\n byteArray.push(expGolombDecoder.readUByte());\n }\n _this._insertSampleInOrder(_this._txtTrack.samples, { type: 3, pts: pes.pts, bytes: byteArray });\n }\n }\n }\n }\n }\n else if (payloadSize < expGolombDecoder.bytesAvailable) {\n for (i = 0; i < payloadSize; i++) {\n expGolombDecoder.readUByte();\n }\n }\n }\n break;\n // SPS\n case 7:\n push = true;\n spsfound = true;\n if (debug && avcSample) {\n avcSample.debug += 'SPS ';\n }\n if (!track.sps) {\n expGolombDecoder = new exp_golomb_1.default(unit.data);\n var config = expGolombDecoder.readSPS();\n track.width = config.width;\n track.height = config.height;\n track.pixelRatio = config.pixelRatio;\n track.sps = [unit.data];\n track.duration = _this._duration;\n var codecarray = unit.data.subarray(1, 4);\n var codecstring = 'avc1.';\n for (i = 0; i < 3; i++) {\n var h = codecarray[i].toString(16);\n if (h.length < 2) {\n h = '0' + h;\n }\n codecstring += h;\n }\n track.codec = codecstring;\n }\n break;\n // PPS\n case 8:\n push = true;\n if (debug && avcSample) {\n avcSample.debug += 'PPS ';\n }\n if (!track.pps) {\n track.pps = [unit.data];\n }\n break;\n // AUD\n case 9:\n push = false;\n track.audFound = true;\n if (avcSample) {\n pushAccesUnit(avcSample, track);\n }\n avcSample = _this.avcSample = createAVCSample(false, pes.pts, pes.dts, debug ? 'AUD ' : '');\n break;\n // Filler Data\n case 12:\n push = false;\n break;\n default:\n push = false;\n if (avcSample) {\n avcSample.debug += 'unknown NAL ' + unit.type + ' ';\n }\n break;\n }\n if (avcSample && push) {\n var units_1 = avcSample.units;\n units_1.push(unit);\n }\n });\n // if last PES packet, push samples\n if (last && avcSample) {\n pushAccesUnit(avcSample, track);\n this.avcSample = null;\n }\n };\n TSDemuxer.prototype._insertSampleInOrder = function (arr, data) {\n var len = arr.length;\n if (len > 0) {\n if (data.pts >= arr[len - 1].pts) {\n arr.push(data);\n }\n else {\n for (var pos = len - 1; pos >= 0; pos--) {\n if (data.pts < arr[pos].pts) {\n arr.splice(pos, 0, data);\n break;\n }\n }\n }\n }\n else {\n arr.push(data);\n }\n };\n TSDemuxer.prototype._getLastNalUnit = function () {\n var avcSample = this.avcSample, lastUnit;\n // try to fallback to previous sample if current one is empty\n if (!avcSample || avcSample.units.length === 0) {\n var track = this._avcTrack, samples = track.samples;\n avcSample = samples[samples.length - 1];\n }\n if (avcSample) {\n var units = avcSample.units;\n lastUnit = units[units.length - 1];\n }\n return lastUnit;\n };\n TSDemuxer.prototype._parseAVCNALu = function (array) {\n var i = 0, len = array.byteLength, value, overflow, track = this._avcTrack, state = track.naluState || 0, lastState = state;\n var units = [], unit, unitType, lastUnitStart = -1, lastUnitType;\n // logger.log('PES:' + Hex.hexDump(array));\n if (state === -1) {\n // special use case where we found 3 or 4-byte start codes exactly at the end of previous PES packet\n lastUnitStart = 0;\n // NALu type is value read from offset 0\n lastUnitType = array[0] & 0x1f;\n state = 0;\n i = 1;\n }\n while (i < len) {\n value = array[i++];\n // optimization. state 0 and 1 are the predominant case. let's handle them outside of the switch/case\n if (!state) {\n state = value ? 0 : 1;\n continue;\n }\n if (state === 1) {\n state = value ? 0 : 2;\n continue;\n }\n // here we have state either equal to 2 or 3\n if (!value) {\n state = 3;\n }\n else if (value === 1) {\n if (lastUnitStart >= 0) {\n unit = { data: array.subarray(lastUnitStart, i - state - 1), type: lastUnitType };\n // logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength);\n units.push(unit);\n }\n else {\n // lastUnitStart is undefined => this is the first start code found in this PES packet\n // first check if start code delimiter is overlapping between 2 PES packets,\n // ie it started in last packet (lastState not zero)\n // and ended at the beginning of this PES packet (i <= 4 - lastState)\n var lastUnit = this._getLastNalUnit();\n if (lastUnit) {\n if (lastState && (i <= 4 - lastState)) {\n // start delimiter overlapping between PES packets\n // strip start delimiter bytes from the end of last NAL unit\n // check if lastUnit had a state different from zero\n if (lastUnit.state) {\n // strip last bytes\n lastUnit.data = lastUnit.data.subarray(0, lastUnit.data.byteLength - lastState);\n }\n }\n // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit.\n overflow = i - state - 1;\n if (overflow > 0) {\n // logger.log('first NALU found with overflow:' + overflow);\n var tmp = new Uint8Array(lastUnit.data.byteLength + overflow);\n tmp.set(lastUnit.data, 0);\n tmp.set(array.subarray(0, overflow), lastUnit.data.byteLength);\n lastUnit.data = tmp;\n }\n }\n }\n // check if we can read unit type\n if (i < len) {\n unitType = array[i] & 0x1f;\n // logger.log('find NALU @ offset:' + i + ',type:' + unitType);\n lastUnitStart = i;\n lastUnitType = unitType;\n state = 0;\n }\n else {\n // not enough byte to read unit type. let's read it on next PES parsing\n state = -1;\n }\n }\n else {\n state = 0;\n }\n }\n if (lastUnitStart >= 0 && state >= 0) {\n unit = { data: array.subarray(lastUnitStart, len), type: lastUnitType, state: state };\n units.push(unit);\n // logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state);\n }\n // no NALu found\n if (units.length === 0) {\n // append pes.data to previous NAL unit\n var lastUnit = this._getLastNalUnit();\n if (lastUnit) {\n var tmp = new Uint8Array(lastUnit.data.byteLength + array.byteLength);\n tmp.set(lastUnit.data, 0);\n tmp.set(array, lastUnit.data.byteLength);\n lastUnit.data = tmp;\n }\n }\n track.naluState = state;\n return units;\n };\n /**\n * remove Emulation Prevention bytes from a RBSP\n */\n TSDemuxer.prototype.discardEPB = function (data) {\n var length = data.byteLength, EPBPositions = [], i = 1, newLength, newData;\n // Find all `Emulation Prevention Bytes`\n while (i < length - 2) {\n if (data[i] === 0 &&\n data[i + 1] === 0 &&\n data[i + 2] === 0x03) {\n EPBPositions.push(i + 2);\n i += 2;\n }\n else {\n i++;\n }\n }\n // If no Emulation Prevention Bytes were found just return the original\n // array\n if (EPBPositions.length === 0) {\n return data;\n }\n // Create a new array to hold the NAL unit data\n newLength = length - EPBPositions.length;\n newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === EPBPositions[0]) {\n // Skip this byte\n sourceIndex++;\n // Remove this position index\n EPBPositions.shift();\n }\n newData[i] = data[sourceIndex];\n }\n return newData;\n };\n TSDemuxer.prototype._parseAACPES = function (pes) {\n var track = this._audioTrack, data = pes.data, pts = pes.pts, startOffset = 0, aacOverFlow = this.aacOverFlow, aacLastPTS = this.aacLastPTS, frameDuration, frameIndex, offset, stamp, len;\n if (aacOverFlow) {\n var tmp = new Uint8Array(aacOverFlow.byteLength + data.byteLength);\n tmp.set(aacOverFlow, 0);\n tmp.set(data, aacOverFlow.byteLength);\n // logger.log(`AAC: append overflowing ${aacOverFlow.byteLength} bytes to beginning of new PES`);\n data = tmp;\n }\n // look for ADTS header (0xFFFx)\n for (offset = startOffset, len = data.length; offset < len - 1; offset++) {\n if (ADTS.isHeader(data, offset)) {\n break;\n }\n }\n // if ADTS header does not start straight from the beginning of the PES payload, raise an error\n if (offset) {\n var reason = void 0, fatal = void 0;\n if (offset < len - 1) {\n reason = \"AAC PES did not start with ADTS header,offset:\" + offset;\n fatal = false;\n }\n else {\n reason = 'no ADTS header found in AAC PES';\n fatal = true;\n }\n logger_1.logger.warn(\"parsing error:\" + reason);\n this.observer.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MEDIA_ERROR, details: errors_1.ErrorDetails.FRAG_PARSING_ERROR, fatal: fatal, reason: reason });\n if (fatal) {\n return;\n }\n }\n ADTS.initTrackConfig(track, this.observer, data, offset, this.audioCodec);\n frameIndex = 0;\n frameDuration = ADTS.getFrameDuration(track.samplerate);\n // if last AAC frame is overflowing, we should ensure timestamps are contiguous:\n // first sample PTS should be equal to last sample PTS + frameDuration\n if (aacOverFlow && aacLastPTS) {\n var newPTS = aacLastPTS + frameDuration;\n if (Math.abs(newPTS - pts) > 1) {\n logger_1.logger.log(\"AAC: align PTS for overlapping frames by \" + Math.round((newPTS - pts) / 90));\n pts = newPTS;\n }\n }\n // scan for aac samples\n while (offset < len) {\n if (ADTS.isHeader(data, offset) && (offset + 5) < len) {\n var frame = ADTS.appendFrame(track, data, offset, pts, frameIndex);\n if (frame) {\n // logger.log(`${Math.round(frame.sample.pts)} : AAC`);\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n }\n else {\n // logger.log('Unable to parse AAC frame');\n break;\n }\n }\n else {\n // nothing found, keep looking\n offset++;\n }\n }\n if (offset < len) {\n aacOverFlow = data.subarray(offset, len);\n // logger.log(`AAC: overflow detected:${len-offset}`);\n }\n else {\n aacOverFlow = null;\n }\n this.aacOverFlow = aacOverFlow;\n this.aacLastPTS = stamp;\n };\n TSDemuxer.prototype._parseMPEGPES = function (pes) {\n var data = pes.data;\n var length = data.length;\n var frameIndex = 0;\n var offset = 0;\n var pts = pes.pts;\n while (offset < length) {\n if (mpegaudio_1.default.isHeader(data, offset)) {\n var frame = mpegaudio_1.default.appendFrame(this._audioTrack, data, offset, pts, frameIndex);\n if (frame) {\n offset += frame.length;\n frameIndex++;\n }\n else {\n // logger.log('Unable to parse Mpeg audio frame');\n break;\n }\n }\n else {\n // nothing found, keep looking\n offset++;\n }\n }\n };\n TSDemuxer.prototype._parseID3PES = function (pes) {\n this._id3Track.samples.push(pes);\n };\n return TSDemuxer;\n}());\nexports.default = TSDemuxer;\n\n\n/***/ }),\n\n/***/ \"./src/errors.js\":\n/*!***********************!*\\\n !*** ./src/errors.js ***!\n \\***********************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ErrorTypes = {\n // Identifier for a network error (loading error / timeout ...)\n NETWORK_ERROR: 'networkError',\n // Identifier for a media Error (video/parsing/mediasource error)\n MEDIA_ERROR: 'mediaError',\n // EME (encrypted media extensions) errors\n KEY_SYSTEM_ERROR: 'keySystemError',\n // Identifier for a mux Error (demuxing/remuxing)\n MUX_ERROR: 'muxError',\n // Identifier for all other errors\n OTHER_ERROR: 'otherError'\n};\n/**\n * @enum {ErrorDetails}\n * @typedef {string} ErrorDetail\n */\nexports.ErrorDetails = {\n KEY_SYSTEM_NO_KEYS: 'keySystemNoKeys',\n KEY_SYSTEM_NO_ACCESS: 'keySystemNoAccess',\n KEY_SYSTEM_NO_SESSION: 'keySystemNoSession',\n KEY_SYSTEM_LICENSE_REQUEST_FAILED: 'keySystemLicenseRequestFailed',\n // Identifier for a manifest load error - data: { url : faulty URL, response : { code: error code, text: error text }}\n MANIFEST_LOAD_ERROR: 'manifestLoadError',\n // Identifier for a manifest load timeout - data: { url : faulty URL, response : { code: error code, text: error text }}\n MANIFEST_LOAD_TIMEOUT: 'manifestLoadTimeOut',\n // Identifier for a manifest parsing error - data: { url : faulty URL, reason : error reason}\n MANIFEST_PARSING_ERROR: 'manifestParsingError',\n // Identifier for a manifest with only incompatible codecs error - data: { url : faulty URL, reason : error reason}\n MANIFEST_INCOMPATIBLE_CODECS_ERROR: 'manifestIncompatibleCodecsError',\n // Identifier for a level load error - data: { url : faulty URL, response : { code: error code, text: error text }}\n LEVEL_LOAD_ERROR: 'levelLoadError',\n // Identifier for a level load timeout - data: { url : faulty URL, response : { code: error code, text: error text }}\n LEVEL_LOAD_TIMEOUT: 'levelLoadTimeOut',\n // Identifier for a level switch error - data: { level : faulty level Id, event : error description}\n LEVEL_SWITCH_ERROR: 'levelSwitchError',\n // Identifier for an audio track load error - data: { url : faulty URL, response : { code: error code, text: error text }}\n AUDIO_TRACK_LOAD_ERROR: 'audioTrackLoadError',\n // Identifier for an audio track load timeout - data: { url : faulty URL, response : { code: error code, text: error text }}\n AUDIO_TRACK_LOAD_TIMEOUT: 'audioTrackLoadTimeOut',\n // Identifier for fragment load error - data: { frag : fragment object, response : { code: error code, text: error text }}\n FRAG_LOAD_ERROR: 'fragLoadError',\n // Identifier for fragment load timeout error - data: { frag : fragment object}\n FRAG_LOAD_TIMEOUT: 'fragLoadTimeOut',\n // Identifier for a fragment decryption error event - data: {id : demuxer Id,frag: fragment object, reason : parsing error description }\n FRAG_DECRYPT_ERROR: 'fragDecryptError',\n // Identifier for a fragment parsing error event - data: { id : demuxer Id, reason : parsing error description }\n // will be renamed DEMUX_PARSING_ERROR and switched to MUX_ERROR in the next major release\n FRAG_PARSING_ERROR: 'fragParsingError',\n // Identifier for a remux alloc error event - data: { id : demuxer Id, frag : fragment object, bytes : nb of bytes on which allocation failed , reason : error text }\n REMUX_ALLOC_ERROR: 'remuxAllocError',\n // Identifier for decrypt key load error - data: { frag : fragment object, response : { code: error code, text: error text }}\n KEY_LOAD_ERROR: 'keyLoadError',\n // Identifier for decrypt key load timeout error - data: { frag : fragment object}\n KEY_LOAD_TIMEOUT: 'keyLoadTimeOut',\n // Triggered when an exception occurs while adding a sourceBuffer to MediaSource - data : { err : exception , mimeType : mimeType }\n BUFFER_ADD_CODEC_ERROR: 'bufferAddCodecError',\n // Identifier for a buffer append error - data: append error description\n BUFFER_APPEND_ERROR: 'bufferAppendError',\n // Identifier for a buffer appending error event - data: appending error description\n BUFFER_APPENDING_ERROR: 'bufferAppendingError',\n // Identifier for a buffer stalled error event\n BUFFER_STALLED_ERROR: 'bufferStalledError',\n // Identifier for a buffer full event\n BUFFER_FULL_ERROR: 'bufferFullError',\n // Identifier for a buffer seek over hole event\n BUFFER_SEEK_OVER_HOLE: 'bufferSeekOverHole',\n // Identifier for a buffer nudge on stall (playback is stuck although currentTime is in a buffered area)\n BUFFER_NUDGE_ON_STALL: 'bufferNudgeOnStall',\n // Identifier for an internal exception happening inside hls.js while handling an event\n INTERNAL_EXCEPTION: 'internalException'\n};\n\n\n/***/ }),\n\n/***/ \"./src/event-handler.js\":\n/*!******************************!*\\\n !*** ./src/event-handler.js ***!\n \\******************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/*\n*\n* All objects in the event handling chain should inherit from this class\n*\n*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar logger_1 = __webpack_require__(/*! ./utils/logger */ \"./src/utils/logger.js\");\nvar errors_1 = __webpack_require__(/*! ./errors */ \"./src/errors.js\");\nvar events_1 = __webpack_require__(/*! ./events */ \"./src/events.js\");\nvar FORBIDDEN_EVENT_NAMES = {\n 'hlsEventGeneric': true,\n 'hlsHandlerDestroying': true,\n 'hlsHandlerDestroyed': true\n};\nvar EventHandler = /** @class */ (function () {\n function EventHandler(hls) {\n var events = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n events[_i - 1] = arguments[_i];\n }\n this.hls = hls;\n this.onEvent = this.onEvent.bind(this);\n this.handledEvents = events;\n this.useGenericHandler = true;\n this.registerListeners();\n }\n EventHandler.prototype.destroy = function () {\n this.onHandlerDestroying();\n this.unregisterListeners();\n this.onHandlerDestroyed();\n };\n EventHandler.prototype.onHandlerDestroying = function () { };\n EventHandler.prototype.onHandlerDestroyed = function () { };\n EventHandler.prototype.isEventHandler = function () {\n return typeof this.handledEvents === 'object' && this.handledEvents.length && typeof this.onEvent === 'function';\n };\n EventHandler.prototype.registerListeners = function () {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function (event) {\n if (FORBIDDEN_EVENT_NAMES[event]) {\n throw new Error('Forbidden event-name: ' + event);\n }\n this.hls.on(event, this.onEvent);\n }, this);\n }\n };\n EventHandler.prototype.unregisterListeners = function () {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function (event) {\n this.hls.off(event, this.onEvent);\n }, this);\n }\n };\n /**\n * arguments: event (string), data (any)\n */\n EventHandler.prototype.onEvent = function (event, data) {\n this.onEventGeneric(event, data);\n };\n EventHandler.prototype.onEventGeneric = function (event, data) {\n var eventToFunction = function (event, data) {\n var funcName = 'on' + event.replace('hls', '');\n if (typeof this[funcName] !== 'function') {\n throw new Error(\"Event \" + event + \" has no generic handler in this \" + this.constructor.name + \" class (tried \" + funcName + \")\");\n }\n return this[funcName].bind(this, data);\n };\n try {\n eventToFunction.call(this, event, data).call();\n }\n catch (err) {\n logger_1.logger.error(\"An internal error happened while handling event \" + event + \". Error message: \\\"\" + err.message + \"\\\". Here is a stacktrace:\", err);\n this.hls.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.OTHER_ERROR, details: errors_1.ErrorDetails.INTERNAL_EXCEPTION, fatal: false, event: event, err: err });\n }\n };\n return EventHandler;\n}());\nexports.default = EventHandler;\n\n\n/***/ }),\n\n/***/ \"./src/events.js\":\n/*!***********************!*\\\n !*** ./src/events.js ***!\n \\***********************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * @readonly\n * @enum {string}\n */\nvar HlsEvents = {\n // fired before MediaSource is attaching to media element - data: { media }\n MEDIA_ATTACHING: 'hlsMediaAttaching',\n // fired when MediaSource has been succesfully attached to media element - data: { }\n MEDIA_ATTACHED: 'hlsMediaAttached',\n // fired before detaching MediaSource from media element - data: { }\n MEDIA_DETACHING: 'hlsMediaDetaching',\n // fired when MediaSource has been detached from media element - data: { }\n MEDIA_DETACHED: 'hlsMediaDetached',\n // fired when we buffer is going to be reset - data: { }\n BUFFER_RESET: 'hlsBufferReset',\n // fired when we know about the codecs that we need buffers for to push into - data: {tracks : { container, codec, levelCodec, initSegment, metadata }}\n BUFFER_CODECS: 'hlsBufferCodecs',\n // fired when sourcebuffers have been created - data: { tracks : tracks }\n BUFFER_CREATED: 'hlsBufferCreated',\n // fired when we append a segment to the buffer - data: { segment: segment object }\n BUFFER_APPENDING: 'hlsBufferAppending',\n // fired when we are done with appending a media segment to the buffer - data : { parent : segment parent that triggered BUFFER_APPENDING, pending : nb of segments waiting for appending for this segment parent}\n BUFFER_APPENDED: 'hlsBufferAppended',\n // fired when the stream is finished and we want to notify the media buffer that there will be no more data - data: { }\n BUFFER_EOS: 'hlsBufferEos',\n // fired when the media buffer should be flushed - data { startOffset, endOffset }\n BUFFER_FLUSHING: 'hlsBufferFlushing',\n // fired when the media buffer has been flushed - data: { }\n BUFFER_FLUSHED: 'hlsBufferFlushed',\n // fired to signal that a manifest loading starts - data: { url : manifestURL}\n MANIFEST_LOADING: 'hlsManifestLoading',\n // fired after manifest has been loaded - data: { levels : [available quality levels], audioTracks : [ available audio tracks], url : manifestURL, stats : { trequest, tfirst, tload, mtime}}\n MANIFEST_LOADED: 'hlsManifestLoaded',\n // fired after manifest has been parsed - data: { levels : [available quality levels], firstLevel : index of first quality level appearing in Manifest}\n MANIFEST_PARSED: 'hlsManifestParsed',\n // fired when a level switch is requested - data: { level : id of new level }\n LEVEL_SWITCHING: 'hlsLevelSwitching',\n // fired when a level switch is effective - data: { level : id of new level }\n LEVEL_SWITCHED: 'hlsLevelSwitched',\n // fired when a level playlist loading starts - data: { url : level URL, level : id of level being loaded}\n LEVEL_LOADING: 'hlsLevelLoading',\n // fired when a level playlist loading finishes - data: { details : levelDetails object, level : id of loaded level, stats : { trequest, tfirst, tload, mtime} }\n LEVEL_LOADED: 'hlsLevelLoaded',\n // fired when a level's details have been updated based on previous details, after it has been loaded - data: { details : levelDetails object, level : id of updated level }\n LEVEL_UPDATED: 'hlsLevelUpdated',\n // fired when a level's PTS information has been updated after parsing a fragment - data: { details : levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment }\n LEVEL_PTS_UPDATED: 'hlsLevelPtsUpdated',\n // fired to notify that audio track lists has been updated - data: { audioTracks : audioTracks }\n AUDIO_TRACKS_UPDATED: 'hlsAudioTracksUpdated',\n // fired when an audio track switching is requested - data: { id : audio track id }\n AUDIO_TRACK_SWITCHING: 'hlsAudioTrackSwitching',\n // fired when an audio track switch actually occurs - data: { id : audio track id }\n AUDIO_TRACK_SWITCHED: 'hlsAudioTrackSwitched',\n // fired when an audio track loading starts - data: { url : audio track URL, id : audio track id }\n AUDIO_TRACK_LOADING: 'hlsAudioTrackLoading',\n // fired when an audio track loading finishes - data: { details : levelDetails object, id : audio track id, stats : { trequest, tfirst, tload, mtime } }\n AUDIO_TRACK_LOADED: 'hlsAudioTrackLoaded',\n // fired to notify that subtitle track lists has been updated - data: { subtitleTracks : subtitleTracks }\n SUBTITLE_TRACKS_UPDATED: 'hlsSubtitleTracksUpdated',\n // fired when an subtitle track switch occurs - data: { id : subtitle track id }\n SUBTITLE_TRACK_SWITCH: 'hlsSubtitleTrackSwitch',\n // fired when a subtitle track loading starts - data: { url : subtitle track URL, id : subtitle track id }\n SUBTITLE_TRACK_LOADING: 'hlsSubtitleTrackLoading',\n // fired when a subtitle track loading finishes - data: { details : levelDetails object, id : subtitle track id, stats : { trequest, tfirst, tload, mtime } }\n SUBTITLE_TRACK_LOADED: 'hlsSubtitleTrackLoaded',\n // fired when a subtitle fragment has been processed - data: { success : boolean, frag : the processed frag }\n SUBTITLE_FRAG_PROCESSED: 'hlsSubtitleFragProcessed',\n // fired when the first timestamp is found - data: { id : demuxer id, initPTS: initPTS, frag : fragment object }\n INIT_PTS_FOUND: 'hlsInitPtsFound',\n // fired when a fragment loading starts - data: { frag : fragment object }\n FRAG_LOADING: 'hlsFragLoading',\n // fired when a fragment loading is progressing - data: { frag : fragment object, { trequest, tfirst, loaded } }\n FRAG_LOAD_PROGRESS: 'hlsFragLoadProgress',\n // Identifier for fragment load aborting for emergency switch down - data: { frag : fragment object }\n FRAG_LOAD_EMERGENCY_ABORTED: 'hlsFragLoadEmergencyAborted',\n // fired when a fragment loading is completed - data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length } }\n FRAG_LOADED: 'hlsFragLoaded',\n // fired when a fragment has finished decrypting - data: { id : demuxer id, frag: fragment object, payload : fragment payload, stats : { tstart, tdecrypt } }\n FRAG_DECRYPTED: 'hlsFragDecrypted',\n // fired when Init Segment has been extracted from fragment - data: { id : demuxer id, frag: fragment object, moov : moov MP4 box, codecs : codecs found while parsing fragment }\n FRAG_PARSING_INIT_SEGMENT: 'hlsFragParsingInitSegment',\n // fired when parsing sei text is completed - data: { id : demuxer id, frag: fragment object, samples : [ sei samples pes ] }\n FRAG_PARSING_USERDATA: 'hlsFragParsingUserdata',\n // fired when parsing id3 is completed - data: { id : demuxer id, frag: fragment object, samples : [ id3 samples pes ] }\n FRAG_PARSING_METADATA: 'hlsFragParsingMetadata',\n // fired when data have been extracted from fragment - data: { id : demuxer id, frag: fragment object, data1 : moof MP4 box or TS fragments, data2 : mdat MP4 box or null}\n FRAG_PARSING_DATA: 'hlsFragParsingData',\n // fired when fragment parsing is completed - data: { id : demuxer id, frag: fragment object }\n FRAG_PARSED: 'hlsFragParsed',\n // fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer - data: { id : demuxer id, frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length, bwEstimate } }\n FRAG_BUFFERED: 'hlsFragBuffered',\n // fired when fragment matching with current media position is changing - data : { id : demuxer id, frag : fragment object }\n FRAG_CHANGED: 'hlsFragChanged',\n // Identifier for a FPS drop event - data: { curentDropped, currentDecoded, totalDroppedFrames }\n FPS_DROP: 'hlsFpsDrop',\n // triggered when FPS drop triggers auto level capping - data: { level, droppedlevel }\n FPS_DROP_LEVEL_CAPPING: 'hlsFpsDropLevelCapping',\n // Identifier for an error event - data: { type : error type, details : error details, fatal : if true, hls.js cannot/will not try to recover, if false, hls.js will try to recover,other error specific data }\n ERROR: 'hlsError',\n // fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a media to the instance of hls.js to handle mid-rolls for example - data: { }\n DESTROYING: 'hlsDestroying',\n // fired when a decrypt key loading starts - data: { frag : fragment object }\n KEY_LOADING: 'hlsKeyLoading',\n // fired when a decrypt key loading is completed - data: { frag : fragment object, payload : key payload, stats : { trequest, tfirst, tload, length } }\n KEY_LOADED: 'hlsKeyLoaded',\n // fired upon stream controller state transitions - data: { previousState, nextState }\n STREAM_STATE_TRANSITION: 'hlsStreamStateTransition'\n};\nexports.default = HlsEvents;\n\n\n/***/ }),\n\n/***/ \"./src/hls.js\":\n/*!********************!*\\\n !*** ./src/hls.js ***!\n \\********************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar URLToolkit = __webpack_require__(/*! url-toolkit */ \"./node_modules/url-toolkit/src/url-toolkit.js\");\nvar errors_1 = __webpack_require__(/*! ./errors */ \"./src/errors.js\");\nvar playlist_loader_1 = __webpack_require__(/*! ./loader/playlist-loader */ \"./src/loader/playlist-loader.js\");\nvar fragment_loader_1 = __webpack_require__(/*! ./loader/fragment-loader */ \"./src/loader/fragment-loader.js\");\nvar key_loader_1 = __webpack_require__(/*! ./loader/key-loader */ \"./src/loader/key-loader.js\");\nvar fragment_tracker_1 = __webpack_require__(/*! ./controller/fragment-tracker */ \"./src/controller/fragment-tracker.js\");\nvar stream_controller_1 = __webpack_require__(/*! ./controller/stream-controller */ \"./src/controller/stream-controller.js\");\nvar level_controller_1 = __webpack_require__(/*! ./controller/level-controller */ \"./src/controller/level-controller.js\");\nvar id3_track_controller_1 = __webpack_require__(/*! ./controller/id3-track-controller */ \"./src/controller/id3-track-controller.js\");\nvar is_supported_1 = __webpack_require__(/*! ./is-supported */ \"./src/is-supported.js\");\nvar logger_1 = __webpack_require__(/*! ./utils/logger */ \"./src/utils/logger.js\");\nvar config_1 = __webpack_require__(/*! ./config */ \"./src/config.js\");\nvar events_1 = __webpack_require__(/*! ./events */ \"./src/events.js\");\nvar observer_1 = __webpack_require__(/*! ./observer */ \"./src/observer.js\");\n/**\n * @module Hls\n * @class\n * @constructor\n */\nvar Hls = /** @class */ (function (_super) {\n __extends(Hls, _super);\n /**\n * Creates an instance of an HLS client that can attach to exactly one `HTMLMediaElement`.\n *\n * @constructs Hls\n * @param {HlsConfig} config\n */\n function Hls(config) {\n if (config === void 0) { config = {}; }\n var _this = _super.call(this) || this;\n var defaultConfig = Hls.DefaultConfig;\n if ((config.liveSyncDurationCount || config.liveMaxLatencyDurationCount) && (config.liveSyncDuration || config.liveMaxLatencyDuration)) {\n throw new Error('Illegal hls.js config: don\\'t mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration');\n }\n for (var prop in defaultConfig) {\n if (prop in config)\n continue;\n config[prop] = defaultConfig[prop];\n }\n if (config.liveMaxLatencyDurationCount !== undefined && config.liveMaxLatencyDurationCount <= config.liveSyncDurationCount) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDurationCount\" must be gt \"liveSyncDurationCount\"');\n }\n if (config.liveMaxLatencyDuration !== undefined && (config.liveMaxLatencyDuration <= config.liveSyncDuration || config.liveSyncDuration === undefined)) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDuration\" must be gt \"liveSyncDuration\"');\n }\n logger_1.enableLogs(config.debug);\n _this.config = config;\n _this._autoLevelCapping = -1;\n // core controllers and network loaders\n /**\n * @member {AbrController} abrController\n */\n var abrController = _this.abrController = new config.abrController(_this);\n var bufferController = new config.bufferController(_this);\n var capLevelController = new config.capLevelController(_this);\n var fpsController = new config.fpsController(_this);\n var playListLoader = new playlist_loader_1.default(_this);\n var fragmentLoader = new fragment_loader_1.default(_this);\n var keyLoader = new key_loader_1.default(_this);\n var id3TrackController = new id3_track_controller_1.default(_this);\n // network controllers\n /**\n * @member {LevelController} levelController\n */\n var levelController = _this.levelController = new level_controller_1.default(_this);\n // FIXME: FragmentTracker must be defined before StreamController because the order of event handling is important\n var fragmentTracker = new fragment_tracker_1.FragmentTracker(_this);\n /**\n * @member {StreamController} streamController\n */\n var streamController = _this.streamController = new stream_controller_1.default(_this, fragmentTracker);\n var networkControllers = [levelController, streamController];\n // optional audio stream controller\n /**\n * @var {ICoreComponent | Controller}\n */\n var Controller = config.audioStreamController;\n if (Controller) {\n networkControllers.push(new Controller(_this, fragmentTracker));\n }\n /**\n * @member {INetworkController[]} networkControllers\n */\n _this.networkControllers = networkControllers;\n /**\n * @var {ICoreComponent[]}\n */\n var coreComponents = [\n playListLoader,\n fragmentLoader,\n keyLoader,\n abrController,\n bufferController,\n capLevelController,\n fpsController,\n id3TrackController,\n fragmentTracker\n ];\n // optional audio track and subtitle controller\n Controller = config.audioTrackController;\n if (Controller) {\n var audioTrackController = new Controller(_this);\n /**\n * @member {AudioTrackController} audioTrackController\n */\n _this.audioTrackController = audioTrackController;\n coreComponents.push(audioTrackController);\n }\n Controller = config.subtitleTrackController;\n if (Controller) {\n var subtitleTrackController = new Controller(_this);\n /**\n * @member {SubtitleTrackController} subtitleTrackController\n */\n _this.subtitleTrackController = subtitleTrackController;\n coreComponents.push(subtitleTrackController);\n }\n Controller = config.emeController;\n if (Controller) {\n var emeController = new Controller(_this);\n /**\n * @member {EMEController} emeController\n */\n _this.emeController = emeController;\n coreComponents.push(emeController);\n }\n // optional subtitle controllers\n Controller = config.subtitleStreamController;\n if (Controller) {\n coreComponents.push(new Controller(_this, fragmentTracker));\n }\n Controller = config.timelineController;\n if (Controller) {\n coreComponents.push(new Controller(_this));\n }\n /**\n * @member {ICoreComponent[]}\n */\n _this.coreComponents = coreComponents;\n return _this;\n }\n Object.defineProperty(Hls, \"version\", {\n /**\n * @type {string}\n */\n get: function () {\n return \"0.12.2\";\n },\n enumerable: true,\n configurable: true\n });\n /**\n * @type {boolean}\n */\n Hls.isSupported = function () {\n return is_supported_1.isSupported();\n };\n Object.defineProperty(Hls, \"Events\", {\n /**\n * @type {HlsEvents}\n */\n get: function () {\n return events_1.default;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls, \"ErrorTypes\", {\n /**\n * @type {HlsErrorTypes}\n */\n get: function () {\n return errors_1.ErrorTypes;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls, \"ErrorDetails\", {\n /**\n * @type {HlsErrorDetails}\n */\n get: function () {\n return errors_1.ErrorDetails;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls, \"DefaultConfig\", {\n /**\n * @type {HlsConfig}\n */\n get: function () {\n if (!Hls.defaultConfig) {\n return config_1.hlsDefaultConfig;\n }\n return Hls.defaultConfig;\n },\n /**\n * @type {HlsConfig}\n */\n set: function (defaultConfig) {\n Hls.defaultConfig = defaultConfig;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Dispose of the instance\n */\n Hls.prototype.destroy = function () {\n logger_1.logger.log('destroy');\n this.trigger(events_1.default.DESTROYING);\n this.detachMedia();\n this.coreComponents.concat(this.networkControllers).forEach(function (component) {\n component.destroy();\n });\n this.url = null;\n this.removeAllListeners();\n this._autoLevelCapping = -1;\n };\n /**\n * Attach a media element\n * @param {HTMLMediaElement} media\n */\n Hls.prototype.attachMedia = function (media) {\n logger_1.logger.log('attachMedia');\n this.media = media;\n this.trigger(events_1.default.MEDIA_ATTACHING, { media: media });\n };\n /**\n * Detach from the media\n */\n Hls.prototype.detachMedia = function () {\n logger_1.logger.log('detachMedia');\n this.trigger(events_1.default.MEDIA_DETACHING);\n this.media = null;\n };\n /**\n * Set the source URL. Can be relative or absolute.\n * @param {string} url\n */\n Hls.prototype.loadSource = function (url) {\n url = URLToolkit.buildAbsoluteURL(window.location.href, url, { alwaysNormalize: true });\n logger_1.logger.log(\"loadSource:\" + url);\n this.url = url;\n // when attaching to a source URL, trigger a playlist load\n this.trigger(events_1.default.MANIFEST_LOADING, { url: url });\n };\n /**\n * Start loading data from the stream source.\n * Depending on default config, client starts loading automatically when a source is set.\n *\n * @param {number} startPosition Set the start position to stream from\n * @default -1 None (from earliest point)\n */\n Hls.prototype.startLoad = function (startPosition) {\n if (startPosition === void 0) { startPosition = -1; }\n logger_1.logger.log(\"startLoad(\" + startPosition + \")\");\n this.networkControllers.forEach(function (controller) {\n controller.startLoad(startPosition);\n });\n };\n /**\n * Stop loading of any stream data.\n */\n Hls.prototype.stopLoad = function () {\n logger_1.logger.log('stopLoad');\n this.networkControllers.forEach(function (controller) {\n controller.stopLoad();\n });\n };\n /**\n * Swap through possible audio codecs in the stream (for example to switch from stereo to 5.1)\n */\n Hls.prototype.swapAudioCodec = function () {\n logger_1.logger.log('swapAudioCodec');\n this.streamController.swapAudioCodec();\n };\n /**\n * When the media-element fails, this allows to detach and then re-attach it\n * as one call (convenience method).\n *\n * Automatic recovery of media-errors by this process is configurable.\n */\n Hls.prototype.recoverMediaError = function () {\n logger_1.logger.log('recoverMediaError');\n var media = this.media;\n this.detachMedia();\n this.attachMedia(media);\n };\n Object.defineProperty(Hls.prototype, \"levels\", {\n /**\n * @type {QualityLevel[]}\n */\n get: function () {\n return this.levelController.levels;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"currentLevel\", {\n /**\n * Index of quality level currently played\n * @type {number}\n */\n get: function () {\n return this.streamController.currentLevel;\n },\n /**\n * Set quality level index immediately .\n * This will flush the current buffer to replace the quality asap.\n * That means playback will interrupt at least shortly to re-buffer and re-sync eventually.\n * @type {number} -1 for automatic level selection\n */\n set: function (newLevel) {\n logger_1.logger.log(\"set currentLevel:\" + newLevel);\n this.loadLevel = newLevel;\n this.streamController.immediateLevelSwitch();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"nextLevel\", {\n /**\n * Index of next quality level loaded as scheduled by stream controller.\n * @type {number}\n */\n get: function () {\n return this.streamController.nextLevel;\n },\n /**\n * Set quality level index for next loaded data.\n * This will switch the video quality asap, without interrupting playback.\n * May abort current loading of data, and flush parts of buffer (outside currently played fragment region).\n * @type {number} -1 for automatic level selection\n */\n set: function (newLevel) {\n logger_1.logger.log(\"set nextLevel:\" + newLevel);\n this.levelController.manualLevel = newLevel;\n this.streamController.nextLevelSwitch();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"loadLevel\", {\n /**\n * Return the quality level of the currently or last (of none is loaded currently) segment\n * @type {number}\n */\n get: function () {\n return this.levelController.level;\n },\n /**\n * Set quality level index for next loaded data in a conservative way.\n * This will switch the quality without flushing, but interrupt current loading.\n * Thus the moment when the quality switch will appear in effect will only be after the already existing buffer.\n * @type {number} newLevel -1 for automatic level selection\n */\n set: function (newLevel) {\n logger_1.logger.log(\"set loadLevel:\" + newLevel);\n this.levelController.manualLevel = newLevel;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"nextLoadLevel\", {\n /**\n * get next quality level loaded\n * @type {number}\n */\n get: function () {\n return this.levelController.nextLoadLevel;\n },\n /**\n * Set quality level of next loaded segment in a fully \"non-destructive\" way.\n * Same as `loadLevel` but will wait for next switch (until current loading is done).\n * @type {number} level\n */\n set: function (level) {\n this.levelController.nextLoadLevel = level;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"firstLevel\", {\n /**\n * Return \"first level\": like a default level, if not set,\n * falls back to index of first level referenced in manifest\n * @type {number}\n */\n get: function () {\n return Math.max(this.levelController.firstLevel, this.minAutoLevel);\n },\n /**\n * Sets \"first-level\", see getter.\n * @type {number}\n */\n set: function (newLevel) {\n logger_1.logger.log(\"set firstLevel:\" + newLevel);\n this.levelController.firstLevel = newLevel;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"startLevel\", {\n /**\n * Return start level (level of first fragment that will be played back)\n * if not overrided by user, first level appearing in manifest will be used as start level\n * if -1 : automatic start level selection, playback will start from level matching download bandwidth\n * (determined from download of first segment)\n * @type {number}\n */\n get: function () {\n return this.levelController.startLevel;\n },\n /**\n * set start level (level of first fragment that will be played back)\n * if not overrided by user, first level appearing in manifest will be used as start level\n * if -1 : automatic start level selection, playback will start from level matching download bandwidth\n * (determined from download of first segment)\n * @type {number} newLevel\n */\n set: function (newLevel) {\n logger_1.logger.log(\"set startLevel:\" + newLevel);\n var hls = this;\n // if not in automatic start level detection, ensure startLevel is greater than minAutoLevel\n if (newLevel !== -1) {\n newLevel = Math.max(newLevel, hls.minAutoLevel);\n }\n hls.levelController.startLevel = newLevel;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"autoLevelCapping\", {\n /**\n * Capping/max level value that should be used by automatic level selection algorithm (`ABRController`)\n * @type {number}\n */\n get: function () {\n return this._autoLevelCapping;\n },\n /**\n * Capping/max level value that should be used by automatic level selection algorithm (`ABRController`)\n * @type {number}\n */\n set: function (newLevel) {\n logger_1.logger.log(\"set autoLevelCapping:\" + newLevel);\n this._autoLevelCapping = newLevel;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"autoLevelEnabled\", {\n /**\n * True when automatic level selection enabled\n * @type {boolean}\n */\n get: function () {\n return (this.levelController.manualLevel === -1);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"manualLevel\", {\n /**\n * Level set manually (if any)\n * @type {number}\n */\n get: function () {\n return this.levelController.manualLevel;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"minAutoLevel\", {\n /**\n * min level selectable in auto mode according to config.minAutoBitrate\n * @type {number}\n */\n get: function () {\n var hls = this, levels = hls.levels, minAutoBitrate = hls.config.minAutoBitrate, len = levels ? levels.length : 0;\n for (var i = 0; i < len; i++) {\n var levelNextBitrate = levels[i].realBitrate ? Math.max(levels[i].realBitrate, levels[i].bitrate) : levels[i].bitrate;\n if (levelNextBitrate > minAutoBitrate) {\n return i;\n }\n }\n return 0;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"maxAutoLevel\", {\n /**\n * max level selectable in auto mode according to autoLevelCapping\n * @type {number}\n */\n get: function () {\n var hls = this;\n var levels = hls.levels;\n var autoLevelCapping = hls.autoLevelCapping;\n var maxAutoLevel;\n if (autoLevelCapping === -1 && levels && levels.length) {\n maxAutoLevel = levels.length - 1;\n }\n else {\n maxAutoLevel = autoLevelCapping;\n }\n return maxAutoLevel;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"nextAutoLevel\", {\n /**\n * next automatically selected quality level\n * @type {number}\n */\n get: function () {\n var hls = this;\n // ensure next auto level is between min and max auto level\n return Math.min(Math.max(hls.abrController.nextAutoLevel, hls.minAutoLevel), hls.maxAutoLevel);\n },\n /**\n * this setter is used to force next auto level.\n * this is useful to force a switch down in auto mode:\n * in case of load error on level N, hls.js can set nextAutoLevel to N-1 for example)\n * forced value is valid for one fragment. upon succesful frag loading at forced level,\n * this value will be resetted to -1 by ABR controller.\n * @type {number}\n */\n set: function (nextLevel) {\n var hls = this;\n hls.abrController.nextAutoLevel = Math.max(hls.minAutoLevel, nextLevel);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"audioTracks\", {\n /**\n * @type {AudioTrack[]}\n */\n get: function () {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.audioTracks : [];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"audioTrack\", {\n /**\n * index of the selected audio track (index in audio track lists)\n * @type {number}\n */\n get: function () {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.audioTrack : -1;\n },\n /**\n * selects an audio track, based on its index in audio track lists\n * @type {number}\n */\n set: function (audioTrackId) {\n var audioTrackController = this.audioTrackController;\n if (audioTrackController) {\n audioTrackController.audioTrack = audioTrackId;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"liveSyncPosition\", {\n /**\n * @type {Seconds}\n */\n get: function () {\n return this.streamController.liveSyncPosition;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"subtitleTracks\", {\n /**\n * get alternate subtitle tracks list from playlist\n * @type {SubtitleTrack[]}\n */\n get: function () {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleTracks : [];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"subtitleTrack\", {\n /**\n * index of the selected subtitle track (index in subtitle track lists)\n * @type {number}\n */\n get: function () {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleTrack : -1;\n },\n /**\n * select an subtitle track, based on its index in subtitle track lists\n * @type{number}\n */\n set: function (subtitleTrackId) {\n var subtitleTrackController = this.subtitleTrackController;\n if (subtitleTrackController) {\n subtitleTrackController.subtitleTrack = subtitleTrackId;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Hls.prototype, \"subtitleDisplay\", {\n /**\n * @type {boolean}\n */\n get: function () {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleDisplay : false;\n },\n /**\n * Enable/disable subtitle display rendering\n * @type {boolean}\n */\n set: function (value) {\n var subtitleTrackController = this.subtitleTrackController;\n if (subtitleTrackController) {\n subtitleTrackController.subtitleDisplay = value;\n }\n },\n enumerable: true,\n configurable: true\n });\n return Hls;\n}(observer_1.Observer));\nexports.default = Hls;\n\n\n/***/ }),\n\n/***/ \"./src/is-supported.js\":\n/*!*****************************!*\\\n !*** ./src/is-supported.js ***!\n \\*****************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar mediasource_helper_1 = __webpack_require__(/*! ./utils/mediasource-helper */ \"./src/utils/mediasource-helper.js\");\nfunction isSupported() {\n var mediaSource = mediasource_helper_1.getMediaSource();\n var sourceBuffer = window.SourceBuffer || window.WebKitSourceBuffer;\n var isTypeSupported = mediaSource &&\n typeof mediaSource.isTypeSupported === 'function' &&\n mediaSource.isTypeSupported('video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"');\n // if SourceBuffer is exposed ensure its API is valid\n // safari and old version of Chrome doe not expose SourceBuffer globally so checking SourceBuffer.prototype is impossible\n var sourceBufferValidAPI = !sourceBuffer ||\n (sourceBuffer.prototype &&\n typeof sourceBuffer.prototype.appendBuffer === 'function' &&\n typeof sourceBuffer.prototype.remove === 'function');\n return !!isTypeSupported && !!sourceBufferValidAPI;\n}\nexports.isSupported = isSupported;\n\n\n/***/ }),\n\n/***/ \"./src/loader/fragment-loader.js\":\n/*!***************************************!*\\\n !*** ./src/loader/fragment-loader.js ***!\n \\***************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\n/*\n * Fragment Loader\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar FragmentLoader = /** @class */ (function (_super) {\n __extends(FragmentLoader, _super);\n function FragmentLoader(hls) {\n var _this = _super.call(this, hls, events_1.default.FRAG_LOADING) || this;\n _this.loaders = {};\n return _this;\n }\n FragmentLoader.prototype.destroy = function () {\n var loaders = this.loaders;\n for (var loaderName in loaders) {\n var loader = loaders[loaderName];\n if (loader) {\n loader.destroy();\n }\n }\n this.loaders = {};\n _super.prototype.destroy.call(this);\n };\n FragmentLoader.prototype.onFragLoading = function (data) {\n var frag = data.frag, type = frag.type, loaders = this.loaders, config = this.hls.config, FragmentILoader = config.fLoader, DefaultILoader = config.loader;\n // reset fragment state\n frag.loaded = 0;\n var loader = loaders[type];\n if (loader) {\n logger_1.logger.warn(\"abort previous fragment loader for type: \" + type);\n loader.abort();\n }\n loader = loaders[type] = frag.loader =\n config.fLoader ? new FragmentILoader(config) : new DefaultILoader(config);\n var loaderContext, loaderConfig, loaderCallbacks;\n loaderContext = { url: frag.url, frag: frag, responseType: 'arraybuffer', progressData: false };\n var start = frag.byteRangeStartOffset, end = frag.byteRangeEndOffset;\n if (Number.isFinite(start) && Number.isFinite(end)) {\n loaderContext.rangeStart = start;\n loaderContext.rangeEnd = end;\n }\n loaderConfig = {\n timeout: config.fragLoadingTimeOut,\n maxRetry: 0,\n retryDelay: 0,\n maxRetryDelay: config.fragLoadingMaxRetryTimeout\n };\n loaderCallbacks = {\n onSuccess: this.loadsuccess.bind(this),\n onError: this.loaderror.bind(this),\n onTimeout: this.loadtimeout.bind(this),\n onProgress: this.loadprogress.bind(this)\n };\n loader.load(loaderContext, loaderConfig, loaderCallbacks);\n };\n FragmentLoader.prototype.loadsuccess = function (response, stats, context, networkDetails) {\n if (networkDetails === void 0) { networkDetails = null; }\n var payload = response.data, frag = context.frag;\n // detach fragment loader on load success\n frag.loader = undefined;\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events_1.default.FRAG_LOADED, { payload: payload, frag: frag, stats: stats, networkDetails: networkDetails });\n };\n FragmentLoader.prototype.loaderror = function (response, context, networkDetails) {\n if (networkDetails === void 0) { networkDetails = null; }\n var frag = context.frag;\n var loader = frag.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.NETWORK_ERROR, details: errors_1.ErrorDetails.FRAG_LOAD_ERROR, fatal: false, frag: context.frag, response: response, networkDetails: networkDetails });\n };\n FragmentLoader.prototype.loadtimeout = function (stats, context, networkDetails) {\n if (networkDetails === void 0) { networkDetails = null; }\n var frag = context.frag;\n var loader = frag.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.NETWORK_ERROR, details: errors_1.ErrorDetails.FRAG_LOAD_TIMEOUT, fatal: false, frag: context.frag, networkDetails: networkDetails });\n };\n // data will be used for progressive parsing\n FragmentLoader.prototype.loadprogress = function (stats, context, data, networkDetails) {\n if (networkDetails === void 0) { networkDetails = null; }\n var frag = context.frag;\n frag.loaded = stats.loaded;\n this.hls.trigger(events_1.default.FRAG_LOAD_PROGRESS, { frag: frag, stats: stats, networkDetails: networkDetails });\n };\n return FragmentLoader;\n}(event_handler_1.default));\nexports.default = FragmentLoader;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/loader/fragment.js\":\n/*!********************************!*\\\n !*** ./src/loader/fragment.js ***!\n \\********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar URLToolkit = __webpack_require__(/*! url-toolkit */ \"./node_modules/url-toolkit/src/url-toolkit.js\");\nvar level_key_1 = __webpack_require__(/*! ./level-key */ \"./src/loader/level-key.js\");\nvar Fragment = /** @class */ (function () {\n function Fragment() {\n var _a;\n this._url = null;\n this._byteRange = null;\n this._decryptdata = null;\n this.tagList = [];\n this.programDateTime = null;\n this.rawProgramDateTime = null;\n // Holds the types of data this fragment supports\n this._elementaryStreams = (_a = {},\n _a[Fragment.ElementaryStreamTypes.AUDIO] = false,\n _a[Fragment.ElementaryStreamTypes.VIDEO] = false,\n _a);\n }\n Object.defineProperty(Fragment, \"ElementaryStreamTypes\", {\n /**\n * `type` property for this._elementaryStreams\n *\n * @enum\n */\n get: function () {\n return {\n AUDIO: 'audio',\n VIDEO: 'video'\n };\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Fragment.prototype, \"url\", {\n get: function () {\n if (!this._url && this.relurl) {\n this._url = URLToolkit.buildAbsoluteURL(this.baseurl, this.relurl, { alwaysNormalize: true });\n }\n return this._url;\n },\n set: function (value) {\n this._url = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Fragment.prototype, \"byteRange\", {\n get: function () {\n if (!this._byteRange && !this.rawByteRange) {\n return [];\n }\n if (this._byteRange) {\n return this._byteRange;\n }\n var byteRange = [];\n if (this.rawByteRange) {\n var params = this.rawByteRange.split('@', 2);\n if (params.length === 1) {\n var lastByteRangeEndOffset = this.lastByteRangeEndOffset;\n byteRange[0] = lastByteRangeEndOffset || 0;\n }\n else {\n byteRange[0] = parseInt(params[1]);\n }\n byteRange[1] = parseInt(params[0]) + byteRange[0];\n this._byteRange = byteRange;\n }\n return byteRange;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Fragment.prototype, \"byteRangeStartOffset\", {\n /**\n * @type {number}\n */\n get: function () {\n return this.byteRange[0];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Fragment.prototype, \"byteRangeEndOffset\", {\n get: function () {\n return this.byteRange[1];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Fragment.prototype, \"decryptdata\", {\n get: function () {\n if (!this._decryptdata) {\n this._decryptdata = this.fragmentDecryptdataFromLevelkey(this.levelkey, this.sn);\n }\n return this._decryptdata;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Fragment.prototype, \"endProgramDateTime\", {\n get: function () {\n if (!Number.isFinite(this.programDateTime)) {\n return null;\n }\n var duration = !Number.isFinite(this.duration) ? 0 : this.duration;\n return this.programDateTime + (duration * 1000);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Fragment.prototype, \"encrypted\", {\n get: function () {\n return !!((this.decryptdata && this.decryptdata.uri !== null) && (this.decryptdata.key === null));\n },\n enumerable: true,\n configurable: true\n });\n /**\n * @param {ElementaryStreamType} type\n */\n Fragment.prototype.addElementaryStream = function (type) {\n this._elementaryStreams[type] = true;\n };\n /**\n * @param {ElementaryStreamType} type\n */\n Fragment.prototype.hasElementaryStream = function (type) {\n return this._elementaryStreams[type] === true;\n };\n /**\n * Utility method for parseLevelPlaylist to create an initialization vector for a given segment\n * @returns {Uint8Array}\n */\n Fragment.prototype.createInitializationVector = function (segmentNumber) {\n var uint8View = new Uint8Array(16);\n for (var i = 12; i < 16; i++) {\n uint8View[i] = (segmentNumber >> 8 * (15 - i)) & 0xff;\n }\n return uint8View;\n };\n /**\n * Utility method for parseLevelPlaylist to get a fragment's decryption data from the currently parsed encryption key data\n * @param levelkey - a playlist's encryption info\n * @param segmentNumber - the fragment's segment number\n * @returns {*} - an object to be applied as a fragment's decryptdata\n */\n Fragment.prototype.fragmentDecryptdataFromLevelkey = function (levelkey, segmentNumber) {\n var decryptdata = levelkey;\n if (levelkey && levelkey.method && levelkey.uri && !levelkey.iv) {\n decryptdata = new level_key_1.default();\n decryptdata.method = levelkey.method;\n decryptdata.baseuri = levelkey.baseuri;\n decryptdata.reluri = levelkey.reluri;\n decryptdata.iv = this.createInitializationVector(segmentNumber);\n }\n return decryptdata;\n };\n return Fragment;\n}());\nexports.default = Fragment;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/loader/key-loader.js\":\n/*!**********************************!*\\\n !*** ./src/loader/key-loader.js ***!\n \\**********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/*\n * Decrypt key Loader\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar KeyLoader = /** @class */ (function (_super) {\n __extends(KeyLoader, _super);\n function KeyLoader(hls) {\n var _this = _super.call(this, hls, events_1.default.KEY_LOADING) || this;\n _this.loaders = {};\n _this.decryptkey = null;\n _this.decrypturl = null;\n return _this;\n }\n KeyLoader.prototype.destroy = function () {\n for (var loaderName in this.loaders) {\n var loader = this.loaders[loaderName];\n if (loader) {\n loader.destroy();\n }\n }\n this.loaders = {};\n event_handler_1.default.prototype.destroy.call(this);\n };\n KeyLoader.prototype.onKeyLoading = function (data) {\n var frag = data.frag, type = frag.type, loader = this.loaders[type], decryptdata = frag.decryptdata, uri = decryptdata.uri;\n // if uri is different from previous one or if decrypt key not retrieved yet\n if (uri !== this.decrypturl || this.decryptkey === null) {\n var config = this.hls.config;\n if (loader) {\n logger_1.logger.warn(\"abort previous key loader for type:\" + type);\n loader.abort();\n }\n frag.loader = this.loaders[type] = new config.loader(config);\n this.decrypturl = uri;\n this.decryptkey = null;\n var loaderContext = void 0, loaderConfig = void 0, loaderCallbacks = void 0;\n loaderContext = { url: uri, frag: frag, responseType: 'arraybuffer' };\n // maxRetry is 0 so that instead of retrying the same key on the same variant multiple times,\n // key-loader will trigger an error and rely on stream-controller to handle retry logic.\n // this will also align retry logic with fragment-loader\n loaderConfig = { timeout: config.fragLoadingTimeOut, maxRetry: 0, retryDelay: config.fragLoadingRetryDelay, maxRetryDelay: config.fragLoadingMaxRetryTimeout };\n loaderCallbacks = { onSuccess: this.loadsuccess.bind(this), onError: this.loaderror.bind(this), onTimeout: this.loadtimeout.bind(this) };\n frag.loader.load(loaderContext, loaderConfig, loaderCallbacks);\n }\n else if (this.decryptkey) {\n // we already loaded this key, return it\n decryptdata.key = this.decryptkey;\n this.hls.trigger(events_1.default.KEY_LOADED, { frag: frag });\n }\n };\n KeyLoader.prototype.loadsuccess = function (response, stats, context) {\n var frag = context.frag;\n this.decryptkey = frag.decryptdata.key = new Uint8Array(response.data);\n // detach fragment loader on load success\n frag.loader = undefined;\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events_1.default.KEY_LOADED, { frag: frag });\n };\n KeyLoader.prototype.loaderror = function (response, context) {\n var frag = context.frag, loader = frag.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[context.type] = undefined;\n this.hls.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.NETWORK_ERROR, details: errors_1.ErrorDetails.KEY_LOAD_ERROR, fatal: false, frag: frag, response: response });\n };\n KeyLoader.prototype.loadtimeout = function (stats, context) {\n var frag = context.frag, loader = frag.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[context.type] = undefined;\n this.hls.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.NETWORK_ERROR, details: errors_1.ErrorDetails.KEY_LOAD_TIMEOUT, fatal: false, frag: frag });\n };\n return KeyLoader;\n}(event_handler_1.default));\nexports.default = KeyLoader;\n\n\n/***/ }),\n\n/***/ \"./src/loader/level-key.js\":\n/*!*********************************!*\\\n !*** ./src/loader/level-key.js ***!\n \\*********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar URLToolkit = __webpack_require__(/*! url-toolkit */ \"./node_modules/url-toolkit/src/url-toolkit.js\");\nvar LevelKey = /** @class */ (function () {\n function LevelKey() {\n this.method = null;\n this.key = null;\n this.iv = null;\n this._uri = null;\n }\n Object.defineProperty(LevelKey.prototype, \"uri\", {\n get: function () {\n if (!this._uri && this.reluri) {\n this._uri = URLToolkit.buildAbsoluteURL(this.baseuri, this.reluri, { alwaysNormalize: true });\n }\n return this._uri;\n },\n enumerable: true,\n configurable: true\n });\n return LevelKey;\n}());\nexports.default = LevelKey;\n\n\n/***/ }),\n\n/***/ \"./src/loader/level.js\":\n/*!*****************************!*\\\n !*** ./src/loader/level.js ***!\n \\*****************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Level = /** @class */ (function () {\n function Level(baseUrl) {\n // Please keep properties in alphabetical order\n this.endCC = 0;\n this.endSN = 0;\n this.fragments = [];\n this.initSegment = null;\n this.live = true;\n this.needSidxRanges = false;\n this.startCC = 0;\n this.startSN = 0;\n this.startTimeOffset = null;\n this.targetduration = 0;\n this.totalduration = 0;\n this.type = null;\n this.url = baseUrl;\n this.version = null;\n }\n Object.defineProperty(Level.prototype, \"hasProgramDateTime\", {\n get: function () {\n return !!(this.fragments[0] && Number.isFinite(this.fragments[0].programDateTime));\n },\n enumerable: true,\n configurable: true\n });\n return Level;\n}());\nexports.default = Level;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/loader/m3u8-parser.js\":\n/*!***********************************!*\\\n !*** ./src/loader/m3u8-parser.js ***!\n \\***********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar URLToolkit = __webpack_require__(/*! url-toolkit */ \"./node_modules/url-toolkit/src/url-toolkit.js\");\nvar fragment_1 = __webpack_require__(/*! ./fragment */ \"./src/loader/fragment.js\");\nvar level_1 = __webpack_require__(/*! ./level */ \"./src/loader/level.js\");\nvar level_key_1 = __webpack_require__(/*! ./level-key */ \"./src/loader/level-key.js\");\nvar attr_list_1 = __webpack_require__(/*! ../utils/attr-list */ \"./src/utils/attr-list.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar codecs_1 = __webpack_require__(/*! ../utils/codecs */ \"./src/utils/codecs.js\");\n/**\n * M3U8 parser\n * @module\n */\n// https://regex101.com is your friend\nvar MASTER_PLAYLIST_REGEX = /#EXT-X-STREAM-INF:([^\\n\\r]*)[\\r\\n]+([^\\r\\n]+)/g;\nvar MASTER_PLAYLIST_MEDIA_REGEX = /#EXT-X-MEDIA:(.*)/g;\nvar LEVEL_PLAYLIST_REGEX_FAST = new RegExp([\n /#EXTINF:\\s*(\\d*(?:\\.\\d+)?)(?:,(.*)\\s+)?/.source,\n /|(?!#)([\\S+ ?]+)/.source,\n /|#EXT-X-BYTERANGE:*(.+)/.source,\n /|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,\n /|#.*/.source // All other non-segment oriented tags will match with all groups empty\n].join(''), 'g');\nvar LEVEL_PLAYLIST_REGEX_SLOW = /(?:(?:#(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-(VERSION):(\\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\\r?\\n?/;\nvar MP4_REGEX_SUFFIX = /\\.(mp4|m4s|m4v|m4a)$/i;\nvar M3U8Parser = /** @class */ (function () {\n function M3U8Parser() {\n }\n M3U8Parser.findGroup = function (groups, mediaGroupId) {\n if (!groups) {\n return null;\n }\n var matchingGroup = null;\n for (var i = 0; i < groups.length; i++) {\n var group = groups[i];\n if (group.id === mediaGroupId) {\n matchingGroup = group;\n }\n }\n return matchingGroup;\n };\n M3U8Parser.convertAVC1ToAVCOTI = function (codec) {\n var result, avcdata = codec.split('.');\n if (avcdata.length > 2) {\n result = avcdata.shift() + '.';\n result += parseInt(avcdata.shift()).toString(16);\n result += ('000' + parseInt(avcdata.shift()).toString(16)).substr(-4);\n }\n else {\n result = codec;\n }\n return result;\n };\n M3U8Parser.resolve = function (url, baseUrl) {\n return URLToolkit.buildAbsoluteURL(baseUrl, url, { alwaysNormalize: true });\n };\n M3U8Parser.parseMasterPlaylist = function (string, baseurl) {\n var levels = [], result;\n MASTER_PLAYLIST_REGEX.lastIndex = 0;\n function setCodecs(codecs, level) {\n ['video', 'audio'].forEach(function (type) {\n var filtered = codecs.filter(function (codec) { return codecs_1.isCodecType(codec, type); });\n if (filtered.length) {\n var preferred = filtered.filter(function (codec) {\n return codec.lastIndexOf('avc1', 0) === 0 || codec.lastIndexOf('mp4a', 0) === 0;\n });\n level[type + \"Codec\"] = preferred.length > 0 ? preferred[0] : filtered[0];\n // remove from list\n codecs = codecs.filter(function (codec) { return filtered.indexOf(codec) === -1; });\n }\n });\n level.unknownCodecs = codecs;\n }\n while ((result = MASTER_PLAYLIST_REGEX.exec(string)) != null) {\n var level = {};\n var attrs = level.attrs = new attr_list_1.default(result[1]);\n level.url = M3U8Parser.resolve(result[2], baseurl);\n var resolution = attrs.decimalResolution('RESOLUTION');\n if (resolution) {\n level.width = resolution.width;\n level.height = resolution.height;\n }\n level.bitrate = attrs.decimalInteger('AVERAGE-BANDWIDTH') || attrs.decimalInteger('BANDWIDTH');\n level.name = attrs.NAME;\n setCodecs([].concat((attrs.CODECS || '').split(/[ ,]+/)), level);\n if (level.videoCodec && level.videoCodec.indexOf('avc1') !== -1) {\n level.videoCodec = M3U8Parser.convertAVC1ToAVCOTI(level.videoCodec);\n }\n levels.push(level);\n }\n return levels;\n };\n M3U8Parser.parseMasterPlaylistMedia = function (string, baseurl, type, audioGroups) {\n if (audioGroups === void 0) { audioGroups = []; }\n var result;\n var medias = [];\n var id = 0;\n MASTER_PLAYLIST_MEDIA_REGEX.lastIndex = 0;\n while ((result = MASTER_PLAYLIST_MEDIA_REGEX.exec(string)) !== null) {\n var media = {};\n var attrs = new attr_list_1.default(result[1]);\n if (attrs.TYPE === type) {\n media.groupId = attrs['GROUP-ID'];\n media.name = attrs.NAME;\n media.type = type;\n media.default = (attrs.DEFAULT === 'YES');\n media.autoselect = (attrs.AUTOSELECT === 'YES');\n media.forced = (attrs.FORCED === 'YES');\n if (attrs.URI) {\n media.url = M3U8Parser.resolve(attrs.URI, baseurl);\n }\n media.lang = attrs.LANGUAGE;\n if (!media.name) {\n media.name = media.lang;\n }\n if (audioGroups.length) {\n var groupCodec = M3U8Parser.findGroup(audioGroups, media.groupId);\n media.audioCodec = groupCodec ? groupCodec.codec : audioGroups[0].codec;\n }\n media.id = id++;\n medias.push(media);\n }\n }\n return medias;\n };\n M3U8Parser.parseLevelPlaylist = function (string, baseurl, id, type, levelUrlId) {\n var currentSN = 0;\n var totalduration = 0;\n var level = new level_1.default(baseurl);\n var levelkey = new level_key_1.default();\n var cc = 0;\n var prevFrag = null;\n var frag = new fragment_1.default();\n var result;\n var i;\n var firstPdtIndex = null;\n LEVEL_PLAYLIST_REGEX_FAST.lastIndex = 0;\n while ((result = LEVEL_PLAYLIST_REGEX_FAST.exec(string)) !== null) {\n var duration = result[1];\n if (duration) { // INF\n frag.duration = parseFloat(duration);\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n var title = (' ' + result[2]).slice(1);\n frag.title = title || null;\n frag.tagList.push(title ? ['INF', duration, title] : ['INF', duration]);\n }\n else if (result[3]) { // url\n if (Number.isFinite(frag.duration)) {\n var sn = currentSN++;\n frag.type = type;\n frag.start = totalduration;\n frag.levelkey = levelkey;\n frag.sn = sn;\n frag.level = id;\n frag.cc = cc;\n frag.urlId = levelUrlId;\n frag.baseurl = baseurl;\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n frag.relurl = (' ' + result[3]).slice(1);\n assignProgramDateTime(frag, prevFrag);\n level.fragments.push(frag);\n prevFrag = frag;\n totalduration += frag.duration;\n frag = new fragment_1.default();\n }\n }\n else if (result[4]) { // X-BYTERANGE\n frag.rawByteRange = (' ' + result[4]).slice(1);\n if (prevFrag) {\n var lastByteRangeEndOffset = prevFrag.byteRangeEndOffset;\n if (lastByteRangeEndOffset) {\n frag.lastByteRangeEndOffset = lastByteRangeEndOffset;\n }\n }\n }\n else if (result[5]) { // PROGRAM-DATE-TIME\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n frag.rawProgramDateTime = (' ' + result[5]).slice(1);\n frag.tagList.push(['PROGRAM-DATE-TIME', frag.rawProgramDateTime]);\n if (firstPdtIndex === null) {\n firstPdtIndex = level.fragments.length;\n }\n }\n else {\n result = result[0].match(LEVEL_PLAYLIST_REGEX_SLOW);\n for (i = 1; i < result.length; i++) {\n if (result[i] !== undefined) {\n break;\n }\n }\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n var value1 = (' ' + result[i + 1]).slice(1);\n var value2 = (' ' + result[i + 2]).slice(1);\n switch (result[i]) {\n case '#':\n frag.tagList.push(value2 ? [value1, value2] : [value1]);\n break;\n case 'PLAYLIST-TYPE':\n level.type = value1.toUpperCase();\n break;\n case 'MEDIA-SEQUENCE':\n currentSN = level.startSN = parseInt(value1);\n break;\n case 'TARGETDURATION':\n level.targetduration = parseFloat(value1);\n break;\n case 'VERSION':\n level.version = parseInt(value1);\n break;\n case 'EXTM3U':\n break;\n case 'ENDLIST':\n level.live = false;\n break;\n case 'DIS':\n cc++;\n frag.tagList.push(['DIS']);\n break;\n case 'DISCONTINUITY-SEQ':\n cc = parseInt(value1);\n break;\n case 'KEY':\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-08#section-3.4.4\n var decryptparams = value1;\n var keyAttrs = new attr_list_1.default(decryptparams);\n var decryptmethod = keyAttrs.enumeratedString('METHOD'), decrypturi = keyAttrs.URI, decryptiv = keyAttrs.hexadecimalInteger('IV');\n if (decryptmethod) {\n levelkey = new level_key_1.default();\n if ((decrypturi) && (['AES-128', 'SAMPLE-AES', 'SAMPLE-AES-CENC'].indexOf(decryptmethod) >= 0)) {\n levelkey.method = decryptmethod;\n // URI to get the key\n levelkey.baseuri = baseurl;\n levelkey.reluri = decrypturi;\n levelkey.key = null;\n // Initialization Vector (IV)\n levelkey.iv = decryptiv;\n }\n }\n break;\n case 'START':\n var startParams = value1;\n var startAttrs = new attr_list_1.default(startParams);\n var startTimeOffset = startAttrs.decimalFloatingPoint('TIME-OFFSET');\n // TIME-OFFSET can be 0\n if (Number.isFinite(startTimeOffset)) {\n level.startTimeOffset = startTimeOffset;\n }\n break;\n case 'MAP':\n var mapAttrs = new attr_list_1.default(value1);\n frag.relurl = mapAttrs.URI;\n frag.rawByteRange = mapAttrs.BYTERANGE;\n frag.baseurl = baseurl;\n frag.level = id;\n frag.type = type;\n frag.sn = 'initSegment';\n level.initSegment = frag;\n frag = new fragment_1.default();\n frag.rawProgramDateTime = level.initSegment.rawProgramDateTime;\n break;\n default:\n logger_1.logger.warn(\"line parsed but not handled: \" + result);\n break;\n }\n }\n }\n frag = prevFrag;\n // logger.log('found ' + level.fragments.length + ' fragments');\n if (frag && !frag.relurl) {\n level.fragments.pop();\n totalduration -= frag.duration;\n }\n level.totalduration = totalduration;\n level.averagetargetduration = totalduration / level.fragments.length;\n level.endSN = currentSN - 1;\n level.startCC = level.fragments[0] ? level.fragments[0].cc : 0;\n level.endCC = cc;\n if (!level.initSegment && level.fragments.length) {\n // this is a bit lurky but HLS really has no other way to tell us\n // if the fragments are TS or MP4, except if we download them :/\n // but this is to be able to handle SIDX.\n if (level.fragments.every(function (frag) { return MP4_REGEX_SUFFIX.test(frag.relurl); })) {\n logger_1.logger.warn('MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX');\n frag = new fragment_1.default();\n frag.relurl = level.fragments[0].relurl;\n frag.baseurl = baseurl;\n frag.level = id;\n frag.type = type;\n frag.sn = 'initSegment';\n level.initSegment = frag;\n level.needSidxRanges = true;\n }\n }\n /**\n * Backfill any missing PDT values\n \"If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after\n one or more Media Segment URIs, the client SHOULD extrapolate\n backward from that tag (using EXTINF durations and/or media\n timestamps) to associate dates with those segments.\"\n * We have already extrapolated forward, but all fragments up to the first instance of PDT do not have their PDTs\n * computed.\n */\n if (firstPdtIndex) {\n backfillProgramDateTimes(level.fragments, firstPdtIndex);\n }\n return level;\n };\n return M3U8Parser;\n}());\nexports.default = M3U8Parser;\nfunction backfillProgramDateTimes(fragments, startIndex) {\n var fragPrev = fragments[startIndex];\n for (var i = startIndex - 1; i >= 0; i--) {\n var frag = fragments[i];\n frag.programDateTime = fragPrev.programDateTime - (frag.duration * 1000);\n fragPrev = frag;\n }\n}\nfunction assignProgramDateTime(frag, prevFrag) {\n if (frag.rawProgramDateTime) {\n frag.programDateTime = Date.parse(frag.rawProgramDateTime);\n }\n else if (prevFrag && prevFrag.programDateTime) {\n frag.programDateTime = prevFrag.endProgramDateTime;\n }\n if (!Number.isFinite(frag.programDateTime)) {\n frag.programDateTime = null;\n frag.rawProgramDateTime = null;\n }\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/loader/playlist-loader.js\":\n/*!***************************************!*\\\n !*** ./src/loader/playlist-loader.js ***!\n \\***************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\n/**\n * PlaylistLoader - delegate for media manifest/playlist loading tasks. Takes care of parsing media to internal data-models.\n *\n * Once loaded, dispatches events with parsed data-models of manifest/levels/audio/subtitle tracks.\n *\n * Uses loader(s) set in config to do actual internal loading of resource tasks.\n *\n * @module\n *\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar event_handler_1 = __webpack_require__(/*! ../event-handler */ \"./src/event-handler.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar mp4demuxer_1 = __webpack_require__(/*! ../demux/mp4demuxer */ \"./src/demux/mp4demuxer.js\");\nvar m3u8_parser_1 = __webpack_require__(/*! ./m3u8-parser */ \"./src/loader/m3u8-parser.js\");\nvar performance = window.performance;\n/**\n * `type` property values for this loaders' context object\n * @enum\n *\n */\nvar ContextType = {\n MANIFEST: 'manifest',\n LEVEL: 'level',\n AUDIO_TRACK: 'audioTrack',\n SUBTITLE_TRACK: 'subtitleTrack'\n};\n/**\n * @enum {string}\n */\nvar LevelType = {\n MAIN: 'main',\n AUDIO: 'audio',\n SUBTITLE: 'subtitle'\n};\n/**\n * @constructor\n */\nvar PlaylistLoader = /** @class */ (function (_super) {\n __extends(PlaylistLoader, _super);\n /**\n * @constructs\n * @param {Hls} hls\n */\n function PlaylistLoader(hls) {\n var _this = _super.call(this, hls, events_1.default.MANIFEST_LOADING, events_1.default.LEVEL_LOADING, events_1.default.AUDIO_TRACK_LOADING, events_1.default.SUBTITLE_TRACK_LOADING) || this;\n _this.loaders = {};\n return _this;\n }\n Object.defineProperty(PlaylistLoader, \"ContextType\", {\n get: function () {\n return ContextType;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PlaylistLoader, \"LevelType\", {\n get: function () {\n return LevelType;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * @param {ContextType} type\n * @returns {boolean}\n */\n PlaylistLoader.canHaveQualityLevels = function (type) {\n return (type !== ContextType.AUDIO_TRACK &&\n type !== ContextType.SUBTITLE_TRACK);\n };\n /**\n * Map context.type to LevelType\n * @param {{type: ContextType}} context\n * @returns {LevelType}\n */\n PlaylistLoader.mapContextToLevelType = function (context) {\n var type = context.type;\n switch (type) {\n case ContextType.AUDIO_TRACK:\n return LevelType.AUDIO;\n case ContextType.SUBTITLE_TRACK:\n return LevelType.SUBTITLE;\n default:\n return LevelType.MAIN;\n }\n };\n PlaylistLoader.getResponseUrl = function (response, context) {\n var url = response.url;\n // responseURL not supported on some browsers (it is used to detect URL redirection)\n // data-uri mode also not supported (but no need to detect redirection)\n if (url === undefined || url.indexOf('data:') === 0) {\n // fallback to initial URL\n url = context.url;\n }\n return url;\n };\n /**\n * Returns defaults or configured loader-type overloads (pLoader and loader config params)\n * Default loader is XHRLoader (see utils)\n * @param {object} context\n * @returns {XHRLoader} or other compatible configured overload\n */\n PlaylistLoader.prototype.createInternalLoader = function (context) {\n var config = this.hls.config;\n var PLoader = config.pLoader;\n var Loader = config.loader;\n var InternalLoader = PLoader || Loader;\n var loader = new InternalLoader(config);\n context.loader = loader;\n this.loaders[context.type] = loader;\n return loader;\n };\n PlaylistLoader.prototype.getInternalLoader = function (context) {\n return this.loaders[context.type];\n };\n PlaylistLoader.prototype.resetInternalLoader = function (contextType) {\n if (this.loaders[contextType]) {\n delete this.loaders[contextType];\n }\n };\n /**\n * Call `destroy` on all internal loader instances mapped (one per context type)\n */\n PlaylistLoader.prototype.destroyInternalLoaders = function () {\n for (var contextType in this.loaders) {\n var loader = this.loaders[contextType];\n if (loader) {\n loader.destroy();\n }\n this.resetInternalLoader(contextType);\n }\n };\n PlaylistLoader.prototype.destroy = function () {\n this.destroyInternalLoaders();\n _super.prototype.destroy.call(this);\n };\n PlaylistLoader.prototype.onManifestLoading = function (data) {\n this.load(data.url, { type: ContextType.MANIFEST, level: 0, id: null });\n };\n PlaylistLoader.prototype.onLevelLoading = function (data) {\n this.load(data.url, { type: ContextType.LEVEL, level: data.level, id: data.id });\n };\n PlaylistLoader.prototype.onAudioTrackLoading = function (data) {\n this.load(data.url, { type: ContextType.AUDIO_TRACK, level: null, id: data.id });\n };\n PlaylistLoader.prototype.onSubtitleTrackLoading = function (data) {\n this.load(data.url, { type: ContextType.SUBTITLE_TRACK, level: null, id: data.id });\n };\n PlaylistLoader.prototype.load = function (url, context) {\n var config = this.hls.config;\n logger_1.logger.debug(\"Loading playlist of type \" + context.type + \", level: \" + context.level + \", id: \" + context.id);\n // Check if a loader for this context already exists\n var loader = this.getInternalLoader(context);\n if (loader) {\n var loaderContext = loader.context;\n if (loaderContext && loaderContext.url === url) { // same URL can't overlap\n logger_1.logger.trace('playlist request ongoing');\n return false;\n }\n else {\n logger_1.logger.warn(\"aborting previous loader for type: \" + context.type);\n loader.abort();\n }\n }\n var maxRetry, timeout, retryDelay, maxRetryDelay;\n // apply different configs for retries depending on\n // context (manifest, level, audio/subs playlist)\n switch (context.type) {\n case ContextType.MANIFEST:\n maxRetry = config.manifestLoadingMaxRetry;\n timeout = config.manifestLoadingTimeOut;\n retryDelay = config.manifestLoadingRetryDelay;\n maxRetryDelay = config.manifestLoadingMaxRetryTimeout;\n break;\n case ContextType.LEVEL:\n // Disable internal loader retry logic, since we are managing retries in Level Controller\n maxRetry = 0;\n timeout = config.levelLoadingTimeOut;\n // TODO Introduce retry settings for audio-track and subtitle-track, it should not use level retry config\n break;\n default:\n maxRetry = config.levelLoadingMaxRetry;\n timeout = config.levelLoadingTimeOut;\n retryDelay = config.levelLoadingRetryDelay;\n maxRetryDelay = config.levelLoadingMaxRetryTimeout;\n break;\n }\n loader = this.createInternalLoader(context);\n context.url = url;\n context.responseType = context.responseType || ''; // FIXME: (should not be necessary to do this)\n var loaderConfig = {\n timeout: timeout,\n maxRetry: maxRetry,\n retryDelay: retryDelay,\n maxRetryDelay: maxRetryDelay\n };\n var loaderCallbacks = {\n onSuccess: this.loadsuccess.bind(this),\n onError: this.loaderror.bind(this),\n onTimeout: this.loadtimeout.bind(this)\n };\n logger_1.logger.debug(\"Calling internal loader delegate for URL: \" + url);\n loader.load(context, loaderConfig, loaderCallbacks);\n return true;\n };\n PlaylistLoader.prototype.loadsuccess = function (response, stats, context, networkDetails) {\n if (networkDetails === void 0) { networkDetails = null; }\n if (context.isSidxRequest) {\n this._handleSidxRequest(response, context);\n this._handlePlaylistLoaded(response, stats, context, networkDetails);\n return;\n }\n this.resetInternalLoader(context.type);\n var string = response.data;\n stats.tload = performance.now();\n // stats.mtime = new Date(target.getResponseHeader('Last-Modified'));\n // Validate if it is an M3U8 at all\n if (string.indexOf('#EXTM3U') !== 0) {\n this._handleManifestParsingError(response, context, 'no EXTM3U delimiter', networkDetails);\n return;\n }\n // Check if chunk-list or master. handle empty chunk list case (first EXTINF not signaled, but TARGETDURATION present)\n if (string.indexOf('#EXTINF:') > 0 || string.indexOf('#EXT-X-TARGETDURATION:') > 0) {\n this._handleTrackOrLevelPlaylist(response, stats, context, networkDetails);\n }\n else {\n this._handleMasterPlaylist(response, stats, context, networkDetails);\n }\n };\n PlaylistLoader.prototype.loaderror = function (response, context, networkDetails) {\n if (networkDetails === void 0) { networkDetails = null; }\n this._handleNetworkError(context, networkDetails, false, response);\n };\n PlaylistLoader.prototype.loadtimeout = function (stats, context, networkDetails) {\n if (networkDetails === void 0) { networkDetails = null; }\n this._handleNetworkError(context, networkDetails, true);\n };\n PlaylistLoader.prototype._handleMasterPlaylist = function (response, stats, context, networkDetails) {\n var hls = this.hls;\n var string = response.data;\n var url = PlaylistLoader.getResponseUrl(response, context);\n var levels = m3u8_parser_1.default.parseMasterPlaylist(string, url);\n if (!levels.length) {\n this._handleManifestParsingError(response, context, 'no level found in manifest', networkDetails);\n return;\n }\n // multi level playlist, parse level info\n var audioGroups = levels.map(function (level) { return ({\n id: level.attrs.AUDIO,\n codec: level.audioCodec\n }); });\n var audioTracks = m3u8_parser_1.default.parseMasterPlaylistMedia(string, url, 'AUDIO', audioGroups);\n var subtitles = m3u8_parser_1.default.parseMasterPlaylistMedia(string, url, 'SUBTITLES');\n if (audioTracks.length) {\n // check if we have found an audio track embedded in main playlist (audio track without URI attribute)\n var embeddedAudioFound_1 = false;\n audioTracks.forEach(function (audioTrack) {\n if (!audioTrack.url) {\n embeddedAudioFound_1 = true;\n }\n });\n // if no embedded audio track defined, but audio codec signaled in quality level,\n // we need to signal this main audio track this could happen with playlists with\n // alt audio rendition in which quality levels (main)\n // contains both audio+video. but with mixed audio track not signaled\n if (embeddedAudioFound_1 === false && levels[0].audioCodec && !levels[0].attrs.AUDIO) {\n logger_1.logger.log('audio codec signaled in quality level, but no embedded audio track signaled, create one');\n audioTracks.unshift({\n type: 'main',\n name: 'main'\n });\n }\n }\n hls.trigger(events_1.default.MANIFEST_LOADED, {\n levels: levels,\n audioTracks: audioTracks,\n subtitles: subtitles,\n url: url,\n stats: stats,\n networkDetails: networkDetails\n });\n };\n PlaylistLoader.prototype._handleTrackOrLevelPlaylist = function (response, stats, context, networkDetails) {\n var hls = this.hls;\n var id = context.id, level = context.level, type = context.type;\n var url = PlaylistLoader.getResponseUrl(response, context);\n var levelUrlId = Number.isFinite(id) ? id : 0;\n var levelId = Number.isFinite(level) ? level : levelUrlId;\n var levelType = PlaylistLoader.mapContextToLevelType(context);\n var levelDetails = m3u8_parser_1.default.parseLevelPlaylist(response.data, url, levelId, levelType, levelUrlId);\n // set stats on level structure\n levelDetails.tload = stats.tload;\n // We have done our first request (Manifest-type) and receive\n // not a master playlist but a chunk-list (track/level)\n // We fire the manifest-loaded event anyway with the parsed level-details\n // by creating a single-level structure for it.\n if (type === ContextType.MANIFEST) {\n var singleLevel = {\n url: url,\n details: levelDetails\n };\n hls.trigger(events_1.default.MANIFEST_LOADED, {\n levels: [singleLevel],\n audioTracks: [],\n url: url,\n stats: stats,\n networkDetails: networkDetails\n });\n }\n // save parsing time\n stats.tparsed = performance.now();\n // in case we need SIDX ranges\n // return early after calling load for\n // the SIDX box.\n if (levelDetails.needSidxRanges) {\n var sidxUrl = levelDetails.initSegment.url;\n this.load(sidxUrl, {\n isSidxRequest: true,\n type: type,\n level: level,\n levelDetails: levelDetails,\n id: id,\n rangeStart: 0,\n rangeEnd: 2048,\n responseType: 'arraybuffer'\n });\n return;\n }\n // extend the context with the new levelDetails property\n context.levelDetails = levelDetails;\n this._handlePlaylistLoaded(response, stats, context, networkDetails);\n };\n PlaylistLoader.prototype._handleSidxRequest = function (response, context) {\n var sidxInfo = mp4demuxer_1.default.parseSegmentIndex(new Uint8Array(response.data));\n // if provided fragment does not contain sidx, early return\n if (!sidxInfo) {\n return;\n }\n var sidxReferences = sidxInfo.references;\n var levelDetails = context.levelDetails;\n sidxReferences.forEach(function (segmentRef, index) {\n var segRefInfo = segmentRef.info;\n var frag = levelDetails.fragments[index];\n if (frag.byteRange.length === 0) {\n frag.rawByteRange = String(1 + segRefInfo.end - segRefInfo.start) + '@' + String(segRefInfo.start);\n }\n });\n levelDetails.initSegment.rawByteRange = String(sidxInfo.moovEndOffset) + '@0';\n };\n PlaylistLoader.prototype._handleManifestParsingError = function (response, context, reason, networkDetails) {\n this.hls.trigger(events_1.default.ERROR, {\n type: errors_1.ErrorTypes.NETWORK_ERROR,\n details: errors_1.ErrorDetails.MANIFEST_PARSING_ERROR,\n fatal: true,\n url: response.url,\n reason: reason,\n networkDetails: networkDetails\n });\n };\n PlaylistLoader.prototype._handleNetworkError = function (context, networkDetails, timeout, response) {\n if (timeout === void 0) { timeout = false; }\n if (response === void 0) { response = null; }\n logger_1.logger.info(\"A network error occured while loading a \" + context.type + \"-type playlist\");\n var details;\n var fatal;\n var loader = this.getInternalLoader(context);\n switch (context.type) {\n case ContextType.MANIFEST:\n details = (timeout ? errors_1.ErrorDetails.MANIFEST_LOAD_TIMEOUT : errors_1.ErrorDetails.MANIFEST_LOAD_ERROR);\n fatal = true;\n break;\n case ContextType.LEVEL:\n details = (timeout ? errors_1.ErrorDetails.LEVEL_LOAD_TIMEOUT : errors_1.ErrorDetails.LEVEL_LOAD_ERROR);\n fatal = false;\n break;\n case ContextType.AUDIO_TRACK:\n details = (timeout ? errors_1.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT : errors_1.ErrorDetails.AUDIO_TRACK_LOAD_ERROR);\n fatal = false;\n break;\n default:\n // details = ...?\n fatal = false;\n }\n if (loader) {\n loader.abort();\n this.resetInternalLoader(context.type);\n }\n var errorData = {\n type: errors_1.ErrorTypes.NETWORK_ERROR,\n details: details,\n fatal: fatal,\n url: loader.url,\n loader: loader,\n context: context,\n networkDetails: networkDetails\n };\n if (response) {\n errorData.response = response;\n }\n this.hls.trigger(events_1.default.ERROR, errorData);\n };\n PlaylistLoader.prototype._handlePlaylistLoaded = function (response, stats, context, networkDetails) {\n var type = context.type, level = context.level, id = context.id, levelDetails = context.levelDetails;\n if (!levelDetails.targetduration) {\n this._handleManifestParsingError(response, context, 'invalid target duration', networkDetails);\n return;\n }\n var canHaveLevels = PlaylistLoader.canHaveQualityLevels(context.type);\n if (canHaveLevels) {\n this.hls.trigger(events_1.default.LEVEL_LOADED, {\n details: levelDetails,\n level: level || 0,\n id: id || 0,\n stats: stats,\n networkDetails: networkDetails\n });\n }\n else {\n switch (type) {\n case ContextType.AUDIO_TRACK:\n this.hls.trigger(events_1.default.AUDIO_TRACK_LOADED, {\n details: levelDetails,\n id: id,\n stats: stats,\n networkDetails: networkDetails\n });\n break;\n case ContextType.SUBTITLE_TRACK:\n this.hls.trigger(events_1.default.SUBTITLE_TRACK_LOADED, {\n details: levelDetails,\n id: id,\n stats: stats,\n networkDetails: networkDetails\n });\n break;\n }\n }\n };\n return PlaylistLoader;\n}(event_handler_1.default));\nexports.default = PlaylistLoader;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/observer.js\":\n/*!*************************!*\\\n !*** ./src/observer.js ***!\n \\*************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar eventemitter3_1 = __webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.js\");\n/**\n * @class\n *\n * Simple adapter sub-class of Nodejs-like EventEmitter.\n *\n * We simply want to pass along the event-name itself\n * in every call to a handler, which is the purpose of our `trigger` method\n * extending the standard API.\n *\n */\nvar Observer = /** @class */ (function (_super) {\n __extends(Observer, _super);\n function Observer() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n *\n * @param {string} event\n * @param {any} data\n */\n Observer.prototype.trigger = function (event) {\n var data = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n data[_i - 1] = arguments[_i];\n }\n this.emit.apply(this, [event, event].concat(data));\n };\n return Observer;\n}(eventemitter3_1.EventEmitter));\nexports.Observer = Observer;\n\n\n/***/ }),\n\n/***/ \"./src/polyfills/number.js\":\n/*!*********************************!*\\\n !*** ./src/polyfills/number.js ***!\n \\*********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar get_self_scope_1 = __webpack_require__(/*! ../utils/get-self-scope */ \"./src/utils/get-self-scope.js\");\nvar self = get_self_scope_1.getSelfScope();\nvar Number = self.Number;\nexports.Number = Number;\n// TODO: get rid of global polyfills and replace them with wrappers (\"ponyfills\")\nNumber.isFinite = Number.isFinite || function (value) {\n return typeof value === 'number' && isFinite(value);\n};\n\n\n/***/ }),\n\n/***/ \"./src/remux/aac-helper.js\":\n/*!*********************************!*\\\n !*** ./src/remux/aac-helper.js ***!\n \\*********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * AAC helper\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar AAC = /** @class */ (function () {\n function AAC() {\n }\n AAC.getSilentFrame = function (codec, channelCount) {\n switch (codec) {\n case 'mp4a.40.2':\n if (channelCount === 1) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x23, 0x80]);\n }\n else if (channelCount === 2) {\n return new Uint8Array([0x21, 0x00, 0x49, 0x90, 0x02, 0x19, 0x00, 0x23, 0x80]);\n }\n else if (channelCount === 3) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64, 0x00, 0x8e]);\n }\n else if (channelCount === 4) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64, 0x00, 0x80, 0x2c, 0x80, 0x08, 0x02, 0x38]);\n }\n else if (channelCount === 5) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64, 0x00, 0x82, 0x30, 0x04, 0x99, 0x00, 0x21, 0x90, 0x02, 0x38]);\n }\n else if (channelCount === 6) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64, 0x00, 0x82, 0x30, 0x04, 0x99, 0x00, 0x21, 0x90, 0x02, 0x00, 0xb2, 0x00, 0x20, 0x08, 0xe0]);\n }\n break;\n // handle HE-AAC below (mp4a.40.5 / mp4a.40.29)\n default:\n if (channelCount === 1) {\n // ffmpeg -y -f lavfi -i \"aevalsrc=0:d=0.05\" -c:a libfdk_aac -profile:a aac_he -b:a 4k output.aac && hexdump -v -e '16/1 \"0x%x,\" \"\\n\"' -v output.aac\n return new Uint8Array([0x1, 0x40, 0x22, 0x80, 0xa3, 0x4e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x1c, 0x6, 0xf1, 0xc1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e]);\n }\n else if (channelCount === 2) {\n // ffmpeg -y -f lavfi -i \"aevalsrc=0|0:d=0.05\" -c:a libfdk_aac -profile:a aac_he_v2 -b:a 4k output.aac && hexdump -v -e '16/1 \"0x%x,\" \"\\n\"' -v output.aac\n return new Uint8Array([0x1, 0x40, 0x22, 0x80, 0xa3, 0x5e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x0, 0x95, 0x0, 0x6, 0xf1, 0xa1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e]);\n }\n else if (channelCount === 3) {\n // ffmpeg -y -f lavfi -i \"aevalsrc=0|0|0:d=0.05\" -c:a libfdk_aac -profile:a aac_he_v2 -b:a 4k output.aac && hexdump -v -e '16/1 \"0x%x,\" \"\\n\"' -v output.aac\n return new Uint8Array([0x1, 0x40, 0x22, 0x80, 0xa3, 0x5e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x0, 0x95, 0x0, 0x6, 0xf1, 0xa1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e]);\n }\n break;\n }\n return null;\n };\n return AAC;\n}());\nexports.default = AAC;\n\n\n/***/ }),\n\n/***/ \"./src/remux/mp4-generator.js\":\n/*!************************************!*\\\n !*** ./src/remux/mp4-generator.js ***!\n \\************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * Generate MP4 Box\n*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar UINT32_MAX = Math.pow(2, 32) - 1;\nvar MP4 = /** @class */ (function () {\n function MP4() {\n }\n MP4.init = function () {\n MP4.types = {\n avc1: [],\n avcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n '.mp3': [],\n mvex: [],\n mvhd: [],\n pasp: [],\n sdtp: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: [],\n smhd: []\n };\n var i;\n for (i in MP4.types) {\n if (MP4.types.hasOwnProperty(i)) {\n MP4.types[i] = [\n i.charCodeAt(0),\n i.charCodeAt(1),\n i.charCodeAt(2),\n i.charCodeAt(3)\n ];\n }\n }\n var videoHdlr = new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x76, 0x69, 0x64, 0x65,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x56, 0x69, 0x64, 0x65,\n 0x6f, 0x48, 0x61, 0x6e,\n 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'\n ]);\n var audioHdlr = new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x73, 0x6f, 0x75, 0x6e,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x53, 0x6f, 0x75, 0x6e,\n 0x64, 0x48, 0x61, 0x6e,\n 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler'\n ]);\n MP4.HDLR_TYPES = {\n 'video': videoHdlr,\n 'audio': audioHdlr\n };\n var dref = new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x01,\n 0x00, 0x00, 0x00, 0x0c,\n 0x75, 0x72, 0x6c, 0x20,\n 0x00,\n 0x00, 0x00, 0x01 // entry_flags\n ]);\n var stco = new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n MP4.STTS = MP4.STSC = MP4.STCO = stco;\n MP4.STSZ = new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00 // sample_count\n ]);\n MP4.VMHD = new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x01,\n 0x00, 0x00,\n 0x00, 0x00,\n 0x00, 0x00,\n 0x00, 0x00 // opcolor\n ]);\n MP4.SMHD = new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x00,\n 0x00, 0x00 // reserved\n ]);\n MP4.STSD = new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x01\n ]); // entry_count\n var majorBrand = new Uint8Array([105, 115, 111, 109]); // isom\n var avc1Brand = new Uint8Array([97, 118, 99, 49]); // avc1\n var minorVersion = new Uint8Array([0, 0, 0, 1]);\n MP4.FTYP = MP4.box(MP4.types.ftyp, majorBrand, minorVersion, majorBrand, avc1Brand);\n MP4.DINF = MP4.box(MP4.types.dinf, MP4.box(MP4.types.dref, dref));\n };\n MP4.box = function (type) {\n var payload = Array.prototype.slice.call(arguments, 1), size = 8, i = payload.length, len = i, result;\n // calculate the total size we need to allocate\n while (i--) {\n size += payload[i].byteLength;\n }\n result = new Uint8Array(size);\n result[0] = (size >> 24) & 0xff;\n result[1] = (size >> 16) & 0xff;\n result[2] = (size >> 8) & 0xff;\n result[3] = size & 0xff;\n result.set(type, 4);\n // copy the payload into the result\n for (i = 0, size = 8; i < len; i++) {\n // copy payload[i] array @ offset size\n result.set(payload[i], size);\n size += payload[i].byteLength;\n }\n return result;\n };\n MP4.hdlr = function (type) {\n return MP4.box(MP4.types.hdlr, MP4.HDLR_TYPES[type]);\n };\n MP4.mdat = function (data) {\n return MP4.box(MP4.types.mdat, data);\n };\n MP4.mdhd = function (timescale, duration) {\n duration *= timescale;\n var upperWordDuration = Math.floor(duration / (UINT32_MAX + 1));\n var lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));\n return MP4.box(MP4.types.mdhd, new Uint8Array([\n 0x01,\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,\n (timescale >> 24) & 0xFF,\n (timescale >> 16) & 0xFF,\n (timescale >> 8) & 0xFF,\n timescale & 0xFF,\n (upperWordDuration >> 24),\n (upperWordDuration >> 16) & 0xFF,\n (upperWordDuration >> 8) & 0xFF,\n upperWordDuration & 0xFF,\n (lowerWordDuration >> 24),\n (lowerWordDuration >> 16) & 0xFF,\n (lowerWordDuration >> 8) & 0xFF,\n lowerWordDuration & 0xFF,\n 0x55, 0xc4,\n 0x00, 0x00\n ]));\n };\n MP4.mdia = function (track) {\n return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale, track.duration), MP4.hdlr(track.type), MP4.minf(track));\n };\n MP4.mfhd = function (sequenceNumber) {\n return MP4.box(MP4.types.mfhd, new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n (sequenceNumber >> 24),\n (sequenceNumber >> 16) & 0xFF,\n (sequenceNumber >> 8) & 0xFF,\n sequenceNumber & 0xFF // sequence_number\n ]));\n };\n MP4.minf = function (track) {\n if (track.type === 'audio') {\n return MP4.box(MP4.types.minf, MP4.box(MP4.types.smhd, MP4.SMHD), MP4.DINF, MP4.stbl(track));\n }\n else {\n return MP4.box(MP4.types.minf, MP4.box(MP4.types.vmhd, MP4.VMHD), MP4.DINF, MP4.stbl(track));\n }\n };\n MP4.moof = function (sn, baseMediaDecodeTime, track) {\n return MP4.box(MP4.types.moof, MP4.mfhd(sn), MP4.traf(track, baseMediaDecodeTime));\n };\n /**\n * @param tracks... (optional) {array} the tracks associated with this movie\n */\n MP4.moov = function (tracks) {\n var i = tracks.length, boxes = [];\n while (i--) {\n boxes[i] = MP4.trak(tracks[i]);\n }\n return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(tracks[0].timescale, tracks[0].duration)].concat(boxes).concat(MP4.mvex(tracks)));\n };\n MP4.mvex = function (tracks) {\n var i = tracks.length, boxes = [];\n while (i--) {\n boxes[i] = MP4.trex(tracks[i]);\n }\n return MP4.box.apply(null, [MP4.types.mvex].concat(boxes));\n };\n MP4.mvhd = function (timescale, duration) {\n duration *= timescale;\n var upperWordDuration = Math.floor(duration / (UINT32_MAX + 1));\n var lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));\n var bytes = new Uint8Array([\n 0x01,\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,\n (timescale >> 24) & 0xFF,\n (timescale >> 16) & 0xFF,\n (timescale >> 8) & 0xFF,\n timescale & 0xFF,\n (upperWordDuration >> 24),\n (upperWordDuration >> 16) & 0xFF,\n (upperWordDuration >> 8) & 0xFF,\n upperWordDuration & 0xFF,\n (lowerWordDuration >> 24),\n (lowerWordDuration >> 16) & 0xFF,\n (lowerWordDuration >> 8) & 0xFF,\n lowerWordDuration & 0xFF,\n 0x00, 0x01, 0x00, 0x00,\n 0x01, 0x00,\n 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0xff, 0xff, 0xff, 0xff // next_track_ID\n ]);\n return MP4.box(MP4.types.mvhd, bytes);\n };\n MP4.sdtp = function (track) {\n var samples = track.samples || [], bytes = new Uint8Array(4 + samples.length), flags, i;\n // leave the full box header (4 bytes) all zero\n // write the sample table\n for (i = 0; i < samples.length; i++) {\n flags = samples[i].flags;\n bytes[i + 4] = (flags.dependsOn << 4) |\n (flags.isDependedOn << 2) |\n (flags.hasRedundancy);\n }\n return MP4.box(MP4.types.sdtp, bytes);\n };\n MP4.stbl = function (track) {\n return MP4.box(MP4.types.stbl, MP4.stsd(track), MP4.box(MP4.types.stts, MP4.STTS), MP4.box(MP4.types.stsc, MP4.STSC), MP4.box(MP4.types.stsz, MP4.STSZ), MP4.box(MP4.types.stco, MP4.STCO));\n };\n MP4.avc1 = function (track) {\n var sps = [], pps = [], i, data, len;\n // assemble the SPSs\n for (i = 0; i < track.sps.length; i++) {\n data = track.sps[i];\n len = data.byteLength;\n sps.push((len >>> 8) & 0xFF);\n sps.push((len & 0xFF));\n // SPS\n sps = sps.concat(Array.prototype.slice.call(data));\n }\n // assemble the PPSs\n for (i = 0; i < track.pps.length; i++) {\n data = track.pps[i];\n len = data.byteLength;\n pps.push((len >>> 8) & 0xFF);\n pps.push((len & 0xFF));\n pps = pps.concat(Array.prototype.slice.call(data));\n }\n var avcc = MP4.box(MP4.types.avcC, new Uint8Array([\n 0x01,\n sps[3],\n sps[4],\n sps[5],\n 0xfc | 3,\n 0xE0 | track.sps.length // 3bit reserved (111) + numOfSequenceParameterSets\n ].concat(sps).concat([\n track.pps.length // numOfPictureParameterSets\n ]).concat(pps))), // \"PPS\"\n width = track.width, height = track.height, hSpacing = track.pixelRatio[0], vSpacing = track.pixelRatio[1];\n return MP4.box(MP4.types.avc1, new Uint8Array([\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x01,\n 0x00, 0x00,\n 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n (width >> 8) & 0xFF,\n width & 0xff,\n (height >> 8) & 0xFF,\n height & 0xff,\n 0x00, 0x48, 0x00, 0x00,\n 0x00, 0x48, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01,\n 0x12,\n 0x64, 0x61, 0x69, 0x6C,\n 0x79, 0x6D, 0x6F, 0x74,\n 0x69, 0x6F, 0x6E, 0x2F,\n 0x68, 0x6C, 0x73, 0x2E,\n 0x6A, 0x73, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x18,\n 0x11, 0x11\n ]), // pre_defined = -1\n avcc, MP4.box(MP4.types.btrt, new Uint8Array([\n 0x00, 0x1c, 0x9c, 0x80,\n 0x00, 0x2d, 0xc6, 0xc0,\n 0x00, 0x2d, 0xc6, 0xc0\n ])), // avgBitrate\n MP4.box(MP4.types.pasp, new Uint8Array([\n (hSpacing >> 24),\n (hSpacing >> 16) & 0xFF,\n (hSpacing >> 8) & 0xFF,\n hSpacing & 0xFF,\n (vSpacing >> 24),\n (vSpacing >> 16) & 0xFF,\n (vSpacing >> 8) & 0xFF,\n vSpacing & 0xFF\n ])));\n };\n MP4.esds = function (track) {\n var configlen = track.config.length;\n return new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n 0x03,\n 0x17 + configlen,\n 0x00, 0x01,\n 0x00,\n 0x04,\n 0x0f + configlen,\n 0x40,\n 0x15,\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x05 // descriptor_type\n ].concat([configlen]).concat(track.config).concat([0x06, 0x01, 0x02])); // GASpecificConfig)); // length + audio config descriptor\n };\n MP4.mp4a = function (track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types.mp4a, new Uint8Array([\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x01,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, track.channelCount,\n 0x00, 0x10,\n 0x00, 0x00, 0x00, 0x00,\n (samplerate >> 8) & 0xFF,\n samplerate & 0xff,\n 0x00, 0x00\n ]), MP4.box(MP4.types.esds, MP4.esds(track)));\n };\n MP4.mp3 = function (track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types['.mp3'], new Uint8Array([\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00,\n 0x00, 0x01,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, track.channelCount,\n 0x00, 0x10,\n 0x00, 0x00, 0x00, 0x00,\n (samplerate >> 8) & 0xFF,\n samplerate & 0xff,\n 0x00, 0x00\n ]));\n };\n MP4.stsd = function (track) {\n if (track.type === 'audio') {\n if (!track.isAAC && track.codec === 'mp3') {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp3(track));\n }\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track));\n }\n else {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track));\n }\n };\n MP4.tkhd = function (track) {\n var id = track.id, duration = track.duration * track.timescale, width = track.width, height = track.height, upperWordDuration = Math.floor(duration / (UINT32_MAX + 1)), lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));\n return MP4.box(MP4.types.tkhd, new Uint8Array([\n 0x01,\n 0x00, 0x00, 0x07,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,\n (id >> 24) & 0xFF,\n (id >> 16) & 0xFF,\n (id >> 8) & 0xFF,\n id & 0xFF,\n 0x00, 0x00, 0x00, 0x00,\n (upperWordDuration >> 24),\n (upperWordDuration >> 16) & 0xFF,\n (upperWordDuration >> 8) & 0xFF,\n upperWordDuration & 0xFF,\n (lowerWordDuration >> 24),\n (lowerWordDuration >> 16) & 0xFF,\n (lowerWordDuration >> 8) & 0xFF,\n lowerWordDuration & 0xFF,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00,\n 0x00, 0x00,\n 0x00, 0x00,\n 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x00, 0x00, 0x00,\n (width >> 8) & 0xFF,\n width & 0xFF,\n 0x00, 0x00,\n (height >> 8) & 0xFF,\n height & 0xFF,\n 0x00, 0x00 // height\n ]));\n };\n MP4.traf = function (track, baseMediaDecodeTime) {\n var sampleDependencyTable = MP4.sdtp(track), id = track.id, upperWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime / (UINT32_MAX + 1)), lowerWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime % (UINT32_MAX + 1));\n return MP4.box(MP4.types.traf, MP4.box(MP4.types.tfhd, new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n (id >> 24),\n (id >> 16) & 0XFF,\n (id >> 8) & 0XFF,\n (id & 0xFF) // track_ID\n ])), MP4.box(MP4.types.tfdt, new Uint8Array([\n 0x01,\n 0x00, 0x00, 0x00,\n (upperWordBaseMediaDecodeTime >> 24),\n (upperWordBaseMediaDecodeTime >> 16) & 0XFF,\n (upperWordBaseMediaDecodeTime >> 8) & 0XFF,\n (upperWordBaseMediaDecodeTime & 0xFF),\n (lowerWordBaseMediaDecodeTime >> 24),\n (lowerWordBaseMediaDecodeTime >> 16) & 0XFF,\n (lowerWordBaseMediaDecodeTime >> 8) & 0XFF,\n (lowerWordBaseMediaDecodeTime & 0xFF)\n ])), MP4.trun(track, sampleDependencyTable.length +\n 16 + // tfhd\n 20 + // tfdt\n 8 + // traf header\n 16 + // mfhd\n 8 + // moof header\n 8), // mdat header\n sampleDependencyTable);\n };\n /**\n * Generate a track box.\n * @param track {object} a track definition\n * @return {Uint8Array} the track box\n */\n MP4.trak = function (track) {\n track.duration = track.duration || 0xffffffff;\n return MP4.box(MP4.types.trak, MP4.tkhd(track), MP4.mdia(track));\n };\n MP4.trex = function (track) {\n var id = track.id;\n return MP4.box(MP4.types.trex, new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00,\n (id >> 24),\n (id >> 16) & 0XFF,\n (id >> 8) & 0XFF,\n (id & 0xFF),\n 0x00, 0x00, 0x00, 0x01,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]));\n };\n MP4.trun = function (track, offset) {\n var samples = track.samples || [], len = samples.length, arraylen = 12 + (16 * len), array = new Uint8Array(arraylen), i, sample, duration, size, flags, cts;\n offset += 8 + arraylen;\n array.set([\n 0x00,\n 0x00, 0x0f, 0x01,\n (len >>> 24) & 0xFF,\n (len >>> 16) & 0xFF,\n (len >>> 8) & 0xFF,\n len & 0xFF,\n (offset >>> 24) & 0xFF,\n (offset >>> 16) & 0xFF,\n (offset >>> 8) & 0xFF,\n offset & 0xFF // data_offset\n ], 0);\n for (i = 0; i < len; i++) {\n sample = samples[i];\n duration = sample.duration;\n size = sample.size;\n flags = sample.flags;\n cts = sample.cts;\n array.set([\n (duration >>> 24) & 0xFF,\n (duration >>> 16) & 0xFF,\n (duration >>> 8) & 0xFF,\n duration & 0xFF,\n (size >>> 24) & 0xFF,\n (size >>> 16) & 0xFF,\n (size >>> 8) & 0xFF,\n size & 0xFF,\n (flags.isLeading << 2) | flags.dependsOn,\n (flags.isDependedOn << 6) |\n (flags.hasRedundancy << 4) |\n (flags.paddingValue << 1) |\n flags.isNonSync,\n flags.degradPrio & 0xF0 << 8,\n flags.degradPrio & 0x0F,\n (cts >>> 24) & 0xFF,\n (cts >>> 16) & 0xFF,\n (cts >>> 8) & 0xFF,\n cts & 0xFF // sample_composition_time_offset\n ], 12 + 16 * i);\n }\n return MP4.box(MP4.types.trun, array);\n };\n MP4.initSegment = function (tracks) {\n if (!MP4.types) {\n MP4.init();\n }\n var movie = MP4.moov(tracks), result;\n result = new Uint8Array(MP4.FTYP.byteLength + movie.byteLength);\n result.set(MP4.FTYP);\n result.set(movie, MP4.FTYP.byteLength);\n return result;\n };\n return MP4;\n}());\nexports.default = MP4;\n\n\n/***/ }),\n\n/***/ \"./src/remux/mp4-remuxer.js\":\n/*!**********************************!*\\\n !*** ./src/remux/mp4-remuxer.js ***!\n \\**********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * fMP4 remuxer\n*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar aac_helper_1 = __webpack_require__(/*! ./aac-helper */ \"./src/remux/aac-helper.js\");\nvar mp4_generator_1 = __webpack_require__(/*! ./mp4-generator */ \"./src/remux/mp4-generator.js\");\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar errors_1 = __webpack_require__(/*! ../errors */ \"./src/errors.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\n// 10 seconds\nvar MAX_SILENT_FRAME_DURATION = 10 * 1000;\nvar MP4Remuxer = /** @class */ (function () {\n function MP4Remuxer(observer, config, typeSupported, vendor) {\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n var userAgent = navigator.userAgent;\n this.isSafari = vendor && vendor.indexOf('Apple') > -1 && userAgent && !userAgent.match('CriOS');\n this.ISGenerated = false;\n }\n MP4Remuxer.prototype.destroy = function () {\n };\n MP4Remuxer.prototype.resetTimeStamp = function (defaultTimeStamp) {\n this._initPTS = this._initDTS = defaultTimeStamp;\n };\n MP4Remuxer.prototype.resetInitSegment = function () {\n this.ISGenerated = false;\n };\n MP4Remuxer.prototype.remux = function (audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n // generate Init Segment if needed\n if (!this.ISGenerated) {\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n if (this.ISGenerated) {\n var nbAudioSamples = audioTrack.samples.length;\n var nbVideoSamples = videoTrack.samples.length;\n var audioTimeOffset = timeOffset;\n var videoTimeOffset = timeOffset;\n if (nbAudioSamples && nbVideoSamples) {\n // timeOffset is expected to be the offset of the first timestamp of this fragment (first DTS)\n // if first audio DTS is not aligned with first video DTS then we need to take that into account\n // when providing timeOffset to remuxAudio / remuxVideo. if we don't do that, there might be a permanent / small\n // drift between audio and video streams\n var audiovideoDeltaDts = (audioTrack.samples[0].pts - videoTrack.samples[0].pts) / videoTrack.inputTimeScale;\n audioTimeOffset += Math.max(0, audiovideoDeltaDts);\n videoTimeOffset += Math.max(0, -audiovideoDeltaDts);\n }\n // Purposefully remuxing audio before video, so that remuxVideo can use nextAudioPts, which is\n // calculated in remuxAudio.\n // logger.log('nb AAC samples:' + audioTrack.samples.length);\n if (nbAudioSamples) {\n // if initSegment was generated without video samples, regenerate it again\n if (!audioTrack.timescale) {\n logger_1.logger.warn('regenerate InitSegment as audio detected');\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n var audioData = this.remuxAudio(audioTrack, audioTimeOffset, contiguous, accurateTimeOffset);\n // logger.log('nb AVC samples:' + videoTrack.samples.length);\n if (nbVideoSamples) {\n var audioTrackLength = void 0;\n if (audioData) {\n audioTrackLength = audioData.endPTS - audioData.startPTS;\n }\n // if initSegment was generated without video samples, regenerate it again\n if (!videoTrack.timescale) {\n logger_1.logger.warn('regenerate InitSegment as video detected');\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n this.remuxVideo(videoTrack, videoTimeOffset, contiguous, audioTrackLength, accurateTimeOffset);\n }\n }\n else {\n // logger.log('nb AVC samples:' + videoTrack.samples.length);\n if (nbVideoSamples) {\n var videoData = this.remuxVideo(videoTrack, videoTimeOffset, contiguous, 0, accurateTimeOffset);\n if (videoData && audioTrack.codec) {\n this.remuxEmptyAudio(audioTrack, audioTimeOffset, contiguous, videoData);\n }\n }\n }\n }\n // logger.log('nb ID3 samples:' + audioTrack.samples.length);\n if (id3Track.samples.length) {\n this.remuxID3(id3Track, timeOffset);\n }\n // logger.log('nb ID3 samples:' + audioTrack.samples.length);\n if (textTrack.samples.length) {\n this.remuxText(textTrack, timeOffset);\n }\n // notify end of parsing\n this.observer.trigger(events_1.default.FRAG_PARSED);\n };\n MP4Remuxer.prototype.generateIS = function (audioTrack, videoTrack, timeOffset) {\n var observer = this.observer, audioSamples = audioTrack.samples, videoSamples = videoTrack.samples, typeSupported = this.typeSupported, container = 'audio/mp4', tracks = {}, data = { tracks: tracks }, computePTSDTS = (this._initPTS === undefined), initPTS, initDTS;\n if (computePTSDTS) {\n initPTS = initDTS = Infinity;\n }\n if (audioTrack.config && audioSamples.length) {\n // let's use audio sampling rate as MP4 time scale.\n // rationale is that there is a integer nb of audio frames per audio sample (1024 for AAC)\n // using audio sampling rate here helps having an integer MP4 frame duration\n // this avoids potential rounding issue and AV sync issue\n audioTrack.timescale = audioTrack.samplerate;\n logger_1.logger.log(\"audio sampling rate : \" + audioTrack.samplerate);\n if (!audioTrack.isAAC) {\n if (typeSupported.mpeg) { // Chrome and Safari\n container = 'audio/mpeg';\n audioTrack.codec = '';\n }\n else if (typeSupported.mp3) { // Firefox\n audioTrack.codec = 'mp3';\n }\n }\n tracks.audio = {\n container: container,\n codec: audioTrack.codec,\n initSegment: !audioTrack.isAAC && typeSupported.mpeg ? new Uint8Array() : mp4_generator_1.default.initSegment([audioTrack]),\n metadata: {\n channelCount: audioTrack.channelCount\n }\n };\n if (computePTSDTS) {\n // remember first PTS of this demuxing context. for audio, PTS = DTS\n initPTS = initDTS = audioSamples[0].pts - audioTrack.inputTimeScale * timeOffset;\n }\n }\n if (videoTrack.sps && videoTrack.pps && videoSamples.length) {\n // let's use input time scale as MP4 video timescale\n // we use input time scale straight away to avoid rounding issues on frame duration / cts computation\n var inputTimeScale = videoTrack.inputTimeScale;\n videoTrack.timescale = inputTimeScale;\n tracks.video = {\n container: 'video/mp4',\n codec: videoTrack.codec,\n initSegment: mp4_generator_1.default.initSegment([videoTrack]),\n metadata: {\n width: videoTrack.width,\n height: videoTrack.height\n }\n };\n if (computePTSDTS) {\n initPTS = Math.min(initPTS, videoSamples[0].pts - inputTimeScale * timeOffset);\n initDTS = Math.min(initDTS, videoSamples[0].dts - inputTimeScale * timeOffset);\n this.observer.trigger(events_1.default.INIT_PTS_FOUND, { initPTS: initPTS });\n }\n }\n if (Object.keys(tracks).length) {\n observer.trigger(events_1.default.FRAG_PARSING_INIT_SEGMENT, data);\n this.ISGenerated = true;\n if (computePTSDTS) {\n this._initPTS = initPTS;\n this._initDTS = initDTS;\n }\n }\n else {\n observer.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MEDIA_ERROR, details: errors_1.ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'no audio/video samples found' });\n }\n };\n MP4Remuxer.prototype.remuxVideo = function (track, timeOffset, contiguous, audioTrackLength, accurateTimeOffset) {\n var offset = 8;\n var mp4SampleDuration;\n var mdat;\n var moof;\n var firstPTS;\n var firstDTS;\n var lastPTS;\n var lastDTS;\n var timeScale = track.timescale;\n var inputSamples = track.samples;\n var outputSamples = [];\n var nbSamples = inputSamples.length;\n var ptsNormalize = this._PTSNormalize;\n var initPTS = this._initPTS;\n // if parsed fragment is contiguous with last one, let's use last DTS value as reference\n var nextAvcDts = this.nextAvcDts;\n var isSafari = this.isSafari;\n if (nbSamples === 0) {\n return;\n }\n // Safari does not like overlapping DTS on consecutive fragments. let's use nextAvcDts to overcome this if fragments are consecutive\n if (isSafari) {\n // also consider consecutive fragments as being contiguous (even if a level switch occurs),\n // for sake of clarity:\n // consecutive fragments are frags with\n // - less than 100ms gaps between new time offset (if accurate) and next expected PTS OR\n // - less than 200 ms PTS gaps (timeScale/5)\n contiguous |= (inputSamples.length && nextAvcDts &&\n ((accurateTimeOffset && Math.abs(timeOffset - nextAvcDts / timeScale) < 0.1) ||\n Math.abs((inputSamples[0].pts - nextAvcDts - initPTS)) < timeScale / 5));\n }\n if (!contiguous) {\n // if not contiguous, let's use target timeOffset\n nextAvcDts = timeOffset * timeScale;\n }\n // PTS is coded on 33bits, and can loop from -2^32 to 2^32\n // ptsNormalize will make PTS/DTS value monotonic, we use last known DTS value as reference value\n inputSamples.forEach(function (sample) {\n sample.pts = ptsNormalize(sample.pts - initPTS, nextAvcDts);\n sample.dts = ptsNormalize(sample.dts - initPTS, nextAvcDts);\n });\n // sort video samples by DTS then PTS then demux id order\n inputSamples.sort(function (a, b) {\n var deltadts = a.dts - b.dts;\n var deltapts = a.pts - b.pts;\n return deltadts || (deltapts || (a.id - b.id));\n });\n // handle broken streams with PTS < DTS, tolerance up 200ms (18000 in 90kHz timescale)\n var PTSDTSshift = inputSamples.reduce(function (prev, curr) { return Math.max(Math.min(prev, curr.pts - curr.dts), -18000); }, 0);\n if (PTSDTSshift < 0) {\n logger_1.logger.warn(\"PTS < DTS detected in video samples, shifting DTS by \" + Math.round(PTSDTSshift / 90) + \" ms to overcome this issue\");\n for (var i = 0; i < inputSamples.length; i++) {\n inputSamples[i].dts += PTSDTSshift;\n }\n }\n // compute first DTS and last DTS, normalize them against reference value\n var sample = inputSamples[0];\n firstDTS = Math.max(sample.dts, 0);\n firstPTS = Math.max(sample.pts, 0);\n // check timestamp continuity accross consecutive fragments (this is to remove inter-fragment gap/hole)\n var delta = Math.round((firstDTS - nextAvcDts) / 90);\n // if fragment are contiguous, detect hole/overlapping between fragments\n if (contiguous) {\n if (delta) {\n if (delta > 1) {\n logger_1.logger.log(\"AVC:\" + delta + \" ms hole between fragments detected,filling it\");\n }\n else if (delta < -1) {\n logger_1.logger.log(\"AVC:\" + (-delta) + \" ms overlapping between fragments detected\");\n }\n // remove hole/gap : set DTS to next expected DTS\n firstDTS = nextAvcDts;\n inputSamples[0].dts = firstDTS;\n // offset PTS as well, ensure that PTS is smaller or equal than new DTS\n firstPTS = Math.max(firstPTS - delta, nextAvcDts);\n inputSamples[0].pts = firstPTS;\n logger_1.logger.log(\"Video/PTS/DTS adjusted: \" + Math.round(firstPTS / 90) + \"/\" + Math.round(firstDTS / 90) + \",delta:\" + delta + \" ms\");\n }\n }\n // compute lastPTS/lastDTS\n sample = inputSamples[inputSamples.length - 1];\n lastDTS = Math.max(sample.dts, 0);\n lastPTS = Math.max(sample.pts, 0, lastDTS);\n // on Safari let's signal the same sample duration for all samples\n // sample duration (as expected by trun MP4 boxes), should be the delta between sample DTS\n // set this constant duration as being the avg delta between consecutive DTS.\n if (isSafari) {\n mp4SampleDuration = Math.round((lastDTS - firstDTS) / (inputSamples.length - 1));\n }\n var nbNalu = 0, naluLen = 0;\n for (var i = 0; i < nbSamples; i++) {\n // compute total/avc sample length and nb of NAL units\n var sample_1 = inputSamples[i], units = sample_1.units, nbUnits = units.length, sampleLen = 0;\n for (var j = 0; j < nbUnits; j++) {\n sampleLen += units[j].data.length;\n }\n naluLen += sampleLen;\n nbNalu += nbUnits;\n sample_1.length = sampleLen;\n // normalize PTS/DTS\n if (isSafari) {\n // sample DTS is computed using a constant decoding offset (mp4SampleDuration) between samples\n sample_1.dts = firstDTS + i * mp4SampleDuration;\n }\n else {\n // ensure sample monotonic DTS\n sample_1.dts = Math.max(sample_1.dts, firstDTS);\n }\n // ensure that computed value is greater or equal than sample DTS\n sample_1.pts = Math.max(sample_1.pts, sample_1.dts);\n }\n /* concatenate the video data and construct the mdat in place\n (need 8 more bytes to fill length and mpdat type) */\n var mdatSize = naluLen + (4 * nbNalu) + 8;\n try {\n mdat = new Uint8Array(mdatSize);\n }\n catch (err) {\n this.observer.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MUX_ERROR, details: errors_1.ErrorDetails.REMUX_ALLOC_ERROR, fatal: false, bytes: mdatSize, reason: \"fail allocating video mdat \" + mdatSize });\n return;\n }\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(mp4_generator_1.default.types.mdat, 4);\n for (var i = 0; i < nbSamples; i++) {\n var avcSample = inputSamples[i], avcSampleUnits = avcSample.units, mp4SampleLength = 0, compositionTimeOffset = void 0;\n // convert NALU bitstream to MP4 format (prepend NALU with size field)\n for (var j = 0, nbUnits = avcSampleUnits.length; j < nbUnits; j++) {\n var unit = avcSampleUnits[j], unitData = unit.data, unitDataLen = unit.data.byteLength;\n view.setUint32(offset, unitDataLen);\n offset += 4;\n mdat.set(unitData, offset);\n offset += unitDataLen;\n mp4SampleLength += 4 + unitDataLen;\n }\n if (!isSafari) {\n // expected sample duration is the Decoding Timestamp diff of consecutive samples\n if (i < nbSamples - 1) {\n mp4SampleDuration = inputSamples[i + 1].dts - avcSample.dts;\n }\n else {\n var config = this.config, lastFrameDuration = avcSample.dts - inputSamples[i > 0 ? i - 1 : i].dts;\n if (config.stretchShortVideoTrack) {\n // In some cases, a segment's audio track duration may exceed the video track duration.\n // Since we've already remuxed audio, and we know how long the audio track is, we look to\n // see if the delta to the next segment is longer than maxBufferHole.\n // If so, playback would potentially get stuck, so we artificially inflate\n // the duration of the last frame to minimize any potential gap between segments.\n var maxBufferHole = config.maxBufferHole, gapTolerance = Math.floor(maxBufferHole * timeScale), deltaToFrameEnd = (audioTrackLength ? firstPTS + audioTrackLength * timeScale : this.nextAudioPts) - avcSample.pts;\n if (deltaToFrameEnd > gapTolerance) {\n // We subtract lastFrameDuration from deltaToFrameEnd to try to prevent any video\n // frame overlap. maxBufferHole should be >> lastFrameDuration anyway.\n mp4SampleDuration = deltaToFrameEnd - lastFrameDuration;\n if (mp4SampleDuration < 0) {\n mp4SampleDuration = lastFrameDuration;\n }\n logger_1.logger.log(\"It is approximately \" + deltaToFrameEnd / 90 + \" ms to the next segment; using duration \" + mp4SampleDuration / 90 + \" ms for the last video frame.\");\n }\n else {\n mp4SampleDuration = lastFrameDuration;\n }\n }\n else {\n mp4SampleDuration = lastFrameDuration;\n }\n }\n compositionTimeOffset = Math.round(avcSample.pts - avcSample.dts);\n }\n else {\n compositionTimeOffset = Math.max(0, mp4SampleDuration * Math.round((avcSample.pts - avcSample.dts) / mp4SampleDuration));\n }\n // console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${avcSample.pts}/${avcSample.dts}/${initDTS}/${ptsnorm}/${dtsnorm}/${(avcSample.pts/4294967296).toFixed(3)}');\n outputSamples.push({\n size: mp4SampleLength,\n // constant duration\n duration: mp4SampleDuration,\n cts: compositionTimeOffset,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: avcSample.key ? 2 : 1,\n isNonSync: avcSample.key ? 0 : 1\n }\n });\n }\n // next AVC sample DTS should be equal to last sample DTS + last sample duration (in PES timescale)\n this.nextAvcDts = lastDTS + mp4SampleDuration;\n var dropped = track.dropped;\n track.len = 0;\n track.nbNalu = 0;\n track.dropped = 0;\n if (outputSamples.length && navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {\n var flags = outputSamples[0].flags;\n // chrome workaround, mark first sample as being a Random Access Point to avoid sourcebuffer append issue\n // https://code.google.com/p/chromium/issues/detail?id=229412\n flags.dependsOn = 2;\n flags.isNonSync = 0;\n }\n track.samples = outputSamples;\n moof = mp4_generator_1.default.moof(track.sequenceNumber++, firstDTS, track);\n track.samples = [];\n var data = {\n data1: moof,\n data2: mdat,\n startPTS: firstPTS / timeScale,\n endPTS: (lastPTS + mp4SampleDuration) / timeScale,\n startDTS: firstDTS / timeScale,\n endDTS: this.nextAvcDts / timeScale,\n type: 'video',\n hasAudio: false,\n hasVideo: true,\n nb: outputSamples.length,\n dropped: dropped\n };\n this.observer.trigger(events_1.default.FRAG_PARSING_DATA, data);\n return data;\n };\n MP4Remuxer.prototype.remuxAudio = function (track, timeOffset, contiguous, accurateTimeOffset) {\n var inputTimeScale = track.inputTimeScale;\n var mp4timeScale = track.timescale;\n var scaleFactor = inputTimeScale / mp4timeScale;\n var mp4SampleDuration = track.isAAC ? 1024 : 1152;\n var inputSampleDuration = mp4SampleDuration * scaleFactor;\n var ptsNormalize = this._PTSNormalize;\n var initPTS = this._initPTS;\n var rawMPEG = !track.isAAC && this.typeSupported.mpeg;\n var offset, mp4Sample, fillFrame, mdat, moof, firstPTS, lastPTS, inputSamples = track.samples, outputSamples = [], nextAudioPts = this.nextAudioPts;\n // for audio samples, also consider consecutive fragments as being contiguous (even if a level switch occurs),\n // for sake of clarity:\n // consecutive fragments are frags with\n // - less than 100ms gaps between new time offset (if accurate) and next expected PTS OR\n // - less than 20 audio frames distance\n // contiguous fragments are consecutive fragments from same quality level (same level, new SN = old SN + 1)\n // this helps ensuring audio continuity\n // and this also avoids audio glitches/cut when switching quality, or reporting wrong duration on first audio frame\n contiguous |= (inputSamples.length && nextAudioPts &&\n ((accurateTimeOffset && Math.abs(timeOffset - nextAudioPts / inputTimeScale) < 0.1) ||\n Math.abs((inputSamples[0].pts - nextAudioPts - initPTS)) < 20 * inputSampleDuration));\n // compute normalized PTS\n inputSamples.forEach(function (sample) {\n sample.pts = sample.dts = ptsNormalize(sample.pts - initPTS, timeOffset * inputTimeScale);\n });\n // filter out sample with negative PTS that are not playable anyway\n // if we don't remove these negative samples, they will shift all audio samples forward.\n // leading to audio overlap between current / next fragment\n inputSamples = inputSamples.filter(function (sample) {\n return sample.pts >= 0;\n });\n // in case all samples have negative PTS, and have been filtered out, return now\n if (inputSamples.length === 0) {\n return;\n }\n if (!contiguous) {\n if (!accurateTimeOffset) {\n // if frag are mot contiguous and if we cant trust time offset, let's use first sample PTS as next audio PTS\n nextAudioPts = inputSamples[0].pts;\n }\n else {\n // if timeOffset is accurate, let's use it as predicted next audio PTS\n nextAudioPts = timeOffset * inputTimeScale;\n }\n }\n // If the audio track is missing samples, the frames seem to get \"left-shifted\" within the\n // resulting mp4 segment, causing sync issues and leaving gaps at the end of the audio segment.\n // In an effort to prevent this from happening, we inject frames here where there are gaps.\n // When possible, we inject a silent frame; when that's not possible, we duplicate the last\n // frame.\n if (track.isAAC) {\n var maxAudioFramesDrift = this.config.maxAudioFramesDrift;\n for (var i = 0, nextPts = nextAudioPts; i < inputSamples.length;) {\n // First, let's see how far off this frame is from where we expect it to be\n var sample = inputSamples[i], delta;\n var pts = sample.pts;\n delta = pts - nextPts;\n var duration = Math.abs(1000 * delta / inputTimeScale);\n // If we're overlapping by more than a duration, drop this sample\n if (delta <= -maxAudioFramesDrift * inputSampleDuration) {\n logger_1.logger.warn(\"Dropping 1 audio frame @ \" + (nextPts / inputTimeScale).toFixed(3) + \"s due to \" + Math.round(duration) + \" ms overlap.\");\n inputSamples.splice(i, 1);\n track.len -= sample.unit.length;\n // Don't touch nextPtsNorm or i\n } // eslint-disable-line brace-style\n // Insert missing frames if:\n // 1: We're more than maxAudioFramesDrift frame away\n // 2: Not more than MAX_SILENT_FRAME_DURATION away\n // 3: currentTime (aka nextPtsNorm) is not 0\n else if (delta >= maxAudioFramesDrift * inputSampleDuration && duration < MAX_SILENT_FRAME_DURATION && nextPts) {\n var missing = Math.round(delta / inputSampleDuration);\n logger_1.logger.warn(\"Injecting \" + missing + \" audio frame @ \" + (nextPts / inputTimeScale).toFixed(3) + \"s due to \" + Math.round(1000 * delta / inputTimeScale) + \" ms gap.\");\n for (var j = 0; j < missing; j++) {\n var newStamp = Math.max(nextPts, 0);\n fillFrame = aac_helper_1.default.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n if (!fillFrame) {\n logger_1.logger.log('Unable to get silent frame for given audio codec; duplicating last frame instead.');\n fillFrame = sample.unit.subarray();\n }\n inputSamples.splice(i, 0, { unit: fillFrame, pts: newStamp, dts: newStamp });\n track.len += fillFrame.length;\n nextPts += inputSampleDuration;\n i++;\n }\n // Adjust sample to next expected pts\n sample.pts = sample.dts = nextPts;\n nextPts += inputSampleDuration;\n i++;\n }\n else {\n // Otherwise, just adjust pts\n if (Math.abs(delta) > (0.1 * inputSampleDuration)) {\n // logger.log(`Invalid frame delta ${Math.round(delta + inputSampleDuration)} at PTS ${Math.round(pts / 90)} (should be ${Math.round(inputSampleDuration)}).`);\n }\n sample.pts = sample.dts = nextPts;\n nextPts += inputSampleDuration;\n i++;\n }\n }\n }\n for (var j = 0, nbSamples_1 = inputSamples.length; j < nbSamples_1; j++) {\n var audioSample = inputSamples[j];\n var unit = audioSample.unit;\n var pts = audioSample.pts;\n // logger.log(`Audio/PTS:${Math.round(pts/90)}`);\n // if not first sample\n if (lastPTS !== undefined) {\n mp4Sample.duration = Math.round((pts - lastPTS) / scaleFactor);\n }\n else {\n var delta_1 = Math.round(1000 * (pts - nextAudioPts) / inputTimeScale), numMissingFrames = 0;\n // if fragment are contiguous, detect hole/overlapping between fragments\n // contiguous fragments are consecutive fragments from same quality level (same level, new SN = old SN + 1)\n if (contiguous && track.isAAC) {\n // log delta\n if (delta_1) {\n if (delta_1 > 0 && delta_1 < MAX_SILENT_FRAME_DURATION) {\n numMissingFrames = Math.round((pts - nextAudioPts) / inputSampleDuration);\n logger_1.logger.log(delta_1 + \" ms hole between AAC samples detected,filling it\");\n if (numMissingFrames > 0) {\n fillFrame = aac_helper_1.default.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n if (!fillFrame) {\n fillFrame = unit.subarray();\n }\n track.len += numMissingFrames * fillFrame.length;\n }\n // if we have frame overlap, overlapping for more than half a frame duraion\n }\n else if (delta_1 < -12) {\n // drop overlapping audio frames... browser will deal with it\n logger_1.logger.log(\"drop overlapping AAC sample, expected/parsed/delta:\" + (nextAudioPts / inputTimeScale).toFixed(3) + \"s/\" + (pts / inputTimeScale).toFixed(3) + \"s/\" + (-delta_1) + \"ms\");\n track.len -= unit.byteLength;\n continue;\n }\n // set PTS/DTS to expected PTS/DTS\n pts = nextAudioPts;\n }\n }\n // remember first PTS of our audioSamples\n firstPTS = pts;\n if (track.len > 0) {\n /* concatenate the audio data and construct the mdat in place\n (need 8 more bytes to fill length and mdat type) */\n var mdatSize = rawMPEG ? track.len : track.len + 8;\n offset = rawMPEG ? 0 : 8;\n try {\n mdat = new Uint8Array(mdatSize);\n }\n catch (err) {\n this.observer.trigger(events_1.default.ERROR, { type: errors_1.ErrorTypes.MUX_ERROR, details: errors_1.ErrorDetails.REMUX_ALLOC_ERROR, fatal: false, bytes: mdatSize, reason: \"fail allocating audio mdat \" + mdatSize });\n return;\n }\n if (!rawMPEG) {\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(mp4_generator_1.default.types.mdat, 4);\n }\n }\n else {\n // no audio samples\n return;\n }\n for (var i = 0; i < numMissingFrames; i++) {\n fillFrame = aac_helper_1.default.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n if (!fillFrame) {\n logger_1.logger.log('Unable to get silent frame for given audio codec; duplicating this frame instead.');\n fillFrame = unit.subarray();\n }\n mdat.set(fillFrame, offset);\n offset += fillFrame.byteLength;\n mp4Sample = {\n size: fillFrame.byteLength,\n cts: 0,\n duration: 1024,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1\n }\n };\n outputSamples.push(mp4Sample);\n }\n }\n mdat.set(unit, offset);\n var unitLen = unit.byteLength;\n offset += unitLen;\n // console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${audioSample.pts}/${audioSample.dts}/${initDTS}/${ptsnorm}/${dtsnorm}/${(audioSample.pts/4294967296).toFixed(3)}');\n mp4Sample = {\n size: unitLen,\n cts: 0,\n duration: 0,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1\n }\n };\n outputSamples.push(mp4Sample);\n lastPTS = pts;\n }\n var lastSampleDuration = 0;\n var nbSamples = outputSamples.length;\n // set last sample duration as being identical to previous sample\n if (nbSamples >= 2) {\n lastSampleDuration = outputSamples[nbSamples - 2].duration;\n mp4Sample.duration = lastSampleDuration;\n }\n if (nbSamples) {\n // next audio sample PTS should be equal to last sample PTS + duration\n this.nextAudioPts = nextAudioPts = lastPTS + scaleFactor * lastSampleDuration;\n // logger.log('Audio/PTS/PTSend:' + audioSample.pts.toFixed(0) + '/' + this.nextAacDts.toFixed(0));\n track.len = 0;\n track.samples = outputSamples;\n if (rawMPEG) {\n moof = new Uint8Array();\n }\n else {\n moof = mp4_generator_1.default.moof(track.sequenceNumber++, firstPTS / scaleFactor, track);\n }\n track.samples = [];\n var start = firstPTS / inputTimeScale;\n var end = nextAudioPts / inputTimeScale;\n var audioData = {\n data1: moof,\n data2: mdat,\n startPTS: start,\n endPTS: end,\n startDTS: start,\n endDTS: end,\n type: 'audio',\n hasAudio: true,\n hasVideo: false,\n nb: nbSamples\n };\n this.observer.trigger(events_1.default.FRAG_PARSING_DATA, audioData);\n return audioData;\n }\n return null;\n };\n MP4Remuxer.prototype.remuxEmptyAudio = function (track, timeOffset, contiguous, videoData) {\n var inputTimeScale = track.inputTimeScale, mp4timeScale = track.samplerate ? track.samplerate : inputTimeScale, scaleFactor = inputTimeScale / mp4timeScale, nextAudioPts = this.nextAudioPts, \n // sync with video's timestamp\n startDTS = (nextAudioPts !== undefined ? nextAudioPts : videoData.startDTS * inputTimeScale) + this._initDTS, endDTS = videoData.endDTS * inputTimeScale + this._initDTS, \n // one sample's duration value\n sampleDuration = 1024, frameDuration = scaleFactor * sampleDuration, \n // samples count of this segment's duration\n nbSamples = Math.ceil((endDTS - startDTS) / frameDuration), \n // silent frame\n silentFrame = aac_helper_1.default.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n logger_1.logger.warn('remux empty Audio');\n // Can't remux if we can't generate a silent frame...\n if (!silentFrame) {\n logger_1.logger.trace('Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!');\n return;\n }\n var samples = [];\n for (var i = 0; i < nbSamples; i++) {\n var stamp = startDTS + i * frameDuration;\n samples.push({ unit: silentFrame, pts: stamp, dts: stamp });\n track.len += silentFrame.length;\n }\n track.samples = samples;\n this.remuxAudio(track, timeOffset, contiguous);\n };\n MP4Remuxer.prototype.remuxID3 = function (track) {\n var length = track.samples.length, sample;\n var inputTimeScale = track.inputTimeScale;\n var initPTS = this._initPTS;\n var initDTS = this._initDTS;\n // consume samples\n if (length) {\n for (var index = 0; index < length; index++) {\n sample = track.samples[index];\n // setting id3 pts, dts to relative time\n // using this._initPTS and this._initDTS to calculate relative time\n sample.pts = ((sample.pts - initPTS) / inputTimeScale);\n sample.dts = ((sample.dts - initDTS) / inputTimeScale);\n }\n this.observer.trigger(events_1.default.FRAG_PARSING_METADATA, {\n samples: track.samples\n });\n }\n track.samples = [];\n };\n MP4Remuxer.prototype.remuxText = function (track) {\n track.samples.sort(function (a, b) {\n return (a.pts - b.pts);\n });\n var length = track.samples.length, sample;\n var inputTimeScale = track.inputTimeScale;\n var initPTS = this._initPTS;\n // consume samples\n if (length) {\n for (var index = 0; index < length; index++) {\n sample = track.samples[index];\n // setting text pts, dts to relative time\n // using this._initPTS and this._initDTS to calculate relative time\n sample.pts = ((sample.pts - initPTS) / inputTimeScale);\n }\n this.observer.trigger(events_1.default.FRAG_PARSING_USERDATA, {\n samples: track.samples\n });\n }\n track.samples = [];\n };\n MP4Remuxer.prototype._PTSNormalize = function (value, reference) {\n var offset;\n if (reference === undefined) {\n return value;\n }\n if (reference < value) {\n // - 2^33\n offset = -8589934592;\n }\n else {\n // + 2^33\n offset = 8589934592;\n }\n /* PTS is 33bit (from 0 to 2^33 -1)\n if diff between value and reference is bigger than half of the amplitude (2^32) then it means that\n PTS looping occured. fill the gap */\n while (Math.abs(value - reference) > 4294967296) {\n value += offset;\n }\n return value;\n };\n return MP4Remuxer;\n}());\nexports.default = MP4Remuxer;\n\n\n/***/ }),\n\n/***/ \"./src/remux/passthrough-remuxer.js\":\n/*!******************************************!*\\\n !*** ./src/remux/passthrough-remuxer.js ***!\n \\******************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * passthrough remuxer\n*/\nvar events_1 = __webpack_require__(/*! ../events */ \"./src/events.js\");\nvar PassThroughRemuxer = /** @class */ (function () {\n function PassThroughRemuxer(observer) {\n this.observer = observer;\n }\n PassThroughRemuxer.prototype.destroy = function () {\n };\n PassThroughRemuxer.prototype.resetTimeStamp = function () {\n };\n PassThroughRemuxer.prototype.resetInitSegment = function () {\n };\n PassThroughRemuxer.prototype.remux = function (audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset, rawData) {\n var observer = this.observer;\n var streamType = '';\n if (audioTrack) {\n streamType += 'audio';\n }\n if (videoTrack) {\n streamType += 'video';\n }\n observer.trigger(events_1.default.FRAG_PARSING_DATA, {\n data1: rawData,\n startPTS: timeOffset,\n startDTS: timeOffset,\n type: streamType,\n hasAudio: !!audioTrack,\n hasVideo: !!videoTrack,\n nb: 1,\n dropped: 0\n });\n // notify end of parsing\n observer.trigger(events_1.default.FRAG_PARSED);\n };\n return PassThroughRemuxer;\n}());\nexports.default = PassThroughRemuxer;\n\n\n/***/ }),\n\n/***/ \"./src/task-loop.js\":\n/*!**************************!*\\\n !*** ./src/task-loop.js ***!\n \\**************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar event_handler_1 = __webpack_require__(/*! ./event-handler */ \"./src/event-handler.js\");\n/**\n * Sub-class specialization of EventHandler base class.\n *\n * TaskLoop allows to schedule a task function being called (optionnaly repeatedly) on the main loop,\n * scheduled asynchroneously, avoiding recursive calls in the same tick.\n *\n * The task itself is implemented in `doTick`. It can be requested and called for single execution\n * using the `tick` method.\n *\n * It will be assured that the task execution method (`tick`) only gets called once per main loop \"tick\",\n * no matter how often it gets requested for execution. Execution in further ticks will be scheduled accordingly.\n *\n * If further execution requests have already been scheduled on the next tick, it can be checked with `hasNextTick`,\n * and cancelled with `clearNextTick`.\n *\n * The task can be scheduled as an interval repeatedly with a period as parameter (see `setInterval`, `clearInterval`).\n *\n * Sub-classes need to implement the `doTick` method which will effectively have the task execution routine.\n *\n * Further explanations:\n *\n * The baseclass has a `tick` method that will schedule the doTick call. It may be called synchroneously\n * only for a stack-depth of one. On re-entrant calls, sub-sequent calls are scheduled for next main loop ticks.\n *\n * When the task execution (`tick` method) is called in re-entrant way this is detected and\n * we are limiting the task execution per call stack to exactly one, but scheduling/post-poning further\n * task processing on the next main loop iteration (also known as \"next tick\" in the Node/JS runtime lingo).\n */\nvar TaskLoop = /** @class */ (function (_super) {\n __extends(TaskLoop, _super);\n function TaskLoop(hls) {\n var events = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n events[_i - 1] = arguments[_i];\n }\n var _this = _super.apply(this, [hls].concat(events)) || this;\n _this._tickInterval = null;\n _this._tickTimer = null;\n _this._tickCallCount = 0;\n _this._boundTick = _this.tick.bind(_this);\n return _this;\n }\n /**\n * @override\n */\n TaskLoop.prototype.onHandlerDestroying = function () {\n // clear all timers before unregistering from event bus\n this.clearNextTick();\n this.clearInterval();\n };\n /**\n * @returns {boolean}\n */\n TaskLoop.prototype.hasInterval = function () {\n return !!this._tickInterval;\n };\n /**\n * @returns {boolean}\n */\n TaskLoop.prototype.hasNextTick = function () {\n return !!this._tickTimer;\n };\n /**\n * @param {number} millis Interval time (ms)\n * @returns {boolean} True when interval has been scheduled, false when already scheduled (no effect)\n */\n TaskLoop.prototype.setInterval = function (millis) {\n if (!this._tickInterval) {\n this._tickInterval = setInterval(this._boundTick, millis);\n return true;\n }\n return false;\n };\n /**\n * @returns {boolean} True when interval was cleared, false when none was set (no effect)\n */\n TaskLoop.prototype.clearInterval = function () {\n if (this._tickInterval) {\n clearInterval(this._tickInterval);\n this._tickInterval = null;\n return true;\n }\n return false;\n };\n /**\n * @returns {boolean} True when timeout was cleared, false when none was set (no effect)\n */\n TaskLoop.prototype.clearNextTick = function () {\n if (this._tickTimer) {\n clearTimeout(this._tickTimer);\n this._tickTimer = null;\n return true;\n }\n return false;\n };\n /**\n * Will call the subclass doTick implementation in this main loop tick\n * or in the next one (via setTimeout(,0)) in case it has already been called\n * in this tick (in case this is a re-entrant call).\n */\n TaskLoop.prototype.tick = function () {\n this._tickCallCount++;\n if (this._tickCallCount === 1) {\n this.doTick();\n // re-entrant call to tick from previous doTick call stack\n // -> schedule a call on the next main loop iteration to process this task processing request\n if (this._tickCallCount > 1) {\n // make sure only one timer exists at any time at max\n this.clearNextTick();\n this._tickTimer = setTimeout(this._boundTick, 0);\n }\n this._tickCallCount = 0;\n }\n };\n /**\n * For subclass to implement task logic\n * @abstract\n */\n TaskLoop.prototype.doTick = function () { };\n return TaskLoop;\n}(event_handler_1.default));\nexports.default = TaskLoop;\n\n\n/***/ }),\n\n/***/ \"./src/utils/attr-list.js\":\n/*!********************************!*\\\n !*** ./src/utils/attr-list.js ***!\n \\********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar DECIMAL_RESOLUTION_REGEX = /^(\\d+)x(\\d+)$/; // eslint-disable-line no-useless-escape\nvar ATTR_LIST_REGEX = /\\s*(.+?)\\s*=((?:\\\".*?\\\")|.*?)(?:,|$)/g; // eslint-disable-line no-useless-escape\n// adapted from https://github.com/kanongil/node-m3u8parse/blob/master/attrlist.js\nvar AttrList = /** @class */ (function () {\n function AttrList(attrs) {\n if (typeof attrs === 'string') {\n attrs = AttrList.parseAttrList(attrs);\n }\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n this[attr] = attrs[attr];\n }\n }\n }\n AttrList.prototype.decimalInteger = function (attrName) {\n var intValue = parseInt(this[attrName], 10);\n if (intValue > Number.MAX_SAFE_INTEGER) {\n return Infinity;\n }\n return intValue;\n };\n AttrList.prototype.hexadecimalInteger = function (attrName) {\n if (this[attrName]) {\n var stringValue = (this[attrName] || '0x').slice(2);\n stringValue = ((stringValue.length & 1) ? '0' : '') + stringValue;\n var value = new Uint8Array(stringValue.length / 2);\n for (var i = 0; i < stringValue.length / 2; i++) {\n value[i] = parseInt(stringValue.slice(i * 2, i * 2 + 2), 16);\n }\n return value;\n }\n else {\n return null;\n }\n };\n AttrList.prototype.hexadecimalIntegerAsNumber = function (attrName) {\n var intValue = parseInt(this[attrName], 16);\n if (intValue > Number.MAX_SAFE_INTEGER) {\n return Infinity;\n }\n return intValue;\n };\n AttrList.prototype.decimalFloatingPoint = function (attrName) {\n return parseFloat(this[attrName]);\n };\n AttrList.prototype.enumeratedString = function (attrName) {\n return this[attrName];\n };\n AttrList.prototype.decimalResolution = function (attrName) {\n var res = DECIMAL_RESOLUTION_REGEX.exec(this[attrName]);\n if (res === null) {\n return undefined;\n }\n return {\n width: parseInt(res[1], 10),\n height: parseInt(res[2], 10)\n };\n };\n AttrList.parseAttrList = function (input) {\n var match, attrs = {};\n ATTR_LIST_REGEX.lastIndex = 0;\n while ((match = ATTR_LIST_REGEX.exec(input)) !== null) {\n var value = match[2], quote = '\"';\n if (value.indexOf(quote) === 0 &&\n value.lastIndexOf(quote) === (value.length - 1)) {\n value = value.slice(1, -1);\n }\n attrs[match[1]] = value;\n }\n return attrs;\n };\n return AttrList;\n}());\nexports.default = AttrList;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/utils/binary-search.js\":\n/*!************************************!*\\\n !*** ./src/utils/binary-search.js ***!\n \\************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar BinarySearch = {\n /**\n * Searches for an item in an array which matches a certain condition.\n * This requires the condition to only match one item in the array,\n * and for the array to be ordered.\n *\n * @param {Array} list The array to search.\n * @param {Function} comparisonFunction\n * Called and provided a candidate item as the first argument.\n * Should return:\n * > -1 if the item should be located at a lower index than the provided item.\n * > 1 if the item should be located at a higher index than the provided item.\n * > 0 if the item is the item you're looking for.\n *\n * @return {*} The object if it is found or null otherwise.\n */\n search: function (list, comparisonFunction) {\n var minIndex = 0;\n var maxIndex = list.length - 1;\n var currentIndex = null;\n var currentElement = null;\n while (minIndex <= maxIndex) {\n currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = list[currentIndex];\n var comparisonResult = comparisonFunction(currentElement);\n if (comparisonResult > 0) {\n minIndex = currentIndex + 1;\n }\n else if (comparisonResult < 0) {\n maxIndex = currentIndex - 1;\n }\n else {\n return currentElement;\n }\n }\n return null;\n }\n};\nexports.default = BinarySearch;\n\n\n/***/ }),\n\n/***/ \"./src/utils/buffer-helper.js\":\n/*!************************************!*\\\n !*** ./src/utils/buffer-helper.js ***!\n \\************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * @module BufferHelper\n *\n * Providing methods dealing with buffer length retrieval for example.\n *\n * In general, a helper around HTML5 MediaElement TimeRanges gathered from `buffered` property.\n *\n * Also @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/buffered\n*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar BufferHelper = /** @class */ (function () {\n function BufferHelper() {\n }\n /**\n * Return true if `media`'s buffered include `position`\n * @param {HTMLMediaElement|SourceBuffer} media\n * @param {number} position\n * @returns {boolean}\n */\n BufferHelper.isBuffered = function (media, position) {\n try {\n if (media) {\n var buffered = media.buffered;\n for (var i = 0; i < buffered.length; i++) {\n if (position >= buffered.start(i) && position <= buffered.end(i)) {\n return true;\n }\n }\n }\n }\n catch (error) {\n // this is to catch\n // InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer':\n // This SourceBuffer has been removed from the parent media source\n }\n return false;\n };\n BufferHelper.bufferInfo = function (media, pos, maxHoleDuration) {\n try {\n if (media) {\n var vbuffered = media.buffered, buffered = [], i = void 0;\n for (i = 0; i < vbuffered.length; i++) {\n buffered.push({ start: vbuffered.start(i), end: vbuffered.end(i) });\n }\n return this.bufferedInfo(buffered, pos, maxHoleDuration);\n }\n }\n catch (error) {\n // this is to catch\n // InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer':\n // This SourceBuffer has been removed from the parent media source\n }\n return { len: 0, start: pos, end: pos, nextStart: undefined };\n };\n BufferHelper.bufferedInfo = function (buffered, pos, maxHoleDuration) {\n var buffered2 = [], \n // bufferStart and bufferEnd are buffer boundaries around current video position\n bufferLen, bufferStart, bufferEnd, bufferStartNext, i;\n // sort on buffer.start/smaller end (IE does not always return sorted buffered range)\n buffered.sort(function (a, b) {\n var diff = a.start - b.start;\n if (diff) {\n return diff;\n }\n else {\n return b.end - a.end;\n }\n });\n // there might be some small holes between buffer time range\n // consider that holes smaller than maxHoleDuration are irrelevant and build another\n // buffer time range representations that discards those holes\n for (i = 0; i < buffered.length; i++) {\n var buf2len = buffered2.length;\n if (buf2len) {\n var buf2end = buffered2[buf2len - 1].end;\n // if small hole (value between 0 or maxHoleDuration ) or overlapping (negative)\n if ((buffered[i].start - buf2end) < maxHoleDuration) {\n // merge overlapping time ranges\n // update lastRange.end only if smaller than item.end\n // e.g. [ 1, 15] with [ 2,8] => [ 1,15] (no need to modify lastRange.end)\n // whereas [ 1, 8] with [ 2,15] => [ 1,15] ( lastRange should switch from [1,8] to [1,15])\n if (buffered[i].end > buf2end) {\n buffered2[buf2len - 1].end = buffered[i].end;\n }\n }\n else {\n // big hole\n buffered2.push(buffered[i]);\n }\n }\n else {\n // first value\n buffered2.push(buffered[i]);\n }\n }\n for (i = 0, bufferLen = 0, bufferStart = bufferEnd = pos; i < buffered2.length; i++) {\n var start = buffered2[i].start, end = buffered2[i].end;\n // logger.log('buf start/end:' + buffered.start(i) + '/' + buffered.end(i));\n if ((pos + maxHoleDuration) >= start && pos < end) {\n // play position is inside this buffer TimeRange, retrieve end of buffer position and buffer length\n bufferStart = start;\n bufferEnd = end;\n bufferLen = bufferEnd - pos;\n }\n else if ((pos + maxHoleDuration) < start) {\n bufferStartNext = start;\n break;\n }\n }\n return { len: bufferLen, start: bufferStart, end: bufferEnd, nextStart: bufferStartNext };\n };\n return BufferHelper;\n}());\nexports.BufferHelper = BufferHelper;\n\n\n/***/ }),\n\n/***/ \"./src/utils/cea-608-parser.js\":\n/*!*************************************!*\\\n !*** ./src/utils/cea-608-parser.js ***!\n \\*************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * Exceptions from regular ASCII. CodePoints are mapped to UTF-16 codes\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar specialCea608CharsCodes = {\n 0x2a: 0xe1,\n 0x5c: 0xe9,\n 0x5e: 0xed,\n 0x5f: 0xf3,\n 0x60: 0xfa,\n 0x7b: 0xe7,\n 0x7c: 0xf7,\n 0x7d: 0xd1,\n 0x7e: 0xf1,\n 0x7f: 0x2588,\n // THIS BLOCK INCLUDES THE 16 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x11 AND LOW BETWEEN 0x30 AND 0x3F\n // THIS MEANS THAT \\x50 MUST BE ADDED TO THE VALUES\n 0x80: 0xae,\n 0x81: 0xb0,\n 0x82: 0xbd,\n 0x83: 0xbf,\n 0x84: 0x2122,\n 0x85: 0xa2,\n 0x86: 0xa3,\n 0x87: 0x266a,\n 0x88: 0xe0,\n 0x89: 0x20,\n 0x8a: 0xe8,\n 0x8b: 0xe2,\n 0x8c: 0xea,\n 0x8d: 0xee,\n 0x8e: 0xf4,\n 0x8f: 0xfb,\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x12 AND LOW BETWEEN 0x20 AND 0x3F\n 0x90: 0xc1,\n 0x91: 0xc9,\n 0x92: 0xd3,\n 0x93: 0xda,\n 0x94: 0xdc,\n 0x95: 0xfc,\n 0x96: 0x2018,\n 0x97: 0xa1,\n 0x98: 0x2a,\n 0x99: 0x2019,\n 0x9a: 0x2501,\n 0x9b: 0xa9,\n 0x9c: 0x2120,\n 0x9d: 0x2022,\n 0x9e: 0x201c,\n 0x9f: 0x201d,\n 0xa0: 0xc0,\n 0xa1: 0xc2,\n 0xa2: 0xc7,\n 0xa3: 0xc8,\n 0xa4: 0xca,\n 0xa5: 0xcb,\n 0xa6: 0xeb,\n 0xa7: 0xce,\n 0xa8: 0xcf,\n 0xa9: 0xef,\n 0xaa: 0xd4,\n 0xab: 0xd9,\n 0xac: 0xf9,\n 0xad: 0xdb,\n 0xae: 0xab,\n 0xaf: 0xbb,\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x13 AND LOW BETWEEN 0x20 AND 0x3F\n 0xb0: 0xc3,\n 0xb1: 0xe3,\n 0xb2: 0xcd,\n 0xb3: 0xcc,\n 0xb4: 0xec,\n 0xb5: 0xd2,\n 0xb6: 0xf2,\n 0xb7: 0xd5,\n 0xb8: 0xf5,\n 0xb9: 0x7b,\n 0xba: 0x7d,\n 0xbb: 0x5c,\n 0xbc: 0x5e,\n 0xbd: 0x5f,\n 0xbe: 0x7c,\n 0xbf: 0x223c,\n 0xc0: 0xc4,\n 0xc1: 0xe4,\n 0xc2: 0xd6,\n 0xc3: 0xf6,\n 0xc4: 0xdf,\n 0xc5: 0xa5,\n 0xc6: 0xa4,\n 0xc7: 0x2503,\n 0xc8: 0xc5,\n 0xc9: 0xe5,\n 0xca: 0xd8,\n 0xcb: 0xf8,\n 0xcc: 0x250f,\n 0xcd: 0x2513,\n 0xce: 0x2517,\n 0xcf: 0x251b // Box drawings heavy up and left\n};\n/**\n * Utils\n */\nvar getCharForByte = function (byte) {\n var charCode = byte;\n if (specialCea608CharsCodes.hasOwnProperty(byte)) {\n charCode = specialCea608CharsCodes[byte];\n }\n return String.fromCharCode(charCode);\n};\nvar NR_ROWS = 15, NR_COLS = 100;\n// Tables to look up row from PAC data\nvar rowsLowCh1 = { 0x11: 1, 0x12: 3, 0x15: 5, 0x16: 7, 0x17: 9, 0x10: 11, 0x13: 12, 0x14: 14 };\nvar rowsHighCh1 = { 0x11: 2, 0x12: 4, 0x15: 6, 0x16: 8, 0x17: 10, 0x13: 13, 0x14: 15 };\nvar rowsLowCh2 = { 0x19: 1, 0x1A: 3, 0x1D: 5, 0x1E: 7, 0x1F: 9, 0x18: 11, 0x1B: 12, 0x1C: 14 };\nvar rowsHighCh2 = { 0x19: 2, 0x1A: 4, 0x1D: 6, 0x1E: 8, 0x1F: 10, 0x1B: 13, 0x1C: 15 };\nvar backgroundColors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'black', 'transparent'];\n/**\n * Simple logger class to be able to write with time-stamps and filter on level.\n */\nvar logger = {\n verboseFilter: { 'DATA': 3, 'DEBUG': 3, 'INFO': 2, 'WARNING': 2, 'TEXT': 1, 'ERROR': 0 },\n time: null,\n verboseLevel: 0,\n setTime: function (newTime) {\n this.time = newTime;\n },\n log: function (severity, msg) {\n var minLevel = this.verboseFilter[severity];\n if (this.verboseLevel >= minLevel) {\n // console.log(this.time + ' [' + severity + '] ' + msg);\n }\n }\n};\nvar numArrayToHexArray = function (numArray) {\n var hexArray = [];\n for (var j = 0; j < numArray.length; j++) {\n hexArray.push(numArray[j].toString(16));\n }\n return hexArray;\n};\nvar PenState = /** @class */ (function () {\n function PenState(foreground, underline, italics, background, flash) {\n this.foreground = foreground || 'white';\n this.underline = underline || false;\n this.italics = italics || false;\n this.background = background || 'black';\n this.flash = flash || false;\n }\n PenState.prototype.reset = function () {\n this.foreground = 'white';\n this.underline = false;\n this.italics = false;\n this.background = 'black';\n this.flash = false;\n };\n PenState.prototype.setStyles = function (styles) {\n var attribs = ['foreground', 'underline', 'italics', 'background', 'flash'];\n for (var i = 0; i < attribs.length; i++) {\n var style = attribs[i];\n if (styles.hasOwnProperty(style)) {\n this[style] = styles[style];\n }\n }\n };\n PenState.prototype.isDefault = function () {\n return (this.foreground === 'white' && !this.underline && !this.italics &&\n this.background === 'black' && !this.flash);\n };\n PenState.prototype.equals = function (other) {\n return ((this.foreground === other.foreground) &&\n (this.underline === other.underline) &&\n (this.italics === other.italics) &&\n (this.background === other.background) &&\n (this.flash === other.flash));\n };\n PenState.prototype.copy = function (newPenState) {\n this.foreground = newPenState.foreground;\n this.underline = newPenState.underline;\n this.italics = newPenState.italics;\n this.background = newPenState.background;\n this.flash = newPenState.flash;\n };\n PenState.prototype.toString = function () {\n return ('color=' + this.foreground + ', underline=' + this.underline + ', italics=' + this.italics +\n ', background=' + this.background + ', flash=' + this.flash);\n };\n return PenState;\n}());\n/**\n * Unicode character with styling and background.\n * @constructor\n */\nvar StyledUnicodeChar = /** @class */ (function () {\n function StyledUnicodeChar(uchar, foreground, underline, italics, background, flash) {\n this.uchar = uchar || ' '; // unicode character\n this.penState = new PenState(foreground, underline, italics, background, flash);\n }\n StyledUnicodeChar.prototype.reset = function () {\n this.uchar = ' ';\n this.penState.reset();\n };\n StyledUnicodeChar.prototype.setChar = function (uchar, newPenState) {\n this.uchar = uchar;\n this.penState.copy(newPenState);\n };\n StyledUnicodeChar.prototype.setPenState = function (newPenState) {\n this.penState.copy(newPenState);\n };\n StyledUnicodeChar.prototype.equals = function (other) {\n return this.uchar === other.uchar && this.penState.equals(other.penState);\n };\n StyledUnicodeChar.prototype.copy = function (newChar) {\n this.uchar = newChar.uchar;\n this.penState.copy(newChar.penState);\n };\n StyledUnicodeChar.prototype.isEmpty = function () {\n return this.uchar === ' ' && this.penState.isDefault();\n };\n return StyledUnicodeChar;\n}());\n/**\n * CEA-608 row consisting of NR_COLS instances of StyledUnicodeChar.\n * @constructor\n */\nvar Row = /** @class */ (function () {\n function Row() {\n this.chars = [];\n for (var i = 0; i < NR_COLS; i++) {\n this.chars.push(new StyledUnicodeChar());\n }\n this.pos = 0;\n this.currPenState = new PenState();\n }\n Row.prototype.equals = function (other) {\n var equal = true;\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].equals(other.chars[i])) {\n equal = false;\n break;\n }\n }\n return equal;\n };\n Row.prototype.copy = function (other) {\n for (var i = 0; i < NR_COLS; i++) {\n this.chars[i].copy(other.chars[i]);\n }\n };\n Row.prototype.isEmpty = function () {\n var empty = true;\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n return empty;\n };\n /**\n * Set the cursor to a valid column.\n */\n Row.prototype.setCursor = function (absPos) {\n if (this.pos !== absPos) {\n this.pos = absPos;\n }\n if (this.pos < 0) {\n logger.log('ERROR', 'Negative cursor position ' + this.pos);\n this.pos = 0;\n }\n else if (this.pos > NR_COLS) {\n logger.log('ERROR', 'Too large cursor position ' + this.pos);\n this.pos = NR_COLS;\n }\n };\n /**\n * Move the cursor relative to current position.\n */\n Row.prototype.moveCursor = function (relPos) {\n var newPos = this.pos + relPos;\n if (relPos > 1) {\n for (var i = this.pos + 1; i < newPos + 1; i++) {\n this.chars[i].setPenState(this.currPenState);\n }\n }\n this.setCursor(newPos);\n };\n /**\n * Backspace, move one step back and clear character.\n */\n Row.prototype.backSpace = function () {\n this.moveCursor(-1);\n this.chars[this.pos].setChar(' ', this.currPenState);\n };\n Row.prototype.insertChar = function (byte) {\n if (byte >= 0x90) { // Extended char\n this.backSpace();\n }\n var char = getCharForByte(byte);\n if (this.pos >= NR_COLS) {\n logger.log('ERROR', 'Cannot insert ' + byte.toString(16) +\n ' (' + char + ') at position ' + this.pos + '. Skipping it!');\n return;\n }\n this.chars[this.pos].setChar(char, this.currPenState);\n this.moveCursor(1);\n };\n Row.prototype.clearFromPos = function (startPos) {\n var i;\n for (i = startPos; i < NR_COLS; i++) {\n this.chars[i].reset();\n }\n };\n Row.prototype.clear = function () {\n this.clearFromPos(0);\n this.pos = 0;\n this.currPenState.reset();\n };\n Row.prototype.clearToEndOfRow = function () {\n this.clearFromPos(this.pos);\n };\n Row.prototype.getTextString = function () {\n var chars = [];\n var empty = true;\n for (var i = 0; i < NR_COLS; i++) {\n var char = this.chars[i].uchar;\n if (char !== ' ') {\n empty = false;\n }\n chars.push(char);\n }\n if (empty) {\n return '';\n }\n else {\n return chars.join('');\n }\n };\n Row.prototype.setPenStyles = function (styles) {\n this.currPenState.setStyles(styles);\n var currChar = this.chars[this.pos];\n currChar.setPenState(this.currPenState);\n };\n return Row;\n}());\n/**\n * Keep a CEA-608 screen of 32x15 styled characters\n * @constructor\n*/\nvar CaptionScreen = /** @class */ (function () {\n function CaptionScreen() {\n this.rows = [];\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows.push(new Row());\n } // Note that we use zero-based numbering (0-14)\n this.currRow = NR_ROWS - 1;\n this.nrRollUpRows = null;\n this.reset();\n }\n CaptionScreen.prototype.reset = function () {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n }\n this.currRow = NR_ROWS - 1;\n };\n CaptionScreen.prototype.equals = function (other) {\n var equal = true;\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].equals(other.rows[i])) {\n equal = false;\n break;\n }\n }\n return equal;\n };\n CaptionScreen.prototype.copy = function (other) {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].copy(other.rows[i]);\n }\n };\n CaptionScreen.prototype.isEmpty = function () {\n var empty = true;\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n return empty;\n };\n CaptionScreen.prototype.backSpace = function () {\n var row = this.rows[this.currRow];\n row.backSpace();\n };\n CaptionScreen.prototype.clearToEndOfRow = function () {\n var row = this.rows[this.currRow];\n row.clearToEndOfRow();\n };\n /**\n * Insert a character (without styling) in the current row.\n */\n CaptionScreen.prototype.insertChar = function (char) {\n var row = this.rows[this.currRow];\n row.insertChar(char);\n };\n CaptionScreen.prototype.setPen = function (styles) {\n var row = this.rows[this.currRow];\n row.setPenStyles(styles);\n };\n CaptionScreen.prototype.moveCursor = function (relPos) {\n var row = this.rows[this.currRow];\n row.moveCursor(relPos);\n };\n CaptionScreen.prototype.setCursor = function (absPos) {\n logger.log('INFO', 'setCursor: ' + absPos);\n var row = this.rows[this.currRow];\n row.setCursor(absPos);\n };\n CaptionScreen.prototype.setPAC = function (pacData) {\n logger.log('INFO', 'pacData = ' + JSON.stringify(pacData));\n var newRow = pacData.row - 1;\n if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) {\n newRow = this.nrRollUpRows - 1;\n }\n // Make sure this only affects Roll-up Captions by checking this.nrRollUpRows\n if (this.nrRollUpRows && this.currRow !== newRow) {\n // clear all rows first\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n }\n // Copy this.nrRollUpRows rows from lastOutputScreen and place it in the newRow location\n // topRowIndex - the start of rows to copy (inclusive index)\n var topRowIndex = this.currRow + 1 - (this.nrRollUpRows);\n // We only copy if the last position was already shown.\n // We use the cueStartTime value to check this.\n var lastOutputScreen = this.lastOutputScreen;\n if (lastOutputScreen) {\n var prevLineTime = lastOutputScreen.rows[topRowIndex].cueStartTime;\n if (prevLineTime && prevLineTime < logger.time) {\n for (var i = 0; i < this.nrRollUpRows; i++) {\n this.rows[newRow - this.nrRollUpRows + i + 1].copy(lastOutputScreen.rows[topRowIndex + i]);\n }\n }\n }\n }\n this.currRow = newRow;\n var row = this.rows[this.currRow];\n if (pacData.indent !== null) {\n var indent = pacData.indent;\n var prevPos = Math.max(indent - 1, 0);\n row.setCursor(pacData.indent);\n pacData.color = row.chars[prevPos].penState.foreground;\n }\n var styles = { foreground: pacData.color, underline: pacData.underline, italics: pacData.italics, background: 'black', flash: false };\n this.setPen(styles);\n };\n /**\n * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).\n */\n CaptionScreen.prototype.setBkgData = function (bkgData) {\n logger.log('INFO', 'bkgData = ' + JSON.stringify(bkgData));\n this.backSpace();\n this.setPen(bkgData);\n this.insertChar(0x20); // Space\n };\n CaptionScreen.prototype.setRollUpRows = function (nrRows) {\n this.nrRollUpRows = nrRows;\n };\n CaptionScreen.prototype.rollUp = function () {\n if (this.nrRollUpRows === null) {\n logger.log('DEBUG', 'roll_up but nrRollUpRows not set yet');\n return; // Not properly setup\n }\n logger.log('TEXT', this.getDisplayText());\n var topRowIndex = this.currRow + 1 - this.nrRollUpRows;\n var topRow = this.rows.splice(topRowIndex, 1)[0];\n topRow.clear();\n this.rows.splice(this.currRow, 0, topRow);\n logger.log('INFO', 'Rolling up');\n // logger.log('TEXT', this.get_display_text())\n };\n /**\n * Get all non-empty rows with as unicode text.\n */\n CaptionScreen.prototype.getDisplayText = function (asOneRow) {\n asOneRow = asOneRow || false;\n var displayText = [];\n var text = '';\n var rowNr = -1;\n for (var i = 0; i < NR_ROWS; i++) {\n var rowText = this.rows[i].getTextString();\n if (rowText) {\n rowNr = i + 1;\n if (asOneRow) {\n displayText.push('Row ' + rowNr + ': \\'' + rowText + '\\'');\n }\n else {\n displayText.push(rowText.trim());\n }\n }\n }\n if (displayText.length > 0) {\n if (asOneRow) {\n text = '[' + displayText.join(' | ') + ']';\n }\n else {\n text = displayText.join('\\n');\n }\n }\n return text;\n };\n CaptionScreen.prototype.getTextAndFormat = function () {\n return this.rows;\n };\n return CaptionScreen;\n}());\n// var modes = ['MODE_ROLL-UP', 'MODE_POP-ON', 'MODE_PAINT-ON', 'MODE_TEXT'];\nvar Cea608Channel = /** @class */ (function () {\n function Cea608Channel(channelNumber, outputFilter) {\n this.chNr = channelNumber;\n this.outputFilter = outputFilter;\n this.mode = null;\n this.verbose = 0;\n this.displayedMemory = new CaptionScreen();\n this.nonDisplayedMemory = new CaptionScreen();\n this.lastOutputScreen = new CaptionScreen();\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null; // Keeps track of where a cue started.\n }\n Cea608Channel.prototype.reset = function () {\n this.mode = null;\n this.displayedMemory.reset();\n this.nonDisplayedMemory.reset();\n this.lastOutputScreen.reset();\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null;\n this.lastCueEndTime = null;\n };\n Cea608Channel.prototype.getHandler = function () {\n return this.outputFilter;\n };\n Cea608Channel.prototype.setHandler = function (newHandler) {\n this.outputFilter = newHandler;\n };\n Cea608Channel.prototype.setPAC = function (pacData) {\n this.writeScreen.setPAC(pacData);\n };\n Cea608Channel.prototype.setBkgData = function (bkgData) {\n this.writeScreen.setBkgData(bkgData);\n };\n Cea608Channel.prototype.setMode = function (newMode) {\n if (newMode === this.mode) {\n return;\n }\n this.mode = newMode;\n logger.log('INFO', 'MODE=' + newMode);\n if (this.mode === 'MODE_POP-ON') {\n this.writeScreen = this.nonDisplayedMemory;\n }\n else {\n this.writeScreen = this.displayedMemory;\n this.writeScreen.reset();\n }\n if (this.mode !== 'MODE_ROLL-UP') {\n this.displayedMemory.nrRollUpRows = null;\n this.nonDisplayedMemory.nrRollUpRows = null;\n }\n this.mode = newMode;\n };\n Cea608Channel.prototype.insertChars = function (chars) {\n for (var i = 0; i < chars.length; i++) {\n this.writeScreen.insertChar(chars[i]);\n }\n var screen = this.writeScreen === this.displayedMemory ? 'DISP' : 'NON_DISP';\n logger.log('INFO', screen + ': ' + this.writeScreen.getDisplayText(true));\n if (this.mode === 'MODE_PAINT-ON' || this.mode === 'MODE_ROLL-UP') {\n logger.log('TEXT', 'DISPLAYED: ' + this.displayedMemory.getDisplayText(true));\n this.outputDataUpdate();\n }\n };\n Cea608Channel.prototype.ccRCL = function () {\n logger.log('INFO', 'RCL - Resume Caption Loading');\n this.setMode('MODE_POP-ON');\n };\n Cea608Channel.prototype.ccBS = function () {\n logger.log('INFO', 'BS - BackSpace');\n if (this.mode === 'MODE_TEXT') {\n return;\n }\n this.writeScreen.backSpace();\n if (this.writeScreen === this.displayedMemory) {\n this.outputDataUpdate();\n }\n };\n Cea608Channel.prototype.ccAOF = function () {\n };\n Cea608Channel.prototype.ccAON = function () {\n };\n Cea608Channel.prototype.ccDER = function () {\n logger.log('INFO', 'DER- Delete to End of Row');\n this.writeScreen.clearToEndOfRow();\n this.outputDataUpdate();\n };\n Cea608Channel.prototype.ccRU = function (nrRows) {\n logger.log('INFO', 'RU(' + nrRows + ') - Roll Up');\n this.writeScreen = this.displayedMemory;\n this.setMode('MODE_ROLL-UP');\n this.writeScreen.setRollUpRows(nrRows);\n };\n Cea608Channel.prototype.ccFON = function () {\n logger.log('INFO', 'FON - Flash On');\n this.writeScreen.setPen({ flash: true });\n };\n Cea608Channel.prototype.ccRDC = function () {\n logger.log('INFO', 'RDC - Resume Direct Captioning');\n this.setMode('MODE_PAINT-ON');\n };\n Cea608Channel.prototype.ccTR = function () {\n logger.log('INFO', 'TR');\n this.setMode('MODE_TEXT');\n };\n Cea608Channel.prototype.ccRTD = function () {\n logger.log('INFO', 'RTD');\n this.setMode('MODE_TEXT');\n };\n Cea608Channel.prototype.ccEDM = function () {\n logger.log('INFO', 'EDM - Erase Displayed Memory');\n this.displayedMemory.reset();\n this.outputDataUpdate(true);\n };\n Cea608Channel.prototype.ccCR = function () {\n logger.log('CR - Carriage Return');\n this.writeScreen.rollUp();\n this.outputDataUpdate(true);\n };\n Cea608Channel.prototype.ccENM = function () {\n logger.log('INFO', 'ENM - Erase Non-displayed Memory');\n this.nonDisplayedMemory.reset();\n };\n Cea608Channel.prototype.ccEOC = function () {\n logger.log('INFO', 'EOC - End Of Caption');\n if (this.mode === 'MODE_POP-ON') {\n var tmp = this.displayedMemory;\n this.displayedMemory = this.nonDisplayedMemory;\n this.nonDisplayedMemory = tmp;\n this.writeScreen = this.nonDisplayedMemory;\n logger.log('TEXT', 'DISP: ' + this.displayedMemory.getDisplayText());\n }\n this.outputDataUpdate(true);\n };\n Cea608Channel.prototype.ccTO = function (nrCols) {\n logger.log('INFO', 'TO(' + nrCols + ') - Tab Offset');\n this.writeScreen.moveCursor(nrCols);\n };\n Cea608Channel.prototype.ccMIDROW = function (secondByte) {\n var styles = { flash: false };\n styles.underline = secondByte % 2 === 1;\n styles.italics = secondByte >= 0x2e;\n if (!styles.italics) {\n var colorIndex = Math.floor(secondByte / 2) - 0x10;\n var colors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta'];\n styles.foreground = colors[colorIndex];\n }\n else {\n styles.foreground = 'white';\n }\n logger.log('INFO', 'MIDROW: ' + JSON.stringify(styles));\n this.writeScreen.setPen(styles);\n };\n Cea608Channel.prototype.outputDataUpdate = function (dispatch) {\n if (dispatch === void 0) { dispatch = false; }\n var t = logger.time;\n if (t === null) {\n return;\n }\n if (this.outputFilter) {\n if (this.cueStartTime === null && !this.displayedMemory.isEmpty()) { // Start of a new cue\n this.cueStartTime = t;\n }\n else {\n if (!this.displayedMemory.equals(this.lastOutputScreen)) {\n if (this.outputFilter.newCue) {\n this.outputFilter.newCue(this.cueStartTime, t, this.lastOutputScreen);\n if (dispatch === true && this.outputFilter.dispatchCue) {\n this.outputFilter.dispatchCue();\n }\n }\n this.cueStartTime = this.displayedMemory.isEmpty() ? null : t;\n }\n }\n this.lastOutputScreen.copy(this.displayedMemory);\n }\n };\n Cea608Channel.prototype.cueSplitAtTime = function (t) {\n if (this.outputFilter) {\n if (!this.displayedMemory.isEmpty()) {\n if (this.outputFilter.newCue) {\n this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory);\n }\n this.cueStartTime = t;\n }\n }\n };\n return Cea608Channel;\n}());\nvar Cea608Parser = /** @class */ (function () {\n function Cea608Parser(field, out1, out2) {\n this.field = field || 1;\n this.outputs = [out1, out2];\n this.channels = [new Cea608Channel(1, out1), new Cea608Channel(2, out2)];\n this.currChNr = -1; // Will be 1 or 2\n this.lastCmdA = null; // First byte of last command\n this.lastCmdB = null; // Second byte of last command\n this.bufferedData = [];\n this.startTime = null;\n this.lastTime = null;\n this.dataCounters = { 'padding': 0, 'char': 0, 'cmd': 0, 'other': 0 };\n }\n Cea608Parser.prototype.getHandler = function (index) {\n return this.channels[index].getHandler();\n };\n Cea608Parser.prototype.setHandler = function (index, newHandler) {\n this.channels[index].setHandler(newHandler);\n };\n /**\n * Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs.\n */\n Cea608Parser.prototype.addData = function (t, byteList) {\n var cmdFound, a, b, charsFound = false;\n this.lastTime = t;\n logger.setTime(t);\n for (var i = 0; i < byteList.length; i += 2) {\n a = byteList[i] & 0x7f;\n b = byteList[i + 1] & 0x7f;\n if (a === 0 && b === 0) {\n this.dataCounters.padding += 2;\n continue;\n }\n else {\n logger.log('DATA', '[' + numArrayToHexArray([byteList[i], byteList[i + 1]]) + '] -> (' + numArrayToHexArray([a, b]) + ')');\n }\n cmdFound = this.parseCmd(a, b);\n if (!cmdFound) {\n cmdFound = this.parseMidrow(a, b);\n }\n if (!cmdFound) {\n cmdFound = this.parsePAC(a, b);\n }\n if (!cmdFound) {\n cmdFound = this.parseBackgroundAttributes(a, b);\n }\n if (!cmdFound) {\n charsFound = this.parseChars(a, b);\n if (charsFound) {\n if (this.currChNr && this.currChNr >= 0) {\n var channel = this.channels[this.currChNr - 1];\n channel.insertChars(charsFound);\n }\n else {\n logger.log('WARNING', 'No channel found yet. TEXT-MODE?');\n }\n }\n }\n if (cmdFound) {\n this.dataCounters.cmd += 2;\n }\n else if (charsFound) {\n this.dataCounters.char += 2;\n }\n else {\n this.dataCounters.other += 2;\n logger.log('WARNING', 'Couldn\\'t parse cleaned data ' + numArrayToHexArray([a, b]) +\n ' orig: ' + numArrayToHexArray([byteList[i], byteList[i + 1]]));\n }\n }\n };\n /**\n * Parse Command.\n * @returns {Boolean} Tells if a command was found\n */\n Cea608Parser.prototype.parseCmd = function (a, b) {\n var chNr = null;\n var cond1 = (a === 0x14 || a === 0x1C) && (b >= 0x20 && b <= 0x2F);\n var cond2 = (a === 0x17 || a === 0x1F) && (b >= 0x21 && b <= 0x23);\n if (!(cond1 || cond2)) {\n return false;\n }\n if (a === this.lastCmdA && b === this.lastCmdB) {\n this.lastCmdA = null;\n this.lastCmdB = null; // Repeated commands are dropped (once)\n logger.log('DEBUG', 'Repeated command (' + numArrayToHexArray([a, b]) + ') is dropped');\n return true;\n }\n if (a === 0x14 || a === 0x17) {\n chNr = 1;\n }\n else {\n chNr = 2;\n } // (a === 0x1C || a=== 0x1f)\n var channel = this.channels[chNr - 1];\n if (a === 0x14 || a === 0x1C) {\n if (b === 0x20) {\n channel.ccRCL();\n }\n else if (b === 0x21) {\n channel.ccBS();\n }\n else if (b === 0x22) {\n channel.ccAOF();\n }\n else if (b === 0x23) {\n channel.ccAON();\n }\n else if (b === 0x24) {\n channel.ccDER();\n }\n else if (b === 0x25) {\n channel.ccRU(2);\n }\n else if (b === 0x26) {\n channel.ccRU(3);\n }\n else if (b === 0x27) {\n channel.ccRU(4);\n }\n else if (b === 0x28) {\n channel.ccFON();\n }\n else if (b === 0x29) {\n channel.ccRDC();\n }\n else if (b === 0x2A) {\n channel.ccTR();\n }\n else if (b === 0x2B) {\n channel.ccRTD();\n }\n else if (b === 0x2C) {\n channel.ccEDM();\n }\n else if (b === 0x2D) {\n channel.ccCR();\n }\n else if (b === 0x2E) {\n channel.ccENM();\n }\n else if (b === 0x2F) {\n channel.ccEOC();\n }\n }\n else { // a == 0x17 || a == 0x1F\n channel.ccTO(b - 0x20);\n }\n this.lastCmdA = a;\n this.lastCmdB = b;\n this.currChNr = chNr;\n return true;\n };\n /**\n * Parse midrow styling command\n * @returns {Boolean}\n */\n Cea608Parser.prototype.parseMidrow = function (a, b) {\n var chNr = null;\n if (((a === 0x11) || (a === 0x19)) && b >= 0x20 && b <= 0x2f) {\n if (a === 0x11) {\n chNr = 1;\n }\n else {\n chNr = 2;\n }\n if (chNr !== this.currChNr) {\n logger.log('ERROR', 'Mismatch channel in midrow parsing');\n return false;\n }\n var channel = this.channels[chNr - 1];\n channel.ccMIDROW(b);\n logger.log('DEBUG', 'MIDROW (' + numArrayToHexArray([a, b]) + ')');\n return true;\n }\n return false;\n };\n /**\n * Parse Preable Access Codes (Table 53).\n * @returns {Boolean} Tells if PAC found\n */\n Cea608Parser.prototype.parsePAC = function (a, b) {\n var chNr = null;\n var row = null;\n var case1 = ((a >= 0x11 && a <= 0x17) || (a >= 0x19 && a <= 0x1F)) && (b >= 0x40 && b <= 0x7F);\n var case2 = (a === 0x10 || a === 0x18) && (b >= 0x40 && b <= 0x5F);\n if (!(case1 || case2)) {\n return false;\n }\n if (a === this.lastCmdA && b === this.lastCmdB) {\n this.lastCmdA = null;\n this.lastCmdB = null;\n return true; // Repeated commands are dropped (once)\n }\n chNr = (a <= 0x17) ? 1 : 2;\n if (b >= 0x40 && b <= 0x5F) {\n row = (chNr === 1) ? rowsLowCh1[a] : rowsLowCh2[a];\n }\n else { // 0x60 <= b <= 0x7F\n row = (chNr === 1) ? rowsHighCh1[a] : rowsHighCh2[a];\n }\n var pacData = this.interpretPAC(row, b);\n var channel = this.channels[chNr - 1];\n channel.setPAC(pacData);\n this.lastCmdA = a;\n this.lastCmdB = b;\n this.currChNr = chNr;\n return true;\n };\n /**\n * Interpret the second byte of the pac, and return the information.\n * @returns {Object} pacData with style parameters.\n */\n Cea608Parser.prototype.interpretPAC = function (row, byte) {\n var pacIndex = byte;\n var pacData = { color: null, italics: false, indent: null, underline: false, row: row };\n if (byte > 0x5F) {\n pacIndex = byte - 0x60;\n }\n else {\n pacIndex = byte - 0x40;\n }\n pacData.underline = (pacIndex & 1) === 1;\n if (pacIndex <= 0xd) {\n pacData.color = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'white'][Math.floor(pacIndex / 2)];\n }\n else if (pacIndex <= 0xf) {\n pacData.italics = true;\n pacData.color = 'white';\n }\n else {\n pacData.indent = (Math.floor((pacIndex - 0x10) / 2)) * 4;\n }\n return pacData; // Note that row has zero offset. The spec uses 1.\n };\n /**\n * Parse characters.\n * @returns An array with 1 to 2 codes corresponding to chars, if found. null otherwise.\n */\n Cea608Parser.prototype.parseChars = function (a, b) {\n var channelNr = null, charCodes = null, charCode1 = null;\n if (a >= 0x19) {\n channelNr = 2;\n charCode1 = a - 8;\n }\n else {\n channelNr = 1;\n charCode1 = a;\n }\n if (charCode1 >= 0x11 && charCode1 <= 0x13) {\n // Special character\n var oneCode = b;\n if (charCode1 === 0x11) {\n oneCode = b + 0x50;\n }\n else if (charCode1 === 0x12) {\n oneCode = b + 0x70;\n }\n else {\n oneCode = b + 0x90;\n }\n logger.log('INFO', 'Special char \\'' + getCharForByte(oneCode) + '\\' in channel ' + channelNr);\n charCodes = [oneCode];\n }\n else if (a >= 0x20 && a <= 0x7f) {\n charCodes = (b === 0) ? [a] : [a, b];\n }\n if (charCodes) {\n var hexCodes = numArrayToHexArray(charCodes);\n logger.log('DEBUG', 'Char codes = ' + hexCodes.join(','));\n this.lastCmdA = null;\n this.lastCmdB = null;\n }\n return charCodes;\n };\n /**\n * Parse extended background attributes as well as new foreground color black.\n * @returns{Boolean} Tells if background attributes are found\n */\n Cea608Parser.prototype.parseBackgroundAttributes = function (a, b) {\n var bkgData, index, chNr, channel;\n var case1 = (a === 0x10 || a === 0x18) && (b >= 0x20 && b <= 0x2f);\n var case2 = (a === 0x17 || a === 0x1f) && (b >= 0x2d && b <= 0x2f);\n if (!(case1 || case2)) {\n return false;\n }\n bkgData = {};\n if (a === 0x10 || a === 0x18) {\n index = Math.floor((b - 0x20) / 2);\n bkgData.background = backgroundColors[index];\n if (b % 2 === 1) {\n bkgData.background = bkgData.background + '_semi';\n }\n }\n else if (b === 0x2d) {\n bkgData.background = 'transparent';\n }\n else {\n bkgData.foreground = 'black';\n if (b === 0x2f) {\n bkgData.underline = true;\n }\n }\n chNr = (a < 0x18) ? 1 : 2;\n channel = this.channels[chNr - 1];\n channel.setBkgData(bkgData);\n this.lastCmdA = null;\n this.lastCmdB = null;\n return true;\n };\n /**\n * Reset state of parser and its channels.\n */\n Cea608Parser.prototype.reset = function () {\n for (var i = 0; i < this.channels.length; i++) {\n if (this.channels[i]) {\n this.channels[i].reset();\n }\n }\n this.lastCmdA = null;\n this.lastCmdB = null;\n };\n /**\n * Trigger the generation of a cue, and the start of a new one if displayScreens are not empty.\n */\n Cea608Parser.prototype.cueSplitAtTime = function (t) {\n for (var i = 0; i < this.channels.length; i++) {\n if (this.channels[i]) {\n this.channels[i].cueSplitAtTime(t);\n }\n }\n };\n return Cea608Parser;\n}());\nexports.default = Cea608Parser;\n\n\n/***/ }),\n\n/***/ \"./src/utils/codecs.js\":\n/*!*****************************!*\\\n !*** ./src/utils/codecs.js ***!\n \\*****************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// from http://mp4ra.org/codecs.html\nvar sampleEntryCodesISO = {\n audio: {\n 'a3ds': true,\n 'ac-3': true,\n 'ac-4': true,\n 'alac': true,\n 'alaw': true,\n 'dra1': true,\n 'dts+': true,\n 'dts-': true,\n 'dtsc': true,\n 'dtse': true,\n 'dtsh': true,\n 'ec-3': true,\n 'enca': true,\n 'g719': true,\n 'g726': true,\n 'm4ae': true,\n 'mha1': true,\n 'mha2': true,\n 'mhm1': true,\n 'mhm2': true,\n 'mlpa': true,\n 'mp4a': true,\n 'raw ': true,\n 'Opus': true,\n 'samr': true,\n 'sawb': true,\n 'sawp': true,\n 'sevc': true,\n 'sqcp': true,\n 'ssmv': true,\n 'twos': true,\n 'ulaw': true\n },\n video: {\n 'avc1': true,\n 'avc2': true,\n 'avc3': true,\n 'avc4': true,\n 'avcp': true,\n 'drac': true,\n 'dvav': true,\n 'dvhe': true,\n 'encv': true,\n 'hev1': true,\n 'hvc1': true,\n 'mjp2': true,\n 'mp4v': true,\n 'mvc1': true,\n 'mvc2': true,\n 'mvc3': true,\n 'mvc4': true,\n 'resv': true,\n 'rv60': true,\n 's263': true,\n 'svc1': true,\n 'svc2': true,\n 'vc-1': true,\n 'vp08': true,\n 'vp09': true\n }\n};\nfunction isCodecType(codec, type) {\n var typeCodes = sampleEntryCodesISO[type];\n return !!typeCodes && typeCodes[codec.slice(0, 4)] === true;\n}\nexports.isCodecType = isCodecType;\nfunction isCodecSupportedInMp4(codec, type) {\n return window.MediaSource.isTypeSupported((type || 'video') + \"/mp4;codecs=\\\"\" + codec + \"\\\"\");\n}\nexports.isCodecSupportedInMp4 = isCodecSupportedInMp4;\n\n\n/***/ }),\n\n/***/ \"./src/utils/cues.js\":\n/*!***************************!*\\\n !*** ./src/utils/cues.js ***!\n \\***************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar vttparser_1 = __webpack_require__(/*! ./vttparser */ \"./src/utils/vttparser.js\");\nfunction newCue(track, startTime, endTime, captionScreen) {\n var row;\n var cue;\n var indenting;\n var indent;\n var text;\n var VTTCue = window.VTTCue || window.TextTrackCue;\n for (var r = 0; r < captionScreen.rows.length; r++) {\n row = captionScreen.rows[r];\n indenting = true;\n indent = 0;\n text = '';\n if (!row.isEmpty()) {\n for (var c = 0; c < row.chars.length; c++) {\n if (row.chars[c].uchar.match(/\\s/) && indenting) {\n indent++;\n }\n else {\n text += row.chars[c].uchar;\n indenting = false;\n }\n }\n // To be used for cleaning-up orphaned roll-up captions\n row.cueStartTime = startTime;\n // Give a slight bump to the endTime if it's equal to startTime to avoid a SyntaxError in IE\n if (startTime === endTime) {\n endTime += 0.0001;\n }\n cue = new VTTCue(startTime, endTime, vttparser_1.fixLineBreaks(text.trim()));\n if (indent >= 16) {\n indent--;\n }\n else {\n indent++;\n }\n // VTTCue.line get's flakey when using controls, so let's now include line 13&14\n // also, drop line 1 since it's to close to the top\n if (navigator.userAgent.match(/Firefox\\//)) {\n cue.line = r + 1;\n }\n else {\n cue.line = (r > 7 ? r - 2 : r + 1);\n }\n cue.align = 'left';\n // Clamp the position between 0 and 100 - if out of these bounds, Firefox throws an exception and captions break\n cue.position = Math.max(0, Math.min(100, 100 * (indent / 32) + (navigator.userAgent.match(/Firefox\\//) ? 50 : 0)));\n track.addCue(cue);\n }\n }\n}\nexports.newCue = newCue;\n\n\n/***/ }),\n\n/***/ \"./src/utils/discontinuities.js\":\n/*!**************************************!*\\\n !*** ./src/utils/discontinuities.js ***!\n \\**************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar binary_search_1 = __webpack_require__(/*! ./binary-search */ \"./src/utils/binary-search.js\");\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nfunction findFirstFragWithCC(fragments, cc) {\n var firstFrag = null;\n for (var i = 0; i < fragments.length; i += 1) {\n var currentFrag = fragments[i];\n if (currentFrag && currentFrag.cc === cc) {\n firstFrag = currentFrag;\n break;\n }\n }\n return firstFrag;\n}\nexports.findFirstFragWithCC = findFirstFragWithCC;\nfunction findFragWithCC(fragments, CC) {\n return binary_search_1.default.search(fragments, function (candidate) {\n if (candidate.cc < CC) {\n return 1;\n }\n else if (candidate.cc > CC) {\n return -1;\n }\n else {\n return 0;\n }\n });\n}\nexports.findFragWithCC = findFragWithCC;\nfunction shouldAlignOnDiscontinuities(lastFrag, lastLevel, details) {\n var shouldAlign = false;\n if (lastLevel && lastLevel.details && details) {\n if (details.endCC > details.startCC || (lastFrag && lastFrag.cc < details.startCC)) {\n shouldAlign = true;\n }\n }\n return shouldAlign;\n}\nexports.shouldAlignOnDiscontinuities = shouldAlignOnDiscontinuities;\n// Find the first frag in the previous level which matches the CC of the first frag of the new level\nfunction findDiscontinuousReferenceFrag(prevDetails, curDetails) {\n var prevFrags = prevDetails.fragments;\n var curFrags = curDetails.fragments;\n if (!curFrags.length || !prevFrags.length) {\n logger_1.logger.log('No fragments to align');\n return;\n }\n var prevStartFrag = findFirstFragWithCC(prevFrags, curFrags[0].cc);\n if (!prevStartFrag || (prevStartFrag && !prevStartFrag.startPTS)) {\n logger_1.logger.log('No frag in previous level to align on');\n return;\n }\n return prevStartFrag;\n}\nexports.findDiscontinuousReferenceFrag = findDiscontinuousReferenceFrag;\nfunction adjustPts(sliding, details) {\n details.fragments.forEach(function (frag) {\n if (frag) {\n var start = frag.start + sliding;\n frag.start = frag.startPTS = start;\n frag.endPTS = start + frag.duration;\n }\n });\n details.PTSKnown = true;\n}\nexports.adjustPts = adjustPts;\n/**\n * Using the parameters of the last level, this function computes PTS' of the new fragments so that they form a\n * contiguous stream with the last fragments.\n * The PTS of a fragment lets Hls.js know where it fits into a stream - by knowing every PTS, we know which fragment to\n * download at any given time. PTS is normally computed when the fragment is demuxed, so taking this step saves us time\n * and an extra download.\n * @param lastFrag\n * @param lastLevel\n * @param details\n */\nfunction alignStream(lastFrag, lastLevel, details) {\n alignDiscontinuities(lastFrag, details, lastLevel);\n if (!details.PTSKnown && lastLevel) {\n // If the PTS wasn't figured out via discontinuity sequence that means there was no CC increase within the level.\n // Aligning via Program Date Time should therefore be reliable, since PDT should be the same within the same\n // discontinuity sequence.\n alignPDT(details, lastLevel.details);\n }\n}\nexports.alignStream = alignStream;\n/**\n * Computes the PTS if a new level's fragments using the PTS of a fragment in the last level which shares the same\n * discontinuity sequence.\n * @param lastLevel - The details of the last loaded level\n * @param details - The details of the new level\n */\nfunction alignDiscontinuities(lastFrag, details, lastLevel) {\n if (shouldAlignOnDiscontinuities(lastFrag, lastLevel, details)) {\n var referenceFrag = findDiscontinuousReferenceFrag(lastLevel.details, details);\n if (referenceFrag) {\n logger_1.logger.log('Adjusting PTS using last level due to CC increase within current level');\n adjustPts(referenceFrag.start, details);\n }\n }\n}\nexports.alignDiscontinuities = alignDiscontinuities;\n/**\n * Computes the PTS of a new level's fragments using the difference in Program Date Time from the last level.\n * @param details - The details of the new level\n * @param lastDetails - The details of the last loaded level\n */\nfunction alignPDT(details, lastDetails) {\n if (lastDetails && lastDetails.fragments.length) {\n if (!details.hasProgramDateTime || !lastDetails.hasProgramDateTime) {\n return;\n }\n // if last level sliding is 1000 and its first frag PROGRAM-DATE-TIME is 2017-08-20 1:10:00 AM\n // and if new details first frag PROGRAM DATE-TIME is 2017-08-20 1:10:08 AM\n // then we can deduce that playlist B sliding is 1000+8 = 1008s\n var lastPDT = lastDetails.fragments[0].programDateTime;\n var newPDT = details.fragments[0].programDateTime;\n // date diff is in ms. frag.start is in seconds\n var sliding = (newPDT - lastPDT) / 1000 + lastDetails.fragments[0].start;\n if (Number.isFinite(sliding)) {\n logger_1.logger.log(\"adjusting PTS using programDateTime delta, sliding:\" + sliding.toFixed(3));\n adjustPts(sliding, details);\n }\n }\n}\nexports.alignPDT = alignPDT;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/utils/ewma-bandwidth-estimator.js\":\n/*!***********************************************!*\\\n !*** ./src/utils/ewma-bandwidth-estimator.js ***!\n \\***********************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/*\n * EWMA Bandwidth Estimator\n * - heavily inspired from shaka-player\n * Tracks bandwidth samples and estimates available bandwidth.\n * Based on the minimum of two exponentially-weighted moving averages with\n * different half-lives.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ewma_1 = __webpack_require__(/*! ../utils/ewma */ \"./src/utils/ewma.js\");\nvar EwmaBandWidthEstimator = /** @class */ (function () {\n function EwmaBandWidthEstimator(hls, slow, fast, defaultEstimate) {\n this.hls = hls;\n this.defaultEstimate_ = defaultEstimate;\n this.minWeight_ = 0.001;\n this.minDelayMs_ = 50;\n this.slow_ = new ewma_1.default(slow);\n this.fast_ = new ewma_1.default(fast);\n }\n EwmaBandWidthEstimator.prototype.sample = function (durationMs, numBytes) {\n durationMs = Math.max(durationMs, this.minDelayMs_);\n var bandwidth = 8000 * numBytes / durationMs, \n // console.log('instant bw:'+ Math.round(bandwidth));\n // we weight sample using loading duration....\n weight = durationMs / 1000;\n this.fast_.sample(weight, bandwidth);\n this.slow_.sample(weight, bandwidth);\n };\n EwmaBandWidthEstimator.prototype.canEstimate = function () {\n var fast = this.fast_;\n return (fast && fast.getTotalWeight() >= this.minWeight_);\n };\n EwmaBandWidthEstimator.prototype.getEstimate = function () {\n if (this.canEstimate()) {\n // console.log('slow estimate:'+ Math.round(this.slow_.getEstimate()));\n // console.log('fast estimate:'+ Math.round(this.fast_.getEstimate()));\n // Take the minimum of these two estimates. This should have the effect of\n // adapting down quickly, but up more slowly.\n return Math.min(this.fast_.getEstimate(), this.slow_.getEstimate());\n }\n else {\n return this.defaultEstimate_;\n }\n };\n EwmaBandWidthEstimator.prototype.destroy = function () {\n };\n return EwmaBandWidthEstimator;\n}());\nexports.default = EwmaBandWidthEstimator;\n\n\n/***/ }),\n\n/***/ \"./src/utils/ewma.js\":\n/*!***************************!*\\\n !*** ./src/utils/ewma.js ***!\n \\***************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/*\n * compute an Exponential Weighted moving average\n * - https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average\n * - heavily inspired from shaka-player\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar EWMA = /** @class */ (function () {\n // About half of the estimated value will be from the last |halfLife| samples by weight.\n function EWMA(halfLife) {\n // Larger values of alpha expire historical data more slowly.\n this.alpha_ = halfLife ? Math.exp(Math.log(0.5) / halfLife) : 0;\n this.estimate_ = 0;\n this.totalWeight_ = 0;\n }\n EWMA.prototype.sample = function (weight, value) {\n var adjAlpha = Math.pow(this.alpha_, weight);\n this.estimate_ = value * (1 - adjAlpha) + adjAlpha * this.estimate_;\n this.totalWeight_ += weight;\n };\n EWMA.prototype.getTotalWeight = function () {\n return this.totalWeight_;\n };\n EWMA.prototype.getEstimate = function () {\n if (this.alpha_) {\n var zeroFactor = 1 - Math.pow(this.alpha_, this.totalWeight_);\n return this.estimate_ / zeroFactor;\n }\n else {\n return this.estimate_;\n }\n };\n return EWMA;\n}());\nexports.default = EWMA;\n\n\n/***/ }),\n\n/***/ \"./src/utils/get-self-scope.js\":\n/*!*************************************!*\\\n !*** ./src/utils/get-self-scope.js ***!\n \\*************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction getSelfScope() {\n // see https://stackoverflow.com/a/11237259/589493\n if (typeof window === 'undefined') {\n /* eslint-disable-next-line no-undef */\n return self;\n }\n else {\n return window;\n }\n}\nexports.getSelfScope = getSelfScope;\n\n\n/***/ }),\n\n/***/ \"./src/utils/logger.js\":\n/*!*****************************!*\\\n !*** ./src/utils/logger.js ***!\n \\*****************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar get_self_scope_1 = __webpack_require__(/*! ./get-self-scope */ \"./src/utils/get-self-scope.js\");\nfunction noop() { }\nvar fakeLogger = {\n trace: noop,\n debug: noop,\n log: noop,\n warn: noop,\n info: noop,\n error: noop\n};\nvar exportedLogger = fakeLogger;\n// let lastCallTime;\n// function formatMsgWithTimeInfo(type, msg) {\n// const now = Date.now();\n// const diff = lastCallTime ? '+' + (now - lastCallTime) : '0';\n// lastCallTime = now;\n// msg = (new Date(now)).toISOString() + ' | [' + type + '] > ' + msg + ' ( ' + diff + ' ms )';\n// return msg;\n// }\nfunction formatMsg(type, msg) {\n msg = '[' + type + '] > ' + msg;\n return msg;\n}\nvar global = get_self_scope_1.getSelfScope();\nfunction consolePrintFn(type) {\n var func = global.console[type];\n if (func) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (args[0]) {\n args[0] = formatMsg(type, args[0]);\n }\n func.apply(global.console, args);\n };\n }\n return noop;\n}\nfunction exportLoggerFunctions(debugConfig) {\n var functions = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n functions[_i - 1] = arguments[_i];\n }\n functions.forEach(function (type) {\n exportedLogger[type] = debugConfig[type] ? debugConfig[type].bind(debugConfig) : consolePrintFn(type);\n });\n}\nexports.enableLogs = function (debugConfig) {\n if (debugConfig === true || typeof debugConfig === 'object') {\n exportLoggerFunctions(debugConfig, \n // Remove out from list here to hard-disable a log-level\n // 'trace',\n 'debug', 'log', 'info', 'warn', 'error');\n // Some browsers don't allow to use bind on console object anyway\n // fallback to default if needed\n try {\n exportedLogger.log();\n }\n catch (e) {\n exportedLogger = fakeLogger;\n }\n }\n else {\n exportedLogger = fakeLogger;\n }\n};\nexports.logger = exportedLogger;\n\n\n/***/ }),\n\n/***/ \"./src/utils/mediakeys-helper.js\":\n/*!***************************************!*\\\n !*** ./src/utils/mediakeys-helper.js ***!\n \\***************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar requestMediaKeySystemAccess = (function () {\n if (typeof window !== 'undefined' && window.navigator && window.navigator.requestMediaKeySystemAccess) {\n return window.navigator.requestMediaKeySystemAccess.bind(window.navigator);\n }\n else {\n return null;\n }\n})();\nexports.requestMediaKeySystemAccess = requestMediaKeySystemAccess;\n\n\n/***/ }),\n\n/***/ \"./src/utils/mediasource-helper.js\":\n/*!*****************************************!*\\\n !*** ./src/utils/mediasource-helper.js ***!\n \\*****************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * MediaSource helper\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction getMediaSource() {\n if (typeof window !== 'undefined') {\n return window.MediaSource || window.WebKitMediaSource;\n }\n}\nexports.getMediaSource = getMediaSource;\n\n\n/***/ }),\n\n/***/ \"./src/utils/output-filter.js\":\n/*!************************************!*\\\n !*** ./src/utils/output-filter.js ***!\n \\************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar OutputFilter = /** @class */ (function () {\n function OutputFilter(timelineController, trackName) {\n this.timelineController = timelineController;\n this.trackName = trackName;\n this.startTime = null;\n this.endTime = null;\n this.screen = null;\n }\n OutputFilter.prototype.dispatchCue = function () {\n if (this.startTime === null) {\n return;\n }\n this.timelineController.addCues(this.trackName, this.startTime, this.endTime, this.screen);\n this.startTime = null;\n };\n OutputFilter.prototype.newCue = function (startTime, endTime, screen) {\n if (this.startTime === null || this.startTime > startTime) {\n this.startTime = startTime;\n }\n this.endTime = endTime;\n this.screen = screen;\n this.timelineController.createCaptionsTrack(this.trackName);\n };\n return OutputFilter;\n}());\nexports.default = OutputFilter;\n\n\n/***/ }),\n\n/***/ \"./src/utils/texttrack-utils.js\":\n/*!**************************************!*\\\n !*** ./src/utils/texttrack-utils.js ***!\n \\**************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction sendAddTrackEvent(track, videoEl) {\n var event = null;\n try {\n event = new window.Event('addtrack');\n }\n catch (err) {\n // for IE11\n event = document.createEvent('Event');\n event.initEvent('addtrack', false, false);\n }\n event.track = track;\n videoEl.dispatchEvent(event);\n}\nexports.sendAddTrackEvent = sendAddTrackEvent;\nfunction clearCurrentCues(track) {\n if (track && track.cues) {\n while (track.cues.length > 0) {\n track.removeCue(track.cues[0]);\n }\n }\n}\nexports.clearCurrentCues = clearCurrentCues;\n\n\n/***/ }),\n\n/***/ \"./src/utils/time-ranges.js\":\n/*!**********************************!*\\\n !*** ./src/utils/time-ranges.js ***!\n \\**********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * TimeRanges to string helper\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar TimeRanges = {\n toString: function (r) {\n var log = '', len = r.length;\n for (var i = 0; i < len; i++) {\n log += '[' + r.start(i).toFixed(3) + ',' + r.end(i).toFixed(3) + ']';\n }\n return log;\n }\n};\nexports.default = TimeRanges;\n\n\n/***/ }),\n\n/***/ \"./src/utils/vttcue.js\":\n/*!*****************************!*\\\n !*** ./src/utils/vttcue.js ***!\n \\*****************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = (function () {\n if (typeof window !== 'undefined' && window.VTTCue) {\n return window.VTTCue;\n }\n var autoKeyword = 'auto';\n var directionSetting = {\n '': true,\n lr: true,\n rl: true\n };\n var alignSetting = {\n start: true,\n middle: true,\n end: true,\n left: true,\n right: true\n };\n function findDirectionSetting(value) {\n if (typeof value !== 'string') {\n return false;\n }\n var dir = directionSetting[value.toLowerCase()];\n return dir ? value.toLowerCase() : false;\n }\n function findAlignSetting(value) {\n if (typeof value !== 'string') {\n return false;\n }\n var align = alignSetting[value.toLowerCase()];\n return align ? value.toLowerCase() : false;\n }\n function extend(obj) {\n var i = 1;\n for (; i < arguments.length; i++) {\n var cobj = arguments[i];\n for (var p in cobj) {\n obj[p] = cobj[p];\n }\n }\n return obj;\n }\n function VTTCue(startTime, endTime, text) {\n var cue = this;\n var isIE8 = (function () {\n if (typeof navigator === 'undefined') {\n return;\n }\n return (/MSIE\\s8\\.0/).test(navigator.userAgent);\n })();\n var baseObj = {};\n if (isIE8) {\n cue = document.createElement('custom');\n }\n else {\n baseObj.enumerable = true;\n }\n /**\n * Shim implementation specific properties. These properties are not in\n * the spec.\n */\n // Lets us know when the VTTCue's data has changed in such a way that we need\n // to recompute its display state. This lets us compute its display state\n // lazily.\n cue.hasBeenReset = false;\n /**\n * VTTCue and TextTrackCue properties\n * http://dev.w3.org/html5/webvtt/#vttcue-interface\n */\n var _id = '';\n var _pauseOnExit = false;\n var _startTime = startTime;\n var _endTime = endTime;\n var _text = text;\n var _region = null;\n var _vertical = '';\n var _snapToLines = true;\n var _line = 'auto';\n var _lineAlign = 'start';\n var _position = 50;\n var _positionAlign = 'middle';\n var _size = 50;\n var _align = 'middle';\n Object.defineProperty(cue, 'id', extend({}, baseObj, {\n get: function () {\n return _id;\n },\n set: function (value) {\n _id = '' + value;\n }\n }));\n Object.defineProperty(cue, 'pauseOnExit', extend({}, baseObj, {\n get: function () {\n return _pauseOnExit;\n },\n set: function (value) {\n _pauseOnExit = !!value;\n }\n }));\n Object.defineProperty(cue, 'startTime', extend({}, baseObj, {\n get: function () {\n return _startTime;\n },\n set: function (value) {\n if (typeof value !== 'number') {\n throw new TypeError('Start time must be set to a number.');\n }\n _startTime = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'endTime', extend({}, baseObj, {\n get: function () {\n return _endTime;\n },\n set: function (value) {\n if (typeof value !== 'number') {\n throw new TypeError('End time must be set to a number.');\n }\n _endTime = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'text', extend({}, baseObj, {\n get: function () {\n return _text;\n },\n set: function (value) {\n _text = '' + value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'region', extend({}, baseObj, {\n get: function () {\n return _region;\n },\n set: function (value) {\n _region = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'vertical', extend({}, baseObj, {\n get: function () {\n return _vertical;\n },\n set: function (value) {\n var setting = findDirectionSetting(value);\n // Have to check for false because the setting an be an empty string.\n if (setting === false) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _vertical = setting;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'snapToLines', extend({}, baseObj, {\n get: function () {\n return _snapToLines;\n },\n set: function (value) {\n _snapToLines = !!value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'line', extend({}, baseObj, {\n get: function () {\n return _line;\n },\n set: function (value) {\n if (typeof value !== 'number' && value !== autoKeyword) {\n throw new SyntaxError('An invalid number or illegal string was specified.');\n }\n _line = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'lineAlign', extend({}, baseObj, {\n get: function () {\n return _lineAlign;\n },\n set: function (value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _lineAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'position', extend({}, baseObj, {\n get: function () {\n return _position;\n },\n set: function (value) {\n if (value < 0 || value > 100) {\n throw new Error('Position must be between 0 and 100.');\n }\n _position = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'positionAlign', extend({}, baseObj, {\n get: function () {\n return _positionAlign;\n },\n set: function (value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _positionAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'size', extend({}, baseObj, {\n get: function () {\n return _size;\n },\n set: function (value) {\n if (value < 0 || value > 100) {\n throw new Error('Size must be between 0 and 100.');\n }\n _size = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'align', extend({}, baseObj, {\n get: function () {\n return _align;\n },\n set: function (value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _align = setting;\n this.hasBeenReset = true;\n }\n }));\n /**\n * Other spec defined properties\n */\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state\n cue.displayState = undefined;\n if (isIE8) {\n return cue;\n }\n }\n /**\n * VTTCue methods\n */\n VTTCue.prototype.getCueAsHTML = function () {\n // Assume WebVTT.convertCueToDOMTree is on the global.\n var WebVTT = window.WebVTT;\n return WebVTT.convertCueToDOMTree(window, this.text);\n };\n return VTTCue;\n})();\n\n\n/***/ }),\n\n/***/ \"./src/utils/vttparser.js\":\n/*!********************************!*\\\n !*** ./src/utils/vttparser.js ***!\n \\********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/*\n * Source: https://github.com/mozilla/vtt.js/blob/master/dist/vtt.js#L1716\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar vttcue_1 = __webpack_require__(/*! ./vttcue */ \"./src/utils/vttcue.js\");\nvar StringDecoder = function StringDecoder() {\n return {\n decode: function (data) {\n if (!data) {\n return '';\n }\n if (typeof data !== 'string') {\n throw new Error('Error - expected string data.');\n }\n return decodeURIComponent(encodeURIComponent(data));\n }\n };\n};\nfunction VTTParser() {\n this.window = window;\n this.state = 'INITIAL';\n this.buffer = '';\n this.decoder = new StringDecoder();\n this.regionList = [];\n}\n// Try to parse input as a time stamp.\nfunction parseTimeStamp(input) {\n function computeSeconds(h, m, s, f) {\n return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;\n }\n var m = input.match(/^(\\d+):(\\d{2})(:\\d{2})?\\.(\\d{3})/);\n if (!m) {\n return null;\n }\n if (m[3]) {\n // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]\n return computeSeconds(m[1], m[2], m[3].replace(':', ''), m[4]);\n }\n else if (m[1] > 59) {\n // Timestamp takes the form of [hours]:[minutes].[milliseconds]\n // First position is hours as it's over 59.\n return computeSeconds(m[1], m[2], 0, m[4]);\n }\n else {\n // Timestamp takes the form of [minutes]:[seconds].[milliseconds]\n return computeSeconds(0, m[1], m[2], m[4]);\n }\n}\n// A settings object holds key/value pairs and will ignore anything but the first\n// assignment to a specific key.\nfunction Settings() {\n this.values = Object.create(null);\n}\nSettings.prototype = {\n // Only accept the first assignment to any key.\n set: function (k, v) {\n if (!this.get(k) && v !== '') {\n this.values[k] = v;\n }\n },\n // Return the value for a key, or a default value.\n // If 'defaultKey' is passed then 'dflt' is assumed to be an object with\n // a number of possible default values as properties where 'defaultKey' is\n // the key of the property that will be chosen; otherwise it's assumed to be\n // a single value.\n get: function (k, dflt, defaultKey) {\n if (defaultKey) {\n return this.has(k) ? this.values[k] : dflt[defaultKey];\n }\n return this.has(k) ? this.values[k] : dflt;\n },\n // Check whether we have a value for a key.\n has: function (k) {\n return k in this.values;\n },\n // Accept a setting if its one of the given alternatives.\n alt: function (k, v, a) {\n for (var n = 0; n < a.length; ++n) {\n if (v === a[n]) {\n this.set(k, v);\n break;\n }\n }\n },\n // Accept a setting if its a valid (signed) integer.\n integer: function (k, v) {\n if (/^-?\\d+$/.test(v)) { // integer\n this.set(k, parseInt(v, 10));\n }\n },\n // Accept a setting if its a valid percentage.\n percent: function (k, v) {\n var m;\n if ((m = v.match(/^([\\d]{1,3})(\\.[\\d]*)?%$/))) {\n v = parseFloat(v);\n if (v >= 0 && v <= 100) {\n this.set(k, v);\n return true;\n }\n }\n return false;\n }\n};\n// Helper function to parse input into groups separated by 'groupDelim', and\n// interprete each group as a key/value pair separated by 'keyValueDelim'.\nfunction parseOptions(input, callback, keyValueDelim, groupDelim) {\n var groups = groupDelim ? input.split(groupDelim) : [input];\n for (var i in groups) {\n if (typeof groups[i] !== 'string') {\n continue;\n }\n var kv = groups[i].split(keyValueDelim);\n if (kv.length !== 2) {\n continue;\n }\n var k = kv[0];\n var v = kv[1];\n callback(k, v);\n }\n}\nvar defaults = new vttcue_1.default(0, 0, 0);\n// 'middle' was changed to 'center' in the spec: https://github.com/w3c/webvtt/pull/244\n// Safari doesn't yet support this change, but FF and Chrome do.\nvar center = defaults.align === 'middle' ? 'middle' : 'center';\nfunction parseCue(input, cue, regionList) {\n // Remember the original input if we need to throw an error.\n var oInput = input;\n // 4.1 WebVTT timestamp\n function consumeTimeStamp() {\n var ts = parseTimeStamp(input);\n if (ts === null) {\n throw new Error('Malformed timestamp: ' + oInput);\n }\n // Remove time stamp from input.\n input = input.replace(/^[^\\sa-zA-Z-]+/, '');\n return ts;\n }\n // 4.4.2 WebVTT cue settings\n function consumeCueSettings(input, cue) {\n var settings = new Settings();\n parseOptions(input, function (k, v) {\n switch (k) {\n case 'region':\n // Find the last region we parsed with the same region id.\n for (var i = regionList.length - 1; i >= 0; i--) {\n if (regionList[i].id === v) {\n settings.set(k, regionList[i].region);\n break;\n }\n }\n break;\n case 'vertical':\n settings.alt(k, v, ['rl', 'lr']);\n break;\n case 'line':\n var vals = v.split(','), vals0 = vals[0];\n settings.integer(k, vals0);\n if (settings.percent(k, vals0)) {\n settings.set('snapToLines', false);\n }\n settings.alt(k, vals0, ['auto']);\n if (vals.length === 2) {\n settings.alt('lineAlign', vals[1], ['start', center, 'end']);\n }\n break;\n case 'position':\n vals = v.split(',');\n settings.percent(k, vals[0]);\n if (vals.length === 2) {\n settings.alt('positionAlign', vals[1], ['start', center, 'end', 'line-left', 'line-right', 'auto']);\n }\n break;\n case 'size':\n settings.percent(k, v);\n break;\n case 'align':\n settings.alt(k, v, ['start', center, 'end', 'left', 'right']);\n break;\n }\n }, /:/, /\\s/);\n // Apply default values for any missing fields.\n cue.region = settings.get('region', null);\n cue.vertical = settings.get('vertical', '');\n var line = settings.get('line', 'auto');\n if (line === 'auto' && defaults.line === -1) {\n // set numeric line number for Safari\n line = -1;\n }\n cue.line = line;\n cue.lineAlign = settings.get('lineAlign', 'start');\n cue.snapToLines = settings.get('snapToLines', true);\n cue.size = settings.get('size', 100);\n cue.align = settings.get('align', center);\n var position = settings.get('position', 'auto');\n if (position === 'auto' && defaults.position === 50) {\n // set numeric position for Safari\n position = cue.align === 'start' || cue.align === 'left' ? 0 : cue.align === 'end' || cue.align === 'right' ? 100 : 50;\n }\n cue.position = position;\n }\n function skipWhitespace() {\n input = input.replace(/^\\s+/, '');\n }\n // 4.1 WebVTT cue timings.\n skipWhitespace();\n cue.startTime = consumeTimeStamp(); // (1) collect cue start time\n skipWhitespace();\n if (input.substr(0, 3) !== '-->') { // (3) next characters must match '-->'\n throw new Error('Malformed time stamp (time stamps must be separated by \\'-->\\'): ' +\n oInput);\n }\n input = input.substr(3);\n skipWhitespace();\n cue.endTime = consumeTimeStamp(); // (5) collect cue end time\n // 4.1 WebVTT cue settings list.\n skipWhitespace();\n consumeCueSettings(input, cue);\n}\nfunction fixLineBreaks(input) {\n return input.replace(//gi, '\\n');\n}\nexports.fixLineBreaks = fixLineBreaks;\nVTTParser.prototype = {\n parse: function (data) {\n var self = this;\n // If there is no data then we won't decode it, but will just try to parse\n // whatever is in buffer already. This may occur in circumstances, for\n // example when flush() is called.\n if (data) {\n // Try to decode the data that we received.\n self.buffer += self.decoder.decode(data, { stream: true });\n }\n function collectNextLine() {\n var buffer = self.buffer;\n var pos = 0;\n buffer = fixLineBreaks(buffer);\n while (pos < buffer.length && buffer[pos] !== '\\r' && buffer[pos] !== '\\n') {\n ++pos;\n }\n var line = buffer.substr(0, pos);\n // Advance the buffer early in case we fail below.\n if (buffer[pos] === '\\r') {\n ++pos;\n }\n if (buffer[pos] === '\\n') {\n ++pos;\n }\n self.buffer = buffer.substr(pos);\n return line;\n }\n // 3.2 WebVTT metadata header syntax\n function parseHeader(input) {\n parseOptions(input, function (k, v) {\n switch (k) {\n case 'Region':\n // 3.3 WebVTT region metadata header syntax\n // console.log('parse region', v);\n // parseRegion(v);\n break;\n }\n }, /:/);\n }\n // 5.1 WebVTT file parsing.\n try {\n var line = void 0;\n if (self.state === 'INITIAL') {\n // We can't start parsing until we have the first line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n line = collectNextLine();\n // strip of UTF-8 BOM if any\n // https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8\n var m = line.match(/^()?WEBVTT([ \\t].*)?$/);\n if (!m || !m[0]) {\n throw new Error('Malformed WebVTT signature.');\n }\n self.state = 'HEADER';\n }\n var alreadyCollectedLine = false;\n while (self.buffer) {\n // We can't parse a line until we have the full line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n if (!alreadyCollectedLine) {\n line = collectNextLine();\n }\n else {\n alreadyCollectedLine = false;\n }\n switch (self.state) {\n case 'HEADER':\n // 13-18 - Allow a header (metadata) under the WEBVTT line.\n if (/:/.test(line)) {\n parseHeader(line);\n }\n else if (!line) {\n // An empty line terminates the header and starts the body (cues).\n self.state = 'ID';\n }\n continue;\n case 'NOTE':\n // Ignore NOTE blocks.\n if (!line) {\n self.state = 'ID';\n }\n continue;\n case 'ID':\n // Check for the start of NOTE blocks.\n if (/^NOTE($|[ \\t])/.test(line)) {\n self.state = 'NOTE';\n break;\n }\n // 19-29 - Allow any number of line terminators, then initialize new cue values.\n if (!line) {\n continue;\n }\n self.cue = new vttcue_1.default(0, 0, '');\n self.state = 'CUE';\n // 30-39 - Check if self line contains an optional identifier or timing data.\n if (line.indexOf('-->') === -1) {\n self.cue.id = line;\n continue;\n }\n // Process line as start of a cue.\n /* falls through */\n case 'CUE':\n // 40 - Collect cue timings and settings.\n try {\n parseCue(line, self.cue, self.regionList);\n }\n catch (e) {\n // In case of an error ignore rest of the cue.\n self.cue = null;\n self.state = 'BADCUE';\n continue;\n }\n self.state = 'CUETEXT';\n continue;\n case 'CUETEXT':\n var hasSubstring = line.indexOf('-->') !== -1;\n // 34 - If we have an empty line then report the cue.\n // 35 - If we have the special substring '-->' then report the cue,\n // but do not collect the line as we need to process the current\n // one as a new cue.\n if (!line || hasSubstring && (alreadyCollectedLine = true)) {\n // We are done parsing self cue.\n if (self.oncue) {\n self.oncue(self.cue);\n }\n self.cue = null;\n self.state = 'ID';\n continue;\n }\n if (self.cue.text) {\n self.cue.text += '\\n';\n }\n self.cue.text += line;\n continue;\n case 'BADCUE': // BADCUE\n // 54-62 - Collect and discard the remaining cue.\n if (!line) {\n self.state = 'ID';\n }\n continue;\n }\n }\n }\n catch (e) {\n // If we are currently parsing a cue, report what we have.\n if (self.state === 'CUETEXT' && self.cue && self.oncue) {\n self.oncue(self.cue);\n }\n self.cue = null;\n // Enter BADWEBVTT state if header was not parsed correctly otherwise\n // another exception occurred so enter BADCUE state.\n self.state = self.state === 'INITIAL' ? 'BADWEBVTT' : 'BADCUE';\n }\n return this;\n },\n flush: function () {\n var self = this;\n try {\n // Finish decoding the stream.\n self.buffer += self.decoder.decode();\n // Synthesize the end of the current cue or region.\n if (self.cue || self.state === 'HEADER') {\n self.buffer += '\\n\\n';\n self.parse();\n }\n // If we've flushed, parsed, and we're still on the INITIAL state then\n // that means we don't have enough of the stream to parse the first\n // line.\n if (self.state === 'INITIAL') {\n throw new Error('Malformed WebVTT signature.');\n }\n }\n catch (e) {\n throw e;\n }\n if (self.onflush) {\n self.onflush();\n }\n return this;\n }\n};\nexports.default = VTTParser;\n\n\n/***/ }),\n\n/***/ \"./src/utils/webvtt-parser.js\":\n/*!************************************!*\\\n !*** ./src/utils/webvtt-parser.js ***!\n \\************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Number) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar vttparser_1 = __webpack_require__(/*! ./vttparser */ \"./src/utils/vttparser.js\");\nvar id3_1 = __webpack_require__(/*! ../demux/id3 */ \"./src/demux/id3.js\");\n// String.prototype.startsWith is not supported in IE11\nvar startsWith = function (inputString, searchString, position) {\n return inputString.substr(position || 0, searchString.length) === searchString;\n};\nvar cueString2millis = function (timeString) {\n var ts = parseInt(timeString.substr(-3));\n var secs = parseInt(timeString.substr(-6, 2));\n var mins = parseInt(timeString.substr(-9, 2));\n var hours = timeString.length > 9 ? parseInt(timeString.substr(0, timeString.indexOf(':'))) : 0;\n if (!Number.isFinite(ts) || !Number.isFinite(secs) || !Number.isFinite(mins) || !Number.isFinite(hours)) {\n return -1;\n }\n ts += 1000 * secs;\n ts += 60 * 1000 * mins;\n ts += 60 * 60 * 1000 * hours;\n return ts;\n};\n// From https://github.com/darkskyapp/string-hash\nvar hash = function (text) {\n var hash = 5381;\n var i = text.length;\n while (i) {\n hash = (hash * 33) ^ text.charCodeAt(--i);\n }\n return (hash >>> 0).toString();\n};\nvar calculateOffset = function (vttCCs, cc, presentationTime) {\n var currCC = vttCCs[cc];\n var prevCC = vttCCs[currCC.prevCC];\n // This is the first discontinuity or cues have been processed since the last discontinuity\n // Offset = current discontinuity time\n if (!prevCC || (!prevCC.new && currCC.new)) {\n vttCCs.ccOffset = vttCCs.presentationOffset = currCC.start;\n currCC.new = false;\n return;\n }\n // There have been discontinuities since cues were last parsed.\n // Offset = time elapsed\n while (prevCC && prevCC.new) {\n vttCCs.ccOffset += currCC.start - prevCC.start;\n currCC.new = false;\n currCC = prevCC;\n prevCC = vttCCs[currCC.prevCC];\n }\n vttCCs.presentationOffset = presentationTime;\n};\nvar WebVTTParser = {\n parse: function (vttByteArray, syncPTS, vttCCs, cc, callBack, errorCallBack) {\n // Convert byteArray into string, replacing any somewhat exotic linefeeds with \"\\n\", then split on that character.\n var re = /\\r\\n|\\n\\r|\\n|\\r/g;\n // Uint8Array.prototype.reduce is not implemented in IE11\n var vttLines = id3_1.utf8ArrayToStr(new Uint8Array(vttByteArray)).trim().replace(re, '\\n').split('\\n');\n var cueTime = '00:00.000';\n var mpegTs = 0;\n var localTime = 0;\n var presentationTime = 0;\n var cues = [];\n var parsingError;\n var inHeader = true;\n // let VTTCue = VTTCue || window.TextTrackCue;\n // Create parser object using VTTCue with TextTrackCue fallback on certain browsers.\n var parser = new vttparser_1.default();\n parser.oncue = function (cue) {\n // Adjust cue timing; clamp cues to start no earlier than - and drop cues that don't end after - 0 on timeline.\n var currCC = vttCCs[cc];\n var cueOffset = vttCCs.ccOffset;\n // Update offsets for new discontinuities\n if (currCC && currCC.new) {\n if (localTime !== undefined) {\n // When local time is provided, offset = discontinuity start time - local time\n cueOffset = vttCCs.ccOffset = currCC.start;\n }\n else {\n calculateOffset(vttCCs, cc, presentationTime);\n }\n }\n if (presentationTime) {\n // If we have MPEGTS, offset = presentation time + discontinuity offset\n cueOffset = presentationTime - vttCCs.presentationOffset;\n }\n cue.startTime += cueOffset - localTime;\n cue.endTime += cueOffset - localTime;\n // Create a unique hash id for a cue based on start/end times and text.\n // This helps timeline-controller to avoid showing repeated captions.\n cue.id = hash(cue.startTime.toString()) + hash(cue.endTime.toString()) + hash(cue.text);\n // Fix encoding of special characters. TODO: Test with all sorts of weird characters.\n cue.text = decodeURIComponent(encodeURIComponent(cue.text));\n if (cue.endTime > 0) {\n cues.push(cue);\n }\n };\n parser.onparsingerror = function (e) {\n parsingError = e;\n };\n parser.onflush = function () {\n if (parsingError && errorCallBack) {\n errorCallBack(parsingError);\n return;\n }\n callBack(cues);\n };\n // Go through contents line by line.\n vttLines.forEach(function (line) {\n if (inHeader) {\n // Look for X-TIMESTAMP-MAP in header.\n if (startsWith(line, 'X-TIMESTAMP-MAP=')) {\n // Once found, no more are allowed anyway, so stop searching.\n inHeader = false;\n // Extract LOCAL and MPEGTS.\n line.substr(16).split(',').forEach(function (timestamp) {\n if (startsWith(timestamp, 'LOCAL:')) {\n cueTime = timestamp.substr(6);\n }\n else if (startsWith(timestamp, 'MPEGTS:')) {\n mpegTs = parseInt(timestamp.substr(7));\n }\n });\n try {\n // Calculate subtitle offset in milliseconds.\n if (syncPTS + ((vttCCs[cc].start * 90000) || 0) < 0) {\n syncPTS += 8589934592;\n }\n // Adjust MPEGTS by sync PTS.\n mpegTs -= syncPTS;\n // Convert cue time to seconds\n localTime = cueString2millis(cueTime) / 1000;\n // Convert MPEGTS to seconds from 90kHz.\n presentationTime = mpegTs / 90000;\n if (localTime === -1) {\n parsingError = new Error(\"Malformed X-TIMESTAMP-MAP: \" + line);\n }\n }\n catch (e) {\n parsingError = new Error(\"Malformed X-TIMESTAMP-MAP: \" + line);\n }\n // Return without parsing X-TIMESTAMP-MAP line.\n return;\n }\n else if (line === '') {\n inHeader = false;\n }\n }\n // Parse line by default.\n parser.parse(line + '\\n');\n });\n parser.flush();\n }\n};\nexports.default = WebVTTParser;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./src/polyfills/number */ \"./src/polyfills/number.js\")[\"Number\"]))\n\n/***/ }),\n\n/***/ \"./src/utils/xhr-loader.js\":\n/*!*********************************!*\\\n !*** ./src/utils/xhr-loader.js ***!\n \\*********************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/**\n * XHR based logger\n*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar logger_1 = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\nvar performance = window.performance, XMLHttpRequest = window.XMLHttpRequest;\nvar XhrLoader = /** @class */ (function () {\n function XhrLoader(config) {\n if (config && config.xhrSetup) {\n this.xhrSetup = config.xhrSetup;\n }\n }\n XhrLoader.prototype.destroy = function () {\n this.abort();\n this.loader = null;\n };\n XhrLoader.prototype.abort = function () {\n var loader = this.loader;\n if (loader && loader.readyState !== 4) {\n this.stats.aborted = true;\n loader.abort();\n }\n window.clearTimeout(this.requestTimeout);\n this.requestTimeout = null;\n window.clearTimeout(this.retryTimeout);\n this.retryTimeout = null;\n };\n XhrLoader.prototype.load = function (context, config, callbacks) {\n this.context = context;\n this.config = config;\n this.callbacks = callbacks;\n this.stats = { trequest: performance.now(), retry: 0 };\n this.retryDelay = config.retryDelay;\n this.loadInternal();\n };\n XhrLoader.prototype.loadInternal = function () {\n var xhr, context = this.context;\n xhr = this.loader = new XMLHttpRequest();\n var stats = this.stats;\n stats.tfirst = 0;\n stats.loaded = 0;\n var xhrSetup = this.xhrSetup;\n try {\n if (xhrSetup) {\n try {\n xhrSetup(xhr, context.url);\n }\n catch (e) {\n // fix xhrSetup: (xhr, url) => {xhr.setRequestHeader(\"Content-Language\", \"test\");}\n // not working, as xhr.setRequestHeader expects xhr.readyState === OPEN\n xhr.open('GET', context.url, true);\n xhrSetup(xhr, context.url);\n }\n }\n if (!xhr.readyState) {\n xhr.open('GET', context.url, true);\n }\n }\n catch (e) {\n // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS\n this.callbacks.onError({ code: xhr.status, text: e.message }, context, xhr);\n return;\n }\n if (context.rangeEnd) {\n xhr.setRequestHeader('Range', 'bytes=' + context.rangeStart + '-' + (context.rangeEnd - 1));\n }\n xhr.onreadystatechange = this.readystatechange.bind(this);\n xhr.onprogress = this.loadprogress.bind(this);\n xhr.responseType = context.responseType;\n // setup timeout before we perform request\n this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), this.config.timeout);\n xhr.send();\n };\n XhrLoader.prototype.readystatechange = function (event) {\n var xhr = event.currentTarget, readyState = xhr.readyState, stats = this.stats, context = this.context, config = this.config;\n // don't proceed if xhr has been aborted\n if (stats.aborted) {\n return;\n }\n // >= HEADERS_RECEIVED\n if (readyState >= 2) {\n // clear xhr timeout and rearm it if readyState less than 4\n window.clearTimeout(this.requestTimeout);\n if (stats.tfirst === 0) {\n stats.tfirst = Math.max(performance.now(), stats.trequest);\n }\n if (readyState === 4) {\n var status_1 = xhr.status;\n // http status between 200 to 299 are all successful\n if (status_1 >= 200 && status_1 < 300) {\n stats.tload = Math.max(stats.tfirst, performance.now());\n var data = void 0, len = void 0;\n if (context.responseType === 'arraybuffer') {\n data = xhr.response;\n len = data.byteLength;\n }\n else {\n data = xhr.responseText;\n len = data.length;\n }\n stats.loaded = stats.total = len;\n var response = { url: xhr.responseURL, data: data };\n this.callbacks.onSuccess(response, stats, context, xhr);\n }\n else {\n // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error\n if (stats.retry >= config.maxRetry || (status_1 >= 400 && status_1 < 499)) {\n logger_1.logger.error(status_1 + \" while loading \" + context.url);\n this.callbacks.onError({ code: status_1, text: xhr.statusText }, context, xhr);\n }\n else {\n // retry\n logger_1.logger.warn(status_1 + \" while loading \" + context.url + \", retrying in \" + this.retryDelay + \"...\");\n // aborts and resets internal state\n this.destroy();\n // schedule retry\n this.retryTimeout = window.setTimeout(this.loadInternal.bind(this), this.retryDelay);\n // set exponential backoff\n this.retryDelay = Math.min(2 * this.retryDelay, config.maxRetryDelay);\n stats.retry++;\n }\n }\n }\n else {\n // readyState >= 2 AND readyState !==4 (readyState = HEADERS_RECEIVED || LOADING) rearm timeout as xhr not finished yet\n this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), config.timeout);\n }\n }\n };\n XhrLoader.prototype.loadtimeout = function () {\n logger_1.logger.warn(\"timeout while loading \" + this.context.url);\n this.callbacks.onTimeout(this.stats, this.context, null);\n };\n XhrLoader.prototype.loadprogress = function (event) {\n var xhr = event.currentTarget, stats = this.stats;\n stats.loaded = event.loaded;\n if (event.lengthComputable) {\n stats.total = event.total;\n }\n var onProgress = this.callbacks.onProgress;\n if (onProgress) {\n // third arg is to provide on progress data\n onProgress(stats, this.context, null, xhr);\n }\n };\n return XhrLoader;\n}());\nexports.default = XhrLoader;\n\n\n/***/ })\n\n/******/ })[\"default\"];\n});\n//# sourceMappingURL=hls.js.map\n\n/***/ }),\n\n/***/ \"./node_modules/node-libs-browser/node_modules/process/browser.js\":\n/*!************************************************************************!*\\\n !*** ./node_modules/node-libs-browser/node_modules/process/browser.js ***!\n \\************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n/***/ }),\n\n/***/ \"./node_modules/style-loader/lib/addStyles.js\":\n/*!****************************************************!*\\\n !*** ./node_modules/style-loader/lib/addStyles.js ***!\n \\****************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n\nvar stylesInDom = {};\n\nvar\tmemoize = function (fn) {\n\tvar memo;\n\n\treturn function () {\n\t\tif (typeof memo === \"undefined\") memo = fn.apply(this, arguments);\n\t\treturn memo;\n\t};\n};\n\nvar isOldIE = memoize(function () {\n\t// Test for IE <= 9 as proposed by Browserhacks\n\t// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n\t// Tests for existence of standard globals is to allow style-loader\n\t// to operate correctly into non-standard environments\n\t// @see https://github.com/webpack-contrib/style-loader/issues/177\n\treturn window && document && document.all && !window.atob;\n});\n\nvar getTarget = function (target) {\n return document.querySelector(target);\n};\n\nvar getElement = (function (fn) {\n\tvar memo = {};\n\n\treturn function(target) {\n // If passing function in options, then use it for resolve \"head\" element.\n // Useful for Shadow Root style i.e\n // {\n // insertInto: function () { return document.querySelector(\"#foo\").shadowRoot }\n // }\n if (typeof target === 'function') {\n return target();\n }\n if (typeof memo[target] === \"undefined\") {\n\t\t\tvar styleTarget = getTarget.call(this, target);\n\t\t\t// Special case to return head of iframe instead of iframe itself\n\t\t\tif (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n\t\t\t\ttry {\n\t\t\t\t\t// This will throw an exception if access to iframe is blocked\n\t\t\t\t\t// due to cross-origin restrictions\n\t\t\t\t\tstyleTarget = styleTarget.contentDocument.head;\n\t\t\t\t} catch(e) {\n\t\t\t\t\tstyleTarget = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmemo[target] = styleTarget;\n\t\t}\n\t\treturn memo[target]\n\t};\n})();\n\nvar singleton = null;\nvar\tsingletonCounter = 0;\nvar\tstylesInsertedAtTop = [];\n\nvar\tfixUrls = __webpack_require__(/*! ./urls */ \"./node_modules/style-loader/lib/urls.js\");\n\nmodule.exports = function(list, options) {\n\tif (typeof DEBUG !== \"undefined\" && DEBUG) {\n\t\tif (typeof document !== \"object\") throw new Error(\"The style-loader cannot be used in a non-browser environment\");\n\t}\n\n\toptions = options || {};\n\n\toptions.attrs = typeof options.attrs === \"object\" ? options.attrs : {};\n\n\t// Force single-tag solution on IE6-9, which has a hard limit on the # of ').html((0, _template2.default)(style.toString())(options));\n }\n};\n\nexports.default = Styler;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/base/svg_icons.js\":\n/*!*******************************!*\\\n !*** ./src/base/svg_icons.js ***!\n \\*******************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.volumeMute = exports.volume = exports.stop = exports.reload = exports.play = exports.pause = exports.hd = exports.fullscreen = exports.exitFullscreen = exports.cc = undefined;\n\nvar _play = __webpack_require__(/*! ../icons/01-play.svg */ \"./src/icons/01-play.svg\");\n\nvar _play2 = _interopRequireDefault(_play);\n\nvar _pause = __webpack_require__(/*! ../icons/02-pause.svg */ \"./src/icons/02-pause.svg\");\n\nvar _pause2 = _interopRequireDefault(_pause);\n\nvar _stop = __webpack_require__(/*! ../icons/03-stop.svg */ \"./src/icons/03-stop.svg\");\n\nvar _stop2 = _interopRequireDefault(_stop);\n\nvar _volume = __webpack_require__(/*! ../icons/04-volume.svg */ \"./src/icons/04-volume.svg\");\n\nvar _volume2 = _interopRequireDefault(_volume);\n\nvar _mute = __webpack_require__(/*! ../icons/05-mute.svg */ \"./src/icons/05-mute.svg\");\n\nvar _mute2 = _interopRequireDefault(_mute);\n\nvar _expand = __webpack_require__(/*! ../icons/06-expand.svg */ \"./src/icons/06-expand.svg\");\n\nvar _expand2 = _interopRequireDefault(_expand);\n\nvar _shrink = __webpack_require__(/*! ../icons/07-shrink.svg */ \"./src/icons/07-shrink.svg\");\n\nvar _shrink2 = _interopRequireDefault(_shrink);\n\nvar _hd = __webpack_require__(/*! ../icons/08-hd.svg */ \"./src/icons/08-hd.svg\");\n\nvar _hd2 = _interopRequireDefault(_hd);\n\nvar _cc = __webpack_require__(/*! ../icons/09-cc.svg */ \"./src/icons/09-cc.svg\");\n\nvar _cc2 = _interopRequireDefault(_cc);\n\nvar _reload = __webpack_require__(/*! ../icons/10-reload.svg */ \"./src/icons/10-reload.svg\");\n\nvar _reload2 = _interopRequireDefault(_reload);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar cc = exports.cc = _cc2.default;\nvar exitFullscreen = exports.exitFullscreen = _shrink2.default;\nvar fullscreen = exports.fullscreen = _expand2.default;\nvar hd = exports.hd = _hd2.default;\nvar pause = exports.pause = _pause2.default;\nvar play = exports.play = _play2.default;\nvar reload = exports.reload = _reload2.default;\nvar stop = exports.stop = _stop2.default;\nvar volume = exports.volume = _volume2.default;\nvar volumeMute = exports.volumeMute = _mute2.default;\n\nexports.default = {\n cc: _cc2.default,\n exitFullscreen: _shrink2.default,\n fullscreen: _expand2.default,\n hd: _hd2.default,\n pause: _pause2.default,\n play: _play2.default,\n reload: _reload2.default,\n stop: _stop2.default,\n volume: _volume2.default,\n volumeMute: _mute2.default\n};\n\n/***/ }),\n\n/***/ \"./src/base/template.js\":\n/*!******************************!*\\\n !*** ./src/base/template.js ***!\n \\******************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n/* eslint-disable no-var */\n// Simple JavaScript Templating\n// Paul Miller (http://paulmillr.com)\n// http://underscorejs.org\n// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\n// By default, Underscore uses ERB-style template delimiters, change the\n// following template settings to use alternative delimiters.\nvar settings = {\n evaluate: /<%([\\s\\S]+?)%>/g,\n interpolate: /<%=([\\s\\S]+?)%>/g,\n escape: /<%-([\\s\\S]+?)%>/g\n\n // When customizing `templateSettings`, if you don't want to define an\n // interpolation, evaluation or escaping regex, we need one that is\n // guaranteed not to match.\n};var noMatch = /(.)^/;\n\n// Certain characters need to be escaped so that they can be put into a\n// string literal.\nvar escapes = {\n '\\'': '\\'',\n '\\\\': '\\\\',\n '\\r': 'r',\n '\\n': 'n',\n '\\t': 't',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n};\n\nvar escaper = /\\\\|'|\\r|\\n|\\t|\\u2028|\\u2029/g;\n\n// List of HTML entities for escaping.\nvar htmlEntities = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n '\\'': '''\n};\n\nvar entityRe = new RegExp('[&<>\"\\']', 'g');\n\nvar escapeExpr = function escapeExpr(string) {\n if (string === null) return '';\n return ('' + string).replace(entityRe, function (match) {\n return htmlEntities[match];\n });\n};\n\nvar counter = 0;\n\n// JavaScript micro-templating, similar to John Resig's implementation.\n// Underscore templating handles arbitrary delimiters, preserves whitespace,\n// and correctly escapes quotes within interpolated code.\nvar tmpl = function tmpl(text, data) {\n var render;\n\n // Combine delimiters into one regular expression via alternation.\n var matcher = new RegExp([(settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source].join('|') + '|$', 'g');\n\n // Compile the template source, escaping string literals appropriately.\n var index = 0;\n var source = '__p+=\\'';\n text.replace(matcher, function (match, escape, interpolate, evaluate, offset) {\n source += text.slice(index, offset).replace(escaper, function (match) {\n return '\\\\' + escapes[match];\n });\n\n if (escape) source += '\\'+\\n((__t=(' + escape + '))==null?\\'\\':escapeExpr(__t))+\\n\\'';\n\n if (interpolate) source += '\\'+\\n((__t=(' + interpolate + '))==null?\\'\\':__t)+\\n\\'';\n\n if (evaluate) source += '\\';\\n' + evaluate + '\\n__p+=\\'';\n\n index = offset + match.length;\n return match;\n });\n source += '\\';\\n';\n\n // If a variable is not specified, place data values in local scope.\n if (!settings.variable) source = 'with(obj||{}){\\n' + source + '}\\n';\n\n source = 'var __t,__p=\\'\\',__j=Array.prototype.join,' + 'print=function(){__p+=__j.call(arguments,\\'\\');};\\n' + source + 'return __p;\\n//# sourceURL=/microtemplates/source[' + counter++ + ']';\n\n try {\n /*jshint -W054 */\n // TODO: find a way to avoid eval\n render = new Function(settings.variable || 'obj', 'escapeExpr', source);\n } catch (e) {\n e.source = source;\n throw e;\n }\n\n if (data) return render(data, escapeExpr);\n var template = function template(data) {\n return render.call(this, data, escapeExpr);\n };\n\n // Provide the compiled function source as a convenience for precompilation.\n template.source = 'function(' + (settings.variable || 'obj') + '){\\n' + source + '}';\n\n return template;\n};\ntmpl.settings = settings;\n\nexports.default = tmpl;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/base/ui_container_plugin.js\":\n/*!*****************************************!*\\\n !*** ./src/base/ui_container_plugin.js ***!\n \\*****************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _assign = __webpack_require__(/*! babel-runtime/core-js/object/assign */ \"./node_modules/babel-runtime/core-js/object/assign.js\");\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _utils = __webpack_require__(/*! ./utils */ \"./src/base/utils.js\");\n\nvar _ui_object = __webpack_require__(/*! ./ui_object */ \"./src/base/ui_object.js\");\n\nvar _ui_object2 = _interopRequireDefault(_ui_object);\n\nvar _error_mixin = __webpack_require__(/*! ./error_mixin */ \"./src/base/error_mixin.js\");\n\nvar _error_mixin2 = _interopRequireDefault(_error_mixin);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * The base class for an ui container plugin\n * @class UIContainerPlugin\n * @constructor\n * @extends UIObject\n * @module base\n */\nvar UIContainerPlugin = function (_UIObject) {\n (0, _inherits3.default)(UIContainerPlugin, _UIObject);\n (0, _createClass3.default)(UIContainerPlugin, [{\n key: 'playerError',\n get: function get() {\n return this.container.playerError;\n }\n }]);\n\n function UIContainerPlugin(container) {\n (0, _classCallCheck3.default)(this, UIContainerPlugin);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, container.options));\n\n _this.container = container;\n _this.enabled = true;\n _this.bindEvents();\n return _this;\n }\n\n UIContainerPlugin.prototype.enable = function enable() {\n if (!this.enabled) {\n this.bindEvents();\n this.$el.show();\n this.enabled = true;\n }\n };\n\n UIContainerPlugin.prototype.disable = function disable() {\n this.stopListening();\n this.$el.hide();\n this.enabled = false;\n };\n\n UIContainerPlugin.prototype.bindEvents = function bindEvents() {};\n\n return UIContainerPlugin;\n}(_ui_object2.default); // Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nexports.default = UIContainerPlugin;\n\n\n(0, _assign2.default)(UIContainerPlugin.prototype, _error_mixin2.default);\n\nUIContainerPlugin.extend = function (properties) {\n return (0, _utils.extend)(UIContainerPlugin, properties);\n};\n\nUIContainerPlugin.type = 'container';\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/base/ui_core_plugin.js\":\n/*!************************************!*\\\n !*** ./src/base/ui_core_plugin.js ***!\n \\************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _assign = __webpack_require__(/*! babel-runtime/core-js/object/assign */ \"./node_modules/babel-runtime/core-js/object/assign.js\");\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _utils = __webpack_require__(/*! ./utils */ \"./src/base/utils.js\");\n\nvar _ui_object = __webpack_require__(/*! ./ui_object */ \"./src/base/ui_object.js\");\n\nvar _ui_object2 = _interopRequireDefault(_ui_object);\n\nvar _error_mixin = __webpack_require__(/*! ./error_mixin */ \"./src/base/error_mixin.js\");\n\nvar _error_mixin2 = _interopRequireDefault(_error_mixin);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar UICorePlugin = function (_UIObject) {\n (0, _inherits3.default)(UICorePlugin, _UIObject);\n (0, _createClass3.default)(UICorePlugin, [{\n key: 'playerError',\n get: function get() {\n return this.core.playerError;\n }\n }]);\n\n function UICorePlugin(core) {\n (0, _classCallCheck3.default)(this, UICorePlugin);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, core.options));\n\n _this.core = core;\n _this.enabled = true;\n _this.bindEvents();\n _this.render();\n return _this;\n }\n\n UICorePlugin.prototype.bindEvents = function bindEvents() {};\n\n UICorePlugin.prototype.getExternalInterface = function getExternalInterface() {\n return {};\n };\n\n UICorePlugin.prototype.enable = function enable() {\n if (!this.enabled) {\n this.bindEvents();\n this.$el.show();\n this.enabled = true;\n }\n };\n\n UICorePlugin.prototype.disable = function disable() {\n this.stopListening();\n this.$el.hide();\n this.enabled = false;\n };\n\n UICorePlugin.prototype.render = function render() {\n return this;\n };\n\n return UICorePlugin;\n}(_ui_object2.default);\n\nexports.default = UICorePlugin;\n\n\n(0, _assign2.default)(UICorePlugin.prototype, _error_mixin2.default);\n\nUICorePlugin.extend = function (properties) {\n return (0, _utils.extend)(UICorePlugin, properties);\n};\n\nUICorePlugin.type = 'core';\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/base/ui_object.js\":\n/*!*******************************!*\\\n !*** ./src/base/ui_object.js ***!\n \\*******************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\nvar _utils = __webpack_require__(/*! ./utils */ \"./src/base/utils.js\");\n\nvar _base_object = __webpack_require__(/*! ./base_object */ \"./src/base/base_object.js\");\n\nvar _base_object2 = _interopRequireDefault(_base_object);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar delegateEventSplitter = /^(\\S+)\\s*(.*)$/;\n\n/**\n * A base class to create ui object.\n * @class UIObject\n * @constructor\n * @extends BaseObject\n * @module base\n */\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar UIObject = function (_BaseObject) {\n (0, _inherits3.default)(UIObject, _BaseObject);\n (0, _createClass3.default)(UIObject, [{\n key: 'tagName',\n\n /**\n * a unique id prefixed with `'c'`, `c1, c232`\n *\n * @property cid\n * @type String\n */\n /**\n * the dom element itself\n *\n * @property el\n * @type HTMLElement\n */\n /**\n * the dom element wrapped by `$`\n *\n * @property $el\n * @type HTMLElement\n */\n\n /**\n * gets the tag name for the ui component\n * @method tagName\n * @default div\n * @return {String} tag's name\n */\n get: function get() {\n return 'div';\n }\n /**\n * a literal object mapping element's events to methods\n * @property events\n * @type Object\n * @example\n *\n *```javascript\n *\n * class MyButton extends UIObject {\n * constructor(options) {\n * super(options)\n * this.myId = 0\n * }\n * get events() { return { 'click': 'myClick' } }\n * myClick(){ this.myId = 42 }\n * }\n *\n * // when you click on MyButton the method `myClick` will be called\n *```\n */\n\n }, {\n key: 'events',\n get: function get() {\n return {};\n }\n /**\n * a literal object mapping attributes and values to the element\n * element's attribute name and the value the attribute value\n * @property attributes\n * @type Object\n * @example\n *\n *```javascript\n *\n * class MyButton extends UIObject {\n * constructor(options) { super(options) }\n * get attributes() { return { class: 'my-button'} }\n * }\n *\n * // MyButton.el.className will be 'my-button'\n * ```\n */\n\n }, {\n key: 'attributes',\n get: function get() {\n return {};\n }\n\n /**\n * it builds an ui component by:\n * * creating an id for the component `cid`\n * * making sure the element is created `$el`\n * * delegating all `events` to the element\n * @method constructor\n * @param {Object} options the options object\n */\n\n }]);\n\n function UIObject(options) {\n (0, _classCallCheck3.default)(this, UIObject);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, options));\n\n _this.cid = (0, _utils.uniqueId)('c');\n _this._ensureElement();\n _this.delegateEvents();\n return _this;\n }\n\n /**\n * selects within the component.\n * @method $\n * @param {String} selector a selector to find within the component.\n * @return {HTMLElement} an element, if it exists.\n * @example\n * ```javascript\n * fullScreenBarUIComponent.$('.button-full') //will return only `.button-full` within the component\n * ```\n */\n\n\n UIObject.prototype.$ = function $(selector) {\n return this.$el.find(selector);\n };\n\n /**\n * render the component, usually attach it to a real existent `element`\n * @method render\n * @return {UIObject} itself\n */\n\n\n UIObject.prototype.render = function render() {\n return this;\n };\n\n /**\n * removes the ui component from DOM\n * @method destroy\n * @return {UIObject} itself\n */\n\n\n UIObject.prototype.destroy = function destroy() {\n this.$el.remove();\n this.stopListening();\n this.undelegateEvents();\n return this;\n };\n\n /**\n * set element to `el` and `$el`\n * @method setElement\n * @param {HTMLElement} element\n * @param {Boolean} delegate whether is delegate or not\n * @return {UIObject} itself\n */\n\n\n UIObject.prototype.setElement = function setElement(element, delegate) {\n if (this.$el) this.undelegateEvents();\n this.$el = _clapprZepto2.default.zepto.isZ(element) ? element : (0, _clapprZepto2.default)(element);\n this.el = this.$el[0];\n if (delegate !== false) this.delegateEvents();\n return this;\n };\n\n /**\n * delegates all the original `events` on `element` to its callbacks\n * @method delegateEvents\n * @param {Object} events\n * @return {UIObject} itself\n */\n\n\n UIObject.prototype.delegateEvents = function delegateEvents(events) {\n if (!(events || (events = this.events))) return this;\n this.undelegateEvents();\n for (var key in events) {\n var method = events[key];\n if (method && method.constructor !== Function) method = this[events[key]];\n if (!method) continue;\n\n var match = key.match(delegateEventSplitter);\n var eventName = match[1],\n selector = match[2];\n eventName += '.delegateEvents' + this.cid;\n if (selector === '') this.$el.on(eventName, method.bind(this));else this.$el.on(eventName, selector, method.bind(this));\n }\n return this;\n };\n\n /**\n * undelegats all the `events`\n * @method undelegateEvents\n * @return {UIObject} itself\n */\n\n\n UIObject.prototype.undelegateEvents = function undelegateEvents() {\n this.$el.off('.delegateEvents' + this.cid);\n return this;\n };\n\n /**\n * ensures the creation of this ui component\n * @method _ensureElement\n * @private\n */\n\n\n UIObject.prototype._ensureElement = function _ensureElement() {\n if (!this.el) {\n var attrs = _clapprZepto2.default.extend({}, this.attributes);\n if (this.id) attrs.id = this.id;\n if (this.className) attrs['class'] = this.className;\n var $el = _utils.DomRecycler.create(this.tagName).attr(attrs);\n this.setElement($el, false);\n } else {\n this.setElement(this.el, false);\n }\n };\n\n return UIObject;\n}(_base_object2.default);\n\nexports.default = UIObject;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/base/utils.js\":\n/*!***************************!*\\\n !*** ./src/base/utils.js ***!\n \\***************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.SvgIcons = exports.DoubleEventHandler = exports.DomRecycler = exports.cancelAnimationFrame = exports.requestAnimationFrame = exports.QueryString = exports.Config = exports.Fullscreen = undefined;\n\nvar _assign = __webpack_require__(/*! babel-runtime/core-js/object/assign */ \"./node_modules/babel-runtime/core-js/object/assign.js\");\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _defineProperty = __webpack_require__(/*! babel-runtime/core-js/object/define-property */ \"./node_modules/babel-runtime/core-js/object/define-property.js\");\n\nvar _defineProperty2 = _interopRequireDefault(_defineProperty);\n\nvar _getOwnPropertyDescriptor = __webpack_require__(/*! babel-runtime/core-js/object/get-own-property-descriptor */ \"./node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js\");\n\nvar _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);\n\nexports.assign = assign;\nexports.extend = extend;\nexports.formatTime = formatTime;\nexports.seekStringToSeconds = seekStringToSeconds;\nexports.uniqueId = uniqueId;\nexports.isNumber = isNumber;\nexports.currentScriptUrl = currentScriptUrl;\nexports.getBrowserLanguage = getBrowserLanguage;\nexports.now = now;\nexports.removeArrayItem = removeArrayItem;\nexports.listContainsIgnoreCase = listContainsIgnoreCase;\nexports.canAutoPlayMedia = canAutoPlayMedia;\n\n__webpack_require__(/*! ./polyfills */ \"./src/base/polyfills.js\");\n\nvar _browser = __webpack_require__(/*! ../components/browser */ \"./src/components/browser/index.js\");\n\nvar _browser2 = _interopRequireDefault(_browser);\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\nvar _media = __webpack_require__(/*! ./media */ \"./src/base/media.js\");\n\nvar _media2 = _interopRequireDefault(_media);\n\nvar _svg_icons = __webpack_require__(/*! ./svg_icons */ \"./src/base/svg_icons.js\");\n\nvar _svg_icons2 = _interopRequireDefault(_svg_icons);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction assign(obj, source) {\n if (source) {\n for (var prop in source) {\n var propDescriptor = (0, _getOwnPropertyDescriptor2.default)(source, prop);\n propDescriptor ? (0, _defineProperty2.default)(obj, prop, propDescriptor) : obj[prop] = source[prop];\n }\n }\n return obj;\n} // Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n/*jshint -W079 */\n\nfunction extend(parent, properties) {\n var Surrogate = function (_parent) {\n (0, _inherits3.default)(Surrogate, _parent);\n\n function Surrogate() {\n (0, _classCallCheck3.default)(this, Surrogate);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _parent.call.apply(_parent, [this].concat(args)));\n\n if (properties.initialize) properties.initialize.apply(_this, args);\n\n return _this;\n }\n\n return Surrogate;\n }(parent);\n\n assign(Surrogate.prototype, properties);\n return Surrogate;\n}\n\nfunction formatTime(time, paddedHours) {\n if (!isFinite(time)) return '--:--';\n\n time = time * 1000;\n time = parseInt(time / 1000);\n var seconds = time % 60;\n time = parseInt(time / 60);\n var minutes = time % 60;\n time = parseInt(time / 60);\n var hours = time % 24;\n var days = parseInt(time / 24);\n var out = '';\n if (days && days > 0) {\n out += days + ':';\n if (hours < 1) out += '00:';\n }\n if (hours && hours > 0 || paddedHours) out += ('0' + hours).slice(-2) + ':';\n out += ('0' + minutes).slice(-2) + ':';\n out += ('0' + seconds).slice(-2);\n return out.trim();\n}\n\nvar Fullscreen = exports.Fullscreen = {\n fullscreenElement: function fullscreenElement() {\n return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement;\n },\n requestFullscreen: function requestFullscreen(el) {\n if (el.requestFullscreen) el.requestFullscreen();else if (el.webkitRequestFullscreen) el.webkitRequestFullscreen();else if (el.mozRequestFullScreen) el.mozRequestFullScreen();else if (el.msRequestFullscreen) el.msRequestFullscreen();else if (el.querySelector && el.querySelector('video') && el.querySelector('video').webkitEnterFullScreen) el.querySelector('video').webkitEnterFullScreen();else if (el.webkitEnterFullScreen) el.webkitEnterFullScreen();\n },\n cancelFullscreen: function cancelFullscreen() {\n var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;\n\n if (el.exitFullscreen) el.exitFullscreen();else if (el.webkitCancelFullScreen) el.webkitCancelFullScreen();else if (el.webkitExitFullscreen) el.webkitExitFullscreen();else if (el.mozCancelFullScreen) el.mozCancelFullScreen();else if (el.msExitFullscreen) el.msExitFullscreen();\n },\n fullscreenEnabled: function fullscreenEnabled() {\n return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);\n }\n};\n\nvar Config = exports.Config = function () {\n function Config() {\n (0, _classCallCheck3.default)(this, Config);\n }\n\n Config._defaultConfig = function _defaultConfig() {\n return {\n volume: {\n value: 100,\n parse: parseInt\n }\n };\n };\n\n Config._defaultValueFor = function _defaultValueFor(key) {\n try {\n return this._defaultConfig()[key].parse(this._defaultConfig()[key].value);\n } catch (e) {\n return undefined;\n }\n };\n\n Config._createKeyspace = function _createKeyspace(key) {\n return 'clappr.' + document.domain + '.' + key;\n };\n\n Config.restore = function restore(key) {\n if (_browser2.default.hasLocalstorage && localStorage[this._createKeyspace(key)]) return this._defaultConfig()[key].parse(localStorage[this._createKeyspace(key)]);\n\n return this._defaultValueFor(key);\n };\n\n Config.persist = function persist(key, value) {\n if (_browser2.default.hasLocalstorage) {\n try {\n localStorage[this._createKeyspace(key)] = value;\n return true;\n } catch (e) {\n return false;\n }\n }\n };\n\n return Config;\n}();\n\nvar QueryString = exports.QueryString = function () {\n function QueryString() {\n (0, _classCallCheck3.default)(this, QueryString);\n }\n\n QueryString.parse = function parse(paramsString) {\n var match = void 0;\n var pl = /\\+/g,\n // Regex for replacing addition symbol with a space\n search = /([^&=]+)=?([^&]*)/g,\n decode = function decode(s) {\n return decodeURIComponent(s.replace(pl, ' '));\n },\n params = {};\n while (match = search.exec(paramsString)) {\n // eslint-disable-line no-cond-assign\n params[decode(match[1]).toLowerCase()] = decode(match[2]);\n }\n return params;\n };\n\n (0, _createClass3.default)(QueryString, null, [{\n key: 'params',\n get: function get() {\n var query = window.location.search.substring(1);\n if (query !== this.query) {\n this._urlParams = this.parse(query);\n this.query = query;\n }\n return this._urlParams;\n }\n }, {\n key: 'hashParams',\n get: function get() {\n var hash = window.location.hash.substring(1);\n if (hash !== this.hash) {\n this._hashParams = this.parse(hash);\n this.hash = hash;\n }\n return this._hashParams;\n }\n }]);\n return QueryString;\n}();\n\nfunction seekStringToSeconds() {\n var paramName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 't';\n\n var seconds = 0;\n var seekString = QueryString.params[paramName] || QueryString.hashParams[paramName] || '';\n var parts = seekString.match(/[0-9]+[hms]+/g) || [];\n if (parts.length > 0) {\n var factor = { 'h': 3600, 'm': 60, 's': 1 };\n parts.forEach(function (el) {\n if (el) {\n var suffix = el[el.length - 1];\n var time = parseInt(el.slice(0, el.length - 1), 10);\n seconds += time * factor[suffix];\n }\n });\n } else if (seekString) {\n seconds = parseInt(seekString, 10);\n }\n\n return seconds;\n}\n\nvar idsCounter = {};\n\nfunction uniqueId(prefix) {\n idsCounter[prefix] || (idsCounter[prefix] = 0);\n var id = ++idsCounter[prefix];\n return prefix + id;\n}\n\nfunction isNumber(value) {\n return value - parseFloat(value) + 1 >= 0;\n}\n\nfunction currentScriptUrl() {\n var scripts = document.getElementsByTagName('script');\n return scripts.length ? scripts[scripts.length - 1].src : '';\n}\n\nvar requestAnimationFrame = exports.requestAnimationFrame = (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {\n window.setTimeout(fn, 1000 / 60);\n}).bind(window);\n\nvar cancelAnimationFrame = exports.cancelAnimationFrame = (window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.clearTimeout).bind(window);\n\nfunction getBrowserLanguage() {\n return window.navigator && window.navigator.language;\n}\n\nfunction now() {\n if (window.performance && window.performance.now) return performance.now();\n\n return Date.now();\n}\n\n// remove the item from the array if it exists in the array\nfunction removeArrayItem(arr, item) {\n var i = arr.indexOf(item);\n if (i >= 0) arr.splice(i, 1);\n}\n\n// find an item regardless of its letter case\nfunction listContainsIgnoreCase(item, items) {\n if (item === undefined || items === undefined) return false;\n return items.find(function (itemEach) {\n return item.toLowerCase() === itemEach.toLowerCase();\n }) !== undefined;\n}\n\n// https://github.com/video-dev/can-autoplay\nfunction canAutoPlayMedia(cb, options) {\n options = (0, _assign2.default)({\n inline: false,\n muted: false,\n timeout: 250,\n type: 'video',\n source: _media2.default.mp4,\n element: null\n }, options);\n\n var element = options.element ? options.element : document.createElement(options.type);\n\n element.muted = options.muted;\n if (options.muted === true) element.setAttribute('muted', 'muted');\n\n if (options.inline === true) element.setAttribute('playsinline', 'playsinline');\n\n element.src = options.source;\n\n var promise = element.play();\n\n var timeoutId = setTimeout(function () {\n setResult(false, new Error('Timeout ' + options.timeout + ' ms has been reached'));\n }, options.timeout);\n\n var setResult = function setResult(result) {\n var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n clearTimeout(timeoutId);\n cb(result, error);\n };\n\n if (promise !== undefined) {\n promise.then(function () {\n return setResult(true);\n }).catch(function (err) {\n return setResult(false, err);\n });\n } else {\n setResult(true);\n }\n}\n\n// Simple Zepto element factory with video recycle feature.\nvar videoStack = [];\n\nvar DomRecycler = exports.DomRecycler = function () {\n function DomRecycler() {\n (0, _classCallCheck3.default)(this, DomRecycler);\n }\n\n DomRecycler.configure = function configure(options) {\n this.options = _clapprZepto2.default.extend(this.options, options);\n };\n\n DomRecycler.create = function create(name) {\n if (this.options.recycleVideo && name === 'video' && videoStack.length > 0) return videoStack.shift();\n\n return (0, _clapprZepto2.default)('<' + name + '>');\n };\n\n DomRecycler.garbage = function garbage($el) {\n // Expect Zepto collection with single element (does not iterate!)\n if (!this.options.recycleVideo || $el[0].tagName.toUpperCase() !== 'VIDEO') return;\n $el.children().remove();\n videoStack.push($el);\n };\n\n return DomRecycler;\n}();\n\nDomRecycler.options = { recycleVideo: false };\n\nvar DoubleEventHandler = exports.DoubleEventHandler = function () {\n function DoubleEventHandler() {\n var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;\n (0, _classCallCheck3.default)(this, DoubleEventHandler);\n\n this.delay = delay;\n this.lastTime = 0;\n }\n\n DoubleEventHandler.prototype.handle = function handle(event, cb) {\n var prevented = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n // Based on http://jsfiddle.net/brettwp/J4djY/\n var currentTime = new Date().getTime();\n var diffTime = currentTime - this.lastTime;\n\n if (diffTime < this.delay && diffTime > 0) {\n cb();\n prevented && event.preventDefault();\n }\n\n this.lastTime = currentTime;\n };\n\n return DoubleEventHandler;\n}();\n\nvar SvgIcons = exports.SvgIcons = _svg_icons2.default;\n\nexports.default = {\n Config: Config,\n Fullscreen: Fullscreen,\n QueryString: QueryString,\n DomRecycler: DomRecycler,\n extend: extend,\n formatTime: formatTime,\n seekStringToSeconds: seekStringToSeconds,\n uniqueId: uniqueId,\n currentScriptUrl: currentScriptUrl,\n isNumber: isNumber,\n requestAnimationFrame: requestAnimationFrame,\n cancelAnimationFrame: cancelAnimationFrame,\n getBrowserLanguage: getBrowserLanguage,\n now: now,\n removeArrayItem: removeArrayItem,\n canAutoPlayMedia: canAutoPlayMedia,\n Media: _media2.default,\n DoubleEventHandler: DoubleEventHandler,\n SvgIcons: _svg_icons2.default\n};\n\n/***/ }),\n\n/***/ \"./src/components/browser/browser.js\":\n/*!*******************************************!*\\\n !*** ./src/components/browser/browser.js ***!\n \\*******************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getDevice = exports.getViewportSize = exports.getOsData = exports.getBrowserData = exports.getBrowserInfo = undefined;\n\nvar _getIterator2 = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ \"./node_modules/babel-runtime/core-js/get-iterator.js\");\n\nvar _getIterator3 = _interopRequireDefault(_getIterator2);\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\nvar _browser_data = __webpack_require__(/*! ./browser_data */ \"./src/components/browser/browser_data.js\");\n\nvar _browser_data2 = _interopRequireDefault(_browser_data);\n\nvar _os_data = __webpack_require__(/*! ./os_data */ \"./src/components/browser/os_data.js\");\n\nvar _os_data2 = _interopRequireDefault(_os_data);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Browser = {};\n\nvar hasLocalstorage = function hasLocalstorage() {\n try {\n localStorage.setItem('clappr', 'clappr');\n localStorage.removeItem('clappr');\n return true;\n } catch (e) {\n return false;\n }\n};\n\nvar hasFlash = function hasFlash() {\n try {\n var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');\n return !!fo;\n } catch (e) {\n return !!(navigator.mimeTypes && navigator.mimeTypes['application/x-shockwave-flash'] !== undefined && navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin);\n }\n};\n\nvar getBrowserInfo = exports.getBrowserInfo = function getBrowserInfo(ua) {\n var parts = ua.match(/\\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [],\n extra = void 0;\n if (/trident/i.test(parts[1])) {\n extra = /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return {\n name: 'IE',\n version: parseInt(extra[1] || '')\n };\n } else if (parts[1] === 'Chrome') {\n extra = ua.match(/\\bOPR\\/(\\d+)/);\n if (extra != null) return { name: 'Opera', version: parseInt(extra[1]) };\n\n extra = ua.match(/\\bEdge\\/(\\d+)/);\n if (extra != null) return { name: 'Edge', version: parseInt(extra[1]) };\n } else if (/android/i.test(ua) && (extra = ua.match(/version\\/(\\d+)/i))) {\n parts.splice(1, 1, 'Android WebView');\n parts.splice(2, 1, extra[1]);\n }\n parts = parts[2] ? [parts[1], parts[2]] : [navigator.appName, navigator.appVersion, '-?'];\n\n return {\n name: parts[0],\n version: parseInt(parts[1])\n };\n};\n\n// Get browser data\nvar getBrowserData = exports.getBrowserData = function getBrowserData() {\n var browserObject = {};\n var userAgent = Browser.userAgent.toLowerCase();\n\n // Check browser type\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = (0, _getIterator3.default)(_browser_data2.default), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var browser = _step.value;\n\n var browserRegExp = new RegExp(browser.identifier.toLowerCase());\n var browserRegExpResult = browserRegExp.exec(userAgent);\n\n if (browserRegExpResult != null && browserRegExpResult[1]) {\n browserObject.name = browser.name;\n browserObject.group = browser.group;\n\n // Check version\n if (browser.versionIdentifier) {\n var versionRegExp = new RegExp(browser.versionIdentifier.toLowerCase());\n var versionRegExpResult = versionRegExp.exec(userAgent);\n\n if (versionRegExpResult != null && versionRegExpResult[1]) setBrowserVersion(versionRegExpResult[1], browserObject);\n } else {\n setBrowserVersion(browserRegExpResult[1], browserObject);\n }\n break;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return browserObject;\n};\n\n// Set browser version\nvar setBrowserVersion = function setBrowserVersion(version, browserObject) {\n var splitVersion = version.split('.', 2);\n browserObject.fullVersion = version;\n\n // Major version\n if (splitVersion[0]) browserObject.majorVersion = parseInt(splitVersion[0]);\n\n // Minor version\n if (splitVersion[1]) browserObject.minorVersion = parseInt(splitVersion[1]);\n};\n\n// Get OS data\nvar getOsData = exports.getOsData = function getOsData() {\n var osObject = {};\n var userAgent = Browser.userAgent.toLowerCase();\n\n // Check browser type\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = (0, _getIterator3.default)(_os_data2.default), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var os = _step2.value;\n\n var osRegExp = new RegExp(os.identifier.toLowerCase());\n var osRegExpResult = osRegExp.exec(userAgent);\n\n if (osRegExpResult != null) {\n osObject.name = os.name;\n osObject.group = os.group;\n\n // Version defined\n if (os.version) {\n setOsVersion(os.version, os.versionSeparator ? os.versionSeparator : '.', osObject);\n\n // Version detected\n } else if (osRegExpResult[1]) {\n setOsVersion(osRegExpResult[1], os.versionSeparator ? os.versionSeparator : '.', osObject);\n\n // Version identifier\n } else if (os.versionIdentifier) {\n var versionRegExp = new RegExp(os.versionIdentifier.toLowerCase());\n var versionRegExpResult = versionRegExp.exec(userAgent);\n\n if (versionRegExpResult != null && versionRegExpResult[1]) setOsVersion(versionRegExpResult[1], os.versionSeparator ? os.versionSeparator : '.', osObject);\n }\n break;\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n return osObject;\n};\n\n// Set OS version\nvar setOsVersion = function setOsVersion(version, separator, osObject) {\n var finalSeparator = separator.substr(0, 1) == '[' ? new RegExp(separator, 'g') : separator;\n var splitVersion = version.split(finalSeparator, 2);\n\n if (separator != '.') version = version.replace(new RegExp(separator, 'g'), '.');\n\n osObject.fullVersion = version;\n\n // Major version\n if (splitVersion && splitVersion[0]) osObject.majorVersion = parseInt(splitVersion[0]);\n\n // Minor version\n if (splitVersion && splitVersion[1]) osObject.minorVersion = parseInt(splitVersion[1]);\n};\n\n// Set viewport size\nvar getViewportSize = exports.getViewportSize = function getViewportSize() {\n var viewportObject = {};\n\n viewportObject.width = (0, _clapprZepto2.default)(window).width();\n viewportObject.height = (0, _clapprZepto2.default)(window).height();\n\n return viewportObject;\n};\n\n// Set viewport orientation\nvar setViewportOrientation = function setViewportOrientation() {\n switch (window.orientation) {\n case -90:\n case 90:\n Browser.viewport.orientation = 'landscape';\n break;\n default:\n Browser.viewport.orientation = 'portrait';\n break;\n }\n};\n\nvar getDevice = exports.getDevice = function getDevice(ua) {\n var platformRegExp = /\\((iP(?:hone|ad|od))?(?:[^;]*; ){0,2}([^)]+(?=\\)))/;\n var matches = platformRegExp.exec(ua);\n var device = matches && (matches[1] || matches[2]) || '';\n return device;\n};\n\nvar browserInfo = getBrowserInfo(navigator.userAgent);\n\nBrowser.isEdge = /edge/i.test(navigator.userAgent);\nBrowser.isChrome = /chrome|CriOS/i.test(navigator.userAgent) && !Browser.isEdge;\nBrowser.isSafari = /safari/i.test(navigator.userAgent) && !Browser.isChrome && !Browser.isEdge;\nBrowser.isFirefox = /firefox/i.test(navigator.userAgent);\nBrowser.isLegacyIE = !!window.ActiveXObject;\nBrowser.isIE = Browser.isLegacyIE || /trident.*rv:1\\d/i.test(navigator.userAgent);\nBrowser.isIE11 = /trident.*rv:11/i.test(navigator.userAgent);\nBrowser.isChromecast = Browser.isChrome && /CrKey/i.test(navigator.userAgent);\nBrowser.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Mobile Safari|Opera Mini/i.test(navigator.userAgent);\nBrowser.isiOS = /iPad|iPhone|iPod/i.test(navigator.userAgent);\nBrowser.isAndroid = /Android/i.test(navigator.userAgent);\nBrowser.isWindowsPhone = /Windows Phone/i.test(navigator.userAgent);\nBrowser.isWin8App = /MSAppHost/i.test(navigator.userAgent);\nBrowser.isWiiU = /WiiU/i.test(navigator.userAgent);\nBrowser.isPS4 = /PlayStation 4/i.test(navigator.userAgent);\nBrowser.hasLocalstorage = hasLocalstorage();\nBrowser.hasFlash = hasFlash();\n\n/**\n* @deprecated\n* This parameter currently exists for retrocompatibility reasons.\n* Use Browser.data.name instead.\n*/\nBrowser.name = browserInfo.name;\n\n/**\n* @deprecated\n* This parameter currently exists for retrocompatibility reasons.\n* Use Browser.data.fullVersion instead.\n*/\nBrowser.version = browserInfo.version;\n\nBrowser.userAgent = navigator.userAgent;\nBrowser.data = getBrowserData();\nBrowser.os = getOsData();\nBrowser.viewport = getViewportSize();\nBrowser.device = getDevice(Browser.userAgent);\ntypeof window.orientation !== 'undefined' && setViewportOrientation();\n\nexports.default = Browser;\n\n/***/ }),\n\n/***/ \"./src/components/browser/browser_data.js\":\n/*!************************************************!*\\\n !*** ./src/components/browser/browser_data.js ***!\n \\************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n/* eslint-disable no-useless-escape */\n// The order of the following arrays is important, be careful if you change it.\n\nvar BROWSER_DATA = [{\n name: 'Chromium',\n group: 'Chrome',\n identifier: 'Chromium/([0-9\\.]*)'\n}, {\n name: 'Chrome Mobile',\n group: 'Chrome',\n identifier: 'Chrome/([0-9\\.]*) Mobile',\n versionIdentifier: 'Chrome/([0-9\\.]*)'\n}, {\n name: 'Chrome',\n group: 'Chrome',\n identifier: 'Chrome/([0-9\\.]*)'\n}, {\n name: 'Chrome for iOS',\n group: 'Chrome',\n identifier: 'CriOS/([0-9\\.]*)'\n}, {\n name: 'Android Browser',\n group: 'Chrome',\n identifier: 'CrMo/([0-9\\.]*)'\n}, {\n name: 'Firefox',\n group: 'Firefox',\n identifier: 'Firefox/([0-9\\.]*)'\n}, {\n name: 'Opera Mini',\n group: 'Opera',\n identifier: 'Opera Mini/([0-9\\.]*)'\n}, {\n name: 'Opera',\n group: 'Opera',\n identifier: 'Opera ([0-9\\.]*)'\n}, {\n name: 'Opera',\n group: 'Opera',\n identifier: 'Opera/([0-9\\.]*)',\n versionIdentifier: 'Version/([0-9\\.]*)'\n}, {\n name: 'IEMobile',\n group: 'Explorer',\n identifier: 'IEMobile/([0-9\\.]*)'\n}, {\n name: 'Internet Explorer',\n group: 'Explorer',\n identifier: 'MSIE ([a-zA-Z0-9\\.]*)'\n}, {\n name: 'Internet Explorer',\n group: 'Explorer',\n identifier: 'Trident/([0-9\\.]*)',\n versionIdentifier: 'rv:([0-9\\.]*)'\n}, {\n name: 'Spartan',\n group: 'Spartan',\n identifier: 'Edge/([0-9\\.]*)',\n versionIdentifier: 'Edge/([0-9\\.]*)'\n}, {\n name: 'Safari',\n group: 'Safari',\n identifier: 'Safari/([0-9\\.]*)',\n versionIdentifier: 'Version/([0-9\\.]*)'\n}];\n\nexports.default = BROWSER_DATA;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/browser/index.js\":\n/*!*****************************************!*\\\n !*** ./src/components/browser/index.js ***!\n \\*****************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _browser = __webpack_require__(/*! ./browser */ \"./src/components/browser/browser.js\");\n\nvar _browser2 = _interopRequireDefault(_browser);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _browser2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/browser/os_data.js\":\n/*!*******************************************!*\\\n !*** ./src/components/browser/os_data.js ***!\n \\*******************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n/* eslint-disable no-useless-escape */\n// The order of the following arrays is important, be careful if you change it.\n\nvar OS_DATA = [{\n name: 'Windows 2000',\n group: 'Windows',\n identifier: 'Windows NT 5.0',\n version: '5.0'\n}, {\n name: 'Windows XP',\n group: 'Windows',\n identifier: 'Windows NT 5.1',\n version: '5.1'\n}, {\n name: 'Windows Vista',\n group: 'Windows',\n identifier: 'Windows NT 6.0',\n version: '6.0'\n}, {\n name: 'Windows 7',\n group: 'Windows',\n identifier: 'Windows NT 6.1',\n version: '7.0'\n}, {\n name: 'Windows 8',\n group: 'Windows',\n identifier: 'Windows NT 6.2',\n version: '8.0'\n}, {\n name: 'Windows 8.1',\n group: 'Windows',\n identifier: 'Windows NT 6.3',\n version: '8.1'\n}, {\n name: 'Windows 10',\n group: 'Windows',\n identifier: 'Windows NT 10.0',\n version: '10.0'\n}, {\n name: 'Windows Phone',\n group: 'Windows Phone',\n identifier: 'Windows Phone ([0-9\\.]*)'\n}, {\n name: 'Windows Phone',\n group: 'Windows Phone',\n identifier: 'Windows Phone OS ([0-9\\.]*)'\n}, {\n name: 'Windows',\n group: 'Windows',\n identifier: 'Windows'\n}, {\n name: 'Chrome OS',\n group: 'Chrome OS',\n identifier: 'CrOS'\n}, {\n name: 'Android',\n group: 'Android',\n identifier: 'Android',\n versionIdentifier: 'Android ([a-zA-Z0-9\\.-]*)'\n}, {\n name: 'iPad',\n group: 'iOS',\n identifier: 'iPad',\n versionIdentifier: 'OS ([0-9_]*)',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'iPod',\n group: 'iOS',\n identifier: 'iPod',\n versionIdentifier: 'OS ([0-9_]*)',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'iPhone',\n group: 'iOS',\n identifier: 'iPhone OS',\n versionIdentifier: 'OS ([0-9_]*)',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X High Sierra',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])13([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Sierra',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])12([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X El Capitan',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])11([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Yosemite',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])10([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Mavericks',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])9([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Mountain Lion',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])8([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Lion',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])7([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Snow Leopard',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])6([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Leopard',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])5([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Tiger',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])4([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Panther',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])3([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Jaguar',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])2([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Puma',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])1([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Cheetah',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])0([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS',\n group: 'Mac OS',\n identifier: 'Mac OS'\n}, {\n name: 'Ubuntu',\n group: 'Linux',\n identifier: 'Ubuntu',\n versionIdentifier: 'Ubuntu/([0-9\\.]*)'\n}, {\n name: 'Debian',\n group: 'Linux',\n identifier: 'Debian'\n}, {\n name: 'Gentoo',\n group: 'Linux',\n identifier: 'Gentoo'\n}, {\n name: 'Linux',\n group: 'Linux',\n identifier: 'Linux'\n}, {\n name: 'BlackBerry',\n group: 'BlackBerry',\n identifier: 'BlackBerry'\n}];\n\nexports.default = OS_DATA;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/container/container.js\":\n/*!***********************************************!*\\\n !*** ./src/components/container/container.js ***!\n \\***********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _assign = __webpack_require__(/*! babel-runtime/core-js/object/assign */ \"./node_modules/babel-runtime/core-js/object/assign.js\");\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _events = __webpack_require__(/*! ../../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _ui_object = __webpack_require__(/*! ../../base/ui_object */ \"./src/base/ui_object.js\");\n\nvar _ui_object2 = _interopRequireDefault(_ui_object);\n\nvar _error_mixin = __webpack_require__(/*! ../../base/error_mixin */ \"./src/base/error_mixin.js\");\n\nvar _error_mixin2 = _interopRequireDefault(_error_mixin);\n\nvar _utils = __webpack_require__(/*! ../../base/utils */ \"./src/base/utils.js\");\n\n__webpack_require__(/*! ./public/style.scss */ \"./src/components/container/public/style.scss\");\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * An abstraction to represent a container for a given playback\n * TODO: describe its responsabilities\n * @class Container\n * @constructor\n * @extends UIObject\n * @module base\n */\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n/**\n * Container is responsible for the video rendering and state\n */\n\nvar Container = function (_UIObject) {\n (0, _inherits3.default)(Container, _UIObject);\n (0, _createClass3.default)(Container, [{\n key: 'name',\n\n /**\n * container's name\n * @method name\n * @default Container\n * @return {String} container's name\n */\n get: function get() {\n return 'Container';\n }\n }, {\n key: 'attributes',\n get: function get() {\n return { class: 'container', 'data-container': '' };\n }\n }, {\n key: 'events',\n get: function get() {\n return {\n 'click': 'clicked',\n 'dblclick': 'dblClicked',\n 'touchend': 'dblTap',\n 'contextmenu': 'onContextMenu',\n 'mouseenter': 'mouseEnter',\n 'mouseleave': 'mouseLeave'\n };\n }\n\n /**\n * Determine if the playback has ended.\n * @property ended\n * @type Boolean\n */\n\n }, {\n key: 'ended',\n get: function get() {\n return this.playback.ended;\n }\n\n /**\n * Determine if the playback is having to buffer in order for\n * playback to be smooth.\n * (i.e if a live stream is playing smoothly, this will be false)\n * @property buffering\n * @type Boolean\n */\n\n }, {\n key: 'buffering',\n get: function get() {\n return this.playback.buffering;\n }\n\n /**\n * The internationalization plugin.\n * @property i18n\n * @type {Strings}\n */\n\n }, {\n key: 'i18n',\n get: function get() {\n return this._i18n;\n }\n\n /**\n * checks if has closed caption tracks.\n * @property hasClosedCaptionsTracks\n * @type {Boolean}\n */\n\n }, {\n key: 'hasClosedCaptionsTracks',\n get: function get() {\n return this.playback.hasClosedCaptionsTracks;\n }\n\n /**\n * gets the available closed caption tracks.\n * @property closedCaptionsTracks\n * @type {Array} an array of objects with at least 'id' and 'name' properties\n */\n\n }, {\n key: 'closedCaptionsTracks',\n get: function get() {\n return this.playback.closedCaptionsTracks;\n }\n\n /**\n * gets the selected closed caption track index. (-1 is disabled)\n * @property closedCaptionsTrackId\n * @type {Number}\n */\n\n }, {\n key: 'closedCaptionsTrackId',\n get: function get() {\n return this.playback.closedCaptionsTrackId;\n }\n\n /**\n * sets the selected closed caption track index. (-1 is disabled)\n * @property closedCaptionsTrackId\n * @type {Number}\n */\n ,\n set: function set(trackId) {\n this.playback.closedCaptionsTrackId = trackId;\n }\n\n /**\n * it builds a container\n * @method constructor\n * @param {Object} options the options object\n * @param {Strings} i18n the internationalization component\n */\n\n }]);\n\n function Container(options, i18n, playerError) {\n (0, _classCallCheck3.default)(this, Container);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, options));\n\n _this._i18n = i18n;\n _this.currentTime = 0;\n _this.volume = 100;\n _this.playback = options.playback;\n _this.playerError = playerError;\n _this.settings = _clapprZepto2.default.extend({}, _this.playback.settings);\n _this.isReady = false;\n _this.mediaControlDisabled = false;\n _this.plugins = [_this.playback];\n _this.dblTapHandler = new _utils.DoubleEventHandler(500);\n _this.clickTimer = null;\n _this.clickDelay = 200; // FIXME: could be a player option\n _this.bindEvents();\n return _this;\n }\n\n /**\n * binds playback events to the methods of the container.\n * it listens to playback's events and triggers them as container events.\n *\n * | Playback |\n * |----------|\n * | progress |\n * | timeupdate |\n * | ready |\n * | buffering |\n * | bufferfull |\n * | settingsupdate |\n * | loadedmetadata |\n * | highdefinitionupdate |\n * | bitrate |\n * | playbackstate |\n * | dvr |\n * | mediacontrol_disable |\n * | mediacontrol_enable |\n * | ended |\n * | play |\n * | pause |\n * | error |\n *\n * ps: the events usually translate from PLABACK_x to CONTAINER_x, you can check all the events at `Event` class.\n *\n * @method bindEvents\n */\n\n\n Container.prototype.bindEvents = function bindEvents() {\n this.listenTo(this.playback, _events2.default.PLAYBACK_PROGRESS, this.onProgress);\n this.listenTo(this.playback, _events2.default.PLAYBACK_TIMEUPDATE, this.timeUpdated);\n this.listenTo(this.playback, _events2.default.PLAYBACK_READY, this.ready);\n this.listenTo(this.playback, _events2.default.PLAYBACK_BUFFERING, this.onBuffering);\n this.listenTo(this.playback, _events2.default.PLAYBACK_BUFFERFULL, this.bufferfull);\n this.listenTo(this.playback, _events2.default.PLAYBACK_SETTINGSUPDATE, this.settingsUpdate);\n this.listenTo(this.playback, _events2.default.PLAYBACK_LOADEDMETADATA, this.loadedMetadata);\n this.listenTo(this.playback, _events2.default.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);\n this.listenTo(this.playback, _events2.default.PLAYBACK_BITRATE, this.updateBitrate);\n this.listenTo(this.playback, _events2.default.PLAYBACK_PLAYBACKSTATE, this.playbackStateChanged);\n this.listenTo(this.playback, _events2.default.PLAYBACK_DVR, this.playbackDvrStateChanged);\n this.listenTo(this.playback, _events2.default.PLAYBACK_MEDIACONTROL_DISABLE, this.disableMediaControl);\n this.listenTo(this.playback, _events2.default.PLAYBACK_MEDIACONTROL_ENABLE, this.enableMediaControl);\n this.listenTo(this.playback, _events2.default.PLAYBACK_SEEKED, this.onSeeked);\n this.listenTo(this.playback, _events2.default.PLAYBACK_ENDED, this.onEnded);\n this.listenTo(this.playback, _events2.default.PLAYBACK_PLAY, this.playing);\n this.listenTo(this.playback, _events2.default.PLAYBACK_PAUSE, this.paused);\n this.listenTo(this.playback, _events2.default.PLAYBACK_STOP, this.stopped);\n this.listenTo(this.playback, _events2.default.PLAYBACK_ERROR, this.error);\n this.listenTo(this.playback, _events2.default.PLAYBACK_SUBTITLE_AVAILABLE, this.subtitleAvailable);\n this.listenTo(this.playback, _events2.default.PLAYBACK_SUBTITLE_CHANGED, this.subtitleChanged);\n };\n\n Container.prototype.subtitleAvailable = function subtitleAvailable() {\n this.trigger(_events2.default.CONTAINER_SUBTITLE_AVAILABLE);\n };\n\n Container.prototype.subtitleChanged = function subtitleChanged(track) {\n this.trigger(_events2.default.CONTAINER_SUBTITLE_CHANGED, track);\n };\n\n Container.prototype.playbackStateChanged = function playbackStateChanged(state) {\n this.trigger(_events2.default.CONTAINER_PLAYBACKSTATE, state);\n };\n\n Container.prototype.playbackDvrStateChanged = function playbackDvrStateChanged(dvrInUse) {\n this.settings = this.playback.settings;\n this.dvrInUse = dvrInUse;\n this.trigger(_events2.default.CONTAINER_PLAYBACKDVRSTATECHANGED, dvrInUse);\n };\n\n Container.prototype.updateBitrate = function updateBitrate(newBitrate) {\n this.trigger(_events2.default.CONTAINER_BITRATE, newBitrate);\n };\n\n Container.prototype.statsReport = function statsReport(metrics) {\n this.trigger(_events2.default.CONTAINER_STATS_REPORT, metrics);\n };\n\n Container.prototype.getPlaybackType = function getPlaybackType() {\n return this.playback.getPlaybackType();\n };\n\n /**\n * returns `true` if DVR is enable otherwise `false`.\n * @method isDvrEnabled\n * @return {Boolean}\n */\n\n\n Container.prototype.isDvrEnabled = function isDvrEnabled() {\n return !!this.playback.dvrEnabled;\n };\n\n /**\n * returns `true` if DVR is in use otherwise `false`.\n * @method isDvrInUse\n * @return {Boolean}\n */\n\n\n Container.prototype.isDvrInUse = function isDvrInUse() {\n return !!this.dvrInUse;\n };\n\n /**\n * destroys the container\n * @method destroy\n */\n\n\n Container.prototype.destroy = function destroy() {\n this.trigger(_events2.default.CONTAINER_DESTROYED, this, this.name);\n this.stopListening();\n this.plugins.forEach(function (plugin) {\n return plugin.destroy();\n });\n this.$el.remove();\n };\n\n Container.prototype.setStyle = function setStyle(style) {\n this.$el.css(style);\n };\n\n Container.prototype.animate = function animate(style, duration) {\n return this.$el.animate(style, duration).promise();\n };\n\n Container.prototype.ready = function ready() {\n this.isReady = true;\n this.trigger(_events2.default.CONTAINER_READY, this.name);\n };\n\n Container.prototype.isPlaying = function isPlaying() {\n return this.playback.isPlaying();\n };\n\n Container.prototype.getStartTimeOffset = function getStartTimeOffset() {\n return this.playback.getStartTimeOffset();\n };\n\n Container.prototype.getCurrentTime = function getCurrentTime() {\n return this.currentTime;\n };\n\n Container.prototype.getDuration = function getDuration() {\n return this.playback.getDuration();\n };\n\n Container.prototype.error = function error(_error) {\n if (!this.isReady) this.ready();\n\n this.trigger(_events2.default.CONTAINER_ERROR, _error, this.name);\n };\n\n Container.prototype.loadedMetadata = function loadedMetadata(metadata) {\n this.trigger(_events2.default.CONTAINER_LOADEDMETADATA, metadata);\n };\n\n Container.prototype.timeUpdated = function timeUpdated(timeProgress) {\n this.currentTime = timeProgress.current;\n this.trigger(_events2.default.CONTAINER_TIMEUPDATE, timeProgress, this.name);\n };\n\n Container.prototype.onProgress = function onProgress() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n this.trigger.apply(this, [_events2.default.CONTAINER_PROGRESS].concat(args, [this.name]));\n };\n\n Container.prototype.playing = function playing() {\n this.trigger(_events2.default.CONTAINER_PLAY, this.name);\n };\n\n Container.prototype.paused = function paused() {\n this.trigger(_events2.default.CONTAINER_PAUSE, this.name);\n };\n\n /**\n * plays the playback\n * @method play\n */\n\n\n Container.prototype.play = function play() {\n this.playback.play();\n };\n\n /**\n * stops the playback\n * @method stop\n */\n\n\n Container.prototype.stop = function stop() {\n this.playback.stop();\n this.currentTime = 0;\n };\n\n /**\n * pauses the playback\n * @method pause\n */\n\n\n Container.prototype.pause = function pause() {\n this.playback.pause();\n };\n\n Container.prototype.onEnded = function onEnded() {\n this.trigger(_events2.default.CONTAINER_ENDED, this, this.name);\n this.currentTime = 0;\n };\n\n Container.prototype.stopped = function stopped() {\n this.trigger(_events2.default.CONTAINER_STOP);\n };\n\n Container.prototype.clicked = function clicked() {\n var _this2 = this;\n\n if (!this.options.chromeless || this.options.allowUserInteraction) {\n // The event is delayed because it can be canceled by a double-click event\n // An example of use is to prevent playback from pausing when switching to full screen\n this.clickTimer = setTimeout(function () {\n _this2.clickTimer && _this2.trigger(_events2.default.CONTAINER_CLICK, _this2, _this2.name);\n }, this.clickDelay);\n }\n };\n\n Container.prototype.cancelClicked = function cancelClicked() {\n clearTimeout(this.clickTimer);\n this.clickTimer = null;\n };\n\n Container.prototype.dblClicked = function dblClicked() {\n if (!this.options.chromeless || this.options.allowUserInteraction) {\n this.cancelClicked();\n this.trigger(_events2.default.CONTAINER_DBLCLICK, this, this.name);\n }\n };\n\n Container.prototype.dblTap = function dblTap(evt) {\n var _this3 = this;\n\n if (!this.options.chromeless || this.options.allowUserInteraction) {\n this.dblTapHandler.handle(evt, function () {\n _this3.cancelClicked();\n _this3.trigger(_events2.default.CONTAINER_DBLCLICK, _this3, _this3.name);\n });\n }\n };\n\n Container.prototype.onContextMenu = function onContextMenu(event) {\n if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(_events2.default.CONTAINER_CONTEXTMENU, event, this.name);\n };\n\n Container.prototype.seek = function seek(time) {\n this.trigger(_events2.default.CONTAINER_SEEK, time, this.name);\n this.playback.seek(time);\n };\n\n Container.prototype.onSeeked = function onSeeked() {\n this.trigger(_events2.default.CONTAINER_SEEKED, this.name);\n };\n\n Container.prototype.seekPercentage = function seekPercentage(percentage) {\n var duration = this.getDuration();\n if (percentage >= 0 && percentage <= 100) {\n var time = duration * (percentage / 100);\n this.seek(time);\n }\n };\n\n Container.prototype.setVolume = function setVolume(value) {\n this.volume = parseFloat(value);\n this.trigger(_events2.default.CONTAINER_VOLUME, this.volume, this.name);\n this.playback.volume(this.volume);\n };\n\n Container.prototype.fullscreen = function fullscreen() {\n this.trigger(_events2.default.CONTAINER_FULLSCREEN, this.name);\n };\n\n Container.prototype.onBuffering = function onBuffering() {\n this.trigger(_events2.default.CONTAINER_STATE_BUFFERING, this.name);\n };\n\n Container.prototype.bufferfull = function bufferfull() {\n this.trigger(_events2.default.CONTAINER_STATE_BUFFERFULL, this.name);\n };\n\n /**\n * adds plugin to the container\n * @method addPlugin\n * @param {Object} plugin\n */\n\n\n Container.prototype.addPlugin = function addPlugin(plugin) {\n this.plugins.push(plugin);\n };\n\n /**\n * checks if a plugin, given its name, exist\n * @method hasPlugin\n * @param {String} name\n * @return {Boolean}\n */\n\n\n Container.prototype.hasPlugin = function hasPlugin(name) {\n return !!this.getPlugin(name);\n };\n\n /**\n * get the plugin given its name\n * @method getPlugin\n * @param {String} name\n */\n\n\n Container.prototype.getPlugin = function getPlugin(name) {\n return this.plugins.filter(function (plugin) {\n return plugin.name === name;\n })[0];\n };\n\n Container.prototype.mouseEnter = function mouseEnter() {\n if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(_events2.default.CONTAINER_MOUSE_ENTER);\n };\n\n Container.prototype.mouseLeave = function mouseLeave() {\n if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(_events2.default.CONTAINER_MOUSE_LEAVE);\n };\n\n Container.prototype.settingsUpdate = function settingsUpdate() {\n this.settings = this.playback.settings;\n this.trigger(_events2.default.CONTAINER_SETTINGSUPDATE);\n };\n\n Container.prototype.highDefinitionUpdate = function highDefinitionUpdate(isHD) {\n this.trigger(_events2.default.CONTAINER_HIGHDEFINITIONUPDATE, isHD);\n };\n\n Container.prototype.isHighDefinitionInUse = function isHighDefinitionInUse() {\n return this.playback.isHighDefinitionInUse();\n };\n\n Container.prototype.disableMediaControl = function disableMediaControl() {\n if (!this.mediaControlDisabled) {\n this.mediaControlDisabled = true;\n this.trigger(_events2.default.CONTAINER_MEDIACONTROL_DISABLE);\n }\n };\n\n Container.prototype.enableMediaControl = function enableMediaControl() {\n if (this.mediaControlDisabled) {\n this.mediaControlDisabled = false;\n this.trigger(_events2.default.CONTAINER_MEDIACONTROL_ENABLE);\n }\n };\n\n Container.prototype.updateStyle = function updateStyle() {\n if (!this.options.chromeless || this.options.allowUserInteraction) this.$el.removeClass('chromeless');else this.$el.addClass('chromeless');\n };\n\n /**\n * enables to configure the container after its creation\n * @method configure\n * @param {Object} options all the options to change in form of a javascript object\n */\n\n\n Container.prototype.configure = function configure(options) {\n this._options = _clapprZepto2.default.extend(this._options, options);\n this.updateStyle();\n this.playback.configure(this.options);\n this.trigger(_events2.default.CONTAINER_OPTIONS_CHANGE);\n };\n\n Container.prototype.render = function render() {\n this.$el.append(this.playback.render().el);\n this.updateStyle();\n return this;\n };\n\n return Container;\n}(_ui_object2.default);\n\nexports.default = Container;\n\n\n(0, _assign2.default)(Container.prototype, _error_mixin2.default);\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/container/index.js\":\n/*!*******************************************!*\\\n !*** ./src/components/container/index.js ***!\n \\*******************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _container = __webpack_require__(/*! ./container */ \"./src/components/container/container.js\");\n\nvar _container2 = _interopRequireDefault(_container);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _container2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/container/public/style.scss\":\n/*!****************************************************!*\\\n !*** ./src/components/container/public/style.scss ***!\n \\****************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\nvar content = __webpack_require__(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./style.scss */ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/components/container/public/style.scss\");\n\nif(typeof content === 'string') content = [[module.i, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"singleton\":true,\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = __webpack_require__(/*! ../../../../node_modules/style-loader/lib/addStyles.js */ \"./node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(false) {}\n\n/***/ }),\n\n/***/ \"./src/components/container_factory/container_factory.js\":\n/*!***************************************************************!*\\\n !*** ./src/components/container_factory/container_factory.js ***!\n \\***************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof2 = __webpack_require__(/*! babel-runtime/helpers/typeof */ \"./node_modules/babel-runtime/helpers/typeof.js\");\n\nvar _typeof3 = _interopRequireDefault(_typeof2);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _base_object = __webpack_require__(/*! ../../base/base_object */ \"./src/base/base_object.js\");\n\nvar _base_object2 = _interopRequireDefault(_base_object);\n\nvar _events = __webpack_require__(/*! ../../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _container = __webpack_require__(/*! ../../components/container */ \"./src/components/container/index.js\");\n\nvar _container2 = _interopRequireDefault(_container);\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n/**\n * The ContainerFactory is responsible for manage playback bootstrap and create containers.\n */\n\nvar ContainerFactory = function (_BaseObject) {\n (0, _inherits3.default)(ContainerFactory, _BaseObject);\n (0, _createClass3.default)(ContainerFactory, [{\n key: 'options',\n get: function get() {\n return this._options;\n },\n set: function set(options) {\n this._options = options;\n }\n }]);\n\n function ContainerFactory(options, loader, i18n, playerError) {\n (0, _classCallCheck3.default)(this, ContainerFactory);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, options));\n\n _this._i18n = i18n;\n _this.loader = loader;\n _this.playerError = playerError;\n return _this;\n }\n\n ContainerFactory.prototype.createContainers = function createContainers() {\n var _this2 = this;\n\n return _clapprZepto2.default.Deferred(function (promise) {\n promise.resolve(_this2.options.sources.map(function (source) {\n return _this2.createContainer(source);\n }));\n });\n };\n\n ContainerFactory.prototype.findPlaybackPlugin = function findPlaybackPlugin(source, mimeType) {\n return this.loader.playbackPlugins.filter(function (p) {\n return p.canPlay(source, mimeType);\n })[0];\n };\n\n ContainerFactory.prototype.createContainer = function createContainer(source) {\n var resolvedSource = null,\n mimeType = this.options.mimeType;\n if ((typeof source === 'undefined' ? 'undefined' : (0, _typeof3.default)(source)) === 'object') {\n resolvedSource = source.source.toString();\n if (source.mimeType) mimeType = source.mimeType;\n } else {\n resolvedSource = source.toString();\n }\n\n if (resolvedSource.match(/^\\/\\//)) resolvedSource = window.location.protocol + resolvedSource;\n\n var options = _clapprZepto2.default.extend({}, this.options, {\n src: resolvedSource,\n mimeType: mimeType\n });\n var playbackPlugin = this.findPlaybackPlugin(resolvedSource, mimeType);\n var playback = new playbackPlugin(options, this._i18n, this.playerError);\n\n options = _clapprZepto2.default.extend({}, options, { playback: playback });\n\n var container = new _container2.default(options, this._i18n, this.playerError);\n var defer = _clapprZepto2.default.Deferred();\n defer.promise(container);\n this.addContainerPlugins(container);\n this.listenToOnce(container, _events2.default.CONTAINER_READY, function () {\n return defer.resolve(container);\n });\n return container;\n };\n\n ContainerFactory.prototype.addContainerPlugins = function addContainerPlugins(container) {\n this.loader.containerPlugins.forEach(function (Plugin) {\n container.addPlugin(new Plugin(container));\n });\n };\n\n return ContainerFactory;\n}(_base_object2.default);\n\nexports.default = ContainerFactory;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/container_factory/index.js\":\n/*!***************************************************!*\\\n !*** ./src/components/container_factory/index.js ***!\n \\***************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _container_factory = __webpack_require__(/*! ./container_factory */ \"./src/components/container_factory/container_factory.js\");\n\nvar _container_factory2 = _interopRequireDefault(_container_factory);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _container_factory2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/core/core.js\":\n/*!*************************************!*\\\n !*** ./src/components/core/core.js ***!\n \\*************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _assign = __webpack_require__(/*! babel-runtime/core-js/object/assign */ \"./node_modules/babel-runtime/core-js/object/assign.js\");\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _utils = __webpack_require__(/*! ../../base/utils */ \"./src/base/utils.js\");\n\nvar _styler = __webpack_require__(/*! ../../base/styler */ \"./src/base/styler.js\");\n\nvar _styler2 = _interopRequireDefault(_styler);\n\nvar _events = __webpack_require__(/*! ../../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _ui_object = __webpack_require__(/*! ../../base/ui_object */ \"./src/base/ui_object.js\");\n\nvar _ui_object2 = _interopRequireDefault(_ui_object);\n\nvar _ui_core_plugin = __webpack_require__(/*! ../../base/ui_core_plugin */ \"./src/base/ui_core_plugin.js\");\n\nvar _ui_core_plugin2 = _interopRequireDefault(_ui_core_plugin);\n\nvar _browser = __webpack_require__(/*! ../../components/browser */ \"./src/components/browser/index.js\");\n\nvar _browser2 = _interopRequireDefault(_browser);\n\nvar _container_factory = __webpack_require__(/*! ../../components/container_factory */ \"./src/components/container_factory/index.js\");\n\nvar _container_factory2 = _interopRequireDefault(_container_factory);\n\nvar _mediator = __webpack_require__(/*! ../../components/mediator */ \"./src/components/mediator.js\");\n\nvar _mediator2 = _interopRequireDefault(_mediator);\n\nvar _player_info = __webpack_require__(/*! ../../components/player_info */ \"./src/components/player_info.js\");\n\nvar _player_info2 = _interopRequireDefault(_player_info);\n\nvar _error = __webpack_require__(/*! ../../components/error */ \"./src/components/error/index.js\");\n\nvar _error2 = _interopRequireDefault(_error);\n\nvar _error_mixin = __webpack_require__(/*! ../../base/error_mixin */ \"./src/base/error_mixin.js\");\n\nvar _error_mixin2 = _interopRequireDefault(_error_mixin);\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\n__webpack_require__(/*! ./public/style.scss */ \"./src/components/core/public/style.scss\");\n\nvar _fonts = __webpack_require__(/*! ./public/fonts.css */ \"./src/components/core/public/fonts.css\");\n\nvar _fonts2 = _interopRequireDefault(_fonts);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar style = void 0;\n\n/**\n * The Core is responsible to manage Containers, the mediator, MediaControl\n * and the player state.\n * @class Core\n * @constructor\n * @extends UIObject\n * @module components\n */\n\nvar Core = function (_UIObject) {\n (0, _inherits3.default)(Core, _UIObject);\n (0, _createClass3.default)(Core, [{\n key: 'events',\n get: function get() {\n return {\n 'webkitfullscreenchange': 'handleFullscreenChange',\n 'mousemove': 'onMouseMove',\n 'mouseleave': 'onMouseLeave'\n };\n }\n }, {\n key: 'attributes',\n get: function get() {\n return {\n 'data-player': '',\n tabindex: 9999\n };\n }\n\n /**\n * checks if the core is ready.\n * @property isReady\n * @type {Boolean} `true` if the core is ready, otherwise `false`\n */\n\n }, {\n key: 'isReady',\n get: function get() {\n return !!this.ready;\n }\n\n /**\n * The internationalization plugin.\n * @property i18n\n * @type {Strings}\n */\n\n }, {\n key: 'i18n',\n get: function get() {\n return this.getPlugin('strings') || { t: function t(key) {\n return key;\n } };\n }\n\n /**\n * @deprecated\n * This property currently exists for retrocompatibility reasons.\n * If you want to access the media control instance, use the method getPlugin('media_control').\n */\n\n }, {\n key: 'mediaControl',\n get: function get() {\n return this.getPlugin('media_control') || this.dummyMediaControl;\n }\n }, {\n key: 'dummyMediaControl',\n get: function get() {\n if (this._dummyMediaControl) return this._dummyMediaControl;\n this._dummyMediaControl = new _ui_core_plugin2.default(this);\n return this._dummyMediaControl;\n }\n\n /**\n * gets the active container reference.\n * @property activeContainer\n * @type {Object}\n */\n\n }, {\n key: 'activeContainer',\n get: function get() {\n return this._activeContainer;\n }\n\n /**\n * sets the active container reference and trigger a event with the new reference.\n * @property activeContainer\n * @type {Object}\n */\n ,\n set: function set(container) {\n this._activeContainer = container;\n this.trigger(_events2.default.CORE_ACTIVE_CONTAINER_CHANGED, this._activeContainer);\n }\n\n /**\n * gets the active playback reference.\n * @property activePlayback\n * @type {Object}\n */\n\n }, {\n key: 'activePlayback',\n get: function get() {\n return this.activeContainer && this.activeContainer.playback;\n }\n }]);\n\n function Core(options) {\n (0, _classCallCheck3.default)(this, Core);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, options));\n\n _this.playerError = new _error2.default(options, _this);\n _this.configureDomRecycler();\n _this.playerInfo = _player_info2.default.getInstance(options.playerId);\n _this.firstResize = true;\n _this.plugins = [];\n _this.containers = [];\n //FIXME fullscreen api sucks\n _this._boundFullscreenHandler = function () {\n return _this.handleFullscreenChange();\n };\n (0, _clapprZepto2.default)(document).bind('fullscreenchange', _this._boundFullscreenHandler);\n (0, _clapprZepto2.default)(document).bind('MSFullscreenChange', _this._boundFullscreenHandler);\n (0, _clapprZepto2.default)(document).bind('mozfullscreenchange', _this._boundFullscreenHandler);\n _browser2.default.isMobile && (0, _clapprZepto2.default)(window).bind('resize', function (o) {\n _this.handleWindowResize(o);\n });\n return _this;\n }\n\n Core.prototype.configureDomRecycler = function configureDomRecycler() {\n var recycleVideo = this.options && this.options.playback && this.options.playback.recycleVideo;\n _utils.DomRecycler.configure({ recycleVideo: recycleVideo });\n };\n\n Core.prototype.createContainers = function createContainers(options) {\n this.defer = _clapprZepto2.default.Deferred();\n this.defer.promise(this);\n this.containerFactory = new _container_factory2.default(options, options.loader, this.i18n, this.playerError);\n this.prepareContainers();\n };\n\n Core.prototype.prepareContainers = function prepareContainers() {\n var _this2 = this;\n\n this.containerFactory.createContainers().then(function (containers) {\n return _this2.setupContainers(containers);\n }).then(function (containers) {\n return _this2.resolveOnContainersReady(containers);\n });\n };\n\n Core.prototype.updateSize = function updateSize() {\n this.isFullscreen() ? this.setFullscreen() : this.setPlayerSize();\n };\n\n Core.prototype.setFullscreen = function setFullscreen() {\n if (!_browser2.default.isiOS) {\n this.$el.addClass('fullscreen');\n this.$el.removeAttr('style');\n this.playerInfo.previousSize = { width: this.options.width, height: this.options.height };\n this.playerInfo.currentSize = { width: (0, _clapprZepto2.default)(window).width(), height: (0, _clapprZepto2.default)(window).height() };\n }\n };\n\n Core.prototype.setPlayerSize = function setPlayerSize() {\n this.$el.removeClass('fullscreen');\n this.playerInfo.currentSize = this.playerInfo.previousSize;\n this.playerInfo.previousSize = { width: (0, _clapprZepto2.default)(window).width(), height: (0, _clapprZepto2.default)(window).height() };\n this.resize(this.playerInfo.currentSize);\n };\n\n Core.prototype.resize = function resize(options) {\n if (!(0, _utils.isNumber)(options.height) && !(0, _utils.isNumber)(options.width)) {\n this.el.style.height = '' + options.height;\n this.el.style.width = '' + options.width;\n } else {\n this.el.style.height = options.height + 'px';\n this.el.style.width = options.width + 'px';\n }\n this.playerInfo.previousSize = { width: this.options.width, height: this.options.height };\n this.options.width = options.width;\n this.options.height = options.height;\n this.playerInfo.currentSize = options;\n this.triggerResize(this.playerInfo.currentSize);\n };\n\n Core.prototype.enableResizeObserver = function enableResizeObserver() {\n var _this3 = this;\n\n var checkSizeCallback = function checkSizeCallback() {\n _this3.triggerResize({ width: _this3.el.clientWidth, height: _this3.el.clientHeight });\n };\n this.resizeObserverInterval = setInterval(checkSizeCallback, 500);\n };\n\n Core.prototype.triggerResize = function triggerResize(newSize) {\n var thereWasChange = this.firstResize || this.oldHeight !== newSize.height || this.oldWidth !== newSize.width;\n if (thereWasChange) {\n this.oldHeight = newSize.height;\n this.oldWidth = newSize.width;\n this.playerInfo.computedSize = newSize;\n this.firstResize = false;\n _mediator2.default.trigger(this.options.playerId + ':' + _events2.default.PLAYER_RESIZE, newSize);\n this.trigger(_events2.default.CORE_RESIZE, newSize);\n }\n };\n\n Core.prototype.disableResizeObserver = function disableResizeObserver() {\n this.resizeObserverInterval && clearInterval(this.resizeObserverInterval);\n };\n\n Core.prototype.resolveOnContainersReady = function resolveOnContainersReady(containers) {\n var _this4 = this;\n\n _clapprZepto2.default.when.apply(_clapprZepto2.default, containers).done(function () {\n _this4.defer.resolve(_this4);\n _this4.ready = true;\n _this4.trigger(_events2.default.CORE_READY);\n });\n };\n\n Core.prototype.addPlugin = function addPlugin(plugin) {\n this.plugins.push(plugin);\n };\n\n Core.prototype.hasPlugin = function hasPlugin(name) {\n return !!this.getPlugin(name);\n };\n\n Core.prototype.getPlugin = function getPlugin(name) {\n return this.plugins.filter(function (plugin) {\n return plugin.name === name;\n })[0];\n };\n\n Core.prototype.load = function load(sources, mimeType) {\n this.options.mimeType = mimeType;\n sources = sources && sources.constructor === Array ? sources : [sources];\n this.options.sources = sources;\n this.containers.forEach(function (container) {\n return container.destroy();\n });\n this.containerFactory.options = _clapprZepto2.default.extend(this.options, { sources: sources });\n this.prepareContainers();\n };\n\n Core.prototype.destroy = function destroy() {\n this.disableResizeObserver();\n this.containers.forEach(function (container) {\n return container.destroy();\n });\n this.plugins.forEach(function (plugin) {\n return plugin.destroy();\n });\n this.$el.remove();\n (0, _clapprZepto2.default)(document).unbind('fullscreenchange', this._boundFullscreenHandler);\n (0, _clapprZepto2.default)(document).unbind('MSFullscreenChange', this._boundFullscreenHandler);\n (0, _clapprZepto2.default)(document).unbind('mozfullscreenchange', this._boundFullscreenHandler);\n this.stopListening();\n };\n\n Core.prototype.handleFullscreenChange = function handleFullscreenChange() {\n this.trigger(_events2.default.CORE_FULLSCREEN, this.isFullscreen());\n this.updateSize();\n };\n\n Core.prototype.handleWindowResize = function handleWindowResize(event) {\n var orientation = window.innerWidth > window.innerHeight ? 'landscape' : 'portrait';\n if (this._screenOrientation === orientation) return;\n this._screenOrientation = orientation;\n this.triggerResize({ width: this.el.clientWidth, height: this.el.clientHeight });\n this.trigger(_events2.default.CORE_SCREEN_ORIENTATION_CHANGED, {\n event: event,\n orientation: this._screenOrientation\n });\n };\n\n Core.prototype.removeContainer = function removeContainer(container) {\n this.stopListening(container);\n this.containers = this.containers.filter(function (c) {\n return c !== container;\n });\n };\n\n Core.prototype.setupContainer = function setupContainer(container) {\n this.listenTo(container, _events2.default.CONTAINER_DESTROYED, this.removeContainer);\n this.containers.push(container);\n };\n\n Core.prototype.setupContainers = function setupContainers(containers) {\n containers.forEach(this.setupContainer.bind(this));\n this.trigger(_events2.default.CORE_CONTAINERS_CREATED);\n this.renderContainers();\n this.activeContainer = containers[0];\n this.render();\n this.appendToParent();\n return this.containers;\n };\n\n Core.prototype.renderContainers = function renderContainers() {\n var _this5 = this;\n\n this.containers.forEach(function (container) {\n return _this5.el.appendChild(container.render().el);\n });\n };\n\n Core.prototype.createContainer = function createContainer(source, options) {\n var container = this.containerFactory.createContainer(source, options);\n this.setupContainer(container);\n this.el.appendChild(container.render().el);\n return container;\n };\n\n /**\n * @deprecated\n * This method currently exists for retrocompatibility reasons.\n * If you want the current container reference, use the activeContainer getter.\n */\n\n\n Core.prototype.getCurrentContainer = function getCurrentContainer() {\n return this.activeContainer;\n };\n\n /**\n * @deprecated\n * This method currently exists for retrocompatibility reasons.\n * If you want the current playback reference, use the activePlayback getter.\n */\n\n\n Core.prototype.getCurrentPlayback = function getCurrentPlayback() {\n return this.activePlayback;\n };\n\n Core.prototype.getPlaybackType = function getPlaybackType() {\n return this.activeContainer && this.activeContainer.getPlaybackType();\n };\n\n Core.prototype.isFullscreen = function isFullscreen() {\n // Ensure current instance is in fullscreen mode by checking fullscreen element\n var el = _browser2.default.isiOS ? this.activeContainer && this.activeContainer.el || this.el : this.el;\n return _utils.Fullscreen.fullscreenElement() === el;\n };\n\n Core.prototype.toggleFullscreen = function toggleFullscreen() {\n if (this.isFullscreen()) {\n _utils.Fullscreen.cancelFullscreen();\n !_browser2.default.isiOS && this.$el.removeClass('fullscreen nocursor');\n } else {\n _utils.Fullscreen.requestFullscreen(_browser2.default.isiOS ? this.activeContainer.el : this.el);\n !_browser2.default.isiOS && this.$el.addClass('fullscreen');\n }\n };\n\n Core.prototype.onMouseMove = function onMouseMove(event) {\n this.trigger(_events2.default.CORE_MOUSE_MOVE, event);\n };\n\n Core.prototype.onMouseLeave = function onMouseLeave(event) {\n this.trigger(_events2.default.CORE_MOUSE_LEAVE, event);\n };\n\n /**\n * enables to configure the container after its creation\n * @method configure\n * @param {Object} options all the options to change in form of a javascript object\n */\n\n\n Core.prototype.configure = function configure(options) {\n var _this6 = this;\n\n this._options = _clapprZepto2.default.extend(this._options, options);\n this.configureDomRecycler();\n\n var sources = options.source || options.sources;\n sources && this.load(sources, options.mimeType || this.options.mimeType);\n\n this.trigger(_events2.default.CORE_OPTIONS_CHANGE, options); // Trigger with newly provided options\n this.containers.forEach(function (container) {\n return container.configure(_this6.options);\n });\n };\n\n Core.prototype.appendToParent = function appendToParent() {\n var hasCoreParent = this.$el.parent() && this.$el.parent().length;\n !hasCoreParent && this.$el.appendTo(this.options.parentElement);\n };\n\n Core.prototype.render = function render() {\n if (!style) style = _styler2.default.getStyleFor(_fonts2.default, { baseUrl: this.options.baseUrl });\n\n (0, _clapprZepto2.default)('head').append(style);\n\n this.options.width = this.options.width || this.$el.width();\n this.options.height = this.options.height || this.$el.height();\n var size = { width: this.options.width, height: this.options.height };\n this.playerInfo.previousSize = this.playerInfo.currentSize = this.playerInfo.computedSize = size;\n this.updateSize();\n\n this.previousSize = { width: this.$el.width(), height: this.$el.height() };\n\n this.enableResizeObserver();\n\n return this;\n };\n\n return Core;\n}(_ui_object2.default);\n\nexports.default = Core;\n\n\n(0, _assign2.default)(Core.prototype, _error_mixin2.default);\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/core/index.js\":\n/*!**************************************!*\\\n !*** ./src/components/core/index.js ***!\n \\**************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _core = __webpack_require__(/*! ./core */ \"./src/components/core/core.js\");\n\nvar _core2 = _interopRequireDefault(_core);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _core2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/core/public/Roboto.ttf\":\n/*!***********************************************!*\\\n !*** ./src/components/core/public/Roboto.ttf ***!\n \\***********************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"<%=baseUrl%>/38861cba61c66739c1452c3a71e39852.ttf\";\n\n/***/ }),\n\n/***/ \"./src/components/core/public/fonts.css\":\n/*!**********************************************!*\\\n !*** ./src/components/core/public/fonts.css ***!\n \\**********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar escape = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/url/escape.js */ \"./node_modules/css-loader/lib/url/escape.js\");\nexports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \"@font-face {\\n font-family: \\\"Roboto\\\";\\n font-style: normal;\\n font-weight: 400;\\n src: local(\\\"Roboto\\\"), local(\\\"Roboto-Regular\\\"), url(\" + escape(__webpack_require__(/*! ./Roboto.ttf */ \"./src/components/core/public/Roboto.ttf\")) + \") format(\\\"truetype\\\");\\n}\\n\", \"\"]);\n\n// exports\n\n\n/***/ }),\n\n/***/ \"./src/components/core/public/style.scss\":\n/*!***********************************************!*\\\n !*** ./src/components/core/public/style.scss ***!\n \\***********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\nvar content = __webpack_require__(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./style.scss */ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/components/core/public/style.scss\");\n\nif(typeof content === 'string') content = [[module.i, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"singleton\":true,\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = __webpack_require__(/*! ../../../../node_modules/style-loader/lib/addStyles.js */ \"./node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(false) {}\n\n/***/ }),\n\n/***/ \"./src/components/core_factory/core_factory.js\":\n/*!*****************************************************!*\\\n !*** ./src/components/core_factory/core_factory.js ***!\n \\*****************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _base_object = __webpack_require__(/*! ../../base/base_object */ \"./src/base/base_object.js\");\n\nvar _base_object2 = _interopRequireDefault(_base_object);\n\nvar _core = __webpack_require__(/*! ../core */ \"./src/components/core/index.js\");\n\nvar _core2 = _interopRequireDefault(_core);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * The Core Factory is responsible for instantiate the core and it's plugins.\n * @class CoreFactory\n * @constructor\n * @extends BaseObject\n * @module components\n */\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar CoreFactory = function (_BaseObject) {\n (0, _inherits3.default)(CoreFactory, _BaseObject);\n (0, _createClass3.default)(CoreFactory, [{\n key: 'loader',\n get: function get() {\n return this.player.loader;\n }\n\n /**\n * it builds the core factory\n * @method constructor\n * @param {Player} player the player object\n */\n\n }]);\n\n function CoreFactory(player) {\n (0, _classCallCheck3.default)(this, CoreFactory);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this));\n\n _this.player = player;\n _this._options = player.options;\n return _this;\n }\n\n /**\n * creates a core and its plugins\n * @method create\n * @return {Core} created core\n */\n\n\n CoreFactory.prototype.create = function create() {\n this.options.loader = this.loader;\n this.core = new _core2.default(this.options);\n this.addCorePlugins();\n this.core.createContainers(this.options);\n return this.core;\n };\n\n /**\n * given the core plugins (`loader.corePlugins`) it builds each one\n * @method addCorePlugins\n * @return {Core} the core with all plugins\n */\n\n\n CoreFactory.prototype.addCorePlugins = function addCorePlugins() {\n var _this2 = this;\n\n this.loader.corePlugins.forEach(function (Plugin) {\n var plugin = new Plugin(_this2.core);\n _this2.core.addPlugin(plugin);\n _this2.setupExternalInterface(plugin);\n });\n return this.core;\n };\n\n CoreFactory.prototype.setupExternalInterface = function setupExternalInterface(plugin) {\n var externalFunctions = plugin.getExternalInterface();\n for (var key in externalFunctions) {\n this.player[key] = externalFunctions[key].bind(plugin);\n this.core[key] = externalFunctions[key].bind(plugin);\n }\n };\n\n return CoreFactory;\n}(_base_object2.default);\n\nexports.default = CoreFactory;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/core_factory/index.js\":\n/*!**********************************************!*\\\n !*** ./src/components/core_factory/index.js ***!\n \\**********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _core_factory = __webpack_require__(/*! ./core_factory */ \"./src/components/core_factory/core_factory.js\");\n\nvar _core_factory2 = _interopRequireDefault(_core_factory);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _core_factory2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/error/error.js\":\n/*!***************************************!*\\\n !*** ./src/components/error/error.js ***!\n \\***************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _events = __webpack_require__(/*! ../../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _base_object = __webpack_require__(/*! ../../base/base_object */ \"./src/base/base_object.js\");\n\nvar _base_object2 = _interopRequireDefault(_base_object);\n\nvar _log = __webpack_require__(/*! ../../plugins/log */ \"./src/plugins/log/index.js\");\n\nvar _log2 = _interopRequireDefault(_log);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * The PlayerError is responsible to receive and propagate errors.\n * @class PlayerError\n * @constructor\n * @extends BaseObject\n * @module components\n */\nvar PlayerError = function (_BaseObject) {\n (0, _inherits3.default)(PlayerError, _BaseObject);\n (0, _createClass3.default)(PlayerError, [{\n key: 'name',\n get: function get() {\n return 'error';\n }\n\n /**\n * @property Levels\n * @type {Object} object with error levels\n */\n\n }], [{\n key: 'Levels',\n get: function get() {\n return {\n FATAL: 'FATAL',\n WARN: 'WARN',\n INFO: 'INFO'\n };\n }\n }]);\n\n function PlayerError() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var core = arguments[1];\n (0, _classCallCheck3.default)(this, PlayerError);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, options));\n\n _this.core = core;\n return _this;\n }\n\n /**\n * creates and trigger an error.\n * @method createError\n * @param {Object} err should be an object with code, description, level, origin, scope and raw error.\n */\n\n\n PlayerError.prototype.createError = function createError(err) {\n if (!this.core) {\n _log2.default.warn(this.name, 'Core is not set. Error: ', err);\n return;\n }\n this.core.trigger(_events2.default.ERROR, err);\n };\n\n return PlayerError;\n}(_base_object2.default);\n\nexports.default = PlayerError;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/error/index.js\":\n/*!***************************************!*\\\n !*** ./src/components/error/index.js ***!\n \\***************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _error = __webpack_require__(/*! ./error */ \"./src/components/error/error.js\");\n\nvar _error2 = _interopRequireDefault(_error);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _error2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/loader/index.js\":\n/*!****************************************!*\\\n !*** ./src/components/loader/index.js ***!\n \\****************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _loader = __webpack_require__(/*! ./loader */ \"./src/components/loader/loader.js\");\n\nvar _loader2 = _interopRequireDefault(_loader);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _loader2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/loader/loader.js\":\n/*!*****************************************!*\\\n !*** ./src/components/loader/loader.js ***!\n \\*****************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _create = __webpack_require__(/*! babel-runtime/core-js/object/create */ \"./node_modules/babel-runtime/core-js/object/create.js\");\n\nvar _create2 = _interopRequireDefault(_create);\n\nvar _toConsumableArray2 = __webpack_require__(/*! babel-runtime/helpers/toConsumableArray */ \"./node_modules/babel-runtime/helpers/toConsumableArray.js\");\n\nvar _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _base_object = __webpack_require__(/*! ../../base/base_object */ \"./src/base/base_object.js\");\n\nvar _base_object2 = _interopRequireDefault(_base_object);\n\nvar _player_info = __webpack_require__(/*! ../player_info */ \"./src/components/player_info.js\");\n\nvar _player_info2 = _interopRequireDefault(_player_info);\n\nvar _html5_video = __webpack_require__(/*! ../../playbacks/html5_video */ \"./src/playbacks/html5_video/index.js\");\n\nvar _html5_video2 = _interopRequireDefault(_html5_video);\n\nvar _flash = __webpack_require__(/*! ../../playbacks/flash */ \"./src/playbacks/flash/index.js\");\n\nvar _flash2 = _interopRequireDefault(_flash);\n\nvar _html5_audio = __webpack_require__(/*! ../../playbacks/html5_audio */ \"./src/playbacks/html5_audio/index.js\");\n\nvar _html5_audio2 = _interopRequireDefault(_html5_audio);\n\nvar _flashls = __webpack_require__(/*! ../../playbacks/flashls */ \"./src/playbacks/flashls/index.js\");\n\nvar _flashls2 = _interopRequireDefault(_flashls);\n\nvar _hls = __webpack_require__(/*! ../../playbacks/hls */ \"./src/playbacks/hls/index.js\");\n\nvar _hls2 = _interopRequireDefault(_hls);\n\nvar _html_img = __webpack_require__(/*! ../../playbacks/html_img */ \"./src/playbacks/html_img/index.js\");\n\nvar _html_img2 = _interopRequireDefault(_html_img);\n\nvar _no_op = __webpack_require__(/*! ../../playbacks/no_op */ \"./src/playbacks/no_op/index.js\");\n\nvar _no_op2 = _interopRequireDefault(_no_op);\n\nvar _spinner_three_bounce = __webpack_require__(/*! ../../plugins/spinner_three_bounce */ \"./src/plugins/spinner_three_bounce/index.js\");\n\nvar _spinner_three_bounce2 = _interopRequireDefault(_spinner_three_bounce);\n\nvar _stats = __webpack_require__(/*! ../../plugins/stats */ \"./src/plugins/stats/index.js\");\n\nvar _stats2 = _interopRequireDefault(_stats);\n\nvar _watermark = __webpack_require__(/*! ../../plugins/watermark */ \"./src/plugins/watermark/index.js\");\n\nvar _watermark2 = _interopRequireDefault(_watermark);\n\nvar _poster = __webpack_require__(/*! ../../plugins/poster */ \"./src/plugins/poster/index.js\");\n\nvar _poster2 = _interopRequireDefault(_poster);\n\nvar _google_analytics = __webpack_require__(/*! ../../plugins/google_analytics */ \"./src/plugins/google_analytics/index.js\");\n\nvar _google_analytics2 = _interopRequireDefault(_google_analytics);\n\nvar _click_to_pause = __webpack_require__(/*! ../../plugins/click_to_pause */ \"./src/plugins/click_to_pause/index.js\");\n\nvar _click_to_pause2 = _interopRequireDefault(_click_to_pause);\n\nvar _media_control = __webpack_require__(/*! ../../plugins/media_control */ \"./src/plugins/media_control/index.js\");\n\nvar _media_control2 = _interopRequireDefault(_media_control);\n\nvar _dvr_controls = __webpack_require__(/*! ../../plugins/dvr_controls */ \"./src/plugins/dvr_controls/index.js\");\n\nvar _dvr_controls2 = _interopRequireDefault(_dvr_controls);\n\nvar _closed_captions = __webpack_require__(/*! ../../plugins/closed_captions */ \"./src/plugins/closed_captions/index.js\");\n\nvar _closed_captions2 = _interopRequireDefault(_closed_captions);\n\nvar _favicon = __webpack_require__(/*! ../../plugins/favicon */ \"./src/plugins/favicon/index.js\");\n\nvar _favicon2 = _interopRequireDefault(_favicon);\n\nvar _seek_time = __webpack_require__(/*! ../../plugins/seek_time */ \"./src/plugins/seek_time/index.js\");\n\nvar _seek_time2 = _interopRequireDefault(_seek_time);\n\nvar _sources = __webpack_require__(/*! ../../plugins/sources */ \"./src/plugins/sources.js\");\n\nvar _sources2 = _interopRequireDefault(_sources);\n\nvar _end_video = __webpack_require__(/*! ../../plugins/end_video */ \"./src/plugins/end_video.js\");\n\nvar _end_video2 = _interopRequireDefault(_end_video);\n\nvar _strings = __webpack_require__(/*! ../../plugins/strings */ \"./src/plugins/strings.js\");\n\nvar _strings2 = _interopRequireDefault(_strings);\n\nvar _error_screen = __webpack_require__(/*! ../../plugins/error_screen */ \"./src/plugins/error_screen/index.js\");\n\nvar _error_screen2 = _interopRequireDefault(_error_screen);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * It keeps a list of the default plugins (playback, container, core) and it merges external plugins with its internals.\n * @class Loader\n * @constructor\n * @extends BaseObject\n * @module components\n */\n\n\n/* Playback Plugins */\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar Loader = function (_BaseObject) {\n (0, _inherits3.default)(Loader, _BaseObject);\n\n /**\n * builds the loader\n * @method constructor\n * @param {Object} externalPlugins the external plugins\n * @param {Number} playerId you can embed multiple instances of clappr, therefore this is the unique id of each one.\n */\n function Loader() {\n var externalPlugins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var playerId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var useOnlyPlainHtml5Plugins = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n (0, _classCallCheck3.default)(this, Loader);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this));\n\n _this.playerId = playerId;\n _this.playbackPlugins = [];\n\n if (!useOnlyPlainHtml5Plugins) {\n _this.playbackPlugins = [].concat((0, _toConsumableArray3.default)(_this.playbackPlugins), [_hls2.default]);\n }\n\n _this.playbackPlugins = [].concat((0, _toConsumableArray3.default)(_this.playbackPlugins), [_html5_video2.default, _html5_audio2.default]);\n\n if (!useOnlyPlainHtml5Plugins) {\n _this.playbackPlugins = [].concat((0, _toConsumableArray3.default)(_this.playbackPlugins), [_flash2.default, _flashls2.default]);\n }\n\n _this.playbackPlugins = [].concat((0, _toConsumableArray3.default)(_this.playbackPlugins), [_html_img2.default, _no_op2.default]);\n\n _this.containerPlugins = [_spinner_three_bounce2.default, _watermark2.default, _poster2.default, _stats2.default, _google_analytics2.default, _click_to_pause2.default];\n _this.corePlugins = [_media_control2.default, _dvr_controls2.default, _closed_captions2.default, _favicon2.default, _seek_time2.default, _sources2.default, _end_video2.default, _error_screen2.default, _strings2.default];\n\n if (!Array.isArray(externalPlugins)) _this.validateExternalPluginsType(externalPlugins);\n\n _this.addExternalPlugins(externalPlugins);\n return _this;\n }\n\n /**\n * groups by type the external plugins that were passed through `options.plugins` it they're on a flat array\n * @method addExternalPlugins\n * @private\n * @param {Object} an config object or an array of plugins\n * @return {Object} plugins the config object with the plugins separated by type\n */\n\n\n Loader.prototype.groupPluginsByType = function groupPluginsByType(plugins) {\n if (Array.isArray(plugins)) {\n plugins = plugins.reduce(function (memo, plugin) {\n memo[plugin.type] || (memo[plugin.type] = []);\n memo[plugin.type].push(plugin);\n return memo;\n }, {});\n }\n return plugins;\n };\n\n Loader.prototype.removeDups = function removeDups(list) {\n var groupUp = function groupUp(plugins, plugin) {\n plugins[plugin.prototype.name] && delete plugins[plugin.prototype.name];\n plugins[plugin.prototype.name] = plugin;\n return plugins;\n };\n var pluginsMap = list.reduceRight(groupUp, (0, _create2.default)(null));\n\n var plugins = [];\n for (var key in pluginsMap) {\n plugins.unshift(pluginsMap[key]);\n }return plugins;\n };\n\n /**\n * adds all the external plugins that were passed through `options.plugins`\n * @method addExternalPlugins\n * @private\n * @param {Object} plugins the config object with all plugins\n */\n\n\n Loader.prototype.addExternalPlugins = function addExternalPlugins(plugins) {\n plugins = this.groupPluginsByType(plugins);\n if (plugins.playback) this.playbackPlugins = this.removeDups(plugins.playback.concat(this.playbackPlugins));\n\n if (plugins.container) this.containerPlugins = this.removeDups(plugins.container.concat(this.containerPlugins));\n\n if (plugins.core) this.corePlugins = this.removeDups(plugins.core.concat(this.corePlugins));\n\n _player_info2.default.getInstance(this.playerId).playbackPlugins = this.playbackPlugins;\n };\n\n /**\n * validate if the external plugins that were passed through `options.plugins` are associated to the correct type\n * @method validateExternalPluginsType\n * @private\n * @param {Object} plugins the config object with all plugins\n */\n\n\n Loader.prototype.validateExternalPluginsType = function validateExternalPluginsType(plugins) {\n var plugintypes = ['playback', 'container', 'core'];\n plugintypes.forEach(function (type) {\n (plugins[type] || []).forEach(function (el) {\n var errorMessage = 'external ' + el.type + ' plugin on ' + type + ' array';\n if (el.type !== type) throw new ReferenceError(errorMessage);\n });\n });\n };\n\n return Loader;\n}(_base_object2.default);\n\n/* Core Plugins */\n\n\n/* Container Plugins */\n\n\nexports.default = Loader;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/mediator.js\":\n/*!************************************!*\\\n !*** ./src/components/mediator.js ***!\n \\************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _events = __webpack_require__(/*! ../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar events = new _events2.default(); // Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n/**\n * The mediator is a singleton for handling global events.\n */\n\nvar Mediator = function Mediator() {\n (0, _classCallCheck3.default)(this, Mediator);\n};\n\nexports.default = Mediator;\n\n\nMediator.on = function (name, callback, context) {\n events.on(name, callback, context);\n return;\n};\n\nMediator.once = function (name, callback, context) {\n events.once(name, callback, context);\n return;\n};\n\nMediator.off = function (name, callback, context) {\n events.off(name, callback, context);\n return;\n};\n\nMediator.trigger = function (name) {\n for (var _len = arguments.length, opts = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n opts[_key - 1] = arguments[_key];\n }\n\n events.trigger.apply(events, [name].concat(opts));\n return;\n};\n\nMediator.stopListening = function (obj, name, callback) {\n events.stopListening(obj, name, callback);\n return;\n};\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/player.js\":\n/*!**********************************!*\\\n !*** ./src/components/player.js ***!\n \\**********************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _assign = __webpack_require__(/*! babel-runtime/core-js/object/assign */ \"./node_modules/babel-runtime/core-js/object/assign.js\");\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _keys = __webpack_require__(/*! babel-runtime/core-js/object/keys */ \"./node_modules/babel-runtime/core-js/object/keys.js\");\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _utils = __webpack_require__(/*! ../base/utils */ \"./src/base/utils.js\");\n\nvar _base_object = __webpack_require__(/*! ../base/base_object */ \"./src/base/base_object.js\");\n\nvar _base_object2 = _interopRequireDefault(_base_object);\n\nvar _events = __webpack_require__(/*! ../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _browser = __webpack_require__(/*! ./browser */ \"./src/components/browser/index.js\");\n\nvar _browser2 = _interopRequireDefault(_browser);\n\nvar _core_factory = __webpack_require__(/*! ./core_factory */ \"./src/components/core_factory/index.js\");\n\nvar _core_factory2 = _interopRequireDefault(_core_factory);\n\nvar _loader = __webpack_require__(/*! ./loader */ \"./src/components/loader/index.js\");\n\nvar _loader2 = _interopRequireDefault(_loader);\n\nvar _player_info = __webpack_require__(/*! ./player_info */ \"./src/components/player_info.js\");\n\nvar _player_info2 = _interopRequireDefault(_player_info);\n\nvar _error_mixin = __webpack_require__(/*! ../base/error_mixin */ \"./src/base/error_mixin.js\");\n\nvar _error_mixin2 = _interopRequireDefault(_error_mixin);\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar baseUrl = (0, _utils.currentScriptUrl)().replace(/\\/[^/]+$/, '');\n\n/**\n * @class Player\n * @constructor\n * @extends BaseObject\n * @module components\n * @example\n * ### Using the Player\n *\n * Add the following script on your HTML:\n * ```html\n * \n * \n * \n * ```\n * Now, create the player:\n * ```html\n * \n *
\n * \n * \n * ```\n */\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar Player = function (_BaseObject) {\n (0, _inherits3.default)(Player, _BaseObject);\n (0, _createClass3.default)(Player, [{\n key: 'loader',\n set: function set(loader) {\n this._loader = loader;\n },\n get: function get() {\n if (!this._loader) this._loader = new _loader2.default(this.options.plugins || {}, this.options.playerId);\n\n return this._loader;\n }\n\n /**\n * Determine if the playback has ended.\n * @property ended\n * @type Boolean\n */\n\n }, {\n key: 'ended',\n get: function get() {\n return this.core.activeContainer.ended;\n }\n\n /**\n * Determine if the playback is having to buffer in order for\n * playback to be smooth.\n * (i.e if a live stream is playing smoothly, this will be false)\n * @property buffering\n * @type Boolean\n */\n\n }, {\n key: 'buffering',\n get: function get() {\n return this.core.activeContainer.buffering;\n }\n\n /*\n * determine if the player is ready.\n * @property isReady\n * @type {Boolean} `true` if the player is ready. ie PLAYER_READY event has fired\n */\n\n }, {\n key: 'isReady',\n get: function get() {\n return !!this._ready;\n }\n\n /**\n * An events map that allows the user to add custom callbacks in player's options.\n * @property eventsMapping\n * @type {Object}\n */\n\n }, {\n key: 'eventsMapping',\n get: function get() {\n return {\n onReady: _events2.default.PLAYER_READY,\n onResize: _events2.default.PLAYER_RESIZE,\n onPlay: _events2.default.PLAYER_PLAY,\n onPause: _events2.default.PLAYER_PAUSE,\n onStop: _events2.default.PLAYER_STOP,\n onEnded: _events2.default.PLAYER_ENDED,\n onSeek: _events2.default.PLAYER_SEEK,\n onError: _events2.default.PLAYER_ERROR,\n onTimeUpdate: _events2.default.PLAYER_TIMEUPDATE,\n onVolumeUpdate: _events2.default.PLAYER_VOLUMEUPDATE,\n onSubtitleAvailable: _events2.default.PLAYER_SUBTITLE_AVAILABLE\n };\n }\n\n /**\n * @typedef {Object} PlaybackConfig\n * @prop {boolean} disableContextMenu\n * disables the context menu (right click) on the video element if a HTML5Video playback is used.\n * @prop {boolean} preload\n * video will be preloaded according to `preload` attribute options **default**: `'metadata'`\n * @prop {boolean} controls\n * enabled/disables displaying controls\n * @prop {boolean} crossOrigin\n * enables cross-origin capability for media-resources\n * @prop {boolean} playInline\n * enables in-line video elements\n * @prop {boolean} audioOnly\n * enforce audio-only playback (when possible)\n * @prop {Object} externalTracks\n * pass externaly loaded track to playback\n * @prop {Number} [maxBufferLength]\n * The default behavior for the **HLS playback** is to keep buffering indefinitely, even on VoD.\n * This replicates the behavior for progressive download, which continues buffering when pausing the video, thus making the video available for playback even on slow networks.\n * To change this behavior use `maxBufferLength` where **value is in seconds**.\n * @prop {Number} [maxBackBufferLength]\n * After how much distance of the playhead data should be pruned from the buffer (influences memory consumption\n * of adaptive media-engines like Hls.js or Shaka)\n * @prop {Number} [minBufferLength]\n * After how much data in the buffer at least we attempt to consume it (influences QoS-related behavior\n * of adaptive media-engines like Hls.js or Shaka). If this is too low, and the available bandwidth is varying a lot\n * and too close to the streamed bitrate, we may continuously hit under-runs.\n * @prop {Number} [initialBandwidthEstimate]\n * define an initial bandwidth \"guess\" (or previously stored/established value) for underlying adaptive-bitreate engines\n * of adaptive playback implementations, like Hls.js or Shaka\n * @prop {Number} [maxAdaptiveBitrate]\n * Limits the streamed bitrate (for adaptive media-engines in underlying playback implementations)\n * @prop {Object} [maxAdaptiveVideoDimensions]\n * Limits the video dimensions in adaptive media-engines. Should be a literal object with `height` and `width`.\n * @prop {Boolean}[enableAutomaticABR] **default**: `true`\n * Allows to enable/disable automatic bitrate switching in adaptive media-engines\n * @prop {String} [preferredTextLanguage] **default**: `'pt-BR'`\n * Allows to set a preferred text language, that may be enabled by the media-engine if available.\n * @prop {String} [preferredAudioLanguage] **default**: `'pt-BR'`\n * Allows to set a preferred audio language, that may be enabled by the media-engine if available.\n */\n\n /**\n * ## Player's constructor\n *\n * You might pass the options object to build the player.\n * ```javascript\n * var options = {source: \"http://example.com/video.mp4\", param1: \"val1\"};\n * var player = new Clappr.Player(options);\n * ```\n *\n * @method constructor\n * @param {Object} options Data\n * options to build a player instance\n * @param {Number} [options.width]\n * player's width **default**: `640`\n * @param {Number} [options.height]\n * player's height **default**: `360`\n * @param {String} [options.parentId]\n * the id of the element on the page that the player should be inserted into\n * @param {Object} [options.parent]\n * a reference to a dom element that the player should be inserted into\n * @param {String} [options.source]\n * The media source URL, or {source: <>, mimeType: <>}\n * @param {Object} [options.sources]\n * An array of media source URL's, or an array of {source: <>, mimeType: <>}\n * @param {Boolean} [options.autoPlay]\n * automatically play after page load **default**: `false`\n * @param {Boolean} [options.loop]\n * automatically replay after it ends **default**: `false`\n * @param {Boolean} [options.chromeless]\n * player acts in chromeless mode **default**: `false`\n * @param {Boolean} [options.allowUserInteraction]\n * whether or not the player should handle click events when in chromeless mode **default**: `false` on desktops browsers, `true` on mobile.\n * @param {Boolean} [options.disableKeyboardShortcuts]\n * disable keyboard shortcuts. **default**: `false`. `true` if `allowUserInteraction` is `false`.\n * @param {Boolean} [options.mute]\n * start the video muted **default**: `false`\n * @param {String} [options.mimeType]\n * add `mimeType: \"application/vnd.apple.mpegurl\"` if you need to use a url without extension.\n * @param {Boolean} [options.actualLiveTime]\n * show duration and seek time relative to actual time.\n * @param {String} [options.actualLiveServerTime]\n * specify server time as a string, format: \"2015/11/26 06:01:03\". This option is meant to be used with actualLiveTime.\n * @param {Boolean} [options.persistConfig]\n * persist player's settings (volume) through the same domain **default**: `true`\n * @param {String} [options.preload] @deprecated\n * video will be preloaded according to `preload` attribute options **default**: `'metadata'`\n * @param {Number} [options.maxBufferLength] @deprecated\n * the default behavior for the **HLS playback** is to keep buffering indefinitely, even on VoD.\n * This replicates the behavior for progressive download, which continues buffering when pausing the video, thus making the video available for playback even on slow networks.\n * To change this behavior use `maxBufferLength` where **value is in seconds**.\n * @param {String} [options.gaAccount]\n * enable Google Analytics events dispatch **(play/pause/stop/buffering/etc)** by adding your `gaAccount`\n * @param {String} [options.gaTrackerName]\n * besides `gaAccount` you can optionally, pass your favorite trackerName as `gaTrackerName`\n * @param {Object} [options.mediacontrol]\n * customize control bar colors, example: `mediacontrol: {seekbar: \"#E113D3\", buttons: \"#66B2FF\"}`\n * @param {Boolean} [options.hideMediaControl]\n * control media control auto hide **default**: `true`\n * @param {Boolean} [options.hideVolumeBar]\n * when embedded with width less than 320, volume bar will hide. You can force this behavior for all sizes by adding `true` **default**: `false`\n * @param {String} [options.watermark]\n * put `watermark: 'http://url/img.png'` on your embed parameters to automatically add watermark on your video.\n * You can customize corner position by defining position parameter. Positions can be `bottom-left`, `bottom-right`, `top-left` and `top-right`.\n * @param {String} [options.watermarkLink]\n * `watermarkLink: 'http://example.net/'` - define URL to open when the watermark is clicked. If not provided watermark will not be clickable.\n * @param {Boolean} [options.disableVideoTagContextMenu] @deprecated\n * disables the context menu (right click) on the video element if a HTML5Video playback is used.\n * @param {Boolean} [options.autoSeekFromUrl]\n * Automatically seek to the seconds provided in the url (e.g example.com?t=100) **default**: `true`\n * @param {Boolean} [options.exitFullscreenOnEnd]\n * Automatically exit full screen when the media finishes. **default**: `true`\n * @param {String} [options.poster]\n * define a poster by adding its address `poster: 'http://url/img.png'`. It will appear after video embed, disappear on play and go back when user stops the video.\n * @param {String} [options.playbackNotSupportedMessage]\n * define a custom message to be displayed when a playback is not supported.\n * @param {Object} [options.events]\n * Specify listeners which will be registered with their corresponding player events.\n * E.g. onReady -> \"PLAYER_READY\", onTimeUpdate -> \"PLAYER_TIMEUPDATE\"\n * @param {PlaybackConfig} [options.playback]\n * Generic `Playback` component related configuration\n * @param {Boolean} [options.disableErrorScreen]\n * disables the error screen plugin.\n * @param {Number} [options.autoPlayTimeout]\n * autoplay check timeout.\n */\n\n }]);\n\n function Player(options) {\n (0, _classCallCheck3.default)(this, Player);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, options));\n\n var playbackDefaultOptions = { recycleVideo: true };\n var defaultOptions = {\n playerId: (0, _utils.uniqueId)(''),\n persistConfig: true,\n width: 640,\n height: 360,\n baseUrl: baseUrl,\n allowUserInteraction: _browser2.default.isMobile,\n playback: playbackDefaultOptions\n };\n _this._options = _clapprZepto2.default.extend(defaultOptions, options);\n _this.options.sources = _this._normalizeSources(options);\n if (!_this.options.chromeless) {\n // \"allowUserInteraction\" cannot be false if not in chromeless mode.\n _this.options.allowUserInteraction = true;\n }\n if (!_this.options.allowUserInteraction) {\n // if user iteraction is not allowed ensure keyboard shortcuts are disabled\n _this.options.disableKeyboardShortcuts = true;\n }\n _this._registerOptionEventListeners(_this.options.events);\n _this._coreFactory = new _core_factory2.default(_this);\n _this.playerInfo = _player_info2.default.getInstance(_this.options.playerId);\n _this.playerInfo.currentSize = { width: options.width, height: options.height };\n _this.playerInfo.options = _this.options;\n if (_this.options.parentId) _this.setParentId(_this.options.parentId);else if (_this.options.parent) _this.attachTo(_this.options.parent);\n\n return _this;\n }\n\n /**\n * Specify a `parentId` to the player.\n * @method setParentId\n * @param {String} parentId the element parent id.\n * @return {Player} itself\n */\n\n\n Player.prototype.setParentId = function setParentId(parentId) {\n var el = document.querySelector(parentId);\n if (el) this.attachTo(el);\n\n return this;\n };\n\n /**\n * You can use this method to attach the player to a given element. You don't need to do this when you specify it during the player instantiation passing the `parentId` param.\n * @method attachTo\n * @param {Object} element a given element.\n * @return {Player} itself\n */\n\n\n Player.prototype.attachTo = function attachTo(element) {\n this.options.parentElement = element;\n this.core = this._coreFactory.create();\n this._addEventListeners();\n return this;\n };\n\n Player.prototype._addEventListeners = function _addEventListeners() {\n if (!this.core.isReady) this.listenToOnce(this.core, _events2.default.CORE_READY, this._onReady);else this._onReady();\n\n this.listenTo(this.core, _events2.default.CORE_ACTIVE_CONTAINER_CHANGED, this._containerChanged);\n this.listenTo(this.core, _events2.default.CORE_FULLSCREEN, this._onFullscreenChange);\n this.listenTo(this.core, _events2.default.CORE_RESIZE, this._onResize);\n return this;\n };\n\n Player.prototype._addContainerEventListeners = function _addContainerEventListeners() {\n var container = this.core.activeContainer;\n if (container) {\n this.listenTo(container, _events2.default.CONTAINER_PLAY, this._onPlay);\n this.listenTo(container, _events2.default.CONTAINER_PAUSE, this._onPause);\n this.listenTo(container, _events2.default.CONTAINER_STOP, this._onStop);\n this.listenTo(container, _events2.default.CONTAINER_ENDED, this._onEnded);\n this.listenTo(container, _events2.default.CONTAINER_SEEK, this._onSeek);\n this.listenTo(container, _events2.default.CONTAINER_ERROR, this._onError);\n this.listenTo(container, _events2.default.CONTAINER_TIMEUPDATE, this._onTimeUpdate);\n this.listenTo(container, _events2.default.CONTAINER_VOLUME, this._onVolumeUpdate);\n this.listenTo(container, _events2.default.CONTAINER_SUBTITLE_AVAILABLE, this._onSubtitleAvailable);\n }\n return this;\n };\n\n Player.prototype._registerOptionEventListeners = function _registerOptionEventListeners() {\n var _this2 = this;\n\n var newEvents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var hasNewEvents = (0, _keys2.default)(newEvents).length > 0;\n hasNewEvents && (0, _keys2.default)(events).forEach(function (userEvent) {\n var eventType = _this2.eventsMapping[userEvent];\n eventType && _this2.off(eventType, events[userEvent]);\n });\n\n (0, _keys2.default)(newEvents).forEach(function (userEvent) {\n var eventType = _this2.eventsMapping[userEvent];\n if (eventType) {\n var eventFunction = newEvents[userEvent];\n eventFunction = typeof eventFunction === 'function' && eventFunction;\n eventFunction && _this2.on(eventType, eventFunction);\n }\n });\n return this;\n };\n\n Player.prototype._containerChanged = function _containerChanged() {\n this.stopListening();\n this._addEventListeners();\n };\n\n Player.prototype._onReady = function _onReady() {\n this._ready = true;\n this._addContainerEventListeners();\n this.trigger(_events2.default.PLAYER_READY);\n };\n\n Player.prototype._onFullscreenChange = function _onFullscreenChange(fullscreen) {\n this.trigger(_events2.default.PLAYER_FULLSCREEN, fullscreen);\n };\n\n Player.prototype._onVolumeUpdate = function _onVolumeUpdate(volume) {\n this.trigger(_events2.default.PLAYER_VOLUMEUPDATE, volume);\n };\n\n Player.prototype._onSubtitleAvailable = function _onSubtitleAvailable() {\n this.trigger(_events2.default.PLAYER_SUBTITLE_AVAILABLE);\n };\n\n Player.prototype._onResize = function _onResize(size) {\n this.trigger(_events2.default.PLAYER_RESIZE, size);\n };\n\n Player.prototype._onPlay = function _onPlay() {\n this.trigger(_events2.default.PLAYER_PLAY);\n };\n\n Player.prototype._onPause = function _onPause() {\n this.trigger(_events2.default.PLAYER_PAUSE);\n };\n\n Player.prototype._onStop = function _onStop() {\n this.trigger(_events2.default.PLAYER_STOP, this.getCurrentTime());\n };\n\n Player.prototype._onEnded = function _onEnded() {\n this.trigger(_events2.default.PLAYER_ENDED);\n };\n\n Player.prototype._onSeek = function _onSeek(time) {\n this.trigger(_events2.default.PLAYER_SEEK, time);\n };\n\n Player.prototype._onTimeUpdate = function _onTimeUpdate(timeProgress) {\n this.trigger(_events2.default.PLAYER_TIMEUPDATE, timeProgress);\n };\n\n Player.prototype._onError = function _onError(error) {\n this.trigger(_events2.default.PLAYER_ERROR, error);\n };\n\n Player.prototype._normalizeSources = function _normalizeSources(options) {\n var sources = options.sources || (options.source !== undefined ? [options.source] : []);\n return sources.length === 0 ? [{ source: '', mimeType: '' }] : sources;\n };\n\n /**\n * resizes the current player canvas.\n * @method resize\n * @param {Object} size should be a literal object with `height` and `width`.\n * @return {Player} itself\n * @example\n * ```javascript\n * player.resize({height: 360, width: 640})\n * ```\n */\n\n\n Player.prototype.resize = function resize(size) {\n this.core.resize(size);\n return this;\n };\n\n /**\n * loads a new source.\n * @method load\n * @param {Array|String} sources source or sources of video.\n * An array item can be a string or {source: <>, mimeType: <>}\n * @param {String} mimeType a mime type, example: `'application/vnd.apple.mpegurl'`\n * @param {Boolean} [autoPlay=false] whether playing should be started immediately\n * @return {Player} itself\n */\n\n\n Player.prototype.load = function load(sources, mimeType, autoPlay) {\n if (autoPlay !== undefined) this.configure({ autoPlay: !!autoPlay });\n\n this.core.load(sources, mimeType);\n return this;\n };\n\n /**\n * destroys the current player and removes it from the DOM.\n * @method destroy\n * @return {Player} itself\n */\n\n\n Player.prototype.destroy = function destroy() {\n this.stopListening();\n this.core.destroy();\n return this;\n };\n\n /**\n * Gives user consent to playback. Required by mobile device after a click event before Player.load().\n * @method consent\n * @return {Player} itself\n */\n\n\n Player.prototype.consent = function consent() {\n this.core.getCurrentPlayback().consent();\n return this;\n };\n\n /**\n * plays the current video (`source`).\n * @method play\n * @return {Player} itself\n */\n\n\n Player.prototype.play = function play() {\n this.core.activeContainer.play();\n return this;\n };\n\n /**\n * pauses the current video (`source`).\n * @method pause\n * @return {Player} itself\n */\n\n\n Player.prototype.pause = function pause() {\n this.core.activeContainer.pause();\n return this;\n };\n\n /**\n * stops the current video (`source`).\n * @method stop\n * @return {Player} itself\n */\n\n\n Player.prototype.stop = function stop() {\n this.core.activeContainer.stop();\n return this;\n };\n\n /**\n * seeks the current video (`source`). For example, `player.seek(120)` will seek to second 120 (2minutes) of the current video.\n * @method seek\n * @param {Number} time should be a number between 0 and the video duration.\n * @return {Player} itself\n */\n\n\n Player.prototype.seek = function seek(time) {\n this.core.activeContainer.seek(time);\n return this;\n };\n\n /**\n * seeks the current video (`source`). For example, `player.seek(50)` will seek to the middle of the current video.\n * @method seekPercentage\n * @param {Number} time should be a number between 0 and 100.\n * @return {Player} itself\n */\n\n\n Player.prototype.seekPercentage = function seekPercentage(percentage) {\n this.core.activeContainer.seekPercentage(percentage);\n return this;\n };\n\n /**\n * mutes the current video (`source`).\n * @method mute\n * @return {Player} itself\n */\n\n\n Player.prototype.mute = function mute() {\n this._mutedVolume = this.getVolume();\n this.setVolume(0);\n return this;\n };\n\n /**\n * unmutes the current video (`source`).\n * @method unmute\n * @return {Player} itself\n */\n\n\n Player.prototype.unmute = function unmute() {\n this.setVolume(typeof this._mutedVolume === 'number' ? this._mutedVolume : 100);\n this._mutedVolume = null;\n return this;\n };\n\n /**\n * checks if the player is playing.\n * @method isPlaying\n * @return {Boolean} `true` if the current source is playing, otherwise `false`\n */\n\n\n Player.prototype.isPlaying = function isPlaying() {\n return this.core.activeContainer.isPlaying();\n };\n\n /**\n * returns `true` if DVR is enable otherwise `false`.\n * @method isDvrEnabled\n * @return {Boolean}\n */\n\n\n Player.prototype.isDvrEnabled = function isDvrEnabled() {\n return this.core.activeContainer.isDvrEnabled();\n };\n\n /**\n * returns `true` if DVR is in use otherwise `false`.\n * @method isDvrInUse\n * @return {Boolean}\n */\n\n\n Player.prototype.isDvrInUse = function isDvrInUse() {\n return this.core.activeContainer.isDvrInUse();\n };\n\n /**\n * enables to configure a player after its creation\n * @method configure\n * @param {Object} options all the options to change in form of a javascript object\n * @return {Player} itself\n */\n\n\n Player.prototype.configure = function configure() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this._registerOptionEventListeners(options.events, this.options.events);\n this.core.configure(options);\n return this;\n };\n\n /**\n * get a plugin by its name.\n * @method getPlugin\n * @param {String} name of the plugin.\n * @return {Object} the plugin instance\n * @example\n * ```javascript\n * var poster = player.getPlugin('poster');\n * poster.hidePlayButton();\n * ```\n */\n\n\n Player.prototype.getPlugin = function getPlugin(name) {\n var plugins = this.core.plugins.concat(this.core.activeContainer.plugins);\n return plugins.filter(function (plugin) {\n return plugin.name === name;\n })[0];\n };\n\n /**\n * the current time in seconds.\n * @method getCurrentTime\n * @return {Number} current time (in seconds) of the current source\n */\n\n\n Player.prototype.getCurrentTime = function getCurrentTime() {\n return this.core.activeContainer.getCurrentTime();\n };\n\n /**\n * The time that \"0\" now represents relative to when playback started.\n * For a stream with a sliding window this will increase as content is\n * removed from the beginning.\n * @method getStartTimeOffset\n * @return {Number} time (in seconds) that time \"0\" represents.\n */\n\n\n Player.prototype.getStartTimeOffset = function getStartTimeOffset() {\n return this.core.activeContainer.getStartTimeOffset();\n };\n\n /**\n * the duration time in seconds.\n * @method getDuration\n * @return {Number} duration time (in seconds) of the current source\n */\n\n\n Player.prototype.getDuration = function getDuration() {\n return this.core.activeContainer.getDuration();\n };\n\n return Player;\n}(_base_object2.default);\n\nexports.default = Player;\n\n\n(0, _assign2.default)(Player.prototype, _error_mixin2.default);\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/components/player_info.js\":\n/*!***************************************!*\\\n !*** ./src/components/player_info.js ***!\n \\***************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar PlayerInfo = function PlayerInfo() {\n (0, _classCallCheck3.default)(this, PlayerInfo);\n\n this.options = {};\n this.playbackPlugins = [];\n this.currentSize = { width: 0, height: 0 };\n};\n\nPlayerInfo._players = {};\n\nPlayerInfo.getInstance = function (playerId) {\n return PlayerInfo._players[playerId] || (PlayerInfo._players[playerId] = new PlayerInfo());\n};\n\nexports.default = PlayerInfo;\nmodule.exports = exports[\"default\"];\n\n/***/ }),\n\n/***/ \"./src/icons/01-play.svg\":\n/*!*******************************!*\\\n !*** ./src/icons/01-play.svg ***!\n \\*******************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\"\n\n/***/ }),\n\n/***/ \"./src/icons/02-pause.svg\":\n/*!********************************!*\\\n !*** ./src/icons/02-pause.svg ***!\n \\********************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\"\n\n/***/ }),\n\n/***/ \"./src/icons/03-stop.svg\":\n/*!*******************************!*\\\n !*** ./src/icons/03-stop.svg ***!\n \\*******************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\"\n\n/***/ }),\n\n/***/ \"./src/icons/04-volume.svg\":\n/*!*********************************!*\\\n !*** ./src/icons/04-volume.svg ***!\n \\*********************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\"\n\n/***/ }),\n\n/***/ \"./src/icons/05-mute.svg\":\n/*!*******************************!*\\\n !*** ./src/icons/05-mute.svg ***!\n \\*******************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\"\n\n/***/ }),\n\n/***/ \"./src/icons/06-expand.svg\":\n/*!*********************************!*\\\n !*** ./src/icons/06-expand.svg ***!\n \\*********************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\"\n\n/***/ }),\n\n/***/ \"./src/icons/07-shrink.svg\":\n/*!*********************************!*\\\n !*** ./src/icons/07-shrink.svg ***!\n \\*********************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\"\n\n/***/ }),\n\n/***/ \"./src/icons/08-hd.svg\":\n/*!*****************************!*\\\n !*** ./src/icons/08-hd.svg ***!\n \\*****************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\"\n\n/***/ }),\n\n/***/ \"./src/icons/09-cc.svg\":\n/*!*****************************!*\\\n !*** ./src/icons/09-cc.svg ***!\n \\*****************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\"\n\n/***/ }),\n\n/***/ \"./src/icons/10-reload.svg\":\n/*!*********************************!*\\\n !*** ./src/icons/10-reload.svg ***!\n \\*********************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\"\n\n/***/ }),\n\n/***/ \"./src/main.js\":\n/*!*********************!*\\\n !*** ./src/main.js ***!\n \\*********************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _player = __webpack_require__(/*! ./components/player */ \"./src/components/player.js\");\n\nvar _player2 = _interopRequireDefault(_player);\n\nvar _utils = __webpack_require__(/*! ./base/utils */ \"./src/base/utils.js\");\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nvar _events = __webpack_require__(/*! ./base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _playback = __webpack_require__(/*! ./base/playback */ \"./src/base/playback.js\");\n\nvar _playback2 = _interopRequireDefault(_playback);\n\nvar _container_plugin = __webpack_require__(/*! ./base/container_plugin */ \"./src/base/container_plugin.js\");\n\nvar _container_plugin2 = _interopRequireDefault(_container_plugin);\n\nvar _core_plugin = __webpack_require__(/*! ./base/core_plugin */ \"./src/base/core_plugin.js\");\n\nvar _core_plugin2 = _interopRequireDefault(_core_plugin);\n\nvar _ui_core_plugin = __webpack_require__(/*! ./base/ui_core_plugin */ \"./src/base/ui_core_plugin.js\");\n\nvar _ui_core_plugin2 = _interopRequireDefault(_ui_core_plugin);\n\nvar _ui_container_plugin = __webpack_require__(/*! ./base/ui_container_plugin */ \"./src/base/ui_container_plugin.js\");\n\nvar _ui_container_plugin2 = _interopRequireDefault(_ui_container_plugin);\n\nvar _base_object = __webpack_require__(/*! ./base/base_object */ \"./src/base/base_object.js\");\n\nvar _base_object2 = _interopRequireDefault(_base_object);\n\nvar _ui_object = __webpack_require__(/*! ./base/ui_object */ \"./src/base/ui_object.js\");\n\nvar _ui_object2 = _interopRequireDefault(_ui_object);\n\nvar _browser = __webpack_require__(/*! ./components/browser */ \"./src/components/browser/index.js\");\n\nvar _browser2 = _interopRequireDefault(_browser);\n\nvar _container = __webpack_require__(/*! ./components/container */ \"./src/components/container/index.js\");\n\nvar _container2 = _interopRequireDefault(_container);\n\nvar _core = __webpack_require__(/*! ./components/core */ \"./src/components/core/index.js\");\n\nvar _core2 = _interopRequireDefault(_core);\n\nvar _error = __webpack_require__(/*! ./components/error */ \"./src/components/error/index.js\");\n\nvar _error2 = _interopRequireDefault(_error);\n\nvar _loader = __webpack_require__(/*! ./components/loader */ \"./src/components/loader/index.js\");\n\nvar _loader2 = _interopRequireDefault(_loader);\n\nvar _mediator = __webpack_require__(/*! ./components/mediator */ \"./src/components/mediator.js\");\n\nvar _mediator2 = _interopRequireDefault(_mediator);\n\nvar _player_info = __webpack_require__(/*! ./components/player_info */ \"./src/components/player_info.js\");\n\nvar _player_info2 = _interopRequireDefault(_player_info);\n\nvar _base_flash_playback = __webpack_require__(/*! ./playbacks/base_flash_playback */ \"./src/playbacks/base_flash_playback/index.js\");\n\nvar _base_flash_playback2 = _interopRequireDefault(_base_flash_playback);\n\nvar _flash = __webpack_require__(/*! ./playbacks/flash */ \"./src/playbacks/flash/index.js\");\n\nvar _flash2 = _interopRequireDefault(_flash);\n\nvar _flashls = __webpack_require__(/*! ./playbacks/flashls */ \"./src/playbacks/flashls/index.js\");\n\nvar _flashls2 = _interopRequireDefault(_flashls);\n\nvar _hls = __webpack_require__(/*! ./playbacks/hls */ \"./src/playbacks/hls/index.js\");\n\nvar _hls2 = _interopRequireDefault(_hls);\n\nvar _html5_audio = __webpack_require__(/*! ./playbacks/html5_audio */ \"./src/playbacks/html5_audio/index.js\");\n\nvar _html5_audio2 = _interopRequireDefault(_html5_audio);\n\nvar _html5_video = __webpack_require__(/*! ./playbacks/html5_video */ \"./src/playbacks/html5_video/index.js\");\n\nvar _html5_video2 = _interopRequireDefault(_html5_video);\n\nvar _html_img = __webpack_require__(/*! ./playbacks/html_img */ \"./src/playbacks/html_img/index.js\");\n\nvar _html_img2 = _interopRequireDefault(_html_img);\n\nvar _no_op = __webpack_require__(/*! ./playbacks/no_op */ \"./src/playbacks/no_op/index.js\");\n\nvar _no_op2 = _interopRequireDefault(_no_op);\n\nvar _media_control = __webpack_require__(/*! ./plugins/media_control */ \"./src/plugins/media_control/index.js\");\n\nvar _media_control2 = _interopRequireDefault(_media_control);\n\nvar _click_to_pause = __webpack_require__(/*! ./plugins/click_to_pause */ \"./src/plugins/click_to_pause/index.js\");\n\nvar _click_to_pause2 = _interopRequireDefault(_click_to_pause);\n\nvar _dvr_controls = __webpack_require__(/*! ./plugins/dvr_controls */ \"./src/plugins/dvr_controls/index.js\");\n\nvar _dvr_controls2 = _interopRequireDefault(_dvr_controls);\n\nvar _favicon = __webpack_require__(/*! ./plugins/favicon */ \"./src/plugins/favicon/index.js\");\n\nvar _favicon2 = _interopRequireDefault(_favicon);\n\nvar _log = __webpack_require__(/*! ./plugins/log */ \"./src/plugins/log/index.js\");\n\nvar _log2 = _interopRequireDefault(_log);\n\nvar _poster = __webpack_require__(/*! ./plugins/poster */ \"./src/plugins/poster/index.js\");\n\nvar _poster2 = _interopRequireDefault(_poster);\n\nvar _spinner_three_bounce = __webpack_require__(/*! ./plugins/spinner_three_bounce */ \"./src/plugins/spinner_three_bounce/index.js\");\n\nvar _spinner_three_bounce2 = _interopRequireDefault(_spinner_three_bounce);\n\nvar _watermark = __webpack_require__(/*! ./plugins/watermark */ \"./src/plugins/watermark/index.js\");\n\nvar _watermark2 = _interopRequireDefault(_watermark);\n\nvar _styler = __webpack_require__(/*! ./base/styler */ \"./src/base/styler.js\");\n\nvar _styler2 = _interopRequireDefault(_styler);\n\nvar _vendor = __webpack_require__(/*! ./vendor */ \"./src/vendor/index.js\");\n\nvar _vendor2 = _interopRequireDefault(_vendor);\n\nvar _template = __webpack_require__(/*! ./base/template */ \"./src/base/template.js\");\n\nvar _template2 = _interopRequireDefault(_template);\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar version = \"0.3.12\"; // Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nexports.default = {\n Player: _player2.default,\n Mediator: _mediator2.default,\n Events: _events2.default,\n Browser: _browser2.default,\n PlayerInfo: _player_info2.default,\n MediaControl: _media_control2.default,\n ContainerPlugin: _container_plugin2.default,\n UIContainerPlugin: _ui_container_plugin2.default,\n CorePlugin: _core_plugin2.default,\n UICorePlugin: _ui_core_plugin2.default,\n Playback: _playback2.default,\n Container: _container2.default,\n Core: _core2.default,\n PlayerError: _error2.default,\n Loader: _loader2.default,\n BaseObject: _base_object2.default,\n UIObject: _ui_object2.default,\n Utils: _utils2.default,\n BaseFlashPlayback: _base_flash_playback2.default,\n Flash: _flash2.default,\n FlasHLS: _flashls2.default,\n HLS: _hls2.default,\n HTML5Audio: _html5_audio2.default,\n HTML5Video: _html5_video2.default,\n HTMLImg: _html_img2.default,\n NoOp: _no_op2.default,\n ClickToPausePlugin: _click_to_pause2.default,\n DVRControls: _dvr_controls2.default,\n Favicon: _favicon2.default,\n Log: _log2.default,\n Poster: _poster2.default,\n SpinnerThreeBouncePlugin: _spinner_three_bounce2.default,\n WaterMarkPlugin: _watermark2.default,\n Styler: _styler2.default,\n Vendor: _vendor2.default,\n version: version,\n template: _template2.default,\n $: _clapprZepto2.default\n};\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/base_flash_playback/base_flash_playback.js\":\n/*!******************************************************************!*\\\n !*** ./src/playbacks/base_flash_playback/base_flash_playback.js ***!\n \\******************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _playback = __webpack_require__(/*! ../../base/playback */ \"./src/base/playback.js\");\n\nvar _playback2 = _interopRequireDefault(_playback);\n\nvar _template = __webpack_require__(/*! ../../base/template */ \"./src/base/template.js\");\n\nvar _template2 = _interopRequireDefault(_template);\n\nvar _browser = __webpack_require__(/*! ../../components/browser */ \"./src/components/browser/index.js\");\n\nvar _browser2 = _interopRequireDefault(_browser);\n\nvar _flash = __webpack_require__(/*! ./public/flash.html */ \"./src/playbacks/base_flash_playback/public/flash.html\");\n\nvar _flash2 = _interopRequireDefault(_flash);\n\n__webpack_require__(/*! ./public/flash.scss */ \"./src/playbacks/base_flash_playback/public/flash.scss\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar IE_CLASSID = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'; // Copyright 2015 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar BaseFlashPlayback = function (_Playback) {\n (0, _inherits3.default)(BaseFlashPlayback, _Playback);\n\n function BaseFlashPlayback() {\n (0, _classCallCheck3.default)(this, BaseFlashPlayback);\n return (0, _possibleConstructorReturn3.default)(this, _Playback.apply(this, arguments));\n }\n\n BaseFlashPlayback.prototype.setElement = function setElement(element) {\n this.$el = element;\n this.el = element[0];\n };\n\n BaseFlashPlayback.prototype.render = function render() {\n this.$el.attr('data', this.swfPath);\n this.$el.html(this.template({\n cid: this.cid,\n swfPath: this.swfPath,\n baseUrl: this.baseUrl,\n playbackId: this.uniqueId,\n wmode: this.wmode,\n callbackName: 'window.Clappr.flashlsCallbacks.' + this.cid }));\n\n if (_browser2.default.isIE) {\n this.$('embed').remove();\n\n if (_browser2.default.isLegacyIE) this.$el.attr('classid', IE_CLASSID);\n }\n\n this.el.id = this.cid;\n\n return this;\n };\n\n (0, _createClass3.default)(BaseFlashPlayback, [{\n key: 'tagName',\n get: function get() {\n return 'object';\n }\n }, {\n key: 'swfPath',\n get: function get() {\n return '';\n }\n }, {\n key: 'wmode',\n get: function get() {\n return 'transparent';\n }\n }, {\n key: 'template',\n get: function get() {\n return (0, _template2.default)(_flash2.default);\n }\n }, {\n key: 'attributes',\n get: function get() {\n var type = 'application/x-shockwave-flash';\n\n if (_browser2.default.isLegacyIE) type = '';\n\n return {\n class: 'clappr-flash-playback',\n type: type,\n width: '100%',\n height: '100%',\n data: this.swfPath,\n 'data-flash-playback': this.name\n };\n }\n }]);\n return BaseFlashPlayback;\n}(_playback2.default);\n\nexports.default = BaseFlashPlayback;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/base_flash_playback/index.js\":\n/*!****************************************************!*\\\n !*** ./src/playbacks/base_flash_playback/index.js ***!\n \\****************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = __webpack_require__(/*! ./base_flash_playback */ \"./src/playbacks/base_flash_playback/base_flash_playback.js\");\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/base_flash_playback/public/flash.html\":\n/*!*************************************************************!*\\\n !*** ./src/playbacks/base_flash_playback/public/flash.html ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"\\\">\\n\\n\\n\\n\\n\\n\\\">\\n\\n&callback=<%= callbackName %>\\\">\\n\\\"\\n type=\\\"application/x-shockwave-flash\\\"\\n disabled=\\\"disabled\\\"\\n tabindex=\\\"-1\\\"\\n enablecontextmenu=\\\"false\\\"\\n allowScriptAccess=\\\"always\\\"\\n quality=\\\"autohigh\\\"\\n pluginspage=\\\"http://www.macromedia.com/go/getflashplayer\\\"\\n wmode=\\\"<%= wmode %>\\\"\\n swliveconnect=\\\"true\\\"\\n allowfullscreen=\\\"false\\\"\\n bgcolor=\\\"#000000\\\"\\n FlashVars=\\\"playbackId=<%= playbackId %>&callback=<%= callbackName %>\\\"\\n data=\\\"<%= swfPath %>\\\"\\n src=\\\"<%= swfPath %>\\\"\\n width=\\\"100%\\\"\\n height=\\\"100%\\\">\\n\\n\";\n\n/***/ }),\n\n/***/ \"./src/playbacks/base_flash_playback/public/flash.scss\":\n/*!*************************************************************!*\\\n !*** ./src/playbacks/base_flash_playback/public/flash.scss ***!\n \\*************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\nvar content = __webpack_require__(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./flash.scss */ \"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno/workspace/clappr/clappr/src/base/scss!./src/playbacks/base_flash_playback/public/flash.scss\");\n\nif(typeof content === 'string') content = [[module.i, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"singleton\":true,\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = __webpack_require__(/*! ../../../../node_modules/style-loader/lib/addStyles.js */ \"./node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(false) {}\n\n/***/ }),\n\n/***/ \"./src/playbacks/flash/flash.js\":\n/*!**************************************!*\\\n !*** ./src/playbacks/flash/flash.js ***!\n \\**************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _utils = __webpack_require__(/*! ../../base/utils */ \"./src/base/utils.js\");\n\nvar _base_flash_playback = __webpack_require__(/*! ../../playbacks/base_flash_playback */ \"./src/playbacks/base_flash_playback/index.js\");\n\nvar _base_flash_playback2 = _interopRequireDefault(_base_flash_playback);\n\nvar _browser = __webpack_require__(/*! ../../components/browser */ \"./src/components/browser/index.js\");\n\nvar _browser2 = _interopRequireDefault(_browser);\n\nvar _mediator = __webpack_require__(/*! ../../components/mediator */ \"./src/components/mediator.js\");\n\nvar _mediator2 = _interopRequireDefault(_mediator);\n\nvar _template = __webpack_require__(/*! ../../base/template */ \"./src/base/template.js\");\n\nvar _template2 = _interopRequireDefault(_template);\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\nvar _events = __webpack_require__(/*! ../../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _playback = __webpack_require__(/*! ../../base/playback */ \"./src/base/playback.js\");\n\nvar _playback2 = _interopRequireDefault(_playback);\n\nvar _Player = __webpack_require__(/*! ./public/Player.swf */ \"./src/playbacks/flash/public/Player.swf\");\n\nvar _Player2 = _interopRequireDefault(_Player);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar MAX_ATTEMPTS = 60; // Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar Flash = function (_BaseFlashPlayback) {\n (0, _inherits3.default)(Flash, _BaseFlashPlayback);\n (0, _createClass3.default)(Flash, [{\n key: 'name',\n get: function get() {\n return 'flash';\n }\n }, {\n key: 'swfPath',\n get: function get() {\n return (0, _template2.default)(_Player2.default)({ baseUrl: this._baseUrl });\n }\n\n /**\n * Determine if the playback has ended.\n * @property ended\n * @type Boolean\n */\n\n }, {\n key: 'ended',\n get: function get() {\n return this._currentState === 'ENDED';\n }\n\n /**\n * Determine if the playback is buffering.\n * This is related to the PLAYBACK_BUFFERING and PLAYBACK_BUFFERFULL events\n * @property buffering\n * @type Boolean\n */\n\n }, {\n key: 'buffering',\n get: function get() {\n return !!this._bufferingState && this._currentState !== 'ENDED';\n }\n }]);\n\n function Flash() {\n (0, _classCallCheck3.default)(this, Flash);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _BaseFlashPlayback.call.apply(_BaseFlashPlayback, [this].concat(args)));\n\n _this._src = _this.options.src;\n _this._baseUrl = _this.options.baseUrl;\n _this._autoPlay = _this.options.autoPlay;\n _this.settings = { default: ['seekbar'] };\n _this.settings.left = ['playpause', 'position', 'duration'];\n _this.settings.right = ['fullscreen', 'volume'];\n _this.settings.seekEnabled = true;\n _this._isReadyState = false;\n _this._addListeners();\n return _this;\n }\n\n Flash.prototype._bootstrap = function _bootstrap() {\n var _this2 = this;\n\n if (this.el.playerPlay) {\n this.el.width = '100%';\n this.el.height = '100%';\n if (this._currentState === 'PLAYING') {\n this._firstPlay();\n } else {\n this._currentState = 'IDLE';\n this._autoPlay && this.play();\n }\n (0, _clapprZepto2.default)('
').insertAfter(this.$el);\n if (this.getDuration() > 0) this._metadataLoaded();else _mediator2.default.once(this.uniqueId + ':timeupdate', this._metadataLoaded, this);\n } else {\n this._attempts = this._attempts || 0;\n if (++this._attempts <= MAX_ATTEMPTS) setTimeout(function () {\n return _this2._bootstrap();\n }, 50);else this.trigger(_events2.default.PLAYBACK_ERROR, { message: 'Max number of attempts reached' }, this.name);\n }\n };\n\n Flash.prototype._metadataLoaded = function _metadataLoaded() {\n this._isReadyState = true;\n this.trigger(_events2.default.PLAYBACK_READY, this.name);\n this.trigger(_events2.default.PLAYBACK_SETTINGSUPDATE, this.name);\n };\n\n Flash.prototype.getPlaybackType = function getPlaybackType() {\n return _playback2.default.VOD;\n };\n\n Flash.prototype.isHighDefinitionInUse = function isHighDefinitionInUse() {\n return false;\n };\n\n Flash.prototype._updateTime = function _updateTime() {\n this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: this.el.getPosition(), total: this.el.getDuration() }, this.name);\n };\n\n Flash.prototype._addListeners = function _addListeners() {\n _mediator2.default.on(this.uniqueId + ':progress', this._progress, this);\n _mediator2.default.on(this.uniqueId + ':timeupdate', this._updateTime, this);\n _mediator2.default.on(this.uniqueId + ':statechanged', this._checkState, this);\n _mediator2.default.on(this.uniqueId + ':flashready', this._bootstrap, this);\n };\n\n Flash.prototype.stopListening = function stopListening() {\n _BaseFlashPlayback.prototype.stopListening.call(this);\n _mediator2.default.off(this.uniqueId + ':progress');\n _mediator2.default.off(this.uniqueId + ':timeupdate');\n _mediator2.default.off(this.uniqueId + ':statechanged');\n _mediator2.default.off(this.uniqueId + ':flashready');\n };\n\n Flash.prototype._checkState = function _checkState() {\n if (this._isIdle || this._currentState === 'PAUSED') {\n return;\n } else if (this._currentState !== 'PLAYING_BUFFERING' && this.el.getState() === 'PLAYING_BUFFERING') {\n this._bufferingState = true;\n this.trigger(_events2.default.PLAYBACK_BUFFERING, this.name);\n this._currentState = 'PLAYING_BUFFERING';\n } else if (this.el.getState() === 'PLAYING') {\n this._bufferingState = false;\n this.trigger(_events2.default.PLAYBACK_BUFFERFULL, this.name);\n this._currentState = 'PLAYING';\n } else if (this.el.getState() === 'IDLE') {\n this._currentState = 'IDLE';\n } else if (this.el.getState() === 'ENDED') {\n this.trigger(_events2.default.PLAYBACK_ENDED, this.name);\n this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: 0, total: this.el.getDuration() }, this.name);\n this._currentState = 'ENDED';\n this._isIdle = true;\n }\n };\n\n Flash.prototype._progress = function _progress() {\n if (this._currentState !== 'IDLE' && this._currentState !== 'ENDED') {\n this.trigger(_events2.default.PLAYBACK_PROGRESS, {\n start: 0,\n current: this.el.getBytesLoaded(),\n total: this.el.getBytesTotal()\n });\n }\n };\n\n Flash.prototype._firstPlay = function _firstPlay() {\n var _this3 = this;\n\n if (this.el.playerPlay) {\n this._isIdle = false;\n this.el.playerPlay(this._src);\n this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () {\n return _this3._checkInitialSeek();\n });\n this._currentState = 'PLAYING';\n } else {\n this.listenToOnce(this, _events2.default.PLAYBACK_READY, this._firstPlay);\n }\n };\n\n Flash.prototype._checkInitialSeek = function _checkInitialSeek() {\n var seekTime = (0, _utils.seekStringToSeconds)(window.location.href);\n if (seekTime !== 0) this.seekSeconds(seekTime);\n };\n\n Flash.prototype.play = function play() {\n this.trigger(_events2.default.PLAYBACK_PLAY_INTENT);\n if (this._currentState === 'PAUSED' || this._currentState === 'PLAYING_BUFFERING') {\n this._currentState = 'PLAYING';\n this.el.playerResume();\n this.trigger(_events2.default.PLAYBACK_PLAY, this.name);\n } else if (this._currentState !== 'PLAYING') {\n this._firstPlay();\n this.trigger(_events2.default.PLAYBACK_PLAY, this.name);\n }\n };\n\n Flash.prototype.volume = function volume(value) {\n var _this4 = this;\n\n if (this.isReady) this.el.playerVolume(value);else this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () {\n return _this4.volume(value);\n });\n };\n\n Flash.prototype.pause = function pause() {\n this._currentState = 'PAUSED';\n this.el.playerPause();\n this.trigger(_events2.default.PLAYBACK_PAUSE, this.name);\n };\n\n Flash.prototype.stop = function stop() {\n this.el.playerStop();\n this.trigger(_events2.default.PLAYBACK_STOP);\n this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: 0, total: 0 }, this.name);\n };\n\n Flash.prototype.isPlaying = function isPlaying() {\n return !!(this.isReady && this._currentState.indexOf('PLAYING') > -1);\n };\n\n Flash.prototype.getDuration = function getDuration() {\n return this.el.getDuration();\n };\n\n Flash.prototype.seekPercentage = function seekPercentage(percentage) {\n var _this5 = this;\n\n if (this.el.getDuration() > 0) {\n var seekSeconds = this.el.getDuration() * (percentage / 100);\n this.seek(seekSeconds);\n } else {\n this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () {\n return _this5.seekPercentage(percentage);\n });\n }\n };\n\n Flash.prototype.seek = function seek(time) {\n var _this6 = this;\n\n if (this.isReady && this.el.playerSeek) {\n this.el.playerSeek(time);\n this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: time, total: this.el.getDuration() }, this.name);\n if (this._currentState === 'PAUSED') this.el.playerPause();\n } else {\n this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () {\n return _this6.seek(time);\n });\n }\n };\n\n Flash.prototype.destroy = function destroy() {\n clearInterval(this.bootstrapId);\n _BaseFlashPlayback.prototype.stopListening.call(this);\n this.$el.remove();\n };\n\n (0, _createClass3.default)(Flash, [{\n key: 'isReady',\n get: function get() {\n return this._isReadyState;\n }\n }]);\n return Flash;\n}(_base_flash_playback2.default);\n\nexports.default = Flash;\n\n\nFlash.canPlay = function (resource) {\n if (!_browser2.default.hasFlash || !resource || resource.constructor !== String) {\n return false;\n } else {\n var resourceParts = resource.split('?')[0].match(/.*\\.(.*)$/) || [];\n return resourceParts.length > 1 && !_browser2.default.isMobile && resourceParts[1].toLowerCase().match(/^(mp4|mov|f4v|3gpp|3gp)$/);\n }\n};\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/flash/index.js\":\n/*!**************************************!*\\\n !*** ./src/playbacks/flash/index.js ***!\n \\**************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _flash = __webpack_require__(/*! ./flash */ \"./src/playbacks/flash/flash.js\");\n\nvar _flash2 = _interopRequireDefault(_flash);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _flash2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/flash/public/Player.swf\":\n/*!***********************************************!*\\\n !*** ./src/playbacks/flash/public/Player.swf ***!\n \\***********************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"<%=baseUrl%>/4b76590b32dab62bc95c1b7951efae78.swf\";\n\n/***/ }),\n\n/***/ \"./src/playbacks/flashls/flashls.js\":\n/*!******************************************!*\\\n !*** ./src/playbacks/flashls/flashls.js ***!\n \\******************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _base_flash_playback = __webpack_require__(/*! ../../playbacks/base_flash_playback */ \"./src/playbacks/base_flash_playback/index.js\");\n\nvar _base_flash_playback2 = _interopRequireDefault(_base_flash_playback);\n\nvar _events = __webpack_require__(/*! ../../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _template = __webpack_require__(/*! ../../base/template */ \"./src/base/template.js\");\n\nvar _template2 = _interopRequireDefault(_template);\n\nvar _playback = __webpack_require__(/*! ../../base/playback */ \"./src/base/playback.js\");\n\nvar _playback2 = _interopRequireDefault(_playback);\n\nvar _mediator = __webpack_require__(/*! ../../components/mediator */ \"./src/components/mediator.js\");\n\nvar _mediator2 = _interopRequireDefault(_mediator);\n\nvar _browser = __webpack_require__(/*! ../../components/browser */ \"./src/components/browser/index.js\");\n\nvar _browser2 = _interopRequireDefault(_browser);\n\nvar _error = __webpack_require__(/*! ../../components/error */ \"./src/components/error/index.js\");\n\nvar _error2 = _interopRequireDefault(_error);\n\nvar _flashls_events = __webpack_require__(/*! ./flashls_events */ \"./src/playbacks/flashls/flashls_events.js\");\n\nvar _flashls_events2 = _interopRequireDefault(_flashls_events);\n\nvar _HLSPlayer = __webpack_require__(/*! ./public/HLSPlayer.swf */ \"./src/playbacks/flashls/public/HLSPlayer.swf\");\n\nvar _HLSPlayer2 = _interopRequireDefault(_HLSPlayer);\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar MAX_ATTEMPTS = 60;\nvar AUTO = -1;\n\nvar FlasHLS = function (_BaseFlashPlayback) {\n (0, _inherits3.default)(FlasHLS, _BaseFlashPlayback);\n (0, _createClass3.default)(FlasHLS, [{\n key: 'name',\n get: function get() {\n return 'flashls';\n }\n }, {\n key: 'swfPath',\n get: function get() {\n return (0, _template2.default)(_HLSPlayer2.default)({ baseUrl: this._baseUrl });\n }\n }, {\n key: 'levels',\n get: function get() {\n return this._levels || [];\n }\n }, {\n key: 'currentLevel',\n get: function get() {\n if (this._currentLevel === null || this._currentLevel === undefined) return AUTO;else return this._currentLevel; //0 is a valid level ID\n },\n set: function set(id) {\n this._currentLevel = id;\n this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH_START);\n this.el.playerSetCurrentLevel(id);\n }\n\n /**\n * Determine if the playback has ended.\n * @property ended\n * @type Boolean\n */\n\n }, {\n key: 'ended',\n get: function get() {\n return this._hasEnded;\n }\n\n /**\n * Determine if the playback is buffering.\n * This is related to the PLAYBACK_BUFFERING and PLAYBACK_BUFFERFULL events\n * @property buffering\n * @type Boolean\n */\n\n }, {\n key: 'buffering',\n get: function get() {\n return !!this._bufferingState && !this._hasEnded;\n }\n }]);\n\n function FlasHLS() {\n (0, _classCallCheck3.default)(this, FlasHLS);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _BaseFlashPlayback.call.apply(_BaseFlashPlayback, [this].concat(args)));\n\n _this._src = _this.options.src;\n _this._baseUrl = _this.options.baseUrl;\n _this._initHlsParameters(_this.options);\n // TODO can this be private?\n _this.highDefinition = false;\n _this._autoPlay = _this.options.autoPlay;\n _this._loop = _this.options.loop;\n _this._defaultSettings = {\n left: ['playstop'],\n default: ['seekbar'],\n right: ['fullscreen', 'volume', 'hd-indicator'],\n seekEnabled: false\n };\n _this.settings = _clapprZepto2.default.extend({}, _this._defaultSettings);\n _this._playbackType = _playback2.default.LIVE;\n _this._hasEnded = false;\n _this._addListeners();\n return _this;\n }\n\n FlasHLS.prototype._initHlsParameters = function _initHlsParameters(options) {\n this._autoStartLoad = options.autoStartLoad === undefined ? true : options.autoStartLoad;\n this._capLevelToStage = options.capLevelToStage === undefined ? false : options.capLevelToStage;\n this._maxLevelCappingMode = options.maxLevelCappingMode === undefined ? 'downscale' : options.maxLevelCappingMode;\n this._minBufferLength = options.minBufferLength === undefined ? -1 : options.minBufferLength;\n this._minBufferLengthCapping = options.minBufferLengthCapping === undefined ? -1 : options.minBufferLengthCapping;\n this._maxBufferLength = options.maxBufferLength === undefined ? 120 : options.maxBufferLength;\n this._maxBackBufferLength = options.maxBackBufferLength === undefined ? 30 : options.maxBackBufferLength;\n this._lowBufferLength = options.lowBufferLength === undefined ? 3 : options.lowBufferLength;\n this._mediaTimePeriod = options.mediaTimePeriod === undefined ? 100 : options.mediaTimePeriod;\n this._fpsDroppedMonitoringPeriod = options.fpsDroppedMonitoringPeriod === undefined ? 5000 : options.fpsDroppedMonitoringPeriod;\n this._fpsDroppedMonitoringThreshold = options.fpsDroppedMonitoringThreshold === undefined ? 0.2 : options.fpsDroppedMonitoringThreshold;\n this._capLevelonFPSDrop = options.capLevelonFPSDrop === undefined ? false : options.capLevelonFPSDrop;\n this._smoothAutoSwitchonFPSDrop = options.smoothAutoSwitchonFPSDrop === undefined ? this.capLevelonFPSDrop : options.smoothAutoSwitchonFPSDrop;\n this._switchDownOnLevelError = options.switchDownOnLevelError === undefined ? true : options.switchDownOnLevelError;\n this._seekMode = options.seekMode === undefined ? 'ACCURATE' : options.seekMode;\n this._keyLoadMaxRetry = options.keyLoadMaxRetry === undefined ? 3 : options.keyLoadMaxRetry;\n this._keyLoadMaxRetryTimeout = options.keyLoadMaxRetryTimeout === undefined ? 64000 : options.keyLoadMaxRetryTimeout;\n this._fragmentLoadMaxRetry = options.fragmentLoadMaxRetry === undefined ? 3 : options.fragmentLoadMaxRetry;\n this._fragmentLoadMaxRetryTimeout = options.fragmentLoadMaxRetryTimeout === undefined ? 4000 : options.fragmentLoadMaxRetryTimeout;\n this._fragmentLoadSkipAfterMaxRetry = options.fragmentLoadSkipAfterMaxRetry === undefined ? true : options.fragmentLoadSkipAfterMaxRetry;\n this._maxSkippedFragments = options.maxSkippedFragments === undefined ? 5 : options.maxSkippedFragments;\n this._flushLiveURLCache = options.flushLiveURLCache === undefined ? false : options.flushLiveURLCache;\n this._initialLiveManifestSize = options.initialLiveManifestSize === undefined ? 1 : options.initialLiveManifestSize;\n this._manifestLoadMaxRetry = options.manifestLoadMaxRetry === undefined ? 3 : options.manifestLoadMaxRetry;\n this._manifestLoadMaxRetryTimeout = options.manifestLoadMaxRetryTimeout === undefined ? 64000 : options.manifestLoadMaxRetryTimeout;\n this._manifestRedundantLoadmaxRetry = options.manifestRedundantLoadmaxRetry === undefined ? 3 : options.manifestRedundantLoadmaxRetry;\n this._startFromBitrate = options.startFromBitrate === undefined ? -1 : options.startFromBitrate;\n this._startFromLevel = options.startFromLevel === undefined ? -1 : options.startFromLevel;\n this._autoStartMaxDuration = options.autoStartMaxDuration === undefined ? -1 : options.autoStartMaxDuration;\n this._seekFromLevel = options.seekFromLevel === undefined ? -1 : options.seekFromLevel;\n this._useHardwareVideoDecoder = options.useHardwareVideoDecoder === undefined ? false : options.useHardwareVideoDecoder;\n this._hlsLogEnabled = options.hlsLogEnabled === undefined ? true : options.hlsLogEnabled;\n this._logDebug = options.logDebug === undefined ? false : options.logDebug;\n this._logDebug2 = options.logDebug2 === undefined ? false : options.logDebug2;\n this._logWarn = options.logWarn === undefined ? true : options.logWarn;\n this._logError = options.logError === undefined ? true : options.logError;\n this._hlsMinimumDvrSize = options.hlsMinimumDvrSize === undefined ? 60 : options.hlsMinimumDvrSize;\n };\n\n FlasHLS.prototype._addListeners = function _addListeners() {\n var _this2 = this;\n\n _mediator2.default.on(this.cid + ':flashready', function () {\n return _this2._bootstrap();\n });\n _mediator2.default.on(this.cid + ':timeupdate', function (timeMetrics) {\n return _this2._updateTime(timeMetrics);\n });\n _mediator2.default.on(this.cid + ':playbackstate', function (state) {\n return _this2._setPlaybackState(state);\n });\n _mediator2.default.on(this.cid + ':levelchanged', function (level) {\n return _this2._levelChanged(level);\n });\n _mediator2.default.on(this.cid + ':error', function (code, url, message) {\n return _this2._flashPlaybackError(code, url, message);\n });\n _mediator2.default.on(this.cid + ':fragmentloaded', function (loadmetrics) {\n return _this2._onFragmentLoaded(loadmetrics);\n });\n _mediator2.default.on(this.cid + ':levelendlist', function (level) {\n return _this2._onLevelEndlist(level);\n });\n };\n\n FlasHLS.prototype.stopListening = function stopListening() {\n _BaseFlashPlayback.prototype.stopListening.call(this);\n _mediator2.default.off(this.cid + ':flashready');\n _mediator2.default.off(this.cid + ':timeupdate');\n _mediator2.default.off(this.cid + ':playbackstate');\n _mediator2.default.off(this.cid + ':levelchanged');\n _mediator2.default.off(this.cid + ':playbackerror');\n _mediator2.default.off(this.cid + ':fragmentloaded');\n _mediator2.default.off(this.cid + ':manifestloaded');\n _mediator2.default.off(this.cid + ':levelendlist');\n };\n\n FlasHLS.prototype._bootstrap = function _bootstrap() {\n var _this3 = this;\n\n if (this.el.playerLoad) {\n this.el.width = '100%';\n this.el.height = '100%';\n this._isReadyState = true;\n this._srcLoaded = false;\n this._currentState = 'IDLE';\n this._setFlashSettings();\n this._updatePlaybackType();\n if (this._autoPlay || this._shouldPlayOnManifestLoaded) this.play();\n\n this.trigger(_events2.default.PLAYBACK_READY, this.name);\n } else {\n this._bootstrapAttempts = this._bootstrapAttempts || 0;\n if (++this._bootstrapAttempts <= MAX_ATTEMPTS) {\n setTimeout(function () {\n return _this3._bootstrap();\n }, 50);\n } else {\n var formattedError = this.createError({\n code: 'playerLoadFail_maxNumberAttemptsReached',\n description: this.name + ' error: Max number of attempts reached',\n level: _error2.default.Levels.FATAL,\n raw: {}\n });\n this.trigger(_events2.default.PLAYBACK_ERROR, formattedError);\n }\n }\n };\n\n FlasHLS.prototype._setFlashSettings = function _setFlashSettings() {\n this.el.playerSetAutoStartLoad(this._autoStartLoad);\n this.el.playerSetCapLevelToStage(this._capLevelToStage);\n this.el.playerSetMaxLevelCappingMode(this._maxLevelCappingMode);\n this.el.playerSetMinBufferLength(this._minBufferLength);\n this.el.playerSetMinBufferLengthCapping(this._minBufferLengthCapping);\n this.el.playerSetMaxBufferLength(this._maxBufferLength);\n this.el.playerSetMaxBackBufferLength(this._maxBackBufferLength);\n this.el.playerSetLowBufferLength(this._lowBufferLength);\n this.el.playerSetMediaTimePeriod(this._mediaTimePeriod);\n this.el.playerSetFpsDroppedMonitoringPeriod(this._fpsDroppedMonitoringPeriod);\n this.el.playerSetFpsDroppedMonitoringThreshold(this._fpsDroppedMonitoringThreshold);\n this.el.playerSetCapLevelonFPSDrop(this._capLevelonFPSDrop);\n this.el.playerSetSmoothAutoSwitchonFPSDrop(this._smoothAutoSwitchonFPSDrop);\n this.el.playerSetSwitchDownOnLevelError(this._switchDownOnLevelError);\n this.el.playerSetSeekMode(this._seekMode);\n this.el.playerSetKeyLoadMaxRetry(this._keyLoadMaxRetry);\n this.el.playerSetKeyLoadMaxRetryTimeout(this._keyLoadMaxRetryTimeout);\n this.el.playerSetFragmentLoadMaxRetry(this._fragmentLoadMaxRetry);\n this.el.playerSetFragmentLoadMaxRetryTimeout(this._fragmentLoadMaxRetryTimeout);\n this.el.playerSetFragmentLoadSkipAfterMaxRetry(this._fragmentLoadSkipAfterMaxRetry);\n this.el.playerSetMaxSkippedFragments(this._maxSkippedFragments);\n this.el.playerSetFlushLiveURLCache(this._flushLiveURLCache);\n this.el.playerSetInitialLiveManifestSize(this._initialLiveManifestSize);\n this.el.playerSetManifestLoadMaxRetry(this._manifestLoadMaxRetry);\n this.el.playerSetManifestLoadMaxRetryTimeout(this._manifestLoadMaxRetryTimeout);\n this.el.playerSetManifestRedundantLoadmaxRetry(this._manifestRedundantLoadmaxRetry);\n this.el.playerSetStartFromBitrate(this._startFromBitrate);\n this.el.playerSetStartFromLevel(this._startFromLevel);\n this.el.playerSetAutoStartMaxDuration(this._autoStartMaxDuration);\n this.el.playerSetSeekFromLevel(this._seekFromLevel);\n this.el.playerSetUseHardwareVideoDecoder(this._useHardwareVideoDecoder);\n this.el.playerSetLogInfo(this._hlsLogEnabled);\n this.el.playerSetLogDebug(this._logDebug);\n this.el.playerSetLogDebug2(this._logDebug2);\n this.el.playerSetLogWarn(this._logWarn);\n this.el.playerSetLogError(this._logError);\n };\n\n FlasHLS.prototype.setAutoStartLoad = function setAutoStartLoad(autoStartLoad) {\n this._autoStartLoad = autoStartLoad;\n this.el.playerSetAutoStartLoad(this._autoStartLoad);\n };\n\n FlasHLS.prototype.setCapLevelToStage = function setCapLevelToStage(capLevelToStage) {\n this._capLevelToStage = capLevelToStage;\n this.el.playerSetCapLevelToStage(this._capLevelToStage);\n };\n\n FlasHLS.prototype.setMaxLevelCappingMode = function setMaxLevelCappingMode(maxLevelCappingMode) {\n this._maxLevelCappingMode = maxLevelCappingMode;\n this.el.playerSetMaxLevelCappingMode(this._maxLevelCappingMode);\n };\n\n FlasHLS.prototype.setSetMinBufferLength = function setSetMinBufferLength(minBufferLength) {\n this._minBufferLength = minBufferLength;\n this.el.playerSetMinBufferLength(this._minBufferLength);\n };\n\n FlasHLS.prototype.setMinBufferLengthCapping = function setMinBufferLengthCapping(minBufferLengthCapping) {\n this._minBufferLengthCapping = minBufferLengthCapping;\n this.el.playerSetMinBufferLengthCapping(this._minBufferLengthCapping);\n };\n\n FlasHLS.prototype.setMaxBufferLength = function setMaxBufferLength(maxBufferLength) {\n this._maxBufferLength = maxBufferLength;\n this.el.playerSetMaxBufferLength(this._maxBufferLength);\n };\n\n FlasHLS.prototype.setMaxBackBufferLength = function setMaxBackBufferLength(maxBackBufferLength) {\n this._maxBackBufferLength = maxBackBufferLength;\n this.el.playerSetMaxBackBufferLength(this._maxBackBufferLength);\n };\n\n FlasHLS.prototype.setLowBufferLength = function setLowBufferLength(lowBufferLength) {\n this._lowBufferLength = lowBufferLength;\n this.el.playerSetLowBufferLength(this._lowBufferLength);\n };\n\n FlasHLS.prototype.setMediaTimePeriod = function setMediaTimePeriod(mediaTimePeriod) {\n this._mediaTimePeriod = mediaTimePeriod;\n this.el.playerSetMediaTimePeriod(this._mediaTimePeriod);\n };\n\n FlasHLS.prototype.setFpsDroppedMonitoringPeriod = function setFpsDroppedMonitoringPeriod(fpsDroppedMonitoringPeriod) {\n this._fpsDroppedMonitoringPeriod = fpsDroppedMonitoringPeriod;\n this.el.playerSetFpsDroppedMonitoringPeriod(this._fpsDroppedMonitoringPeriod);\n };\n\n FlasHLS.prototype.setFpsDroppedMonitoringThreshold = function setFpsDroppedMonitoringThreshold(fpsDroppedMonitoringThreshold) {\n this._fpsDroppedMonitoringThreshold = fpsDroppedMonitoringThreshold;\n this.el.playerSetFpsDroppedMonitoringThreshold(this._fpsDroppedMonitoringThreshold);\n };\n\n FlasHLS.prototype.setCapLevelonFPSDrop = function setCapLevelonFPSDrop(capLevelonFPSDrop) {\n this._capLevelonFPSDrop = capLevelonFPSDrop;\n this.el.playerSetCapLevelonFPSDrop(this._capLevelonFPSDrop);\n };\n\n FlasHLS.prototype.setSmoothAutoSwitchonFPSDrop = function setSmoothAutoSwitchonFPSDrop(smoothAutoSwitchonFPSDrop) {\n this._smoothAutoSwitchonFPSDrop = smoothAutoSwitchonFPSDrop;\n this.el.playerSetSmoothAutoSwitchonFPSDrop(this._smoothAutoSwitchonFPSDrop);\n };\n\n FlasHLS.prototype.setSwitchDownOnLevelError = function setSwitchDownOnLevelError(switchDownOnLevelError) {\n this._switchDownOnLevelError = switchDownOnLevelError;\n this.el.playerSetSwitchDownOnLevelError(this._switchDownOnLevelError);\n };\n\n FlasHLS.prototype.setSeekMode = function setSeekMode(seekMode) {\n this._seekMode = seekMode;\n this.el.playerSetSeekMode(this._seekMode);\n };\n\n FlasHLS.prototype.setKeyLoadMaxRetry = function setKeyLoadMaxRetry(keyLoadMaxRetry) {\n this._keyLoadMaxRetry = keyLoadMaxRetry;\n this.el.playerSetKeyLoadMaxRetry(this._keyLoadMaxRetry);\n };\n\n FlasHLS.prototype.setKeyLoadMaxRetryTimeout = function setKeyLoadMaxRetryTimeout(keyLoadMaxRetryTimeout) {\n this._keyLoadMaxRetryTimeout = keyLoadMaxRetryTimeout;\n this.el.playerSetKeyLoadMaxRetryTimeout(this._keyLoadMaxRetryTimeout);\n };\n\n FlasHLS.prototype.setFragmentLoadMaxRetry = function setFragmentLoadMaxRetry(fragmentLoadMaxRetry) {\n this._fragmentLoadMaxRetry = fragmentLoadMaxRetry;\n this.el.playerSetFragmentLoadMaxRetry(this._fragmentLoadMaxRetry);\n };\n\n FlasHLS.prototype.setFragmentLoadMaxRetryTimeout = function setFragmentLoadMaxRetryTimeout(fragmentLoadMaxRetryTimeout) {\n this._fragmentLoadMaxRetryTimeout = fragmentLoadMaxRetryTimeout;\n this.el.playerSetFragmentLoadMaxRetryTimeout(this._fragmentLoadMaxRetryTimeout);\n };\n\n FlasHLS.prototype.setFragmentLoadSkipAfterMaxRetry = function setFragmentLoadSkipAfterMaxRetry(fragmentLoadSkipAfterMaxRetry) {\n this._fragmentLoadSkipAfterMaxRetry = fragmentLoadSkipAfterMaxRetry;\n this.el.playerSetFragmentLoadSkipAfterMaxRetry(this._fragmentLoadSkipAfterMaxRetry);\n };\n\n FlasHLS.prototype.setMaxSkippedFragments = function setMaxSkippedFragments(maxSkippedFragments) {\n this._maxSkippedFragments = maxSkippedFragments;\n this.el.playerSetMaxSkippedFragments(this._maxSkippedFragments);\n };\n\n FlasHLS.prototype.setFlushLiveURLCache = function setFlushLiveURLCache(flushLiveURLCache) {\n this._flushLiveURLCache = flushLiveURLCache;\n this.el.playerSetFlushLiveURLCache(this._flushLiveURLCache);\n };\n\n FlasHLS.prototype.setInitialLiveManifestSize = function setInitialLiveManifestSize(initialLiveManifestSize) {\n this._initialLiveManifestSize = initialLiveManifestSize;\n this.el.playerSetInitialLiveManifestSize(this._initialLiveManifestSize);\n };\n\n FlasHLS.prototype.setManifestLoadMaxRetry = function setManifestLoadMaxRetry(manifestLoadMaxRetry) {\n this._manifestLoadMaxRetry = manifestLoadMaxRetry;\n this.el.playerSetManifestLoadMaxRetry(this._manifestLoadMaxRetry);\n };\n\n FlasHLS.prototype.setManifestLoadMaxRetryTimeout = function setManifestLoadMaxRetryTimeout(manifestLoadMaxRetryTimeout) {\n this._manifestLoadMaxRetryTimeout = manifestLoadMaxRetryTimeout;\n this.el.playerSetManifestLoadMaxRetryTimeout(this._manifestLoadMaxRetryTimeout);\n };\n\n FlasHLS.prototype.setManifestRedundantLoadmaxRetry = function setManifestRedundantLoadmaxRetry(manifestRedundantLoadmaxRetry) {\n this._manifestRedundantLoadmaxRetry = manifestRedundantLoadmaxRetry;\n this.el.playerSetManifestRedundantLoadmaxRetry(this._manifestRedundantLoadmaxRetry);\n };\n\n FlasHLS.prototype.setStartFromBitrate = function setStartFromBitrate(startFromBitrate) {\n this._startFromBitrate = startFromBitrate;\n this.el.playerSetStartFromBitrate(this._startFromBitrate);\n };\n\n FlasHLS.prototype.setStartFromLevel = function setStartFromLevel(startFromLevel) {\n this._startFromLevel = startFromLevel;\n this.el.playerSetStartFromLevel(this._startFromLevel);\n };\n\n FlasHLS.prototype.setAutoStartMaxDuration = function setAutoStartMaxDuration(autoStartMaxDuration) {\n this._autoStartMaxDuration = autoStartMaxDuration;\n this.el.playerSetAutoStartMaxDuration(this._autoStartMaxDuration);\n };\n\n FlasHLS.prototype.setSeekFromLevel = function setSeekFromLevel(seekFromLevel) {\n this._seekFromLevel = seekFromLevel;\n this.el.playerSetSeekFromLevel(this._seekFromLevel);\n };\n\n FlasHLS.prototype.setUseHardwareVideoDecoder = function setUseHardwareVideoDecoder(useHardwareVideoDecoder) {\n this._useHardwareVideoDecoder = useHardwareVideoDecoder;\n this.el.playerSetUseHardwareVideoDecoder(this._useHardwareVideoDecoder);\n };\n\n FlasHLS.prototype.setSetLogInfo = function setSetLogInfo(hlsLogEnabled) {\n this._hlsLogEnabled = hlsLogEnabled;\n this.el.playerSetLogInfo(this._hlsLogEnabled);\n };\n\n FlasHLS.prototype.setLogDebug = function setLogDebug(logDebug) {\n this._logDebug = logDebug;\n this.el.playerSetLogDebug(this._logDebug);\n };\n\n FlasHLS.prototype.setLogDebug2 = function setLogDebug2(logDebug2) {\n this._logDebug2 = logDebug2;\n this.el.playerSetLogDebug2(this._logDebug2);\n };\n\n FlasHLS.prototype.setLogWarn = function setLogWarn(logWarn) {\n this._logWarn = logWarn;\n this.el.playerSetLogWarn(this._logWarn);\n };\n\n FlasHLS.prototype.setLogError = function setLogError(logError) {\n this._logError = logError;\n this.el.playerSetLogError(this._logError);\n };\n\n FlasHLS.prototype._levelChanged = function _levelChanged(level) {\n var currentLevel = this.el.getLevels()[level];\n if (currentLevel) {\n this.highDefinition = currentLevel.height >= 720 || currentLevel.bitrate / 1000 >= 2000;\n this.trigger(_events2.default.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinition);\n\n if (!this._levels || this._levels.length === 0) this._fillLevels();\n\n this.trigger(_events2.default.PLAYBACK_BITRATE, {\n height: currentLevel.height,\n width: currentLevel.width,\n bandwidth: currentLevel.bitrate,\n bitrate: currentLevel.bitrate,\n level: level\n });\n this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH_END);\n }\n };\n\n FlasHLS.prototype._updateTime = function _updateTime(timeMetrics) {\n if (this._currentState === 'IDLE') return;\n\n var duration = this._normalizeDuration(timeMetrics.duration);\n var position = Math.min(Math.max(timeMetrics.position, 0), duration);\n var previousDVRStatus = this._dvrEnabled;\n var livePlayback = this._playbackType === _playback2.default.LIVE;\n this._dvrEnabled = livePlayback && duration > this._hlsMinimumDvrSize;\n\n if (duration === 100 || livePlayback === undefined) return;\n\n if (this._dvrEnabled !== previousDVRStatus) {\n this._updateSettings();\n this.trigger(_events2.default.PLAYBACK_SETTINGSUPDATE, this.name);\n }\n\n if (livePlayback && !this._dvrEnabled) position = duration;\n\n this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: position, total: duration }, this.name);\n };\n\n FlasHLS.prototype.play = function play() {\n this.trigger(_events2.default.PLAYBACK_PLAY_INTENT);\n if (this._currentState === 'PAUSED') this.el.playerResume();else if (!this._srcLoaded && this._currentState !== 'PLAYING') this._firstPlay();else this.el.playerPlay();\n };\n\n FlasHLS.prototype.getPlaybackType = function getPlaybackType() {\n return this._playbackType ? this._playbackType : null;\n };\n\n FlasHLS.prototype.getCurrentTime = function getCurrentTime() {\n return this.el.getPosition();\n };\n\n FlasHLS.prototype.getCurrentLevelIndex = function getCurrentLevelIndex() {\n return this._currentLevel;\n };\n\n FlasHLS.prototype.getCurrentLevel = function getCurrentLevel() {\n return this.levels[this.currentLevel];\n };\n\n FlasHLS.prototype.getCurrentBitrate = function getCurrentBitrate() {\n return this.levels[this.currentLevel].bitrate;\n };\n\n FlasHLS.prototype.setCurrentLevel = function setCurrentLevel(level) {\n this.currentLevel = level;\n };\n\n FlasHLS.prototype.isHighDefinitionInUse = function isHighDefinitionInUse() {\n return this.highDefinition;\n };\n\n FlasHLS.prototype.getLevels = function getLevels() {\n return this.levels;\n };\n\n FlasHLS.prototype._setPlaybackState = function _setPlaybackState(state) {\n if (['PLAYING_BUFFERING', 'PAUSED_BUFFERING'].indexOf(state) >= 0) {\n this._bufferingState = true;\n this.trigger(_events2.default.PLAYBACK_BUFFERING, this.name);\n this._updateCurrentState(state);\n } else if (['PLAYING', 'PAUSED'].indexOf(state) >= 0) {\n if (['PLAYING_BUFFERING', 'PAUSED_BUFFERING', 'IDLE'].indexOf(this._currentState) >= 0) {\n this._bufferingState = false;\n this.trigger(_events2.default.PLAYBACK_BUFFERFULL, this.name);\n }\n this._updateCurrentState(state);\n } else if (state === 'IDLE') {\n this._srcLoaded = false;\n if (this._loop && ['PLAYING_BUFFERING', 'PLAYING'].indexOf(this._currentState) >= 0) {\n this.play();\n this.seek(0);\n } else {\n this._updateCurrentState(state);\n this._hasEnded = true;\n this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: 0, total: this.getDuration() }, this.name);\n this.trigger(_events2.default.PLAYBACK_ENDED, this.name);\n }\n }\n };\n\n FlasHLS.prototype._updateCurrentState = function _updateCurrentState(state) {\n this._currentState = state;\n if (state !== 'IDLE') this._hasEnded = false;\n\n this._updatePlaybackType();\n if (state === 'PLAYING') this.trigger(_events2.default.PLAYBACK_PLAY, this.name);else if (state === 'PAUSED') this.trigger(_events2.default.PLAYBACK_PAUSE, this.name);\n };\n\n FlasHLS.prototype._updatePlaybackType = function _updatePlaybackType() {\n this._playbackType = this.el.getType();\n if (this._playbackType) {\n this._playbackType = this._playbackType.toLowerCase();\n if (this._playbackType === _playback2.default.VOD) this._startReportingProgress();else this._stopReportingProgress();\n }\n this.trigger(_events2.default.PLAYBACK_PLAYBACKSTATE, { type: this._playbackType });\n };\n\n FlasHLS.prototype._startReportingProgress = function _startReportingProgress() {\n if (!this._reportingProgress) this._reportingProgress = true;\n };\n\n FlasHLS.prototype._stopReportingProgress = function _stopReportingProgress() {\n this._reportingProgress = false;\n };\n\n FlasHLS.prototype._onFragmentLoaded = function _onFragmentLoaded(loadmetrics) {\n this.trigger(_events2.default.PLAYBACK_FRAGMENT_LOADED, loadmetrics);\n if (this._reportingProgress && this.getCurrentTime()) {\n var buffered = this.getCurrentTime() + this.el.getbufferLength();\n this.trigger(_events2.default.PLAYBACK_PROGRESS, {\n start: this.getCurrentTime(),\n current: buffered,\n total: this.el.getDuration()\n });\n }\n };\n\n FlasHLS.prototype._onLevelEndlist = function _onLevelEndlist() {\n this._updatePlaybackType();\n };\n\n FlasHLS.prototype._firstPlay = function _firstPlay() {\n var _this4 = this;\n\n this._shouldPlayOnManifestLoaded = true;\n if (this.el.playerLoad) {\n _mediator2.default.once(this.cid + ':manifestloaded', function (duration, loadmetrics) {\n return _this4._manifestLoaded(duration, loadmetrics);\n });\n this._setFlashSettings(); //ensure flushLiveURLCache will work (#327)\n this.el.playerLoad(this._src);\n this._srcLoaded = true;\n }\n };\n\n FlasHLS.prototype.volume = function volume(value) {\n var _this5 = this;\n\n if (this.isReady) this.el.playerVolume(value);else this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () {\n return _this5.volume(value);\n });\n };\n\n FlasHLS.prototype.pause = function pause() {\n if (this._playbackType !== _playback2.default.LIVE || this._dvrEnabled) {\n this.el.playerPause();\n if (this._playbackType === _playback2.default.LIVE && this._dvrEnabled) this._updateDvr(true);\n }\n };\n\n FlasHLS.prototype.stop = function stop() {\n this._srcLoaded = false;\n this.el.playerStop();\n this.trigger(_events2.default.PLAYBACK_STOP);\n this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: 0, total: 0 }, this.name);\n };\n\n FlasHLS.prototype.isPlaying = function isPlaying() {\n if (this._currentState) return !!this._currentState.match(/playing/i);\n\n return false;\n };\n\n FlasHLS.prototype.getDuration = function getDuration() {\n return this._normalizeDuration(this.el.getDuration());\n };\n\n FlasHLS.prototype._normalizeDuration = function _normalizeDuration(duration) {\n if (this._playbackType === _playback2.default.LIVE) {\n // estimate 10 seconds of buffer time for live streams for seek positions\n duration = Math.max(0, duration - 10);\n }\n return duration;\n };\n\n FlasHLS.prototype.seekPercentage = function seekPercentage(percentage) {\n var duration = this.el.getDuration();\n var time = 0;\n if (percentage > 0) time = duration * percentage / 100;\n\n this.seek(time);\n };\n\n FlasHLS.prototype.seek = function seek(time) {\n var duration = this.getDuration();\n if (this._playbackType === _playback2.default.LIVE) {\n // seek operations to a time within 3 seconds from live stream will position playhead back to live\n var dvrInUse = duration - time > 3;\n this._updateDvr(dvrInUse);\n }\n this.el.playerSeek(time);\n this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: time, total: duration }, this.name);\n };\n\n FlasHLS.prototype._updateDvr = function _updateDvr(dvrInUse) {\n var previousDvrInUse = !!this._dvrInUse;\n this._dvrInUse = dvrInUse;\n if (this._dvrInUse !== previousDvrInUse) {\n this._updateSettings();\n this.trigger(_events2.default.PLAYBACK_DVR, this._dvrInUse);\n this.trigger(_events2.default.PLAYBACK_STATS_ADD, { 'dvr': this._dvrInUse });\n }\n };\n\n FlasHLS.prototype._flashPlaybackError = function _flashPlaybackError(code, url, message) {\n var error = {\n code: code,\n description: message,\n level: _error2.default.Levels.FATAL,\n raw: { code: code, url: url, message: message }\n };\n var formattedError = this.createError(error);\n this.trigger(_events2.default.PLAYBACK_ERROR, formattedError);\n this.trigger(_events2.default.PLAYBACK_STOP);\n };\n\n FlasHLS.prototype._manifestLoaded = function _manifestLoaded(duration, loadmetrics) {\n if (this._shouldPlayOnManifestLoaded) {\n this._shouldPlayOnManifestLoaded = false;\n // this method initialises the player (and starts playback)\n // this needs to happen before PLAYBACK_LOADEDMETADATA is fired\n // as the user may call seek() in a LOADEDMETADATA listener.\n /// when playerPlay() is called the player seeks to 0\n this.el.playerPlay();\n }\n\n this._fillLevels();\n this.trigger(_events2.default.PLAYBACK_LOADEDMETADATA, { duration: duration, data: loadmetrics });\n };\n\n FlasHLS.prototype._fillLevels = function _fillLevels() {\n var levels = this.el.getLevels();\n var levelsLength = levels.length;\n this._levels = [];\n\n for (var index = 0; index < levelsLength; index++) {\n this._levels.push({ id: index, label: levels[index].height + 'p', level: levels[index] });\n }this.trigger(_events2.default.PLAYBACK_LEVELS_AVAILABLE, this._levels);\n };\n\n FlasHLS.prototype.destroy = function destroy() {\n this.stopListening();\n this.$el.remove();\n };\n\n FlasHLS.prototype._updateSettings = function _updateSettings() {\n this.settings = _clapprZepto2.default.extend({}, this._defaultSettings);\n if (this._playbackType === _playback2.default.VOD || this._dvrInUse) {\n this.settings.left = ['playpause', 'position', 'duration'];\n this.settings.seekEnabled = true;\n } else if (this._dvrEnabled) {\n this.settings.left = ['playpause'];\n this.settings.seekEnabled = true;\n } else {\n this.settings.seekEnabled = false;\n }\n };\n\n FlasHLS.prototype._createCallbacks = function _createCallbacks() {\n var _this6 = this;\n\n if (!window.Clappr) window.Clappr = {};\n\n if (!window.Clappr.flashlsCallbacks) window.Clappr.flashlsCallbacks = {};\n\n this.flashlsEvents = new _flashls_events2.default(this.cid);\n window.Clappr.flashlsCallbacks[this.cid] = function (eventName, args) {\n _this6.flashlsEvents[eventName].apply(_this6.flashlsEvents, args);\n };\n };\n\n FlasHLS.prototype.render = function render() {\n _BaseFlashPlayback.prototype.render.call(this);\n this._createCallbacks();\n return this;\n };\n\n (0, _createClass3.default)(FlasHLS, [{\n key: 'isReady',\n get: function get() {\n return this._isReadyState;\n }\n }, {\n key: 'dvrEnabled',\n get: function get() {\n return !!this._dvrEnabled;\n }\n }]);\n return FlasHLS;\n}(_base_flash_playback2.default);\n\nexports.default = FlasHLS;\n\n\nFlasHLS.canPlay = function (resource, mimeType) {\n var resourceParts = resource.split('?')[0].match(/.*\\.(.*)$/) || [];\n return _browser2.default.hasFlash && (resourceParts.length > 1 && resourceParts[1].toLowerCase() === 'm3u8' || mimeType === 'application/x-mpegURL' || mimeType === 'application/vnd.apple.mpegurl');\n};\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/flashls/flashls_events.js\":\n/*!*************************************************!*\\\n !*** ./src/playbacks/flashls/flashls_events.js ***!\n \\*************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _mediator = __webpack_require__(/*! ../../components/mediator */ \"./src/components/mediator.js\");\n\nvar _mediator2 = _interopRequireDefault(_mediator);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar HLSEvents = function () {\n function HLSEvents(instanceId) {\n (0, _classCallCheck3.default)(this, HLSEvents);\n\n this.instanceId = instanceId;\n }\n\n HLSEvents.prototype.ready = function ready() {\n _mediator2.default.trigger(this.instanceId + ':flashready');\n };\n\n HLSEvents.prototype.videoSize = function videoSize(width, height) {\n _mediator2.default.trigger(this.instanceId + ':videosizechanged', width, height);\n };\n\n HLSEvents.prototype.complete = function complete() {\n _mediator2.default.trigger(this.instanceId + ':complete');\n };\n\n HLSEvents.prototype.error = function error(code, url, message) {\n _mediator2.default.trigger(this.instanceId + ':error', code, url, message);\n };\n\n HLSEvents.prototype.manifest = function manifest(duration, loadmetrics) {\n _mediator2.default.trigger(this.instanceId + ':manifestloaded', duration, loadmetrics);\n };\n\n HLSEvents.prototype.audioLevelLoaded = function audioLevelLoaded(loadmetrics) {\n _mediator2.default.trigger(this.instanceId + ':audiolevelloaded', loadmetrics);\n };\n\n HLSEvents.prototype.levelLoaded = function levelLoaded(loadmetrics) {\n _mediator2.default.trigger(this.instanceId + ':levelloaded', loadmetrics);\n };\n\n HLSEvents.prototype.levelEndlist = function levelEndlist(level) {\n _mediator2.default.trigger(this.instanceId + ':levelendlist', level);\n };\n\n HLSEvents.prototype.fragmentLoaded = function fragmentLoaded(loadmetrics) {\n _mediator2.default.trigger(this.instanceId + ':fragmentloaded', loadmetrics);\n };\n\n HLSEvents.prototype.fragmentPlaying = function fragmentPlaying(playmetrics) {\n _mediator2.default.trigger(this.instanceId + ':fragmentplaying', playmetrics);\n };\n\n HLSEvents.prototype.position = function position(timemetrics) {\n _mediator2.default.trigger(this.instanceId + ':timeupdate', timemetrics);\n };\n\n HLSEvents.prototype.state = function state(newState) {\n _mediator2.default.trigger(this.instanceId + ':playbackstate', newState);\n };\n\n HLSEvents.prototype.seekState = function seekState(newState) {\n _mediator2.default.trigger(this.instanceId + ':seekstate', newState);\n };\n\n HLSEvents.prototype.switch = function _switch(newLevel) {\n _mediator2.default.trigger(this.instanceId + ':levelchanged', newLevel);\n };\n\n HLSEvents.prototype.audioTracksListChange = function audioTracksListChange(trackList) {\n _mediator2.default.trigger(this.instanceId + ':audiotracklistchanged', trackList);\n };\n\n HLSEvents.prototype.audioTrackChange = function audioTrackChange(trackId) {\n _mediator2.default.trigger(this.instanceId + ':audiotrackchanged', trackId);\n };\n\n return HLSEvents;\n}();\n\nexports.default = HLSEvents;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/flashls/index.js\":\n/*!****************************************!*\\\n !*** ./src/playbacks/flashls/index.js ***!\n \\****************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _flashls = __webpack_require__(/*! ./flashls */ \"./src/playbacks/flashls/flashls.js\");\n\nvar _flashls2 = _interopRequireDefault(_flashls);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _flashls2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/flashls/public/HLSPlayer.swf\":\n/*!****************************************************!*\\\n !*** ./src/playbacks/flashls/public/HLSPlayer.swf ***!\n \\****************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nmodule.exports = \"<%=baseUrl%>/8fa12a459188502b9f0d39b8a67d9e6c.swf\";\n\n/***/ }),\n\n/***/ \"./src/playbacks/hls/hls.js\":\n/*!**********************************!*\\\n !*** ./src/playbacks/hls/hls.js ***!\n \\**********************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _toConsumableArray2 = __webpack_require__(/*! babel-runtime/helpers/toConsumableArray */ \"./node_modules/babel-runtime/helpers/toConsumableArray.js\");\n\nvar _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);\n\nvar _stringify = __webpack_require__(/*! babel-runtime/core-js/json/stringify */ \"./node_modules/babel-runtime/core-js/json/stringify.js\");\n\nvar _stringify2 = _interopRequireDefault(_stringify);\n\nvar _extends2 = __webpack_require__(/*! babel-runtime/helpers/extends */ \"./node_modules/babel-runtime/helpers/extends.js\");\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _html5_video = __webpack_require__(/*! ../../playbacks/html5_video */ \"./src/playbacks/html5_video/index.js\");\n\nvar _html5_video2 = _interopRequireDefault(_html5_video);\n\nvar _hls = __webpack_require__(/*! hls.js */ \"./node_modules/hls.js/dist/hls.js\");\n\nvar _hls2 = _interopRequireDefault(_hls);\n\nvar _events = __webpack_require__(/*! ../../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _playback = __webpack_require__(/*! ../../base/playback */ \"./src/base/playback.js\");\n\nvar _playback2 = _interopRequireDefault(_playback);\n\nvar _utils = __webpack_require__(/*! ../../base/utils */ \"./src/base/utils.js\");\n\nvar _log = __webpack_require__(/*! ../../plugins/log */ \"./src/plugins/log/index.js\");\n\nvar _log2 = _interopRequireDefault(_log);\n\nvar _error = __webpack_require__(/*! ../../components/error */ \"./src/components/error/index.js\");\n\nvar _error2 = _interopRequireDefault(_error);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar AUTO = -1; // Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar HLS = function (_HTML5VideoPlayback) {\n (0, _inherits3.default)(HLS, _HTML5VideoPlayback);\n (0, _createClass3.default)(HLS, [{\n key: 'name',\n get: function get() {\n return 'hls';\n }\n }, {\n key: 'levels',\n get: function get() {\n return this._levels || [];\n }\n }, {\n key: 'currentLevel',\n get: function get() {\n if (this._currentLevel === null || this._currentLevel === undefined) return AUTO;else return this._currentLevel; //0 is a valid level ID\n },\n set: function set(id) {\n this._currentLevel = id;\n this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH_START);\n if (this.options.playback.hlsUseNextLevel) this._hls.nextLevel = this._currentLevel;else this._hls.currentLevel = this._currentLevel;\n }\n }, {\n key: 'isReady',\n get: function get() {\n return this._isReadyState;\n }\n }, {\n key: '_startTime',\n get: function get() {\n if (this._playbackType === _playback2.default.LIVE && this._playlistType !== 'EVENT') return this._extrapolatedStartTime;\n\n return this._playableRegionStartTime;\n }\n }, {\n key: '_now',\n get: function get() {\n return (0, _utils.now)();\n }\n\n // the time in the video element which should represent the start of the sliding window\n // extrapolated to increase in real time (instead of jumping as the early segments are removed)\n\n }, {\n key: '_extrapolatedStartTime',\n get: function get() {\n if (!this._localStartTimeCorrelation) return this._playableRegionStartTime;\n\n var corr = this._localStartTimeCorrelation;\n var timePassed = this._now - corr.local;\n var extrapolatedWindowStartTime = (corr.remote + timePassed) / 1000;\n // cap at the end of the extrapolated window duration\n return Math.min(extrapolatedWindowStartTime, this._playableRegionStartTime + this._extrapolatedWindowDuration);\n }\n\n // the time in the video element which should represent the end of the content\n // extrapolated to increase in real time (instead of jumping as segments are added)\n\n }, {\n key: '_extrapolatedEndTime',\n get: function get() {\n var actualEndTime = this._playableRegionStartTime + this._playableRegionDuration;\n if (!this._localEndTimeCorrelation) return actualEndTime;\n\n var corr = this._localEndTimeCorrelation;\n var timePassed = this._now - corr.local;\n var extrapolatedEndTime = (corr.remote + timePassed) / 1000;\n return Math.max(actualEndTime - this._extrapolatedWindowDuration, Math.min(extrapolatedEndTime, actualEndTime));\n }\n }, {\n key: '_duration',\n get: function get() {\n return this._extrapolatedEndTime - this._startTime;\n }\n\n // Returns the duration (seconds) of the window that the extrapolated start time is allowed\n // to move in before being capped.\n // The extrapolated start time should never reach the cap at the end of the window as the\n // window should slide as chunks are removed from the start.\n // This also applies to the extrapolated end time in the same way.\n //\n // If chunks aren't being removed for some reason that the start time will reach and remain fixed at\n // playableRegionStartTime + extrapolatedWindowDuration\n //\n // <-- window duration -->\n // I.e playableRegionStartTime |-----------------------|\n // | --> . . .\n // . --> | --> . .\n // . . --> | --> .\n // . . . --> |\n // . . . .\n // extrapolatedStartTime\n\n }, {\n key: '_extrapolatedWindowDuration',\n get: function get() {\n if (this._segmentTargetDuration === null) return 0;\n\n return this._extrapolatedWindowNumSegments * this._segmentTargetDuration;\n }\n }], [{\n key: 'HLSJS',\n get: function get() {\n return _hls2.default;\n }\n }]);\n\n function HLS() {\n (0, _classCallCheck3.default)(this, HLS);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n // backwards compatibility (TODO: remove on 0.3.0)\n var _this = (0, _possibleConstructorReturn3.default)(this, _HTML5VideoPlayback.call.apply(_HTML5VideoPlayback, [this].concat(args)));\n\n _this.options.playback = (0, _extends3.default)({}, _this.options, _this.options.playback);\n _this._minDvrSize = typeof _this.options.hlsMinimumDvrSize === 'undefined' ? 60 : _this.options.hlsMinimumDvrSize;\n // The size of the start time extrapolation window measured as a multiple of segments.\n // Should be 2 or higher, or 0 to disable. Should only need to be increased above 2 if more than one segment is\n // removed from the start of the playlist at a time. E.g if the playlist is cached for 10 seconds and new chunks are\n // added/removed every 5.\n _this._extrapolatedWindowNumSegments = !_this.options.playback || typeof _this.options.playback.extrapolatedWindowNumSegments === 'undefined' ? 2 : _this.options.playback.extrapolatedWindowNumSegments;\n\n _this._playbackType = _playback2.default.VOD;\n _this._lastTimeUpdate = { current: 0, total: 0 };\n _this._lastDuration = null;\n // for hls streams which have dvr with a sliding window,\n // the content at the start of the playlist is removed as new\n // content is appended at the end.\n // this means the actual playable start time will increase as the\n // start content is deleted\n // For streams with dvr where the entire recording is kept from the\n // beginning this should stay as 0\n _this._playableRegionStartTime = 0;\n // {local, remote} remote is the time in the video element that should represent 0\n // local is the system time when the 'remote' measurment took place\n _this._localStartTimeCorrelation = null;\n // {local, remote} remote is the time in the video element that should represents the end\n // local is the system time when the 'remote' measurment took place\n _this._localEndTimeCorrelation = null;\n // if content is removed from the beginning then this empty area should\n // be ignored. \"playableRegionDuration\" excludes the empty area\n _this._playableRegionDuration = 0;\n // #EXT-X-PROGRAM-DATE-TIME\n _this._programDateTime = 0;\n // true when the actual duration is longer than hlsjs's live sync point\n // when this is false playableRegionDuration will be the actual duration\n // when this is true playableRegionDuration will exclude the time after the sync point\n _this._durationExcludesAfterLiveSyncPoint = false;\n // #EXT-X-TARGETDURATION\n _this._segmentTargetDuration = null;\n // #EXT-X-PLAYLIST-TYPE\n _this._playlistType = null;\n _this._recoverAttemptsRemaining = _this.options.hlsRecoverAttempts || 16;\n return _this;\n }\n\n HLS.prototype._setup = function _setup() {\n var _this2 = this;\n\n this._ccIsSetup = false;\n this._ccTracksUpdated = false;\n this._hls = new _hls2.default((0, _utils.assign)({}, this.options.playback.hlsjsConfig));\n this._hls.on(_hls2.default.Events.MEDIA_ATTACHED, function () {\n return _this2._hls.loadSource(_this2.options.src);\n });\n this._hls.on(_hls2.default.Events.LEVEL_LOADED, function (evt, data) {\n return _this2._updatePlaybackType(evt, data);\n });\n this._hls.on(_hls2.default.Events.LEVEL_UPDATED, function (evt, data) {\n return _this2._onLevelUpdated(evt, data);\n });\n this._hls.on(_hls2.default.Events.LEVEL_SWITCHING, function (evt, data) {\n return _this2._onLevelSwitch(evt, data);\n });\n this._hls.on(_hls2.default.Events.FRAG_LOADED, function (evt, data) {\n return _this2._onFragmentLoaded(evt, data);\n });\n this._hls.on(_hls2.default.Events.ERROR, function (evt, data) {\n return _this2._onHLSJSError(evt, data);\n });\n this._hls.on(_hls2.default.Events.SUBTITLE_TRACK_LOADED, function (evt, data) {\n return _this2._onSubtitleLoaded(evt, data);\n });\n this._hls.on(_hls2.default.Events.SUBTITLE_TRACKS_UPDATED, function () {\n return _this2._ccTracksUpdated = true;\n });\n this._hls.attachMedia(this.el);\n };\n\n HLS.prototype.render = function render() {\n this._ready();\n return _HTML5VideoPlayback.prototype.render.call(this);\n };\n\n HLS.prototype._ready = function _ready() {\n this._isReadyState = true;\n this.trigger(_events2.default.PLAYBACK_READY, this.name);\n };\n\n HLS.prototype._recover = function _recover(evt, data, error) {\n if (!this._recoveredDecodingError) {\n this._recoveredDecodingError = true;\n this._hls.recoverMediaError();\n } else if (!this._recoveredAudioCodecError) {\n this._recoveredAudioCodecError = true;\n this._hls.swapAudioCodec();\n this._hls.recoverMediaError();\n } else {\n _log2.default.error('hlsjs: failed to recover', { evt: evt, data: data });\n error.level = _error2.default.Levels.FATAL;\n var formattedError = this.createError(error);\n this.trigger(_events2.default.PLAYBACK_ERROR, formattedError);\n this.stop();\n }\n };\n\n // override\n\n\n HLS.prototype._setupSrc = function _setupSrc(srcUrl) {// eslint-disable-line no-unused-vars\n // this playback manages the src on the video element itself\n };\n\n HLS.prototype._startTimeUpdateTimer = function _startTimeUpdateTimer() {\n var _this3 = this;\n\n if (this._timeUpdateTimer) return;\n\n this._timeUpdateTimer = setInterval(function () {\n _this3._onDurationChange();\n _this3._onTimeUpdate();\n }, 100);\n };\n\n HLS.prototype._stopTimeUpdateTimer = function _stopTimeUpdateTimer() {\n if (!this._timeUpdateTimer) return;\n\n clearInterval(this._timeUpdateTimer);\n this._timeUpdateTimer = null;\n };\n\n HLS.prototype.getProgramDateTime = function getProgramDateTime() {\n return this._programDateTime;\n };\n // the duration on the video element itself should not be used\n // as this does not necesarily represent the duration of the stream\n // https://github.com/clappr/clappr/issues/668#issuecomment-157036678\n\n\n HLS.prototype.getDuration = function getDuration() {\n return this._duration;\n };\n\n HLS.prototype.getCurrentTime = function getCurrentTime() {\n // e.g. can be < 0 if user pauses near the start\n // eventually they will then be kicked to the end by hlsjs if they run out of buffer\n // before the official start time\n return Math.max(0, this.el.currentTime - this._startTime);\n };\n\n // the time that \"0\" now represents relative to when playback started\n // for a stream with a sliding window this will increase as content is\n // removed from the beginning\n\n\n HLS.prototype.getStartTimeOffset = function getStartTimeOffset() {\n return this._startTime;\n };\n\n HLS.prototype.seekPercentage = function seekPercentage(percentage) {\n var seekTo = this._duration;\n if (percentage > 0) seekTo = this._duration * (percentage / 100);\n\n this.seek(seekTo);\n };\n\n HLS.prototype.seek = function seek(time) {\n if (time < 0) {\n _log2.default.warn('Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point.');\n time = this.getDuration();\n }\n // assume live if time within 3 seconds of end of stream\n this.dvrEnabled && this._updateDvr(time < this.getDuration() - 3);\n time += this._startTime;\n _HTML5VideoPlayback.prototype.seek.call(this, time);\n };\n\n HLS.prototype.seekToLivePoint = function seekToLivePoint() {\n this.seek(this.getDuration());\n };\n\n HLS.prototype._updateDvr = function _updateDvr(status) {\n this.trigger(_events2.default.PLAYBACK_DVR, status);\n this.trigger(_events2.default.PLAYBACK_STATS_ADD, { 'dvr': status });\n };\n\n HLS.prototype._updateSettings = function _updateSettings() {\n if (this._playbackType === _playback2.default.VOD) this.settings.left = ['playpause', 'position', 'duration'];else if (this.dvrEnabled) this.settings.left = ['playpause'];else this.settings.left = ['playstop'];\n\n this.settings.seekEnabled = this.isSeekEnabled();\n this.trigger(_events2.default.PLAYBACK_SETTINGSUPDATE);\n };\n\n HLS.prototype._onHLSJSError = function _onHLSJSError(evt, data) {\n var error = {\n code: data.type + '_' + data.details,\n description: this.name + ' error: type: ' + data.type + ', details: ' + data.details,\n raw: data\n };\n var formattedError = void 0;\n if (data.response) error.description += ', response: ' + (0, _stringify2.default)(data.response);\n // only report/handle errors if they are fatal\n // hlsjs should automatically handle non fatal errors\n if (data.fatal) {\n if (this._recoverAttemptsRemaining > 0) {\n this._recoverAttemptsRemaining -= 1;\n switch (data.type) {\n case _hls2.default.ErrorTypes.NETWORK_ERROR:\n switch (data.details) {\n // The following network errors cannot be recovered with HLS.startLoad()\n // For more details, see https://github.com/video-dev/hls.js/blob/master/doc/design.md#error-detection-and-handling\n // For \"level load\" fatal errors, see https://github.com/video-dev/hls.js/issues/1138\n case _hls2.default.ErrorDetails.MANIFEST_LOAD_ERROR:\n case _hls2.default.ErrorDetails.MANIFEST_LOAD_TIMEOUT:\n case _hls2.default.ErrorDetails.MANIFEST_PARSING_ERROR:\n case _hls2.default.ErrorDetails.LEVEL_LOAD_ERROR:\n case _hls2.default.ErrorDetails.LEVEL_LOAD_TIMEOUT:\n _log2.default.error('hlsjs: unrecoverable network fatal error.', { evt: evt, data: data });\n formattedError = this.createError(error);\n this.trigger(_events2.default.PLAYBACK_ERROR, formattedError);\n this.stop();\n break;\n default:\n _log2.default.warn('hlsjs: trying to recover from network error.', { evt: evt, data: data });\n error.level = _error2.default.Levels.WARN;\n this.createError(error);\n this._hls.startLoad();\n break;\n }\n break;\n case _hls2.default.ErrorTypes.MEDIA_ERROR:\n _log2.default.warn('hlsjs: trying to recover from media error.', { evt: evt, data: data });\n error.level = _error2.default.Levels.WARN;\n this.createError(error);\n this._recover(evt, data, error);\n break;\n default:\n _log2.default.error('hlsjs: could not recover from error.', { evt: evt, data: data });\n formattedError = this.createError(error);\n this.trigger(_events2.default.PLAYBACK_ERROR, formattedError);\n this.stop();\n break;\n }\n } else {\n _log2.default.error('hlsjs: could not recover from error after maximum number of attempts.', { evt: evt, data: data });\n formattedError = this.createError(error);\n this.trigger(_events2.default.PLAYBACK_ERROR, formattedError);\n this.stop();\n }\n } else {\n // Transforms HLSJS.ErrorDetails.KEY_LOAD_ERROR non-fatal error to\n // playback fatal error if triggerFatalErrorOnResourceDenied playback\n // option is set. HLSJS.ErrorTypes.KEY_SYSTEM_ERROR are fatal errors\n // and therefore already handled.\n if (this.options.playback.triggerFatalErrorOnResourceDenied && this._keyIsDenied(data)) {\n _log2.default.error('hlsjs: could not load decrypt key.', { evt: evt, data: data });\n formattedError = this.createError(error);\n this.trigger(_events2.default.PLAYBACK_ERROR, formattedError);\n this.stop();\n return;\n }\n\n error.level = _error2.default.Levels.WARN;\n this.createError(error);\n _log2.default.warn('hlsjs: non-fatal error occurred', { evt: evt, data: data });\n }\n };\n\n HLS.prototype._keyIsDenied = function _keyIsDenied(data) {\n return data.type === _hls2.default.ErrorTypes.NETWORK_ERROR && data.details === _hls2.default.ErrorDetails.KEY_LOAD_ERROR && data.response && data.response.code >= 400;\n };\n\n HLS.prototype._onTimeUpdate = function _onTimeUpdate() {\n var update = { current: this.getCurrentTime(), total: this.getDuration(), firstFragDateTime: this.getProgramDateTime() };\n var isSame = this._lastTimeUpdate && update.current === this._lastTimeUpdate.current && update.total === this._lastTimeUpdate.total;\n if (isSame) return;\n\n this._lastTimeUpdate = update;\n this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, update, this.name);\n };\n\n HLS.prototype._onDurationChange = function _onDurationChange() {\n var duration = this.getDuration();\n if (this._lastDuration === duration) return;\n\n this._lastDuration = duration;\n _HTML5VideoPlayback.prototype._onDurationChange.call(this);\n };\n\n HLS.prototype._onProgress = function _onProgress() {\n if (!this.el.buffered.length) return;\n\n var buffered = [];\n var bufferedPos = 0;\n for (var i = 0; i < this.el.buffered.length; i++) {\n buffered = [].concat((0, _toConsumableArray3.default)(buffered), [{\n // for a stream with sliding window dvr something that is buffered my slide off the start of the timeline\n start: Math.max(0, this.el.buffered.start(i) - this._playableRegionStartTime),\n end: Math.max(0, this.el.buffered.end(i) - this._playableRegionStartTime)\n }]);\n if (this.el.currentTime >= buffered[i].start && this.el.currentTime <= buffered[i].end) bufferedPos = i;\n }\n var progress = {\n start: buffered[bufferedPos].start,\n current: buffered[bufferedPos].end,\n total: this.getDuration()\n };\n this.trigger(_events2.default.PLAYBACK_PROGRESS, progress, buffered);\n };\n\n HLS.prototype.play = function play() {\n if (!this._hls) this._setup();\n\n _HTML5VideoPlayback.prototype.play.call(this);\n this._startTimeUpdateTimer();\n };\n\n HLS.prototype.pause = function pause() {\n if (!this._hls) return;\n\n _HTML5VideoPlayback.prototype.pause.call(this);\n if (this.dvrEnabled) this._updateDvr(true);\n };\n\n HLS.prototype.stop = function stop() {\n this._stopTimeUpdateTimer();\n if (this._hls) {\n _HTML5VideoPlayback.prototype.stop.call(this);\n this._hls.destroy();\n delete this._hls;\n }\n };\n\n HLS.prototype.destroy = function destroy() {\n this._stopTimeUpdateTimer();\n if (this._hls) {\n this._hls.destroy();\n delete this._hls;\n }\n _HTML5VideoPlayback.prototype.destroy.call(this);\n };\n\n HLS.prototype._updatePlaybackType = function _updatePlaybackType(evt, data) {\n this._playbackType = data.details.live ? _playback2.default.LIVE : _playback2.default.VOD;\n this._onLevelUpdated(evt, data);\n\n // Live stream subtitle tracks detection hack (may not immediately available)\n if (this._ccTracksUpdated && this._playbackType === _playback2.default.LIVE && this.hasClosedCaptionsTracks) this._onSubtitleLoaded();\n };\n\n HLS.prototype._fillLevels = function _fillLevels() {\n this._levels = this._hls.levels.map(function (level, index) {\n return { id: index, level: level, label: level.bitrate / 1000 + 'Kbps' };\n });\n this.trigger(_events2.default.PLAYBACK_LEVELS_AVAILABLE, this._levels);\n };\n\n HLS.prototype._onLevelUpdated = function _onLevelUpdated(evt, data) {\n this._segmentTargetDuration = data.details.targetduration;\n this._playlistType = data.details.type || null;\n\n var startTimeChanged = false;\n var durationChanged = false;\n var fragments = data.details.fragments;\n var previousPlayableRegionStartTime = this._playableRegionStartTime;\n var previousPlayableRegionDuration = this._playableRegionDuration;\n\n if (fragments.length === 0) return;\n\n // #EXT-X-PROGRAM-DATE-TIME\n if (fragments[0].rawProgramDateTime) this._programDateTime = fragments[0].rawProgramDateTime;\n\n if (this._playableRegionStartTime !== fragments[0].start) {\n startTimeChanged = true;\n this._playableRegionStartTime = fragments[0].start;\n }\n\n if (startTimeChanged) {\n if (!this._localStartTimeCorrelation) {\n // set the correlation to map to middle of the extrapolation window\n this._localStartTimeCorrelation = {\n local: this._now,\n remote: (fragments[0].start + this._extrapolatedWindowDuration / 2) * 1000\n };\n } else {\n // check if the correlation still works\n var corr = this._localStartTimeCorrelation;\n var timePassed = this._now - corr.local;\n // this should point to a time within the extrapolation window\n var startTime = (corr.remote + timePassed) / 1000;\n if (startTime < fragments[0].start) {\n // our start time is now earlier than the first chunk\n // (maybe the chunk was removed early)\n // reset correlation so that it sits at the beginning of the first available chunk\n this._localStartTimeCorrelation = {\n local: this._now,\n remote: fragments[0].start * 1000\n };\n } else if (startTime > previousPlayableRegionStartTime + this._extrapolatedWindowDuration) {\n // start time was past the end of the old extrapolation window (so would have been capped)\n // see if now that time would be inside the window, and if it would be set the correlation\n // so that it resumes from the time it was at at the end of the old window\n // update the correlation so that the time starts counting again from the value it's on now\n this._localStartTimeCorrelation = {\n local: this._now,\n remote: Math.max(fragments[0].start, previousPlayableRegionStartTime + this._extrapolatedWindowDuration) * 1000\n };\n }\n }\n }\n\n var newDuration = data.details.totalduration;\n // if it's a live stream then shorten the duration to remove access\n // to the area after hlsjs's live sync point\n // seeks to areas after this point sometimes have issues\n if (this._playbackType === _playback2.default.LIVE) {\n var fragmentTargetDuration = data.details.targetduration;\n var hlsjsConfig = this.options.playback.hlsjsConfig || {};\n var liveSyncDurationCount = hlsjsConfig.liveSyncDurationCount || _hls2.default.DefaultConfig.liveSyncDurationCount;\n var hiddenAreaDuration = fragmentTargetDuration * liveSyncDurationCount;\n if (hiddenAreaDuration <= newDuration) {\n newDuration -= hiddenAreaDuration;\n this._durationExcludesAfterLiveSyncPoint = true;\n } else {\n this._durationExcludesAfterLiveSyncPoint = false;\n }\n }\n\n if (newDuration !== this._playableRegionDuration) {\n durationChanged = true;\n this._playableRegionDuration = newDuration;\n }\n\n // Note the end time is not the playableRegionDuration\n // The end time will always increase even if content is removed from the beginning\n var endTime = fragments[0].start + newDuration;\n var previousEndTime = previousPlayableRegionStartTime + previousPlayableRegionDuration;\n var endTimeChanged = endTime !== previousEndTime;\n if (endTimeChanged) {\n if (!this._localEndTimeCorrelation) {\n // set the correlation to map to the end\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: endTime * 1000\n };\n } else {\n // check if the correlation still works\n var _corr = this._localEndTimeCorrelation;\n var _timePassed = this._now - _corr.local;\n // this should point to a time within the extrapolation window from the end\n var extrapolatedEndTime = (_corr.remote + _timePassed) / 1000;\n if (extrapolatedEndTime > endTime) {\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: endTime * 1000\n };\n } else if (extrapolatedEndTime < endTime - this._extrapolatedWindowDuration) {\n // our extrapolated end time is now earlier than the extrapolation window from the actual end time\n // (maybe a chunk became available early)\n // reset correlation so that it sits at the beginning of the extrapolation window from the end time\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: (endTime - this._extrapolatedWindowDuration) * 1000\n };\n } else if (extrapolatedEndTime > previousEndTime) {\n // end time was past the old end time (so would have been capped)\n // set the correlation so that it resumes from the time it was at at the end of the old window\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: previousEndTime * 1000\n };\n }\n }\n }\n\n // now that the values have been updated call any methods that use on them so they get the updated values\n // immediately\n durationChanged && this._onDurationChange();\n startTimeChanged && this._onProgress();\n };\n\n HLS.prototype._onFragmentLoaded = function _onFragmentLoaded(evt, data) {\n this.trigger(_events2.default.PLAYBACK_FRAGMENT_LOADED, data);\n };\n\n HLS.prototype._onSubtitleLoaded = function _onSubtitleLoaded() {\n // This event may be triggered multiple times\n // Setup CC only once (disable CC by default)\n if (!this._ccIsSetup) {\n this.trigger(_events2.default.PLAYBACK_SUBTITLE_AVAILABLE);\n var trackId = this._playbackType === _playback2.default.LIVE ? -1 : this.closedCaptionsTrackId;\n this.closedCaptionsTrackId = trackId;\n this._ccIsSetup = true;\n }\n };\n\n HLS.prototype._onLevelSwitch = function _onLevelSwitch(evt, data) {\n if (!this.levels.length) this._fillLevels();\n\n this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH_END);\n this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH, data);\n var currentLevel = this._hls.levels[data.level];\n if (currentLevel) {\n // TODO should highDefinition be private and maybe have a read only accessor if it's used somewhere\n this.highDefinition = currentLevel.height >= 720 || currentLevel.bitrate / 1000 >= 2000;\n this.trigger(_events2.default.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinition);\n this.trigger(_events2.default.PLAYBACK_BITRATE, {\n height: currentLevel.height,\n width: currentLevel.width,\n bandwidth: currentLevel.bitrate,\n bitrate: currentLevel.bitrate,\n level: data.level\n });\n }\n };\n\n HLS.prototype.getPlaybackType = function getPlaybackType() {\n return this._playbackType;\n };\n\n HLS.prototype.isSeekEnabled = function isSeekEnabled() {\n return this._playbackType === _playback2.default.VOD || this.dvrEnabled;\n };\n\n (0, _createClass3.default)(HLS, [{\n key: 'dvrEnabled',\n get: function get() {\n // enabled when:\n // - the duration does not include content after hlsjs's live sync point\n // - the playable region duration is longer than the configured duration to enable dvr after\n // - the playback type is LIVE.\n return this._durationExcludesAfterLiveSyncPoint && this._duration >= this._minDvrSize && this.getPlaybackType() === _playback2.default.LIVE;\n }\n }]);\n return HLS;\n}(_html5_video2.default);\n\nexports.default = HLS;\n\n\nHLS.canPlay = function (resource, mimeType) {\n var resourceParts = resource.split('?')[0].match(/.*\\.(.*)$/) || [];\n var isHls = resourceParts.length > 1 && resourceParts[1].toLowerCase() === 'm3u8' || (0, _utils.listContainsIgnoreCase)(mimeType, ['application/vnd.apple.mpegurl', 'application/x-mpegURL']);\n\n return !!(_hls2.default.isSupported() && isHls);\n};\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/hls/index.js\":\n/*!************************************!*\\\n !*** ./src/playbacks/hls/index.js ***!\n \\************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _hls = __webpack_require__(/*! ./hls */ \"./src/playbacks/hls/hls.js\");\n\nvar _hls2 = _interopRequireDefault(_hls);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _hls2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/html5_audio/html5_audio.js\":\n/*!**************************************************!*\\\n !*** ./src/playbacks/html5_audio/html5_audio.js ***!\n \\**************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _events = __webpack_require__(/*! ../../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _playback = __webpack_require__(/*! ../../base/playback */ \"./src/base/playback.js\");\n\nvar _playback2 = _interopRequireDefault(_playback);\n\nvar _html5_video = __webpack_require__(/*! ../../playbacks/html5_video */ \"./src/playbacks/html5_video/index.js\");\n\nvar _html5_video2 = _interopRequireDefault(_html5_video);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// TODO: remove this playback and change HTML5Video to HTML5Playback (breaking change, only after 0.3.0)\nvar HTML5Audio = function (_HTML5Video) {\n (0, _inherits3.default)(HTML5Audio, _HTML5Video);\n\n function HTML5Audio() {\n (0, _classCallCheck3.default)(this, HTML5Audio);\n return (0, _possibleConstructorReturn3.default)(this, _HTML5Video.apply(this, arguments));\n }\n\n HTML5Audio.prototype.updateSettings = function updateSettings() {\n this.settings.left = ['playpause', 'position', 'duration'];\n this.settings.seekEnabled = this.isSeekEnabled();\n this.trigger(_events2.default.PLAYBACK_SETTINGSUPDATE);\n };\n\n HTML5Audio.prototype.getPlaybackType = function getPlaybackType() {\n return _playback2.default.AOD;\n };\n\n (0, _createClass3.default)(HTML5Audio, [{\n key: 'name',\n get: function get() {\n return 'html5_audio';\n }\n }, {\n key: 'tagName',\n get: function get() {\n return 'audio';\n }\n }, {\n key: 'isAudioOnly',\n get: function get() {\n return true;\n }\n }]);\n return HTML5Audio;\n}(_html5_video2.default); // Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nexports.default = HTML5Audio;\n\n\nHTML5Audio.canPlay = function (resourceUrl, mimeType) {\n var mimetypes = {\n 'wav': ['audio/wav'],\n 'mp3': ['audio/mp3', 'audio/mpeg;codecs=\"mp3\"'],\n 'aac': ['audio/mp4;codecs=\"mp4a.40.5\"'],\n 'oga': ['audio/ogg']\n };\n return _html5_video2.default._canPlay('audio', mimetypes, resourceUrl, mimeType);\n};\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/html5_audio/index.js\":\n/*!********************************************!*\\\n !*** ./src/playbacks/html5_audio/index.js ***!\n \\********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _html5_audio = __webpack_require__(/*! ./html5_audio */ \"./src/playbacks/html5_audio/html5_audio.js\");\n\nvar _html5_audio2 = _interopRequireDefault(_html5_audio);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _html5_audio2.default;\nmodule.exports = exports['default'];\n\n/***/ }),\n\n/***/ \"./src/playbacks/html5_video/html5_video.js\":\n/*!**************************************************!*\\\n !*** ./src/playbacks/html5_video/html5_video.js ***!\n \\**************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(process) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _from = __webpack_require__(/*! babel-runtime/core-js/array/from */ \"./node_modules/babel-runtime/core-js/array/from.js\");\n\nvar _from2 = _interopRequireDefault(_from);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _toConsumableArray2 = __webpack_require__(/*! babel-runtime/helpers/toConsumableArray */ \"./node_modules/babel-runtime/helpers/toConsumableArray.js\");\n\nvar _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);\n\nvar _keys = __webpack_require__(/*! babel-runtime/core-js/object/keys */ \"./node_modules/babel-runtime/core-js/object/keys.js\");\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nvar _utils = __webpack_require__(/*! ../../base/utils */ \"./src/base/utils.js\");\n\nvar _playback = __webpack_require__(/*! ../../base/playback */ \"./src/base/playback.js\");\n\nvar _playback2 = _interopRequireDefault(_playback);\n\nvar _browser = __webpack_require__(/*! ../../components/browser */ \"./src/components/browser/index.js\");\n\nvar _browser2 = _interopRequireDefault(_browser);\n\nvar _error = __webpack_require__(/*! ../../components/error */ \"./src/components/error/index.js\");\n\nvar _error2 = _interopRequireDefault(_error);\n\nvar _events = __webpack_require__(/*! ../../base/events */ \"./src/base/events.js\");\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _log = __webpack_require__(/*! ../../plugins/log */ \"./src/plugins/log/index.js\");\n\nvar _log2 = _interopRequireDefault(_log);\n\nvar _clapprZepto = __webpack_require__(/*! clappr-zepto */ \"./node_modules/clappr-zepto/zepto.js\");\n\nvar _clapprZepto2 = _interopRequireDefault(_clapprZepto);\n\nvar _template = __webpack_require__(/*! ../../base/template */ \"./src/base/template.js\");\n\nvar _template2 = _interopRequireDefault(_template);\n\nvar _tracks = __webpack_require__(/*! ./public/tracks.html */ \"./src/playbacks/html5_video/public/tracks.html\");\n\nvar _tracks2 = _interopRequireDefault(_tracks);\n\n__webpack_require__(/*! ./public/style.scss */ \"./src/playbacks/html5_video/public/style.scss\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nvar MIMETYPES = {\n 'mp4': ['avc1.42E01E', 'avc1.58A01E', 'avc1.4D401E', 'avc1.64001E', 'mp4v.20.8', 'mp4v.20.240', 'mp4a.40.2'].map(function (codec) {\n return 'video/mp4; codecs=\"' + codec + ', mp4a.40.2\"';\n }),\n 'ogg': ['video/ogg; codecs=\"theora, vorbis\"', 'video/ogg; codecs=\"dirac\"', 'video/ogg; codecs=\"theora, speex\"'],\n '3gpp': ['video/3gpp; codecs=\"mp4v.20.8, samr\"'],\n 'webm': ['video/webm; codecs=\"vp8, vorbis\"'],\n 'mkv': ['video/x-matroska; codecs=\"theora, vorbis\"'],\n 'm3u8': ['application/x-mpegurl']\n};\nMIMETYPES['ogv'] = MIMETYPES['ogg'];\nMIMETYPES['3gp'] = MIMETYPES['3gpp'];\n\nvar AUDIO_MIMETYPES = {\n 'wav': ['audio/wav'],\n 'mp3': ['audio/mp3', 'audio/mpeg;codecs=\"mp3\"'],\n 'aac': ['audio/mp4;codecs=\"mp4a.40.5\"'],\n 'oga': ['audio/ogg']\n};\n\nvar KNOWN_AUDIO_MIMETYPES = (0, _keys2.default)(AUDIO_MIMETYPES).reduce(function (acc, k) {\n return [].concat((0, _toConsumableArray3.default)(acc), (0, _toConsumableArray3.default)(AUDIO_MIMETYPES[k]));\n}, []);\n\nvar UNKNOWN_ERROR = { code: 'unknown', message: 'unknown'\n\n // TODO: rename this Playback to HTML5Playback (breaking change, only after 0.3.0)\n};\nvar HTML5Video = function (_Playback) {\n (0, _inherits3.default)(HTML5Video, _Playback);\n (0, _createClass3.default)(HTML5Video, [{\n key: 'name',\n get: function get() {\n return 'html5_video';\n }\n }, {\n key: 'tagName',\n get: function get() {\n return this.isAudioOnly ? 'audio' : 'video';\n }\n }, {\n key: 'isAudioOnly',\n get: function get() {\n var resourceUrl = this.options.src;\n var mimeTypes = HTML5Video._mimeTypesForUrl(resourceUrl, AUDIO_MIMETYPES, this.options.mimeType);\n return this.options.playback && this.options.playback.audioOnly || this.options.audioOnly || KNOWN_AUDIO_MIMETYPES.indexOf(mimeTypes[0]) >= 0;\n }\n }, {\n key: 'attributes',\n get: function get() {\n return {\n 'data-html5-video': ''\n };\n }\n }, {\n key: 'events',\n get: function get() {\n return {\n 'canplay': '_onCanPlay',\n 'canplaythrough': '_handleBufferingEvents',\n 'durationchange': '_onDurationChange',\n 'ended': '_onEnded',\n 'error': '_onError',\n 'loadeddata': '_onLoadedData',\n 'loadedmetadata': '_onLoadedMetadata',\n 'pause': '_onPause',\n 'playing': '_onPlaying',\n 'progress': '_onProgress',\n 'seeking': '_onSeeking',\n 'seeked': '_onSeeked',\n 'stalled': '_handleBufferingEvents',\n 'timeupdate': '_onTimeUpdate',\n 'waiting': '_onWaiting'\n };\n }\n\n /**\n * Determine if the playback has ended.\n * @property ended\n * @type Boolean\n */\n\n }, {\n key: 'ended',\n get: function get() {\n return this.el.ended;\n }\n\n /**\n * Determine if the playback is having to buffer in order for\n * playback to be smooth.\n * This is related to the PLAYBACK_BUFFERING and PLAYBACK_BUFFERFULL events\n * @property buffering\n * @type Boolean\n */\n\n }, {\n key: 'buffering',\n get: function get() {\n return this._isBuffering;\n }\n }]);\n\n function HTML5Video() {\n (0, _classCallCheck3.default)(this, HTML5Video);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var _this = (0, _possibleConstructorReturn3.default)(this, _Playback.call.apply(_Playback, [this].concat(args)));\n\n _this._destroyed = false;\n _this._loadStarted = false;\n _this._isBuffering = false;\n _this._playheadMoving = false;\n _this._playheadMovingTimer = null;\n _this._stopped = false;\n _this._ccTrackId = -1;\n _this._setupSrc(_this.options.src);\n // backwards compatibility (TODO: remove on 0.3.0)\n _this.options.playback || (_this.options.playback = _this.options || {});\n _this.options.playback.disableContextMenu = _this.options.playback.disableContextMenu || _this.options.disableVideoTagContextMenu;\n\n var playbackConfig = _this.options.playback;\n var preload = playbackConfig.preload || (_browser2.default.isSafari ? 'auto' : _this.options.preload);\n\n var posterUrl = void 0; // FIXME: poster plugin should always convert poster to object with expected properties ?\n if (_this.options.poster) {\n if (typeof _this.options.poster === 'string') posterUrl = _this.options.poster;else if (typeof _this.options.poster.url === 'string') posterUrl = _this.options.poster.url;\n }\n\n _clapprZepto2.default.extend(_this.el, {\n muted: _this.options.mute,\n defaultMuted: _this.options.mute,\n loop: _this.options.loop,\n poster: posterUrl,\n preload: preload || 'metadata',\n controls: (playbackConfig.controls || _this.options.useVideoTagDefaultControls) && 'controls',\n crossOrigin: playbackConfig.crossOrigin,\n 'x-webkit-playsinline': playbackConfig.playInline\n });\n\n playbackConfig.playInline && _this.$el.attr({ playsinline: 'playsinline' });\n playbackConfig.crossOrigin && _this.$el.attr({ crossorigin: playbackConfig.crossOrigin });\n\n // TODO should settings be private?\n _this.settings = { default: ['seekbar'] };\n _this.settings.left = ['playpause', 'position', 'duration'];\n _this.settings.right = ['fullscreen', 'volume', 'hd-indicator'];\n\n playbackConfig.externalTracks && _this._setupExternalTracks(playbackConfig.externalTracks);\n\n _this.options.autoPlay && _this.attemptAutoPlay();\n return _this;\n }\n\n HTML5Video.prototype.configure = function configure(options) {\n _Playback.prototype.configure.call(this, options);\n this.el.loop = !!options.loop;\n };\n\n // See Playback.attemptAutoPlay()\n\n\n HTML5Video.prototype.attemptAutoPlay = function attemptAutoPlay() {\n var _this2 = this;\n\n this.canAutoPlay(function (result, error) {\n error && _log2.default.warn(_this2.name, 'autoplay error.', { result: result, error: error });\n\n // https://github.com/clappr/clappr/issues/1076\n result && process.nextTick(function () {\n return !_this2._destroyed && _this2.play();\n });\n });\n };\n\n // See Playback.canAutoPlay()\n\n\n HTML5Video.prototype.canAutoPlay = function canAutoPlay(cb) {\n if (this.options.disableCanAutoPlay) cb(true, null);\n\n var opts = {\n timeout: this.options.autoPlayTimeout || 500,\n inline: this.options.playback.playInline || false,\n muted: this.options.mute || false // Known issue: mediacontrols may asynchronously mute video\n\n\n // Use current video element if recycling feature enabled with mobile devices\n };if (_browser2.default.isMobile && _utils.DomRecycler.options.recycleVideo) opts.element = this.el;\n\n // Desktop browser autoplay policy may require user action\n // Mobile browser autoplay require user consent and video recycling feature enabled\n // It may returns a false positive with source-less player consent\n (0, _utils.canAutoPlayMedia)(cb, opts);\n };\n\n HTML5Video.prototype._setupExternalTracks = function _setupExternalTracks(tracks) {\n this._externalTracks = tracks.map(function (track) {\n return {\n kind: track.kind || 'subtitles', // Default is 'subtitles'\n label: track.label,\n lang: track.lang,\n src: track.src\n };\n });\n };\n\n /**\n * Sets the source url on the