diff --git a/.prettierignore b/.prettierignore index fe2163110f10247032dd2b80731578980da7bfb9..9f0838858b7e60825eaef2e0ce9a16a17b6b9675 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,6 +9,5 @@ static.dist/ src/core/fixtures/local/**/* src/plainui/static/plainui/hub.* -src/plainui/static/plainui/js/player.js src/**/templates/**/*.js diff --git a/src/.ruff.toml b/src/.ruff.toml index ed08c4a0b02aee10c13d0b164a9bbf80b9150412..54daa1c3a8f7b6a98264bccfadb9198332bd2d2a 100644 --- a/src/.ruff.toml +++ b/src/.ruff.toml @@ -93,6 +93,7 @@ section-order = [ "django_bootstrap5", "django_rich", "djangorestframework", + "csp", "modeltranslation", "ragelimit", "rules", diff --git a/src/core/views/sso.py b/src/core/views/sso.py index ec25485126cb842701c7cdc8d3980e2d5197fb45..fb4e9e4092bf1590910621389179dc516ff1c563 100644 --- a/src/core/views/sso.py +++ b/src/core/views/sso.py @@ -2,10 +2,10 @@ import calendar import json import logging -from csp.decorators import csp_update from oauth2_provider.models import get_access_token_model from oauth2_provider.views import AuthorizationView, ClientProtectedScopedResourceView +from csp.decorators import csp_update from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponse diff --git a/src/hub/settings/base.py b/src/hub/settings/base.py index cfffd03078a3b9eec9a71da02cd80475386c784a..c93dee613d7a3f41802203b86f4ff25613e0b52a 100644 --- a/src/hub/settings/base.py +++ b/src/hub/settings/base.py @@ -104,9 +104,11 @@ env = environ.FileAwareEnv( MOLLY_GUARD=(bool, True), CSP_DEFAULT_SRC=(list, ["'self'"]), CSP_SCRIPT_SRC=(list, ["'self'"]), + # TODO: Remove unsafe-inline from CSP_STYLE_SRC after style extraction is done CSP_STYLE_SRC=(list, ["'self'", "'unsafe-inline'"]), - CSP_IMG_SRC=(list, ["'self'", 'data:']), - CSP_CONNECT_SRC=(list, ["'self'"]), + # c3volc.de is used for the video player + CSP_IMG_SRC=(list, ["'self'", 'data:', 'http://*.c3voc.de/']), + CSP_CONNECT_SRC=(list, ["'self'", 'http://*.c3voc.de/']), CSP_FONT_SRC=(list, ["'self'"]), CSP_OBJECT_SRC=(list, ["'none'"]), CSP_FRAME_SRC=(list, ["'none'"]), diff --git a/src/plainui/jinja2/plainui/components/integrations.html.j2 b/src/plainui/jinja2/plainui/components/integrations.html.j2 index 4d00e5b7ff442a084a26a5cff018c8c0a7ed315a..5231091143f6676ba4601e4717310f4de37a4a95 100644 --- a/src/plainui/jinja2/plainui/components/integrations.html.j2 +++ b/src/plainui/jinja2/plainui/components/integrations.html.j2 @@ -1,7 +1,9 @@ -{% macro vocPlayer(playerId='player', vocStream=None, vocLecture=None) -%} +{% macro vocPlayer(playerId='player') -%} <div id="{{ playerId }}" class="hub_voc_player"></div> +{%- endmacro %} - <script nonce="{{ request.csp_nonce }}"> +{% macro vocScript(nonce, playerId='player', vocStream=None, vocLecture=None) -%} + <script nonce="{{ nonce }}"> new VOCPlayer.Player({ {% if vocStream -%} vocStream: "{{ vocStream }}", diff --git a/src/plainui/jinja2/plainui/event.html.j2 b/src/plainui/jinja2/plainui/event.html.j2 index 048769f4ff4a39801d311b581739e8d3f59094df..d6db16f586af2d566f57722a7f0e362751037238 100644 --- a/src/plainui/jinja2/plainui/event.html.j2 +++ b/src/plainui/jinja2/plainui/event.html.j2 @@ -23,7 +23,10 @@ {% endblock title %} {% block head %} - <script src="{{ static('plainui/js/player.js') }}"></script> + <script src="{{ static('plainui/vendor/vocplayer/player.umd.js') }}"></script> + <link href="{{ static('plainui/vendor/vocplayer/style.css') }}" + rel="stylesheet"> + {% endblock head %} {% block content %} <article class="mt-10"> @@ -161,8 +164,9 @@ {% endif %} </div> + <div class="border p-3 my-8">{{ integrations.vocPlayer() }}</div> {% if event.kind == "official" and running_state == "running" %} - <div class="border p-3 my-8">{{ integrations.vocPlayer(vocLecture=event.slug) }}</div> + <div class="border p-3 my-8">{{ integrations.vocPlayer() }}</div> {% endif %} <div class="hub-row hub-card"> @@ -196,5 +200,7 @@ </div> </div> </article> - {% endblock content %} +{% block jstools %} + {{ integrations.vocScript(csp_nonce, vocLecture=event.slug) }} +{% endblock jstools %} diff --git a/src/plainui/jinja2/plainui/index.html.j2 b/src/plainui/jinja2/plainui/index.html.j2 index 60f69b31786bd84f5979ca3de1d8b844a3571098..2dfb5392eebdc3a9db0113c1d29d8b05a1526623 100644 --- a/src/plainui/jinja2/plainui/index.html.j2 +++ b/src/plainui/jinja2/plainui/index.html.j2 @@ -10,7 +10,9 @@ {{ conf.name }} - Index {% endblock title %} {% block head %} - <script src="{{ static('plainui/js/player.js') }}" /></script> + <script src="{{ static('plainui/vendor/vocplayer/player.umd.js') }}"></script> + <link href="{{ static('plainui/vendor/vocplayer/style.css') }}" + rel="stylesheet"> {% endblock head %} {% block content %} @@ -23,7 +25,7 @@ {% for stream in public_streams %} <div class="hub-card hub-layout-equal"> <h2 class="hub-section-title">{{ stream.name }}</h2> - {{ integrations.vocPlayer(vocStream=stream.voc_stream_id, playerId=unique_id() ) }} + {{ integrations.vocPlayer(playerId="player-" ~ stream.slug) }} </div> {% endfor %} </div> @@ -71,3 +73,9 @@ </div> {% endblock content %} + +{% block jstools %} + {% for stream in public_streams %} + {{ integrations.vocScript(csp_nonce, vocStream=stream.voc_stream_id, playerId="player-" ~ stream.slug) }} + {% endfor %} +{% endblock jstools %} diff --git a/src/plainui/jinja2/plainui/projects/detail.html.j2 b/src/plainui/jinja2/plainui/projects/detail.html.j2 index d12fc39a5aac8b03bd33d2fe07cde3cd2d8c6835..a3922d612730e0323a34856d698288bd431ec2b1 100644 --- a/src/plainui/jinja2/plainui/projects/detail.html.j2 +++ b/src/plainui/jinja2/plainui/projects/detail.html.j2 @@ -9,9 +9,6 @@ {% block title %} Conference {{ conf.name }} - Project {{ project.name }} {% endblock title %} -{% block head %} - <script src="{{ static('plainui/js/player.js') }}" /></script> -{% endblock head %} {% block content %} {{ navMacro.top_nav(_("Project") , has_breadcrumbs=True) }} <nav aria-label="breadcrumb"> diff --git a/src/plainui/jinja2/plainui/room.html.j2 b/src/plainui/jinja2/plainui/room.html.j2 index de12e4b29d711a3c6c4fdcce37a41d166b3fc63a..dc349a3014fd0e92eb9a70c1264e73bf6a820077 100644 --- a/src/plainui/jinja2/plainui/room.html.j2 +++ b/src/plainui/jinja2/plainui/room.html.j2 @@ -11,7 +11,9 @@ {% endblock title %} {% block head %} - <script src="{{ static('plainui/js/player.js') }}" /></script> + <script src="{{ static('plainui/vendor/vocplayer/player.umd.js') }}"></script> + <link href="{{ static('plainui/vendor/vocplayer/style.css') }}" + rel="stylesheet"> {% endblock head %} {% block content %} @@ -56,7 +58,7 @@ {% if voc_stream and not archive_mode %} <div class="hub-card"> <h2 class="hub-section-title mb-0">{{ _("Currently Streaming") }}</h2> - {{ integrations.vocPlayer(vocStream=voc_stream) }} + {{ integrations.vocPlayer() }} </div> {% endif %} @@ -70,3 +72,7 @@ </div> </div> {% endblock content %} + +{% block jstools %} + {% if voc_stream and not archive_mode %}{{ integrations.vocScript(csp_nonce, vocStream=voc_stream) }}{% endif %} +{% endblock jstools %} diff --git a/src/plainui/static/plainui/js/player.js b/src/plainui/static/plainui/js/player.js deleted file mode 100644 index afd4c42434912e9af578ecd5a24d95ff11cd8ee2..0000000000000000000000000000000000000000 --- a/src/plainui/static/plainui/js/player.js +++ /dev/null @@ -1,1143 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VOCPlayer=t():e.VOCPlayer=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}([function(e,t,n){var r;window,r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="dist/",n(n.s="./src/main.js")}({"./node_modules/babel-runtime/core-js/array/from.js": -/*!**********************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/array/from.js ***! - \**********************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/array/from */"./node_modules/core-js/library/fn/array/from.js"),__esModule:!0}},"./node_modules/babel-runtime/core-js/get-iterator.js": -/*!************************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/get-iterator.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/get-iterator */"./node_modules/core-js/library/fn/get-iterator.js"),__esModule:!0}},"./node_modules/babel-runtime/core-js/json/stringify.js": -/*!**************************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/json/stringify.js ***! - \**************************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/json/stringify */"./node_modules/core-js/library/fn/json/stringify.js"),__esModule:!0}},"./node_modules/babel-runtime/core-js/object/assign.js": -/*!*************************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/object/assign.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/object/assign */"./node_modules/core-js/library/fn/object/assign.js"),__esModule:!0}},"./node_modules/babel-runtime/core-js/object/create.js": -/*!*************************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/object/create.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/object/create */"./node_modules/core-js/library/fn/object/create.js"),__esModule:!0}},"./node_modules/babel-runtime/core-js/object/define-property.js": -/*!**********************************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/object/define-property.js ***! - \**********************************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/object/define-property */"./node_modules/core-js/library/fn/object/define-property.js"),__esModule:!0}},"./node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js ***! - \**********************************************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/object/get-own-property-descriptor */"./node_modules/core-js/library/fn/object/get-own-property-descriptor.js"),__esModule:!0}},"./node_modules/babel-runtime/core-js/object/keys.js": -/*!***********************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/object/keys.js ***! - \***********************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/object/keys */"./node_modules/core-js/library/fn/object/keys.js"),__esModule:!0}},"./node_modules/babel-runtime/core-js/object/set-prototype-of.js": -/*!***********************************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/object/set-prototype-of.js ***! - \***********************************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/object/set-prototype-of */"./node_modules/core-js/library/fn/object/set-prototype-of.js"),__esModule:!0}},"./node_modules/babel-runtime/core-js/symbol.js": -/*!******************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/symbol.js ***! - \******************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/symbol */"./node_modules/core-js/library/fn/symbol/index.js"),__esModule:!0}},"./node_modules/babel-runtime/core-js/symbol/iterator.js": -/*!***************************************************************!*\ - !*** ./node_modules/babel-runtime/core-js/symbol/iterator.js ***! - \***************************************************************/ -/*! no static exports found */function(e,t,n){e.exports={default:n(/*! core-js/library/fn/symbol/iterator */"./node_modules/core-js/library/fn/symbol/iterator.js"),__esModule:!0}},"./node_modules/babel-runtime/helpers/classCallCheck.js": -/*!**************************************************************!*\ - !*** ./node_modules/babel-runtime/helpers/classCallCheck.js ***! - \**************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},"./node_modules/babel-runtime/helpers/createClass.js": -/*!***********************************************************!*\ - !*** ./node_modules/babel-runtime/helpers/createClass.js ***! - \***********************************************************/ -/*! no static exports found */function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(/*! ../core-js/object/define-property */"./node_modules/babel-runtime/core-js/object/define-property.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,a.default)(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()},"./node_modules/babel-runtime/helpers/extends.js": -/*!*******************************************************!*\ - !*** ./node_modules/babel-runtime/helpers/extends.js ***! - \*******************************************************/ -/*! no static exports found */function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(/*! ../core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},"./node_modules/babel-runtime/helpers/inherits.js": -/*!********************************************************!*\ - !*** ./node_modules/babel-runtime/helpers/inherits.js ***! - \********************************************************/ -/*! no static exports found */function(e,t,n){"use strict";t.__esModule=!0;var r=o(n(/*! ../core-js/object/set-prototype-of */"./node_modules/babel-runtime/core-js/object/set-prototype-of.js")),i=o(n(/*! ../core-js/object/create */"./node_modules/babel-runtime/core-js/object/create.js")),a=o(n(/*! ../helpers/typeof */"./node_modules/babel-runtime/helpers/typeof.js"));function o(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,a.default)(t)));e.prototype=(0,i.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(r.default?(0,r.default)(e,t):e.__proto__=t)}},"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js": -/*!*************************************************************************!*\ - !*** ./node_modules/babel-runtime/helpers/possibleConstructorReturn.js ***! - \*************************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(/*! ../helpers/typeof */"./node_modules/babel-runtime/helpers/typeof.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,a.default)(t))&&"function"!=typeof t?e:t}},"./node_modules/babel-runtime/helpers/toConsumableArray.js": -/*!*****************************************************************!*\ - !*** ./node_modules/babel-runtime/helpers/toConsumableArray.js ***! - \*****************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(/*! ../core-js/array/from */"./node_modules/babel-runtime/core-js/array/from.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return(0,a.default)(e)}},"./node_modules/babel-runtime/helpers/typeof.js": -/*!******************************************************!*\ - !*** ./node_modules/babel-runtime/helpers/typeof.js ***! - \******************************************************/ -/*! no static exports found */function(e,t,n){"use strict";t.__esModule=!0;var r=o(n(/*! ../core-js/symbol/iterator */"./node_modules/babel-runtime/core-js/symbol/iterator.js")),i=o(n(/*! ../core-js/symbol */"./node_modules/babel-runtime/core-js/symbol.js")),a="function"==typeof i.default&&"symbol"==typeof r.default?function(e){return typeof e}:function(e){return e&&"function"==typeof i.default&&e.constructor===i.default&&e!==i.default.prototype?"symbol":typeof e};function o(e){return e&&e.__esModule?e:{default:e}}t.default="function"==typeof i.default&&"symbol"===a(r.default)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof i.default&&e.constructor===i.default&&e!==i.default.prototype?"symbol":void 0===e?"undefined":a(e)}},"./node_modules/clappr-zepto/zepto.js": -/*!********************************************!*\ - !*** ./node_modules/clappr-zepto/zepto.js ***! - \********************************************/ -/*! no static exports found */function(e,t){var n,r=function(){var e,t,n,r,i,a=[],o=a.concat,s=a.filter,l=a.slice,u=window.document,c={},d={},f={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},h=/^\s*<(\w+|!)[^>]*>/,p=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,m=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,g=/^(?:body|html)$/i,y=/([A-Z])/g,v=["val","css","html","text","data","width","height","offset"],b=u.createElement("table"),_=u.createElement("tr"),A={tr:u.createElement("tbody"),tbody:b,thead:b,tfoot:b,td:_,th:_,"*":u.createElement("div")},E=/complete|loaded|interactive/,T=/^[\w-]*$/,w={},S=w.toString,k={},C=u.createElement("div"),x={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},R=Array.isArray||function(e){return e instanceof Array};function L(e){return null==e?String(e):w[S.call(e)]||"object"}function I(e){return"function"==L(e)}function P(e){return null!=e&&e==e.window}function j(e){return null!=e&&e.nodeType==e.DOCUMENT_NODE}function O(e){return"object"==L(e)}function D(e){return O(e)&&!P(e)&&Object.getPrototypeOf(e)==Object.prototype}function M(e){var n=!!e&&"length"in e&&e.length,r=t.type(e);return"function"!=r&&!P(e)&&("array"==r||0===n||"number"==typeof n&&n>0&&n-1 in e)}function N(e){return e.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function U(e){return e in d?d[e]:d[e]=new RegExp("(^|\\s)"+e+"(\\s|$)")}function F(e,t){return"number"!=typeof t||f[N(e)]?t:t+"px"}function B(e){return"children"in e?l.call(e.children):t.map(e.childNodes,(function(e){if(1==e.nodeType)return e}))}function K(e,t){var n,r=e?e.length:0;for(n=0;n<r;n++)this[n]=e[n];this.length=r,this.selector=t||""}function V(t,n,r){for(e in n)r&&(D(n[e])||R(n[e]))?(D(n[e])&&!D(t[e])&&(t[e]={}),R(n[e])&&!R(t[e])&&(t[e]=[]),V(t[e],n[e],r)):void 0!==n[e]&&(t[e]=n[e])}function G(e,n){return null==n?t(e):t(e).filter(n)}function H(e,t,n,r){return I(t)?t.call(e,n,r):t}function Y(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function z(e,t){var n=e.className||"",r=n&&void 0!==n.baseVal;if(void 0===t)return r?n.baseVal:n;r?n.baseVal=t:e.className=t}function W(e){try{return e?"true"==e||"false"!=e&&("null"==e?null:+e+""==e?+e:/^[\[\{]/.test(e)?t.parseJSON(e):e):e}catch(t){return e}}function $(e,t){t(e);for(var n=0,r=e.childNodes.length;n<r;n++)$(e.childNodes[n],t)}return k.matches=function(e,t){if(!t||!e||1!==e.nodeType)return!1;var n=e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.matchesSelector;if(n)return n.call(e,t);var r,i=e.parentNode,a=!i;return a&&(i=C).appendChild(e),r=~k.qsa(i,t).indexOf(e),a&&C.removeChild(e),r},r=function(e){return e.replace(/-+(.)?/g,(function(e,t){return t?t.toUpperCase():""}))},i=function(e){return s.call(e,(function(t,n){return e.indexOf(t)==n}))},k.fragment=function(e,n,r){var i,a,o;return p.test(e)&&(i=t(u.createElement(RegExp.$1))),i||(e.replace&&(e=e.replace(m,"<$1></$2>")),void 0===n&&(n=h.test(e)&&RegExp.$1),n in A||(n="*"),(o=A[n]).innerHTML=""+e,i=t.each(l.call(o.childNodes),(function(){o.removeChild(this)}))),D(r)&&(a=t(i),t.each(r,(function(e,t){v.indexOf(e)>-1?a[e](t):a.attr(e,t)}))),i},k.Z=function(e,t){return new K(e,t)},k.isZ=function(e){return e instanceof k.Z},k.init=function(e,n){var r,i;if(!e)return k.Z();if("string"==typeof e)if("<"==(e=e.trim())[0]&&h.test(e))r=k.fragment(e,RegExp.$1,n),e=null;else{if(void 0!==n)return t(n).find(e);r=k.qsa(u,e)}else{if(I(e))return t(u).ready(e);if(k.isZ(e))return e;if(R(e))i=e,r=s.call(i,(function(e){return null!=e}));else if(O(e))r=[e],e=null;else if(h.test(e))r=k.fragment(e.trim(),RegExp.$1,n),e=null;else{if(void 0!==n)return t(n).find(e);r=k.qsa(u,e)}}return k.Z(r,e)},(t=function(e,t){return k.init(e,t)}).extend=function(e){var t,n=l.call(arguments,1);return"boolean"==typeof e&&(t=e,e=n.shift()),n.forEach((function(n){V(e,n,t)})),e},k.qsa=function(e,t){var n,r="#"==t[0],i=!r&&"."==t[0],a=r||i?t.slice(1):t,o=T.test(a);return e.getElementById&&o&&r?(n=e.getElementById(a))?[n]:[]:1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType?[]:l.call(o&&!r&&e.getElementsByClassName?i?e.getElementsByClassName(a):e.getElementsByTagName(t):e.querySelectorAll(t))},t.contains=u.documentElement.contains?function(e,t){return e!==t&&e.contains(t)}:function(e,t){for(;t&&(t=t.parentNode);)if(t===e)return!0;return!1},t.type=L,t.isFunction=I,t.isWindow=P,t.isArray=R,t.isPlainObject=D,t.isEmptyObject=function(e){var t;for(t in e)return!1;return!0},t.isNumeric=function(e){var t=Number(e),n=typeof e;return null!=e&&"boolean"!=n&&("string"!=n||e.length)&&!isNaN(t)&&isFinite(t)||!1},t.inArray=function(e,t,n){return a.indexOf.call(t,e,n)},t.camelCase=r,t.trim=function(e){return null==e?"":String.prototype.trim.call(e)},t.uuid=0,t.support={},t.expr={},t.noop=function(){},t.map=function(e,n){var r,i,a,o,s=[];if(M(e))for(i=0;i<e.length;i++)null!=(r=n(e[i],i))&&s.push(r);else for(a in e)null!=(r=n(e[a],a))&&s.push(r);return(o=s).length>0?t.fn.concat.apply([],o):o},t.each=function(e,t){var n,r;if(M(e)){for(n=0;n<e.length;n++)if(!1===t.call(e[n],n,e[n]))return e}else for(r in e)if(!1===t.call(e[r],r,e[r]))return e;return e},t.grep=function(e,t){return s.call(e,t)},window.JSON&&(t.parseJSON=JSON.parse),t.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),(function(e,t){w["[object "+t+"]"]=t.toLowerCase()})),t.fn={constructor:k.Z,length:0,forEach:a.forEach,reduce:a.reduce,push:a.push,sort:a.sort,splice:a.splice,indexOf:a.indexOf,concat:function(){var e,t,n=[];for(e=0;e<arguments.length;e++)t=arguments[e],n[e]=k.isZ(t)?t.toArray():t;return o.apply(k.isZ(this)?this.toArray():this,n)},map:function(e){return t(t.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return t(l.apply(this,arguments))},ready:function(e){return E.test(u.readyState)&&u.body?e(t):u.addEventListener("DOMContentLoaded",(function(){e(t)}),!1),this},get:function(e){return void 0===e?l.call(this):this[e>=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each((function(){null!=this.parentNode&&this.parentNode.removeChild(this)}))},each:function(e){return a.every.call(this,(function(t,n){return!1!==e.call(t,n,t)})),this},filter:function(e){return I(e)?this.not(this.not(e)):t(s.call(this,(function(t){return k.matches(t,e)})))},add:function(e,n){return t(i(this.concat(t(e,n))))},is:function(e){return this.length>0&&k.matches(this[0],e)},not:function(e){var n=[];if(I(e)&&void 0!==e.call)this.each((function(t){e.call(this,t)||n.push(this)}));else{var r="string"==typeof e?this.filter(e):M(e)&&I(e.item)?l.call(e):t(e);this.forEach((function(e){r.indexOf(e)<0&&n.push(e)}))}return t(n)},has:function(e){return this.filter((function(){return O(e)?t.contains(this,e):t(this).find(e).size()}))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},first:function(){var e=this[0];return e&&!O(e)?e:t(e)},last:function(){var e=this[this.length-1];return e&&!O(e)?e:t(e)},find:function(e){var n=this;return e?"object"==typeof e?t(e).filter((function(){var e=this;return a.some.call(n,(function(n){return t.contains(n,e)}))})):1==this.length?t(k.qsa(this[0],e)):this.map((function(){return k.qsa(this,e)})):t()},closest:function(e,n){var r=[],i="object"==typeof e&&t(e);return this.each((function(t,a){for(;a&&!(i?i.indexOf(a)>=0:k.matches(a,e));)a=a!==n&&!j(a)&&a.parentNode;a&&r.indexOf(a)<0&&r.push(a)})),t(r)},parents:function(e){for(var n=[],r=this;r.length>0;)r=t.map(r,(function(e){if((e=e.parentNode)&&!j(e)&&n.indexOf(e)<0)return n.push(e),e}));return G(n,e)},parent:function(e){return G(i(this.pluck("parentNode")),e)},children:function(e){return G(this.map((function(){return B(this)})),e)},contents:function(){return this.map((function(){return this.contentDocument||l.call(this.childNodes)}))},siblings:function(e){return G(this.map((function(e,t){return s.call(B(t.parentNode),(function(e){return e!==t}))})),e)},empty:function(){return this.each((function(){this.innerHTML=""}))},pluck:function(e){return t.map(this,(function(t){return t[e]}))},show:function(){return this.each((function(){var e,t,n;"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=(e=this.nodeName,c[e]||(t=u.createElement(e),u.body.appendChild(t),n=getComputedStyle(t,"").getPropertyValue("display"),t.parentNode.removeChild(t),"none"==n&&(n="block"),c[e]=n),c[e]))}))},replaceWith:function(e){return this.before(e).remove()},wrap:function(e){var n=I(e);if(this[0]&&!n)var r=t(e).get(0),i=r.parentNode||this.length>1;return this.each((function(a){t(this).wrapAll(n?e.call(this,a):i?r.cloneNode(!0):r)}))},wrapAll:function(e){if(this[0]){var n;for(t(this[0]).before(e=t(e));(n=e.children()).length;)e=n.first();t(e).append(this)}return this},wrapInner:function(e){var n=I(e);return this.each((function(r){var i=t(this),a=i.contents(),o=n?e.call(this,r):e;a.length?a.wrapAll(o):i.append(o)}))},unwrap:function(){return this.parent().each((function(){t(this).replaceWith(t(this).children())})),this},clone:function(){return this.map((function(){return this.cloneNode(!0)}))},hide:function(){return this.css("display","none")},toggle:function(e){return this.each((function(){var n=t(this);(void 0===e?"none"==n.css("display"):e)?n.show():n.hide()}))},prev:function(e){return t(this.pluck("previousElementSibling")).filter(e||"*")},next:function(e){return t(this.pluck("nextElementSibling")).filter(e||"*")},html:function(e){return 0 in arguments?this.each((function(n){var r=this.innerHTML;t(this).empty().append(H(this,e,n,r))})):0 in this?this[0].innerHTML:null},text:function(e){return 0 in arguments?this.each((function(t){var n=H(this,e,t,this.textContent);this.textContent=null==n?"":""+n})):0 in this?this.pluck("textContent").join(""):null},attr:function(t,n){var r;return"string"!=typeof t||1 in arguments?this.each((function(r){if(1===this.nodeType)if(O(t))for(e in t)Y(this,e,t[e]);else Y(this,t,H(this,n,r,this.getAttribute(t)))})):0 in this&&1==this[0].nodeType&&null!=(r=this[0].getAttribute(t))?r:void 0},removeAttr:function(e){return this.each((function(){1===this.nodeType&&e.split(" ").forEach((function(e){Y(this,e)}),this)}))},prop:function(e,t){return e=x[e]||e,1 in arguments?this.each((function(n){this[e]=H(this,t,n,this[e])})):this[0]&&this[0][e]},removeProp:function(e){return e=x[e]||e,this.each((function(){delete this[e]}))},data:function(e,t){var n="data-"+e.replace(y,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,t):this.attr(n);return null!==r?W(r):void 0},val:function(e){return 0 in arguments?(null==e&&(e=""),this.each((function(t){this.value=H(this,e,t,this.value)}))):this[0]&&(this[0].multiple?t(this[0]).find("option").filter((function(){return this.selected})).pluck("value"):this[0].value)},offset:function(e){if(e)return this.each((function(n){var r=t(this),i=H(this,e,n,r.offset()),a=r.offsetParent().offset(),o={top:i.top-a.top,left:i.left-a.left};"static"==r.css("position")&&(o.position="relative"),r.css(o)}));if(!this.length)return null;if(u.documentElement!==this[0]&&!t.contains(u.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+window.pageXOffset,top:n.top+window.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(n,i){if(arguments.length<2){var a=this[0];if("string"==typeof n){if(!a)return;return a.style[r(n)]||getComputedStyle(a,"").getPropertyValue(n)}if(R(n)){if(!a)return;var o={},s=getComputedStyle(a,"");return t.each(n,(function(e,t){o[t]=a.style[r(t)]||s.getPropertyValue(t)})),o}}var l="";if("string"==L(n))i||0===i?l=N(n)+":"+F(n,i):this.each((function(){this.style.removeProperty(N(n))}));else for(e in n)n[e]||0===n[e]?l+=N(e)+":"+F(e,n[e])+";":this.each((function(){this.style.removeProperty(N(e))}));return this.each((function(){this.style.cssText+=";"+l}))},index:function(e){return e?this.indexOf(t(e)[0]):this.parent().children().indexOf(this[0])},hasClass:function(e){return!!e&&a.some.call(this,(function(e){return this.test(z(e))}),U(e))},addClass:function(e){return e?this.each((function(r){if("className"in this){n=[];var i=z(this);H(this,e,r,i).split(/\s+/g).forEach((function(e){t(this).hasClass(e)||n.push(e)}),this),n.length&&z(this,i+(i?" ":"")+n.join(" "))}})):this},removeClass:function(e){return this.each((function(t){if("className"in this){if(void 0===e)return z(this,"");n=z(this),H(this,e,t,n).split(/\s+/g).forEach((function(e){n=n.replace(U(e)," ")})),z(this,n.trim())}}))},toggleClass:function(e,n){return e?this.each((function(r){var i=t(this);H(this,e,r,z(this)).split(/\s+/g).forEach((function(e){(void 0===n?!i.hasClass(e):n)?i.addClass(e):i.removeClass(e)}))})):this},scrollTop:function(e){if(this.length){var t="scrollTop"in this[0];return void 0===e?t?this[0].scrollTop:this[0].pageYOffset:this.each(t?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var t="scrollLeft"in this[0];return void 0===e?t?this[0].scrollLeft:this[0].pageXOffset:this.each(t?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var e=this[0],n=this.offsetParent(),r=this.offset(),i=g.test(n[0].nodeName)?{top:0,left:0}:n.offset();return r.top-=parseFloat(t(e).css("margin-top"))||0,r.left-=parseFloat(t(e).css("margin-left"))||0,i.top+=parseFloat(t(n[0]).css("border-top-width"))||0,i.left+=parseFloat(t(n[0]).css("border-left-width"))||0,{top:r.top-i.top,left:r.left-i.left}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent||u.body;e&&!g.test(e.nodeName)&&"static"==t(e).css("position");)e=e.offsetParent;return e}))}},t.fn.detach=t.fn.remove,["width","height"].forEach((function(e){var n=e.replace(/./,(function(e){return e[0].toUpperCase()}));t.fn[e]=function(r){var i,a=this[0];return void 0===r?P(a)?a["inner"+n]:j(a)?a.documentElement["scroll"+n]:(i=this.offset())&&i[e]:this.each((function(n){(a=t(this)).css(e,H(this,r,n,a[e]()))}))}})),["after","prepend","before","append"].forEach((function(e,n){var r=n%2;t.fn[e]=function(){var e,i,a=t.map(arguments,(function(n){var r=[];return"array"==(e=L(n))?(n.forEach((function(e){return void 0!==e.nodeType?r.push(e):t.zepto.isZ(e)?r=r.concat(e.get()):void(r=r.concat(k.fragment(e)))})),r):"object"==e||null==n?n:k.fragment(n)})),o=this.length>1;return a.length<1?this:this.each((function(e,s){i=r?s:s.parentNode,s=0==n?s.nextSibling:1==n?s.firstChild:2==n?s:null;var l=t.contains(u.documentElement,i);a.forEach((function(e){if(o)e=e.cloneNode(!0);else if(!i)return t(e).remove();i.insertBefore(e,s),l&&$(e,(function(e){if(!(null==e.nodeName||"SCRIPT"!==e.nodeName.toUpperCase()||e.type&&"text/javascript"!==e.type||e.src)){var t=e.ownerDocument?e.ownerDocument.defaultView:window;t.eval.call(t,e.innerHTML)}}))}))}))},t.fn[r?e+"To":"insert"+(n?"Before":"After")]=function(n){return t(n)[e](this),this}})),k.Z.prototype=K.prototype=t.fn,k.uniq=i,k.deserializeValue=W,t.zepto=k,t}();window.Zepto=r,void 0===window.$&&(window.$=r),function(e){var t,n,r=+new Date,i=window.document,a=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,o=/^(?:text|application)\/javascript/i,s=/^(?:text|application)\/xml/i,l=/^\s*$/,u=i.createElement("a");function c(t,n,r,a){if(t.global)return function(t,n,r){var i=e.Event(n);return e(t).trigger(i,r),!i.isDefaultPrevented()}(n||i,r,a)}function d(e,t){var n=t.context;if(!1===t.beforeSend.call(n,e,t)||!1===c(t,n,"ajaxBeforeSend",[e,t]))return!1;c(t,n,"ajaxSend",[e,t])}function f(e,t,n,r){var i=n.context;n.success.call(i,e,"success",t),r&&r.resolveWith(i,[e,"success",t]),c(n,i,"ajaxSuccess",[t,n,e]),p("success",t,n)}function h(e,t,n,r,i){var a=r.context;r.error.call(a,n,t,e),i&&i.rejectWith(a,[n,t,e]),c(r,a,"ajaxError",[n,r,e||t]),p(t,n,r)}function p(t,n,r){var i=r.context;r.complete.call(i,n,t),c(r,i,"ajaxComplete",[n,r]),function(t){t.global&&!--e.active&&c(t,null,"ajaxStop")}(r)}function m(){}function g(e,t){return""==t?e:(e+"&"+t).replace(/[&?]{1,2}/,"?")}function y(t,n,r,i){return e.isFunction(n)&&(i=r,r=n,n=void 0),e.isFunction(r)||(i=r,r=void 0),{url:t,data:n,success:r,dataType:i}}u.href=window.location.href,e.active=0,e.ajaxJSONP=function(t,n){if(!("type"in t))return e.ajax(t);var a,o,s=t.jsonpCallback,l=(e.isFunction(s)?s():s)||"Zepto"+r++,u=i.createElement("script"),c=window[l],p=function(t){e(u).triggerHandler("error",t||"abort")},m={abort:p};return n&&n.promise(m),e(u).on("load error",(function(r,i){clearTimeout(o),e(u).off().remove(),"error"!=r.type&&a?f(a[0],m,t,n):h(null,i||"error",m,t,n),window[l]=c,a&&e.isFunction(c)&&c(a[0]),c=a=void 0})),!1===d(m,t)?(p("abort"),m):(window[l]=function(){a=arguments},u.src=t.url.replace(/\?(.+)=\?/,"?$1="+l),i.head.appendChild(u),t.timeout>0&&(o=setTimeout((function(){p("timeout")}),t.timeout)),m)},e.ajaxSettings={type:"GET",beforeSend:m,success:m,error:m,complete:m,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:"application/json",xml:"application/xml, text/xml",html:"text/html",text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:m},e.ajax=function(r){var a,p,y=e.extend({},r||{}),v=e.Deferred&&e.Deferred();for(t in e.ajaxSettings)void 0===y[t]&&(y[t]=e.ajaxSettings[t]);!function(t){t.global&&0==e.active++&&c(t,null,"ajaxStart")}(y),y.crossDomain||((a=i.createElement("a")).href=y.url,a.href=a.href,y.crossDomain=u.protocol+"//"+u.host!=a.protocol+"//"+a.host),y.url||(y.url=window.location.toString()),(p=y.url.indexOf("#"))>-1&&(y.url=y.url.slice(0,p)),function(t){t.processData&&t.data&&"string"!=e.type(t.data)&&(t.data=e.param(t.data,t.traditional)),!t.data||t.type&&"GET"!=t.type.toUpperCase()&&"jsonp"!=t.dataType||(t.url=g(t.url,t.data),t.data=void 0)}(y);var b=y.dataType,_=/\?.+=\?/.test(y.url);if(_&&(b="jsonp"),!1!==y.cache&&(r&&!0===r.cache||"script"!=b&&"jsonp"!=b)||(y.url=g(y.url,"_="+Date.now())),"jsonp"==b)return _||(y.url=g(y.url,y.jsonp?y.jsonp+"=?":!1===y.jsonp?"":"callback=?")),e.ajaxJSONP(y,v);var A,E=y.accepts[b],T={},w=function(e,t){T[e.toLowerCase()]=[e,t]},S=/^([\w-]+:)\/\//.test(y.url)?RegExp.$1:window.location.protocol,k=y.xhr(),C=k.setRequestHeader;if(v&&v.promise(k),y.crossDomain||w("X-Requested-With","XMLHttpRequest"),w("Accept",E||"*/*"),(E=y.mimeType||E)&&(E.indexOf(",")>-1&&(E=E.split(",",2)[0]),k.overrideMimeType&&k.overrideMimeType(E)),(y.contentType||!1!==y.contentType&&y.data&&"GET"!=y.type.toUpperCase())&&w("Content-Type",y.contentType||"application/x-www-form-urlencoded"),y.headers)for(n in y.headers)w(n,y.headers[n]);if(k.setRequestHeader=w,k.onreadystatechange=function(){if(4==k.readyState){k.onreadystatechange=m,clearTimeout(A);var t,n=!1;if(k.status>=200&&k.status<300||304==k.status||0==k.status&&"file:"==S){if(b=b||function(e){return e&&(e=e.split(";",2)[0]),e&&("text/html"==e?"html":"application/json"==e?"json":o.test(e)?"script":s.test(e)&&"xml")||"text"}(y.mimeType||k.getResponseHeader("content-type")),"arraybuffer"==k.responseType||"blob"==k.responseType)t=k.response;else{t=k.responseText;try{t=function(e,t,n){if(n.dataFilter==m)return e;var r=n.context;return n.dataFilter.call(r,e,t)}(t,b,y),"script"==b?(0,eval)(t):"xml"==b?t=k.responseXML:"json"==b&&(t=l.test(t)?null:e.parseJSON(t))}catch(e){n=e}if(n)return h(n,"parsererror",k,y,v)}f(t,k,y,v)}else h(k.statusText||null,k.status?"error":"abort",k,y,v)}},!1===d(k,y))return k.abort(),h(null,"abort",k,y,v),k;var x=!("async"in y)||y.async;if(k.open(y.type,y.url,x,y.username,y.password),y.xhrFields)for(n in y.xhrFields)k[n]=y.xhrFields[n];for(n in T)C.apply(k,T[n]);return y.timeout>0&&(A=setTimeout((function(){k.onreadystatechange=m,k.abort(),h(null,"timeout",k,y,v)}),y.timeout)),k.send(y.data?y.data:null),k},e.get=function(){return e.ajax(y.apply(null,arguments))},e.post=function(){var t=y.apply(null,arguments);return t.type="POST",e.ajax(t)},e.getJSON=function(){var t=y.apply(null,arguments);return t.dataType="json",e.ajax(t)},e.fn.load=function(t,n,r){if(!this.length)return this;var i,o=this,s=t.split(/\s/),l=y(t,n,r),u=l.success;return s.length>1&&(l.url=s[0],i=s[1]),l.success=function(t){o.html(i?e("<div>").html(t.replace(a,"")).find(i):t),u&&u.apply(o,arguments)},e.ajax(l),this};var v=encodeURIComponent;e.param=function(t,n){var r=[];return r.add=function(t,n){e.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(v(t)+"="+v(n))},function t(n,r,i,a){var o,s=e.isArray(r),l=e.isPlainObject(r);e.each(r,(function(r,u){o=e.type(u),a&&(r=i?a:a+"["+(l||"object"==o||"array"==o?r:"")+"]"),!a&&s?n.add(u.name,u.value):"array"==o||!i&&"object"==o?t(n,u,i,r):n.add(r,u)}))}(r,t,n),r.join("&").replace(/%20/g,"+")}}(r),(n=r).Callbacks=function(e){e=n.extend({},e);var t,r,i,a,o,s,l=[],u=!e.once&&[],c=function(n){for(t=e.memory&&n,r=!0,s=a||0,a=0,o=l.length,i=!0;l&&s<o;++s)if(!1===l[s].apply(n[0],n[1])&&e.stopOnFalse){t=!1;break}i=!1,l&&(u?u.length&&c(u.shift()):t?l.length=0:d.disable())},d={add:function(){if(l){var r=l.length,s=function(t){n.each(t,(function(t,n){"function"==typeof n?e.unique&&d.has(n)||l.push(n):n&&n.length&&"string"!=typeof n&&s(n)}))};s(arguments),i?o=l.length:t&&(a=r,c(t))}return this},remove:function(){return l&&n.each(arguments,(function(e,t){for(var r;(r=n.inArray(t,l,r))>-1;)l.splice(r,1),i&&(r<=o&&--o,r<=s&&--s)})),this},has:function(e){return!(!l||!(e?n.inArray(e,l)>-1:l.length))},empty:function(){return o=l.length=0,this},disable:function(){return l=u=t=void 0,this},disabled:function(){return!l},lock:function(){return u=void 0,t||d.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||r&&!u||(t=[e,(t=t||[]).slice?t.slice():t],i?u.push(t):c(t)),this},fire:function(){return d.fireWith(this,arguments)},fired:function(){return!!r}};return d},function(e){var t=Array.prototype.slice;function n(t){var r=[["resolve","done",e.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",e.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",e.Callbacks({memory:1})]],i="pending",a={state:function(){return i},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var t=arguments;return n((function(n){e.each(r,(function(r,i){var s=e.isFunction(t[r])&&t[r];o[i[1]]((function(){var t=s&&s.apply(this,arguments);if(t&&e.isFunction(t.promise))t.promise().done(n.resolve).fail(n.reject).progress(n.notify);else{var r=this===a?n.promise():this,o=s?[t]:arguments;n[i[0]+"With"](r,o)}}))})),t=null})).promise()},promise:function(t){return null!=t?e.extend(t,a):a}},o={};return e.each(r,(function(e,t){var n=t[2],s=t[3];a[t[1]]=n.add,s&&n.add((function(){i=s}),r[1^e][2].disable,r[2][2].lock),o[t[0]]=function(){return o[t[0]+"With"](this===o?a:this,arguments),this},o[t[0]+"With"]=n.fireWith})),a.promise(o),t&&t.call(o,o),o}e.when=function(r){var i,a,o,s=t.call(arguments),l=s.length,u=0,c=1!==l||r&&e.isFunction(r.promise)?l:0,d=1===c?r:n(),f=function(e,n,r){return function(a){n[e]=this,r[e]=arguments.length>1?t.call(arguments):a,r===i?d.notifyWith(n,r):--c||d.resolveWith(n,r)}};if(l>1)for(i=new Array(l),a=new Array(l),o=new Array(l);u<l;++u)s[u]&&e.isFunction(s[u].promise)?s[u].promise().done(f(u,o,s)).fail(d.reject).progress(f(u,a,i)):--c;return c||d.resolveWith(o,s),d.promise()},e.Deferred=n}(r),function(e){var t=1,n=Array.prototype.slice,r=e.isFunction,i=function(e){return"string"==typeof e},a={},o={},s="onfocusin"in window,l={focus:"focusin",blur:"focusout"},u={mouseenter:"mouseover",mouseleave:"mouseout"};function c(e){return e._zid||(e._zid=t++)}function d(e,t,n,r){if((t=f(t)).ns)var i=(o=t.ns,new RegExp("(?:^| )"+o.replace(" "," .* ?")+"(?: |$)"));var o;return(a[c(e)]||[]).filter((function(e){return e&&(!t.e||e.e==t.e)&&(!t.ns||i.test(e.ns))&&(!n||c(e.fn)===c(n))&&(!r||e.sel==r)}))}function f(e){var t=(""+e).split(".");return{e:t[0],ns:t.slice(1).sort().join(" ")}}function h(e,t){return e.del&&!s&&e.e in l||!!t}function p(e){return u[e]||s&&l[e]||e}function m(t,n,r,i,o,s,l){var d=c(t),m=a[d]||(a[d]=[]);n.split(/\s/).forEach((function(n){if("ready"==n)return e(document).ready(r);var a=f(n);a.fn=r,a.sel=o,a.e in u&&(r=function(t){var n=t.relatedTarget;if(!n||n!==this&&!e.contains(this,n))return a.fn.apply(this,arguments)}),a.del=s;var c=s||r;a.proxy=function(e){if(!(e=A(e)).isImmediatePropagationStopped()){e.data=i;var n=c.apply(t,null==e._args?[e]:[e].concat(e._args));return!1===n&&(e.preventDefault(),e.stopPropagation()),n}},a.i=m.length,m.push(a),"addEventListener"in t&&t.addEventListener(p(a.e),a.proxy,h(a,l))}))}function g(e,t,n,r,i){var o=c(e);(t||"").split(/\s/).forEach((function(t){d(e,t,n,r).forEach((function(t){delete a[o][t.i],"removeEventListener"in e&&e.removeEventListener(p(t.e),t.proxy,h(t,i))}))}))}o.click=o.mousedown=o.mouseup=o.mousemove="MouseEvents",e.event={add:m,remove:g},e.proxy=function(t,a){var o=2 in arguments&&n.call(arguments,2);if(r(t)){var s=function(){return t.apply(a,o?o.concat(n.call(arguments)):arguments)};return s._zid=c(t),s}if(i(a))return o?(o.unshift(t[a],t),e.proxy.apply(null,o)):e.proxy(t[a],t);throw new TypeError("expected function")},e.fn.bind=function(e,t,n){return this.on(e,t,n)},e.fn.unbind=function(e,t){return this.off(e,t)},e.fn.one=function(e,t,n,r){return this.on(e,t,n,r,1)};var y=function(){return!0},v=function(){return!1},b=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,_={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};function A(t,n){return!n&&t.isDefaultPrevented||(n||(n=t),e.each(_,(function(e,r){var i=n[e];t[e]=function(){return this[r]=y,i&&i.apply(n,arguments)},t[r]=v})),t.timeStamp||(t.timeStamp=Date.now()),(void 0!==n.defaultPrevented?n.defaultPrevented:"returnValue"in n?!1===n.returnValue:n.getPreventDefault&&n.getPreventDefault())&&(t.isDefaultPrevented=y)),t}function E(e){var t,n={originalEvent:e};for(t in e)b.test(t)||void 0===e[t]||(n[t]=e[t]);return A(n,e)}e.fn.delegate=function(e,t,n){return this.on(t,e,n)},e.fn.undelegate=function(e,t,n){return this.off(t,e,n)},e.fn.live=function(t,n){return e(document.body).delegate(this.selector,t,n),this},e.fn.die=function(t,n){return e(document.body).undelegate(this.selector,t,n),this},e.fn.on=function(t,a,o,s,l){var u,c,d=this;return t&&!i(t)?(e.each(t,(function(e,t){d.on(e,a,o,t,l)})),d):(i(a)||r(s)||!1===s||(s=o,o=a,a=void 0),void 0!==s&&!1!==o||(s=o,o=void 0),!1===s&&(s=v),d.each((function(r,i){l&&(u=function(e){return g(i,e.type,s),s.apply(this,arguments)}),a&&(c=function(t){var r,o=e(t.target).closest(a,i).get(0);if(o&&o!==i)return r=e.extend(E(t),{currentTarget:o,liveFired:i}),(u||s).apply(o,[r].concat(n.call(arguments,1)))}),m(i,t,s,o,a,c||u)})))},e.fn.off=function(t,n,a){var o=this;return t&&!i(t)?(e.each(t,(function(e,t){o.off(e,n,t)})),o):(i(n)||r(a)||!1===a||(a=n,n=void 0),!1===a&&(a=v),o.each((function(){g(this,t,a,n)})))},e.fn.trigger=function(t,n){return(t=i(t)||e.isPlainObject(t)?e.Event(t):A(t))._args=n,this.each((function(){t.type in l&&"function"==typeof this[t.type]?this[t.type]():"dispatchEvent"in this?this.dispatchEvent(t):e(this).triggerHandler(t,n)}))},e.fn.triggerHandler=function(t,n){var r,a;return this.each((function(o,s){(r=E(i(t)?e.Event(t):t))._args=n,r.target=s,e.each(d(s,t.type||t),(function(e,t){if(a=t.proxy(r),r.isImmediatePropagationStopped())return!1}))})),a},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach((function(t){e.fn[t]=function(e){return 0 in arguments?this.bind(t,e):this.trigger(t)}})),e.Event=function(e,t){i(e)||(e=(t=e).type);var n=document.createEvent(o[e]||"Events"),r=!0;if(t)for(var a in t)"bubbles"==a?r=!!t[a]:n[a]=t[a];return n.initEvent(e,r,!0),A(n)}}(r),function(){try{getComputedStyle(void 0)}catch(t){var e=getComputedStyle;window.getComputedStyle=function(t,n){try{return e(t,n)}catch(e){return null}}}}(),function(e){var t=e.zepto,n=t.qsa,r=t.matches;function i(t){return!(!(t=e(t)).width()&&!t.height())&&"none"!==t.css("display")}var a=e.expr[":"]={visible:function(){if(i(this))return this},hidden:function(){if(!i(this))return this},selected:function(){if(this.selected)return this},checked:function(){if(this.checked)return this},parent:function(){return this.parentNode},first:function(e){if(0===e)return this},last:function(e,t){if(e===t.length-1)return this},eq:function(e,t,n){if(e===n)return this},contains:function(t,n,r){if(e(this).text().indexOf(r)>-1)return this},has:function(e,n,r){if(t.qsa(this,r).length)return this}},o=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),s=/^\s*>/,l="Zepto"+ +new Date;function u(e,t){e=e.replace(/=#\]/g,'="#"]');var n,r,i=o.exec(e);if(i&&i[2]in a&&(n=a[i[2]],r=i[3],e=i[1],r)){var s=Number(r);r=isNaN(s)?r.replace(/^["']|["']$/g,""):s}return t(e,n,r)}t.qsa=function(r,i){return u(i,(function(a,o,u){try{var c;!a&&o?a="*":s.test(a)&&(c=e(r).addClass(l),a="."+l+" "+a);var d=n(r,a)}catch(e){throw console.error("error performing selector: %o",i),e}finally{c&&c.removeClass(l)}return o?t.uniq(e.map(d,(function(e,t){return o.call(e,t,d,u)}))):d}))},t.matches=function(e,t){return u(t,(function(t,n,i){return(!t||r(e,t))&&(!n||n.call(e,null,i)===e)}))}}(r),e.exports=r},"./node_modules/core-js/library/fn/array/from.js": -/*!*******************************************************!*\ - !*** ./node_modules/core-js/library/fn/array/from.js ***! - \*******************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ../../modules/es6.string.iterator */"./node_modules/core-js/library/modules/es6.string.iterator.js"),n(/*! ../../modules/es6.array.from */"./node_modules/core-js/library/modules/es6.array.from.js"),e.exports=n(/*! ../../modules/_core */"./node_modules/core-js/library/modules/_core.js").Array.from},"./node_modules/core-js/library/fn/get-iterator.js": -/*!*********************************************************!*\ - !*** ./node_modules/core-js/library/fn/get-iterator.js ***! - \*********************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ../modules/web.dom.iterable */"./node_modules/core-js/library/modules/web.dom.iterable.js"),n(/*! ../modules/es6.string.iterator */"./node_modules/core-js/library/modules/es6.string.iterator.js"),e.exports=n(/*! ../modules/core.get-iterator */"./node_modules/core-js/library/modules/core.get-iterator.js")},"./node_modules/core-js/library/fn/json/stringify.js": -/*!***********************************************************!*\ - !*** ./node_modules/core-js/library/fn/json/stringify.js ***! - \***********************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ../../modules/_core */"./node_modules/core-js/library/modules/_core.js"),i=r.JSON||(r.JSON={stringify:JSON.stringify});e.exports=function(e){return i.stringify.apply(i,arguments)}},"./node_modules/core-js/library/fn/object/assign.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js/library/fn/object/assign.js ***! - \**********************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ../../modules/es6.object.assign */"./node_modules/core-js/library/modules/es6.object.assign.js"),e.exports=n(/*! ../../modules/_core */"./node_modules/core-js/library/modules/_core.js").Object.assign},"./node_modules/core-js/library/fn/object/create.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js/library/fn/object/create.js ***! - \**********************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ../../modules/es6.object.create */"./node_modules/core-js/library/modules/es6.object.create.js");var r=n(/*! ../../modules/_core */"./node_modules/core-js/library/modules/_core.js").Object;e.exports=function(e,t){return r.create(e,t)}},"./node_modules/core-js/library/fn/object/define-property.js": -/*!*******************************************************************!*\ - !*** ./node_modules/core-js/library/fn/object/define-property.js ***! - \*******************************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ../../modules/es6.object.define-property */"./node_modules/core-js/library/modules/es6.object.define-property.js");var r=n(/*! ../../modules/_core */"./node_modules/core-js/library/modules/_core.js").Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},"./node_modules/core-js/library/fn/object/get-own-property-descriptor.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/core-js/library/fn/object/get-own-property-descriptor.js ***! - \*******************************************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ../../modules/es6.object.get-own-property-descriptor */"./node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js");var r=n(/*! ../../modules/_core */"./node_modules/core-js/library/modules/_core.js").Object;e.exports=function(e,t){return r.getOwnPropertyDescriptor(e,t)}},"./node_modules/core-js/library/fn/object/keys.js": -/*!********************************************************!*\ - !*** ./node_modules/core-js/library/fn/object/keys.js ***! - \********************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ../../modules/es6.object.keys */"./node_modules/core-js/library/modules/es6.object.keys.js"),e.exports=n(/*! ../../modules/_core */"./node_modules/core-js/library/modules/_core.js").Object.keys},"./node_modules/core-js/library/fn/object/set-prototype-of.js": -/*!********************************************************************!*\ - !*** ./node_modules/core-js/library/fn/object/set-prototype-of.js ***! - \********************************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ../../modules/es6.object.set-prototype-of */"./node_modules/core-js/library/modules/es6.object.set-prototype-of.js"),e.exports=n(/*! ../../modules/_core */"./node_modules/core-js/library/modules/_core.js").Object.setPrototypeOf},"./node_modules/core-js/library/fn/symbol/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/core-js/library/fn/symbol/index.js ***! - \*********************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ../../modules/es6.symbol */"./node_modules/core-js/library/modules/es6.symbol.js"),n(/*! ../../modules/es6.object.to-string */"./node_modules/core-js/library/modules/es6.object.to-string.js"),n(/*! ../../modules/es7.symbol.async-iterator */"./node_modules/core-js/library/modules/es7.symbol.async-iterator.js"),n(/*! ../../modules/es7.symbol.observable */"./node_modules/core-js/library/modules/es7.symbol.observable.js"),e.exports=n(/*! ../../modules/_core */"./node_modules/core-js/library/modules/_core.js").Symbol},"./node_modules/core-js/library/fn/symbol/iterator.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/fn/symbol/iterator.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ../../modules/es6.string.iterator */"./node_modules/core-js/library/modules/es6.string.iterator.js"),n(/*! ../../modules/web.dom.iterable */"./node_modules/core-js/library/modules/web.dom.iterable.js"),e.exports=n(/*! ../../modules/_wks-ext */"./node_modules/core-js/library/modules/_wks-ext.js").f("iterator")},"./node_modules/core-js/library/modules/_a-function.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_a-function.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},"./node_modules/core-js/library/modules/_add-to-unscopables.js": -/*!*********************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_add-to-unscopables.js ***! - \*********************************************************************/ -/*! no static exports found */function(e,t){e.exports=function(){}},"./node_modules/core-js/library/modules/_an-object.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_an-object.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_is-object */"./node_modules/core-js/library/modules/_is-object.js");e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},"./node_modules/core-js/library/modules/_array-includes.js": -/*!*****************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_array-includes.js ***! - \*****************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_to-iobject */"./node_modules/core-js/library/modules/_to-iobject.js"),i=n(/*! ./_to-length */"./node_modules/core-js/library/modules/_to-length.js"),a=n(/*! ./_to-index */"./node_modules/core-js/library/modules/_to-index.js");e.exports=function(e){return function(t,n,o){var s,l=r(t),u=i(l.length),c=a(o,u);if(e&&n!=n){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}}},"./node_modules/core-js/library/modules/_classof.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_classof.js ***! - \**********************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_cof */"./node_modules/core-js/library/modules/_cof.js"),i=n(/*! ./_wks */"./node_modules/core-js/library/modules/_wks.js")("toStringTag"),a="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?r(t):"Object"==(o=r(t))&&"function"==typeof t.callee?"Arguments":o}},"./node_modules/core-js/library/modules/_cof.js": -/*!******************************************************!*\ - !*** ./node_modules/core-js/library/modules/_cof.js ***! - \******************************************************/ -/*! no static exports found */function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},"./node_modules/core-js/library/modules/_core.js": -/*!*******************************************************!*\ - !*** ./node_modules/core-js/library/modules/_core.js ***! - \*******************************************************/ -/*! no static exports found */function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},"./node_modules/core-js/library/modules/_create-property.js": -/*!******************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_create-property.js ***! - \******************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";var r=n(/*! ./_object-dp */"./node_modules/core-js/library/modules/_object-dp.js"),i=n(/*! ./_property-desc */"./node_modules/core-js/library/modules/_property-desc.js");e.exports=function(e,t,n){t in e?r.f(e,t,i(0,n)):e[t]=n}},"./node_modules/core-js/library/modules/_ctx.js": -/*!******************************************************!*\ - !*** ./node_modules/core-js/library/modules/_ctx.js ***! - \******************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_a-function */"./node_modules/core-js/library/modules/_a-function.js");e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},"./node_modules/core-js/library/modules/_defined.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_defined.js ***! - \**********************************************************/ -/*! no static exports found */function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},"./node_modules/core-js/library/modules/_descriptors.js": -/*!**************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_descriptors.js ***! - \**************************************************************/ -/*! no static exports found */function(e,t,n){e.exports=!n(/*! ./_fails */"./node_modules/core-js/library/modules/_fails.js")((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},"./node_modules/core-js/library/modules/_dom-create.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_dom-create.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_is-object */"./node_modules/core-js/library/modules/_is-object.js"),i=n(/*! ./_global */"./node_modules/core-js/library/modules/_global.js").document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},"./node_modules/core-js/library/modules/_enum-bug-keys.js": -/*!****************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_enum-bug-keys.js ***! - \****************************************************************/ -/*! no static exports found */function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},"./node_modules/core-js/library/modules/_enum-keys.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_enum-keys.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_object-keys */"./node_modules/core-js/library/modules/_object-keys.js"),i=n(/*! ./_object-gops */"./node_modules/core-js/library/modules/_object-gops.js"),a=n(/*! ./_object-pie */"./node_modules/core-js/library/modules/_object-pie.js");e.exports=function(e){var t=r(e),n=i.f;if(n)for(var o,s=n(e),l=a.f,u=0;s.length>u;)l.call(e,o=s[u++])&&t.push(o);return t}},"./node_modules/core-js/library/modules/_export.js": -/*!*********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_export.js ***! - \*********************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_global */"./node_modules/core-js/library/modules/_global.js"),i=n(/*! ./_core */"./node_modules/core-js/library/modules/_core.js"),a=n(/*! ./_ctx */"./node_modules/core-js/library/modules/_ctx.js"),o=n(/*! ./_hide */"./node_modules/core-js/library/modules/_hide.js"),s=function(e,t,n){var l,u,c,d=e&s.F,f=e&s.G,h=e&s.S,p=e&s.P,m=e&s.B,g=e&s.W,y=f?i:i[t]||(i[t]={}),v=y.prototype,b=f?r:h?r[t]:(r[t]||{}).prototype;for(l in f&&(n=t),n)(u=!d&&b&&void 0!==b[l])&&l in y||(c=u?b[l]:n[l],y[l]=f&&"function"!=typeof b[l]?n[l]:m&&u?a(c,r):g&&b[l]==c?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(c):p&&"function"==typeof c?a(Function.call,c):c,p&&((y.virtual||(y.virtual={}))[l]=c,e&s.R&&v&&!v[l]&&o(v,l,c)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},"./node_modules/core-js/library/modules/_fails.js": -/*!********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_fails.js ***! - \********************************************************/ -/*! no static exports found */function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},"./node_modules/core-js/library/modules/_global.js": -/*!*********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_global.js ***! - \*********************************************************/ -/*! no static exports found */function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},"./node_modules/core-js/library/modules/_has.js": -/*!******************************************************!*\ - !*** ./node_modules/core-js/library/modules/_has.js ***! - \******************************************************/ -/*! no static exports found */function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},"./node_modules/core-js/library/modules/_hide.js": -/*!*******************************************************!*\ - !*** ./node_modules/core-js/library/modules/_hide.js ***! - \*******************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_object-dp */"./node_modules/core-js/library/modules/_object-dp.js"),i=n(/*! ./_property-desc */"./node_modules/core-js/library/modules/_property-desc.js");e.exports=n(/*! ./_descriptors */"./node_modules/core-js/library/modules/_descriptors.js")?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},"./node_modules/core-js/library/modules/_html.js": -/*!*******************************************************!*\ - !*** ./node_modules/core-js/library/modules/_html.js ***! - \*******************************************************/ -/*! no static exports found */function(e,t,n){e.exports=n(/*! ./_global */"./node_modules/core-js/library/modules/_global.js").document&&document.documentElement},"./node_modules/core-js/library/modules/_ie8-dom-define.js": -/*!*****************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_ie8-dom-define.js ***! - \*****************************************************************/ -/*! no static exports found */function(e,t,n){e.exports=!n(/*! ./_descriptors */"./node_modules/core-js/library/modules/_descriptors.js")&&!n(/*! ./_fails */"./node_modules/core-js/library/modules/_fails.js")((function(){return 7!=Object.defineProperty(n(/*! ./_dom-create */"./node_modules/core-js/library/modules/_dom-create.js")("div"),"a",{get:function(){return 7}}).a}))},"./node_modules/core-js/library/modules/_iobject.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_iobject.js ***! - \**********************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_cof */"./node_modules/core-js/library/modules/_cof.js");e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},"./node_modules/core-js/library/modules/_is-array-iter.js": -/*!****************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_is-array-iter.js ***! - \****************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_iterators */"./node_modules/core-js/library/modules/_iterators.js"),i=n(/*! ./_wks */"./node_modules/core-js/library/modules/_wks.js")("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||a[i]===e)}},"./node_modules/core-js/library/modules/_is-array.js": -/*!***********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_is-array.js ***! - \***********************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_cof */"./node_modules/core-js/library/modules/_cof.js");e.exports=Array.isArray||function(e){return"Array"==r(e)}},"./node_modules/core-js/library/modules/_is-object.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_is-object.js ***! - \************************************************************/ -/*! no static exports found */function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},"./node_modules/core-js/library/modules/_iter-call.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_iter-call.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_an-object */"./node_modules/core-js/library/modules/_an-object.js");e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var a=e.return;throw void 0!==a&&r(a.call(e)),t}}},"./node_modules/core-js/library/modules/_iter-create.js": -/*!**************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_iter-create.js ***! - \**************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";var r=n(/*! ./_object-create */"./node_modules/core-js/library/modules/_object-create.js"),i=n(/*! ./_property-desc */"./node_modules/core-js/library/modules/_property-desc.js"),a=n(/*! ./_set-to-string-tag */"./node_modules/core-js/library/modules/_set-to-string-tag.js"),o={};n(/*! ./_hide */"./node_modules/core-js/library/modules/_hide.js")(o,n(/*! ./_wks */"./node_modules/core-js/library/modules/_wks.js")("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=r(o,{next:i(1,n)}),a(e,t+" Iterator")}},"./node_modules/core-js/library/modules/_iter-define.js": -/*!**************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_iter-define.js ***! - \**************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";var r=n(/*! ./_library */"./node_modules/core-js/library/modules/_library.js"),i=n(/*! ./_export */"./node_modules/core-js/library/modules/_export.js"),a=n(/*! ./_redefine */"./node_modules/core-js/library/modules/_redefine.js"),o=n(/*! ./_hide */"./node_modules/core-js/library/modules/_hide.js"),s=n(/*! ./_has */"./node_modules/core-js/library/modules/_has.js"),l=n(/*! ./_iterators */"./node_modules/core-js/library/modules/_iterators.js"),u=n(/*! ./_iter-create */"./node_modules/core-js/library/modules/_iter-create.js"),c=n(/*! ./_set-to-string-tag */"./node_modules/core-js/library/modules/_set-to-string-tag.js"),d=n(/*! ./_object-gpo */"./node_modules/core-js/library/modules/_object-gpo.js"),f=n(/*! ./_wks */"./node_modules/core-js/library/modules/_wks.js")("iterator"),h=!([].keys&&"next"in[].keys()),p=function(){return this};e.exports=function(e,t,n,m,g,y,v){u(n,t,m);var b,_,A,E=function(e){if(!h&&e in k)return k[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},T=t+" Iterator",w="values"==g,S=!1,k=e.prototype,C=k[f]||k["@@iterator"]||g&&k[g],x=C||E(g),R=g?w?E("entries"):x:void 0,L="Array"==t&&k.entries||C;if(L&&(A=d(L.call(new e)))!==Object.prototype&&(c(A,T,!0),r||s(A,f)||o(A,f,p)),w&&C&&"values"!==C.name&&(S=!0,x=function(){return C.call(this)}),r&&!v||!h&&!S&&k[f]||o(k,f,x),l[t]=x,l[T]=p,g)if(b={values:w?x:E("values"),keys:y?x:E("keys"),entries:R},v)for(_ in b)_ in k||a(k,_,b[_]);else i(i.P+i.F*(h||S),t,b);return b}},"./node_modules/core-js/library/modules/_iter-detect.js": -/*!**************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_iter-detect.js ***! - \**************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_wks */"./node_modules/core-js/library/modules/_wks.js")("iterator"),i=!1;try{var a=[7][r]();a.return=function(){i=!0},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var a=[7],o=a[r]();o.next=function(){return{done:n=!0}},a[r]=function(){return o},e(a)}catch(e){}return n}},"./node_modules/core-js/library/modules/_iter-step.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_iter-step.js ***! - \************************************************************/ -/*! no static exports found */function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},"./node_modules/core-js/library/modules/_iterators.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_iterators.js ***! - \************************************************************/ -/*! no static exports found */function(e,t){e.exports={}},"./node_modules/core-js/library/modules/_keyof.js": -/*!********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_keyof.js ***! - \********************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_object-keys */"./node_modules/core-js/library/modules/_object-keys.js"),i=n(/*! ./_to-iobject */"./node_modules/core-js/library/modules/_to-iobject.js");e.exports=function(e,t){for(var n,a=i(e),o=r(a),s=o.length,l=0;s>l;)if(a[n=o[l++]]===t)return n}},"./node_modules/core-js/library/modules/_library.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_library.js ***! - \**********************************************************/ -/*! no static exports found */function(e,t){e.exports=!0},"./node_modules/core-js/library/modules/_meta.js": -/*!*******************************************************!*\ - !*** ./node_modules/core-js/library/modules/_meta.js ***! - \*******************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_uid */"./node_modules/core-js/library/modules/_uid.js")("meta"),i=n(/*! ./_is-object */"./node_modules/core-js/library/modules/_is-object.js"),a=n(/*! ./_has */"./node_modules/core-js/library/modules/_has.js"),o=n(/*! ./_object-dp */"./node_modules/core-js/library/modules/_object-dp.js").f,s=0,l=Object.isExtensible||function(){return!0},u=!n(/*! ./_fails */"./node_modules/core-js/library/modules/_fails.js")((function(){return l(Object.preventExtensions({}))})),c=function(e){o(e,r,{value:{i:"O"+ ++s,w:{}}})},d=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!a(e,r)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[r].i},getWeak:function(e,t){if(!a(e,r)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[r].w},onFreeze:function(e){return u&&d.NEED&&l(e)&&!a(e,r)&&c(e),e}}},"./node_modules/core-js/library/modules/_object-assign.js": -/*!****************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-assign.js ***! - \****************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";var r=n(/*! ./_object-keys */"./node_modules/core-js/library/modules/_object-keys.js"),i=n(/*! ./_object-gops */"./node_modules/core-js/library/modules/_object-gops.js"),a=n(/*! ./_object-pie */"./node_modules/core-js/library/modules/_object-pie.js"),o=n(/*! ./_to-object */"./node_modules/core-js/library/modules/_to-object.js"),s=n(/*! ./_iobject */"./node_modules/core-js/library/modules/_iobject.js"),l=Object.assign;e.exports=!l||n(/*! ./_fails */"./node_modules/core-js/library/modules/_fails.js")((function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e})),7!=l({},e)[n]||Object.keys(l({},t)).join("")!=r}))?function(e,t){for(var n=o(e),l=arguments.length,u=1,c=i.f,d=a.f;l>u;)for(var f,h=s(arguments[u++]),p=c?r(h).concat(c(h)):r(h),m=p.length,g=0;m>g;)d.call(h,f=p[g++])&&(n[f]=h[f]);return n}:l},"./node_modules/core-js/library/modules/_object-create.js": -/*!****************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-create.js ***! - \****************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_an-object */"./node_modules/core-js/library/modules/_an-object.js"),i=n(/*! ./_object-dps */"./node_modules/core-js/library/modules/_object-dps.js"),a=n(/*! ./_enum-bug-keys */"./node_modules/core-js/library/modules/_enum-bug-keys.js"),o=n(/*! ./_shared-key */"./node_modules/core-js/library/modules/_shared-key.js")("IE_PROTO"),s=function(){},l=function(){var e,t=n(/*! ./_dom-create */"./node_modules/core-js/library/modules/_dom-create.js")("iframe"),r=a.length;for(t.style.display="none",n(/*! ./_html */"./node_modules/core-js/library/modules/_html.js").appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),l=e.F;r--;)delete l.prototype[a[r]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[o]=e):n=l(),void 0===t?n:i(n,t)}},"./node_modules/core-js/library/modules/_object-dp.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-dp.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_an-object */"./node_modules/core-js/library/modules/_an-object.js"),i=n(/*! ./_ie8-dom-define */"./node_modules/core-js/library/modules/_ie8-dom-define.js"),a=n(/*! ./_to-primitive */"./node_modules/core-js/library/modules/_to-primitive.js"),o=Object.defineProperty;t.f=n(/*! ./_descriptors */"./node_modules/core-js/library/modules/_descriptors.js")?Object.defineProperty:function(e,t,n){if(r(e),t=a(t,!0),r(n),i)try{return o(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},"./node_modules/core-js/library/modules/_object-dps.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-dps.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_object-dp */"./node_modules/core-js/library/modules/_object-dp.js"),i=n(/*! ./_an-object */"./node_modules/core-js/library/modules/_an-object.js"),a=n(/*! ./_object-keys */"./node_modules/core-js/library/modules/_object-keys.js");e.exports=n(/*! ./_descriptors */"./node_modules/core-js/library/modules/_descriptors.js")?Object.defineProperties:function(e,t){i(e);for(var n,o=a(t),s=o.length,l=0;s>l;)r.f(e,n=o[l++],t[n]);return e}},"./node_modules/core-js/library/modules/_object-gopd.js": -/*!**************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-gopd.js ***! - \**************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_object-pie */"./node_modules/core-js/library/modules/_object-pie.js"),i=n(/*! ./_property-desc */"./node_modules/core-js/library/modules/_property-desc.js"),a=n(/*! ./_to-iobject */"./node_modules/core-js/library/modules/_to-iobject.js"),o=n(/*! ./_to-primitive */"./node_modules/core-js/library/modules/_to-primitive.js"),s=n(/*! ./_has */"./node_modules/core-js/library/modules/_has.js"),l=n(/*! ./_ie8-dom-define */"./node_modules/core-js/library/modules/_ie8-dom-define.js"),u=Object.getOwnPropertyDescriptor;t.f=n(/*! ./_descriptors */"./node_modules/core-js/library/modules/_descriptors.js")?u:function(e,t){if(e=a(e),t=o(t,!0),l)try{return u(e,t)}catch(e){}if(s(e,t))return i(!r.f.call(e,t),e[t])}},"./node_modules/core-js/library/modules/_object-gopn-ext.js": -/*!******************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-gopn-ext.js ***! - \******************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_to-iobject */"./node_modules/core-js/library/modules/_to-iobject.js"),i=n(/*! ./_object-gopn */"./node_modules/core-js/library/modules/_object-gopn.js").f,a={}.toString,o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return o&&"[object Window]"==a.call(e)?function(e){try{return i(e)}catch(e){return o.slice()}}(e):i(r(e))}},"./node_modules/core-js/library/modules/_object-gopn.js": -/*!**************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-gopn.js ***! - \**************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_object-keys-internal */"./node_modules/core-js/library/modules/_object-keys-internal.js"),i=n(/*! ./_enum-bug-keys */"./node_modules/core-js/library/modules/_enum-bug-keys.js").concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},"./node_modules/core-js/library/modules/_object-gops.js": -/*!**************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-gops.js ***! - \**************************************************************/ -/*! no static exports found */function(e,t){t.f=Object.getOwnPropertySymbols},"./node_modules/core-js/library/modules/_object-gpo.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-gpo.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_has */"./node_modules/core-js/library/modules/_has.js"),i=n(/*! ./_to-object */"./node_modules/core-js/library/modules/_to-object.js"),a=n(/*! ./_shared-key */"./node_modules/core-js/library/modules/_shared-key.js")("IE_PROTO"),o=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,a)?e[a]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},"./node_modules/core-js/library/modules/_object-keys-internal.js": -/*!***********************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-keys-internal.js ***! - \***********************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_has */"./node_modules/core-js/library/modules/_has.js"),i=n(/*! ./_to-iobject */"./node_modules/core-js/library/modules/_to-iobject.js"),a=n(/*! ./_array-includes */"./node_modules/core-js/library/modules/_array-includes.js")(!1),o=n(/*! ./_shared-key */"./node_modules/core-js/library/modules/_shared-key.js")("IE_PROTO");e.exports=function(e,t){var n,s=i(e),l=0,u=[];for(n in s)n!=o&&r(s,n)&&u.push(n);for(;t.length>l;)r(s,n=t[l++])&&(~a(u,n)||u.push(n));return u}},"./node_modules/core-js/library/modules/_object-keys.js": -/*!**************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-keys.js ***! - \**************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_object-keys-internal */"./node_modules/core-js/library/modules/_object-keys-internal.js"),i=n(/*! ./_enum-bug-keys */"./node_modules/core-js/library/modules/_enum-bug-keys.js");e.exports=Object.keys||function(e){return r(e,i)}},"./node_modules/core-js/library/modules/_object-pie.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-pie.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t){t.f={}.propertyIsEnumerable},"./node_modules/core-js/library/modules/_object-sap.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_object-sap.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_export */"./node_modules/core-js/library/modules/_export.js"),i=n(/*! ./_core */"./node_modules/core-js/library/modules/_core.js"),a=n(/*! ./_fails */"./node_modules/core-js/library/modules/_fails.js");e.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],o={};o[e]=t(n),r(r.S+r.F*a((function(){n(1)})),"Object",o)}},"./node_modules/core-js/library/modules/_property-desc.js": -/*!****************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_property-desc.js ***! - \****************************************************************/ -/*! no static exports found */function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},"./node_modules/core-js/library/modules/_redefine.js": -/*!***********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_redefine.js ***! - \***********************************************************/ -/*! no static exports found */function(e,t,n){e.exports=n(/*! ./_hide */"./node_modules/core-js/library/modules/_hide.js")},"./node_modules/core-js/library/modules/_set-proto.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_set-proto.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_is-object */"./node_modules/core-js/library/modules/_is-object.js"),i=n(/*! ./_an-object */"./node_modules/core-js/library/modules/_an-object.js"),a=function(e,t){if(i(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{(r=n(/*! ./_ctx */"./node_modules/core-js/library/modules/_ctx.js")(Function.call,n(/*! ./_object-gopd */"./node_modules/core-js/library/modules/_object-gopd.js").f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return a(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:a}},"./node_modules/core-js/library/modules/_set-to-string-tag.js": -/*!********************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_set-to-string-tag.js ***! - \********************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_object-dp */"./node_modules/core-js/library/modules/_object-dp.js").f,i=n(/*! ./_has */"./node_modules/core-js/library/modules/_has.js"),a=n(/*! ./_wks */"./node_modules/core-js/library/modules/_wks.js")("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,a)&&r(e,a,{configurable:!0,value:t})}},"./node_modules/core-js/library/modules/_shared-key.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_shared-key.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_shared */"./node_modules/core-js/library/modules/_shared.js")("keys"),i=n(/*! ./_uid */"./node_modules/core-js/library/modules/_uid.js");e.exports=function(e){return r[e]||(r[e]=i(e))}},"./node_modules/core-js/library/modules/_shared.js": -/*!*********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_shared.js ***! - \*********************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_global */"./node_modules/core-js/library/modules/_global.js"),i=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(e){return i[e]||(i[e]={})}},"./node_modules/core-js/library/modules/_string-at.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_string-at.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_to-integer */"./node_modules/core-js/library/modules/_to-integer.js"),i=n(/*! ./_defined */"./node_modules/core-js/library/modules/_defined.js");e.exports=function(e){return function(t,n){var a,o,s=String(i(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(a=s.charCodeAt(l))<55296||a>56319||l+1===u||(o=s.charCodeAt(l+1))<56320||o>57343?e?s.charAt(l):a:e?s.slice(l,l+2):o-56320+(a-55296<<10)+65536}}},"./node_modules/core-js/library/modules/_to-index.js": -/*!***********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_to-index.js ***! - \***********************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_to-integer */"./node_modules/core-js/library/modules/_to-integer.js"),i=Math.max,a=Math.min;e.exports=function(e,t){return(e=r(e))<0?i(e+t,0):a(e,t)}},"./node_modules/core-js/library/modules/_to-integer.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_to-integer.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},"./node_modules/core-js/library/modules/_to-iobject.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_to-iobject.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_iobject */"./node_modules/core-js/library/modules/_iobject.js"),i=n(/*! ./_defined */"./node_modules/core-js/library/modules/_defined.js");e.exports=function(e){return r(i(e))}},"./node_modules/core-js/library/modules/_to-length.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_to-length.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_to-integer */"./node_modules/core-js/library/modules/_to-integer.js"),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},"./node_modules/core-js/library/modules/_to-object.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_to-object.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_defined */"./node_modules/core-js/library/modules/_defined.js");e.exports=function(e){return Object(r(e))}},"./node_modules/core-js/library/modules/_to-primitive.js": -/*!***************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_to-primitive.js ***! - \***************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_is-object */"./node_modules/core-js/library/modules/_is-object.js");e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},"./node_modules/core-js/library/modules/_uid.js": -/*!******************************************************!*\ - !*** ./node_modules/core-js/library/modules/_uid.js ***! - \******************************************************/ -/*! no static exports found */function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},"./node_modules/core-js/library/modules/_wks-define.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js/library/modules/_wks-define.js ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_global */"./node_modules/core-js/library/modules/_global.js"),i=n(/*! ./_core */"./node_modules/core-js/library/modules/_core.js"),a=n(/*! ./_library */"./node_modules/core-js/library/modules/_library.js"),o=n(/*! ./_wks-ext */"./node_modules/core-js/library/modules/_wks-ext.js"),s=n(/*! ./_object-dp */"./node_modules/core-js/library/modules/_object-dp.js").f;e.exports=function(e){var t=i.Symbol||(i.Symbol=a?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:o.f(e)})}},"./node_modules/core-js/library/modules/_wks-ext.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js/library/modules/_wks-ext.js ***! - \**********************************************************/ -/*! no static exports found */function(e,t,n){t.f=n(/*! ./_wks */"./node_modules/core-js/library/modules/_wks.js")},"./node_modules/core-js/library/modules/_wks.js": -/*!******************************************************!*\ - !*** ./node_modules/core-js/library/modules/_wks.js ***! - \******************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_shared */"./node_modules/core-js/library/modules/_shared.js")("wks"),i=n(/*! ./_uid */"./node_modules/core-js/library/modules/_uid.js"),a=n(/*! ./_global */"./node_modules/core-js/library/modules/_global.js").Symbol,o="function"==typeof a;(e.exports=function(e){return r[e]||(r[e]=o&&a[e]||(o?a:i)("Symbol."+e))}).store=r},"./node_modules/core-js/library/modules/core.get-iterator-method.js": -/*!**************************************************************************!*\ - !*** ./node_modules/core-js/library/modules/core.get-iterator-method.js ***! - \**************************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_classof */"./node_modules/core-js/library/modules/_classof.js"),i=n(/*! ./_wks */"./node_modules/core-js/library/modules/_wks.js")("iterator"),a=n(/*! ./_iterators */"./node_modules/core-js/library/modules/_iterators.js");e.exports=n(/*! ./_core */"./node_modules/core-js/library/modules/_core.js").getIteratorMethod=function(e){if(null!=e)return e[i]||e["@@iterator"]||a[r(e)]}},"./node_modules/core-js/library/modules/core.get-iterator.js": -/*!*******************************************************************!*\ - !*** ./node_modules/core-js/library/modules/core.get-iterator.js ***! - \*******************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_an-object */"./node_modules/core-js/library/modules/_an-object.js"),i=n(/*! ./core.get-iterator-method */"./node_modules/core-js/library/modules/core.get-iterator-method.js");e.exports=n(/*! ./_core */"./node_modules/core-js/library/modules/_core.js").getIterator=function(e){var t=i(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},"./node_modules/core-js/library/modules/es6.array.from.js": -/*!****************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.array.from.js ***! - \****************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";var r=n(/*! ./_ctx */"./node_modules/core-js/library/modules/_ctx.js"),i=n(/*! ./_export */"./node_modules/core-js/library/modules/_export.js"),a=n(/*! ./_to-object */"./node_modules/core-js/library/modules/_to-object.js"),o=n(/*! ./_iter-call */"./node_modules/core-js/library/modules/_iter-call.js"),s=n(/*! ./_is-array-iter */"./node_modules/core-js/library/modules/_is-array-iter.js"),l=n(/*! ./_to-length */"./node_modules/core-js/library/modules/_to-length.js"),u=n(/*! ./_create-property */"./node_modules/core-js/library/modules/_create-property.js"),c=n(/*! ./core.get-iterator-method */"./node_modules/core-js/library/modules/core.get-iterator-method.js");i(i.S+i.F*!n(/*! ./_iter-detect */"./node_modules/core-js/library/modules/_iter-detect.js")((function(e){Array.from(e)})),"Array",{from:function(e){var t,n,i,d,f=a(e),h="function"==typeof this?this:Array,p=arguments.length,m=p>1?arguments[1]:void 0,g=void 0!==m,y=0,v=c(f);if(g&&(m=r(m,p>2?arguments[2]:void 0,2)),null==v||h==Array&&s(v))for(n=new h(t=l(f.length));t>y;y++)u(n,y,g?m(f[y],y):f[y]);else for(d=v.call(f),n=new h;!(i=d.next()).done;y++)u(n,y,g?o(d,m,[i.value,y],!0):i.value);return n.length=y,n}})},"./node_modules/core-js/library/modules/es6.array.iterator.js": -/*!********************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.array.iterator.js ***! - \********************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";var r=n(/*! ./_add-to-unscopables */"./node_modules/core-js/library/modules/_add-to-unscopables.js"),i=n(/*! ./_iter-step */"./node_modules/core-js/library/modules/_iter-step.js"),a=n(/*! ./_iterators */"./node_modules/core-js/library/modules/_iterators.js"),o=n(/*! ./_to-iobject */"./node_modules/core-js/library/modules/_to-iobject.js");e.exports=n(/*! ./_iter-define */"./node_modules/core-js/library/modules/_iter-define.js")(Array,"Array",(function(e,t){this._t=o(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):i(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),a.Arguments=a.Array,r("keys"),r("values"),r("entries")},"./node_modules/core-js/library/modules/es6.object.assign.js": -/*!*******************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.object.assign.js ***! - \*******************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_export */"./node_modules/core-js/library/modules/_export.js");r(r.S+r.F,"Object",{assign:n(/*! ./_object-assign */"./node_modules/core-js/library/modules/_object-assign.js")})},"./node_modules/core-js/library/modules/es6.object.create.js": -/*!*******************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.object.create.js ***! - \*******************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_export */"./node_modules/core-js/library/modules/_export.js");r(r.S,"Object",{create:n(/*! ./_object-create */"./node_modules/core-js/library/modules/_object-create.js")})},"./node_modules/core-js/library/modules/es6.object.define-property.js": -/*!****************************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.object.define-property.js ***! - \****************************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_export */"./node_modules/core-js/library/modules/_export.js");r(r.S+r.F*!n(/*! ./_descriptors */"./node_modules/core-js/library/modules/_descriptors.js"),"Object",{defineProperty:n(/*! ./_object-dp */"./node_modules/core-js/library/modules/_object-dp.js").f})},"./node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js": -/*!****************************************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js ***! - \****************************************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_to-iobject */"./node_modules/core-js/library/modules/_to-iobject.js"),i=n(/*! ./_object-gopd */"./node_modules/core-js/library/modules/_object-gopd.js").f;n(/*! ./_object-sap */"./node_modules/core-js/library/modules/_object-sap.js")("getOwnPropertyDescriptor",(function(){return function(e,t){return i(r(e),t)}}))},"./node_modules/core-js/library/modules/es6.object.keys.js": -/*!*****************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.object.keys.js ***! - \*****************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_to-object */"./node_modules/core-js/library/modules/_to-object.js"),i=n(/*! ./_object-keys */"./node_modules/core-js/library/modules/_object-keys.js");n(/*! ./_object-sap */"./node_modules/core-js/library/modules/_object-sap.js")("keys",(function(){return function(e){return i(r(e))}}))},"./node_modules/core-js/library/modules/es6.object.set-prototype-of.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.object.set-prototype-of.js ***! - \*****************************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ./_export */"./node_modules/core-js/library/modules/_export.js");r(r.S,"Object",{setPrototypeOf:n(/*! ./_set-proto */"./node_modules/core-js/library/modules/_set-proto.js").set})},"./node_modules/core-js/library/modules/es6.object.to-string.js": -/*!**********************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.object.to-string.js ***! - \**********************************************************************/ -/*! no static exports found */function(e,t){},"./node_modules/core-js/library/modules/es6.string.iterator.js": -/*!*********************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.string.iterator.js ***! - \*********************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";var r=n(/*! ./_string-at */"./node_modules/core-js/library/modules/_string-at.js")(!0);n(/*! ./_iter-define */"./node_modules/core-js/library/modules/_iter-define.js")(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})}))},"./node_modules/core-js/library/modules/es6.symbol.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es6.symbol.js ***! - \************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";var r=n(/*! ./_global */"./node_modules/core-js/library/modules/_global.js"),i=n(/*! ./_has */"./node_modules/core-js/library/modules/_has.js"),a=n(/*! ./_descriptors */"./node_modules/core-js/library/modules/_descriptors.js"),o=n(/*! ./_export */"./node_modules/core-js/library/modules/_export.js"),s=n(/*! ./_redefine */"./node_modules/core-js/library/modules/_redefine.js"),l=n(/*! ./_meta */"./node_modules/core-js/library/modules/_meta.js").KEY,u=n(/*! ./_fails */"./node_modules/core-js/library/modules/_fails.js"),c=n(/*! ./_shared */"./node_modules/core-js/library/modules/_shared.js"),d=n(/*! ./_set-to-string-tag */"./node_modules/core-js/library/modules/_set-to-string-tag.js"),f=n(/*! ./_uid */"./node_modules/core-js/library/modules/_uid.js"),h=n(/*! ./_wks */"./node_modules/core-js/library/modules/_wks.js"),p=n(/*! ./_wks-ext */"./node_modules/core-js/library/modules/_wks-ext.js"),m=n(/*! ./_wks-define */"./node_modules/core-js/library/modules/_wks-define.js"),g=n(/*! ./_keyof */"./node_modules/core-js/library/modules/_keyof.js"),y=n(/*! ./_enum-keys */"./node_modules/core-js/library/modules/_enum-keys.js"),v=n(/*! ./_is-array */"./node_modules/core-js/library/modules/_is-array.js"),b=n(/*! ./_an-object */"./node_modules/core-js/library/modules/_an-object.js"),_=n(/*! ./_to-iobject */"./node_modules/core-js/library/modules/_to-iobject.js"),A=n(/*! ./_to-primitive */"./node_modules/core-js/library/modules/_to-primitive.js"),E=n(/*! ./_property-desc */"./node_modules/core-js/library/modules/_property-desc.js"),T=n(/*! ./_object-create */"./node_modules/core-js/library/modules/_object-create.js"),w=n(/*! ./_object-gopn-ext */"./node_modules/core-js/library/modules/_object-gopn-ext.js"),S=n(/*! ./_object-gopd */"./node_modules/core-js/library/modules/_object-gopd.js"),k=n(/*! ./_object-dp */"./node_modules/core-js/library/modules/_object-dp.js"),C=n(/*! ./_object-keys */"./node_modules/core-js/library/modules/_object-keys.js"),x=S.f,R=k.f,L=w.f,I=r.Symbol,P=r.JSON,j=P&&P.stringify,O=h("_hidden"),D=h("toPrimitive"),M={}.propertyIsEnumerable,N=c("symbol-registry"),U=c("symbols"),F=c("op-symbols"),B=Object.prototype,K="function"==typeof I,V=r.QObject,G=!V||!V.prototype||!V.prototype.findChild,H=a&&u((function(){return 7!=T(R({},"a",{get:function(){return R(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=x(B,t);r&&delete B[t],R(e,t,n),r&&e!==B&&R(B,t,r)}:R,Y=function(e){var t=U[e]=T(I.prototype);return t._k=e,t},z=K&&"symbol"==typeof I.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof I},W=function(e,t,n){return e===B&&W(F,t,n),b(e),t=A(t,!0),b(n),i(U,t)?(n.enumerable?(i(e,O)&&e[O][t]&&(e[O][t]=!1),n=T(n,{enumerable:E(0,!1)})):(i(e,O)||R(e,O,E(1,{})),e[O][t]=!0),H(e,t,n)):R(e,t,n)},$=function(e,t){b(e);for(var n,r=y(t=_(t)),i=0,a=r.length;a>i;)W(e,n=r[i++],t[n]);return e},q=function(e){var t=M.call(this,e=A(e,!0));return!(this===B&&i(U,e)&&!i(F,e))&&(!(t||!i(this,e)||!i(U,e)||i(this,O)&&this[O][e])||t)},X=function(e,t){if(e=_(e),t=A(t,!0),e!==B||!i(U,t)||i(F,t)){var n=x(e,t);return!n||!i(U,t)||i(e,O)&&e[O][t]||(n.enumerable=!0),n}},J=function(e){for(var t,n=L(_(e)),r=[],a=0;n.length>a;)i(U,t=n[a++])||t==O||t==l||r.push(t);return r},Q=function(e){for(var t,n=e===B,r=L(n?F:_(e)),a=[],o=0;r.length>o;)!i(U,t=r[o++])||n&&!i(B,t)||a.push(U[t]);return a};K||(s((I=function(){if(this instanceof I)throw TypeError("Symbol is not a constructor!");var e=f(arguments.length>0?arguments[0]:void 0),t=function(n){this===B&&t.call(F,n),i(this,O)&&i(this[O],e)&&(this[O][e]=!1),H(this,e,E(1,n))};return a&&G&&H(B,e,{configurable:!0,set:t}),Y(e)}).prototype,"toString",(function(){return this._k})),S.f=X,k.f=W,n(/*! ./_object-gopn */"./node_modules/core-js/library/modules/_object-gopn.js").f=w.f=J,n(/*! ./_object-pie */"./node_modules/core-js/library/modules/_object-pie.js").f=q,n(/*! ./_object-gops */"./node_modules/core-js/library/modules/_object-gops.js").f=Q,a&&!n(/*! ./_library */"./node_modules/core-js/library/modules/_library.js")&&s(B,"propertyIsEnumerable",q,!0),p.f=function(e){return Y(h(e))}),o(o.G+o.W+o.F*!K,{Symbol:I});for(var Z="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ee=0;Z.length>ee;)h(Z[ee++]);for(Z=C(h.store),ee=0;Z.length>ee;)m(Z[ee++]);o(o.S+o.F*!K,"Symbol",{for:function(e){return i(N,e+="")?N[e]:N[e]=I(e)},keyFor:function(e){if(z(e))return g(N,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){G=!0},useSimple:function(){G=!1}}),o(o.S+o.F*!K,"Object",{create:function(e,t){return void 0===t?T(e):$(T(e),t)},defineProperty:W,defineProperties:$,getOwnPropertyDescriptor:X,getOwnPropertyNames:J,getOwnPropertySymbols:Q}),P&&o(o.S+o.F*(!K||u((function(){var e=I();return"[null]"!=j([e])||"{}"!=j({a:e})||"{}"!=j(Object(e))}))),"JSON",{stringify:function(e){if(void 0!==e&&!z(e)){for(var t,n,r=[e],i=1;arguments.length>i;)r.push(arguments[i++]);return"function"==typeof(t=r[1])&&(n=t),!n&&v(t)||(t=function(e,t){if(n&&(t=n.call(this,e,t)),!z(t))return t}),r[1]=t,j.apply(P,r)}}}),I.prototype[D]||n(/*! ./_hide */"./node_modules/core-js/library/modules/_hide.js")(I.prototype,D,I.prototype.valueOf),d(I,"Symbol"),d(Math,"Math",!0),d(r.JSON,"JSON",!0)},"./node_modules/core-js/library/modules/es7.symbol.async-iterator.js": -/*!***************************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es7.symbol.async-iterator.js ***! - \***************************************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ./_wks-define */"./node_modules/core-js/library/modules/_wks-define.js")("asyncIterator")},"./node_modules/core-js/library/modules/es7.symbol.observable.js": -/*!***********************************************************************!*\ - !*** ./node_modules/core-js/library/modules/es7.symbol.observable.js ***! - \***********************************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ./_wks-define */"./node_modules/core-js/library/modules/_wks-define.js")("observable")},"./node_modules/core-js/library/modules/web.dom.iterable.js": -/*!******************************************************************!*\ - !*** ./node_modules/core-js/library/modules/web.dom.iterable.js ***! - \******************************************************************/ -/*! no static exports found */function(e,t,n){n(/*! ./es6.array.iterator */"./node_modules/core-js/library/modules/es6.array.iterator.js");for(var r=n(/*! ./_global */"./node_modules/core-js/library/modules/_global.js"),i=n(/*! ./_hide */"./node_modules/core-js/library/modules/_hide.js"),a=n(/*! ./_iterators */"./node_modules/core-js/library/modules/_iterators.js"),o=n(/*! ./_wks */"./node_modules/core-js/library/modules/_wks.js")("toStringTag"),s=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],l=0;l<5;l++){var u=s[l],c=r[u],d=c&&c.prototype;d&&!d[o]&&i(d,o,u),a[u]=a.Array}},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/components/container/public/style.scss": -/*!*****************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/components/container/public/style.scss ***! - \*****************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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",""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/components/core/public/style.scss": -/*!************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/components/core/public/style.scss ***! - \************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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',""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/base_flash_playback/public/flash.scss": -/*!**************************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/base_flash_playback/public/flash.scss ***! - \**************************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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",""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/html5_video/public/style.scss": -/*!******************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/html5_video/public/style.scss ***! - \******************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.i,"[data-html5-video] {\n position: absolute;\n height: 100%;\n width: 100%;\n display: block; }\n",""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/html_img/public/style.scss": -/*!***************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/html_img/public/style.scss ***! - \***************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.i,"[data-html-img] {\n max-width: 100%;\n max-height: 100%; }\n",""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/no_op/public/style.scss": -/*!************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/no_op/public/style.scss ***! - \************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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",""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/closed_captions/public/closed_captions.scss": -/*!******************************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/closed_captions/public/closed_captions.scss ***! - \******************************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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",""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/dvr_controls/public/dvr_controls.scss": -/*!************************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/dvr_controls/public/dvr_controls.scss ***! - \************************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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',""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/error_screen/public/error_screen.scss": -/*!************************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/error_screen/public/error_screen.scss ***! - \************************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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",""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/media_control/public/media-control.scss": -/*!**************************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/media_control/public/media-control.scss ***! - \**************************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ../../../../node_modules/css-loader/lib/url/escape.js */"./node_modules/css-loader/lib/url/escape.js");(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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("+r(n(/*! ./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("+r(n(/*! ./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',""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/poster/public/poster.scss": -/*!************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/poster/public/poster.scss ***! - \************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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",""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/seek_time/public/seek_time.scss": -/*!******************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/seek_time/public/seek_time.scss ***! - \******************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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',""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/spinner_three_bounce/public/spinner.scss": -/*!***************************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/spinner_three_bounce/public/spinner.scss ***! - \***************************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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",""])},"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/watermark/public/watermark.scss": -/*!******************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/watermark/public/watermark.scss ***! - \******************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */function(e,t,n){(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.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",""])},"./node_modules/css-loader/lib/css-base.js": -/*!*************************************************!*\ - !*** ./node_modules/css-loader/lib/css-base.js ***! - \*************************************************/ -/*! no static exports found */function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,r=e[1]||"",i=e[3];if(!i)return r;if(t&&"function"==typeof btoa){var a=(n=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"),o=i.sources.map((function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"}));return[r].concat(o).concat([a]).join("\n")}return[r].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},i=0;i<this.length;i++){var a=this[i][0];"number"==typeof a&&(r[a]=!0)}for(i=0;i<e.length;i++){var o=e[i];"number"==typeof o[0]&&r[o[0]]||(n&&!o[2]?o[2]=n:n&&(o[2]="("+o[2]+") and ("+n+")"),t.push(o))}},t}},"./node_modules/css-loader/lib/url/escape.js": -/*!***************************************************!*\ - !*** ./node_modules/css-loader/lib/url/escape.js ***! - \***************************************************/ -/*! no static exports found */function(e,t){e.exports=function(e){return"string"!=typeof e?e:(/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),/["'() \t\n]/.test(e)?'"'+e.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"':e)}},"./node_modules/hls.js/dist/hls.js": -/*!*****************************************!*\ - !*** ./node_modules/hls.js/dist/hls.js ***! - \*****************************************/ -/*! no static exports found */function(e,t,n){var r;"undefined"!=typeof window&&(r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js": -/*!*********************************************!*\ - !*** ./node_modules/eventemitter3/index.js ***! - \*********************************************/ -/*! no static exports found */ -/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i="~";function a(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,r||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function u(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(i=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},u.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,a=n.length,o=new Array(a);r<a;r++)o[r]=n[r].fn;return o},u.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,r,a,o){var s=i?i+e:e;if(!this._events[s])return!1;var l,u,c=this._events[s],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,a),!0;case 6:return c.fn.call(c.context,t,n,r,a,o),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var f,h=c.length;for(u=0;u<h;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,n);break;case 4:c[u].fn.call(c[u].context,t,n,r);break;default:if(!l)for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];c[u].fn.apply(c[u].context,l)}}return!0},u.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},u.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},u.prototype.removeListener=function(e,t,n,r){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return l(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||r&&!o.once||n&&o.context!==n||l(this,a);else{for(var s=0,u=[],c=o.length;s<c;s++)(o[s].fn!==t||r&&!o[s].once||n&&o[s].context!==n)&&u.push(o[s]);u.length?this._events[a]=1===u.length?u[0]:u:l(this,a)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&l(this,t)):(this._events=new a,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=i,u.EventEmitter=u,e.exports=u},"./node_modules/url-toolkit/src/url-toolkit.js": -/*!*****************************************************!*\ - !*** ./node_modules/url-toolkit/src/url-toolkit.js ***! - \*****************************************************/ -/*! no static exports found */ -/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){var r,i,a,o,s;r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,i=/^([^\/?#]*)(.*)$/,a=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var r=s.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=s.normalizePath(r.path),s.buildURLFromParts(r)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return n.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=i.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;u.path=s.normalizePath(d)}else u.path=o.path,a.params||(u.params=o.params,a.query||(u.query=o.query));return null===u.path&&(u.path=n.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(u)},parseURL:function(e){var t=r.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(a,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s},"./node_modules/webworkify-webpack/index.js": -/*!**************************************************!*\ - !*** ./node_modules/webworkify-webpack/index.js ***! - \**************************************************/ -/*! no static exports found */ -/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){function r(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n.oe=function(e){throw console.error(e),e};var r=n(n.s=ENTRY_MODULE);return r.default||r}function i(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,r){var a={};a[r]=[];var o=t.toString(),s=o.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return a;for(var l,u=s[1],c=new RegExp("(\\\\n|\\W)"+i(u)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");l=c.exec(o);)"dll-reference"!==l[3]&&a[r].push(l[3]);for(c=new RegExp("\\("+i(u)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");l=c.exec(o);)e[l[2]]||(a[r].push(l[1]),e[l[2]]=n(l[1]).m),a[l[2]]=a[l[2]]||[],a[l[2]].push(l[4]);for(var d,f=Object.keys(a),h=0;h<f.length;h++)for(var p=0;p<a[f[h]].length;p++)d=a[f[h]][p],isNaN(1*d)||(a[f[h]][p]=1*a[f[h]][p]);return a}function o(e){return Object.keys(e).reduce((function(t,n){return t||e[n].length>0}),!1)}e.exports=function(e,t){t=t||{};var i={main:n.m},s=t.all?{main:Object.keys(i.main)}:function(e,t){for(var n={main:[t]},r={main:[]},i={main:{}};o(n);)for(var s=Object.keys(n),l=0;l<s.length;l++){var u=s[l],c=n[u].pop();if(i[u]=i[u]||{},!i[u][c]&&e[u][c]){i[u][c]=!0,r[u]=r[u]||[],r[u].push(c);for(var d=a(e,e[u][c],u),f=Object.keys(d),h=0;h<f.length;h++)n[f[h]]=n[f[h]]||[],n[f[h]]=n[f[h]].concat(d[f[h]])}}return r}(i,e),l="";Object.keys(s).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;s[e][t];)t++;s[e].push(t),i[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",l=l+"var "+e+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+s[e].map((function(t){return JSON.stringify(t)+": "+i[e][t].toString()})).join(",")+"});\n"})),l=l+"new (("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+s.main.map((function(e){return JSON.stringify(e)+": "+i.main[e].toString()})).join(",")+"}))(self);";var u=new window.Blob([l],{type:"text/javascript"});if(t.bare)return u;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),d=new window.Worker(c);return d.objectURL=c,d}},"./src/crypt/decrypter.js": -/*!********************************************!*\ - !*** ./src/crypt/decrypter.js + 3 modules ***! - \********************************************/ -/*! exports provided: default */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/hls.ts */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/hls.ts */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/hls.ts */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/hls.ts */function(e,t,n){"use strict";n.r(t);var r=function(){function e(e,t){this.subtle=e,this.aesIV=t}return e.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)},e}(),i=function(){function e(e,t){this.subtle=e,this.key=t}return e.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},e}(),a=function(){function e(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),n=new Uint32Array(4),r=0;r<4;r++)n[r]=t.getUint32(4*r);return n},t.initTable=function(){var e=this.sBox,t=this.invSBox,n=this.subMix,r=n[0],i=n[1],a=n[2],o=n[3],s=this.invSubMix,l=s[0],u=s[1],c=s[2],d=s[3],f=new Uint32Array(256),h=0,p=0,m=0;for(m=0;m<256;m++)f[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){var g=p^p<<1^p<<2^p<<3^p<<4;g=g>>>8^255&g^99,e[h]=g,t[g]=h;var y=f[h],v=f[y],b=f[v],_=257*f[g]^16843008*g;r[h]=_<<24|_>>>8,i[h]=_<<16|_>>>16,a[h]=_<<8|_>>>24,o[h]=_,_=16843009*b^65537*v^257*y^16843008*h,l[g]=_<<24|_>>>8,u[g]=_<<16|_>>>16,c[g]=_<<8|_>>>24,d[g]=_,h?(h=y^f[f[f[b^y]]],p^=f[f[p]]):h=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),n=!0,r=0;r<t.length&&n;)n=t[r]===this.key[r],r++;if(!n){this.key=t;var i=this.keySize=t.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);var a,o,s,l,u=this.ksRows=4*(i+6+1),c=this.keySchedule=new Uint32Array(u),d=this.invKeySchedule=new Uint32Array(u),f=this.sBox,h=this.rcon,p=this.invSubMix,m=p[0],g=p[1],y=p[2],v=p[3];for(a=0;a<u;a++)a<i?s=c[a]=t[a]:(l=s,a%i==0?(l=f[(l=l<<8|l>>>24)>>>24]<<24|f[l>>>16&255]<<16|f[l>>>8&255]<<8|f[255&l],l^=h[a/i|0]<<24):i>6&&a%i==4&&(l=f[l>>>24]<<24|f[l>>>16&255]<<16|f[l>>>8&255]<<8|f[255&l]),c[a]=s=(c[a-i]^l)>>>0);for(o=0;o<u;o++)a=u-o,l=3&o?c[a]:c[a-4],d[o]=o<4||a<=4?l:m[f[l>>>24]]^g[f[l>>>16&255]]^y[f[l>>>8&255]]^v[f[255&l]],d[o]=d[o]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,n,r){for(var i,a,o,s,l,u,c,d,f,h,p,m,g,y,v,b,_,A=this.keySize+6,E=this.invKeySchedule,T=this.invSBox,w=this.invSubMix,S=w[0],k=w[1],C=w[2],x=w[3],R=this.uint8ArrayToUint32Array_(n),L=R[0],I=R[1],P=R[2],j=R[3],O=new Int32Array(e),D=new Int32Array(O.length),M=this.networkToHostOrderSwap;t<O.length;){for(f=M(O[t]),h=M(O[t+1]),p=M(O[t+2]),m=M(O[t+3]),l=f^E[0],u=m^E[1],c=p^E[2],d=h^E[3],g=4,y=1;y<A;y++)i=S[l>>>24]^k[u>>16&255]^C[c>>8&255]^x[255&d]^E[g],a=S[u>>>24]^k[c>>16&255]^C[d>>8&255]^x[255&l]^E[g+1],o=S[c>>>24]^k[d>>16&255]^C[l>>8&255]^x[255&u]^E[g+2],s=S[d>>>24]^k[l>>16&255]^C[u>>8&255]^x[255&c]^E[g+3],l=i,u=a,c=o,d=s,g+=4;i=T[l>>>24]<<24^T[u>>16&255]<<16^T[c>>8&255]<<8^T[255&d]^E[g],a=T[u>>>24]<<24^T[c>>16&255]<<16^T[d>>8&255]<<8^T[255&l]^E[g+1],o=T[c>>>24]<<24^T[d>>16&255]<<16^T[l>>8&255]<<8^T[255&u]^E[g+2],s=T[d>>>24]<<24^T[l>>16&255]<<16^T[u>>8&255]<<8^T[255&c]^E[g+3],g+=3,D[t]=M(i^L),D[t+1]=M(s^I),D[t+2]=M(o^P),D[t+3]=M(a^j),L=f,I=h,P=p,j=m,t+=4}return r?(v=D.buffer,b=v.byteLength,(_=b&&new DataView(v).getUint8(b-1))?v.slice(0,b-_):v):D.buffer},t.destroy=function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0},e}(),o=n("./src/errors.ts"),s=n("./src/utils/logger.js"),l=n("./src/events.js"),u=n("./src/utils/get-self-scope.js"),c=Object(u.getSelfScope)(),d=function(){function e(e,t,n){var r=(void 0===n?{}:n).removePKCS7Padding,i=void 0===r||r;if(this.logEnabled=!0,this.observer=e,this.config=t,this.removePKCS7Padding=i,i)try{var a=c.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(e){}this.disableWebCrypto=!this.subtle}var t=e.prototype;return t.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},t.decrypt=function(e,t,n,o){var l=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(s.logger.log("JS AES decrypt"),this.logEnabled=!1);var u=this.decryptor;u||(this.decryptor=u=new a),u.expandKey(t),o(u.decrypt(e,0,n,this.removePKCS7Padding))}else{this.logEnabled&&(s.logger.log("WebCrypto AES decrypt"),this.logEnabled=!1);var c=this.subtle;this.key!==t&&(this.key=t,this.fastAesKey=new i(c,t)),this.fastAesKey.expandKey().then((function(i){new r(c,n).decrypt(e,i).catch((function(r){l.onWebCryptoError(r,e,t,n,o)})).then((function(e){o(e)}))})).catch((function(r){l.onWebCryptoError(r,e,t,n,o)}))}},t.onWebCryptoError=function(e,t,n,r,i){this.config.enableSoftwareAES?(s.logger.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(t,n,r,i)):(s.logger.error("decrypting error : "+e.message),this.observer.trigger(l.default.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:e.message}))},t.destroy=function(){var e=this.decryptor;e&&(e.destroy(),this.decryptor=void 0)},e}();t.default=d},"./src/demux/demuxer-inline.js": -/*!**************************************************!*\ - !*** ./src/demux/demuxer-inline.js + 12 modules ***! - \**************************************************/ -/*! exports provided: default */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/hls.ts */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/hls.ts */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/hls.ts */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/hls.ts */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/hls.ts */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number-isFinite.js because of ./src/hls.ts */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/hls.ts */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/hls.ts */function(e,t,n){"use strict";n.r(t);var r=n("./src/events.js"),i=n("./src/errors.ts"),a=n("./src/crypt/decrypter.js"),o=n("./src/polyfills/number-isFinite.js"),s=n("./src/utils/logger.js"),l=n("./src/utils/get-self-scope.js");function u(e,t){return 255===e[t]&&240==(246&e[t+1])}function c(e,t){return 1&e[t+1]?7:9}function d(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function f(e,t){return!!(t+1<e.length&&u(e,t))}function h(e,t){if(f(e,t)){var n=c(e,t);t+5<e.length&&(n=d(e,t));var r=t+n;if(r===e.length||r+1<e.length&&u(e,r))return!0}return!1}function p(e,t,n,a,o){if(!e.samplerate){var l=function(e,t,n,a){var o,l,u,c,d,f=navigator.userAgent.toLowerCase(),h=a,p=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];if(o=1+((192&t[n+2])>>>6),!((l=(60&t[n+2])>>>2)>p.length-1))return c=(1&t[n+2])<<2,c|=(192&t[n+3])>>>6,s.logger.log("manifest codec:"+a+",ADTS data:type:"+o+",sampleingIndex:"+l+"["+p[l]+"Hz],channelConfig:"+c),/firefox/i.test(f)?l>=6?(o=5,d=new Array(4),u=l-3):(o=2,d=new Array(2),u=l):-1!==f.indexOf("android")?(o=2,d=new Array(2),u=l):(o=5,d=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&l>=6?u=l-3:((a&&-1!==a.indexOf("mp4a.40.2")&&(l>=6&&1===c||/vivaldi/i.test(f))||!a&&1===c)&&(o=2,d=new Array(2)),u=l)),d[0]=o<<3,d[0]|=(14&l)>>1,d[1]|=(1&l)<<7,d[1]|=c<<3,5===o&&(d[1]|=(14&u)>>1,d[2]=(1&u)<<7,d[2]|=8,d[3]=0),{config:d,samplerate:p[l],channelCount:c,codec:"mp4a.40."+o,manifestCodec:h};e.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+l})}(t,n,a,o);e.config=l.config,e.samplerate=l.samplerate,e.channelCount=l.channelCount,e.codec=l.codec,e.manifestCodec=l.manifestCodec,s.logger.log("parsed codec:"+e.codec+",rate:"+l.samplerate+",nb channel:"+l.channelCount)}}function m(e){return 9216e4/e}function g(e,t,n,r,i){var a=function(e,t,n,r,i){var a,o,s=e.length;if(a=c(e,t),o=d(e,t),(o-=a)>0&&t+a+o<=s)return{headerLength:a,frameLength:o,stamp:n+r*i}}(t,n,r,i,m(e.samplerate));if(a){var o=a.stamp,s=a.headerLength,l=a.frameLength,u={unit:t.subarray(n+s,n+s+l),pts:o,dts:o};return e.samples.push(u),{sample:u,length:l+s}}}var y=n("./src/demux/id3.js"),v=function(){function e(e,t,n){this.observer=e,this.config=n,this.remuxer=t}var t=e.prototype;return t.resetInitSegment=function(e,t,n,r){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:t,duration:r,inputTimeScale:9e4}},t.resetTimeStamp=function(){},e.probe=function(e){if(!e)return!1;for(var t=(y.default.getID3Data(e,0)||[]).length,n=e.length;t<n;t++)if(h(e,t))return s.logger.log("ADTS sync word found !"),!0;return!1},t.append=function(e,t,n,r){for(var i=this._audioTrack,a=y.default.getID3Data(e,0)||[],l=y.default.getTimeStamp(a),u=Object(o.isFiniteNumber)(l)?90*l:9e4*t,c=0,d=u,h=e.length,m=a.length,v=[{pts:d,dts:d,data:a}];m<h-1;)if(f(e,m)&&m+5<h){p(i,this.observer,e,m,i.manifestCodec);var b=g(i,e,m,u,c);if(!b){s.logger.log("Unable to parse AAC frame");break}m+=b.length,d=b.sample.pts,c++}else y.default.isHeader(e,m)?(a=y.default.getID3Data(e,m),v.push({pts:d,dts:d,data:a}),m+=a.length):m++;this.remuxer.remux(i,{samples:[]},{samples:v,inputTimeScale:9e4},{samples:[]},t,n,r)},t.destroy=function(){},e}(),b=n("./src/demux/mp4demuxer.js"),_={BitratesMap:[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],SamplesCoefficients:[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],BytesInSlot:[0,1,1,4],appendFrame:function(e,t,n,r,i){if(!(n+24>t.length)){var a=this.parseHeader(t,n);if(a&&n+a.frameLength<=t.length){var o=r+i*(9e4*a.samplesPerFrame/a.sampleRate),s={unit:t.subarray(n,n+a.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(s),{sample:s,length:a.frameLength}}}},parseHeader:function(e,t){var n=e[t+1]>>3&3,r=e[t+1]>>1&3,i=e[t+2]>>4&15,a=e[t+2]>>2&3,o=e[t+2]>>1&1;if(1!==n&&0!==i&&15!==i&&3!==a){var s=3===n?3-r:3===r?3:4,l=1e3*_.BitratesMap[14*s+i-1],u=3===n?0:2===n?1:2,c=_.SamplingRateMap[3*u+a],d=e[t+3]>>6==3?1:2,f=_.SamplesCoefficients[n][r],h=_.BytesInSlot[r],p=8*f*h;return{sampleRate:c,channelCount:d,frameLength:parseInt(f*l/c+o,10)*h,samplesPerFrame:p}}},isHeaderPattern:function(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])},isHeader:function(e,t){return!!(t+1<e.length&&this.isHeaderPattern(e,t))},probe:function(e,t){if(t+1<e.length&&this.isHeaderPattern(e,t)){var n=this.parseHeader(e,t),r=4;n&&n.frameLength&&(r=n.frameLength);var i=t+r;if(i===e.length||i+1<e.length&&this.isHeaderPattern(e,i))return!0}return!1}},A=_,E=function(){function e(e){this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,n=e.byteLength-t,r=new Uint8Array(4),i=Math.min(4,t);if(0===i)throw new Error("no bytes available");r.set(e.subarray(n,n+i)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},t.skipBits=function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),n=this.word>>>32-t;return e>32&&s.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),(t=e-t)>0&&this.bitsAvailable?n<<t|this.readBits(t):n},t.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){var t,n=8,r=8;for(t=0;t<e;t++)0!==r&&(r=(n+this.readEG()+256)%256),n=0===r?n:r},t.readSPS=function(){var e,t,n,r,i,a,o,s=0,l=0,u=0,c=0,d=this.readUByte.bind(this),f=this.readBits.bind(this),h=this.readUEG.bind(this),p=this.readBoolean.bind(this),m=this.skipBits.bind(this),g=this.skipEG.bind(this),y=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);if(d(),e=d(),f(5),m(3),d(),y(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var b=h();if(3===b&&m(1),y(),y(),m(1),p())for(a=3!==b?8:12,o=0;o<a;o++)p()&&v(o<6?16:64)}y();var _=h();if(0===_)h();else if(1===_)for(m(1),g(),g(),t=h(),o=0;o<t;o++)g();y(),m(1),n=h(),r=h(),0===(i=f(1))&&m(1),m(1),p()&&(s=h(),l=h(),u=h(),c=h());var A=[1,1];if(p()&&p())switch(d()){case 1:A=[1,1];break;case 2:A=[12,11];break;case 3:A=[10,11];break;case 4:A=[16,11];break;case 5:A=[40,33];break;case 6:A=[24,11];break;case 7:A=[20,11];break;case 8:A=[32,11];break;case 9:A=[80,33];break;case 10:A=[18,11];break;case 11:A=[15,11];break;case 12:A=[64,33];break;case 13:A=[160,99];break;case 14:A=[4,3];break;case 15:A=[3,2];break;case 16:A=[2,1];break;case 255:A=[d()<<8|d(),d()<<8|d()]}return{width:Math.ceil(16*(n+1)-2*s-2*l),height:(2-i)*(r+1)*16-(i?2:4)*(u+c),pixelRatio:A}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}(),T=function(){function e(e,t,n,r){this.decryptdata=n,this.discardEPB=r,this.decrypter=new a.default(e,t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e,t){this.decrypter.decrypt(e,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,t)},t.decryptAacSample=function(e,t,n,r){var i=e[t].unit,a=i.subarray(16,i.length-i.length%16),o=a.buffer.slice(a.byteOffset,a.byteOffset+a.length),s=this;this.decryptBuffer(o,(function(a){a=new Uint8Array(a),i.set(a,16),r||s.decryptAacSamples(e,t+1,n)}))},t.decryptAacSamples=function(e,t,n){for(;;t++){if(t>=e.length)return void n();if(!(e[t].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(e,t,n,r),!r)return}}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,n=new Int8Array(t),r=0,i=32;i<=e.length-16;i+=160,r+=16)n.set(e.subarray(i,i+16),r);return n},t.getAvcDecryptedUnit=function(e,t){t=new Uint8Array(t);for(var n=0,r=32;r<=e.length-16;r+=160,n+=16)e.set(t.subarray(n,n+16),r);return e},t.decryptAvcSample=function(e,t,n,r,i,a){var o=this.discardEPB(i.data),s=this.getAvcEncryptedData(o),l=this;this.decryptBuffer(s.buffer,(function(s){i.data=l.getAvcDecryptedUnit(o,s),a||l.decryptAvcSamples(e,t,n+1,r)}))},t.decryptAvcSamples=function(e,t,n,r){for(;;t++,n=0){if(t>=e.length)return void r();for(var i=e[t].units;!(n>=i.length);n++){var a=i[n];if(!(a.length<=48||1!==a.type&&5!==a.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(e,t,n,r,a,o),!o)return}}}},e}(),w={video:1,audio:2,id3:3,text:4},S=function(){function e(e,t,n,r){this.observer=e,this.config=n,this.typeSupported=r,this.remuxer=t,this.sampleAes=null}var t=e.prototype;return t.setDecryptData=function(e){null!=e&&null!=e.key&&"SAMPLE-AES"===e.method?this.sampleAes=new T(this.observer,this.config,e,this.discardEPB):this.sampleAes=null},e.probe=function(t){var n=e._syncOffset(t);return!(n<0||(n&&s.logger.warn("MPEG2-TS detected but first sync word found @ offset "+n+", junk ahead ?"),0))},e._syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),n=0;n<t;){if(71===e[n]&&71===e[n+188]&&71===e[n+376])return n;n++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:w[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:"video"===e?0:void 0,isAAC:"audio"===e||void 0,duration:"audio"===e?t:void 0}},t.resetInitSegment=function(t,n,r,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=e.createTrack("video",i),this._audioTrack=e.createTrack("audio",i),this._id3Track=e.createTrack("id3",i),this._txtTrack=e.createTrack("text",i),this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=n,this.videoCodec=r,this._duration=i},t.resetTimeStamp=function(){},t.append=function(t,n,a,o){var l,u,c,d,f,h=t.length,p=!1;this.contiguous=a;var m=this.pmtParsed,g=this._avcTrack,y=this._audioTrack,v=this._id3Track,b=g.pid,_=y.pid,A=v.pid,E=this._pmtId,T=g.pesData,w=y.pesData,S=v.pesData,k=this._parsePAT,C=this._parsePMT,x=this._parsePES,R=this._parseAVCPES.bind(this),L=this._parseAACPES.bind(this),I=this._parseMPEGPES.bind(this),P=this._parseID3PES.bind(this),j=e._syncOffset(t);for(h-=(h+j)%188,l=j;l<h;l+=188)if(71===t[l]){if(u=!!(64&t[l+1]),c=((31&t[l+1])<<8)+t[l+2],(48&t[l+3])>>4>1){if((d=l+5+t[l+4])===l+188)continue}else d=l+4;switch(c){case b:u&&(T&&(f=x(T))&&R(f,!1),T={data:[],size:0}),T&&(T.data.push(t.subarray(d,l+188)),T.size+=l+188-d);break;case _:u&&(w&&(f=x(w))&&(y.isAAC?L(f):I(f)),w={data:[],size:0}),w&&(w.data.push(t.subarray(d,l+188)),w.size+=l+188-d);break;case A:u&&(S&&(f=x(S))&&P(f),S={data:[],size:0}),S&&(S.data.push(t.subarray(d,l+188)),S.size+=l+188-d);break;case 0:u&&(d+=t[d]+1),E=this._pmtId=k(t,d);break;case E:u&&(d+=t[d]+1);var O=C(t,d,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);(b=O.avc)>0&&(g.pid=b),(_=O.audio)>0&&(y.pid=_,y.isAAC=O.isAAC),(A=O.id3)>0&&(v.pid=A),p&&!m&&(s.logger.log("reparse from beginning"),p=!1,l=j-188),m=this.pmtParsed=!0;break;case 17:case 8191:break;default:p=!0}}else this.observer.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});T&&(f=x(T))?(R(f,!0),g.pesData=null):g.pesData=T,w&&(f=x(w))?(y.isAAC?L(f):I(f),y.pesData=null):(w&&w.size&&s.logger.log("last AAC PES packet truncated,might overlap between fragments"),y.pesData=w),S&&(f=x(S))?(P(f),v.pesData=null):v.pesData=S,null==this.sampleAes?this.remuxer.remux(y,g,v,this._txtTrack,n,a,o):this.decryptAndRemux(y,g,v,this._txtTrack,n,a,o)},t.decryptAndRemux=function(e,t,n,r,i,a,o){if(e.samples&&e.isAAC){var s=this;this.sampleAes.decryptAacSamples(e.samples,0,(function(){s.decryptAndRemuxAvc(e,t,n,r,i,a,o)}))}else this.decryptAndRemuxAvc(e,t,n,r,i,a,o)},t.decryptAndRemuxAvc=function(e,t,n,r,i,a,o){if(t.samples){var s=this;this.sampleAes.decryptAvcSamples(t.samples,0,0,(function(){s.remuxer.remux(e,t,n,r,i,a,o)}))}else this.remuxer.remux(e,t,n,r,i,a,o)},t.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},t._parsePAT=function(e,t){return(31&e[t+10])<<8|e[t+11]},t._parsePMT=function(e,t,n,r){var i,a,o={audio:-1,avc:-1,id3:-1,isAAC:!0};for(i=t+3+((15&e[t+1])<<8|e[t+2])-4,t+=12+((15&e[t+10])<<8|e[t+11]);t<i;){switch(a=(31&e[t+1])<<8|e[t+2],e[t]){case 207:if(!r){s.logger.log("unknown stream type:"+e[t]);break}case 15:-1===o.audio&&(o.audio=a);break;case 21:-1===o.id3&&(o.id3=a);break;case 219:if(!r){s.logger.log("unknown stream type:"+e[t]);break}case 27:-1===o.avc&&(o.avc=a);break;case 3:case 4:n?-1===o.audio&&(o.audio=a,o.isAAC=!1):s.logger.log("MPEG audio found, not supported in this browser for now");break;case 36:s.logger.warn("HEVC stream type found, not supported for now");break;default:s.logger.log("unknown stream type:"+e[t])}t+=5+((15&e[t+3])<<8|e[t+4])}return o},t._parsePES=function(e){var t,n,r,i,a,o,l,u,c=0,d=e.data;if(!e||0===e.size)return null;for(;d[0].length<19&&d.length>1;){var f=new Uint8Array(d[0].length+d[1].length);f.set(d[0]),f.set(d[1],d[0].length),d[0]=f,d.splice(1,1)}if(1===((t=d[0])[0]<<16)+(t[1]<<8)+t[2]){if((r=(t[4]<<8)+t[5])&&r>e.size-6)return null;if(192&(n=t[7])&&((o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2)>4294967295&&(o-=8589934592),64&n?((l=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>4294967295&&(l-=8589934592),o-l>54e5&&(s.logger.warn(Math.round((o-l)/9e4)+"s delta between PTS and DTS, align them"),o=l)):l=o),u=(i=t[8])+9,e.size<=u)return null;e.size-=u,a=new Uint8Array(e.size);for(var h=0,p=d.length;h<p;h++){var m=(t=d[h]).byteLength;if(u){if(u>m){u-=m;continue}t=t.subarray(u),m-=u,u=0}a.set(t,c),c+=m}return r&&(r-=i+3),{data:a,pts:o,dts:l,len:r}}return null},t.pushAccesUnit=function(e,t){if(e.units.length&&e.frame){var n=t.samples,r=n.length;if(isNaN(e.pts)){if(!r)return void t.dropped++;var i=n[r-1];e.pts=i.pts,e.dts=i.dts}!this.config.forceKeyFrameOnDiscontinuity||!0===e.key||t.sps&&(r||this.contiguous)?(e.id=r,n.push(e)):t.dropped++}e.debug.length&&s.logger.log(e.pts+"/"+e.dts+":"+e.debug)},t._parseAVCPES=function(e,t){var n,r,i,a=this,o=this._avcTrack,s=this._parseAVCNALu(e.data),l=this.avcSample,u=!1,c=this.pushAccesUnit.bind(this),d=function(e,t,n,r){return{key:e,pts:t,dts:n,units:[],debug:r}};e.data=null,l&&s.length&&!o.audFound&&(c(l,o),l=this.avcSample=d(!1,e.pts,e.dts,"")),s.forEach((function(t){switch(t.type){case 1:r=!0,l||(l=a.avcSample=d(!0,e.pts,e.dts,"")),l.frame=!0;var s=t.data;if(u&&s.length>4){var f=new E(s).readSliceType();2!==f&&4!==f&&7!==f&&9!==f||(l.key=!0)}break;case 5:r=!0,l||(l=a.avcSample=d(!0,e.pts,e.dts,"")),l.key=!0,l.frame=!0;break;case 6:r=!0,(n=new E(a.discardEPB(t.data))).readUByte();for(var h=0,p=0,m=!1,g=0;!m&&n.bytesAvailable>1;){h=0;do{h+=g=n.readUByte()}while(255===g);p=0;do{p+=g=n.readUByte()}while(255===g);if(4===h&&0!==n.bytesAvailable){if(m=!0,181===n.readUByte()&&49===n.readUShort()&&1195456820===n.readUInt()&&3===n.readUByte()){var v=n.readUByte(),b=31&v,_=[v,n.readUByte()];for(i=0;i<b;i++)_.push(n.readUByte()),_.push(n.readUByte()),_.push(n.readUByte());a._insertSampleInOrder(a._txtTrack.samples,{type:3,pts:e.pts,bytes:_})}}else if(5===h&&0!==n.bytesAvailable){if(m=!0,p>16){var A=[];for(i=0;i<16;i++)A.push(n.readUByte().toString(16)),3!==i&&5!==i&&7!==i&&9!==i||A.push("-");var T=p-16,w=new Uint8Array(T);for(i=0;i<T;i++)w[i]=n.readUByte();a._insertSampleInOrder(a._txtTrack.samples,{pts:e.pts,payloadType:h,uuid:A.join(""),userDataBytes:w,userData:Object(y.utf8ArrayToStr)(w.buffer)})}}else if(p<n.bytesAvailable)for(i=0;i<p;i++)n.readUByte()}break;case 7:if(r=!0,u=!0,!o.sps){var S=(n=new E(t.data)).readSPS();o.width=S.width,o.height=S.height,o.pixelRatio=S.pixelRatio,o.sps=[t.data],o.duration=a._duration;var k=t.data.subarray(1,4),C="avc1.";for(i=0;i<3;i++){var x=k[i].toString(16);x.length<2&&(x="0"+x),C+=x}o.codec=C}break;case 8:r=!0,o.pps||(o.pps=[t.data]);break;case 9:r=!1,o.audFound=!0,l&&c(l,o),l=a.avcSample=d(!1,e.pts,e.dts,"");break;case 12:r=!1;break;default:r=!1,l&&(l.debug+="unknown NAL "+t.type+" ")}l&&r&&l.units.push(t)})),t&&l&&(c(l,o),this.avcSample=null)},t._insertSampleInOrder=function(e,t){var n=e.length;if(n>0){if(t.pts>=e[n-1].pts)e.push(t);else for(var r=n-1;r>=0;r--)if(t.pts<e[r].pts){e.splice(r,0,t);break}}else e.push(t)},t._getLastNalUnit=function(){var e,t=this.avcSample;if(!t||0===t.units.length){var n=this._avcTrack.samples;t=n[n.length-1]}if(t){var r=t.units;e=r[r.length-1]}return e},t._parseAVCNALu=function(e){var t,n,r,i,a=0,o=e.byteLength,s=this._avcTrack,l=s.naluState||0,u=l,c=[],d=-1;for(-1===l&&(d=0,i=31&e[0],l=0,a=1);a<o;)if(t=e[a++],l)if(1!==l)if(t)if(1===t){if(d>=0)r={data:e.subarray(d,a-l-1),type:i},c.push(r);else{var f=this._getLastNalUnit();if(f&&(u&&a<=4-u&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-u)),(n=a-l-1)>0)){var h=new Uint8Array(f.data.byteLength+n);h.set(f.data,0),h.set(e.subarray(0,n),f.data.byteLength),f.data=h}}a<o?(d=a,i=31&e[a],l=0):l=-1}else l=0;else l=3;else l=t?0:2;else l=t?0:1;if(d>=0&&l>=0&&(r={data:e.subarray(d,o),type:i,state:l},c.push(r)),0===c.length){var p=this._getLastNalUnit();if(p){var m=new Uint8Array(p.data.byteLength+e.byteLength);m.set(p.data,0),m.set(e,p.data.byteLength),p.data=m}}return s.naluState=l,c},t.discardEPB=function(e){for(var t,n,r=e.byteLength,i=[],a=1;a<r-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(i.push(a+2),a+=2):a++;if(0===i.length)return e;t=r-i.length,n=new Uint8Array(t);var o=0;for(a=0;a<t;o++,a++)o===i[0]&&(o++,i.shift()),n[a]=e[o];return n},t._parseAACPES=function(e){var t,n,a,o,l,u,c,d=this._audioTrack,h=e.data,y=e.pts,v=this.aacOverFlow,b=this.aacLastPTS;if(v){var _=new Uint8Array(v.byteLength+h.byteLength);_.set(v,0),_.set(h,v.byteLength),h=_}for(a=0,l=h.length;a<l-1&&!f(h,a);a++);if(!a||(a<l-1?(u="AAC PES did not start with ADTS header,offset:"+a,c=!1):(u="no ADTS header found in AAC PES",c=!0),s.logger.warn("parsing error:"+u),this.observer.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:c,reason:u}),!c)){if(p(d,this.observer,h,a,this.audioCodec),n=0,t=m(d.samplerate),v&&b){var A=b+t;Math.abs(A-y)>1&&(s.logger.log("AAC: align PTS for overlapping frames by "+Math.round((A-y)/90)),y=A)}for(;a<l;){if(f(h,a)){if(a+5<l){var E=g(d,h,a,y,n);if(E){a+=E.length,o=E.sample.pts,n++;continue}}break}a++}v=a<l?h.subarray(a,l):null,this.aacOverFlow=v,this.aacLastPTS=o}},t._parseMPEGPES=function(e){for(var t=e.data,n=t.length,r=0,i=0,a=e.pts;i<n;)if(A.isHeader(t,i)){var o=A.appendFrame(this._audioTrack,t,i,a,r);if(!o)break;i+=o.length,r++}else i++},t._parseID3PES=function(e){this._id3Track.samples.push(e)},e}(),k=function(){function e(e,t,n){this.observer=e,this.config=n,this.remuxer=t}var t=e.prototype;return t.resetInitSegment=function(e,t,n,r){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:t,duration:r,inputTimeScale:9e4}},t.resetTimeStamp=function(){},e.probe=function(e){var t,n,r=y.default.getID3Data(e,0);if(r&&void 0!==y.default.getTimeStamp(r))for(t=r.length,n=Math.min(e.length-1,t+100);t<n;t++)if(A.probe(e,t))return s.logger.log("MPEG Audio sync word found !"),!0;return!1},t.append=function(e,t,n,r){for(var i=y.default.getID3Data(e,0),a=y.default.getTimeStamp(i),o=a?90*a:9e4*t,s=i.length,l=e.length,u=0,c=0,d=this._audioTrack,f=[{pts:o,dts:o,data:i}];s<l;)if(A.isHeader(e,s)){var h=A.appendFrame(d,e,s,o,u);if(!h)break;s+=h.length,c=h.sample.pts,u++}else y.default.isHeader(e,s)?(i=y.default.getID3Data(e,s),f.push({pts:c,dts:c,data:i}),s+=i.length):s++;this.remuxer.remux(d,{samples:[]},{samples:f,inputTimeScale:9e4},{samples:[]},t,n,r)},t.destroy=function(){},e}(),C=function(){function e(){}return e.getSilentFrame=function(e,t){switch(e){case"mp4a.40.2":if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}(),x=Math.pow(2,32)-1,R=function(){function e(){}return e.init=function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var n=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:n,audio:r};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),s=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,o,l,o,s),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,i))},e.box=function(e){for(var t,n=Array.prototype.slice.call(arguments,1),r=8,i=n.length,a=i;i--;)r+=n[i].byteLength;for((t=new Uint8Array(r))[0]=r>>24&255,t[1]=r>>16&255,t[2]=r>>8&255,t[3]=255&r,t.set(e,4),i=0,r=8;i<a;i++)t.set(n[i],r),r+=n[i].byteLength;return t},e.hdlr=function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])},e.mdat=function(t){return e.box(e.types.mdat,t)},e.mdhd=function(t,n){n*=t;var r=Math.floor(n/(x+1)),i=Math.floor(n%(x+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,n,r){return e.box(e.types.moof,e.mfhd(t),e.traf(r,n))},e.moov=function(t){for(var n=t.length,r=[];n--;)r[n]=e.trak(t[n]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(e.mvex(t)))},e.mvex=function(t){for(var n=t.length,r=[];n--;)r[n]=e.trex(t[n]);return e.box.apply(null,[e.types.mvex].concat(r))},e.mvhd=function(t,n){n*=t;var r=Math.floor(n/(x+1)),i=Math.floor(n%(x+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,a)},e.sdtp=function(t){var n,r,i=t.samples||[],a=new Uint8Array(4+i.length);for(r=0;r<i.length;r++)n=i[r].flags,a[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return e.box(e.types.sdtp,a)},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))},e.avc1=function(t){var n,r,i,a=[],o=[];for(n=0;n<t.sps.length;n++)i=(r=t.sps[n]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(r));for(n=0;n<t.pps.length;n++)i=(r=t.pps[n]).byteLength,o.push(i>>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(r));var s=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(o))),l=t.width,u=t.height,c=t.pixelRatio[0],d=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,d>>24,d>>16&255,d>>8&255,255&d])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.mp4a=function(t){var n=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var n=t.samplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]))},e.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var n=t.id,r=t.duration*t.timescale,i=t.width,a=t.height,o=Math.floor(r/(x+1)),s=Math.floor(r%(x+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,a>>8&255,255&a,0,0]))},e.traf=function(t,n){var r=e.sdtp(t),i=t.id,a=Math.floor(n/(x+1)),o=Math.floor(n%(x+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o])),e.trun(t,r.length+16+20+8+16+8+8),r)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var n=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,n){var r,i,a,o,s,l,u=t.samples||[],c=u.length,d=12+16*c,f=new Uint8Array(d);for(n+=8+d,f.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0),r=0;r<c;r++)a=(i=u[r]).duration,o=i.size,s=i.flags,l=i.cts,f.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*r);return e.box(e.types.trun,f)},e.initSegment=function(t){e.types||e.init();var n,r=e.moov(t);return(n=new Uint8Array(e.FTYP.byteLength+r.byteLength)).set(e.FTYP),n.set(r,e.FTYP.byteLength),n},e}();function L(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=!1);var i=e*t*n;return r?Math.round(i):i}function I(e,t){return void 0===t&&(t=!1),L(e,1e3,1/9e4,t)}function P(e,t){return void 0===t&&(t=1),L(e,9e4,1/t)}var j,O=P(10),D=P(.2),M=function(){function e(e,t,n,r){this.observer=e,this.config=t,this.typeSupported=n;var i=navigator.userAgent;this.isSafari=r&&r.indexOf("Apple")>-1&&i&&!i.match("CriOS"),this.ISGenerated=!1}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this._initPTS=this._initDTS=e},t.resetInitSegment=function(){this.ISGenerated=!1},t.remux=function(e,t,n,i,a,o,l){if(this.ISGenerated||this.generateIS(e,t,a),this.ISGenerated){var u=e.samples.length,c=t.samples.length,d=a,f=a;if(u&&c){var h=(e.samples[0].pts-t.samples[0].pts)/t.inputTimeScale;d+=Math.max(0,h),f+=Math.max(0,-h)}if(u){e.timescale||(s.logger.warn("regenerate InitSegment as audio detected"),this.generateIS(e,t,a));var p,m=this.remuxAudio(e,d,o,l);c&&(m&&(p=m.endPTS-m.startPTS),t.timescale||(s.logger.warn("regenerate InitSegment as video detected"),this.generateIS(e,t,a)),this.remuxVideo(t,f,o,p,l))}else if(c){var g=this.remuxVideo(t,f,o,0,l);g&&e.codec&&this.remuxEmptyAudio(e,d,o,g)}}n.samples.length&&this.remuxID3(n,a),i.samples.length&&this.remuxText(i,a),this.observer.trigger(r.default.FRAG_PARSED)},t.generateIS=function(e,t,n){var a,o,l=this.observer,u=e.samples,c=t.samples,d=this.typeSupported,f="audio/mp4",h={},p={tracks:h},m=void 0===this._initPTS;if(m&&(a=o=1/0),e.config&&u.length&&(e.timescale=e.samplerate,s.logger.log("audio sampling rate : "+e.samplerate),e.isAAC||(d.mpeg?(f="audio/mpeg",e.codec=""):d.mp3&&(e.codec="mp3")),h.audio={container:f,codec:e.codec,initSegment:!e.isAAC&&d.mpeg?new Uint8Array:R.initSegment([e]),metadata:{channelCount:e.channelCount}},m&&(a=o=u[0].pts-e.inputTimeScale*n)),t.sps&&t.pps&&c.length){var g=t.inputTimeScale;t.timescale=g,h.video={container:"video/mp4",codec:t.codec,initSegment:R.initSegment([t]),metadata:{width:t.width,height:t.height}},m&&(a=Math.min(a,c[0].pts-g*n),o=Math.min(o,c[0].dts-g*n),this.observer.trigger(r.default.INIT_PTS_FOUND,{initPTS:a}))}Object.keys(h).length?(l.trigger(r.default.FRAG_PARSING_INIT_SEGMENT,p),this.ISGenerated=!0,m&&(this._initPTS=a,this._initDTS=o)):l.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},t.remuxVideo=function(e,t,n,a,o){var l,u,c,d,f,h,p,m=8,g=e.timescale,y=e.samples,v=[],b=y.length,_=this._PTSNormalize,A=this._initPTS,E=this.nextAvcDts,T=this.isSafari;if(0!==b){T&&(n|=y.length&&E&&(o&&Math.abs(t-E/g)<.1||Math.abs(y[0].pts-E-A)<g/5)),n||(E=t*g),y.forEach((function(e){e.pts=_(e.pts-A,E),e.dts=_(e.dts-A,E)})),y.sort((function(e,t){var n=e.dts-t.dts,r=e.pts-t.pts;return n||r||e.id-t.id}));var w=y.reduce((function(e,t){return Math.max(Math.min(e,t.pts-t.dts),-1*D)}),0);if(w<0){s.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+I(w,!0)+" ms to overcome this issue");for(var S=0;S<y.length;S++)y[S].dts+=w}var k=y[0];f=Math.max(k.dts,0),d=Math.max(k.pts,0);var C=f-E;n&&C&&(C>1?s.logger.log("AVC: "+I(C,!0)+" ms hole between fragments detected,filling it"):C<-1&&s.logger.log("AVC: "+I(-C,!0)+" ms overlapping between fragments detected"),f=E,y[0].dts=f,d=Math.max(d-C,E),y[0].pts=d,s.logger.log("Video: PTS/DTS adjusted: "+I(d,!0)+"/"+I(f,!0)+", delta: "+I(C,!0)+" ms")),k=y[y.length-1],p=Math.max(k.dts,0),h=Math.max(k.pts,0,p),T&&(l=Math.round((p-f)/(y.length-1)));for(var x=0,L=0,P=0;P<b;P++){for(var j=y[P],O=j.units,M=O.length,N=0,U=0;U<M;U++)N+=O[U].data.length;L+=N,x+=M,j.length=N,j.dts=T?f+P*l:Math.max(j.dts,f),j.pts=Math.max(j.pts,j.dts)}var F=L+4*x+8;try{u=new Uint8Array(F)}catch(e){return void this.observer.trigger(r.default.ERROR,{type:i.ErrorTypes.MUX_ERROR,details:i.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:F,reason:"fail allocating video mdat "+F})}var B=new DataView(u.buffer);B.setUint32(0,F),u.set(R.types.mdat,4);for(var K=0;K<b;K++){for(var V=y[K],G=V.units,H=0,Y=void 0,z=0,W=G.length;z<W;z++){var $=G[z],q=$.data,X=$.data.byteLength;B.setUint32(m,X),m+=4,u.set(q,m),m+=X,H+=4+X}if(T)Y=Math.max(0,l*Math.round((V.pts-V.dts)/l));else{if(K<b-1)l=y[K+1].dts-V.dts;else{var J=this.config,Q=V.dts-y[K>0?K-1:K].dts;if(J.stretchShortVideoTrack){var Z=J.maxBufferHole,ee=Math.floor(Z*g),te=(a?d+a*g:this.nextAudioPts)-V.pts;te>ee?((l=te-Q)<0&&(l=Q),s.logger.log("It is approximately "+I(te,!1)+" ms to the next segment; using duration "+I(l,!1)+" ms for the last video frame.")):l=Q}else l=Q}Y=Math.round(V.pts-V.dts)}v.push({size:H,duration:l,cts:Y,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:V.key?2:1,isNonSync:V.key?0:1}})}this.nextAvcDts=p+l;var ne=e.dropped;if(e.nbNalu=0,e.dropped=0,v.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var re=v[0].flags;re.dependsOn=2,re.isNonSync=0}e.samples=v,c=R.moof(e.sequenceNumber++,f,e),e.samples=[];var ie={data1:c,data2:u,startPTS:d/g,endPTS:(h+l)/g,startDTS:f/g,endDTS:this.nextAvcDts/g,type:"video",hasAudio:!1,hasVideo:!0,nb:v.length,dropped:ne};return this.observer.trigger(r.default.FRAG_PARSING_DATA,ie),ie}},t.remuxAudio=function(e,t,n,a){var o,l,u,c,d,f,h=e.inputTimeScale,p=e.timescale,m=h/p,g=(e.isAAC?1024:1152)*m,y=this._PTSNormalize,v=this._initPTS,b=!e.isAAC&&this.typeSupported.mpeg,_=b?0:8,A=e.samples,E=[],T=this.nextAudioPts;if(n|=A.length&&T&&(a&&Math.abs(t-T/h)<.1||Math.abs(A[0].pts-T-v)<20*g),A.forEach((function(e){e.pts=e.dts=y(e.pts-v,t*h)})),0!==(A=A.filter((function(e){return e.pts>=0}))).length){if(n||(T=a?t*h:A[0].pts),e.isAAC)for(var w=this.config.maxAudioFramesDrift,S=0,k=T;S<A.length;){var x,L=A[S];if((x=L.pts-k)<=-w*g)s.logger.warn("Dropping 1 audio frame @ "+I(k,!0)+" ms due to "+I(x,!0)+" ms overlap."),A.splice(S,1);else if(x>=w*g&&x<O&&k){var P=Math.round(x/g);s.logger.warn("Injecting "+P+" audio frames @ "+I(k,!0)+" ms due to "+I(k,!0)+" ms gap.");for(var j=0;j<P;j++){var D=Math.max(k,0);(l=C.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(s.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),l=L.unit.subarray()),A.splice(S,0,{unit:l,pts:D,dts:D}),k+=g,S++}L.pts=L.dts=k,k+=g,S++}else Math.abs(x),L.pts=L.dts=k,k+=g,S++}for(var M=A.length,N=0;M--;)N+=A[M].unit.byteLength;for(var U=0,F=A.length;U<F;U++){var B=A[U],K=B.unit,V=B.pts;if(void 0!==f)o.duration=Math.round((V-f)/m);else{var G=V-T,H=0;if(n&&e.isAAC&&G){if(G>0&&G<O)H=Math.round((V-T)/g),s.logger.log(I(G,!0)+" ms hole between AAC samples detected,filling it"),H>0&&((l=C.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(l=K.subarray()),N+=H*l.length);else if(G<-12){s.logger.log("drop overlapping AAC sample, expected/parsed/delta: "+I(T,!0)+" ms / "+I(V,!0)+" ms / "+I(-G,!0)+" ms"),N-=K.byteLength;continue}V=T}if(d=V,!(N>0))return;N+=_;try{u=new Uint8Array(N)}catch(e){return void this.observer.trigger(r.default.ERROR,{type:i.ErrorTypes.MUX_ERROR,details:i.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:N,reason:"fail allocating audio mdat "+N})}b||(new DataView(u.buffer).setUint32(0,N),u.set(R.types.mdat,4));for(var Y=0;Y<H;Y++)(l=C.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(s.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),l=K.subarray()),u.set(l,_),_+=l.byteLength,o={size:l.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},E.push(o)}u.set(K,_);var z=K.byteLength;_+=z,o={size:z,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},E.push(o),f=V}var W=0;if((M=E.length)>=2&&(W=E[M-2].duration,o.duration=W),M){this.nextAudioPts=T=f+m*W,e.samples=E,c=b?new Uint8Array:R.moof(e.sequenceNumber++,d/m,e),e.samples=[];var $=d/h,q=T/h,X={data1:c,data2:u,startPTS:$,endPTS:q,startDTS:$,endDTS:q,type:"audio",hasAudio:!0,hasVideo:!1,nb:M};return this.observer.trigger(r.default.FRAG_PARSING_DATA,X),X}return null}},t.remuxEmptyAudio=function(e,t,n,r){var i=e.inputTimeScale,a=i/(e.samplerate?e.samplerate:i),o=this.nextAudioPts,l=(void 0!==o?o:r.startDTS*i)+this._initDTS,u=r.endDTS*i+this._initDTS,c=1024*a,d=Math.ceil((u-l)/c),f=C.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(s.logger.warn("remux empty Audio"),f){for(var h=[],p=0;p<d;p++){var m=l+p*c;h.push({unit:f,pts:m,dts:m})}e.samples=h,this.remuxAudio(e,t,n)}else s.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!")},t.remuxID3=function(e){var t,n=e.samples.length,i=e.inputTimeScale,a=this._initPTS,o=this._initDTS;if(n){for(var s=0;s<n;s++)(t=e.samples[s]).pts=(t.pts-a)/i,t.dts=(t.dts-o)/i;this.observer.trigger(r.default.FRAG_PARSING_METADATA,{samples:e.samples})}e.samples=[]},t.remuxText=function(e){e.samples.sort((function(e,t){return e.pts-t.pts}));var t,n=e.samples.length,i=e.inputTimeScale,a=this._initPTS;if(n){for(var o=0;o<n;o++)(t=e.samples[o]).pts=(t.pts-a)/i;this.observer.trigger(r.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[]},t._PTSNormalize=function(e,t){var n;if(void 0===t)return e;for(n=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=n;return e},e}(),N=function(){function e(e){this.observer=e}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(){},t.resetInitSegment=function(){},t.remux=function(e,t,n,i,a,o,s,l){var u=this.observer,c="";e&&(c+="audio"),t&&(c+="video"),u.trigger(r.default.FRAG_PARSING_DATA,{data1:l,startPTS:a,startDTS:a,type:c,hasAudio:!!e,hasVideo:!!t,nb:1,dropped:0}),u.trigger(r.default.FRAG_PARSED)},e}(),U=Object(l.getSelfScope)();try{j=U.performance.now.bind(U.performance)}catch(e){s.logger.debug("Unable to use Performance API on this environment"),j=U.Date.now}var F=function(){function e(e,t,n,r){this.observer=e,this.typeSupported=t,this.config=n,this.vendor=r}var t=e.prototype;return t.destroy=function(){var e=this.demuxer;e&&e.destroy()},t.push=function(e,t,n,i,o,s,l,u,c,d,f,h){var p=this;if(e.byteLength>0&&null!=t&&null!=t.key&&"AES-128"===t.method){var m=this.decrypter;null==m&&(m=this.decrypter=new a.default(this.observer,this.config));var g=j();m.decrypt(e,t.key.buffer,t.iv.buffer,(function(e){var a=j();p.observer.trigger(r.default.FRAG_DECRYPTED,{stats:{tstart:g,tdecrypt:a}}),p.pushDecrypted(new Uint8Array(e),t,new Uint8Array(n),i,o,s,l,u,c,d,f,h)}))}else this.pushDecrypted(new Uint8Array(e),t,new Uint8Array(n),i,o,s,l,u,c,d,f,h)},t.pushDecrypted=function(e,t,n,a,o,s,l,u,c,d,f,h){var p=this.demuxer;if(!p||(l||u)&&!this.probe(e)){for(var m=this.observer,g=this.typeSupported,y=this.config,_=[{demux:S,remux:M},{demux:b.default,remux:N},{demux:v,remux:M},{demux:k,remux:M}],A=0,E=_.length;A<E;A++){var T=_[A],w=T.demux.probe;if(w(e)){var C=this.remuxer=new T.remux(m,y,g,this.vendor);p=new T.demux(m,C,y,g),this.probe=w;break}}if(!p)return void m.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=p}var x=this.remuxer;(l||u)&&(p.resetInitSegment(n,a,o,d),x.resetInitSegment()),l&&(p.resetTimeStamp(h),x.resetTimeStamp(h)),"function"==typeof p.setDecryptData&&p.setDecryptData(t),p.append(e,s,c,f)},e}();t.default=F},"./src/demux/demuxer-worker.js": -/*!*************************************!*\ - !*** ./src/demux/demuxer-worker.js ***! - \*************************************/ -/*! exports provided: default */ -/*! ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./src/demux/demuxer.js (referenced with require.resolve) */function(e,t,n){"use strict";n.r(t);var r=n(/*! ../demux/demuxer-inline */"./src/demux/demuxer-inline.js"),i=n(/*! ../events */"./src/events.js"),a=n(/*! ../utils/logger */"./src/utils/logger.js"),o=n(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");t.default=function(e){var t=new o.EventEmitter;t.trigger=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];t.emit.apply(t,[e,e].concat(r))},t.off=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];t.removeListener.apply(t,[e].concat(r))};var n=function(t,n){e.postMessage({event:t,data:n})};e.addEventListener("message",(function(i){var o=i.data;switch(o.cmd){case"init":var s=JSON.parse(o.config);e.demuxer=new r.default(t,o.typeSupported,s,o.vendor),Object(a.enableLogs)(s.debug),n("init",null);break;case"demux":e.demuxer.push(o.data,o.decryptdata,o.initSegment,o.audioCodec,o.videoCodec,o.timeOffset,o.discontinuity,o.trackSwitch,o.contiguous,o.duration,o.accurateTimeOffset,o.defaultInitPTS)}})),t.on(i.default.FRAG_DECRYPTED,n),t.on(i.default.FRAG_PARSING_INIT_SEGMENT,n),t.on(i.default.FRAG_PARSED,n),t.on(i.default.ERROR,n),t.on(i.default.FRAG_PARSING_METADATA,n),t.on(i.default.FRAG_PARSING_USERDATA,n),t.on(i.default.INIT_PTS_FOUND,n),t.on(i.default.FRAG_PARSING_DATA,(function(t,n){var r=[],i={event:t,data:n};n.data1&&(i.data1=n.data1.buffer,r.push(n.data1.buffer),delete n.data1),n.data2&&(i.data2=n.data2.buffer,r.push(n.data2.buffer),delete n.data2),e.postMessage(i,r)}))}},"./src/demux/id3.js": -/*!**************************!*\ - !*** ./src/demux/id3.js ***! - \**************************/ -/*! exports provided: default, utf8ArrayToStr */function(e,t,n){"use strict";n.r(t),n.d(t,"utf8ArrayToStr",(function(){return s}));var r,i=n(/*! ../utils/get-self-scope */"./src/utils/get-self-scope.js"),a=function(){function e(){}return e.isHeader=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},e.isFooter=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},e.getID3Data=function(t,n){for(var r=n,i=0;e.isHeader(t,n);)i+=10,i+=e._readSize(t,n+6),e.isFooter(t,n+10)&&(i+=10),n+=i;if(i>0)return t.subarray(r,r+i)},e._readSize=function(e,t){var n=0;return n=(127&e[t])<<21,n|=(127&e[t+1])<<14,n|=(127&e[t+2])<<7,n|=127&e[t+3]},e.getTimeStamp=function(t){for(var n=e.getID3Frames(t),r=0;r<n.length;r++){var i=n[r];if(e.isTimeStampFrame(i))return e._readTimeStamp(i)}},e.isTimeStampFrame=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},e._getFrameData=function(t){var n=String.fromCharCode(t[0],t[1],t[2],t[3]),r=e._readSize(t,4);return{type:n,size:r,data:t.subarray(10,10+r)}},e.getID3Frames=function(t){for(var n=0,r=[];e.isHeader(t,n);){for(var i=e._readSize(t,n+6),a=(n+=10)+i;n+8<a;){var o=e._getFrameData(t.subarray(n)),s=e._decodeFrame(o);s&&r.push(s),n+=o.size+10}e.isFooter(t,n)&&(n+=10)}return r},e._decodeFrame=function(t){return"PRIV"===t.type?e._decodePrivFrame(t):"T"===t.type[0]?e._decodeTextFrame(t):"W"===t.type[0]?e._decodeURLFrame(t):void 0},e._readTimeStamp=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),n=1&t[3],r=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return r/=45,n&&(r+=47721858.84),Math.round(r)}},e._decodePrivFrame=function(t){if(!(t.size<2)){var n=e._utf8ArrayToStr(t.data,!0),r=new Uint8Array(t.data.subarray(n.length+1));return{key:t.type,info:n,data:r.buffer}}},e._decodeTextFrame=function(t){if(!(t.size<2)){if("TXXX"===t.type){var n=1,r=e._utf8ArrayToStr(t.data.subarray(n),!0);n+=r.length+1;var i=e._utf8ArrayToStr(t.data.subarray(n));return{key:t.type,info:r,data:i}}var a=e._utf8ArrayToStr(t.data.subarray(1));return{key:t.type,data:a}}},e._decodeURLFrame=function(t){if("WXXX"===t.type){if(t.size<2)return;var n=1,r=e._utf8ArrayToStr(t.data.subarray(n));n+=r.length+1;var i=e._utf8ArrayToStr(t.data.subarray(n));return{key:t.type,info:r,data:i}}var a=e._utf8ArrayToStr(t.data);return{key:t.type,data:a}},e._utf8ArrayToStr=function(e,t){void 0===t&&(t=!1);var n=o();if(n){var r=n.decode(e);if(t){var i=r.indexOf("\0");return-1!==i?r.substring(0,i):r}return r.replace(/\0/g,"")}for(var a,s,l,u=e.length,c="",d=0;d<u;){if(0===(a=e[d++])&&t)return c;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(a);break;case 12:case 13:s=e[d++],c+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=e[d++],l=e[d++],c+=String.fromCharCode((15&a)<<12|(63&s)<<6|(63&l)<<0)}}return c},e}();function o(){var e=Object(i.getSelfScope)();return r||void 0===e.TextDecoder||(r=new e.TextDecoder("utf-8")),r}var s=a._utf8ArrayToStr;t.default=a},"./src/demux/mp4demuxer.js": -/*!*********************************!*\ - !*** ./src/demux/mp4demuxer.js ***! - \*********************************/ -/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var r=n(/*! ../utils/logger */"./src/utils/logger.js"),i=n(/*! ../events */"./src/events.js"),a=Math.pow(2,32)-1,o=function(){function e(e,t){this.observer=e,this.remuxer=t}var t=e.prototype;return t.resetTimeStamp=function(e){this.initPTS=e},t.resetInitSegment=function(t,n,r,a){if(t&&t.byteLength){var o=this.initData=e.parseInitSegment(t);null==n&&(n="mp4a.40.5"),null==r&&(r="avc1.42e01e");var s={};o.audio&&o.video?s.audiovideo={container:"video/mp4",codec:n+","+r,initSegment:a?t:null}:(o.audio&&(s.audio={container:"audio/mp4",codec:n,initSegment:a?t:null}),o.video&&(s.video={container:"video/mp4",codec:r,initSegment:a?t:null})),this.observer.trigger(i.default.FRAG_PARSING_INIT_SEGMENT,{tracks:s})}else n&&(this.audioCodec=n),r&&(this.videoCodec=r)},e.probe=function(t){return e.findBox({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},e.bin2str=function(e){return String.fromCharCode.apply(null,e)},e.readUint16=function(e,t){e.data&&(t+=e.start,e=e.data);var n=e[t]<<8|e[t+1];return n<0?65536+n:n},e.readUint32=function(e,t){e.data&&(t+=e.start,e=e.data);var n=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return n<0?4294967296+n:n},e.writeUint32=function(e,t,n){e.data&&(t+=e.start,e=e.data),e[t]=n>>24,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n},e.findBox=function(t,n){var r,i,a,o,s,l,u=[];if(t.data?(s=t.start,a=t.end,t=t.data):(s=0,a=t.byteLength),!n.length)return null;for(r=s;r<a;)l=(i=e.readUint32(t,r))>1?r+i:a,e.bin2str(t.subarray(r+4,r+8))===n[0]&&(1===n.length?u.push({data:t,start:r+8,end:l}):(o=e.findBox({data:t,start:r+8,end:l},n.slice(1))).length&&(u=u.concat(o))),r=l;return u},e.parseSegmentIndex=function(t){var n,r=e.findBox(t,["moov"])[0],i=r?r.end:null,a=0,o=e.findBox(t,["sidx"]);if(!o||!o[0])return null;n=[];var s=(o=o[0]).data[0];a=0===s?8:16;var l=e.readUint32(o,a);a+=4,a+=0===s?8:16,a+=2;var u=o.end+0,c=e.readUint16(o,a);a+=2;for(var d=0;d<c;d++){var f=a,h=e.readUint32(o,f);f+=4;var p=2147483647&h;if(1==(2147483648&h)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var m=e.readUint32(o,f);f+=4,n.push({referenceSize:p,subsegmentDuration:m,info:{duration:m/l,start:u,end:u+p-1}}),u+=p,a=f+=4}return{earliestPresentationTime:0,timescale:l,version:s,referencesCount:c,references:n,moovEndOffset:i}},e.parseInitSegment=function(t){var n=[];return e.findBox(t,["moov","trak"]).forEach((function(t){var i=e.findBox(t,["tkhd"])[0];if(i){var a=i.data[i.start],o=0===a?12:20,s=e.readUint32(i,o),l=e.findBox(t,["mdia","mdhd"])[0];if(l){o=0===(a=l.data[l.start])?12:20;var u=e.readUint32(l,o),c=e.findBox(t,["mdia","hdlr"])[0];if(c){var d={soun:"audio",vide:"video"}[e.bin2str(c.data.subarray(c.start+8,c.start+12))];if(d){var f=e.findBox(t,["mdia","minf","stbl","stsd"]);if(f.length){f=f[0];var h=e.bin2str(f.data.subarray(f.start+12,f.start+16));r.logger.log("MP4Demuxer:"+d+":"+h+" found")}n[s]={timescale:u,type:d},n[d]={timescale:u,id:s}}}}}})),n},e.getStartDTS=function(t,n){var r,i,a;return r=e.findBox(n,["moof","traf"]),i=[].concat.apply([],r.map((function(n){return e.findBox(n,["tfhd"]).map((function(r){var i,a;return i=e.readUint32(r,4),a=t[i].timescale||9e4,e.findBox(n,["tfdt"]).map((function(t){var n,r;return n=t.data[t.start],r=e.readUint32(t,4),1===n&&(r*=Math.pow(2,32),r+=e.readUint32(t,8)),r}))[0]/a}))}))),a=Math.min.apply(null,i),isFinite(a)?a:0},e.offsetStartDTS=function(t,n,r){e.findBox(n,["moof","traf"]).map((function(n){return e.findBox(n,["tfhd"]).map((function(i){var o=e.readUint32(i,4),s=t[o].timescale||9e4;e.findBox(n,["tfdt"]).map((function(t){var n=t.data[t.start],i=e.readUint32(t,4);if(0===n)e.writeUint32(t,4,i-r*s);else{i*=Math.pow(2,32),i+=e.readUint32(t,8),i-=r*s,i=Math.max(i,0);var o=Math.floor(i/(a+1)),l=Math.floor(i%(a+1));e.writeUint32(t,4,o),e.writeUint32(t,8,l)}}))}))}))},t.append=function(t,n,r,a){var o=this.initData;o||(this.resetInitSegment(t,this.audioCodec,this.videoCodec,!1),o=this.initData);var s,l=this.initPTS;if(void 0===l){var u=e.getStartDTS(o,t);this.initPTS=l=u-n,this.observer.trigger(i.default.INIT_PTS_FOUND,{initPTS:l})}e.offsetStartDTS(o,t,l),s=e.getStartDTS(o,t),this.remuxer.remux(o.audio,o.video,null,null,s,r,a,t)},t.destroy=function(){},e}();t.default=o},"./src/errors.ts": -/*!***********************!*\ - !*** ./src/errors.ts ***! - \***********************/ -/*! exports provided: ErrorTypes, ErrorDetails */function(e,t,n){"use strict";var r,i;n.r(t),n.d(t,"ErrorTypes",(function(){return r})),n.d(t,"ErrorDetails",(function(){return i})),function(e){e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError"}(r||(r={})),function(e){e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException"}(i||(i={}))},"./src/events.js": -/*!***********************!*\ - !*** ./src/events.js ***! - \***********************/ -/*! exports provided: default */function(e,t,n){"use strict";n.r(t),t.default={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition",LIVE_BACK_BUFFER_REACHED:"hlsLiveBackBufferReached"}},"./src/hls.ts": -/*!*********************************!*\ - !*** ./src/hls.ts + 50 modules ***! - \*********************************/ -/*! exports provided: default */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/demux/demuxer-worker.js */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/demuxer-inline.js because of ./src/demux/demuxer-worker.js */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/demux/demuxer-worker.js */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/demux/demuxer-worker.js */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/demux/demuxer-worker.js */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/demux/demuxer-worker.js */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number-isFinite.js because of ./src/demux/demuxer-worker.js */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/demux/demuxer-worker.js */ -/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/demux/demuxer-worker.js */ -/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/eventemitter3/index.js (<- Module is not an ECMAScript module) */ -/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/url-toolkit/src/url-toolkit.js (<- Module is not an ECMAScript module) */function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"newCue",(function(){return gt}));var i,a,o=n("./node_modules/url-toolkit/src/url-toolkit.js"),s=n("./src/errors.ts"),l=n("./src/polyfills/number-isFinite.js"),u=n("./src/events.js"),c=n("./src/utils/logger.js"),d={hlsEventGeneric:!0,hlsHandlerDestroying:!0,hlsHandlerDestroyed:!0},f=function(){function e(e){this.hls=void 0,this.handledEvents=void 0,this.useGenericHandler=void 0,this.hls=e,this.onEvent=this.onEvent.bind(this);for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.handledEvents=n,this.useGenericHandler=!0,this.registerListeners()}var t=e.prototype;return t.destroy=function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()},t.onHandlerDestroying=function(){},t.onHandlerDestroyed=function(){},t.isEventHandler=function(){return"object"==typeof this.handledEvents&&this.handledEvents.length&&"function"==typeof this.onEvent},t.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEach((function(e){if(d[e])throw new Error("Forbidden event-name: "+e);this.hls.on(e,this.onEvent)}),this)},t.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach((function(e){this.hls.off(e,this.onEvent)}),this)},t.onEvent=function(e,t){this.onEventGeneric(e,t)},t.onEventGeneric=function(e,t){try{(function(e,t){var n="on"+e.replace("hls","");if("function"!=typeof this[n])throw new Error("Event "+e+" has no generic handler in this "+this.constructor.name+" class (tried "+n+")");return this[n].bind(this,t)}).call(this,e,t).call()}catch(t){c.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}},e}();!function(e){e.MANIFEST="manifest",e.LEVEL="level",e.AUDIO_TRACK="audioTrack",e.SUBTITLE_TRACK="subtitleTrack"}(i||(i={})),function(e){e.MAIN="main",e.AUDIO="audio",e.SUBTITLE="subtitle"}(a||(a={}));var h=n("./src/demux/mp4demuxer.js");function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var m,g=function(){function e(e,t){this._uri=null,this.baseuri=void 0,this.reluri=void 0,this.method=null,this.key=null,this.iv=null,this.baseuri=e,this.reluri=t}var t,n,r;return t=e,(n=[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=Object(o.buildAbsoluteURL)(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}])&&p(t.prototype,n),r&&p(t,r),e}();function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}!function(e){e.AUDIO="audio",e.VIDEO="video"}(m||(m={}));var v=function(){function e(){var e;this._url=null,this._byteRange=null,this._decryptdata=null,this._elementaryStreams=((e={})[m.AUDIO]=!1,e[m.VIDEO]=!1,e),this.deltaPTS=0,this.rawProgramDateTime=null,this.programDateTime=null,this.title=null,this.tagList=[],this.cc=void 0,this.type=void 0,this.relurl=void 0,this.baseurl=void 0,this.duration=void 0,this.start=void 0,this.sn=0,this.urlId=0,this.level=0,this.levelkey=void 0,this.loader=void 0}var t,n,r,i=e.prototype;return i.setByteRange=function(e,t){var n=e.split("@",2),r=[];1===n.length?r[0]=t?t.byteRangeEndOffset:0:r[0]=parseInt(n[1]),r[1]=parseInt(n[0])+r[0],this._byteRange=r},i.addElementaryStream=function(e){this._elementaryStreams[e]=!0},i.hasElementaryStream=function(e){return!0===this._elementaryStreams[e]},i.createInitializationVector=function(e){for(var t=new Uint8Array(16),n=12;n<16;n++)t[n]=e>>8*(15-n)&255;return t},i.setDecryptDataFromLevelKey=function(e,t){var n=e;return e&&e.method&&e.uri&&!e.iv&&((n=new g(e.baseuri,e.reluri)).method=e.method,n.iv=this.createInitializationVector(t)),n},t=e,(n=[{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=Object(o.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(e){this._url=e}},{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var e=this.sn;"number"!=typeof e&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&c.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)}return this._decryptdata}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(l.isFiniteNumber)(this.programDateTime))return null;var e=Object(l.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){return!(!this.decryptdata||null===this.decryptdata.uri||null!==this.decryptdata.key)}}])&&y(t.prototype,n),r&&y(t,r),e}();function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var _=function(){function e(e){this.endCC=0,this.endSN=0,this.fragments=[],this.initSegment=null,this.live=!0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=e,this.version=null}var t,n,r;return t=e,(n=[{key:"hasProgramDateTime",get:function(){return!(!this.fragments[0]||!Object(l.isFiniteNumber)(this.fragments[0].programDateTime))}}])&&b(t.prototype,n),r&&b(t,r),e}(),A=/^(\d+)x(\d+)$/,E=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,T=function(){function e(t){for(var n in"string"==typeof t&&(t=e.parseAttrList(t)),t)t.hasOwnProperty(n)&&(this[n]=t[n])}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var n=new Uint8Array(t.length/2),r=0;r<t.length/2;r++)n[r]=parseInt(t.slice(2*r,2*r+2),16);return n}return null},t.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.enumeratedString=function(e){return this[e]},t.decimalResolution=function(e){var t=A.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,n={};for(E.lastIndex=0;null!==(t=E.exec(e));){var r=t[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),n[t[1]]=r}return n},e}(),w={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0}};function S(e,t){return MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}var k=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,C=/#EXT-X-MEDIA:(.*)/g,x=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)([\S+ ?]+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),R=/(?:(?:#(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?/,L=/\.(mp4|m4s|m4v|m4a)$/i,I=function(){function e(){}return e.findGroup=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.id===t)return r}},e.convertAVC1ToAVCOTI=function(e){var t,n=e.split(".");return n.length>2?(t=n.shift()+".",t+=parseInt(n.shift()).toString(16),t+=("000"+parseInt(n.shift()).toString(16)).substr(-4)):t=e,t},e.resolve=function(e,t){return o.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.parseMasterPlaylist=function(t,n){var r,i=[];function a(e,t){["video","audio"].forEach((function(n){var r=e.filter((function(e){return function(e,t){var n=w[t];return!!n&&!0===n[e.slice(0,4)]}(e,n)}));if(r.length){var i=r.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)}));t[n+"Codec"]=i.length>0?i[0]:r[0],e=e.filter((function(e){return-1===r.indexOf(e)}))}})),t.unknownCodecs=e}for(k.lastIndex=0;null!=(r=k.exec(t));){var o={},s=o.attrs=new T(r[1]);o.url=e.resolve(r[2],n);var l=s.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),o.bitrate=s.decimalInteger("AVERAGE-BANDWIDTH")||s.decimalInteger("BANDWIDTH"),o.name=s.NAME,a([].concat((s.CODECS||"").split(/[ ,]+/)),o),o.videoCodec&&-1!==o.videoCodec.indexOf("avc1")&&(o.videoCodec=e.convertAVC1ToAVCOTI(o.videoCodec)),i.push(o)}return i},e.parseMasterPlaylistMedia=function(t,n,r,i){var a;void 0===i&&(i=[]);var o=[],s=0;for(C.lastIndex=0;null!==(a=C.exec(t));){var l=new T(a[1]);if(l.TYPE===r){var u={id:s++,groupId:l["GROUP-ID"],name:l.NAME||l.LANGUAGE,type:r,default:"YES"===l.DEFAULT,autoselect:"YES"===l.AUTOSELECT,forced:"YES"===l.FORCED,lang:l.LANGUAGE};if(l.URI&&(u.url=e.resolve(l.URI,n)),i.length){var c=e.findGroup(i,u.groupId);u.audioCodec=c?c.codec:i[0].codec}o.push(u)}}return o},e.parseLevelPlaylist=function(e,t,n,r,i){var a,o,s,u=0,d=0,f=new _(t),h=0,p=null,m=new v,y=null;for(x.lastIndex=0;null!==(a=x.exec(e));){var b=a[1];if(b){m.duration=parseFloat(b);var A=(" "+a[2]).slice(1);m.title=A||null,m.tagList.push(A?["INF",b,A]:["INF",b])}else if(a[3]){if(Object(l.isFiniteNumber)(m.duration)){var E=u++;m.type=r,m.start=d,s&&(m.levelkey=s),m.sn=E,m.level=n,m.cc=h,m.urlId=i,m.baseurl=t,m.relurl=(" "+a[3]).slice(1),P(m,p),f.fragments.push(m),p=m,d+=m.duration,m=new v}}else if(a[4]){var w=(" "+a[4]).slice(1);p?m.setByteRange(w,p):m.setByteRange(w)}else if(a[5])m.rawProgramDateTime=(" "+a[5]).slice(1),m.tagList.push(["PROGRAM-DATE-TIME",m.rawProgramDateTime]),null===y&&(y=f.fragments.length);else{if(!(a=a[0].match(R))){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(o=1;o<a.length&&void 0===a[o];o++);var S=(" "+a[o+1]).slice(1),k=(" "+a[o+2]).slice(1);switch(a[o]){case"#":m.tagList.push(k?[S,k]:[S]);break;case"PLAYLIST-TYPE":f.type=S.toUpperCase();break;case"MEDIA-SEQUENCE":u=f.startSN=parseInt(S);break;case"TARGETDURATION":f.targetduration=parseFloat(S);break;case"VERSION":f.version=parseInt(S);break;case"EXTM3U":break;case"ENDLIST":f.live=!1;break;case"DIS":h++,m.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":h=parseInt(S);break;case"KEY":var C=new T(S),I=C.enumeratedString("METHOD"),j=C.URI,O=C.hexadecimalInteger("IV");I&&(s=new g(t,j),j&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(I)>=0&&(s.method=I,s.key=null,s.iv=O));break;case"START":var D=new T(S).decimalFloatingPoint("TIME-OFFSET");Object(l.isFiniteNumber)(D)&&(f.startTimeOffset=D);break;case"MAP":var M=new T(S);m.relurl=M.URI,M.BYTERANGE&&m.setByteRange(M.BYTERANGE),m.baseurl=t,m.level=n,m.type=r,m.sn="initSegment",f.initSegment=m,(m=new v).rawProgramDateTime=f.initSegment.rawProgramDateTime;break;default:c.logger.warn("line parsed but not handled: "+a)}}}return(m=p)&&!m.relurl&&(f.fragments.pop(),d-=m.duration),f.totalduration=d,f.averagetargetduration=d/f.fragments.length,f.endSN=u-1,f.startCC=f.fragments[0]?f.fragments[0].cc:0,f.endCC=h,!f.initSegment&&f.fragments.length&&f.fragments.every((function(e){return L.test(e.relurl)}))&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(m=new v).relurl=f.fragments[0].relurl,m.baseurl=t,m.level=n,m.type=r,m.sn="initSegment",f.initSegment=m,f.needSidxRanges=!0),y&&function(e,t){for(var n=e[t],r=t-1;r>=0;r--){var i=e[r];i.programDateTime=n.programDateTime-1e3*i.duration,n=i}}(f.fragments,y),f},e}();function P(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Object(l.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}var j=window.performance,O=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.MANIFEST_LOADING,u.default.LEVEL_LOADING,u.default.AUDIO_TRACK_LOADING,u.default.SUBTITLE_TRACK_LOADING)||this).loaders={},n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,r.canHaveQualityLevels=function(e){return e!==i.AUDIO_TRACK&&e!==i.SUBTITLE_TRACK},r.mapContextToLevelType=function(e){switch(e.type){case i.AUDIO_TRACK:return a.AUDIO;case i.SUBTITLE_TRACK:return a.SUBTITLE;default:return a.MAIN}},r.getResponseUrl=function(e,t){var n=e.url;return void 0!==n&&0!==n.indexOf("data:")||(n=t.url),n};var o=r.prototype;return o.createInternalLoader=function(e){var t=this.hls.config,n=t.pLoader,r=t.loader,i=new(n||r)(t);return e.loader=i,this.loaders[e.type]=i,i},o.getInternalLoader=function(e){return this.loaders[e.type]},o.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},o.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},o.destroy=function(){this.destroyInternalLoaders(),e.prototype.destroy.call(this)},o.onManifestLoading=function(e){this.load({url:e.url,type:i.MANIFEST,level:0,id:null,responseType:"text"})},o.onLevelLoading=function(e){this.load({url:e.url,type:i.LEVEL,level:e.level,id:e.id,responseType:"text"})},o.onAudioTrackLoading=function(e){this.load({url:e.url,type:i.AUDIO_TRACK,level:null,id:e.id,responseType:"text"})},o.onSubtitleTrackLoading=function(e){this.load({url:e.url,type:i.SUBTITLE_TRACK,level:null,id:e.id,responseType:"text"})},o.load=function(e){var t=this.hls.config;c.logger.debug("Loading playlist of type "+e.type+", level: "+e.level+", id: "+e.id);var n,r,a,o,s=this.getInternalLoader(e);if(s){var l=s.context;if(l&&l.url===e.url)return c.logger.trace("playlist request ongoing"),!1;c.logger.warn("aborting previous loader for type: "+e.type),s.abort()}switch(e.type){case i.MANIFEST:n=t.manifestLoadingMaxRetry,r=t.manifestLoadingTimeOut,a=t.manifestLoadingRetryDelay,o=t.manifestLoadingMaxRetryTimeout;break;case i.LEVEL:n=0,o=0,a=0,r=t.levelLoadingTimeOut;break;default:n=t.levelLoadingMaxRetry,r=t.levelLoadingTimeOut,a=t.levelLoadingRetryDelay,o=t.levelLoadingMaxRetryTimeout}s=this.createInternalLoader(e);var u={timeout:r,maxRetry:n,retryDelay:a,maxRetryDelay:o},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return c.logger.debug("Calling internal loader delegate for URL: "+e.url),s.load(e,u,d),!0},o.loadsuccess=function(e,t,n,r){if(void 0===r&&(r=null),n.isSidxRequest)return this._handleSidxRequest(e,n),void this._handlePlaylistLoaded(e,t,n,r);if(this.resetInternalLoader(n.type),"string"!=typeof e.data)throw new Error('expected responseType of "text" for PlaylistLoader');var i=e.data;t.tload=j.now(),0===i.indexOf("#EXTM3U")?i.indexOf("#EXTINF:")>0||i.indexOf("#EXT-X-TARGETDURATION:")>0?this._handleTrackOrLevelPlaylist(e,t,n,r):this._handleMasterPlaylist(e,t,n,r):this._handleManifestParsingError(e,n,"no EXTM3U delimiter",r)},o.loaderror=function(e,t,n){void 0===n&&(n=null),this._handleNetworkError(t,n,!1,e)},o.loadtimeout=function(e,t,n){void 0===n&&(n=null),this._handleNetworkError(t,n,!0)},o._handleMasterPlaylist=function(e,t,n,i){var a=this.hls,o=e.data,s=r.getResponseUrl(e,n),l=I.parseMasterPlaylist(o,s);if(l.length){var d=l.map((function(e){return{id:e.attrs.AUDIO,codec:e.audioCodec}})),f=I.parseMasterPlaylistMedia(o,s,"AUDIO",d),h=I.parseMasterPlaylistMedia(o,s,"SUBTITLES");if(f.length){var p=!1;f.forEach((function(e){e.url||(p=!0)})),!1===p&&l[0].audioCodec&&!l[0].attrs.AUDIO&&(c.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1}))}a.trigger(u.default.MANIFEST_LOADED,{levels:l,audioTracks:f,subtitles:h,url:s,stats:t,networkDetails:i})}else this._handleManifestParsingError(e,n,"no level found in manifest",i)},o._handleTrackOrLevelPlaylist=function(e,t,n,a){var o=this.hls,s=n.id,c=n.level,d=n.type,f=r.getResponseUrl(e,n),h=Object(l.isFiniteNumber)(s)?s:0,p=Object(l.isFiniteNumber)(c)?c:h,m=r.mapContextToLevelType(n),g=I.parseLevelPlaylist(e.data,f,p,m,h);if(g.tload=t.tload,d===i.MANIFEST){var y={url:f,details:g};o.trigger(u.default.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:f,stats:t,networkDetails:a})}if(t.tparsed=j.now(),g.needSidxRanges){var v=g.initSegment.url;this.load({url:v,isSidxRequest:!0,type:d,level:c,levelDetails:g,id:s,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}else n.levelDetails=g,this._handlePlaylistLoaded(e,t,n,a)},o._handleSidxRequest=function(e,t){if("string"==typeof e.data)throw new Error("sidx request must be made with responseType of array buffer");var n=h.default.parseSegmentIndex(new Uint8Array(e.data));if(n){var r=n.references,i=t.levelDetails;r.forEach((function(e,t){var n=e.info;if(i){var r=i.fragments[t];0===r.byteRange.length&&r.setByteRange(String(1+n.end-n.start)+"@"+String(n.start))}})),i&&i.initSegment.setByteRange(String(n.moovEndOffset)+"@0")}},o._handleManifestParsingError=function(e,t,n,r){this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:e.url,reason:n,networkDetails:r})},o._handleNetworkError=function(e,t,n,r){var a,o;void 0===n&&(n=!1),void 0===r&&(r=null),c.logger.info("A network error occured while loading a "+e.type+"-type playlist");var l=this.getInternalLoader(e);switch(e.type){case i.MANIFEST:a=n?s.ErrorDetails.MANIFEST_LOAD_TIMEOUT:s.ErrorDetails.MANIFEST_LOAD_ERROR,o=!0;break;case i.LEVEL:a=n?s.ErrorDetails.LEVEL_LOAD_TIMEOUT:s.ErrorDetails.LEVEL_LOAD_ERROR,o=!1;break;case i.AUDIO_TRACK:a=n?s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,o=!1;break;default:o=!1}l&&(l.abort(),this.resetInternalLoader(e.type));var d={type:s.ErrorTypes.NETWORK_ERROR,details:a,fatal:o,url:e.url,loader:l,context:e,networkDetails:t};r&&(d.response=r),this.hls.trigger(u.default.ERROR,d)},o._handlePlaylistLoaded=function(e,t,n,a){var o=n.type,s=n.level,l=n.id,c=n.levelDetails;if(c&&c.targetduration)if(r.canHaveQualityLevels(n.type))this.hls.trigger(u.default.LEVEL_LOADED,{details:c,level:s||0,id:l||0,stats:t,networkDetails:a});else switch(o){case i.AUDIO_TRACK:this.hls.trigger(u.default.AUDIO_TRACK_LOADED,{details:c,id:l,stats:t,networkDetails:a});break;case i.SUBTITLE_TRACK:this.hls.trigger(u.default.SUBTITLE_TRACK_LOADED,{details:c,id:l,stats:t,networkDetails:a})}else this._handleManifestParsingError(e,n,"invalid target duration",a)},r}(f),D=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.FRAG_LOADING)||this).loaders={},n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.destroy=function(){var t=this.loaders;for(var n in t){var r=t[n];r&&r.destroy()}this.loaders={},e.prototype.destroy.call(this)},i.onFragLoading=function(e){var t=e.frag,n=t.type,r=this.loaders,i=this.hls.config,a=i.fLoader,o=i.loader;t.loaded=0;var s,u,d,f=r[n];f&&(c.logger.warn("abort previous fragment loader for type: "+n),f.abort()),f=r[n]=t.loader=i.fLoader?new a(i):new o(i),s={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1};var h=t.byteRangeStartOffset,p=t.byteRangeEndOffset;Object(l.isFiniteNumber)(h)&&Object(l.isFiniteNumber)(p)&&(s.rangeStart=h,s.rangeEnd=p),u={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:i.fragLoadingMaxRetryTimeout},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},f.load(s,u,d)},i.loadsuccess=function(e,t,n,r){void 0===r&&(r=null);var i=e.data,a=n.frag;a.loader=void 0,this.loaders[a.type]=void 0,this.hls.trigger(u.default.FRAG_LOADED,{payload:i,frag:a,stats:t,networkDetails:r})},i.loaderror=function(e,t,n){void 0===n&&(n=null);var r=t.frag,i=r.loader;i&&i.abort(),this.loaders[r.type]=void 0,this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t.frag,response:e,networkDetails:n})},i.loadtimeout=function(e,t,n){void 0===n&&(n=null);var r=t.frag,i=r.loader;i&&i.abort(),this.loaders[r.type]=void 0,this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t.frag,networkDetails:n})},i.loadprogress=function(e,t,n,r){void 0===r&&(r=null);var i=t.frag;i.loaded=e.loaded,this.hls.trigger(u.default.FRAG_LOAD_PROGRESS,{frag:i,stats:e,networkDetails:r})},r}(f),M=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.KEY_LOADING)||this).loaders={},n.decryptkey=null,n.decrypturl=null,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.destroy=function(){for(var t in this.loaders){var n=this.loaders[t];n&&n.destroy()}this.loaders={},e.prototype.destroy.call(this)},i.onKeyLoading=function(e){var t=e.frag,n=t.type,r=this.loaders[n];if(t.decryptdata){var i=t.decryptdata.uri;if(i!==this.decrypturl||null===this.decryptkey){var a=this.hls.config;if(r&&(c.logger.warn("abort previous key loader for type:"+n),r.abort()),!i)return void c.logger.warn("key uri is falsy");t.loader=this.loaders[n]=new a.loader(a),this.decrypturl=i,this.decryptkey=null;var o={url:i,frag:t,responseType:"arraybuffer"},s={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.loader.load(o,s,l)}else this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(u.default.KEY_LOADED,{frag:t}))}else c.logger.warn("Missing decryption data on fragment in onKeyLoading")},i.loadsuccess=function(e,t,n){var r=n.frag;r.decryptdata?(this.decryptkey=r.decryptdata.key=new Uint8Array(e.data),r.loader=void 0,delete this.loaders[r.type],this.hls.trigger(u.default.KEY_LOADED,{frag:r})):c.logger.error("after key load, decryptdata unset")},i.loaderror=function(e,t){var n=t.frag,r=n.loader;r&&r.abort(),delete this.loaders[n.type],this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:n,response:e})},i.loadtimeout=function(e,t){var n=t.frag,r=n.loader;r&&r.abort(),delete this.loaders[n.type],this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:n})},r}(f),N="NOT_LOADED",U="APPENDING",F="PARTIAL",B="OK",K=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.BUFFER_APPENDED,u.default.FRAG_BUFFERED,u.default.FRAG_LOADED)||this).bufferPadding=.2,n.fragments=Object.create(null),n.timeRanges=Object.create(null),n.config=t.config,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.destroy=function(){this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.config=null,f.prototype.destroy.call(this),e.prototype.destroy.call(this)},i.getBufferedFrag=function(e,t){var n=this.fragments,r=Object.keys(n).filter((function(r){var i=n[r];if(i.body.type!==t)return!1;if(!i.buffered)return!1;var a=i.body;return a.startPTS<=e&&e<=a.endPTS}));if(0===r.length)return null;var i=r.pop();return n[i].body},i.detectEvictedFragments=function(e,t){var n,r,i=this;Object.keys(this.fragments).forEach((function(a){var o=i.fragments[a];if(!0===o.buffered){var s=o.range[e];if(s){n=s.time;for(var l=0;l<n.length;l++)if(r=n[l],!1===i.isTimeBuffered(r.startPTS,r.endPTS,t)){i.removeFragment(o.body);break}}}}))},i.detectPartialFragments=function(e){var t=this,n=this.getFragmentKey(e),r=this.fragments[n];r&&(r.buffered=!0,Object.keys(this.timeRanges).forEach((function(n){if(e.hasElementaryStream(n)){var i=t.timeRanges[n];r.range[n]=t.getBufferedTimes(e.startPTS,e.endPTS,i)}})))},i.getBufferedTimes=function(e,t,n){for(var r,i,a=[],o=!1,s=0;s<n.length;s++){if(r=n.start(s)-this.bufferPadding,i=n.end(s)+this.bufferPadding,e>=r&&t<=i){a.push({startPTS:Math.max(e,n.start(s)),endPTS:Math.min(t,n.end(s))});break}if(e<i&&t>r)a.push({startPTS:Math.max(e,n.start(s)),endPTS:Math.min(t,n.end(s))}),o=!0;else if(t<=r)break}return{time:a,partial:o}},i.getFragmentKey=function(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn},i.getPartialFragment=function(e){var t,n,r,i=this,a=null,o=0;return Object.keys(this.fragments).forEach((function(s){var l=i.fragments[s];i.isPartial(l)&&(n=l.body.startPTS-i.bufferPadding,r=l.body.endPTS+i.bufferPadding,e>=n&&e<=r&&(t=Math.min(e-n,r-e),o<=t&&(a=l.body,o=t)))})),a},i.getState=function(e){var t=this.getFragmentKey(e),n=this.fragments[t],r=N;return void 0!==n&&(r=n.buffered?!0===this.isPartial(n)?F:B:U),r},i.isPartial=function(e){return!0===e.buffered&&(void 0!==e.range.video&&!0===e.range.video.partial||void 0!==e.range.audio&&!0===e.range.audio.partial)},i.isTimeBuffered=function(e,t,n){for(var r,i,a=0;a<n.length;a++){if(r=n.start(a)-this.bufferPadding,i=n.end(a)+this.bufferPadding,e>=r&&t<=i)return!0;if(t<=r)return!1}return!1},i.onFragLoaded=function(e){var t=e.frag;Object(l.isFiniteNumber)(t.sn)&&!t.bitrateTest&&(this.fragments[this.getFragmentKey(t)]={body:t,range:Object.create(null),buffered:!1})},i.onBufferAppended=function(e){var t=this;this.timeRanges=e.timeRanges,Object.keys(this.timeRanges).forEach((function(e){var n=t.timeRanges[e];t.detectEvictedFragments(e,n)}))},i.onFragBuffered=function(e){this.detectPartialFragments(e.frag)},i.hasFragment=function(e){var t=this.getFragmentKey(e);return void 0!==this.fragments[t]},i.removeFragment=function(e){var t=this.getFragmentKey(e);delete this.fragments[t]},i.removeAllFragments=function(){this.fragments=Object.create(null)},r}(f),V={search:function(e,t){for(var n=0,r=e.length-1,i=null,a=null;n<=r;){var o=t(a=e[i=(n+r)/2|0]);if(o>0)n=i+1;else{if(!(o<0))return a;r=i-1}}return null}},G=function(){function e(){}return e.isBuffered=function(e,t){try{if(e)for(var n=e.buffered,r=0;r<n.length;r++)if(t>=n.start(r)&&t<=n.end(r))return!0}catch(e){}return!1},e.bufferInfo=function(e,t,n){try{if(e){var r,i=e.buffered,a=[];for(r=0;r<i.length;r++)a.push({start:i.start(r),end:i.end(r)});return this.bufferedInfo(a,t,n)}}catch(e){}return{len:0,start:t,end:t,nextStart:void 0}},e.bufferedInfo=function(e,t,n){e.sort((function(e,t){var n=e.start-t.start;return n||t.end-e.end}));var r=[];if(n)for(var i=0;i<e.length;i++){var a=r.length;if(a){var o=r[a-1].end;e[i].start-o<n?e[i].end>o&&(r[a-1].end=e[i].end):r.push(e[i])}else r.push(e[i])}else r=e;for(var s,l=0,u=t,c=t,d=0;d<r.length;d++){var f=r[d].start,h=r[d].end;if(t+n>=f&&t<h)u=f,l=(c=h)-t;else if(t+n<f){s=f;break}}return{len:l,start:u,end:c,nextStart:s}},e}(),H=n("./node_modules/eventemitter3/index.js"),Y=n("./node_modules/webworkify-webpack/index.js"),z=n("./src/demux/demuxer-inline.js");function W(){return window.MediaSource||window.WebKitMediaSource}var $=n("./src/utils/get-self-scope.js"),q=function(e){var t,n;function r(){return e.apply(this,arguments)||this}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,r.prototype.trigger=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.emit.apply(this,[e,e].concat(n))},r}(H.EventEmitter),X=Object($.getSelfScope)(),J=W()||{isTypeSupported:function(){return!1}},Q=function(){function e(e,t){var n=this;this.hls=e,this.id=t;var r=this.observer=new q,i=e.config,a=function(t,r){(r=r||{}).frag=n.frag,r.id=n.id,e.trigger(t,r)};r.on(u.default.FRAG_DECRYPTED,a),r.on(u.default.FRAG_PARSING_INIT_SEGMENT,a),r.on(u.default.FRAG_PARSING_DATA,a),r.on(u.default.FRAG_PARSED,a),r.on(u.default.ERROR,a),r.on(u.default.FRAG_PARSING_METADATA,a),r.on(u.default.FRAG_PARSING_USERDATA,a),r.on(u.default.INIT_PTS_FOUND,a);var o={mp4:J.isTypeSupported("video/mp4"),mpeg:J.isTypeSupported("audio/mpeg"),mp3:J.isTypeSupported('audio/mp4; codecs="mp3"')},l=navigator.vendor;if(i.enableWorker&&"undefined"!=typeof Worker){var d;c.logger.log("demuxing in webworker");try{d=this.w=Y(/*! ../demux/demuxer-worker.js */"./src/demux/demuxer-worker.js"),this.onwmsg=this.onWorkerMessage.bind(this),d.addEventListener("message",this.onwmsg),d.onerror=function(t){e.trigger(u.default.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},d.postMessage({cmd:"init",typeSupported:o,vendor:l,id:t,config:JSON.stringify(i)})}catch(e){c.logger.warn("Error in worker:",e),c.logger.error("Error while initializing DemuxerWorker, fallback on DemuxerInline"),d&&X.URL.revokeObjectURL(d.objectURL),this.demuxer=new z.default(r,o,i,l),this.w=void 0}}else this.demuxer=new z.default(r,o,i,l)}var t=e.prototype;return t.destroy=function(){var e=this.w;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.w=null;else{var t=this.demuxer;t&&(t.destroy(),this.demuxer=null)}var n=this.observer;n&&(n.removeAllListeners(),this.observer=null)},t.push=function(e,t,n,r,i,a,o,s){var u=this.w,d=Object(l.isFiniteNumber)(i.startPTS)?i.startPTS:i.start,f=i.decryptdata,h=this.frag,p=!(h&&i.cc===h.cc),m=!(h&&i.level===h.level),g=h&&i.sn===h.sn+1,y=!m&&g;if(p&&c.logger.log(this.id+":discontinuity detected"),m&&c.logger.log(this.id+":switch detected"),this.frag=i,u)u.postMessage({cmd:"demux",data:e,decryptdata:f,initSegment:t,audioCodec:n,videoCodec:r,timeOffset:d,discontinuity:p,trackSwitch:m,contiguous:y,duration:a,accurateTimeOffset:o,defaultInitPTS:s},e instanceof ArrayBuffer?[e]:[]);else{var v=this.demuxer;v&&v.push(e,f,t,n,r,d,p,m,y,a,o,s)}},t.onWorkerMessage=function(e){var t=e.data,n=this.hls;switch(t.event){case"init":X.URL.revokeObjectURL(this.w.objectURL);break;case u.default.FRAG_PARSING_DATA:t.data.data1=new Uint8Array(t.data1),t.data2&&(t.data.data2=new Uint8Array(t.data2));default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,n.trigger(t.event,t.data)}},e}();function Z(e,t,n){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(n);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(n)}}function ee(e,t,n){var r=e[t],i=e[n],a=i.startPTS;Object(l.isFiniteNumber)(a)?n>t?(r.duration=a-r.start,r.duration<0&&c.logger.warn("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!")):(i.duration=r.start-a,i.duration<0&&c.logger.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):i.start=n>t?r.start+r.duration:Math.max(r.start-i.duration,0)}function te(e,t,n,r,i,a){var o=n;if(Object(l.isFiniteNumber)(t.startPTS)){var s=Math.abs(t.startPTS-n);Object(l.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(s,t.deltaPTS):t.deltaPTS=s,o=Math.max(n,t.startPTS),n=Math.min(n,t.startPTS),r=Math.max(r,t.endPTS),i=Math.min(i,t.startDTS),a=Math.max(a,t.endDTS)}var u=n-t.start;t.start=t.startPTS=n,t.maxStartPTS=o,t.endPTS=r,t.startDTS=i,t.endDTS=a,t.duration=r-n;var c,d,f,h=t.sn;if(!e||h<e.startSN||h>e.endSN)return 0;for(c=h-e.startSN,(d=e.fragments)[c]=t,f=c;f>0;f--)ee(d,f,f-1);for(f=c;f<d.length-1;f++)ee(d,f,f+1);return e.PTSKnown=!0,u}function ne(e,t){t.initSegment&&e.initSegment&&(t.initSegment=e.initSegment);var n,r=0;if(re(e,t,(function(e,i){r=e.cc-i.cc,Object(l.isFiniteNumber)(e.startPTS)&&(i.start=i.startPTS=e.startPTS,i.endPTS=e.endPTS,i.duration=e.duration,i.backtracked=e.backtracked,i.dropped=e.dropped,n=i),t.PTSKnown=!0})),t.PTSKnown){if(r){c.logger.log("discontinuity sliding from playlist, take drift into account");for(var i=t.fragments,a=0;a<i.length;a++)i[a].cc+=r}n?te(t,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):function(e,t){var n=t.startSN-e.startSN,r=e.fragments,i=t.fragments;if(!(n<0||n>r.length))for(var a=0;a<i.length;a++)i[a].start+=r[n].start}(e,t),t.PTSKnown=e.PTSKnown}}function re(e,t,n){if(e&&t)for(var r=Math.max(e.startSN,t.startSN)-t.startSN,i=Math.min(e.endSN,t.endSN)-t.startSN,a=t.startSN-e.startSN,o=r;o<=i;o++){var s=e.fragments[a+o],l=t.fragments[o];if(!s||!l)break;n(s,l,o)}}function ie(e,t,n){var r=1e3*(t.averagetargetduration?t.averagetargetduration:t.targetduration),i=r/2;return e&&t.endSN===e.endSN&&(r=i),n&&(r=Math.max(i,r-(window.performance.now()-n))),Math.round(r)}var ae={toString:function(e){for(var t="",n=e.length,r=0;r<n;r++)t+="["+e.start(r).toFixed(3)+","+e.end(r).toFixed(3)+"]";return t}};function oe(e,t){t.fragments.forEach((function(t){if(t){var n=t.start+e;t.start=t.startPTS=n,t.endPTS=n+t.duration}})),t.PTSKnown=!0}function se(e,t,n){!function(e,t,n){if(function(e,t,n){var r=!1;return t&&t.details&&n&&(n.endCC>n.startCC||e&&e.cc<n.startCC)&&(r=!0),r}(e,n,t)){var r=function(e,t){var n=e.fragments,r=t.fragments;if(r.length&&n.length){var i=function(e,t){for(var n=null,r=0;r<e.length;r+=1){var i=e[r];if(i&&i.cc===t){n=i;break}}return n}(n,r[0].cc);if(i&&(!i||i.startPTS))return i;c.logger.log("No frag in previous level to align on")}else c.logger.log("No fragments to align")}(n.details,t);r&&(c.logger.log("Adjusting PTS using last level due to CC increase within current level"),oe(r.start,t))}}(e,n,t),!n.PTSKnown&&t&&function(e,t){if(t&&t.fragments.length){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;var n=t.fragments[0].programDateTime,r=(e.fragments[0].programDateTime-n)/1e3+t.fragments[0].start;Object(l.isFiniteNumber)(r)&&(c.logger.log("adjusting PTS using programDateTime delta, sliding:"+r.toFixed(3)),oe(r,e))}}(n,t.details)}function le(e,t,n){if(null===t||!Array.isArray(e)||!e.length||!Object(l.isFiniteNumber)(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;n=n||0;for(var r=0;r<e.length;++r){var i=e[r];if(de(t,n,i))return i}return null}function ue(e,t,n,r){void 0===n&&(n=0),void 0===r&&(r=0);var i=e?t[e.sn-t[0].sn+1]:null;return i&&!ce(n,r,i)?i:V.search(t,ce.bind(null,n,r))}function ce(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0);var r=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-r<=e?1:n.start-r>e&&n.start?-1:0}function de(e,t,n){var r=1e3*Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return(n.endProgramDateTime||0)-r>e}var fe=function(){function e(e,t,n,r){this.config=e,this.media=t,this.fragmentTracker=n,this.hls=r,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1}var t=e.prototype;return t.poll=function(e){var t=this.config,n=this.media,r=this.stalled,i=n.currentTime,a=n.seeking,o=this.seeking&&!a,s=!this.seeking&&a;if(this.seeking=a,i===e){if((s||o)&&(this.stalled=null),!n.paused&&!n.ended&&0!==n.playbackRate&&n.buffered.length){var l=G.bufferInfo(n,i,0),u=l.len>0,d=l.nextStart||0;if(u||d){if(a){if(l.len>2||!d||d-i>2)return;this.moved=!1}if(!this.moved&&this.stalled){var f=Math.max(d,l.start||0)-i;if(f>0&&f<=2)return void this._trySkipBufferHole(null)}var h=self.performance.now();if(null!==r){var p=h-r;!a&&p>=250&&this._reportStall(l.len);var m=G.bufferInfo(n,i,t.maxBufferHole);this._tryFixBufferStall(m,p)}else this.stalled=h}}}else if(this.moved=!0,null!==r){if(this.stallReported){var g=self.performance.now()-r;c.logger.warn("playback not stuck anymore @"+i+", after "+Math.round(g)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},t._tryFixBufferStall=function(e,t){var n=this.config,r=this.fragmentTracker,i=this.media.currentTime,a=r.getPartialFragment(i);a&&this._trySkipBufferHole(a)||e.len>n.maxBufferHole&&t>1e3*n.highBufferWatchdogPeriod&&(c.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,n=this.media;this.stallReported||(this.stallReported=!0,c.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer"),t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,n=this.hls,r=this.media,i=r.currentTime,a=0,o=0;o<r.buffered.length;o++){var l=r.buffered.start(o);if(i+t.maxBufferHole>=a&&i<l){var d=Math.max(l+.05,r.currentTime+.1);return c.logger.warn("skipping hole, adjusting currentTime from "+i+" to "+d),this.moved=!0,this.stalled=null,r.currentTime=d,e&&n.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+i+" to "+d,frag:e}),d}a=r.buffered.end(o)}return 0},t._tryNudgeBuffer=function(){var e=this.config,t=this.hls,n=this.media,r=n.currentTime,i=(this.nudgeRetry||0)+1;if(this.nudgeRetry=i,i<e.nudgeMaxRetry){var a=r+i*e.nudgeOffset;c.logger.warn("Nudging 'currentTime' from "+r+" to "+a),n.currentTime=a,t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else c.logger.error("Playhead still not moving while enough data buffered @"+r+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},e}();function he(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var pe=function(e){var t,n;function r(t){for(var n,r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];return(n=e.call.apply(e,[this,t].concat(i))||this)._boundTick=void 0,n._tickTimer=null,n._tickInterval=null,n._tickCallCount=0,n._boundTick=n.tick.bind(he(n)),n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},i.hasInterval=function(){return!!this._tickInterval},i.hasNextTick=function(){return!!this._tickTimer},i.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},i.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},i.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},i.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&(this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)),this._tickCallCount=0)},i.doTick=function(){},r}(f),me="STOPPED",ge="STARTING",ye="IDLE",ve="PAUSED",be="KEY_LOADING",_e="FRAG_LOADING",Ae="FRAG_LOADING_WAITING_RETRY",Ee="WAITING_TRACK",Te="PARSING",we="PARSED",Se="BUFFER_FLUSHING",ke="ENDED",Ce="ERROR",xe="WAITING_INIT_PTS",Re="WAITING_LEVEL",Le=function(e){var t,n;function r(){return e.apply(this,arguments)||this}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.doTick=function(){},i.startLoad=function(){},i.stopLoad=function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragmentTracker.removeFragment(e)),this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=me},i._streamEnded=function(e,t){var n=this.fragCurrent,r=this.fragmentTracker;if(!t.live&&n&&!n.backtracked&&n.sn===t.endSN&&!e.nextStart){var i=r.getState(n);return i===F||i===B}return!1},i.onMediaSeeking=function(){var e=this.config,t=this.media,n=this.mediaBuffer,r=this.state,i=t?t.currentTime:null,a=G.bufferInfo(n||t,i,this.config.maxBufferHole);if(Object(l.isFiniteNumber)(i)&&c.logger.log("media seeking to "+i.toFixed(3)),r===_e){var o=this.fragCurrent;if(0===a.len&&o){var s=e.maxFragLookUpTolerance,u=o.start-s,d=o.start+o.duration+s;i<u||i>d?(o.loader&&(c.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),o.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=ye):c.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else r===ke&&(0===a.len&&(this.fragPrevious=null,this.fragCurrent=null),this.state=ye);t&&(this.lastCurrentTime=i),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=i),this.tick()},i.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},i.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this)},i.onHandlerDestroyed=function(){this.state=me,this.fragmentTracker=null},i.computeLivePosition=function(e,t){var n=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;return e+Math.max(0,t.totalduration-n)},r}(pe);function Ie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Pe=function(e){var t,n;function r(t,n){var r;return(r=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.MANIFEST_LOADING,u.default.MANIFEST_PARSED,u.default.LEVEL_LOADED,u.default.KEY_LOADED,u.default.FRAG_LOADED,u.default.FRAG_LOAD_EMERGENCY_ABORTED,u.default.FRAG_PARSING_INIT_SEGMENT,u.default.FRAG_PARSING_DATA,u.default.FRAG_PARSED,u.default.ERROR,u.default.AUDIO_TRACK_SWITCHING,u.default.AUDIO_TRACK_SWITCHED,u.default.BUFFER_CREATED,u.default.BUFFER_APPENDED,u.default.BUFFER_FLUSHED)||this).fragmentTracker=n,r.config=t.config,r.audioCodecSwap=!1,r._state=me,r.stallReported=!1,r.gapController=null,r.altAudio=!1,r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i,o,d,f=r.prototype;return f.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,n=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var r=n.startLevel;-1===r&&(r=0,this.bitrateTest=!0),this.level=n.nextLoadLevel=r,this.loadedmetadata=!1}t>0&&-1===e&&(c.logger.log("override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=ye,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this.forceStartLoad=!0,this.state=me},f.stopLoad=function(){this.forceStartLoad=!1,e.prototype.stopLoad.call(this)},f.doTick=function(){switch(this.state){case Se:this.fragLoadError=0;break;case ye:this._doTickIdle();break;case Re:var e=this.levels[this.level];e&&e.details&&(this.state=ye);break;case Ae:var t=window.performance.now(),n=this.retryDate;(!n||t>=n||this.media&&this.media.seeking)&&(c.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=ye)}this._checkBuffer(),this._checkFragmentChanged()},f._doTickIdle=function(){var e=this.hls,t=e.config,n=this.media;if(void 0!==this.levelLastLoaded&&(n||!this.startFragRequested&&t.startFragPrefetch)){var r;r=this.loadedmetadata?n.currentTime:this.nextLoadPosition;var i=e.nextLoadLevel,a=this.levels[i];if(a){var o,s=a.bitrate;o=s?Math.max(8*t.maxBufferSize/s,t.maxBufferLength):t.maxBufferLength,o=Math.min(o,t.maxMaxBufferLength);var l=G.bufferInfo(this.mediaBuffer?this.mediaBuffer:n,r,t.maxBufferHole),d=l.len;if(!(d>=o)){c.logger.trace("buffer length of "+d.toFixed(3)+" is below max of "+o.toFixed(3)+". checking for more payload ..."),this.level=e.nextLoadLevel=i;var f=a.details;if(!f||f.live&&this.levelLastLoaded!==i)this.state=Re;else{if(this._streamEnded(l,f)){var h={};return this.altAudio&&(h.type="video"),this.hls.trigger(u.default.BUFFER_EOS,h),void(this.state=ke)}this._fetchPayloadOrEos(r,l,f)}}}}},f._fetchPayloadOrEos=function(e,t,n){var r=this.fragPrevious,i=this.level,a=n.fragments,o=a.length;if(0!==o){var s,l=a[0].start,u=a[o-1].start+a[o-1].duration,d=t.end;if(n.initSegment&&!n.initSegment.data)s=n.initSegment;else if(n.live){var f=this.config.initialLiveManifestSize;if(o<f)return void c.logger.warn("Can not start playback of a level, reason: not enough fragments "+o+" < "+f);if(null===(s=this._ensureFragmentAtLivePoint(n,d,l,u,r,a,o)))return}else d<l&&(s=a[0]);s||(s=this._findFragment(l,r,o,a,d,u,n)),s&&(s.encrypted?(c.logger.log("Loading key for "+s.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+i),this._loadKey(s)):(c.logger.log("Loading "+s.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+i+", currentTime:"+e.toFixed(3)+",bufferEnd:"+d.toFixed(3)),this._loadFragment(s)))}},f._ensureFragmentAtLivePoint=function(e,t,n,r,i,a,o){var s,l=this.hls.config,u=this.media,d=void 0!==l.liveMaxLatencyDuration?l.liveMaxLatencyDuration:l.liveMaxLatencyDurationCount*e.targetduration;if(t<Math.max(n-l.maxFragLookUpTolerance,r-d)){var f=this.liveSyncPosition=this.computeLivePosition(n,e);t=f,u&&!u.paused&&u.readyState&&u.duration>f&&f>u.currentTime&&(c.logger.log("buffer end: "+t.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+f.toFixed(3)),u.currentTime=f),this.nextLoadPosition=f}if(e.PTSKnown&&t>r&&u&&u.readyState)return null;if(this.startFragRequested&&!e.PTSKnown){if(i)if(e.hasProgramDateTime)c.logger.log("live playlist, switching playlist, load frag with same PDT: "+i.programDateTime),s=le(a,i.endProgramDateTime,l.maxFragLookUpTolerance);else{var h=i.sn+1;if(h>=e.startSN&&h<=e.endSN){var p=a[h-e.startSN];i.cc===p.cc&&(s=p,c.logger.log("live playlist, switching playlist, load frag with next SN: "+s.sn))}s||(s=V.search(a,(function(e){return i.cc-e.cc})))&&c.logger.log("live playlist, switching playlist, load frag with same CC: "+s.sn)}s||(s=a[Math.min(o-1,Math.round(o/2))],c.logger.log("live playlist, switching playlist, unknown, load middle frag : "+s.sn))}return s},f._findFragment=function(e,t,n,r,i,a,o){var s,l=this.hls.config;if(s=i<a?ue(t,r,i,i>a-l.maxFragLookUpTolerance?0:l.maxFragLookUpTolerance):r[n-1]){var u=s.sn-o.startSN,d=t&&s.level===t.level,f=r[u-1],h=r[u+1];if(t&&s.sn===t.sn)if(d&&!s.backtracked)if(s.sn<o.endSN){var p=t.deltaPTS;p&&p>l.maxBufferHole&&t.dropped&&u?(s=f,c.logger.warn("Previous fragment was dropped with large PTS gap between audio and video. Maybe fragment is not starting with a keyframe? Loading previous one to try to overcome this")):(s=h,c.logger.log("Re-loading fragment with SN: "+s.sn))}else s=null;else s.backtracked&&(h&&h.backtracked?(c.logger.warn("Already backtracked from fragment "+h.sn+", will not backtrack to fragment "+s.sn+". Loading fragment "+h.sn),s=h):(c.logger.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),s.dropped=0,f?(s=f).backtracked=!0:u&&(s=null)))}return s},f._loadKey=function(e){this.state=be,this.hls.trigger(u.default.KEY_LOADING,{frag:e})},f._loadFragment=function(e){var t=this.fragmentTracker.getState(e);this.fragCurrent=e,"initSegment"!==e.sn&&(this.startFragRequested=!0),Object(l.isFiniteNumber)(e.sn)&&!e.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),e.backtracked||t===N||t===F?(e.autoLevel=this.hls.autoLevelEnabled,e.bitrateTest=this.bitrateTest,this.hls.trigger(u.default.FRAG_LOADING,{frag:e}),this.demuxer||(this.demuxer=new Q(this.hls,"main")),this.state=_e):t===U&&this._reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e)},f.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,a.MAIN)},f.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.endPTS+.5):null},f._checkFragmentChanged=function(){var e,t,n=this.media;if(n&&n.readyState&&!1===n.seeking&&((t=n.currentTime)>this.lastCurrentTime&&(this.lastCurrentTime=t),G.isBuffered(n,t)?e=this.getBufferedFrag(t):G.isBuffered(n,t+.1)&&(e=this.getBufferedFrag(t+.1)),e)){var r=e;if(r!==this.fragPlaying){this.hls.trigger(u.default.FRAG_CHANGED,{frag:r});var i=r.level;this.fragPlaying&&this.fragPlaying.level===i||this.hls.trigger(u.default.LEVEL_SWITCHED,{level:i}),this.fragPlaying=r}}},f.immediateLevelSwitch=function(){if(c.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var e,t=this.media;t?(e=t.paused,t.pause()):e=!0,this.previouslyPaused=e}var n=this.fragCurrent;n&&n.loader&&n.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},f.immediateLevelSwitchEnd=function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,G.isBuffered(e,e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())},f.nextLevelSwitch=function(){var e=this.media;if(e&&e.readyState){var t,n,r;if((n=this.getBufferedFrag(e.currentTime))&&n.startPTS>1&&this.flushMainBuffer(0,n.startPTS-1),e.paused)t=0;else{var i=this.hls.nextLoadLevel,a=this.levels[i],o=this.fragLastKbps;t=o&&this.fragCurrent?this.fragCurrent.duration*a.bitrate/(1e3*o)+1:0}if((r=this.getBufferedFrag(e.currentTime+t))&&(r=this.followingBufferedFrag(r))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(r.maxStartPTS,Number.POSITIVE_INFINITY)}}},f.flushMainBuffer=function(e,t){this.state=Se;var n={startOffset:e,endOffset:t};this.altAudio&&(n.type="video"),this.hls.trigger(u.default.BUFFER_FLUSHING,n)},f.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);var n=this.config;this.levels&&n.autoStartLoad&&this.hls.startLoad(n.startPosition),this.gapController=new fe(n,t,this.fragmentTracker,this.hls)},f.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(c.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.levels;t&&t.forEach((function(e){e.details&&e.details.fragments.forEach((function(e){e.backtracked=void 0}))})),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.fragmentTracker.removeAllFragments(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},f.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:void 0;Object(l.isFiniteNumber)(t)&&c.logger.log("media seeked to "+t.toFixed(3)),this.tick()},f.onManifestLoading=function(){c.logger.log("trigger BUFFER_RESET"),this.hls.trigger(u.default.BUFFER_RESET),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0},f.onManifestParsed=function(e){var t,n=!1,r=!1;e.levels.forEach((function(e){(t=e.audioCodec)&&(-1!==t.indexOf("mp4a.40.2")&&(n=!0),-1!==t.indexOf("mp4a.40.5")&&(r=!0))})),this.audioCodecSwitch=n&&r,this.audioCodecSwitch&&c.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.altAudio=e.altAudio,this.levels=e.levels,this.startFragRequested=!1;var i=this.config;(i.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(i.startPosition)},f.onLevelLoaded=function(e){var t=e.details,n=e.level,r=this.levels[this.levelLastLoaded],i=this.levels[n],a=t.totalduration,o=0;if(c.logger.log("level "+n+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),t.live){var s=i.details;s&&t.fragments.length>0?(ne(s,t),o=t.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,s),t.PTSKnown&&Object(l.isFiniteNumber)(o)?c.logger.log("live playlist sliding:"+o.toFixed(3)):(c.logger.log("live playlist - outdated PTS, unknown sliding"),se(this.fragPrevious,r,t))):(c.logger.log("live playlist - first load, unknown sliding"),t.PTSKnown=!1,se(this.fragPrevious,r,t))}else t.PTSKnown=!1;if(i.details=t,this.levelLastLoaded=n,this.hls.trigger(u.default.LEVEL_UPDATED,{details:t,level:n}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var d=t.startTimeOffset;Object(l.isFiniteNumber)(d)?(d<0&&(c.logger.log("negative start time offset "+d+", count from end of last fragment"),d=o+a+d),c.logger.log("start time offset found in playlist, adjust startPosition to "+d),this.startPosition=d):t.live?(this.startPosition=this.computeLivePosition(o,t),c.logger.log("configure startPosition to "+this.startPosition)):this.startPosition=0,this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===Re&&(this.state=ye),this.tick()},f.onKeyLoaded=function(){this.state===be&&(this.state=ye,this.tick())},f.onFragLoaded=function(e){var t=this.fragCurrent,n=this.hls,r=this.levels,i=this.media,a=e.frag;if(this.state===_e&&t&&"main"===a.type&&a.level===t.level&&a.sn===t.sn){var o=e.stats,s=r[t.level],l=s.details;if(this.bitrateTest=!1,this.stats=o,c.logger.log("Loaded "+t.sn+" of ["+l.startSN+" ,"+l.endSN+"],level "+t.level),a.bitrateTest&&n.nextLoadLevel)this.state=ye,this.startFragRequested=!1,o.tparsed=o.tbuffered=window.performance.now(),n.trigger(u.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else if("initSegment"===a.sn)this.state=ye,o.tparsed=o.tbuffered=window.performance.now(),l.initSegment.data=e.payload,n.trigger(u.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else{c.logger.log("Parsing "+t.sn+" of ["+l.startSN+" ,"+l.endSN+"],level "+t.level+", cc "+t.cc),this.state=Te,this.pendingBuffering=!0,this.appended=!1,a.bitrateTest&&(a.bitrateTest=!1,this.fragmentTracker.onFragLoaded({frag:a}));var d=!(i&&i.seeking)&&(l.PTSKnown||!l.live),f=l.initSegment?l.initSegment.data:[],h=this._getAudioCodec(s);(this.demuxer=this.demuxer||new Q(this.hls,"main")).push(e.payload,f,h,s.videoCodec,t,l.totalduration,d)}}this.fragLoadError=0},f.onFragParsingInitSegment=function(e){var t=this.fragCurrent,n=e.frag;if(t&&"main"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===Te){var r,i,a=e.tracks;if(a.audio&&this.altAudio&&delete a.audio,i=a.audio){var o=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(c.logger.log("swapping playlist audio codec"),o=-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==i.metadata.channelCount&&-1===s.indexOf("firefox")&&(o="mp4a.40.5"),-1!==s.indexOf("android")&&"audio/mpeg"!==i.container&&(o="mp4a.40.2",c.logger.log("Android: force audio codec to "+o)),i.levelCodec=o,i.id=e.id}for(r in(i=a.video)&&(i.levelCodec=this.levels[this.level].videoCodec,i.id=e.id),this.hls.trigger(u.default.BUFFER_CODECS,a),a){i=a[r],c.logger.log("main track:"+r+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var l=i.initSegment;l&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(u.default.BUFFER_APPENDING,{type:r,data:l,parent:"main",content:"initSegment"}))}this.tick()}},f.onFragParsingData=function(e){var t=this,n=this.fragCurrent,r=e.frag;if(n&&"main"===e.id&&r.sn===n.sn&&r.level===n.level&&("audio"!==e.type||!this.altAudio)&&this.state===Te){var i=this.levels[this.level],a=n;if(Object(l.isFiniteNumber)(e.endPTS)||(e.endPTS=e.startPTS+n.duration,e.endDTS=e.startDTS+n.duration),!0===e.hasAudio&&a.addElementaryStream(m.AUDIO),!0===e.hasVideo&&a.addElementaryStream(m.VIDEO),c.logger.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0)),"video"===e.type)if(a.dropped=e.dropped,a.dropped)if(a.backtracked)c.logger.warn("Already backtracked on this fragment, appending with the gap",a.sn);else{var o=i.details;if(!o||a.sn!==o.startSN)return c.logger.warn("missing video frame(s), backtracking fragment",a.sn),this.fragmentTracker.removeFragment(a),a.backtracked=!0,this.nextLoadPosition=e.startPTS,this.state=ye,this.fragPrevious=a,void this.tick();c.logger.warn("missing video frame(s) on first frag, appending with gap",a.sn)}else a.backtracked=!1;var s=te(i.details,a,e.startPTS,e.endPTS,e.startDTS,e.endDTS),d=this.hls;d.trigger(u.default.LEVEL_PTS_UPDATED,{details:i.details,level:this.level,drift:s,type:e.type,start:e.startPTS,end:e.endPTS}),[e.data1,e.data2].forEach((function(n){n&&n.length&&t.state===Te&&(t.appended=!0,t.pendingBuffering=!0,d.trigger(u.default.BUFFER_APPENDING,{type:e.type,data:n,parent:"main",content:"data"}))})),this.tick()}},f.onFragParsed=function(e){var t=this.fragCurrent,n=e.frag;t&&"main"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===Te&&(this.stats.tparsed=window.performance.now(),this.state=we,this._checkAppendedParsed())},f.onAudioTrackSwitching=function(e){var t=!!e.url,n=e.id;if(!t){if(this.mediaBuffer!==this.media){c.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var r=this.fragCurrent;r.loader&&(c.logger.log("switching to main audio track, cancel main fragment load"),r.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=ye}var i=this.hls;i.trigger(u.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),i.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:n}),this.altAudio=!1}},f.onAudioTrackSwitched=function(e){var t=e.id,n=!!this.hls.audioTracks[t].url;if(n){var r=this.videoBuffer;r&&this.mediaBuffer!==r&&(c.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=n,this.tick()},f.onBufferCreated=function(e){var t,n,r=e.tracks,i=!1;for(var a in r){var o=r[a];"main"===o.id?(n=a,t=o,"video"===a&&(this.videoBuffer=r[a].buffer)):i=!0}i&&t?(c.logger.log("alternate track found, use "+n+".buffered to schedule main fragment loading"),this.mediaBuffer=t.buffer):this.mediaBuffer=this.media},f.onBufferAppended=function(e){if("main"===e.parent){var t=this.state;t!==Te&&t!==we||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},f._checkAppendedParsed=function(){if(!(this.state!==we||this.appended&&this.pendingBuffering)){var e=this.fragCurrent;if(e){var t=this.mediaBuffer?this.mediaBuffer:this.media;c.logger.log("main buffered : "+ae.toString(t.buffered)),this.fragPrevious=e;var n=this.stats;n.tbuffered=window.performance.now(),this.fragLastKbps=Math.round(8*n.total/(n.tbuffered-n.tfirst)),this.hls.trigger(u.default.FRAG_BUFFERED,{stats:n,frag:e,id:"main"}),this.state=ye}this.tick()}},f.onError=function(e){var t=e.frag||this.fragCurrent;if(!t||"main"===t.type){var n=!!this.media&&G.isBuffered(this.media,this.media.currentTime)&&G.isBuffered(this.media,this.media.currentTime+.5);switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:if(!e.fatal)if(this.fragLoadError+1<=this.config.fragLoadingMaxRetry){var r=Math.min(Math.pow(2,this.fragLoadError)*this.config.fragLoadingRetryDelay,this.config.fragLoadingMaxRetryTimeout);c.logger.warn("mediaController: frag loading failed, retry in "+r+" ms"),this.retryDate=window.performance.now()+r,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.fragLoadError++,this.state=Ae}else c.logger.error("mediaController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=Ce;break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==Ce&&(e.fatal?(this.state=Ce,c.logger.warn("streamController: "+e.details+",switch to "+this.state+" state ...")):e.levelRetry||this.state!==Re||(this.state=ye));break;case s.ErrorDetails.BUFFER_FULL_ERROR:"main"!==e.parent||this.state!==Te&&this.state!==we||(n?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=ye):(c.logger.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},f._reduceMaxBufferLength=function(e){var t=this.config;return t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,c.logger.warn("main:reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},f._checkBuffer=function(){var e=this.media;if(e&&0!==e.readyState){var t=(this.mediaBuffer?this.mediaBuffer:e).buffered;!this.loadedmetadata&&t.length?(this.loadedmetadata=!0,this._seekToStartPos()):this.immediateSwitch?this.immediateLevelSwitchEnd():this.gapController.poll(this.lastCurrentTime,t)}},f.onFragLoadEmergencyAborted=function(){this.state=ye,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},f.onBufferFlushed=function(){var e=this.mediaBuffer?this.mediaBuffer:this.media;e&&this.fragmentTracker.detectEvictedFragments(m.VIDEO,e.buffered),this.state=ye,this.fragPrevious=null},f.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},f._seekToStartPos=function(){var e=this.media,t=e.currentTime,n=e.seeking?t:this.startPosition;t!==n&&n>=0&&(c.logger.log("target start position not buffered, seek to buffered.start(0) "+n+" from current time "+t+" "),e.currentTime=n)},f._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&(c.logger.log("swapping playlist audio codec"),t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),t},i=r,(o=[{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,c.logger.log("main stream-controller: "+t+"->"+e),this.hls.trigger(u.default.STREAM_STATE_TRANSITION,{previousState:t,nextState:e})}},get:function(){return this._state}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getBufferedFrag(e.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;return e?this.followingBufferedFrag(this.getBufferedFrag(e.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(e){this._liveSyncPosition=e}}])&&Ie(i.prototype,o),d&&Ie(i,d),r}(Le);function je(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}window.performance;var Oe,De=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.MANIFEST_LOADED,u.default.LEVEL_LOADED,u.default.AUDIO_TRACK_SWITCHED,u.default.FRAG_LOADED,u.default.ERROR)||this).canload=!1,n.currentLevelIndex=null,n.manualLevelIndex=-1,n.timer=null,Oe=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i,a,o,l=r.prototype;return l.onHandlerDestroying=function(){this.clearTimer(),this.manualLevelIndex=-1},l.clearTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},l.startLoad=function(){var e=this._levels;this.canload=!0,this.levelRetryCount=0,e&&e.forEach((function(e){e.loadError=0;var t=e.details;t&&t.live&&(e.details=void 0)})),null!==this.timer&&this.loadLevel()},l.stopLoad=function(){this.canload=!1},l.onManifestLoaded=function(e){var t,n=[],r=[],i={},a=null,o=!1,l=!1;if(e.levels.forEach((function(e){var t=e.attrs;e.loadError=0,e.fragmentError=!1,o=o||!!e.videoCodec,l=l||!!e.audioCodec,Oe&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0),(a=i[e.bitrate])?a.url.push(e.url):(e.url=[e.url],e.urlId=0,i[e.bitrate]=e,n.push(e)),t&&(t.AUDIO&&(l=!0,Z(a||e,"audio",t.AUDIO)),t.SUBTITLES&&Z(a||e,"text",t.SUBTITLES))})),o&&l&&(n=n.filter((function(e){return!!e.videoCodec}))),n=n.filter((function(e){var t=e.audioCodec,n=e.videoCodec;return(!t||S(t,"audio"))&&(!n||S(n,"video"))})),e.audioTracks&&(r=e.audioTracks.filter((function(e){return!e.audioCodec||S(e.audioCodec,"audio")}))).forEach((function(e,t){e.id=t})),n.length>0){t=n[0].bitrate,n.sort((function(e,t){return e.bitrate-t.bitrate})),this._levels=n;for(var d=0;d<n.length;d++)if(n[d].bitrate===t){this._firstLevel=d,c.logger.log("manifest loaded,"+n.length+" level(s) found, first bitrate:"+t);break}this.hls.trigger(u.default.MANIFEST_PARSED,{levels:n,audioTracks:r,firstLevel:this._firstLevel,stats:e.stats,audio:l,video:o,altAudio:r.some((function(e){return!!e.url}))})}else this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},l.setLevelInternal=function(e){var t=this._levels,n=this.hls;if(e>=0&&e<t.length){if(this.clearTimer(),this.currentLevelIndex!==e){c.logger.log("switching to level "+e),this.currentLevelIndex=e;var r=t[e];r.level=e,n.trigger(u.default.LEVEL_SWITCHING,r)}var i=t[e],a=i.details;if(!a||a.live){var o=i.urlId;n.trigger(u.default.LEVEL_LOADING,{url:i.url[o],level:e,id:o})}}else n.trigger(u.default.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:!1,reason:"invalid level idx"})},l.onError=function(e){if(e.fatal)e.type===s.ErrorTypes.NETWORK_ERROR&&this.clearTimer();else{var t,n=!1,r=!1;switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:t=e.frag.level,r=!0;break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:t=e.context.level,n=!0;break;case s.ErrorDetails.REMUX_ALLOC_ERROR:t=e.level,n=!0}void 0!==t&&this.recoverLevel(e,t,n,r)}},l.recoverLevel=function(e,t,n,r){var i,a,o,s=this,l=this.hls.config,u=e.details,d=this._levels[t];if(d.loadError++,d.fragmentError=r,n){if(!(this.levelRetryCount+1<=l.levelLoadingMaxRetry))return c.logger.error("level controller, cannot recover from "+u+" error"),this.currentLevelIndex=null,this.clearTimer(),void(e.fatal=!0);a=Math.min(Math.pow(2,this.levelRetryCount)*l.levelLoadingRetryDelay,l.levelLoadingMaxRetryTimeout),this.timer=setTimeout((function(){return s.loadLevel()}),a),e.levelRetry=!0,this.levelRetryCount++,c.logger.warn("level controller, "+u+", retry in "+a+" ms, current retry count is "+this.levelRetryCount)}(n||r)&&((i=d.url.length)>1&&d.loadError<i?(d.urlId=(d.urlId+1)%i,d.details=void 0,c.logger.warn("level controller, "+u+" for level "+t+": switching to redundant URL-id "+d.urlId)):-1===this.manualLevelIndex?(o=0===t?this._levels.length-1:t-1,c.logger.warn("level controller, "+u+": switch to "+o),this.hls.nextAutoLevel=this.currentLevelIndex=o):r&&(c.logger.warn("level controller, "+u+": reload a fragment"),this.currentLevelIndex=null))},l.onFragLoaded=function(e){var t=e.frag;if(void 0!==t&&"main"===t.type){var n=this._levels[t.level];void 0!==n&&(n.fragmentError=!1,n.loadError=0,this.levelRetryCount=0)}},l.onLevelLoaded=function(e){var t=this,n=e.level,r=e.details;if(n===this.currentLevelIndex){var i=this._levels[n];if(i.fragmentError||(i.loadError=0,this.levelRetryCount=0),r.live){var a=ie(i.details,r,e.stats.trequest);c.logger.log("live playlist, reload in "+Math.round(a)+" ms"),this.timer=setTimeout((function(){return t.loadLevel()}),a)}else this.clearTimer()}},l.onAudioTrackSwitched=function(e){var t=this.hls.audioTracks[e.id].groupId,n=this.hls.levels[this.currentLevelIndex];if(n&&n.audioGroupIds){for(var r=-1,i=0;i<n.audioGroupIds.length;i++)if(n.audioGroupIds[i]===t){r=i;break}r!==n.urlId&&(n.urlId=r,this.startLoad())}},l.loadLevel=function(){if(c.logger.debug("call to loadLevel"),null!==this.currentLevelIndex&&this.canload){var e=this._levels[this.currentLevelIndex];if("object"==typeof e&&e.url.length>0){var t=this.currentLevelIndex,n=e.urlId,r=e.url[n];c.logger.log("Attempt loading level index "+t+" with URL-id "+n),this.hls.trigger(u.default.LEVEL_LOADING,{url:r,level:t,id:n})}}},i=r,(a=[{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;t&&(e=Math.min(e,t.length-1),this.currentLevelIndex===e&&t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}])&&je(i.prototype,a),o&&je(i,o),r}(f),Me=n("./src/demux/id3.js");function Ne(e,t){var n;try{n=new Event("addtrack")}catch(e){(n=document.createEvent("Event")).initEvent("addtrack",!1,!1)}n.track=e,t.dispatchEvent(n)}function Ue(e){if(e&&e.cues)for(;e.cues.length>0;)e.removeCue(e.cues[0])}var Fe=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.FRAG_PARSING_METADATA,u.default.LIVE_BACK_BUFFER_REACHED)||this).id3Track=void 0,n.media=void 0,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.destroy=function(){f.prototype.destroy.call(this)},i.onMediaAttached=function(e){this.media=e.media,this.media},i.onMediaDetaching=function(){Ue(this.id3Track),this.id3Track=void 0,this.media=void 0},i.getID3Track=function(e){for(var t=0;t<e.length;t++){var n=e[t];if("metadata"===n.kind&&"id3"===n.label)return Ne(n,this.media),n}return this.media.addTextTrack("metadata","id3")},i.onFragParsingMetadata=function(e){var t=e.frag,n=e.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var r=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,i=0;i<n.length;i++){var a=Me.default.getID3Frames(n[i].data);if(a){var o=n[i].pts,s=i<n.length-1?n[i+1].pts:t.endPTS;o===s?s+=1e-4:o>s&&(c.logger.warn("detected an id3 sample with endTime < startTime, adjusting endTime to (startTime + 0.25)"),s=o+.25);for(var l=0;l<a.length;l++){var u=a[l];if(!Me.default.isTimeStampFrame(u)){var d=new r(o,s,"");d.value=u,this.id3Track.addCue(d)}}}}},i.onLiveBackBufferReached=function(e){var t=e.bufferEnd,n=this.id3Track;if(n&&n.cues&&n.cues.length){var r=function(e,t){if(t<e[0].endTime)return e[0];if(t>e[e.length-1].endTime)return e[e.length-1];for(var n=0,r=e.length-1;n<=r;){var i=Math.floor((r+n)/2);if(t<e[i].endTime)r=i-1;else{if(!(t>e[i].endTime))return e[i];n=i+1}}return e[n].endTime-t<t-e[r].endTime?e[n]:e[r]}(n.cues,t);if(r)for(;n.cues[0]!==r;)n.removeCue(n.cues[0])}},r}(f),Be=function(){function e(e){this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=0,this.totalWeight_=0}var t=e.prototype;return t.sample=function(e,t){var n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/e}return this.estimate_},e}(),Ke=function(){function e(e,t,n,r){this.hls=void 0,this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.hls=e,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Be(t),this.fast_=new Be(n)}var t=e.prototype;return t.sample=function(e,t){var n=(e=Math.max(e,this.minDelayMs_))/1e3,r=8*t/n;this.fast_.sample(n,r),this.slow_.sample(n,r)},t.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.destroy=function(){},e}();function Ve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Ge=window.performance,He=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.FRAG_LOADING,u.default.FRAG_LOADED,u.default.FRAG_BUFFERED,u.default.ERROR)||this).lastLoadedFragLevel=0,n._nextAutoLevel=-1,n.hls=t,n.timer=null,n._bwEstimator=null,n.onCheck=n._abandonRulesCheck.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n)),n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i,a,o,d=r.prototype;return d.destroy=function(){this.clearTimer(),f.prototype.destroy.call(this)},d.onFragLoading=function(e){var t=e.frag;if("main"===t.type&&(this.timer||(this.fragCurrent=t,this.timer=setInterval(this.onCheck,100)),!this._bwEstimator)){var n,r,i=this.hls,a=i.config,o=t.level;i.levels[o].details.live?(n=a.abrEwmaFastLive,r=a.abrEwmaSlowLive):(n=a.abrEwmaFastVoD,r=a.abrEwmaSlowVoD),this._bwEstimator=new Ke(i,r,n,a.abrEwmaDefaultEstimate)}},d._abandonRulesCheck=function(){var e=this.hls,t=e.media,n=this.fragCurrent;if(n){var r=n.loader,i=e.minAutoLevel;if(!r||r.stats&&r.stats.aborted)return c.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);var a=r.stats;if(t&&a&&(!t.paused&&0!==t.playbackRate||!t.readyState)&&n.autoLevel&&n.level){var o=Ge.now()-a.trequest,s=Math.abs(t.playbackRate);if(o>500*n.duration/s){var l=e.levels,d=Math.max(1,a.bw?a.bw/8:1e3*a.loaded/o),f=l[n.level],h=f.realBitrate?Math.max(f.realBitrate,f.bitrate):f.bitrate,p=a.total?a.total:Math.max(a.loaded,Math.round(n.duration*h/8)),m=t.currentTime,g=(p-a.loaded)/d,y=(G.bufferInfo(t,m,e.config.maxBufferHole).end-m)/s;if(y<2*n.duration/s&&g>y){var v;for(v=n.level-1;v>i;v--){var b=l[v].realBitrate?Math.max(l[v].realBitrate,l[v].bitrate):l[v].bitrate;if(n.duration*b/(6.4*d)<y)break}void 0<g&&(c.logger.warn("loading too slow, abort fragment loading and switch to level "+v+":fragLoadedDelay["+v+"]<fragLoadedDelay["+(n.level-1)+"];bufferStarvationDelay:"+(void 0).toFixed(1)+"<"+g.toFixed(1)+":"+y.toFixed(1)),e.nextLoadLevel=v,this._bwEstimator.sample(o,a.loaded),r.abort(),this.clearTimer(),e.trigger(u.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,stats:a}))}}}}},d.onFragLoaded=function(e){var t=e.frag;if("main"===t.type&&Object(l.isFiniteNumber)(t.sn)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var n=this.hls.levels[t.level],r=(n.loaded?n.loaded.bytes:0)+e.stats.loaded,i=(n.loaded?n.loaded.duration:0)+e.frag.duration;n.loaded={bytes:r,duration:i},n.realBitrate=Math.round(8*r/i)}if(e.frag.bitrateTest){var a=e.stats;a.tparsed=a.tbuffered=a.tload,this.onFragBuffered(e)}}},d.onFragBuffered=function(e){var t=e.stats,n=e.frag;if(!0!==t.aborted&&"main"===n.type&&Object(l.isFiniteNumber)(n.sn)&&(!n.bitrateTest||t.tload===t.tbuffered)){var r=t.tparsed-t.trequest;c.logger.log("latency/loading/parsing/append/kbps:"+Math.round(t.tfirst-t.trequest)+"/"+Math.round(t.tload-t.tfirst)+"/"+Math.round(t.tparsed-t.tload)+"/"+Math.round(t.tbuffered-t.tparsed)+"/"+Math.round(8*t.loaded/(t.tbuffered-t.trequest))),this._bwEstimator.sample(r,t.loaded),t.bwEstimate=this._bwEstimator.getEstimate(),n.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}},d.onError=function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},d.clearTimer=function(){clearInterval(this.timer),this.timer=null},d._findBestLevel=function(e,t,n,r,i,a,o,s,l){for(var u=i;u>=r;u--){var d=l[u];if(d){var f=d.details,h=f?f.totalduration/f.fragments.length:t,p=!!f&&f.live,m=void 0;m=u<=e?o*n:s*n;var g=l[u].realBitrate?Math.max(l[u].realBitrate,l[u].bitrate):l[u].bitrate,y=g*h/m;if(c.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(m)+"/"+g+"/"+h+"/"+a+"/"+y),m>g&&(!y||p&&!this.bitrateTestDelay||y<a))return u}}return-1},i=r,(a=[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this._bwEstimator;if(!(-1===e||t&&t.canEstimate()))return e;var n=this._nextABRAutoLevel;return-1!==e&&(n=Math.min(e,n)),n},set:function(e){this._nextAutoLevel=e}},{key:"_nextABRAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,n=e.levels,r=e.config,i=e.minAutoLevel,a=e.media,o=this.lastLoadedFragLevel,s=this.fragCurrent?this.fragCurrent.duration:0,l=a?a.currentTime:0,u=a&&0!==a.playbackRate?Math.abs(a.playbackRate):1,d=this._bwEstimator?this._bwEstimator.getEstimate():r.abrEwmaDefaultEstimate,f=(G.bufferInfo(a,l,r.maxBufferHole).end-l)/u,h=this._findBestLevel(o,s,d,i,t,f,r.abrBandWidthFactor,r.abrBandWidthUpFactor,n);if(h>=0)return h;c.logger.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var p=s?Math.min(s,r.maxStarvationDelay):r.maxStarvationDelay,m=r.abrBandWidthFactor,g=r.abrBandWidthUpFactor;if(0===f){var y=this.bitrateTestDelay;y&&(p=(s?Math.min(s,r.maxLoadingDelay):r.maxLoadingDelay)-y,c.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*p)+" ms"),m=g=1)}return h=this._findBestLevel(o,s,d,i,t,f+p,m,g,n),Math.max(h,0)}}])&&Ve(i.prototype,a),o&&Ve(i,o),r}(f),Ye=W(),ze=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.MANIFEST_PARSED,u.default.BUFFER_RESET,u.default.BUFFER_APPENDING,u.default.BUFFER_CODECS,u.default.BUFFER_EOS,u.default.BUFFER_FLUSHING,u.default.LEVEL_PTS_UPDATED,u.default.LEVEL_UPDATED)||this)._msDuration=null,n._levelDuration=null,n._levelTargetDuration=10,n._live=null,n._objectUrl=null,n._needsFlush=!1,n._needsEos=!1,n.config=void 0,n.audioTimestampOffset=void 0,n.bufferCodecEventsExpected=0,n._bufferCodecEventsTotal=0,n.media=null,n.mediaSource=null,n.segments=[],n.parent=void 0,n.appending=!1,n.appended=0,n.appendError=0,n.flushBufferCounter=0,n.tracks={},n.pendingTracks={},n.sourceBuffer={},n.flushRange=[],n._onMediaSourceOpen=function(){c.logger.log("media source opened"),n.hls.trigger(u.default.MEDIA_ATTACHED,{media:n.media});var e=n.mediaSource;e&&e.removeEventListener("sourceopen",n._onMediaSourceOpen),n.checkPendingTracks()},n._onMediaSourceClose=function(){c.logger.log("media source closed")},n._onMediaSourceEnded=function(){c.logger.log("media source ended")},n._onSBUpdateEnd=function(){if(n.audioTimestampOffset&&n.sourceBuffer.audio){var e=n.sourceBuffer.audio;c.logger.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+n.audioTimestampOffset),e.timestampOffset=n.audioTimestampOffset,delete n.audioTimestampOffset}n._needsFlush&&n.doFlush(),n._needsEos&&n.checkEos(),n.appending=!1;var t=n.parent,r=n.segments.reduce((function(e,n){return n.parent===t?e+1:e}),0),i={},a=n.sourceBuffer;for(var o in a){var s=a[o];if(!s)throw Error("handling source buffer update end error: source buffer for "+o+" uninitilized and unable to update buffered TimeRanges.");i[o]=s.buffered}n.hls.trigger(u.default.BUFFER_APPENDED,{parent:t,pending:r,timeRanges:i}),n._needsFlush||n.doAppending(),n.updateMediaElementDuration(),0===r&&n.flushLiveBackBuffer()},n._onSBUpdateError=function(e){c.logger.error("sourceBuffer error:",e),n.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})},n.config=t.config,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.destroy=function(){f.prototype.destroy.call(this)},i.onLevelPtsUpdated=function(e){var t=e.type,n=this.tracks.audio;if("audio"===t&&n&&"audio/mpeg"===n.container){var r=this.sourceBuffer.audio;if(!r)throw Error("Level PTS Updated and source buffer for audio uninitalized");if(Math.abs(r.timestampOffset-e.start)>.1){var i=r.updating;try{r.abort()}catch(e){c.logger.warn("can not abort audio buffer: "+e)}i?this.audioTimestampOffset=e.start:(c.logger.warn("change mpeg audio timestamp offset from "+r.timestampOffset+" to "+e.start),r.timestampOffset=e.start)}}},i.onManifestParsed=function(e){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=e.altAudio?2:1,c.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},i.onMediaAttaching=function(e){var t=this.media=e.media;if(t&&Ye){var n=this.mediaSource=new Ye;n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),t.src=window.URL.createObjectURL(n),this._objectUrl=t.src}},i.onMediaDetaching=function(){c.logger.log("media source detaching");var e=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(e){c.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),this.media&&(this._objectUrl&&window.URL.revokeObjectURL(this._objectUrl),this.media.src===this._objectUrl?(this.media.removeAttribute("src"),this.media.load()):c.logger.warn("media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.hls.trigger(u.default.MEDIA_DETACHED)},i.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.pendingTracks,n=Object.keys(t).length;(n&&!e||2===n)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},i.onBufferReset=function(){var e=this.sourceBuffer;for(var t in e){var n=e[t];try{n&&(this.mediaSource&&this.mediaSource.removeSourceBuffer(n),n.removeEventListener("updateend",this._onSBUpdateEnd),n.removeEventListener("error",this._onSBUpdateError))}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},i.onBufferCodecs=function(e){var t=this;Object.keys(this.sourceBuffer).length||(Object.keys(e).forEach((function(n){t.pendingTracks[n]=e[n]})),this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},i.createSourceBuffers=function(e){var t=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");for(var r in e)if(!t[r]){var i=e[r];if(!i)throw Error("source buffer exists for track "+r+", however track does not");var a=i.levelCodec||i.codec,o=i.container+";codecs="+a;c.logger.log("creating sourceBuffer("+o+")");try{var l=t[r]=n.addSourceBuffer(o);l.addEventListener("updateend",this._onSBUpdateEnd),l.addEventListener("error",this._onSBUpdateError),this.tracks[r]={buffer:l,codec:a,id:i.id,container:i.container,levelCodec:i.levelCodec}}catch(e){c.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:o})}}this.hls.trigger(u.default.BUFFER_CREATED,{tracks:this.tracks})},i.onBufferAppending=function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())},i.onBufferEos=function(e){for(var t in this.sourceBuffer)if(!e.type||e.type===t){var n=this.sourceBuffer[t];n&&!n.ended&&(n.ended=!0,c.logger.log(t+" sourceBuffer now EOS"))}this.checkEos()},i.checkEos=function(){var e=this.sourceBuffer,t=this.mediaSource;if(t&&"open"===t.readyState){for(var n in e){var r=e[n];if(r){if(!r.ended)return;if(r.updating)return void(this._needsEos=!0)}}c.logger.log("all media data are available, signal endOfStream() to MediaSource and stop loading fragment");try{t.endOfStream()}catch(e){c.logger.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1}else this._needsEos=!1},i.onBufferFlushing=function(e){e.type?this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}):(this.flushRange.push({start:e.startOffset,end:e.endOffset,type:"video"}),this.flushRange.push({start:e.startOffset,end:e.endOffset,type:"audio"})),this.flushBufferCounter=0,this.doFlush()},i.flushLiveBackBuffer=function(){if(this._live){var e=this.config.liveBackBufferLength;if(isFinite(e)&&!(e<0))if(this.media)for(var t=this.media.currentTime,n=this.sourceBuffer,r=Object.keys(n),i=t-Math.max(e,this._levelTargetDuration),a=r.length-1;a>=0;a--){var o=r[a],s=n[o];if(s){var l=s.buffered;l.length>0&&i>l.start(0)&&this.removeBufferRange(o,s,0,i)&&this.hls.trigger(u.default.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i})}}else c.logger.error("flushLiveBackBuffer called without attaching media")}},i.onLevelUpdated=function(e){var t=e.details;t.fragments.length>0&&(this._levelDuration=t.totalduration+t.fragments[0].start,this._levelTargetDuration=t.averagetargetduration||t.targetduration||10,this._live=t.live,this.updateMediaElementDuration())},i.updateMediaElementDuration=function(){var e,t=this.config;if(null!==this._levelDuration&&this.media&&this.mediaSource&&this.sourceBuffer&&0!==this.media.readyState&&"open"===this.mediaSource.readyState){for(var n in this.sourceBuffer){var r=this.sourceBuffer[n];if(r&&!0===r.updating)return}e=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===t.liveDurationInfinity?(c.logger.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>e||!Object(l.isFiniteNumber)(e))&&(c.logger.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},i.doFlush=function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end,e.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,n=this.sourceBuffer;try{for(var r in n){var i=n[r];i&&(t+=i.buffered.length)}}catch(e){c.logger.error("error while accessing sourceBuffer.buffered")}this.appended=t,this.hls.trigger(u.default.BUFFER_FLUSHED)}},i.doAppending=function(){var e=this.config,t=this.hls,n=this.segments,r=this.sourceBuffer;if(Object.keys(r).length){if(!this.media||this.media.error)return this.segments=[],void c.logger.error("trying to append although a media error occured, flush segment and abort");if(!this.appending){var i=n.shift();if(i)try{var a=r[i.type];if(!a)return void this._onSBUpdateEnd();if(a.updating)return void n.unshift(i);a.ended=!1,this.parent=i.parent,a.appendBuffer(i.data),this.appendError=0,this.appended++,this.appending=!0}catch(r){c.logger.error("error while trying to append buffer:"+r.message),n.unshift(i);var o={type:s.ErrorTypes.MEDIA_ERROR,parent:i.parent,details:"",fatal:!1};22===r.code?(this.segments=[],o.details=s.ErrorDetails.BUFFER_FULL_ERROR):(this.appendError++,o.details=s.ErrorDetails.BUFFER_APPEND_ERROR,this.appendError>e.appendErrorMaxRetry&&(c.logger.log("fail "+e.appendErrorMaxRetry+" times to append segment in sourceBuffer"),this.segments=[],o.fatal=!0)),t.trigger(u.default.ERROR,o)}}}},i.flushBuffer=function(e,t,n){var r=this.sourceBuffer;if(!Object.keys(r).length)return!0;var i="null";if(this.media&&(i=this.media.currentTime.toFixed(3)),c.logger.log("flushBuffer,pos/start/end: "+i+"/"+e+"/"+t),this.flushBufferCounter>=this.appended)return c.logger.warn("abort flushing too many retries"),!0;var a=r[n];if(a){if(a.ended=!1,a.updating)return c.logger.warn("cannot flush, sb updating in progress"),!1;if(this.removeBufferRange(n,a,e,t))return this.flushBufferCounter++,!1}return c.logger.log("buffer flushed"),!0},i.removeBufferRange=function(e,t,n,r){try{for(var i=0;i<t.buffered.length;i++){var a=t.buffered.start(i),o=t.buffered.end(i),s=Math.max(a,n),l=Math.min(o,r);if(Math.min(l,o)-s>.5){var u="null";return this.media&&(u=this.media.currentTime.toString()),c.logger.log("sb remove "+e+" ["+s+","+l+"], of ["+a+","+o+"], pos:"+u),t.remove(s,l),!0}}}catch(e){c.logger.warn("removeBufferRange failed",e)}return!1},r}(f);function We(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var $e=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.FPS_DROP_LEVEL_CAPPING,u.default.MEDIA_ATTACHING,u.default.MANIFEST_PARSED,u.default.BUFFER_CODECS,u.default.MEDIA_DETACHING)||this).autoLevelCapping=Number.POSITIVE_INFINITY,n.firstLevel=null,n.levels=[],n.media=null,n.restrictedLevels=[],n.timer=null,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i,a,o,s=r.prototype;return s.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this.stopCapping())},s.onFpsDropLevelCapping=function(e){r.isLevelAllowed(e.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(e.droppedLevel)},s.onMediaAttaching=function(e){this.media=e.media instanceof window.HTMLVideoElement?e.media:null},s.onManifestParsed=function(e){var t=this.hls;this.restrictedLevels=[],this.levels=e.levels,this.firstLevel=e.firstLevel,t.config.capLevelToPlayerSize&&e.video&&this.startCapping()},s.onBufferCodecs=function(e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},s.onLevelsUpdated=function(e){this.levels=e.levels},s.onMediaDetaching=function(){this.stopCapping()},s.detectPlayerSize=function(){if(this.media){var e=this.levels?this.levels.length:0;if(e){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e-1),t.autoLevelCapping>this.autoLevelCapping&&t.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},s.getMaxLevel=function(e){var t=this;if(!this.levels)return-1;var n=this.levels.filter((function(n,i){return r.isLevelAllowed(i,t.restrictedLevels)&&i<=e}));return r.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)},s.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},s.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer),this.timer=null)},r.isLevelAllowed=function(e,t){return void 0===t&&(t=[]),-1===t.indexOf(e)},r.getMaxLevelByMediaSize=function(e,t,n){if(!e||e&&!e.length)return-1;for(var r,i,a=e.length-1,o=0;o<e.length;o+=1){var s=e[o];if((s.width>=t||s.height>=n)&&(r=s,!(i=e[o+1])||r.width!==i.width||r.height!==i.height)){a=o;break}}return a},i=r,o=[{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}}],(a=[{key:"mediaWidth",get:function(){var e,t=this.media;return t&&(e=t.width||t.clientWidth||t.offsetWidth,e*=r.contentScaleFactor),e}},{key:"mediaHeight",get:function(){var e,t=this.media;return t&&(e=t.height||t.clientHeight||t.offsetHeight,e*=r.contentScaleFactor),e}}])&&We(i.prototype,a),o&&We(i,o),r}(f),qe=window.performance,Xe=function(e){var t,n;function r(t){return e.call(this,t,u.default.MEDIA_ATTACHING)||this}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},i.onMediaAttaching=function(e){var t=this.hls.config;t.capLevelOnFPSDrop&&("function"==typeof(this.video=e.media instanceof window.HTMLVideoElement?e.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),t.fpsDroppedMonitoringPeriod))},i.checkFPS=function(e,t,n){var r=qe.now();if(t){if(this.lastTime){var i=r-this.lastTime,a=n-this.lastDroppedFrames,o=t-this.lastDecodedFrames,s=1e3*a/i,l=this.hls;if(l.trigger(u.default.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:n}),s>0&&a>l.config.fpsDroppedMonitoringThreshold*o){var d=l.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=d)&&(d-=1,l.trigger(u.default.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:l.currentLevel}),l.autoLevelCapping=d,l.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=n,this.lastDecodedFrames=t}},i.checkFPSInterval=function(){var e=this.video;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},r}(f),Je=window,Qe=Je.performance,Ze=Je.XMLHttpRequest,et=function(){function e(e){e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}var t=e.prototype;return t.destroy=function(){this.abort(),this.loader=null},t.abort=function(){var e=this.loader;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null},t.load=function(e,t,n){this.context=e,this.config=t,this.callbacks=n,this.stats={trequest:Qe.now(),retry:0},this.retryDelay=t.retryDelay,this.loadInternal()},t.loadInternal=function(){var e,t=this.context;e=this.loader=new Ze;var n=this.stats;n.tfirst=0,n.loaded=0;var r=this.xhrSetup;try{if(r)try{r(e,t.url)}catch(n){e.open("GET",t.url,!0),r(e,t.url)}e.readyState||e.open("GET",t.url,!0)}catch(n){return void this.callbacks.onError({code:e.status,text:n.message},t,e)}t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()},t.readystatechange=function(e){var t=e.currentTarget,n=t.readyState,r=this.stats,i=this.context,a=this.config;if(!r.aborted&&n>=2)if(window.clearTimeout(this.requestTimeout),0===r.tfirst&&(r.tfirst=Math.max(Qe.now(),r.trequest)),4===n){var o=t.status;if(o>=200&&o<300){var s,l;r.tload=Math.max(r.tfirst,Qe.now()),l="arraybuffer"===i.responseType?(s=t.response).byteLength:(s=t.responseText).length,r.loaded=r.total=l;var u={url:t.responseURL,data:s};this.callbacks.onSuccess(u,r,i,t)}else r.retry>=a.maxRetry||o>=400&&o<499?(c.logger.error(o+" while loading "+i.url),this.callbacks.onError({code:o,text:t.statusText},i,t)):(c.logger.warn(o+" while loading "+i.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),r.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),a.timeout)},t.loadtimeout=function(){c.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},t.loadprogress=function(e){var t=e.currentTarget,n=this.stats;n.loaded=e.loaded,e.lengthComputable&&(n.total=e.total);var r=this.callbacks.onProgress;r&&r(n,this.context,null,t)},e}();function tt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var nt=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.MANIFEST_LOADING,u.default.MANIFEST_PARSED,u.default.AUDIO_TRACK_LOADED,u.default.AUDIO_TRACK_SWITCHED,u.default.LEVEL_LOADED,u.default.ERROR)||this)._trackId=-1,n._selectDefaultTrack=!0,n.tracks=[],n.trackIdBlacklist=Object.create(null),n.audioGroupId=null,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i,a,o,l=r.prototype;return l.onManifestLoading=function(){this.tracks=[],this._trackId=-1,this._selectDefaultTrack=!0},l.onManifestParsed=function(e){var t=this.tracks=e.audioTracks||[];this.hls.trigger(u.default.AUDIO_TRACKS_UPDATED,{audioTracks:t}),this._selectAudioGroup(this.hls.nextLoadLevel)},l.onAudioTrackLoaded=function(e){if(e.id>=this.tracks.length)c.logger.warn("Invalid audio track id:",e.id);else{if(c.logger.log("audioTrack "+e.id+" loaded"),this.tracks[e.id].details=e.details,e.details.live&&!this.hasInterval()){var t=1e3*e.details.targetduration;this.setInterval(t)}!e.details.live&&this.hasInterval()&&this.clearInterval()}},l.onAudioTrackSwitched=function(e){var t=this.tracks[e.id].groupId;t&&this.audioGroupId!==t&&(this.audioGroupId=t)},l.onLevelLoaded=function(e){this._selectAudioGroup(e.level)},l.onError=function(e){e.type===s.ErrorTypes.NETWORK_ERROR&&(e.fatal&&this.clearInterval(),e.details===s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&(c.logger.warn("Network failure on audio-track id:",e.context.id),this._handleLoadError()))},l._setAudioTrack=function(e){if(this._trackId===e&&this.tracks[this._trackId].details)c.logger.debug("Same id as current audio-track passed, and track details available -> no-op");else if(e<0||e>=this.tracks.length)c.logger.warn("Invalid id passed to audio-track controller");else{var t=this.tracks[e];c.logger.log("Now switching to audio-track index "+e),this.clearInterval(),this._trackId=e;var n=t.url,r=t.type,i=t.id;this.hls.trigger(u.default.AUDIO_TRACK_SWITCHING,{id:i,type:r,url:n}),this._loadTrackDetailsIfNeeded(t)}},l.doTick=function(){this._updateTrack(this._trackId)},l._selectAudioGroup=function(e){var t=this.hls.levels[e];if(t&&t.audioGroupIds){var n=t.audioGroupIds[t.urlId];this.audioGroupId!==n&&(this.audioGroupId=n,this._selectInitialAudioTrack())}},l._selectInitialAudioTrack=function(){var e=this,t=this.tracks;if(t.length){var n=this.tracks[this._trackId],r=null;if(n&&(r=n.name),this._selectDefaultTrack){var i=t.filter((function(e){return e.default}));i.length?t=i:c.logger.warn("No default audio tracks defined")}var a=!1,o=function(){t.forEach((function(t){a||e.audioGroupId&&t.groupId!==e.audioGroupId||r&&r!==t.name||(e._setAudioTrack(t.id),a=!0)}))};o(),a||(r=null,o()),a||(c.logger.error("No track found for running audio group-ID: "+this.audioGroupId),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))}},l._needsTrackLoading=function(e){var t=e.details,n=e.url;return!(t&&!t.live||!n)},l._loadTrackDetailsIfNeeded=function(e){if(this._needsTrackLoading(e)){var t=e.url,n=e.id;c.logger.log("loading audio-track playlist for id: "+n),this.hls.trigger(u.default.AUDIO_TRACK_LOADING,{url:t,id:n})}},l._updateTrack=function(e){if(!(e<0||e>=this.tracks.length)){this.clearInterval(),this._trackId=e,c.logger.log("trying to update audio-track "+e);var t=this.tracks[e];this._loadTrackDetailsIfNeeded(t)}},l._handleLoadError=function(){this.trackIdBlacklist[this._trackId]=!0;var e=this._trackId,t=this.tracks[e],n=t.name,r=t.language,i=t.groupId;c.logger.warn("Loading failed on audio track id: "+e+", group-id: "+i+', name/language: "'+n+'" / "'+r+'"');for(var a=e,o=0;o<this.tracks.length;o++)if(!this.trackIdBlacklist[o]&&this.tracks[o].name===n){a=o;break}a!==e?(c.logger.log("Attempting audio-track fallback id:",a,"group-id:",this.tracks[a].groupId),this._setAudioTrack(a)):c.logger.warn('No fallback audio-track found for name/language: "'+n+'" / "'+r+'"')},i=r,(a=[{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this._trackId},set:function(e){this._setAudioTrack(e),this._selectDefaultTrack=!1}}])&&tt(i.prototype,a),o&&tt(i,o),r}(pe);function rt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var it=window.performance,at=function(e){var t,n;function r(t,n){var r;return(r=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.AUDIO_TRACKS_UPDATED,u.default.AUDIO_TRACK_SWITCHING,u.default.AUDIO_TRACK_LOADED,u.default.KEY_LOADED,u.default.FRAG_LOADED,u.default.FRAG_PARSING_INIT_SEGMENT,u.default.FRAG_PARSING_DATA,u.default.FRAG_PARSED,u.default.ERROR,u.default.BUFFER_RESET,u.default.BUFFER_CREATED,u.default.BUFFER_APPENDED,u.default.BUFFER_FLUSHED,u.default.INIT_PTS_FOUND)||this).fragmentTracker=n,r.config=t.config,r.audioCodecSwap=!1,r._state=me,r.initPTS=[],r.waitingFragment=null,r.videoTrackCC=null,r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i,a,o,d=r.prototype;return d.onInitPtsFound=function(e){var t=e.id,n=e.frag.cc,r=e.initPTS;"main"===t&&(this.initPTS[n]=r,this.videoTrackCC=n,c.logger.log("InitPTS for cc: "+n+" found from video track: "+r),this.state===xe&&this.tick())},d.startLoad=function(e){if(this.tracks){var t=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,t>0&&-1===e?(c.logger.log("audio:override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=ye):(this.lastCurrentTime=this.startPosition?this.startPosition:e,this.state=ge),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=e,this.state=me},d.doTick=function(){var e,t,n,r=this.hls,i=r.config;switch(this.state){case Ce:case ve:case Se:break;case ge:this.state=Ee,this.loadedmetadata=!1;break;case ye:var a=this.tracks;if(!a)break;if(!this.media&&(this.startFragRequested||!i.startFragPrefetch))break;if(this.loadedmetadata)e=this.media.currentTime;else if(void 0===(e=this.nextLoadPosition))break;var o=this.mediaBuffer?this.mediaBuffer:this.media,s=this.videoBuffer?this.videoBuffer:this.media,d=G.bufferInfo(o,e,i.maxBufferHole),f=G.bufferInfo(s,e,i.maxBufferHole),h=d.len,p=d.end,m=this.fragPrevious,g=Math.min(i.maxBufferLength,i.maxMaxBufferLength),y=Math.max(g,f.len),v=this.audioSwitch,b=this.trackId;if((h<y||v)&&b<a.length){if(void 0===(n=a[b].details)){this.state=Ee;break}if(!v&&this._streamEnded(d,n))return this.hls.trigger(u.default.BUFFER_EOS,{type:"audio"}),void(this.state=ke);var _,A=n.fragments,E=A.length,T=A[0].start,w=A[E-1].start+A[E-1].duration;if(v)if(n.live&&!n.PTSKnown)c.logger.log("switching audiotrack, live stream, unknown PTS,load first fragment"),p=0;else if(p=e,n.PTSKnown&&e<T){if(!(d.end>T||d.nextStart))return;c.logger.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=T+.05}if(n.initSegment&&!n.initSegment.data)_=n.initSegment;else if(p<=T){if(_=A[0],null!==this.videoTrackCC&&_.cc!==this.videoTrackCC&&(_=function(e,t){return V.search(e,(function(e){return e.cc<t?1:e.cc>t?-1:0}))}(A,this.videoTrackCC)),n.live&&_.loadIdx&&_.loadIdx===this.fragLoadIdx){var S=d.nextStart?d.nextStart:T;return c.logger.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(S+.05)),void(this.media.currentTime=S+.05)}}else{var k,C=i.maxFragLookUpTolerance,x=m?A[m.sn-A[0].sn+1]:void 0,R=function(e){var t=Math.min(C,e.duration);return e.start+e.duration-t<=p?1:e.start-t>p&&e.start?-1:0};p<w?(p>w-C&&(C=0),k=x&&!R(x)?x:V.search(A,R)):k=A[E-1],k&&(_=k,T=k.start,m&&_.level===m.level&&_.sn===m.sn&&(_.sn<n.endSN?(_=A[_.sn+1-n.startSN],c.logger.log("SN just loaded, load next one: "+_.sn)):_=null))}_&&(_.encrypted?(c.logger.log("Loading key for "+_.sn+" of ["+n.startSN+" ,"+n.endSN+"],track "+b),this.state=be,r.trigger(u.default.KEY_LOADING,{frag:_})):(c.logger.log("Loading "+_.sn+", cc: "+_.cc+" of ["+n.startSN+" ,"+n.endSN+"],track "+b+", currentTime:"+e+",bufferEnd:"+p.toFixed(3)),this.fragCurrent=_,(v||this.fragmentTracker.getState(_)===N)&&("initSegment"!==_.sn&&(this.startFragRequested=!0),Object(l.isFiniteNumber)(_.sn)&&(this.nextLoadPosition=_.start+_.duration),r.trigger(u.default.FRAG_LOADING,{frag:_}),this.state=_e)))}break;case Ee:(t=this.tracks[this.trackId])&&t.details&&(this.state=ye);break;case Ae:var L=it.now(),I=this.retryDate,P=(o=this.media)&&o.seeking;(!I||L>=I||P)&&(c.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=ye);break;case xe:var j=this.videoTrackCC;if(void 0===this.initPTS[j])break;var O=this.waitingFragment;if(O){var D=O.frag.cc;j!==D?(t=this.tracks[this.trackId]).details&&t.details.live&&(c.logger.warn("Waiting fragment CC ("+D+") does not match video track CC ("+j+")"),this.waitingFragment=null,this.state=ye):(this.state=_e,this.onFragLoaded(this.waitingFragment),this.waitingFragment=null)}else this.state=ye}},d.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended);var n=this.config;this.tracks&&n.autoStartLoad&&this.startLoad(n.startPosition)},d.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(c.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},d.onAudioTracksUpdated=function(e){c.logger.log("audio tracks updated"),this.tracks=e.audioTracks},d.onAudioTrackSwitching=function(e){var t=!!e.url;this.trackId=e.id,this.fragCurrent=null,this.state=ve,this.waitingFragment=null,t?this.setInterval(100):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),t&&(this.audioSwitch=!0,this.state=ye),this.tick()},d.onAudioTrackLoaded=function(e){var t=e.details,n=e.id,r=this.tracks[n],i=t.totalduration,a=0;if(c.logger.log("track "+n+" loaded ["+t.startSN+","+t.endSN+"],duration:"+i),t.live){var o=r.details;o&&t.fragments.length>0?(ne(o,t),a=t.fragments[0].start,t.PTSKnown?c.logger.log("live audio playlist sliding:"+a.toFixed(3)):c.logger.log("live audio playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,c.logger.log("live audio playlist - first load, unknown sliding"))}else t.PTSKnown=!1;if(r.details=t,!this.startFragRequested){if(-1===this.startPosition){var s=t.startTimeOffset;Object(l.isFiniteNumber)(s)?(c.logger.log("start time offset found in playlist, adjust startPosition to "+s),this.startPosition=s):t.live?(this.startPosition=this.computeLivePosition(a,t),c.logger.log("compute startPosition for audio-track to "+this.startPosition)):this.startPosition=0}this.nextLoadPosition=this.startPosition}this.state===Ee&&(this.state=ye),this.tick()},d.onKeyLoaded=function(){this.state===be&&(this.state=ye,this.tick())},d.onFragLoaded=function(e){var t=this.fragCurrent,n=e.frag;if(this.state===_e&&t&&"audio"===n.type&&n.level===t.level&&n.sn===t.sn){var r=this.tracks[this.trackId],i=r.details,a=i.totalduration,o=t.level,s=t.sn,l=t.cc,d=this.config.defaultAudioCodec||r.audioCodec||"mp4a.40.2",f=this.stats=e.stats;if("initSegment"===s)this.state=ye,f.tparsed=f.tbuffered=it.now(),i.initSegment.data=e.payload,this.hls.trigger(u.default.FRAG_BUFFERED,{stats:f,frag:t,id:"audio"}),this.tick();else{this.state=Te,this.appended=!1,this.demuxer||(this.demuxer=new Q(this.hls,"audio"));var h=this.initPTS[l],p=i.initSegment?i.initSegment.data:[];i.initSegment||void 0!==h?(this.pendingBuffering=!0,c.logger.log("Demuxing "+s+" of ["+i.startSN+" ,"+i.endSN+"],track "+o),this.demuxer.push(e.payload,p,d,null,t,a,!1,h)):(c.logger.log("unknown video PTS for continuity counter "+l+", waiting for video PTS before demuxing audio frag "+s+" of ["+i.startSN+" ,"+i.endSN+"],track "+o),this.waitingFragment=e,this.state=xe)}}this.fragLoadError=0},d.onFragParsingInitSegment=function(e){var t=this.fragCurrent,n=e.frag;if(t&&"audio"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===Te){var r,i=e.tracks;if(i.video&&delete i.video,r=i.audio){r.levelCodec=r.codec,r.id=e.id,this.hls.trigger(u.default.BUFFER_CODECS,i),c.logger.log("audio track:audio,container:"+r.container+",codecs[level/parsed]=["+r.levelCodec+"/"+r.codec+"]");var a=r.initSegment;if(a){var o={type:"audio",data:a,parent:"audio",content:"initSegment"};this.audioSwitch?this.pendingData=[o]:(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(u.default.BUFFER_APPENDING,o))}this.tick()}}},d.onFragParsingData=function(e){var t=this,n=this.fragCurrent,r=e.frag;if(n&&"audio"===e.id&&"audio"===e.type&&r.sn===n.sn&&r.level===n.level&&this.state===Te){var i=this.trackId,a=this.tracks[i],o=this.hls;Object(l.isFiniteNumber)(e.endPTS)||(e.endPTS=e.startPTS+n.duration,e.endDTS=e.startDTS+n.duration),n.addElementaryStream(m.AUDIO),c.logger.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),te(a.details,n,e.startPTS,e.endPTS);var d=this.audioSwitch,f=this.media,h=!1;if(d)if(f&&f.readyState){var p=f.currentTime;c.logger.log("switching audio track : currentTime:"+p),p>=e.startPTS&&(c.logger.log("switching audio track : flushing all audio"),this.state=Se,o.trigger(u.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),h=!0,this.audioSwitch=!1,o.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:i}))}else this.audioSwitch=!1,o.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:i});var g=this.pendingData;if(!g)return c.logger.warn("Apparently attempt to enqueue media payload without codec initialization data upfront"),void o.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:null,fatal:!0});this.audioSwitch||([e.data1,e.data2].forEach((function(t){t&&t.length&&g.push({type:e.type,data:t,parent:"audio",content:"data"})})),!h&&g.length&&(g.forEach((function(e){t.state===Te&&(t.pendingBuffering=!0,t.hls.trigger(u.default.BUFFER_APPENDING,e))})),this.pendingData=[],this.appended=!0)),this.tick()}},d.onFragParsed=function(e){var t=this.fragCurrent,n=e.frag;t&&"audio"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===Te&&(this.stats.tparsed=it.now(),this.state=we,this._checkAppendedParsed())},d.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},d.onBufferCreated=function(e){var t=e.tracks.audio;t&&(this.mediaBuffer=t.buffer,this.loadedmetadata=!0),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},d.onBufferAppended=function(e){if("audio"===e.parent){var t=this.state;t!==Te&&t!==we||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},d._checkAppendedParsed=function(){if(!(this.state!==we||this.appended&&this.pendingBuffering)){var e=this.fragCurrent,t=this.stats,n=this.hls;if(e){this.fragPrevious=e,t.tbuffered=it.now(),n.trigger(u.default.FRAG_BUFFERED,{stats:t,frag:e,id:"audio"});var r=this.mediaBuffer?this.mediaBuffer:this.media;r&&c.logger.log("audio buffered : "+ae.toString(r.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,n.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=ye}this.tick()}},d.onError=function(e){var t=e.frag;if(!t||"audio"===t.type)switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:var n=e.frag;if(n&&"audio"!==n.type)break;if(!e.fatal){var r=this.fragLoadError;r?r++:r=1;var i=this.config;if(r<=i.fragLoadingMaxRetry){this.fragLoadError=r;var a=Math.min(Math.pow(2,r-1)*i.fragLoadingRetryDelay,i.fragLoadingMaxRetryTimeout);c.logger.warn("AudioStreamController: frag loading failed, retry in "+a+" ms"),this.retryDate=it.now()+a,this.state=Ae}else c.logger.error("AudioStreamController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=Ce}break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==Ce&&(this.state=e.fatal?Ce:ye,c.logger.warn("AudioStreamController: "+e.details+" while loading frag, now switching to "+this.state+" state ..."));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===e.parent&&(this.state===Te||this.state===we)){var o=this.mediaBuffer,l=this.media.currentTime;if(o&&G.isBuffered(o,l)&&G.isBuffered(o,l+.5)){var d=this.config;d.maxMaxBufferLength>=d.maxBufferLength&&(d.maxMaxBufferLength/=2,c.logger.warn("AudioStreamController: reduce max buffer length to "+d.maxMaxBufferLength+"s")),this.state=ye}else c.logger.warn("AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=Se,this.hls.trigger(u.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})}}},d.onBufferFlushed=function(){var e=this,t=this.pendingData;t&&t.length?(c.logger.log("AudioStreamController: appending pending audio data after buffer flushed"),t.forEach((function(t){e.hls.trigger(u.default.BUFFER_APPENDING,t)})),this.appended=!0,this.pendingData=[],this.state=we):(this.state=ye,this.fragPrevious=null,this.tick())},i=r,(a=[{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,c.logger.log("audio stream:"+t+"->"+e)}},get:function(){return this._state}}])&&rt(i.prototype,a),o&&rt(i,o),r}(Le),ot=function(){if("undefined"!=typeof window&&window.VTTCue)return window.VTTCue;var e={"":!0,lr:!0,rl:!0},t={start:!0,middle:!0,end:!0,left:!0,right:!0};function n(e){return"string"==typeof e&&!!t[e.toLowerCase()]&&e.toLowerCase()}function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}function i(t,i,a){var o=this,s={enumerable:!0};o.hasBeenReset=!1;var l="",u=!1,c=t,d=i,f=a,h=null,p="",m=!0,g="auto",y="start",v=50,b="middle",_=50,A="middle";Object.defineProperty(o,"id",r({},s,{get:function(){return l},set:function(e){l=""+e}})),Object.defineProperty(o,"pauseOnExit",r({},s,{get:function(){return u},set:function(e){u=!!e}})),Object.defineProperty(o,"startTime",r({},s,{get:function(){return c},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");c=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",r({},s,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",r({},s,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",r({},s,{get:function(){return h},set:function(e){h=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",r({},s,{get:function(){return p},set:function(t){var n=function(t){return"string"==typeof t&&!!e[t.toLowerCase()]&&t.toLowerCase()}(t);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");p=n,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",r({},s,{get:function(){return m},set:function(e){m=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",r({},s,{get:function(){return g},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");g=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",r({},s,{get:function(){return y},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",r({},s,{get:function(){return v},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",r({},s,{get:function(){return b},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",r({},s,{get:function(){return _},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");_=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",r({},s,{get:function(){return A},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");A=t,this.hasBeenReset=!0}})),o.displayState=void 0}return i.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},i}(),st=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}};function lt(){this.window=window,this.state="INITIAL",this.buffer="",this.decoder=new st,this.regionList=[]}function ut(){this.values=Object.create(null)}function ct(e,t,n,r){var i=r?e.split(r):[e];for(var a in i)if("string"==typeof i[a]){var o=i[a].split(n);2===o.length&&t(o[0],o[1])}}ut.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,n){for(var r=0;r<n.length;++r)if(t===n[r]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var dt=new ot(0,0,0),ft="middle"===dt.align?"middle":"center";function ht(e,t,n){var r=e;function i(){var t=function(e){function t(e,t,n,r){return 3600*(0|e)+60*(0|t)+(0|n)+(0|r)/1e3}var n=e.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return n?n[3]?t(n[1],n[2],n[3].replace(":",""),n[4]):n[1]>59?t(n[1],n[2],0,n[4]):t(0,n[1],n[2],n[4]):null}(e);if(null===t)throw new Error("Malformed timestamp: "+r);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=i(),a(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);e=e.substr(3),a(),t.endTime=i(),a(),function(e,t){var r=new ut;ct(e,(function(e,t){switch(e){case"region":for(var i=n.length-1;i>=0;i--)if(n[i].id===t){r.set(e,n[i].region);break}break;case"vertical":r.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),o=a[0];r.integer(e,o),r.percent(e,o)&&r.set("snapToLines",!1),r.alt(e,o,["auto"]),2===a.length&&r.alt("lineAlign",a[1],["start",ft,"end"]);break;case"position":a=t.split(","),r.percent(e,a[0]),2===a.length&&r.alt("positionAlign",a[1],["start",ft,"end","line-left","line-right","auto"]);break;case"size":r.percent(e,t);break;case"align":r.alt(e,t,["start",ft,"end","left","right"])}}),/:/,/\s/),t.region=r.get("region",null),t.vertical=r.get("vertical","");var i=r.get("line","auto");"auto"===i&&-1===dt.line&&(i=-1),t.line=i,t.lineAlign=r.get("lineAlign","start"),t.snapToLines=r.get("snapToLines",!0),t.size=r.get("size",100),t.align=r.get("align",ft);var a=r.get("position","auto");"auto"===a&&50===dt.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}(e,t)}function pt(e){return e.replace(/<br(?: \/)?>/gi,"\n")}lt.prototype={parse:function(e){var t=this;function n(){var e=t.buffer,n=0;for(e=pt(e);n<e.length&&"\r"!==e[n]&&"\n"!==e[n];)++n;var r=e.substr(0,n);return"\r"===e[n]&&++n,"\n"===e[n]&&++n,t.buffer=e.substr(n),r}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var i=(r=n()).match(/^()?WEBVTT([ \t].*)?$/);if(!i||!i[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var a=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:r=n(),t.state){case"HEADER":/:/.test(r)?ct(r,(function(e,t){}),/:/):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;if(t.cue=new ot(0,0,""),t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{ht(r,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(a=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r;continue;case"BADCUE":r||(t.state="ID");continue}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){try{if(this.buffer+=this.decoder.decode(),(this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state)throw new Error("Malformed WebVTT signature.")}catch(e){throw e}return this.onflush&&this.onflush(),this}};var mt=lt;function gt(e,t,n,r){for(var i,a,o,s,l,u=window.VTTCue||TextTrackCue,c=0;c<r.rows.length;c++)if(o=!0,s=0,l="",!(i=r.rows[c]).isEmpty()){for(var d=0;d<i.chars.length;d++)i.chars[d].uchar.match(/\s/)&&o?s++:(l+=i.chars[d].uchar,o=!1);i.cueStartTime=t,t===n&&(n+=1e-4),a=new u(t,n,pt(l.trim())),s>=16?s--:s++,navigator.userAgent.match(/Firefox\//)?a.line=c+1:a.line=c>7?c-2:c+1,a.align="left",a.position=Math.max(0,Math.min(100,s/32*100)),e.addCue(a)}}var yt,vt={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},bt=function(e){var t=e;return vt.hasOwnProperty(e)&&(t=vt[e]),String.fromCharCode(t)},_t={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},At={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Et={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Tt={25:2,26:4,29:6,30:8,31:10,27:13,28:15},wt=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];!function(e){e[e.ERROR=0]="ERROR",e[e.TEXT=1]="TEXT",e[e.WARNING=2]="WARNING",e[e.INFO=2]="INFO",e[e.DEBUG=3]="DEBUG",e[e.DATA=3]="DATA"}(yt||(yt={}));var St={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(e){this.time=e},log:function(e,t){this.verboseFilter[e],this.verboseLevel}},kt=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].toString(16));return t},Ct=function(){function e(e,t,n,r,i){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=n||!1,this.background=r||"black",this.flash=i||!1}var t=e.prototype;return t.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},t.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],n=0;n<t.length;n++){var r=t[n];e.hasOwnProperty(r)&&(this[r]=e[r])}},t.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},t.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},t.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},t.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},e}(),xt=function(){function e(e,t,n,r,i,a){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new Ct(t,n,r,i,a)}var t=e.prototype;return t.reset=function(){this.uchar=" ",this.penState.reset()},t.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},t.setPenState=function(e){this.penState.copy(e)},t.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},t.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},t.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},e}(),Rt=function(){function e(){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.chars=[];for(var e=0;e<100;e++)this.chars.push(new xt);this.pos=0,this.currPenState=new Ct}var t=e.prototype;return t.equals=function(e){for(var t=!0,n=0;n<100;n++)if(!this.chars[n].equals(e.chars[n])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<100;t++)this.chars[t].copy(e.chars[t])},t.isEmpty=function(){for(var e=!0,t=0;t<100;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},t.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(St.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(St.log("ERROR","Too large cursor position "+this.pos),this.pos=100)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var n=this.pos+1;n<t+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(t)},t.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},t.insertChar=function(e){e>=144&&this.backSpace();var t=bt(e);this.pos>=100?St.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t<100;t++)this.chars[t].reset()},t.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.getTextString=function(){for(var e=[],t=!0,n=0;n<100;n++){var r=this.chars[n].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e}(),Lt=function(){function e(){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.rows=[];for(var e=0;e<15;e++)this.rows.push(new Rt);this.currRow=14,this.nrRollUpRows=null,this.reset()}var t=e.prototype;return t.reset=function(){for(var e=0;e<15;e++)this.rows[e].clear();this.currRow=14},t.equals=function(e){for(var t=!0,n=0;n<15;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<15;t++)this.rows[t].copy(e.rows[t])},t.isEmpty=function(){for(var e=!0,t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},t.backSpace=function(){this.rows[this.currRow].backSpace()},t.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},t.insertChar=function(e){this.rows[this.currRow].insertChar(e)},t.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},t.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},t.setCursor=function(e){St.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)},t.setPAC=function(e){St.log("INFO","pacData = "+JSON.stringify(e));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var n=0;n<15;n++)this.rows[n].clear();var r=this.currRow+1-this.nrRollUpRows,i=this.lastOutputScreen;if(i){var a=i.rows[r].cueStartTime;if(a&&St.time&&a<St.time)for(var o=0;o<this.nrRollUpRows;o++)this.rows[t-this.nrRollUpRows+o+1].copy(i.rows[r+o])}}this.currRow=t;var s=this.rows[this.currRow];if(null!==e.indent){var l=e.indent,u=Math.max(l-1,0);s.setCursor(e.indent),e.color=s.chars[u].penState.foreground}var c={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(c)},t.setBkgData=function(e){St.log("INFO","bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},t.setRollUpRows=function(e){this.nrRollUpRows=e},t.rollUp=function(){if(null!==this.nrRollUpRows){St.log("TEXT",this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),St.log("INFO","Rolling up")}else St.log("DEBUG","roll_up but nrRollUpRows not set yet")},t.getDisplayText=function(e){e=e||!1;for(var t=[],n="",r=-1,i=0;i<15;i++){var a=this.rows[i].getTextString();a&&(r=i+1,e?t.push("Row "+r+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(n=e?"["+t.join(" | ")+"]":t.join("\n")),n},t.getTextAndFormat=function(){return this.rows},e}(),It=function(){function e(e,t){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.lastCueEndTime=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Lt,this.nonDisplayedMemory=new Lt,this.lastOutputScreen=new Lt,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,St.log("INFO","MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";St.log("INFO",n+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(St.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},t.ccRCL=function(){St.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},t.ccBS=function(){St.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},t.ccAOF=function(){},t.ccAON=function(){},t.ccDER=function(){St.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},t.ccRU=function(e){St.log("INFO","RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},t.ccFON=function(){St.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},t.ccRDC=function(){St.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},t.ccTR=function(){St.log("INFO","TR"),this.setMode("MODE_TEXT")},t.ccRTD=function(){St.log("INFO","RTD"),this.setMode("MODE_TEXT")},t.ccEDM=function(){St.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},t.ccCR=function(){St.log("INFO","CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},t.ccENM=function(){St.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},t.ccEOC=function(){if(St.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,St.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},t.ccTO=function(e){St.log("INFO","TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},t.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var n=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}St.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=St.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e}(),Pt=function(){function e(e,t,n){this.field=void 0,this.outputs=void 0,this.channels=void 0,this.currChNr=void 0,this.lastCmdA=void 0,this.lastCmdB=void 0,this.lastTime=void 0,this.dataCounters=void 0,this.field=e||1,this.outputs=[t,n],this.channels=[new It(1,t),new It(2,n)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var n,r,i,a=!1;this.lastTime=e,St.setTime(e);for(var o=0;o<t.length;o+=2)r=127&t[o],i=127&t[o+1],0!==r||0!==i?(St.log("DATA","["+kt([t[o],t[o+1]])+"] -> ("+kt([r,i])+")"),(n=this.parseCmd(r,i))||(n=this.parseMidrow(r,i)),n||(n=this.parsePAC(r,i)),n||(n=this.parseBackgroundAttributes(r,i)),n||(a=this.parseChars(r,i))&&(this.currChNr&&this.currChNr>=0?this.channels[this.currChNr-1].insertChars(a):St.log("WARNING","No channel found yet. TEXT-MODE?")),n?this.dataCounters.cmd+=2:a?this.dataCounters.char+=2:(this.dataCounters.other+=2,St.log("WARNING","Couldn't parse cleaned data "+kt([r,i])+" orig: "+kt([t[o],t[o+1]])))):this.dataCounters.padding+=2},t.parseCmd=function(e,t){var n=null;if(!((20===e||28===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,St.log("DEBUG","Repeated command ("+kt([e,t])+") is dropped"),!0;n=20===e||23===e?1:2;var r=this.channels[n-1];return 20===e||28===e?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},t.parseMidrow=function(e,t){var n=null;return(17===e||25===e)&&t>=32&&t<=47&&((n=17===e?1:2)!==this.currChNr?(St.log("ERROR","Mismatch channel in midrow parsing"),!1):(this.channels[n-1].ccMIDROW(t),St.log("DEBUG","MIDROW ("+kt([e,t])+")"),!0))},t.parsePAC=function(e,t){var n,r=null;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,!0;n=e<=23?1:2,r=t>=64&&t<=95?1===n?_t[e]:Et[e]:1===n?At[e]:Tt[e];var i=this.interpretPAC(r,t);return this.channels[n-1].setPAC(i),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},t.interpretPAC=function(e,t){var n=t,r={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-64,r.underline=1==(1&n),n<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((n-16)/2),r},t.parseChars=function(e,t){var n=null,r=null,i=null;if(e>=25?(n=2,i=e-8):(n=1,i=e),i>=17&&i<=19){var a=t;a=17===i?t+80:18===i?t+112:t+144,St.log("INFO","Special char '"+bt(a)+"' in channel "+n),r=[a]}else e>=32&&e<=127&&(r=0===t?[e]:[e,t]);if(r){var o=kt(r);St.log("DEBUG","Char codes = "+o.join(",")),this.lastCmdA=null,this.lastCmdB=null}return r},t.parseBackgroundAttributes=function(e,t){var n,r,i;return((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47)&&(n={},16===e||24===e?(r=Math.floor((t-32)/2),n.background=wt[r],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0)),i=e<24?1:2,this.channels[i-1].setBkgData(n),this.lastCmdA=null,this.lastCmdB=null,!0)},t.reset=function(){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].reset();this.lastCmdA=null,this.lastCmdB=null},t.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].cueSplitAtTime(e)},e}(),jt=function(){function e(e,t){this.timelineController=void 0,this.trackName=void 0,this.startTime=void 0,this.endTime=void 0,this.screen=void 0,this.timelineController=e,this.trackName=t,this.startTime=null,this.endTime=null,this.screen=null}var t=e.prototype;return t.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen),this.startTime=null)},t.newCue=function(e,t,n){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)},e}(),Ot=function(e,t,n){return e.substr(n||0,t.length)===t},Dt=function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return(t>>>0).toString()},Mt={parse:function(e,t,n,r,i,a){var o,s=Object(Me.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),u="00:00.000",c=0,d=0,f=0,h=[],p=!0,m=!1,g=new mt;g.oncue=function(e){var t=n[r],i=n.ccOffset;t&&t.new&&(void 0!==d?i=n.ccOffset=t.start:function(e,t,n){var r=e[t],i=e[r.prevCC];if(!i||!i.new&&r.new)return e.ccOffset=e.presentationOffset=r.start,void(r.new=!1);for(;i&&i.new;)e.ccOffset+=r.start-i.start,r.new=!1,i=e[(r=i).prevCC];e.presentationOffset=n}(n,r,f)),f&&(i=f-n.presentationOffset),m&&(e.startTime+=i-d,e.endTime+=i-d),e.id=Dt(e.startTime.toString())+Dt(e.endTime.toString())+Dt(e.text),e.text=decodeURIComponent(encodeURIComponent(e.text)),e.endTime>0&&h.push(e)},g.onparsingerror=function(e){o=e},g.onflush=function(){o&&a?a(o):i(h)},s.forEach((function(e){if(p){if(Ot(e,"X-TIMESTAMP-MAP=")){p=!1,m=!0,e.substr(16).split(",").forEach((function(e){Ot(e,"LOCAL:")?u=e.substr(6):Ot(e,"MPEGTS:")&&(c=parseInt(e.substr(7)))}));try{t+(9e4*n[r].start||0)<0&&(t+=8589934592),c-=t,d=function(e){var t=parseInt(e.substr(-3)),n=parseInt(e.substr(-6,2)),r=parseInt(e.substr(-9,2)),i=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;if(!(Object(l.isFiniteNumber)(t)&&Object(l.isFiniteNumber)(n)&&Object(l.isFiniteNumber)(r)&&Object(l.isFiniteNumber)(i)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*n,t+=6e4*r,t+=36e5*i}(u)/1e3,f=c/9e4}catch(e){m=!1,o=e}return}""===e&&(p=!1)}g.parse(e+"\n")})),g.flush()}};function Nt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ut(e,t){return e&&e.label===t.name&&!(e.textTrack1||e.textTrack2)}var Ft=function(e){var t,n;function r(t){var n;if((n=e.call(this,t,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.FRAG_PARSING_USERDATA,u.default.FRAG_DECRYPTED,u.default.MANIFEST_LOADING,u.default.MANIFEST_LOADED,u.default.FRAG_LOADED,u.default.INIT_PTS_FOUND)||this).media=null,n.config=void 0,n.enabled=!0,n.Cues=void 0,n.textTracks=[],n.tracks=[],n.initPTS=[],n.unparsedVttFrags=[],n.cueRanges=[],n.captionsTracks={},n.captionsProperties=void 0,n.cea608Parser=void 0,n.lastSn=-1,n.prevCC=-1,n.vttCCs=null,n.hls=t,n.config=t.config,n.Cues=t.config.cueHandler,n.captionsProperties={textTrack1:{label:n.config.captionsTextTrack1Label,languageCode:n.config.captionsTextTrack1LanguageCode},textTrack2:{label:n.config.captionsTextTrack2Label,languageCode:n.config.captionsTextTrack2LanguageCode}},n.config.enableCEA708Captions){var r=new jt(Nt(n),"textTrack1"),i=new jt(Nt(n),"textTrack2");n.cea608Parser=new Pt(0,r,i)}return n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.addCues=function(e,t,n,r){for(var i,a,o,s,l=this.cueRanges,u=!1,c=l.length;c--;){var d=l[c],f=(i=d[0],a=d[1],o=t,s=n,Math.min(a,s)-Math.max(i,o));if(f>=0&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],n),u=!0,f/(n-t)>.5))return}u||l.push([t,n]),this.Cues.newCue(this.captionsTracks[e],t,n,r)},i.onInitPtsFound=function(e){var t=this,n=e.frag,r=e.id,i=e.initPTS,a=this.unparsedVttFrags;"main"===r&&(this.initPTS[n.cc]=i),a.length&&(this.unparsedVttFrags=[],a.forEach((function(e){t.onFragLoaded(e)})))},i.getExistingTrack=function(e){var t=this.media;if(t)for(var n=0;n<t.textTracks.length;n++){var r=t.textTracks[n];if(r[e])return r}return null},i.createCaptionsTrack=function(e){var t=this.captionsProperties,n=this.captionsTracks,r=this.media,i=t[e],a=i.label,o=i.languageCode;if(!n[e]){var s=this.getExistingTrack(e);if(s)n[e]=s,Ue(n[e]),Ne(n[e],r);else{var l=this.createTextTrack("captions",a,o);l&&(l[e]=!0,n[e]=l)}}},i.createTextTrack=function(e,t,n){var r=this.media;if(r)return r.addTextTrack(e,t,n)},i.destroy=function(){e.prototype.destroy.call(this)},i.onMediaAttaching=function(e){this.media=e.media,this._cleanTracks()},i.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach((function(t){Ue(e[t]),delete e[t]}))},i.onManifestLoading=function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this._cleanTracks()},i._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var n=0;n<t.length;n++)Ue(t[n])}},i.onManifestLoaded=function(e){var t=this;if(this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.cueRanges=[],this.config.enableWebVTT){this.tracks=e.subtitles||[];var n=this.media?this.media.textTracks:[];this.tracks.forEach((function(e,r){var i;if(r<n.length){for(var a=null,o=0;o<n.length;o++)if(Ut(n[o],e)){a=n[o];break}a&&(i=a)}i||(i=t.createTextTrack("subtitles",e.name,e.lang)),e.default?i.mode=t.hls.subtitleDisplay?"showing":"hidden":i.mode="disabled",t.textTracks.push(i)}))}},i.onFragLoaded=function(e){var t=e.frag,n=e.payload,r=this.cea608Parser,i=this.initPTS,a=this.lastSn,o=this.unparsedVttFrags;if("main"===t.type){var s=t.sn;t.sn!==a+1&&r&&r.reset(),this.lastSn=s}else if("subtitle"===t.type)if(n.byteLength){if(!Object(l.isFiniteNumber)(i[t.cc]))return o.push(e),void(i.length&&this.hls.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t}));var c=t.decryptdata;null!=c&&null!=c.key&&"AES-128"===c.method||this._parseVTTs(t,n)}else this.hls.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t})},i._parseVTTs=function(e,t){var n=this.hls,r=this.prevCC,i=this.textTracks,a=this.vttCCs;a[e.cc]||(a[e.cc]={start:e.start,prevCC:r,new:!0},this.prevCC=e.cc),Mt.parse(t,this.initPTS[e.cc],a,e.cc,(function(t){var r=i[e.level];"disabled"!==r.mode?(t.forEach((function(e){if(!r.cues.getCueById(e.id))try{if(r.addCue(e),!r.cues.getCueById(e.id))throw new Error("addCue is failed for: "+e)}catch(n){c.logger.debug("Failed occurred on adding cues: "+n);var t=new window.TextTrackCue(e.startTime,e.endTime,e.text);t.id=e.id,r.addCue(t)}})),n.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})):n.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})}),(function(t){c.logger.log("Failed to parse VTT cue: "+t),n.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})}))},i.onFragDecrypted=function(e){var t=e.frag,n=e.payload;if("subtitle"===t.type){if(!Object(l.isFiniteNumber)(this.initPTS[t.cc]))return void this.unparsedVttFrags.push(e);this._parseVTTs(t,n)}},i.onFragParsingUserdata=function(e){if(this.enabled&&this.cea608Parser)for(var t=0;t<e.samples.length;t++){var n=e.samples[t].bytes;if(n){var r=this.extractCea608Data(n);this.cea608Parser.addData(e.samples[t].pts,r)}}},i.extractCea608Data=function(e){for(var t,n,r,i=31&e[0],a=2,o=[],s=0;s<i;s++)t=e[a++],n=127&e[a++],r=127&e[a++],0===n&&0===r||0!=(4&t)&&0==(3&t)&&(o.push(n),o.push(r));return o},r}(f);function Bt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Kt(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];"subtitles"===r.kind&&r.label&&t.push(e[n])}return t}var Vt,Gt=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.MANIFEST_LOADED,u.default.SUBTITLE_TRACK_LOADED)||this).tracks=[],n.trackId=-1,n.media=null,n.stopped=!0,n.subtitleDisplay=!0,n.queuedDefaultTrack=null,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i,a,o,s=r.prototype;return s.destroy=function(){f.prototype.destroy.call(this)},s.onMediaAttached=function(e){var t=this;this.media=e.media,this.media&&(Object(l.isFiniteNumber)(this.queuedDefaultTrack)&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=null),this.trackChangeListener=this._onTextTracksChanged.bind(this),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.subtitlePollingInterval=setInterval((function(){t.trackChangeListener()}),500):this.media.textTracks.addEventListener("change",this.trackChangeListener))},s.onMediaDetaching=function(){this.media&&(this.useTextTrackPolling?clearInterval(this.subtitlePollingInterval):this.media.textTracks.removeEventListener("change",this.trackChangeListener),Object(l.isFiniteNumber)(this.subtitleTrack)&&(this.queuedDefaultTrack=this.subtitleTrack),Kt(this.media.textTracks).forEach((function(e){Ue(e)})),this.subtitleTrack=-1,this.media=null)},s.onManifestLoaded=function(e){var t=this,n=e.subtitles||[];this.tracks=n,this.hls.trigger(u.default.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:n}),n.forEach((function(e){e.default&&(t.media?t.subtitleTrack=e.id:t.queuedDefaultTrack=e.id)}))},s.onSubtitleTrackLoaded=function(e){var t=this,n=e.id,r=e.details,i=this.trackId,a=this.tracks,o=a[i];if(n>=a.length||n!==i||!o||this.stopped)this._clearReloadTimer();else if(c.logger.log("subtitle track "+n+" loaded"),r.live){var s=ie(o.details,r,e.stats.trequest);c.logger.log("Reloading live subtitle playlist in "+s+"ms"),this.timer=setTimeout((function(){t._loadCurrentTrack()}),s)}else this._clearReloadTimer()},s.startLoad=function(){this.stopped=!1,this._loadCurrentTrack()},s.stopLoad=function(){this.stopped=!0,this._clearReloadTimer()},s._clearReloadTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},s._loadCurrentTrack=function(){var e=this.trackId,t=this.tracks,n=this.hls,r=t[e];e<0||!r||r.details&&!r.details.live||(c.logger.log("Loading subtitle track "+e),n.trigger(u.default.SUBTITLE_TRACK_LOADING,{url:r.url,id:e}))},s._toggleTrackModes=function(e){var t=this.media,n=this.subtitleDisplay,r=this.trackId;if(t){var i=Kt(t.textTracks);if(-1===e)[].slice.call(i).forEach((function(e){e.mode="disabled"}));else{var a=i[r];a&&(a.mode="disabled")}var o=i[e];o&&(o.mode=n?"showing":"hidden")}},s._setSubtitleTrackInternal=function(e){var t=this.hls,n=this.tracks;!Object(l.isFiniteNumber)(e)||e<-1||e>=n.length||(this.trackId=e,c.logger.log("Switching to subtitle track "+e),t.trigger(u.default.SUBTITLE_TRACK_SWITCH,{id:e}),this._loadCurrentTrack())},s._onTextTracksChanged=function(){if(this.media){for(var e=-1,t=Kt(this.media.textTracks),n=0;n<t.length;n++)if("hidden"===t[n].mode)e=n;else if("showing"===t[n].mode){e=n;break}this.subtitleTrack=e}},i=r,(a=[{key:"subtitleTracks",get:function(){return this.tracks}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.trackId!==e&&(this._toggleTrackModes(e),this._setSubtitleTrackInternal(e))}}])&&Bt(i.prototype,a),o&&Bt(i,o),r}(f),Ht=n("./src/crypt/decrypter.js"),Yt=window.performance,zt=function(e){var t,n;function r(t,n){var r;return(r=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.ERROR,u.default.KEY_LOADED,u.default.FRAG_LOADED,u.default.SUBTITLE_TRACKS_UPDATED,u.default.SUBTITLE_TRACK_SWITCH,u.default.SUBTITLE_TRACK_LOADED,u.default.SUBTITLE_FRAG_PROCESSED,u.default.LEVEL_UPDATED)||this).fragmentTracker=n,r.config=t.config,r.state=me,r.tracks=[],r.tracksBuffered=[],r.currentTrackId=-1,r.decrypter=new Ht.default(t,t.config),r.lastAVStart=0,r._onMediaSeeking=r.onMediaSeeking.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.onSubtitleFragProcessed=function(e){var t=e.frag,n=e.success;if(this.fragPrevious=t,this.state=ye,n){var r=this.tracksBuffered[this.currentTrackId];if(r){for(var i,a=t.start,o=0;o<r.length;o++)if(a>=r[o].start&&a<=r[o].end){i=r[o];break}var s=t.start+t.duration;i?i.end=s:(i={start:a,end:s},r.push(i))}}},i.onMediaAttached=function(e){var t=e.media;this.media=t,t.addEventListener("seeking",this._onMediaSeeking),this.state=ye},i.onMediaDetaching=function(){var e=this;this.media&&(this.media.removeEventListener("seeking",this._onMediaSeeking),this.fragmentTracker.removeAllFragments(),this.currentTrackId=-1,this.tracks.forEach((function(t){e.tracksBuffered[t.id]=[]})),this.media=null,this.state=me)},i.onError=function(e){var t=e.frag;t&&"subtitle"===t.type&&(this.state=ye)},i.onSubtitleTracksUpdated=function(e){var t=this;c.logger.log("subtitle tracks updated"),this.tracksBuffered=[],this.tracks=e.subtitleTracks,this.tracks.forEach((function(e){t.tracksBuffered[e.id]=[]}))},i.onSubtitleTrackSwitch=function(e){if(this.currentTrackId=e.id,this.tracks&&this.tracks.length&&-1!==this.currentTrackId){var t=this.tracks[this.currentTrackId];t&&t.details&&this.setInterval(500)}else this.clearInterval()},i.onSubtitleTrackLoaded=function(e){var t=e.id,n=e.details,r=this.currentTrackId,i=this.tracks,a=i[r];t>=i.length||t!==r||!a||(n.live&&function(e,t,n){void 0===n&&(n=0);var r=-1;re(e,t,(function(e,t,n){t.start=e.start,r=n}));var i=t.fragments;if(r<0)i.forEach((function(e){e.start+=n}));else for(var a=r+1;a<i.length;a++)i[a].start=i[a-1].start+i[a-1].duration}(a.details,n,this.lastAVStart),a.details=n,this.setInterval(500))},i.onKeyLoaded=function(){this.state===be&&(this.state=ye)},i.onFragLoaded=function(e){var t=this.fragCurrent,n=e.frag.decryptdata,r=e.frag,i=this.hls;if(this.state===_e&&t&&"subtitle"===e.frag.type&&t.sn===e.frag.sn&&e.payload.byteLength>0&&n&&n.key&&"AES-128"===n.method){var a=Yt.now();this.decrypter.decrypt(e.payload,n.key.buffer,n.iv.buffer,(function(e){var t=Yt.now();i.trigger(u.default.FRAG_DECRYPTED,{frag:r,payload:e,stats:{tstart:a,tdecrypt:t}})}))}},i.onLevelUpdated=function(e){var t=e.details.fragments;this.lastAVStart=t.length?t[0].start:0},i.doTick=function(){if(this.media)switch(this.state){case ye:var e=this.config,t=this.currentTrackId,n=this.fragmentTracker,r=this.media,i=this.tracks;if(!i||!i[t]||!i[t].details)break;var a,o=e.maxBufferHole,s=e.maxFragLookUpTolerance,l=Math.min(e.maxBufferLength,e.maxMaxBufferLength),d=G.bufferedInfo(this._getBuffered(),r.currentTime,o),f=d.end,h=d.len,p=i[t].details,m=p.fragments,g=m.length,y=m[g-1].start+m[g-1].duration;if(h>l)return;var v=this.fragPrevious;f<y?(v&&p.hasProgramDateTime&&(a=le(m,v.endProgramDateTime,s)),a||(a=ue(v,m,f,s))):a=m[g-1],a&&a.encrypted?(c.logger.log("Loading key for "+a.sn),this.state=be,this.hls.trigger(u.default.KEY_LOADING,{frag:a})):a&&n.getState(a)===N&&(this.fragCurrent=a,this.state=_e,this.hls.trigger(u.default.FRAG_LOADING,{frag:a}))}else this.state=ye},i.stopLoad=function(){this.lastAVStart=0,e.prototype.stopLoad.call(this)},i._getBuffered=function(){return this.tracksBuffered[this.currentTrackId]||[]},i.onMediaSeeking=function(){this.fragPrevious=null},r}(Le);!function(e){e.WIDEVINE="com.widevine.alpha",e.PLAYREADY="com.microsoft.playready"}(Vt||(Vt={}));var Wt="undefined"!=typeof window&&window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null;function $t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var qt=function(e){var t,n;function r(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHED,u.default.MANIFEST_PARSED)||this)._widevineLicenseUrl=void 0,n._licenseXhrSetup=void 0,n._emeEnabled=void 0,n._requestMediaKeySystemAccess=void 0,n._config=void 0,n._mediaKeysList=[],n._media=null,n._hasSetMediaKeys=!1,n._requestLicenseFailureCount=0,n._onMediaEncrypted=function(e){c.logger.log('Media is encrypted using "'+e.initDataType+'" init data type'),n._attemptSetMediaKeys(),n._generateRequestWithPreferredKeySession(e.initDataType,e.initData)},n._config=t.config,n._widevineLicenseUrl=n._config.widevineLicenseUrl,n._licenseXhrSetup=n._config.licenseXhrSetup,n._emeEnabled=n._config.emeEnabled,n._requestMediaKeySystemAccess=n._config.requestMediaKeySystemAccessFunc,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i,a,o,l=r.prototype;return l.getLicenseServerUrl=function(e){switch(e){case Vt.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+e+'"')},l._attemptKeySystemAccess=function(e,t,n){var r=this,i=function(e,t,n){switch(e){case Vt.WIDEVINE:return function(e,t){var n={videoCapabilities:[]};return t.forEach((function(e){n.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"'})})),[n]}(0,n);default:throw new Error("Unknown key-system: "+e)}}(e,0,n);c.logger.log("Requesting encrypted media key-system access"),this.requestMediaKeySystemAccess(e,i).then((function(t){r._onMediaKeySystemAccessObtained(e,t)})).catch((function(t){c.logger.error('Failed to obtain key-system "'+e+'" access:',t)}))},l._onMediaKeySystemAccessObtained=function(e,t){var n=this;c.logger.log('Access for key-system "'+e+'" obtained');var r={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e};this._mediaKeysList.push(r),t.createMediaKeys().then((function(t){r.mediaKeys=t,c.logger.log('Media-keys created for key-system "'+e+'"'),n._onMediaKeysCreated()})).catch((function(e){c.logger.error("Failed to create media-keys:",e)}))},l._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach((function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))}))},l._onNewMediaKeySession=function(e){var t=this;c.logger.log("New key-system session "+e.sessionId),e.addEventListener("message",(function(n){t._onKeySessionMessage(e,n.message)}),!1)},l._onKeySessionMessage=function(e,t){c.logger.log("Got EME message event, creating license request"),this._requestLicense(t,(function(t){c.logger.log("Received license data (length: "+(t?t.byteLength:t)+"), updating key-session"),e.update(t)}))},l._attemptSetMediaKeys=function(){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys)return c.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});c.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},l._generateRequestWithPreferredKeySession=function(e,t){var n=this,r=this._mediaKeysList[0];if(!r)return c.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(r.mediaKeysSessionInitialized)c.logger.warn("Key-Session already initialized but requested again");else{var i=r.mediaKeysSession;if(!i)return c.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});if(!t)return c.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});c.logger.log('Generating key-session request for "'+e+'" init data type'),r.mediaKeysSessionInitialized=!0,i.generateRequest(e,t).then((function(){c.logger.debug("Key-session generation succeeded")})).catch((function(e){c.logger.error("Error generating key-session request:",e),n.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},l._createLicenseXhr=function(e,t,n){var r=new XMLHttpRequest,i=this._licenseXhrSetup;try{if(i)try{i(r,e)}catch(t){r.open("POST",e,!0),i(r,e)}r.readyState||r.open("POST",e,!0)}catch(e){throw new Error("issue setting up KeySystem license XHR "+e)}return r.responseType="arraybuffer",r.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,r,e,t,n),r},l._onLicenseRequestReadyStageChange=function(e,t,n,r){switch(e.readyState){case 4:if(200===e.status)this._requestLicenseFailureCount=0,c.logger.log("License request succeeded"),"arraybuffer"!==e.responseType&&c.logger.warn("xhr response type was not set to the expected arraybuffer for license request"),r(e.response);else{if(c.logger.error("License Request XHR failed ("+t+"). Status: "+e.status+" ("+e.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>3)return void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var i=3-this._requestLicenseFailureCount+1;c.logger.warn("Retrying license request, "+i+" attempts left"),this._requestLicense(n,r)}}},l._generateLicenseRequestChallenge=function(e,t){switch(e.mediaKeySystemDomain){case Vt.WIDEVINE:return t}throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},l._requestLicense=function(e,t){c.logger.log("Requesting content license for key-system");var n=this._mediaKeysList[0];if(!n)return c.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var r=this.getLicenseServerUrl(n.mediaKeySystemDomain),i=this._createLicenseXhr(r,e,t);c.logger.log("Sending license request to URL: "+r);var a=this._generateLicenseRequestChallenge(n,e);i.send(a)}catch(e){c.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},l.onMediaAttached=function(e){if(this._emeEnabled){var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)}},l.onMediaDetached=function(){this._media&&(this._media.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null)},l.onManifestParsed=function(e){if(this._emeEnabled){var t=e.levels.map((function(e){return e.audioCodec})),n=e.levels.map((function(e){return e.videoCodec}));this._attemptKeySystemAccess(Vt.WIDEVINE,t,n)}},i=r,(a=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&$t(i.prototype,a),o&&$t(i,o),r}(f);function Xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jt=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Xt(e,t,n[t])}))}return e}({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,liveDurationInfinity:!1,liveBackBufferLength:1/0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:et,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,abrController:He,bufferController:ze,capLevelController:$e,fpsController:Xe,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,requestMediaKeySystemAccessFunc:Wt},{cueHandler:r,enableCEA708Captions:!0,enableWebVTT:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es"},{subtitleStreamController:zt,subtitleTrackController:Gt,timelineController:Ft,audioStreamController:at,audioTrackController:nt,emeController:qt});function Qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function en(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function tn(e,t,n){return t&&en(e.prototype,t),n&&en(e,n),e}n.d(t,"default",(function(){return nn}));var nn=function(e){var t,n;function r(t){var n;void 0===t&&(t={}),(n=e.call(this)||this).config=void 0,n._autoLevelCapping=void 0,n.abrController=void 0,n.capLevelController=void 0,n.levelController=void 0,n.streamController=void 0,n.networkControllers=void 0,n.audioTrackController=void 0,n.subtitleTrackController=void 0,n.emeController=void 0,n.coreComponents=void 0,n.media=null,n.url=null;var i=r.DefaultConfig;if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");n.config=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Qt(e,t,n[t])}))}return e}({},i,t);var a=Zt(n).config;if(void 0!==a.liveMaxLatencyDurationCount&&a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==a.liveMaxLatencyDuration&&(void 0===a.liveSyncDuration||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');Object(c.enableLogs)(a.debug),n._autoLevelCapping=-1;var o=n.abrController=new a.abrController(Zt(n)),s=new a.bufferController(Zt(n)),l=n.capLevelController=new a.capLevelController(Zt(n)),u=new a.fpsController(Zt(n)),d=new O(Zt(n)),f=new D(Zt(n)),h=new M(Zt(n)),p=new Fe(Zt(n)),m=n.levelController=new De(Zt(n)),g=new K(Zt(n)),y=[m,n.streamController=new Pe(Zt(n),g)],v=a.audioStreamController;v&&y.push(new v(Zt(n),g)),n.networkControllers=y;var b=[d,f,h,o,s,l,u,p,g];if(v=a.audioTrackController){var _=new v(Zt(n));n.audioTrackController=_,b.push(_)}if(v=a.subtitleTrackController){var A=new v(Zt(n));n.subtitleTrackController=A,y.push(A)}if(v=a.emeController){var E=new v(Zt(n));n.emeController=E,b.push(E)}return(v=a.subtitleStreamController)&&y.push(new v(Zt(n),g)),(v=a.timelineController)&&b.push(new v(Zt(n))),n.coreComponents=b,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,r.isSupported=function(){return function(){var e=W();if(!e)return!1;var t=self.SourceBuffer||self.WebKitSourceBuffer,n=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),r=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return!!n&&!!r}()},tn(r,null,[{key:"version",get:function(){return"0.13.2"}},{key:"Events",get:function(){return u.default}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return r.defaultConfig?r.defaultConfig:Jt},set:function(e){r.defaultConfig=e}}]);var i=r.prototype;return i.destroy=function(){c.logger.log("destroy"),this.trigger(u.default.DESTROYING),this.detachMedia(),this.coreComponents.concat(this.networkControllers).forEach((function(e){e.destroy()})),this.url=null,this.removeAllListeners(),this._autoLevelCapping=-1},i.attachMedia=function(e){c.logger.log("attachMedia"),this.media=e,this.trigger(u.default.MEDIA_ATTACHING,{media:e})},i.detachMedia=function(){c.logger.log("detachMedia"),this.trigger(u.default.MEDIA_DETACHING),this.media=null},i.loadSource=function(e){e=o.buildAbsoluteURL(window.location.href,e,{alwaysNormalize:!0}),c.logger.log("loadSource:"+e),this.url=e,this.trigger(u.default.MANIFEST_LOADING,{url:e})},i.startLoad=function(e){void 0===e&&(e=-1),c.logger.log("startLoad("+e+")"),this.networkControllers.forEach((function(t){t.startLoad(e)}))},i.stopLoad=function(){c.logger.log("stopLoad"),this.networkControllers.forEach((function(e){e.stopLoad()}))},i.swapAudioCodec=function(){c.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},i.recoverMediaError=function(){c.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),e&&this.attachMedia(e)},tn(r,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){c.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){c.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){c.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){c.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){c.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){c.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e}},{key:"bandwidthEstimate",get:function(){var e=this.abrController._bwEstimator;return e?e.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var e=this.levels,t=this.config.minAutoBitrate,n=e?e.length:0,r=0;r<n;r++)if((e[r].realBitrate?Math.max(e[r].realBitrate,e[r].bitrate):e[r].bitrate)>t)return r;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}}]),r}(q);nn.defaultConfig=void 0},"./src/polyfills/number-isFinite.js": -/*!******************************************!*\ - !*** ./src/polyfills/number-isFinite.js ***! - \******************************************/ -/*! exports provided: isFiniteNumber */function(e,t,n){"use strict";n.r(t),n.d(t,"isFiniteNumber",(function(){return r}));var r=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)}},"./src/utils/get-self-scope.js": -/*!*************************************!*\ - !*** ./src/utils/get-self-scope.js ***! - \*************************************/ -/*! exports provided: getSelfScope */function(e,t,n){"use strict";function r(){return"undefined"==typeof window?self:window}n.r(t),n.d(t,"getSelfScope",(function(){return r}))},"./src/utils/logger.js": -/*!*****************************!*\ - !*** ./src/utils/logger.js ***! - \*****************************/ -/*! exports provided: enableLogs, logger */function(e,t,n){"use strict";n.r(t),n.d(t,"enableLogs",(function(){return c})),n.d(t,"logger",(function(){return d}));var r=n(/*! ./get-self-scope */"./src/utils/get-self-scope.js");function i(){}var a={trace:i,debug:i,log:i,warn:i,info:i,error:i},o=a;function s(e,t){return t="["+e+"] > "+t}var l=Object(r.getSelfScope)();function u(e){var t=l.console[e];return t?function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];r[0]&&(r[0]=s(e,r[0])),t.apply(l.console,r)}:i}var c=function(e){if(l.console&&!0===e||"object"==typeof e){!function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];n.forEach((function(t){o[t]=e[t]?e[t].bind(e):u(t)}))}(e,"debug","log","info","warn","error");try{o.log()}catch(e){o=a}}else o=a},d=o}}).default},e.exports=r())},"./node_modules/node-libs-browser/node_modules/process/browser.js": -/*!************************************************************************!*\ - !*** ./node_modules/node-libs-browser/node_modules/process/browser.js ***! - \************************************************************************/ -/*! no static exports found */function(e,t){var n,r,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var l,u=[],c=!1,d=-1;function f(){c&&l&&(c=!1,l.length?u=l.concat(u):d=-1,u.length&&h())}function h(){if(!c){var e=s(f);c=!0;for(var t=u.length;t;){for(l=u,u=[];++d<t;)l&&l[d].run();d=-1,t=u.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||c||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},"./node_modules/style-loader/lib/addStyles.js": -/*!****************************************************!*\ - !*** ./node_modules/style-loader/lib/addStyles.js ***! - \****************************************************/ -/*! no static exports found */function(e,t,n){var r,i,a={},o=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=r.apply(this,arguments)),i}),s=function(e){return document.querySelector(e)},l=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var n=s.call(this,e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),u=null,c=0,d=[],f=n(/*! ./urls */"./node_modules/style-loader/lib/urls.js");function h(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=a[r.id];if(i){i.refs++;for(var o=0;o<i.parts.length;o++)i.parts[o](r.parts[o]);for(;o<r.parts.length;o++)i.parts.push(b(r.parts[o],t))}else{var s=[];for(o=0;o<r.parts.length;o++)s.push(b(r.parts[o],t));a[r.id]={id:r.id,refs:1,parts:s}}}}function p(e,t){for(var n=[],r={},i=0;i<e.length;i++){var a=e[i],o=t.base?a[0]+t.base:a[0],s={css:a[1],media:a[2],sourceMap:a[3]};r[o]?r[o].parts.push(s):n.push(r[o]={id:o,parts:[s]})}return n}function m(e,t){var n=l(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=d[d.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),d.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=l(e.insertInto+" "+e.insertAt.before);n.insertBefore(t,i)}}function g(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=d.indexOf(e);t>=0&&d.splice(t,1)}function y(e){var t=document.createElement("style");return e.attrs.type="text/css",v(t,e.attrs),m(e,t),t}function v(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function b(e,t){var n,r,i,a;if(t.transform&&e.css){if(!(a=t.transform(e.css)))return function(){};e.css=a}if(t.singleton){var o=c++;n=u||(u=y(t)),r=E.bind(null,n,o,!1),i=E.bind(null,n,o,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",v(t,e.attrs),m(e,t),t}(t),r=w.bind(null,n,t),i=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=y(t),r=T.bind(null,n),i=function(){g(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=o()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return h(n,t),function(e){for(var r=[],i=0;i<n.length;i++){var o=n[i];(s=a[o.id]).refs--,r.push(s)}for(e&&h(p(e,t),t),i=0;i<r.length;i++){var s;if(0===(s=r[i]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete a[s.id]}}}};var _,A=(_=[],function(e,t){return _[e]=t,_.filter(Boolean).join("\n")});function E(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=A(t,i);else{var a=document.createTextNode(i),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(a,o[t]):e.appendChild(a)}}function T(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function w(e,t,n){var r=n.css,i=n.sourceMap,a=void 0===t.convertToAbsoluteUrls&&i;(t.convertToAbsoluteUrls||a)&&(r=f(r)),i&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var o=new Blob([r],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(o),s&&URL.revokeObjectURL(s)}},"./node_modules/style-loader/lib/urls.js": -/*!***********************************************!*\ - !*** ./node_modules/style-loader/lib/urls.js ***! - \***********************************************/ -/*! no static exports found */function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,r=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var i,a=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(a)?e:(i=0===a.indexOf("//")?a:0===a.indexOf("/")?n+a:r+a.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},"./src/base/base_object.js": -/*!*********************************!*\ - !*** ./src/base/base_object.js ***! - \*********************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=l(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=l(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=l(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=n(/*! ./utils */"./src/base/utils.js");function l(e){return e&&e.__esModule?e:{default:e}}var u=function(e){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a._options=n,a.uniqueId=(0,s.uniqueId)("o"),a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"options",get:function(){return this._options}}]),t}(l(n(/*! ./events */"./src/base/events.js")).default);t.default=u,e.exports=t.default},"./src/base/container_plugin.js": -/*!**************************************!*\ - !*** ./src/base/container_plugin.js ***! - \**************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(/*! babel-runtime/core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js")),i=d(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),a=d(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=d(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),s=d(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=d(n(/*! ./base_object */"./src/base/base_object.js")),u=n(/*! ./utils */"./src/base/utils.js"),c=d(n(/*! ./error_mixin */"./src/base/error_mixin.js"));function d(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(n){(0,i.default)(this,t);var r=(0,a.default)(this,e.call(this,n.options));return r.container=n,r.enabled=!0,r.bindEvents(),r}return(0,s.default)(t,e),(0,o.default)(t,[{key:"playerError",get:function(){return this.container.playerError}}]),t.prototype.enable=function(){this.enabled||(this.bindEvents(),this.enabled=!0)},t.prototype.disable=function(){this.enabled&&(this.stopListening(),this.enabled=!1)},t.prototype.bindEvents=function(){},t.prototype.destroy=function(){this.stopListening()},t}(l.default);t.default=f,(0,r.default)(f.prototype,c.default),f.extend=function(e){return(0,u.extend)(f,e)},f.type="container",e.exports=t.default},"./src/base/core_plugin.js": -/*!*********************************!*\ - !*** ./src/base/core_plugin.js ***! - \*********************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(/*! babel-runtime/core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js")),i=d(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),a=d(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=d(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),s=d(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=n(/*! ./utils */"./src/base/utils.js"),u=d(n(/*! ./base_object */"./src/base/base_object.js")),c=d(n(/*! ./error_mixin */"./src/base/error_mixin.js"));function d(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(n){(0,i.default)(this,t);var r=(0,a.default)(this,e.call(this,n.options));return r.core=n,r.enabled=!0,r.bindEvents(),r}return(0,s.default)(t,e),(0,o.default)(t,[{key:"playerError",get:function(){return this.core.playerError}}]),t.prototype.bindEvents=function(){},t.prototype.enable=function(){this.enabled||(this.bindEvents(),this.enabled=!0)},t.prototype.disable=function(){this.enabled&&(this.stopListening(),this.enabled=!1)},t.prototype.getExternalInterface=function(){return{}},t.prototype.destroy=function(){this.stopListening()},t}(u.default);t.default=f,(0,r.default)(f.prototype,c.default),f.extend=function(e){return(0,l.extend)(f,e)},f.type="core",e.exports=t.default},"./src/base/error_mixin.js": -/*!*********************************!*\ - !*** ./src/base/error_mixin.js ***! - \*********************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=o(n(/*! babel-runtime/core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js")),i=o(n(/*! ../plugins/log */"./src/plugins/log/index.js")),a=o(n(/*! ../components/error */"./src/components/error/index.js"));function o(e){return e&&e.__esModule?e:{default:e}}var s={createError:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{useCodePrefix:!0},n=this.constructor&&this.constructor.type||"",o=this.name||n,s=this.i18n||this.core&&this.core.i18n||this.container&&this.container.i18n,l=o+":"+(e&&e.code||"unknown"),u={description:"",level:a.default.Levels.FATAL,origin:o,scope:n,raw:{}},c=(0,r.default)({},u,e,{code:t.useCodePrefix?l:e.code});if(s&&c.level==a.default.Levels.FATAL&&!c.UI){var d={title:s.t("default_error_title"),message:s.t("default_error_message")};c.UI=d}return this.playerError?this.playerError.createError(c):i.default.warn(o,"PlayerError is not defined. Error: ",c),c}};t.default=s,e.exports=t.default},"./src/base/events.js": -/*!****************************!*\ - !*** ./src/base/events.js ***! - \****************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(/*! babel-runtime/core-js/object/keys */"./node_modules/babel-runtime/core-js/object/keys.js")),i=l(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),a=l(n(/*! babel-runtime/helpers/typeof */"./node_modules/babel-runtime/helpers/typeof.js")),o=l(n(/*! ../plugins/log */"./src/plugins/log/index.js")),s=n(/*! ./utils */"./src/base/utils.js");function l(e){return e&&e.__esModule?e:{default:e}}var u=Array.prototype.slice,c=/\s+/,d=function(e,t,n,r){if(!n)return!0;if("object"===(void 0===n?"undefined":(0,a.default)(n))){for(var i in n)e[t].apply(e,[i,n[i]].concat(r));return!1}if(c.test(n)){for(var o=n.split(c),s=0,l=o.length;s<l;s++)e[t].apply(e,[o[s]].concat(r));return!1}return!0},f=function(e,t,n,r){var i=void 0,a=-1,s=e.length,l=t[0],u=t[1],c=t[2];!function d(){try{switch(t.length){case 0:for(;++a<s;)(i=e[a]).callback.call(i.ctx);return;case 1:for(;++a<s;)(i=e[a]).callback.call(i.ctx,l);return;case 2:for(;++a<s;)(i=e[a]).callback.call(i.ctx,l,u);return;case 3:for(;++a<s;)(i=e[a]).callback.call(i.ctx,l,u,c);return;default:for(;++a<s;)(i=e[a]).callback.apply(i.ctx,t);return}}catch(e){o.default.error.apply(o.default,[n,"error on event",r,"trigger","-",e]),d()}}()},h=function(){function e(){(0,i.default)(this,e)}return e.prototype.on=function(e,t,n){return d(this,"on",e,[t,n])&&t?(this._events||(this._events={}),(this._events[e]||(this._events[e]=[])).push({callback:t,context:n,ctx:n||this}),this):this},e.prototype.once=function(e,t,n){var r=this,i=void 0;if(!d(this,"once",e,[t,n])||!t)return this;var a=function(){return r.off(e,i)};return i=function(){a(),t.apply(this,arguments)},this.on(e,i,n)},e.prototype.off=function(e,t,n){var i,a,o=void 0,s=void 0,l=void 0,u=void 0,c=void 0,f=void 0;if(!this._events||!d(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events=void 0,this;for(u=0,a=(i=e?[e]:(0,r.default)(this._events)).length;u<a;u++)if(e=i[u],l=this._events[e]){if(this._events[e]=o=[],t||n)for(c=0,f=l.length;c<f;c++)s=l[c],(t&&t!==s.callback&&t!==s.callback._callback||n&&n!==s.context)&&o.push(s);o.length||delete this._events[e]}return this},e.prototype.trigger=function(e){var t=this.name||this.constructor.name;if(o.default.debug.apply(o.default,[t].concat(Array.prototype.slice.call(arguments))),!this._events)return this;var n=u.call(arguments,1);if(!d(this,"trigger",e,n))return this;var r=this._events[e],i=this._events.all;return r&&f(r,n,t,e),i&&f(i,arguments,t,e),this},e.prototype.stopListening=function(e,t,n){var i=this._listeningTo;if(!i)return this;var o=!t&&!n;for(var s in n||"object"!==(void 0===t?"undefined":(0,a.default)(t))||(n=this),e&&((i={})[e._listenId]=e),i)(e=i[s]).off(t,n,this),(o||0===(0,r.default)(e._events).length)&&delete this._listeningTo[s];return this},e.register=function(t){e.Custom||(e.Custom={});var n="string"==typeof t&&t.toUpperCase().trim();n&&!e.Custom[n]?e.Custom[n]=n.toLowerCase().split("_").map((function(e,t){return 0===t?e:e=e[0].toUpperCase()+e.slice(1)})).join(""):o.default.error("Events","Error when register event: "+t)},e.listAvailableCustomEvents=function(){return e.Custom||(e.Custom={}),(0,r.default)(e.Custom).filter((function(t){return"string"==typeof e.Custom[t]}))},e}();t.default=h;var p={listenTo:"on",listenToOnce:"once"};(0,r.default)(p).forEach((function(e){h.prototype[e]=function(t,n,r){return(this._listeningTo||(this._listeningTo={}))[t._listenId||(t._listenId=(0,s.uniqueId)("l"))]=t,r||"object"!==(void 0===n?"undefined":(0,a.default)(n))||(r=this),t[p[e]](n,r,this),this}})),h.PLAYER_READY="ready",h.PLAYER_RESIZE="resize",h.PLAYER_FULLSCREEN="fullscreen",h.PLAYER_PLAY="play",h.PLAYER_PAUSE="pause",h.PLAYER_STOP="stop",h.PLAYER_ENDED="ended",h.PLAYER_SEEK="seek",h.PLAYER_ERROR="playererror",h.ERROR="error",h.PLAYER_TIMEUPDATE="timeupdate",h.PLAYER_VOLUMEUPDATE="volumeupdate",h.PLAYER_SUBTITLE_AVAILABLE="subtitleavailable",h.PLAYBACK_PROGRESS="playback:progress",h.PLAYBACK_TIMEUPDATE="playback:timeupdate",h.PLAYBACK_READY="playback:ready",h.PLAYBACK_BUFFERING="playback:buffering",h.PLAYBACK_BUFFERFULL="playback:bufferfull",h.PLAYBACK_SETTINGSUPDATE="playback:settingsupdate",h.PLAYBACK_LOADEDMETADATA="playback:loadedmetadata",h.PLAYBACK_HIGHDEFINITIONUPDATE="playback:highdefinitionupdate",h.PLAYBACK_BITRATE="playback:bitrate",h.PLAYBACK_LEVELS_AVAILABLE="playback:levels:available",h.PLAYBACK_LEVEL_SWITCH_START="playback:levels:switch:start",h.PLAYBACK_LEVEL_SWITCH_END="playback:levels:switch:end",h.PLAYBACK_PLAYBACKSTATE="playback:playbackstate",h.PLAYBACK_DVR="playback:dvr",h.PLAYBACK_MEDIACONTROL_DISABLE="playback:mediacontrol:disable",h.PLAYBACK_MEDIACONTROL_ENABLE="playback:mediacontrol:enable",h.PLAYBACK_ENDED="playback:ended",h.PLAYBACK_PLAY_INTENT="playback:play:intent",h.PLAYBACK_PLAY="playback:play",h.PLAYBACK_PAUSE="playback:pause",h.PLAYBACK_SEEK="playback:seek",h.PLAYBACK_SEEKED="playback:seeked",h.PLAYBACK_STOP="playback:stop",h.PLAYBACK_ERROR="playback:error",h.PLAYBACK_STATS_ADD="playback:stats:add",h.PLAYBACK_FRAGMENT_LOADED="playback:fragment:loaded",h.PLAYBACK_LEVEL_SWITCH="playback:level:switch",h.PLAYBACK_SUBTITLE_AVAILABLE="playback:subtitle:available",h.PLAYBACK_SUBTITLE_CHANGED="playback:subtitle:changed",h.CORE_CONTAINERS_CREATED="core:containers:created",h.CORE_ACTIVE_CONTAINER_CHANGED="core:active:container:changed",h.CORE_OPTIONS_CHANGE="core:options:change",h.CORE_READY="core:ready",h.CORE_FULLSCREEN="core:fullscreen",h.CORE_RESIZE="core:resize",h.CORE_SCREEN_ORIENTATION_CHANGED="core:screen:orientation:changed",h.CORE_MOUSE_MOVE="core:mousemove",h.CORE_MOUSE_LEAVE="core:mouseleave",h.CONTAINER_PLAYBACKSTATE="container:playbackstate",h.CONTAINER_PLAYBACKDVRSTATECHANGED="container:dvr",h.CONTAINER_BITRATE="container:bitrate",h.CONTAINER_STATS_REPORT="container:stats:report",h.CONTAINER_DESTROYED="container:destroyed",h.CONTAINER_READY="container:ready",h.CONTAINER_ERROR="container:error",h.CONTAINER_LOADEDMETADATA="container:loadedmetadata",h.CONTAINER_SUBTITLE_AVAILABLE="container:subtitle:available",h.CONTAINER_SUBTITLE_CHANGED="container:subtitle:changed",h.CONTAINER_TIMEUPDATE="container:timeupdate",h.CONTAINER_PROGRESS="container:progress",h.CONTAINER_PLAY="container:play",h.CONTAINER_STOP="container:stop",h.CONTAINER_PAUSE="container:pause",h.CONTAINER_ENDED="container:ended",h.CONTAINER_CLICK="container:click",h.CONTAINER_DBLCLICK="container:dblclick",h.CONTAINER_CONTEXTMENU="container:contextmenu",h.CONTAINER_MOUSE_ENTER="container:mouseenter",h.CONTAINER_MOUSE_LEAVE="container:mouseleave",h.CONTAINER_SEEK="container:seek",h.CONTAINER_SEEKED="container:seeked",h.CONTAINER_VOLUME="container:volume",h.CONTAINER_FULLSCREEN="container:fullscreen",h.CONTAINER_STATE_BUFFERING="container:state:buffering",h.CONTAINER_STATE_BUFFERFULL="container:state:bufferfull",h.CONTAINER_SETTINGSUPDATE="container:settingsupdate",h.CONTAINER_HIGHDEFINITIONUPDATE="container:highdefinitionupdate",h.CONTAINER_MEDIACONTROL_SHOW="container:mediacontrol:show",h.CONTAINER_MEDIACONTROL_HIDE="container:mediacontrol:hide",h.CONTAINER_MEDIACONTROL_DISABLE="container:mediacontrol:disable",h.CONTAINER_MEDIACONTROL_ENABLE="container:mediacontrol:enable",h.CONTAINER_STATS_ADD="container:stats:add",h.CONTAINER_OPTIONS_CHANGE="container:options:change",h.MEDIACONTROL_RENDERED="mediacontrol:rendered",h.MEDIACONTROL_FULLSCREEN="mediacontrol:fullscreen",h.MEDIACONTROL_SHOW="mediacontrol:show",h.MEDIACONTROL_HIDE="mediacontrol:hide",h.MEDIACONTROL_MOUSEMOVE_SEEKBAR="mediacontrol:mousemove:seekbar",h.MEDIACONTROL_MOUSELEAVE_SEEKBAR="mediacontrol:mouseleave:seekbar",h.MEDIACONTROL_PLAYING="mediacontrol:playing",h.MEDIACONTROL_NOTPLAYING="mediacontrol:notplaying",h.MEDIACONTROL_CONTAINERCHANGED="mediacontrol:containerchanged",h.MEDIACONTROL_OPTIONS_CHANGE="mediacontrol:options:change",e.exports=t.default},"./src/base/media.js": -/*!***************************!*\ - !*** ./src/base/media.js ***! - \***************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.mp4="data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAC721kYXQhEAUgpBv/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3pwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCEQBSCkG//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADengAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAsJtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAALwABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAB7HRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAIAAAAAAAAALwAAAAAAAAAAAAAAAQEAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAAC8AAAAAAAEAAAAAAWRtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAAKxEAAAIAFXEAAAAAAAtaGRscgAAAAAAAAAAc291bgAAAAAAAAAAAAAAAFNvdW5kSGFuZGxlcgAAAAEPbWluZgAAABBzbWhkAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAADTc3RibAAAAGdzdHNkAAAAAAAAAAEAAABXbXA0YQAAAAAAAAABAAAAAAAAAAAAAgAQAAAAAKxEAAAAAAAzZXNkcwAAAAADgICAIgACAASAgIAUQBUAAAAAAfQAAAHz+QWAgIACEhAGgICAAQIAAAAYc3R0cwAAAAAAAAABAAAAAgAABAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAIAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAFzAAABdAAAABRzdGNvAAAAAAAAAAEAAAAsAAAAYnVkdGEAAABabWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAtaWxzdAAAACWpdG9vAAAAHWRhdGEAAAABAAAAAExhdmY1Ni40MC4xMDE=";t.default={mp4:r}},"./src/base/playback.js": -/*!******************************!*\ - !*** ./src/base/playback.js ***! - \******************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=f(n(/*! babel-runtime/core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js")),i=f(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),a=f(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=f(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),s=f(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=n(/*! ./utils */"./src/base/utils.js"),u=f(n(/*! ./ui_object */"./src/base/ui_object.js")),c=f(n(/*! ./error_mixin */"./src/base/error_mixin.js")),d=f(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js"));function f(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(n,r,o){(0,i.default)(this,t);var s=(0,a.default)(this,e.call(this,n));return s.settings={},s._i18n=r,s.playerError=o,s._consented=!1,s}return(0,s.default)(t,e),(0,o.default)(t,[{key:"isAudioOnly",get:function(){return!1}},{key:"isAdaptive",get:function(){return!1}},{key:"ended",get:function(){return!1}},{key:"i18n",get:function(){return this._i18n}},{key:"buffering",get:function(){return!1}},{key:"consented",get:function(){return this._consented}}]),t.prototype.consent=function(){this._consented=!0},t.prototype.play=function(){},t.prototype.pause=function(){},t.prototype.stop=function(){},t.prototype.seek=function(e){},t.prototype.seekPercentage=function(e){},t.prototype.getStartTimeOffset=function(){return 0},t.prototype.getDuration=function(){return 0},t.prototype.isPlaying=function(){return!1},t.prototype.getPlaybackType=function(){return t.NO_OP},t.prototype.isHighDefinitionInUse=function(){return!1},t.prototype.volume=function(e){},t.prototype.configure=function(e){this._options=d.default.extend(this._options,e)},t.prototype.attemptAutoPlay=function(){var e=this;this.canAutoPlay((function(t,n){t&&e.play()}))},t.prototype.canAutoPlay=function(e){e(!0,null)},(0,o.default)(t,[{key:"isReady",get:function(){return!1}},{key:"hasClosedCaptionsTracks",get:function(){return this.closedCaptionsTracks.length>0}},{key:"closedCaptionsTracks",get:function(){return[]}},{key:"closedCaptionsTrackId",get:function(){return-1},set:function(e){}}]),t}(u.default);t.default=h,(0,r.default)(h.prototype,c.default),h.extend=function(e){return(0,l.extend)(h,e)},h.canPlay=function(e,t){return!1},h.VOD="vod",h.AOD="aod",h.LIVE="live",h.NO_OP="no_op",h.type="playback",e.exports=t.default},"./src/base/polyfills.js": -/*!*******************************!*\ - !*** ./src/base/polyfills.js ***! - \*******************************/ -/*! no static exports found */function(e,t,n){"use strict";Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var r=arguments[1],i=0;i<n;){var a=t[i];if(e.call(r,a,i,t))return a;i++}}})},"./src/base/styler.js": -/*!****************************!*\ - !*** ./src/base/styler.js ***! - \****************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js")),i=a(n(/*! ./template */"./src/base/template.js"));function a(e){return e&&e.__esModule?e:{default:e}}var o={getStyleFor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{baseUrl:""};return(0,r.default)('<style class="clappr-style"></style>').html((0,i.default)(e.toString())(t))}};t.default=o,e.exports=t.default},"./src/base/svg_icons.js": -/*!*******************************!*\ - !*** ./src/base/svg_icons.js ***! - \*******************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.volumeMute=t.volume=t.stop=t.reload=t.play=t.pause=t.hd=t.fullscreen=t.exitFullscreen=t.cc=void 0;var r=h(n(/*! ../icons/01-play.svg */"./src/icons/01-play.svg")),i=h(n(/*! ../icons/02-pause.svg */"./src/icons/02-pause.svg")),a=h(n(/*! ../icons/03-stop.svg */"./src/icons/03-stop.svg")),o=h(n(/*! ../icons/04-volume.svg */"./src/icons/04-volume.svg")),s=h(n(/*! ../icons/05-mute.svg */"./src/icons/05-mute.svg")),l=h(n(/*! ../icons/06-expand.svg */"./src/icons/06-expand.svg")),u=h(n(/*! ../icons/07-shrink.svg */"./src/icons/07-shrink.svg")),c=h(n(/*! ../icons/08-hd.svg */"./src/icons/08-hd.svg")),d=h(n(/*! ../icons/09-cc.svg */"./src/icons/09-cc.svg")),f=h(n(/*! ../icons/10-reload.svg */"./src/icons/10-reload.svg"));function h(e){return e&&e.__esModule?e:{default:e}}t.cc=d.default,t.exitFullscreen=u.default,t.fullscreen=l.default,t.hd=c.default,t.pause=i.default,t.play=r.default,t.reload=f.default,t.stop=a.default,t.volume=o.default,t.volumeMute=s.default,t.default={cc:d.default,exitFullscreen:u.default,fullscreen:l.default,hd:c.default,pause:i.default,play:r.default,reload:f.default,stop:a.default,volume:o.default,volumeMute:s.default}},"./src/base/template.js": -/*!******************************!*\ - !*** ./src/base/template.js ***! - \******************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},i=/(.)^/,a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},o=/\\|'|\r|\n|\t|\u2028|\u2029/g,s={"&":"&","<":"<",">":">",'"':""","'":"'"},l=new RegExp("[&<>\"']","g"),u=function(e){return null===e?"":(""+e).replace(l,(function(e){return s[e]}))},c=0,d=function(e,t){var n,s=new RegExp([(r.escape||i).source,(r.interpolate||i).source,(r.evaluate||i).source].join("|")+"|$","g"),l=0,d="__p+='";e.replace(s,(function(t,n,r,i,s){return d+=e.slice(l,s).replace(o,(function(e){return"\\"+a[e]})),n&&(d+="'+\n((__t=("+n+"))==null?'':escapeExpr(__t))+\n'"),r&&(d+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(d+="';\n"+i+"\n__p+='"),l=s+t.length,t})),d+="';\n",r.variable||(d="with(obj||{}){\n"+d+"}\n"),d="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+d+"return __p;\n//# sourceURL=/microtemplates/source["+c+++"]";try{n=new Function(r.variable||"obj","escapeExpr",d)}catch(e){throw e.source=d,e}if(t)return n(t,u);var f=function(e){return n.call(this,e,u)};return f.source="function("+(r.variable||"obj")+"){\n"+d+"}",f};d.settings=r,t.default=d,e.exports=t.default},"./src/base/ui_container_plugin.js": -/*!*****************************************!*\ - !*** ./src/base/ui_container_plugin.js ***! - \*****************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(/*! babel-runtime/core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js")),i=d(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),a=d(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=d(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),s=d(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=n(/*! ./utils */"./src/base/utils.js"),u=d(n(/*! ./ui_object */"./src/base/ui_object.js")),c=d(n(/*! ./error_mixin */"./src/base/error_mixin.js"));function d(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(n){(0,i.default)(this,t);var r=(0,a.default)(this,e.call(this,n.options));return r.container=n,r.enabled=!0,r.bindEvents(),r}return(0,s.default)(t,e),(0,o.default)(t,[{key:"playerError",get:function(){return this.container.playerError}}]),t.prototype.enable=function(){this.enabled||(this.bindEvents(),this.$el.show(),this.enabled=!0)},t.prototype.disable=function(){this.stopListening(),this.$el.hide(),this.enabled=!1},t.prototype.bindEvents=function(){},t}(u.default);t.default=f,(0,r.default)(f.prototype,c.default),f.extend=function(e){return(0,l.extend)(f,e)},f.type="container",e.exports=t.default},"./src/base/ui_core_plugin.js": -/*!************************************!*\ - !*** ./src/base/ui_core_plugin.js ***! - \************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(/*! babel-runtime/core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js")),i=d(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),a=d(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=d(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),s=d(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=n(/*! ./utils */"./src/base/utils.js"),u=d(n(/*! ./ui_object */"./src/base/ui_object.js")),c=d(n(/*! ./error_mixin */"./src/base/error_mixin.js"));function d(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(n){(0,i.default)(this,t);var r=(0,a.default)(this,e.call(this,n.options));return r.core=n,r.enabled=!0,r.bindEvents(),r.render(),r}return(0,s.default)(t,e),(0,o.default)(t,[{key:"playerError",get:function(){return this.core.playerError}}]),t.prototype.bindEvents=function(){},t.prototype.getExternalInterface=function(){return{}},t.prototype.enable=function(){this.enabled||(this.bindEvents(),this.$el.show(),this.enabled=!0)},t.prototype.disable=function(){this.stopListening(),this.$el.hide(),this.enabled=!1},t.prototype.render=function(){return this},t}(u.default);t.default=f,(0,r.default)(f.prototype,c.default),f.extend=function(e){return(0,l.extend)(f,e)},f.type="core",e.exports=t.default},"./src/base/ui_object.js": -/*!*******************************!*\ - !*** ./src/base/ui_object.js ***! - \*******************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=c(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=c(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=c(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=c(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js")),l=n(/*! ./utils */"./src/base/utils.js"),u=c(n(/*! ./base_object */"./src/base/base_object.js"));function c(e){return e&&e.__esModule?e:{default:e}}var d=/^(\S+)\s*(.*)$/,f=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a.cid=(0,l.uniqueId)("c"),a._ensureElement(),a.delegateEvents(),a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"tagName",get:function(){return"div"}},{key:"events",get:function(){return{}}},{key:"attributes",get:function(){return{}}}]),t.prototype.$=function(e){return this.$el.find(e)},t.prototype.render=function(){return this},t.prototype.destroy=function(){return this.$el.remove(),this.stopListening(),this.undelegateEvents(),this},t.prototype.setElement=function(e,t){return this.$el&&this.undelegateEvents(),this.$el=s.default.zepto.isZ(e)?e:(0,s.default)(e),this.el=this.$el[0],!1!==t&&this.delegateEvents(),this},t.prototype.delegateEvents=function(e){if(!e&&!(e=this.events))return this;for(var t in this.undelegateEvents(),e){var n=e[t];if(n&&n.constructor!==Function&&(n=this[e[t]]),n){var r=t.match(d),i=r[1],a=r[2];i+=".delegateEvents"+this.cid,""===a?this.$el.on(i,n.bind(this)):this.$el.on(i,a,n.bind(this))}}return this},t.prototype.undelegateEvents=function(){return this.$el.off(".delegateEvents"+this.cid),this},t.prototype._ensureElement=function(){if(this.el)this.setElement(this.el,!1);else{var e=s.default.extend({},this.attributes);this.id&&(e.id=this.id),this.className&&(e.class=this.className);var t=l.DomRecycler.create(this.tagName).attr(e);this.setElement(t,!1)}},t}(u.default);t.default=f,e.exports=t.default},"./src/base/utils.js": -/*!***************************!*\ - !*** ./src/base/utils.js ***! - \***************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SvgIcons=t.DoubleEventHandler=t.DomRecycler=t.cancelAnimationFrame=t.requestAnimationFrame=t.QueryString=t.Config=t.Fullscreen=void 0;var r=p(n(/*! babel-runtime/core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js")),i=p(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),a=p(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),o=p(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),s=p(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=p(n(/*! babel-runtime/core-js/object/define-property */"./node_modules/babel-runtime/core-js/object/define-property.js")),u=p(n(/*! babel-runtime/core-js/object/get-own-property-descriptor */"./node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js"));t.assign=m,t.extend=g,t.formatTime=y,t.seekStringToSeconds=A,t.uniqueId=T,t.isNumber=w,t.currentScriptUrl=S,t.getBrowserLanguage=x,t.now=R,t.removeArrayItem=L,t.listContainsIgnoreCase=function(e,t){return void 0!==e&&void 0!==t&&void 0!==t.find((function(t){return e.toLowerCase()===t.toLowerCase()}))},t.canAutoPlayMedia=I,n(/*! ./polyfills */"./src/base/polyfills.js");var c=p(n(/*! ../components/browser */"./src/components/browser/index.js")),d=p(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js")),f=p(n(/*! ./media */"./src/base/media.js")),h=p(n(/*! ./svg_icons */"./src/base/svg_icons.js"));function p(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(t)for(var n in t){var r=(0,u.default)(t,n);r?(0,l.default)(e,n,r):e[n]=t[n]}return e}function g(e,t){var n=function(e){function n(){(0,a.default)(this,n);for(var r=arguments.length,i=Array(r),s=0;s<r;s++)i[s]=arguments[s];var l=(0,o.default)(this,e.call.apply(e,[this].concat(i)));return t.initialize&&t.initialize.apply(l,i),l}return(0,s.default)(n,e),n}(e);return m(n.prototype,t),n}function y(e,t){if(!isFinite(e))return"--:--";e*=1e3;var n=(e=parseInt(e/1e3))%60,r=(e=parseInt(e/60))%60,i=(e=parseInt(e/60))%24,a=parseInt(e/24),o="";return a&&a>0&&(o+=a+":",i<1&&(o+="00:")),(i&&i>0||t)&&(o+=("0"+i).slice(-2)+":"),o+=("0"+r).slice(-2)+":",(o+=("0"+n).slice(-2)).trim()}var v=t.Fullscreen={fullscreenElement:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},requestFullscreen:function(e){e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.querySelector&&e.querySelector("video")&&e.querySelector("video").webkitEnterFullScreen?e.querySelector("video").webkitEnterFullScreen():e.webkitEnterFullScreen&&e.webkitEnterFullScreen()},cancelFullscreen:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e.exitFullscreen?e.exitFullscreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.webkitExitFullscreen?e.webkitExitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.msExitFullscreen&&e.msExitFullscreen()},fullscreenEnabled:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},b=t.Config=function(){function e(){(0,a.default)(this,e)}return e._defaultConfig=function(){return{volume:{value:100,parse:parseInt}}},e._defaultValueFor=function(e){try{return this._defaultConfig()[e].parse(this._defaultConfig()[e].value)}catch(e){return}},e._createKeyspace=function(e){return"clappr."+document.domain+"."+e},e.restore=function(e){return c.default.hasLocalstorage&&localStorage[this._createKeyspace(e)]?this._defaultConfig()[e].parse(localStorage[this._createKeyspace(e)]):this._defaultValueFor(e)},e.persist=function(e,t){if(c.default.hasLocalstorage)try{return localStorage[this._createKeyspace(e)]=t,!0}catch(e){return!1}},e}(),_=t.QueryString=function(){function e(){(0,a.default)(this,e)}return e.parse=function(e){for(var t=void 0,n=/\+/g,r=/([^&=]+)=?([^&]*)/g,i=function(e){return decodeURIComponent(e.replace(n," "))},a={};t=r.exec(e);)a[i(t[1]).toLowerCase()]=i(t[2]);return a},(0,i.default)(e,null,[{key:"params",get:function(){var e=window.location.search.substring(1);return e!==this.query&&(this._urlParams=this.parse(e),this.query=e),this._urlParams}},{key:"hashParams",get:function(){var e=window.location.hash.substring(1);return e!==this.hash&&(this._hashParams=this.parse(e),this.hash=e),this._hashParams}}]),e}();function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"t",t=0,n=_.params[e]||_.hashParams[e]||"",r=n.match(/[0-9]+[hms]+/g)||[];if(r.length>0){var i={h:3600,m:60,s:1};r.forEach((function(e){if(e){var n=e[e.length-1],r=parseInt(e.slice(0,e.length-1),10);t+=r*i[n]}}))}else n&&(t=parseInt(n,10));return t}var E={};function T(e){return E[e]||(E[e]=0),e+ ++E[e]}function w(e){return e-parseFloat(e)+1>=0}function S(){var e=document.getElementsByTagName("script");return e.length?e[e.length-1].src:""}var k=t.requestAnimationFrame=(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}).bind(window),C=t.cancelAnimationFrame=(window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout).bind(window);function x(){return window.navigator&&window.navigator.language}function R(){return window.performance&&window.performance.now?performance.now():Date.now()}function L(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}function I(e,t){var n=(t=(0,r.default)({inline:!1,muted:!1,timeout:250,type:"video",source:f.default.mp4,element:null},t)).element?t.element:document.createElement(t.type);n.muted=t.muted,!0===t.muted&&n.setAttribute("muted","muted"),!0===t.inline&&n.setAttribute("playsinline","playsinline"),n.src=t.source;var i=n.play(),a=setTimeout((function(){o(!1,new Error("Timeout "+t.timeout+" ms has been reached"))}),t.timeout),o=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;clearTimeout(a),e(t,n)};void 0!==i?i.then((function(){return o(!0)})).catch((function(e){return o(!1,e)})):o(!0)}var P=[],j=t.DomRecycler=function(){function e(){(0,a.default)(this,e)}return e.configure=function(e){this.options=d.default.extend(this.options,e)},e.create=function(e){return this.options.recycleVideo&&"video"===e&&P.length>0?P.shift():(0,d.default)("<"+e+">")},e.garbage=function(e){this.options.recycleVideo&&"VIDEO"===e[0].tagName.toUpperCase()&&(e.children().remove(),P.push(e))},e}();j.options={recycleVideo:!1};var O=t.DoubleEventHandler=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;(0,a.default)(this,e),this.delay=t,this.lastTime=0}return e.prototype.handle=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=(new Date).getTime(),i=r-this.lastTime;i<this.delay&&i>0&&(t(),n&&e.preventDefault()),this.lastTime=r},e}();t.SvgIcons=h.default,t.default={Config:b,Fullscreen:v,QueryString:_,DomRecycler:j,extend:g,formatTime:y,seekStringToSeconds:A,uniqueId:T,currentScriptUrl:S,isNumber:w,requestAnimationFrame:k,cancelAnimationFrame:C,getBrowserLanguage:x,now:R,removeArrayItem:L,canAutoPlayMedia:I,Media:f.default,DoubleEventHandler:O,SvgIcons:h.default}},"./src/components/browser/browser.js": -/*!*******************************************!*\ - !*** ./src/components/browser/browser.js ***! - \*******************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDevice=t.getViewportSize=t.getOsData=t.getBrowserData=t.getBrowserInfo=void 0;var r=s(n(/*! babel-runtime/core-js/get-iterator */"./node_modules/babel-runtime/core-js/get-iterator.js")),i=s(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js")),a=s(n(/*! ./browser_data */"./src/components/browser/browser_data.js")),o=s(n(/*! ./os_data */"./src/components/browser/os_data.js"));function s(e){return e&&e.__esModule?e:{default:e}}var l={},u=t.getBrowserInfo=function(e){var t=e.match(/\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[],n=void 0;if(/trident/i.test(t[1]))return n=/\brv[ :]+(\d+)/g.exec(e)||[],{name:"IE",version:parseInt(n[1]||"")};if("Chrome"===t[1]){if(null!=(n=e.match(/\bOPR\/(\d+)/)))return{name:"Opera",version:parseInt(n[1])};if(null!=(n=e.match(/\bEdge\/(\d+)/)))return{name:"Edge",version:parseInt(n[1])}}else/android/i.test(e)&&(n=e.match(/version\/(\d+)/i))&&(t.splice(1,1,"Android WebView"),t.splice(2,1,n[1]));return{name:(t=t[2]?[t[1],t[2]]:[navigator.appName,navigator.appVersion,"-?"])[0],version:parseInt(t[1])}},c=t.getBrowserData=function(){var e={},t=l.userAgent.toLowerCase(),n=!0,i=!1,o=void 0;try{for(var s,u=(0,r.default)(a.default);!(n=(s=u.next()).done);n=!0){var c=s.value,f=new RegExp(c.identifier.toLowerCase()).exec(t);if(null!=f&&f[1]){if(e.name=c.name,e.group=c.group,c.versionIdentifier){var h=new RegExp(c.versionIdentifier.toLowerCase()).exec(t);null!=h&&h[1]&&d(h[1],e)}else d(f[1],e);break}}}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return e},d=function(e,t){var n=e.split(".",2);t.fullVersion=e,n[0]&&(t.majorVersion=parseInt(n[0])),n[1]&&(t.minorVersion=parseInt(n[1]))},f=t.getOsData=function(){var e={},t=l.userAgent.toLowerCase(),n=!0,i=!1,a=void 0;try{for(var s,u=(0,r.default)(o.default);!(n=(s=u.next()).done);n=!0){var c=s.value,d=new RegExp(c.identifier.toLowerCase()).exec(t);if(null!=d){if(e.name=c.name,e.group=c.group,c.version)h(c.version,c.versionSeparator?c.versionSeparator:".",e);else if(d[1])h(d[1],c.versionSeparator?c.versionSeparator:".",e);else if(c.versionIdentifier){var f=new RegExp(c.versionIdentifier.toLowerCase()).exec(t);null!=f&&f[1]&&h(f[1],c.versionSeparator?c.versionSeparator:".",e)}break}}}catch(e){i=!0,a=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw a}}return e},h=function(e,t,n){var r="["==t.substr(0,1)?new RegExp(t,"g"):t,i=e.split(r,2);"."!=t&&(e=e.replace(new RegExp(t,"g"),".")),n.fullVersion=e,i&&i[0]&&(n.majorVersion=parseInt(i[0])),i&&i[1]&&(n.minorVersion=parseInt(i[1]))},p=t.getViewportSize=function(){var e={};return e.width=(0,i.default)(window).width(),e.height=(0,i.default)(window).height(),e},m=t.getDevice=function(e){var t=/\((iP(?:hone|ad|od))?(?:[^;]*; ){0,2}([^)]+(?=\)))/.exec(e);return t&&(t[1]||t[2])||""},g=u(navigator.userAgent);l.isEdge=/edge/i.test(navigator.userAgent),l.isChrome=/chrome|CriOS/i.test(navigator.userAgent)&&!l.isEdge,l.isSafari=/safari/i.test(navigator.userAgent)&&!l.isChrome&&!l.isEdge,l.isFirefox=/firefox/i.test(navigator.userAgent),l.isLegacyIE=!!window.ActiveXObject,l.isIE=l.isLegacyIE||/trident.*rv:1\d/i.test(navigator.userAgent),l.isIE11=/trident.*rv:11/i.test(navigator.userAgent),l.isChromecast=l.isChrome&&/CrKey/i.test(navigator.userAgent),l.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Mobile Safari|Opera Mini/i.test(navigator.userAgent),l.isiOS=/iPad|iPhone|iPod/i.test(navigator.userAgent),l.isAndroid=/Android/i.test(navigator.userAgent),l.isWindowsPhone=/Windows Phone/i.test(navigator.userAgent),l.isWin8App=/MSAppHost/i.test(navigator.userAgent),l.isWiiU=/WiiU/i.test(navigator.userAgent),l.isPS4=/PlayStation 4/i.test(navigator.userAgent),l.hasLocalstorage=function(){try{return localStorage.setItem("clappr","clappr"),localStorage.removeItem("clappr"),!0}catch(e){return!1}}(),l.hasFlash=function(){try{return!!new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){return!(!navigator.mimeTypes||void 0===navigator.mimeTypes["application/x-shockwave-flash"]||!navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)}}(),l.name=g.name,l.version=g.version,l.userAgent=navigator.userAgent,l.data=c(),l.os=f(),l.viewport=p(),l.device=m(l.userAgent),void 0!==window.orientation&&function(){switch(window.orientation){case-90:case 90:l.viewport.orientation="landscape";break;default:l.viewport.orientation="portrait"}}(),t.default=l},"./src/components/browser/browser_data.js": -/*!************************************************!*\ - !*** ./src/components/browser/browser_data.js ***! - \************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=[{name:"Chromium",group:"Chrome",identifier:"Chromium/([0-9.]*)"},{name:"Chrome Mobile",group:"Chrome",identifier:"Chrome/([0-9.]*) Mobile",versionIdentifier:"Chrome/([0-9.]*)"},{name:"Chrome",group:"Chrome",identifier:"Chrome/([0-9.]*)"},{name:"Chrome for iOS",group:"Chrome",identifier:"CriOS/([0-9.]*)"},{name:"Android Browser",group:"Chrome",identifier:"CrMo/([0-9.]*)"},{name:"Firefox",group:"Firefox",identifier:"Firefox/([0-9.]*)"},{name:"Opera Mini",group:"Opera",identifier:"Opera Mini/([0-9.]*)"},{name:"Opera",group:"Opera",identifier:"Opera ([0-9.]*)"},{name:"Opera",group:"Opera",identifier:"Opera/([0-9.]*)",versionIdentifier:"Version/([0-9.]*)"},{name:"IEMobile",group:"Explorer",identifier:"IEMobile/([0-9.]*)"},{name:"Internet Explorer",group:"Explorer",identifier:"MSIE ([a-zA-Z0-9.]*)"},{name:"Internet Explorer",group:"Explorer",identifier:"Trident/([0-9.]*)",versionIdentifier:"rv:([0-9.]*)"},{name:"Spartan",group:"Spartan",identifier:"Edge/([0-9.]*)",versionIdentifier:"Edge/([0-9.]*)"},{name:"Safari",group:"Safari",identifier:"Safari/([0-9.]*)",versionIdentifier:"Version/([0-9.]*)"}],e.exports=t.default},"./src/components/browser/index.js": -/*!*****************************************!*\ - !*** ./src/components/browser/index.js ***! - \*****************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./browser */"./src/components/browser/browser.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/components/browser/os_data.js": -/*!*******************************************!*\ - !*** ./src/components/browser/os_data.js ***! - \*******************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=[{name:"Windows 2000",group:"Windows",identifier:"Windows NT 5.0",version:"5.0"},{name:"Windows XP",group:"Windows",identifier:"Windows NT 5.1",version:"5.1"},{name:"Windows Vista",group:"Windows",identifier:"Windows NT 6.0",version:"6.0"},{name:"Windows 7",group:"Windows",identifier:"Windows NT 6.1",version:"7.0"},{name:"Windows 8",group:"Windows",identifier:"Windows NT 6.2",version:"8.0"},{name:"Windows 8.1",group:"Windows",identifier:"Windows NT 6.3",version:"8.1"},{name:"Windows 10",group:"Windows",identifier:"Windows NT 10.0",version:"10.0"},{name:"Windows Phone",group:"Windows Phone",identifier:"Windows Phone ([0-9.]*)"},{name:"Windows Phone",group:"Windows Phone",identifier:"Windows Phone OS ([0-9.]*)"},{name:"Windows",group:"Windows",identifier:"Windows"},{name:"Chrome OS",group:"Chrome OS",identifier:"CrOS"},{name:"Android",group:"Android",identifier:"Android",versionIdentifier:"Android ([a-zA-Z0-9.-]*)"},{name:"iPad",group:"iOS",identifier:"iPad",versionIdentifier:"OS ([0-9_]*)",versionSeparator:"[_|.]"},{name:"iPod",group:"iOS",identifier:"iPod",versionIdentifier:"OS ([0-9_]*)",versionSeparator:"[_|.]"},{name:"iPhone",group:"iOS",identifier:"iPhone OS",versionIdentifier:"OS ([0-9_]*)",versionSeparator:"[_|.]"},{name:"Mac OS X High Sierra",group:"Mac OS",identifier:"Mac OS X (10([_|.])13([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Sierra",group:"Mac OS",identifier:"Mac OS X (10([_|.])12([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X El Capitan",group:"Mac OS",identifier:"Mac OS X (10([_|.])11([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Yosemite",group:"Mac OS",identifier:"Mac OS X (10([_|.])10([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Mavericks",group:"Mac OS",identifier:"Mac OS X (10([_|.])9([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Mountain Lion",group:"Mac OS",identifier:"Mac OS X (10([_|.])8([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Lion",group:"Mac OS",identifier:"Mac OS X (10([_|.])7([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Snow Leopard",group:"Mac OS",identifier:"Mac OS X (10([_|.])6([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Leopard",group:"Mac OS",identifier:"Mac OS X (10([_|.])5([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Tiger",group:"Mac OS",identifier:"Mac OS X (10([_|.])4([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Panther",group:"Mac OS",identifier:"Mac OS X (10([_|.])3([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Jaguar",group:"Mac OS",identifier:"Mac OS X (10([_|.])2([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Puma",group:"Mac OS",identifier:"Mac OS X (10([_|.])1([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Cheetah",group:"Mac OS",identifier:"Mac OS X (10([_|.])0([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS",group:"Mac OS",identifier:"Mac OS"},{name:"Ubuntu",group:"Linux",identifier:"Ubuntu",versionIdentifier:"Ubuntu/([0-9.]*)"},{name:"Debian",group:"Linux",identifier:"Debian"},{name:"Gentoo",group:"Linux",identifier:"Gentoo"},{name:"Linux",group:"Linux",identifier:"Linux"},{name:"BlackBerry",group:"BlackBerry",identifier:"BlackBerry"}],e.exports=t.default},"./src/components/container/container.js": -/*!***********************************************!*\ - !*** ./src/components/container/container.js ***! - \***********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=h(n(/*! babel-runtime/core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js")),i=h(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),a=h(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=h(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),s=h(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=h(n(/*! ../../base/events */"./src/base/events.js")),u=h(n(/*! ../../base/ui_object */"./src/base/ui_object.js")),c=h(n(/*! ../../base/error_mixin */"./src/base/error_mixin.js")),d=n(/*! ../../base/utils */"./src/base/utils.js");n(/*! ./public/style.scss */"./src/components/container/public/style.scss");var f=h(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js"));function h(e){return e&&e.__esModule?e:{default:e}}var p=function(e){function t(n,r,o){(0,i.default)(this,t);var s=(0,a.default)(this,e.call(this,n));return s._i18n=r,s.currentTime=0,s.volume=100,s.playback=n.playback,s.playerError=o,s.settings=f.default.extend({},s.playback.settings),s.isReady=!1,s.mediaControlDisabled=!1,s.plugins=[s.playback],s.dblTapHandler=new d.DoubleEventHandler(500),s.clickTimer=null,s.clickDelay=200,s.bindEvents(),s}return(0,s.default)(t,e),(0,o.default)(t,[{key:"name",get:function(){return"Container"}},{key:"attributes",get:function(){return{class:"container","data-container":""}}},{key:"events",get:function(){return{click:"clicked",dblclick:"dblClicked",touchend:"dblTap",contextmenu:"onContextMenu",mouseenter:"mouseEnter",mouseleave:"mouseLeave"}}},{key:"ended",get:function(){return this.playback.ended}},{key:"buffering",get:function(){return this.playback.buffering}},{key:"i18n",get:function(){return this._i18n}},{key:"hasClosedCaptionsTracks",get:function(){return this.playback.hasClosedCaptionsTracks}},{key:"closedCaptionsTracks",get:function(){return this.playback.closedCaptionsTracks}},{key:"closedCaptionsTrackId",get:function(){return this.playback.closedCaptionsTrackId},set:function(e){this.playback.closedCaptionsTrackId=e}}]),t.prototype.bindEvents=function(){this.listenTo(this.playback,l.default.PLAYBACK_PROGRESS,this.onProgress),this.listenTo(this.playback,l.default.PLAYBACK_TIMEUPDATE,this.timeUpdated),this.listenTo(this.playback,l.default.PLAYBACK_READY,this.ready),this.listenTo(this.playback,l.default.PLAYBACK_BUFFERING,this.onBuffering),this.listenTo(this.playback,l.default.PLAYBACK_BUFFERFULL,this.bufferfull),this.listenTo(this.playback,l.default.PLAYBACK_SETTINGSUPDATE,this.settingsUpdate),this.listenTo(this.playback,l.default.PLAYBACK_LOADEDMETADATA,this.loadedMetadata),this.listenTo(this.playback,l.default.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinitionUpdate),this.listenTo(this.playback,l.default.PLAYBACK_BITRATE,this.updateBitrate),this.listenTo(this.playback,l.default.PLAYBACK_PLAYBACKSTATE,this.playbackStateChanged),this.listenTo(this.playback,l.default.PLAYBACK_DVR,this.playbackDvrStateChanged),this.listenTo(this.playback,l.default.PLAYBACK_MEDIACONTROL_DISABLE,this.disableMediaControl),this.listenTo(this.playback,l.default.PLAYBACK_MEDIACONTROL_ENABLE,this.enableMediaControl),this.listenTo(this.playback,l.default.PLAYBACK_SEEKED,this.onSeeked),this.listenTo(this.playback,l.default.PLAYBACK_ENDED,this.onEnded),this.listenTo(this.playback,l.default.PLAYBACK_PLAY,this.playing),this.listenTo(this.playback,l.default.PLAYBACK_PAUSE,this.paused),this.listenTo(this.playback,l.default.PLAYBACK_STOP,this.stopped),this.listenTo(this.playback,l.default.PLAYBACK_ERROR,this.error),this.listenTo(this.playback,l.default.PLAYBACK_SUBTITLE_AVAILABLE,this.subtitleAvailable),this.listenTo(this.playback,l.default.PLAYBACK_SUBTITLE_CHANGED,this.subtitleChanged)},t.prototype.subtitleAvailable=function(){this.trigger(l.default.CONTAINER_SUBTITLE_AVAILABLE)},t.prototype.subtitleChanged=function(e){this.trigger(l.default.CONTAINER_SUBTITLE_CHANGED,e)},t.prototype.playbackStateChanged=function(e){this.trigger(l.default.CONTAINER_PLAYBACKSTATE,e)},t.prototype.playbackDvrStateChanged=function(e){this.settings=this.playback.settings,this.dvrInUse=e,this.trigger(l.default.CONTAINER_PLAYBACKDVRSTATECHANGED,e)},t.prototype.updateBitrate=function(e){this.trigger(l.default.CONTAINER_BITRATE,e)},t.prototype.statsReport=function(e){this.trigger(l.default.CONTAINER_STATS_REPORT,e)},t.prototype.getPlaybackType=function(){return this.playback.getPlaybackType()},t.prototype.isDvrEnabled=function(){return!!this.playback.dvrEnabled},t.prototype.isDvrInUse=function(){return!!this.dvrInUse},t.prototype.destroy=function(){this.trigger(l.default.CONTAINER_DESTROYED,this,this.name),this.stopListening(),this.plugins.forEach((function(e){return e.destroy()})),this.$el.remove()},t.prototype.setStyle=function(e){this.$el.css(e)},t.prototype.animate=function(e,t){return this.$el.animate(e,t).promise()},t.prototype.ready=function(){this.isReady=!0,this.trigger(l.default.CONTAINER_READY,this.name)},t.prototype.isPlaying=function(){return this.playback.isPlaying()},t.prototype.getStartTimeOffset=function(){return this.playback.getStartTimeOffset()},t.prototype.getCurrentTime=function(){return this.currentTime},t.prototype.getDuration=function(){return this.playback.getDuration()},t.prototype.error=function(e){this.isReady||this.ready(),this.trigger(l.default.CONTAINER_ERROR,e,this.name)},t.prototype.loadedMetadata=function(e){this.trigger(l.default.CONTAINER_LOADEDMETADATA,e)},t.prototype.timeUpdated=function(e){this.currentTime=e.current,this.trigger(l.default.CONTAINER_TIMEUPDATE,e,this.name)},t.prototype.onProgress=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.trigger.apply(this,[l.default.CONTAINER_PROGRESS].concat(t,[this.name]))},t.prototype.playing=function(){this.trigger(l.default.CONTAINER_PLAY,this.name)},t.prototype.paused=function(){this.trigger(l.default.CONTAINER_PAUSE,this.name)},t.prototype.play=function(){this.playback.play()},t.prototype.stop=function(){this.playback.stop(),this.currentTime=0},t.prototype.pause=function(){this.playback.pause()},t.prototype.onEnded=function(){this.trigger(l.default.CONTAINER_ENDED,this,this.name),this.currentTime=0},t.prototype.stopped=function(){this.trigger(l.default.CONTAINER_STOP)},t.prototype.clicked=function(){var e=this;this.options.chromeless&&!this.options.allowUserInteraction||(this.clickTimer=setTimeout((function(){e.clickTimer&&e.trigger(l.default.CONTAINER_CLICK,e,e.name)}),this.clickDelay))},t.prototype.cancelClicked=function(){clearTimeout(this.clickTimer),this.clickTimer=null},t.prototype.dblClicked=function(){this.options.chromeless&&!this.options.allowUserInteraction||(this.cancelClicked(),this.trigger(l.default.CONTAINER_DBLCLICK,this,this.name))},t.prototype.dblTap=function(e){var t=this;this.options.chromeless&&!this.options.allowUserInteraction||this.dblTapHandler.handle(e,(function(){t.cancelClicked(),t.trigger(l.default.CONTAINER_DBLCLICK,t,t.name)}))},t.prototype.onContextMenu=function(e){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(l.default.CONTAINER_CONTEXTMENU,e,this.name)},t.prototype.seek=function(e){this.trigger(l.default.CONTAINER_SEEK,e,this.name),this.playback.seek(e)},t.prototype.onSeeked=function(){this.trigger(l.default.CONTAINER_SEEKED,this.name)},t.prototype.seekPercentage=function(e){var t=this.getDuration();if(e>=0&&e<=100){var n=t*(e/100);this.seek(n)}},t.prototype.setVolume=function(e){this.volume=parseFloat(e),this.trigger(l.default.CONTAINER_VOLUME,this.volume,this.name),this.playback.volume(this.volume)},t.prototype.fullscreen=function(){this.trigger(l.default.CONTAINER_FULLSCREEN,this.name)},t.prototype.onBuffering=function(){this.trigger(l.default.CONTAINER_STATE_BUFFERING,this.name)},t.prototype.bufferfull=function(){this.trigger(l.default.CONTAINER_STATE_BUFFERFULL,this.name)},t.prototype.addPlugin=function(e){this.plugins.push(e)},t.prototype.hasPlugin=function(e){return!!this.getPlugin(e)},t.prototype.getPlugin=function(e){return this.plugins.filter((function(t){return t.name===e}))[0]},t.prototype.mouseEnter=function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(l.default.CONTAINER_MOUSE_ENTER)},t.prototype.mouseLeave=function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(l.default.CONTAINER_MOUSE_LEAVE)},t.prototype.settingsUpdate=function(){this.settings=this.playback.settings,this.trigger(l.default.CONTAINER_SETTINGSUPDATE)},t.prototype.highDefinitionUpdate=function(e){this.trigger(l.default.CONTAINER_HIGHDEFINITIONUPDATE,e)},t.prototype.isHighDefinitionInUse=function(){return this.playback.isHighDefinitionInUse()},t.prototype.disableMediaControl=function(){this.mediaControlDisabled||(this.mediaControlDisabled=!0,this.trigger(l.default.CONTAINER_MEDIACONTROL_DISABLE))},t.prototype.enableMediaControl=function(){this.mediaControlDisabled&&(this.mediaControlDisabled=!1,this.trigger(l.default.CONTAINER_MEDIACONTROL_ENABLE))},t.prototype.updateStyle=function(){!this.options.chromeless||this.options.allowUserInteraction?this.$el.removeClass("chromeless"):this.$el.addClass("chromeless")},t.prototype.configure=function(e){this._options=f.default.extend(this._options,e),this.updateStyle(),this.playback.configure(this.options),this.trigger(l.default.CONTAINER_OPTIONS_CHANGE)},t.prototype.render=function(){return this.$el.append(this.playback.render().el),this.updateStyle(),this},t}(u.default);t.default=p,(0,r.default)(p.prototype,c.default),e.exports=t.default},"./src/components/container/index.js": -/*!*******************************************!*\ - !*** ./src/components/container/index.js ***! - \*******************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./container */"./src/components/container/container.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/components/container/public/style.scss": -/*!****************************************************!*\ - !*** ./src/components/container/public/style.scss ***! - \****************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/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/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/components/container/public/style.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/components/container_factory/container_factory.js": -/*!***************************************************************!*\ - !*** ./src/components/container_factory/container_factory.js ***! - \***************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=f(n(/*! babel-runtime/helpers/typeof */"./node_modules/babel-runtime/helpers/typeof.js")),i=f(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),a=f(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=f(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),s=f(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=f(n(/*! ../../base/base_object */"./src/base/base_object.js")),u=f(n(/*! ../../base/events */"./src/base/events.js")),c=f(n(/*! ../../components/container */"./src/components/container/index.js")),d=f(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js"));function f(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(n,r,o,s){(0,i.default)(this,t);var l=(0,a.default)(this,e.call(this,n));return l._i18n=o,l.loader=r,l.playerError=s,l}return(0,s.default)(t,e),(0,o.default)(t,[{key:"options",get:function(){return this._options},set:function(e){this._options=e}}]),t.prototype.createContainers=function(){var e=this;return d.default.Deferred((function(t){t.resolve(e.options.sources.map((function(t){return e.createContainer(t)})))}))},t.prototype.findPlaybackPlugin=function(e,t){return this.loader.playbackPlugins.filter((function(n){return n.canPlay(e,t)}))[0]},t.prototype.createContainer=function(e){var t=null,n=this.options.mimeType;"object"===(void 0===e?"undefined":(0,r.default)(e))?(t=e.source.toString(),e.mimeType&&(n=e.mimeType)):t=e.toString(),t.match(/^\/\//)&&(t=window.location.protocol+t);var i=d.default.extend({},this.options,{src:t,mimeType:n}),a=new(this.findPlaybackPlugin(t,n))(i,this._i18n,this.playerError);i=d.default.extend({},i,{playback:a});var o=new c.default(i,this._i18n,this.playerError),s=d.default.Deferred();return s.promise(o),this.addContainerPlugins(o),this.listenToOnce(o,u.default.CONTAINER_READY,(function(){return s.resolve(o)})),o},t.prototype.addContainerPlugins=function(e){this.loader.containerPlugins.forEach((function(t){e.addPlugin(new t(e))}))},t}(l.default);t.default=h,e.exports=t.default},"./src/components/container_factory/index.js": -/*!***************************************************!*\ - !*** ./src/components/container_factory/index.js ***! - \***************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./container_factory */"./src/components/container_factory/container_factory.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/components/core/core.js": -/*!*************************************!*\ - !*** ./src/components/core/core.js ***! - \*************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=A(n(/*! babel-runtime/core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js")),i=A(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),a=A(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=A(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),s=A(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=n(/*! ../../base/utils */"./src/base/utils.js"),u=A(n(/*! ../../base/styler */"./src/base/styler.js")),c=A(n(/*! ../../base/events */"./src/base/events.js")),d=A(n(/*! ../../base/ui_object */"./src/base/ui_object.js")),f=A(n(/*! ../../base/ui_core_plugin */"./src/base/ui_core_plugin.js")),h=A(n(/*! ../../components/browser */"./src/components/browser/index.js")),p=A(n(/*! ../../components/container_factory */"./src/components/container_factory/index.js")),m=A(n(/*! ../../components/mediator */"./src/components/mediator.js")),g=A(n(/*! ../../components/player_info */"./src/components/player_info.js")),y=A(n(/*! ../../components/error */"./src/components/error/index.js")),v=A(n(/*! ../../base/error_mixin */"./src/base/error_mixin.js")),b=A(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js"));n(/*! ./public/style.scss */"./src/components/core/public/style.scss");var _=A(n(/*! ./public/fonts.css */"./src/components/core/public/fonts.css"));function A(e){return e&&e.__esModule?e:{default:e}}var E=void 0,T=function(e){function t(n){(0,i.default)(this,t);var r=(0,a.default)(this,e.call(this,n));return r.playerError=new y.default(n,r),r.configureDomRecycler(),r.playerInfo=g.default.getInstance(n.playerId),r.firstResize=!0,r.plugins=[],r.containers=[],r._boundFullscreenHandler=function(){return r.handleFullscreenChange()},(0,b.default)(document).bind("fullscreenchange",r._boundFullscreenHandler),(0,b.default)(document).bind("MSFullscreenChange",r._boundFullscreenHandler),(0,b.default)(document).bind("mozfullscreenchange",r._boundFullscreenHandler),h.default.isMobile&&(0,b.default)(window).bind("resize",(function(e){r.handleWindowResize(e)})),r}return(0,s.default)(t,e),(0,o.default)(t,[{key:"events",get:function(){return{webkitfullscreenchange:"handleFullscreenChange",mousemove:"onMouseMove",mouseleave:"onMouseLeave"}}},{key:"attributes",get:function(){return{"data-player":"",tabindex:9999}}},{key:"isReady",get:function(){return!!this.ready}},{key:"i18n",get:function(){return this.getPlugin("strings")||{t:function(e){return e}}}},{key:"mediaControl",get:function(){return this.getPlugin("media_control")||this.dummyMediaControl}},{key:"dummyMediaControl",get:function(){return this._dummyMediaControl||(this._dummyMediaControl=new f.default(this)),this._dummyMediaControl}},{key:"activeContainer",get:function(){return this._activeContainer},set:function(e){this._activeContainer=e,this.trigger(c.default.CORE_ACTIVE_CONTAINER_CHANGED,this._activeContainer)}},{key:"activePlayback",get:function(){return this.activeContainer&&this.activeContainer.playback}}]),t.prototype.configureDomRecycler=function(){var e=this.options&&this.options.playback&&this.options.playback.recycleVideo;l.DomRecycler.configure({recycleVideo:e})},t.prototype.createContainers=function(e){this.defer=b.default.Deferred(),this.defer.promise(this),this.containerFactory=new p.default(e,e.loader,this.i18n,this.playerError),this.prepareContainers()},t.prototype.prepareContainers=function(){var e=this;this.containerFactory.createContainers().then((function(t){return e.setupContainers(t)})).then((function(t){return e.resolveOnContainersReady(t)}))},t.prototype.updateSize=function(){this.isFullscreen()?this.setFullscreen():this.setPlayerSize()},t.prototype.setFullscreen=function(){h.default.isiOS||(this.$el.addClass("fullscreen"),this.$el.removeAttr("style"),this.playerInfo.previousSize={width:this.options.width,height:this.options.height},this.playerInfo.currentSize={width:(0,b.default)(window).width(),height:(0,b.default)(window).height()})},t.prototype.setPlayerSize=function(){this.$el.removeClass("fullscreen"),this.playerInfo.currentSize=this.playerInfo.previousSize,this.playerInfo.previousSize={width:(0,b.default)(window).width(),height:(0,b.default)(window).height()},this.resize(this.playerInfo.currentSize)},t.prototype.resize=function(e){(0,l.isNumber)(e.height)||(0,l.isNumber)(e.width)?(this.el.style.height=e.height+"px",this.el.style.width=e.width+"px"):(this.el.style.height=""+e.height,this.el.style.width=""+e.width),this.playerInfo.previousSize={width:this.options.width,height:this.options.height},this.options.width=e.width,this.options.height=e.height,this.playerInfo.currentSize=e,this.triggerResize(this.playerInfo.currentSize)},t.prototype.enableResizeObserver=function(){var e=this;this.resizeObserverInterval=setInterval((function(){e.triggerResize({width:e.el.clientWidth,height:e.el.clientHeight})}),500)},t.prototype.triggerResize=function(e){(this.firstResize||this.oldHeight!==e.height||this.oldWidth!==e.width)&&(this.oldHeight=e.height,this.oldWidth=e.width,this.playerInfo.computedSize=e,this.firstResize=!1,m.default.trigger(this.options.playerId+":"+c.default.PLAYER_RESIZE,e),this.trigger(c.default.CORE_RESIZE,e))},t.prototype.disableResizeObserver=function(){this.resizeObserverInterval&&clearInterval(this.resizeObserverInterval)},t.prototype.resolveOnContainersReady=function(e){var t=this;b.default.when.apply(b.default,e).done((function(){t.defer.resolve(t),t.ready=!0,t.trigger(c.default.CORE_READY)}))},t.prototype.addPlugin=function(e){this.plugins.push(e)},t.prototype.hasPlugin=function(e){return!!this.getPlugin(e)},t.prototype.getPlugin=function(e){return this.plugins.filter((function(t){return t.name===e}))[0]},t.prototype.load=function(e,t){this.options.mimeType=t,e=e&&e.constructor===Array?e:[e],this.options.sources=e,this.containers.forEach((function(e){return e.destroy()})),this.containerFactory.options=b.default.extend(this.options,{sources:e}),this.prepareContainers()},t.prototype.destroy=function(){this.disableResizeObserver(),this.containers.forEach((function(e){return e.destroy()})),this.plugins.forEach((function(e){return e.destroy()})),this.$el.remove(),(0,b.default)(document).unbind("fullscreenchange",this._boundFullscreenHandler),(0,b.default)(document).unbind("MSFullscreenChange",this._boundFullscreenHandler),(0,b.default)(document).unbind("mozfullscreenchange",this._boundFullscreenHandler),this.stopListening()},t.prototype.handleFullscreenChange=function(){this.trigger(c.default.CORE_FULLSCREEN,this.isFullscreen()),this.updateSize()},t.prototype.handleWindowResize=function(e){var t=window.innerWidth>window.innerHeight?"landscape":"portrait";this._screenOrientation!==t&&(this._screenOrientation=t,this.triggerResize({width:this.el.clientWidth,height:this.el.clientHeight}),this.trigger(c.default.CORE_SCREEN_ORIENTATION_CHANGED,{event:e,orientation:this._screenOrientation}))},t.prototype.removeContainer=function(e){this.stopListening(e),this.containers=this.containers.filter((function(t){return t!==e}))},t.prototype.setupContainer=function(e){this.listenTo(e,c.default.CONTAINER_DESTROYED,this.removeContainer),this.containers.push(e)},t.prototype.setupContainers=function(e){return e.forEach(this.setupContainer.bind(this)),this.trigger(c.default.CORE_CONTAINERS_CREATED),this.renderContainers(),this.activeContainer=e[0],this.render(),this.appendToParent(),this.containers},t.prototype.renderContainers=function(){var e=this;this.containers.forEach((function(t){return e.el.appendChild(t.render().el)}))},t.prototype.createContainer=function(e,t){var n=this.containerFactory.createContainer(e,t);return this.setupContainer(n),this.el.appendChild(n.render().el),n},t.prototype.getCurrentContainer=function(){return this.activeContainer},t.prototype.getCurrentPlayback=function(){return this.activePlayback},t.prototype.getPlaybackType=function(){return this.activeContainer&&this.activeContainer.getPlaybackType()},t.prototype.isFullscreen=function(){var e=h.default.isiOS&&this.activeContainer&&this.activeContainer.el||this.el;return l.Fullscreen.fullscreenElement()===e},t.prototype.toggleFullscreen=function(){this.isFullscreen()?(l.Fullscreen.cancelFullscreen(),!h.default.isiOS&&this.$el.removeClass("fullscreen nocursor")):(l.Fullscreen.requestFullscreen(h.default.isiOS?this.activeContainer.el:this.el),!h.default.isiOS&&this.$el.addClass("fullscreen"))},t.prototype.onMouseMove=function(e){this.trigger(c.default.CORE_MOUSE_MOVE,e)},t.prototype.onMouseLeave=function(e){this.trigger(c.default.CORE_MOUSE_LEAVE,e)},t.prototype.configure=function(e){var t=this;this._options=b.default.extend(this._options,e),this.configureDomRecycler();var n=e.source||e.sources;n&&this.load(n,e.mimeType||this.options.mimeType),this.trigger(c.default.CORE_OPTIONS_CHANGE,e),this.containers.forEach((function(e){return e.configure(t.options)}))},t.prototype.appendToParent=function(){(!this.$el.parent()||!this.$el.parent().length)&&this.$el.appendTo(this.options.parentElement)},t.prototype.render=function(){E||(E=u.default.getStyleFor(_.default,{baseUrl:this.options.baseUrl})),(0,b.default)("head").append(E),this.options.width=this.options.width||this.$el.width(),this.options.height=this.options.height||this.$el.height();var e={width:this.options.width,height:this.options.height};return this.playerInfo.previousSize=this.playerInfo.currentSize=this.playerInfo.computedSize=e,this.updateSize(),this.previousSize={width:this.$el.width(),height:this.$el.height()},this.enableResizeObserver(),this},t}(d.default);t.default=T,(0,r.default)(T.prototype,v.default),e.exports=t.default},"./src/components/core/index.js": -/*!**************************************!*\ - !*** ./src/components/core/index.js ***! - \**************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./core */"./src/components/core/core.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/components/core/public/Roboto.ttf": -/*!***********************************************!*\ - !*** ./src/components/core/public/Roboto.ttf ***! - \***********************************************/ -/*! no static exports found */function(e,t){e.exports="<%=baseUrl%>/38861cba61c66739c1452c3a71e39852.ttf"},"./src/components/core/public/fonts.css": -/*!**********************************************!*\ - !*** ./src/components/core/public/fonts.css ***! - \**********************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! ../../../../node_modules/css-loader/lib/url/escape.js */"./node_modules/css-loader/lib/url/escape.js");(e.exports=n(/*! ../../../../node_modules/css-loader/lib/css-base.js */"./node_modules/css-loader/lib/css-base.js")(!1)).push([e.i,'@font-face {\n font-family: "Roboto";\n font-style: normal;\n font-weight: 400;\n src: local("Roboto"), local("Roboto-Regular"), url('+r(n(/*! ./Roboto.ttf */"./src/components/core/public/Roboto.ttf"))+') format("truetype");\n}\n',""])},"./src/components/core/public/style.scss": -/*!***********************************************!*\ - !*** ./src/components/core/public/style.scss ***! - \***********************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/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/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/components/core/public/style.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/components/core_factory/core_factory.js": -/*!*****************************************************!*\ - !*** ./src/components/core_factory/core_factory.js ***! - \*****************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=u(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=u(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=u(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=u(n(/*! ../../base/base_object */"./src/base/base_object.js")),l=u(n(/*! ../core */"./src/components/core/index.js"));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this));return a.player=n,a._options=n.options,a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"loader",get:function(){return this.player.loader}}]),t.prototype.create=function(){return this.options.loader=this.loader,this.core=new l.default(this.options),this.addCorePlugins(),this.core.createContainers(this.options),this.core},t.prototype.addCorePlugins=function(){var e=this;return this.loader.corePlugins.forEach((function(t){var n=new t(e.core);e.core.addPlugin(n),e.setupExternalInterface(n)})),this.core},t.prototype.setupExternalInterface=function(e){var t=e.getExternalInterface();for(var n in t)this.player[n]=t[n].bind(e),this.core[n]=t[n].bind(e)},t}(s.default);t.default=c,e.exports=t.default},"./src/components/core_factory/index.js": -/*!**********************************************!*\ - !*** ./src/components/core_factory/index.js ***! - \**********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./core_factory */"./src/components/core_factory/core_factory.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/components/error/error.js": -/*!***************************************!*\ - !*** ./src/components/error/error.js ***! - \***************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=c(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=c(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=c(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=c(n(/*! ../../base/events */"./src/base/events.js")),l=c(n(/*! ../../base/base_object */"./src/base/base_object.js")),u=c(n(/*! ../../plugins/log */"./src/plugins/log/index.js"));function c(e){return e&&e.__esModule?e:{default:e}}var d=function(e){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments[1];(0,r.default)(this,t);var o=(0,i.default)(this,e.call(this,n));return o.core=a,o}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"error"}}],[{key:"Levels",get:function(){return{FATAL:"FATAL",WARN:"WARN",INFO:"INFO"}}}]),t.prototype.createError=function(e){this.core?this.core.trigger(s.default.ERROR,e):u.default.warn(this.name,"Core is not set. Error: ",e)},t}(l.default);t.default=d,e.exports=t.default},"./src/components/error/index.js": -/*!***************************************!*\ - !*** ./src/components/error/index.js ***! - \***************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./error */"./src/components/error/error.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/components/loader/index.js": -/*!****************************************!*\ - !*** ./src/components/loader/index.js ***! - \****************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./loader */"./src/components/loader/loader.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/components/loader/loader.js": -/*!*****************************************!*\ - !*** ./src/components/loader/loader.js ***! - \*****************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=P(n(/*! babel-runtime/core-js/object/create */"./node_modules/babel-runtime/core-js/object/create.js")),i=P(n(/*! babel-runtime/helpers/toConsumableArray */"./node_modules/babel-runtime/helpers/toConsumableArray.js")),a=P(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),o=P(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),s=P(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=P(n(/*! ../../base/base_object */"./src/base/base_object.js")),u=P(n(/*! ../player_info */"./src/components/player_info.js")),c=P(n(/*! ../../playbacks/html5_video */"./src/playbacks/html5_video/index.js")),d=P(n(/*! ../../playbacks/flash */"./src/playbacks/flash/index.js")),f=P(n(/*! ../../playbacks/html5_audio */"./src/playbacks/html5_audio/index.js")),h=P(n(/*! ../../playbacks/flashls */"./src/playbacks/flashls/index.js")),p=P(n(/*! ../../playbacks/hls */"./src/playbacks/hls/index.js")),m=P(n(/*! ../../playbacks/html_img */"./src/playbacks/html_img/index.js")),g=P(n(/*! ../../playbacks/no_op */"./src/playbacks/no_op/index.js")),y=P(n(/*! ../../plugins/spinner_three_bounce */"./src/plugins/spinner_three_bounce/index.js")),v=P(n(/*! ../../plugins/stats */"./src/plugins/stats/index.js")),b=P(n(/*! ../../plugins/watermark */"./src/plugins/watermark/index.js")),_=P(n(/*! ../../plugins/poster */"./src/plugins/poster/index.js")),A=P(n(/*! ../../plugins/google_analytics */"./src/plugins/google_analytics/index.js")),E=P(n(/*! ../../plugins/click_to_pause */"./src/plugins/click_to_pause/index.js")),T=P(n(/*! ../../plugins/media_control */"./src/plugins/media_control/index.js")),w=P(n(/*! ../../plugins/dvr_controls */"./src/plugins/dvr_controls/index.js")),S=P(n(/*! ../../plugins/closed_captions */"./src/plugins/closed_captions/index.js")),k=P(n(/*! ../../plugins/favicon */"./src/plugins/favicon/index.js")),C=P(n(/*! ../../plugins/seek_time */"./src/plugins/seek_time/index.js")),x=P(n(/*! ../../plugins/sources */"./src/plugins/sources.js")),R=P(n(/*! ../../plugins/end_video */"./src/plugins/end_video.js")),L=P(n(/*! ../../plugins/strings */"./src/plugins/strings.js")),I=P(n(/*! ../../plugins/error_screen */"./src/plugins/error_screen/index.js"));function P(e){return e&&e.__esModule?e:{default:e}}var j=function(e){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,a.default)(this,t);var l=(0,o.default)(this,e.call(this));return l.playerId=r,l.playbackPlugins=[],s||(l.playbackPlugins=[].concat((0,i.default)(l.playbackPlugins),[p.default])),l.playbackPlugins=[].concat((0,i.default)(l.playbackPlugins),[c.default,f.default]),s||(l.playbackPlugins=[].concat((0,i.default)(l.playbackPlugins),[d.default,h.default])),l.playbackPlugins=[].concat((0,i.default)(l.playbackPlugins),[m.default,g.default]),l.containerPlugins=[y.default,b.default,_.default,v.default,A.default,E.default],l.corePlugins=[T.default,w.default,S.default,k.default,C.default,x.default,R.default,I.default,L.default],Array.isArray(n)||l.validateExternalPluginsType(n),l.addExternalPlugins(n),l}return(0,s.default)(t,e),t.prototype.groupPluginsByType=function(e){return Array.isArray(e)&&(e=e.reduce((function(e,t){return e[t.type]||(e[t.type]=[]),e[t.type].push(t),e}),{})),e},t.prototype.removeDups=function(e){var t=e.reduceRight((function(e,t){return e[t.prototype.name]&&delete e[t.prototype.name],e[t.prototype.name]=t,e}),(0,r.default)(null)),n=[];for(var i in t)n.unshift(t[i]);return n},t.prototype.addExternalPlugins=function(e){(e=this.groupPluginsByType(e)).playback&&(this.playbackPlugins=this.removeDups(e.playback.concat(this.playbackPlugins))),e.container&&(this.containerPlugins=this.removeDups(e.container.concat(this.containerPlugins))),e.core&&(this.corePlugins=this.removeDups(e.core.concat(this.corePlugins))),u.default.getInstance(this.playerId).playbackPlugins=this.playbackPlugins},t.prototype.validateExternalPluginsType=function(e){["playback","container","core"].forEach((function(t){(e[t]||[]).forEach((function(e){var n="external "+e.type+" plugin on "+t+" array";if(e.type!==t)throw new ReferenceError(n)}))}))},t}(l.default);t.default=j,e.exports=t.default},"./src/components/mediator.js": -/*!************************************!*\ - !*** ./src/components/mediator.js ***! - \************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js"));function i(e){return e&&e.__esModule?e:{default:e}}var a=new(i(n(/*! ../base/events */"./src/base/events.js")).default),o=function e(){(0,r.default)(this,e)};t.default=o,o.on=function(e,t,n){a.on(e,t,n)},o.once=function(e,t,n){a.once(e,t,n)},o.off=function(e,t,n){a.off(e,t,n)},o.trigger=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];a.trigger.apply(a,[e].concat(n))},o.stopListening=function(e,t,n){a.stopListening(e,t,n)},e.exports=t.default},"./src/components/player.js": -/*!**********************************!*\ - !*** ./src/components/player.js ***! - \**********************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=v(n(/*! babel-runtime/core-js/object/assign */"./node_modules/babel-runtime/core-js/object/assign.js")),i=v(n(/*! babel-runtime/core-js/object/keys */"./node_modules/babel-runtime/core-js/object/keys.js")),a=v(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),o=v(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),s=v(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),l=v(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),u=n(/*! ../base/utils */"./src/base/utils.js"),c=v(n(/*! ../base/base_object */"./src/base/base_object.js")),d=v(n(/*! ../base/events */"./src/base/events.js")),f=v(n(/*! ./browser */"./src/components/browser/index.js")),h=v(n(/*! ./core_factory */"./src/components/core_factory/index.js")),p=v(n(/*! ./loader */"./src/components/loader/index.js")),m=v(n(/*! ./player_info */"./src/components/player_info.js")),g=v(n(/*! ../base/error_mixin */"./src/base/error_mixin.js")),y=v(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js"));function v(e){return e&&e.__esModule?e:{default:e}}var b=(0,u.currentScriptUrl)().replace(/\/[^/]+$/,""),_=function(e){function t(n){(0,a.default)(this,t);var r=(0,o.default)(this,e.call(this,n)),i={playerId:(0,u.uniqueId)(""),persistConfig:!0,width:640,height:360,baseUrl:b,allowUserInteraction:f.default.isMobile,playback:{recycleVideo:!0}};return r._options=y.default.extend(i,n),r.options.sources=r._normalizeSources(n),r.options.chromeless||(r.options.allowUserInteraction=!0),r.options.allowUserInteraction||(r.options.disableKeyboardShortcuts=!0),r._registerOptionEventListeners(r.options.events),r._coreFactory=new h.default(r),r.playerInfo=m.default.getInstance(r.options.playerId),r.playerInfo.currentSize={width:n.width,height:n.height},r.playerInfo.options=r.options,r.options.parentId?r.setParentId(r.options.parentId):r.options.parent&&r.attachTo(r.options.parent),r}return(0,l.default)(t,e),(0,s.default)(t,[{key:"loader",set:function(e){this._loader=e},get:function(){return this._loader||(this._loader=new p.default(this.options.plugins||{},this.options.playerId)),this._loader}},{key:"ended",get:function(){return this.core.activeContainer.ended}},{key:"buffering",get:function(){return this.core.activeContainer.buffering}},{key:"isReady",get:function(){return!!this._ready}},{key:"eventsMapping",get:function(){return{onReady:d.default.PLAYER_READY,onResize:d.default.PLAYER_RESIZE,onPlay:d.default.PLAYER_PLAY,onPause:d.default.PLAYER_PAUSE,onStop:d.default.PLAYER_STOP,onEnded:d.default.PLAYER_ENDED,onSeek:d.default.PLAYER_SEEK,onError:d.default.PLAYER_ERROR,onTimeUpdate:d.default.PLAYER_TIMEUPDATE,onVolumeUpdate:d.default.PLAYER_VOLUMEUPDATE,onSubtitleAvailable:d.default.PLAYER_SUBTITLE_AVAILABLE}}}]),t.prototype.setParentId=function(e){var t=document.querySelector(e);return t&&this.attachTo(t),this},t.prototype.attachTo=function(e){return this.options.parentElement=e,this.core=this._coreFactory.create(),this._addEventListeners(),this},t.prototype._addEventListeners=function(){return this.core.isReady?this._onReady():this.listenToOnce(this.core,d.default.CORE_READY,this._onReady),this.listenTo(this.core,d.default.CORE_ACTIVE_CONTAINER_CHANGED,this._containerChanged),this.listenTo(this.core,d.default.CORE_FULLSCREEN,this._onFullscreenChange),this.listenTo(this.core,d.default.CORE_RESIZE,this._onResize),this},t.prototype._addContainerEventListeners=function(){var e=this.core.activeContainer;return e&&(this.listenTo(e,d.default.CONTAINER_PLAY,this._onPlay),this.listenTo(e,d.default.CONTAINER_PAUSE,this._onPause),this.listenTo(e,d.default.CONTAINER_STOP,this._onStop),this.listenTo(e,d.default.CONTAINER_ENDED,this._onEnded),this.listenTo(e,d.default.CONTAINER_SEEK,this._onSeek),this.listenTo(e,d.default.CONTAINER_ERROR,this._onError),this.listenTo(e,d.default.CONTAINER_TIMEUPDATE,this._onTimeUpdate),this.listenTo(e,d.default.CONTAINER_VOLUME,this._onVolumeUpdate),this.listenTo(e,d.default.CONTAINER_SUBTITLE_AVAILABLE,this._onSubtitleAvailable)),this},t.prototype._registerOptionEventListeners=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,i.default)(t).length>0;return r&&(0,i.default)(n).forEach((function(t){var r=e.eventsMapping[t];r&&e.off(r,n[t])})),(0,i.default)(t).forEach((function(n){var r=e.eventsMapping[n];if(r){var i=t[n];(i="function"==typeof i&&i)&&e.on(r,i)}})),this},t.prototype._containerChanged=function(){this.stopListening(),this._addEventListeners()},t.prototype._onReady=function(){this._ready=!0,this._addContainerEventListeners(),this.trigger(d.default.PLAYER_READY)},t.prototype._onFullscreenChange=function(e){this.trigger(d.default.PLAYER_FULLSCREEN,e)},t.prototype._onVolumeUpdate=function(e){this.trigger(d.default.PLAYER_VOLUMEUPDATE,e)},t.prototype._onSubtitleAvailable=function(){this.trigger(d.default.PLAYER_SUBTITLE_AVAILABLE)},t.prototype._onResize=function(e){this.trigger(d.default.PLAYER_RESIZE,e)},t.prototype._onPlay=function(){this.trigger(d.default.PLAYER_PLAY)},t.prototype._onPause=function(){this.trigger(d.default.PLAYER_PAUSE)},t.prototype._onStop=function(){this.trigger(d.default.PLAYER_STOP,this.getCurrentTime())},t.prototype._onEnded=function(){this.trigger(d.default.PLAYER_ENDED)},t.prototype._onSeek=function(e){this.trigger(d.default.PLAYER_SEEK,e)},t.prototype._onTimeUpdate=function(e){this.trigger(d.default.PLAYER_TIMEUPDATE,e)},t.prototype._onError=function(e){this.trigger(d.default.PLAYER_ERROR,e)},t.prototype._normalizeSources=function(e){var t=e.sources||(void 0!==e.source?[e.source]:[]);return 0===t.length?[{source:"",mimeType:""}]:t},t.prototype.resize=function(e){return this.core.resize(e),this},t.prototype.load=function(e,t,n){return void 0!==n&&this.configure({autoPlay:!!n}),this.core.load(e,t),this},t.prototype.destroy=function(){return this.stopListening(),this.core.destroy(),this},t.prototype.consent=function(){return this.core.getCurrentPlayback().consent(),this},t.prototype.play=function(){return this.core.activeContainer.play(),this},t.prototype.pause=function(){return this.core.activeContainer.pause(),this},t.prototype.stop=function(){return this.core.activeContainer.stop(),this},t.prototype.seek=function(e){return this.core.activeContainer.seek(e),this},t.prototype.seekPercentage=function(e){return this.core.activeContainer.seekPercentage(e),this},t.prototype.mute=function(){return this._mutedVolume=this.getVolume(),this.setVolume(0),this},t.prototype.unmute=function(){return this.setVolume("number"==typeof this._mutedVolume?this._mutedVolume:100),this._mutedVolume=null,this},t.prototype.isPlaying=function(){return this.core.activeContainer.isPlaying()},t.prototype.isDvrEnabled=function(){return this.core.activeContainer.isDvrEnabled()},t.prototype.isDvrInUse=function(){return this.core.activeContainer.isDvrInUse()},t.prototype.configure=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._registerOptionEventListeners(e.events,this.options.events),this.core.configure(e),this},t.prototype.getPlugin=function(e){return this.core.plugins.concat(this.core.activeContainer.plugins).filter((function(t){return t.name===e}))[0]},t.prototype.getCurrentTime=function(){return this.core.activeContainer.getCurrentTime()},t.prototype.getStartTimeOffset=function(){return this.core.activeContainer.getStartTimeOffset()},t.prototype.getDuration=function(){return this.core.activeContainer.getDuration()},t}(c.default);t.default=_,(0,r.default)(_.prototype,g.default),e.exports=t.default},"./src/components/player_info.js": -/*!***************************************!*\ - !*** ./src/components/player_info.js ***! - \***************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js"),a=(r=i)&&r.__esModule?r:{default:r},o=function e(){(0,a.default)(this,e),this.options={},this.playbackPlugins=[],this.currentSize={width:0,height:0}};o._players={},o.getInstance=function(e){return o._players[e]||(o._players[e]=new o)},t.default=o,e.exports=t.default},"./src/icons/01-play.svg": -/*!*******************************!*\ - !*** ./src/icons/01-play.svg ***! - \*******************************/ -/*! no static exports found */function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#010101" d="M1.425.35L14.575 8l-13.15 7.65V.35z"></path></svg>'},"./src/icons/02-pause.svg": -/*!********************************!*\ - !*** ./src/icons/02-pause.svg ***! - \********************************/ -/*! no static exports found */function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M1.712 14.76H6.43V1.24H1.71v13.52zm7.86-13.52v13.52h4.716V1.24H9.573z"></path></svg>'},"./src/icons/03-stop.svg": -/*!*******************************!*\ - !*** ./src/icons/03-stop.svg ***! - \*******************************/ -/*! no static exports found */function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M1.712 1.24h12.6v13.52h-12.6z"></path></svg>'},"./src/icons/04-volume.svg": -/*!*********************************!*\ - !*** ./src/icons/04-volume.svg ***! - \*********************************/ -/*! no static exports found */function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M11.5 11h-.002v1.502L7.798 10H4.5V6h3.297l3.7-2.502V4.5h.003V11zM11 4.49L7.953 6.5H5v3h2.953L11 11.51V4.49z"></path></svg>'},"./src/icons/05-mute.svg": -/*!*******************************!*\ - !*** ./src/icons/05-mute.svg ***! - \*******************************/ -/*! no static exports found */function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M9.75 11.51L6.7 9.5H3.75v-3H6.7L9.75 4.49v.664l.497.498V3.498L6.547 6H3.248v4h3.296l3.7 2.502v-2.154l-.497.5v.662zm3-5.165L12.404 6l-1.655 1.653L9.093 6l-.346.345L10.402 8 8.747 9.654l.346.347 1.655-1.653L12.403 10l.348-.346L11.097 8l1.655-1.655z"></path></svg>'},"./src/icons/06-expand.svg": -/*!*********************************!*\ - !*** ./src/icons/06-expand.svg ***! - \*********************************/ -/*! no static exports found */function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#010101" d="M7.156 8L4 11.156V8.5H3V13h4.5v-1H4.844L8 8.844 7.156 8zM8.5 3v1h2.657L8 7.157 8.846 8 12 4.844V7.5h1V3H8.5z"></path></svg>'},"./src/icons/07-shrink.svg": -/*!*********************************!*\ - !*** ./src/icons/07-shrink.svg ***! - \*********************************/ -/*! no static exports found */function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#010101" d="M13.5 3.344l-.844-.844L9.5 5.656V3h-1v4.5H13v-1h-2.656L13.5 3.344zM3 9.5h2.656L2.5 12.656l.844.844L6.5 10.344V13h1V8.5H3v1z"></path></svg>'},"./src/icons/08-hd.svg": -/*!*****************************!*\ - !*** ./src/icons/08-hd.svg ***! - \*****************************/ -/*! no static exports found */function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#010101" d="M5.375 7.062H2.637V4.26H.502v7.488h2.135V8.9h2.738v2.848h2.133V4.26H5.375v2.802zm5.97-2.81h-2.84v7.496h2.798c2.65 0 4.195-1.607 4.195-3.77v-.022c0-2.162-1.523-3.704-4.154-3.704zm2.06 3.758c0 1.21-.81 1.896-2.03 1.896h-.83V6.093h.83c1.22 0 2.03.696 2.03 1.896v.02z"></path></svg>'},"./src/icons/09-cc.svg": -/*!*****************************!*\ - !*** ./src/icons/09-cc.svg ***! - \*****************************/ -/*! no static exports found */function(e,t){e.exports='<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 49 41.8" style="enable-background:new 0 0 49 41.8;" xml:space="preserve"><path d="M47.1,0H3.2C1.6,0,0,1.2,0,2.8v31.5C0,35.9,1.6,37,3.2,37h11.9l3.2,1.9l4.7,2.7c0.9,0.5,2-0.1,2-1.1V37h22.1 c1.6,0,1.9-1.1,1.9-2.7V2.8C49,1.2,48.7,0,47.1,0z M7.2,18.6c0-4.8,3.5-9.3,9.9-9.3c4.8,0,7.1,2.7,7.1,2.7l-2.5,4 c0,0-1.7-1.7-4.2-1.7c-2.8,0-4.3,2.1-4.3,4.3c0,2.1,1.5,4.4,4.5,4.4c2.5,0,4.9-2.1,4.9-2.1l2.2,4.2c0,0-2.7,2.9-7.6,2.9 C10.8,27.9,7.2,23.5,7.2,18.6z M36.9,27.9c-6.4,0-9.9-4.4-9.9-9.3c0-4.8,3.5-9.3,9.9-9.3C41.7,9.3,44,12,44,12l-2.5,4 c0,0-1.7-1.7-4.2-1.7c-2.8,0-4.3,2.1-4.3,4.3c0,2.1,1.5,4.4,4.5,4.4c2.5,0,4.9-2.1,4.9-2.1l2.2,4.2C44.5,25,41.9,27.9,36.9,27.9z"></path></svg>'},"./src/icons/10-reload.svg": -/*!*********************************!*\ - !*** ./src/icons/10-reload.svg ***! - \*********************************/ -/*! no static exports found */function(e,t){e.exports='<svg fill="#FFFFFF" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg>'},"./src/main.js": -/*!*********************!*\ - !*** ./src/main.js ***! - \*********************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=B(n(/*! ./components/player */"./src/components/player.js")),i=B(n(/*! ./base/utils */"./src/base/utils.js")),a=B(n(/*! ./base/events */"./src/base/events.js")),o=B(n(/*! ./base/playback */"./src/base/playback.js")),s=B(n(/*! ./base/container_plugin */"./src/base/container_plugin.js")),l=B(n(/*! ./base/core_plugin */"./src/base/core_plugin.js")),u=B(n(/*! ./base/ui_core_plugin */"./src/base/ui_core_plugin.js")),c=B(n(/*! ./base/ui_container_plugin */"./src/base/ui_container_plugin.js")),d=B(n(/*! ./base/base_object */"./src/base/base_object.js")),f=B(n(/*! ./base/ui_object */"./src/base/ui_object.js")),h=B(n(/*! ./components/browser */"./src/components/browser/index.js")),p=B(n(/*! ./components/container */"./src/components/container/index.js")),m=B(n(/*! ./components/core */"./src/components/core/index.js")),g=B(n(/*! ./components/error */"./src/components/error/index.js")),y=B(n(/*! ./components/loader */"./src/components/loader/index.js")),v=B(n(/*! ./components/mediator */"./src/components/mediator.js")),b=B(n(/*! ./components/player_info */"./src/components/player_info.js")),_=B(n(/*! ./playbacks/base_flash_playback */"./src/playbacks/base_flash_playback/index.js")),A=B(n(/*! ./playbacks/flash */"./src/playbacks/flash/index.js")),E=B(n(/*! ./playbacks/flashls */"./src/playbacks/flashls/index.js")),T=B(n(/*! ./playbacks/hls */"./src/playbacks/hls/index.js")),w=B(n(/*! ./playbacks/html5_audio */"./src/playbacks/html5_audio/index.js")),S=B(n(/*! ./playbacks/html5_video */"./src/playbacks/html5_video/index.js")),k=B(n(/*! ./playbacks/html_img */"./src/playbacks/html_img/index.js")),C=B(n(/*! ./playbacks/no_op */"./src/playbacks/no_op/index.js")),x=B(n(/*! ./plugins/media_control */"./src/plugins/media_control/index.js")),R=B(n(/*! ./plugins/click_to_pause */"./src/plugins/click_to_pause/index.js")),L=B(n(/*! ./plugins/dvr_controls */"./src/plugins/dvr_controls/index.js")),I=B(n(/*! ./plugins/favicon */"./src/plugins/favicon/index.js")),P=B(n(/*! ./plugins/log */"./src/plugins/log/index.js")),j=B(n(/*! ./plugins/poster */"./src/plugins/poster/index.js")),O=B(n(/*! ./plugins/spinner_three_bounce */"./src/plugins/spinner_three_bounce/index.js")),D=B(n(/*! ./plugins/watermark */"./src/plugins/watermark/index.js")),M=B(n(/*! ./base/styler */"./src/base/styler.js")),N=B(n(/*! ./vendor */"./src/vendor/index.js")),U=B(n(/*! ./base/template */"./src/base/template.js")),F=B(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js"));function B(e){return e&&e.__esModule?e:{default:e}}t.default={Player:r.default,Mediator:v.default,Events:a.default,Browser:h.default,PlayerInfo:b.default,MediaControl:x.default,ContainerPlugin:s.default,UIContainerPlugin:c.default,CorePlugin:l.default,UICorePlugin:u.default,Playback:o.default,Container:p.default,Core:m.default,PlayerError:g.default,Loader:y.default,BaseObject:d.default,UIObject:f.default,Utils:i.default,BaseFlashPlayback:_.default,Flash:A.default,FlasHLS:E.default,HLS:T.default,HTML5Audio:w.default,HTML5Video:S.default,HTMLImg:k.default,NoOp:C.default,ClickToPausePlugin:R.default,DVRControls:L.default,Favicon:I.default,Log:P.default,Poster:j.default,SpinnerThreeBouncePlugin:O.default,WaterMarkPlugin:D.default,Styler:M.default,Vendor:N.default,version:"0.3.13",template:U.default,$:F.default},e.exports=t.default},"./src/playbacks/base_flash_playback/base_flash_playback.js": -/*!******************************************************************!*\ - !*** ./src/playbacks/base_flash_playback/base_flash_playback.js ***! - \******************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=d(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),a=d(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=d(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=d(n(/*! ../../base/playback */"./src/base/playback.js")),l=d(n(/*! ../../base/template */"./src/base/template.js")),u=d(n(/*! ../../components/browser */"./src/components/browser/index.js")),c=d(n(/*! ./public/flash.html */"./src/playbacks/base_flash_playback/public/flash.html"));function d(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/flash.scss */"./src/playbacks/base_flash_playback/public/flash.scss");var f=function(e){function t(){return(0,r.default)(this,t),(0,a.default)(this,e.apply(this,arguments))}return(0,o.default)(t,e),t.prototype.setElement=function(e){this.$el=e,this.el=e[0]},t.prototype.render=function(){return this.$el.attr("data",this.swfPath),this.$el.html(this.template({cid:this.cid,swfPath:this.swfPath,baseUrl:this.baseUrl,playbackId:this.uniqueId,wmode:this.wmode,callbackName:"window.Clappr.flashlsCallbacks."+this.cid})),u.default.isIE&&(this.$("embed").remove(),u.default.isLegacyIE&&this.$el.attr("classid","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000")),this.el.id=this.cid,this},(0,i.default)(t,[{key:"tagName",get:function(){return"object"}},{key:"swfPath",get:function(){return""}},{key:"wmode",get:function(){return"transparent"}},{key:"template",get:function(){return(0,l.default)(c.default)}},{key:"attributes",get:function(){var e="application/x-shockwave-flash";return u.default.isLegacyIE&&(e=""),{class:"clappr-flash-playback",type:e,width:"100%",height:"100%",data:this.swfPath,"data-flash-playback":this.name}}}]),t}(s.default);t.default=f,e.exports=t.default},"./src/playbacks/base_flash_playback/index.js": -/*!****************************************************!*\ - !*** ./src/playbacks/base_flash_playback/index.js ***! - \****************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=n(/*! ./base_flash_playback */"./src/playbacks/base_flash_playback/base_flash_playback.js"),e.exports=t.default},"./src/playbacks/base_flash_playback/public/flash.html": -/*!*************************************************************!*\ - !*** ./src/playbacks/base_flash_playback/public/flash.html ***! - \*************************************************************/ -/*! no static exports found */function(e,t){e.exports='<param name="movie" value="<%= swfPath %>">\n<param name="quality" value="autohigh">\n<param name="swliveconnect" value="true">\n<param name="allowScriptAccess" value="always">\n<param name="bgcolor" value="#000000">\n<param name="allowFullScreen" value="false">\n<param name="wmode" value="<%= wmode %>">\n<param name="tabindex" value="1">\n<param name="FlashVars" value="playbackId=<%= playbackId %>&callback=<%= callbackName %>">\n<embed\n name="<%= cid %>"\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</embed>\n'},"./src/playbacks/base_flash_playback/public/flash.scss": -/*!*************************************************************!*\ - !*** ./src/playbacks/base_flash_playback/public/flash.scss ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/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/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/base_flash_playback/public/flash.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/playbacks/flash/flash.js": -/*!**************************************!*\ - !*** ./src/playbacks/flash/flash.js ***! - \**************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=g(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=g(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=g(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=g(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=n(/*! ../../base/utils */"./src/base/utils.js"),l=g(n(/*! ../../playbacks/base_flash_playback */"./src/playbacks/base_flash_playback/index.js")),u=g(n(/*! ../../components/browser */"./src/components/browser/index.js")),c=g(n(/*! ../../components/mediator */"./src/components/mediator.js")),d=g(n(/*! ../../base/template */"./src/base/template.js")),f=g(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js")),h=g(n(/*! ../../base/events */"./src/base/events.js")),p=g(n(/*! ../../base/playback */"./src/base/playback.js")),m=g(n(/*! ./public/Player.swf */"./src/playbacks/flash/public/Player.swf"));function g(e){return e&&e.__esModule?e:{default:e}}var y=function(e){function t(){(0,r.default)(this,t);for(var n=arguments.length,a=Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=(0,i.default)(this,e.call.apply(e,[this].concat(a)));return s._src=s.options.src,s._baseUrl=s.options.baseUrl,s._autoPlay=s.options.autoPlay,s.settings={default:["seekbar"]},s.settings.left=["playpause","position","duration"],s.settings.right=["fullscreen","volume"],s.settings.seekEnabled=!0,s._isReadyState=!1,s._addListeners(),s}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"flash"}},{key:"swfPath",get:function(){return(0,d.default)(m.default)({baseUrl:this._baseUrl})}},{key:"ended",get:function(){return"ENDED"===this._currentState}},{key:"buffering",get:function(){return!!this._bufferingState&&"ENDED"!==this._currentState}}]),t.prototype._bootstrap=function(){var e=this;this.el.playerPlay?(this.el.width="100%",this.el.height="100%","PLAYING"===this._currentState?this._firstPlay():(this._currentState="IDLE",this._autoPlay&&this.play()),(0,f.default)('<div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%" />').insertAfter(this.$el),this.getDuration()>0?this._metadataLoaded():c.default.once(this.uniqueId+":timeupdate",this._metadataLoaded,this)):(this._attempts=this._attempts||0,++this._attempts<=60?setTimeout((function(){return e._bootstrap()}),50):this.trigger(h.default.PLAYBACK_ERROR,{message:"Max number of attempts reached"},this.name))},t.prototype._metadataLoaded=function(){this._isReadyState=!0,this.trigger(h.default.PLAYBACK_READY,this.name),this.trigger(h.default.PLAYBACK_SETTINGSUPDATE,this.name)},t.prototype.getPlaybackType=function(){return p.default.VOD},t.prototype.isHighDefinitionInUse=function(){return!1},t.prototype._updateTime=function(){this.trigger(h.default.PLAYBACK_TIMEUPDATE,{current:this.el.getPosition(),total:this.el.getDuration()},this.name)},t.prototype._addListeners=function(){c.default.on(this.uniqueId+":progress",this._progress,this),c.default.on(this.uniqueId+":timeupdate",this._updateTime,this),c.default.on(this.uniqueId+":statechanged",this._checkState,this),c.default.on(this.uniqueId+":flashready",this._bootstrap,this)},t.prototype.stopListening=function(){e.prototype.stopListening.call(this),c.default.off(this.uniqueId+":progress"),c.default.off(this.uniqueId+":timeupdate"),c.default.off(this.uniqueId+":statechanged"),c.default.off(this.uniqueId+":flashready")},t.prototype._checkState=function(){this._isIdle||"PAUSED"===this._currentState||("PLAYING_BUFFERING"!==this._currentState&&"PLAYING_BUFFERING"===this.el.getState()?(this._bufferingState=!0,this.trigger(h.default.PLAYBACK_BUFFERING,this.name),this._currentState="PLAYING_BUFFERING"):"PLAYING"===this.el.getState()?(this._bufferingState=!1,this.trigger(h.default.PLAYBACK_BUFFERFULL,this.name),this._currentState="PLAYING"):"IDLE"===this.el.getState()?this._currentState="IDLE":"ENDED"===this.el.getState()&&(this.trigger(h.default.PLAYBACK_ENDED,this.name),this.trigger(h.default.PLAYBACK_TIMEUPDATE,{current:0,total:this.el.getDuration()},this.name),this._currentState="ENDED",this._isIdle=!0))},t.prototype._progress=function(){"IDLE"!==this._currentState&&"ENDED"!==this._currentState&&this.trigger(h.default.PLAYBACK_PROGRESS,{start:0,current:this.el.getBytesLoaded(),total:this.el.getBytesTotal()})},t.prototype._firstPlay=function(){var e=this;this.el.playerPlay?(this._isIdle=!1,this.el.playerPlay(this._src),this.listenToOnce(this,h.default.PLAYBACK_BUFFERFULL,(function(){return e._checkInitialSeek()})),this._currentState="PLAYING"):this.listenToOnce(this,h.default.PLAYBACK_READY,this._firstPlay)},t.prototype._checkInitialSeek=function(){var e=(0,s.seekStringToSeconds)(window.location.href);0!==e&&this.seekSeconds(e)},t.prototype.play=function(){this.trigger(h.default.PLAYBACK_PLAY_INTENT),"PAUSED"===this._currentState||"PLAYING_BUFFERING"===this._currentState?(this._currentState="PLAYING",this.el.playerResume(),this.trigger(h.default.PLAYBACK_PLAY,this.name)):"PLAYING"!==this._currentState&&(this._firstPlay(),this.trigger(h.default.PLAYBACK_PLAY,this.name))},t.prototype.volume=function(e){var t=this;this.isReady?this.el.playerVolume(e):this.listenToOnce(this,h.default.PLAYBACK_BUFFERFULL,(function(){return t.volume(e)}))},t.prototype.pause=function(){this._currentState="PAUSED",this.el.playerPause(),this.trigger(h.default.PLAYBACK_PAUSE,this.name)},t.prototype.stop=function(){this.el.playerStop(),this.trigger(h.default.PLAYBACK_STOP),this.trigger(h.default.PLAYBACK_TIMEUPDATE,{current:0,total:0},this.name)},t.prototype.isPlaying=function(){return!!(this.isReady&&this._currentState.indexOf("PLAYING")>-1)},t.prototype.getDuration=function(){return this.el.getDuration()},t.prototype.seekPercentage=function(e){var t=this;if(this.el.getDuration()>0){var n=this.el.getDuration()*(e/100);this.seek(n)}else this.listenToOnce(this,h.default.PLAYBACK_BUFFERFULL,(function(){return t.seekPercentage(e)}))},t.prototype.seek=function(e){var t=this;this.isReady&&this.el.playerSeek?(this.el.playerSeek(e),this.trigger(h.default.PLAYBACK_TIMEUPDATE,{current:e,total:this.el.getDuration()},this.name),"PAUSED"===this._currentState&&this.el.playerPause()):this.listenToOnce(this,h.default.PLAYBACK_BUFFERFULL,(function(){return t.seek(e)}))},t.prototype.destroy=function(){clearInterval(this.bootstrapId),e.prototype.stopListening.call(this),this.$el.remove()},(0,a.default)(t,[{key:"isReady",get:function(){return this._isReadyState}}]),t}(l.default);t.default=y,y.canPlay=function(e){if(u.default.hasFlash&&e&&e.constructor===String){var t=e.split("?")[0].match(/.*\.(.*)$/)||[];return t.length>1&&!u.default.isMobile&&t[1].toLowerCase().match(/^(mp4|mov|f4v|3gpp|3gp)$/)}return!1},e.exports=t.default},"./src/playbacks/flash/index.js": -/*!**************************************!*\ - !*** ./src/playbacks/flash/index.js ***! - \**************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./flash */"./src/playbacks/flash/flash.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/playbacks/flash/public/Player.swf": -/*!***********************************************!*\ - !*** ./src/playbacks/flash/public/Player.swf ***! - \***********************************************/ -/*! no static exports found */function(e,t){e.exports="<%=baseUrl%>/4b76590b32dab62bc95c1b7951efae78.swf"},"./src/playbacks/flashls/flashls.js": -/*!******************************************!*\ - !*** ./src/playbacks/flashls/flashls.js ***! - \******************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=y(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=y(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=y(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=y(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=y(n(/*! ../../playbacks/base_flash_playback */"./src/playbacks/base_flash_playback/index.js")),l=y(n(/*! ../../base/events */"./src/base/events.js")),u=y(n(/*! ../../base/template */"./src/base/template.js")),c=y(n(/*! ../../base/playback */"./src/base/playback.js")),d=y(n(/*! ../../components/mediator */"./src/components/mediator.js")),f=y(n(/*! ../../components/browser */"./src/components/browser/index.js")),h=y(n(/*! ../../components/error */"./src/components/error/index.js")),p=y(n(/*! ./flashls_events */"./src/playbacks/flashls/flashls_events.js")),m=y(n(/*! ./public/HLSPlayer.swf */"./src/playbacks/flashls/public/HLSPlayer.swf")),g=y(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js"));function y(e){return e&&e.__esModule?e:{default:e}}var v=function(e){function t(){(0,r.default)(this,t);for(var n=arguments.length,a=Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=(0,i.default)(this,e.call.apply(e,[this].concat(a)));return s._src=s.options.src,s._baseUrl=s.options.baseUrl,s._initHlsParameters(s.options),s.highDefinition=!1,s._autoPlay=s.options.autoPlay,s._loop=s.options.loop,s._defaultSettings={left:["playstop"],default:["seekbar"],right:["fullscreen","volume","hd-indicator"],seekEnabled:!1},s.settings=g.default.extend({},s._defaultSettings),s._playbackType=c.default.LIVE,s._hasEnded=!1,s._addListeners(),s}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"flashls"}},{key:"swfPath",get:function(){return(0,u.default)(m.default)({baseUrl:this._baseUrl})}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel},set:function(e){this._currentLevel=e,this.trigger(l.default.PLAYBACK_LEVEL_SWITCH_START),this.el.playerSetCurrentLevel(e)}},{key:"ended",get:function(){return this._hasEnded}},{key:"buffering",get:function(){return!!this._bufferingState&&!this._hasEnded}}]),t.prototype._initHlsParameters=function(e){this._autoStartLoad=void 0===e.autoStartLoad||e.autoStartLoad,this._capLevelToStage=void 0!==e.capLevelToStage&&e.capLevelToStage,this._maxLevelCappingMode=void 0===e.maxLevelCappingMode?"downscale":e.maxLevelCappingMode,this._minBufferLength=void 0===e.minBufferLength?-1:e.minBufferLength,this._minBufferLengthCapping=void 0===e.minBufferLengthCapping?-1:e.minBufferLengthCapping,this._maxBufferLength=void 0===e.maxBufferLength?120:e.maxBufferLength,this._maxBackBufferLength=void 0===e.maxBackBufferLength?30:e.maxBackBufferLength,this._lowBufferLength=void 0===e.lowBufferLength?3:e.lowBufferLength,this._mediaTimePeriod=void 0===e.mediaTimePeriod?100:e.mediaTimePeriod,this._fpsDroppedMonitoringPeriod=void 0===e.fpsDroppedMonitoringPeriod?5e3:e.fpsDroppedMonitoringPeriod,this._fpsDroppedMonitoringThreshold=void 0===e.fpsDroppedMonitoringThreshold?.2:e.fpsDroppedMonitoringThreshold,this._capLevelonFPSDrop=void 0!==e.capLevelonFPSDrop&&e.capLevelonFPSDrop,this._smoothAutoSwitchonFPSDrop=void 0===e.smoothAutoSwitchonFPSDrop?this.capLevelonFPSDrop:e.smoothAutoSwitchonFPSDrop,this._switchDownOnLevelError=void 0===e.switchDownOnLevelError||e.switchDownOnLevelError,this._seekMode=void 0===e.seekMode?"ACCURATE":e.seekMode,this._keyLoadMaxRetry=void 0===e.keyLoadMaxRetry?3:e.keyLoadMaxRetry,this._keyLoadMaxRetryTimeout=void 0===e.keyLoadMaxRetryTimeout?64e3:e.keyLoadMaxRetryTimeout,this._fragmentLoadMaxRetry=void 0===e.fragmentLoadMaxRetry?3:e.fragmentLoadMaxRetry,this._fragmentLoadMaxRetryTimeout=void 0===e.fragmentLoadMaxRetryTimeout?4e3:e.fragmentLoadMaxRetryTimeout,this._fragmentLoadSkipAfterMaxRetry=void 0===e.fragmentLoadSkipAfterMaxRetry||e.fragmentLoadSkipAfterMaxRetry,this._maxSkippedFragments=void 0===e.maxSkippedFragments?5:e.maxSkippedFragments,this._flushLiveURLCache=void 0!==e.flushLiveURLCache&&e.flushLiveURLCache,this._initialLiveManifestSize=void 0===e.initialLiveManifestSize?1:e.initialLiveManifestSize,this._manifestLoadMaxRetry=void 0===e.manifestLoadMaxRetry?3:e.manifestLoadMaxRetry,this._manifestLoadMaxRetryTimeout=void 0===e.manifestLoadMaxRetryTimeout?64e3:e.manifestLoadMaxRetryTimeout,this._manifestRedundantLoadmaxRetry=void 0===e.manifestRedundantLoadmaxRetry?3:e.manifestRedundantLoadmaxRetry,this._startFromBitrate=void 0===e.startFromBitrate?-1:e.startFromBitrate,this._startFromLevel=void 0===e.startFromLevel?-1:e.startFromLevel,this._autoStartMaxDuration=void 0===e.autoStartMaxDuration?-1:e.autoStartMaxDuration,this._seekFromLevel=void 0===e.seekFromLevel?-1:e.seekFromLevel,this._useHardwareVideoDecoder=void 0!==e.useHardwareVideoDecoder&&e.useHardwareVideoDecoder,this._hlsLogEnabled=void 0===e.hlsLogEnabled||e.hlsLogEnabled,this._logDebug=void 0!==e.logDebug&&e.logDebug,this._logDebug2=void 0!==e.logDebug2&&e.logDebug2,this._logWarn=void 0===e.logWarn||e.logWarn,this._logError=void 0===e.logError||e.logError,this._hlsMinimumDvrSize=void 0===e.hlsMinimumDvrSize?60:e.hlsMinimumDvrSize},t.prototype._addListeners=function(){var e=this;d.default.on(this.cid+":flashready",(function(){return e._bootstrap()})),d.default.on(this.cid+":timeupdate",(function(t){return e._updateTime(t)})),d.default.on(this.cid+":playbackstate",(function(t){return e._setPlaybackState(t)})),d.default.on(this.cid+":levelchanged",(function(t){return e._levelChanged(t)})),d.default.on(this.cid+":error",(function(t,n,r){return e._flashPlaybackError(t,n,r)})),d.default.on(this.cid+":fragmentloaded",(function(t){return e._onFragmentLoaded(t)})),d.default.on(this.cid+":levelendlist",(function(t){return e._onLevelEndlist(t)}))},t.prototype.stopListening=function(){e.prototype.stopListening.call(this),d.default.off(this.cid+":flashready"),d.default.off(this.cid+":timeupdate"),d.default.off(this.cid+":playbackstate"),d.default.off(this.cid+":levelchanged"),d.default.off(this.cid+":playbackerror"),d.default.off(this.cid+":fragmentloaded"),d.default.off(this.cid+":manifestloaded"),d.default.off(this.cid+":levelendlist")},t.prototype._bootstrap=function(){var e=this;if(this.el.playerLoad)this.el.width="100%",this.el.height="100%",this._isReadyState=!0,this._srcLoaded=!1,this._currentState="IDLE",this._setFlashSettings(),this._updatePlaybackType(),(this._autoPlay||this._shouldPlayOnManifestLoaded)&&this.play(),this.trigger(l.default.PLAYBACK_READY,this.name);else if(this._bootstrapAttempts=this._bootstrapAttempts||0,++this._bootstrapAttempts<=60)setTimeout((function(){return e._bootstrap()}),50);else{var t=this.createError({code:"playerLoadFail_maxNumberAttemptsReached",description:this.name+" error: Max number of attempts reached",level:h.default.Levels.FATAL,raw:{}});this.trigger(l.default.PLAYBACK_ERROR,t)}},t.prototype._setFlashSettings=function(){this.el.playerSetAutoStartLoad(this._autoStartLoad),this.el.playerSetCapLevelToStage(this._capLevelToStage),this.el.playerSetMaxLevelCappingMode(this._maxLevelCappingMode),this.el.playerSetMinBufferLength(this._minBufferLength),this.el.playerSetMinBufferLengthCapping(this._minBufferLengthCapping),this.el.playerSetMaxBufferLength(this._maxBufferLength),this.el.playerSetMaxBackBufferLength(this._maxBackBufferLength),this.el.playerSetLowBufferLength(this._lowBufferLength),this.el.playerSetMediaTimePeriod(this._mediaTimePeriod),this.el.playerSetFpsDroppedMonitoringPeriod(this._fpsDroppedMonitoringPeriod),this.el.playerSetFpsDroppedMonitoringThreshold(this._fpsDroppedMonitoringThreshold),this.el.playerSetCapLevelonFPSDrop(this._capLevelonFPSDrop),this.el.playerSetSmoothAutoSwitchonFPSDrop(this._smoothAutoSwitchonFPSDrop),this.el.playerSetSwitchDownOnLevelError(this._switchDownOnLevelError),this.el.playerSetSeekMode(this._seekMode),this.el.playerSetKeyLoadMaxRetry(this._keyLoadMaxRetry),this.el.playerSetKeyLoadMaxRetryTimeout(this._keyLoadMaxRetryTimeout),this.el.playerSetFragmentLoadMaxRetry(this._fragmentLoadMaxRetry),this.el.playerSetFragmentLoadMaxRetryTimeout(this._fragmentLoadMaxRetryTimeout),this.el.playerSetFragmentLoadSkipAfterMaxRetry(this._fragmentLoadSkipAfterMaxRetry),this.el.playerSetMaxSkippedFragments(this._maxSkippedFragments),this.el.playerSetFlushLiveURLCache(this._flushLiveURLCache),this.el.playerSetInitialLiveManifestSize(this._initialLiveManifestSize),this.el.playerSetManifestLoadMaxRetry(this._manifestLoadMaxRetry),this.el.playerSetManifestLoadMaxRetryTimeout(this._manifestLoadMaxRetryTimeout),this.el.playerSetManifestRedundantLoadmaxRetry(this._manifestRedundantLoadmaxRetry),this.el.playerSetStartFromBitrate(this._startFromBitrate),this.el.playerSetStartFromLevel(this._startFromLevel),this.el.playerSetAutoStartMaxDuration(this._autoStartMaxDuration),this.el.playerSetSeekFromLevel(this._seekFromLevel),this.el.playerSetUseHardwareVideoDecoder(this._useHardwareVideoDecoder),this.el.playerSetLogInfo(this._hlsLogEnabled),this.el.playerSetLogDebug(this._logDebug),this.el.playerSetLogDebug2(this._logDebug2),this.el.playerSetLogWarn(this._logWarn),this.el.playerSetLogError(this._logError)},t.prototype.setAutoStartLoad=function(e){this._autoStartLoad=e,this.el.playerSetAutoStartLoad(this._autoStartLoad)},t.prototype.setCapLevelToStage=function(e){this._capLevelToStage=e,this.el.playerSetCapLevelToStage(this._capLevelToStage)},t.prototype.setMaxLevelCappingMode=function(e){this._maxLevelCappingMode=e,this.el.playerSetMaxLevelCappingMode(this._maxLevelCappingMode)},t.prototype.setSetMinBufferLength=function(e){this._minBufferLength=e,this.el.playerSetMinBufferLength(this._minBufferLength)},t.prototype.setMinBufferLengthCapping=function(e){this._minBufferLengthCapping=e,this.el.playerSetMinBufferLengthCapping(this._minBufferLengthCapping)},t.prototype.setMaxBufferLength=function(e){this._maxBufferLength=e,this.el.playerSetMaxBufferLength(this._maxBufferLength)},t.prototype.setMaxBackBufferLength=function(e){this._maxBackBufferLength=e,this.el.playerSetMaxBackBufferLength(this._maxBackBufferLength)},t.prototype.setLowBufferLength=function(e){this._lowBufferLength=e,this.el.playerSetLowBufferLength(this._lowBufferLength)},t.prototype.setMediaTimePeriod=function(e){this._mediaTimePeriod=e,this.el.playerSetMediaTimePeriod(this._mediaTimePeriod)},t.prototype.setFpsDroppedMonitoringPeriod=function(e){this._fpsDroppedMonitoringPeriod=e,this.el.playerSetFpsDroppedMonitoringPeriod(this._fpsDroppedMonitoringPeriod)},t.prototype.setFpsDroppedMonitoringThreshold=function(e){this._fpsDroppedMonitoringThreshold=e,this.el.playerSetFpsDroppedMonitoringThreshold(this._fpsDroppedMonitoringThreshold)},t.prototype.setCapLevelonFPSDrop=function(e){this._capLevelonFPSDrop=e,this.el.playerSetCapLevelonFPSDrop(this._capLevelonFPSDrop)},t.prototype.setSmoothAutoSwitchonFPSDrop=function(e){this._smoothAutoSwitchonFPSDrop=e,this.el.playerSetSmoothAutoSwitchonFPSDrop(this._smoothAutoSwitchonFPSDrop)},t.prototype.setSwitchDownOnLevelError=function(e){this._switchDownOnLevelError=e,this.el.playerSetSwitchDownOnLevelError(this._switchDownOnLevelError)},t.prototype.setSeekMode=function(e){this._seekMode=e,this.el.playerSetSeekMode(this._seekMode)},t.prototype.setKeyLoadMaxRetry=function(e){this._keyLoadMaxRetry=e,this.el.playerSetKeyLoadMaxRetry(this._keyLoadMaxRetry)},t.prototype.setKeyLoadMaxRetryTimeout=function(e){this._keyLoadMaxRetryTimeout=e,this.el.playerSetKeyLoadMaxRetryTimeout(this._keyLoadMaxRetryTimeout)},t.prototype.setFragmentLoadMaxRetry=function(e){this._fragmentLoadMaxRetry=e,this.el.playerSetFragmentLoadMaxRetry(this._fragmentLoadMaxRetry)},t.prototype.setFragmentLoadMaxRetryTimeout=function(e){this._fragmentLoadMaxRetryTimeout=e,this.el.playerSetFragmentLoadMaxRetryTimeout(this._fragmentLoadMaxRetryTimeout)},t.prototype.setFragmentLoadSkipAfterMaxRetry=function(e){this._fragmentLoadSkipAfterMaxRetry=e,this.el.playerSetFragmentLoadSkipAfterMaxRetry(this._fragmentLoadSkipAfterMaxRetry)},t.prototype.setMaxSkippedFragments=function(e){this._maxSkippedFragments=e,this.el.playerSetMaxSkippedFragments(this._maxSkippedFragments)},t.prototype.setFlushLiveURLCache=function(e){this._flushLiveURLCache=e,this.el.playerSetFlushLiveURLCache(this._flushLiveURLCache)},t.prototype.setInitialLiveManifestSize=function(e){this._initialLiveManifestSize=e,this.el.playerSetInitialLiveManifestSize(this._initialLiveManifestSize)},t.prototype.setManifestLoadMaxRetry=function(e){this._manifestLoadMaxRetry=e,this.el.playerSetManifestLoadMaxRetry(this._manifestLoadMaxRetry)},t.prototype.setManifestLoadMaxRetryTimeout=function(e){this._manifestLoadMaxRetryTimeout=e,this.el.playerSetManifestLoadMaxRetryTimeout(this._manifestLoadMaxRetryTimeout)},t.prototype.setManifestRedundantLoadmaxRetry=function(e){this._manifestRedundantLoadmaxRetry=e,this.el.playerSetManifestRedundantLoadmaxRetry(this._manifestRedundantLoadmaxRetry)},t.prototype.setStartFromBitrate=function(e){this._startFromBitrate=e,this.el.playerSetStartFromBitrate(this._startFromBitrate)},t.prototype.setStartFromLevel=function(e){this._startFromLevel=e,this.el.playerSetStartFromLevel(this._startFromLevel)},t.prototype.setAutoStartMaxDuration=function(e){this._autoStartMaxDuration=e,this.el.playerSetAutoStartMaxDuration(this._autoStartMaxDuration)},t.prototype.setSeekFromLevel=function(e){this._seekFromLevel=e,this.el.playerSetSeekFromLevel(this._seekFromLevel)},t.prototype.setUseHardwareVideoDecoder=function(e){this._useHardwareVideoDecoder=e,this.el.playerSetUseHardwareVideoDecoder(this._useHardwareVideoDecoder)},t.prototype.setSetLogInfo=function(e){this._hlsLogEnabled=e,this.el.playerSetLogInfo(this._hlsLogEnabled)},t.prototype.setLogDebug=function(e){this._logDebug=e,this.el.playerSetLogDebug(this._logDebug)},t.prototype.setLogDebug2=function(e){this._logDebug2=e,this.el.playerSetLogDebug2(this._logDebug2)},t.prototype.setLogWarn=function(e){this._logWarn=e,this.el.playerSetLogWarn(this._logWarn)},t.prototype.setLogError=function(e){this._logError=e,this.el.playerSetLogError(this._logError)},t.prototype._levelChanged=function(e){var t=this.el.getLevels()[e];t&&(this.highDefinition=t.height>=720||t.bitrate/1e3>=2e3,this.trigger(l.default.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this._levels&&0!==this._levels.length||this._fillLevels(),this.trigger(l.default.PLAYBACK_BITRATE,{height:t.height,width:t.width,bandwidth:t.bitrate,bitrate:t.bitrate,level:e}),this.trigger(l.default.PLAYBACK_LEVEL_SWITCH_END))},t.prototype._updateTime=function(e){if("IDLE"!==this._currentState){var t=this._normalizeDuration(e.duration),n=Math.min(Math.max(e.position,0),t),r=this._dvrEnabled,i=this._playbackType===c.default.LIVE;this._dvrEnabled=i&&t>this._hlsMinimumDvrSize,100!==t&&void 0!==i&&(this._dvrEnabled!==r&&(this._updateSettings(),this.trigger(l.default.PLAYBACK_SETTINGSUPDATE,this.name)),i&&!this._dvrEnabled&&(n=t),this.trigger(l.default.PLAYBACK_TIMEUPDATE,{current:n,total:t},this.name))}},t.prototype.play=function(){this.trigger(l.default.PLAYBACK_PLAY_INTENT),"PAUSED"===this._currentState?this.el.playerResume():this._srcLoaded||"PLAYING"===this._currentState?this.el.playerPlay():this._firstPlay()},t.prototype.getPlaybackType=function(){return this._playbackType?this._playbackType:null},t.prototype.getCurrentTime=function(){return this.el.getPosition()},t.prototype.getCurrentLevelIndex=function(){return this._currentLevel},t.prototype.getCurrentLevel=function(){return this.levels[this.currentLevel]},t.prototype.getCurrentBitrate=function(){return this.levels[this.currentLevel].bitrate},t.prototype.setCurrentLevel=function(e){this.currentLevel=e},t.prototype.isHighDefinitionInUse=function(){return this.highDefinition},t.prototype.getLevels=function(){return this.levels},t.prototype._setPlaybackState=function(e){["PLAYING_BUFFERING","PAUSED_BUFFERING"].indexOf(e)>=0?(this._bufferingState=!0,this.trigger(l.default.PLAYBACK_BUFFERING,this.name),this._updateCurrentState(e)):["PLAYING","PAUSED"].indexOf(e)>=0?(["PLAYING_BUFFERING","PAUSED_BUFFERING","IDLE"].indexOf(this._currentState)>=0&&(this._bufferingState=!1,this.trigger(l.default.PLAYBACK_BUFFERFULL,this.name)),this._updateCurrentState(e)):"IDLE"===e&&(this._srcLoaded=!1,this._loop&&["PLAYING_BUFFERING","PLAYING"].indexOf(this._currentState)>=0?(this.play(),this.seek(0)):(this._updateCurrentState(e),this._hasEnded=!0,this.trigger(l.default.PLAYBACK_TIMEUPDATE,{current:0,total:this.getDuration()},this.name),this.trigger(l.default.PLAYBACK_ENDED,this.name)))},t.prototype._updateCurrentState=function(e){this._currentState=e,"IDLE"!==e&&(this._hasEnded=!1),this._updatePlaybackType(),"PLAYING"===e?this.trigger(l.default.PLAYBACK_PLAY,this.name):"PAUSED"===e&&this.trigger(l.default.PLAYBACK_PAUSE,this.name)},t.prototype._updatePlaybackType=function(){this._playbackType=this.el.getType(),this._playbackType&&(this._playbackType=this._playbackType.toLowerCase(),this._playbackType===c.default.VOD?this._startReportingProgress():this._stopReportingProgress()),this.trigger(l.default.PLAYBACK_PLAYBACKSTATE,{type:this._playbackType})},t.prototype._startReportingProgress=function(){this._reportingProgress||(this._reportingProgress=!0)},t.prototype._stopReportingProgress=function(){this._reportingProgress=!1},t.prototype._onFragmentLoaded=function(e){if(this.trigger(l.default.PLAYBACK_FRAGMENT_LOADED,e),this._reportingProgress&&this.getCurrentTime()){var t=this.getCurrentTime()+this.el.getbufferLength();this.trigger(l.default.PLAYBACK_PROGRESS,{start:this.getCurrentTime(),current:t,total:this.el.getDuration()})}},t.prototype._onLevelEndlist=function(){this._updatePlaybackType()},t.prototype._firstPlay=function(){var e=this;this._shouldPlayOnManifestLoaded=!0,this.el.playerLoad&&(d.default.once(this.cid+":manifestloaded",(function(t,n){return e._manifestLoaded(t,n)})),this._setFlashSettings(),this.el.playerLoad(this._src),this._srcLoaded=!0)},t.prototype.volume=function(e){var t=this;this.isReady?this.el.playerVolume(e):this.listenToOnce(this,l.default.PLAYBACK_BUFFERFULL,(function(){return t.volume(e)}))},t.prototype.pause=function(){(this._playbackType!==c.default.LIVE||this._dvrEnabled)&&(this.el.playerPause(),this._playbackType===c.default.LIVE&&this._dvrEnabled&&this._updateDvr(!0))},t.prototype.stop=function(){this._srcLoaded=!1,this.el.playerStop(),this.trigger(l.default.PLAYBACK_STOP),this.trigger(l.default.PLAYBACK_TIMEUPDATE,{current:0,total:0},this.name)},t.prototype.isPlaying=function(){return!!this._currentState&&!!this._currentState.match(/playing/i)},t.prototype.getDuration=function(){return this._normalizeDuration(this.el.getDuration())},t.prototype._normalizeDuration=function(e){return this._playbackType===c.default.LIVE&&(e=Math.max(0,e-10)),e},t.prototype.seekPercentage=function(e){var t=this.el.getDuration(),n=0;e>0&&(n=t*e/100),this.seek(n)},t.prototype.seek=function(e){var t=this.getDuration();if(this._playbackType===c.default.LIVE){var n=t-e>3;this._updateDvr(n)}this.el.playerSeek(e),this.trigger(l.default.PLAYBACK_TIMEUPDATE,{current:e,total:t},this.name)},t.prototype._updateDvr=function(e){var t=!!this._dvrInUse;this._dvrInUse=e,this._dvrInUse!==t&&(this._updateSettings(),this.trigger(l.default.PLAYBACK_DVR,this._dvrInUse),this.trigger(l.default.PLAYBACK_STATS_ADD,{dvr:this._dvrInUse}))},t.prototype._flashPlaybackError=function(e,t,n){var r={code:e,description:n,level:h.default.Levels.FATAL,raw:{code:e,url:t,message:n}},i=this.createError(r);this.trigger(l.default.PLAYBACK_ERROR,i),this.trigger(l.default.PLAYBACK_STOP)},t.prototype._manifestLoaded=function(e,t){this._shouldPlayOnManifestLoaded&&(this._shouldPlayOnManifestLoaded=!1,this.el.playerPlay()),this._fillLevels(),this.trigger(l.default.PLAYBACK_LOADEDMETADATA,{duration:e,data:t})},t.prototype._fillLevels=function(){var e=this.el.getLevels(),t=e.length;this._levels=[];for(var n=0;n<t;n++)this._levels.push({id:n,label:e[n].height+"p",level:e[n]});this.trigger(l.default.PLAYBACK_LEVELS_AVAILABLE,this._levels)},t.prototype.destroy=function(){this.stopListening(),this.$el.remove()},t.prototype._updateSettings=function(){this.settings=g.default.extend({},this._defaultSettings),this._playbackType===c.default.VOD||this._dvrInUse?(this.settings.left=["playpause","position","duration"],this.settings.seekEnabled=!0):this._dvrEnabled?(this.settings.left=["playpause"],this.settings.seekEnabled=!0):this.settings.seekEnabled=!1},t.prototype._createCallbacks=function(){var e=this;window.Clappr||(window.Clappr={}),window.Clappr.flashlsCallbacks||(window.Clappr.flashlsCallbacks={}),this.flashlsEvents=new p.default(this.cid),window.Clappr.flashlsCallbacks[this.cid]=function(t,n){e.flashlsEvents[t].apply(e.flashlsEvents,n)}},t.prototype.render=function(){return e.prototype.render.call(this),this._createCallbacks(),this},(0,a.default)(t,[{key:"isReady",get:function(){return this._isReadyState}},{key:"dvrEnabled",get:function(){return!!this._dvrEnabled}}]),t}(s.default);t.default=v,v.canPlay=function(e,t){var n=e.split("?")[0].match(/.*\.(.*)$/)||[];return f.default.hasFlash&&(n.length>1&&"m3u8"===n[1].toLowerCase()||"application/x-mpegURL"===t||"application/vnd.apple.mpegurl"===t)},e.exports=t.default},"./src/playbacks/flashls/flashls_events.js": -/*!*************************************************!*\ - !*** ./src/playbacks/flashls/flashls_events.js ***! - \*************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=a(n(/*! ../../components/mediator */"./src/components/mediator.js"));function a(e){return e&&e.__esModule?e:{default:e}}var o=function(){function e(t){(0,r.default)(this,e),this.instanceId=t}return e.prototype.ready=function(){i.default.trigger(this.instanceId+":flashready")},e.prototype.videoSize=function(e,t){i.default.trigger(this.instanceId+":videosizechanged",e,t)},e.prototype.complete=function(){i.default.trigger(this.instanceId+":complete")},e.prototype.error=function(e,t,n){i.default.trigger(this.instanceId+":error",e,t,n)},e.prototype.manifest=function(e,t){i.default.trigger(this.instanceId+":manifestloaded",e,t)},e.prototype.audioLevelLoaded=function(e){i.default.trigger(this.instanceId+":audiolevelloaded",e)},e.prototype.levelLoaded=function(e){i.default.trigger(this.instanceId+":levelloaded",e)},e.prototype.levelEndlist=function(e){i.default.trigger(this.instanceId+":levelendlist",e)},e.prototype.fragmentLoaded=function(e){i.default.trigger(this.instanceId+":fragmentloaded",e)},e.prototype.fragmentPlaying=function(e){i.default.trigger(this.instanceId+":fragmentplaying",e)},e.prototype.position=function(e){i.default.trigger(this.instanceId+":timeupdate",e)},e.prototype.state=function(e){i.default.trigger(this.instanceId+":playbackstate",e)},e.prototype.seekState=function(e){i.default.trigger(this.instanceId+":seekstate",e)},e.prototype.switch=function(e){i.default.trigger(this.instanceId+":levelchanged",e)},e.prototype.audioTracksListChange=function(e){i.default.trigger(this.instanceId+":audiotracklistchanged",e)},e.prototype.audioTrackChange=function(e){i.default.trigger(this.instanceId+":audiotrackchanged",e)},e}();t.default=o,e.exports=t.default},"./src/playbacks/flashls/index.js": -/*!****************************************!*\ - !*** ./src/playbacks/flashls/index.js ***! - \****************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./flashls */"./src/playbacks/flashls/flashls.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/playbacks/flashls/public/HLSPlayer.swf": -/*!****************************************************!*\ - !*** ./src/playbacks/flashls/public/HLSPlayer.swf ***! - \****************************************************/ -/*! no static exports found */function(e,t){e.exports="<%=baseUrl%>/8fa12a459188502b9f0d39b8a67d9e6c.swf"},"./src/playbacks/hls/hls.js": -/*!**********************************!*\ - !*** ./src/playbacks/hls/hls.js ***! - \**********************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=y(n(/*! babel-runtime/helpers/toConsumableArray */"./node_modules/babel-runtime/helpers/toConsumableArray.js")),i=y(n(/*! babel-runtime/core-js/json/stringify */"./node_modules/babel-runtime/core-js/json/stringify.js")),a=y(n(/*! babel-runtime/helpers/extends */"./node_modules/babel-runtime/helpers/extends.js")),o=y(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),s=y(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),l=y(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),u=y(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),c=y(n(/*! ../../playbacks/html5_video */"./src/playbacks/html5_video/index.js")),d=y(n(/*! hls.js */"./node_modules/hls.js/dist/hls.js")),f=y(n(/*! ../../base/events */"./src/base/events.js")),h=y(n(/*! ../../base/playback */"./src/base/playback.js")),p=n(/*! ../../base/utils */"./src/base/utils.js"),m=y(n(/*! ../../plugins/log */"./src/plugins/log/index.js")),g=y(n(/*! ../../components/error */"./src/components/error/index.js"));function y(e){return e&&e.__esModule?e:{default:e}}var v=function(e){function t(){(0,o.default)(this,t);for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var l=(0,s.default)(this,e.call.apply(e,[this].concat(r)));return l.options.playback=(0,a.default)({},l.options,l.options.playback),l._minDvrSize=void 0===l.options.hlsMinimumDvrSize?60:l.options.hlsMinimumDvrSize,l._extrapolatedWindowNumSegments=l.options.playback&&void 0!==l.options.playback.extrapolatedWindowNumSegments?l.options.playback.extrapolatedWindowNumSegments:2,l._playbackType=h.default.VOD,l._lastTimeUpdate={current:0,total:0},l._lastDuration=null,l._playableRegionStartTime=0,l._localStartTimeCorrelation=null,l._localEndTimeCorrelation=null,l._playableRegionDuration=0,l._programDateTime=0,l._durationExcludesAfterLiveSyncPoint=!1,l._segmentTargetDuration=null,l._playlistType=null,l._recoverAttemptsRemaining=l.options.hlsRecoverAttempts||16,l}return(0,u.default)(t,e),(0,l.default)(t,[{key:"name",get:function(){return"hls"}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel},set:function(e){this._currentLevel=e,this.trigger(f.default.PLAYBACK_LEVEL_SWITCH_START),this.options.playback.hlsUseNextLevel?this._hls.nextLevel=this._currentLevel:this._hls.currentLevel=this._currentLevel}},{key:"isReady",get:function(){return this._isReadyState}},{key:"_startTime",get:function(){return this._playbackType===h.default.LIVE&&"EVENT"!==this._playlistType?this._extrapolatedStartTime:this._playableRegionStartTime}},{key:"_now",get:function(){return(0,p.now)()}},{key:"_extrapolatedStartTime",get:function(){if(!this._localStartTimeCorrelation)return this._playableRegionStartTime;var e=this._localStartTimeCorrelation,t=this._now-e.local,n=(e.remote+t)/1e3;return Math.min(n,this._playableRegionStartTime+this._extrapolatedWindowDuration)}},{key:"_extrapolatedEndTime",get:function(){var e=this._playableRegionStartTime+this._playableRegionDuration;if(!this._localEndTimeCorrelation)return e;var t=this._localEndTimeCorrelation,n=this._now-t.local,r=(t.remote+n)/1e3;return Math.max(e-this._extrapolatedWindowDuration,Math.min(r,e))}},{key:"_duration",get:function(){return this._extrapolatedEndTime-this._startTime}},{key:"_extrapolatedWindowDuration",get:function(){return null===this._segmentTargetDuration?0:this._extrapolatedWindowNumSegments*this._segmentTargetDuration}}],[{key:"HLSJS",get:function(){return d.default}}]),t.prototype._setup=function(){var e=this;this._ccIsSetup=!1,this._ccTracksUpdated=!1,this._hls=new d.default((0,p.assign)({},this.options.playback.hlsjsConfig)),this._hls.on(d.default.Events.MEDIA_ATTACHED,(function(){return e._hls.loadSource(e.options.src)})),this._hls.on(d.default.Events.LEVEL_LOADED,(function(t,n){return e._updatePlaybackType(t,n)})),this._hls.on(d.default.Events.LEVEL_UPDATED,(function(t,n){return e._onLevelUpdated(t,n)})),this._hls.on(d.default.Events.LEVEL_SWITCHING,(function(t,n){return e._onLevelSwitch(t,n)})),this._hls.on(d.default.Events.FRAG_LOADED,(function(t,n){return e._onFragmentLoaded(t,n)})),this._hls.on(d.default.Events.ERROR,(function(t,n){return e._onHLSJSError(t,n)})),this._hls.on(d.default.Events.SUBTITLE_TRACK_LOADED,(function(t,n){return e._onSubtitleLoaded(t,n)})),this._hls.on(d.default.Events.SUBTITLE_TRACKS_UPDATED,(function(){return e._ccTracksUpdated=!0})),this._hls.attachMedia(this.el)},t.prototype.render=function(){return this._ready(),e.prototype.render.call(this)},t.prototype._ready=function(){this._isReadyState=!0,this.trigger(f.default.PLAYBACK_READY,this.name)},t.prototype._recover=function(e,t,n){if(this._recoveredDecodingError)if(this._recoveredAudioCodecError){m.default.error("hlsjs: failed to recover",{evt:e,data:t}),n.level=g.default.Levels.FATAL;var r=this.createError(n);this.trigger(f.default.PLAYBACK_ERROR,r),this.stop()}else this._recoveredAudioCodecError=!0,this._hls.swapAudioCodec(),this._hls.recoverMediaError();else this._recoveredDecodingError=!0,this._hls.recoverMediaError()},t.prototype._setupSrc=function(e){},t.prototype._startTimeUpdateTimer=function(){var e=this;this._timeUpdateTimer||(this._timeUpdateTimer=setInterval((function(){e._onDurationChange(),e._onTimeUpdate()}),100))},t.prototype._stopTimeUpdateTimer=function(){this._timeUpdateTimer&&(clearInterval(this._timeUpdateTimer),this._timeUpdateTimer=null)},t.prototype.getProgramDateTime=function(){return this._programDateTime},t.prototype.getDuration=function(){return this._duration},t.prototype.getCurrentTime=function(){return Math.max(0,this.el.currentTime-this._startTime)},t.prototype.getStartTimeOffset=function(){return this._startTime},t.prototype.seekPercentage=function(e){var t=this._duration;e>0&&(t=this._duration*(e/100)),this.seek(t)},t.prototype.seek=function(t){t<0&&(m.default.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),t=this.getDuration()),this.dvrEnabled&&this._updateDvr(t<this.getDuration()-3),t+=this._startTime,e.prototype.seek.call(this,t)},t.prototype.seekToLivePoint=function(){this.seek(this.getDuration())},t.prototype._updateDvr=function(e){this.trigger(f.default.PLAYBACK_DVR,e),this.trigger(f.default.PLAYBACK_STATS_ADD,{dvr:e})},t.prototype._updateSettings=function(){this._playbackType===h.default.VOD?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(f.default.PLAYBACK_SETTINGSUPDATE)},t.prototype._onHLSJSError=function(e,t){var n={code:t.type+"_"+t.details,description:this.name+" error: type: "+t.type+", details: "+t.details,raw:t},r=void 0;if(t.response&&(n.description+=", response: "+(0,i.default)(t.response)),t.fatal)if(this._recoverAttemptsRemaining>0)switch(this._recoverAttemptsRemaining-=1,t.type){case d.default.ErrorTypes.NETWORK_ERROR:switch(t.details){case d.default.ErrorDetails.MANIFEST_LOAD_ERROR:case d.default.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case d.default.ErrorDetails.MANIFEST_PARSING_ERROR:case d.default.ErrorDetails.LEVEL_LOAD_ERROR:case d.default.ErrorDetails.LEVEL_LOAD_TIMEOUT:m.default.error("hlsjs: unrecoverable network fatal error.",{evt:e,data:t}),r=this.createError(n),this.trigger(f.default.PLAYBACK_ERROR,r),this.stop();break;default:m.default.warn("hlsjs: trying to recover from network error.",{evt:e,data:t}),n.level=g.default.Levels.WARN,this.createError(n),this._hls.startLoad()}break;case d.default.ErrorTypes.MEDIA_ERROR:m.default.warn("hlsjs: trying to recover from media error.",{evt:e,data:t}),n.level=g.default.Levels.WARN,this.createError(n),this._recover(e,t,n);break;default:m.default.error("hlsjs: could not recover from error.",{evt:e,data:t}),r=this.createError(n),this.trigger(f.default.PLAYBACK_ERROR,r),this.stop()}else m.default.error("hlsjs: could not recover from error after maximum number of attempts.",{evt:e,data:t}),r=this.createError(n),this.trigger(f.default.PLAYBACK_ERROR,r),this.stop();else{if(this.options.playback.triggerFatalErrorOnResourceDenied&&this._keyIsDenied(t))return m.default.error("hlsjs: could not load decrypt key.",{evt:e,data:t}),r=this.createError(n),this.trigger(f.default.PLAYBACK_ERROR,r),void this.stop();n.level=g.default.Levels.WARN,this.createError(n),m.default.warn("hlsjs: non-fatal error occurred",{evt:e,data:t})}},t.prototype._keyIsDenied=function(e){return e.type===d.default.ErrorTypes.NETWORK_ERROR&&e.details===d.default.ErrorDetails.KEY_LOAD_ERROR&&e.response&&e.response.code>=400},t.prototype._onTimeUpdate=function(){var e={current:this.getCurrentTime(),total:this.getDuration(),firstFragDateTime:this.getProgramDateTime()};this._lastTimeUpdate&&e.current===this._lastTimeUpdate.current&&e.total===this._lastTimeUpdate.total||(this._lastTimeUpdate=e,this.trigger(f.default.PLAYBACK_TIMEUPDATE,e,this.name))},t.prototype._onDurationChange=function(){var t=this.getDuration();this._lastDuration!==t&&(this._lastDuration=t,e.prototype._onDurationChange.call(this))},t.prototype._onProgress=function(){if(this.el.buffered.length){for(var e=[],t=0,n=0;n<this.el.buffered.length;n++)e=[].concat((0,r.default)(e),[{start:Math.max(0,this.el.buffered.start(n)-this._playableRegionStartTime),end:Math.max(0,this.el.buffered.end(n)-this._playableRegionStartTime)}]),this.el.currentTime>=e[n].start&&this.el.currentTime<=e[n].end&&(t=n);var i={start:e[t].start,current:e[t].end,total:this.getDuration()};this.trigger(f.default.PLAYBACK_PROGRESS,i,e)}},t.prototype.play=function(){this._hls||this._setup(),e.prototype.play.call(this),this._startTimeUpdateTimer()},t.prototype.pause=function(){this._hls&&(e.prototype.pause.call(this),this.dvrEnabled&&this._updateDvr(!0))},t.prototype.stop=function(){this._stopTimeUpdateTimer(),this._hls&&(e.prototype.stop.call(this),this._hls.destroy(),delete this._hls)},t.prototype.destroy=function(){this._stopTimeUpdateTimer(),this._hls&&(this._hls.destroy(),delete this._hls),e.prototype.destroy.call(this)},t.prototype._updatePlaybackType=function(e,t){this._playbackType=t.details.live?h.default.LIVE:h.default.VOD,this._onLevelUpdated(e,t),this._ccTracksUpdated&&this._playbackType===h.default.LIVE&&this.hasClosedCaptionsTracks&&this._onSubtitleLoaded()},t.prototype._fillLevels=function(){this._levels=this._hls.levels.map((function(e,t){return{id:t,level:e,label:e.bitrate/1e3+"Kbps"}})),this.trigger(f.default.PLAYBACK_LEVELS_AVAILABLE,this._levels)},t.prototype._onLevelUpdated=function(e,t){this._segmentTargetDuration=t.details.targetduration,this._playlistType=t.details.type||null;var n=!1,r=!1,i=t.details.fragments,a=this._playableRegionStartTime,o=this._playableRegionDuration;if(0!==i.length){if(i[0].rawProgramDateTime&&(this._programDateTime=i[0].rawProgramDateTime),this._playableRegionStartTime!==i[0].start&&(n=!0,this._playableRegionStartTime=i[0].start),n)if(this._localStartTimeCorrelation){var s=this._localStartTimeCorrelation,l=this._now-s.local,u=(s.remote+l)/1e3;u<i[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*i[0].start}:u>a+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(i[0].start,a+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(i[0].start+this._extrapolatedWindowDuration/2)};var c=t.details.totalduration;if(this._playbackType===h.default.LIVE){var f=t.details.targetduration*((this.options.playback.hlsjsConfig||{}).liveSyncDurationCount||d.default.DefaultConfig.liveSyncDurationCount);f<=c?(c-=f,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}c!==this._playableRegionDuration&&(r=!0,this._playableRegionDuration=c);var p=i[0].start+c,m=a+o;if(p!==m)if(this._localEndTimeCorrelation){var g=this._localEndTimeCorrelation,y=this._now-g.local,v=(g.remote+y)/1e3;v>p?this._localEndTimeCorrelation={local:this._now,remote:1e3*p}:v<p-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(p-this._extrapolatedWindowDuration)}:v>m&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*m})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*p};r&&this._onDurationChange(),n&&this._onProgress()}},t.prototype._onFragmentLoaded=function(e,t){this.trigger(f.default.PLAYBACK_FRAGMENT_LOADED,t)},t.prototype._onSubtitleLoaded=function(){if(!this._ccIsSetup){this.trigger(f.default.PLAYBACK_SUBTITLE_AVAILABLE);var e=this._playbackType===h.default.LIVE?-1:this.closedCaptionsTrackId;this.closedCaptionsTrackId=e,this._ccIsSetup=!0}},t.prototype._onLevelSwitch=function(e,t){this.levels.length||this._fillLevels(),this.trigger(f.default.PLAYBACK_LEVEL_SWITCH_END),this.trigger(f.default.PLAYBACK_LEVEL_SWITCH,t);var n=this._hls.levels[t.level];n&&(this.highDefinition=n.height>=720||n.bitrate/1e3>=2e3,this.trigger(f.default.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(f.default.PLAYBACK_BITRATE,{height:n.height,width:n.width,bandwidth:n.bitrate,bitrate:n.bitrate,level:t.level}))},t.prototype.getPlaybackType=function(){return this._playbackType},t.prototype.isSeekEnabled=function(){return this._playbackType===h.default.VOD||this.dvrEnabled},(0,l.default)(t,[{key:"dvrEnabled",get:function(){return this._durationExcludesAfterLiveSyncPoint&&this._duration>=this._minDvrSize&&this.getPlaybackType()===h.default.LIVE}}]),t}(c.default);t.default=v,v.canPlay=function(e,t){var n=e.split("?")[0].match(/.*\.(.*)$/)||[],r=n.length>1&&"m3u8"===n[1].toLowerCase()||(0,p.listContainsIgnoreCase)(t,["application/vnd.apple.mpegurl","application/x-mpegURL"]);return!(!d.default.isSupported()||!r)},e.exports=t.default},"./src/playbacks/hls/index.js": -/*!************************************!*\ - !*** ./src/playbacks/hls/index.js ***! - \************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./hls */"./src/playbacks/hls/hls.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/playbacks/html5_audio/html5_audio.js": -/*!**************************************************!*\ - !*** ./src/playbacks/html5_audio/html5_audio.js ***! - \**************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=c(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),a=c(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=c(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=c(n(/*! ../../base/events */"./src/base/events.js")),l=c(n(/*! ../../base/playback */"./src/base/playback.js")),u=c(n(/*! ../../playbacks/html5_video */"./src/playbacks/html5_video/index.js"));function c(e){return e&&e.__esModule?e:{default:e}}var d=function(e){function t(){return(0,r.default)(this,t),(0,a.default)(this,e.apply(this,arguments))}return(0,o.default)(t,e),t.prototype.updateSettings=function(){this.settings.left=["playpause","position","duration"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(s.default.PLAYBACK_SETTINGSUPDATE)},t.prototype.getPlaybackType=function(){return l.default.AOD},(0,i.default)(t,[{key:"name",get:function(){return"html5_audio"}},{key:"tagName",get:function(){return"audio"}},{key:"isAudioOnly",get:function(){return!0}}]),t}(u.default);t.default=d,d.canPlay=function(e,t){return u.default._canPlay("audio",{wav:["audio/wav"],mp3:["audio/mp3",'audio/mpeg;codecs="mp3"'],aac:['audio/mp4;codecs="mp4a.40.5"'],oga:["audio/ogg"]},e,t)},e.exports=t.default},"./src/playbacks/html5_audio/index.js": -/*!********************************************!*\ - !*** ./src/playbacks/html5_audio/index.js ***! - \********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./html5_audio */"./src/playbacks/html5_audio/html5_audio.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/playbacks/html5_video/html5_video.js": -/*!**************************************************!*\ - !*** ./src/playbacks/html5_video/html5_video.js ***! - \**************************************************/ -/*! no static exports found */function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var i=_(n(/*! babel-runtime/core-js/array/from */"./node_modules/babel-runtime/core-js/array/from.js")),a=_(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),o=_(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),s=_(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),l=_(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),u=_(n(/*! babel-runtime/helpers/toConsumableArray */"./node_modules/babel-runtime/helpers/toConsumableArray.js")),c=_(n(/*! babel-runtime/core-js/object/keys */"./node_modules/babel-runtime/core-js/object/keys.js")),d=n(/*! ../../base/utils */"./src/base/utils.js"),f=_(n(/*! ../../base/playback */"./src/base/playback.js")),h=_(n(/*! ../../components/browser */"./src/components/browser/index.js")),p=_(n(/*! ../../components/error */"./src/components/error/index.js")),m=_(n(/*! ../../base/events */"./src/base/events.js")),g=_(n(/*! ../../plugins/log */"./src/plugins/log/index.js")),y=_(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js")),v=_(n(/*! ../../base/template */"./src/base/template.js")),b=_(n(/*! ./public/tracks.html */"./src/playbacks/html5_video/public/tracks.html"));function _(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/style.scss */"./src/playbacks/html5_video/public/style.scss");var A={mp4:["avc1.42E01E","avc1.58A01E","avc1.4D401E","avc1.64001E","mp4v.20.8","mp4v.20.240","mp4a.40.2"].map((function(e){return'video/mp4; codecs="'+e+', mp4a.40.2"'})),ogg:['video/ogg; codecs="theora, vorbis"','video/ogg; codecs="dirac"','video/ogg; codecs="theora, speex"'],"3gpp":['video/3gpp; codecs="mp4v.20.8, samr"'],webm:['video/webm; codecs="vp8, vorbis"'],mkv:['video/x-matroska; codecs="theora, vorbis"'],m3u8:["application/x-mpegurl"]};A.ogv=A.ogg,A["3gp"]=A["3gpp"];var E={wav:["audio/wav"],mp3:["audio/mp3",'audio/mpeg;codecs="mp3"'],aac:['audio/mp4;codecs="mp4a.40.5"'],oga:["audio/ogg"]},T=(0,c.default)(E).reduce((function(e,t){return[].concat((0,u.default)(e),(0,u.default)(E[t]))}),[]),w={code:"unknown",message:"unknown"},S=function(e){function t(){(0,a.default)(this,t);for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var s=(0,o.default)(this,e.call.apply(e,[this].concat(r)));s._destroyed=!1,s._loadStarted=!1,s._isBuffering=!1,s._playheadMoving=!1,s._playheadMovingTimer=null,s._stopped=!1,s._ccTrackId=-1,s._setupSrc(s.options.src),s.options.playback||(s.options.playback=s.options||{}),s.options.playback.disableContextMenu=s.options.playback.disableContextMenu||s.options.disableVideoTagContextMenu;var l=s.options.playback,u=l.preload||(h.default.isSafari?"auto":s.options.preload),c=void 0;return s.options.poster&&("string"==typeof s.options.poster?c=s.options.poster:"string"==typeof s.options.poster.url&&(c=s.options.poster.url)),y.default.extend(s.el,{muted:s.options.mute,defaultMuted:s.options.mute,loop:s.options.loop,poster:c,preload:u||"metadata",controls:(l.controls||s.options.useVideoTagDefaultControls)&&"controls",crossOrigin:l.crossOrigin,"x-webkit-playsinline":l.playInline}),l.playInline&&s.$el.attr({playsinline:"playsinline"}),l.crossOrigin&&s.$el.attr({crossorigin:l.crossOrigin}),s.settings={default:["seekbar"]},s.settings.left=["playpause","position","duration"],s.settings.right=["fullscreen","volume","hd-indicator"],l.externalTracks&&s._setupExternalTracks(l.externalTracks),s.options.autoPlay&&s.attemptAutoPlay(),s}return(0,l.default)(t,e),(0,s.default)(t,[{key:"name",get:function(){return"html5_video"}},{key:"tagName",get:function(){return this.isAudioOnly?"audio":"video"}},{key:"isAudioOnly",get:function(){var e=this.options.src,n=t._mimeTypesForUrl(e,E,this.options.mimeType);return this.options.playback&&this.options.playback.audioOnly||this.options.audioOnly||T.indexOf(n[0])>=0}},{key:"attributes",get:function(){return{"data-html5-video":""}}},{key:"events",get:function(){return{canplay:"_onCanPlay",canplaythrough:"_handleBufferingEvents",durationchange:"_onDurationChange",ended:"_onEnded",error:"_onError",loadeddata:"_onLoadedData",loadedmetadata:"_onLoadedMetadata",pause:"_onPause",playing:"_onPlaying",progress:"_onProgress",seeking:"_onSeeking",seeked:"_onSeeked",stalled:"_handleBufferingEvents",timeupdate:"_onTimeUpdate",waiting:"_onWaiting"}}},{key:"ended",get:function(){return this.el.ended}},{key:"buffering",get:function(){return this._isBuffering}}]),t.prototype.configure=function(t){e.prototype.configure.call(this,t),this.el.loop=!!t.loop},t.prototype.attemptAutoPlay=function(){var e=this;this.canAutoPlay((function(t,n){n&&g.default.warn(e.name,"autoplay error.",{result:t,error:n}),t&&r.nextTick((function(){return!e._destroyed&&e.play()}))}))},t.prototype.canAutoPlay=function(e){this.options.disableCanAutoPlay&&e(!0,null);var t={timeout:this.options.autoPlayTimeout||500,inline:this.options.playback.playInline||!1,muted:this.options.mute||!1};h.default.isMobile&&d.DomRecycler.options.recycleVideo&&(t.element=this.el),(0,d.canAutoPlayMedia)(e,t)},t.prototype._setupExternalTracks=function(e){this._externalTracks=e.map((function(e){return{kind:e.kind||"subtitles",label:e.label,lang:e.lang,src:e.src}}))},t.prototype._setupSrc=function(e){this.el.src!==e&&(this._ccIsSetup=!1,this.el.src=e,this._src=this.el.src)},t.prototype._onLoadedMetadata=function(e){this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_LOADEDMETADATA,{duration:e.target.duration,data:e}),this._updateSettings();var t=void 0===this._options.autoSeekFromUrl||this._options.autoSeekFromUrl;this.getPlaybackType()!==f.default.LIVE&&t&&this._checkInitialSeek()},t.prototype._onDurationChange=function(){this._updateSettings(),this._onTimeUpdate(),this._onProgress()},t.prototype._updateSettings=function(){this.getPlaybackType()===f.default.VOD||this.getPlaybackType()===f.default.AOD?this.settings.left=["playpause","position","duration"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(m.default.PLAYBACK_SETTINGSUPDATE)},t.prototype.isSeekEnabled=function(){return isFinite(this.getDuration())},t.prototype.getPlaybackType=function(){var e="audio"===this.tagName?f.default.AOD:f.default.VOD;return[0,void 0,1/0].indexOf(this.el.duration)>=0?f.default.LIVE:e},t.prototype.isHighDefinitionInUse=function(){return!1},t.prototype.consent=function(){this.isPlaying()||(e.prototype.consent.call(this),this.el.load())},t.prototype.play=function(){this.trigger(m.default.PLAYBACK_PLAY_INTENT),this._stopped=!1,this._setupSrc(this._src),this._handleBufferingEvents();var e=this.el.play();e&&e.catch&&e.catch((function(){}))},t.prototype.pause=function(){this.el.pause()},t.prototype.stop=function(){this.pause(),this._stopped=!0,this.el.removeAttribute("src"),this.el.load(),this._stopPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_STOP)},t.prototype.volume=function(e){0===e?(this.$el.attr({muted:"true"}),this.el.muted=!0):(this.$el.attr({muted:null}),this.el.muted=!1,this.el.volume=e/100)},t.prototype.mute=function(){this.el.muted=!0},t.prototype.unmute=function(){this.el.muted=!1},t.prototype.isMuted=function(){return!0===this.el.muted||0===this.el.volume},t.prototype.isPlaying=function(){return!this.el.paused&&!this.el.ended},t.prototype._startPlayheadMovingChecks=function(){null===this._playheadMovingTimer&&(this._playheadMovingTimeOnCheck=null,this._determineIfPlayheadMoving(),this._playheadMovingTimer=setInterval(this._determineIfPlayheadMoving.bind(this),500))},t.prototype._stopPlayheadMovingChecks=function(){null!==this._playheadMovingTimer&&(clearInterval(this._playheadMovingTimer),this._playheadMovingTimer=null,this._playheadMoving=!1)},t.prototype._determineIfPlayheadMoving=function(){var e=this._playheadMovingTimeOnCheck,t=this.el.currentTime;this._playheadMoving=e!==t,this._playheadMovingTimeOnCheck=t,this._handleBufferingEvents()},t.prototype._onWaiting=function(){this._loadStarted=!0,this._handleBufferingEvents()},t.prototype._onLoadedData=function(){this._loadStarted=!0,this._handleBufferingEvents()},t.prototype._onCanPlay=function(){this._handleBufferingEvents()},t.prototype._onPlaying=function(){this._checkForClosedCaptions(),this._startPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_PLAY)},t.prototype._onPause=function(){this._stopPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_PAUSE)},t.prototype._onSeeking=function(){this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_SEEK)},t.prototype._onSeeked=function(){this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_SEEKED)},t.prototype._onEnded=function(){this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_ENDED,this.name)},t.prototype._handleBufferingEvents=function(){var e=!this.el.ended&&!this.el.paused,t=this._loadStarted&&!this.el.ended&&!this._stopped&&(e&&!this._playheadMoving||this.el.readyState<this.el.HAVE_FUTURE_DATA);this._isBuffering!==t&&(this._isBuffering=t,t?this.trigger(m.default.PLAYBACK_BUFFERING,this.name):this.trigger(m.default.PLAYBACK_BUFFERFULL,this.name))},t.prototype._onError=function(){var e=this.el.error||w,t=e.code,n=e.message,r=t===w.code,i=this.createError({code:t,description:n,raw:this.el.error,level:r?p.default.Levels.WARN:p.default.Levels.FATAL});r?g.default.warn(this.name,"HTML5 unknown error: ",i):this.trigger(m.default.PLAYBACK_ERROR,i)},t.prototype.destroy=function(){this._destroyed=!0,this.handleTextTrackChange&&this.el.textTracks.removeEventListener("change",this.handleTextTrackChange),e.prototype.destroy.call(this),this.el.removeAttribute("src"),this.el.load(),this._src=null,d.DomRecycler.garbage(this.$el)},t.prototype.seek=function(e){this.el.currentTime=e},t.prototype.seekPercentage=function(e){var t=this.el.duration*(e/100);this.seek(t)},t.prototype._checkInitialSeek=function(){var e=(0,d.seekStringToSeconds)();0!==e&&this.seek(e)},t.prototype.getCurrentTime=function(){return this.el.currentTime},t.prototype.getDuration=function(){return this.el.duration},t.prototype._onTimeUpdate=function(){this.getPlaybackType()===f.default.LIVE?this.trigger(m.default.PLAYBACK_TIMEUPDATE,{current:1,total:1},this.name):this.trigger(m.default.PLAYBACK_TIMEUPDATE,{current:this.el.currentTime,total:this.el.duration},this.name)},t.prototype._onProgress=function(){if(this.el.buffered.length){for(var e=[],t=0,n=0;n<this.el.buffered.length;n++)e=[].concat((0,u.default)(e),[{start:this.el.buffered.start(n),end:this.el.buffered.end(n)}]),this.el.currentTime>=e[n].start&&this.el.currentTime<=e[n].end&&(t=n);var r={start:e[t].start,current:e[t].end,total:this.el.duration};this.trigger(m.default.PLAYBACK_PROGRESS,r,e)}},t.prototype._typeFor=function(e){var n=t._mimeTypesForUrl(e,A,this.options.mimeType);return 0===n.length&&(n=t._mimeTypesForUrl(e,E,this.options.mimeType)),(n[0]||"").split(";")[0]},t.prototype._ready=function(){this._isReadyState||(this._isReadyState=!0,this.trigger(m.default.PLAYBACK_READY,this.name))},t.prototype._checkForClosedCaptions=function(){if(this.isHTML5Video&&!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(m.default.PLAYBACK_SUBTITLE_AVAILABLE);var e=this.closedCaptionsTrackId;this.closedCaptionsTrackId=e,this.handleTextTrackChange=this._handleTextTrackChange.bind(this),this.el.textTracks.addEventListener("change",this.handleTextTrackChange)}this._ccIsSetup=!0}},t.prototype._handleTextTrackChange=function(){var e=this.closedCaptionsTracks.find((function(e){return"showing"===e.track.mode}))||{id:-1};this._ccTrackId!==e.id&&(this._ccTrackId=e.id,this.trigger(m.default.PLAYBACK_SUBTITLE_CHANGED,{id:e.id}))},t.prototype.render=function(){return this.options.playback.disableContextMenu&&this.$el.on("contextmenu",(function(){return!1})),this._externalTracks&&this._externalTracks.length>0&&this.$el.html(this.template({tracks:this._externalTracks})),this._ready(),this},(0,s.default)(t,[{key:"isReady",get:function(){return this._isReadyState}},{key:"isHTML5Video",get:function(){return this.name===t.prototype.name}},{key:"closedCaptionsTracks",get:function(){var e=0;return(this.el.textTracks?(0,i.default)(this.el.textTracks):[]).filter((function(e){return"subtitles"===e.kind||"captions"===e.kind})).map((function(t){return{id:e++,name:t.label,track:t}}))}},{key:"closedCaptionsTrackId",get:function(){return this._ccTrackId},set:function(e){if((0,d.isNumber)(e)){var t=this.closedCaptionsTracks,n=void 0;if(-1!==e){if(!(n=t.find((function(t){return t.id===e}))))return;if("showing"===n.track.mode)return}t.filter((function(e){return"hidden"!==e.track.mode})).forEach((function(e){return e.track.mode="hidden"})),n&&(n.track.mode="showing"),this._ccTrackId=e,this.trigger(m.default.PLAYBACK_SUBTITLE_CHANGED,{id:e})}}},{key:"template",get:function(){return(0,v.default)(b.default)}}]),t}(f.default);t.default=S,S._mimeTypesForUrl=function(e,t,n){var r=(e.split("?")[0].match(/.*\.(.*)$/)||[])[1],i=n||r&&t[r.toLowerCase()]||[];return i.constructor===Array?i:[i]},S._canPlay=function(e,t,n,r){var i=S._mimeTypesForUrl(n,t,r),a=document.createElement(e);return!!i.filter((function(e){return!!a.canPlayType(e).replace(/no/,"")}))[0]},S.canPlay=function(e,t){return S._canPlay("audio",E,e,t)||S._canPlay("video",A,e,t)},e.exports=t.default}).call(this,n(/*! ./../../../node_modules/node-libs-browser/node_modules/process/browser.js */"./node_modules/node-libs-browser/node_modules/process/browser.js"))},"./src/playbacks/html5_video/index.js": -/*!********************************************!*\ - !*** ./src/playbacks/html5_video/index.js ***! - \********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./html5_video */"./src/playbacks/html5_video/html5_video.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/playbacks/html5_video/public/style.scss": -/*!*****************************************************!*\ - !*** ./src/playbacks/html5_video/public/style.scss ***! - \*****************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/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/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/html5_video/public/style.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/playbacks/html5_video/public/tracks.html": -/*!******************************************************!*\ - !*** ./src/playbacks/html5_video/public/tracks.html ***! - \******************************************************/ -/*! no static exports found */function(e,t){e.exports='<% for (var i = 0; i < tracks.length; i++) { %>\n <track data-html5-video-track="<%= i %>" kind="<%= tracks[i].kind %>" label="<%= tracks[i].label %>" srclang="<%= tracks[i].lang %>" src="<%= tracks[i].src %>" />\n<% }; %>\n'},"./src/playbacks/html_img/html_img.js": -/*!********************************************!*\ - !*** ./src/playbacks/html_img/html_img.js ***! - \********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=u(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=u(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=u(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=u(n(/*! ../../base/playback */"./src/base/playback.js")),l=u(n(/*! ../../base/events */"./src/base/events.js"));function u(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/style.scss */"./src/playbacks/html_img/public/style.scss");var c=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a.el.src=n.src,a}return(0,o.default)(t,e),t.prototype.getPlaybackType=function(){return s.default.NO_OP},(0,a.default)(t,[{key:"name",get:function(){return"html_img"}},{key:"tagName",get:function(){return"img"}},{key:"attributes",get:function(){return{"data-html-img":""}}},{key:"events",get:function(){return{load:"_onLoad",abort:"_onError",error:"_onError"}}}]),t.prototype.render=function(){return this.trigger(l.default.PLAYBACK_READY,this.name),this},t.prototype._onLoad=function(){this.trigger(l.default.PLAYBACK_ENDED,this.name)},t.prototype._onError=function(e){var t="error"===e.type?"load error":"loading aborted";this.trigger(l.default.PLAYBACK_ERROR,{message:t},this.name)},t}(s.default);t.default=c,c.canPlay=function(e){return/\.(png|jpg|jpeg|gif|bmp|tiff|pgm|pnm|webp)(|\?.*)$/i.test(e)},e.exports=t.default},"./src/playbacks/html_img/index.js": -/*!*****************************************!*\ - !*** ./src/playbacks/html_img/index.js ***! - \*****************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./html_img */"./src/playbacks/html_img/html_img.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/playbacks/html_img/public/style.scss": -/*!**************************************************!*\ - !*** ./src/playbacks/html_img/public/style.scss ***! - \**************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/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/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/html_img/public/style.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/playbacks/no_op/index.js": -/*!**************************************!*\ - !*** ./src/playbacks/no_op/index.js ***! - \**************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./no_op */"./src/playbacks/no_op/no_op.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/playbacks/no_op/no_op.js": -/*!**************************************!*\ - !*** ./src/playbacks/no_op/no_op.js ***! - \**************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=f(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=f(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=f(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=f(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=n(/*! ../../base/utils */"./src/base/utils.js"),l=f(n(/*! ../../base/playback */"./src/base/playback.js")),u=f(n(/*! ../../base/template */"./src/base/template.js")),c=f(n(/*! ../../base/events */"./src/base/events.js")),d=f(n(/*! ./public/error.html */"./src/playbacks/no_op/public/error.html"));function f(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/style.scss */"./src/playbacks/no_op/public/style.scss");var h=function(e){function t(){(0,r.default)(this,t);for(var n=arguments.length,a=Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=(0,i.default)(this,e.call.apply(e,[this].concat(a)));return s._noiseFrameNum=-1,s}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"no_op"}},{key:"template",get:function(){return(0,u.default)(d.default)}},{key:"attributes",get:function(){return{"data-no-op":""}}}]),t.prototype.render=function(){var e=this.options.playbackNotSupportedMessage||this.i18n.t("playback_not_supported");this.$el.html(this.template({message:e})),this.trigger(c.default.PLAYBACK_READY,this.name);var t=!(!this.options.poster||!this.options.poster.showForNoOp);return!this.options.autoPlay&&t||this._animate(),this},t.prototype._noise=function(){if(this._noiseFrameNum=(this._noiseFrameNum+1)%5,!this._noiseFrameNum){var e=this.context.createImageData(this.context.canvas.width,this.context.canvas.height),t=void 0;try{t=new Uint32Array(e.data.buffer)}catch(i){t=new Uint32Array(this.context.canvas.width*this.context.canvas.height*4);for(var n=e.data,r=0;r<n.length;r++)t[r]=n[r]}for(var i=t.length,a=6*Math.random()+4,o=0,s=0,l=0;l<i;)o<0&&(o=a*Math.random(),s=255*Math.pow(Math.random(),.4)<<24),o-=1,t[l++]=s;this.context.putImageData(e,0,0)}},t.prototype._loop=function(){var e=this;this._stop||(this._noise(),this._animationHandle=(0,s.requestAnimationFrame)((function(){return e._loop()})))},t.prototype.destroy=function(){this._animationHandle&&((0,s.cancelAnimationFrame)(this._animationHandle),this._stop=!0)},t.prototype._animate=function(){this.canvas=this.$el.find("canvas[data-no-op-canvas]")[0],this.context=this.canvas.getContext("2d"),this._loop()},t}(l.default);t.default=h,h.canPlay=function(e){return!0},e.exports=t.default},"./src/playbacks/no_op/public/error.html": -/*!***********************************************!*\ - !*** ./src/playbacks/no_op/public/error.html ***! - \***********************************************/ -/*! no static exports found */function(e,t){e.exports="<canvas data-no-op-canvas></canvas>\n<p data-no-op-msg><%=message%><p>\n"},"./src/playbacks/no_op/public/style.scss": -/*!***********************************************!*\ - !*** ./src/playbacks/no_op/public/style.scss ***! - \***********************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/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/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/playbacks/no_op/public/style.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/plugins/click_to_pause/click_to_pause.js": -/*!******************************************************!*\ - !*** ./src/plugins/click_to_pause/click_to_pause.js ***! - \******************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=c(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=c(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=c(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=c(n(/*! ../../base/container_plugin */"./src/base/container_plugin.js")),l=c(n(/*! ../../base/events */"./src/base/events.js")),u=c(n(/*! ../../base/playback */"./src/base/playback.js"));function c(e){return e&&e.__esModule?e:{default:e}}var d=function(e){function t(n){return(0,r.default)(this,t),(0,i.default)(this,e.call(this,n))}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"click_to_pause"}}]),t.prototype.bindEvents=function(){this.listenTo(this.container,l.default.CONTAINER_CLICK,this.click),this.listenTo(this.container,l.default.CONTAINER_SETTINGSUPDATE,this.settingsUpdate)},t.prototype.click=function(){(this.container.getPlaybackType()!==u.default.LIVE||this.container.isDvrEnabled())&&(this.container.isPlaying()?this.container.pause():this.container.play())},t.prototype.settingsUpdate=function(){var e=this.container.getPlaybackType()!==u.default.LIVE||this.container.isDvrEnabled();if(e!==this.pointerEnabled){var t=e?"addClass":"removeClass";this.container.$el[t]("pointer-enabled"),this.pointerEnabled=e}},t}(s.default);t.default=d,e.exports=t.default},"./src/plugins/click_to_pause/index.js": -/*!*********************************************!*\ - !*** ./src/plugins/click_to_pause/index.js ***! - \*********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./click_to_pause */"./src/plugins/click_to_pause/click_to_pause.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/closed_captions/closed_captions.js": -/*!********************************************************!*\ - !*** ./src/plugins/closed_captions/closed_captions.js ***! - \********************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=f(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=f(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=f(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=f(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=f(n(/*! ../../base/ui_core_plugin */"./src/base/ui_core_plugin.js")),l=f(n(/*! ../../base/template */"./src/base/template.js")),u=f(n(/*! ../../base/events */"./src/base/events.js")),c=n(/*! ../../base/utils */"./src/base/utils.js"),d=f(n(/*! ./public/closed_captions.html */"./src/plugins/closed_captions/public/closed_captions.html"));function f(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/closed_captions.scss */"./src/plugins/closed_captions/public/closed_captions.scss");var h=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n)),o=n.options.closedCaptionsConfig;return a._title=o&&o.title?o.title:null,a._ariaLabel=o&&o.ariaLabel?o.ariaLabel:"cc-button",a._labelCb=o&&o.labelCallback&&"function"==typeof o.labelCallback?o.labelCallback:function(e){return e.name},a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"closed_captions"}},{key:"template",get:function(){return(0,l.default)(d.default)}},{key:"events",get:function(){return{"click [data-cc-button]":"toggleContextMenu","click [data-cc-select]":"onTrackSelect"}}},{key:"attributes",get:function(){return{class:"cc-controls","data-cc-controls":""}}}]),t.prototype.bindEvents=function(){this.listenTo(this.core,u.default.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged),this.listenTo(this.core.mediaControl,u.default.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,u.default.MEDIACONTROL_HIDE,this.hideContextMenu),this.container=this.core.getCurrentContainer(),this.container&&(this.listenTo(this.container,u.default.CONTAINER_SUBTITLE_AVAILABLE,this.onSubtitleAvailable),this.listenTo(this.container,u.default.CONTAINER_SUBTITLE_CHANGED,this.onSubtitleChanged),this.listenTo(this.container,u.default.CONTAINER_STOP,this.onContainerStop))},t.prototype.onContainerStop=function(){this.ccAvailable(!1)},t.prototype.containerChanged=function(){this.ccAvailable(!1),this.stopListening(),this.bindEvents()},t.prototype.onSubtitleAvailable=function(){this.renderCcButton(),this.ccAvailable(!0)},t.prototype.onSubtitleChanged=function(e){this.setCurrentContextMenuElement(e.id)},t.prototype.onTrackSelect=function(e){var t=parseInt(e.target.dataset.ccSelect,10);return this.container.closedCaptionsTrackId=t,this.hideContextMenu(),e.stopPropagation(),!1},t.prototype.ccAvailable=function(e){var t=e?"addClass":"removeClass";this.$el[t]("available")},t.prototype.toggleContextMenu=function(){this.$el.find("ul").toggle()},t.prototype.hideContextMenu=function(){this.$el.find("ul").hide()},t.prototype.contextMenuElement=function(e){return this.$el.find("ul a"+(isNaN(e)?"":'[data-cc-select="'+e+'"]')).parent()},t.prototype.setCurrentContextMenuElement=function(e){if(this._trackId!==e){this.contextMenuElement().removeClass("current"),this.contextMenuElement(e).addClass("current");var t=e>-1?"addClass":"removeClass";this.$ccButton[t]("enabled"),this._trackId=e}},t.prototype.renderCcButton=function(){for(var e=this.container?this.container.closedCaptionsTracks:[],t=0;t<e.length;t++)e[t].label=this._labelCb(e[t]);this.$el.html(this.template({ariaLabel:this._ariaLabel,disabledLabel:this.core.i18n.t("disabled"),title:this._title,tracks:e})),this.$ccButton=this.$el.find("button.cc-button[data-cc-button]"),this.$ccButton.append(c.SvgIcons.cc),this.$el.append(this.style)},t.prototype.render=function(){this.renderCcButton();var e=this.core.mediaControl.$el.find("button[data-fullscreen]");return e[0]?this.$el.insertAfter(e):this.core.mediaControl.$el.find(".media-control-right-panel[data-media-control]").prepend(this.$el),this},t}(s.default);t.default=h,e.exports=t.default},"./src/plugins/closed_captions/index.js": -/*!**********************************************!*\ - !*** ./src/plugins/closed_captions/index.js ***! - \**********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./closed_captions */"./src/plugins/closed_captions/closed_captions.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/closed_captions/public/closed_captions.html": -/*!*****************************************************************!*\ - !*** ./src/plugins/closed_captions/public/closed_captions.html ***! - \*****************************************************************/ -/*! no static exports found */function(e,t){e.exports='<button type="button" class="cc-button media-control-button media-control-icon" data-cc-button aria-label="<%= ariaLabel %>"></button>\n<ul>\n <% if (title) { %>\n <li data-title><%= title %></li>\n <% }; %>\n <li><a href="#" data-cc-select="-1"><%= disabledLabel %></a></li>\n <% for (var i = 0; i < tracks.length; i++) { %>\n <li><a href="#" data-cc-select="<%= tracks[i].id %>"><%= tracks[i].label %></a></li>\n <% }; %>\n</ul>\n'},"./src/plugins/closed_captions/public/closed_captions.scss": -/*!*****************************************************************!*\ - !*** ./src/plugins/closed_captions/public/closed_captions.scss ***! - \*****************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./closed_captions.scss */"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/closed_captions/public/closed_captions.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/plugins/dvr_controls/dvr_controls.js": -/*!**************************************************!*\ - !*** ./src/plugins/dvr_controls/dvr_controls.js ***! - \**************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=f(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=f(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=f(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=f(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=f(n(/*! ../../base/ui_core_plugin */"./src/base/ui_core_plugin.js")),l=f(n(/*! ../../base/template */"./src/base/template.js")),u=f(n(/*! ../../base/playback */"./src/base/playback.js")),c=f(n(/*! ../../base/events */"./src/base/events.js")),d=f(n(/*! ./public/index.html */"./src/plugins/dvr_controls/public/index.html"));function f(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/dvr_controls.scss */"./src/plugins/dvr_controls/public/dvr_controls.scss");var h=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a.settingsUpdate(),a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"template",get:function(){return(0,l.default)(d.default)}},{key:"name",get:function(){return"dvr_controls"}},{key:"events",get:function(){return{"click .live-button":"click"}}},{key:"attributes",get:function(){return{class:"dvr-controls","data-dvr-controls":""}}}]),t.prototype.bindEvents=function(){this.listenTo(this.core.mediaControl,c.default.MEDIACONTROL_CONTAINERCHANGED,this.containerChanged),this.listenTo(this.core.mediaControl,c.default.MEDIACONTROL_RENDERED,this.settingsUpdate),this.listenTo(this.core,c.default.CORE_OPTIONS_CHANGE,this.render),this.core.getCurrentContainer()&&(this.listenToOnce(this.core.getCurrentContainer(),c.default.CONTAINER_TIMEUPDATE,this.render),this.listenTo(this.core.getCurrentContainer(),c.default.CONTAINER_PLAYBACKDVRSTATECHANGED,this.dvrChanged))},t.prototype.containerChanged=function(){this.stopListening(),this.bindEvents()},t.prototype.dvrChanged=function(e){this.core.getPlaybackType()===u.default.LIVE&&(this.settingsUpdate(),this.core.mediaControl.$el.addClass("live"),e?(this.core.mediaControl.$el.addClass("dvr"),this.core.mediaControl.$el.find(".media-control-indicator[data-position], .media-control-indicator[data-duration]").hide()):this.core.mediaControl.$el.removeClass("dvr"))},t.prototype.click=function(){var e=this.core.mediaControl,t=e.container;t.isPlaying()||t.play(),e.$el.hasClass("dvr")&&t.seek(t.getDuration())},t.prototype.settingsUpdate=function(){var e=this;this.stopListening(),this.core.mediaControl.$el.removeClass("live"),this.shouldRender()&&(this.render(),this.$el.click((function(){return e.click()}))),this.bindEvents()},t.prototype.shouldRender=function(){return(void 0===this.core.options.useDvrControls||!!this.core.options.useDvrControls)&&this.core.getPlaybackType()===u.default.LIVE},t.prototype.render=function(){return this.$el.html(this.template({live:this.core.i18n.t("live"),backToLive:this.core.i18n.t("back_to_live")})),this.shouldRender()&&(this.core.mediaControl.$el.addClass("live"),this.core.mediaControl.$(".media-control-left-panel[data-media-control]").append(this.$el)),this},t}(s.default);t.default=h,e.exports=t.default},"./src/plugins/dvr_controls/index.js": -/*!*******************************************!*\ - !*** ./src/plugins/dvr_controls/index.js ***! - \*******************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./dvr_controls */"./src/plugins/dvr_controls/dvr_controls.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/dvr_controls/public/dvr_controls.scss": -/*!***********************************************************!*\ - !*** ./src/plugins/dvr_controls/public/dvr_controls.scss ***! - \***********************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./dvr_controls.scss */"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/dvr_controls/public/dvr_controls.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/plugins/dvr_controls/public/index.html": -/*!****************************************************!*\ - !*** ./src/plugins/dvr_controls/public/index.html ***! - \****************************************************/ -/*! no static exports found */function(e,t){e.exports='<div class="live-info"><%= live %></div>\n<button type="button" class="live-button" aria-label="<%= backToLive %>"><%= backToLive %></button>\n'},"./src/plugins/end_video.js": -/*!**********************************!*\ - !*** ./src/plugins/end_video.js ***! - \**********************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=l(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),a=l(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=l(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=l(n(/*! ../base/events */"./src/base/events.js"));function l(e){return e&&e.__esModule?e:{default:e}}var u=function(e){function t(){return(0,r.default)(this,t),(0,a.default)(this,e.apply(this,arguments))}return(0,o.default)(t,e),t.prototype.bindEvents=function(){this.listenTo(this.core,s.default.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged);var e=this.core.activeContainer;e&&(this.listenTo(e,s.default.CONTAINER_ENDED,this.ended),this.listenTo(e,s.default.CONTAINER_STOP,this.ended))},t.prototype.containerChanged=function(){this.stopListening(),this.bindEvents()},t.prototype.ended=function(){(void 0===this.core.options.exitFullscreenOnEnd||this.core.options.exitFullscreenOnEnd)&&this.core.isFullscreen()&&this.core.toggleFullscreen()},(0,i.default)(t,[{key:"name",get:function(){return"end_video"}}]),t}(l(n(/*! ../base/core_plugin */"./src/base/core_plugin.js")).default);t.default=u,e.exports=t.default},"./src/plugins/error_screen/error_screen.js": -/*!**************************************************!*\ - !*** ./src/plugins/error_screen/error_screen.js ***! - \**************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=h(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=h(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=h(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=h(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=h(n(/*! ../../base/events */"./src/base/events.js")),l=h(n(/*! ../../base/ui_core_plugin */"./src/base/ui_core_plugin.js")),u=h(n(/*! ../../base/template */"./src/base/template.js")),c=h(n(/*! ../../components/error/ */"./src/components/error/index.js")),d=n(/*! ../../base/utils */"./src/base/utils.js"),f=h(n(/*! ./public/error_screen.html */"./src/plugins/error_screen/public/error_screen.html"));function h(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/error_screen.scss */"./src/plugins/error_screen/public/error_screen.scss");var p=function(e){function t(n){var a;(0,r.default)(this,t);var o=(0,i.default)(this,e.call(this,n));return o.options.disableErrorScreen?(a=o.disable(),(0,i.default)(o,a)):o}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"error_screen"}},{key:"template",get:function(){return(0,u.default)(f.default)}},{key:"container",get:function(){return this.core.getCurrentContainer()}},{key:"attributes",get:function(){return{class:"player-error-screen","data-error-screen":""}}}]),t.prototype.bindEvents=function(){this.listenTo(this.core,s.default.ERROR,this.onError),this.listenTo(this.core,s.default.CORE_ACTIVE_CONTAINER_CHANGED,this.onContainerChanged)},t.prototype.bindReload=function(){this.reloadButton=this.$el.find(".player-error-screen__reload"),this.reloadButton&&this.reloadButton.on("click",this.reload.bind(this))},t.prototype.reload=function(){var e=this;this.listenToOnce(this.core,s.default.CORE_READY,(function(){return e.container.play()})),this.core.load(this.options.sources,this.options.mimeType),this.unbindReload()},t.prototype.unbindReload=function(){this.reloadButton&&this.reloadButton.off("click")},t.prototype.onContainerChanged=function(){this.err=null,this.unbindReload(),this.hide()},t.prototype.onError=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.level===c.default.Levels.FATAL&&(this.err=e,this.container.disableMediaControl(),this.container.stop(),this.show())},t.prototype.show=function(){this.render(),this.$el.show()},t.prototype.hide=function(){this.$el.hide()},t.prototype.render=function(){if(this.err)return this.$el.html(this.template({title:this.err.UI.title,message:this.err.UI.message,code:this.err.code,icon:this.err.UI.icon||"",reloadIcon:d.SvgIcons.reload})),this.core.$el.append(this.el),this.bindReload(),this},t}(l.default);t.default=p,e.exports=t.default},"./src/plugins/error_screen/index.js": -/*!*******************************************!*\ - !*** ./src/plugins/error_screen/index.js ***! - \*******************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./error_screen */"./src/plugins/error_screen/error_screen.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/error_screen/public/error_screen.html": -/*!***********************************************************!*\ - !*** ./src/plugins/error_screen/public/error_screen.html ***! - \***********************************************************/ -/*! no static exports found */function(e,t){e.exports='<div class="player-error-screen__content" data-error-screen>\n <% if (icon) { %>\n <div class="player-error-screen__icon" data-error-screen><%= icon %></div>\n <% } %>\n <div class="player-error-screen__title" data-error-screen><%= title %></div>\n <div class="player-error-screen__message" data-error-screen><%= message %></div>\n <div class="player-error-screen__code" data-error-screen>Error code: <%= code %></div>\n <div class="player-error-screen__reload" data-error-screen><%= reloadIcon %></div>\n</div>\n'},"./src/plugins/error_screen/public/error_screen.scss": -/*!***********************************************************!*\ - !*** ./src/plugins/error_screen/public/error_screen.scss ***! - \***********************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./error_screen.scss */"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/error_screen/public/error_screen.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/plugins/favicon/favicon.js": -/*!****************************************!*\ - !*** ./src/plugins/favicon/favicon.js ***! - \****************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=d(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=d(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=d(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=d(n(/*! ../../base/core_plugin */"./src/base/core_plugin.js")),l=d(n(/*! ../../base/events */"./src/base/events.js")),u=d(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js")),c=n(/*! ../../base/utils */"./src/base/utils.js");function d(e){return e&&e.__esModule?e:{default:e}}var f=(0,u.default)('link[rel="shortcut icon"]'),h=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a._container=null,a.configure(),a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"favicon"}},{key:"oldIcon",get:function(){return f}}]),t.prototype.configure=function(){this.core.options.changeFavicon?this.enabled||(this.stopListening(this.core,l.default.CORE_OPTIONS_CHANGE),this.enable()):this.enabled&&(this.disable(),this.listenTo(this.core,l.default.CORE_OPTIONS_CHANGE,this.configure))},t.prototype.bindEvents=function(){this.listenTo(this.core,l.default.CORE_OPTIONS_CHANGE,this.configure),this.listenTo(this.core,l.default.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged),this.core.activeContainer&&this.containerChanged()},t.prototype.containerChanged=function(){this._container&&this.stopListening(this._container),this._container=this.core.activeContainer,this.listenTo(this._container,l.default.CONTAINER_PLAY,this.setPlayIcon),this.listenTo(this._container,l.default.CONTAINER_PAUSE,this.setPauseIcon),this.listenTo(this._container,l.default.CONTAINER_STOP,this.resetIcon),this.listenTo(this._container,l.default.CONTAINER_ENDED,this.resetIcon),this.listenTo(this._container,l.default.CONTAINER_ERROR,this.resetIcon),this.resetIcon()},t.prototype.disable=function(){e.prototype.disable.call(this),this.resetIcon()},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.resetIcon()},t.prototype.createIcon=function(e){var t=(0,u.default)("<canvas/>");t[0].width=16,t[0].height=16;var n=t[0].getContext("2d");n.fillStyle="#000";var r=(0,u.default)(e).find("path").attr("d"),i=new Path2D(r);n.fill(i);var a=(0,u.default)('<link rel="shortcut icon" type="image/png"/>');return a.attr("href",t[0].toDataURL("image/png")),a},t.prototype.setPlayIcon=function(){this.playIcon||(this.playIcon=this.createIcon(c.SvgIcons.play)),this.changeIcon(this.playIcon)},t.prototype.setPauseIcon=function(){this.pauseIcon||(this.pauseIcon=this.createIcon(c.SvgIcons.pause)),this.changeIcon(this.pauseIcon)},t.prototype.resetIcon=function(){(0,u.default)('link[rel="shortcut icon"]').remove(),(0,u.default)("head").append(this.oldIcon)},t.prototype.changeIcon=function(e){e&&((0,u.default)('link[rel="shortcut icon"]').remove(),(0,u.default)("head").append(e))},t}(s.default);t.default=h,e.exports=t.default},"./src/plugins/favicon/index.js": -/*!**************************************!*\ - !*** ./src/plugins/favicon/index.js ***! - \**************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./favicon.js */"./src/plugins/favicon/favicon.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/google_analytics/google_analytics.js": -/*!**********************************************************!*\ - !*** ./src/plugins/google_analytics/google_analytics.js ***! - \**********************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=u(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=u(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=u(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=u(n(/*! ../../base/container_plugin */"./src/base/container_plugin.js")),l=u(n(/*! ../../base/events */"./src/base/events.js"));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a.container.options.gaAccount&&(a.account=a.container.options.gaAccount,a.trackerName=a.container.options.gaTrackerName?a.container.options.gaTrackerName+".":"Clappr.",a.domainName=a.container.options.gaDomainName,a.currentHDState=void 0,a.embedScript()),a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"google_analytics"}}]),t.prototype.embedScript=function(){var e=this;if(window._gat)this.addEventListeners();else{var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("async","async"),t.setAttribute("src","//www.google-analytics.com/ga.js"),t.onload=function(){return e.addEventListeners()},document.body.appendChild(t)}},t.prototype.addEventListeners=function(){var e=this;this.container&&(this.listenTo(this.container,l.default.CONTAINER_READY,this.onReady),this.listenTo(this.container,l.default.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,l.default.CONTAINER_STOP,this.onStop),this.listenTo(this.container,l.default.CONTAINER_PAUSE,this.onPause),this.listenTo(this.container,l.default.CONTAINER_ENDED,this.onEnded),this.listenTo(this.container,l.default.CONTAINER_STATE_BUFFERING,this.onBuffering),this.listenTo(this.container,l.default.CONTAINER_STATE_BUFFERFULL,this.onBufferFull),this.listenTo(this.container,l.default.CONTAINER_ERROR,this.onError),this.listenTo(this.container,l.default.CONTAINER_PLAYBACKSTATE,this.onPlaybackChanged),this.listenTo(this.container,l.default.CONTAINER_VOLUME,(function(t){return e.onVolumeChanged(t)})),this.listenTo(this.container,l.default.CONTAINER_SEEK,(function(t){return e.onSeek(t)})),this.listenTo(this.container,l.default.CONTAINER_FULL_SCREEN,this.onFullscreen),this.listenTo(this.container,l.default.CONTAINER_HIGHDEFINITIONUPDATE,this.onHD),this.listenTo(this.container,l.default.CONTAINER_PLAYBACKDVRSTATECHANGED,this.onDVR)),_gaq.push([this.trackerName+"_setAccount",this.account]),this.domainName&&_gaq.push([this.trackerName+"_setDomainName",this.domainName])},t.prototype.onReady=function(){this.push(["Video","Playback",this.container.playback.name])},t.prototype.onPlay=function(){this.push(["Video","Play",this.container.playback.src])},t.prototype.onStop=function(){this.push(["Video","Stop",this.container.playback.src])},t.prototype.onEnded=function(){this.push(["Video","Ended",this.container.playback.src])},t.prototype.onBuffering=function(){this.push(["Video","Buffering",this.container.playback.src])},t.prototype.onBufferFull=function(){this.push(["Video","Bufferfull",this.container.playback.src])},t.prototype.onError=function(){this.push(["Video","Error",this.container.playback.src])},t.prototype.onHD=function(e){var t=e?"ON":"OFF";t!==this.currentHDState&&(this.currentHDState=t,this.push(["Video","HD - "+t,this.container.playback.src]))},t.prototype.onPlaybackChanged=function(e){null!==e.type&&this.push(["Video","Playback Type - "+e.type,this.container.playback.src])},t.prototype.onDVR=function(e){var t=e?"ON":"OFF";this.push(["Interaction","DVR - "+t,this.container.playback.src])},t.prototype.onPause=function(){this.push(["Video","Pause",this.container.playback.src])},t.prototype.onSeek=function(){this.push(["Video","Seek",this.container.playback.src])},t.prototype.onVolumeChanged=function(){this.push(["Interaction","Volume",this.container.playback.src])},t.prototype.onFullscreen=function(){this.push(["Interaction","Fullscreen",this.container.playback.src])},t.prototype.push=function(e){var t=[this.trackerName+"_trackEvent"].concat(e);_gaq.push(t)},t}(s.default);t.default=c,e.exports=t.default},"./src/plugins/google_analytics/index.js": -/*!***********************************************!*\ - !*** ./src/plugins/google_analytics/index.js ***! - \***********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./google_analytics */"./src/plugins/google_analytics/google_analytics.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/log/index.js": -/*!**********************************!*\ - !*** ./src/plugins/log/index.js ***! - \**********************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./log */"./src/plugins/log/log.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/log/log.js": -/*!********************************!*\ - !*** ./src/plugins/log/log.js ***! - \********************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js"),a=(r=i)&&r.__esModule?r:{default:r},o=n(/*! ../../vendor */"./src/vendor/index.js"),s="font-weight: bold; font-size: 13px;",l="color: #ff8000;"+s,u="color: #ff0000;"+s,c=["color: #0000ff;font-weight: bold; font-size: 13px;","color: #006600;font-weight: bold; font-size: 13px;",l,u,u],d=["debug","info","warn","error","disabled"],f=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;(0,a.default)(this,e),this.kibo=new o.Kibo,this.kibo.down(["ctrl shift d"],(function(){return t.onOff()})),this.BLACKLIST=["timeupdate","playback:timeupdate","playback:progress","container:hover","container:timeupdate","container:progress"],this.level=n,this.offLevel=r}return e.prototype.debug=function(e){this.log(e,0,Array.prototype.slice.call(arguments,1))},e.prototype.info=function(e){this.log(e,1,Array.prototype.slice.call(arguments,1))},e.prototype.warn=function(e){this.log(e,2,Array.prototype.slice.call(arguments,1))},e.prototype.error=function(e){this.log(e,3,Array.prototype.slice.call(arguments,1))},e.prototype.onOff=function(){this.level===this.offLevel?this.level=this.previousLevel:(this.previousLevel=this.level,this.level=this.offLevel),window.console&&window.console.log&&window.console.log("%c[Clappr.Log] set log level to "+d[this.level],l)},e.prototype.level=function(e){this.level=e},e.prototype.log=function(e,t,n){if(!(this.BLACKLIST.indexOf(n[0])>=0||t<this.level)){n||(n=e,e=null);var r=c[t],i="";e&&(i="["+e+"]"),window.console&&window.console.log&&window.console.log.apply(console,["%c["+d[t]+"]"+i,r].concat(n))}},e}();t.default=f,f.LEVEL_DEBUG=0,f.LEVEL_INFO=1,f.LEVEL_WARN=2,f.LEVEL_ERROR=3,f.getInstance=function(){return void 0===this._instance&&(this._instance=new this,this._instance.previousLevel=this._instance.level,this._instance.level=this._instance.offLevel),this._instance},f.setLevel=function(e){this.getInstance().level=e},f.debug=function(){this.getInstance().debug.apply(this.getInstance(),arguments)},f.info=function(){this.getInstance().info.apply(this.getInstance(),arguments)},f.warn=function(){this.getInstance().warn.apply(this.getInstance(),arguments)},f.error=function(){this.getInstance().error.apply(this.getInstance(),arguments)},e.exports=t.default},"./src/plugins/media_control/index.js": -/*!********************************************!*\ - !*** ./src/plugins/media_control/index.js ***! - \********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./media_control */"./src/plugins/media_control/media_control.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/media_control/media_control.js": -/*!****************************************************!*\ - !*** ./src/plugins/media_control/media_control.js ***! - \****************************************************/ -/*! no static exports found */function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var i=b(n(/*! babel-runtime/core-js/json/stringify */"./node_modules/babel-runtime/core-js/json/stringify.js")),a=b(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),o=b(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),s=b(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),l=b(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),u=n(/*! ../../base/utils */"./src/base/utils.js"),c=n(/*! ../../vendor */"./src/vendor/index.js"),d=b(n(/*! ../../base/events */"./src/base/events.js")),f=b(n(/*! ../../base/ui_core_plugin */"./src/base/ui_core_plugin.js")),h=b(n(/*! ../../components/browser */"./src/components/browser/index.js")),p=b(n(/*! ../../components/mediator */"./src/components/mediator.js")),m=b(n(/*! ../../base/template */"./src/base/template.js")),g=b(n(/*! ../../base/playback */"./src/base/playback.js")),y=b(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js"));n(/*! ./public/media-control.scss */"./src/plugins/media_control/public/media-control.scss");var v=b(n(/*! ./public/media-control.html */"./src/plugins/media_control/public/media-control.html"));function b(e){return e&&e.__esModule?e:{default:e}}var _=function(e){function t(n){(0,a.default)(this,t);var r=(0,o.default)(this,e.call(this,n));return r.persistConfig=r.options.persistConfig,r.currentPositionValue=null,r.currentDurationValue=null,r.keepVisible=!1,r.fullScreenOnVideoTagSupported=null,r.setInitialVolume(),r.settings={left:["play","stop","pause"],right:["volume"],default:["position","seekbar","duration"]},r.kibo=new c.Kibo(r.options.focusElement),r.bindKeyEvents(),r.container?y.default.isEmptyObject(r.container.settings)||(r.settings=y.default.extend({},r.container.settings)):r.settings={},r.userDisabled=!1,(r.container&&r.container.mediaControlDisabled||r.options.chromeless)&&r.disable(),r.stopDragHandler=function(e){return r.stopDrag(e)},r.updateDragHandler=function(e){return r.updateDrag(e)},(0,y.default)(document).bind("mouseup",r.stopDragHandler),(0,y.default)(document).bind("mousemove",r.updateDragHandler),r}return(0,l.default)(t,e),(0,s.default)(t,[{key:"name",get:function(){return"media_control"}},{key:"disabled",get:function(){var e=this.container&&this.container.getPlaybackType()===g.default.NO_OP;return this.userDisabled||e}},{key:"container",get:function(){return this.core&&this.core.activeContainer}},{key:"playback",get:function(){return this.core&&this.core.activePlayback}},{key:"attributes",get:function(){return{class:"media-control","data-media-control":""}}},{key:"events",get:function(){return{"click [data-play]":"play","click [data-pause]":"pause","click [data-playpause]":"togglePlayPause","click [data-stop]":"stop","click [data-playstop]":"togglePlayStop","click [data-fullscreen]":"toggleFullscreen","click .bar-container[data-seekbar]":"seek","click .bar-container[data-volume]":"onVolumeClick","click .drawer-icon[data-volume]":"toggleMute","mouseenter .drawer-container[data-volume]":"showVolumeBar","mouseleave .drawer-container[data-volume]":"hideVolumeBar","mousedown .bar-container[data-volume]":"startVolumeDrag","mousemove .bar-container[data-volume]":"mousemoveOnVolumeBar","mousedown .bar-scrubber[data-seekbar]":"startSeekDrag","mousemove .bar-container[data-seekbar]":"mousemoveOnSeekBar","mouseleave .bar-container[data-seekbar]":"mouseleaveOnSeekBar","mouseenter .media-control-layer[data-controls]":"setUserKeepVisible","mouseleave .media-control-layer[data-controls]":"resetUserKeepVisible"}}},{key:"template",get:function(){return(0,m.default)(v.default)}},{key:"volume",get:function(){return this.container&&this.container.isReady?this.container.volume:this.intendedVolume}},{key:"muted",get:function(){return 0===this.volume}}]),t.prototype.getExternalInterface=function(){var e=this;return{setVolume:this.setVolume,getVolume:function(){return e.volume}}},t.prototype.bindEvents=function(){var e=this;this.stopListening(),this.listenTo(this.core,d.default.CORE_ACTIVE_CONTAINER_CHANGED,this.onActiveContainerChanged),this.listenTo(this.core,d.default.CORE_MOUSE_MOVE,this.show),this.listenTo(this.core,d.default.CORE_MOUSE_LEAVE,(function(){return e.hide(e.options.hideMediaControlDelay)})),this.listenTo(this.core,d.default.CORE_FULLSCREEN,this.show),this.listenTo(this.core,d.default.CORE_OPTIONS_CHANGE,this.configure),p.default.on(this.options.playerId+":"+d.default.PLAYER_RESIZE,this.playerResize,this),this.bindContainerEvents()},t.prototype.bindContainerEvents=function(){this.container&&(this.listenTo(this.container,d.default.CONTAINER_PLAY,this.changeTogglePlay),this.listenTo(this.container,d.default.CONTAINER_PAUSE,this.changeTogglePlay),this.listenTo(this.container,d.default.CONTAINER_STOP,this.changeTogglePlay),this.listenTo(this.container,d.default.CONTAINER_DBLCLICK,this.toggleFullscreen),this.listenTo(this.container,d.default.CONTAINER_TIMEUPDATE,this.onTimeUpdate),this.listenTo(this.container,d.default.CONTAINER_PROGRESS,this.updateProgressBar),this.listenTo(this.container,d.default.CONTAINER_SETTINGSUPDATE,this.settingsUpdate),this.listenTo(this.container,d.default.CONTAINER_PLAYBACKDVRSTATECHANGED,this.settingsUpdate),this.listenTo(this.container,d.default.CONTAINER_HIGHDEFINITIONUPDATE,this.highDefinitionUpdate),this.listenTo(this.container,d.default.CONTAINER_MEDIACONTROL_DISABLE,this.disable),this.listenTo(this.container,d.default.CONTAINER_MEDIACONTROL_ENABLE,this.enable),this.listenTo(this.container,d.default.CONTAINER_ENDED,this.ended),this.listenTo(this.container,d.default.CONTAINER_VOLUME,this.onVolumeChanged),this.listenTo(this.container,d.default.CONTAINER_OPTIONS_CHANGE,this.setInitialVolume),"video"===this.container.playback.el.nodeName.toLowerCase()&&this.listenToOnce(this.container,d.default.CONTAINER_LOADEDMETADATA,this.onLoadedMetadataOnVideoTag))},t.prototype.disable=function(){this.userDisabled=!0,this.hide(),this.unbindKeyEvents(),this.$el.hide()},t.prototype.enable=function(){this.options.chromeless||(this.userDisabled=!1,this.bindKeyEvents(),this.show())},t.prototype.play=function(){this.container&&this.container.play()},t.prototype.pause=function(){this.container&&this.container.pause()},t.prototype.stop=function(){this.container&&this.container.stop()},t.prototype.setInitialVolume=function(){var e=this.persistConfig?u.Config.restore("volume"):100,t=this.container&&this.container.options||this.options;this.setVolume(t.mute?0:e,!0)},t.prototype.onVolumeChanged=function(){this.updateVolumeUI()},t.prototype.onLoadedMetadataOnVideoTag=function(){var e=this.playback&&this.playback.el;!u.Fullscreen.fullscreenEnabled()&&e.webkitSupportsFullscreen&&(this.fullScreenOnVideoTagSupported=!0,this.settingsUpdate())},t.prototype.updateVolumeUI=function(){if(this.rendered){this.$volumeBarContainer.find(".bar-fill-2").css({});var e=this.$volumeBarContainer.width(),t=this.$volumeBarBackground.width(),n=(e-t)/2,r=t*this.volume/100+n;this.$volumeBarFill.css({width:this.volume+"%"}),this.$volumeBarScrubber.css({left:r}),this.$volumeBarContainer.find(".segmented-bar-element").removeClass("fill");var i=Math.ceil(this.volume/10);this.$volumeBarContainer.find(".segmented-bar-element").slice(0,i).addClass("fill"),this.$volumeIcon.html(""),this.$volumeIcon.removeClass("muted"),this.muted?(this.$volumeIcon.append(u.SvgIcons.volumeMute),this.$volumeIcon.addClass("muted")):this.$volumeIcon.append(u.SvgIcons.volume),this.applyButtonStyle(this.$volumeIcon)}},t.prototype.changeTogglePlay=function(){this.$playPauseToggle.html(""),this.$playStopToggle.html(""),this.container&&this.container.isPlaying()?(this.$playPauseToggle.append(u.SvgIcons.pause),this.$playStopToggle.append(u.SvgIcons.stop),this.trigger(d.default.MEDIACONTROL_PLAYING)):(this.$playPauseToggle.append(u.SvgIcons.play),this.$playStopToggle.append(u.SvgIcons.play),this.trigger(d.default.MEDIACONTROL_NOTPLAYING),h.default.isMobile&&this.show()),this.applyButtonStyle(this.$playPauseToggle),this.applyButtonStyle(this.$playStopToggle)},t.prototype.mousemoveOnSeekBar=function(e){if(this.settings.seekEnabled){var t=e.pageX-this.$seekBarContainer.offset().left-this.$seekBarHover.width()/2;this.$seekBarHover.css({left:t})}this.trigger(d.default.MEDIACONTROL_MOUSEMOVE_SEEKBAR,e)},t.prototype.mouseleaveOnSeekBar=function(e){this.trigger(d.default.MEDIACONTROL_MOUSELEAVE_SEEKBAR,e)},t.prototype.onVolumeClick=function(e){this.setVolume(this.getVolumeFromUIEvent(e))},t.prototype.mousemoveOnVolumeBar=function(e){this.draggingVolumeBar&&this.setVolume(this.getVolumeFromUIEvent(e))},t.prototype.playerResize=function(e){this.$fullscreenToggle.html("");var t=this.core.isFullscreen()?u.SvgIcons.exitFullscreen:u.SvgIcons.fullscreen;this.$fullscreenToggle.append(t),this.applyButtonStyle(this.$fullscreenToggle),0!==this.$el.find(".media-control").length&&this.$el.removeClass("w320"),(e.width<=320||this.options.hideVolumeBar)&&this.$el.addClass("w320")},t.prototype.togglePlayPause=function(){return this.container.isPlaying()?this.container.pause():this.container.play(),!1},t.prototype.togglePlayStop=function(){this.container.isPlaying()?this.container.stop():this.container.play()},t.prototype.startSeekDrag=function(e){this.settings.seekEnabled&&(this.draggingSeekBar=!0,this.$el.addClass("dragging"),this.$seekBarLoaded.addClass("media-control-notransition"),this.$seekBarPosition.addClass("media-control-notransition"),this.$seekBarScrubber.addClass("media-control-notransition"),e&&e.preventDefault())},t.prototype.startVolumeDrag=function(e){this.draggingVolumeBar=!0,this.$el.addClass("dragging"),e&&e.preventDefault()},t.prototype.stopDrag=function(e){this.draggingSeekBar&&this.seek(e),this.$el.removeClass("dragging"),this.$seekBarLoaded.removeClass("media-control-notransition"),this.$seekBarPosition.removeClass("media-control-notransition"),this.$seekBarScrubber.removeClass("media-control-notransition dragging"),this.draggingSeekBar=!1,this.draggingVolumeBar=!1},t.prototype.updateDrag=function(e){if(this.draggingSeekBar){e.preventDefault();var t=(e.pageX-this.$seekBarContainer.offset().left)/this.$seekBarContainer.width()*100;t=Math.min(100,Math.max(t,0)),this.setSeekPercentage(t)}else this.draggingVolumeBar&&(e.preventDefault(),this.setVolume(this.getVolumeFromUIEvent(e)))},t.prototype.getVolumeFromUIEvent=function(e){return(e.pageX-this.$volumeBarContainer.offset().left)/this.$volumeBarContainer.width()*100},t.prototype.toggleMute=function(){if(this.muted)return this.setVolume(this._mutedVolume||100),void(this._mutedVolume=null);this._mutedVolume=this.volume,this.setVolume(0)},t.prototype.setVolume=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e=Math.min(100,Math.max(e,0)),this.intendedVolume=e,this.persistConfig&&!n&&u.Config.persist("volume",e);var r=function(){t.container&&t.container.isReady?t.container.setVolume(e):t.listenToOnce(t.container,d.default.CONTAINER_READY,(function(){t.container.setVolume(e)}))};this.container?r():this.listenToOnce(this,d.default.MEDIACONTROL_CONTAINERCHANGED,(function(){return r()}))},t.prototype.toggleFullscreen=function(){this.trigger(d.default.MEDIACONTROL_FULLSCREEN,this.name),this.container.fullscreen(),this.core.toggleFullscreen(),this.resetUserKeepVisible()},t.prototype.onActiveContainerChanged=function(){this.fullScreenOnVideoTagSupported=null,p.default.off(this.options.playerId+":"+d.default.PLAYER_RESIZE,this.playerResize,this),this.bindEvents(),this.setInitialVolume(),this.changeTogglePlay(),this.bindContainerEvents(),this.settingsUpdate(),this.container&&this.container.trigger(d.default.CONTAINER_PLAYBACKDVRSTATECHANGED,this.container.isDvrInUse()),this.container&&this.container.mediaControlDisabled&&this.disable(),this.trigger(d.default.MEDIACONTROL_CONTAINERCHANGED)},t.prototype.showVolumeBar=function(){this.hideVolumeId&&clearTimeout(this.hideVolumeId),this.$volumeBarContainer.removeClass("volume-bar-hide")},t.prototype.hideVolumeBar=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:400;this.$volumeBarContainer&&(this.draggingVolumeBar?this.hideVolumeId=setTimeout((function(){return e.hideVolumeBar()}),t):(this.hideVolumeId&&clearTimeout(this.hideVolumeId),this.hideVolumeId=setTimeout((function(){return e.$volumeBarContainer.addClass("volume-bar-hide")}),t)))},t.prototype.ended=function(){this.changeTogglePlay()},t.prototype.updateProgressBar=function(e){var t=e.start/e.total*100,n=e.current/e.total*100;this.$seekBarLoaded.css({left:t+"%",width:n-t+"%"})},t.prototype.onTimeUpdate=function(e){if(!this.draggingSeekBar){var t=e.current<0?e.total:e.current;this.currentPositionValue=t,this.currentDurationValue=e.total,this.renderSeekBar()}},t.prototype.renderSeekBar=function(){if(null!==this.currentPositionValue&&null!==this.currentDurationValue){this.currentSeekBarPercentage=100,this.container&&(this.container.getPlaybackType()!==g.default.LIVE||this.container.isDvrInUse())&&(this.currentSeekBarPercentage=this.currentPositionValue/this.currentDurationValue*100),this.setSeekPercentage(this.currentSeekBarPercentage);var e=(0,u.formatTime)(this.currentPositionValue),t=(0,u.formatTime)(this.currentDurationValue);e!==this.displayedPosition&&(this.$position.text(e),this.displayedPosition=e),t!==this.displayedDuration&&(this.$duration.text(t),this.displayedDuration=t)}},t.prototype.seek=function(e){if(this.settings.seekEnabled){var t=(e.pageX-this.$seekBarContainer.offset().left)/this.$seekBarContainer.width()*100;return t=Math.min(100,Math.max(t,0)),this.container&&this.container.seekPercentage(t),this.setSeekPercentage(t),!1}},t.prototype.setKeepVisible=function(){this.keepVisible=!0},t.prototype.resetKeepVisible=function(){this.keepVisible=!1},t.prototype.setUserKeepVisible=function(){this.userKeepVisible=!0},t.prototype.resetUserKeepVisible=function(){this.userKeepVisible=!1},t.prototype.isVisible=function(){return!this.$el.hasClass("media-control-hide")},t.prototype.show=function(e){var t=this;if(!this.disabled){var n=e&&e.clientX!==this.lastMouseX&&e.clientY!==this.lastMouseY;(!e||n||navigator.userAgent.match(/firefox/i))&&(clearTimeout(this.hideId),this.$el.show(),this.trigger(d.default.MEDIACONTROL_SHOW,this.name),this.container&&this.container.trigger(d.default.CONTAINER_MEDIACONTROL_SHOW,this.name),this.$el.removeClass("media-control-hide"),this.hideId=setTimeout((function(){return t.hide()}),2e3),e&&(this.lastMouseX=e.clientX,this.lastMouseY=e.clientY)),this.updateCursorStyle(!0)}},t.prototype.hide=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.isVisible()){var n=t||2e3;if(clearTimeout(this.hideId),this.disabled||!1!==this.options.hideMediaControl){var r=this.userKeepVisible||this.keepVisible,i=this.draggingSeekBar||this.draggingVolumeBar;if(!this.disabled&&(t||r||i))this.hideId=setTimeout((function(){return e.hide()}),n);else{this.trigger(d.default.MEDIACONTROL_HIDE,this.name),this.container&&this.container.trigger(d.default.CONTAINER_MEDIACONTROL_HIDE,this.name),this.$el.addClass("media-control-hide"),this.hideVolumeBar(0);var a=!1;this.updateCursorStyle(a)}}}},t.prototype.updateCursorStyle=function(e){e?this.core.$el.removeClass("nocursor"):this.core.isFullscreen()&&this.core.$el.addClass("nocursor")},t.prototype.settingsUpdate=function(){var e=this.getSettings();!e||this.fullScreenOnVideoTagSupported||u.Fullscreen.fullscreenEnabled()||(e.default&&(0,u.removeArrayItem)(e.default,"fullscreen"),e.left&&(0,u.removeArrayItem)(e.left,"fullscreen"),e.right&&(0,u.removeArrayItem)(e.right,"fullscreen")),(0,i.default)(this.settings)!==(0,i.default)(e)&&(this.settings=e,this.render())},t.prototype.getSettings=function(){return y.default.extend(!0,{},this.container&&this.container.settings)},t.prototype.highDefinitionUpdate=function(e){this.isHD=e;var t=e?"addClass":"removeClass";this.$hdIndicator[t]("enabled")},t.prototype.createCachedElements=function(){var e=this.$el.find(".media-control-layer");this.$duration=e.find(".media-control-indicator[data-duration]"),this.$fullscreenToggle=e.find("button.media-control-button[data-fullscreen]"),this.$playPauseToggle=e.find("button.media-control-button[data-playpause]"),this.$playStopToggle=e.find("button.media-control-button[data-playstop]"),this.$position=e.find(".media-control-indicator[data-position]"),this.$seekBarContainer=e.find(".bar-container[data-seekbar]"),this.$seekBarHover=e.find(".bar-hover[data-seekbar]"),this.$seekBarLoaded=e.find(".bar-fill-1[data-seekbar]"),this.$seekBarPosition=e.find(".bar-fill-2[data-seekbar]"),this.$seekBarScrubber=e.find(".bar-scrubber[data-seekbar]"),this.$volumeBarContainer=e.find(".bar-container[data-volume]"),this.$volumeContainer=e.find(".drawer-container[data-volume]"),this.$volumeIcon=e.find(".drawer-icon[data-volume]"),this.$volumeBarBackground=this.$el.find(".bar-background[data-volume]"),this.$volumeBarFill=this.$el.find(".bar-fill-1[data-volume]"),this.$volumeBarScrubber=this.$el.find(".bar-scrubber[data-volume]"),this.$hdIndicator=this.$el.find("button.media-control-button[data-hd-indicator]"),this.resetIndicators(),this.initializeIcons()},t.prototype.resetIndicators=function(){this.displayedPosition=this.$position.text(),this.displayedDuration=this.$duration.text()},t.prototype.initializeIcons=function(){var e=this.$el.find(".media-control-layer");e.find("button.media-control-button[data-play]").append(u.SvgIcons.play),e.find("button.media-control-button[data-pause]").append(u.SvgIcons.pause),e.find("button.media-control-button[data-stop]").append(u.SvgIcons.stop),this.$playPauseToggle.append(u.SvgIcons.play),this.$playStopToggle.append(u.SvgIcons.play),this.$volumeIcon.append(u.SvgIcons.volume),this.$fullscreenToggle.append(u.SvgIcons.fullscreen),this.$hdIndicator.append(u.SvgIcons.hd)},t.prototype.setSeekPercentage=function(e){e=Math.max(Math.min(e,100),0),this.displayedSeekBarPercentage!==e&&(this.displayedSeekBarPercentage=e,this.$seekBarPosition.removeClass("media-control-notransition"),this.$seekBarScrubber.removeClass("media-control-notransition"),this.$seekBarPosition.css({width:e+"%"}),this.$seekBarScrubber.css({left:e+"%"}))},t.prototype.seekRelative=function(e){if(this.settings.seekEnabled){var t=this.container.getCurrentTime(),n=this.container.getDuration(),r=Math.min(Math.max(t+e,0),n);r=Math.min(100*r/n,100),this.container.seekPercentage(r)}},t.prototype.bindKeyAndShow=function(e,t){var n=this;this.kibo.down(e,(function(){return n.show(),t()}))},t.prototype.bindKeyEvents=function(){var e=this;h.default.isMobile||this.options.disableKeyboardShortcuts||(this.unbindKeyEvents(),this.kibo=new c.Kibo(this.options.focusElement||this.options.parentElement),this.bindKeyAndShow("space",(function(){return e.togglePlayPause()})),this.bindKeyAndShow("left",(function(){return e.seekRelative(-5)})),this.bindKeyAndShow("right",(function(){return e.seekRelative(5)})),this.bindKeyAndShow("shift left",(function(){return e.seekRelative(-10)})),this.bindKeyAndShow("shift right",(function(){return e.seekRelative(10)})),this.bindKeyAndShow("shift ctrl left",(function(){return e.seekRelative(-15)})),this.bindKeyAndShow("shift ctrl right",(function(){return e.seekRelative(15)})),["1","2","3","4","5","6","7","8","9","0"].forEach((function(t){e.bindKeyAndShow(t,(function(){e.settings.seekEnabled&&e.container&&e.container.seekPercentage(10*t)}))})))},t.prototype.unbindKeyEvents=function(){this.kibo&&(this.kibo.off("space"),this.kibo.off("left"),this.kibo.off("right"),this.kibo.off("shift left"),this.kibo.off("shift right"),this.kibo.off("shift ctrl left"),this.kibo.off("shift ctrl right"),this.kibo.off(["1","2","3","4","5","6","7","8","9","0"]))},t.prototype.parseColors=function(){if(this.options.mediacontrol){this.buttonsColor=this.options.mediacontrol.buttons;var e=this.options.mediacontrol.seekbar;this.$el.find(".bar-fill-2[data-seekbar]").css("background-color",e),this.$el.find(".media-control-icon svg path").css("fill",this.buttonsColor),this.$el.find(".segmented-bar-element[data-volume]").css("boxShadow","inset 2px 0 0 "+this.buttonsColor)}},t.prototype.applyButtonStyle=function(e){this.buttonsColor&&e&&(0,y.default)(e).find("svg path").css("fill",this.buttonsColor)},t.prototype.destroy=function(){(0,y.default)(document).unbind("mouseup",this.stopDragHandler),(0,y.default)(document).unbind("mousemove",this.updateDragHandler),this.unbindKeyEvents(),this.stopListening(),e.prototype.destroy.call(this)},t.prototype.configure=function(e){this.options.chromeless||e.source||e.sources?this.disable():this.enable(),this.trigger(d.default.MEDIACONTROL_OPTIONS_CHANGE)},t.prototype.render=function(){var e=this,t=this.options.hideMediaControlDelay||2e3;this.settings&&this.$el.html(this.template({settings:this.settings})),this.createCachedElements(),this.$playPauseToggle.addClass("paused"),this.$playStopToggle.addClass("stopped"),this.changeTogglePlay(),this.container&&(this.hideId=setTimeout((function(){return e.hide()}),t),this.disabled&&this.hide()),h.default.isSafari&&h.default.isMobile&&(h.default.version<10?this.$volumeContainer.css("display","none"):this.$volumeBarContainer.css("display","none")),this.$seekBarPosition.addClass("media-control-notransition"),this.$seekBarScrubber.addClass("media-control-notransition");var n=0;return this.displayedSeekBarPercentage&&(n=this.displayedSeekBarPercentage),this.displayedSeekBarPercentage=null,this.setSeekPercentage(n),r.nextTick((function(){!e.settings.seekEnabled&&e.$seekBarContainer.addClass("seek-disabled"),!h.default.isMobile&&!e.options.disableKeyboardShortcuts&&e.bindKeyEvents(),e.playerResize({width:e.options.width,height:e.options.height}),e.hideVolumeBar(0)})),this.parseColors(),this.highDefinitionUpdate(this.isHD),this.core.$el.append(this.el),this.rendered=!0,this.updateVolumeUI(),this.trigger(d.default.MEDIACONTROL_RENDERED),this},t}(f.default);t.default=_,_.extend=function(e){return(0,u.extend)(_,e)},e.exports=t.default}).call(this,n(/*! ./../../../node_modules/node-libs-browser/node_modules/process/browser.js */"./node_modules/node-libs-browser/node_modules/process/browser.js"))},"./src/plugins/media_control/public/closed-hand.cur": -/*!**********************************************************!*\ - !*** ./src/plugins/media_control/public/closed-hand.cur ***! - \**********************************************************/ -/*! no static exports found */function(e,t){e.exports="<%=baseUrl%>/a8c874b93b3d848f39a71260c57e3863.cur"},"./src/plugins/media_control/public/media-control.html": -/*!*************************************************************!*\ - !*** ./src/plugins/media_control/public/media-control.html ***! - \*************************************************************/ -/*! no static exports found */function(e,t){e.exports='<div class="media-control-background" data-background></div>\n<div class="media-control-layer" data-controls>\n <% var renderBar = function(name) { %>\n <div class="bar-container" data-<%= name %>>\n <div class="bar-background" data-<%= name %>>\n <div class="bar-fill-1" data-<%= name %>></div>\n <div class="bar-fill-2" data-<%= name %>></div>\n <div class="bar-hover" data-<%= name %>></div>\n </div>\n <div class="bar-scrubber" data-<%= name %>>\n <div class="bar-scrubber-icon" data-<%= name %>></div>\n </div>\n </div>\n <% }; %>\n <% var renderSegmentedBar = function(name, segments) {\n segments = segments || 10; %>\n <div class="bar-container" data-<%= name %>>\n <% for (var i = 0; i < segments; i++) { %>\n <div class="segmented-bar-element" data-<%= name %>></div>\n <% } %>\n </div>\n <% }; %>\n <% var renderDrawer = function(name, renderContent) { %>\n <div class="drawer-container" data-<%= name %>>\n <div class="drawer-icon-container" data-<%= name %>>\n <div class="drawer-icon media-control-icon" data-<%= name %>></div>\n <span class="drawer-text" data-<%= name %>></span>\n </div>\n <% renderContent(name); %>\n </div>\n <% }; %>\n <% var renderIndicator = function(name) { %>\n <div class="media-control-indicator" data-<%= name %>></div>\n <% }; %>\n <% var renderButton = function(name) { %>\n <button type="button" class="media-control-button media-control-icon" data-<%= name %> aria-label="<%= name %>"></button>\n <% }; %>\n <% var templates = {\n bar: renderBar,\n segmentedBar: renderSegmentedBar,\n };\n var render = function(settingsList) {\n settingsList.forEach(function(setting) {\n if(setting === "seekbar") {\n renderBar(setting);\n } else if (setting === "volume") {\n renderDrawer(setting, settings.volumeBarTemplate ? templates[settings.volumeBarTemplate] : function(name) { return renderSegmentedBar(name); });\n } else if (setting === "duration" || setting === "position") {\n renderIndicator(setting);\n } else {\n renderButton(setting);\n }\n });\n }; %>\n <% if (settings.default && settings.default.length) { %>\n <div class="media-control-center-panel" data-media-control>\n <% render(settings.default); %>\n </div>\n <% } %>\n <% if (settings.left && settings.left.length) { %>\n <div class="media-control-left-panel" data-media-control>\n <% render(settings.left); %>\n </div>\n <% } %>\n <% if (settings.right && settings.right.length) { %>\n <div class="media-control-right-panel" data-media-control>\n <% render(settings.right); %>\n </div>\n <% } %>\n</div>\n'},"./src/plugins/media_control/public/media-control.scss": -/*!*************************************************************!*\ - !*** ./src/plugins/media_control/public/media-control.scss ***! - \*************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./media-control.scss */"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/media_control/public/media-control.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/plugins/poster/index.js": -/*!*************************************!*\ - !*** ./src/plugins/poster/index.js ***! - \*************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./poster */"./src/plugins/poster/poster.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/poster/poster.js": -/*!**************************************!*\ - !*** ./src/plugins/poster/poster.js ***! - \**************************************/ -/*! no static exports found */function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var i=m(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),a=m(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=m(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),s=m(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),l=m(n(/*! ../../base/ui_container_plugin */"./src/base/ui_container_plugin.js")),u=m(n(/*! ../../base/events */"./src/base/events.js")),c=m(n(/*! ../../base/template */"./src/base/template.js")),d=m(n(/*! ../../base/playback */"./src/base/playback.js")),f=m(n(/*! ../../components/error/error */"./src/components/error/error.js")),h=m(n(/*! ./public/poster.html */"./src/plugins/poster/public/poster.html")),p=n(/*! ../../base/utils */"./src/base/utils.js");function m(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/poster.scss */"./src/plugins/poster/public/poster.scss");var g=function(e){function t(n){(0,i.default)(this,t);var o=(0,a.default)(this,e.call(this,n));return o.hasStartedPlaying=!1,o.playRequested=!1,o.render(),r.nextTick((function(){return o.update()})),o}return(0,s.default)(t,e),(0,o.default)(t,[{key:"name",get:function(){return"poster"}},{key:"template",get:function(){return(0,c.default)(h.default)}},{key:"shouldRender",get:function(){var e=!(!this.options.poster||!this.options.poster.showForNoOp);return"html_img"!==this.container.playback.name&&(this.container.playback.getPlaybackType()!==d.default.NO_OP||e)}},{key:"attributes",get:function(){return{class:"player-poster","data-poster":""}}},{key:"events",get:function(){return{click:"clicked"}}},{key:"showOnVideoEnd",get:function(){return!this.options.poster||this.options.poster.showOnVideoEnd||void 0===this.options.poster.showOnVideoEnd}}]),t.prototype.bindEvents=function(){this.listenTo(this.container,u.default.CONTAINER_STOP,this.onStop),this.listenTo(this.container,u.default.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,u.default.CONTAINER_STATE_BUFFERING,this.update),this.listenTo(this.container,u.default.CONTAINER_STATE_BUFFERFULL,this.update),this.listenTo(this.container,u.default.CONTAINER_OPTIONS_CHANGE,this.render),this.listenTo(this.container,u.default.CONTAINER_ERROR,this.onError),this.showOnVideoEnd&&this.listenTo(this.container,u.default.CONTAINER_ENDED,this.onStop)},t.prototype.onError=function(e){this.hasFatalError=e.level===f.default.Levels.FATAL,this.hasFatalError&&(this.hasStartedPlaying=!1,this.playRequested=!1,this.showPlayButton())},t.prototype.onPlay=function(){this.hasStartedPlaying=!0,this.update()},t.prototype.onStop=function(){this.hasStartedPlaying=!1,this.playRequested=!1,this.update()},t.prototype.updatePlayButton=function(e){!e||this.options.chromeless&&!this.options.allowUserInteraction?this.hidePlayButton():this.showPlayButton()},t.prototype.showPlayButton=function(){this.hasFatalError&&!this.options.disableErrorScreen||(this.$playButton.show(),this.$el.addClass("clickable"))},t.prototype.hidePlayButton=function(){this.$playButton.hide(),this.$el.removeClass("clickable")},t.prototype.clicked=function(){if(!this.hasStartedPlaying)return this.options.chromeless&&!this.options.allowUserInteraction||(this.playRequested=!0,this.update(),this.container.play()),!1},t.prototype.shouldHideOnPlay=function(){return!this.container.playback.isAudioOnly},t.prototype.update=function(){if(this.shouldRender){var e=!this.playRequested&&!this.hasStartedPlaying&&!this.container.buffering;this.updatePlayButton(e),this.updatePoster()}},t.prototype.updatePoster=function(){this.hasStartedPlaying?this.hidePoster():this.showPoster()},t.prototype.showPoster=function(){this.container.disableMediaControl(),this.$el.show()},t.prototype.hidePoster=function(){this.container.enableMediaControl(),this.shouldHideOnPlay()&&this.$el.hide()},t.prototype.render=function(){if(this.shouldRender){if(this.$el.html(this.template()),this.options.poster&&void 0===this.options.poster.custom){var e=this.options.poster.url||this.options.poster;this.$el.css({"background-image":"url("+e+")"})}else this.options.poster&&this.$el.css({background:this.options.poster.custom});this.container.$el.append(this.el),this.$playWrapper=this.$el.find(".play-wrapper"),this.$playWrapper.append(p.SvgIcons.play),this.$playButton=this.$playWrapper.find("svg"),this.$playButton.addClass("poster-icon"),this.$playButton.attr("data-poster","");var t=this.options.mediacontrol&&this.options.mediacontrol.buttons;return t&&this.$el.find("svg path").css("fill",t),this.options.mediacontrol&&this.options.mediacontrol.buttons&&(t=this.options.mediacontrol.buttons,this.$playButton.css("color",t)),this.update(),this}},t}(l.default);t.default=g,e.exports=t.default}).call(this,n(/*! ./../../../node_modules/node-libs-browser/node_modules/process/browser.js */"./node_modules/node-libs-browser/node_modules/process/browser.js"))},"./src/plugins/poster/public/poster.html": -/*!***********************************************!*\ - !*** ./src/plugins/poster/public/poster.html ***! - \***********************************************/ -/*! no static exports found */function(e,t){e.exports='<div class="play-wrapper" data-poster></div>\n'},"./src/plugins/poster/public/poster.scss": -/*!***********************************************!*\ - !*** ./src/plugins/poster/public/poster.scss ***! - \***********************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./poster.scss */"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/poster/public/poster.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/plugins/seek_time/index.js": -/*!****************************************!*\ - !*** ./src/plugins/seek_time/index.js ***! - \****************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./seek_time */"./src/plugins/seek_time/seek_time.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/seek_time/public/seek_time.html": -/*!*****************************************************!*\ - !*** ./src/plugins/seek_time/public/seek_time.html ***! - \*****************************************************/ -/*! no static exports found */function(e,t){e.exports="<span data-seek-time></span>\n<span data-duration></span>\n"},"./src/plugins/seek_time/public/seek_time.scss": -/*!*****************************************************!*\ - !*** ./src/plugins/seek_time/public/seek_time.scss ***! - \*****************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./seek_time.scss */"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/seek_time/public/seek_time.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/plugins/seek_time/seek_time.js": -/*!********************************************!*\ - !*** ./src/plugins/seek_time/seek_time.js ***! - \********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=h(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=h(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=h(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=h(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=n(/*! ../../base/utils */"./src/base/utils.js"),l=h(n(/*! ../../base/ui_core_plugin */"./src/base/ui_core_plugin.js")),u=h(n(/*! ../../base/template */"./src/base/template.js")),c=h(n(/*! ../../base/events */"./src/base/events.js")),d=h(n(/*! ../../base/playback */"./src/base/playback.js")),f=h(n(/*! ./public/seek_time.html */"./src/plugins/seek_time/public/seek_time.html"));function h(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/seek_time.scss */"./src/plugins/seek_time/public/seek_time.scss");var p=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a.hoveringOverSeekBar=!1,a.hoverPosition=null,a.duration=null,a.firstFragDateTime=null,a.actualLiveTime=!!a.mediaControl.options.actualLiveTime,a.actualLiveTime&&(a.mediaControl.options.actualLiveServerTime?a.actualLiveServerTimeDiff=(new Date).getTime()-new Date(a.mediaControl.options.actualLiveServerTime).getTime():a.actualLiveServerTimeDiff=0),a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"seek_time"}},{key:"template",get:function(){return(0,u.default)(f.default)}},{key:"attributes",get:function(){return{class:"seek-time","data-seek-time":""}}},{key:"mediaControl",get:function(){return this.core.mediaControl}},{key:"mediaControlContainer",get:function(){return this.mediaControl.container}},{key:"isLiveStreamWithDvr",get:function(){return this.mediaControlContainer&&this.mediaControlContainer.getPlaybackType()===d.default.LIVE&&this.mediaControlContainer.isDvrEnabled()}},{key:"durationShown",get:function(){return this.isLiveStreamWithDvr&&!this.actualLiveTime}},{key:"useActualLiveTime",get:function(){return this.actualLiveTime&&this.isLiveStreamWithDvr}}]),t.prototype.bindEvents=function(){this.listenTo(this.mediaControl,c.default.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.mediaControl,c.default.MEDIACONTROL_MOUSEMOVE_SEEKBAR,this.showTime),this.listenTo(this.mediaControl,c.default.MEDIACONTROL_MOUSELEAVE_SEEKBAR,this.hideTime),this.listenTo(this.mediaControl,c.default.MEDIACONTROL_CONTAINERCHANGED,this.onContainerChanged),this.mediaControlContainer&&(this.listenTo(this.mediaControlContainer,c.default.CONTAINER_PLAYBACKDVRSTATECHANGED,this.update),this.listenTo(this.mediaControlContainer,c.default.CONTAINER_TIMEUPDATE,this.updateDuration))},t.prototype.onContainerChanged=function(){this.stopListening(),this.bindEvents()},t.prototype.updateDuration=function(e){this.duration=e.total,this.firstFragDateTime=e.firstFragDateTime,this.update()},t.prototype.showTime=function(e){this.hoveringOverSeekBar=!0,this.calculateHoverPosition(e),this.update()},t.prototype.hideTime=function(){this.hoveringOverSeekBar=!1,this.update()},t.prototype.calculateHoverPosition=function(e){var t=e.pageX-this.mediaControl.$seekBarContainer.offset().left;this.hoverPosition=Math.min(1,Math.max(t/this.mediaControl.$seekBarContainer.width(),0))},t.prototype.getSeekTime=function(){var e=void 0,t=void 0,n=void 0,r=void 0;return this.useActualLiveTime?(this.firstFragDateTime?(r=new Date(this.firstFragDateTime),(n=new Date(this.firstFragDateTime)).setHours(0,0,0,0),t=(r.getTime()-n.getTime())/1e3+this.duration):(n=new Date((new Date).getTime()-this.actualLiveServerTimeDiff),t=((r=new Date(n))-n.setHours(0,0,0,0))/1e3),(e=t-this.duration+this.hoverPosition*this.duration)<0&&(e+=86400)):e=this.hoverPosition*this.duration,{seekTime:e,secondsSinceMidnight:t}},t.prototype.update=function(){if(this.rendered)if(this.shouldBeVisible()){var e=this.getSeekTime(),t=(0,s.formatTime)(e.seekTime,this.useActualLiveTime);if(t!==this.displayedSeekTime&&(this.$seekTimeEl.text(t),this.displayedSeekTime=t),this.durationShown){this.$durationEl.show();var n=(0,s.formatTime)(this.actualLiveTime?e.secondsSinceMidnight:this.duration,this.actualLiveTime);n!==this.displayedDuration&&(this.$durationEl.text(n),this.displayedDuration=n)}else this.$durationEl.hide();this.$el.show();var r=this.mediaControl.$seekBarContainer.width(),i=this.$el.width(),a=this.hoverPosition*r;a-=i/2,a=Math.max(0,Math.min(a,r-i)),this.$el.css("left",a)}else this.$el.hide(),this.$el.css("left","-100%")},t.prototype.shouldBeVisible=function(){return this.mediaControlContainer&&this.mediaControlContainer.settings.seekEnabled&&this.hoveringOverSeekBar&&null!==this.hoverPosition&&null!==this.duration},t.prototype.render=function(){this.rendered=!0,this.displayedDuration=null,this.displayedSeekTime=null,this.$el.html(this.template()),this.$el.hide(),this.mediaControl.$el.append(this.el),this.$seekTimeEl=this.$el.find("[data-seek-time]"),this.$durationEl=this.$el.find("[data-duration]"),this.$durationEl.hide(),this.update()},t}(l.default);t.default=p,e.exports=t.default},"./src/plugins/sources.js": -/*!********************************!*\ - !*** ./src/plugins/sources.js ***! - \********************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=u(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),a=u(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),o=u(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=u(n(/*! ../base/core_plugin */"./src/base/core_plugin.js")),l=u(n(/*! ../base/events */"./src/base/events.js"));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(){return(0,r.default)(this,t),(0,a.default)(this,e.apply(this,arguments))}return(0,o.default)(t,e),t.prototype.bindEvents=function(){this.listenTo(this.core,l.default.CORE_CONTAINERS_CREATED,this.onContainersCreated)},t.prototype.onContainersCreated=function(){var e=this.core.containers.filter((function(e){return"no_op"!==e.playback.name}))[0]||this.core.containers[0];e&&this.core.containers.forEach((function(t){t!==e&&t.destroy()}))},(0,i.default)(t,[{key:"name",get:function(){return"sources"}}]),t}(s.default);t.default=c,e.exports=t.default},"./src/plugins/spinner_three_bounce/index.js": -/*!***************************************************!*\ - !*** ./src/plugins/spinner_three_bounce/index.js ***! - \***************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./spinner_three_bounce */"./src/plugins/spinner_three_bounce/spinner_three_bounce.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/spinner_three_bounce/public/spinner.html": -/*!**************************************************************!*\ - !*** ./src/plugins/spinner_three_bounce/public/spinner.html ***! - \**************************************************************/ -/*! no static exports found */function(e,t){e.exports="<div data-bounce1></div><div data-bounce2></div><div data-bounce3></div>\n"},"./src/plugins/spinner_three_bounce/public/spinner.scss": -/*!**************************************************************!*\ - !*** ./src/plugins/spinner_three_bounce/public/spinner.scss ***! - \**************************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./spinner.scss */"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/spinner_three_bounce/public/spinner.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/plugins/spinner_three_bounce/spinner_three_bounce.js": -/*!******************************************************************!*\ - !*** ./src/plugins/spinner_three_bounce/spinner_three_bounce.js ***! - \******************************************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=d(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=d(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=d(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=d(n(/*! ../../base/ui_container_plugin */"./src/base/ui_container_plugin.js")),l=d(n(/*! ../../base/events */"./src/base/events.js")),u=d(n(/*! ../../base/template */"./src/base/template.js")),c=d(n(/*! ./public/spinner.html */"./src/plugins/spinner_three_bounce/public/spinner.html"));function d(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/spinner.scss */"./src/plugins/spinner_three_bounce/public/spinner.scss");var f=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a.template=(0,u.default)(c.default),a.showTimeout=null,a.listenTo(a.container,l.default.CONTAINER_STATE_BUFFERING,a.onBuffering),a.listenTo(a.container,l.default.CONTAINER_STATE_BUFFERFULL,a.onBufferFull),a.listenTo(a.container,l.default.CONTAINER_STOP,a.onStop),a.listenTo(a.container,l.default.CONTAINER_ENDED,a.onStop),a.listenTo(a.container,l.default.CONTAINER_ERROR,a.onStop),a.render(),a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"spinner"}},{key:"attributes",get:function(){return{"data-spinner":"",class:"spinner-three-bounce"}}}]),t.prototype.onBuffering=function(){this.show()},t.prototype.onBufferFull=function(){this.hide()},t.prototype.onStop=function(){this.hide()},t.prototype.show=function(){var e=this;null===this.showTimeout&&(this.showTimeout=setTimeout((function(){return e.$el.show()}),300))},t.prototype.hide=function(){null!==this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.$el.hide()},t.prototype.render=function(){return this.$el.html(this.template()),this.container.$el.append(this.$el),this.$el.hide(),this.container.buffering&&this.onBuffering(),this},t}(s.default);t.default=f,e.exports=t.default},"./src/plugins/stats/index.js": -/*!************************************!*\ - !*** ./src/plugins/stats/index.js ***! - \************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./stats */"./src/plugins/stats/stats.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/stats/stats.js": -/*!************************************!*\ - !*** ./src/plugins/stats/stats.js ***! - \************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=c(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=c(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=c(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=c(n(/*! ../../base/container_plugin */"./src/base/container_plugin.js")),l=c(n(/*! ../../base/events */"./src/base/events.js")),u=c(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js"));function c(e){return e&&e.__esModule?e:{default:e}}var d=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a.setInitialAttrs(),a.reportInterval=a.options.reportInterval||5e3,a.state="IDLE",a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"stats"}}]),t.prototype.bindEvents=function(){this.listenTo(this.container.playback,l.default.PLAYBACK_PLAY,this.onPlay),this.listenTo(this.container,l.default.CONTAINER_STOP,this.onStop),this.listenTo(this.container,l.default.CONTAINER_ENDED,this.onStop),this.listenTo(this.container,l.default.CONTAINER_DESTROYED,this.onStop),this.listenTo(this.container,l.default.CONTAINER_STATE_BUFFERING,this.onBuffering),this.listenTo(this.container,l.default.CONTAINER_STATE_BUFFERFULL,this.onBufferFull),this.listenTo(this.container,l.default.CONTAINER_STATS_ADD,this.onStatsAdd),this.listenTo(this.container,l.default.CONTAINER_BITRATE,this.onStatsAdd),this.listenTo(this.container.playback,l.default.PLAYBACK_STATS_ADD,this.onStatsAdd)},t.prototype.setInitialAttrs=function(){this.firstPlay=!0,this.startupTime=0,this.rebufferingTime=0,this.watchingTime=0,this.rebuffers=0,this.externalMetrics={}},t.prototype.onPlay=function(){this.state="PLAYING",this.watchingTimeInit=Date.now(),this.intervalId||(this.intervalId=setInterval(this.report.bind(this),this.reportInterval))},t.prototype.onStop=function(){clearInterval(this.intervalId),this.report(),this.intervalId=void 0,this.state="STOPPED"},t.prototype.onBuffering=function(){this.firstPlay?this.startupTimeInit=Date.now():this.rebufferingTimeInit=Date.now(),this.state="BUFFERING",this.rebuffers++},t.prototype.onBufferFull=function(){this.firstPlay&&this.startupTimeInit?(this.firstPlay=!1,this.startupTime=Date.now()-this.startupTimeInit,this.watchingTimeInit=Date.now()):this.rebufferingTimeInit&&(this.rebufferingTime+=this.getRebufferingTime()),this.rebufferingTimeInit=void 0,this.state="PLAYING"},t.prototype.getRebufferingTime=function(){return Date.now()-this.rebufferingTimeInit},t.prototype.getWatchingTime=function(){return Date.now()-this.watchingTimeInit-this.rebufferingTime},t.prototype.isRebuffering=function(){return!!this.rebufferingTimeInit},t.prototype.onStatsAdd=function(e){u.default.extend(this.externalMetrics,e)},t.prototype.getStats=function(){var e={startupTime:this.startupTime,rebuffers:this.rebuffers,rebufferingTime:this.isRebuffering()?this.rebufferingTime+this.getRebufferingTime():this.rebufferingTime,watchingTime:this.isRebuffering()?this.getWatchingTime()-this.getRebufferingTime():this.getWatchingTime()};return u.default.extend(e,this.externalMetrics),e},t.prototype.report=function(){this.container.statsReport(this.getStats())},t}(s.default);t.default=d,e.exports=t.default},"./src/plugins/strings.js": -/*!********************************!*\ - !*** ./src/plugins/strings.js ***! - \********************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=u(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=u(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=u(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=n(/*! ../base/utils */"./src/base/utils.js"),l=u(n(/*! clappr-zepto */"./node_modules/clappr-zepto/zepto.js"));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a._initializeMessages(),a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"strings"}}]),t.prototype.t=function(e){var t=this._language(),n=this._messages.en;return(t&&this._messages[t]||n)[e]||n[e]||e},t.prototype._language=function(){return this.core.options.language||(0,s.getBrowserLanguage)()},t.prototype._initializeMessages=function(){this._messages=l.default.extend(!0,{en:{live:"live",back_to_live:"back to live",disabled:"Disabled",playback_not_supported:"Your browser does not support the playback of this video. Please try using a different browser.",default_error_title:"Could not play video.",default_error_message:"There was a problem trying to load the video."},pt:{live:"ao vivo",back_to_live:"voltar para o ao vivo",disabled:"Desativado",playback_not_supported:"Seu navegador não supporta a reprodução deste video. Por favor, tente usar um navegador diferente.",default_error_title:"Não foi possível reproduzir o vídeo.",default_error_message:"Ocorreu um problema ao tentar carregar o vídeo."},es:{live:"vivo",back_to_live:"volver en vivo",disabled:"Discapacitado",playback_not_supported:"Su navegador no soporta la reproducción de un video. Por favor, trate de usar un navegador diferente."},ru:{live:"прямой эфир",back_to_live:"к прямому эфиру",disabled:"Отключено",playback_not_supported:"Ваш браузер не поддерживает воспроизведение этого видео. Пожалуйста, попробуйте другой браузер."},fr:{live:"en direct",back_to_live:"retour au direct",disabled:"Désactivé",playback_not_supported:"Votre navigateur ne supporte pas la lecture de cette vidéo. Merci de tenter sur un autre navigateur.",default_error_title:"Impossible de lire la vidéo.",default_error_message:"Un problème est survenu lors du chargement de la vidéo."},tr:{live:"canlı",back_to_live:"canlı yayına dön",disabled:"Engelli",playback_not_supported:"Tarayıcınız bu videoyu oynatma desteğine sahip değil. Lütfen farklı bir tarayıcı ile deneyin."},et:{live:"Otseülekanne",back_to_live:"Tagasi otseülekande juurde",disabled:"Keelatud",playback_not_supported:"Teie brauser ei toeta selle video taasesitust. Proovige kasutada muud brauserit."},ar:{live:"مباشر",back_to_live:"الرجوع إلى المباشر",disabled:"معطّل",playback_not_supported:"المتصفح الذي تستخدمه لا يدعم تشغيل هذا الفيديو. الرجاء إستخدام متصفح آخر.",default_error_title:"غير قادر الى التشغيل.",default_error_message:"حدثت مشكلة أثناء تحميل الفيديو."}},this.core.options.strings||{}),this._messages["pt-BR"]=this._messages.pt,this._messages["en-US"]=this._messages.en,this._messages["es-419"]=this._messages.es,this._messages["fr-FR"]=this._messages.fr,this._messages["tr-TR"]=this._messages.tr,this._messages["et-EE"]=this._messages.et,this._messages["ar-IQ"]=this._messages.ar},t}(u(n(/*! ../base/core_plugin */"./src/base/core_plugin.js")).default);t.default=c,e.exports=t.default},"./src/plugins/watermark/index.js": -/*!****************************************!*\ - !*** ./src/plugins/watermark/index.js ***! - \****************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./watermark */"./src/plugins/watermark/watermark.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},"./src/plugins/watermark/public/watermark.html": -/*!*****************************************************!*\ - !*** ./src/plugins/watermark/public/watermark.html ***! - \*****************************************************/ -/*! no static exports found */function(e,t){e.exports='<div class="clappr-watermark" data-watermark data-watermark-<%=position %>>\n<% if(typeof imageLink !== \'undefined\') { %>\n<a target=_blank href="<%= imageLink %>">\n<% } %>\n<img src="<%= imageUrl %>">\n<% if(typeof imageLink !== \'undefined\') { %>\n</a>\n<% } %>\n</div>\n'},"./src/plugins/watermark/public/watermark.scss": -/*!*****************************************************!*\ - !*** ./src/plugins/watermark/public/watermark.scss ***! - \*****************************************************/ -/*! no static exports found */function(e,t,n){var r=n(/*! !../../../../node_modules/css-loader!../../../../node_modules/postcss-loader/lib!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./watermark.scss */"./node_modules/css-loader/index.js!./node_modules/postcss-loader/lib/index.js!./node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/joaopaulo/Workstation/JS/clappr/src/base/scss!./src/plugins/watermark/public/watermark.scss");"string"==typeof r&&(r=[[e.i,r,""]]);var i={singleton:!0,hmr:!0,transform:void 0,insertInto:void 0};n(/*! ../../../../node_modules/style-loader/lib/addStyles.js */"./node_modules/style-loader/lib/addStyles.js")(r,i),r.locals&&(e.exports=r.locals)},"./src/plugins/watermark/watermark.js": -/*!********************************************!*\ - !*** ./src/plugins/watermark/watermark.js ***! - \********************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(/*! babel-runtime/helpers/classCallCheck */"./node_modules/babel-runtime/helpers/classCallCheck.js")),i=d(n(/*! babel-runtime/helpers/possibleConstructorReturn */"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js")),a=d(n(/*! babel-runtime/helpers/createClass */"./node_modules/babel-runtime/helpers/createClass.js")),o=d(n(/*! babel-runtime/helpers/inherits */"./node_modules/babel-runtime/helpers/inherits.js")),s=d(n(/*! ../../base/ui_container_plugin */"./src/base/ui_container_plugin.js")),l=d(n(/*! ../../base/events */"./src/base/events.js")),u=d(n(/*! ../../base/template */"./src/base/template.js")),c=d(n(/*! ./public/watermark.html */"./src/plugins/watermark/public/watermark.html"));function d(e){return e&&e.__esModule?e:{default:e}}n(/*! ./public/watermark.scss */"./src/plugins/watermark/public/watermark.scss");var f=function(e){function t(n){(0,r.default)(this,t);var a=(0,i.default)(this,e.call(this,n));return a.configure(),a}return(0,o.default)(t,e),(0,a.default)(t,[{key:"name",get:function(){return"watermark"}},{key:"template",get:function(){return(0,u.default)(c.default)}}]),t.prototype.bindEvents=function(){this.listenTo(this.container,l.default.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,l.default.CONTAINER_STOP,this.onStop),this.listenTo(this.container,l.default.CONTAINER_OPTIONS_CHANGE,this.configure)},t.prototype.configure=function(){this.position=this.options.position||"bottom-right",this.options.watermark?(this.imageUrl=this.options.watermark,this.imageLink=this.options.watermarkLink,this.render()):this.$el.remove()},t.prototype.onPlay=function(){this.hidden||this.$el.show()},t.prototype.onStop=function(){this.$el.hide()},t.prototype.render=function(){this.$el.hide();var e={position:this.position,imageUrl:this.imageUrl,imageLink:this.imageLink};return this.$el.html(this.template(e)),this.container.$el.append(this.$el),this},t}(s.default);t.default=f,e.exports=t.default},"./src/vendor/index.js": -/*!*****************************!*\ - !*** ./src/vendor/index.js ***! - \*****************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(/*! ./kibo */"./src/vendor/kibo.js"),a=(r=i)&&r.__esModule?r:{default:r};t.default={Kibo:a.default},e.exports=t.default},"./src/vendor/kibo.js": -/*!****************************!*\ - !*** ./src/vendor/kibo.js ***! - \****************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){this.element=e||window.document,this.initialize()};r.KEY_NAMES_BY_CODE={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"caps_lock",27:"esc",32:"space",37:"left",38:"up",39:"right",40:"down",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},r.KEY_CODES_BY_NAME={},function(){for(var e in r.KEY_NAMES_BY_CODE)Object.prototype.hasOwnProperty.call(r.KEY_NAMES_BY_CODE,e)&&(r.KEY_CODES_BY_NAME[r.KEY_NAMES_BY_CODE[e]]=+e)}(),r.MODIFIERS=["shift","ctrl","alt"],r.registerEvent=document.addEventListener?function(e,t,n){e.addEventListener(t,n,!1)}:document.attachEvent?function(e,t,n){e.attachEvent("on"+t,n)}:void 0,r.unregisterEvent=document.removeEventListener?function(e,t,n){e.removeEventListener(t,n,!1)}:document.detachEvent?function(e,t,n){e.detachEvent("on"+t,n)}:void 0,r.stringContains=function(e,t){return-1!==e.indexOf(t)},r.neatString=function(e){return e.replace(/^\s+|\s+$/g,"").replace(/\s+/g," ")},r.capitalize=function(e){return e.toLowerCase().replace(/^./,(function(e){return e.toUpperCase()}))},r.isString=function(e){return r.stringContains(Object.prototype.toString.call(e),"String")},r.arrayIncludes=Array.prototype.indexOf?function(e,t){return-1!==e.indexOf(t)}:function(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return!0;return!1},r.extractModifiers=function(e){var t,n;for(t=[],n=0;n<r.MODIFIERS.length;n++)r.stringContains(e,r.MODIFIERS[n])&&t.push(r.MODIFIERS[n]);return t},r.extractKey=function(e){var t,n;for(t=r.neatString(e).split(" "),n=0;n<t.length;n++)if(!r.arrayIncludes(r.MODIFIERS,t[n]))return t[n]},r.modifiersAndKey=function(e){var t,n;return r.stringContains(e,"any")?r.neatString(e).split(" ").slice(0,2).join(" "):(t=r.extractModifiers(e),(n=r.extractKey(e))&&!r.arrayIncludes(r.MODIFIERS,n)&&t.push(n),t.join(" "))},r.keyName=function(e){return r.KEY_NAMES_BY_CODE[e+""]},r.keyCode=function(e){return+r.KEY_CODES_BY_NAME[e]},r.prototype.initialize=function(){var e,t=this;for(this.lastKeyCode=-1,this.lastModifiers={},e=0;e<r.MODIFIERS.length;e++)this.lastModifiers[r.MODIFIERS[e]]=!1;this.keysDown={any:[]},this.keysUp={any:[]},this.downHandler=this.handler("down"),this.upHandler=this.handler("up"),r.registerEvent(this.element,"keydown",this.downHandler),r.registerEvent(this.element,"keyup",this.upHandler),r.registerEvent(window,"unload",(function e(){r.unregisterEvent(t.element,"keydown",t.downHandler),r.unregisterEvent(t.element,"keyup",t.upHandler),r.unregisterEvent(window,"unload",e)}))},r.prototype.handler=function(e){var t=this;return function(n){var i,a,o;for(n=n||window.event,t.lastKeyCode=n.keyCode,i=0;i<r.MODIFIERS.length;i++)t.lastModifiers[r.MODIFIERS[i]]=n[r.MODIFIERS[i]+"Key"];for(r.arrayIncludes(r.MODIFIERS,r.keyName(t.lastKeyCode))&&(t.lastModifiers[r.keyName(t.lastKeyCode)]=!0),a=t["keys"+r.capitalize(e)],i=0;i<a.any.length;i++)!1===a.any[i](n)&&n.preventDefault&&n.preventDefault();if(a[o=t.lastModifiersAndKey()])for(i=0;i<a[o].length;i++)!1===a[o][i](n)&&n.preventDefault&&n.preventDefault()}},r.prototype.registerKeys=function(e,t,n){var i,a,o=this["keys"+r.capitalize(e)];for(r.isString(t)&&(t=[t]),i=0;i<t.length;i++)a=t[i],o[a=r.modifiersAndKey(a+"")]?o[a].push(n):o[a]=[n];return this},r.prototype.unregisterKeys=function(e,t,n){var i,a,o,s=this["keys"+r.capitalize(e)];for(r.isString(t)&&(t=[t]),i=0;i<t.length;i++)if(o=t[i],o=r.modifiersAndKey(o+""),null===n)delete s[o];else if(s[o])for(a=0;a<s[o].length;a++)if(String(s[o][a])===String(n)){s[o].splice(a,1);break}return this},r.prototype.off=function(e){return this.unregisterKeys("down",e,null)},r.prototype.delegate=function(e,t,n){return null!==n||void 0!==n?this.registerKeys(e,t,n):this.unregisterKeys(e,t,n)},r.prototype.down=function(e,t){return this.delegate("down",e,t)},r.prototype.up=function(e,t){return this.delegate("up",e,t)},r.prototype.lastKey=function(e){return e?this.lastModifiers[e]:r.keyName(this.lastKeyCode)},r.prototype.lastModifiersAndKey=function(){var e,t;for(e=[],t=0;t<r.MODIFIERS.length;t++)this.lastKey(r.MODIFIERS[t])&&e.push(r.MODIFIERS[t]);return r.arrayIncludes(e,this.lastKey())||e.push(this.lastKey()),e.join(" ")},t.default=r,e.exports=t.default}})},e.exports=r()},function(e,t,n){var r;window,r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="dist/",n(n.s="./src/clappr-dash-shaka-playback.js")}({"./node_modules/shaka-player/dist/shaka-player.compiled.js": -/*!*****************************************************************!*\ - !*** ./node_modules/shaka-player/dist/shaka-player.compiled.js ***! - \*****************************************************************/ -/*! no static exports found */function(e,t,n){(function(e,n){!function(){var r="undefined"!=typeof window?window:e,i={};for(var a in function(e,t){var r,i="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){e!=Array.prototype&&e!=Object.prototype&&(e[t]=n.value)},a=void 0!==e&&e===this?this:void 0!==t&&null!=t?t:this;function o(){o=function(){},a.Symbol||(a.Symbol=l)}var s,l=(s=0,function(e){return"jscomp_symbol_"+(e||"")+s++});function u(){o();var e=a.Symbol.iterator;e||(e=a.Symbol.iterator=a.Symbol("iterator")),"function"!=typeof Array.prototype[e]&&i(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return c(this)}}),u=function(){}}function c(e){var t=0;return d((function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}))}function d(e){return u(),(e={next:e})[a.Symbol.iterator]=function(){return this},e}function f(e){u();var t=e[Symbol.iterator];return t?t.call(e):c(e)}function h(e,t){if(t){for(var n=a,r=e.split("."),o=0;o<r.length-1;o++){var s=r[o];s in n||(n[s]={}),n=n[s]}(s=t(o=n[r=r[r.length-1]]))!=o&&null!=s&&i(n,r,{configurable:!0,writable:!0,value:s})}}function p(e){return function(e){function t(t){return e.next(t)}function n(t){return e.throw(t)}return new Promise((function(r,i){!function e(a){a.done?r(a.value):Promise.resolve(a.value).then(t,n).then(e,i)}(e.next())}))}(e())}h("Promise",(function(e){function t(e){this.b=0,this.g=void 0,this.a=[];var t=this.c();try{e(t.resolve,t.reject)}catch(e){t.reject(e)}}function n(){this.a=null}function r(e){return e instanceof t?e:new t((function(t){t(e)}))}if(e)return e;n.prototype.b=function(e){null==this.a&&(this.a=[],this.f()),this.a.push(e)},n.prototype.f=function(){var e=this;this.c((function(){e.h()}))};var i=a.setTimeout;n.prototype.c=function(e){i(e,0)},n.prototype.h=function(){for(;this.a&&this.a.length;){var e=this.a;this.a=[];for(var t=0;t<e.length;++t){var n=e[t];e[t]=null;try{n()}catch(e){this.g(e)}}}this.a=null},n.prototype.g=function(e){this.c((function(){throw e}))},t.prototype.c=function(){function e(e){return function(r){n||(n=!0,e.call(t,r))}}var t=this,n=!1;return{resolve:e(this.s),reject:e(this.f)}},t.prototype.s=function(e){if(e===this)this.f(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof t)this.u(e);else{e:switch(typeof e){case"object":var n=null!=e;break e;case"function":n=!0;break e;default:n=!1}n?this.m(e):this.h(e)}},t.prototype.m=function(e){var t=void 0;try{t=e.then}catch(e){return void this.f(e)}"function"==typeof t?this.B(t,e):this.h(e)},t.prototype.f=function(e){this.i(2,e)},t.prototype.h=function(e){this.i(1,e)},t.prototype.i=function(e,t){if(0!=this.b)throw Error("Cannot settle("+e+", "+t+"): Promise already settled in state"+this.b);this.b=e,this.g=t,this.l()},t.prototype.l=function(){if(null!=this.a){for(var e=0;e<this.a.length;++e)o.b(this.a[e]);this.a=null}};var o=new n;return t.prototype.u=function(e){var t=this.c();e.cc(t.resolve,t.reject)},t.prototype.B=function(e,t){var n=this.c();try{e.call(t,n.resolve,n.reject)}catch(e){n.reject(e)}},t.prototype.then=function(e,n){function r(e,t){return"function"==typeof e?function(t){try{i(e(t))}catch(e){a(e)}}:t}var i,a,o=new t((function(e,t){i=e,a=t}));return this.cc(r(e,i),r(n,a)),o},t.prototype.catch=function(e){return this.then(void 0,e)},t.prototype.cc=function(e,t){function n(){switch(r.b){case 1:e(r.g);break;case 2:t(r.g);break;default:throw Error("Unexpected state: "+r.b)}}var r=this;null==this.a?o.b(n):this.a.push(n)},t.resolve=r,t.reject=function(e){return new t((function(t,n){n(e)}))},t.race=function(e){return new t((function(t,n){for(var i=f(e),a=i.next();!a.done;a=i.next())r(a.value).cc(t,n)}))},t.all=function(e){var n=f(e),i=n.next();return i.done?r([]):new t((function(e,t){function a(t){return function(n){o[t]=n,0==--s&&e(o)}}var o=[],s=0;do{o.push(void 0),s++,r(i.value).cc(a(o.length-1),t),i=n.next()}while(!i.done)}))},t})),h("Promise.prototype.finally",(function(e){return e||function(e){return this.then((function(t){return Promise.resolve(e()).then((function(){return t}))}),(function(t){return Promise.resolve(e()).then((function(){throw t}))}))}}));var m,g="function"==typeof Object.create?Object.create:function(e){function t(){}return t.prototype=e,new t};if("function"==typeof Object.setPrototypeOf)m=Object.setPrototypeOf;else{var y;e:{var v={};try{v.__proto__={Ae:!0},y=v.Ae;break e}catch(s){}y=!1}m=y?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null}var b=m;function _(e,t){if(e.prototype=g(t.prototype),e.prototype.constructor=e,b)b(e,t);else for(var n in t)if("prototype"!=n)if(Object.defineProperties){var r=Object.getOwnPropertyDescriptor(t,n);r&&Object.defineProperty(e,n,r)}else e[n]=t[n];e.tg=t.prototype}function A(){this.g=!1,this.c=null,this.o=void 0,this.j=1,this.b=this.f=0,this.i=this.a=null}function E(e){if(e.g)throw new TypeError("Generator is already running");e.g=!0}function T(e,t){e.a={Ld:t,Wd:!0},e.j=e.f||e.b}function w(e,t,n){return e.j=n,{value:t}}function S(e){e.j=0}function k(e,t,n){e.f=t,null!=n&&(e.b=n)}function C(e,t){e.f=0,e.b=t||0}function x(e,t){e.j=t,e.f=0}function R(e){e.f=0;var t=e.a.Ld;return e.a=null,t}function L(e){e.i=[e.a],e.f=0,e.b=0}function I(e,t){var n=e.i.splice(0)[0];(n=e.a=e.a||n)?n.Wd?e.j=e.f||e.b:null!=n.A&&e.b<n.A?(e.j=n.A,e.a=null):e.j=e.b:e.j=t}function P(e){this.a=new A,this.b=e}function j(e,t,n,r){try{var i=t.call(e.a.c,n);if(!(i instanceof Object))throw new TypeError("Iterator result "+i+" is not an object");if(!i.done)return e.a.g=!1,i;var a=i.value}catch(t){return e.a.c=null,T(e.a,t),O(e)}return e.a.c=null,r.call(e.a,a),O(e)}function O(e){for(;e.a.j;)try{var t=e.b(e.a);if(t)return e.a.g=!1,{value:t.value,done:!1}}catch(t){e.a.o=void 0,T(e.a,t)}if(e.a.g=!1,e.a.a){if(t=e.a.a,e.a.a=null,t.Wd)throw t.Ld;return{value:t.return,done:!0}}return{value:void 0,done:!0}}function D(e){this.next=function(t){return E(e.a),e.a.c?t=j(e,e.a.c.next,t,e.a.h):(e.a.h(t),t=O(e)),t},this.throw=function(t){return E(e.a),e.a.c?t=j(e,e.a.c.throw,t,e.a.h):(T(e.a,t),t=O(e)),t},this.return=function(t){return function(e,t){E(e.a);var n=e.a.c;return n?j(e,"return"in n?n.return:function(e){return{value:e,done:!0}},t,e.a.return):(e.a.return(t),O(e))}(e,t)},u(),this[Symbol.iterator]=function(){return this}}function M(e,t){return D.prototype=e.prototype,new D(new P(t))}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function U(e,t,n){e instanceof String&&(e=String(e));for(var r=e.length,i=0;i<r;i++){var a=e[i];if(t.call(n,a,i,e))return{Td:i,ve:a}}return{Td:-1,ve:void 0}}function F(e,t,n){if(null==e)throw new TypeError("The 'this' value for String.prototype."+n+" must not be null or undefined");if(t instanceof RegExp)throw new TypeError("First argument to String.prototype."+n+" must not be a regular expression");return e+""}A.prototype.h=function(e){this.o=e},A.prototype.return=function(e){this.a={return:e},this.j=this.b},A.prototype.A=function(e){this.j=e},h("WeakMap",(function(e){function t(e){if(this.a=(s+=Math.random()+1).toString(),e){o(),u(),e=f(e);for(var t;!(t=e.next()).done;)t=t.value,this.set(t[0],t[1])}}function n(e){N(e,a)||i(e,a,{value:{}})}function r(e){var t=Object[e];t&&(Object[e]=function(e){return n(e),t(e)})}if(function(){if(!e||!Object.seal)return!1;try{var t=Object.seal({}),n=Object.seal({}),r=new e([[t,2],[n,3]]);return 2==r.get(t)&&3==r.get(n)&&(r.delete(t),r.set(n,4),!r.has(t)&&4==r.get(n))}catch(e){return!1}}())return e;var a="$jscomp_hidden_"+Math.random();r("freeze"),r("preventExtensions"),r("seal");var s=0;return t.prototype.set=function(e,t){if(n(e),!N(e,a))throw Error("WeakMap key fail: "+e);return e[a][this.a]=t,this},t.prototype.get=function(e){return N(e,a)?e[a][this.a]:void 0},t.prototype.has=function(e){return N(e,a)&&N(e[a],this.a)},t.prototype.delete=function(e){return!(!N(e,a)||!N(e[a],this.a))&&delete e[a][this.a]},t})),h("Map",(function(e){function t(){var e={};return e.Fa=e.next=e.head=e}function n(e,t){var n=e.a;return d((function(){if(n){for(;n.head!=e.a;)n=n.Fa;for(;n.next!=n.head;)return n=n.next,{done:!1,value:t(n)};n=null}return{done:!0,value:void 0}}))}function r(e,t){var n=t&&typeof t;"object"==n||"function"==n?a.has(t)?n=a.get(t):(n=""+ ++s,a.set(t,n)):n="p_"+t;var r=e.b[n];if(r&&N(e.b,n))for(var i=0;i<r.length;i++){var o=r[i];if(t!=t&&o.key!=o.key||t===o.key)return{id:n,list:r,index:i,X:o}}return{id:n,list:r,index:-1,X:void 0}}function i(e){if(this.b={},this.a=t(),this.size=0,e){e=f(e);for(var n;!(n=e.next()).done;)n=n.value,this.set(n[0],n[1])}}if(function(){if(!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),n=new e(f([[t,"s"]]));if("s"!=n.get(t)||1!=n.size||n.get({x:4})||n.set({x:4},"t")!=n||2!=n.size)return!1;var r=n.entries(),i=r.next();return!i.done&&i.value[0]==t&&"s"==i.value[1]&&!((i=r.next()).done||4!=i.value[0].x||"t"!=i.value[1]||!r.next().done)}catch(e){return!1}}())return e;o(),u();var a=new WeakMap;i.prototype.set=function(e,t){var n=r(this,e);return n.list||(n.list=this.b[n.id]=[]),n.X?n.X.value=t:(n.X={next:this.a,Fa:this.a.Fa,head:this.a,key:e,value:t},n.list.push(n.X),this.a.Fa.next=n.X,this.a.Fa=n.X,this.size++),this},i.prototype.delete=function(e){return!(!(e=r(this,e)).X||!e.list||(e.list.splice(e.index,1),e.list.length||delete this.b[e.id],e.X.Fa.next=e.X.next,e.X.next.Fa=e.X.Fa,e.X.head=null,this.size--,0))},i.prototype.clear=function(){this.b={},this.a=this.a.Fa=t(),this.size=0},i.prototype.has=function(e){return!!r(this,e).X},i.prototype.get=function(e){return(e=r(this,e).X)&&e.value},i.prototype.entries=function(){return n(this,(function(e){return[e.key,e.value]}))},i.prototype.keys=function(){return n(this,(function(e){return e.key}))},i.prototype.values=function(){return n(this,(function(e){return e.value}))},i.prototype.forEach=function(e,t){for(var n,r=this.entries();!(n=r.next()).done;)n=n.value,e.call(t,n[1],n[0],this)},i.prototype[Symbol.iterator]=i.prototype.entries;var s=0;return i})),h("Set",(function(e){function t(e){if(this.a=new Map,e){e=f(e);for(var t;!(t=e.next()).done;)this.add(t.value)}this.size=this.a.size}return function(){if(!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),n=new e(f([t]));if(!n.has(t)||1!=n.size||n.add(t)!=n||1!=n.size||n.add({x:4})!=n||2!=n.size)return!1;var r=n.entries(),i=r.next();return!i.done&&i.value[0]==t&&i.value[1]==t&&!(i=r.next()).done&&i.value[0]!=t&&4==i.value[0].x&&i.value[1]==i.value[0]&&r.next().done}catch(e){return!1}}()?e:(o(),u(),t.prototype.add=function(e){return this.a.set(e,e),this.size=this.a.size,this},t.prototype.delete=function(e){return e=this.a.delete(e),this.size=this.a.size,e},t.prototype.clear=function(){this.a.clear(),this.size=0},t.prototype.has=function(e){return this.a.has(e)},t.prototype.entries=function(){return this.a.entries()},t.prototype.values=function(){return this.a.values()},t.prototype.keys=t.prototype.values,t.prototype[Symbol.iterator]=t.prototype.values,t.prototype.forEach=function(e,t){var n=this;this.a.forEach((function(r){return e.call(t,r,r,n)}))},t)})),h("Array.prototype.findIndex",(function(e){return e||function(e,t){return U(this,e,t).Td}})),h("Array.prototype.keys",(function(e){return e||function(){return function(e,t){u(),e instanceof String&&(e+="");var n=0,r={next:function(){if(n<e.length){var i=n++;return{value:t(i,e[i]),done:!1}}return r.next=function(){return{done:!0,value:void 0}},r.next()}};return r[Symbol.iterator]=function(){return r},r}(this,(function(e){return e}))}})),h("Object.is",(function(e){return e||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}})),h("Array.prototype.includes",(function(e){return e||function(e,t){var n=this;n instanceof String&&(n=String(n));var r=n.length,i=t||0;for(0>i&&(i=Math.max(i+r,0));i<r;i++){var a=n[i];if(a===e||Object.is(a,e))return!0}return!1}})),h("String.prototype.includes",(function(e){return e||function(e,t){return-1!==F(this,e,"includes").indexOf(e,t||0)}})),h("Array.from",(function(e){return e||function(e,t,n){u(),t=null!=t?t:function(e){return e};var r=[],i=e[Symbol.iterator];if("function"==typeof i)for(e=i.call(e);!(i=e.next()).done;)r.push(t.call(n,i.value));else{i=e.length;for(var a=0;a<i;a++)r.push(t.call(n,e[a]))}return r}})),h("String.prototype.startsWith",(function(e){return e||function(e,t){for(var n=F(this,e,"startsWith"),r=n.length,i=e.length,a=Math.max(0,Math.min(0|t,n.length)),o=0;o<i&&a<r;)if(n[a++]!=e[o++])return!1;return o>=i}})),h("Array.prototype.find",(function(e){return e||function(e,t){return U(this,e,t).ve}}));var B="function"==typeof Object.assign?Object.assign:function(e,t){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r)for(var i in r)N(r,i)&&(e[i]=r[i])}return e};h("Object.assign",(function(e){return e||B}));var K=this;function V(e,t){var n,r=e.split("."),i=K;r[0]in i||!i.execScript||i.execScript("var "+r[0]);for(;r.length&&(n=r.shift());)r.length||void 0===t?i=i[n]?i[n]:i[n]={}:i[n]=t}function G(e,t){function n(){}n.prototype=t.prototype,e.tg=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Eg=function(e,n,r){return t.prototype[n].apply(e,Array.prototype.slice.call(arguments,2))}}function H(e){this.c=Math.exp(Math.log(.5)/e),this.b=this.a=0}function Y(e,t,n){var r=Math.pow(e.c,t);n=n*(1-r)+r*e.a,isNaN(n)||(e.a=n,e.b+=t)}function z(e){return e.a/(1-Math.pow(e.c,e.b))}function W(){this.b=new H(2),this.c=new H(5),this.a=0}function $(){}function q(){}function X(){}K.a=!0,W.prototype.getBandwidthEstimate=function(e){return 128e3>this.a?e:Math.min(z(this.b),z(this.c))},e.console&&e.console.log.bind&&(q=console.warn.bind(console),$=console.error.bind(console));var J=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;function Q(e){var t;e instanceof Q?(Z(this,e.ta),this.bb=e.bb,this.sa=e.sa,ee(this,e.Ab),this.ja=e.ja,te(this,e.a.clone()),this.Sa=e.Sa):e&&(t=String(e).match(J))?(Z(this,t[1]||"",!0),this.bb=ne(t[2]||""),this.sa=ne(t[3]||"",!0),ee(this,t[4]),this.ja=ne(t[5]||"",!0),te(this,t[6]||"",!0),this.Sa=ne(t[7]||"")):this.a=new ce(null)}function Z(e,t,n){e.ta=n?ne(t,!0):t,e.ta&&(e.ta=e.ta.replace(/:$/,""))}function ee(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.Ab=t}else e.Ab=null}function te(e,t,n){t instanceof ce?e.a=t:(n||(t=re(t,le)),e.a=new ce(t))}function ne(e,t){return e?t?decodeURI(e):decodeURIComponent(e):""}function re(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,ie),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function ie(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}(r=Q.prototype).ta="",r.bb="",r.sa="",r.Ab=null,r.ja="",r.Sa="",r.toString=function(){var e=[],t=this.ta;if(t&&e.push(re(t,ae,!0),":"),t=this.sa){e.push("//");var n=this.bb;n&&e.push(re(n,ae,!0),"@"),e.push(encodeURIComponent(t).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(t=this.Ab)&&e.push(":",String(t))}return(t=this.ja)&&(this.sa&&"/"!=t.charAt(0)&&e.push("/"),e.push(re(t,"/"==t.charAt(0)?se:oe,!0))),(t=this.a.toString())&&e.push("?",t),(t=this.Sa)&&e.push("#",re(t,ue)),e.join("")},r.resolve=function(e){var t=this.clone();"data"===t.ta&&(t=new Q);var n=!!e.ta;n?Z(t,e.ta):n=!!e.bb,n?t.bb=e.bb:n=!!e.sa,n?t.sa=e.sa:n=null!=e.Ab;var r=e.ja;if(n)ee(t,e.Ab);else if(n=!!e.ja){if("/"!=r.charAt(0))if(this.sa&&!this.ja)r="/"+r;else{var i=t.ja.lastIndexOf("/");-1!=i&&(r=t.ja.substr(0,i+1)+r)}if(".."==r||"."==r)r="";else if(-1!=r.indexOf("./")||-1!=r.indexOf("/.")){i=0==r.lastIndexOf("/",0),r=r.split("/");for(var a=[],o=0;o<r.length;){var s=r[o++];"."==s?i&&o==r.length&&a.push(""):".."==s?((1<a.length||1==a.length&&""!=a[0])&&a.pop(),i&&o==r.length&&a.push("")):(a.push(s),i=!0)}r=a.join("/")}}return n?t.ja=r:n=""!==e.a.toString(),n?te(t,e.a.clone()):n=!!e.Sa,n&&(t.Sa=e.Sa),t},r.clone=function(){return new Q(this)};var ae=/[#\/\?@]/g,oe=/[#\?:]/g,se=/[#\?]/g,le=/[#\?@]/g,ue=/#/g;function ce(e){this.a=e||null}function de(e){this.b=e,this.a=null}function fe(e){this.b=e,this.a=null}function he(e,t){var n={maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0};this.i=null==e.maxAttempts?n.maxAttempts:e.maxAttempts,this.f=null==e.baseDelay?n.baseDelay:e.baseDelay,this.h=null==e.fuzzFactor?n.fuzzFactor:e.fuzzFactor,this.g=null==e.backoffFactor?n.backoffFactor:e.backoffFactor,this.a=0,this.b=this.f,(this.c=void 0!==t&&t)&&(this.a=1)}function pe(e){return p((function t(){var n,r;return M(t,(function(t){switch(t.j){case 1:if(e.a>=e.i){if(!e.c)return t.return(Promise.reject());e.a=1,e.b=e.f}return n=e.a,e.a++,0==n?t.return():(r=e.b*(1+(2*Math.random()-1)*e.h),w(t,new Promise((function(e){new fe(e).R(r/1e3)})),2));case 2:e.b*=e.g,S(t)}}))}))}function me(e,t,n,r){for(var i=[],a=3;a<arguments.length;++a)i[a-3]=arguments[a];this.severity=e,this.category=t,this.code=n,this.data=i,this.handled=!1}function ge(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function ye(e,t){this.promise=e,this.Zd=t,this.a=!1}function ve(e){return new ye(Promise.reject(e),(function(){return Promise.resolve()}))}function be(){var e=Promise.reject(new me(2,7,7001));return e.catch((function(){})),new ye(e,(function(){return Promise.resolve()}))}function _e(e){return new ye(Promise.resolve(e),(function(){return Promise.resolve()}))}function Ae(e){return new ye(e,(function(){return e.catch((function(){}))}))}function Ee(e){return new ye(Promise.all(e.map((function(e){return e.promise}))),(function(){return Promise.all(e.map((function(e){return e.abort()})))}))}function Te(e,t,n){try{var r=e(t);return r&&r.promise&&r.abort?(n.resolve(r.promise),function(){return r.abort()}):(n.resolve(r),function(){return Promise.resolve(r).then((function(){})).catch((function(){}))})}catch(e){return n.reject(e),function(){return Promise.resolve()}}}function we(t,n){for(var r in n=void 0===n?{}:n)this[r]=n[r];this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=e.performance&&e.performance.now?e.performance.now():Date.now(),this.type=t,this.isTrusted=!1,this.target=this.currentTarget=null,this.a=!1}function Se(){this.a={}}function ke(){this.Jc=new Se,this.$b=this}function Ce(e){var t=new Set;return function e(n){switch(typeof n){case"undefined":case"boolean":case"number":case"string":case"symbol":case"function":return n;default:if(!n||n.buffer&&n.buffer.constructor==ArrayBuffer)return n;if(t.has(n))return null;var r=n.constructor==Array;if(n.constructor!=Object&&!r)return null;t.add(n);var i,a=r?[]:{};for(i in n)a[i]=e(n[i]);return r&&(a.length=n.length),a}}(e)}function xe(e,t){return!("number"!=typeof e||"number"!=typeof t||!isNaN(e)||!isNaN(t))||e===t}function Re(e,t){var n=e.indexOf(t);-1<n&&e.splice(n,1)}function Le(e,t,n){if(n||(n=xe),e.length!=t.length)return!1;t=t.slice();for(var r={},i=(e=f(e)).next();!i.done;r={item:r.item},i=e.next()){if(r.item=i.value,-1==(i=t.findIndex(function(e){return function(t){return n(e.item,t)}}(r))))return!1;t[i]=t[t.length-1],t.pop()}return 0==t.length}function Ie(){this.a=[]}function Pe(e,t){e.a.push(t.finally((function(){Re(e.a,t)})))}function je(e){ke.call(this),this.f=!1,this.g=new Ie,this.a=new Set,this.b=new Set,this.c=e||null}(r=ce.prototype).ha=null,r.fc=null,r.add=function(e,t){if(!this.ha&&(this.ha={},this.fc=0,this.a))for(var n=this.a.split("&"),r=0;r<n.length;r++){var i=n[r].indexOf("="),a=null;if(0<=i){var o=n[r].substring(0,i);a=n[r].substring(i+1)}else o=n[r];o=decodeURIComponent(o.replace(/\+/g," ")),a=a||"",this.add(o,decodeURIComponent(a.replace(/\+/g," ")))}return this.a=null,(n=this.ha.hasOwnProperty(e)&&this.ha[e])||(this.ha[e]=n=[]),n.push(t),this.fc++,this},r.toString=function(){if(this.a)return this.a;if(!this.ha)return"";var e,t=[];for(e in this.ha)for(var n=encodeURIComponent(e),r=this.ha[e],i=0;i<r.length;i++){var a=n;""!==r[i]&&(a+="="+encodeURIComponent(r[i])),t.push(a)}return this.a=t.join("&")},r.clone=function(){var e=new ce;if(e.a=this.a,this.ha){var t,n={};for(t in this.ha)n[t]=this.ha[t].concat();e.ha=n,e.fc=this.fc}return e},de.prototype.R=function(t){var n=this;this.stop();var r=!0,i=null;return this.a=function(){e.clearTimeout(i),r=!1},i=e.setTimeout((function(){r&&n.b()}),1e3*t),this},de.prototype.stop=function(){this.a&&(this.a(),this.a=null)},V("shaka.util.Timer",fe),fe.prototype.yc=function(){return this.stop(),this.b(),this},fe.prototype.tickNow=fe.prototype.yc,fe.prototype.R=function(e){var t=this;return this.stop(),this.a=new de((function(){t.b()})).R(e),this},fe.prototype.tickAfter=fe.prototype.R,fe.prototype.Na=function(e){var t=this;return this.stop(),this.a=new de((function(){t.a.R(e),t.b()})).R(e),this},fe.prototype.tickEvery=fe.prototype.Na,fe.prototype.stop=function(){this.a&&(this.a.stop(),this.a=null)},fe.prototype.stop=fe.prototype.stop,V("shaka.util.Error",me),me.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")},me.Severity={RECOVERABLE:1,CRITICAL:2},me.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9},me.Code={UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,UNKNOWN_DATA_URI_ENCODING:1005,REQUEST_FILTER_ERROR:1006,RESPONSE_FILTER_ERROR:1007,MALFORMED_TEST_URI:1008,UNEXPECTED_TEST_REQUEST:1009,INVALID_TEXT_HEADER:2e3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_MP4_TTML:2007,INVALID_MP4_VTT:2008,UNABLE_TO_EXTRACT_CUE_START_TIME:2009,BUFFER_READ_OUT_OF_BOUNDS:3e3,JS_INTEGER_OVERFLOW:3001,EBML_OVERFLOW:3002,EBML_BAD_FLOATING_POINT_SIZE:3003,MP4_SIDX_WRONG_BOX_TYPE:3004,MP4_SIDX_INVALID_TIMESCALE:3005,MP4_SIDX_TYPE_NOT_SUPPORTED:3006,WEBM_CUES_ELEMENT_MISSING:3007,WEBM_EBML_HEADER_ELEMENT_MISSING:3008,WEBM_SEGMENT_ELEMENT_MISSING:3009,WEBM_INFO_ELEMENT_MISSING:3010,WEBM_DURATION_ELEMENT_MISSING:3011,WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING:3012,WEBM_CUE_TIME_ELEMENT_MISSING:3013,MEDIA_SOURCE_OPERATION_FAILED:3014,MEDIA_SOURCE_OPERATION_THREW:3015,VIDEO_ERROR:3016,QUOTA_EXCEEDED_ERROR:3017,TRANSMUXING_FAILED:3018,UNABLE_TO_GUESS_MANIFEST_TYPE:4e3,DASH_INVALID_XML:4001,DASH_NO_SEGMENT_INFO:4002,DASH_EMPTY_ADAPTATION_SET:4003,DASH_EMPTY_PERIOD:4004,DASH_WEBM_MISSING_INIT:4005,DASH_UNSUPPORTED_CONTAINER:4006,DASH_PSSH_BAD_ENCODING:4007,DASH_NO_COMMON_KEY_SYSTEM:4008,DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED:4009,DASH_CONFLICTING_KEY_IDS:4010,UNPLAYABLE_PERIOD:4011,RESTRICTIONS_CANNOT_BE_MET:4012,NO_PERIODS:4014,HLS_PLAYLIST_HEADER_MISSING:4015,INVALID_HLS_TAG:4016,HLS_INVALID_PLAYLIST_HIERARCHY:4017,DASH_DUPLICATE_REPRESENTATION_ID:4018,HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND:4020,HLS_COULD_NOT_GUESS_MIME_TYPE:4021,HLS_MASTER_PLAYLIST_NOT_PROVIDED:4022,HLS_REQUIRED_ATTRIBUTE_MISSING:4023,HLS_REQUIRED_TAG_MISSING:4024,HLS_COULD_NOT_GUESS_CODECS:4025,HLS_KEYFORMATS_NOT_SUPPORTED:4026,DASH_UNSUPPORTED_XLINK_ACTUATE:4027,DASH_XLINK_DEPTH_LIMIT:4028,HLS_COULD_NOT_PARSE_SEGMENT_START_TIME:4030,CONTENT_UNSUPPORTED_BY_BROWSER:4032,CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM:4033,HLS_AES_128_ENCRYPTION_NOT_SUPPORTED:4034,HLS_INTERNAL_SKIP_STREAM:4035,INVALID_STREAMS_CHOSEN:5005,NO_RECOGNIZED_KEY_SYSTEMS:6e3,REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE:6001,FAILED_TO_CREATE_CDM:6002,FAILED_TO_ATTACH_TO_VIDEO:6003,INVALID_SERVER_CERTIFICATE:6004,FAILED_TO_CREATE_SESSION:6005,FAILED_TO_GENERATE_LICENSE_REQUEST:6006,LICENSE_REQUEST_FAILED:6007,LICENSE_RESPONSE_REJECTED:6008,ENCRYPTED_CONTENT_WITHOUT_DRM_INFO:6010,NO_LICENSE_SERVER_GIVEN:6012,OFFLINE_SESSION_REMOVED:6013,EXPIRED:6014,SERVER_CERTIFICATE_REQUIRED:6015,INIT_DATA_TRANSFORM_ERROR:6016,LOAD_INTERRUPTED:7e3,OPERATION_ABORTED:7001,NO_VIDEO_ELEMENT:7002,CAST_API_UNAVAILABLE:8e3,NO_CAST_RECEIVERS:8001,ALREADY_CASTING:8002,UNEXPECTED_CAST_ERROR:8003,CAST_CANCELED_BY_USER:8004,CAST_CONNECTION_TIMED_OUT:8005,CAST_RECEIVER_APP_UNAVAILABLE:8006,STORAGE_NOT_SUPPORTED:9e3,INDEXED_DB_ERROR:9001,DEPRECATED_OPERATION_ABORTED:9002,REQUESTED_ITEM_NOT_FOUND:9003,MALFORMED_OFFLINE_URI:9004,CANNOT_STORE_LIVE_OFFLINE:9005,STORE_ALREADY_IN_PROGRESS:9006,NO_INIT_DATA_FOR_OFFLINE:9007,LOCAL_PLAYER_INSTANCE_REQUIRED:9008,NEW_KEY_OPERATION_NOT_SUPPORTED:9011,KEY_NOT_FOUND:9012,MISSING_STORAGE_CELL:9013},ge.prototype.resolve=function(){},ge.prototype.reject=function(){},V("shaka.util.AbortableOperation",ye),ye.failed=ve,ye.aborted=be,ye.completed=_e,ye.notAbortable=Ae,ye.prototype.abort=function(){return this.a=!0,this.Zd()},ye.prototype.abort=ye.prototype.abort,ye.all=Ee,ye.prototype.finally=function(e){return this.promise.then((function(){return e(!0)}),(function(){return e(!1)})),this},ye.prototype.finally=ye.prototype.finally,ye.prototype.U=function(e,t){function n(){return i.reject(new me(2,7,7001)),r.abort()}var r=this,i=new ge;return this.promise.then((function(t){r.a?i.reject(new me(2,7,7001)):e?n=Te(e,t,i):i.resolve(t)}),(function(e){t?n=Te(t,e,i):i.reject(e)})),new ye(i,(function(){return n()}))},ye.prototype.chain=ye.prototype.U,we.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},we.prototype.stopImmediatePropagation=function(){this.a=!0},we.prototype.stopPropagation=function(){},(r=Se.prototype).push=function(e,t){this.a.hasOwnProperty(e)?this.a[e].push(t):this.a[e]=[t]},r.get=function(e){return(e=this.a[e])?e.slice():null},r.getAll=function(){var e,t=[];for(e in this.a)t.push.apply(t,this.a[e]);return t},r.remove=function(e,t){var n=this.a[e];if(n)for(var r=0;r<n.length;++r)n[r]==t&&(n.splice(r,1),--r)},r.forEach=function(e){for(var t in this.a)e(t,this.a[t])},ke.prototype.addEventListener=function(e,t){this.Jc.push(e,t)},ke.prototype.removeEventListener=function(e,t){this.Jc.remove(e,t)},ke.prototype.dispatchEvent=function(e){for(var t=this.Jc.get(e.type)||[],n=0;n<t.length;++n){e.target=this.$b,e.currentTarget=this.$b;var r=t[n];try{r.handleEvent?r.handleEvent(e):r.call(this,e)}catch(e){}if(e.a)break}return e.defaultPrevented},Ie.prototype.destroy=function(){var e=[];return this.a.forEach((function(t){t.promise.catch((function(){})),e.push(t.abort())})),this.a=[],Promise.all(e)},G(je,ke),V("shaka.net.NetworkingEngine",je),je.RequestType={MANIFEST:0,SEGMENT:1,LICENSE:2,APP:3,TIMING:4},je.PluginPriority={FALLBACK:1,PREFERRED:2,APPLICATION:3};var Oe={};function De(e,t,n){n=n||3;var r=Oe[e];(!r||n>=r.priority)&&(Oe[e]={priority:n,Rf:t})}function Me(e,t){return{uris:e,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:t,licenseRequestType:null,sessionId:null}}function Ne(){this.a=0}function Ue(e,t,n){ye.call(this,e,t),this.b=n}function Fe(){}function Be(){this.a=new Se}function Ke(e,t,n,r){this.target=e,this.type=t,this.listener=n,this.a=function(e,t){if(null==t)return!1;if("boolean"==typeof t)return t;var n=new Set(["passive","capture"]);return Object.keys(t).filter((function(e){return!n.has(e)})),function(e){var t=Ve;if(null==t){t=!1;try{var n={},r={get:function(){return t=!0,!1}};Object.defineProperty(n,"passive",r),Object.defineProperty(n,"capture",r),r=function(){},e.addEventListener("test",r,n),e.removeEventListener("test",r,n)}catch(e){t=!1}Ve=t}return t||!1}(e)?t:t.capture||!1}(e,r),this.target.addEventListener(t,n,this.a)}je.registerScheme=De,je.unregisterScheme=function(e){delete Oe[e]},je.prototype.Tf=function(e){this.a.add(e)},je.prototype.registerRequestFilter=je.prototype.Tf,je.prototype.vg=function(e){this.a.delete(e)},je.prototype.unregisterRequestFilter=je.prototype.vg,je.prototype.Ie=function(){this.a.clear()},je.prototype.clearAllRequestFilters=je.prototype.Ie,je.prototype.Uf=function(e){this.b.add(e)},je.prototype.registerResponseFilter=je.prototype.Uf,je.prototype.wg=function(e){this.b.delete(e)},je.prototype.unregisterResponseFilter=je.prototype.wg,je.prototype.Je=function(){this.b.clear()},je.prototype.clearAllResponseFilters=je.prototype.Je,je.defaultRetryParameters=function(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0}},je.makeRequest=Me,je.prototype.destroy=function(){return this.f=!0,this.a.clear(),this.b.clear(),this.g.destroy()},je.prototype.destroy=je.prototype.destroy,je.prototype.request=function(e,t){var n=this,r=new Ne;if(this.f){var i=Promise.reject(new me(2,7,7001));return i.catch((function(){})),new Ue(i,(function(){return Promise.resolve()}),r)}t.method=t.method||"GET",t.headers=t.headers||{},t.retryParameters=t.retryParameters?Ce(t.retryParameters):{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},t.uris=Ce(t.uris);var a=(i=function(e,t,n){for(var r=_e(void 0),i={},a=(e=f(e.a)).next();!a.done;i={qd:i.qd},a=e.next())i.qd=a.value,r=r.U(function(e){return function(){return e.qd(t,n)}}(i));return r.U(void 0,(function(e){if(e&&7001==e.code)throw e;throw new me(2,1,1006,e)}))}(this,e,t)).U((function(){return function e(t,n,r,i,a,o,s){var l=new Q(r.uris[a]),u=l.ta,c=!1;u||(u=(u=location.protocol).slice(0,-1),Z(l,u),r.uris[a]=l.toString()),u=u.toLowerCase();var d,f=(u=Oe[u])?u.Rf:null;return f?Ae(pe(i)).U((function(){return t.f?be():(d=Date.now(),f(r.uris[a],r,n,(function(e,r,i){t.c&&1==n&&(t.c(e,r),c=!0,s.a=i)})))})).U((function(e){return null==e.timeMs&&(e.timeMs=Date.now()-d),{response:e,qf:c}}),(function(l){if(l&&7001==l.code)throw l;if(t.f)return be();if(l&&1==l.severity)return t.dispatchEvent(new we("retry",{error:l instanceof me?l:null})),a=(a+1)%r.uris.length,e(t,n,r,i,a,l,s);throw l||o})):ve(new me(2,1,1e3,l))}(n,e,t,new he(t.retryParameters,!1),0,null,r)})),o=a.U((function(t){return function(e,t,n){for(var r=_e(void 0),i=(e=f(e.b)).next();!i.done;i=e.next())r=r.U(i.value.bind(null,t,n.response));return r.U((function(){return n}),(function(e){if(e&&7001==e.code)throw e;var t=2;throw e instanceof me&&(t=e.severity),new me(t,1,1007,e)}))}(n,e,t)})),s=Date.now(),l=0;i.promise.then((function(){l=Date.now()-s}),(function(){}));var u=0;return a.promise.then((function(){u=Date.now()}),(function(){})),i=new Ue((i=o.U((function(t){var r=Date.now()-u,i=t.response;return i.timeMs+=l,i.timeMs+=r,t.qf||!n.c||i.fromCache||1!=e||n.c(i.timeMs,i.data.byteLength),i}),(function(e){throw e&&(e.severity=2),e}))).promise,i.Zd,r),Pe(this.g,i),i},je.prototype.request=je.prototype.request,je.NumBytesRemainingClass=Ne,_(Ue,ye),je.PendingRequest=Ue,Ue.all=Ee,Ue.notAbortable=Ae,Ue.completed=_e,Ue.aborted=be,Ue.failed=ve,V("shaka.util.IReleasable",Fe),Fe.prototype.release=function(){},V("shaka.util.EventManager",Be),Be.prototype.release=function(){this.$a(),this.a=null},Be.prototype.release=Be.prototype.release,Be.prototype.w=function(e,t,n,r){this.a&&(e=new Ke(e,t,n,r),this.a.push(t,e))},Be.prototype.listen=Be.prototype.w,Be.prototype.da=function(e,t,n,r){var i=this;this.w(e,t,(function r(a){i.ea(e,t,r),n(a)}),r)},Be.prototype.listenOnce=Be.prototype.da,Be.prototype.ea=function(e,t,n){if(this.a)for(var r=this.a.get(t)||[],i=(r=f(r)).next();!i.done;i=r.next())(i=i.value).target!=e||n!=i.listener&&n||(i.ea(),this.a.remove(t,i))},Be.prototype.unlisten=Be.prototype.ea,Be.prototype.$a=function(){if(this.a){for(var e=this.a.getAll(),t=(e=f(e)).next();!t.done;t=e.next())t.value.ea();this.a.a={}}},Be.prototype.removeAll=Be.prototype.$a,Ke.prototype.ea=function(){this.target.removeEventListener(this.type,this.listener,this.a),this.listener=this.target=null,this.a=!1},Ke.prototype.unlisten=Ke.prototype.ea;var Ve=void 0;function Ge(e){if(e=new Uint8Array(e),new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!0)+4!=e.byteLength)throw new RangeError("Malformed FairPlay init data");return new Q(e=st(e.subarray(4),!0)).sa}function He(e,t,n){function r(e){new DataView(a.buffer).setUint32(o,e.byteLength,!0),o+=4,i(e)}function i(e){a.set(e,o),o+=e.byteLength}if(!n||!n.byteLength)throw new me(2,6,6015);t="string"==typeof t?new Uint8Array(ct(t,!0)):new Uint8Array(t);var a=new Uint8Array(8+e.byteLength+t.byteLength+n.byteLength),o=0;return i(new Uint8Array(e)),r(t),r(new Uint8Array(n)),a}function Ye(e,t){for(var n=[],r=f(e),i=r.next();!i.done;i=r.next())n.push(t(i.value));return n}function ze(e,t){for(var n=f(e),r=n.next();!r.done;r=n.next())if(!t(r.value))return!1;return!0}function We(e){var t=new Map;return Object.keys(e).forEach((function(n){t.set(n,e[n])})),t}function $e(e){var t={};return e.forEach((function(e,n){t[n]=e})),t}function qe(e,t){var n=e;return t&&(n+='; codecs="'+t+'"'),n}function Xe(e){var t=(e=e.split("."))[0];return e.pop(),[t,e.join(".")]}V("shaka.util.FairPlayUtils.defaultGetContentId",Ge),V("shaka.util.FairPlayUtils.initDataTransform",He);var Je=(new Map).set("codecs","codecs").set("frameRate","framerate").set("bandwidth","bitrate").set("width","width").set("height","height").set("channelsCount","channels");function Qe(){return!(!e.MediaSource||!MediaSource.isTypeSupported)}function Ze(e){return""!=rt().canPlayType(e)}function et(){return!!navigator.vendor&&navigator.vendor.includes("Apple")&&!nt("Tizen")}function tt(){if(!et())return null;var e=navigator.userAgent.match(/Version\/(\d+)/);return e||(e=navigator.userAgent.match(/OS (\d+)(?:_\d+)?/))?parseInt(e[1],10):null}function nt(e){return(navigator.userAgent||"").includes(e)}function rt(){return at||(it||(it=new fe((function(){at=null}))),(at=document.querySelector("video")||document.querySelector("audio"))||(at=document.createElement("video")),it.R(1),at)}var it=null,at=null;function ot(e){if(!e)return"";239==(e=new Uint8Array(e))[0]&&187==e[1]&&191==e[2]&&(e=e.subarray(3)),e=dt(e),e=escape(e);try{return decodeURIComponent(e)}catch(e){throw new me(2,2,2004)}}function st(e,t,n){if(!e)return"";if(!n&&0!=e.byteLength%2)throw new me(2,2,2004);if(e instanceof ArrayBuffer)var r=e;else(n=new Uint8Array(e.byteLength)).set(new Uint8Array(e)),r=n.buffer;e=Math.floor(e.byteLength/2),n=new Uint16Array(e),r=new DataView(r);for(var i=0;i<e;i++)n[i]=r.getUint16(2*i,t);return dt(n)}function lt(e){var t=new Uint8Array(e);if(239==t[0]&&187==t[1]&&191==t[2])return ot(t);if(254==t[0]&&255==t[1])return st(t.subarray(2),!1);if(255==t[0]&&254==t[1])return st(t.subarray(2),!0);var n=function(e,t){return e.byteLength<=t||32<=e[t]&&126>=e[t]}.bind(null,t);if(0==t[0]&&0==t[2])return st(e,!1);if(0==t[1]&&0==t[3])return st(e,!0);if(n(0)&&n(1)&&n(2)&&n(3))return ot(e);throw new me(2,2,2003)}function ut(e){e=encodeURIComponent(e),e=unescape(e);for(var t=new Uint8Array(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t.buffer}function ct(e,t){for(var n=new Uint8Array(2*e.length),r=new DataView(n.buffer),i=0;i<e.length;++i)r.setUint16(2*i,e.charCodeAt(i),t);return n.buffer}function dt(e){if(!ft)for(var t=function(e){try{var t=new Uint8Array(e);return 0<String.fromCharCode.apply(null,t).length}catch(e){return!1}},n={size:65536};0<n.size;(n={size:n.size}).size/=2)if(t(n.size)){ft=function(e){return function(t){for(var n="",r=0;r<t.length;r+=e.size)n+=String.fromCharCode.apply(null,t.subarray(r,r+e.size));return n}}(n);break}return ft(e)}V("shaka.util.StringUtils.fromUTF8",ot),V("shaka.util.StringUtils.fromUTF16",st),V("shaka.util.StringUtils.fromBytesAutoDetect",lt),V("shaka.util.StringUtils.toUTF8",ut),V("shaka.util.StringUtils.toUTF16",ct);var ft=null;V("shaka.util.StringUtils.resetFromCharCode",(function(){ft=null}));var ht={zc:function(t,n){var r=dt(t);return n=null==n||n,r=e.btoa(r).replace(/\+/g,"-").replace(/\//g,"_"),n?r:r.replace(/=*$/,"")}};function pt(e){var t=this;this.B=e,this.u=new Set,this.h=this.l=null,this.S=!1,this.K=0,this.a=null,this.i=new Be,this.b=new Map,this.s=[],this.m=new ge,this.f=null,this.g=function(n){t.m.reject(n),e.onError(n)},this.pa=new Map,this.W=new Map,this.O=new fe((function(){return function(e){var t=e.pa,n=e.W;n.clear(),t.forEach((function(e,t){return n.set(t,e)})),(t=Array.from(n.values())).length&&t.every((function(e){return"expired"==e}))&&e.g(new me(2,6,6014)),e.B.qc($e(n))}(t)})),this.c=!1,this.na=new ge,this.D=!1,this.F=[],this.oa=!1,this.$=new fe((function(){!function(e){e.b.forEach((function(t,n){var r=t.hd,i=n.expiration;isNaN(i)&&(i=1/0),i!=r&&(e.B.onExpirationUpdated(n.sessionId,i),t.hd=i)}))}(t)})).Na(1),this.m.catch((function(){}))}function mt(e,t,n){return e.s=n,e.D=0<n.length,gt(e,t)}function gt(t,n){var r=function(t){if(0==(t=We(t.f.clearKeys)).size)return null;var n=[],r=[];t.forEach((function(e,t){var i=ht.Qc(t),a=ht.Qc(e);i={kty:"oct",kid:ht.zc(i,!1),k:ht.zc(a,!1)},n.push(i),r.push(i.kid)})),t=JSON.stringify({keys:n});var i=JSON.stringify({kids:r});return i=[{initData:new Uint8Array(ut(i)),initDataType:"keyids"}],{keySystem:"org.w3.clearkey",licenseServerUri:"data:application/json;base64,"+e.btoa(t),distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:i,keyIds:[]}}(t);if(r)for(var i=f(n),a=i.next();!a.done;a=i.next())a.value.drmInfos=[r];for((r=n.some((function(e){return 0<e.drmInfos.length})))||function(e,t){var n=[];t.forEach((function(e,t){n.push({keySystem:t,licenseServerUri:e,distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[]})}));for(var r=f(e),i=r.next();!i.done;i=r.next())i.value.drmInfos=n}(n,a=We(t.f.servers)),a=(i=f(n)).next();!a.done;a=i.next())for(var o=(a=f(a.value.drmInfos)).next();!o.done;o=a.next())jt(o.value,We(t.f.servers),We(t.f.advanced||{}));return(a=function(e,t){for(var n=new Set,r=f(t),i=r.next();!i.done;i=r.next()){var a=f(i.value.drmInfos);for(i=a.next();!i.done;i=a.next())n.add(i.value)}for(r=f(n),i=r.next();!i.done;i=r.next())jt(i.value,We(e.f.servers),We(e.f.advanced||{}));a=e.D?"required":"optional";var o=e.D?["persistent-license"]:["temporary"];for(r=new Map,n=f(n),i=n.next();!i.done;i=n.next())i=i.value,r.set(i.keySystem,{audioCapabilities:[],videoCapabilities:[],distinctiveIdentifier:"optional",persistentState:a,sessionTypes:o,label:i.keySystem,drmInfos:[]});for(n=f(t),i=n.next();!i.done;i=n.next()){i=i.value,a=i.audio,o=i.video;var s=a?qe(a.mimeType,a.codecs):"",l=o?qe(o.mimeType,o.codecs):"",u=f(i.drmInfos);for(i=u.next();!i.done;i=u.next()){i=i.value;var c=r.get(i.keySystem);c.drmInfos.push(i),i.distinctiveIdentifierRequired&&(c.distinctiveIdentifier="required"),i.persistentStateRequired&&(c.persistentState="required"),a&&c.audioCapabilities.push({robustness:i.audioRobustness||"",contentType:s}),o&&c.videoCapabilities.push({robustness:i.videoRobustness||"",contentType:l})}}return r}(t,n)).size?(a=Tt(t,a),r?a:a.catch((function(){}))):(t.S=!0,Promise.resolve())}function yt(e){return p((function t(){var n;return M(t,(function(t){switch(t.j){case 1:if(!(e.l&&e.a&&e.a.serverCertificate&&e.a.serverCertificate.length)){t.A(0);break}return k(t,3),w(t,e.l.setServerCertificate(e.a.serverCertificate),5);case 5:x(t,0);break;case 3:return n=R(t),t.return(Promise.reject(new me(2,6,6004,n.message)))}}))}))}function vt(e){var t=e.a?e.a.initData:[];return t.forEach((function(t){return St(e,t.initDataType,t.initData)})),e.s.forEach((function(t){return wt(e,t)})),t.length||e.s.length||e.m.resolve(),e.m}function bt(e,t,n){for(var r=e.b.values(),i=(r=f(r)).next();!i.done;i=r.next())if(ht.za(n,i.value.initData)&&!nt("Tizen 2"))return;St(e,t,n)}function _t(e){return e?e.keySystem:""}function At(e,t){return!!nt("Edge/")||e.u.has(t)}function Et(e){return e=Ye(e=e.b.keys(),(function(e){return e.sessionId})),Array.from(e)}function Tt(e,t){if(1==t.size&&t.has(""))return Promise.reject(new me(2,6,6e3));for(var n=f(t.values()),r=n.next();!r.done;r=n.next())0==(r=r.value).audioCapabilities.length&&delete r.audioCapabilities,0==r.videoCapabilities.length&&delete r.videoCapabilities;var i=n=new ge;return[!0,!1].forEach(function(e){var n=this;t.forEach((function(t,r){t.drmInfos.some((function(e){return!!e.licenseServerUri}))==e&&(i=i.catch(function(){if(!this.c)return navigator.requestMediaKeySystemAccess(r,[t])}.bind(n)))}))}.bind(e)),i=(i=i.catch((function(){return Promise.reject(new me(2,6,6001))}))).then(function(e){if(this.c)return Promise.reject();this.u.clear();var n=e.getConfiguration(),r=n.videoCapabilities||[],i=f(n.audioCapabilities||[]);for(n=i.next();!n.done;n=i.next())this.u.add(n.value.contentType);for(n=(r=f(r)).next();!n.done;n=r.next())this.u.add(n.value.contentType);r=e.keySystem,i=[];var a=[],o=[],s=[];return function(e,t,n,r,i){e.forEach((function(e){if(t.includes(e.licenseServerUri)||t.push(e.licenseServerUri),e.serverCertificate&&(n.some((function(t){return ht.za(t,e.serverCertificate)}))||n.push(e.serverCertificate)),e.initData&&e.initData.forEach((function(e){r.some((function(t){return!(!t.keyId||t.keyId!=e.keyId)||t.initDataType==e.initDataType&&ht.za(t.initData,e.initData)}))||r.push(e)})),e.keyIds)for(var a=0;a<e.keyIds.length;++a)i.includes(e.keyIds[a])||i.push(e.keyIds[a])}))}((n=t.get(e.keySystem)).drmInfos,i,a,o,s),this.a={keySystem:r,licenseServerUri:i[0],distinctiveIdentifierRequired:"required"==n.distinctiveIdentifier,persistentStateRequired:"required"==n.persistentState,audioRobustness:(n.audioCapabilities?n.audioCapabilities[0].robustness:"")||"",videoRobustness:(n.videoCapabilities?n.videoCapabilities[0].robustness:"")||"",serverCertificate:a[0],initData:o,keyIds:s},this.a.licenseServerUri?e.createMediaKeys():Promise.reject(new me(2,6,6012,this.a.keySystem))}.bind(e)).then(function(e){if(this.c)return Promise.reject();this.l=e,this.S=!0}.bind(e)).catch(function(e){if(!this.c)return this.a=null,this.u.clear(),e instanceof me?Promise.reject(e):Promise.reject(new me(2,6,6002,e.message))}.bind(e)),n.reject(),i}function wt(e,t){try{var n=e.l.createSession("persistent-license")}catch(t){var r=new me(2,6,6005,t.message);return e.g(r),Promise.reject(r)}e.i.w(n,"message",e.fe.bind(e)),e.i.w(n,"keystatuseschange",e.de.bind(e));var i={initData:null,loaded:!1,hd:1/0,ya:null};return e.b.set(n,i),n.load(t).then(function(e){return this.c?Promise.reject():e?(i.loaded=!0,Pt(this)&&this.m.resolve(),n):(this.b.delete(n),void this.g(new me(2,6,6013)))}.bind(e),function(e){this.c||(this.b.delete(n),this.g(new me(2,6,6005,e.message)))}.bind(e))}function St(e,t,n){try{var r=e.D?e.l.createSession("persistent-license"):e.l.createSession()}catch(t){return void e.g(new me(2,6,6005,t.message))}e.i.w(r,"message",e.fe.bind(e)),e.i.w(r,"keystatuseschange",e.de.bind(e)),e.b.set(r,{initData:n,loaded:!1,hd:1/0,ya:null});try{n=e.f.initDataTransform(n,e.a)}catch(n){return t=n,n instanceof me||(t=new me(2,6,6016,n)),void e.g(t)}r.generateRequest(t,n.buffer).catch((function(t){if(!e.c){if(e.b.delete(r),t.errorCode&&t.errorCode.systemCode){var n=t.errorCode.systemCode;0>n&&(n+=Math.pow(2,32)),n="0x"+n.toString(16)}e.g(new me(2,6,6006,t.message,t,n))}}))}function kt(e,t){if(_t(t).startsWith("com.apple.fps")){var n=t.serverCertificate;e=He(e,Ge(e),n)}return e}function Ct(e,t){var n=t.target,r=e.b.get(n),i=e.a.licenseServerUri,a=e.f.advanced[e.a.keySystem];"individualization-request"==t.messageType&&a&&a.individualizationServer&&(i=a.individualizationServer),(i=Me([i],e.f.retryParameters)).body=t.message,i.method="POST",i.licenseRequestType=t.messageType,i.sessionId=n.sessionId,"com.microsoft.playready"!=e.a.keySystem&&"com.chromecast.playready"!=e.a.keySystem||function(e){var t=st(e.body,!0,!0);if(t.includes("PlayReadyKeyMessage")){for(var n=(t=(new DOMParser).parseFromString(t,"application/xml")).getElementsByTagName("HttpHeader"),r=0;r<n.length;++r)e.headers[n[r].querySelector("name").textContent]=n[r].querySelector("value").textContent;e.body=ht.Ba(t.querySelector("Challenge").textContent).buffer}else e.headers["Content-Type"]="text/xml; charset=utf-8"}(i),e.a.keySystem.startsWith("com.apple.fps")&&e.f.fairPlayTransform&&function(e){var t=new Uint8Array(e.body);t="spc="+ht.zc(t),e.headers["Content-Type"]="application/x-www-form-urlencoded",e.body=ut(t)}(i);var o=Date.now();e.B.ub.request(2,i).promise.then(function(e){return this.c?Promise.reject():(this.a.keySystem.startsWith("com.apple.fps")&&this.f.fairPlayTransform&&function(e){try{var t=ot(e.data)}catch(e){return}"<ckc>"===(t=t.trim()).substr(0,5)&&"</ckc>"===t.substr(-6)&&(t=t.slice(5,-6));try{t=JSON.parse(t).ckc}catch(e){}e.data=ht.Ba(t).buffer}(e),this.K+=(Date.now()-o)/1e3,n.update(e.data).then(function(){var e=this;this.B.onEvent(new we("drmsessionupdate")),r&&(r.ya&&r.ya.resolve(),new fe((function(){r.loaded=!0,Pt(e)&&e.m.resolve()})).R(Ot))}.bind(this)))}.bind(e),function(e){this.c||(e=new me(2,6,6007,e),this.g(e),r&&r.ya&&r.ya.reject(e))}.bind(e)).catch(function(e){this.c||(e=new me(2,6,6008,e.message),this.g(e),r&&r.ya&&r.ya.reject(e))}.bind(e))}function xt(){var e=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],t=[{videoCapabilities:e,persistentState:"required",sessionTypes:["persistent-license"]},{videoCapabilities:e}],n=new Map;return e="org.w3.clearkey com.widevine.alpha com.microsoft.playready com.apple.fps.3_0 com.apple.fps.2_0 com.apple.fps.1_0 com.apple.fps com.adobe.primetime".split(" ").map((function(e){return function(e){return p((function r(){var i,a,o;return M(r,(function(r){switch(r.j){case 1:return k(r,2),w(r,navigator.requestMediaKeySystemAccess(e,t),4);case 4:return i=r.o,o=!!(a=i.getConfiguration().sessionTypes)&&a.includes("persistent-license"),nt("Tizen 3")&&(o=!1),n.set(e,{persistentState:o}),w(r,i.createMediaKeys(),5);case 5:x(r,0);break;case 2:R(r),n.set(e,null),S(r)}}))}))}(e)})),Promise.all(e).then((function(){return $e(n)}))}function Rt(e,t){var n=t.audio,r=t.video;if(n&&n.encrypted&&!At(e,qe(n.mimeType,n.codecs))||r&&r.encrypted&&!At(e,qe(r.mimeType,r.codecs)))return!1;var i=_t(e.a);return 0==t.drmInfos.length||t.drmInfos.some((function(e){return e.keySystem==i}))}function Lt(e,t){if(!e.length)return t;if(!t.length)return e;for(var n=[],r=0;r<e.length;r++)for(var i=0;i<t.length;i++)if(e[r].keySystem==t[i].keySystem){var a=e[r];i=t[i];var o=[];o=(o=o.concat(a.initData||[])).concat(i.initData||[]);var s=[];s=(s=s.concat(a.keyIds)).concat(i.keyIds),n.push({keySystem:a.keySystem,licenseServerUri:a.licenseServerUri||i.licenseServerUri,distinctiveIdentifierRequired:a.distinctiveIdentifierRequired||i.distinctiveIdentifierRequired,persistentStateRequired:a.persistentStateRequired||i.persistentStateRequired,videoRobustness:a.videoRobustness||i.videoRobustness,audioRobustness:a.audioRobustness||i.audioRobustness,serverCertificate:a.serverCertificate||i.serverCertificate,initData:o,keyIds:s});break}return n}function It(e){return p((function t(){var n;return M(t,(function(t){switch(t.j){case 1:return n=Array.from(e.b.keys()),e.b.clear(),w(t,Promise.all(n.map((function(e){return p((function t(){return M(t,(function(t){switch(t.j){case 1:return k(t,2),w(t,Promise.all([e.close(),e.closed]),4);case 4:x(t,0);break;case 2:R(t),S(t)}}))}))}))),0)}}))}))}function Pt(e){return ze(e=e.b.values(),(function(e){return e.loaded}))}function jt(t,n,r){!t.keySystem||"org.w3.clearkey"==t.keySystem&&t.licenseServerUri||(n.size&&(n=n.get(t.keySystem)||"",t.licenseServerUri=n),t.keyIds||(t.keyIds=[]),(r=r.get(t.keySystem))&&(t.distinctiveIdentifierRequired||(t.distinctiveIdentifierRequired=r.distinctiveIdentifierRequired),t.persistentStateRequired||(t.persistentStateRequired=r.persistentStateRequired),t.videoRobustness||(t.videoRobustness=r.videoRobustness),t.audioRobustness||(t.audioRobustness=r.audioRobustness),t.serverCertificate||(t.serverCertificate=r.serverCertificate)),e.cast&&e.cast.__platform__&&"com.microsoft.playready"==t.keySystem&&(t.keySystem="com.chromecast.playready"))}V("shaka.util.Uint8ArrayUtils.toBase64",ht.zc),ht.Ba=function(t){t=e.atob(t.replace(/-/g,"+").replace(/_/g,"/"));for(var n=new Uint8Array(t.length),r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n},V("shaka.util.Uint8ArrayUtils.fromBase64",ht.Ba),ht.Qc=function(t){for(var n=new Uint8Array(t.length/2),r=0;r<t.length;r+=2)n[r/2]=e.parseInt(t.substr(r,2),16);return n},V("shaka.util.Uint8ArrayUtils.fromHex",ht.Qc),ht.Ac=function(e){for(var t="",n=0;n<e.length;++n){var r=e[n].toString(16);1==r.length&&(r="0"+r),t+=r}return t},V("shaka.util.Uint8ArrayUtils.toHex",ht.Ac),ht.za=function(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!=t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!=t[n])return!1;return!0},V("shaka.util.Uint8ArrayUtils.equal",ht.za),ht.concat=function(e){for(var t=[],n=0;n<arguments.length;++n)t[n]=arguments[n];for(var r=n=0;r<t.length;++r)n+=t[r].length;n=new Uint8Array(n);for(var i=r=0;i<t.length;++i)n.set(t[i],r),r+=t[i].length;return n},V("shaka.util.Uint8ArrayUtils.concat",ht.concat),(r=pt.prototype).destroy=function(){var e=this;return p((function t(){return M(t,(function(t){switch(t.j){case 1:return e.c?w(t,e.na,0):(e.c=!0,w(t,function(e){return p((function t(){return M(t,(function(t){switch(t.j){case 1:return e.i.release(),e.i=null,e.m.reject(),e.$.stop(),e.$=null,e.O.stop(),e.O=null,w(t,It(e),2);case 2:if(!e.h){t.A(3);break}return k(t,4),w(t,e.h.setMediaKeys(null),6);case 6:x(t,5);break;case 4:R(t);case 5:e.h=null;case 3:e.a=null,e.u.clear(),e.l=null,e.s=[],e.f=null,e.g=null,e.B=null,S(t)}}))}))}(e),4));case 4:e.na.resolve(),t.A(0)}}))}))},r.configure=function(e){this.f=e},r.Hb=function(e){var t=this;if(!this.l)return this.i.da(e,"encrypted",(function(){t.g(new me(2,6,6010))})),Promise.resolve();this.h=e,this.i.da(this.h,"play",(function(){for(var e=0;e<t.F.length;e++)Ct(t,t.F[e]);t.oa=!0,t.F=[]})),"webkitCurrentPlaybackTargetIsWireless"in this.h&&this.i.w(this.h,"webkitcurrentplaybacktargetiswirelesschanged",(function(){return It(t)})),e=(e=this.h.setMediaKeys(this.l)).catch((function(e){return Promise.reject(new me(2,6,6003,e.message))}));var n=yt(this);return Promise.all([e,n]).then((function(){if(t.c)return Promise.reject();vt(t),t.a.initData.length||t.s.length||t.i.w(t.h,"encrypted",(function(e){return bt(t,e.initDataType,new Uint8Array(e.initData))}))})).catch((function(e){if(!t.c)return Promise.reject(e)}))},r.Lb=function(){for(var e=1/0,t=this.b.keys(),n=(t=f(t)).next();!n.done;n=t.next())n=n.value,isNaN(n.expiration)||(e=Math.min(e,n.expiration));return e},r.fe=function(e){this.h&&this.f.delayLicenseRequestUntilPlayed&&this.h.paused&&!this.oa?this.F.push(e):Ct(this,e)},r.de=function(e){e=e.target;var t=this.b.get(e),n=!1;e.keyStatuses.forEach(function(e,r){if("string"==typeof r){var i=r;r=e,e=i}if("com.microsoft.playready"==this.a.keySystem&&16==r.byteLength&&!nt("Tizen")&&!nt("VITIS")){var a=(i=new DataView(r)).getUint32(0,!0),o=i.getUint16(4,!0),s=i.getUint16(6,!0);i.setUint32(0,a,!1),i.setUint16(4,o,!1),i.setUint16(6,s,!1)}"com.microsoft.playready"==this.a.keySystem&&"status-pending"==e&&(e="usable"),"status-pending"!=e&&(t.loaded=!0),"expired"==e&&(n=!0),i=ht.Ac(new Uint8Array(r)),this.pa.set(i,e)}.bind(this));var r=e.expiration-Date.now();(0>r||n&&1e3>r)&&t&&!t.ya&&(this.b.delete(e),e.close().catch((function(){}))),Pt(this)&&(this.m.resolve(),this.O.R(Dt))};var Ot=5,Dt=.5;function Mt(){this.a=new muxjs.mp4.CaptionParser,this.g=[],this.f={}}function Nt(){}function Ut(e){return!e||1==e.length&&1e-6>e.end(0)-e.start(0)?null:e.length?e.end(e.length-1):null}function Ft(e,t,n){return n=void 0===n?0:n,!(!e||!e.length||1==e.length&&1e-6>e.end(0)-e.start(0)||t>e.end(e.length-1))&&t+n>=e.start(0)}function Bt(e,t){if(!e||!e.length||1==e.length&&1e-6>e.end(0)-e.start(0))return 0;for(var n=0,r=e.length-1;0<=r&&e.end(r)>t;--r)n+=e.end(r)-Math.max(e.start(r),t);return n}function Kt(e){if(!e)return[];for(var t=[],n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}Mt.prototype.init=function(e){var t=muxjs.mp4.probe;e=new Uint8Array(e),this.g=t.videoTrackIds(e),this.f=t.timescale(e),this.a.init()},Mt.prototype.b=function(e,t){var n=new Uint8Array(e);(n=this.a.parse(n,this.g,this.f))&&n.captions&&t(n.captions),this.a.clearParsedCaptions()},Mt.prototype.c=function(){this.a.resetCaptionStream()},Nt.prototype.init=function(){},Nt.prototype.b=function(){},Nt.prototype.c=function(){};var Vt={Ke:function(e,t){return e.reduce(function(e,t,n){return t.catch(e.bind(null,n))}.bind(null,t),Promise.reject())},Gc:function(e,t){return e.concat(t)},oc:function(){},Ia:function(e){return null!=e}};function Gt(e,t){if(0==t.length)return e;var n=t.map((function(e){return new Q(e)}));return e.map((function(e){return new Q(e)})).map((function(e){return n.map(e.resolve.bind(e))})).reduce(Vt.Gc,[]).map((function(e){return e.toString()}))}function Ht(e,t){return{keySystem:e,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:t||[],keyIds:[]}}var Yt={Pa:"video",Eb:"audio",ra:"text",Cg:"image",Ag:"application"};function zt(){this.a=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0}),this.b=null,this.g=[],this.c=[],this.f=!1,this.a.on("data",this.i.bind(this)),this.a.on("done",this.h.bind(this))}function Wt(t,n){return!(!e.muxjs||"mp2t"!=t.toLowerCase().split(";")[0].split("/")[1])&&(n?MediaSource.isTypeSupported($t(n,t)):MediaSource.isTypeSupported($t("audio",t))||MediaSource.isTypeSupported($t("video",t)))}function $t(e,t){var n=t.replace(/mp2t/i,"mp4");"audio"==e&&(n=n.replace("video","audio"));var r=/avc1\.(66|77|100)\.(\d+)/.exec(n);if(r){var i="avc1.",a=r[1],o=Number(r[2]);i=("66"==a?i+"4200":"77"==a?i+"4d00":i+"6400")+(o>>4).toString(16),i+=(15&o).toString(16),n=n.replace(r[0],i)}return n}function qt(e,t,n){this.startTime=e,this.direction=tn,this.endTime=t,this.payload=n,this.region=new cn,this.position=null,this.positionAlign=Xt,this.size=100,this.textAlign=Jt,this.writingMode=nn,this.lineInterpretation=rn,this.line=null,this.lineHeight="",this.lineAlign=an,this.displayAlign=Zt,this.fontSize=this.backgroundImage=this.backgroundColor=this.color="",this.fontWeight=sn,this.fontStyle=ln,this.fontFamily="",this.textDecoration=[],this.wrapLine=!0,this.id="",this.nestedCues=[],this.spacer=!1}zt.prototype.destroy=function(){return this.a.dispose(),this.a=null,Promise.resolve()},zt.prototype.i=function(e){this.c=e.captions;var t=new Uint8Array(e.data.byteLength+e.initSegment.byteLength);t.set(e.initSegment,0),t.set(e.data,e.initSegment.byteLength),this.g.push(t)},zt.prototype.h=function(){var e={data:ht.concat.apply(null,this.g),captions:this.c};this.b.resolve(e),this.f=!1},V("shaka.text.Cue",qt);var Xt="auto";qt.positionAlign={LEFT:"line-left",RIGHT:"line-right",CENTER:"center",AUTO:Xt};var Jt="center",Qt={LEFT:"left",RIGHT:"right",CENTER:Jt,START:"start",END:"end"};qt.textAlign=Qt;var Zt="after",en={BEFORE:"before",CENTER:"center",AFTER:Zt};qt.displayAlign=en;var tn="ltr";qt.direction={HORIZONTAL_LEFT_TO_RIGHT:tn,HORIZONTAL_RIGHT_TO_LEFT:"rtl"};var nn="horizontal-tb";qt.writingMode={HORIZONTAL_TOP_TO_BOTTOM:nn,VERTICAL_LEFT_TO_RIGHT:"vertical-lr",VERTICAL_RIGHT_TO_LEFT:"vertical-rl"};var rn=0;qt.lineInterpretation={LINE_NUMBER:rn,PERCENTAGE:1};var an="start",on={CENTER:"center",START:an,END:"end"};qt.lineAlign=on;var sn=400;qt.fontWeight={NORMAL:sn,BOLD:700};var ln="normal",un={NORMAL:ln,ITALIC:"italic",OBLIQUE:"oblique"};function cn(){this.id="",this.regionAnchorY=this.regionAnchorX=this.viewportAnchorY=this.viewportAnchorX=0,this.height=this.width=100,this.viewportAnchorUnits=this.widthUnits=this.heightUnits=dn,this.scroll=fn}qt.fontStyle=un,qt.textDecoration={UNDERLINE:"underline",LINE_THROUGH:"lineThrough",OVERLINE:"overline"},V("shaka.text.CueRegion",cn);var dn=1;cn.units={PX:0,PERCENTAGE:dn,LINES:2};var fn="";function hn(e){this.g=null,this.c=e,this.f=this.m=0,this.h=1/0,this.b=this.a=null,this.l="",this.i=new Map}cn.scrollMode={NONE:fn,UP:"up"};var pn={};function mn(t){return!!(pn[t]||e.muxjs&&"application/cea-608"==t)}function gn(e,t){"application/cea-608"!=t&&(e.g=new pn[t])}function yn(e,t,n,r,i){for(var a=n+" "+r,o=new Map,s=(t=f(t)).next();!s.done;s=t.next()){var l=s.value;s=l.stream,o.has(s)||o.set(s,new Map),o.get(s).has(a)||o.get(s).set(a,[]),l.startTime+=i,l.endTime+=i,l.startTime>=e.f&&l.startTime<e.h&&(l=new qt(l.startTime,l.endTime,l.text),o.get(s).get(a).push(l),s==e.l&&e.c.append([l]))}for(a=(i=f(o.keys())).next();!a.done;a=i.next())for(a=a.value,e.i.has(a)||e.i.set(a,new Map),s=(t=f(o.get(a).keys())).next();!s.done;s=t.next())s=s.value,l=o.get(a).get(s),e.i.get(a).set(s,l);e.a=null==e.a?Math.max(n,e.f):Math.min(e.a,Math.max(n,e.f)),e.b=Math.max(e.b,Math.min(r,e.h))}function vn(e,t,n){this.f=e,this.g=n,this.b={},this.a=null,this.c={},this.i=new Be,this.u=!1,this.l={},this.m=t,e=this.s=new ge,t=new MediaSource,this.i.da(t,"sourceopen",e.resolve),this.f.src=bn(t),this.h=t}V("shaka.text.TextEngine.registerParser",(function(e,t){pn[e]=t})),V("shaka.text.TextEngine.unregisterParser",(function(e){delete pn[e]})),hn.prototype.destroy=function(){return this.c=this.g=null,this.i.clear(),Promise.resolve()},hn.prototype.kc=function(e){try{return this.g.parseMedia(new Uint8Array(e),{periodStart:0,segmentStart:null,segmentEnd:0})[0].startTime}catch(e){throw new me(2,2,2009,e)}},hn.prototype.remove=function(e,t){return Promise.resolve().then(function(){!this.c||!this.c.remove(e,t)||null==this.a||t<=this.a||e>=this.b||(e<=this.a&&t>=this.b?this.a=this.b=null:e<=this.a&&t<this.b?this.a=t:e>this.a&&t>=this.b&&(this.b=e))}.bind(this))};var bn=e.URL.createObjectURL;function _n(e){var t=qe(e.mimeType,e.codecs),n=function(e){var t=[e.mimeType];return Je.forEach((function(n,r){var i=e[r];i&&t.push(n+'="'+i+'"')})),t.join(";")}(e);return mn(t)||MediaSource.isTypeSupported(n)||Wt(t,e.type)}function An(e,t){e.a||(e.a=new hn(e.g)),gn(e.a,t)}function En(e){return!e.h||"ended"==e.h.readyState}function Tn(e,t){if("text"==t)var n=e.a.a;else n=!(n=Sn(e,t))||1==n.length&&1e-6>n.end(0)-n.start(0)?null:1==n.length&&0>n.start(0)?0:n.length?n.start(0):null;return n}function wn(e,t){return"text"==t?e.a.b:Ut(Sn(e,t))}function Sn(e,t){try{return e.b[t].buffered}catch(e){return null}}function kn(t,n,r,i,a,o){return"text"==n?function(e,t,n,r){return Promise.resolve().then(function(){if(this.g&&this.c)if(null==n||null==r)this.g.parseInit(new Uint8Array(t));else{var e={periodStart:this.m,segmentStart:n,segmentEnd:r};e=this.g.parseMedia(new Uint8Array(t),e).filter(function(e){return e.startTime>=this.f&&e.startTime<this.h}.bind(this)),this.c.append(e),null==this.a&&(this.a=Math.max(n,this.f)),this.b=Math.min(r,this.h)}}.bind(e))}(t.a,r,i,a):t.l[n]?function(e,t){e.f=!0,e.b=new ge,e.g=[],e.c=[];var n=new Uint8Array(t);return e.a.push(n),e.a.flush(),e.f&&e.b.reject(new me(2,3,3018)),e.b}(t.l[n],r).then(function(e){return this.a||An(this,"text/vtt"),e.captions&&e.captions.length&&yn(this.a,e.captions,i,a,this.b.video.timestampOffset),Rn(this,n,this.re.bind(this,n,e.data.buffer))}.bind(t)):(o&&e.muxjs&&(t.a||An(t,"text/vtt"),null==i&&null==a?t.m.init(r):t.m.b(r,(function(e){e.length&&yn(t.a,e,i,a,t.b.video.timestampOffset)}))),Rn(t,n,t.re.bind(t,n,r)))}function Cn(e,t){var n=wn(e,"video")||0;!function(e,t,n){if(e.l=t,t=e.i.get(t))for(var r=f(t.keys()),i=r.next();!i.done;i=r.next())(i=t.get(i.value).filter((function(e){return e.endTime<=n})))&&e.c.append(i)}(e.a,t,n)}function xn(e,t){return"text"==t?e.a?(e.m.c(),e.a.remove(0,1/0)):Promise.resolve():Rn(e,t,e.se.bind(e,t,0,e.h.duration))}function Rn(e,t,n){if(e.u)return Promise.reject();if(n={start:n,p:new ge},e.c[t].push(n),1==e.c[t].length)try{n.start()}catch(r){"QuotaExceededError"==r.name?n.p.reject(new me(2,3,3017,t)):n.p.reject(new me(2,3,3015,r)),In(e,t)}return n.p}function Ln(e,t){if(e.u)return Promise.reject();var n,r=[];for(n in e.b){var i=new ge,a={start:function(e){e.resolve()}.bind(null,i),p:i};e.c[n].push(a),r.push(i),1==e.c[n].length&&a.start()}return Promise.all(r).then(function(){try{t()}catch(t){var e=Promise.reject(new me(2,3,3015,t))}for(var n in this.b)In(this,n);return e}.bind(e),function(e){throw e}.bind(e))}function In(e,t){e.c[t].shift();var n=e.c[t][0];if(n)try{n.start()}catch(r){n.p.reject(new me(2,3,3015,r)),In(e,t)}}function Pn(e,t){return e=On(e),t=On(t),e.split("-")[0]==t.split("-")[0]}function jn(e,t){e=On(e),t=On(t);var n=e.split("-"),r=t.split("-");return n[0]==r[0]&&1==n.length&&2==r.length}function On(e){var t=e.split("-");return e=t[0]||"",t=t[1]||"",e=e.toLowerCase(),e=Nn.get(e)||e,(t=t.toUpperCase())?e+"-"+t:e}function Dn(e){return e.language?On(e.language):e.audio&&e.audio.language?On(e.audio.language):e.video&&e.video.language?On(e.video.language):"und"}function Mn(e,t){for(var n=On(e),r=new Set,i=f(t),a=i.next();!a.done;a=i.next())r.add(On(a.value));for(a=(i=f(r)).next();!a.done;a=i.next())if((a=a.value)==n)return a;for(a=(i=f(r)).next();!a.done;a=i.next())if(jn(a=a.value,n))return a;for(a=(i=f(r)).next();!a.done;a=i.next()){var o=a=a.value,s=n;if(o=On(o),s=On(s),o=o.split("-"),s=s.split("-"),2==o.length&&2==s.length&&o[0]==s[0])return a}for(a=(r=f(r)).next();!a.done;a=r.next())if(jn(n,i=a.value))return i;return null}(r=vn.prototype).destroy=function(){var e=this;this.u=!0;var t,n=[];for(t in this.c){var r=this.c[t],i=r[0];for(this.c[t]=r.slice(0,1),i&&n.push(i.p.catch(Vt.oc)),i=1;i<r.length;++i)r[i].p.reject()}for(var a in this.a&&n.push(this.a.destroy()),this.g&&n.push(this.g.destroy()),this.l)n.push(this.l[a].destroy());return Promise.all(n).then((function(){e.i&&(e.i.release(),e.i=null),e.f&&(e.f.removeAttribute("src"),e.f.load(),e.f=null),e.h=null,e.a=null,e.g=null,e.b={},e.l={},e.m=null,e.c={}}))},r.init=function(e,t){var n=this;return p((function r(){var i;return M(r,(function(r){switch(r.j){case 1:return i=Yt,w(r,n.s,2);case 2:e.forEach((function(e,r){var a=qe(e.mimeType,e.codecs);r==i.ra?An(n,a):(!t&&MediaSource.isTypeSupported(a)||!Wt(a,r)||(n.l[r]=new zt,a=$t(r,a)),a=n.h.addSourceBuffer(a),n.i.w(a,"error",n.lg.bind(n,r)),n.i.w(a,"updateend",n.xb.bind(n,r)),n.b[r]=a,n.c[r]=[])})),S(r)}}))}))},r.Sc=function(e){if(e.total=Kt(this.f.buffered),e.audio=Kt(Sn(this,"audio")),e.video=Kt(Sn(this,"video")),e.text=[],this.a){var t=this.a.a,n=this.a.b;null!=t&&null!=n&&e.text.push({start:t,end:n})}},r.remove=function(e,t,n){return"text"==e?this.a.remove(t,n):Rn(this,e,this.se.bind(this,e,t,n))},r.flush=function(e){return"text"==e?Promise.resolve():Rn(this,e,this.Pe.bind(this,e))},r.endOfStream=function(e){return Ln(this,function(){En(this)||(e?this.h.endOfStream(e):this.h.endOfStream())}.bind(this))},r.xa=function(e){return Ln(this,function(){this.h.duration=e}.bind(this))},r.Y=function(){return this.h.duration},r.re=function(e,t){this.b[e].appendBuffer(t)},r.se=function(e,t,n){n<=t?this.xb(e):this.b[e].remove(t,n)},r.Be=function(e){var t=this.b[e].appendWindowStart,n=this.b[e].appendWindowEnd;this.b[e].abort(),this.b[e].appendWindowStart=t,this.b[e].appendWindowEnd=n,this.xb(e)},r.Pe=function(e){this.f.currentTime-=.001,this.xb(e)},r.kg=function(e,t){0>t&&(t+=.001),this.b[e].timestampOffset=t,this.xb(e)},r.hg=function(e,t,n){this.b[e].appendWindowStart=0,this.b[e].appendWindowEnd=n,this.b[e].appendWindowStart=t,this.xb(e)},r.lg=function(e){this.c[e][0].p.reject(new me(2,3,3014,this.f.error?this.f.error.code:0))},r.xb=function(e){var t=this.c[e][0];t&&(t.p.resolve(),In(this,e))};var Nn=new Map([["aar","aa"],["abk","ab"],["afr","af"],["aka","ak"],["alb","sq"],["amh","am"],["ara","ar"],["arg","an"],["arm","hy"],["asm","as"],["ava","av"],["ave","ae"],["aym","ay"],["aze","az"],["bak","ba"],["bam","bm"],["baq","eu"],["bel","be"],["ben","bn"],["bih","bh"],["bis","bi"],["bod","bo"],["bos","bs"],["bre","br"],["bul","bg"],["bur","my"],["cat","ca"],["ces","cs"],["cha","ch"],["che","ce"],["chi","zh"],["chu","cu"],["chv","cv"],["cor","kw"],["cos","co"],["cre","cr"],["cym","cy"],["cze","cs"],["dan","da"],["deu","de"],["div","dv"],["dut","nl"],["dzo","dz"],["ell","el"],["eng","en"],["epo","eo"],["est","et"],["eus","eu"],["ewe","ee"],["fao","fo"],["fas","fa"],["fij","fj"],["fin","fi"],["fra","fr"],["fre","fr"],["fry","fy"],["ful","ff"],["geo","ka"],["ger","de"],["gla","gd"],["gle","ga"],["glg","gl"],["glv","gv"],["gre","el"],["grn","gn"],["guj","gu"],["hat","ht"],["hau","ha"],["heb","he"],["her","hz"],["hin","hi"],["hmo","ho"],["hrv","hr"],["hun","hu"],["hye","hy"],["ibo","ig"],["ice","is"],["ido","io"],["iii","ii"],["iku","iu"],["ile","ie"],["ina","ia"],["ind","id"],["ipk","ik"],["isl","is"],["ita","it"],["jav","jv"],["jpn","ja"],["kal","kl"],["kan","kn"],["kas","ks"],["kat","ka"],["kau","kr"],["kaz","kk"],["khm","km"],["kik","ki"],["kin","rw"],["kir","ky"],["kom","kv"],["kon","kg"],["kor","ko"],["kua","kj"],["kur","ku"],["lao","lo"],["lat","la"],["lav","lv"],["lim","li"],["lin","ln"],["lit","lt"],["ltz","lb"],["lub","lu"],["lug","lg"],["mac","mk"],["mah","mh"],["mal","ml"],["mao","mi"],["mar","mr"],["may","ms"],["mkd","mk"],["mlg","mg"],["mlt","mt"],["mon","mn"],["mri","mi"],["msa","ms"],["mya","my"],["nau","na"],["nav","nv"],["nbl","nr"],["nde","nd"],["ndo","ng"],["nep","ne"],["nld","nl"],["nno","nn"],["nob","nb"],["nor","no"],["nya","ny"],["oci","oc"],["oji","oj"],["ori","or"],["orm","om"],["oss","os"],["pan","pa"],["per","fa"],["pli","pi"],["pol","pl"],["por","pt"],["pus","ps"],["que","qu"],["roh","rm"],["ron","ro"],["rum","ro"],["run","rn"],["rus","ru"],["sag","sg"],["san","sa"],["sin","si"],["slk","sk"],["slo","sk"],["slv","sl"],["sme","se"],["smo","sm"],["sna","sn"],["snd","sd"],["som","so"],["sot","st"],["spa","es"],["sqi","sq"],["srd","sc"],["srp","sr"],["ssw","ss"],["sun","su"],["swa","sw"],["swe","sv"],["tah","ty"],["tam","ta"],["tat","tt"],["tel","te"],["tgk","tg"],["tgl","tl"],["tha","th"],["tib","bo"],["tir","ti"],["ton","to"],["tsn","tn"],["tso","ts"],["tuk","tk"],["tur","tr"],["twi","tw"],["uig","ug"],["ukr","uk"],["urd","ur"],["uzb","uz"],["ven","ve"],["vie","vi"],["vol","vo"],["wel","cy"],["wln","wa"],["wol","wo"],["xho","xh"],["yid","yi"],["yor","yo"],["zha","za"],["zho","zh"],["zul","zu"]]),Un={bd:function(e,t,n){function r(e,t,n){return e>=t&&e<=n}var i=e.video;return!(i&&i.width&&i.height&&(!r(i.width,t.minWidth,Math.min(t.maxWidth,n.width))||!r(i.height,t.minHeight,Math.min(t.maxHeight,n.height))||!r(i.width*i.height,t.minPixels,t.maxPixels))||e&&e.frameRate&&!r(e.frameRate,t.minFrameRate,t.maxFrameRate)||!r(e.bandwidth,t.minBandwidth,t.maxBandwidth))},Gd:function(e,t,n){var r=!1;return e.forEach((function(e){var i=e.allowedByApplication;e.allowedByApplication=Un.bd(e,t,n),i!=e.allowedByApplication&&(r=!0)})),r},filterNewPeriod:function(e,t,n,r){r.variants=r.variants.filter((function(r){if(e&&e.S&&!Rt(e,r))return!1;var i=r.audio;return r=r.video,!(i&&!_n(i)||r&&!_n(r)||i&&t&&!Un.Hd(i,t)||r&&n&&!Un.Hd(r,n))})),r.textStreams=r.textStreams.filter((function(e){return mn(qe(e.mimeType,e.codecs))}))},Hd:function(e,t){return e.mimeType==t.mimeType&&e.codecs.split(".")[0]==t.codecs.split(".")[0]},Ed:function(e){var t=e.audio,n=e.video,r=t?t.codecs:null,i=n?n.codecs:null,a=[];i&&a.push(i),r&&a.push(r);var o=[];n&&o.push(n.mimeType),t&&o.push(t.mimeType),o=o[0]||null;var s=[];t&&s.push(t.kind),n&&s.push(n.kind),s=s[0]||null;var l=new Set;return t&&t.roles.forEach((function(e){return l.add(e)})),n&&n.roles.forEach((function(e){return l.add(e)})),e={id:e.id,active:!1,type:"variant",bandwidth:e.bandwidth,language:e.language,label:null,kind:s,width:null,height:null,frameRate:null,pixelAspectRatio:null,mimeType:o,codecs:a.join(", "),audioCodec:r,videoCodec:i,primary:e.primary,roles:Array.from(l),audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null},n&&(e.videoId=n.id,e.originalVideoId=n.originalId,e.width=n.width||null,e.height=n.height||null,e.frameRate=n.frameRate||null,e.pixelAspectRatio=n.pixelAspectRatio||null,e.videoBandwidth=n.bandwidth||null),t&&(e.audioId=t.id,e.originalAudioId=t.originalId,e.channelsCount=t.channelsCount,e.audioSamplingRate=t.audioSamplingRate,e.audioBandwidth=t.bandwidth||null,e.label=t.label,e.audioRoles=t.roles),e},xc:function(e){return{id:e.id,active:!1,type:"text",bandwidth:0,language:e.language,label:e.label,kind:e.kind||null,width:null,height:null,frameRate:null,pixelAspectRatio:null,mimeType:e.mimeType,codecs:e.codecs||null,audioCodec:null,videoCodec:null,primary:e.primary,roles:e.roles,audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:e.originalId}},Wc:function(e){return e.__shaka_id||(e.__shaka_id=Un.yf++),e.__shaka_id},yf:0,sf:function(e){var t=Un.Sd(e);return t.active="disabled"!=e.mode,t.type="text",t.originalTextId=e.id,"captions"==e.kind&&(t.mimeType="application/cea-608"),t},rf:function(e){var t=Un.Sd(e);return t.active=e.enabled,t.type="variant",t.originalAudioId=e.id,"main"==e.kind?(t.primary=!0,t.roles=["main"],t.audioRoles=["main"]):t.audioRoles=[],t},Sd:function(e){return{id:Un.Wc(e),active:!1,type:"",bandwidth:0,language:On(e.language),label:e.label,kind:e.kind,width:null,height:null,frameRate:null,pixelAspectRatio:null,mimeType:null,codecs:null,audioCodec:null,videoCodec:null,primary:!1,roles:[],audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null}},rb:function(e){return e.allowedByApplication&&e.allowedByKeySystem},df:function(e){return e.filter((function(e){return Un.rb(e)}))},Nd:function(e,t){for(var n=e.filter((function(e){return e.audio&&e.audio.channelsCount})),r=new Map,i=(n=f(n)).next();!i.done;i=n.next()){var a=(i=i.value).audio.channelsCount;r.has(a)||r.set(a,[]),r.get(a).push(i)}return 0==(n=Array.from(r.keys())).length?e:(i=n.filter((function(e){return e<=t}))).length?r.get(Math.max.apply(null,i)):r.get(Math.min.apply(null,n))},Jb:function(e,t,n){var r=e,i=e.filter((function(e){return e.primary}));i.length&&(r=i);var a=r.length?r[0].language:"";if(r=r.filter((function(e){return e.language==a})),t){var o=Mn(On(t),e.map((function(e){return e.language})));o&&(r=e.filter((function(e){return On(e.language)==o})))}if(n){if((e=Un.Md(r,n)).length)return e}else if((e=r.filter((function(e){return 0==e.roles.length}))).length)return e;return(e=r.map((function(e){return e.roles})).reduce(Vt.Gc,[])).length?Un.Md(r,e[0]):r},Md:function(e,t){return e.filter((function(e){return e.roles.includes(t)}))},Qd:function(e,t,n){for(var r=0;r<n.length;r++)if(n[r].audio==e&&n[r].video==t)return n[r];return null},tf:function(e){return"audio"==e.type},wf:function(e){return"video"==e.type},nf:function(e){var t=[];return e.audio&&t.push(e.audio),e.video&&t.push(e.video),t},Gg:function(e){return Un.tf(e)?"type=audio codecs="+e.codecs+" bandwidth="+e.bandwidth+" channelsCount="+e.channelsCount+" audioSamplingRate="+e.audioSamplingRate:Un.wf(e)?"type=video codecs="+e.codecs+" bandwidth="+e.bandwidth+" frameRate="+e.frameRate+" width="+e.width+" height="+e.height:"unexpected stream type"}};function Fn(){this.h=null,this.f=!1,this.b=new W,this.c=[],this.i=!1,this.a=this.g=null}function Bn(e,t){return e&&(t=t.filter((function(t){return Un.bd(t,e,{width:1/0,height:1/0})}))),t.sort((function(e,t){return e.bandwidth-t.bandwidth}))}function Kn(e,t){this.a=e,this.b=t}function Vn(e,t){var n=new Kn(2,6),r=Yn,i=r.a,a=n.b-i.b;(0<(n.a-i.a||a)?r.c:r.b)(r.a,n,e,t)}function Gn(e,t,n,r){q([n,"has been deprecated and will be removed in",t,". We are currently at version",e,". Additional information:",r].join(" "))}function Hn(e,t,n,r){$([n,"has been deprecated and has been removed in",t,". We are now at version",e,". Additional information:",r].join(""))}V("shaka.abr.SimpleAbrManager",Fn),Fn.prototype.stop=function(){this.h=null,this.f=!1,this.c=[],this.g=null},Fn.prototype.stop=Fn.prototype.stop,Fn.prototype.init=function(e){this.h=e},Fn.prototype.init=Fn.prototype.init,Fn.prototype.chooseVariant=function(){var e=Bn(this.a.restrictions,this.c),t=this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate);this.c.length&&!e.length&&(e=[(e=Bn(null,this.c))[0]]);for(var n=e[0]||null,r=0;r<e.length;++r){var i=e[r],a=(e[r+1]||{bandwidth:1/0}).bandwidth/this.a.bandwidthUpgradeTarget;t>=i.bandwidth/this.a.bandwidthDowngradeTarget&&t<=a&&(n=i)}return this.g=Date.now(),n},Fn.prototype.chooseVariant=Fn.prototype.chooseVariant,Fn.prototype.enable=function(){this.f=!0},Fn.prototype.enable=Fn.prototype.enable,Fn.prototype.disable=function(){this.f=!1},Fn.prototype.disable=Fn.prototype.disable,Fn.prototype.segmentDownloaded=function(e,t){var n=this.b;if(!(16e3>t)){var r=8e3*t/e,i=e/1e3;n.a+=t,Y(n.b,i,r),Y(n.c,i,r)}if(null!=this.g&&this.f)e:{if(this.i){if(Date.now()-this.g<1e3*this.a.switchInterval)break e}else{if(!(128e3<=this.b.a))break e;this.i=!0}n=this.chooseVariant(),this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate),this.h(n)}},Fn.prototype.segmentDownloaded=Fn.prototype.segmentDownloaded,Fn.prototype.getBandwidthEstimate=function(){return this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate)},Fn.prototype.getBandwidthEstimate=Fn.prototype.getBandwidthEstimate,Fn.prototype.setVariants=function(e){this.c=e},Fn.prototype.setVariants=Fn.prototype.setVariants,Fn.prototype.configure=function(e){this.a=e},Fn.prototype.configure=Fn.prototype.configure,Kn.prototype.toString=function(){return"v"+this.a+"."+this.b};var Yn=null,zn="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),Wn="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),$n=["loop","playbackRate"],qn=["pause","play"],Xn="abrstatuschanged adaptation buffering drmsessionupdate emsg error expirationupdated largegap loading manifestparsed onstatechange onstateidle streaming textchanged texttrackvisibility timelineregionadded timelineregionenter timelineregionexit trackschanged unloading variantchanged".split(" "),Jn={getAssetUri:2,getAudioLanguages:2,getAudioLanguagesAndRoles:2,getBufferedInfo:2,getConfiguration:2,getExpiration:2,getPlaybackRate:2,getTextLanguages:2,getTextLanguagesAndRoles:2,getTextTracks:2,getStats:5,getVariantTracks:2,isAudioOnly:10,isBuffering:1,isInProgress:1,isLive:10,isTextTrackVisible:1,keySystem:10,seekRange:1,usingEmbeddedTextTrack:2,getLoadMode:10},Qn={getPlayheadTimeAsDate:1,getPresentationStartTimeAsDate:20},Zn=[["getConfiguration","configure"]],er=[["isTextTrackVisible","setTextTrackVisibility"]],tr="addTextTrack cancelTrickPlay configure resetConfiguration retryStreaming selectAudioLanguage selectEmbeddedTextTrack selectTextLanguage selectTextTrack selectVariantTrack selectVariantsByLabel setTextTrackVisibility trickPlay".split(" "),nr=["attach","detach","load","unload"];function rr(e){return JSON.stringify(e,(function(e,t){if("function"!=typeof t){if(t instanceof Event||t instanceof we){var n,r={};for(n in t){var i=t[n];i&&"object"==typeof i?"detail"==n&&(r[n]=i):n in Event||(r[n]=i)}return r}if(t instanceof TimeRanges)for(r={__type__:"TimeRanges",length:t.length,start:[],end:[]},n=0;n<t.length;++n)r.start.push(t.start(n)),r.end.push(t.end(n));else r=t instanceof Uint8Array?{__type__:"Uint8Array",entries:Array.from(t)}:"number"==typeof t?isNaN(t)?"NaN":isFinite(t)?t:0>t?"-Infinity":"Infinity":t;return r}}))}function ir(e){return JSON.parse(e,(function(e,t){return"NaN"==t?NaN:"-Infinity"==t?-1/0:"Infinity"==t?1/0:t&&"object"==typeof t&&"TimeRanges"==t.__type__?function(e){return{length:e.length,start:function(t){return e.start[t]},end:function(t){return e.end[t]}}}(t):t&&"object"==typeof t&&"Uint8Array"==t.__type__?new Uint8Array(t.entries):t}))}function ar(e,t,n,r,i,a){this.O=e,this.f=new fe(t),this.S=n,this.l=!1,this.F=r,this.K=i,this.B=a,this.b=this.h=!1,this.D="",this.i=null,this.m=this.ce.bind(this),this.s=this.Ff.bind(this),this.a={video:{},player:{}},this.u=0,this.c={},this.g=null,pr.add(this)}var or=!1,sr=null;function lr(e){for(var t=f(pr),n=t.next();!n.done;n=t.next())ur(n.value,e)}function ur(e,t){var n=e.B();e.g=new ge,e.l=!0,e.kd(n,t)}function cr(e){for(var t=f(pr),n=t.next();!n.done;n=t.next())n=n.value,or="available"==e,n.f.yc()}function dr(e){var t=sr;t.removeUpdateListener(e.m),t.removeMessageListener("urn:x-cast:com.google.shaka.v2",e.s)}function fr(e){for(var t in e.c){var n=e.c[t];delete e.c[t],n.reject(new me(1,7,7e3))}}function hr(e){e=rr(e),sr.sendMessage("urn:x-cast:com.google.shaka.v2",e,(function(){}),X)}(r=ar.prototype).destroy=function(){return pr.delete(this),fr(this),sr&&dr(this),this.f&&(this.f.stop(),this.f=null),this.K=this.F=null,this.b=this.h=!1,this.s=this.m=this.g=this.c=this.a=this.i=null,Promise.resolve()},r.ga=function(){return this.b},r.nd=function(){return this.D},r.init=function(){if(e.chrome&&chrome.cast&&chrome.cast.isAvailable&&this.O.length){this.h=!0,this.f.yc();var t=new chrome.cast.SessionRequest(this.O);t=new chrome.cast.ApiConfig(t,lr.bind(this),cr.bind(this),"origin_scoped"),chrome.cast.initialize(t,(function(){}),(function(){})),or&&this.f.R(.02),(t=sr)&&t.status!=chrome.cast.SessionStatus.STOPPED?ur(this,t):sr=null}},r.ud=function(e){this.i=e,this.b&&hr({type:"appData",appData:this.i})},r.cast=function(e){return this.h?or?this.b?Promise.reject(new me(1,8,8002)):(this.g=new ge,chrome.cast.requestSession(this.kd.bind(this,e),this.be.bind(this)),this.g):Promise.reject(new me(1,8,8001)):Promise.reject(new me(1,8,8e3))},r.Kb=function(){this.b&&(fr(this),sr&&(dr(this),sr.stop((function(){}),(function(){})),sr=null))},r.get=function(e,t){if("video"==e){if(qn.includes(t))return this.le.bind(this,e,t)}else if("player"==e){if(Qn[t]&&!this.get("player","isLive")())return function(){};if(tr.includes(t))return this.le.bind(this,e,t);if(nr.includes(t))return this.Wf.bind(this,e,t);if(Jn[t])return this.ie.bind(this,e,t)}return this.ie(e,t)},r.set=function(e,t,n){this.a[e][t]=n,hr({type:"set",targetName:e,property:t,value:n})},r.kd=function(e,t){sr=t,t.addUpdateListener(this.m),t.addMessageListener("urn:x-cast:com.google.shaka.v2",this.s),this.ce(),hr({type:"init",initState:e,appData:this.i}),this.g.resolve()},r.be=function(e){var t=8003;switch(e.code){case"cancel":t=8004;break;case"timeout":t=8005;break;case"receiver_unavailable":t=8006}this.g.reject(new me(2,8,t,e))},r.ie=function(e,t){return this.a[e][t]},r.le=function(e,t,n){for(var r=[],i=2;i<arguments.length;++i)r[i-2]=arguments[i];hr({type:"call",targetName:e,methodName:t,args:r})},r.Wf=function(e,t,n){for(var r=[],i=2;i<arguments.length;++i)r[i-2]=arguments[i];i=new ge;var a=this.u.toString();return this.u++,this.c[a]=i,hr({type:"asyncCall",targetName:e,methodName:t,args:r,id:a}),i},r.ce=function(){var e=!!sr&&"connected"==sr.status;if(this.b&&!e){for(var t in this.K(),this.a)this.a[t]={};fr(this)}this.D=(this.b=e)?sr.receiver.friendlyName:"",this.f.yc()},r.Ff=function(e,t){var n=ir(t);switch(n.type){case"event":var r=n.event;this.F(n.targetName,new we(r.type,r));break;case"update":for(var i in r=n.update)for(var a in n=this.a[i]||{},r[i])n[a]=r[i][a];this.l&&(this.S(),this.l=!1);break;case"asyncComplete":if(i=n.id,n=n.error,a=this.c[i],delete this.c[i],a)if(n){for(r in i=new me(n.severity,n.category,n.code),n)i[r]=n[r];a.reject(i)}else a.resolve()}};var pr=new Set;function mr(e,t,n){var r=this;ke.call(this),this.c=e,this.b=t,this.i=this.g=this.f=this.l=this.h=null,this.s=n,this.m=new Map,this.a=new ar(n,(function(){return vr(r)}),(function(){return br(r)}),(function(e,t){return Ar(r,e,t)}),(function(){return _r(r)}),(function(){return yr(r)})),function(e){for(var t in e.a.init(),e.i=new Be,zn.forEach(function(e){this.i.w(this.c,e,this.D.bind(this))}.bind(e)),Xn.forEach(function(e){this.i.w(this.b,e,this.u.bind(this))}.bind(e)),e.h={},e.c)Object.defineProperty(e.h,t,{configurable:!1,enumerable:!0,get:e.B.bind(e,t),set:e.F.bind(e,t)});e.l={},gr(e,(function(t){Object.defineProperty(e.l,t,{configurable:!1,enumerable:!0,get:function(){return function e(t,n){if(t.m.has(n)&&(n=t.m.get(n)),"addEventListener"==n)return t.g.addEventListener.bind(t.g);if("removeEventListener"==n)return t.g.removeEventListener.bind(t.g);if("getMediaElement"==n)return function(){return this.h}.bind(t);if("getSharedConfiguration"==n)return t.a.get("player","getConfiguration");if("getNetworkingEngine"==n)return t.b.Mb.bind(t.b);if(t.a.ga()){if("getManifest"==n||"drmInfo"==n)return function(){return q(n+"() does not work while casting!"),null};if("getManifestUri"==n)return Vn("getManifestUri",'Please use "getAssetUri" instead.'),e(t,"getAssetUri");if("attach"==n||"detach"==n)return function(){return q(n+"() does not work while casting!"),Promise.resolve()}}return t.a.ga()&&0==Object.keys(t.a.a.video).length&&Jn[n]||!t.a.ga()?t.b[n].bind(t.b):t.a.get("player",n)}(e,t)}})})),function(e){var t=new Map;gr(e,(function(n,r){if(t.has(r)){var i=t.get(r);n.length<i.length?e.m.set(n,i):e.m.set(i,n)}else t.set(r,n)}))}(e),e.f=new ke,e.f.$b=e.h,e.g=new ke,e.g.$b=e.l}(this)}function gr(e,t){function n(e){return"constructor"!=e&&"function"==typeof r[e]&&!i.has(e)}var r=e.b,i=new Set;for(a in r)n(a)&&(i.add(a),t(a,r[a]));for(var a=Object.getPrototypeOf(r),o=Object.getPrototypeOf({});a&&a!=o;){for(var s=f(Object.getOwnPropertyNames(a)),l=s.next();!l.done;l=s.next())n(l=l.value)&&(i.add(l),t(l,r[l]));a=Object.getPrototypeOf(a)}}function yr(e){var t={video:{},player:{},playerAfterLoad:{},manifest:e.b.hc(),startTime:null};return e.c.pause(),$n.forEach(function(e){t.video[e]=this.c[e]}.bind(e)),e.c.ended||(t.startTime=e.c.currentTime),Zn.forEach(function(e){var n=e[1];e=this.b[e[0]](),t.player[n]=e}.bind(e)),er.forEach(function(e){var n=e[1];e=this.b[e[0]](),t.playerAfterLoad[n]=e}.bind(e)),t}function vr(e){e.dispatchEvent(new we("caststatuschanged"))}function br(e){e.f.dispatchEvent(new we(e.h.paused?"pause":"play"))}function _r(e){Zn.forEach(function(e){var t=e[1];e=this.a.get("player",e[0])(),this.b[t](e)}.bind(e));var t=e.a.get("player","getAssetUri")(),n=e.a.get("video","ended"),r=Promise.resolve(),i=e.c.autoplay,a=null;n||(a=e.a.get("video","currentTime")),t&&(e.c.autoplay=!1,r=e.b.load(t,a));var o={};$n.forEach(function(e){o[e]=this.a.get("video",e)}.bind(e)),r.then((function(){e.c&&($n.forEach(function(e){this.c[e]=o[e]}.bind(e)),er.forEach(function(e){var t=e[1];e=this.a.get("player",e[0])(),this.b[t](e)}.bind(e)),e.c.autoplay=i,t&&e.c.play())}),(function(t){e.b.dispatchEvent(new we("error",{detail:t}))}))}function Ar(e,t,n){e.a.ga()&&("video"==t?e.f.dispatchEvent(n):"player"==t&&e.g.dispatchEvent(n))}function Er(e,t,n,r){var i=this;ke.call(this),this.a=e,this.b=t,this.c=new Be,this.D={video:e,player:t},this.s=n||function(){},this.F=r||function(e){return e},this.u=!1,this.h=!0,this.g=0,this.m=!1,this.l=!0,this.i=this.f=null,this.B=new fe((function(){wr(i)})),function(e){var t=cast.receiver.CastReceiverManager.getInstance();t.onSenderConnected=e.ee.bind(e),t.onSenderDisconnected=e.ee.bind(e),t.onSystemVolumeChanged=e.Oe.bind(e),e.i=t.getCastMessageBus("urn:x-cast:com.google.cast.media"),e.i.onMessage=e.Af.bind(e),e.f=t.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),e.f.onMessage=e.Kf.bind(e),t.start(),zn.forEach(function(e){this.c.w(this.a,e,this.je.bind(this,"video"))}.bind(e)),Xn.forEach(function(e){this.c.w(this.b,e,this.je.bind(this,"player"))}.bind(e)),cast.__platform__&&cast.__platform__.canDisplayType('video/mp4; codecs="avc1.640028"; width=3840; height=2160')?e.b.vd(3840,2160):e.b.vd(1920,1080),e.c.w(e.a,"loadeddata",function(){this.m=!0}.bind(e)),e.c.w(e.b,"loading",function(){this.h=!1,Tr(this)}.bind(e)),e.c.w(e.a,"playing",function(){this.h=!1,Tr(this)}.bind(e)),e.c.w(e.a,"pause",function(){Tr(this)}.bind(e)),e.c.w(e.b,"unloading",function(){this.h=!0,Tr(this)}.bind(e)),e.c.w(e.a,"ended",function(){var e=this;new fe((function(){e.a&&e.a.ended&&(e.h=!0,Tr(e))})).R(5)}.bind(e))}(this)}function Tr(e){Promise.resolve().then(function(){this.b&&(this.dispatchEvent(new we("caststatuschanged")),Sr(this)||xr(this,0))}.bind(e))}function wr(e){e.B.R(.5);var t={video:{},player:{}};if(Wn.forEach(function(e){t.video[e]=this.a[e]}.bind(e)),e.b.V())for(var n in Qn)0==e.g%Qn[n]&&(t.player[n]=e.b[n]());for(var r in Jn)0==e.g%Jn[r]&&(t.player[r]=e.b[r]());(n=cast.receiver.CastReceiverManager.getInstance().getSystemVolume())&&(t.video.volume=n.level,t.video.muted=n.muted),e.m&&(e.g+=1),Cr(e,{type:"update",update:t},e.f),Sr(e)}function Sr(e){return!(!e.l||!e.a.duration&&!e.b.V()||(kr(e),e.l=!1,0))}function kr(e){var t={contentId:e.b.hc(),streamType:e.b.V()?"LIVE":"BUFFERED",duration:e.a.duration,contentType:""};xr(e,0,t)}function Cr(e,t,n,r){e.u&&(e=rr(t),r?n.getCastChannel(r).send(e):n.broadcast(e))}function xr(e,t,n){var r=e.a.playbackRate,i=Rr;r={mediaSessionId:0,playbackRate:r,playerState:i=e.h?i.IDLE:e.b.Xc()?i.we:e.a.paused?i.ye:i.ze,currentTime:e.a.currentTime,supportedMediaCommands:15,volume:{level:e.a.volume,muted:e.a.muted}},n&&(r.media=n),Cr(e,{requestId:t,type:"MEDIA_STATUS",status:[r]},e.i)}e.__onGCastApiAvailable=function(e){if(e)for(var t=(e=f(pr)).next();!t.done;t=e.next())t.value.init()},G(mr,ke),V("shaka.cast.CastProxy",mr),mr.prototype.destroy=function(e){return e&&this.a.Kb(),this.i&&(this.i.release(),this.i=null),e=[],this.b&&(e.push(this.b.destroy()),this.b=null),this.a&&(e.push(this.a.destroy()),this.a=null),this.l=this.h=this.c=null,Promise.all(e)},mr.prototype.destroy=mr.prototype.destroy,mr.prototype.pf=function(){return this.h},mr.prototype.getVideo=mr.prototype.pf,mr.prototype.ff=function(){return this.l},mr.prototype.getPlayer=mr.prototype.ff,mr.prototype.Ee=function(){return this.a.h&&or},mr.prototype.canCast=mr.prototype.Ee,mr.prototype.ga=function(){return this.a.ga()},mr.prototype.isCasting=mr.prototype.ga,mr.prototype.nd=function(){return this.a.nd()},mr.prototype.receiverName=mr.prototype.nd,mr.prototype.cast=function(){var e=yr(this);return this.a.cast(e).then(function(){if(this.b)return this.b.Cd()}.bind(this))},mr.prototype.cast=mr.prototype.cast,mr.prototype.ud=function(e){this.a.ud(e)},mr.prototype.setAppData=mr.prototype.ud,mr.prototype.sg=function(){var e=this.a;if(e.b){var t=e.B();chrome.cast.requestSession(e.kd.bind(e,t),e.be.bind(e))}},mr.prototype.suggestDisconnect=mr.prototype.sg,mr.prototype.He=function(e){var t=this;return p((function n(){return M(n,(function(n){switch(n.j){case 1:return e==t.s?n.return():(t.s=e,t.a.Kb(),w(n,t.a.destroy(),2));case 2:t.a=null,t.a=new ar(e,(function(){return vr(t)}),(function(){return br(t)}),(function(e,n){return Ar(t,e,n)}),(function(){return _r(t)}),(function(){return yr(t)})),t.a.init(),S(n)}}))}))},mr.prototype.changeReceiverId=mr.prototype.He,mr.prototype.Kb=function(){this.a.Kb()},mr.prototype.forceDisconnect=mr.prototype.Kb,mr.prototype.B=function(e){if("addEventListener"==e)return this.f.addEventListener.bind(this.f);if("removeEventListener"==e)return this.f.removeEventListener.bind(this.f);if(this.a.ga()&&0==Object.keys(this.a.a.video).length){var t=this.c[e];if("function"!=typeof t)return t}return this.a.ga()?this.a.get("video",e):("function"==typeof(e=this.c[e])&&(e=e.bind(this.c)),e)},mr.prototype.F=function(e,t){this.a.ga()?this.a.set("video",e,t):this.c[e]=t},mr.prototype.D=function(e){this.a.ga()||this.f.dispatchEvent(new we(e.type,e))},mr.prototype.u=function(e){this.a.ga()||this.g.dispatchEvent(e)},G(Er,ke),V("shaka.cast.CastReceiver",Er),Er.prototype.isConnected=function(){return this.u},Er.prototype.isConnected=Er.prototype.isConnected,Er.prototype.vf=function(){return this.h},Er.prototype.isIdle=Er.prototype.vf,Er.prototype.destroy=function(){var e=this;return p((function t(){var n;return M(t,(function(t){switch(t.j){case 1:return e.c&&(e.c.release(),e.c=null),n=[],e.b&&(n.push(e.b.destroy()),e.b=null),e.B&&(e.B.stop(),e.B=null),e.a=null,e.D=null,e.s=null,e.u=!1,e.h=!0,e.f=null,e.i=null,w(t,Promise.all(n),2);case 2:cast.receiver.CastReceiverManager.getInstance().stop(),S(t)}}))}))},Er.prototype.destroy=Er.prototype.destroy,(r=Er.prototype).ee=function(){this.g=0,this.l=!0,this.u=0!=cast.receiver.CastReceiverManager.getInstance().getSenders().length,Tr(this)},r.je=function(e,t){this.b&&(wr(this),Cr(this,{type:"event",targetName:e,event:t},this.f))},r.Oe=function(){var e=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();e&&Cr(this,{type:"update",update:{video:{volume:e.level,muted:e.muted}}},this.f),Cr(this,{type:"event",targetName:"video",event:{type:"volumechange"}},this.f)},r.Kf=function(e){var t=ir(e.data);switch(t.type){case"init":this.g=0,this.m=!1,this.l=!0,function(e,t,n){for(var r in t.player)e.b[r](t.player[r]);e.s(n),n=Promise.resolve();var i=e.a.autoplay;t.manifest&&(e.a.autoplay=!1,n=e.b.load(t.manifest,t.startTime)),n.then((function(){if(e.b){for(var n in t.video)e.a[n]=t.video[n];for(var r in t.playerAfterLoad)e.b[r](t.playerAfterLoad[r]);e.a.autoplay=i,t.manifest&&(e.a.play(),xr(e,0))}}),(function(t){e.b.dispatchEvent(new we("error",{detail:t}))}))}(this,t.initState,t.appData),wr(this);break;case"appData":this.s(t.appData);break;case"set":var n=t.targetName,r=t.property;if(t=t.value,"video"==n){var i=cast.receiver.CastReceiverManager.getInstance();if("volume"==r){i.setSystemVolumeLevel(t);break}if("muted"==r){i.setSystemVolumeMuted(t);break}}this.D[n][r]=t;break;case"call":(n=this.D[t.targetName])[t.methodName].apply(n,t.args);break;case"asyncCall":n=t.targetName,r=t.methodName,"player"==n&&"load"==r&&(this.g=0,this.m=!1),i=t.id,e=e.senderId;var a=this.D[n];t=a[r].apply(a,t.args),"player"==n&&"load"==r&&(t=t.then(function(){this.l=!0}.bind(this))),t.then(this.oe.bind(this,e,i,null),this.oe.bind(this,e,i))}},r.Af=function(e){var t=ir(e.data);switch(t.type){case"PLAY":this.a.play(),xr(this,0);break;case"PAUSE":this.a.pause(),xr(this,0);break;case"SEEK":e=t.currentTime;var n=t.resumeState;null!=e&&(this.a.currentTime=Number(e)),n&&"PLAYBACK_START"==n?(this.a.play(),xr(this,0)):n&&"PLAYBACK_PAUSE"==n&&(this.a.pause(),xr(this,0));break;case"STOP":this.b.Cd().then(function(){this.b&&xr(this,0)}.bind(this));break;case"GET_STATUS":xr(this,Number(t.requestId));break;case"VOLUME":e=(n=t.volume).level,n=n.muted;var r=this.a.volume,i=this.a.muted;null!=e&&(this.a.volume=Number(e)),null!=n&&(this.a.muted=n),r==this.a.volume&&i==this.a.muted||xr(this,0);break;case"LOAD":this.g=0,this.l=this.m=!1,e=t.media,n=t.currentTime,r=this.F(e.contentId),i=t.autoplay||!0,this.s(e.customData),i&&(this.a.autoplay=!0),this.b.load(r,n).then(function(){this.b&&kr(this)}.bind(this)).catch(function(e){var n="LOAD_FAILED";7==e.category&&7e3==e.code&&(n="LOAD_CANCELLED"),Cr(this,{requestId:Number(t.requestId),type:n},this.i)}.bind(this));break;default:Cr(this,{requestId:Number(t.requestId),type:"INVALID_REQUEST",reason:"INVALID_COMMAND"},this.i)}},r.oe=function(e,t,n){this.b&&Cr(this,{type:"asyncComplete",id:t,error:n},this.f,e)};var Rr={IDLE:"IDLE",ze:"PLAYING",we:"BUFFERING",ye:"PAUSED"};function Lr(e,t){this.J=e,this.b=t==Ir,this.a=0}V("shaka.util.DataViewReader",Lr);var Ir=1;function Pr(){throw new me(2,3,3e3)}function jr(){this.c=[],this.b=[],this.a=!1}function Or(e){for(var t=null!=e.flags?12:8;e.reader.ua()&&!e.parser.a;)e.parser.sc(e.start+t,e.reader,e.partialOkay)}function Dr(e){for(var t=null!=e.flags?12:8,n=e.reader.G();0<n&&!e.parser.a;--n)e.parser.sc(e.start+t,e.reader,e.partialOkay)}function Mr(e){return function(t){e(t.reader.Za(t.reader.J.byteLength-t.reader.ca()))}}function Nr(e){for(var t=0,n=0;n<e.length;n++)t=t<<8|e.charCodeAt(n);return t}function Ur(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}function Fr(e){var t=this;this.a=[],this.b=[],this.data=[],(new jr).H("moov",Or).fa("pssh",(function(e){if(!(1<e.version)){var n=e.reader.J;if(n=new Uint8Array(n.buffer,n.byteOffset-12,e.size),t.data.push(n),t.a.push(ht.Ac(e.reader.Za(16))),0<e.version){n=e.reader.G();for(var r=0;r<n;++r){var i=ht.Ac(e.reader.Za(16));t.b.push(i)}}}})).parse(e)}Lr.Endianness={Bg:0,Dg:Ir},Lr.prototype.ua=function(){return this.a<this.J.byteLength},Lr.prototype.hasMoreData=Lr.prototype.ua,Lr.prototype.ca=function(){return this.a},Lr.prototype.getPosition=Lr.prototype.ca,Lr.prototype.Ve=function(){return this.J.byteLength},Lr.prototype.getLength=Lr.prototype.Ve,Lr.prototype.la=function(){try{var e=this.J.getUint8(this.a);return this.a+=1,e}catch(e){Pr()}},Lr.prototype.readUint8=Lr.prototype.la,Lr.prototype.Tb=function(){try{var e=this.J.getUint16(this.a,this.b);return this.a+=2,e}catch(e){Pr()}},Lr.prototype.readUint16=Lr.prototype.Tb,Lr.prototype.G=function(){try{var e=this.J.getUint32(this.a,this.b);return this.a+=4,e}catch(e){Pr()}},Lr.prototype.readUint32=Lr.prototype.G,Lr.prototype.ke=function(){try{var e=this.J.getInt32(this.a,this.b);return this.a+=4,e}catch(e){Pr()}},Lr.prototype.readInt32=Lr.prototype.ke,Lr.prototype.Bb=function(){try{if(this.b)var e=this.J.getUint32(this.a,!0),t=this.J.getUint32(this.a+4,!0);else t=this.J.getUint32(this.a,!1),e=this.J.getUint32(this.a+4,!1)}catch(e){Pr()}if(2097151<t)throw new me(2,3,3001);return this.a+=8,t*Math.pow(2,32)+e},Lr.prototype.readUint64=Lr.prototype.Bb,Lr.prototype.Za=function(e){this.a+e>this.J.byteLength&&Pr();var t=new Uint8Array(this.J.buffer,this.J.byteOffset+this.a,e);return this.a+=e,t},Lr.prototype.readBytes=Lr.prototype.Za,Lr.prototype.M=function(e){this.a+e>this.J.byteLength&&Pr(),this.a+=e},Lr.prototype.skip=Lr.prototype.M,Lr.prototype.me=function(e){this.a<e&&Pr(),this.a-=e},Lr.prototype.rewind=Lr.prototype.me,Lr.prototype.seek=function(e){(0>e||e>this.J.byteLength)&&Pr(),this.a=e},Lr.prototype.seek=Lr.prototype.seek,Lr.prototype.md=function(){for(var e=this.a;this.ua()&&0!=this.J.getUint8(this.a);)this.a+=1;return e=new Uint8Array(this.J.buffer,this.J.byteOffset+e,this.a-e),this.a+=1,ot(e)},Lr.prototype.readTerminatedString=Lr.prototype.md,V("shaka.util.Mp4Parser",jr),jr.prototype.H=function(e,t){var n=Nr(e);return this.c[n]=0,this.b[n]=t,this},jr.prototype.box=jr.prototype.H,jr.prototype.fa=function(e,t){var n=Nr(e);return this.c[n]=1,this.b[n]=t,this},jr.prototype.fullBox=jr.prototype.fa,jr.prototype.stop=function(){this.a=!0},jr.prototype.stop=jr.prototype.stop,jr.prototype.parse=function(e,t){var n=new Uint8Array(e);for(n=new Lr(new DataView(n.buffer,n.byteOffset,n.byteLength),0),this.a=!1;n.ua()&&!this.a;)this.sc(0,n,t)},jr.prototype.parse=jr.prototype.parse,jr.prototype.sc=function(e,t,n){var r=t.ca(),i=t.G(),a=t.G();switch(i){case 0:i=t.J.byteLength-r;break;case 1:i=t.Bb()}var o=this.b[a];if(o){var s=null,l=null;1==this.c[a]&&(s=(l=t.G())>>>24,l&=16777215),a=r+i,n&&a>t.J.byteLength&&(a=t.J.byteLength),a-=t.ca(),t=0<a?t.Za(a):new Uint8Array(0),o({parser:this,partialOkay:n||!1,version:s,flags:l,reader:t=new Lr(new DataView(t.buffer,t.byteOffset,t.byteLength),0),size:i,start:r+e})}else t.M(Math.min(r+i-t.ca(),t.J.byteLength-t.ca()))},jr.prototype.parseNext=jr.prototype.sc,jr.children=Or,jr.sampleDescription=Dr,jr.allData=Mr,jr.typeToString=Ur;var Br={gc:function(e,t){var n=Br.P(e,t);return 1!=n.length?null:n[0]},Oc:function(e,t,n){return 1!=(e=Br.Od(e,t,n)).length?null:e[0]},P:function(e,t){return Array.prototype.filter.call(e.childNodes,(function(e){return e instanceof Element&&e.tagName==t}))},Od:function(e,t,n){return Array.prototype.filter.call(e.childNodes,(function(e){return e instanceof Element&&e.localName==n&&e.namespaceURI==t}))},getAttributeNS:function(e,t,n){return e.hasAttributeNS(t,n)?e.getAttributeNS(t,n):null},ic:function(e){return Array.prototype.every.call(e.childNodes,(function(e){return e.nodeType==Node.TEXT_NODE||e.nodeType==Node.CDATA_SECTION_NODE}))?e.textContent.trim():null},I:function(e,t,n,r){r=void 0===r?null:r;var i=null;return null!=(e=e.getAttribute(t))&&(i=n(e)),null==i?r:i},Of:function(e){return e?(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z"),e=Date.parse(e),isNaN(e)?null:Math.floor(e/1e3)):null},Ea:function(e){return e&&(e=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(e))?(e=31536e3*Number(e[1]||null)+2592e3*Number(e[2]||null)+86400*Number(e[3]||null)+3600*Number(e[4]||null)+60*Number(e[5]||null)+Number(e[6]||null),isFinite(e)?e:null):null},uc:function(e){var t=/([0-9]+)-([0-9]+)/.exec(e);return t?(e=Number(t[1]),isFinite(e)?(t=Number(t[2]),isFinite(t)?{start:e,end:t}:null):null):null},parseInt:function(e){return 0==(e=Number(e))%1?e:null},tc:function(e){return 0==(e=Number(e))%1&&0<e?e:null},yb:function(e){return 0==(e=Number(e))%1&&0<=e?e:null},parseFloat:function(e){return e=Number(e),isNaN(e)?null:e},Me:function(e){var t;return e=(t=e.match(/^(\d+)\/(\d+)$/))?Number(t[1])/Number(t[2]):Number(e),isNaN(e)?null:e},he:function(e,t){var n=new DOMParser;try{var r=n.parseFromString(e,"text/xml")}catch(e){}if(r&&r.documentElement.tagName==t)var i=r.documentElement;return i&&0<i.getElementsByTagName("parsererror").length?null:i},ge:function(e,t){try{var n=ot(e);return Br.he(n,t)}catch(e){}}},Kr=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b","org.w3.clearkey").set("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine.alpha").set("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95","com.microsoft.playready").set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb","com.adobe.primetime");function Vr(e,t,n){var r=function(e){for(var t=[],n=(e=f(e)).next();!n.done;n=e.next())(n=Yr(n.value))&&t.push(n);return t}(e),i=null;e=[];var a=[],o=new Set(r.map((function(e){return e.keyId})));if(o.delete(null),1<o.size)throw new me(2,4,4010);if(n||(a=r.filter((function(e){return"urn:mpeg:dash:mp4protection:2011"!=e.ne||(i=e.init||i,!1)}))).length&&0==(e=function(e,t,n){for(var r=[],i=(n=f(n)).next();!i.done;i=n.next()){i=i.value;var a=Kr.get(i.ne);if(a){var o;if(o=Br.Oc(i.node,"urn:microsoft:playready","pro")){o=ht.Ba(o.textContent);var s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),l=o.length,u=s.length+16+l,c=new ArrayBuffer(u),d=new Uint8Array(c);c=new DataView(c);var h=0;c.setUint32(h,u),h+=4,c.setUint32(h,1886614376),h+=4,c.setUint32(h,0),h+=4,d.set(s,h),h+=s.length,c.setUint32(h,l),h+=4,d.set(o,h),o=[{initData:d,initDataType:"cenc",keyId:i.keyId}]}else o=null;o=Ht(a,i.init||e||o),(a=Hr.get(a))&&(o.licenseServerUri=a(i)),r.push(o)}else for(i=f(i=t(i.node)||[]),a=i.next();!a.done;a=i.next())r.push(a.value)}return r}(i,t,a)).length&&(e=[Ht("",i)]),r.length&&(n||!a.length))for(e=[],n=(t=f(Kr.values())).next();!n.done;n=t.next())"org.w3.clearkey"!=(n=n.value)&&e.push(Ht(n,i));if(o=Array.from(o)[0]||null)for(n=(t=f(e)).next();!n.done;n=t.next())for(r=(n=f(n.value.initData)).next();!r.done;r=n.next())r.value.keyId=o;return{Kd:o,Fg:i,drmInfos:e,Pd:!0}}var Gr,Hr=(new Map).set("com.widevine.alpha",(function(e){return(e=Br.Oc(e.node,"urn:microsoft","laurl"))&&e.getAttribute("licenseUrl")||""})).set("com.microsoft.playready",(function(e){return(e=Br.Oc(e.node,"urn:microsoft:playready","pro"))&&(e=function(e){var t=0,n=new DataView(e).getUint32(t,!0);if(n!==e.byteLength)return[];t+=6,n=[];for(var r=new DataView(e);t<e.byteLength-1;){var i=r.getUint16(t,!0);t+=2;var a=r.getUint16(t,!0);t+=2;var o=new Uint8Array(e,t,a);n.push({type:i,value:o}),t+=a}return n}((e=ht.Ba(e.textContent)).buffer).filter((function(e){return 1===e.type}))[0])?(e=st(e.value,!0),(e=Br.he(e,"WRMHEADER"))?function(e){return(e=e.querySelector("DATA > LA_URL"))?e.textContent:""}(e):""):""}));function Yr(e){var t=e.getAttribute("schemeIdUri"),n=Br.getAttributeNS(e,"urn:mpeg:cenc:2013","default_KID"),r=Br.Od(e,"urn:mpeg:cenc:2013","pssh").map(Br.ic);if(!t)return null;if(t=t.toLowerCase(),n&&(n=n.replace(/-/g,"").toLowerCase()).includes(" "))throw new me(2,4,4009);var i=[];try{i=r.map((function(e){return{initDataType:"cenc",initData:ht.Ba(e),keyId:null}}))}catch(e){throw new me(2,4,4007)}return{node:e,ne:t,keyId:n,init:0<i.length?i:null}}function zr(t,n,r,i,a){var o={RepresentationID:n,Number:r,Bandwidth:i,Time:a};return t.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g,(function(t,n,r,i){if("$$"==t)return"$";var a=o[n];if(null==a)return t;switch("RepresentationID"==n&&r&&(r=void 0),"Time"==n&&(a=Math.round(a)),i){case void 0:case"d":case"i":case"u":t=a.toString();break;case"o":t=a.toString(8);break;case"x":t=a.toString(16);break;case"X":t=a.toString(16).toUpperCase();break;default:t=a.toString()}return r=e.parseInt(r,10)||1,Array(Math.max(0,r-t.length)+1).join("0")+t}))}function Wr(e,t){var n=$r(e,t,"timescale"),r=1;n&&(r=Br.tc(n)||1),n=$r(e,t,"duration"),(n=Br.tc(n||""))&&(n/=r);var i=$r(e,t,"startNumber"),a=Number($r(e,t,"presentationTimeOffset"))||0,o=Br.yb(i||"");null!=i&&null!=o||(o=1);var s=qr(e,t,"SegmentTimeline");if(i=null,s){i=r;var l=e.T.duration||1/0;s=Br.P(s,"S");for(var u=[],c=0,d=0;d<s.length;++d){var f=s[d],h=Br.I(f,"t",Br.yb),p=Br.I(f,"d",Br.yb);if(f=Br.I(f,"r",Br.parseInt),null!=h&&(h-=a),!p)break;if(h=null!=h?h:c,0>(f=f||0))if(d+1<s.length){if(null==(f=Br.I(s[d+1],"t",Br.yb)))break;if(h>=f)break;f=Math.ceil((f-h)/p)-1}else{if(1/0==l)break;if(h/i>=l)break;f=Math.ceil((l*i-h)/p)-1}0<u.length&&h!=c&&(u[u.length-1].end=h/i);for(var m=0;m<=f;++m)c=h+p,u.push({start:h/i,end:c/i,xg:h}),h=c}i=u}return{timescale:r,Z:n,ab:o,ma:a/r||0,Dd:a,N:i}}function $r(e,t,n){return[t(e.C),t(e.aa),t(e.ka)].filter(Vt.Ia).map((function(e){return e.getAttribute(n)})).reduce((function(e,t){return e||t}))}function qr(e,t,n){return[t(e.C),t(e.aa),t(e.ka)].filter(Vt.Ia).map((function(e){return Br.gc(e,n)})).reduce((function(e,t){return e||t}))}function Xr(e,t,n,r,i,a){if(a=void 0===a?0:a,Br.getAttributeNS(e,"http://www.w3.org/1999/xlink","href")){var o=function(e,t,n,r,i,a){for(var o=Br.getAttributeNS(e,"http://www.w3.org/1999/xlink","href"),s=Br.getAttributeNS(e,"http://www.w3.org/1999/xlink","actuate")||"onRequest",l=0;l<e.attributes.length;l++){var u=e.attributes[l];"http://www.w3.org/1999/xlink"==u.namespaceURI&&(e.removeAttributeNS(u.namespaceURI,u.localName),--l)}if(5<=a)return ve(new me(2,4,4028));if("onLoad"!=s)return ve(new me(2,4,4027));var c=Gt([r],[o]);return i.request(0,Me(c,t)).U((function(r){if(!(r=Br.ge(r.data,e.tagName)))return ve(new me(2,4,4001,o));for(;e.childNodes.length;)e.removeChild(e.childNodes[0]);for(;r.childNodes.length;){var s=r.childNodes[0];r.removeChild(s),e.appendChild(s)}for(s=0;s<r.attributes.length;s++){var l=r.attributes[s].nodeName,u=r.getAttribute(l);e.setAttribute(l,u)}return Xr(e,t,n,c[0],i,a+1)}))}(e,t,n,r,i,a);return n&&(o=o.U(void 0,(function(){return Xr(e,t,n,r,i,a)}))),o}o=[];for(var s=0;s<e.childNodes.length;s++){var l=e.childNodes[s];l instanceof Element&&("urn:mpeg:dash:resolve-to-zero:2013"==Br.getAttributeNS(l,"http://www.w3.org/1999/xlink","href")?(e.removeChild(l),--s):"SegmentTimeline"!=l.tagName&&o.push(Xr(l,t,n,r,i,a)))}return Ee(o).U((function(){return e}))}function Jr(e,t,n){this.c=e,this.b=t,this.a=n}function Qr(e,t,n,r,i,a){this.position=e,this.startTime=t,this.endTime=n,this.c=r,this.b=i,this.a=a}function Zr(e,t,n,r){var i,a=(new jr).fa("sidx",(function(e){i=function(e,t,n,r){var i=[];r.reader.M(4);var a=r.reader.G();if(0==a)throw new me(2,3,3005);if(0==r.version)var o=r.reader.G(),s=r.reader.G();else o=r.reader.Bb(),s=r.reader.Bb();r.reader.M(2);var l=r.reader.Tb();for(e=e+r.size+s,s=0;s<l;s++){var u=r.reader.G(),c=(2147483648&u)>>>31;u&=2147483647;var d=r.reader.G();if(r.reader.M(4),1==c)throw new me(2,3,3006);i.push(new Qr(i.length,o/a-t,(o+d)/a-t,(function(){return n}),e,e+u-1)),o+=d,e+=u}return r.parser.stop(),i}(t,r,n,e)}));if(e&&a.parse(e),i)return i;throw new me(2,3,3004)}function ei(e){this.a=e}function ti(e,t){for(;e.a.length&&e.a[e.a.length-1].startTime>=t;)e.a.pop();for(;e.a.length&&0>=e.a[0].endTime;)e.a.shift();if(0!=e.a.length){var n=e.a[e.a.length-1];e.a[e.a.length-1]=new Qr(n.position,n.startTime,t,n.c,n.b,n.a)}}function ni(e){this.b=e,this.a=new Lr(e,0),Gr||(Gr=[new Uint8Array([255]),new Uint8Array([127,255]),new Uint8Array([63,255,255]),new Uint8Array([31,255,255,255]),new Uint8Array([15,255,255,255,255]),new Uint8Array([7,255,255,255,255,255]),new Uint8Array([3,255,255,255,255,255,255]),new Uint8Array([1,255,255,255,255,255,255,255])])}function ri(e){var t=ii(e);if(7<t.length)throw new me(2,3,3002);for(var n=0,r=0;r<t.length;r++)n=256*n+t[r];t=n,n=ii(e);e:{r=ht.za;for(var i=0;i<Gr.length;i++)if(r(n,Gr[i])){r=!0;break e}r=!1}if(r)n=e.b.byteLength-e.a.ca();else{if(8==n.length&&224&n[1])throw new me(2,3,3001);for(r=n[0]&(1<<8-n.length)-1,i=1;i<n.length;i++)r=256*r+n[i];n=r}return n=e.a.ca()+n<=e.b.byteLength?n:e.b.byteLength-e.a.ca(),r=new DataView(e.b.buffer,e.b.byteOffset+e.a.ca(),n),e.a.M(n),new ai(t,r)}function ii(e){var t,n=e.a.la();for(t=1;8>=t&&!(n&1<<8-t);t++);if(8<t)throw new me(2,3,3002);var r=new Uint8Array(t);for(r[0]=n,n=1;n<t;n++)r[n]=e.a.la();return r}function ai(e,t){this.id=e,this.a=t}function oi(e){if(8<e.a.byteLength)throw new me(2,3,3002);if(8==e.a.byteLength&&224&e.a.getUint8(0))throw new me(2,3,3001);for(var t=0,n=0;n<e.a.byteLength;n++)t=256*t+e.a.getUint8(n);return t}function si(){}function li(e){var t=new ni(e.a);if(179!=(e=ri(t)).id)throw new me(2,3,3013);if(e=oi(e),183!=(t=ri(t)).id)throw new me(2,3,3012);t=new ni(t.a);for(var n=0;t.ua();){var r=ri(t);if(241==r.id){n=oi(r);break}}return{yg:e,Vf:n}}function ui(e,t){var n=qr(e,t,"Initialization");if(!n)return null;var r=e.C.qa,i=n.getAttribute("sourceURL");i&&(r=Gt(e.C.qa,[i])),i=0;var a=null;return(n=Br.I(n,"range",Br.uc))&&(i=n.start,a=n.end),new Jr((function(){return r}),i,a)}function ci(e,t,n,r,i,a,o,s){var l=e.presentationTimeline,u=!e.mb||!e.T.Zc,c=e.T.start,d=e.T.duration,f=t,h=null;return{createSegmentIndex:function(){var e=[f(r,i,a),"webm"==o?f(n.c(),n.b,n.a):null];return f=null,Promise.all(e).then((function(e){var t=e[0];e=e[1]||null,t="mp4"==o?Zr(t,i,r,s):(new si).parse(t,e,r,s),l.vb(t,c),h=new ei(t),u&&ti(h,d)}))},findSegmentPosition:function(e){return h.find(e)},getSegmentReference:function(e){return h.get(e)}}}function di(e){return e.Ub}function fi(e,t){var n=ui(e,hi),r=function(e){return[e.C.La,e.aa.La,e.ka.La].filter(Vt.Ia).map((function(e){return Br.P(e,"SegmentURL")})).reduce((function(e,t){return 0<e.length?e:t})).map((function(t){return t.getAttribute("indexRange")&&!e.Vd&&(e.Vd=!0),{xf:t.getAttribute("media"),start:(t=Br.I(t,"mediaRange",Br.uc,{start:0,end:null})).start,end:t.end}}))}(e),i=Wr(e,hi),a=i.ab;0==a&&(a=1);var o=0;if(i.Z?o=i.Z*(a-1):i.N&&0<i.N.length&&(o=i.N[0].start),!(r={Z:i.Z,startTime:o,ab:a,ma:i.ma,N:i.N,tb:r}).Z&&!r.N&&1<r.tb.length)throw new me(2,4,4002);if(!r.Z&&!e.T.duration&&!r.N&&1==r.tb.length)throw new me(2,4,4002);if(r.N&&0==r.N.length)throw new me(2,4,4002);return a=i=null,e.ka.id&&e.C.id&&(i=t[a=e.ka.id+","+e.C.id]),o=function(e,t,n,r){var i=r.tb.length;r.N&&r.N.length!=r.tb.length&&(i=Math.min(r.N.length,r.tb.length));for(var a=[],o=r.startTime,s=0;s<i;s++){var l,u=r.tb[s],c=Gt(n,[u.xf]);l=null!=r.Z?o+r.Z:r.N?r.N[s].end:o+e,a.push(new Qr(s+t,o,l,function(e){return e}.bind(null,c),u.start,u.end)),o=l}return a}(e.T.duration,r.ab,e.C.qa,r),i?(i.cd(o),a=e.presentationTimeline.Ob(),i.Lc(a-e.T.start)):(e.presentationTimeline.vb(o,e.T.start),i=new ei(o),a&&e.mb&&(t[a]=i)),e.mb&&e.T.Zc||ti(i,e.T.duration),{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:i.find.bind(i),getSegmentReference:i.get.bind(i),initSegmentReference:n,ma:r.ma}}function hi(e){return e.La}function pi(e,t,n,r){var i=function(e){var t=$r(e,mi,"initialization");if(!t)return null;var n=e.C.id,r=e.bandwidth||null,i=e.C.qa;return new Jr((function(){var e=zr(t,n,null,r,null);return Gt(i,[e])}),0,null)}(e),a=Wr(e,mi),o=$r(e,mi,"media"),s=$r(e,mi,"index");if(o=(a={Z:a.Z,timescale:a.timescale,ab:a.ab,ma:a.ma,Dd:a.Dd,N:a.N,ad:o,Qb:s}).Qb?1:0,o+=a.N?1:0,0==(o+=a.Z?1:0))throw new me(2,4,4002);if(1!=o&&(a.Qb&&(a.N=null),a.Z=null),!a.Qb&&!a.ad)throw new me(2,4,4002);if(a.Qb){if("mp4"!=(n=e.C.mimeType.split("/")[1])&&"webm"!=n)throw new me(2,4,4006);if("webm"==n&&!i)throw new me(2,4,4005);r=zr(a.Qb,e.C.id,null,e.bandwidth||null,null),e=ci(e,t,i,r=Gt(e.C.qa,[r]),0,null,n,a.ma)}else a.Z?(r||(e.presentationTimeline.ed(a.Z),e.presentationTimeline.fd(e.T.start)),e=function(e,t){var n=e.T.duration,r=t.Z,i=t.ab,a=t.timescale,o=t.ad,s=e.bandwidth||null,l=e.C.id,u=e.C.qa;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(e){return 0>e||n&&e>=n?null:Math.floor(e/r)},getSegmentReference:function(e){var t=e*r,c=t+r;return n&&(c=Math.min(c,n)),0>c||n&&t>=n?null:new Qr(e,t,c,(function(){var n=zr(o,l,e+i,s,t*a);return Gt(u,[n])}),0,null)}}}(e,a)):(o=t=null,e.ka.id&&e.C.id&&(t=n[o=e.ka.id+","+e.C.id]),s=function(e,t){for(var n=[],r=0;r<t.N.length;r++){var i=r+t.ab;n.push(new Qr(i,t.N[r].start,t.N[r].end,function(e,t,n,r,i,a){return Gt(r,[e=zr(e,t,i,n,a)]).map((function(e){return e.toString()}))}.bind(null,t.ad,e.C.id,e.bandwidth||null,e.C.qa,i,t.N[r].xg+t.Dd),0,null))}return n}(e,a),r=!e.mb||!e.T.Zc,t?(r&&ti(new ei(s),e.T.duration),t.cd(s),n=e.presentationTimeline.Ob(),t.Lc(n-e.T.start)):(e.presentationTimeline.vb(s,e.T.start),t=new ei(s),o&&e.mb&&(n[o]=t)),r&&ti(t,e.T.duration),e={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:t.find.bind(t),getSegmentReference:t.get.bind(t)});return{createSegmentIndex:e.createSegmentIndex,findSegmentPosition:e.findSegmentPosition,getSegmentReference:e.getSegmentReference,initSegmentReference:i,ma:a.ma}}function mi(e){return e.Wb}V("shaka.media.InitSegmentReference",Jr),Jr.prototype.Ic=function(){return this.c()},Jr.prototype.createUris=Jr.prototype.Ic,Jr.prototype.Uc=function(){return this.b},Jr.prototype.getStartByte=Jr.prototype.Uc,Jr.prototype.Tc=function(){return this.a},Jr.prototype.getEndByte=Jr.prototype.Tc,V("shaka.media.SegmentReference",Qr),Qr.prototype.ca=function(){return this.position},Qr.prototype.getPosition=Qr.prototype.ca,Qr.prototype.kc=function(){return this.startTime},Qr.prototype.getStartTime=Qr.prototype.kc,Qr.prototype.Te=function(){return this.endTime},Qr.prototype.getEndTime=Qr.prototype.Te,Qr.prototype.Ic=function(){return this.c()},Qr.prototype.createUris=Qr.prototype.Ic,Qr.prototype.Uc=function(){return this.b},Qr.prototype.getStartByte=Qr.prototype.Uc,Qr.prototype.Tc=function(){return this.a},Qr.prototype.getEndByte=Qr.prototype.Tc,V("shaka.media.SegmentIndex",ei),ei.prototype.destroy=function(){return this.a=null,Promise.resolve()},ei.prototype.destroy=ei.prototype.destroy,ei.prototype.find=function(e){for(var t=this.a.length-1;0<=t;--t){var n=this.a[t];if(e>=n.startTime&&e<n.endTime)return n.position}return this.a.length&&e<this.a[0].startTime?this.a[0].position:null},ei.prototype.find=ei.prototype.find,ei.prototype.get=function(e){return 0==this.a.length||0>(e-=this.a[0].position)||e>=this.a.length?null:this.a[e]},ei.prototype.get=ei.prototype.get,ei.prototype.offset=function(e){for(var t=0;t<this.a.length;++t)this.a[t].startTime+=e,this.a[t].endTime+=e},ei.prototype.offset=ei.prototype.offset,ei.prototype.cd=function(e){for(var t=[],n=0,r=0;n<this.a.length&&r<e.length;){var i=this.a[n],a=e[r];i.startTime<a.startTime?(t.push(i),n++):(i.startTime>a.startTime?0==n&&t.push(a):(.1<Math.abs(i.endTime-a.endTime)?t.push(new Qr(i.position,a.startTime,a.endTime,a.c,a.b,a.a)):t.push(i),n++),r++)}for(;n<this.a.length;)t.push(this.a[n++]);if(t.length)for(n=t[t.length-1].position+1;r<e.length;)i=new Qr(n++,(i=e[r++]).startTime,i.endTime,i.c,i.b,i.a),t.push(i);else t=e;this.a=t},ei.prototype.merge=ei.prototype.cd,ei.prototype.Lc=function(e){for(var t=0;t<this.a.length;++t)if(this.a[t].endTime>e)return void this.a.splice(0,t);this.a=[]},ei.prototype.evict=ei.prototype.Lc,ni.prototype.ua=function(){return this.a.ua()},si.prototype.parse=function(e,t,n,r){var i;if(440786851!=ri(t=new ni(new DataView(t))).id)throw new me(2,3,3008);var a=ri(t);if(408125543!=a.id)throw new me(2,3,3009);for(t=a.a.byteOffset,a=new ni(a.a),i=null;a.ua();){var o=ri(a);if(357149030==o.id){i=o;break}}if(!i)throw new me(2,3,3010);for(a=new ni(i.a),i=1e6,o=null;a.ua();){var s=ri(a);if(2807729==s.id)i=oi(s);else if(17545==s.id)if(4==(o=s).a.byteLength)o=o.a.getFloat32(0);else{if(8!=o.a.byteLength)throw new me(2,3,3003);o=o.a.getFloat64(0)}}if(null==o)throw new me(2,3,3011);if(i=o*(a=i/1e9),475249515!=(e=ri(new ni(new DataView(e)))).id)throw new me(2,3,3007);return function(e,t,n,r,i,a){function o(){return i}var s=[];e=new ni(e.a);for(var l=null,u=null;e.ua();){var c=ri(e);if(187==c.id){var d=li(c);d&&(c=n*d.yg,d=t+d.Vf,null!=l&&s.push(new Qr(s.length,l-a,c-a,o,u,d-1)),l=c,u=d)}}return null!=l&&s.push(new Qr(s.length,l-a,r-a,o,u,null)),s}(e,t,a,i,n,r)};var gi={zb:{},Sb:{},pd:function(e,t){gi.Sb[e]=t}};function yi(e,t,n){this.f=e,this.vc=t,this.h=this.g=1/0,this.a=1,this.b=this.c=null,this.l=0,this.m=!0,this.i=0,this.s=void 0===n||n}function vi(e,t,n,r){return e=Me(e,r),0==t&&null==n||(e.headers.Range=n?"bytes="+t+"-"+n:"bytes="+t+"-"),e}function bi(){var e=this;this.b=this.a=null,this.f=[],this.c=null,this.l=[],this.h=1,this.m={},this.s=0,this.u=new H(5),this.i=new fe((function(){!function(e){p((function t(){var n,r;return M(t,(function(t){switch(t.j){case 1:return n=0,k(t,2),w(t,_i(e),4);case 4:n=t.o,x(t,3);break;case 2:r=R(t),e.b&&(r.severity=1,e.b.onError(r));case 3:if(!e.b)return t.return();wi(e,n),S(t)}}))}))}(e)})),this.g=new Ie}function _i(e){var t=Date.now(),n=e.b.networkingEngine.request(0,Me(e.f,e.a.retryParameters));return Pe(e.g,n),n.promise.then((function(t){if(e.b)return t.uri&&!e.f.includes(t.uri)&&e.f.unshift(t.uri),function(e,t,n){if(!(t=Br.ge(t,"MPD")))throw new me(2,4,4001,n);return t=Xr(t,e.a.retryParameters,e.a.dash.xlinkFailGracefully,n,e.b.networkingEngine),Pe(e.g,t),t.promise.then((function(t){return function(e,t,n){return p((function r(){var i,a,o,s,l,u,c,d,f,h,p,m,g,y,v,b,_,A,E,T,k,C,x,R;return M(r,(function(r){switch(r.j){case 1:s=Vt,u=[n],0<(c=(l=Br).P(t,"Location").map(l.ic).filter(s.Ia)).length&&(d=Gt(u,c),u=e.f=d),f=l.P(t,"BaseURL").map(l.ic),h=Gt(u,f),p=e.a.dash.ignoreMinBufferTime,m=0,p||(m=l.I(t,"minBufferTime",l.Ea)),e.s=l.I(t,"minimumUpdatePeriod",l.Ea,-1),g=l.I(t,"availabilityStartTime",l.Of),y=l.I(t,"timeShiftBufferDepth",l.Ea),v=l.I(t,"maxSegmentDuration",l.Ea),b=t.getAttribute("type")||"static",_=e.a.dash.ignoreSuggestedPresentationDelay,A=null,_||(A=l.I(t,"suggestedPresentationDelay",l.Ea)),e.c?E=e.c.presentationTimeline:(T=Math.max(e.a.dash.defaultPresentationDelay,1.5*m),E=new yi(g,null!=A?A:T,e.a.dash.autoCorrectDrift));for(var L={mb:"static"!=b,presentationTimeline:E,ka:null,T:null,aa:null,C:null,bandwidth:0,Vd:!1},I=h,P=Br.I(t,"mediaPresentationDuration",Br.Ea),j=[],O=0,D=Br.P(t,"Period"),M=0;M<D.length;M++){var N=D[M];O=Br.I(N,"start",Br.Ea,O);var U=Br.I(N,"duration",Br.Ea),F=null;if(M!=D.length-1){var B=Br.I(D[M+1],"start",Br.Ea);null!=B&&(F=B-O)}else null!=P&&(F=P-O);if(null==F&&(F=U),N=Ai(e,L,I,{start:O,duration:F,node:N,Zc:null==F||M==D.length-1}),j.push(N),U=L.ka.id,e.l.includes(U)||(e.l.push(U),e.c&&(e.b.filterNewPeriod(N),e.c.periods.push(N))),null==F){O=null;break}O+=F}if(null==e.c&&e.b.filterAllPeriods(j),null!=P?(i=j,a=P,o=!1):(i=j,a=O,o=!0),k=a,C=i,E.Xb("static"==b),"static"!=b&&o||E.xa(k||1/0),E.V()&&!isNaN(e.a.availabilityWindowOverride)&&(y=e.a.availabilityWindowOverride),null==y&&(y=1/0),E.xd(y),E.ed(v||1),e.c){r.A(0);break}if(e.c={presentationTimeline:E,periods:C,offlineSessionIds:[],minBufferTime:m||0},!E.ue()){r.A(0);break}return x=l.P(t,"UTCTiming"),w(r,function(e,t,n){n=n.map((function(e){return{scheme:e.getAttribute("schemeIdUri"),value:e.getAttribute("value")}}));var r=e.a.dash.clockSyncUri;return!n.length&&r&&n.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:r}),Vt.Ke(n,function(e){var n=e.scheme;switch(e=e.value,n){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":return ki(this,t,e,"HEAD");case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":return ki(this,t,e,"GET");case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":return n=Date.parse(e),isNaN(n)?0:n-Date.now();case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":return q("NTP UTCTiming scheme is not supported"),Promise.reject();default:return q("Unrecognized scheme in UTCTiming element",n),Promise.reject()}}.bind(e)).catch((function(){return q("A UTCTiming element should always be given in live manifests! This content may not play on clients with bad clocks!"),0}))}(e,h,x),4);case 4:if(R=r.o,!e.b)return r.return();E.pe(R),S(r)}}))}))}(e,t,n)}))}(e,t.data,t.uri)})).then((function(){var n=(Date.now()-t)/1e3;return Y(e.u,1,n),n}))}function Ai(e,t,n,r){if(t.ka=Si(r.node,null,n),t.T=r,t.ka.id||(t.ka.id="__shaka_period_"+r.start),Br.P(r.node,"EventStream").forEach(e.Pf.bind(e,r.start,r.duration)),n=Br.P(r.node,"AdaptationSet").map(e.Nf.bind(e,t)).filter(Vt.Ia),t.mb){t=[];for(var i=f(n),a=i.next();!a.done;a=i.next())for(var o=(a=f(a.value.Yf)).next();!o.done;o=a.next())t.push(o.value);if(t.length!=new Set(t).size)throw new me(2,4,4018)}var s=n.filter((function(e){return!e.Bd}));if(n.filter((function(e){return e.Bd})).forEach((function(e){var t=e.streams[0],n=e.Bd;s.forEach((function(e){e.id==n&&e.streams.forEach((function(e){e.trickModeVideo=t}))}))})),t=Ei(s,"video"),i=Ei(s,"audio"),!t.length&&!i.length)throw new me(2,4,4004);for(n=e.a.disableAudio,i.length&&!n||(i=[null]),n=e.a.disableVideo,t.length&&!n||(t=[null]),n=[],a=0;a<i.length;a++)for(o=0;o<t.length;o++)Ti(e,i[a],t[o],n);if(t=[],!e.a.disableText)for(e=Ei(s,"text"),i=0;i<e.length;i++)t.push.apply(t,e[i].streams);return{startTime:r.start,textStreams:t,variants:n}}function Ei(e,t){return e.filter((function(e){return e.contentType==t}))}function Ti(e,t,n,r){if(t||n)if(t&&n){var i=t.drmInfos,a=n.drmInfos;if(!i.length||!a.length||0<Lt(i,a).length){a=Lt(t.drmInfos,n.drmInfos);for(var o=0;o<t.streams.length;o++)for(var s=0;s<n.streams.length;s++)i=(n.streams[s].bandwidth||0)+(t.streams[o].bandwidth||0),i={id:e.h++,language:t.language,primary:t.$c||n.$c,audio:t.streams[o],video:n.streams[s],bandwidth:i,drmInfos:a,allowedByApplication:!0,allowedByKeySystem:!0},r.push(i)}}else for(a=t||n,o=0;o<a.streams.length;o++)i=a.streams[o].bandwidth||0,i={id:e.h++,language:a.language||"und",primary:a.$c,audio:t?a.streams[o]:null,video:n?a.streams[o]:null,bandwidth:i,drmInfos:a.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},r.push(i)}function wi(e,t){0>e.s||e.i.R(Math.max(3,e.s-t,z(e.u)))}function Si(e,t,n){t=t||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,gd:null,audioSamplingRate:null},n=n||t.qa;var r=Br.yb,i=Br.Me,a=Br.P(e,"BaseURL").map(Br.ic),o=e.getAttribute("contentType")||t.contentType,s=e.getAttribute("mimeType")||t.mimeType,l=e.getAttribute("codecs")||t.codecs;i=Br.I(e,"frameRate",i)||t.frameRate;for(var u=e.getAttribute("par")||t.pixelAspectRatio,c=Br.P(e,"InbandEventStream"),d=t.emsgSchemeIdUris.slice(),h=(c=f(c)).next();!h.done;h=c.next())h=h.value.getAttribute("schemeIdUri"),d.includes(h)||d.push(h);return c=function(e){for(var t=0;t<e.length;++t){var n=e[t],r=n.getAttribute("schemeIdUri");if(r&&(n=n.getAttribute("value")))switch(r){case"urn:mpeg:dash:outputChannelPositionList:2012":return n.trim().split(/ +/).length;case"urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case"urn:dts:dash:audio_channel_configuration:2012":if(!(r=parseInt(n,10)))continue;return r;case"tag:dolby.com,2014:dash:audio_channel_configuration:2011":case"urn:dolby:dash:audio_channel_configuration:2011":if(r=parseInt(n,16)){for(e=0;r;)1&r&&++e,r>>=1;return e}}}return null}(c=Br.P(e,"AudioChannelConfiguration"))||t.gd,h=Br.I(e,"audioSamplingRate",r)||t.audioSamplingRate,o||(o=Ci(s,l)),{qa:Gt(n,a),Ub:Br.gc(e,"SegmentBase")||t.Ub,La:Br.gc(e,"SegmentList")||t.La,Wb:Br.gc(e,"SegmentTemplate")||t.Wb,width:Br.I(e,"width",r)||t.width,height:Br.I(e,"height",r)||t.height,contentType:o,mimeType:s,codecs:l,frameRate:i,pixelAspectRatio:u,emsgSchemeIdUris:d,id:e.getAttribute("id"),gd:c,audioSamplingRate:h}}function ki(e,t,n,r){return(t=Me(t=Gt(t,[n]),e.a.retryParameters)).method=r,t=e.b.networkingEngine.request(4,t),Pe(e.g,t),t.promise.then((function(e){if("HEAD"==r){if(!e.headers||!e.headers.date)return 0;e=e.headers.date}else e=ot(e.data);return e=Date.parse(e),isNaN(e)?0:e-Date.now()}))}function Ci(e,t){return mn(qe(e,t))?"text":e.split("/")[0]}function xi(e,t,n,r){this.b=e,this.type=t,this.a=n,this.segments=r||null}function Ri(e,t,n,r){this.id=e,this.name=t,this.a=n,this.value=void 0===r?null:r}function Li(e,t){this.name=e,this.value=t}function Ii(e,t,n){return(e=e.getAttribute(t))?e.value:n||null}function Pi(e,t){this.b=t,this.a=e}V("shaka.media.ManifestParser.registerParserByExtension",gi.pd),gi.Cb=function(e,t){gi.zb[e]=t},V("shaka.media.ManifestParser.registerParserByMime",gi.Cb),gi.Sf=function(){var e={};if(Qe()){for(var t in gi.zb)e[t]=!0;for(var n in gi.Sb)e[n]=!0}t={mpd:"application/dash+xml",m3u8:"application/x-mpegurl",ism:"application/vnd.ms-sstr+xml"};for(var r=(n=f(["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"])).next();!r.done;r=n.next())e[r=r.value]=Qe()?!!gi.zb[r]:Ze(r);for(var i in t)e[i]=Qe()?!!gi.Sb[i]:Ze(t[i]);return e},gi.create=function(e,t,n,r){return p((function i(){var a,o;return M(i,(function(i){switch(i.j){case 1:return k(i,2),w(i,gi.Ue(e,t,n,r),4);case 4:return a=i.o,i.return(new a);case 2:throw(o=R(i)).severity=2,o}}))}))},gi.Ue=function(e,t,n,r){return p((function i(){var a,o,s,l,u;return M(i,(function(i){switch(i.j){case 1:if(a=gi,r&&(o=a.zb[r.toLowerCase()]))return i.return(o);if((s=a.getExtension(e))&&(l=a.Sb[s]))return i.return(l);if(r){i.A(2);break}return w(i,a.bf(e,t,n),3);case 3:if((r=i.o)&&(u=gi.zb[r]))return i.return(u);case 2:throw new me(2,4,4e3,e)}}))}))},gi.bf=function(e,t,n){return p((function r(){var i,a,o;return M(r,(function(r){switch(r.j){case 1:return(i=Me([e],n)).method="HEAD",w(r,t.request(0,i).promise,2);case 2:return a=r.o,o=a.headers["content-type"],r.return(o?o.toLowerCase().split(";").shift():"")}}))}))},gi.getExtension=function(e){return 1==(e=new Q(e).ja.split("/").pop().split(".")).length?"":e.pop().toLowerCase()},gi.isSupported=function(e,t){return!!Qe()&&(t in gi.zb||gi.getExtension(e)in gi.Sb)},V("shaka.media.PresentationTimeline",yi),yi.prototype.Y=function(){return this.g},yi.prototype.getDuration=yi.prototype.Y,yi.prototype.$e=function(){return this.a},yi.prototype.getMaxSegmentDuration=yi.prototype.$e,yi.prototype.xa=function(e){this.g=e},yi.prototype.setDuration=yi.prototype.xa,yi.prototype.hf=function(){return this.f},yi.prototype.getPresentationStartTime=yi.prototype.hf,yi.prototype.pe=function(e){this.l=e},yi.prototype.setClockOffset=yi.prototype.pe,yi.prototype.Xb=function(e){this.m=e},yi.prototype.setStatic=yi.prototype.Xb,yi.prototype.xd=function(e){this.h=e},yi.prototype.setSegmentAvailabilityDuration=yi.prototype.xd,yi.prototype.ig=function(e){this.vc=e},yi.prototype.setDelay=yi.prototype.ig,yi.prototype.Se=function(){return this.vc},yi.prototype.getDelay=yi.prototype.Se,yi.prototype.vb=function(e,t){if(0!=e.length){var n=e[e.length-1].endTime+t;this.fd(e[0].startTime+t),this.a=e.reduce((function(e,t){return Math.max(e,t.endTime-t.startTime)}),this.a),this.b=Math.max(this.b,n),null!=this.f&&this.s&&(this.f=(Date.now()+this.l)/1e3-this.b-this.a)}},yi.prototype.notifySegments=yi.prototype.vb,yi.prototype.fd=function(e){this.c=null==this.c?e:Math.min(this.c,e)},yi.prototype.notifyMinSegmentStartTime=yi.prototype.fd,yi.prototype.ed=function(e){this.a=Math.max(this.a,e)},yi.prototype.notifyMaxSegmentDuration=yi.prototype.ed,yi.prototype.offset=function(e){null!=this.c&&(this.c+=e),null!=this.b&&(this.b+=e)},yi.prototype.offset=yi.prototype.offset,yi.prototype.V=function(){return 1/0==this.g&&!this.m},yi.prototype.isLive=yi.prototype.V,yi.prototype.Xa=function(){return 1/0!=this.g&&!this.m},yi.prototype.isInProgress=yi.prototype.Xa,yi.prototype.Ob=function(){if(1/0==this.h)return this.i;var e=this.pb()-this.h;return Math.max(this.i,e)},yi.prototype.getSegmentAvailabilityStart=yi.prototype.Ob,yi.prototype.qe=function(e){this.i=e},yi.prototype.setUserSeekStart=yi.prototype.qe,yi.prototype.pb=function(){return this.V()||this.Xa()?Math.min(Math.max(0,(Date.now()+this.l)/1e3-this.a-this.f),this.g):this.g},yi.prototype.getSegmentAvailabilityEnd=yi.prototype.pb,yi.prototype.Nb=function(e){var t=Math.max(this.c,this.i);if(1/0==this.h)return t;var n=this.pb()-this.h;return e=Math.min(n+e,this.Ca()),Math.max(t,e)},yi.prototype.getSafeSeekRangeStart=yi.prototype.Nb,yi.prototype.ob=function(){return this.Nb(0)},yi.prototype.getSeekRangeStart=yi.prototype.ob,yi.prototype.Ca=function(){var e=this.V()||this.Xa()?this.vc:0;return Math.max(0,this.pb()-e)},yi.prototype.getSeekRangeEnd=yi.prototype.Ca,yi.prototype.ue=function(){return!(null==this.f||null!=this.b&&this.s)},yi.prototype.usingPresentationStartTime=yi.prototype.ue,V("shaka.dash.DashParser",bi),(r=bi.prototype).configure=function(e){this.a=e},r.start=function(e,t){var n=this;return p((function r(){var i;return M(r,(function(r){switch(r.j){case 1:return n.f=[e],n.b=t,w(r,_i(n),2);case 2:if(i=r.o,n.b&&wi(n,i),!n.b)throw new me(2,7,7001);return r.return(n.c)}}))}))},r.stop=function(){return this.a=this.b=null,this.f=[],this.c=null,this.l=[],this.m={},null!=this.i&&(this.i.stop(),this.i=null),this.g.destroy()},r.update=function(){_i(this).catch(function(e){this.b&&this.b.onError(e)}.bind(this))},r.onExpirationUpdated=function(){},r.Nf=function(e,t){if(e.aa=Si(t,e.ka,null),"image"==e.aa.contentType)return null;var n=!1,r=Br.P(t,"Role"),i=r.map((function(e){return e.getAttribute("value")})).filter(Vt.Ia),a=void 0,o="text"==e.aa.contentType;o&&(a="subtitle");for(var s=0;s<r.length;s++){var l=r[s].getAttribute("schemeIdUri");if(null==l||"urn:mpeg:dash:role:2011"==l)switch(l=r[s].getAttribute("value"),l){case"main":n=!0;break;case"caption":case"subtitle":a=l}}var u=null,c=!1;Br.P(t,"EssentialProperty").forEach((function(e){"http://dashif.org/guidelines/trickmode"==e.getAttribute("schemeIdUri")?u=e.getAttribute("value"):c=!0})),s=Br.P(t,"Accessibility");var d=new Map;for(r={},l=(s=f(s)).next();!l.done;r={Ib:r.Ib},l=s.next()){var h=l.value;l=h.getAttribute("schemeIdUri"),h=h.getAttribute("value"),"urn:scte:dash:cc:cea-608:2015"==l||"urn:scte:dash:cc:cea-708:2015"==l?(r.Ib=1,null!=h?h.split(";").forEach(function(e){return function(t){if(t.includes("=")){var n=(t=t.split("="))[0].startsWith("CC")?t[0]:"CC"+t[0];t=t[1].split(",")[0].split(":").pop()}else n="CC"+e.Ib,e.Ib+=2;d.set(n,On(t))}}(r)):d.set("CC1","und")):"urn:mpeg:dash:role:2011"==l&&null!=h&&(i.push(h),"captions"==h&&(a="caption"))}if(c)return null;var p=Vr(r=Br.P(t,"ContentProtection"),this.a.dash.customScheme,this.a.dash.ignoreDrmInfo);if(r=On(t.getAttribute("lang")||"und"),s=t.getAttribute("label"),(l=Br.P(t,"Label"))&&l.length&&(l=l[0]).textContent&&(s=l.textContent),0==(i=(l=Br.P(t,"Representation")).map(this.Qf.bind(this,e,p,a,r,s,n,i,d)).filter((function(e){return!!e}))).length){if(this.a.dash.ignoreEmptyAdaptationSet||o)return null;throw new me(2,4,4003)}return e.aa.contentType&&"application"!=e.aa.contentType||(e.aa.contentType=Ci(i[0].mimeType,i[0].codecs),i.forEach((function(t){t.type=e.aa.contentType}))),i.forEach((function(e){p.drmInfos.forEach((function(t){e.keyId&&t.keyIds.push(e.keyId)}))})),o=l.map((function(e){return e.getAttribute("id")})).filter(Vt.Ia),{id:e.aa.id||"__fake__"+this.h++,contentType:e.aa.contentType,language:r,$c:n,streams:i,drmInfos:p.drmInfos,Bd:u,Yf:o}},r.Qf=function(e,t,n,r,i,a,o,s,l){if(e.C=Si(l,e.aa,null),!function(e){var t=e.Ub?1:0;return t+=e.La?1:0,0==(t+=e.Wb?1:0)?"text"==e.contentType||"application"==e.contentType:(1!=t&&(e.Ub&&(e.La=null),e.Wb=null),!0)}(e.C))return null;e.bandwidth=Br.I(l,"bandwidth",Br.tc)||0;var u=e.C.contentType;u="text"==u||"application"==u;try{var c=this.Zf.bind(this);if(e.C.Ub)var d=function(e,t){var n=Number($r(e,di,"presentationTimeOffset"))||0,r=$r(e,di,"timescale"),i=1;r&&(i=Br.tc(r)||1),n=n/i||0,r=ui(e,di);var a=e.C.contentType;if(i=e.C.mimeType.split("/")[1],"text"!=a&&"mp4"!=i&&"webm"!=i)throw new me(2,4,4006);if("webm"==i&&!r)throw new me(2,4,4005);a=qr(e,di,"RepresentationIndex");var o=$r(e,di,"indexRange"),s=e.C.qa;if(o=Br.uc(o||""),a){var l=a.getAttribute("sourceURL");l&&(s=Gt(e.C.qa,[l])),o=Br.I(a,"range",Br.uc,o)}if(!o)throw new me(2,4,4002);return{createSegmentIndex:(i=ci(e,t,r,s,o.start,o.end,i,n)).createSegmentIndex,findSegmentPosition:i.findSegmentPosition,getSegmentReference:i.getSegmentReference,initSegmentReference:r,ma:n}}(e,c);else if(e.C.La)d=fi(e,this.m);else if(e.C.Wb)d=pi(e,c,this.m,!!this.c);else{var f=e.C.qa,h=e.T.duration||0;d={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(e){return 0<=e&&e<h?1:null},getSegmentReference:function(e){return 1!=e?null:new Qr(1,0,h,(function(){return f}),0,null)},initSegmentReference:null,ma:0}}}catch(e){if(u&&4002==e.code)return null;throw e}return l=function(e,t,n,r){var i=Vr(e,t,r);if(n.Pd)e=1==n.drmInfos.length&&!n.drmInfos[0].keySystem,t=0==i.drmInfos.length,(0==n.drmInfos.length||e&&!t)&&(n.drmInfos=i.drmInfos),n.Pd=!1;else if(0<i.drmInfos.length&&(n.drmInfos=n.drmInfos.filter((function(e){return i.drmInfos.some((function(t){return t.keySystem==e.keySystem}))})),0==n.drmInfos.length))throw new me(2,4,4008);return i.Kd||n.Kd}(l=Br.P(l,"ContentProtection"),this.a.dash.customScheme,t,this.a.dash.ignoreDrmInfo),{id:this.h++,originalId:e.C.id,createSegmentIndex:d.createSegmentIndex,findSegmentPosition:d.findSegmentPosition,getSegmentReference:d.getSegmentReference,initSegmentReference:d.initSegmentReference,presentationTimeOffset:d.ma,mimeType:e.C.mimeType,codecs:e.C.codecs,frameRate:e.C.frameRate,pixelAspectRatio:e.C.pixelAspectRatio,bandwidth:e.bandwidth,width:e.C.width,height:e.C.height,kind:n,encrypted:0<t.drmInfos.length,keyId:l,language:r,label:i,type:e.aa.contentType,primary:a,trickModeVideo:null,emsgSchemeIdUris:e.C.emsgSchemeIdUris,roles:o,channelsCount:e.C.gd,audioSamplingRate:e.C.audioSamplingRate,closedCaptions:s}},r.Pf=function(e,t,n){var r=Br.yb,i=n.getAttribute("schemeIdUri")||"",a=n.getAttribute("value")||"",o=Br.I(n,"timescale",r)||1;Br.P(n,"Event").forEach(function(n){var s=Br.I(n,"presentationTime",r)||0,l=Br.I(n,"duration",r)||0;l=(s=s/o+e)+l/o,null!=t&&(s=Math.min(s,e+t),l=Math.min(l,e+t)),n={schemeIdUri:i,value:a,startTime:s,endTime:l,id:n.getAttribute("id")||"",eventElement:n},this.b.onTimelineRegionAdded(n)}.bind(this))},r.Zf=function(e,t,n){return e=vi(e,t,n,this.a.retryParameters),e=this.b.networkingEngine.request(1,e),Pe(this.g,e),e.promise.then((function(e){return e.data}))},gi.pd("mpd",bi),gi.Cb("application/dash+xml",bi),gi.Cb("video/vnd.mpeg.dash.mpd",bi),Ri.prototype.toString=function(){var e="#"+this.name,t=this.a?this.a.map((function(e){return e.name+"="+(isNaN(Number(e.value))?'"'+e.value+'"':e.value)})):[];return this.value&&t.unshift(this.value),0<t.length&&(e+=":"+t.join(",")),e},Ri.prototype.getAttribute=function(e){var t=this.a.filter((function(t){return t.name==e}));return t.length?t[0]:null};var ji={nb:function(e,t){return e.filter((function(e){return e.name==t}))},Ta:function(e,t){var n=ji.nb(e,t);return n.length?n[0]:null},Pc:function(e,t,n){return e.filter((function(e){var r=e.getAttribute("TYPE");return e=e.getAttribute("GROUP-ID"),r.value==t&&e.value==n}))},Hc:function(e,t){return Gt([e],[t])[0]},Yc:function(e){return/^#(?!EXT)/m.test(e)}};function Oi(e){this.b=e,this.a=0}function Di(e){Mi(e,/[ \t]+/gm)}function Mi(e,t){t.lastIndex=e.a;var n=t.exec(e.b);return n=null==n?null:{position:n.index,length:n[0].length,ag:n},e.a==e.b.length||null==n||n.position!=e.a?null:(e.a+=n.length,n.ag)}function Ni(e){return e.a==e.b.length?null:(e=Mi(e,/[^ \t\n]*/gm))?e[0]:null}function Ui(){this.a=0}function Fi(e,t,n){var r=(t=(t=ot(t)).replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim()).split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(r[0]))throw new me(2,4,4015);t=0;for(var i=1;i<r.length;i++)if(!ji.Yc(r[i])){var a=Ki(e,r[i]);if(--e.a,Vi.includes(a.name)){t=1;break}"EXT-X-STREAM-INF"==a.name&&(i+=1)}for(i=[],a=1;a<r.length;)if(ji.Yc(r[a]))a+=1;else{var o=Ki(e,r[a]);if(Gi.includes(o.name)){if(1!=t)throw new me(2,4,4017);return new xi(n,t,i,e=Bi(e,n,r=r.splice(a,r.length-a),i))}i.push(o),a+=1,"EXT-X-STREAM-INF"==o.name&&(o.a.push(new Li("URI",r[a])),a+=1)}return new xi(n,t,i)}function Bi(e,t,n,r){var i=[],a=[];return n.forEach((function(n){if(/^(#EXT)/.test(n))n=Ki(e,n),Vi.includes(n.name)?r.push(n):a.push(n);else{if(ji.Yc(n))return[];n=ji.Hc(t,n.trim()),i.push(new Pi(n,a)),a=[]}})),i}function Ki(e,t){var n=e.a++,r=t.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!r)throw new me(2,4,4016,t);var i,a=r[1],o=r[2];if(r=[],o){var s;(s=Mi(o=new Oi(o),/^([^,=]+)(?:,|$)/g))&&(i=s[1]);for(var l=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;s=Mi(o,l);)r.push(new Li(s[1],s[2]||s[3]))}return new Ri(n,a,r,i)}var Vi="EXT-X-TARGETDURATION EXT-X-MEDIA-SEQUENCE EXT-X-DISCONTINUITY-SEQUENCE EXT-X-PLAYLIST-TYPE EXT-X-MAP EXT-X-I-FRAMES-ONLY EXT-X-ENDLIST".split(" "),Gi="EXTINF EXT-X-BYTERANGE EXT-X-DISCONTINUITY EXT-X-PROGRAM-DATE-TIME EXT-X-KEY EXT-X-DATERANGE".split(" ");function Hi(e){try{var t=Hi.parse(e);return _e({uri:e,ld:e,data:t.data,headers:{"content-type":t.contentType}})}catch(e){return ve(e)}}function Yi(){var e=this;this.a=this.f=null,this.$=1,this.D=new Map,this.S=new Set,this.b=new Map,this.c=null,this.u="",this.s=new Ui,this.O=0,this.h=new fe((function(){!function(e){p((function t(){var n,r;return M(t,(function(t){switch(t.j){case 1:return e.f?(k(t,2),w(t,e.update(),4)):t.return();case 4:n=e.O,e.h.R(n),x(t,0);break;case 2:if(r=R(t),!e.f)return t.return();r.severity=1,e.f.onError(r),e.h.R(.1),S(t)}}))}))}(e)})),this.g=da,this.m=null,this.B=0,this.F=1/0,this.i=new Ie,this.K=[],this.l=new Map,this.W=!1}function zi(e,t){return p((function n(){var r,i,a,o,s,l,u,c,d,f;return M(n,(function(n){switch(n.j){case 1:return r=ji,i=fa,a=t.Ce,w(n,ua(e,Me([a],e.a.retryParameters),0),2);case 2:if(o=n.o,1!=(s=Fi(e.s,o.data,o.uri)).type)throw new me(2,4,4017);return u=(l=r.Ta(s.a,"EXT-X-MEDIA-SEQUENCE"))?Number(l.value):0,c=t.stream,w(n,ea(e,t.Bc,s,u,c.mimeType,c.codecs),3);case 3:d=n.o,t.Vb.a=d,f=d[d.length-1],r.Ta(s.a,"EXT-X-ENDLIST")&&(la(e,i.Qa),e.c.xa(f.endTime)),S(n)}}))}))}function Wi(e){e.forEach((function(e){if(e){var t=e.stream.codecs.split(",");t=t.filter((function(e){return"mp4a.40.34"!=e})),e.stream.codecs=t.join(",")}}))}function $i(e,t,n,r,i){return{id:e.$++,language:t?t.language:"und",primary:!!t&&t.primary||!!n&&n.primary,audio:t,video:n,bandwidth:r,drmInfos:i,allowedByApplication:!0,allowedByKeySystem:!0}}function qi(e,t,n){return p((function r(){var i,a,o,s,l,u,c,d,f;return M(r,(function(r){switch(r.j){case 1:if(i=ra(t,"URI"),e.b.has(i))return r.return(e.b.get(i));if(a=ra(t,"TYPE").toLowerCase(),o=Yt,"subtitles"==a&&(a=o.ra),s=On(Ii(t,"LANGUAGE","und")),l=Ii(t,"NAME"),u=t.getAttribute("DEFAULT"),c=t.getAttribute("AUTOSELECT"),d=Ii(t,"CHANNELS"),"audio"==a)if(d){var h=d.split("/")[0];h=parseInt(h,10)}else h=null;else h=null;return w(r,Xi(e,i,n,a,s,!!u||!!c,l,h,null),2);case 2:return f=r.o,e.b.has(i)?r.return(e.b.get(i)):null==f?r.return(null):(e.D.set(t.id,f),e.b.set(i,f),r.return(f))}}))}))}function Xi(e,t,n,r,i,a,o,s,l){return p((function u(){var c,d,h,m,g,y,v,b,_,A,E,T,S,C,L,I,P,j,O,D,N,U,F,B,K,V;return M(u,(function(u){switch(u.j){case 1:return d=(c=ji).Hc(e.u,t),w(u,ua(e,Me([d],e.a.retryParameters),0),2);case 2:if(h=u.o,d=h.uri,1!=(m=Fi(e.s,h.data,d)).type)throw new me(2,4,4017);g=[],m.segments.forEach((function(e){e=c.nb(e.b,"EXT-X-KEY"),g.push.apply(g,e)})),y=!1,v=[],b=null;for(var G=f(g),H=G.next();!H.done;H=G.next())if(_=H.value,"NONE"!=(A=ra(_,"METHOD"))){if(y=!0,"AES-128"==A)return e.W=!0,u.return(null);E=ra(_,"KEYFORMAT"),(S=(T=ca[E])?T(_):null)&&(S.keyIds.length&&(b=S.keyIds[0]),v.push(S))}if(y&&!v.length)throw new me(2,4,4026);return function(e,t){var n=fa,r=ji.Ta(t.a,"EXT-X-PLAYLIST-TYPE"),i=ji.Ta(t.a,"EXT-X-ENDLIST");i=r&&"VOD"==r.value||i,r=r&&"EVENT"==r.value&&!i,r=!i&&!r,i?la(e,n.Qa):(la(e,r?n.Fd:n.xe),n=ia(t.a,"EXT-X-TARGETDURATION"),n=Number(n.value),e.B=Math.max(n,e.B),e.F=Math.min(n,e.F))}(e,m),C=function(e,t){if(1==t.length)return t[0];var n=na(e,t);if(null!=n)return n;throw new me(2,4,4025,t)}(r,n),w(u,function(e,t,n,r){return p((function i(){var a,o,s,l,u,c,d,f,h;return M(i,(function(i){switch(i.j){case 1:return a=Yt,o=r.segments[0].a,s=new Q(o),l=s.ja.split(".").pop(),u=sa[t],(c=u[l])?i.return(c):t==a.ra?n&&"vtt"!=n?i.return("application/mp4"):i.return("text/vtt"):((d=Me([o],e.a.retryParameters)).method="HEAD",w(i,ua(e,d,1),2));case 2:if(f=i.o,!(h=f.headers["content-type"]))throw new me(2,4,4021,l);return i.return(h.split(";")[0])}}))}))}(e,r,C,m),3);case 3:return L=u.o,oa.includes(L)&&(C=""),P=(I=c.Ta(m.a,"EXT-X-MEDIA-SEQUENCE"))?Number(I.value):0,k(u,4),w(u,ea(e,t,m,P,L,C),6);case 6:j=u.o,x(u,5);break;case 4:if(4035==(O=R(u)).code)return q("Skipping unsupported HLS stream",L,t),u.return(null);throw O;case 5:return D=j[0].startTime,N=j[j.length-1].endTime,U=N-D,F=new ei(j),B=Ji(m),K=void 0,"text"==r&&(K="subtitle"),V={id:e.$++,originalId:o,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:F.find.bind(F),getSegmentReference:F.get.bind(F),initSegmentReference:B,presentationTimeOffset:0,mimeType:L,codecs:C,kind:K,encrypted:y,keyId:b,language:i,label:o,type:r,primary:a,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:void 0,pixelAspectRatio:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:s,audioSamplingRate:null,closedCaptions:l},u.return({stream:V,Vb:F,drmInfos:v,Bc:t,Ce:d,dd:D,Hg:N,duration:U})}}))}))}function Ji(e){var t=ji.nb(e.a,"EXT-X-MAP");if(!t.length)return null;if(1<t.length)throw new me(2,4,4020);var n=ra(t=t[0],"URI"),r=ji.Hc(e.b,n);return e=0,n=null,(t=Ii(t,"BYTERANGE"))&&(e=t.split("@"),t=Number(e[0]),n=(e=Number(e[1]))+t-1),new Jr((function(){return[r]}),e,n)}function Qi(e,t,n,r){var i=t.b,a=t.a;t=ia(i,"EXTINF").value.split(","),t=r+Number(t[0]);var o=0,s=null;return(i=ji.Ta(i,"EXT-X-BYTERANGE"))&&(o=i.value.split("@"),i=Number(o[0]),s=(o=o[1]?Number(o[1]):e.a+1)+i-1),new Qr(n,r,t,(function(){return[a]}),o,s)}function Zi(e){e.c&&(e.K.forEach((function(t){e.c.vb(t,0)})),e.K=[])}function ea(e,t,n,r,i,a){return p((function o(){var s,l,u,c,d,f,h,m,g,y;return M(o,(function(o){switch(o.j){case 1:return s=n.segments,l=[],u=s[0].a,c=Qi(null,s[0],r,0),d=Ji(n),w(o,function(e,t,n,r,i,a){return p((function o(){var s,l,u,c,d,f,h,p,m;return M(o,(function(o){switch(o.j){case 1:if(e.m&&(s=e.b.get(t),l=s.Vb,u=l.get(r.position)))return o.return(u.startTime);if(i=i.toLowerCase(),oa.includes(i))throw q("Raw formats are not yet supported. Skipping "+i),new me(1,4,4035);if("video/webm"==i)throw q("WebM in HLS is not yet supported. Skipping."),new me(1,4,4035);if("video/mp4"!=i&&"audio/mp4"!=i){o.A(2);break}return c=[ta(e,r)],n&&c.push(ta(e,n)),w(o,Promise.all(c),3);case 3:return d=o.o,f=d[0],h=d[1]||d[0],o.return(function(e,t,n,r){var i=0;if((new jr).H("moov",Or).H("trak",Or).H("mdia",Or).fa("mdhd",(function(e){e.reader.M(0==e.version?8:16),i=e.reader.G(),e.parser.stop()})).parse(r,!0),!i)throw new me(2,4,4030,e,t);var a=0,o=!1;if((new jr).H("moof",Or).H("traf",Or).fa("tfdt",(function(e){a=(0==e.version?e.reader.G():e.reader.Bb())/i,o=!0,e.parser.stop()})).parse(n,!0),!o)throw new me(2,4,4030,e,t);return a}(t,f.uri,f.data,h.data));case 2:if("video/mp2t"!=i){o.A(4);break}return w(o,ta(e,r),5);case 5:return p=o.o,o.return(function(e,t,n){function r(){throw new me(2,4,4030,e,t)}n=new Lr(new DataView(n),0);for(var i=0,a=0;;){if(i=n.ca(),71!=(a=n.la())&&r(),16384&n.Tb()||r(),0!=(a=(48&n.la())>>4)&&2!=a||r(),3==a&&(a=n.la(),n.M(a)),1==n.G()>>8)return n.M(3),0!=(i=n.la()>>6)&&1!=i||r(),0==n.la()&&r(),i=n.la(),a=n.Tb(),n=n.Tb(),(1073741824*((14&i)>>1)+((65534&a)<<14|(65534&n)>>1))/9e4;n.seek(i+188),71!=(a=n.la())&&(n.seek(i+192),a=n.la()),71!=a&&(n.seek(i+204),a=n.la()),71!=a&&r(),n.me(1)}}(t,p.uri,p.data));case 4:if("application/mp4"!=i&&!i.startsWith("text/")){o.A(6);break}return w(o,ta(e,r),7);case 7:return m=o.o,o.return(function(e,t,n){return mn(e=qe(e,t))?(gn(t=new hn(null),e),t.kc(n)):0}(i,a,m.data));case 6:throw new me(2,4,4030,t)}}))}))}(e,t,d,c,i,a),2);case 2:f=o.o,u.split("/").pop();for(var v=0;v<s.length;++v)h=s[v],m=l[l.length-1],g=0==v?f:m.endTime,y=Qi(m,h,r+v,g),l.push(y);return e.K.push(l),Zi(e),o.return(l)}}))}))}function ta(e,t){return p((function n(){var r,i,a,o,s,l;return M(n,(function(n){switch(n.j){case 1:return r=1,i=vi(t.c(),t.b,t.b+2048-1,e.a.retryParameters),a=vi(t.c(),t.b,t.a,e.a.retryParameters),k(n,2),w(n,ua(e,i,r),4);case 4:return o=n.o,n.return(o);case 2:if(7001==(s=R(n)).code)throw s;return q("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS preflights.",i.uris[0]),w(n,ua(e,a,r),5);case 5:return l=n.o,n.return(l)}}))}))}function na(e,t){for(var n=aa[e],r=0;r<n.length;r++)for(var i=0;i<t.length;i++)if(n[r].test(t[i].trim()))return t[i].trim();return"text"==e?"":null}function ra(e,t){var n=e.getAttribute(t);if(!n)throw new me(2,4,4023,t);return n.value}function ia(e,t){var n=ji.Ta(e,t);if(!n)throw new me(2,4,4024,t);return n}V("shaka.net.DataUriPlugin",Hi),Hi.parse=function(t){var n=t.split(":");if(2>n.length||"data"!=n[0])throw new me(2,1,1004,t);if(2>(n=n.slice(1).join(":").split(",")).length)throw new me(2,1,1004,t);var r=n[0];n=e.decodeURIComponent(n.slice(1).join(","));var i=null;if(1<(r=r.split(";")).length&&(i=r[1]),"base64"==i)t=ht.Ba(n).buffer;else{if(i)throw new me(2,1,1005,t);t=ut(n)}return{data:t,contentType:r[0]}},De("data",Hi),V("shaka.hls.HlsParser",Yi),(r=Yi.prototype).configure=function(e){this.a=e},r.start=function(e,t){var n=this;return p((function r(){var i,a;return M(r,(function(r){switch(r.j){case 1:return n.f=t,w(r,ua(n,Me([e],n.a.retryParameters),0),2);case 2:return i=r.o,n.u=i.uri,w(r,function(e,t){return p((function n(){var r,i,a,o,s,l,u,c,d,h,m;return M(n,(function(n){switch(n.j){case 1:if(0!=(r=Fi(e.s,t,e.u)).type)throw new me(2,4,4022);return w(n,function(e,t){return p((function n(){var r,i,a,o,s,l,u,c,d,h,m,g;return M(n,(function(n){switch(n.j){case 1:return r=ji,i=Vt,a=t.a,o=r.nb(t.a,"EXT-X-MEDIA"),s=o.filter(function(e){return"SUBTITLES"==ra(e,"TYPE")}.bind(e)),l=s.map(function(e){var t=this;return p((function n(){var r;return M(n,(function(n){switch(n.j){case 1:return t.a.disableText?n.return(null):(k(n,2),w(n,function(e,t){return p((function n(){var r;return M(n,(function(n){switch(n.j){case 1:return ra(t,"TYPE"),w(n,qi(e,t,[]),2);case 2:return r=n.o,n.return(r.stream)}}))}))}(t,e),4));case 4:return n.return(n.o);case 2:if(r=R(n),t.a.hls.ignoreTextStreamFailures)return n.return(null);throw r}}))}))}.bind(e)),u=o.filter((function(e){return"CLOSED-CAPTIONS"==ra(e,"TYPE")})),function(e,t){for(var n=f(t),r=n.next();!r.done;r=n.next()){ra(r=r.value,"TYPE");var i=Ii(r,"LANGUAGE")||"und";i=On(i);var a=ra(r,"GROUP-ID");r=ra(r,"INSTREAM-ID"),e.l.get(a)||e.l.set(a,new Map),e.l.get(a).set(r,i)}}(e,u),w(n,Promise.all(l),2);case 2:return c=n.o,d=r.nb(a,"EXT-X-STREAM-INF"),h=d.map(function(e){return function(e,t,n){return p((function r(){var i,a,o,s,l,u,c,d,h,m,g,y,v,b,_,A,E,T,S,k,C,x,R,L,I,P,j;return M(r,(function(r){switch(r.j){case 1:return i=Yt,a=ji,o=Ii(t,"CODECS","avc1.42E01E,mp4a.40.2"),s=function(e){for(var t=new Set,n=[],r=(e=f(e)).next();!r.done;r=e.next()){var i=Xe(r=r.value)[0];t.has(i)||(n.push(r),t.add(i))}return n}(o.split(/\s*,\s*/)),l=t.getAttribute("RESOLUTION"),c=u=null,d=Ii(t,"FRAME-RATE"),h=Number(ra(t,"BANDWIDTH")),l&&(m=l.value.split("x"),u=m[0],c=m[1]),g=(g=(g=a.nb(n.a,"EXT-X-MEDIA")).filter((function(e){return"CLOSED-CAPTIONS"!=ra(e,"TYPE")}))).filter((function(e){var t=Ii(e,"URI")||"";return"SUBTITLES"==(Ii(e,"TYPE")||"")||""!=t})),y=Ii(t,"AUDIO"),v=Ii(t,"VIDEO"),y?g=a.Pc(g,"AUDIO",y):v&&(g=a.Pc(g,"VIDEO",v)),(b=na(i.ra,s))&&((_=Ii(t,"SUBTITLES"))&&(A=a.Pc(g,"SUBTITLES",_)).length&&(E=e.D.get(A[0].id))&&(E.stream.codecs=b),Re(s,b)),T=g.map(function(e){return qi(this,e,s)}.bind(e)),S=[],k=[],w(r,Promise.all(T),2);case 2:if(x=(x=r.o).filter((function(e){return null!=e})),y?S=x:v&&(k=x),L=!1,S.length||k.length?S.length?(P=ra(t,"URI"),j=S[0].Bc,P==j?(R=i.Eb,L=!0):R=i.Pa):R=i.Eb:1==s.length?(I=na(i.Pa,s),R=l||d||I?i.Pa:i.Eb):(R=i.Pa,s=[s.join(",")]),L){r.A(3);break}return w(r,function(e,t,n,r){return p((function i(){var a,o,s,l,u;return M(i,(function(i){switch(i.j){case 1:return a=Yt,o=ra(t,"URI"),e.b.has(o)?i.return(e.b.get(o)):(s=Ii(t,"CLOSED-CAPTIONS"),l=null,r==a.Pa&&s&&"NONE"!=s&&(l=e.l.get(s)),w(i,Xi(e,o,n,r,"und",!1,null,null,l),2));case 2:return null==(u=i.o)?i.return(null):e.b.has(o)?i.return(e.b.get(o)):(e.b.set(o,u),i.return(u))}}))}))}(e,t,s,R),4);case 4:C=r.o;case 3:if(C)C.stream.type==i.Eb?S=[C]:k=[C];else if(null===C)return r.return([]);return k&&Wi(k),S&&Wi(S),r.return(function(e,t,n,r,i,a,o){n.forEach(function(e){(e=e.stream)&&(e.width=Number(i)||void 0,e.height=Number(a)||void 0,e.frameRate=Number(o)||void 0)}.bind(e));var s=!!e.a&&e.a.disableAudio;t.length&&!s||(t=[null]),s=!!e.a&&e.a.disableVideo,(!n.length||s)&&(n=[null]),s=[];for(var l=(t=f(t)).next();!l.done;l=t.next()){l=l.value;for(var u=f(n),c=u.next();!c.done;c=u.next()){var d=c.value;c=l?l.stream:null;var h=d?d.stream:null,p=l?l.drmInfos:null,m=d?d.drmInfos:null;d=(d?d.Bc:"")+" - "+(l?l.Bc:"");var g=void 0;if(c&&h){if(p.length&&m.length&&!(0<Lt(p,m).length))continue;g=Lt(p,m)}else c?g=p:h&&(g=m);e.S.has(d)||(c=$i(e,c,h,r,g),s.push(c),e.S.add(d))}}return s}(e,S,k,h,u,c,d))}}))}))}(this,e,t)}.bind(e)),w(n,Promise.all(h),3);case 3:return m=n.o,g=(g=m.reduce(i.Gc,[])).filter((function(e){return null!=e})),n.return({startTime:0,variants:g,textStreams:c.filter((function(e){return null!=e}))})}}))}))}(e,r),2);case 2:if(i=n.o,!e.f)throw new me(2,7,7001);if(e.W&&0==i.variants.length)throw new me(2,4,4034);e.f.filterAllPeriods([i]),a=1/0,o=0,s=1/0;for(var g=f(e.b.values()),y=g.next();!y.done;y=g.next())l=y.value,a=Math.min(a,l.dd),o=Math.max(o,l.dd),"text"!=l.stream.type&&(s=Math.min(s,l.duration));if(e.g!=fa.Qa?(e.c=new yi(0,3*e.B),e.c.Xb(!1)):(e.c=new yi(null,0),e.c.Xb(!0)),Zi(e),e.g!=fa.Qa){for(e.O=e.F,u=fa,e.g==u.Fd&&(c=e.c.vc,isNaN(e.a.availabilityWindowOverride)||(c=e.a.availabilityWindowOverride),e.c.xd(c)),d=0;95443.7176888889<=o;)d+=95443.7176888889,o-=95443.7176888889;if(d)for(y=(g=f(e.b.values())).next();!y.done;y=g.next())95443.7176888889>(h=y.value).dd&&(h.stream.presentationTimeOffset=-d,h.Vb.offset(d))}else for(e.c.xa(s),e.c.offset(-a),y=(g=f(e.b.values())).next();!y.done;y=g.next())(m=y.value).stream.presentationTimeOffset=a,m.Vb.offset(-a),ti(m.Vb,s);e.m={presentationTimeline:e.c,periods:[i],offlineSessionIds:[],minBufferTime:0},S(n)}}))}))}(n,i.data),3);case 3:return 0<(a=n.O)&&n.h.R(a),r.return(n.m)}}))}))},r.stop=function(){this.h&&(this.h.stop(),this.h=null);var e=[];return this.i&&(e.push(this.i.destroy()),this.i=null),this.a=this.f=null,this.D.clear(),this.S.clear(),this.b.clear(),this.m=null,Promise.all(e)},r.update=function(){if(this.g!=fa.Qa){for(var e=[],t=f(this.b.values()),n=t.next();!n.done;n=t.next())e.push(zi(this,n.value));return Promise.all(e)}},r.onExpirationUpdated=function(){};var aa={audio:[/^vorbis$/,/^opus$/,/^flac$/,/^mp4a/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]},oa=["audio/aac","audio/ac3","audio/ec3","audio/mpeg"],sa={audio:{mp4:"audio/mp4",m4s:"audio/mp4",m4i:"audio/mp4",m4a:"audio/mp4",ts:"video/mp2t",aac:"audio/aac",ac3:"audio/ac3",ec3:"audio/ec3",mp3:"audio/mpeg"},video:{mp4:"video/mp4",m4s:"video/mp4",m4i:"video/mp4",m4v:"video/mp4",ts:"video/mp2t"},text:{mp4:"application/mp4",m4s:"application/mp4",m4i:"application/mp4",vtt:"text/vtt",ttml:"application/ttml+xml"}};function la(e,t){e.g=t,e.c&&e.c.Xb(e.g==fa.Qa),e.g!=fa.Qa||e.h.stop()}function ua(e,t,n){if(!e.i)throw new me(2,7,7001);return t=e.f.networkingEngine.request(n,t),Pe(e.i,t),t.promise}var ca={"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(e){var t=ra(e,"METHOD");return Vn("HLS SAMPLE-AES-CENC","SAMPLE-AES-CENC will no longer be supported, see Issue #1227"),["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].includes(t)?(t=ra(e,"URI"),t=Hi.parse(t),t=Ht("com.widevine.alpha",[{initDataType:"cenc",initData:t=new Uint8Array(t.data)}]),(e=Ii(e,"KEYID"))&&(t.keyIds=[e.substr(2).toLowerCase()]),t):null}},da="VOD",fa={Qa:da,xe:"EVENT",Fd:"LIVE"};function ha(){this.a=new Map}function pa(e,t,n){ma(e,t).text=n}function ma(e,t){return e.a.has(t)||e.a.set(t,new ga),e.a.get(t)}function ga(){this.text=this.variant=null}function ya(e,t){this.a=e,this.b=new Set([e]);for(var n=f(t=t||[]),r=n.next();!r.done;r=n.next())this.add(r.value)}function va(e,t){var n;if(!(n=!!e.audio!=!!t.audio||!!e.video!=!!t.video||e.language!=t.language)&&(n=e.audio&&t.audio)){n=e.audio;var r=t.audio;n=!(n.channelsCount==r.channelsCount&&ba(n,r)&&_a(n.roles,r.roles))}return!n&&(n=e.video&&t.video)&&(n=!(ba(n=e.video,r=t.video)&&_a(n.roles,r.roles))),!n}function ba(e,t){if(e.mimeType!=t.mimeType)return!1;var n=e.codecs.split(",").map((function(e){return Xe(e)[0]})),r=t.codecs.split(",").map((function(e){return Xe(e)[0]}));if(n.length!=r.length)return!1;n.sort(),r.sort();for(var i=0;i<n.length;i++)if(n[i]!=r[i])return!1;return!0}function _a(e,t){var n=new Set(e),r=new Set(t);if(n.delete("main"),r.delete("main"),n.size!=r.size)return!1;for(var i=(n=f(n)).next();!i.done;i=n.next())if(!r.has(i.value))return!1;return!0}function Aa(e){this.a=e,this.b=new Ea(e.language,"",e.audio&&e.audio.channelsCount?e.audio.channelsCount:0,"")}function Ea(e,t,n,r,i){this.f=e,this.c=t,this.a=n,this.b=void 0===r?"":r,this.g=void 0===i?"":i}function Ta(){this.a=ka,this.b=(new Map).set(ka,2).set(Sa,1)}function wa(e,t,n){e.b.set(ka,n).set(Sa,t)}gi.pd("m3u8",Yi),gi.Cb("application/x-mpegurl",Yi),gi.Cb("application/vnd.apple.mpegurl",Yi),ya.prototype.add=function(e){return!!va(this.a,e)&&(this.b.add(e),!0)},ya.prototype.values=function(){return this.b.values()},Aa.prototype.create=function(e){var t=this,n=e.filter((function(e){return va(t.a,e)}));return n.length?new ya(n[0],n):this.b.create(e)},Ea.prototype.create=function(e){var t=[];t=function(e,t){var n=Mn(On(t),e.map((function(e){return Dn(e)})));return n?e.filter((function(e){return n==Dn(e)})):[]}(e,this.f);var n=e.filter((function(e){return e.primary}));for(t=t.length?t:n.length?n:e,this.c&&(e=function(e,t,n){return e.filter((function(e){if(n){var r=e[n];return r&&r.roles.includes(t)}return r=e.audio,e=e.video,r&&0<=r.roles.indexOf(t)||e&&0<=e.roles.indexOf(t)}))}(t,this.c,this.g)).length&&(t=e),this.a&&(e=Un.Nd(t,this.a)).length&&(t=e),this.b&&(e=function(e,t){return e.filter((function(e){return!!e.audio&&e.audio.label.toLowerCase()==t.toLowerCase()}))}(t,this.b)).length&&(t=e),e=new ya(t[0]),n=(t=f(t)).next();!n.done;n=t.next())n=n.value,va(e.a,n)&&e.add(n);return e};var Sa=0,ka=1;function Ca(e,t){this.g=e,this.h=Ra(e),this.a=e.a.currentTime,this.f=Date.now()/1e3,this.b=!1,this.i=t,this.c=function(){}}function xa(e){this.a=e}function Ra(e){if(e.a.paused||0==e.a.playbackRate||null==e.a.buffered)var t=!1;else e:{t=e.a.buffered,e=e.a.currentTime;for(var n=0;n<t.length;n++){var r=t.start(n),i=t.end(n);if(!(e<r||e>i-.5)){t=!0;break e}}t=!1}return t}function La(e,t,n,r,i){var a=this;this.a=e,this.u=t,this.s=n,this.l=i,this.f=new Be,this.i=!1,this.m=e.readyState,this.c=!1,this.b=r,this.h=!1,this.f.w(e,"waiting",(function(){return Ia(a)})),this.g=new fe((function(){Ia(a)})).Na(.25)}function Ia(e){if(0!=e.a.readyState){if(e.a.seeking){if(!e.i)return}else e.i=!1;if(!e.a.paused){e.a.readyState!=e.m&&(e.c=!1,e.m=e.a.readyState);var t=e.s.smallGapLimit,n=e.a.currentTime,r=e.a.buffered;e:{if(r&&r.length&&!(1==r.length&&1e-6>r.end(0)-r.start(0)))for(var i=nt("Edge/")||nt("Trident/")||nt("Tizen")||nt("CrKey")?.5:.1,a=0;a<r.length;a++)if(r.start(a)>n&&(0==a||r.end(a-1)-n<=i)){i=a;break e}i=null}if(null==i)e.b&&(n=Ra(r=(e=e.b).g),i=r.a.currentTime,a=Date.now()/1e3,e.a==i&&e.h==n||(e.f=a,e.a=i,e.h=n,e.b=!1),(i=a-e.f)>=e.i&&n&&!e.b&&(e.c(e.a,i),e.b=!0,e.a=r.a.currentTime));else if(0!=i||e.h){a=r.start(i);var o=e.u.Ca();if(!(a>=o)){t=(o=a-n)<=t;var s=!1;.001>o||(t||e.c||(e.c=!0,(n=new we("largegap",{currentTime:n,gapSize:o})).cancelable=!0,e.l(n),e.s.jumpLargeGaps&&!n.defaultPrevented&&(s=!0)),!t&&!s)||(0!=i&&r.end(i-1),e.a.currentTime=a)}}}}}function Pa(e){var t=this;this.c=e,this.a=new Set,this.b=new fe((function(){ja(t,!1)})).Na(.25)}function ja(e,t){for(var n=f(e.a),r=n.next();!r.done;r=n.next())r.value.g(e.c.currentTime,t)}function Oa(e){for(var t=[],n=(e=f(e)).next();!n.done;n=e.next())for(var r=(n=f(n.value.variants)).next();!r.done;r=n.next())t.push(r.value);return t}function Da(e,t){for(var n=null,r=f(e),i=r.next();!i.done;i=r.next())t>=(i=i.value).startTime&&(n=i);return n}function Ma(e){this.c=e,this.a=null,this.b=function(){}}function Na(e){var t=this;this.a=e,this.f=!1,this.c=this.a.jc(),this.b=new fe((function(){t.a.Yd(.25*t.c)}))}function Ua(e){e.b.stop();var t=e.f?0:e.c;if(0<=t)try{return void(e.a.jc()!=t&&e.a.wd(t))}catch(e){}e.b.Na(.25),0!=e.a.jc()&&e.a.wd(0)}function Fa(e,t,n){this.a=e,this.f=t,this.g=n,this.h=!1,this.b=new Be,this.c=new Ha(e),0<e.readyState?Va(this,n):Ka(this,n)}function Ba(e){return e.h?e.a.currentTime:e.g}function Ka(e,t){e.g=t,e.b.ea(e.a,"loadedmetadata"),e.b.da(e.a,"loadedmetadata",(function(){Va(e,t)}))}function Va(e,t){.001>Math.abs(e.a.currentTime-t)?Ga(e):(e.b.da(e.a,"seeking",(function(){Ga(e)})),Ya(e.c,0==e.a.currentTime?t:e.a.currentTime))}function Ga(e){e.h=!0,e.b.w(e.a,"seeking",(function(){return e.f()}))}function Ha(e){var t=this;this.b=e,this.h=10,this.g=this.f=this.c=0,this.a=new fe((function(){0>=t.c||t.b.currentTime!=t.f?t.a.stop():(t.b.currentTime=t.g,t.c--)}))}function Ya(e,t){e.f=e.b.currentTime,e.g=t,e.c=e.h,e.b.currentTime=t,e.a.Na(.1)}function za(e){function t(){null==n.c?n.f=!0:(n.b.da(n.a,"seeking",(function(){n.f=!0})),n.a.currentTime=Math.max(0,n.a.currentTime+n.c))}var n=this;this.a=e,this.f=!1,this.c=null,this.b=new Be,0==this.a.readyState?this.b.da(this.a,"loadeddata",t):t()}function Wa(e,t,n,r,i,a){var o=this;this.b=e,this.a=t.presentationTimeline,this.B=t.minBufferTime||0,this.g=n,this.u=i,this.l=null,this.f=new La(e,t.presentationTimeline,n,function(e,t){if(!t.stallEnabled)return null;var n=t.stallSkip,r=new Ca(new xa(e),t.stallThreshold);return function(e,t){e.c=t}(r,(function(){e.currentTime+=n})),r}(e,n),a),this.c=new Fa(e,(function(){var e=o.f;e.i=!0,e.h=!1,e.c=!1;var t=Ba(o.c);return e=qa(o,t),.001<Math.abs(e-t)&&(t=(new Date).getTime()/1e3,!o.l||o.l<t-1)?(o.l=t,0<(t=o.c).a.readyState?Ya(t.c,e):Ka(t,e),e=void 0):(o.u(),e=void 0),e}),function(e,t){return null==t?t=1/0>e.a.Y()?e.a.ob():e.a.Ca():0>t&&(t=e.a.Ca()+t),$a(e,Xa(e,t))}(this,r)),this.i=new fe((function(){if(0!=o.b.readyState&&!o.b.paused){var e=o.b.currentTime,t=o.a.ob(),n=o.a.Ca();3>n-t&&(t=n-3),e<t&&(e=qa(o,e),o.b.currentTime=e)}})).Na(.25)}function $a(e,t){var n=e.a.Y();return t>=n?n-e.g.durationBackoff:t}function qa(e,t){var n=Ft.bind(null,e.b.buffered),r=Math.max(e.B,e.g.rebufferingGoal),i=e.g.safeSeekOffset,a=e.a.ob(),o=e.a.Ca(),s=e.a.Y();3>o-a&&(a=o-3);var l=e.a.Nb(r),u=e.a.Nb(i);return r=e.a.Nb(r+i),t>=s?$a(e,t):t>o?o:t<a?n(u)?u:r:t>=l||n(t)?t:r}function Xa(e,t){var n=e.a.ob();return t<n||t>(n=e.a.Ca())?n:t}function Ja(){this.b=function(){},this.a=new Set}function Qa(e){var t=this;this.h=e,this.f=new Map,this.a=function(){},this.b=function(){},this.c=function(){},this.i=[{eb:null,cb:eo,Wa:function(e,n){return t.a(e,n)}},{eb:Za,cb:eo,Wa:function(e,n){return t.a(e,n)}},{eb:to,cb:eo,Wa:function(e,n){return t.a(e,n)}},{eb:eo,cb:Za,Wa:function(e,n){return t.b(e,n)}},{eb:eo,cb:to,Wa:function(e,n){return t.b(e,n)}},{eb:Za,cb:to,Wa:function(e,n){return t.c(e,n)}},{eb:to,cb:Za,Wa:function(e,n){return t.c(e,n)}}]}Ca.prototype.release=function(){this.g=null,this.c=function(){}},La.prototype.release=function(){this.f&&(this.f.release(),this.f=null),null!=this.g&&(this.g.stop(),this.g=null),this.b&&(this.b.release(),this.b=null),this.a=this.u=this.l=null},La.prototype.jd=function(){this.h=!0,Ia(this)},Pa.prototype.release=function(){this.b.stop();for(var e=f(this.a),t=e.next();!t.done;t=e.next())t.value.release();this.a.clear()},Ma.prototype.release=function(){this.a=this.c=null,this.b=function(){}},Ma.prototype.g=function(e){var t=this.a,n=this.c.periods;t!=(e=Da(n,e)||n[0])&&this.b(e),this.a=e},Na.prototype.release=function(){this.b&&(this.b.stop(),this.b=null),this.a=null},Na.prototype.set=function(e){this.c=e,Ua(this)},Fa.prototype.release=function(){this.b&&(this.b.release(),this.b=null),null!=this.c&&(this.c.release(),this.c=null),this.f=function(){},this.a=null},Ha.prototype.release=function(){this.a&&(this.a.stop(),this.a=null),this.b=null},za.prototype.release=function(){this.b&&(this.b.release(),this.b=null),this.a=null},za.prototype.m=function(e){this.c=this.f?this.c:e},za.prototype.h=function(){return(this.f?this.a.currentTime:this.c)||0},za.prototype.s=function(){},Wa.prototype.release=function(){this.c&&(this.c.release(),this.c=null),this.f&&(this.f.release(),this.f=null),this.i&&(this.i.stop(),this.i=null),this.b=this.c=this.a=this.g=null,this.u=function(){}},Wa.prototype.m=function(e){var t=this.c;0<t.a.readyState?Ya(t.c,e):Ka(t,e)},Wa.prototype.h=function(){var e=Ba(this.c);return 0<this.b.readyState&&!this.b.paused?Xa(this,e):e},Wa.prototype.s=function(){this.f.jd()},Ja.prototype.release=function(){this.b=function(){},this.a.clear()},Qa.prototype.release=function(){this.h=null,this.f.clear(),this.a=function(){},this.b=function(){},this.c=function(){}},Qa.prototype.g=function(e,t){for(var n=f(this.h.a),r=n.next();!r.done;r=n.next()){r=r.value;var i=this.f.get(r),a=e<r.startTime?Za:e>r.endTime?to:eo;this.f.set(r,a);for(var o=f(this.i),s=o.next();!s.done;s=o.next())(s=s.value).eb==i&&s.cb==a&&s.Wa(r,t)}};var Za=1,eo=2,to=3;function no(e,t){this.a=t,this.c=e,this.g=null,this.l=1,this.u=Promise.resolve(),this.h=[],this.i=new Map,this.b=new Map,this.s=!1,this.F=null,this.D=this.f=this.m=!1,this.B=0}function ro(e){return ao(e,"audio")}function io(e){return ao(e,"video")}function ao(e,t){var n=e.b.get(t);return n?n.Ka||n.stream:null}function oo(e,t){return p((function n(){var r,i,a,o,s,l,u,c,d;return M(n,(function(n){switch(n.j){case 1:return r=Yt,w(n,xn(e.a.L,r.ra),2);case 2:return e.B++,e.D=!1,i=e.B,a=e.a.L,o=new Map,s=new Set,o.set(r.ra,t),s.add(t),w(n,a.init(o,!1),3);case 3:return e.f?n.return():w(n,mo(e,s),4);case 4:if(e.f)return n.return();l=e.a.L.g.isTextVisible()||e.g.alwaysStreamText,e.B!=i||e.b.has(r.ra)||e.D||!l||(u=e.a.Ua(),c=Eo(e,u),d=ho(t,c,0),e.b.set(r.ra,d),ko(e,d,0)),S(n)}}))}))}function so(e,t){var n=e.b.get("video");if(n){var r=n.stream;if(r)if(t){var i=r.trickModeVideo;i&&!n.Ka&&(uo(e,i,!1,0,!1),n.Ka=r)}else(r=n.Ka)&&(n.Ka=null,uo(e,r,!0,0,!1))}}function lo(e,t,n,r){var i=!1;if(t.video){var a=uo(e,t.video,n,r,!1);i=i||a}return t.audio&&(e=uo(e,t.audio,n,r,!1),i=i||e),i}function uo(e,t,n,r,i){var a=e.b.get(t.type);if(!a&&"text"==t.type&&e.g.ignoreTextStreamFailures)return oo(e,t),!0;if(!a)return!1;var o=To(e,t),s=Array.from(e.b.values()).every((function(e){return e.ia==a.ia}));return n&&o!=a.ia&&s?(e.b.forEach((function(t){co(e,t)})),!0):(a.Ka&&(t.trickModeVideo?(a.Ka=t,t=t.trickModeVideo):a.Ka=null),!(!(s=e.h[o])||!s.Db||!(s=e.i.get(t.id))||!s.Db||a.stream==t&&!i||("text"==t.type&&An(e.a.L,qe(t.mimeType,t.codecs)),a.stream=t,a.nc=!0,function(e,t,n){if(!t.Rb)return!1;var r=e.a.Ua(),i=wn(e.a.L,t.type),a=vo(e,t,r,i,n);return n=a&&a.a?a.a-a.b:null,a&&!n&&(n=(a.endTime-a.kc())*t.stream.bandwidth/8),!isNaN(n)&&((a=t.stream.initSegmentReference)&&(n+=(a.a?a.a-a.b:null)||0),a=e.a.getBandwidthEstimate(),8*n/a<i-r-Math.max(e.c.minBufferTime||0,e.g.rebufferingGoal)||t.Rb.b.a>n)}(e,a,o)&&a.Rb.abort(),n&&(a.Ra?a.Cc=!0:a.Ja?(a.Oa=!0,a.dc=r,a.Cc=!0):(Co(a),So(e,a,!0,r).catch((function(t){e.a&&e.a.onError(t)})))),0)))}function co(e,t){t.Ra||t.Oa||(t.Ja?(t.Oa=!0,t.dc=0):null==Tn(e.a.L,t.type)?null==t.Ga&&ko(e,t,0):(Co(t),So(e,t,!1,0).catch((function(t){e.a&&e.a.onError(t)}))))}function fo(e,t,n,r,i){return p((function a(){var o,s,l,u,c,d,f;return M(a,(function(a){switch(a.j){case 1:return o=e.a.Ua(),s=Eo(e,o),l=Yt,u=new Map,c=new Set,t&&(u.set(l.Eb,t),c.add(t)),n&&(u.set(l.Pa,n),c.add(n)),r&&(u.set(l.ra,r),c.add(r)),d=e.a.L,f=e.g.forceTransmuxTS,w(a,d.init(u,f),2);case 2:return e.f?a.return():(function(e){var t=e.c.presentationTimeline.Y();1/0>t?e.a.L.xa(t):e.a.L.xa(Math.pow(2,32))}(e),w(a,mo(e,c),3));case 3:if(e.f)return a.return();u.forEach((function(t,n){if(!e.b.has(n)){var r=ho(t,s,i);e.b.set(n,r),ko(e,r,0)}})),S(a)}}))}))}function ho(e,t,n){return{stream:e,type:e.type,sb:null,Da:null,Ka:null,nc:!0,ia:t,endOfStream:!1,Ja:!1,Ga:null,Oa:!1,dc:0,Cc:!1,Ra:!1,od:!1,Pb:!1,rd:n||0,Rb:null}}function po(e,t){var n=e.h[t];if(n)return n.promise;n={promise:new ge,Db:!1},e.h[t]=n;for(var r=new Set,i=f(e.c.periods[t].variants),a=i.next();!a.done;a=i.next())(a=a.value).video&&r.add(a.video),a.video&&a.video.trickModeVideo&&r.add(a.video.trickModeVideo),a.audio&&r.add(a.audio);for(a=(i=f(e.c.periods[t].textStreams)).next();!a.done;a=i.next())r.add(a.value);return e.u=e.u.then(function(){if(!this.f)return mo(this,r)}.bind(e)).then(function(){this.f||(this.h[t].promise.resolve(),this.h[t].Db=!0)}.bind(e)).catch(function(e){this.f||(this.h[t].promise.catch((function(){})),this.h[t].promise.reject(),delete this.h[t],this.a.onError(e))}.bind(e)),n.promise}function mo(e,t){return p((function n(){var r,i,a,o,s,l,u;return M(n,(function(n){switch(n.j){case 1:r=[];for(var c=f(t),d=c.next();!d.done;d=c.next())i=d.value,(a=e.i.get(i.id))?r.push(a.promise):(e.i.set(i.id,{promise:new ge,Db:!1}),r.push(i.createSegmentIndex()));return k(n,2),w(n,Promise.all(r),4);case 4:if(e.f)return n.return();x(n,3);break;case 2:if(o=R(n),e.f)return n.return();for(d=(n=f(t)).next();!d.done;d=n.next())s=d.value,e.i.get(s.id).promise.catch((function(){})),e.i.get(s.id).promise.reject(),e.i.delete(s.id);throw o;case 3:for(d=(c=f(t)).next();!d.done;d=c.next())l=d.value,(u=e.i.get(l.id)).Db||(u.promise.resolve(),u.Db=!0);S(n)}}))}))}function go(e,t){if(!e.f&&!t.Ja&&null!=t.Ga&&!t.Ra)if(t.Ga=null,t.Oa)So(e,t,t.Cc,t.dc);else{try{var n=function(e,t){if(_o(t))return Cn(e.a.L,t.stream.originalId||""),null;var n=e.a.Ua(),r=yo(e,t,n),i=To(e,t.stream),a=Eo(e,r),o=function(e,t,n){return"text"==t?null==(e=e.a).b||e.b<n?0:e.b-Math.max(n,e.a):Bt(e=Sn(e,t),n)}(e.a.L,t.type,n),s=Math.max(e.c.minBufferTime||0,e.g.rebufferingGoal,e.g.bufferingGoal)*e.l;if(r>=e.c.presentationTimeline.Y())return t.endOfStream=!0,"video"==t.type&&(r=e.b.get("text"))&&"application/cea-608"==r.stream.mimeType&&(r.endOfStream=!0),null;if(t.endOfStream=!1,t.ia=a,a!=i)return null;if(o>=s)return.5;if(a=wn(e.a.L,t.type),!(a=vo(e,t,n,a,i)))return 1;var l=1/0;return Array.from(e.b.values()).forEach((function(t){_o(t)||(t=yo(e,t,n),l=Math.min(l,t))})),r>=l+e.c.presentationTimeline.a?1:(t.rd=0,function(e,t,n,r,i){var a=e.c.periods[r],o=t.stream,s=e.c.presentationTimeline.Y(),l=e.c.periods[r+1];r=function(e,t,n,r,i){return t.nc?(n=function(e,t,n,r,i){return"text"==t?(e.a.m=n,(e=e.a).f=r,e.h=i,Promise.resolve()):Promise.all([Rn(e,t,e.Be.bind(e,t)),Rn(e,t,e.kg.bind(e,t,n)),Rn(e,t,e.hg.bind(e,t,r,i))])}(e.a.L,t.type,e.c.periods[n].startTime-t.stream.presentationTimeOffset,r,i),t.stream.initSegmentReference?(e=wo(e,t,t.stream.initSegmentReference).then(function(e){if(!this.f)return kn(this.a.L,t.type,e,null,null,t.stream.closedCaptions&&0<t.stream.closedCaptions.size)}.bind(e)).catch((function(e){return t.nc=!0,Promise.reject(e)})),Promise.all([n,e])):n):Promise.resolve()}(e,t,r,Math.max(0,a.startTime-.1),l?l.startTime+.01:s),t.Ja=!0,t.nc=!1,s=wo(e,t,i),Promise.all([r,s]).then(function(e){if(!this.f&&!this.m)return function(e,t,n,r,i,a,o){var s=i.closedCaptions&&0<i.closedCaptions.size;return null!=i.emsgSchemeIdUris&&0<i.emsgSchemeIdUris.length&&(new jr).fa("emsg",e.K.bind(e,r,a,i.emsgSchemeIdUris)).parse(o),function(e,t,n){var r=Math.max(e.g.bufferBehind,e.c.presentationTimeline.a),i=Tn(e.a.L,t.type);return null==i||0>=(n=n-i-r)?Promise.resolve():e.a.L.remove(t.type,i,i+n).then(function(){}.bind(e))}(e,t,n).then(function(){if(!this.f)return kn(this.a.L,t.type,o,a.startTime+r.startTime,a.endTime+r.startTime,s)}.bind(e)).then(function(){if(!this.f)return t.sb=i,t.Da=a,Promise.resolve()}.bind(e))}(this,t,n,a,o,i,e[1])}.bind(e)).then(function(){this.f||this.m||(t.Ja=!1,t.od=!1,t.Oa||this.a.jd(),ko(this,t,0),function(e,t){if(!e.s){var n=Array.from(e.b.values());if(1==n.length&&"text"==n[0].type||(e.s=n.every((function(e){return"text"==e.type||!e.Oa&&!e.Ra&&e.Da}))),e.s){for(n=To(e,t),e.h[n]||po(e,n).then(function(){this.f||this.a.$d()}.bind(e)).catch(Vt.oc),n=0;n<e.c.periods.length;++n)po(e,n).catch(Vt.oc);e.a.Lf&&e.a.Lf()}}}(this,o))}.bind(e)).catch(function(e){this.f||this.m||(t.Ja=!1,"text"==t.type&&this.g.ignoreTextStreamFailures?this.b.delete("text"):7001==e.code?(t.Ja=!1,t.Ga=null,ko(this,t,0)):3017==e.code?function(e,t,n){if(!Array.from(e.b.values()).some((function(e){return e!=t&&e.od}))){var r=Math.round(100*e.l);if(20<r)e.l-=.2;else{if(!(4<r))return t.Pb=!0,e.m=!0,void e.a.onError(n);e.l-=.04}t.od=!0}ko(e,t,4)}(this,t,e):(t.Pb=!0,e.severity=2,xo(this,e)))}.bind(e))}(e,t,n,i,a),null)}(e,t);null!=n&&(ko(e,t,n),t.Pb=!1)}catch(t){return void xo(e,t)}n=Array.from(e.b.values()),function(e,t){var n=To(e,t.stream);if(t.ia!=n){var r=t.ia,i=Array.from(e.b.values());i.every((function(e){return e.ia==r||_o(e)}))&&i.every(Ao)&&po(e,r).then(function(){if(!this.f&&i.every(function(e){var t=Ao(e),n=To(this,e.stream);return!!_o(e)||t&&e.ia==r&&n!=r}.bind(this))){var e=this.c.periods[r],t=this.a.ae(e),n=new Map;t.variant&&t.variant.video&&n.set("video",t.variant.video),t.variant&&t.variant.audio&&n.set("audio",t.variant.audio),t.text&&n.set("text",t.text);for(var a=(t=f(this.b.keys())).next();!a.done;a=t.next())if(a=a.value,!n.has(a)&&"text"!=a)return void this.a.onError(new me(2,5,5005));for(a=(t=f(Array.from(n.keys()))).next();!a.done;a=t.next())if(a=a.value,!this.b.has(a)){if("text"!=a)return void this.a.onError(new me(2,5,5005));fo(this,null,null,n.get("text"),e.startTime),n.delete(a)}for(a=(t=f(Array.from(this.b.keys()))).next();!a.done;a=t.next()){a=a.value;var o=this.b.get(a),s=n.get(a);if(s){var l=_o(o);l&&(o.ia=r,o.rd=e.startTime),uo(this,s,!1,0,!1),l&&_o(o)||ko(this,this.b.get(a),0)}else this.b.delete(a)}this.a.$d()}}.bind(e)).catch(Vt.oc)}}(e,t),e.s&&n.every((function(e){return e.endOfStream}))&&e.a.L.endOfStream().then(function(){if(!this.f){var e=this.a.L.Y();0!=e&&e<this.c.presentationTimeline.Y()&&this.c.presentationTimeline.xa(e)}}.bind(e))}}function yo(e,t,n){return t.sb&&t.Da?(n=To(e,t.sb),e.c.periods[n].startTime+t.Da.endTime):Math.max(n,t.rd)}function vo(e,t,n,r,i){if(t.Da&&t.stream==t.sb)return bo(e,t,i,t.Da.position+1);if(t.Da?(n=To(e,t.sb),n=t.stream.findSegmentPosition(Math.max(0,e.c.periods[n].startTime+t.Da.endTime-e.c.periods[i].startTime))):n=t.stream.findSegmentPosition(Math.max(0,(r||n)-e.c.periods[i].startTime)),null==n)return null;var a=null;return null==r&&(a=bo(e,t,i,Math.max(0,n-1))),a||bo(e,t,i,n)}function bo(e,t,n,r){return n=e.c.periods[n],(t=t.stream.getSegmentReference(r))?(e=(r=e.c.presentationTimeline).Ob(),r=r.pb(),n.startTime+t.endTime<e||n.startTime+t.startTime>r?null:t):null}function _o(e){return e&&"text"==e.type&&"application/cea-608"==e.stream.mimeType}function Ao(e){return!e.Ja&&null==e.Ga&&!e.Oa&&!e.Ra}function Eo(e,t){var n=Da(e.c.periods,t+1/15);return n?e.c.periods.indexOf(n):0}function To(e,t){for(var n=e.c.periods,r=0;r<n.length;r++){for(var i=n[r],a=new Set,o=f(i.variants),s=o.next();!s.done;s=o.next())(s=s.value).audio&&a.add(s.audio),s.video&&a.add(s.video),s.video&&s.video.trickModeVideo&&a.add(s.video.trickModeVideo);for(o=(i=f(i.textStreams)).next();!o.done;o=i.next())a.add(o.value);if(a.has(t))return r}return-1}function wo(e,t,n){return n=vi(n.c(),n.b,n.a,e.g.retryParameters),e=e.a.ub.request(1,n),t.Rb=e,e.promise.then((function(e){return t.Rb=null,e.data}))}function So(e,t,n,r){return p((function i(){var a,o,s;return M(i,(function(i){switch(i.j){case 1:return t.Oa=!1,t.Cc=!1,t.dc=0,t.Ra=!0,r?(o=e.a.Ua(),s=e.a.L.Y(),a=e.a.L.remove(t.type,o+r,s)):a=xn(e.a.L,t.type).then(function(){if(!this.f&&n)return this.a.L.flush(t.type)}.bind(e)),w(i,a,2);case 2:if(e.f)return i.return();t.sb=null,t.Da=null,t.Ra=!1,t.endOfStream=!1,ko(e,t,0),S(i)}}))}))}function ko(e,t,n){t.Ga=new de((function(){return p((function n(){var r;return M(n,(function(n){switch(n.j){case 1:return k(n,2),w(n,go(e,t),4);case 4:x(n,0);break;case 2:r=R(n),e.a&&e.a.onError(r),S(n)}}))}))})).R(n)}function Co(e){null!=e.Ga&&(e.Ga.stop(),e.Ga=null)}function xo(e,t){pe(e.F).then(function(){this.f||(this.a.onError(t),t.handled||this.g.failureCallback(t))}.bind(e))}function Ro(e,t,n,r,i,a){if(200<=n&&299>=n&&202!=n)return{uri:i||r,ld:r,data:t,headers:e,fromCache:!!e["x-shaka-from-cache"]};i=null;try{i=lt(t)}catch(e){}throw new me(401==n||403==n?2:1,1,1001,r,n,i,e,a)}function Lo(e,t,n,r){var i=new Lo.b;We(t.headers).forEach((function(e,t){i.append(t,e)}));var a=new Lo.a,o={Id:!1,te:!1};if(e=new ye(e=Lo.l(e,n,{body:t.body||void 0,headers:i,method:t.method,signal:a.signal,credentials:t.allowCrossSiteCredentials?"include":void 0},o,r),(function(){return o.Id=!0,a.abort(),Promise.resolve()})),t=t.retryParameters.timeout){var s=new fe((function(){o.te=!0,a.abort()}));s.R(t/1e3),e.finally((function(){s.stop()}))}return e}function Io(e,t,n,r){var i=new Io.f,a=Date.now(),o=0;return new ye(new Promise((function(s,l){for(var u in i.open(t.method,e,!0),i.responseType="arraybuffer",i.timeout=t.retryParameters.timeout,i.withCredentials=t.allowCrossSiteCredentials,i.onabort=function(){l(new me(1,1,7001,e,n))},i.onload=function(t){for(var r=(t=t.target).getAllResponseHeaders().trim().split("\r\n"),i={},a=(r=f(r)).next();!a.done;a=r.next())i[(a=a.value.split(": "))[0].toLowerCase()]=a.slice(1).join(": ");try{var o=Ro(i,t.response,t.status,e,t.responseURL,n);s(o)}catch(e){l(e)}},i.onerror=function(t){l(new me(1,1,1002,e,t,n))},i.ontimeout=function(){l(new me(1,1,1003,e,n))},i.onprogress=function(e){var t=Date.now();(100<t-a||e.lengthComputable&&e.loaded==e.total)&&(r(t-a,e.loaded-o,e.total-e.loaded),o=e.loaded,a=t)},t.headers)i.setRequestHeader(u.toLowerCase(),t.headers[u]);i.send(t.body)})),(function(){return i.abort(),Promise.resolve()}))}function Po(){this.a=this.f=this.b=0,this.c=new Map,this.g=0}function jo(e,t,n){this.h=e,this.b=new Map,this.c=!1,this.g=t,this.f=n,this.a=new Po}function Oo(e,t,n,r,i,a){var o=function(e,t){e.b+=t;var n=e.g;return e.g++,e.c.set(n,t),n}(e.a,r);r=e.b.get(t)||Promise.resolve(),e.b.set(t,r.then((function(){return p((function t(){var r,s,l,u,c,d;return M(t,(function(t){switch(t.j){case 1:return w(t,function(e,t){return p((function n(){var r;return M(n,(function(n){switch(n.j){case 1:return w(n,e.h.request(1,t).promise,2);case 2:return r=n.o,n.return(r.data)}}))}))}(e,n),2);case 2:if(r=t.o,e.c)throw new me(2,9,7001);if(i)for(var f in s=new Uint8Array(r),(l=new Fr(s)).data)u=Number(f),c=l.data[u],d=l.a[u],e.f(c,d);return e.a.close(o,r.byteLength),f=e.a,e.g(0==f.b?0:f.f/f.b,e.a.a),t.return(a(r))}}))}))})))}function Do(e,t){var n=this;this.c=e,this.b=e.objectStore(t),this.a=new ge,e.onabort=function(e){e.preventDefault(),n.a.reject()},e.onerror=function(e){e.preventDefault(),n.a.reject()},e.oncomplete=function(){n.a.resolve()}}function Mo(e,t){return new Promise((function(n,r){var i=e.b.openCursor();i.onerror=r,i.onsuccess=function(e){if(!(e=e.target.result))return n();t(e.key,e.value,e),e.continue()}}))}function No(e){this.b=e,this.a=[]}function Uo(e,t){return Fo(e,t,"readwrite")}function Fo(e,t,n){var r=new Do(n=e.b.transaction([t],n),t);return e.a.push(r),r.promise().then((function(){Re(e.a,r)}),(function(){Re(e.a,r)})),r}function Bo(e,t,n){this.b=new No(e),this.c=t,this.a=n}function Ko(e){return Promise.reject(new me(2,9,9011,"Cannot add new value to "+e))}function Vo(e,t,n,r){t=(e=Uo(e.b,t)).store();for(var i={},a=(n=f(n)).next();!a.done;i={key:i.key},a=n.next())i.key=a.value,t.delete(i.key).onsuccess=function(e){return function(){return r(e.key)}}(i);return e.promise()}function Go(e,t,n){return p((function r(){var i,a,o,s,l,u,c;return M(r,(function(r){switch(r.j){case 1:for(i=Fo(e.b,t,"readonly"),a=i.store(),o={},s=[],l={},u=f(n),c=u.next();!c.done;l={request:l.request,key:l.key},c=u.next())l.key=c.value,l.request=a.get(l.key),l.request.onsuccess=function(e){return function(){null==e.request.result&&s.push(e.key),o[e.key]=e.request.result}}(l);return w(r,i.promise(),2);case 2:if(s.length)throw new me(2,9,9012,"Could not find values for "+s);return r.return(n.map((function(e){return o[e]})))}}))}))}function Ho(e){this.a=new No(e)}function Yo(){this.a=new Map}function zo(e,t,n){if(!(e=e.a.get(t)))throw new me(2,9,9013,"Could not find mechanism with name "+t);if(!(t=e.getCells().get(n)))throw new me(2,9,9013,"Could not find cell with name "+n);return t}function Wo(e,t){$o.set(e,t)}no.prototype.destroy=function(){for(var e=f(this.b.values()),t=e.next();!t.done;t=e.next())Co(t.value);return this.b.clear(),this.i.clear(),this.g=this.h=this.u=this.c=this.a=null,this.f=!0,Promise.resolve()},no.prototype.configure=function(e){this.g=e,this.F=new he({maxAttempts:Math.max(e.retryParameters.maxAttempts,2),baseDelay:e.retryParameters.baseDelay,backoffFactor:e.retryParameters.backoffFactor,fuzzFactor:e.retryParameters.fuzzFactor,timeout:0},!0)},no.prototype.start=function(){var e=this;return p((function t(){var n,r,i;return M(t,(function(t){switch(t.j){case 1:return n=e.a.Ua(),r=Eo(e,n),(i=e.a.ae(e.c.periods[r])).variant||i.text?w(t,fo(e,i.variant?i.variant.audio:null,i.variant?i.variant.video:null,i.text,n),2):t.return(new me(2,5,5005));case 2:if(e.f)return t.return();e.a&&e.a.Cf&&e.a.Cf(),S(t)}}))}))},no.prototype.K=function(e,t,n,r){var i=r.reader.md(),a=r.reader.md(),o=r.reader.G(),s=r.reader.G(),l=r.reader.G(),u=r.reader.G();r=r.reader.Za(r.reader.J.byteLength-r.reader.ca()),e=e.startTime+t.startTime+s/o,n.includes(i)&&("urn:mpeg:dash:event:2012"==i?this.a.Df():this.a.onEvent(new we("emsg",{detail:{startTime:e,endTime:e+l/o,schemeIdUri:i,value:a,timescale:o,presentationTimeDelta:s,eventDuration:l,id:u,messageData:r}})))},V("shaka.net.HttpFetchPlugin",Lo),Lo.l=function(e,t,n,r,i){return p((function a(){var o,s,l,u,c,d,f,h,m,g,y,v;return M(a,(function(a){switch(a.j){case 1:return o=Lo.g,s=Lo.c,d=c=0,f=Date.now(),k(a,2),w(a,o(e,n),4);case 4:return l=a.o,h=l.clone().body.getReader(),g=(m=l.headers.get("Content-Length"))?parseInt(m,10):0,new s({start:function(e){!function t(){return p((function n(){var r,a;return M(n,(function(n){switch(n.j){case 1:return k(n,2),w(n,h.read(),4);case 4:r=n.o,x(n,3);break;case 2:return R(n),n.return();case 3:r.done||(c+=r.value.byteLength),(100<(a=Date.now())-f||r.done)&&(i(a-f,c-d,g-c),d=c,f=a),r.done?e.close():(e.enqueue(r.value),t()),S(n)}}))}))}()}}),w(a,l.arrayBuffer(),5);case 5:u=a.o,x(a,3);break;case 2:if(y=R(a),r.Id)throw new me(1,1,7001,e,t);if(r.te)throw new me(1,1,1003,e,t);throw new me(1,1,1002,e,y,t);case 3:return v={},l.headers.forEach((function(e,t){v[t.trim()]=e})),a.return(Ro(v,u,l.status,e,l.url,t))}}))}))},Lo.isSupported=function(){if(!e.ReadableStream)return!1;try{new ReadableStream({})}catch(e){return!1}return!(!e.fetch||!e.AbortController)},Lo.isSupported=Lo.isSupported,Lo.g=e.fetch,Lo.a=e.AbortController,Lo.c=e.ReadableStream,Lo.b=e.Headers,Lo.isSupported()&&(De("http",Lo,2),De("https",Lo,2)),V("shaka.net.HttpXHRPlugin",Io),Io.f=e.XMLHttpRequest,De("http",Io,1),De("https",Io,1),Po.prototype.close=function(e,t){if(this.c.has(e)){var n=this.c.get(e);this.c.delete(e),this.f+=n,this.a+=t}},jo.prototype.destroy=function(){return this.c=!0,Promise.all(this.b.values()).then((function(){}),(function(){}))},Do.prototype.abort=function(){try{this.c.abort()}catch(e){}return this.a.catch((function(){}))},Do.prototype.store=function(){return this.b},Do.prototype.promise=function(){return this.a},No.prototype.destroy=function(){return Promise.all(this.a.map((function(e){return e.abort()})))},(r=Bo.prototype).destroy=function(){return this.b.destroy()},r.hasFixedKeySpace=function(){return!0},r.addSegments=function(){return Ko(this.c)},r.removeSegments=function(e,t){return Vo(this,this.c,e,t)},r.getSegments=function(e){var t=this;return p((function n(){var r;return M(n,(function(n){switch(n.j){case 1:return w(n,Go(t,t.c,e),2);case 2:return r=n.o,n.return(r.map((function(e){return t.Jd(e)})))}}))}))},r.addManifests=function(){return Ko(this.a)},r.updateManifestExpiration=function(e,t){var n=Uo(this.b,this.a),r=n.store();return r.get(e).onsuccess=function(n){(n=n.target.result)&&(n.expiration=t,r.put(n,e))},n.promise()},r.removeManifests=function(e,t){return Vo(this,this.a,e,t)},r.getManifests=function(e){var t=this;return p((function n(){var r;return M(n,(function(n){switch(n.j){case 1:return w(n,Go(t,t.a,e),2);case 2:return r=n.o,n.return(r.map((function(e){return t.ec(e)})))}}))}))},r.getAllManifests=function(){var e=this;return p((function t(){var n,r;return M(t,(function(t){switch(t.j){case 1:return n=Fo(e.b,e.a,"readonly"),r=new Map,w(t,Mo(n,(function(t,n){r.set(t,e.ec(n))})),2);case 2:return w(t,n.promise(),3);case 3:return t.return(r)}}))}))},r.Jd=function(e){return e},r.ec=function(e){return e},r.add=function(e,t){var n=this;return p((function r(){var i,a,o,s;return M(r,(function(r){switch(r.j){case 1:i=Uo(n.b,e),a=i.store(),o=[];for(var l=f(t),u=l.next();!u.done;u=l.next())s=u.value,a.add(s).onsuccess=function(e){o.push(e.target.result)};return w(r,i.promise(),2);case 2:return r.return(o)}}))}))},Ho.prototype.destroy=function(){return this.a.destroy()},Ho.prototype.getAll=function(){var e=this;return p((function t(){var n,r;return M(t,(function(t){switch(t.j){case 1:return n=Fo(e.a,"session-ids","readonly"),r=[],w(t,Mo(n,(function(e,t){r.push(t)})),2);case 2:return w(t,n.promise(),3);case 3:return t.return(r)}}))}))},Ho.prototype.add=function(e){for(var t=Uo(this.a,"session-ids"),n=t.store(),r=(e=f(e)).next();!r.done;r=e.next())n.add(r.value);return t.promise()},Ho.prototype.remove=function(e){var t=this;return p((function n(){var r;return M(n,(function(n){switch(n.j){case 1:return w(n,Mo(r=Uo(t.a,"session-ids"),(function(t,n,r){0<=e.indexOf(n.sessionId)&&r.delete()})),2);case 2:return w(n,r.promise(),0)}}))}))},Yo.prototype.destroy=function(){for(var e=[],t=f(this.a.values()),n=t.next();!n.done;n=t.next())e.push(n.value.destroy());return this.a.clear(),Promise.all(e)},Yo.prototype.init=function(){var e=this;$o.forEach((function(t,n){var r=t();r&&e.a.set(n,r)}));for(var t=[],n=f(this.a.values()),r=n.next();!r.done;r=n.next())t.push(r.value.init());return Promise.all(t)},Yo.prototype.erase=function(){var e=this;return p((function t(){var n,r;return M(t,(function(t){switch(t.j){case 1:return n=Array.from(e.a.values()),(r=0<n.length)||$o.forEach((function(e){(e=e())&&n.push(e)})),w(t,Promise.all(n.map((function(e){return e.erase()}))),2);case 2:if(!r)return w(t,Promise.all(n.map((function(e){return e.destroy()}))),0);t.A(0)}}))}))},V("shaka.offline.StorageMuxer.register",Wo),V("shaka.offline.StorageMuxer.unregister",(function(e){$o.delete(e)}));var $o=new Map;function qo(e){Bo.apply(this,arguments)}function Xo(e){return function(e){var t=e.streams.filter((function(e){return"audio"==e.contentType})),n=e.streams.filter((function(e){return"video"==e.contentType}));if(!t.every((function(e){return e.variantIds}))||!n.every((function(e){return e.variantIds}))){t.forEach((function(e){e.variantIds=[]})),n.forEach((function(e){e.variantIds=[]}));var r=0;if(n.length&&!t.length){var i=r++;n.forEach((function(e){e.variantIds.push(i)}))}if(!n.length&&t.length){var a=r++;t.forEach((function(e){e.variantIds.push(a)}))}n.length&&t.length&&t.forEach((function(e){n.forEach((function(t){var n=r++;e.variantIds.push(n),t.variantIds.push(n)}))}))}}(e),e.streams.forEach((function(){})),{startTime:e.startTime,streams:e.streams.map(Jo)}}function Jo(e){var t=e.initSegmentUri?Zo(e.initSegmentUri):null;return{id:e.id,originalId:null,primary:e.primary,presentationTimeOffset:e.presentationTimeOffset,contentType:e.contentType,mimeType:e.mimeType,codecs:e.codecs,frameRate:e.frameRate,pixelAspectRatio:void 0,kind:e.kind,language:e.language,label:e.label,width:e.width,height:e.height,initSegmentKey:t,encrypted:e.encrypted,keyId:e.keyId,segments:e.segments.map(Qo),variantIds:e.variantIds}}function Qo(e){var t=Zo(e.uri);return{startTime:e.startTime,endTime:e.endTime,dataKey:t}}function Zo(e){var t;if((t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(e))||(t=/^offline:segment\/([0-9]+)$/.exec(e)))return Number(t[1]);throw new me(2,9,9004,"Could not parse uri "+e)}function es(e,t,n,r){Bo.call(this,e,t,n),this.f=r}function ts(){this.g=this.c=this.b=this.a=this.f=null}function ns(e,t,n,r){this.a=e,this.g=t,this.f=n,this.c=r,this.b=["offline:",e,"/",t,"/",n,"/",r].join("")}function rs(e){if(null==(e=/^offline:([a-z]+)\/([^/]+)\/([^/]+)\/([0-9]+)$/.exec(e)))return null;var t=e[1];if("manifest"!=t&&"segment"!=t)return null;var n=e[2];if(!n)return null;var r=e[3];return r&&null!=t?new ns(t,n,r,Number(e[4])):null}function is(e,t){this.b=e,this.a=t}function as(e,t,n){var r=t.streams.filter((function(e){return"audio"==e.contentType})),i=t.streams.filter((function(e){return"video"==e.contentType}));return r=function(e,t,n){for(var r=new Set,i=f(t),a=i.next();!a.done;a=i.next()){var o=f(a.value.variantIds);for(a=o.next();!a.done;a=o.next())r.add(a.value)}for(i=f(n),a=i.next();!a.done;a=i.next())for(o=f(a.value.variantIds),a=o.next();!a.done;a=o.next())r.add(a.value);for(i=new Map,r=f(r),a=r.next();!a.done;a=r.next())a=a.value,i.set(a,{id:a,language:"",primary:!1,audio:null,video:null,bandwidth:0,drmInfos:[],allowedByApplication:!0,allowedByKeySystem:!0});for(t=f(t),r=t.next();!r.done;r=t.next())for(r=r.value,a=os(e,r),o=f(r.variantIds),r=o.next();!r.done;r=o.next())(r=i.get(r.value)).language=a.language,r.primary=r.primary||a.primary,r.audio=a;for(n=f(n),t=n.next();!t.done;t=n.next())for(r=t.value,t=os(e,r),a=f(r.variantIds),r=a.next();!r.done;r=a.next())(r=i.get(r.value)).primary=r.primary||t.primary,r.video=t;return i}(e,r,i),i=t.streams.filter((function(e){return"text"==e.contentType})).map((function(t){return os(e,t)})),t.streams.forEach((function(r){r=r.segments.map((function(t,n){return ss(e,n,t)})),n.vb(r,t.startTime)})),{startTime:t.startTime,variants:Array.from(r.values()),textStreams:i}}function os(e,t){var n=t.segments.map((function(t,n){return ss(e,n,t)})),r=new ei(n);return n={id:t.id,originalId:t.originalId,createSegmentIndex:function(){return Promise.resolve()},findSegmentPosition:function(e){return r.find(e)},getSegmentReference:function(e){return r.get(e)},initSegmentReference:null,presentationTimeOffset:t.presentationTimeOffset,mimeType:t.mimeType,codecs:t.codecs,width:t.width||void 0,height:t.height||void 0,frameRate:t.frameRate||void 0,pixelAspectRatio:t.pixelAspectRatio||void 0,kind:t.kind,encrypted:t.encrypted,keyId:t.keyId,language:t.language,label:t.label||null,type:t.contentType,primary:t.primary,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,audioSamplingRate:null,closedCaptions:null},null!=t.initSegmentKey&&(n.initSegmentReference=function(e,t){var n=new ns("segment",e.b,e.a,t);return new Jr((function(){return[n.toString()]}),0,null)}(e,t.initSegmentKey)),n}function ss(e,t,n){var r=new ns("segment",e.b,e.a,n.dataKey);return new Qr(t,n.startTime,n.endTime,(function(){return[r.toString()]}),0,null)}function ls(){this.a=null}function us(e){var t=rs(e);return t&&"manifest"==t.a?us.h(e):t&&"segment"==t.a?us.i(t.key(),t):ve(new me(2,1,9004,e))}function cs(e,t,n){return p((function r(){var i,a,o,s,l,u;return M(r,(function(r){switch(r.j){case 1:i=[];for(var c=[],d=f(n),h=d.next();!h.done;h=d.next()){h=h.value;for(var m=!1,g=f(c),y=g.next();!y.done;y=g.next())if(ds((y=y.value).info,h)){y.sessionIds.push(h.sessionId),m=!0;break}m||c.push({info:h,sessionIds:[h.sessionId]})}a=f(c),o=a.next();case 2:if(o.done){r.A(4);break}return s=o.value,l=function(e,t,n){return p((function r(){var i,a;return M(r,(function(r){switch(r.j){case 1:return i=new pt({ub:t,onError:function(){},qc:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),k(r,2),i.configure(e),w(r,function(e,t,n,r,i,a){var o=new Map;return o.set(t,{audioCapabilities:i,videoCapabilities:a,distinctiveIdentifier:"optional",persistentState:"required",sessionTypes:["persistent-license"],label:t,drmInfos:[{keySystem:t,licenseServerUri:n,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:r,initData:null,keyIds:null}]}),Tt(e,o)}(i,n.info.keySystem,n.info.licenseUri,n.info.serverCertificate,n.info.audioCapabilities,n.info.videoCapabilities),4);case 4:x(r,3);break;case 2:return R(r),w(r,i.destroy(),5);case 5:return r.return([]);case 3:return k(r,6),w(r,yt(i),8);case 8:x(r,7);break;case 6:return R(r),w(r,i.destroy(),9);case 9:return r.return([]);case 7:return a=[],w(r,Promise.all(n.sessionIds.map((function(e){return p((function t(){return M(t,(function(t){switch(t.j){case 1:return k(t,2),w(t,function(e,t){return p((function n(){var r,i,a;return M(n,(function(n){switch(n.j){case 1:return w(n,wt(e,t),2);case 2:return(r=n.o)?(i=[],(a=e.b.get(r))&&(a.ya=new ge,i.push(a.ya)),i.push(r.remove()),w(n,Promise.all(i),0)):n.return()}}))}))}(i,e),4);case 4:a.push(e),x(t,0);break;case 2:R(t),S(t)}}))}))}))),10);case 10:return w(r,i.destroy(),11);case 11:return r.return(a)}}))}))}(e,t,s),w(r,l,5);case 5:u=r.o,i=i.concat(u),o=a.next(),r.A(2);break;case 4:return r.return(i)}}))}))}function ds(e,t){function n(e,t){return e.robustness==t.robustness&&e.contentType==t.contentType}return e.keySystem==t.keySystem&&e.licenseUri==t.licenseUri&&Le(e.audioCapabilities,t.audioCapabilities,n)&&Le(e.videoCapabilities,t.videoCapabilities,n)}function fs(e,t){var n={Aa:null,v:null,mimeType:null,startTime:null,zd:null,uri:null},r=this;this.g=t,this.c=e,this.i=n,this.h=null,this.f=[],this.b=this.a=null,this.l=!0,this.m=Promise.resolve().then((function(){return function(e){return p((function t(){return M(t,(function(t){switch(t.j){case 1:if(e.l){if(0==e.f.length||e.a&&!e.a.Va)var n=!1;else{e.a&&(e.a.va.Ya(),e.a=null);var r=(n=e.f.shift()).create(e.i);r?(n.va.wb(),e.a={node:r.node,payload:r.payload,Va:r.Va,va:n.va}):n.va.rc(),n=!0}return n?n=Promise.resolve():e.a?n=function(e){return p((function t(){var n,r;return M(t,(function(t){switch(t.j){case 1:return e.c=e.g.cf(e.c,e.i,e.a.node,e.a.payload),k(t,2),e.b=e.g.Le(e.c,e.i,e.a.payload),w(t,e.b.promise,4);case 4:e.b=null,e.c==e.a.node&&(e.a.va.pc(),e.a=null),x(t,0);break;case 2:return 7001==(n=R(t)).code?e.a.va.Ya():e.a.va.onError(n),e.a=null,e.b=null,r=e,w(t,e.g.handleError(e.i,n),5);case 5:r.c=t.o,S(t)}}))}))}(e):(e.g.Bf(e.c),e.h=new ge,n=e.h),w(t,n,1)}t.A(0)}}))}))}(r)}))}function hs(e,t){var n={wb:function(){},pc:function(){},Ya:function(){},onError:function(){},rc:function(){},Jg:function(){}};return e.f.push({create:t,va:n}),e.b&&e.b.abort(),ps(e),n}function ps(e){e.h&&(e.h.resolve(),e.h=null)}function ms(e){this.a=null;for(var t=0;t<e.textTracks.length;++t){var n=e.textTracks[t];n.mode="disabled","Shaka Player TextTrack"==n.label&&(this.a=n)}this.a||(this.a=e.addTextTrack("subtitles","Shaka Player TextTrack")),this.a.mode="hidden"}function gs(e){if(e.startTime>=e.endTime)return null;var t=new VTTCue(e.startTime,e.endTime,e.payload);t.lineAlign=e.lineAlign,t.positionAlign=e.positionAlign,t.size=e.size;try{t.align=e.textAlign}catch(e){}return"center"==e.textAlign&&"center"!=t.align&&(t.align="middle"),"vertical-lr"==e.writingMode?t.vertical="lr":"vertical-rl"==e.writingMode&&(t.vertical="rl"),1==e.lineInterpretation&&(t.snapToLines=!1),null!=e.line&&(t.line=e.line),null!=e.position&&(t.position=e.position),t}function ys(e,t){var n=e.mode;e.mode="showing"==n?"showing":"hidden";for(var r=e.cues,i=r.length-1;0<=i;i--){var a=r[i];a&&t(a)&&e.removeCue(a)}e.mode=n}function vs(e,t,n,r,i){var a,o=i in r,s=!0;for(a in t){var l=i+"."+a,u=o?r[i]:n[a];o||a in n?void 0===t[a]?void 0===u||o?delete e[a]:e[a]=Ce(u):u.constructor==Object&&t[a]&&t[a].constructor==Object?(e[a]||(e[a]=Ce(u)),l=vs(e[a],t[a],u,r,l),s=s&&l):typeof t[a]!=typeof u||null==t[a]||"function"!=typeof t[a]&&t[a].constructor!=u.constructor?($("Invalid config, wrong type for "+l),s=!1):("function"==typeof n[a]&&n[a].length!=t[a].length&&q("Unexpected number of arguments for "+l),e[a]=t[a]):($("Invalid config, unrecognized key "+l),s=!1)}return s}function bs(e,t){for(var n={},r=n,i=0,a=0;!(0>(i=e.indexOf(".",i)));)0!=i&&"\\"==e[i-1]||(r[a=e.substring(a,i).replace(/\\\./g,".")]={},r=r[a],a=i+1),i+=1;return r[e.substring(a).replace(/\\\./g,".")]=t,n}function _s(){}function As(){var e=5e5,t=1/0;navigator.connection&&(e=1e6*navigator.connection.downlink,navigator.connection.saveData&&(t=360));var n={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1,initDataTransform:kt,fairPlayTransform:!0},r={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},availabilityWindowOverride:NaN,disableAudio:!1,disableVideo:!1,disableText:!1,dash:{customScheme:function(e){if(e)return null},clockSyncUri:"",ignoreDrmInfo:!1,xlinkFailGracefully:!1,defaultPresentationDelay:10,ignoreMinBufferTime:!1,autoCorrectDrift:!0,ignoreSuggestedPresentationDelay:!1,ignoreEmptyAdaptationSet:!1},hls:{ignoreTextStreamFailures:!1}},i={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},failureCallback:function(e){return[e]},rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,ignoreTextStreamFailures:!1,alwaysStreamText:!1,startAtSegmentBoundary:!1,smallGapLimit:.5,jumpLargeGaps:!1,durationBackoff:1,forceTransmuxTS:!1,safeSeekOffset:5,stallEnabled:!0,stallThreshold:1,stallSkip:.1,useNativeHlsOnSafari:!0};nt("Web0S")&&(i.stallEnabled=!1);var a={trackSelectionCallback:function(e){return p((function t(){return M(t,(function(t){switch(t.j){case 1:return t.return(e)}}))}))},progressCallback:function(e,t){return[e,t]},usePersistentLicense:!0},o={drm:n,manifest:r,streaming:i,offline:a,abrFactory:Fn,abr:{enabled:!0,defaultBandwidthEstimate:e,switchInterval:8,bandwidthUpgradeTarget:.85,bandwidthDowngradeTarget:.95,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:t,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0}},preferredAudioLanguage:"",preferredTextLanguage:"",preferredVariantRole:"",preferredTextRole:"",preferredAudioChannelCount:2,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0},playRangeStart:0,playRangeEnd:1/0,textDisplayFactory:function(){return null}};return a.trackSelectionCallback=function(e){return p((function t(){return M(t,(function(t){switch(t.j){case 1:return t.return(function(e,t){var n=e.filter((function(e){return"variant"==e.type})),r=[],i=Mn(t,n.map((function(e){return e.language})));i&&(r=n.filter((function(e){return On(e.language)==i}))),0==r.length&&(r=n.filter((function(e){return e.primary}))),0==r.length&&(n.map((function(e){return e.language})),r=n);var a=r.filter((function(e){return e.height&&480>=e.height}));if(a.length&&(a.sort((function(e,t){return t.height-e.height})),r=a.filter((function(e){return e.height==a[0].height}))),n=[],r.length){var o=Math.floor(r.length/2);r.sort((function(e,t){return e.bandwidth-t.bandwidth})),n.push(r[o])}for(r=f(e),o=r.next();!o.done;o=r.next())"text"==(o=o.value).type&&n.push(o);return n}(e,o.preferredAudioLanguage))}}))}))},o}function Es(e,t,n){var r={".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",serverCertificate:new Uint8Array(0),individualizationServer:""}};return vs(e,t,n||As(),r,"")}function Ts(){this.a=null,this.b=[]}function ws(e,t){if(null==e.a)e.a={timestamp:Date.now()/1e3,state:t,duration:0};else{var n=Date.now()/1e3;e.a.duration=n-e.a.timestamp,e.a.state!=t&&(e.b.push(e.a),e.a={timestamp:n,state:t,duration:0})}}function Ss(e,t){var n=0;e.a&&e.a.state==t&&(n+=e.a.duration);for(var r=f(e.b),i=r.next();!i.done;i=r.next())n+=(i=i.value).state==t?i.duration:0;return n}function ks(){this.b=this.c=null,this.a=[]}function Cs(){this.f=this.s=this.h=this.b=this.i=this.l=this.m=this.g=this.u=NaN,this.a=new Ts,this.c=new ks}function xs(t,n){var r=this;ke.call(this),this.i=pl,this.a=null,this.gb=!1,this.g=new Be,this.Dc=this.l=this.Fb=this.b=this.s=this.f=this.Yb=this.B=this.Zb=this.W=this.ib=this.m=this.D=this.h=this.K=null,this.Xd=1e9,this.ac=new Set,this.kb=!0,this.pa=null,this.Ud=!1,this.Rd=0,this.oa=null,this.$=new ha,this.c=Us(this),this.bc={width:1/0,height:1/0},this.u=null,this.Gb=new Ea(this.c.preferredAudioLanguage,this.c.preferredVariantRole,this.c.preferredAudioChannelCount),this.na=this.c.preferredTextLanguage,this.fb=this.c.preferredTextRole,n&&n(this),this.K=function(e){return new je((function(t,n){e.l&&e.l.segmentDownloaded(t,n)}))}(this),this.g.w(e,"online",(function(){r.sd()})),this.F={name:"detach"},this.O={name:"attach"},this.Ha={name:"unload"},this.Mc={name:"manifest-parser"},this.Kc={name:"manifest"},this.hb={name:"media-source"},this.Ec={name:"drm-engine"},this.S={name:"load"},this.Rc={name:"src-equals-drm-engine"},this.jb={name:"src-equals"};var i=new Map;i.set(this.O,(function(e,t){return Ae(function(e,t,n){return null==t.v&&(t.v=n.v,e.g.w(t.v,"error",(function(){var t=el(e);t&&e.Ma(t)}))),e.a=t.v,Promise.resolve()}(r,e,t))})),i.set(this.F,(function(e){return e.v&&(r.g.ea(e.v,"error"),e.v=null),r.a=null,Ae(e=Promise.resolve())})),i.set(this.Ha,(function(e){return Ae(Ps(r,e))})),i.set(this.hb,(function(t){return Ae(t=function(t,n){return p((function r(){var i,a,o,s;return M(r,(function(r){switch(r.j){case 1:return i=e.muxjs?new Mt:new Nt,a=t.c.textDisplayFactory,o=new a,t.Fc=a,w(r,(s=new vn(n.v,i,o)).s,2);case 2:t.D=s,S(r)}}))}))}(r,t))})),i.set(this.Mc,(function(e,t){return Ae(function(e,t,n){return p((function r(){var i,a,o,s;return M(r,(function(r){switch(r.j){case 1:if(t.Aa=n.Aa,t.mimeType=n.mimeType,t.uri=n.uri,i=t.uri,a=e.K,e.Fb=i,t.Aa){e.s=t.Aa(),r.A(2);break}return o=e,w(r,gi.create(i,a,e.c.manifest.retryParameters,t.mimeType),3);case 3:o.s=r.o;case 2:s=Ce(e.c.manifest),n.v&&"AUDIO"===n.v.nodeName&&(s.disableVideo=!0),e.s.configure(s),S(r)}}))}))}(r,e,t))})),i.set(this.Kc,(function(e){return function(e,t){var n=t.uri,r=e.K;e.Yb=new Ja,function(e,t){e.b=t}(e.Yb,(function(t){Zs(e,"timelineregionadded",t)}));var i={networkingEngine:r,filterNewPeriod:function(t){return e.Nc(t)},filterAllPeriods:function(t){return Fs(e,t)},onTimelineRegionAdded:function(t){var n=e.Yb;e:{for(var r=f(n.a),i=r.next();!i.done;i=r.next())if((i=i.value).schemeIdUri==t.schemeIdUri&&i.id==t.id&&i.startTime==t.startTime&&i.endTime==t.endTime){r=i;break e}r=null}null==r&&(n.a.add(t),n.b(t))},onEvent:function(t){return e.dispatchEvent(t)},onError:function(t){return e.Ma(t)}};return new ye(Promise.resolve().then((function(){return p((function t(){var r;return M(t,(function(t){switch(t.j){case 1:return r=e,w(t,e.s.start(n,i),2);case 2:if(r.b=t.o,e.dispatchEvent(new we("manifestparsed")),0==e.b.periods.length)throw new me(2,4,4014);!function(e){function t(e){return e.video&&e.audio||e.video&&e.video.codecs.includes(",")}e.some((function(e){return e.variants.some(t)}))&&e.forEach((function(e){e.variants=e.variants.filter(t)}))}(e.b.periods),S(t)}}))}))})),(function(){return e.s.stop()}))}(r,e)})),i.set(this.Ec,(function(){return Ae(function(e){return p((function t(){return M(t,(function(t){switch(t.j){case 1:return e.h=new pt({ub:e.K,onError:function(t){e.Ma(t)},qc:function(t){tl(e,t)},onExpirationUpdated:function(t,n){nl(e,t,n)},onEvent:function(t){e.dispatchEvent(t)}}),e.h.configure(e.c.drm),w(t,mt(e.h,Oa(e.b.periods),e.b.offlineSessionIds),2);case 2:Fs(e,e.b.periods),S(t)}}))}))}(r))})),i.set(this.S,(function(e,t){return Ae(function(e,t,n){return p((function r(){var i,a,o,s,l,u,c,d,h;return M(r,(function(r){switch(r.j){case 1:return t.startTime=n.startTime,i=t.v,a=t.uri,e.Fb=a,e.u=new Cs,o=function(){return Gs(e)},s=function(){var t=e.a.playbackRate;0!=t&&e.W.set(t)},e.g.w(i,"playing",o),e.g.w(i,"pause",o),e.g.w(i,"ended",o),e.g.w(i,"ratechange",s),l=e.c.abrFactory,e.l&&e.Dc==l||(e.Dc=l,e.l=new l,e.l.configure(e.c.abr)),function(e,t){for(var n=0;n<t.length;n++){for(var r=t[n],i=new Map,a=f(r.variants),o=a.next();!o.done;o=a.next())if((o=o.value).video&&o.video.closedCaptions)for(var s=f((o=o.video).closedCaptions.keys()),l=s.next();!l.done;l=s.next())if(l=l.value,!i.has(l)){var u={id:e.Xd++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,presentationTimeOffset:0,mimeType:"application/cea-608",codecs:"",kind:"caption",encrypted:!1,keyId:null,language:o.closedCaptions.get(l),label:null,type:"text",primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:o.roles,channelsCount:null,audioSamplingRate:null,closedCaptions:null};i.set(l,u)}for(i=f(i.values()),a=i.next();!a.done;a=i.next())r.textStreams.push(a.value)}}(e,e.b.periods),e.Gb=new Ea(e.c.preferredAudioLanguage,e.c.preferredVariantRole,e.c.preferredAudioChannelCount),e.na=e.c.preferredTextLanguage,function(e,t,n){0<t&&(e.V()||e.qe(t)),n<e.Y()&&(e.V()||e.xa(n))}(e.b.presentationTimeline,e.c.playRangeStart,e.c.playRangeEnd),w(r,e.h.Hb(i),2);case 2:return e.l.init((function(t,n,r){n=void 0!==n&&n,r=void 0===r?0:r;e:{for(var i=f(e.b.periods),a=i.next();!a.done;a=i.next())if((a=a.value).variants.includes(t)){i=a;break e}i=null}Ms(e,i,t,!0),e.f&&lo(e.f,t,n,r)&&Ws(e)})),e.m=function(e,t){return new Wa(e.a,e.b,e.c.streaming,t,(function(){e.ib&&ja(e.ib,!0),e.f&&function(e){function t(t){var i=e.a.L;return t="text"==t?null!=(t=i.a).a&&null!=t.b&&n>=t.a&&n<t.b:Ft(t=Sn(i,t),n,r)}var n=e.a.Ua(),r=e.g.smallGapLimit,i=Eo(e,n);if(ze(e.b.values(),(function(e){return e.ia==i})))for(var a=f(e.b.keys()),o=a.next();!o.done;o=a.next())t(o=o.value)||co(e,e.b.get(o));else ze(e.b.keys(),t)||e.b.forEach((function(t){co(e,t)}))}(e.f),e.B&&Os(e)}),(function(t){return e.dispatchEvent(t)}))}(e,t.startTime),e.ib=function(e){var t=new Ma(e.b);!function(e,t){e.b=t}(t,(function(){$s(e)}));var n=new Qa(e.Yb);!function(e,t,n,r){e.a=t,e.b=n,e.c=r}(n,(function(t){Zs(e,"timelineregionenter",t)}),(function(t){Zs(e,"timelineregionexit",t)}),(function(t,n){n||(Zs(e,"timelineregionenter",t),Zs(e,"timelineregionexit",t))}));var r=new Pa(e.a);return r.a.add(t),r.a.add(n),r}(e),e.W=new Na({jc:function(){return t.v.playbackRate},wd:function(e){t.v.playbackRate=e},Yd:function(e){t.v.currentTime+=e}}),u=Math.max(e.b.minBufferTime,e.c.streaming.rebufferingGoal),js(e,u),e.f=function(e){return new no(e.b,{Ua:function(){return e.m.h()},getBandwidthEstimate:function(){return e.l.getBandwidthEstimate()},L:e.D,ub:e.K,ae:e.zf.bind(e),$d:e.Fe.bind(e),onError:e.Ma.bind(e),onEvent:function(t){return e.dispatchEvent(t)},Df:e.Ef.bind(e),jd:e.Jf.bind(e)})}(e),e.f.configure(e.c.streaming),function(e){function t(e){var t="";e.video&&(t=Xe(e.video.codecs)[0]);var n="";return e.audio&&(n=Xe(e.audio.codecs)[0]),t+"-"+n}var n=e.b.periods.reduce((function(e,t){return e.concat(t.variants)}),[]);n=Un.Nd(n,e.c.preferredAudioChannelCount);var r=new Se;n.forEach((function(e){var n=t(e);r.push(n,e)}));var i=null,a=1/0;r.forEach((function(e,t){var n=0,r=0;t.forEach((function(e){n+=e.bandwidth||0,++r}));var o=n/r;o<a&&(i=e,a=o)})),e.b.periods.forEach((function(e){e.variants=e.variants.filter((function(e){return t(e)==i}))}))}(e),e.i=ml,e.dispatchEvent(new we("streaming")),w(r,e.f.start(),3);case 3:e.c.streaming.startAtSegmentBoundary&&(c=e.m.h(),d=function(e,t){function n(e,t){if(!e)return null;var n=e.findSegmentPosition(t-a.startTime);return null==n?null:(n=e.getSegmentReference(n))?n.startTime+a.startTime:null}var r=ro(e.f),i=io(e.f),a=ll(e);return r=n(r,t),null!=(i=n(i,t))&&null!=r?Math.max(i,r):null!=i?i:null!=r?r:t}(e,c),e.m.m(d)),e.b.periods.forEach(e.Nc.bind(e)),$s(e),Ws(e),(h=ll(e)||e.b.periods[0]).variants.some((function(e){return e.primary})),Hs(e,h.variants),e.g.da(i,"loadeddata",(function(){e.u.b=Date.now()/1e3-n.zd})),S(r)}}))}))}(r,e,t))})),i.set(this.Rc,(function(e){return Ae(e=function(e,t){return p((function n(){var r,i;return M(n,(function(n){switch(n.j){case 1:return r=Yt,e.h=new pt({ub:e.K,onError:function(t){e.Ma(t)},qc:function(t){tl(e,t)},onExpirationUpdated:function(t,n){nl(e,t,n)},onEvent:function(t){e.dispatchEvent(t)}}),e.h.configure(e.c.drm),i={id:0,language:"und",primary:!1,audio:null,video:{id:0,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,presentationTimeOffset:0,mimeType:"video/mp4",codecs:"",encrypted:!0,keyId:null,language:"und",label:null,type:r.Pa,primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,audioSamplingRate:null,closedCaptions:null},bandwidth:100,drmInfos:[],allowedByApplication:!0,allowedByKeySystem:!0},w(n,mt(e.h,[i],[]),2);case 2:return w(n,e.h.Hb(t.v),0)}}))}))}(r,e))})),i.set(this.jb,(function(e,t){return function(e,t,n){function r(){return Gs(e)}if(t.uri=n.uri,t.startTime=n.startTime,e.Fb=t.uri,e.u=new Cs,e.m=new za(t.v),null!=t.startTime&&e.m.m(t.startTime),e.W=new Na({jc:function(){return t.v.playbackRate},wd:function(e){t.v.playbackRate=e},Yd:function(e){t.v.currentTime+=e}}),js(e,e.c.streaming.rebufferingGoal),e.g.w(t.v,"playing",r),e.g.w(t.v,"pause",r),e.g.w(t.v,"ended",r),e.g.da(t.v,"loadeddata",(function(){e.u.b=Date.now()/1e3-n.zd})),e.a.audioTracks&&(e.g.w(e.a.audioTracks,"addtrack",(function(){return $s(e)})),e.g.w(e.a.audioTracks,"removetrack",(function(){return $s(e)})),e.g.w(e.a.audioTracks,"change",(function(){return $s(e)}))),e.a.textTracks){var i=e.a.textTracks;e.g.w(i,"addtrack",(function(){return $s(e)})),e.g.w(i,"removetrack",(function(){return $s(e)})),e.g.w(i,"change",(function(){return $s(e)}))}t.v.src=t.uri,e.i=gl,e.dispatchEvent(new we("streaming"));var a=new ge;return e.a.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?a.resolve():e.a.error?a.reject(el(e)):(e.g.da(e.a,"loadeddata",(function(){a.resolve()})),e.g.da(e.a,"error",(function(){a.reject(el(e))}))),new ye(a,(function(){return a.reject(new me(2,7,7001)),Promise.resolve()}))}(r,e,t)})),this.lb=new fs(this.F,{cf:function(e,t,n,i){var a=null;return e==r.F&&(a=n==r.F?r.F:r.O),e==r.O&&(a=n==r.F||t.v!=i.v?r.F:n==r.O?r.O:n==r.hb||n==r.S?r.hb:n==r.jb?r.Rc:null),e==r.hb&&(a=n==r.S&&t.v==i.v?r.Mc:r.Ha),e==r.Mc&&(a=dl(r.S,r.Kc,r.Ha,n,t,i)),e==r.Kc&&(a=dl(r.S,r.Ec,r.Ha,n,t,i)),e==r.Ec&&(a=dl(r.S,r.S,r.Ha,n,t,i)),e==r.Rc&&(a=n==r.jb&&t.v==i.v?r.jb:r.Ha),e!=r.S&&e!=r.jb||(a=r.Ha),e==r.Ha&&(a=i.v&&t.v==i.v?r.O:r.F),a},Le:function(e,t,n){return r.dispatchEvent(new we("onstatechange",{state:e.name})),i.get(e)(t,n)},handleError:function(e){return p((function t(){return M(t,(function(t){switch(t.j){case 1:return w(t,Ps(r,e),2);case 2:return t.return(e.v?r.O:r.F)}}))}))},Bf:function(e){r.dispatchEvent(new we("onstateidle",{state:e.name}))}}),t&&this.Hb(t,!0)}_(qo,Bo),qo.prototype.updateManifestExpiration=function(e,t){var n=Uo(this.b,this.a),r=n.store(),i=new ge;return r.get(e).onsuccess=function(n){(n=n.target.result)?(n.expiration=t,r.put(n),i.resolve()):i.reject(new me(2,9,9012,"Could not find values for "+e))},n.promise().then((function(){return i}))},qo.prototype.ec=function(e){return{originalManifestUri:e.originalManifestUri,duration:e.duration,size:e.size,expiration:null==e.expiration?1/0:e.expiration,periods:e.periods.map(Xo),sessionIds:e.sessionIds,drmInfo:e.drmInfo,appMetadata:e.appMetadata}},qo.prototype.Jd=function(e){return{data:e.data}},_(es,Bo),es.prototype.hasFixedKeySpace=function(){return this.f},es.prototype.addSegments=function(e){return this.f?Ko(this.c):this.add(this.c,e)},es.prototype.addManifests=function(e){return this.f?Ko(this.a):this.add(this.a,e)},es.prototype.ec=function(e){return null==e.expiration&&(e.expiration=1/0),e},(r=ts.prototype).init=function(){var t=this,n=new ge,r=e.indexedDB.open("shaka_offline_db",4);return r.onsuccess=function(e){e=e.target.result,t.f=e;var r=e.objectStoreNames;r=r.contains("manifest")&&r.contains("segment")?new qo(e,"segment","manifest"):null,t.a=r,r=(r=e.objectStoreNames).contains("manifest-v2")&&r.contains("segment-v2")?new es(e,"segment-v2","manifest-v2",!0):null,t.b=r,r=(r=e.objectStoreNames).contains("manifest-v3")&&r.contains("segment-v3")?new es(e,"segment-v3","manifest-v3",!1):null,t.c=r,e=e.objectStoreNames.contains("session-ids")?new Ho(e):null,t.g=e,n.resolve()},r.onupgradeneeded=function(e){e=e.target.result;for(var t=f(["segment-v3","manifest-v3","session-ids"]),n=t.next();!n.done;n=t.next())n=n.value,e.objectStoreNames.contains(n)||e.createObjectStore(n,{autoIncrement:!0})},r.onerror=function(e){n.reject(new me(2,9,9001,r.error)),e.preventDefault()},n},r.destroy=function(){var e=this;return p((function t(){return M(t,(function(t){switch(t.j){case 1:if(!e.a){t.A(2);break}return w(t,e.a.destroy(),2);case 2:if(!e.b){t.A(4);break}return w(t,e.b.destroy(),4);case 4:if(!e.c){t.A(6);break}return w(t,e.c.destroy(),6);case 6:if(!e.g){t.A(8);break}return w(t,e.g.destroy(),8);case 8:e.f&&e.f.close(),S(t)}}))}))},r.getCells=function(){var e=new Map;return this.a&&e.set("v1",this.a),this.b&&e.set("v2",this.b),this.c&&e.set("v3",this.c),e},r.getEmeSessionCell=function(){return this.g},r.erase=function(){var t=this;return p((function n(){return M(n,(function(n){switch(n.j){case 1:if(!t.a){n.A(2);break}return w(n,t.a.destroy(),2);case 2:if(!t.b){n.A(4);break}return w(n,t.b.destroy(),4);case 4:if(!t.c){n.A(6);break}return w(n,t.c.destroy(),6);case 6:return t.f&&t.f.close(),w(n,function(){var t=new ge,n=e.indexedDB.deleteDatabase("shaka_offline_db");return n.onblocked=function(){},n.onsuccess=function(){t.resolve()},n.onerror=function(e){t.reject(new me(2,9,9001,n.error)),e.preventDefault()},t}(),8);case 8:return t.f=null,t.a=null,t.b=null,t.c=null,w(n,t.init(),0)}}))}))},Wo("idb",(function(){return e.indexedDB?new ts:null})),ns.prototype.wa=function(){return this.g},ns.prototype.ba=function(){return this.f},ns.prototype.key=function(){return this.c},ns.prototype.toString=function(){return this.b},(r=ls.prototype).configure=function(){},r.start=function(e){var t=this;return p((function n(){var r,i,a,o,s;return M(n,(function(n){switch(n.j){case 1:return r=rs(e),t.a=r,null==r||"manifest"!=r.a?n.return(Promise.reject(new me(2,1,9004,r))):(i=new Yo,C(n,2),w(n,i.init(),4));case 4:return w(n,zo(i,r.wa(),r.ba()),5);case 5:return w(n,n.o.getManifests([r.key()]),6);case 6:return a=n.o,o=a[0],s=new is(r.wa(),r.ba()),n.return(function(e,t){var n=new yi(null,0);n.xa(t.duration);var r=t.periods.map((function(t){return as(e,t,n)})),i=t.drmInfo?[t.drmInfo]:[];return t.drmInfo&&r.forEach((function(e){e.variants.forEach((function(e){e.drmInfos=i}))})),{presentationTimeline:n,minBufferTime:2,offlineSessionIds:t.sessionIds,periods:r}}(s,o));case 2:return L(n),w(n,i.destroy(),7);case 7:I(n,0)}}))}))},r.stop=function(){return Promise.resolve()},r.update=function(){},r.onExpirationUpdated=function(e,t){var n=this;return p((function r(){var i,a,o,s,l,u,c;return M(r,(function(r){switch(r.j){case 1:return i=n.a,a=new Yo,k(r,2,3),w(r,a.init(),5);case 5:return w(r,zo(a,i.wa(),i.ba()),6);case 6:return w(r,(o=r.o).getManifests([i.key()]),7);case 7:if(s=r.o,l=s[0],u=l.sessionIds.includes(e),c=null==l.expiration||l.expiration>t,!u||!c){r.A(3);break}return w(r,o.updateManifestExpiration(i.key(),t),3);case 3:return L(r),w(r,a.destroy(),10);case 10:I(r,0);break;case 2:R(r),r.A(3)}}))}))},gi.Cb("application/x-offline-manifest",ls),V("shaka.offline.OfflineScheme",us),us.h=function(e){return _e(e={uri:e,ld:e,data:new ArrayBuffer(0),headers:{"content-type":"application/x-offline-manifest"}})},us.i=function(e,t){var n=new Yo;return _e(void 0).U((function(){return n.init()})).U((function(){return zo(n,t.wa(),t.ba())})).U((function(e){return e.getSegments([t.key()])})).U((function(e){return{uri:t,ld:t,data:e[0].data,headers:{}}})).finally((function(){return n.destroy()}))},De("offline",us),fs.prototype.destroy=function(){var e=this;return p((function t(){return M(t,(function(t){switch(t.j){case 1:return e.l=!1,e.b&&e.b.abort(),ps(e),w(t,e.m,2);case 2:e.a&&e.a.va.Ya();for(var n=f(e.f),r=n.next();!r.done;r=n.next())r.value.va.Ya();e.a=null,e.f=[],e.g=null,S(t)}}))}))},V("shaka.text.SimpleTextDisplayer",ms),ms.prototype.remove=function(e,t){return!!this.a&&(ys(this.a,(function(n){return n.startTime<t&&n.endTime>e})),!0)},ms.prototype.remove=ms.prototype.remove,ms.prototype.append=function(e){for(var t=gs,n=[],r=0;r<e.length;r++){var i=t(e[r]);i&&n.push(i)}n.slice().sort((function(e,t){return e.startTime!=t.startTime?e.startTime-t.startTime:e.endTime!=t.endTime?e.endTime-t.startTime:n.indexOf(t)-n.indexOf(e)})).forEach(function(e){this.a.addCue(e)}.bind(this))},ms.prototype.append=ms.prototype.append,ms.prototype.destroy=function(){return this.a&&ys(this.a,(function(){return!0})),this.a=null,Promise.resolve()},ms.prototype.destroy=ms.prototype.destroy,ms.prototype.isTextVisible=function(){return"showing"==this.a.mode},ms.prototype.isTextVisible=ms.prototype.isTextVisible,ms.prototype.setTextVisibility=function(e){this.a.mode=e?"showing":"hidden"},ms.prototype.setTextVisibility=ms.prototype.setTextVisibility,V("shaka.util.ConfigUtils.mergeConfigObjects",vs),V("shaka.util.ConfigUtils.convertToConfigObject",bs),V("shaka.util.PlayerConfiguration",_s),_s.mergeConfigObjects=Es,G(xs,ke),V("shaka.Player",xs),xs.prototype.destroy=function(){var e=this;return p((function t(){var n;return M(t,(function(t){switch(t.j){case 1:return e.i==hl?t.return():(e.i=hl,n=hs(e.lb,(function(){return{node:e.F,payload:{Aa:null,v:null,mimeType:null,startTime:null,zd:null,uri:null},Va:!1}})),w(t,new Promise((function(t){n.wb=function(){},n.pc=function(){t(),e.dispatchEvent(new we("loaded"))},n.Ya=function(){t()},n.onError=function(){t()},n.rc=function(){t()}})),2));case 2:return w(t,e.lb.destroy(),3);case 3:if(e.g&&(e.g.release(),e.g=null),e.Dc=null,e.l=null,e.c=null,!e.K){t.A(0);break}return w(t,e.K.destroy(),5);case 5:e.K=null,S(t)}}))}))},xs.prototype.destroy=xs.prototype.destroy,xs.version="v2.5.10";var Rs=["2","5"];Yn=new function(e){this.a=e,this.c=Gn,this.b=Hn}(new Kn(Number(Rs[0]),Number(Rs[1])));var Ls=["output-restricted","internal-error"],Is={};function Ps(e,t){return p((function n(){return M(n,(function(n){switch(n.j){case 1:if(e.i!=hl&&(e.i=pl),e.dispatchEvent(new we("unloading")),t.Aa=null,t.mimeType=null,t.startTime=null,t.uri=null,t.v&&(e.g.ea(t.v,"loadeddata"),e.g.ea(t.v,"playing"),e.g.ea(t.v,"pause"),e.g.ea(t.v,"ended"),e.g.ea(t.v,"ratechange")),e.ib&&(e.ib.release(),e.ib=null),e.Zb&&(e.Zb.stop(),e.Zb=null),!e.s){n.A(2);break}return w(n,e.s.stop(),3);case 3:e.s=null;case 2:if(!e.l){n.A(4);break}return w(n,e.l.stop(),4);case 4:if(!e.f){n.A(6);break}return w(n,e.f.destroy(),7);case 7:e.f=null;case 6:if(e.m&&(e.m.release(),e.m=null),!e.D){n.A(8);break}return w(n,e.D.destroy(),9);case 9:e.D=null;case 8:if(!t.v||!t.v.src){n.A(10);break}return w(n,new Promise((function(e){return new fe(e).R(.1)})),11);case 11:t.v.removeAttribute("src"),t.v.load();case 10:if(!e.h){n.A(12);break}return w(n,e.h.destroy(),13);case 13:e.h=null;case 12:e.$.a.clear(),e.Fb=null,e.B=null,e.ac.clear(),e.b=null,e.u=null,e.Fc=null,e.kb=!0,Vs(e),S(n)}}))}))}function js(e,t){e.B=new Ta,e.B.a=Sa,wa(e.B,t,Math.min(.5,t/2)),Vs(e),e.Zb=new fe((function(){Os(e)})).Na(.25)}function Os(e){switch(e.i){case gl:var t=!!e.a.ended||Ut(e.a.buffered)>=e.a.duration-1;break;case ml:e:if(e.a.ended||En(e.D))t=!0;else{if(e.b.presentationTimeline.V()){var n=e.b.presentationTimeline.pb();if(Ut(e.a.buffered)>=n){t=!0;break e}}t=!1}break;default:t=!1}var r=Bt(e.a.buffered,e.a.currentTime),i=t,a=(n=e.B).b.get(n.a);t=n.a,r=i||r>=a?ka:Sa,n.a=r,t!=r&&Vs(e)}function Ds(e){if(e.s){var t=Ce(e.c.manifest);e.a&&"AUDIO"===e.a.nodeName&&(t.disableVideo=!0),e.s.configure(t)}if(e.h&&e.h.configure(e.c.drm),e.f){e.f.configure(e.c.streaming);try{e.b.periods.forEach(e.Nc.bind(e))}catch(t){e.Ma(t)}var n=ro(e.f),r=io(e.f);t=ll(e),n=Un.Qd(n,r,t.variants),e.l&&n&&n.allowedByApplication&&n.allowedByKeySystem?Hs(e,t.variants):Ys(e,t)}if(e.D&&(t=e.c.textDisplayFactory,e.Fc!=t)){n=new t;var i=(r=e.D).g;r.g=n,i&&(n.setTextVisibility(i.isTextVisible()),i.destroy()),r.a&&(r.a.c=n),e.Fc=t,e.f&&(n=(t=e.f).b.get("text"))&&uo(t,n.stream,!0,0,!0)}e.l&&(e.l.configure(e.c.abr),e.c.abr.enabled&&!e.kb?e.l.enable():e.l.disable(),Qs(e)),e.B&&(t=e.c.streaming.rebufferingGoal,e.b&&(t=Math.max(t,e.b.minBufferTime)),wa(e.B,t,Math.min(.5,t/2)))}function Ms(e,t,n,r){ma(e.$,t).variant=n,(e=e.u.c).c!=n&&(e.c=n,e.a.push({timestamp:Date.now()/1e3,id:n.id,type:"variant",fromAdaptation:r,bandwidth:n.bandwidth}))}function Ns(e,t,n,r){pa(e.$,t,n),(e=e.u.c).b!=n&&(e.b=n,e.a.push({timestamp:Date.now()/1e3,id:n.id,type:"text",fromAdaptation:r,bandwidth:null}))}function Us(e){var t=As();return t.streaming.failureCallback=function(t){e.V()&&[1001,1002,1003].includes(t.code)&&(t.severity=1,e.sd())},t.textDisplayFactory=function(){return new ms(e.a)},t}function Fs(e,t){var n=e.f?ro(e.f):null,r=e.f?io(e.f):null;if(t.forEach(Un.filterNewPeriod.bind(null,e.h,n,r)),0==(n=function(e,t){var n=0;return e.forEach((function(e){n+=t(e)?1:0})),n}(t,(function(e){return e.variants.some(Un.rb)}))))throw new me(2,4,4032);if(n<t.length)throw new me(2,4,4011);t.forEach(function(e){Un.Gd(e.variants,this.c.restrictions,this.bc)&&this.f&&ll(this)==e&&$s(this),rl(this,e.variants)}.bind(e))}function Bs(e,t,n,r){return n=void 0!==n&&n,r=void 0===r?0:r,e.kb?(e.pa=t,e.Ud=n,e.Rd=r,!0):((t=lo(e.f,t,n,r))&&qs(e),t)}function Ks(e,t){if(e.kb)return e.oa=t,!0;var n=uo(e.f,t,!0,0,!1);return n&&Xs(e),n}function Vs(e){var t=e.Xc();if(e.u&&e.B&&e.m){var n=e.W;n.f=t,Ua(n),Gs(e)}e.dispatchEvent(new we("buffering",{buffering:t}))}function Gs(e){if(e.u&&e.B){var t=e.u.a;e.B.a==Sa?ws(t,"buffering"):e.a.paused?ws(t,"paused"):e.a.ended?ws(t,"ended"):ws(t,"playing")}}function Hs(e,t){try{rl(e,t)}catch(t){return e.Ma(t),null}var n=t.filter((function(e){return Un.rb(e)}));return n=e.Gb.create(n),e.l.setVariants(Array.from(n.values())),e.l.chooseVariant()}function Ys(e,t){var n=zs(e,t,!1),r=Un.Jb(t.textStreams,e.na,e.fb)[0]||null,i=!1;r&&(e.c.streaming.alwaysStreamText||e.mc())&&(Ns(e,t,r,!0),i=Ks(e,r)),(n||i)&&Ws(e)}function zs(e,t,n){n=void 0===n||n;var r=Hs(e,t.variants),i=!1;return r&&(Ms(e,t,r,!0),i=Bs(e,r,!0)),n&&i&&Ws(e),i}function Ws(e){il(e,new we("adaptation"))}function $s(e){il(e,new we("trackschanged"))}function qs(e){il(e,new we("variantchanged"))}function Xs(e){il(e,new we("textchanged"))}function Js(e){il(e,new we("texttrackvisibility"))}function Qs(e){il(e,new we("abrstatuschanged",{Ig:e.c.abr.enabled}))}function Zs(e,t,n){e.dispatchEvent(new we(t,{detail:{schemeIdUri:n.schemeIdUri,value:n.value,startTime:n.startTime,endTime:n.endTime,id:n.id,eventElement:n.eventElement}}))}function el(e){if(!e.a.error)return null;var t=e.a.error.code;if(1==t)return null;var n=e.a.error.msExtendedCode;return n&&(0>n&&(n+=Math.pow(2,32)),n=n.toString(16)),new me(2,3,3016,t,n,e.a.error.message)}function tl(e,t){if(e.f){var n=ll(e),r=!1,i=Object.keys(t),a=1==i.length&&"00"==i[0];i.length&&e.b.periods.forEach((function(e){e.variants.forEach((function(e){Un.nf(e).forEach((function(n){var i=e.allowedByKeySystem;n.keyId&&(n=t[a?"00":n.keyId],e.allowedByKeySystem=!!n&&!Ls.includes(n)),i!=e.allowedByKeySystem&&(r=!0)}))}))})),i=ro(e.f);var o=io(e.f);(i=Un.Qd(i,o,n.variants))&&!i.allowedByKeySystem&&zs(e,n),r&&($s(e),Hs(e,n.variants))}}function nl(e,t,n){e.s&&e.s.onExpirationUpdated&&e.s.onExpirationUpdated(t,n),e.dispatchEvent(new we("expirationupdated"))}function rl(e,t){var n=e.h?$e(e.h.W):{},r=Object.keys(n);r=r.length&&"00"==r[0];for(var i=!1,a=!1,o=[],s=[],l=f(t),u=l.next();!u.done;u=l.next()){var c=[];(u=u.value).audio&&c.push(u.audio),u.video&&c.push(u.video);for(var d=(c=f(c)).next();!d.done;d=c.next())if((d=d.value).keyId){var h=n[r?"00":d.keyId];h?Ls.includes(h)&&(s.includes(h)||s.push(h)):o.includes(d.keyId)||o.push(d.keyId)}u.allowedByApplication?u.allowedByKeySystem&&(i=!0):a=!0}if(!i)throw new me(2,4,4012,{hasAppRestrictions:a,missingKeys:o,restrictedKeyStatuses:s})}function il(e,t){p((function n(){return M(n,(function(n){switch(n.j){case 1:return w(n,Promise.resolve(),2);case 2:e.i!=hl&&e.dispatchEvent(t),S(n)}}))}))}function al(e){for(var t=new Set,n=(e=f(e)).next();!n.done;n=e.next())(n=n.value).language?t.add(On(n.language)):t.add("und");return t}function ol(e){for(var t=new Map,n=(e=f(e)).next();!n.done;n=e.next()){var r=n.value;n="und";var i=[];for(r.language&&(n=On(r.language)),(i="variant"==r.type?r.audioRoles:r.roles)&&i.length||(i=[""]),t.has(n)||t.set(n,new Set),i=(r=f(i)).next();!i.done;i=r.next())i=i.value,t.get(n).add(i)}var a=[];return t.forEach((function(e,t){for(var n=f(e),r=n.next();!r.done;r=n.next())a.push({language:t,role:r.value})})),a}function sl(e){return null==(e=ll(e))?[]:e.variants.filter((function(e){return Un.rb(e)}))}function ll(e){for(var t=e.m.h(),n=null,r=(e=f(e.b.periods)).next();!r.done;r=e.next())(r=r.value).startTime<=t&&(n=r);return n}function ul(e){var t=ll(e);return ma(e.$,t).variant}function cl(){return new me(2,7,7e3)}function dl(e,t,n,r,i,a){return r==e&&i.v==a.v&&i.uri==a.uri&&i.mimeType==a.mimeType&&i.Aa==a.Aa?t:n}function fl(e){return new Promise((function(t,n){e.Ya=function(){return n(cl())},e.pc=function(){return t()},e.onError=function(e){return n(e)},e.rc=function(){return n(cl())}}))}xs.registerSupportPlugin=function(e,t){Is[e]=t},xs.isBrowserSupported=function(){if(!(e.Promise&&e.Uint8Array&&Array.prototype.forEach))return!1;var t=tt();return!(t&&12>t||!(e.MediaKeys&&e.navigator&&e.navigator.requestMediaKeySystemAccess&&e.MediaKeySystemAccess&&e.MediaKeySystemAccess.prototype.getConfiguration))&&(!!Qe()||Ze("application/x-mpegurl"))},xs.probeSupport=function(){return xt().then((function(e){for(var t=gi.Sf(),n={},r=f('video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",video/mp4; codecs="av01.0.01M.08",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="opus",audio/mp4; codecs="flac",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="vp09.00.10.08",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",")),i=r.next();!i.done;i=r.next()){n[i=i.value]=Qe()?!!mn(i)||MediaSource.isTypeSupported(i)||Wt(i):Ze(i);var a=i.split(";")[0];n[a]=n[a]||n[i]}for(var o in e={manifest:t,media:n,drm:e},Is)e[o]=Is[o]();return e}))},xs.prototype.Hb=function(e,t){if(t=void 0===t||t,this.i==hl)return Promise.reject(cl());var n={Aa:null,v:null,mimeType:null,startTime:null,zd:null,uri:null};n.v=e,Qe()||(t=!1);var r=t?this.hb:this.O,i=hs(this.lb,(function(){return{node:r,payload:n,Va:!1}}));return i.wb=function(){},fl(i)},xs.prototype.attach=xs.prototype.Hb,xs.prototype.detach=function(){var e=this;if(this.i==hl)return Promise.reject(cl());var t=hs(this.lb,(function(){return{node:e.F,payload:{Aa:null,v:null,mimeType:null,startTime:null,zd:null,uri:null},Va:!1}}));return t.wb=function(){},fl(t)},xs.prototype.detach=xs.prototype.detach,xs.prototype.Cd=function(e){var t=this;if(e=void 0===e||e,this.i==hl)return Promise.reject(cl());Qe()||(e=!1);var n={Aa:null,v:null,mimeType:null,startTime:null,zd:null,uri:null},r=hs(this.lb,(function(r){var i=r.v&&e?t.hb:r.v?t.O:t.F;return n.v=r.v,{node:i,payload:n,Va:!1}}));return r.wb=function(){},fl(r)},xs.prototype.unload=xs.prototype.Cd,xs.prototype.load=function(e,t,n){if(this.i==hl)return Promise.reject(cl());this.dispatchEvent(new we("loading"));var r={Aa:null,v:null,mimeType:null,startTime:null,zd:null,uri:null};r.uri=e,r.zd=Date.now()/1e3,n&&"string"!=typeof n&&(Vn("Loading with a manifest parser factory","Please register a manifest parser and for the mime-type."),r.Aa=function(){return new n}),n&&"string"==typeof n&&(r.mimeType=n),void 0!==t&&(r.startTime=t);var i=function(e,t){if(t.Aa)return!1;if(!Qe())return!0;var n=t.mimeType,r=t.uri||"";return n||(n={mp4:"video/mp4",m4v:"video/mp4",m4a:"audio/mp4",webm:"video/webm",weba:"audio/webm",mkv:"video/webm",ts:"video/mp2t",ogv:"video/ogg",ogg:"audio/ogg",mpg:"video/mpeg",mpeg:"video/mpeg",m3u8:"application/x-mpegurl",mp3:"audio/mpeg",aac:"audio/aac",flac:"audio/flac",wav:"audio/wav"}[gi.getExtension(r)]),!!n&&""!=(t.v||rt()).canPlayType(n)&&(!gi.isSupported(r,n)||et()&&e.c.streaming.useNativeHlsOnSafari)}(this,r)?this.jb:this.S,a=hs(this.lb,(function(e){return null==e.v?null:(r.v=e.v,{node:i,payload:r,Va:!0})}));return a.wb=function(){},new Promise((function(e,t){a.rc=function(){return t(new me(2,7,7002))},a.pc=function(){return e()},a.Ya=function(){return t(cl())},a.onError=function(e){return t(e)}}))},xs.prototype.load=xs.prototype.load,xs.prototype.configure=function(e,t){2==arguments.length&&"string"==typeof e&&(e=bs(e,t));var n=Es(this.c,e,Us(this));return Ds(this),n},xs.prototype.configure=xs.prototype.configure,xs.prototype.getConfiguration=function(){var e=Us(this);return Es(e,this.c,Us(this)),e},xs.prototype.getConfiguration=xs.prototype.getConfiguration,xs.prototype.$f=function(){for(var e in this.c)delete this.c[e];Es(this.c,Us(this),Us(this)),Ds(this)},xs.prototype.resetConfiguration=xs.prototype.$f,xs.prototype.We=function(){return this.i},xs.prototype.getLoadMode=xs.prototype.We,xs.prototype.af=function(){return this.a},xs.prototype.getMediaElement=xs.prototype.af,xs.prototype.Mb=function(){return this.K},xs.prototype.getNetworkingEngine=xs.prototype.Mb,xs.prototype.hc=function(){return this.Fb},xs.prototype.getAssetUri=xs.prototype.hc,xs.prototype.Ze=function(){return Vn("getManifestUri",'Please use "getAssetUri" instead.'),this.hc()},xs.prototype.getManifestUri=xs.prototype.Ze,xs.prototype.V=function(){return this.b?this.b.presentationTimeline.V():!(!this.a||!this.a.src)&&1/0==this.a.duration},xs.prototype.isLive=xs.prototype.V,xs.prototype.Xa=function(){return!!this.b&&this.b.presentationTimeline.Xa()},xs.prototype.isInProgress=xs.prototype.Xa,xs.prototype.uf=function(){if(this.b){if(!this.b.periods.length)return!1;var e=this.b.periods[0].variants;return!!e.length&&!e[0].video}return!(!this.a||!this.a.src)&&(this.a.videoTracks?0==this.a.videoTracks.length:0==this.a.videoHeight)},xs.prototype.isAudioOnly=xs.prototype.uf,xs.prototype.bg=function(){if(this.b){var e=this.b.presentationTimeline;return{start:e.ob(),end:e.Ca()}}return this.a&&this.a.src&&(e=this.a.seekable).length?{start:e.start(0),end:e.end(e.length-1)}:{start:0,end:0}},xs.prototype.seekRange=xs.prototype.bg,xs.prototype.keySystem=function(){return _t(this.drmInfo())},xs.prototype.keySystem=xs.prototype.keySystem,xs.prototype.drmInfo=function(){return this.h?this.h.a:null},xs.prototype.drmInfo=xs.prototype.drmInfo,xs.prototype.Lb=function(){return this.h?this.h.Lb():1/0},xs.prototype.getExpiration=xs.prototype.Lb,xs.prototype.Xc=function(){return!!this.B&&this.B.a==Sa},xs.prototype.isBuffering=xs.prototype.Xc,xs.prototype.ef=function(){if(this.W){var e=this.W;e=e.f?0:e.c}else e=0;return e},xs.prototype.getPlaybackRate=xs.prototype.ef,xs.prototype.ug=function(e){0==e?q("A trick play rate of 0 is unsupported!"):(this.a.paused&&this.a.play(),this.W.set(e),this.i==ml&&so(this.f,1<Math.abs(e)))},xs.prototype.trickPlay=xs.prototype.ug,xs.prototype.Ge=function(){this.i==gl&&this.W.set(1),this.i==ml&&(this.W.set(1),so(this.f,!1))},xs.prototype.cancelTrickPlay=xs.prototype.Ge,xs.prototype.Vc=function(){if(this.b&&this.m){for(var e=ul(this),t=[],n=f(sl(this)),r=n.next();!r.done;r=n.next()){r=r.value;var i=Un.Ed(r);i.active=r==e,t.push(i)}return t}return this.a&&this.a.audioTracks?Array.from(this.a.audioTracks).map((function(e){return Un.rf(e)})):[]},xs.prototype.getVariantTracks=xs.prototype.Vc,xs.prototype.qb=function(){if(this.b&&this.m){for(var e=function(e){var t=ll(e);if(null==t)return null;if(!ma(e.$,t).text){var n=Un.Jb(t.textStreams,e.na,e.fb);n.length&&pa(e.$,t,n[0])}return ma(e.$,t).text}(this),t=[],n=f(function(e){var t=ll(e);return null==t?[]:t.textStreams.filter((function(t){return!e.ac.has(t)}))}(this)),r=n.next();!r.done;r=n.next()){r=r.value;var i=Un.xc(r);i.active=r==e,t.push(i)}return t}return this.a&&this.a.src&&this.a.textTracks?Array.from(this.a.textTracks).map((function(e){return Un.sf(e)})):[]},xs.prototype.getTextTracks=xs.prototype.qb,xs.prototype.td=function(e){if(this.b&&this.f){var t=ll(this),n=t.textStreams.find((function(t){return t.id==e.id}));n&&(Ns(this,t,n,!1),Ks(this,n),this.na=n.language)}else if(this.a&&this.a.src&&this.a.textTracks){for(n=(t=f(t=Array.from(this.a.textTracks))).next();!n.done;n=t.next())n=n.value,Un.Wc(n)==e.id?n.mode=this.gb?"showing":"hidden":n.mode="disabled";Xs(this)}},xs.prototype.selectTextTrack=xs.prototype.td,xs.prototype.dg=function(){Vn("selectEmbeddedTextTrack","If closed captions are signaled in the manifest, a text stream will be created to represent them. Please use SelectTextTrack.");var e=this.qb().filter((function(e){return"application/cea-608"==e.mimeType}));0<e.length&&this.td(e[0])},xs.prototype.selectEmbeddedTextTrack=xs.prototype.dg,xs.prototype.zg=function(){Vn("usingEmbeddedTextTrack","If closed captions are signaled in the manifest, a text stream will be created to represent them. There should be no reason to know if the player is playing embedded text.");var e=this.qb().filter((function(e){return e.active}))[0];return!!e&&"application/cea-608"==e.mimeType},xs.prototype.usingEmbeddedTextTrack=xs.prototype.zg,xs.prototype.fg=function(e,t,n){if(n=void 0===n?0:n,this.b&&this.f){var r=ll(this);this.c.abr.enabled&&q("Changing tracks while abr manager is enabled will likely result in the selected track being overriden. Consider disabling abr before calling selectVariantTrack().");var i=r.variants.find((function(t){return t.id==e.id}));i&&Un.rb(i)&&(Ms(this,r,i,!1),Bs(this,i,t,n),this.Gb=new Aa(i),Hs(this,r.variants))}else if(this.a&&this.a.audioTracks){for(n=(t=f(t=Array.from(this.a.audioTracks))).next();!n.done;n=t.next())n=n.value,Un.Wc(n)==e.id&&(n.enabled=!0);qs(this)}},xs.prototype.selectVariantTrack=xs.prototype.fg,xs.prototype.Re=function(){return ol(this.Vc())},xs.prototype.getAudioLanguagesAndRoles=xs.prototype.Re,xs.prototype.mf=function(){return ol(this.qb())},xs.prototype.getTextLanguagesAndRoles=xs.prototype.mf,xs.prototype.Qe=function(){return Array.from(al(this.Vc()))},xs.prototype.getAudioLanguages=xs.prototype.Qe,xs.prototype.lf=function(){return Array.from(al(this.qb()))},xs.prototype.getTextLanguages=xs.prototype.lf,xs.prototype.cg=function(e,t){if(this.b&&this.m){var n=ll(this);this.Gb=new Ea(e,t||"",0,"","audio"),zs(this,n)}else if(this.a&&this.a.audioTracks){for(var r=(n=f(n=Array.from(this.a.audioTracks))).next();!r.done;r=n.next())(r=r.value).language==e&&(r.enabled=!0);qs(this)}},xs.prototype.selectAudioLanguage=xs.prototype.cg,xs.prototype.eg=function(e,t){if(this.b&&this.m){var n=ll(this);this.na=e,this.fb=t||"";var r=Un.Jb(n.textStreams,this.na,this.fb)[0]||null;r&&(Ns(this,n,r,!1),(this.c.streaming.alwaysStreamText||this.mc())&&Ks(this,r))}else(n=this.qb().filter((function(t){return t.language==e}))[0])&&this.td(n)},xs.prototype.selectTextLanguage=xs.prototype.eg,xs.prototype.gg=function(e){if(this.b&&this.m){for(var t=ll(this),n=null,r=f(sl(this)),i=r.next();!i.done;i=r.next())if((i=i.value).audio.label==e){n=i;break}null!=n&&(this.Gb=new Ea(n.language,"",0,e),zs(this,t))}},xs.prototype.selectVariantsByLabel=xs.prototype.gg,xs.prototype.mc=function(){var e=this.gb;return this.D?this.D.g.isTextVisible():this.a&&this.a.src&&this.a.textTracks?Array.from(this.a.textTracks).some((function(e){return"showing"==e.mode})):e},xs.prototype.isTextTrackVisible=xs.prototype.mc,xs.prototype.jg=function(e){var t=this;return p((function n(){var r,i,a,o;return M(n,(function(n){switch(n.j){case 1:if(t.gb==(r=!!e))return n.return();if(t.gb=r,t.i!=ml){if(t.a&&t.a.src&&t.a.textTracks)for(var s=f(Array.from(t.a.textTracks)),l=s.next();!l.done;l=s.next())"disabled"!=(i=l.value).mode&&(i.mode=r?"showing":"hidden");n.A(2);break}if(t.D.g.setTextVisibility(r),t.c.streaming.alwaysStreamText){n.A(2);break}if(!r){(s=t.f).D=!0,(l=s.b.get("text"))&&(Co(l),s.b.delete("text")),n.A(2);break}if(a=ll(t),!(0<(o=Un.Jb(a.textStreams,t.na,t.fb)).length)){n.A(2);break}return w(n,oo(t.f,o[0]),2);case 2:Js(t),S(n)}}))}))},xs.prototype.setTextTrackVisibility=xs.prototype.jg,xs.prototype.gf=function(){if(!this.V())return null;if(this.b)return new Date(1e3*(this.b.presentationTimeline.f+this.a.currentTime));if(this.a&&this.a.getStartDate){var e=this.a.getStartDate();return isNaN(e.getTime())?null:new Date(e.getTime()+1e3*this.a.currentTime)}return null},xs.prototype.getPlayheadTimeAsDate=xs.prototype.gf,xs.prototype.jf=function(){if(!this.V())return null;if(this.b)return new Date(1e3*this.b.presentationTimeline.f);if(this.a&&this.a.getStartDate){var e=this.a.getStartDate();return isNaN(e.getTime())?null:e}return null},xs.prototype.getPresentationStartTimeAsDate=xs.prototype.jf,xs.prototype.Sc=function(){var e={total:[],audio:[],video:[],text:[]};return this.i==gl&&(e.total=Kt(this.a.buffered)),this.i==ml&&this.D.Sc(e),e},xs.prototype.getBufferedInfo=xs.prototype.Sc,xs.prototype.getStats=function(){if(this.i!=ml&&this.i!=gl)return{width:NaN,height:NaN,streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,corruptedFrames:NaN,estimatedBandwidth:NaN,loadLatency:NaN,playTime:NaN,pauseTime:NaN,bufferingTime:NaN,licenseTime:NaN,switchHistory:[],stateHistory:[]};Gs(this);var e=this.a;if(e.getVideoPlaybackQuality){e=e.getVideoPlaybackQuality();var t=this.u,n=Number(e.totalVideoFrames);t.m=Number(e.droppedVideoFrames),t.l=n,this.u.i=Number(e.corruptedVideoFrames)}e=this.h&&(e=this.h).K?e.K:NaN,this.u.h=e,this.i==ml&&((e=ul(this))&&(this.u.s=e.bandwidth),e&&e.video&&(t=this.u,n=e.video.height||NaN,t.u=e.video.width||NaN,t.g=n),e=this.l.getBandwidthEstimate(),this.u.f=e);var r=this.u;e=r.u,t=r.g,n=r.s;for(var i=r.l,a=r.m,o=r.i,s=r.f,l=r.b,u=Ss(r.a,"playing"),c=Ss(r.a,"paused"),d=Ss(r.a,"buffering"),h=r.h,p=function(e){function t(e){return{timestamp:e.timestamp,state:e.state,duration:e.duration}}for(var n=[],r=f(e.b),i=r.next();!i.done;i=r.next())n.push(t(i.value));return e.a&&n.push(t(e.a)),n}(r.a),m=[],g=(r=f(r.c.a)).next();!g.done;g=r.next())g=g.value,m.push({timestamp:g.timestamp,id:g.id,type:g.type,fromAdaptation:g.fromAdaptation,bandwidth:g.bandwidth});return{width:e,height:t,streamBandwidth:n,decodedFrames:i,droppedFrames:a,corruptedFrames:o,estimatedBandwidth:s,loadLatency:l,playTime:u,pauseTime:c,bufferingTime:d,licenseTime:h,stateHistory:p,switchHistory:m}},xs.prototype.getStats=xs.prototype.getStats,xs.prototype.addTextTrack=function(e,t,n,r,i,a){var o=this;return p((function s(){var l,u,c,d,f,h,p,m,g;return M(s,(function(s){switch(s.j){case 1:if(o.i==gl)throw Error("State error!");if(o.i!=ml)throw Error("State error!");if(l=ll(o),u=Yt,c=o.b.periods.indexOf(l),f=(d=c+1)>=o.b.periods.length?o.b.presentationTimeline.Y():o.b.periods[d].startTime,1/0==(h=f-l.startTime))throw new me(1,4,4033);return p=new Qr(1,0,h,(function(){return[e]}),0,null),m={id:o.Xd++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return 1},getSegmentReference:function(e){return 1==e?p:null},initSegmentReference:null,presentationTimeOffset:0,mimeType:r,codecs:i||"",kind:n,encrypted:!1,keyId:null,language:t,label:a||null,type:u.ra,primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,audioSamplingRate:null,closedCaptions:null},o.ac.add(m),l.textStreams.push(m),w(s,oo(o.f,m),2);case 2:return(g=ao(o.f,"text"))&&pa(o.$,l,g),o.ac.delete(m),Ys(o,l),$s(o),s.return(Un.xc(m))}}))}))},xs.prototype.addTextTrack=xs.prototype.addTextTrack,xs.prototype.vd=function(e,t){this.bc.width=e,this.bc.height=t},xs.prototype.setMaxHardwareResolution=xs.prototype.vd,xs.prototype.sd=function(){if(this.i==ml){var e=this.f;if(e.f)e=!1;else if(e.m)e=!1;else{for(var t=f(e.b.values()),n=t.next();!n.done;n=t.next())(n=n.value).Pb&&(n.Pb=!1,ko(e,n,.1));e=!0}}else e=!1;return e},xs.prototype.retryStreaming=xs.prototype.sd,xs.prototype.Xe=function(){return this.b},xs.prototype.getManifest=xs.prototype.Xe,xs.prototype.Ye=function(){return this.s?this.s.constructor:null},xs.prototype.getManifestParserFactory=xs.prototype.Ye,(r=xs.prototype).Nc=function(e){var t=this.f?ro(this.f):null,n=this.f?io(this.f):null;if(Un.filterNewPeriod(this.h,t,n,e),!(t=e.variants).some(Un.rb))throw new me(2,4,4011);if(rl(this,e.variants),Un.Gd(t,this.c.restrictions,this.bc)&&this.f&&ll(this)==e&&$s(this),e=this.h?this.h.a:null)for(n=(t=f(t)).next();!n.done;n=t.next())for(var r=(n=f(n.value.drmInfos)).next();!r.done;r=n.next())if((r=r.value).keySystem==e.keySystem)for(var i=(r=f(r.initData||[])).next();!i.done;i=r.next())i=i.value,bt(this.h,i.initDataType,i.initData)},r.zf=function(e){try{this.kb=!0,this.l.disable(),Qs(this);var t=Hs(this,e.variants),n=Un.Jb(e.textStreams,this.na,this.fb)[0]||null;this.pa&&(e.variants.includes(this.pa)&&(t=this.pa),this.pa=null),this.oa&&(e.textStreams.includes(this.oa)&&(n=this.oa),this.oa=null),t&&Ms(this,e,t,!0),n&&Ns(this,e,n,!0);var r=this.f,i=r.b.get("video");if(i)var a=r.c.periods[i.ia];else{var o=r.b.get("audio");a=o?r.c.periods[o.ia]:null}var s=t?t.audio:null;if(!a&&n){var l;if(l=s){e=n;var u=On(this.c.preferredTextLanguage),c=On(s.language),d=On(e.language);l=Pn(d,u)&&!Pn(c,d)}l&&(this.gb=!0),this.gb&&this.D.g.setTextVisibility(!0),Js(this)}return this.c.streaming.alwaysStreamText||this.mc()?{variant:t,text:n}:{variant:t,text:null}}catch(e){return this.Ma(e),{variant:null,text:null}}},r.Fe=function(){this.kb=!1,this.c.abr.enabled&&(this.l.enable(),Qs(this)),this.pa&&(lo(this.f,this.pa,this.Ud,this.Rd),qs(this),this.pa=null),this.oa&&(uo(this.f,this.oa,!0,0,!1),Xs(this),this.oa=null)},r.Ef=function(){this.s&&this.s.update&&this.s.update()},r.Jf=function(){this.m&&this.m.s()},r.Ma=function(e){if(this.i!=hl){var t=new we("error",{detail:e});this.dispatchEvent(t),t.defaultPrevented&&(e.handled=!0)}};var hl=0,pl=1,ml=2,gl=3;function yl(e,t){var n=as(new is(e.wa(),e.ba()),t.periods[0],new yi(null,0)),r=t.appMetadata||{};return n=vl(n),{offlineUri:e.toString(),originalManifestUri:t.originalManifestUri,duration:t.duration,size:t.size,expiration:t.expiration,tracks:n,appMetadata:r}}function vl(e){for(var t=[],n=Un.df(e.variants),r=(n=f(n)).next();!r.done;r=n.next())t.push(Un.Ed(r.value));for(n=(e=f(e.textStreams)).next();!n.done;n=e.next())t.push(Un.xc(n.value));return t}function bl(){this.a={}}function _l(e,t){var n=t.audio,r=t.video;if(n&&!r&&(e.a[n.id]=n.bandwidth||t.bandwidth),!n&&r&&(e.a[r.id]=r.bandwidth||t.bandwidth),n&&r){var i=n.bandwidth||393216,a=r.bandwidth||t.bandwidth-i;0>=a&&(a=t.bandwidth),e.a[n.id]=i,e.a[r.id]=a}}function Al(e,t){var n=e.a[t];return null==n&&(n=0),n}function El(e){this.a=!1,this.b=new ge,this.c=e}function Tl(e){var t=new Sl;e.periods.forEach((function(e,n){var r=Cl(e.variants);if(0==n)for(var i=(r=f(r.a)).next();!i.done;i=r.next())t.add(i.value);else!function(e,t){e.a=e.a.filter((function(e){return kl(t,e)}))}(t,r)}));for(var n=(e=f(e.periods)).next();!n.done;n=e.next())(n=n.value).variants=n.variants.filter((function(e){return kl(t,new wl(e))}))}function wl(e){var t=e.audio;e=e.video,this.b=t?t.mimeType:null,this.a=t?t.codecs.split(".")[0]:null,this.f=e?e.mimeType:null,this.c=e?e.codecs.split(".")[0]:null}function Sl(){this.a=[]}function kl(e,t){return e.a.some((function(e){return t.b==e.b&&t.a==e.a&&t.f==e.f&&t.c==e.c}))}function Cl(e){for(var t=new Sl,n=(e=f(e)).next();!n.done;n=e.next())t.add(new wl(n.value));return t}function xl(e){var t=this;if(e&&e.constructor!=xs)throw new me(2,9,9008);this.b=this.a=null,e?(this.a=e.c,this.b=e.Mb()):(this.a=As(),this.b=new je),this.f=!1,this.c=[],this.g=[];var n=!e;this.h=new El((function(){return p((function e(){var r;return M(e,(function(e){switch(e.j){case 1:return r=function(){},w(e,Promise.all(t.g.map((function(e){return e.then(r,r)}))),2);case 2:if(!n){e.A(3);break}return w(e,t.b.destroy(),3);case 3:t.a=null,t.b=null,S(e)}}))}))}))}function Rl(){if(Qe())e:{for(var e=f($o.values()),t=e.next();!t.done;t=e.next())if(t=(t=t.value)()){t.destroy(),e=!0;break e}e=!1}else e=!1;return e}function Ll(e,t){for(var n=[],r=f(e.periods),i=r.next();!i.done;i=r.next())for(var a=(i=f(i.value.streams)).next();!a.done;a=i.next())a=a.value,t&&"video"==a.contentType?n.push({contentType:qe(a.mimeType,a.codecs),robustness:e.drmInfo.videoRobustness}):t||"audio"!=a.contentType||n.push({contentType:qe(a.mimeType,a.codecs),robustness:e.drmInfo.audioRobustness});return n}function Il(e,t,n){return p((function r(){return M(r,(function(r){switch(r.j){case 1:return w(r,function(e,t,n,r){return p((function i(){var a,o,s;return M(i,(function(i){switch(i.j){case 1:return r.drmInfo?(a=function(e){var t=Array.from(e.a.keys());if(!t.length)throw new me(2,9,9e3,"No supported storage mechanisms found");return e.a.get(t[0]).getEmeSessionCell()}(n),o=r.sessionIds.map((function(e){return{sessionId:e,keySystem:r.drmInfo.keySystem,licenseUri:r.drmInfo.licenseServerUri,serverCertificate:r.drmInfo.serverCertificate,audioCapabilities:Ll(r,!1),videoCapabilities:Ll(r,!0)}})),w(i,cs(t,e,o),2)):i.return();case 2:return s=i.o,w(i,a.remove(s),3);case 3:return w(i,a.add(o.filter((function(e){return-1==s.indexOf(e.sessionId)}))),0)}}))}))}(e.b,e.a.drm,n,t),0)}}))}))}function Pl(e,t,n,r){function i(){s+=1,e.a.offline.progressCallback(l,s/o)}var a=function(e){var t=[];return e.periods.forEach((function(e){e.streams.forEach((function(e){null!=e.initSegmentKey&&t.push(e.initSegmentKey),e.segments.forEach((function(e){t.push(e.dataKey)}))}))})),t}(r),o=a.length+1,s=0,l=yl(n,r);return Promise.all([t.removeSegments(a,i),t.removeManifests([n.key()],i)])}function jl(e,t,n,r,i,a){var o={id:a.id,originalId:a.originalId,primary:a.primary,presentationTimeOffset:a.presentationTimeOffset||0,contentType:a.type,mimeType:a.mimeType,codecs:a.codecs,frameRate:a.frameRate,pixelAspectRatio:a.pixelAspectRatio,kind:a.kind,language:a.language,label:a.label,width:a.width||null,height:a.height||null,initSegmentKey:null,encrypted:a.encrypted,keyId:a.keyId,segments:[],variantIds:[]};i=i.presentationTimeline.Ob();var s=a.id,l=a.initSegmentReference;return l&&(l=vi(l.c(),l.b,l.a,e.a.streaming.retryParameters),Oo(t,s,l,.5*Al(r,a.id),!0,(function(t){return p((function r(){var i;return M(r,(function(r){switch(r.j){case 1:return w(r,n.addSegments([{data:t}]),2);case 2:i=r.o,e.c.push(i[0]),o.initSegmentKey=i[0],S(r)}}))}))}))),function(e,t,n){for(var r=null==(t=e.findSegmentPosition(t))?null:e.getSegmentReference(t);r;)n(r),r=e.getSegmentReference(++t)}(a,i,(function(i){var l=vi(i.c(),i.b,i.a,e.a.streaming.retryParameters);Oo(t,s,l,function(e,t,n){return n=n.endTime-n.startTime,Al(e,t)*n}(r,a.id,i),!1,(function(t){return p((function r(){var a;return M(r,(function(r){switch(r.j){case 1:return w(r,n.addSegments([{data:t}]),2);case 2:a=r.o,e.c.push(a[0]),o.segments.push({startTime:i.startTime,endTime:i.endTime,dataKey:a[0]}),S(r)}}))}))}))})),o}function Ol(e){if(e.h.a)throw new me(2,9,7001)}function Dl(){if(!Rl())throw new me(2,9,9e3)}function Ml(e,t){return p((function n(){return M(n,(function(n){switch(n.j){case 1:return e.g.push(t),C(n,2),w(n,t,4);case 4:return n.return(n.o);case 2:L(n),Re(e.g,t),I(n,0)}}))}))}function Nl(e){e.variants.map((function(e){return e.video}));var t=new Set(e.variants.map((function(e){return e.audio})));e=e.textStreams;for(var n=f(t),r=n.next();!r.done;r=n.next())for(var i=(r=f(t)).next();!i.done;i=r.next());for(n=(t=f(e)).next();!n.done;n=t.next())for(r=(n=f(e)).next();!r.done;r=n.next());}xs.LoadMode={DESTROYED:hl,NOT_LOADED:pl,MEDIA_SOURCE:ml,SRC_EQUALS:gl},El.prototype.destroy=function(){var e=this;return this.a?this.b:(this.a=!0,this.c().then((function(){e.b.resolve()}),(function(){e.b.resolve()})))},Sl.prototype.add=function(e){kl(this,e)||this.a.push(e)},V("shaka.offline.Storage",xl),xl.support=Rl,xl.prototype.destroy=function(){return this.h.destroy()},xl.prototype.destroy=xl.prototype.destroy,xl.prototype.configure=function(e,t){2==arguments.length&&"string"==typeof e&&(e=bs(e,t));var n=e,r=!1;return null!=n.trackSelectionCallback&&(r=!0,n.offline=n.offline||{},n.offline.trackSelectionCallback=n.trackSelectionCallback,delete n.trackSelectionCallback),null!=n.progressCallback&&(r=!0,n.offline=n.offline||{},n.offline.progressCallback=n.progressCallback,delete n.progressCallback),null!=n.usePersistentLicense&&(r=!0,n.offline=n.offline||{},n.offline.usePersistentLicense=n.usePersistentLicense,delete n.usePersistentLicense),r&&Vn("Storage.configure with OfflineConfig","Please configure storage with a player configuration."),Es(this.a,e)},xl.prototype.configure=xl.prototype.configure,xl.prototype.getConfiguration=function(){var e=As();return Es(e,this.a,As()),e},xl.prototype.getConfiguration=xl.prototype.getConfiguration,xl.prototype.Mb=function(){return this.b},xl.prototype.getNetworkingEngine=xl.prototype.Mb,xl.prototype.store=function(e,t,n){var r=this;return Ml(this,function(e,t,n,r){return p((function i(){var a,o,s,l,u,c,d,h,m;return M(i,(function(i){switch(i.j){case 1:return Dl(),e.f?i.return(Promise.reject(new me(2,9,9006))):(e.f=!0,w(i,function(e,t,n){return p((function r(){var i,a,o,s,l,u;return M(r,(function(r){switch(r.j){case 1:return i=null,a=e.b,o={networkingEngine:a,filterAllPeriods:function(){},filterNewPeriod:function(){},onTimelineRegionAdded:function(){},onEvent:function(){},onError:function(e){i=e}},w(r,n(),2);case 2:return(s=r.o).configure(e.a.manifest),Ol(e),C(r,3),w(r,s.start(t,o),5);case 5:return l=r.o,Ol(e),u=function(e){for(var t=new Set,n=(e=f(e.periods)).next();!n.done;n=e.next()){for(var r=f((n=n.value).textStreams),i=r.next();!i.done;i=r.next())t.add(i.value);for(n=f(n.variants),r=n.next();!r.done;r=n.next())(r=r.value).audio&&t.add(r.audio),r.video&&t.add(r.video)}return t}(l),w(r,Promise.all(Ye(u,(function(e){return e.createSegmentIndex()}))),6);case 6:if(Ol(e),i)throw i;return r.return(l);case 3:return L(r),w(r,s.stop(),7);case 7:I(r,0)}}))}))}(e,t,r),2));case 2:if(a=i.o,Ol(e),a.presentationTimeline.V()||a.presentationTimeline.Xa())throw new me(2,9,9005,t);return o=null,s=new Yo,u=l=null,k(i,3,4),w(i,function(e,t,n){return p((function r(){var i,a,o;return M(r,(function(r){switch(r.j){case 1:return i=new pt({ub:e.b,onError:n,qc:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),a=Oa(t.periods),o=e.a,i.configure(o.drm),w(r,function(e,t,n){return e.s=[],e.D=n,gt(e,t)}(i,a,o.offline.usePersistentLicense),2);case 2:return w(r,yt(i),3);case 3:return w(r,vt(i),4);case 4:return r.return(i)}}))}))}(e,a,(function(e){u=u||e})),6);case 6:if(o=i.o,Ol(e),u)throw u;return w(i,function(e,t,n){return p((function r(){var i;return M(r,(function(r){switch(r.j){case 1:return i={width:1/0,height:1/0},function(e,t,n){for(var r=(e=f(e.periods)).next();!r.done;r=e.next())(r=r.value).variants=r.variants.filter((function(e){return Un.bd(e,t,n)}))}(t,e.a.restrictions,i),function(e){for(var t=(e=f(e.periods)).next();!t.done;t=e.next())(t=t.value).variants=t.variants.filter((function(e){var t=!0;return e.audio&&(t=t&&_n(e.audio)),e.video&&(t=t&&_n(e.video)),t}))}(t),function(e,t){for(var n=f(e.periods),r=n.next();!r.done;r=n.next())(r=r.value).variants=r.variants.filter((function(e){return Rt(t,e)}))}(t,n),Tl(t),w(r,function(e,t){return p((function n(){var r,i,a,o;return M(n,(function(n){switch(n.j){case 1:r=null,i=f(e.periods),a=i.next();case 2:if(a.done){n.A(0);break}return o=a.value,r&&(o.variants=o.variants.filter((function(e){return kl(r,new wl(e))}))),w(n,t(o),5);case 5:r=Cl(o.variants),a=i.next(),n.A(2)}}))}))}(t,(function(t){return p((function n(){var r,i,a,o,s,l,u,c;return M(n,(function(n){switch(n.j){case 1:r=Un,i=[];for(var d=f(t.variants),h=d.next();!h.done;h=d.next())a=h.value,i.push(r.Ed(a));for(h=(d=f(t.textStreams)).next();!h.done;h=d.next())o=h.value,i.push(r.xc(o));return w(n,e.a.offline.trackSelectionCallback(i),2);case 2:for(s=n.o,l=new Set,u=new Set,h=(d=f(s)).next();!h.done;h=d.next())"variant"==(c=h.value).type&&l.add(c.id),"text"==c.type&&u.add(c.id);t.variants=t.variants.filter((function(e){return l.has(e.id)})),t.textStreams=t.textStreams.filter((function(e){return u.has(e.id)})),S(n)}}))}))})),2);case 2:(function(e){if(0==e.periods.length)throw new me(2,4,4014);for(var t=(e=f(e.periods)).next();!t.done;t=e.next())Nl(t.value)})(t),S(r)}}))}))}(e,a,o),7);case 7:return w(i,s.init(),8);case 8:return Ol(e),w(i,function(e){var t=null;if(e.a.forEach((function(e,n){e.getCells().forEach((function(e,r){e.hasFixedKeySpace()||t||(t={path:{wa:n,ba:r},ba:e})}))})),t)return t;throw new me(2,9,9013,"Could not find a cell that supports add-operations")}(s),9);case 9:return l=i.o,Ol(e),w(i,function(e,t,n,r,i,a){return p((function o(){var s,l,u,c,d,h,m,g,y,v;return M(o,(function(o){switch(o.j){case 1:return s=function(e,t,n){var r=null==t.expiration?1/0:t.expiration;return{offlineUri:null,originalManifestUri:e,duration:t.presentationTimeline.Y(),size:0,expiration:r,tracks:t=vl(t.periods[0]),appMetadata:n}}(i,r,a),l=r.periods.some((function(e){return e.variants.some((function(e){return e.drmInfos&&e.drmInfos.length}))})),u=r.periods.some((function(e){return e.variants.some((function(e){return e.drmInfos.some((function(e){return e.initData&&e.initData.length}))}))})),d=null,(c=l&&!u)&&(h=n.a,d=Ul.get(h.keySystem)),m=new jo(e.b,(function(t,n){s.size=n,e.a.offline.progressCallback(s,t)}),(function(t,r){c&&e.a.offline.usePersistentLicense&&d==r&&bt(n,"cenc",t)})),C(o,2),y=g=function(e,t,n,r,i,a,o){var s=new bl,l=i.periods.map((function(r){return function(e,t,n,r,i,a){for(var o=f(a.variants),s=o.next();!s.done;s=o.next())_l(r,s.value);for(o=f(a.textStreams),s=o.next();!s.done;s=o.next())r.a[s.value.id]=52;o=function(e){for(var t=new Set,n=f(e.textStreams),r=n.next();!r.done;r=n.next())t.add(r.value);for(e=f(e.variants),n=e.next();!n.done;n=e.next())(n=n.value).audio&&t.add(n.audio),n.video&&t.add(n.video);return t}(a);var l=new Map;for(o=f(o),s=o.next();!s.done;s=o.next()){s=s.value;var u=jl(e,t,n,r,i,s);l.set(s.id,u)}return a.variants.forEach((function(e){e.audio&&l.get(e.audio.id).variantIds.push(e.id),e.video&&l.get(e.video.id).variantIds.push(e.id)})),{startTime:a.startTime,streams:Array.from(l.values())}}(e,t,n,s,i,r)})),u=r.a,c=e.a.offline.usePersistentLicense;return u&&c&&(u.initData=[]),{originalManifestUri:a,duration:i.presentationTimeline.Y(),size:0,expiration:r.Lb(),periods:l,sessionIds:c?Et(r):[],drmInfo:u,appMetadata:o}}(e,m,t,n,r,i,a),w(o,function(e){return p((function t(){return M(t,(function(t){switch(t.j){case 1:return w(t,Promise.all(e.b.values()),2);case 2:return t.return(e.a.a)}}))}))}(m),4);case 4:if(y.size=o.o,g.expiration=n.Lb(),v=Et(n),g.sessionIds=e.a.offline.usePersistentLicense?v:[],l&&e.a.offline.usePersistentLicense&&!v.length)throw new me(2,9,9007);return o.return(g);case 2:return L(o),w(o,m.destroy(),5);case 5:I(o,0)}}))}))}(e,l.ba,o,a,t,n),10);case 10:if(c=i.o,Ol(e),u)throw u;return w(i,l.ba.addManifests([c]),11);case 11:return d=i.o,Ol(e),h=new ns("manifest",l.path.wa,l.path.ba,d[0]),i.return(yl(h,c));case 4:return L(i),e.f=!1,e.c=[],w(i,s.destroy(),12);case 12:if(!o){i.A(13);break}return w(i,o.destroy(),13);case 13:I(i,0);break;case 3:if(m=R(i),!l){i.A(15);break}return w(i,l.ba.removeSegments(e.c,(function(){})),15);case 15:throw u||m}}))}))}(this,e,t||{},(function(){return p((function t(){var i,a;return M(t,(function(t){switch(t.j){case 1:return n&&"string"!=typeof n?(Vn("Storing with a manifest parser factory","Please register a manifest parser and for the mime-type."),i=n,t.return(new i)):w(t,gi.create(e,r.b,r.a.manifest.retryParameters,n),2);case 2:return a=t.o,t.return(a)}}))}))})))},xl.prototype.store=xl.prototype.store,xl.prototype.kf=function(){return this.f},xl.prototype.getStoreInProgress=xl.prototype.kf,xl.prototype.remove=function(e){return Ml(this,function(e,t){return p((function n(){var r,i,a,o,s,l;return M(n,(function(n){switch(n.j){case 1:return Dl(),null==(r=rs(t))||"manifest"!=r.a?n.return(Promise.reject(new me(2,9,9004,t))):(i=r,a=new Yo,C(n,2),w(n,a.init(),4));case 4:return w(n,zo(a,i.wa(),i.ba()),5);case 5:return w(n,(o=n.o).getManifests([i.key()]),6);case 6:return s=n.o,l=s[0],w(n,Promise.all([Il(e,l,a),Pl(e,o,i,l)]),2);case 2:return L(n),w(n,a.destroy(),8);case 8:I(n,0)}}))}))}(this,e))},xl.prototype.remove=xl.prototype.remove,xl.prototype.Xf=function(){return Ml(this,function(e){return p((function t(){var n,r,i,a,o,s,l,u,c;return M(t,(function(t){switch(t.j){case 1:return Dl(),n=e.b,r=e.a.drm,i=new Yo,a=!1,C(t,2),w(t,i.init(),4);case 4:for(o=[],function(e,t){e.a.forEach((function(e){t(e.getEmeSessionCell())}))}(i,(function(e){return o.push(e)})),s=Promise.resolve(),l={},u=f(o),c=u.next();!c.done;l={wc:l.wc},c=u.next())l.wc=c.value,s=s.then(function(e){return function(){return p((function t(){var i,o;return M(t,(function(t){switch(t.j){case 1:return w(t,e.wc.getAll(),2);case 2:return i=t.o,w(t,cs(r,n,i),3);case 3:return o=t.o,w(t,e.wc.remove(o),4);case 4:o.length!=i.length&&(a=!0),S(t)}}))}))}}(l));return w(t,s,2);case 2:return L(t),w(t,i.destroy(),6);case 6:I(t,3);break;case 3:return t.return(!a)}}))}))}(this))},xl.prototype.removeEmeSessions=xl.prototype.Xf,xl.prototype.list=function(){return Ml(this,p((function e(){var t,n,r;return M(e,(function(e){switch(e.j){case 1:return Dl(),t=[],n=new Yo,C(e,2),w(e,n.init(),4);case 4:return r=Promise.resolve(),function(e,t){e.a.forEach((function(e,n){e.getCells().forEach((function(e,r){t({wa:n,ba:r},e)}))}))}(n,(function(e,n){r=r.then((function(){return p((function r(){return M(r,(function(r){switch(r.j){case 1:return w(r,n.getAllManifests(),2);case 2:r.o.forEach((function(n,r){var i=yl(new ns("manifest",e.wa,e.ba,r),n);t.push(i)})),S(r)}}))}))}))})),w(e,r,2);case 2:return L(e),w(e,n.destroy(),6);case 6:I(e,3);break;case 3:return e.return(t)}}))})))},xl.prototype.list=xl.prototype.list,xl.deleteAll=function(){return p((function e(){var t;return M(e,(function(e){switch(e.j){case 1:return t=new Yo,C(e,2),w(e,t.erase(),2);case 2:return L(e),w(e,t.destroy(),5);case 5:I(e,0)}}))}))};var Ul=(new Map).set("org.w3.clearkey","1077efecc0b24d02ace33c1e52e2fb4b").set("com.widevine.alpha","edef8ba979d64acea3c827dcd51d21ed").set("com.microsoft.playready","9a04f07998404286ab92e65be0885f95").set("com.adobe.primetime","f239e769efa348509c16a903c6932efb");Is.offline=Rl,V("shaka.polyfill.installAll",(function(){for(var e=0;e<Kl.length;++e)try{Kl[e].De()}catch(e){q("Error installing polyfill!",e)}}));var Fl,Bl,Kl=[];function Vl(e,t){for(var n={priority:t=t||0,De:e},r=0;r<Kl.length;r++)if(Kl[r].priority<t)return void Kl.splice(r,0,n);Kl.push(n)}function Gl(e){var t=e.type.replace(/^(webkit|moz|MS)/,"").toLowerCase();if("function"==typeof Event)var n=new Event(t,e);else(n=document.createEvent("Event")).initEvent(t,e.bubbles,e.cancelable);e.target.dispatchEvent(n)}function Hl(e,t,n){if("input"==e)switch(this.type){case"range":e="change"}HTMLInputElement.prototype.originalAddEventListener.call(this,e,t,n)}function Yl(){var e=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(t){for(var n=[],r=0;r<arguments.length;++r)n[r]=arguments[r];return(n=e.apply(this,n)).abort=function(){},n}}function zl(e,t){try{var n=new Wl(e,t);return Promise.resolve(n)}catch(e){return Promise.reject(e)}}function Wl(e,t){if(this.keySystem=e,e.startsWith("com.apple.fps"))for(var n=f(t),r=n.next();!r.done;r=n.next()){var i=r.value;if("required"==i.persistentState)r=null;else{r={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:i.initDataTypes,sessionTypes:["temporary"],label:i.label};var a=!1,o=!1;if(i.audioCapabilities)for(var s=f(i.audioCapabilities),l=s.next();!l.done;l=s.next())if((l=l.value).contentType){a=!0;var u=l.contentType.split(";")[0];WebKitMediaKeys.isTypeSupported(this.keySystem,u)&&(r.audioCapabilities.push(l),o=!0)}if(i.videoCapabilities)for(l=(i=f(i.videoCapabilities)).next();!l.done;l=i.next())(s=l.value).contentType&&(a=!0,l=s.contentType.split(";")[0],WebKitMediaKeys.isTypeSupported(this.keySystem,l)&&(r.videoCapabilities.push(s),o=!0));a||(o=WebKitMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),r=o?r:null}if(r)return void(this.a=r)}throw(n=Error("Unsupported keySystem")).name="NotSupportedError",n.code=DOMException.NOT_SUPPORTED_ERR,n}function $l(e){var t=this.mediaKeys;return t&&t!=e&&Xl(t,null),delete this.mediaKeys,(this.mediaKeys=e)?Xl(e,this):Promise.resolve()}function ql(e){this.b=new WebKitMediaKeys(e),this.a=new Be}function Xl(e,t){if(e.a.$a(),!t)return Promise.resolve();e.a.w(t,"webkitneedkey",Ql);try{return 1<=t.readyState?t.webkitSetMediaKeys(e.b):e.a.da(t,"loadedmetadata",(function(){t.webkitSetMediaKeys(e.b)})),Promise.resolve()}catch(e){return Promise.reject(e)}}function Jl(e){ke.call(this),this.b=null,this.g=e,this.c=this.a=null,this.f=new Be,this.sessionId="",this.expiration=NaN,this.closed=new ge,this.keyStatuses=new eu}function Ql(e){var t=new Event("encrypted");t.initDataType="cenc",t.initData=e.initData,this.dispatchEvent(t)}function Zl(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.a=t,e.dispatchEvent(new we("keystatuseschange"))}function eu(){this.size=0,this.a=void 0}function tu(e,t){try{var n=new nu(e,t);return Promise.resolve(n)}catch(e){return Promise.reject(e)}}function nu(e,t){this.keySystem=e;for(var n=!1,r=0;r<t.length;++r){var i=t[r],a={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:i.initDataTypes,sessionTypes:["temporary"],label:i.label},o=!1;if(i.audioCapabilities)for(var s=0;s<i.audioCapabilities.length;++s){var l=i.audioCapabilities[s];if(l.contentType){o=!0;var u=l.contentType.split(";")[0];MSMediaKeys.isTypeSupported(this.keySystem,u)&&(a.audioCapabilities.push(l),n=!0)}}if(i.videoCapabilities)for(s=0;s<i.videoCapabilities.length;++s)(l=i.videoCapabilities[s]).contentType&&(o=!0,u=l.contentType.split(";")[0],MSMediaKeys.isTypeSupported(this.keySystem,u)&&(a.videoCapabilities.push(l),n=!0));if(o||(n=MSMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),"required"==i.persistentState&&(n=!1),n)return void(this.a=a)}throw(n=Error("Unsupported keySystem")).name="NotSupportedError",n.code=DOMException.NOT_SUPPORTED_ERR,n}function ru(e){var t=this.mediaKeys;return t&&t!=e&&au(t,null),delete this.mediaKeys,(this.mediaKeys=e)?au(e,this):Promise.resolve()}function iu(e){this.a=new MSMediaKeys(e),this.b=new Be}function au(e,t){if(e.b.$a(),!t)return Promise.resolve();e.b.w(t,"msneedkey",su);var n=e;try{return 1<=t.readyState?t.msSetMediaKeys(e.a):t.addEventListener("loadedmetadata",(function e(){t.msSetMediaKeys(n.a),t.removeEventListener("loadedmetadata",e)})),Promise.resolve()}catch(e){return Promise.reject(e)}}function ou(e){ke.call(this),this.c=null,this.g=e,this.b=this.a=null,this.f=new Be,this.sessionId="",this.expiration=NaN,this.closed=new ge,this.keyStatuses=new uu}function su(e){if(e.initData){var t=document.createEvent("CustomEvent");t.initCustomEvent("encrypted",!1,!1,null),t.initDataType="cenc",t.initData=function(e){if(!e)return e;var t=new Fr(e);if(1>=t.data.length)return e;e=[];for(var n={},r=(t=f(t.data)).next();!r.done;n={lc:n.lc},r=t.next())n.lc=r.value,e.some(function(e){return function(t){return ht.za(t,e.lc)}}(n))||e.push(n.lc);return ht.concat.apply(ht,e instanceof Array?e:function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(f(e)))}(e.initData),this.dispatchEvent(t)}}function lu(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.a=t,e.dispatchEvent(new we("keystatuseschange"))}function uu(){this.size=0,this.a=void 0}function cu(){return Promise.reject(Error("The key system specified is not supported."))}function du(e){return null==e?Promise.resolve():Promise.reject(Error("MediaKeys not supported."))}function fu(){throw new TypeError("Illegal constructor.")}function hu(){throw new TypeError("Illegal constructor.")}V("shaka.polyfill.register",Vl),Vl((function(){wc()}),-1),Vl((function(){if(e.Document){var t=Element.prototype;t.requestFullscreen=t.requestFullscreen||t.mozRequestFullScreen||t.msRequestFullscreen||t.webkitRequestFullscreen,(t=Document.prototype).exitFullscreen=t.exitFullscreen||t.mozCancelFullScreen||t.msExitFullscreen||t.webkitExitFullscreen,"fullscreenElement"in document||(Object.defineProperty(document,"fullscreenElement",{get:function(){return document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement}}),Object.defineProperty(document,"fullscreenEnabled",{get:function(){return document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled}})),document.addEventListener("webkitfullscreenchange",Gl),document.addEventListener("webkitfullscreenerror",Gl),document.addEventListener("mozfullscreenchange",Gl),document.addEventListener("mozfullscreenerror",Gl),document.addEventListener("MSFullscreenChange",Gl),document.addEventListener("MSFullscreenError",Gl)}})),Vl((function(){var t=!1;if(nt("CrKey"))t=!0;else try{e.indexedDB&&(t=!1)}catch(e){t=!0}t&&delete e.indexedDB})),Vl((function(){nt("Trident/")&&!HTMLInputElement.prototype.originalAddEventListener&&(HTMLInputElement.prototype.originalAddEventListener=HTMLInputElement.prototype.addEventListener,HTMLInputElement.prototype.addEventListener=Hl)})),Vl((function(){navigator.languages||Object.defineProperty(navigator,"languages",{get:function(){return navigator.language?[navigator.language]:["en"]}})})),Vl((function(){})),Vl((function(){var t=tt();e.MediaSource&&(e.cast&&cast.__platform__&&cast.__platform__.canDisplayType?function(){var e=MediaSource.isTypeSupported,t=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=function(n){for(var r=n.split(/ *; */),i=r[0],a={},o=1;o<r.length;++o){var s=r[o].split("="),l=s[0];s=s[1].replace(/"(.*)"/,"$1"),a[l]=s}if(!(r=a.codecs))return e(n);var u=!1,c=!1;for(var d in n=r.split(",").filter((function(e){return t.test(e)&&(c=!0),/^(hev|hvc)1\.2/.test(e)&&(u=!0),!0})),c&&(u=!1),a.codecs=n.join(","),u&&(a.eotf="smpte2084"),a)i+="; "+d+'="'+a[d]+'"';return cast.__platform__.canDisplayType(i)}}():t?(function(){var e=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(t){return"mp2t"!=t.split(/ *; */)[0].split("/")[1].toLowerCase()&&e(t)}}(),12>=t?(Yl(),function(){var e=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(t,n){return e.call(this,t,n-.001)}}()):Yl()):nt("Tizen")&&function(){var e=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(t){return"opus"!=Xe(t)[0]&&e(t)}}())})),Wl.prototype.createMediaKeys=function(){var e=new ql(this.keySystem);return Promise.resolve(e)},Wl.prototype.getConfiguration=function(){return this.a},ql.prototype.createSession=function(e){if("temporary"!=(e=e||"temporary"))throw new TypeError("Session type "+e+" is unsupported on this platform.");return new Jl(this.b,e)},ql.prototype.setServerCertificate=function(e){return e&&new Uint8Array(e),Promise.resolve(!0)},G(Jl,ke),(r=Jl.prototype).generateRequest=function(e,t){this.a=new ge;try{this.b=this.g.createSession("video/mp4",new Uint8Array(t)),this.sessionId=this.b.sessionId||"",this.f.w(this.b,"webkitkeymessage",this.og.bind(this)),this.f.w(this.b,"webkitkeyadded",this.mg.bind(this)),this.f.w(this.b,"webkitkeyerror",this.ng.bind(this)),Zl(this,"status-pending")}catch(e){this.a.reject(e)}return this.a},r.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},r.update=function(e){this.c=new ge;try{this.b.update(new Uint8Array(e))}catch(e){this.c.reject(e)}return this.c},r.close=function(){try{this.b.close(),this.closed.resolve(),this.f.$a()}catch(e){this.closed.reject(e)}return this.closed},r.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},r.og=function(e){this.a&&(this.a.resolve(),this.a=null),this.dispatchEvent(new we("message",{messageType:null==this.keyStatuses.a?"license-request":"license-renewal",message:e.message.buffer}))},r.mg=function(){this.c&&(Zl(this,"usable"),this.c.resolve(),this.c=null)},r.ng=function(){var e=Error("EME PatchedMediaKeysApple key error");if(e.errorCode=this.b.error,null!=this.a)this.a.reject(e),this.a=null;else if(null!=this.c)this.c.reject(e),this.c=null;else switch(this.b.error.code){case WebKitMediaKeyError.MEDIA_KEYERR_OUTPUT:case WebKitMediaKeyError.MEDIA_KEYERR_HARDWARECHANGE:Zl(this,"output-not-allowed");break;default:Zl(this,"internal-error")}},(r=eu.prototype).forEach=function(e){this.a&&e(this.a,Fl)},r.get=function(e){if(this.has(e))return this.a},r.has=function(e){var t=Fl;return!(!this.a||!ht.za(new Uint8Array(e),new Uint8Array(t)))},r.entries=function(){},r.keys=function(){},r.values=function(){},Vl((function(){e.HTMLVideoElement&&e.WebKitMediaKeys&&(Fl=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=$l,e.MediaKeys=ql,e.MediaKeySystemAccess=Wl,navigator.requestMediaKeySystemAccess=zl)})),nu.prototype.createMediaKeys=function(){var e=new iu(this.keySystem);return Promise.resolve(e)},nu.prototype.getConfiguration=function(){return this.a},iu.prototype.createSession=function(e){if("temporary"!=(e=e||"temporary"))throw new TypeError("Session type "+e+" is unsupported on this platform.");return new ou(this.a,e)},iu.prototype.setServerCertificate=function(){return Promise.resolve(!1)},G(ou,ke),(r=ou.prototype).generateRequest=function(e,t){this.a=new ge;try{this.c=this.g.createSession("video/mp4",new Uint8Array(t),null),this.f.w(this.c,"mskeymessage",this.If.bind(this)),this.f.w(this.c,"mskeyadded",this.Gf.bind(this)),this.f.w(this.c,"mskeyerror",this.Hf.bind(this)),lu(this,"status-pending")}catch(e){this.a.reject(e)}return this.a},r.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},r.update=function(e){this.b=new ge;try{this.c.update(new Uint8Array(e))}catch(e){this.b.reject(e)}return this.b},r.close=function(){try{this.c.close(),this.closed.resolve(),this.f.$a()}catch(e){this.closed.reject(e)}return this.closed},r.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},r.If=function(e){this.a&&(this.a.resolve(),this.a=null),this.dispatchEvent(new we("message",{messageType:null==this.keyStatuses.a?"license-request":"license-renewal",message:e.message.buffer}))},r.Gf=function(){this.a?(lu(this,"usable"),this.a.resolve(),this.a=null):this.b&&(lu(this,"usable"),this.b.resolve(),this.b=null)},r.Hf=function(){var e=Error("EME PatchedMediaKeysMs key error");if(e.errorCode=this.c.error,null!=this.a)this.a.reject(e),this.a=null;else if(null!=this.b)this.b.reject(e),this.b=null;else switch(this.c.error.code){case MSMediaKeyError.MS_MEDIA_KEYERR_OUTPUT:case MSMediaKeyError.MS_MEDIA_KEYERR_HARDWARECHANGE:lu(this,"output-not-allowed");break;default:lu(this,"internal-error")}},(r=uu.prototype).forEach=function(e){this.a&&e(this.a,Bl)},r.get=function(e){if(this.has(e))return this.a},r.has=function(e){var t=Bl;return!(!this.a||!ht.za(new Uint8Array(e),new Uint8Array(t)))},r.entries=function(){},r.keys=function(){},r.values=function(){},Vl((function(){!e.HTMLVideoElement||!e.MSMediaKeys||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(Bl=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=ru,e.MediaKeys=iu,e.MediaKeySystemAccess=nu,navigator.requestMediaKeySystemAccess=tu)})),fu.prototype.createSession=function(){},fu.prototype.setServerCertificate=function(){},hu.prototype.getConfiguration=function(){},hu.prototype.createMediaKeys=function(){},Vl((function(){!e.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(navigator.requestMediaKeySystemAccess=cu,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=du,e.MediaKeys=fu,e.MediaKeySystemAccess=hu)}),-10);var pu,mu="";function gu(e){return mu?mu+e.charAt(0).toUpperCase()+e.slice(1):e}function yu(e,t){try{var n=new bu(e,t);return Promise.resolve(n)}catch(e){return Promise.reject(e)}}function vu(e){var t=this.mediaKeys;return t&&t!=e&&Au(t,null),delete this.mediaKeys,(this.mediaKeys=e)&&Au(e,this),Promise.resolve()}function bu(e,t){this.a=this.keySystem=e;var n=!1;"org.w3.clearkey"==e&&(this.a="webkit-org.w3.clearkey",n=!1);var r=!1,i=document.getElementsByTagName("video");i=i.length?i[0]:document.createElement("video");for(var a=0;a<t.length;++a){var o=t[a],s={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:o.initDataTypes,sessionTypes:["temporary"],label:o.label},l=!1;if(o.audioCapabilities)for(var u=0;u<o.audioCapabilities.length;++u){var c=o.audioCapabilities[u];if(c.contentType){l=!0;var d=c.contentType.split(";")[0];i.canPlayType(d,this.a)&&(s.audioCapabilities.push(c),r=!0)}}if(o.videoCapabilities)for(u=0;u<o.videoCapabilities.length;++u)(c=o.videoCapabilities[u]).contentType&&(l=!0,i.canPlayType(c.contentType,this.a)&&(s.videoCapabilities.push(c),r=!0));if(l||(r=i.canPlayType("video/mp4",this.a)||i.canPlayType("video/webm",this.a)),"required"==o.persistentState&&(n?(s.persistentState="required",s.sessionTypes=["persistent-license"]):r=!1),r)return void(this.b=s)}throw n="Unsupported keySystem","org.w3.clearkey"!=e&&"com.widevine.alpha"!=e||(n="None of the requested configurations were supported."),(n=Error(n)).name="NotSupportedError",n.code=DOMException.NOT_SUPPORTED_ERR,n}function _u(e){this.g=e,this.b=null,this.a=new Be,this.c=[],this.f={}}function Au(e,t){e.b=t,e.a.$a();var n=mu;t&&(e.a.w(t,n+"needkey",e.Mf.bind(e)),e.a.w(t,n+"keymessage",e.rg.bind(e)),e.a.w(t,n+"keyadded",e.pg.bind(e)),e.a.w(t,n+"keyerror",e.qg.bind(e)))}function Eu(e,t){var n=e.f[t];return n||((n=e.c.shift())?(n.sessionId=t,e.f[t]=n):null)}function Tu(e,t,n){ke.call(this),this.f=e,this.h=!1,this.a=this.b=null,this.c=t,this.g=n,this.sessionId="",this.expiration=NaN,this.closed=new ge,this.keyStatuses=new ku}function wu(e,t,n){if(e.h)return Promise.reject(Error("The session is already initialized."));e.h=!0;try{if("persistent-license"==e.g)if(n)var r=new Uint8Array(ut("LOAD_SESSION|"+n));else{var i=ut("PERSISTENT|"),a=new Uint8Array(i.byteLength+t.byteLength);a.set(new Uint8Array(i),0),a.set(new Uint8Array(t),i.byteLength),r=a}else r=new Uint8Array(t)}catch(e){return Promise.reject(e)}e.b=new ge;var o=gu("generateKeyRequest");try{e.f[o](e.c,r)}catch(t){if("InvalidStateError"!=t.name)return e.b=null,Promise.reject(t);new fe((function(){try{e.f[o](e.c,r)}catch(t){e.b.reject(t),e.b=null}})).R(.01)}return e.b}function Su(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.a=t,e.dispatchEvent(new we("keystatuseschange"))}function ku(){this.size=0,this.a=void 0}function Cu(e){if("picture-in-picture"==(e=e.target).webkitPresentationMode){document.pictureInPictureElement=e;var t=new Event("enterpictureinpicture");e.dispatchEvent(t)}else document.pictureInPictureElement==e&&(document.pictureInPictureElement=null),t=new Event("leavepictureinpicture"),e.dispatchEvent(t)}function xu(){return this.webkitSupportsPresentationMode("picture-in-picture")?(this.webkitSetPresentationMode("picture-in-picture"),document.pictureInPictureElement=this,Promise.resolve()):Promise.reject(Error("PiP not allowed by video element"))}function Ru(){var e=document.pictureInPictureElement;return e?(e.webkitSetPresentationMode("inline"),document.pictureInPictureElement=null,Promise.resolve()):Promise.reject(Error("No picture in picture element found"))}function Lu(){return!!this.hasAttribute("disablePictureInPicture")||!this.webkitSupportsPresentationMode("picture-in-picture")}function Iu(e){e?this.setAttribute("disablePictureInPicture",""):this.removeAttribute("disablePictureInPicture")}function Pu(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}function ju(t,n,r){return new e.TextTrackCue(t,n,r)}function Ou(t,n,r){return new e.TextTrackCue(t+"-"+n+"-"+r,t,n,r)}function Du(){}bu.prototype.createMediaKeys=function(){var e=new _u(this.a);return Promise.resolve(e)},bu.prototype.getConfiguration=function(){return this.b},(r=_u.prototype).createSession=function(e){if("temporary"!=(e=e||"temporary")&&"persistent-license"!=e)throw new TypeError("Session type "+e+" is unsupported on this platform.");var t=this.b||document.createElement("video");return t.src||(t.src="about:blank"),e=new Tu(t,this.g,e),this.c.push(e),e},r.setServerCertificate=function(){return Promise.resolve(!1)},r.Mf=function(e){var t=document.createEvent("CustomEvent");t.initCustomEvent("encrypted",!1,!1,null),t.initDataType="webm",t.initData=e.initData,this.b.dispatchEvent(t)},r.rg=function(e){var t=Eu(this,e.sessionId);t&&(e=new we("message",{messageType:null==t.keyStatuses.a?"licenserequest":"licenserenewal",message:e.message}),t.b&&(t.b.resolve(),t.b=null),t.dispatchEvent(e))},r.pg=function(e){(e=Eu(this,e.sessionId))&&(Su(e,"usable"),e.a&&e.a.resolve(),e.a=null)},r.qg=function(e){var t=Eu(this,e.sessionId);t&&t.handleError(e)},G(Tu,ke),(r=Tu.prototype).handleError=function(e){var t=Error("EME v0.1b key error");t.errorCode=e.errorCode,t.errorCode.systemCode=e.systemCode,!e.sessionId&&this.b?(t.method="generateRequest",45==e.systemCode&&(t.message="Unsupported session type."),this.b.reject(t),this.b=null):e.sessionId&&this.a?(t.method="update",this.a.reject(t),this.a=null):(t=e.systemCode,e.errorCode.code==MediaKeyError.MEDIA_KEYERR_OUTPUT?Su(this,"output-restricted"):Su(this,1==t?"expired":"internal-error"))},r.yd=function(e,t){if(this.a)this.a.then(this.yd.bind(this,e,t)).catch(this.yd.bind(this,e,t));else{if(this.a=e,"webkit-org.w3.clearkey"==this.c){var n=ot(t),r=JSON.parse(n);"oct"!=r.keys[0].kty&&(this.a.reject(Error("Response is not a valid JSON Web Key Set.")),this.a=null),n=ht.Ba(r.keys[0].k),r=ht.Ba(r.keys[0].kid)}else n=new Uint8Array(t),r=null;var i=gu("addKey");try{this.f[i](this.c,n,r,this.sessionId)}catch(e){this.a.reject(e),this.a=null}}},r.generateRequest=function(e,t){return wu(this,t,null)},r.load=function(e){return"persistent-license"==this.g?wu(this,null,e):Promise.reject(Error("Not a persistent session."))},r.update=function(e){var t=new ge;return this.yd(t,e),t},r.close=function(){if("persistent-license"!=this.g){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var e=gu("cancelKeyRequest");try{this.f[e](this.c,this.sessionId)}catch(e){}}return this.closed.resolve(),this.closed},r.remove=function(){return"persistent-license"!=this.g?Promise.reject(Error("Not a persistent session.")):this.close()},(r=ku.prototype).forEach=function(e){this.a&&e(this.a,pu)},r.get=function(e){if(this.has(e))return this.a},r.has=function(e){var t=pu;return!(!this.a||!ht.za(new Uint8Array(e),new Uint8Array(t)))},r.entries=function(){},r.keys=function(){},r.values=function(){},Vl((function(){if(!(!e.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration)){if(HTMLMediaElement.prototype.webkitGenerateKeyRequest)mu="webkit";else if(!HTMLMediaElement.prototype.generateKeyRequest)return;pu=new Uint8Array([0]).buffer,navigator.requestMediaKeySystemAccess=yu,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=vu,e.MediaKeys=_u,e.MediaKeySystemAccess=bu}})),Vl((function(){if(e.HTMLVideoElement){var t=HTMLVideoElement.prototype;t.requestPictureInPicture&&document.exitPictureInPicture||!t.webkitSupportsPresentationMode||(document.pictureInPictureEnabled=!0,document.pictureInPictureElement=null,t.requestPictureInPicture=xu,Object.defineProperty(t,"disablePictureInPicture",{get:Lu,set:Iu,enumerable:!0,configurable:!0}),document.exitPictureInPicture=Ru,document.addEventListener("webkitpresentationmodechanged",Cu,!0))}})),Vl((function(){if(e.HTMLMediaElement){var t=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){var e=t.apply(this);return e&&e.catch((function(){})),e}}})),Vl((function(){if(e.HTMLVideoElement){var t=HTMLVideoElement.prototype;!t.getVideoPlaybackQuality&&"webkitDroppedFrameCount"in t&&(t.getVideoPlaybackQuality=Pu)}})),Vl((function(){if(!e.VTTCue&&e.TextTrackCue){var t=TextTrackCue.length;if(3==t)e.VTTCue=ju;else if(6==t)e.VTTCue=Ou;else{try{var n=!!ju(1,2,"")}catch(e){n=!1}n&&(e.VTTCue=ju)}}})),V("shaka.text.TtmlTextParser",Du),Du.prototype.parseInit=function(){},Du.prototype.parseInit=Du.prototype.parseInit,Du.prototype.parseMedia=function(e,t){var n=ot(e),r=[],i=new DOMParser,a=null;if(""==n)return r;try{a=i.parseFromString(n,"text/xml")}catch(e){throw new me(2,2,2005,"Failed to parse TTML.")}if(a){if(n=a.getElementsByTagName("parsererror")[0])throw new me(2,2,2005,n.textContent);if(!(i=a.getElementsByTagName("tt")[0]))throw new me(2,2,2005,"TTML does not contain <tt> tag.");var o=Br.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","frameRate"),s=Br.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","subFrameRate"),l=Br.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","frameRateMultiplier"),u=Br.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","tickRate");if(a=i.getAttribute("xml:space")||"default",n=i.getAttribute("tts:extent"),"default"!=a&&"preserve"!=a)throw new me(2,2,2005,"Invalid xml:space value: "+a);a="default"==a,o=new ic(o,s,l,u),s=qu(i.getElementsByTagName("metadata")[0]),l=qu(i.getElementsByTagName("styling")[0]),u=qu(i.getElementsByTagName("layout")[0]);for(var c=[],d=0;d<u.length;d++){var h,p,m=u[d],g=l,y=n,v=new cn,b=m.getAttribute("xml:id");b?(v.id=b,b=null,y&&(b=Uu.exec(y)||Bu.exec(y)),y=b?Number(b[1]):null,b=b?Number(b[2]):null,(h=Zu(m,g,"extent"))&&null!=(h=(p=Uu.exec(h))||Bu.exec(h))&&(v.width=null!=y?100*Number(h[1])/y:Number(h[1]),v.height=null!=b?100*Number(h[2])/b:Number(h[2]),v.widthUnits=p||null!=y?dn:0,v.heightUnits=p||null!=b?dn:0),(m=Zu(m,g,"origin"))&&null!=(h=(p=Uu.exec(m))||Bu.exec(m))&&(v.viewportAnchorX=null!=b?100*Number(h[1])/b:Number(h[1]),v.viewportAnchorY=null!=y?100*Number(h[2])/y:Number(h[2]),v.viewportAnchorUnits=p||null!=y?dn:0)):v=null,v&&c.push(v)}for(n=(n=i.getElementsByTagName("body")[0])?Array.from(n.querySelectorAll("[begin]")):[],i=(n=f(n)).next();!i.done;i=n.next())(i=Xu(i.value,t.periodStart,o,s,l,u,c,a,!1))&&r.push(i)}return r},Du.prototype.parseMedia=Du.prototype.parseMedia;var Mu,Nu,Uu=/^(\d{1,2}(?:\.\d+)?|100)% (\d{1,2}(?:\.\d+)?|100)%$/,Fu=/^(\d+px|\d+em)$/,Bu=/^(\d+)px (\d+)px$/,Ku=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Vu=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Gu=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,Hu=/^(\d*(?:\.\d*)?)f$/,Yu=/^(\d*(?:\.\d*)?)t$/,zu=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,Wu={left:an,center:"center",right:"end",start:an,end:"end"},$u={left:"line-left",center:"center",right:"line-right"};function qu(e){var t=[];if(!e)return t;for(var n=f(e.childNodes),r=n.next();!r.done;r=n.next())(r=r.value).nodeType==Node.ELEMENT_NODE&&"br"!==r.nodeName&&(r=qu(r),t=t.concat(r));return t.length||t.push(e),t}function Xu(e,t,n,r,i,a,o,s,l){if(l&&"br"==e.nodeName)return(e=new qt(0,0,"")).spacer=!0,e;var u=/^[\s\n]*$/.test(e.textContent),c=e.nodeType==Node.ELEMENT_NODE&&!e.hasAttribute("begin")&&!e.hasAttribute("end");if(e.nodeType!=Node.ELEMENT_NODE||c&&u||c&&!l)return null;u=nc(e.getAttribute("begin"),n),c=nc(e.getAttribute("end"),n);var d=nc(e.getAttribute("dur"),n);if(null==c&&null!=d&&(c=u+d),!l&&(null==u||null==c))throw new me(2,2,2001);if(u+=t,c+=t,d="",l=[],Array.from(e.childNodes).find((function(e){return e.nodeType===Node.TEXT_NODE&&/\w+/.test(e.textContent)})))d=function e(t,n){for(var r="",i=f(t.childNodes),a=i.next();!a.done;a=i.next())"br"==(a=a.value).nodeName&&t.childNodes[0]!==a?r+="\n":a.childNodes&&0<a.childNodes.length?r+=e(a,n):r+=n?a=(a=a.textContent.trim()).replace(/\s+/g," "):a.textContent;return r}(e,s);else for(var h=f(e.childNodes),p=h.next();!p.done;p=h.next())(p=Xu(p.value,t,n,r,i,a,o,s,!0))&&l.push(p);if((t=new qt(u,c,d)).nestedCues=l,(a=tc(e,"region",a,"")[0])&&a.getAttribute("xml:id")){var m=a.getAttribute("xml:id");t.region=o.filter((function(e){return e.id==m}))[0]}return function(e,t,n,r,i){"rtl"==Qu(t,n,i,"direction")&&(e.direction="rtl");var a=Qu(t,n,i,"writingMode");if("tb"==a||"tblr"==a?e.writingMode="vertical-lr":"tbrl"==a?e.writingMode="vertical-rl":"rltb"==a||"rl"==a?e.direction="rtl":a&&(e.direction=tn),(a=Qu(t,n,i,"textAlign"))?(e.positionAlign=$u[a],e.lineAlign=Wu[a],e.textAlign=Qt[a.toUpperCase()]):e.textAlign="start",(a=Qu(t,n,i,"displayAlign"))&&(e.displayAlign=en[a.toUpperCase()]),(a=Qu(t,n,i,"color"))&&(e.color=a),(a=Qu(t,n,i,"backgroundColor"))&&(e.backgroundColor=a),(a=Qu(t,n,i,"fontFamily"))&&(e.fontFamily=a),(a=Qu(t,n,i,"fontWeight"))&&"bold"==a&&(e.fontWeight=700),(a=Qu(t,n,i,"wrapOption"))&&"noWrap"==a&&(e.wrapLine=!1),(a=Qu(t,n,i,"lineHeight"))&&a.match(Fu)&&(e.lineHeight=a),(a=Qu(t,n,i,"fontSize"))&&a.match(Fu)&&(e.fontSize=a),(a=Qu(t,n,i,"fontStyle"))&&(e.fontStyle=un[a.toUpperCase()]),r){a=r.getAttribute("imagetype");var o=r.getAttribute("encoding");r=r.textContent.trim(),"PNG"==a&&"Base64"==o&&r&&(e.backgroundImage="data:image/png;base64,"+r)}(n=Zu(n,i,"textDecoration"))&&Ju(e,n),(t=ec(t,i,"textDecoration"))&&Ju(e,t)}(t,e,a,r=tc(e,"smpte:backgroundImage",r,"#")[0],i),t}function Ju(e,t){for(var n=t.split(" "),r=0;r<n.length;r++)switch(n[r]){case"underline":e.textDecoration.includes("underline")||e.textDecoration.push("underline");break;case"noUnderline":e.textDecoration.includes("underline")&&Re(e.textDecoration,"underline");break;case"lineThrough":e.textDecoration.includes("lineThrough")||e.textDecoration.push("lineThrough");break;case"noLineThrough":e.textDecoration.includes("lineThrough")&&Re(e.textDecoration,"lineThrough");break;case"overline":e.textDecoration.includes("overline")||e.textDecoration.push("overline");break;case"noOverline":e.textDecoration.includes("overline")&&Re(e.textDecoration,"overline")}}function Qu(e,t,n,r){return(e=ec(e,n,r))?e:Zu(t,n,r)}function Zu(e,t,n){for(var r=qu(e),i=0;i<r.length;i++){var a=Br.getAttributeNS(r[i],"http://www.w3.org/ns/ttml#styling",n);if(a)return a}return(e=tc(e,"style",t,"")[0])?Br.getAttributeNS(e,"http://www.w3.org/ns/ttml#styling",n):null}function ec(e,t,n){var r=Br.getAttributeNS(e,"http://www.w3.org/ns/ttml#styling",n);if(r)return r;for(e=tc(e,"style",t,""),t=null,r=0;r<e.length;r++){var i=Br.getAttributeNS(e[r],"http://www.w3.org/ns/ttml#styling",n);i&&(t=i)}return t}function tc(e,t,n,r){var i=[];if(!e||1>n.length)return i;var a=e;for(e=null;a&&!(e=a.getAttribute(t))&&(a=a.parentNode)instanceof Element;);if(t=e)for(e=(t=f(t=t.split(" "))).next();!e.done;e=t.next()){e=e.value;for(var o=(a=f(n)).next();!o.done;o=a.next())if(r+(o=o.value).getAttribute("xml:id")==e){i.push(o);break}}return i}function nc(e,t){var n=null;if(Ku.test(e)){n=Ku.exec(e);var r=Number(n[1]),i=Number(n[2]),a=Number(n[3]),o=Number(n[4]);n=(a+=(o+=(Number(n[5])||0)/t.b)/t.frameRate)+60*i+3600*r}else Vu.test(e)?n=rc(Vu,e):Gu.test(e)?n=rc(Gu,e):Hu.test(e)?(n=Hu.exec(e),n=Number(n[1])/t.frameRate):Yu.test(e)?(n=Yu.exec(e),n=Number(n[1])/t.a):zu.test(e)&&(n=rc(zu,e));return n}function rc(e,t){var n=e.exec(t);return null==n||""==n[0]?null:(Number(n[4])||0)/1e3+(Number(n[3])||0)+60*(Number(n[2])||0)+3600*(Number(n[1])||0)}function ic(e,t,n,r){this.frameRate=Number(e)||30,this.b=Number(t)||1,this.a=Number(r),0==this.a&&(this.a=e?this.frameRate*this.b:1),n&&(e=/^(\d+) (\d+)$/g.exec(n))&&(this.frameRate*=Number(e[1])/Number(e[2]))}function ac(){this.a=new Du}function oc(){}function sc(e,t,n){var r;(r=/^align:(start|middle|center|end|left|right)$/.exec(t))?(t=r[1],e.textAlign="middle"==t?Jt:Qt[t.toUpperCase()]):(r=/^vertical:(lr|rl)$/.exec(t))?e.writingMode="lr"==r[1]?"vertical-lr":"vertical-rl":(r=/^size:([\d.]+)%$/.exec(t))?e.size=Number(r[1]):(r=/^position:([\d.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(t))?(e.position=Number(r[1]),r[2]&&(t=r[2],e.positionAlign="line-left"==t||"start"==t?"line-left":"line-right"==t||"end"==t?"line-right":"center")):(r=/^region:(.*)$/.exec(t))?(t=function(e,t){var n=e.filter((function(e){return e.id==t}));return n.length?n[0]:null}(n,r[1]))&&(e.region=t):(n=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(t))?(e.lineInterpretation=1,e.line=Number(n[1]),n[2]&&(e.lineAlign=on[n[2].toUpperCase()])):(n=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(t))&&(e.lineInterpretation=rn,e.line=Number(n[1]),n[2]&&(e.lineAlign=on[n[2].toUpperCase()]))}function lc(e){if(null==(e=Mi(e,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g)))return null;var t=Number(e[2]),n=Number(e[3]);return 59<t||59<n?null:Number(e[4])/1e3+n+60*t+3600*(Number(e[1])||0)}function uc(){this.a=null}function cc(e,t,n){var r,i,a;return(new jr).H("payl",Mr((function(e){r=ot(e)}))).H("iden",Mr((function(e){i=ot(e)}))).H("sttg",Mr((function(e){a=ot(e)}))).parse(e),r?function(e,t,n,r,i){if(e=new qt(r,i,e),t&&(e.id=t),n)for(t=new Oi(n),n=Ni(t);n;)sc(e,n,[]),Di(t),n=Ni(t);return e}(r,i,a,t,n):null} -/* - @license - EME Encryption Scheme Polyfill - Copyright 2019 Google LLC - SPDX-License-Identifier: Apache-2.0 -*/ -function dc(){}function fc(){Mu?console.debug("EmeEncryptionSchemePolyfill: Already installed."):navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration?(Mu=navigator.requestMediaKeySystemAccess,console.debug("EmeEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.requestMediaKeySystemAccess=hc):console.debug("EmeEncryptionSchemePolyfill: EME not found")}function hc(e,t){var n=this;return p((function r(){var i;return M(r,(function(r){switch(r.j){case 1:return console.assert(n==navigator,'bad "this" for requestMediaKeySystemAccess'),w(r,Mu.call(n,e,t),2);case 2:return Ec(i=r.o)?(console.debug("EmeEncryptionSchemePolyfill: Native encryptionScheme support found."),navigator.requestMediaKeySystemAccess=Mu,r.return(i)):(console.debug("EmeEncryptionSchemePolyfill: No native encryptionScheme support found. Patching encryptionScheme support."),navigator.requestMediaKeySystemAccess=pc,r.return(pc.call(n,e,t)))}}))}))}function pc(e,t){var n=this;return p((function r(){var i,a,o,s,l,u,c,d;return M(r,(function(r){switch(r.j){case 1:console.assert(n==navigator,'bad "this" for requestMediaKeySystemAccess'),i=Ac(e),a=[];for(var h=f(t),p=h.next();!p.done;p=h.next())o=p.value,s=mc(o.videoCapabilities,i),l=mc(o.audioCapabilities,i),o.videoCapabilities&&o.videoCapabilities.length&&!s.length||o.audioCapabilities&&o.audioCapabilities.length&&!l.length||((u=Object.assign({},o)).videoCapabilities=s,u.audioCapabilities=l,a.push(u));if(!a.length)throw(c=Error("Unsupported keySystem or supportedConfigurations.")).name="NotSupportedError",c.code=DOMException.NOT_SUPPORTED_ERR,c;return w(r,Mu.call(n,e,a),2);case 2:return d=r.o,r.return(new _c(d,i))}}))}))}function mc(e,t){return e?e.filter((function(e){return!e.encryptionScheme||e.encryptionScheme==t})):e}function gc(){}function yc(){navigator.mediaCapabilities?(Nu=navigator.mediaCapabilities.decodingInfo,console.debug("McEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=vc):console.debug("McEncryptionSchemePolyfill: MediaCapabilities not found")}function vc(e){var t=this;return p((function n(){var r;return M(n,(function(n){switch(n.j){case 1:return console.assert(t==navigator.mediaCapabilities,'bad "this" for decodingInfo'),w(n,Nu.call(t,e),2);case 2:return r=n.o,e.keySystemConfiguration?Ec(r.keySystemAccess)?(console.debug("McEncryptionSchemePolyfill: Native encryptionScheme support found."),navigator.mediaCapabilities.decodingInfo=Nu,n.return(r)):(console.debug("McEncryptionSchemePolyfill: No native encryptionScheme support found. Patching encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=bc,n.return(bc.call(t,e))):n.return(r)}}))}))}function bc(e){var t=this;return p((function n(){var r,i,a,o,s,l,u;return M(n,(function(n){switch(n.j){case 1:return console.assert(t==navigator.mediaCapabilities,'bad "this" for decodingInfo'),r=null,e.keySystemConfiguration&&(i=e.keySystemConfiguration,a=i.keySystem,o=i.audio&&i.audio.encryptionScheme,s=i.video&&i.video.encryptionScheme,r=Ac(a),l={powerEfficient:!1,smooth:!1,supported:!1,keySystemAccess:null,configuration:e},o&&o!=r||s&&s!=r)?n.return(l):w(n,Nu.call(t,e),2);case 2:return(u=n.o).keySystemAccess&&(u.keySystemAccess=new _c(u.keySystemAccess,r)),n.return(u)}}))}))}function _c(e,t){this.b=e,this.a=t,this.keySystem=e.keySystem}function Ac(e){return e.startsWith("com.widevine")||e.startsWith("com.microsoft")||e.startsWith("com.adobe")||e.startsWith("org.w3")?"cenc":e.startsWith("com.apple")?"cbcs-1-9":(console.warn("EmeEncryptionSchemePolyfill: Unknown key system:",e,"Please contribute!"),null)}function Ec(e){var t=(e=e.getConfiguration()).audioCapabilities&&e.audioCapabilities[0];return!(!(e=e.videoCapabilities&&e.videoCapabilities[0]||t)||void 0===e.encryptionScheme)}function Tc(){}function wc(){fc(),yc()}pn["application/ttml+xml"]=Du,V("shaka.text.Mp4TtmlParser",ac),ac.prototype.parseInit=function(e){var t=!1;if((new jr).H("moov",Or).H("trak",Or).H("mdia",Or).H("minf",Or).H("stbl",Or).fa("stsd",Dr).H("stpp",(function(e){t=!0,e.parser.stop()})).parse(e),!t)throw new me(2,2,2007)},ac.prototype.parseInit=ac.prototype.parseInit,ac.prototype.parseMedia=function(e,t){var n=!1,r=[];if((new jr).H("mdat",Mr(function(e){n=!0,r=r.concat(this.a.parseMedia(e,t))}.bind(this))).parse(e),!n)throw new me(2,2,2007);return r},ac.prototype.parseMedia=ac.prototype.parseMedia,pn['application/mp4; codecs="stpp"']=ac,pn['application/mp4; codecs="stpp.ttml.im1t"']=ac,pn['application/mp4; codecs="stpp.TTML.im1t"']=ac,V("shaka.text.VttTextParser",oc),oc.prototype.parseInit=function(){},oc.prototype.parseInit=oc.prototype.parseInit,oc.prototype.parseMedia=function(e,t){var n=ot(e);if(n=(n=n.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n")).split(/\n{2,}/m),!/^WEBVTT($|[ \t\n])/m.test(n[0]))throw new me(2,2,2e3);var r=t.segmentStart;if(null==r&&(r=0,n[0].includes("X-TIMESTAMP-MAP"))){var i=n[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),a=n[0].match(/MPEGTS:(\d+)/m);if(i&&a){if(null==(r=lc(new Oi(i[1]))))throw new me(2,2,2e3);r=t.periodStart+(Number(a[1])/9e4-r)}}a=[];var o=n[0].split("\n");for(i=1;i<o.length;i++)if(/^Region:/.test(o[i])){var s=new Oi(o[i]),l=new cn;Ni(s),Di(s);for(var u=Ni(s);u;){var c=l,d=u;(u=/^id=(.*)$/.exec(d))?c.id=u[1]:(u=/^width=(\d{1,2}|100)%$/.exec(d))?c.width=Number(u[1]):(u=/^lines=(\d+)$/.exec(d))?(c.height=Number(u[1]),c.heightUnits=2):(u=/^regionanchor=(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(d))?(c.regionAnchorX=Number(u[1]),c.regionAnchorY=Number(u[2])):(u=/^viewportanchor=(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(d))?(c.viewportAnchorX=Number(u[1]),c.viewportAnchorY=Number(u[2])):/^scroll=up$/.exec(d)&&(c.scroll="up"),Di(s),u=Ni(s)}a.push(l)}for(i=[],s=1;s<n.length;s++){if(u=o=n[s].split("\n"),d=r,o=a,1==u.length&&!u[0]||/^NOTE($|[ \t])/.test(u[0])||"STYLE"==u[0])o=null;else{l=null,u[0].includes("--\x3e")||(l=u[0],u.splice(0,1));var f=lc(c=new Oi(u[0])),h=Mi(c,/[ \t]+--\x3e[ \t]+/g),p=lc(c);if(null==f||null==h||null==p)throw new me(2,2,2001);for(u=new qt(f+d,p+d,u.slice(1).join("\n").trim()),Di(c),d=Ni(c);d;)sc(u,d,o),Di(c),d=Ni(c);null!=l&&(u.id=l),o=u}o&&i.push(o)}return i},oc.prototype.parseMedia=oc.prototype.parseMedia,pn["text/vtt"]=oc,pn['text/vtt; codecs="vtt"']=oc,V("shaka.text.Mp4VttParser",uc),uc.prototype.parseInit=function(e){var t=!1;if((new jr).H("moov",Or).H("trak",Or).H("mdia",Or).fa("mdhd",function(e){0==e.version?(e.reader.M(4),e.reader.M(4),this.a=e.reader.G(),e.reader.M(4)):(e.reader.M(8),e.reader.M(8),this.a=e.reader.G(),e.reader.M(8)),e.reader.M(4)}.bind(this)).H("minf",Or).H("stbl",Or).fa("stsd",Dr).H("wvtt",(function(){t=!0})).parse(e),!this.a)throw new me(2,2,2008);if(!t)throw new me(2,2,2008)},uc.prototype.parseInit=uc.prototype.parseInit,uc.prototype.parseMedia=function(e,t){var n=this;if(!this.a)throw new me(2,2,2008);var r,i=0,a=[],o=[],s=!1,l=!1,u=!1,c=null;if((new jr).H("moof",Or).H("traf",Or).fa("tfdt",(function(e){s=!0,i=0==e.version?e.reader.G():e.reader.Bb()})).fa("tfhd",(function(e){var t=e.flags;(e=e.reader).M(4),1&t&&e.M(8),2&t&&e.M(4),c=8&t?e.G():null})).fa("trun",(function(e){l=!0;var t=e.version,n=e.flags,r=(e=e.reader).G();1&n&&e.M(4),4&n&&e.M(4);for(var i=[],o=0;o<r;o++){var s={duration:null,sampleSize:null,Ad:null};256&n&&(s.duration=e.G()),512&n&&(s.sampleSize=e.G()),1024&n&&e.M(4),2048&n&&(s.Ad=0==t?e.G():e.ke()),i.push(s)}a=i})).H("mdat",Mr((function(e){u=!0,r=e}))).parse(e),!u&&!s&&!l)throw new me(2,2,2008);var d=i,f=new Lr(new DataView(r.buffer,r.byteOffset,r.byteLength),0);return a.forEach((function(e){var r=e.duration||c,a=e.Ad?i+e.Ad:d;d=a+(r||0);var s=0;do{var l=f.G();s+=l;var u=null;"vttc"==Ur(f.G())?8<l&&(u=f.Za(l-8)):f.M(l-8),r&&u&&o.push(cc(u,t.periodStart+a/n.a,t.periodStart+d/n.a))}while(e.sampleSize&&s<e.sampleSize)})),o.filter(Vt.Ia)},uc.prototype.parseMedia=uc.prototype.parseMedia,pn['application/mp4; codecs="wvtt"']=uc,V("shaka.util.Dom.createHTMLElement",(function(e){return document.createElement(e)})),V("shaka.util.Dom.createVideoElement",(function(){var e=document.createElement("video");return e.muted=!0,e.width=600,e.height=400,e})),V("shaka.util.Dom.asHTMLElement",(function(e){return e})),V("shaka.util.Dom.asHTMLMediaElement",(function(e){return e})),V("shaka.util.Dom.removeAllChildren",(function(e){for(;e.firstChild;)e.removeChild(e.firstChild)})),V("EmeEncryptionSchemePolyfill",dc),dc.install=fc,V("McEncryptionSchemePolyfill",gc),gc.install=yc,_c.prototype.getConfiguration=function(){var e=this.b.getConfiguration();if(e.videoCapabilities)for(var t=f(e.videoCapabilities),n=t.next();!n.done;n=t.next())n.value.encryptionScheme=this.a;if(e.audioCapabilities)for(n=(t=f(e.audioCapabilities)).next();!n.done;n=t.next())n.value.encryptionScheme=this.a;return e},_c.prototype.createMediaKeys=function(){return this.b.createMediaKeys()},V("EncryptionSchemePolyfills",Tc),Tc.install=wc,n.Ne&&(n.Ne=Tc)}.call(i,r,r),i.shaka)t[a]=i.shaka[a]}()}).call(this,n(/*! ./../../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"),n(/*! ./../../webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(e))},"./node_modules/webpack/buildin/global.js": -/*!***********************************!*\ - !*** (webpack)/buildin/global.js ***! - \***********************************/ -/*! no static exports found */function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},"./node_modules/webpack/buildin/module.js": -/*!***********************************!*\ - !*** (webpack)/buildin/module.js ***! - \***********************************/ -/*! no static exports found */function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},"./src/clappr-dash-shaka-playback.js": -/*!*******************************************!*\ - !*** ./src/clappr-dash-shaka-playback.js ***! - \*******************************************/ -/*! no static exports found */function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,r)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(r):void 0},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(/*! clappr */"clappr"),s=n(/*! shaka-player */"./node_modules/shaka-player/dist/shaka-player.compiled.js"),l=(r=s)&&r.__esModule?r:{default:r};function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var d=function(e){function t(){var e;u(this,t);for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=c(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return a._levels=[],a._pendingAdaptationEvent=!1,a._isShakaReadyState=!1,a._minDvrSize=void 0===a.options.shakaMinimumDvrSize?60:a.options.shakaMinimumDvrSize,a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"getDuration",value:function(){return this._duration}},{key:"getCurrentTime",value:function(){return this.shakaPlayerInstance.getMediaElement().currentTime-this.seekRange.start}},{key:"name",get:function(){return"dash_shaka_playback"}},{key:"shakaVersion",get:function(){return l.default.player.Player.version}},{key:"shakaPlayerInstance",get:function(){return this._player}},{key:"levels",get:function(){return this._levels}},{key:"seekRange",get:function(){return this.shakaPlayerInstance.seekRange()}},{key:"currentLevel",set:function(e){var t=this;this._currentLevelId=e;var n=-1===this._currentLevelId;this.trigger(o.Events.PLAYBACK_LEVEL_SWITCH_START),n?(this._player.configure({abr:{enabled:!0}}),this.trigger(o.Events.PLAYBACK_LEVEL_SWITCH_END)):(this._player.configure({abr:{enabled:!1}}),this._pendingAdaptationEvent=!0,this.selectTrack(this.videoTracks.filter((function(e){return e.id===t._currentLevelId}))[0]))},get:function(){return this._currentLevelId||-1}},{key:"dvrEnabled",get:function(){return this._duration>=this._minDvrSize&&"live"===this.getPlaybackType()}},{key:"_duration",get:function(){return this.shakaPlayerInstance?this.seekRange.end-this.seekRange.start:0}},{key:"_startTime",get:function(){return this.seekRange.start}},{key:"presentationTimeline",get:function(){var e=this.shakaPlayerInstance.getManifest();return e?e.presentationTimeline:null}},{key:"bandwidthEstimate",get:function(){if(this.shakaPlayerInstance)return this.shakaPlayerInstance.getStats().estimatedBandwidth}}],[{key:"canPlay",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";l.default.polyfill.installAll();var n=l.default.Player.isBrowserSupported(),r=e.split("?")[0].match(/.*\.(.*)$/)||[];return n&&("mpd"===r[1]||t.indexOf("application/dash+xml")>-1)}},{key:"Events",get:function(){return{SHAKA_READY:"shaka:ready"}}}]),a(t,[{key:"getProgramDateTime",value:function(){var e=this.presentationTimeline;return e?new Date(1e3*(e.getPresentationStartTime()+this.seekRange.start)):null}},{key:"_updateDvr",value:function(e){this.trigger(o.Events.PLAYBACK_DVR,e),this.trigger(o.Events.PLAYBACK_STATS_ADD,{dvr:e})}},{key:"seek",value:function(e){e<0&&(o.Log.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),e=this._duration),this.dvrEnabled&&this._updateDvr(e<this._duration-3),e+=this._startTime,i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"seek",this).call(this,e)}},{key:"pause",value:function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"pause",this).call(this),this.dvrEnabled&&this._updateDvr(!0)}},{key:"play",value:function(){this._player||this._setup(),this.isReady?(this._stopped=!1,this._src=this.el.src,i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"play",this).call(this),this._startTimeUpdateTimer()):this.once(t.Events.SHAKA_READY,this.play)}},{key:"_startTimeUpdateTimer",value:function(){var e=this;this._stopTimeUpdateTimer(),this._timeUpdateTimer=setInterval((function(){e._onTimeUpdate()}),100)}},{key:"_stopTimeUpdateTimer",value:function(){this._timeUpdateTimer&&clearInterval(this._timeUpdateTimer)}},{key:"_setupSrc",value:function(){}},{key:"_ready",value:function(){}},{key:"_onShakaReady",value:function(){this._isShakaReadyState=!0,this.trigger(t.Events.SHAKA_READY),this.trigger(o.Events.PLAYBACK_READY,this.name)}},{key:"error",value:function(e){o.Log.error("an error was raised by the video tag",e,this.el.error)}},{key:"isHighDefinitionInUse",value:function(){return!1}},{key:"stop",value:function(){var e=this;this._stopTimeUpdateTimer(),clearInterval(this.sendStatsId),this._stopped=!0,this._player?(this._sendStats(),this._player.unload().then((function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"stop",e).call(e),e._player=null,e._isShakaReadyState=!1})).catch((function(){o.Log.error("shaka could not be unloaded")}))):i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"stop",this).call(this)}},{key:"getPlaybackType",value:function(){return(this.isReady&&this._player.isLive()?"live":"vod")||""}},{key:"selectAudioLanguage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._player.selectAudioLanguage(e,t)}},{key:"selectTrack",value:function(e){if("text"===e.type)this._player.selectTextTrack(e);else{if("variant"!==e.type)throw new Error("Unhandled track type:",e.type);this._player.selectVariantTrack(e),e.mimeType.startsWith("video/")&&this._onAdaptation()}}},{key:"_enableShakaTextTrack",value:function(e){this.el.textTracks&&(this._shakaTTVisible=e,Array.from(this.el.textTracks).filter((function(e){return"subtitles"===e.kind})).forEach((function(t){return t.mode=!0===e?"showing":"hidden"})))}},{key:"_checkForClosedCaptions",value:function(){if(!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(o.Events.PLAYBACK_SUBTITLE_AVAILABLE);var e=this.closedCaptionsTrackId;this.closedCaptionsTrackId=e}this._ccIsSetup=!0}}},{key:"destroy",value:function(){var e=this;this._stopTimeUpdateTimer(),clearInterval(this.sendStatsId),this._player?this._player.destroy().then((function(){return e._destroy()})).catch((function(){e._destroy(),o.Log.error("shaka could not be destroyed")})):this._destroy(),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"_setup",value:function(){var e=this;this._isShakaReadyState=!1,this._ccIsSetup=!1,this._player=this._createPlayer(),this._options.shakaConfiguration&&this._player.configure(this._options.shakaConfiguration),this._options.shakaOnBeforeLoad&&this._options.shakaOnBeforeLoad(this._player),this._player.load(this._options.src).then((function(){return e._loaded()})).catch((function(t){return e._setupError(t)}))}},{key:"_createPlayer",value:function(){var e=new l.default.Player(this.el);return e.addEventListener("error",this._onError.bind(this)),e.addEventListener("adaptation",this._onAdaptation.bind(this)),e.addEventListener("buffering",this._onBuffering.bind(this)),e}},{key:"_onTimeUpdate",value:function(){if(this.shakaPlayerInstance){var e=this.getProgramDateTime();if(e){var t={current:this.getCurrentTime(),total:this.getDuration(),firstFragDateTime:e};this._lastTimeUpdate&&t.current===this._lastTimeUpdate.current&&t.total===this._lastTimeUpdate.total||(this._lastTimeUpdate=t,this.trigger(o.Events.PLAYBACK_TIMEUPDATE,t,this.name))}}}},{key:"_onBuffering",value:function(e){if(!this._stopped){var t=e.buffering?o.Events.PLAYBACK_BUFFERING:o.Events.PLAYBACK_BUFFERFULL;this.trigger(t)}}},{key:"_loaded",value:function(){this._onShakaReady(),this._startToSendStats(),this._fillLevels(),this._checkForClosedCaptions()}},{key:"_fillLevels",value:function(){0===this._levels.length&&(this._levels=this.videoTracks.slice(0).reverse(),this.trigger(o.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels))}},{key:"_startToSendStats",value:function(){var e=this,t=this._options.shakaSendStatsInterval||3e4;this.sendStatsId=setInterval((function(){return e._sendStats()}),t)}},{key:"_sendStats",value:function(){this.trigger(o.Events.PLAYBACK_STATS_ADD,this._player.getStats())}},{key:"_setupError",value:function(e){this._onError(e)}},{key:"_onError",value:function(e){var n={shakaError:e,videoError:this.el.error},r=n.shakaError.detail||n.shakaError,a=r.category,s=r.code,u=r.severity;if(n.videoError||!s&&!a)return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_onError",this).call(this);var c={code:a+"_"+s,description:"Category: "+a+", code: "+s+", severity: "+u,level:u===l.default.util.Error.Severity.CRITICAL?o.PlayerError.Levels.FATAL:o.PlayerError.Levels.WARN,raw:e},d=this.createError(c);o.Log.error("Shaka error event:",d),this.trigger(o.Events.PLAYBACK_ERROR,d)}},{key:"_onAdaptation",value:function(){var e=this.videoTracks.filter((function(e){return!0===e.active}))[0];this._fillLevels(),this._sendStats(),this._pendingAdaptationEvent&&(this.trigger(o.Events.PLAYBACK_LEVEL_SWITCH_END),this._pendingAdaptationEvent=!1),o.Log.debug("an adaptation has happened:",e),this.highDefinition=e.height>=720,this.trigger(o.Events.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(o.Events.PLAYBACK_BITRATE,{bandwidth:e.bandwidth,width:e.width,height:e.height,language:e.language,level:e.id,bitrate:e.videoBandwidth})}},{key:"_updateSettings",value:function(){"vod"===this.getPlaybackType()?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(o.Events.PLAYBACK_SETTINGSUPDATE)}},{key:"_destroy",value:function(){this._isShakaReadyState=!1,o.Log.debug("shaka was destroyed")}},{key:"isReady",get:function(){return this._isShakaReadyState}},{key:"textTracks",get:function(){return this.isReady&&this._player.getTextTracks()}},{key:"audioLanguages",get:function(){return this.isReady&&this._player.getAudioLanguages()}},{key:"audioTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter((function(e){return e.mimeType.startsWith("audio/")}))}},{key:"videoTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter((function(e){return e.mimeType.startsWith("video/")}))}},{key:"closedCaptionsTracks",get:function(){var e=0;return(this.textTracks||[]).filter((function(e){return"subtitle"===e.kind})).map((function(t){return{id:e++,name:t.label||t.language,track:t}}))}},{key:"closedCaptionsTrackId",get:function(){return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"closedCaptionsTrackId",this)},set:function(e){if(this._player){var t=this.closedCaptionsTracks,n=void 0;if(-1!==e){if(!(n=t.find((function(t){return t.id===e}))))return void o.Log.warn('Track id "'+e+'" not found');if(this._shakaTTVisible&&!0===n.track.active)return void o.Log.info('Track id "'+e+'" already showing')}n?(this._player.selectTextTrack(n.track),this._player.setTextTrackVisibility(!0),this._enableShakaTextTrack(!0)):(this._player.setTextTrackVisibility(!1),this._enableShakaTextTrack(!1)),this._ccTrackId=e,this.trigger(o.Events.PLAYBACK_SUBTITLE_CHANGED,{id:e})}}}]),t}(o.HTML5Video);t.default=d,e.exports=t.default},clappr: -/*!******************************************************************************************!*\ - !*** external {"amd":"clappr","commonjs":"clappr","commonjs2":"clappr","root":"Clappr"} ***! - \******************************************************************************************/ -/*! no static exports found */function(t,n){t.exports=e}})},e.exports=r(n(0))},function(e,t,n){var r;"undefined"!=typeof self&&self,r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="<%=baseUrl%>/",n(n.s=40)}([function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){var n=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(10),i=n(29),a=n(15),o=Object.defineProperty;t.f=n(3)?Object.defineProperty:function(e,t,n){if(r(e),t=a(t,!0),r(n),i)try{return o(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){e.exports=!n(11)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(2),i=n(12);e.exports=n(3)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(56),i=n(17);e.exports=function(e){return r(i(e))}},function(e,t,n){var r=n(22)("wks"),i=n(14),a=n(0).Symbol,o="function"==typeof a;(e.exports=function(e){return r[e]||(r[e]=o&&a[e]||(o?a:i)("Symbol."+e))}).store=r},function(e,t,n){var r=n(0),i=n(1),a=n(28),o=n(5),s=n(4),l=function(e,t,n){var u,c,d,f=e&l.F,h=e&l.G,p=e&l.S,m=e&l.P,g=e&l.B,y=e&l.W,v=h?i:i[t]||(i[t]={}),b=v.prototype,_=h?r:p?r[t]:(r[t]||{}).prototype;for(u in h&&(n=t),n)(c=!f&&_&&void 0!==_[u])&&s(v,u)||(d=c?_[u]:n[u],v[u]=h&&"function"!=typeof _[u]?n[u]:g&&c?a(d,r):y&&_[u]==d?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(d):m&&"function"==typeof d?a(Function.call,d):d,m&&((v.virtual||(v.virtual={}))[u]=d,e&l.R&&b&&!b[u]&&o(b,u,d)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,n){var r=n(6);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){e.exports=!0},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(6);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports={}},function(e,t,n){var r=n(10),i=n(55),a=n(23),o=n(21)("IE_PROTO"),s=function(){},l=function(){var e,t=n(30)("iframe"),r=a.length;for(t.style.display="none",n(60).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),l=e.F;r--;)delete l.prototype[a[r]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[o]=e):n=l(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(34),i=n(23);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t,n){var r=n(22)("keys"),i=n(14);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){var r=n(1),i=n(0),a=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(13)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(2).f,i=n(4),a=n(8)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,a)&&r(e,a,{configurable:!0,value:t})}},function(e,t,n){t.f=n(8)},function(e,t,n){var r=n(0),i=n(1),a=n(13),o=n(25),s=n(2).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=a?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:o.f(e)})}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(48);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){e.exports=!n(3)&&!n(11)((function(){return 7!=Object.defineProperty(n(30)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(6),i=n(0).document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){"use strict";t.__esModule=!0;var r=o(n(50)),i=o(n(66)),a="function"==typeof i.default&&"symbol"==typeof r.default?function(e){return typeof e}:function(e){return e&&"function"==typeof i.default&&e.constructor===i.default&&e!==i.default.prototype?"symbol":typeof e};function o(e){return e&&e.__esModule?e:{default:e}}t.default="function"==typeof i.default&&"symbol"===a(r.default)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof i.default&&e.constructor===i.default&&e!==i.default.prototype?"symbol":void 0===e?"undefined":a(e)}},function(e,t,n){"use strict";var r=n(13),i=n(9),a=n(33),o=n(5),s=n(18),l=n(54),u=n(24),c=n(61),d=n(8)("iterator"),f=!([].keys&&"next"in[].keys()),h=function(){return this};e.exports=function(e,t,n,p,m,g,y){l(n,t,p);var v,b,_,A=function(e){if(!f&&e in S)return S[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},E=t+" Iterator",T="values"==m,w=!1,S=e.prototype,k=S[d]||S["@@iterator"]||m&&S[m],C=k||A(m),x=m?T?A("entries"):C:void 0,R="Array"==t&&S.entries||k;if(R&&(_=c(R.call(new e)))!==Object.prototype&&_.next&&(u(_,E,!0),r||"function"==typeof _[d]||o(_,d,h)),T&&k&&"values"!==k.name&&(w=!0,C=function(){return k.call(this)}),r&&!y||!f&&!w&&S[d]||o(S,d,C),s[t]=C,s[E]=h,m)if(v={values:T?C:A("values"),keys:g?C:A("keys"),entries:x},y)for(b in v)b in S||a(S,b,v[b]);else i(i.P+i.F*(f||w),t,v);return v}},function(e,t,n){e.exports=n(5)},function(e,t,n){var r=n(4),i=n(7),a=n(57)(!1),o=n(21)("IE_PROTO");e.exports=function(e,t){var n,s=i(e),l=0,u=[];for(n in s)n!=o&&r(s,n)&&u.push(n);for(;t.length>l;)r(s,n=t[l++])&&(~a(u,n)||u.push(n));return u}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(17);e.exports=function(e){return Object(r(e))}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(34),i=n(23).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},function(e,t,n){var r=n(27),i=n(12),a=n(7),o=n(15),s=n(4),l=n(29),u=Object.getOwnPropertyDescriptor;t.f=n(3)?u:function(e,t){if(e=a(e),t=o(t,!0),l)try{return u(e,t)}catch(e){}if(s(e,t))return i(!r.f.call(e,t),e[t])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(41),a=(r=i)&&r.__esModule?r:{default:r};t.default=a.default,e.exports=t.default},function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var i=d(n(43)),a=d(n(44)),o=d(n(49)),s=d(n(76)),l=n(84),u=d(n(85)),c=d(n(86));function d(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(){return(0,i.default)(this,t),(0,o.default)(this,e.apply(this,arguments))}return(0,s.default)(t,e),t.prototype.bindEvents=function(){this.listenTo(this.core,l.Events.CORE_READY,this.bindPlaybackEvents),l.Events.CORE_ACTIVE_CONTAINER_CHANGED?this.listenTo(this.core,l.Events.CORE_ACTIVE_CONTAINER_CHANGED,this.reload):this.listenTo(this.core.mediaControl,l.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload),this.listenTo(this.core.mediaControl,l.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,l.Events.MEDIACONTROL_HIDE,this.hideSelectLevelMenu)},t.prototype.bindPlaybackEvents=function(){this.playback&&(this.listenTo(this.playback,l.Events.PLAYBACK_LEVELS_AVAILABLE,this.fillLevels),this.listenTo(this.playback,l.Events.PLAYBACK_LEVEL_SWITCH_START,this.startLevelSwitch),this.listenTo(this.playback,l.Events.PLAYBACK_LEVEL_SWITCH_END,this.stopLevelSwitch),this.listenTo(this.playback,l.Events.PLAYBACK_BITRATE,this.updateCurrentLevel),this.playback.levels&&this.playback.levels.length>0&&this.fillLevels(this.playback.levels))},t.prototype.reload=function(){var e=this;this.stopListening(),r.nextTick((function(){e.bindEvents(),e.bindPlaybackEvents()}))},t.prototype.shouldRender=function(){if(!this.container||!this.playback)return!1;var e=void 0!==this.playback.currentLevel,t=!!(this.levels&&this.levels.length>1);return e&&t},t.prototype.render=function(){if(this.shouldRender()){var e=l.Styler.getStyleFor(c.default,{baseUrl:this.core.options.baseUrl});this.$el.html(this.template({levels:this.levels,title:this.getTitle()})),this.$el.append(e),this.core.mediaControl.$(".media-control-right-panel").append(this.el),this.$(".level_selector ul").css("max-height",.8*this.core.el.offsetHeight),this.highlightCurrentLevel()}return this},t.prototype.fillLevels=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;void 0===this.selectedLevelId&&(this.selectedLevelId=t);var n=this.core.options&&this.core.options.levelSelectorConfig&&this.core.options.levelSelectorConfig.onLevelsAvailable;if(n){if("function"!=typeof n)throw new TypeError("onLevelsAvailable must be a function");e=n(e.slice())}this.levels=e,this.configureLevelsLabels(),this.render()},t.prototype.configureLevelsLabels=function(){if(void 0!==this.core.options.levelSelectorConfig){var e=this.core.options.levelSelectorConfig.labelCallback;if(e&&"function"!=typeof e)throw new TypeError("labelCallback must be a function");var t=this.core.options.levelSelectorConfig.labels,n=t?this.core.options.levelSelectorConfig.labels:{};if(e||t){var r=void 0,i=void 0;for(var a in this.levels)i=n[(r=this.levels[a]).id],e?r.label=e(r,i):i&&(r.label=i)}}},t.prototype.findLevelBy=function(e){var t=void 0;return this.levels.forEach((function(n){n.id===e&&(t=n)})),t},t.prototype.onLevelSelect=function(e){return this.selectedLevelId=parseInt(e.target.dataset.levelSelectorSelect,10),this.playback.currentLevel==this.selectedLevelId||(this.playback.currentLevel=this.selectedLevelId,this.toggleContextMenu(),e.stopPropagation()),!1},t.prototype.onShowLevelSelectMenu=function(){this.toggleContextMenu()},t.prototype.hideSelectLevelMenu=function(){this.$(".level_selector ul").hide()},t.prototype.toggleContextMenu=function(){this.$(".level_selector ul").toggle()},t.prototype.buttonElement=function(){return this.$(".level_selector button")},t.prototype.levelElement=function(e){return this.$(".level_selector ul a"+(isNaN(e)?"":'[data-level-selector-select="'+e+'"]')).parent()},t.prototype.getTitle=function(){return(this.core.options.levelSelectorConfig||{}).title},t.prototype.startLevelSwitch=function(){this.buttonElement().addClass("changing")},t.prototype.stopLevelSwitch=function(){this.buttonElement().removeClass("changing")},t.prototype.updateText=function(e){-1===e?this.buttonElement().text(this.currentLevel?"AUTO ("+this.currentLevel.label+")":"AUTO"):this.buttonElement().text(this.findLevelBy(e).label)},t.prototype.updateCurrentLevel=function(e){var t=this.findLevelBy(e.level);this.currentLevel=t||null,this.highlightCurrentLevel()},t.prototype.highlightCurrentLevel=function(){var e=this;this.levelElement().removeClass("current"),this.currentLevel&&this.levelElement(this.currentLevel.id).addClass("current"),this.updateText(this.selectedLevelId);var t=this.currentLevel&&this.currentLevel.language;t&&(this.levelElement().removeClass("hidden"),this.levels.forEach((function(n){n.language!=t&&e.levelElement(n.id).addClass("hidden")})))},(0,a.default)(t,[{key:"name",get:function(){return"level_selector"}},{key:"template",get:function(){return(0,l.template)(u.default)}},{key:"attributes",get:function(){return{class:this.name,"data-level-selector":""}}},{key:"events",get:function(){return{"click [data-level-selector-select]":"onLevelSelect","click [data-level-selector-button]":"onShowLevelSelectMenu"}}},{key:"container",get:function(){return this.core.activeContainer?this.core.activeContainer:this.core.mediaControl.container}},{key:"playback",get:function(){return this.core.activePlayback?this.core.activePlayback:this.core.getCurrentPlayback()}}],[{key:"version",get:function(){return VERSION}}]),t}(l.UICorePlugin);t.default=f,e.exports=t.default}).call(t,n(42))},function(e,t){var n,r,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var l,u=[],c=!1,d=-1;function f(){c&&l&&(c=!1,l.length?u=l.concat(u):d=-1,u.length&&h())}function h(){if(!c){var e=s(f);c=!0;for(var t=u.length;t;){for(l=u,u=[];++d<t;)l&&l[d].run();d=-1,t=u.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||c||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(45),a=(r=i)&&r.__esModule?r:{default:r};t.default=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,a.default)(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()},function(e,t,n){e.exports={default:n(46),__esModule:!0}},function(e,t,n){n(47);var r=n(1).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},function(e,t,n){var r=n(9);r(r.S+r.F*!n(3),"Object",{defineProperty:n(2).f})},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(31),a=(r=i)&&r.__esModule?r:{default:r};t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,a.default)(t))&&"function"!=typeof t?e:t}},function(e,t,n){e.exports={default:n(51),__esModule:!0}},function(e,t,n){n(52),n(62),e.exports=n(25).f("iterator")},function(e,t,n){"use strict";var r=n(53)(!0);n(32)(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(16),i=n(17);e.exports=function(e){return function(t,n){var a,o,s=String(i(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(a=s.charCodeAt(l))<55296||a>56319||l+1===u||(o=s.charCodeAt(l+1))<56320||o>57343?e?s.charAt(l):a:e?s.slice(l,l+2):o-56320+(a-55296<<10)+65536}}},function(e,t,n){"use strict";var r=n(19),i=n(12),a=n(24),o={};n(5)(o,n(8)("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=r(o,{next:i(1,n)}),a(e,t+" Iterator")}},function(e,t,n){var r=n(2),i=n(10),a=n(20);e.exports=n(3)?Object.defineProperties:function(e,t){i(e);for(var n,o=a(t),s=o.length,l=0;s>l;)r.f(e,n=o[l++],t[n]);return e}},function(e,t,n){var r=n(35);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(7),i=n(58),a=n(59);e.exports=function(e){return function(t,n,o){var s,l=r(t),u=i(l.length),c=a(o,u);if(e&&n!=n){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}}},function(e,t,n){var r=n(16),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){var r=n(16),i=Math.max,a=Math.min;e.exports=function(e,t){return(e=r(e))<0?i(e+t,0):a(e,t)}},function(e,t,n){var r=n(0).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(4),i=n(36),a=n(21)("IE_PROTO"),o=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,a)?e[a]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},function(e,t,n){n(63);for(var r=n(0),i=n(5),a=n(18),o=n(8)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),l=0;l<s.length;l++){var u=s[l],c=r[u],d=c&&c.prototype;d&&!d[o]&&i(d,o,u),a[u]=a.Array}},function(e,t,n){"use strict";var r=n(64),i=n(65),a=n(18),o=n(7);e.exports=n(32)(Array,"Array",(function(e,t){this._t=o(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):i(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),a.Arguments=a.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){e.exports={default:n(67),__esModule:!0}},function(e,t,n){n(68),n(73),n(74),n(75),e.exports=n(1).Symbol},function(e,t,n){"use strict";var r=n(0),i=n(4),a=n(3),o=n(9),s=n(33),l=n(69).KEY,u=n(11),c=n(22),d=n(24),f=n(14),h=n(8),p=n(25),m=n(26),g=n(70),y=n(71),v=n(10),b=n(6),_=n(36),A=n(7),E=n(15),T=n(12),w=n(19),S=n(72),k=n(39),C=n(37),x=n(2),R=n(20),L=k.f,I=x.f,P=S.f,j=r.Symbol,O=r.JSON,D=O&&O.stringify,M=h("_hidden"),N=h("toPrimitive"),U={}.propertyIsEnumerable,F=c("symbol-registry"),B=c("symbols"),K=c("op-symbols"),V=Object.prototype,G="function"==typeof j&&!!C.f,H=r.QObject,Y=!H||!H.prototype||!H.prototype.findChild,z=a&&u((function(){return 7!=w(I({},"a",{get:function(){return I(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=L(V,t);r&&delete V[t],I(e,t,n),r&&e!==V&&I(V,t,r)}:I,W=function(e){var t=B[e]=w(j.prototype);return t._k=e,t},$=G&&"symbol"==typeof j.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof j},q=function(e,t,n){return e===V&&q(K,t,n),v(e),t=E(t,!0),v(n),i(B,t)?(n.enumerable?(i(e,M)&&e[M][t]&&(e[M][t]=!1),n=w(n,{enumerable:T(0,!1)})):(i(e,M)||I(e,M,T(1,{})),e[M][t]=!0),z(e,t,n)):I(e,t,n)},X=function(e,t){v(e);for(var n,r=g(t=A(t)),i=0,a=r.length;a>i;)q(e,n=r[i++],t[n]);return e},J=function(e){var t=U.call(this,e=E(e,!0));return!(this===V&&i(B,e)&&!i(K,e))&&(!(t||!i(this,e)||!i(B,e)||i(this,M)&&this[M][e])||t)},Q=function(e,t){if(e=A(e),t=E(t,!0),e!==V||!i(B,t)||i(K,t)){var n=L(e,t);return!n||!i(B,t)||i(e,M)&&e[M][t]||(n.enumerable=!0),n}},Z=function(e){for(var t,n=P(A(e)),r=[],a=0;n.length>a;)i(B,t=n[a++])||t==M||t==l||r.push(t);return r},ee=function(e){for(var t,n=e===V,r=P(n?K:A(e)),a=[],o=0;r.length>o;)!i(B,t=r[o++])||n&&!i(V,t)||a.push(B[t]);return a};G||(s((j=function(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var e=f(arguments.length>0?arguments[0]:void 0),t=function(n){this===V&&t.call(K,n),i(this,M)&&i(this[M],e)&&(this[M][e]=!1),z(this,e,T(1,n))};return a&&Y&&z(V,e,{configurable:!0,set:t}),W(e)}).prototype,"toString",(function(){return this._k})),k.f=Q,x.f=q,n(38).f=S.f=Z,n(27).f=J,C.f=ee,a&&!n(13)&&s(V,"propertyIsEnumerable",J,!0),p.f=function(e){return W(h(e))}),o(o.G+o.W+o.F*!G,{Symbol:j});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)h(te[ne++]);for(var re=R(h.store),ie=0;re.length>ie;)m(re[ie++]);o(o.S+o.F*!G,"Symbol",{for:function(e){return i(F,e+="")?F[e]:F[e]=j(e)},keyFor:function(e){if(!$(e))throw TypeError(e+" is not a symbol!");for(var t in F)if(F[t]===e)return t},useSetter:function(){Y=!0},useSimple:function(){Y=!1}}),o(o.S+o.F*!G,"Object",{create:function(e,t){return void 0===t?w(e):X(w(e),t)},defineProperty:q,defineProperties:X,getOwnPropertyDescriptor:Q,getOwnPropertyNames:Z,getOwnPropertySymbols:ee});var ae=u((function(){C.f(1)}));o(o.S+o.F*ae,"Object",{getOwnPropertySymbols:function(e){return C.f(_(e))}}),O&&o(o.S+o.F*(!G||u((function(){var e=j();return"[null]"!=D([e])||"{}"!=D({a:e})||"{}"!=D(Object(e))}))),"JSON",{stringify:function(e){for(var t,n,r=[e],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=t=r[1],(b(t)||void 0!==e)&&!$(e))return y(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!$(t))return t}),r[1]=t,D.apply(O,r)}}),j.prototype[N]||n(5)(j.prototype,N,j.prototype.valueOf),d(j,"Symbol"),d(Math,"Math",!0),d(r.JSON,"JSON",!0)},function(e,t,n){var r=n(14)("meta"),i=n(6),a=n(4),o=n(2).f,s=0,l=Object.isExtensible||function(){return!0},u=!n(11)((function(){return l(Object.preventExtensions({}))})),c=function(e){o(e,r,{value:{i:"O"+ ++s,w:{}}})},d=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!a(e,r)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[r].i},getWeak:function(e,t){if(!a(e,r)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[r].w},onFreeze:function(e){return u&&d.NEED&&l(e)&&!a(e,r)&&c(e),e}}},function(e,t,n){var r=n(20),i=n(37),a=n(27);e.exports=function(e){var t=r(e),n=i.f;if(n)for(var o,s=n(e),l=a.f,u=0;s.length>u;)l.call(e,o=s[u++])&&t.push(o);return t}},function(e,t,n){var r=n(35);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(7),i=n(38).f,a={}.toString,o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return o&&"[object Window]"==a.call(e)?function(e){try{return i(e)}catch(e){return o.slice()}}(e):i(r(e))}},function(e,t){},function(e,t,n){n(26)("asyncIterator")},function(e,t,n){n(26)("observable")},function(e,t,n){"use strict";t.__esModule=!0;var r=o(n(77)),i=o(n(81)),a=o(n(31));function o(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,a.default)(t)));e.prototype=(0,i.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(r.default?(0,r.default)(e,t):e.__proto__=t)}},function(e,t,n){e.exports={default:n(78),__esModule:!0}},function(e,t,n){n(79),e.exports=n(1).Object.setPrototypeOf},function(e,t,n){var r=n(9);r(r.S,"Object",{setPrototypeOf:n(80).set})},function(e,t,n){var r=n(6),i=n(10),a=function(e,t){if(i(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{(r=n(28)(Function.call,n(39).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return a(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:a}},function(e,t,n){e.exports={default:n(82),__esModule:!0}},function(e,t,n){n(83);var r=n(1).Object;e.exports=function(e,t){return r.create(e,t)}},function(e,t,n){var r=n(9);r(r.S,"Object",{create:n(19)})},function(t,n){t.exports=e},function(e,t){e.exports='<button data-level-selector-button>\n Auto\n</button>\n<ul>\n <% if (title) { %>\n <li data-title><%= title %></li>\n <% }; %>\n <li><a href="#" data-level-selector-select="-1">AUTO</a></li>\n <% for (var i = 0; i < levels.length; i++) { %>\n <li><a href="#" data-level-selector-select="<%= levels[i].id %>"><%= levels[i].label %></a></li>\n <% }; %>\n</ul>\n'},function(e,t,n){var r=n(87);"string"==typeof r&&(r=[[e.i,r,""]]),n(89)(r,{singleton:!0}),r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(88)(!1)).push([e.i,'.level_selector[data-level-selector] {\n float: right;\n position: relative;\n height: 100%; }\n .level_selector[data-level-selector] button {\n background-color: transparent;\n color: #fff;\n font-family: Roboto,"Open Sans",Arial,sans-serif;\n -webkit-font-smoothing: antialiased;\n border: none;\n font-size: 12px;\n height: 100%; }\n .level_selector[data-level-selector] button:hover {\n color: #c9c9c9; }\n .level_selector[data-level-selector] button.changing {\n -webkit-animation: pulse 0.5s infinite alternate; }\n .level_selector[data-level-selector] > ul {\n overflow-x: hidden;\n overflow-y: auto;\n list-style-type: none;\n position: absolute;\n bottom: 100%;\n display: none;\n background-color: rgba(28, 28, 28, 0.9);\n white-space: nowrap; }\n .level_selector[data-level-selector] li {\n font-size: 12px;\n color: #eee; }\n .level_selector[data-level-selector] li[data-title] {\n background-color: #333;\n padding: 8px 25px; }\n .level_selector[data-level-selector] li a {\n color: #eee;\n padding: 5px 18px;\n display: block;\n text-decoration: none; }\n .level_selector[data-level-selector] li a:hover {\n background-color: rgba(255, 255, 255, 0.1);\n color: #fff; }\n .level_selector[data-level-selector] li a:hover a {\n color: #fff;\n text-decoration: none; }\n .level_selector[data-level-selector] li.current a {\n color: #2ecc71; }\n .level_selector[data-level-selector] li.hidden {\n display: none; }\n',""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,r=e[1]||"",i=e[3];if(!i)return r;if(t&&"function"==typeof btoa){var a=(n=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"),o=i.sources.map((function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"}));return[r].concat(o).concat([a]).join("\n")}return[r].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},i=0;i<this.length;i++){var a=this[i][0];"number"==typeof a&&(r[a]=!0)}for(i=0;i<e.length;i++){var o=e[i];"number"==typeof o[0]&&r[o[0]]||(n&&!o[2]?o[2]=n:n&&(o[2]="("+o[2]+") and ("+n+")"),t.push(o))}},t}},function(e,t){var n={},r=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}},i=r((function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())})),a=r((function(){return document.head||document.getElementsByTagName("head")[0]})),o=null,s=0;function l(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=n[i.id];if(a){a.refs++;for(var o=0;o<a.parts.length;o++)a.parts[o](i.parts[o]);for(;o<i.parts.length;o++)a.parts.push(d(i.parts[o],t))}else{var s=[];for(o=0;o<i.parts.length;o++)s.push(d(i.parts[o],t));n[i.id]={id:i.id,refs:1,parts:s}}}}function u(e){for(var t=[],n={},r=0;r<e.length;r++){var i=e[r],a=i[0],o={css:i[1],media:i[2],sourceMap:i[3]};n[a]?n[a].parts.push(o):t.push(n[a]={id:a,parts:[o]})}return t}function c(){var e=document.createElement("style"),t=a();return e.type="text/css",t.appendChild(e),e}function d(e,t){var n,r,i,l,u;if(t.singleton){var d=s++;n=o||(o=c()),r=p.bind(null,n,d,!1),i=p.bind(null,n,d,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(l=document.createElement("link"),u=a(),l.rel="stylesheet",u.appendChild(l),n=l,r=g.bind(null,n),i=function(){n.parentNode.removeChild(n),n.href&&URL.revokeObjectURL(n.href)}):(n=c(),r=m.bind(null,n),i=function(){n.parentNode.removeChild(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");void 0===(t=t||{}).singleton&&(t.singleton=i());var r=u(e);return l(r,t),function(e){for(var i=[],a=0;a<r.length;a++){var o=r[a];(s=n[o.id]).refs--,i.push(s)}for(e&&l(u(e),t),a=0;a<i.length;a++){var s;if(0===(s=i[a]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete n[s.id]}}}};var f,h=(f=[],function(e,t){return f[e]=t,f.filter(Boolean).join("\n")});function p(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=h(t,i);else{var a=document.createTextNode(i),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(a,o[t]):e.appendChild(a)}}function m(e,t){var n=t.css,r=t.media;if(t.sourceMap,r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function g(e,t){var n=t.css,r=(t.media,t.sourceMap);r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var i=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(i),a&&URL.revokeObjectURL(a)}}])},e.exports=r(n(0))},function(module,exports,__webpack_require__){var factory;window,factory=function(__WEBPACK_EXTERNAL_MODULE_clappr__){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/main.js")}({"./node_modules/css-loader/dist/runtime/api.js": -/*!*****************************************************!*\ - !*** ./node_modules/css-loader/dist/runtime/api.js ***! - \*****************************************************/ -/*! no static exports found */function(module,exports,__webpack_require__){"use strict";eval('/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/ // css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports=function(useSourceMap){var list=[];// return the list of modules as css string\nlist.toString=function toString(){return this.map(function(item){var content=cssWithMappingToString(item,useSourceMap);if(item[2]){return"@media ".concat(item[2]," {").concat(content,"}");}return content;}).join(\'\');};// import a list of modules into the list\n// eslint-disable-next-line func-names\nlist.i=function(modules,mediaQuery,dedupe){if(typeof modules===\'string\'){// eslint-disable-next-line no-param-reassign\nmodules=[[null,modules,\'\']];}var alreadyImportedModules={};if(dedupe){for(var i=0;i<this.length;i++){// eslint-disable-next-line prefer-destructuring\nvar id=this[i][0];if(id!=null){alreadyImportedModules[id]=true;}}}for(var _i=0;_i<modules.length;_i++){var item=[].concat(modules[_i]);if(dedupe&&alreadyImportedModules[item[0]]){// eslint-disable-next-line no-continue\ncontinue;}if(mediaQuery){if(!item[2]){item[2]=mediaQuery;}else{item[2]="".concat(mediaQuery," and ").concat(item[2]);}}list.push(item);}};return list;};function cssWithMappingToString(item,useSourceMap){var content=item[1]||\'\';// eslint-disable-next-line prefer-destructuring\nvar cssMapping=item[3];if(!cssMapping){return content;}if(useSourceMap&&typeof btoa===\'function\'){var sourceMapping=toComment(cssMapping);var sourceURLs=cssMapping.sources.map(function(source){return"/*# sourceURL=".concat(cssMapping.sourceRoot||\'\').concat(source," */");});return[content].concat(sourceURLs).concat([sourceMapping]).join(\'\\n\');}return[content].join(\'\\n\');}// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap){// eslint-disable-next-line no-undef\nvar base64=btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));var data="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);return"/*# ".concat(data," */");}\n\n//# sourceURL=webpack://AudioTrackSelector/./node_modules/css-loader/dist/runtime/api.js?')},"./src/main.js": -/*!*********************!*\ - !*** ./src/main.js ***! - \*********************/ -/*! exports provided: default */function(module,__webpack_exports__,__webpack_require__){"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return AudioTrackSelector; });\n/* harmony import */ var clappr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! clappr */ \"clappr\");\n/* harmony import */ var clappr__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(clappr__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _public_audio_track_selector_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./public/audio-track-selector.html */ \"./src/public/audio-track-selector.html\");\n/* harmony import */ var _public_audio_track_selector_html__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_public_audio_track_selector_html__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _public_style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./public/style.scss */ \"./src/public/style.scss\");\n/* harmony import */ var _public_style_scss__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_public_style_scss__WEBPACK_IMPORTED_MODULE_2__);\nclass AudioTrackSelector extends clappr__WEBPACK_IMPORTED_MODULE_0__[\"UICorePlugin\"]{static get version(){return VERSION;}get name(){return'audio_track_selector';}get template(){return Object(clappr__WEBPACK_IMPORTED_MODULE_0__[\"template\"])(_public_audio_track_selector_html__WEBPACK_IMPORTED_MODULE_1___default.a);}get attributes(){return{'class':this.name,'data-audio-track-selector':''};}get events(){return{'click [data-audio-track-selector-lang]':'handleLanguageSelect','click [data-audio-track-selector-button]':'handleAudioTrackSelectorClick'};}get container(){return this.core.activeContainer?this.core.activeContainer:this.core.mediaControl.container;}get playback(){return this.core.activePlayback?this.core.activePlayback:this.core.getCurrentPlayback();}bindEvents(){if(clappr__WEBPACK_IMPORTED_MODULE_0__[\"Events\"].CORE_ACTIVE_CONTAINER_CHANGED)this.listenTo(this.core,clappr__WEBPACK_IMPORTED_MODULE_0__[\"Events\"].CORE_ACTIVE_CONTAINER_CHANGED,this.reload);else this.listenTo(this.core.mediaControl,clappr__WEBPACK_IMPORTED_MODULE_0__[\"Events\"].MEDIACONTROL_CONTAINERCHANGED,this.reload);this.listenTo(this.core,clappr__WEBPACK_IMPORTED_MODULE_0__[\"Events\"].CORE_READY,this.bindPlaybackEvents);this.listenTo(this.core.mediaControl,clappr__WEBPACK_IMPORTED_MODULE_0__[\"Events\"].MEDIACONTROL_RENDERED,this.render);this.listenTo(this.core.mediaControl,clappr__WEBPACK_IMPORTED_MODULE_0__[\"Events\"].MEDIACONTROL_HIDE,this._hideContextMenu);}bindPlaybackEvents(){this.listenTo(this.playback,clappr__WEBPACK_IMPORTED_MODULE_0__[\"Events\"].PLAYBACK_LEVELS_AVAILABLE,this._handleLevels);this.listenTo(this.playback,clappr__WEBPACK_IMPORTED_MODULE_0__[\"Events\"].PLAYBACK_BITRATE,this._handleAdaptation);this.listenTo(this.playback,clappr__WEBPACK_IMPORTED_MODULE_0__[\"Events\"].PLAYBACK_PLAY,this._handlePlay);}reload(){this.stopListening();this.bindEvents();this.bindPlaybackEvents();}shouldRender(){if(!this.container)return false;if(!this.playback)return false;// Only display if we have at least 2 languages to choose from\nvar hasChoice=!!(this.languages&&this.languages.size>1);return hasChoice;}render(){if(this.shouldRender()){var style=clappr__WEBPACK_IMPORTED_MODULE_0__[\"Styler\"].getStyleFor(_public_style_scss__WEBPACK_IMPORTED_MODULE_2___default.a,{baseUrl:this.core.options.baseUrl});this.$el.html(this.template({'title':this._getTitle(),'languages':this.languages}));this.$el.append(style);this.core.mediaControl.$('.media-control-right-panel').append(this.el);this._highlightCurrentElement();}return this;}_setLanguage(language){console.log(\"setLanguage\",language);// custom voc dash-shaka-playback\nif(this.playback.selectAudioLanguage){this.nextLanguage=language;this.playback.selectAudioLanguage(language);// hlsjs playback\n}else if(this.playback._hls){// hlsjs may have multiple audiotracks with the same language\n// this will just switch to the first one\nconst track=this.playback._hls.audioTracks.find(track=>track.lang==language||track.name===language);if(!track)return;this.playback._hls.audioTrack=track.id;this.activeLanguage=language;this._highlightCurrentElement();// html5 track change\n}else if(this.playback.el.audioTracks){// also just selects the first track matching the label\nconst audioTracks=[...this.playback.el.audioTracks];const track=audioTracks.find(track=>track.language==language||track.label===language);if(!track)return;track.enabled=true;this.activeLanguage=language;this._highlightCurrentElement();}}_fillLanguages(){// custom voc dash-shaka-playback\nif(this.playback.audioLanguages){this.languages=new Set(this.playback.audioLanguages);// hlsjs playback\n}else if(this.playback._hls){const audioTracks=this.playback._hls.audioTracks;const currentId=this.playback._hls.audioTrack;const current=audioTracks.find(track=>track.id==currentId);this.languages=new Set(audioTracks.map(track=>track.lang||track.name));if(current){this.activeLanguage=current.lang||current.name;}// native playback\n}else if(this.playback.el.audioTracks){const audioTracks=[...this.playback.el.audioTracks];const current=audioTracks.find(track=>track.enabled);this.languages=new Set(audioTracks.map(track=>track.language||track.label));if(current){this.activeLanguage=current.language||current.label;}}this.render();}handleLanguageSelect(event){event.preventDefault();event.stopPropagation();const selected=event.target.dataset.audioTrackSelectorLang;if(this.activeLanguage==selected)return false;this._setLanguage(selected);this._toggleContextMenu();return false;}// Handles adaptation event from shaka-playback\n_handleAdaptation(variant){if(variant.language){this.activeLanguage=variant.language;this._highlightCurrentElement();}}// shaka-playback knows languages on level event\n_handleLevels(){this._fillLanguages();}// hlsjs-playback and html5video-playback only know languages on play\n_handlePlay(){if(this.playback._hls||this.playback instanceof clappr__WEBPACK_IMPORTED_MODULE_0__[\"HTML5Video\"]){this._fillLanguages();}}handleAudioTrackSelectorClick(event){this._toggleContextMenu();}_toggleContextMenu(){this.$('.audio_track_selector ul').toggle();}_hideContextMenu(){this.$('.audio_track_selector ul').hide();}_getLanguageElement(language=null){if(language)return this.$('.audio_track_selector a[data-audio-track-selector-lang=\"'+language+'\"]').parent();else return this.$('.audio_track_selector a').parent();}_getButtonElement(){return this.$('.audio_track_selector button');}_getTitle(){return(this.core.options.audioTrackSelectorConfig||{}).title;}_highlightCurrentElement(){if(!this.activeLanguage)return;this._getLanguageElement().removeClass('current');this._getLanguageElement(this.activeLanguage).addClass('current');this._getButtonElement().text(this.activeLanguage);}}\n\n//# sourceURL=webpack://AudioTrackSelector/./src/main.js?")},"./src/public/audio-track-selector.html": -/*!**********************************************!*\ - !*** ./src/public/audio-track-selector.html ***! - \**********************************************/ -/*! no static exports found */function(module,exports){eval('// Module\nvar code = "<button data-audio-track-selector-button>\\n Language\\n</button>\\n<ul>\\n <% if (title) { %>\\n <li data-title><%= title %></li>\\n <% }; %>\\n <% languages.forEach((language) => { %>\\n <li><a href=\\"#\\" data-audio-track-selector-lang=\\"<%= language %>\\"><%= language %></a></li>\\n <% }); %>\\n</ul>\\n";\n// Exports\nmodule.exports = code;\n\n//# sourceURL=webpack://AudioTrackSelector/./src/public/audio-track-selector.html?')},"./src/public/style.scss": -/*!*******************************!*\ - !*** ./src/public/style.scss ***! - \*******************************/ -/*! no static exports found */function(module,exports,__webpack_require__){eval('// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.i, ".audio_track_selector[data-audio-track-selector] {\\n float: right;\\n height: 100%;\\n position: relative; }\\n .audio_track_selector[data-audio-track-selector] button {\\n background-color: transparent;\\n color: #fff;\\n font-family: Roboto,\\"Open Sans\\",Arial,sans-serif;\\n -webkit-font-smoothing: antialiased;\\n border: none;\\n font-size: 12px;\\n height: 100%; }\\n .audio_track_selector[data-audio-track-selector] button:hover {\\n color: #c9c9c9; }\\n .audio_track_selector[data-audio-track-selector] button.changing {\\n -webkit-animation: pulse 0.5s infinite alternate; }\\n .audio_track_selector[data-audio-track-selector] > ul {\\n overflow-x: hidden;\\n overflow-y: auto;\\n list-style-type: none;\\n position: absolute;\\n bottom: 100%;\\n display: none;\\n background-color: rgba(28, 28, 28, 0.9);\\n white-space: nowrap; }\\n .audio_track_selector[data-audio-track-selector] li {\\n font-size: 12px;\\n color: #eee; }\\n .audio_track_selector[data-audio-track-selector] li[data-title] {\\n background-color: #333;\\n padding: 8px 25px; }\\n .audio_track_selector[data-audio-track-selector] li a {\\n color: #eee;\\n padding: 5px 18px;\\n display: block;\\n text-decoration: none; }\\n .audio_track_selector[data-audio-track-selector] li a:hover {\\n background-color: rgba(255, 255, 255, 0.1);\\n color: #fff; }\\n .audio_track_selector[data-audio-track-selector] li a:hover a {\\n color: #fff;\\n text-decoration: none; }\\n .audio_track_selector[data-audio-track-selector] li.current a {\\n color: #2ecc71; }\\n\\n@-webkit-keyframes pulse {\\n 0% {\\n color: #fff; }\\n 50% {\\n color: #ff0101; }\\n 100% {\\n color: #B80000; } }\\n", ""]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://AudioTrackSelector/./src/public/style.scss?')},clappr: -/*!******************************************************************************************!*\ - !*** 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,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}e.exports=function(e){var t=r(e,4),n=t[1],i=t[3];if(!i)return n;if("function"==typeof btoa){var a=btoa(unescape(encodeURIComponent(JSON.stringify(i)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),s="/*# ".concat(o," */"),l=i.sources.map((function(e){return"/*# sourceURL=".concat(i.sourceRoot||"").concat(e," */")}));return[n].concat(l).concat([s]).join("\n")}return[n].join("\n")}},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var a=0;a<this.length;a++){var o=this[a][0];null!=o&&(i[o]=!0)}for(var s=0;s<e.length;s++){var l=[].concat(e[s]);r&&i[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),t.push(l))}},t}},function(e,t,n){var r=n(7),i=n(8);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var a={insert:"head",singleton:!1};r(i,a);e.exports=i.locals||{}},function(e,t,n){"use strict";var r,i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),o=[];function s(e){for(var t=-1,n=0;n<o.length;n++)if(o[n].identifier===e){t=n;break}return t}function l(e,t){for(var n={},r=[],i=0;i<e.length;i++){var a=e[i],l=t.base?a[0]+t.base:a[0],u=n[l]||0,c="".concat(l," ").concat(u);n[l]=u+1;var d=s(c),f={css:a[1],media:a[2],sourceMap:a[3]};-1!==d?(o[d].references++,o[d].updater(f)):o.push({identifier:c,updater:g(f,t),references:1}),r.push(c)}return r}function u(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var i=n.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var o=a(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var c,d=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function f(e,t,n,r){var i=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=d(t,i);else{var a=document.createTextNode(i),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(a,o[t]):e.appendChild(a)}}function h(e,t,n){var r=n.css,i=n.media,a=n.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var p=null,m=0;function g(e,t){var n,r,i;if(t.singleton){var a=m++;n=p||(p=u(t)),r=f.bind(null,n,a,!1),i=f.bind(null,n,a,!0)}else n=u(t),r=h.bind(null,n,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=i());var n=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var i=s(n[r]);o[i].references--}for(var a=l(e,t),u=0;u<n.length;u++){var c=s(n[u]);0===o[c].references&&(o[c].updater(),o.splice(c,1))}n=a}}}},function(e,t,n){"use strict";n.r(t);var r=n(4),i=n.n(r),a=n(5),o=n.n(a)()(i.a);o.push([e.i,"button.media-control-button[data-hd-indicator]{display:none !important}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]{height:40px}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar]{height:2px;background-color:#ccc}.player-poster[data-poster] .play-wrapper[data-poster] svg path{fill:#ccc}.spinner-three-bounce[data-spinner]>div{background-color:#ccc}.clappr-watermark[data-watermark]{transition:opacity .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}}","",{version:3,sources:["webpack://./src/public/style.scss"],names:[],mappings:"AAAA,+CACC,uBAAA,CAGD,oGACC,WAAA,CAGD,kIACC,UAAA,CACA,qBAAA,CAID,gEACC,SAAA,CAID,wCACC,qBAAA,CAID,kCACC,+BAAA,CACA,QAAA,CACA,cAAA,CACA,eAAA,CACA,wDACC,SAAA,CAIF,2CACC,OAAA,CACA,SAAA,CACA,eAAA,CAEA,yBALD,2CAME,QAAA,CACA,SAAA,CAAA",sourcesContent:["button.media-control-button[data-hd-indicator] {\n\tdisplay: none !important;\n}\n\n.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] {\n\theight: 40px;\n}\n\n.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] {\n\theight: 2px;\n\tbackground-color: #ccc;\n}\n\n// Change play button color from #FFF to grey.\n.player-poster[data-poster] .play-wrapper[data-poster] svg path {\n\tfill: #ccc;\n}\n\n// Change loading indicator color from #FFF to grey.\n.spinner-three-bounce[data-spinner] > div {\n\tbackground-color: #ccc;\n}\n\n// Fade out watermark with media control\n.clappr-watermark[data-watermark] {\n\ttransition: opacity 0.5s ease-out;\n\twidth: 8%;\n\tmin-width: 50px;\n\tmax-width: 100px;\n\t&.clappr-watermark-hide{\n\t\topacity: 0;\n\t}\n}\n\n.clappr-watermark[data-watermark-top-left]{\n\ttop: 0px;\n\tleft: 15px;\n\ttext-align: left;\n\n\t@media (min-width: 768px) {\n\t\ttop: 10px;\n\t\tleft: 30px;\n\t}\n}"],sourceRoot:""}]),t.default=o},function(e,t,n){"use strict";n.r(t),n.d(t,"Player",(function(){return O})),n.d(t,"Mediator",(function(){return r.Mediator})),n.d(t,"Events",(function(){return r.Events})),n.d(t,"Browser",(function(){return r.Browser})),n.d(t,"PlayerInfo",(function(){return r.PlayerInfo})),n.d(t,"MediaControl",(function(){return r.MediaControl})),n.d(t,"ContainerPlugin",(function(){return r.ContainerPlugin})),n.d(t,"UIContainerPlugin",(function(){return r.UIContainerPlugin})),n.d(t,"CorePlugin",(function(){return r.CorePlugin})),n.d(t,"UICorePlugin",(function(){return r.UICorePlugin})),n.d(t,"Playback",(function(){return r.Playback})),n.d(t,"Container",(function(){return r.Container})),n.d(t,"Core",(function(){return r.Core})),n.d(t,"PlayerError",(function(){return r.PlayerError})),n.d(t,"Loader",(function(){return r.Loader})),n.d(t,"BaseObject",(function(){return r.BaseObject})),n.d(t,"UIObject",(function(){return r.UIObject})),n.d(t,"Utils",(function(){return r.Utils})),n.d(t,"BaseFlashPlayback",(function(){return r.BaseFlashPlayback})),n.d(t,"Flash",(function(){return r.Flash})),n.d(t,"FlasHLS",(function(){return r.FlasHLS})),n.d(t,"HLS",(function(){return r.HLS})),n.d(t,"HTML5Audio",(function(){return r.HTML5Audio})),n.d(t,"HTML5Video",(function(){return r.HTML5Video})),n.d(t,"HTMLImg",(function(){return r.HTMLImg})),n.d(t,"NoOp",(function(){return r.NoOp})),n.d(t,"ClickToPausePlugin",(function(){return r.ClickToPausePlugin})),n.d(t,"DVRControls",(function(){return r.DVRControls})),n.d(t,"Favicon",(function(){return r.Favicon})),n.d(t,"Log",(function(){return r.Log})),n.d(t,"Poster",(function(){return r.Poster})),n.d(t,"SpinnerThreeBouncePlugin",(function(){return r.SpinnerThreeBouncePlugin})),n.d(t,"WaterMarkPlugin",(function(){return r.WaterMarkPlugin})),n.d(t,"Styler",(function(){return r.Styler})),n.d(t,"Vendor",(function(){return r.Vendor})),n.d(t,"version",(function(){return r.version})),n.d(t,"template",(function(){return r.template})),n.d(t,"$",(function(){return r.$}));var r=n(0),i=n.n(r),a=n(1),o=n.n(a),s=n(2),l=n.n(s),u=n(3),c=n.n(u);n(6);function d(e){return(d="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 f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),e}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=v(e);if(t){var i=v(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return y(this,n)}}function y(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(n,e);var t=g(n);function n(){var e;f(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).timeout=1,e.max_timeout=10,e}return p(n,[{key:"name",get:function(){return"error_plugin"}},{key:"background",get:function(){return"data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%22%20height%3D%22100%22%20viewBox%3D%220%200%2026.458318%2026.458333%22%3E%3Cpath%20d%3D%22M13.23.302C6.07.302.264%206.107.264%2013.267a12.965%2012.965%200%200%200%20.847%204.595c.19-.497.408-.982.682-1.438.14-.232.294-.457.396-.707.103-.25.15-.533.072-.792a1.362%201.362%200%200%200-.22-.404c-.092-.123-.192-.24-.275-.37a1.662%201.662%200%200%201-.255-1.12%201.5%201.5%200%200%201%20.58-.987c.28-.208.635-.3.985-.288a1.757%201.757%200%200%201%20.346.048c.452.11.852.393%201.148.75.368.447.584%201.01.637%201.586a3.574%203.574%200%200%201-.275%201.693c-.4.955-1.15%201.725-1.565%202.673-.338.775-.435%201.638-.39%202.483.007.077.018.155.025.234a12.965%2012.965%200%200%200%203.62%203.18%2017.63%2017.63%200%200%201-.13-2.11c.002-.56.03-1.12.085-1.675-.34-.236-.65-.51-.87-.86-.392-.62-.466-1.408-.305-2.124.16-.717.54-1.37.997-1.945a7.833%207.833%200%200%201%202.835-2.223%2010.305%2010.305%200%200%201-.09-.126%204.854%204.854%200%200%201-.702-2.176c-.06-.777.064-1.554.115-2.33.037-.543.04-1.085.07-1.627.038-.627.114-1.255.29-1.858a2.36%202.36%200%200%201%20.266-.63%201.4%201.4%200%200%201%20.594-.514c.274-.108.51-.132.776-.087.22.046.425.156.604.294.18.138.335.304.48.477a7.298%207.298%200%200%201%201.04%201.617%203.57%203.57%200%200%201%201.09%200%207.287%207.287%200%200%201%201.04-1.616%203.21%203.21%200%200%201%20.48-.476c.18-.14.383-.248.604-.295a1.268%201.268%200%200%201%20.78.086%201.402%201.402%200%200%201%20.595.517c.124.19.202.408.266.626.175.602.252%201.23.29%201.856.03.543.033%201.087.07%201.628.05.777.175%201.554.116%202.33a4.855%204.855%200%200%201-.705%202.178c-.03.05-.07.096-.103.145.247.278.598.513.898.614a1.956%201.956%200%200%200%201.05.044%201.65%201.65%200%200%200%20.533-.226%201.253%201.253%200%200%200%20.397-.418c.118-.21.166-.45.192-.687.067-.61%200-1.224-.05-1.835-.034-.396-.062-.8.027-1.187.06-.26.177-.518.373-.7a1.106%201.106%200%200%201%20.465-.255%201.312%201.312%200%200%201%20.53-.03c.38.057.736.274.948.594.12.18.194.39.238.604.044.213.06.43.072.648.04.76.04%201.522.018%202.284-.018.665-.055%201.348-.32%201.957-.343.782-1.032%201.366-1.775%201.786a7.052%207.052%200%200%201-1.588.647c.482%201.54.733%203.24.733%204.968a17.6%2017.6%200%200%201-.135%202.125%2012.964%2012.964%200%200%200%206.384-11.152c0-7.16-5.806-12.965-12.965-12.965zM9.602%2016.284v1.483a1.88%201.88%200%200%201%201.083.362%201.738%201.738%200%200%201%20.556.68c.122.27.166.576.116.868a1.493%201.493%200%200%201-.332.708%201.647%201.647%200%200%201-.635.458%201.738%201.738%200%200%201-.787.122v3.73l7.762-4.208-7.762-4.204z%22%20fill%3D%22%23999%22%2F%3E%3C%2Fsvg%3E"}}]),p(n,[{key:"bindEvents",value:function(){this.listenTo(this.container,i.a.Events.CONTAINER_ERROR,this.onError)}},{key:"hide",value:function(){this._err&&this._err.remove()}},{key:"show",value:function(e){var t=i.a.$;this.hide();var n=e&&e.title||"Oh no, we encountered an error",r=e&&e.subtitle||"Please reload the page";this._err=t("<div>").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 a=t("<div>").css({position:"absolute",width:"100%","padding-bottom":"5%",bottom:0}).append(t("<h2>").text(n).css({"font-size":"2em"})).append(t("<p>").text(r).css({"font-size":"1.2em",margin:"15px"}));this._err.append(a),this.container&&this.container.$el.prepend(this._err)}},{key:"onError",value:function(e){var t=this;if(this.container){var n=this.options.errorPlugin.onError,r=null;n&&"function"==typeof n&&(r=n(e,(function(){t.hide(),t.container.getPlugin("click_to_pause").enable()}))),this.show(r),this.container.getPlugin("click_to_pause").disable()}}}]),n}(i.a.ContainerPlugin);function _(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&null!=e[n]&&t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t.join("&")}function A(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(new Headers,t.replace(/\s+/g," ")),i=_({query:r,operation:e,variables:JSON.stringify(n)});return fetch("https://media.ccc.de/graphql?".concat(i),{method:"GET",headers:{Accept:"application/json"}}).then((function(e){var t=e.body.getReader(),n="",r=new TextDecoder("utf-8");return t.read().then((function e(i){var a=i.done,o=i.value;return a?JSON.parse(n):(n+=r.decode(o),t.read().then(e))}))}))}("LectureBySlug","\n query LectureBySlug($slug: ID!) {\n lecture: lectureBySlug(slug: $slug) {\n originalLanguage\n timelens { thumbnailsUrl, timelineUrl }\n videos { label, source: url, mimeType }\n images { posterUrl }\n relive\n playerConfig\n }\n }\n ",{slug:e}).then((function(e){if(!e.data.lecture)throw new Error("Lecture could not be found");return e.data.lecture}))}var E=function(e,t,n,r,i){var a="MediaSource"in window,o={poster:"//cdn.c3voc.de/thumbnail/".concat(e,"/poster.jpeg"),levelSelectorConfig:{labelCallback:function(e){var t=e.videoBandwidth||e.level.bitrate;return t<=1e5?"Slides":t<=9e5?"SD":t<=5e6?"HD":"Source"},title:"Quality"},disableErrorScreen:!0,errorPlugin:{onError:i},vocConfigUpdate:function(t){if("visible"===document.visibilityState&&!t.isPlaying()){var n,r="//cdn.c3voc.de/thumbnail/".concat(e,"/poster.jpeg?t=").concat(Date.now());(n=r,new Promise((function(e,t){var r=new Image;r.onload=function(){e()},r.onerror=function(){t()},r.src=n}))).then((function(){t.configure({poster:r})}))}}};return!(-1!=navigator.userAgent.indexOf("Firefox"))&&!n&&a&&MediaSource.isTypeSupported('video/webm; codecs="vp9,opus"')?(o.source={source:"//cdn.c3voc.de/dash/".concat(e,"/manifest.mpd")},o.shakaConfiguration={preferredAudioLanguage:r,abr:{defaultBandwidthEstimate:1e6},streaming:{jumpLargeGaps:!0},manifest:{dash:{defaultPresentationDelay:3,ignoreSuggestedPresentationDelay:!0}}}):t||!a&&""==document.createElement("video").canPlayType("application/vnd.apple.mpegURL")?o.source=t?{source:"//cdn.c3voc.de/".concat(e,"_native.mp3"),mimeType:"audio/mp3"}:{source:"//cdn.c3voc.de/".concat(e,"_native_hd.webm"),mimeType:"video/webm"}:o.source={source:"//cdn.c3voc.de/hls/".concat(e,"/native_hd.m3u8"),mimeType:"application/vnd.apple.mpegURL"},Promise.resolve(o)};function T(e){return(T="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 w(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=I(e);if(t){var i=I(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return R(this,n)}}function R(e,t){return!t||"object"!==T(t)&&"function"!=typeof t?L(e):t}function L(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var P=function(e,t){return"dash_shaka_playback"==e.origin&&(e.raw.code==t||e.raw.detail&&e.raw.detail.code==t)},j=function(e,t){return"hls"==e.origin&&e.raw.response.code==t},O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&C(e,t)}(s,e);var t,n,i,a=x(s);function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=a.call(this)).timeout=5,t.maxTimeout=15,t._playerPromise=t._getConfig(e).then((function(e){return t._options=e,t._player=new r.Player(t._options),t._player.core&&t._player.core.isReady?t._addEventListeners():t.listenToOnce(t._player,r.Events.PLAYER_READY,t._addEventListeners.bind(L(t))),e.vocConfigUpdate&&setInterval((function(){return e.vocConfigUpdate(t._player)}),3e4),t._player})),t}return t=s,(n=[{key:"attachTo",value:function(){var e,t=arguments;(e=console).log.apply(e,["will attach"].concat(Array.prototype.slice.call(arguments))),this._playerPromise.then((function(e){var n;(n=console).log.apply(n,["attach"].concat(w(t))),e.attachTo.apply(e,t)}))}},{key:"_getConfig",value:function(e){var t=[c.a,l.a,o.a,b];e.plugins&&e.plugins.length&&(t=t.concat(e.plugins),console.log("loading plugins"),t.forEach((function(e){return console.log(e.name,e.type)})));var n=Promise.resolve({});return e.vocStream?n=E(e.vocStream,e.audioOnly,e.h264Only,e.preferredAudioLanguage,this._handleError.bind(this)):e.vocLecture&&(n=A(e.vocLecture).then((function(e){var t,n,r,i;return{sources:e.videos||(null===(t=e.relive)||void 0===t?void 0:t.playlistCut)||(null===(n=e.relive)||void 0===n?void 0:n.playlist),poster:null===(r=e.images)||void 0===r?void 0:r.posterUrl,timelens:e.timelens,playback:{externalTracks:null===(i=e.playerConfig)||void 0===i?void 0:i.subtitles},levelSelectorConfig:{labelCallback:function(e,t){console.log("labelCallback",arguments);var n=e.videoBandwidth||e.level.bitrate;return n<=1e5?"Slides":n<=9e5?"SD":"HD"},title:"Quality"}}})).catch((function(e){return console.log("Failed to fetch media sources",e),{playbackNotSupportedMessage:"".concat(e.message)}}))),n.then((function(n){return Object.assign({width:"100%",height:"100%",hideMediaControlDelay:1e3,position:"top-left",watermark:"data:image/svg+xml;utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3Csvg%0A%20%20%20xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%0A%20%20%20xmlns%3Acc%3D%22http%3A%2F%2Fcreativecommons.org%2Fns%23%22%0A%20%20%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%0A%20%20%20xmlns%3Asvg%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%0A%20%20%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%0A%20%20%20id%3D%22svg4568%22%0A%20%20%20version%3D%221.1%22%0A%20%20%20viewBox%3D%220%200%2026.458318%2026.458333%22%0A%20%20%20height%3D%22100%22%0A%20%20%20width%3D%22100%22%3E%0A%20%20%3Cmetadata%0A%20%20%20%20%20id%3D%22metadata4574%22%3E%0A%20%20%20%20%3Crdf%3ARDF%3E%0A%20%20%20%20%20%20%3Ccc%3AWork%0A%20%20%20%20%20%20%20%20%20rdf%3Aabout%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%3Cdc%3Aformat%3Eimage%2Fsvg%2Bxml%3C%2Fdc%3Aformat%3E%0A%20%20%20%20%20%20%20%20%3Cdc%3Atype%0A%20%20%20%20%20%20%20%20%20%20%20rdf%3Aresource%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Fdcmitype%2FStillImage%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%3Cdc%3Atitle%3E%3C%2Fdc%3Atitle%3E%0A%20%20%20%20%20%20%3C%2Fcc%3AWork%3E%0A%20%20%20%20%3C%2Frdf%3ARDF%3E%0A%20%20%3C%2Fmetadata%3E%0A%20%20%3Cdefs%0A%20%20%20%20%20id%3D%22defs4572%22%20%2F%3E%0A%20%20%3Cpath%0A%20%20%20%20%20style%3D%22fill%3A%23ffffff%3Bfill-opacity%3A0.8627451%3Bstroke-width%3A0.79176539%22%0A%20%20%20%20%20id%3D%22path4566%22%0A%20%20%20%20%20d%3D%22m%2012.91039%2C7.1445417%20c%20-5.6690402%2C0%20-10.2660306%2C4.5961993%20-10.2660306%2C10.2652403%20a%2010.265238%2C10.265238%200%200%200%200.6706253%2C3.63816%20c%200.1504354%2C-0.393506%200.3230402%2C-0.777512%200.539984%2C-1.138557%200.1108472%2C-0.18369%200.2327789%2C-0.361837%200.313539%2C-0.559779%200.081551%2C-0.197941%200.1187648%2C-0.42201%200.057007%2C-0.627078%20A%201.0783844%2C1.0783844%200%200%200%204.0513264%2C18.402655%20C%203.9784841%2C18.305267%203.8993075%2C18.212631%203.833591%2C18.109702%20A%201.3159141%2C1.3159141%200%200%201%203.6316909%2C17.222924%201.1876481%2C1.1876481%200%200%201%204.0909148%2C16.441452%20c%200.2216944%2C-0.164688%200.5027709%2C-0.23753%200.7798889%2C-0.228028%20a%201.3911318%2C1.3911318%200%200%201%200.2739508%2C0.03801%20c%200.3578779%2C0.08709%200.6745841%2C0.311164%200.9089467%2C0.593824%200.2913696%2C0.353919%200.462391%2C0.799683%200.5043546%2C1.25574%20a%202.8297696%2C2.8297696%200%200%201%20-0.2177355%2C1.34046%20C%206.0236142%2C20.197593%205.42979%2C20.807252%205.1012074%2C21.557847%204.8335907%2C22.171464%204.7567894%2C22.854758%204.7924189%2C23.5238%20c%200.00554%2C0.06096%200.014251%2C0.122723%200.019794%2C0.185272%20a%2010.265238%2C10.265238%200%200%200%202.866191%2C2.517815%2013.958824%2C13.958824%200%200%201%20-0.1029298%2C-1.670626%20c%200.00161%2C-0.443389%200.023751%2C-0.886777%200.067304%2C-1.326206%20C%207.3735785%2C23.043191%207.1281312%2C22.826248%206.9539421%2C22.54913%206.6435705%2C22.058235%206.5849797%2C21.434324%206.712454%2C20.867421%206.8391365%2C20.299724%207.1400069%2C19.782702%207.5018439%2C19.327437%20A%206.2018984%2C6.2018984%200%200%201%209.7464993%2C17.567343%208.1591425%2C8.1591425%200%200%201%209.6752356%2C17.46758%203.8432293%2C3.8432293%200%200%201%209.1194163%2C15.744698%20c%20-0.047503%2C-0.615201%200.050669%2C-1.230403%200.091055%2C-1.844814%200.02929%2C-0.429928%200.031672%2C-0.859064%200.055423%2C-1.288201%200.030084%2C-0.496437%200.090261%2C-0.993667%200.2296124%2C-1.471101%20a%201.8685664%2C1.8685664%200%200%201%200.21061%2C-0.498812%201.1084716%2C1.1084716%200%200%201%200.4703083%2C-0.406968%20c%200.216945%2C-0.0855%200.403801%2C-0.104512%200.614411%2C-0.06888%200.174189%2C0.03642%200.3365%2C0.123516%200.478227%2C0.232779%200.142518%2C0.109264%200.26524%2C0.240698%200.380047%2C0.377673%20a%205.7783039%2C5.7783039%200%200%201%200.823436%2C1.280285%202.8266025%2C2.8266025%200%200%201%200.863024%2C0%205.7695944%2C5.7695944%200%200%201%200.823436%2C-1.279493%202.5415669%2C2.5415669%200%200%201%200.380047%2C-0.376881%20c%200.142518%2C-0.110847%200.303246%2C-0.196358%200.478227%2C-0.23357%20a%201.0039585%2C1.0039585%200%200%201%200.617577%2C0.06809%201.1100551%2C1.1100551%200%200%201%200.4711%2C0.409343%20c%200.09818%2C0.150436%200.159936%2C0.323041%200.21061%2C0.495645%200.138558%2C0.476643%200.199525%2C0.973872%200.229612%2C1.469517%200.02375%2C0.429928%200.02612%2C0.860649%200.05542%2C1.288995%200.0396%2C0.615201%200.138559%2C1.230403%200.09185%2C1.844813%20a%203.844021%2C3.844021%200%200%201%20-0.558194%2C1.724465%20c%20-0.02375%2C0.0396%20-0.05542%2C0.076%20-0.08154%2C0.114805%200.195565%2C0.220111%200.473476%2C0.406176%200.711006%2C0.486144%20a%201.5486932%2C1.5486932%200%200%200%200.831353%2C0.03484%201.3064129%2C1.3064129%200%200%200%200.42201%2C-0.17894%200.99208205%2C0.99208205%200%200%200%200.314331%2C-0.330957%20c%200.09343%2C-0.166272%200.131433%2C-0.356295%200.152019%2C-0.543944%200.05305%2C-0.482977%200%2C-0.96912%20-0.0396%2C-1.452889%20-0.02692%2C-0.313539%20-0.04909%2C-0.633412%200.02138%2C-0.939826%200.0475%2C-0.205858%200.140142%2C-0.410133%200.295328%2C-0.554235%20a%200.87569253%2C0.87569253%200%200%201%200.36817%2C-0.2019%201.0387963%2C1.0387963%200%200%201%200.419637%2C-0.02375%20c%200.30087%2C0.04514%200.582739%2C0.216942%200.750593%2C0.470308%200.09502%2C0.142517%200.153603%2C0.308788%200.18844%2C0.478226%200.03484%2C0.168646%200.0475%2C0.340459%200.05701%2C0.513064%200.03167%2C0.601741%200.03167%2C1.205067%200.01426%2C1.808392%20-0.01426%2C0.526524%20-0.04355%2C1.0673%20-0.253366%2C1.549486%20-0.271575%2C0.619159%20-0.817101%2C1.08155%20-1.405383%2C1.414092%20a%205.5835296%2C5.5835296%200%200%201%20-1.257323%2C0.512272%20c%200.38163%2C1.219319%200.580363%2C2.56532%200.580363%2C3.93349%20a%2013.935071%2C13.935071%200%200%201%20-0.106901%2C1.682498%2010.264446%2C10.264446%200%200%200%205.054631%2C-8.829768%20c%200%2C-5.669041%20-4.59699%2C-10.2652391%20-10.265238%2C-10.2652391%20z%20M%2010.037865%2C19.798537%20v%201.174188%20a%201.488519%2C1.488519%200%200%201%200.857482%2C0.286619%201.3760882%2C1.3760882%200%200%201%200.440222%2C0.538402%20c%200.0966%2C0.213775%200.131432%2C0.456056%200.09184%2C0.687252%20a%201.1821057%2C1.1821057%200%200%201%20-0.262867%2C0.560568%201.3040376%2C1.3040376%200%200%201%20-0.502772%2C0.36263%201.3760882%2C1.3760882%200%200%201%20-0.623119%2C0.0966%20v%202.953287%20l%206.145683%2C-3.33175%20-6.145683%2C-3.328583%20z%22%20%2F%3E%0A%3C%2Fsvg%3E",watermarkLink:"https://c3voc.de",levelSelectorConfig:{labelCallback:function(e){var t="unknown";return e.height?t=e.height:e.level&&e.level.height&&(t=e.level.height),t+"p"},title:"Quality"},audioTrackSelectorConfig:{title:"Language"}},n,e,{plugins:t})}))}},{key:"_containerChanged",value:function(){this.stopListening(),this._addEventListeners()}},{key:"_addEventListeners",value:function(){var e=this._player.core;this._container=e.activeContainer,this.listenTo(this._player,r.Events.PLAYER_PLAY,this._handlePlay),this.listenTo(this._player,r.Events.PLAYER_STOP,this._handleStop),this.listenTo(e,r.Events.CORE_ACTIVE_CONTAINER_CHANGED,this._containerChanged),this.listenTo(this._container,r.Events.CONTAINER_STATE_BUFFERFULL,this._handleBufferFull),this.listenTo(this._container,r.Events.CONTAINER_MEDIACONTROL_HIDE,this._handleMediaControlHide),this.listenTo(this._container,r.Events.CONTAINER_MEDIACONTROL_SHOW,this._handleMediaControlShow)}},{key:"_handleMediaControlHide",value:function(){this._container.$el.find(".clappr-watermark[data-watermark]").addClass("clappr-watermark-hide")}},{key:"_handleMediaControlShow",value:function(){this._container.$el.find(".clappr-watermark[data-watermark]").removeClass("clappr-watermark-hide")}},{key:"_getTimeout",value:function(){var e=.6*this.timeout+.4*this.timeout*Math.random();return this.timeout=Math.min(2*this.timeout,this.maxTimeout),e}},{key:"_resetTimeout",value:function(){this.timeout=5}},{key:"_handleError",value:function(e,t){this._recovery?clearTimeout(this._recovery.timeout):this._player.stop();var n=this._getTimeout();return console.log("got error",e,"retrying in ".concat(Math.round(n),"s")),this._recovery={clearOverlay:t,state:"restarting",timeout:setTimeout(this._waitForMedia.bind(this),1e3*n)},P(e,1001)||j(e,404)?{title:"Stream is offline",subtitle:"We will be right back"}:P(e,1002)||j(0)?{title:"A network error ocurred",subtitle:"Please check your internet connection"}:{title:"Oh no, an unknown error occured",subtitle:"Please try reloading the page"}}},{key:"_handlePlay",value:function(){this._recovery&&(console.log("soft recovery: play"),this._recovery.clearOverlay(),clearTimeout(this._recovery.timeout),this._recovery=null),this._resetTimeout()}},{key:"_handleStop",value:function(e){this._recovery&&this._container&&(console.log("soft recovery: stop"),this._container.playback.play.call(this._container.playback))}},{key:"_handleBufferFull",value:function(){if(this._recovery&&"live"==this._container.playback.getPlaybackType()){console.log("seeking to end for recovery");var e=Math.max(this._player.getDuration()-6,0);this._player.seek(e)}}},{key:"_handleMediaCheck",value:function(e){if(e)console.log("try playing again, media should be available"),this._player.play();else{var t=this._getTimeout();console.log("test for media failed, retrying in ~".concat(Math.round(t),"s")),setTimeout(this._waitForMedia.bind(this),1e3*t)}}},{key:"_waitForMedia",value:function(){var e=this._player.options.source;e&&e.source&&(e=e.source),"string"==typeof e?function(e,t){if(!t||"function"!=typeof t)throw new Error("Excepted function, got '".concat(t,"'"));var n=new XMLHttpRequest;n.onreadystatechange=function(){this.readyState===XMLHttpRequest.HEADERS_RECEIVED&&(200===this.status?t(!0):t(!1),n.abort())},n.open("GET",e,!0),n.send(null)}(e,this._handleMediaCheck.bind(this)):this.reset()}},{key:"reset",value:function(){console.log("performing hard reset"),this._recovery=null;var e=0==this._player.getVolume();e||this._player.mute(),this._player.configure({source:this._player.options.source,autoPlay:!0}),e||this._player.unmute()}}])&&k(t.prototype,n),i&&k(t,i),s}(r.BaseObject)}])})); diff --git a/src/plainui/static/plainui/vendor/vocplayer/player.umd.js b/src/plainui/static/plainui/vendor/vocplayer/player.umd.js new file mode 100644 index 0000000000000000000000000000000000000000..9c3d32683c06c512a731924feb86b1103224d635 --- /dev/null +++ b/src/plainui/static/plainui/vendor/vocplayer/player.umd.js @@ -0,0 +1,41034 @@ +(function (ye, xe) { + typeof exports == "object" && typeof module < "u" + ? xe(exports) + : typeof define == "function" && define.amd + ? define(["exports"], xe) + : ((ye = typeof globalThis < "u" ? globalThis : ye || self), + xe((ye.VOCPlayer = {}))); +})(this, function (ye) { + "use strict"; + function xe(s, e, t) { + return ( + (e = mt(e)), + fl( + s, + Wr() ? Reflect.construct(e, t || [], mt(s).constructor) : e.apply(s, t) + ) + ); + } + function Wr() { + try { + var s = !Boolean.prototype.valueOf.call( + Reflect.construct(Boolean, [], function () {}) + ); + } catch {} + return (Wr = function () { + return !!s; + })(); + } + function ul(s, e) { + var t = + s == null + ? null + : (typeof Symbol < "u" && s[Symbol.iterator]) || s["@@iterator"]; + if (t != null) { + var i, + n, + r, + a, + o = [], + l = !0, + u = !1; + try { + if (((r = (t = t.call(s)).next), e === 0)) { + if (Object(t) !== t) return; + l = !1; + } else + for ( + ; + !(l = (i = r.call(t)).done) && (o.push(i.value), o.length !== e); + l = !0 + ); + } catch (c) { + (u = !0), (n = c); + } finally { + try { + if (!l && t.return != null && ((a = t.return()), Object(a) !== a)) + return; + } finally { + if (u) throw n; + } + } + return o; + } + } + function jr(s, e) { + var t = Object.keys(s); + if (Object.getOwnPropertySymbols) { + var i = Object.getOwnPropertySymbols(s); + e && + (i = i.filter(function (n) { + return Object.getOwnPropertyDescriptor(s, n).enumerable; + })), + t.push.apply(t, i); + } + return t; + } + function Fi(s) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e] != null ? arguments[e] : {}; + e % 2 + ? jr(Object(t), !0).forEach(function (i) { + hl(s, i, t[i]); + }) + : Object.getOwnPropertyDescriptors + ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(t)) + : jr(Object(t)).forEach(function (i) { + Object.defineProperty(s, i, Object.getOwnPropertyDescriptor(t, i)); + }); + } + return s; + } + function cl(s, e) { + if (typeof s != "object" || !s) return s; + var t = s[Symbol.toPrimitive]; + if (t !== void 0) { + var i = t.call(s, e); + if (typeof i != "object") return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return String(s); + } + function qr(s) { + var e = cl(s, "string"); + return typeof e == "symbol" ? e : e + ""; + } + function Mt(s) { + "@babel/helpers - typeof"; + return ( + (Mt = + typeof Symbol == "function" && typeof Symbol.iterator == "symbol" + ? function (e) { + return typeof e; + } + : function (e) { + return e && + typeof Symbol == "function" && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + }), + Mt(s) + ); + } + function ve(s, e) { + if (!(s instanceof e)) + throw new TypeError("Cannot call a class as a function"); + } + function Xr(s, e) { + for (var t = 0; t < e.length; t++) { + var i = e[t]; + (i.enumerable = i.enumerable || !1), + (i.configurable = !0), + "value" in i && (i.writable = !0), + Object.defineProperty(s, qr(i.key), i); + } + } + function Ee(s, e, t) { + return ( + e && Xr(s.prototype, e), + t && Xr(s, t), + Object.defineProperty(s, "prototype", { writable: !1 }), + s + ); + } + function hl(s, e, t) { + return ( + (e = qr(e)), + e in s + ? Object.defineProperty(s, e, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0, + }) + : (s[e] = t), + s + ); + } + function we(s, e) { + if (typeof e != "function" && e !== null) + throw new TypeError("Super expression must either be null or a function"); + (s.prototype = Object.create(e && e.prototype, { + constructor: { value: s, writable: !0, configurable: !0 }, + })), + Object.defineProperty(s, "prototype", { writable: !1 }), + e && mn(s, e); + } + function mt(s) { + return ( + (mt = Object.setPrototypeOf + ? Object.getPrototypeOf.bind() + : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }), + mt(s) + ); + } + function mn(s, e) { + return ( + (mn = Object.setPrototypeOf + ? Object.setPrototypeOf.bind() + : function (i, n) { + return (i.__proto__ = n), i; + }), + mn(s, e) + ); + } + function dl(s) { + if (s === void 0) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return s; + } + function fl(s, e) { + if (e && (typeof e == "object" || typeof e == "function")) return e; + if (e !== void 0) + throw new TypeError( + "Derived constructors may only return object or undefined" + ); + return dl(s); + } + function gl(s, e) { + for ( + ; + !Object.prototype.hasOwnProperty.call(s, e) && ((s = mt(s)), s !== null); + + ); + return s; + } + function Bt() { + return ( + typeof Reflect < "u" && Reflect.get + ? (Bt = Reflect.get.bind()) + : (Bt = function (e, t, i) { + var n = gl(e, t); + if (n) { + var r = Object.getOwnPropertyDescriptor(n, t); + return r.get ? r.get.call(arguments.length < 3 ? e : i) : r.value; + } + }), + Bt.apply(this, arguments) + ); + } + function An(s, e) { + return ml(s) || ul(s, e) || yn(s, e) || vl(); + } + function Qt(s) { + return pl(s) || Al(s) || yn(s) || yl(); + } + function pl(s) { + if (Array.isArray(s)) return vn(s); + } + function ml(s) { + if (Array.isArray(s)) return s; + } + function Al(s) { + if ( + (typeof Symbol < "u" && s[Symbol.iterator] != null) || + s["@@iterator"] != null + ) + return Array.from(s); + } + function yn(s, e) { + if (s) { + if (typeof s == "string") return vn(s, e); + var t = Object.prototype.toString.call(s).slice(8, -1); + if ( + (t === "Object" && s.constructor && (t = s.constructor.name), + t === "Map" || t === "Set") + ) + return Array.from(s); + if ( + t === "Arguments" || + /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) + ) + return vn(s, e); + } + } + function vn(s, e) { + (e == null || e > s.length) && (e = s.length); + for (var t = 0, i = new Array(e); t < e; t++) i[t] = s[t]; + return i; + } + function yl() { + throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); + } + function vl() { + throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); + } + function Zr(s, e) { + var t = (typeof Symbol < "u" && s[Symbol.iterator]) || s["@@iterator"]; + if (!t) { + if (Array.isArray(s) || (t = yn(s)) || e) { + t && (s = t); + var i = 0, + n = function () {}; + return { + s: n, + n: function () { + return i >= s.length ? { done: !0 } : { done: !1, value: s[i++] }; + }, + e: function (l) { + throw l; + }, + f: n, + }; + } + throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); + } + var r = !0, + a = !1, + o; + return { + s: function () { + t = t.call(s); + }, + n: function () { + var l = t.next(); + return (r = l.done), l; + }, + e: function (l) { + (a = !0), (o = l); + }, + f: function () { + try { + !r && t.return != null && t.return(); + } finally { + if (a) throw o; + } + }, + }; + } + function El(s) { + return s && + s.__esModule && + Object.prototype.hasOwnProperty.call(s, "default") + ? s.default + : s; + } + var xt = (function () { + var s, + e, + t, + i, + n = [], + r = n.concat, + a = n.filter, + o = n.slice, + l = window.document, + u = {}, + c = {}, + d = { + "column-count": 1, + columns: 1, + "font-weight": 1, + "line-height": 1, + opacity: 1, + "z-index": 1, + zoom: 1, + }, + f = /^\s*<(\w+|!)[^>]*>/, + g = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + p = + /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + v = /^(?:body|html)$/i, + T = /([A-Z])/g, + x = ["val", "css", "html", "text", "data", "width", "height", "offset"], + I = ["after", "prepend", "before", "append"], + L = l.createElement("table"), + M = l.createElement("tr"), + O = { + tr: l.createElement("tbody"), + tbody: L, + thead: L, + tfoot: L, + td: M, + th: M, + "*": l.createElement("div"), + }, + j = /complete|loaded|interactive/, + U = /^[\w-]*$/, + Y = {}, + _ = Y.toString, + E = {}, + w, + b, + S = l.createElement("div"), + P = { + tabindex: "tabIndex", + readonly: "readOnly", + for: "htmlFor", + class: "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable", + }, + F = + Array.isArray || + function (h) { + return h instanceof Array; + }; + E.matches = function (h, m) { + if (!m || !h || h.nodeType !== 1) return !1; + var k = + h.matches || + h.webkitMatchesSelector || + h.mozMatchesSelector || + h.oMatchesSelector || + h.matchesSelector; + if (k) return k.call(h, m); + var R, + Z = h.parentNode, + W = !Z; + return ( + W && (Z = S).appendChild(h), + (R = ~E.qsa(Z, m).indexOf(h)), + W && S.removeChild(h), + R + ); + }; + function V(h) { + return h == null ? String(h) : Y[_.call(h)] || "object"; + } + function K(h) { + return V(h) == "function"; + } + function G(h) { + return h != null && h == h.window; + } + function B(h) { + return h != null && h.nodeType == h.DOCUMENT_NODE; + } + function q(h) { + return V(h) == "object"; + } + function X(h) { + return q(h) && !G(h) && Object.getPrototypeOf(h) == Object.prototype; + } + function J(h) { + var m = !!h && "length" in h && h.length, + k = t.type(h); + return ( + k != "function" && + !G(h) && + (k == "array" || + m === 0 || + (typeof m == "number" && m > 0 && m - 1 in h)) + ); + } + function z(h) { + return a.call(h, function (m) { + return m != null; + }); + } + function Ne(h) { + return h.length > 0 ? t.fn.concat.apply([], h) : h; + } + w = function (h) { + return h.replace(/-+(.)?/g, function (m, k) { + return k ? k.toUpperCase() : ""; + }); + }; + function me(h) { + return h + .replace(/::/g, "/") + .replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2") + .replace(/([a-z\d])([A-Z])/g, "$1_$2") + .replace(/_/g, "-") + .toLowerCase(); + } + b = function (h) { + return a.call(h, function (m, k) { + return h.indexOf(m) == k; + }); + }; + function Re(h) { + return h in c ? c[h] : (c[h] = new RegExp("(^|\\s)" + h + "(\\s|$)")); + } + function oe(h, m) { + return typeof m == "number" && !d[me(h)] ? m + "px" : m; + } + function Me(h) { + var m, k; + return ( + u[h] || + ((m = l.createElement(h)), + l.body.appendChild(m), + (k = getComputedStyle(m, "").getPropertyValue("display")), + m.parentNode.removeChild(m), + k == "none" && (k = "block"), + (u[h] = k)), + u[h] + ); + } + function St(h) { + return "children" in h + ? o.call(h.children) + : t.map(h.childNodes, function (m) { + if (m.nodeType == 1) return m; + }); + } + function Pi(h, m) { + var k, + R = h ? h.length : 0; + for (k = 0; k < R; k++) this[k] = h[k]; + (this.length = R), (this.selector = m || ""); + } + (E.fragment = function (h, m, k) { + var R, Z, W; + return ( + g.test(h) && (R = t(l.createElement(RegExp.$1))), + R || + (h.replace && (h = h.replace(p, "<$1></$2>")), + m === s && (m = f.test(h) && RegExp.$1), + m in O || (m = "*"), + (W = O[m]), + (W.innerHTML = "" + h), + (R = t.each(o.call(W.childNodes), function () { + W.removeChild(this); + }))), + X(k) && + ((Z = t(R)), + t.each(k, function (Ce, ke) { + x.indexOf(Ce) > -1 ? Z[Ce](ke) : Z.attr(Ce, ke); + })), + R + ); + }), + (E.Z = function (h, m) { + return new Pi(h, m); + }), + (E.isZ = function (h) { + return h instanceof E.Z; + }), + (E.init = function (h, m) { + var k; + if (h) + if (typeof h == "string") + if (((h = h.trim()), h[0] == "<" && f.test(h))) + (k = E.fragment(h, RegExp.$1, m)), (h = null); + else { + if (m !== s) return t(m).find(h); + k = E.qsa(l, h); + } + else { + if (K(h)) return t(l).ready(h); + if (E.isZ(h)) return h; + if (F(h)) k = z(h); + else if (q(h)) (k = [h]), (h = null); + else if (f.test(h)) + (k = E.fragment(h.trim(), RegExp.$1, m)), (h = null); + else { + if (m !== s) return t(m).find(h); + k = E.qsa(l, h); + } + } + else return E.Z(); + return E.Z(k, h); + }), + (t = function (h, m) { + return E.init(h, m); + }); + function wi(h, m, k) { + for (e in m) + k && (X(m[e]) || F(m[e])) + ? (X(m[e]) && !X(h[e]) && (h[e] = {}), + F(m[e]) && !F(h[e]) && (h[e] = []), + wi(h[e], m[e], k)) + : m[e] !== s && (h[e] = m[e]); + } + (t.extend = function (h) { + var m, + k = o.call(arguments, 1); + return ( + typeof h == "boolean" && ((m = h), (h = k.shift())), + k.forEach(function (R) { + wi(h, R, m); + }), + h + ); + }), + (E.qsa = function (h, m) { + var k, + R = m[0] == "#", + Z = !R && m[0] == ".", + W = R || Z ? m.slice(1) : m, + Ce = U.test(W); + return h.getElementById && Ce && R + ? (k = h.getElementById(W)) + ? [k] + : [] + : h.nodeType !== 1 && h.nodeType !== 9 && h.nodeType !== 11 + ? [] + : o.call( + Ce && !R && h.getElementsByClassName + ? Z + ? h.getElementsByClassName(W) + : h.getElementsByTagName(m) + : h.querySelectorAll(m) + ); + }); + function Ct(h, m) { + return m == null ? t(h) : t(h).filter(m); + } + t.contains = l.documentElement.contains + ? function (h, m) { + return h !== m && h.contains(m); + } + : function (h, m) { + for (; m && (m = m.parentNode); ) if (m === h) return !0; + return !1; + }; + function Pe(h, m, k, R) { + return K(m) ? m.call(h, k, R) : m; + } + function Zt(h, m, k) { + k == null ? h.removeAttribute(m) : h.setAttribute(m, k); + } + function Ye(h, m) { + var k = h.className || "", + R = k && k.baseVal !== s; + if (m === s) return R ? k.baseVal : k; + R ? (k.baseVal = m) : (h.className = m); + } + function Di(h) { + try { + return ( + h && + (h == "true" || + (h == "false" + ? !1 + : h == "null" + ? null + : +h + "" == h + ? +h + : /^[\[\{]/.test(h) + ? t.parseJSON(h) + : h)) + ); + } catch { + return h; + } + } + (t.type = V), + (t.isFunction = K), + (t.isWindow = G), + (t.isArray = F), + (t.isPlainObject = X), + (t.isEmptyObject = function (h) { + var m; + for (m in h) return !1; + return !0; + }), + (t.isNumeric = function (h) { + var m = Number(h), + k = typeof h; + return ( + (h != null && + k != "boolean" && + (k != "string" || h.length) && + !isNaN(m) && + isFinite(m)) || + !1 + ); + }), + (t.inArray = function (h, m, k) { + return n.indexOf.call(m, h, k); + }), + (t.camelCase = w), + (t.trim = function (h) { + return h == null ? "" : String.prototype.trim.call(h); + }), + (t.uuid = 0), + (t.support = {}), + (t.expr = {}), + (t.noop = function () {}), + (t.map = function (h, m) { + var k, + R = [], + Z, + W; + if (J(h)) + for (Z = 0; Z < h.length; Z++) + (k = m(h[Z], Z)), k != null && R.push(k); + else for (W in h) (k = m(h[W], W)), k != null && R.push(k); + return Ne(R); + }), + (t.each = function (h, m) { + var k, R; + if (J(h)) { + for (k = 0; k < h.length; k++) + if (m.call(h[k], k, h[k]) === !1) return h; + } else for (R in h) if (m.call(h[R], R, h[R]) === !1) return h; + return h; + }), + (t.grep = function (h, m) { + return a.call(h, m); + }), + window.JSON && (t.parseJSON = JSON.parse), + t.each( + "Boolean Number String Function Array Date RegExp Object Error".split( + " " + ), + function (h, m) { + Y["[object " + m + "]"] = m.toLowerCase(); + } + ), + (t.fn = { + constructor: E.Z, + length: 0, + forEach: n.forEach, + reduce: n.reduce, + push: n.push, + sort: n.sort, + splice: n.splice, + indexOf: n.indexOf, + concat: function () { + var h, + m, + k = []; + for (h = 0; h < arguments.length; h++) + (m = arguments[h]), (k[h] = E.isZ(m) ? m.toArray() : m); + return r.apply(E.isZ(this) ? this.toArray() : this, k); + }, + map: function (h) { + return t( + t.map(this, function (m, k) { + return h.call(m, k, m); + }) + ); + }, + slice: function () { + return t(o.apply(this, arguments)); + }, + ready: function (h) { + return ( + j.test(l.readyState) && l.body + ? h(t) + : l.addEventListener( + "DOMContentLoaded", + function () { + h(t); + }, + !1 + ), + this + ); + }, + get: function (h) { + return h === s ? o.call(this) : this[h >= 0 ? h : h + this.length]; + }, + toArray: function () { + return this.get(); + }, + size: function () { + return this.length; + }, + remove: function () { + return this.each(function () { + this.parentNode != null && this.parentNode.removeChild(this); + }); + }, + each: function (h) { + return ( + n.every.call(this, function (m, k) { + return h.call(m, k, m) !== !1; + }), + this + ); + }, + filter: function (h) { + return K(h) + ? this.not(this.not(h)) + : t( + a.call(this, function (m) { + return E.matches(m, h); + }) + ); + }, + add: function (h, m) { + return t(b(this.concat(t(h, m)))); + }, + is: function (h) { + return this.length > 0 && E.matches(this[0], h); + }, + not: function (h) { + var m = []; + if (K(h) && h.call !== s) + this.each(function (R) { + h.call(this, R) || m.push(this); + }); + else { + var k = + typeof h == "string" + ? this.filter(h) + : J(h) && K(h.item) + ? o.call(h) + : t(h); + this.forEach(function (R) { + k.indexOf(R) < 0 && m.push(R); + }); + } + return t(m); + }, + has: function (h) { + return this.filter(function () { + return q(h) ? t.contains(this, h) : t(this).find(h).size(); + }); + }, + eq: function (h) { + return h === -1 ? this.slice(h) : this.slice(h, +h + 1); + }, + first: function () { + var h = this[0]; + return h && !q(h) ? h : t(h); + }, + last: function () { + var h = this[this.length - 1]; + return h && !q(h) ? h : t(h); + }, + find: function (h) { + var m, + k = this; + return ( + h + ? typeof h == "object" + ? (m = t(h).filter(function () { + var R = this; + return n.some.call(k, function (Z) { + return t.contains(Z, R); + }); + })) + : this.length == 1 + ? (m = t(E.qsa(this[0], h))) + : (m = this.map(function () { + return E.qsa(this, h); + })) + : (m = t()), + m + ); + }, + closest: function (h, m) { + var k = [], + R = typeof h == "object" && t(h); + return ( + this.each(function (Z, W) { + for (; W && !(R ? R.indexOf(W) >= 0 : E.matches(W, h)); ) + W = W !== m && !B(W) && W.parentNode; + W && k.indexOf(W) < 0 && k.push(W); + }), + t(k) + ); + }, + parents: function (h) { + for (var m = [], k = this; k.length > 0; ) + k = t.map(k, function (R) { + if ((R = R.parentNode) && !B(R) && m.indexOf(R) < 0) + return m.push(R), R; + }); + return Ct(m, h); + }, + parent: function (h) { + return Ct(b(this.pluck("parentNode")), h); + }, + children: function (h) { + return Ct( + this.map(function () { + return St(this); + }), + h + ); + }, + contents: function () { + return this.map(function () { + return this.contentDocument || o.call(this.childNodes); + }); + }, + siblings: function (h) { + return Ct( + this.map(function (m, k) { + return a.call(St(k.parentNode), function (R) { + return R !== k; + }); + }), + h + ); + }, + empty: function () { + return this.each(function () { + this.innerHTML = ""; + }); + }, + pluck: function (h) { + return t.map(this, function (m) { + return m[h]; + }); + }, + show: function () { + return this.each(function () { + this.style.display == "none" && (this.style.display = ""), + getComputedStyle(this, "").getPropertyValue("display") == + "none" && (this.style.display = Me(this.nodeName)); + }); + }, + replaceWith: function (h) { + return this.before(h).remove(); + }, + wrap: function (h) { + var m = K(h); + if (this[0] && !m) + var k = t(h).get(0), + R = k.parentNode || this.length > 1; + return this.each(function (Z) { + t(this).wrapAll(m ? h.call(this, Z) : R ? k.cloneNode(!0) : k); + }); + }, + wrapAll: function (h) { + if (this[0]) { + t(this[0]).before((h = t(h))); + for (var m; (m = h.children()).length; ) h = m.first(); + t(h).append(this); + } + return this; + }, + wrapInner: function (h) { + var m = K(h); + return this.each(function (k) { + var R = t(this), + Z = R.contents(), + W = m ? h.call(this, k) : h; + Z.length ? Z.wrapAll(W) : R.append(W); + }); + }, + unwrap: function () { + return ( + this.parent().each(function () { + t(this).replaceWith(t(this).children()); + }), + this + ); + }, + clone: function () { + return this.map(function () { + return this.cloneNode(!0); + }); + }, + hide: function () { + return this.css("display", "none"); + }, + toggle: function (h) { + return this.each(function () { + var m = t(this); + (h === s ? m.css("display") == "none" : h) ? m.show() : m.hide(); + }); + }, + prev: function (h) { + return t(this.pluck("previousElementSibling")).filter(h || "*"); + }, + next: function (h) { + return t(this.pluck("nextElementSibling")).filter(h || "*"); + }, + html: function (h) { + return 0 in arguments + ? this.each(function (m) { + var k = this.innerHTML; + t(this).empty().append(Pe(this, h, m, k)); + }) + : 0 in this + ? this[0].innerHTML + : null; + }, + text: function (h) { + return 0 in arguments + ? this.each(function (m) { + var k = Pe(this, h, m, this.textContent); + this.textContent = k == null ? "" : "" + k; + }) + : 0 in this + ? this.pluck("textContent").join("") + : null; + }, + attr: function (h, m) { + var k; + return typeof h == "string" && !(1 in arguments) + ? 0 in this && + this[0].nodeType == 1 && + (k = this[0].getAttribute(h)) != null + ? k + : s + : this.each(function (R) { + if (this.nodeType === 1) + if (q(h)) for (e in h) Zt(this, e, h[e]); + else Zt(this, h, Pe(this, m, R, this.getAttribute(h))); + }); + }, + removeAttr: function (h) { + return this.each(function () { + this.nodeType === 1 && + h.split(" ").forEach(function (m) { + Zt(this, m); + }, this); + }); + }, + prop: function (h, m) { + return ( + (h = P[h] || h), + 1 in arguments + ? this.each(function (k) { + this[h] = Pe(this, m, k, this[h]); + }) + : this[0] && this[0][h] + ); + }, + removeProp: function (h) { + return ( + (h = P[h] || h), + this.each(function () { + delete this[h]; + }) + ); + }, + data: function (h, m) { + var k = "data-" + h.replace(T, "-$1").toLowerCase(), + R = 1 in arguments ? this.attr(k, m) : this.attr(k); + return R !== null ? Di(R) : s; + }, + val: function (h) { + return 0 in arguments + ? (h == null && (h = ""), + this.each(function (m) { + this.value = Pe(this, h, m, this.value); + })) + : this[0] && + (this[0].multiple + ? t(this[0]) + .find("option") + .filter(function () { + return this.selected; + }) + .pluck("value") + : this[0].value); + }, + offset: function (h) { + if (h) + return this.each(function (k) { + var R = t(this), + Z = Pe(this, h, k, R.offset()), + W = R.offsetParent().offset(), + Ce = { top: Z.top - W.top, left: Z.left - W.left }; + R.css("position") == "static" && (Ce.position = "relative"), + R.css(Ce); + }); + if (!this.length) return null; + if ( + l.documentElement !== this[0] && + !t.contains(l.documentElement, this[0]) + ) + return { top: 0, left: 0 }; + var m = this[0].getBoundingClientRect(); + return { + left: m.left + window.pageXOffset, + top: m.top + window.pageYOffset, + width: Math.round(m.width), + height: Math.round(m.height), + }; + }, + css: function (h, m) { + if (arguments.length < 2) { + var k = this[0]; + if (typeof h == "string") + return k + ? k.style[w(h)] || getComputedStyle(k, "").getPropertyValue(h) + : void 0; + if (F(h)) { + if (!k) return; + var R = {}, + Z = getComputedStyle(k, ""); + return ( + t.each(h, function (Ce, ke) { + R[ke] = k.style[w(ke)] || Z.getPropertyValue(ke); + }), + R + ); + } + } + var W = ""; + if (V(h) == "string") + !m && m !== 0 + ? this.each(function () { + this.style.removeProperty(me(h)); + }) + : (W = me(h) + ":" + oe(h, m)); + else + for (e in h) + !h[e] && h[e] !== 0 + ? this.each(function () { + this.style.removeProperty(me(e)); + }) + : (W += me(e) + ":" + oe(e, h[e]) + ";"); + return this.each(function () { + this.style.cssText += ";" + W; + }); + }, + index: function (h) { + return h + ? this.indexOf(t(h)[0]) + : this.parent().children().indexOf(this[0]); + }, + hasClass: function (h) { + return h + ? n.some.call( + this, + function (m) { + return this.test(Ye(m)); + }, + Re(h) + ) + : !1; + }, + addClass: function (h) { + return h + ? this.each(function (m) { + if ("className" in this) { + i = []; + var k = Ye(this), + R = Pe(this, h, m, k); + R.split(/\s+/g).forEach(function (Z) { + t(this).hasClass(Z) || i.push(Z); + }, this), + i.length && Ye(this, k + (k ? " " : "") + i.join(" ")); + } + }) + : this; + }, + removeClass: function (h) { + return this.each(function (m) { + if ("className" in this) { + if (h === s) return Ye(this, ""); + (i = Ye(this)), + Pe(this, h, m, i) + .split(/\s+/g) + .forEach(function (k) { + i = i.replace(Re(k), " "); + }), + Ye(this, i.trim()); + } + }); + }, + toggleClass: function (h, m) { + return h + ? this.each(function (k) { + var R = t(this), + Z = Pe(this, h, k, Ye(this)); + Z.split(/\s+/g).forEach(function (W) { + (m === s ? !R.hasClass(W) : m) + ? R.addClass(W) + : R.removeClass(W); + }); + }) + : this; + }, + scrollTop: function (h) { + if (this.length) { + var m = "scrollTop" in this[0]; + return h === s + ? m + ? this[0].scrollTop + : this[0].pageYOffset + : this.each( + m + ? function () { + this.scrollTop = h; + } + : function () { + this.scrollTo(this.scrollX, h); + } + ); + } + }, + scrollLeft: function (h) { + if (this.length) { + var m = "scrollLeft" in this[0]; + return h === s + ? m + ? this[0].scrollLeft + : this[0].pageXOffset + : this.each( + m + ? function () { + this.scrollLeft = h; + } + : function () { + this.scrollTo(h, this.scrollY); + } + ); + } + }, + position: function () { + if (this.length) { + var h = this[0], + m = this.offsetParent(), + k = this.offset(), + R = v.test(m[0].nodeName) ? { top: 0, left: 0 } : m.offset(); + return ( + (k.top -= parseFloat(t(h).css("margin-top")) || 0), + (k.left -= parseFloat(t(h).css("margin-left")) || 0), + (R.top += parseFloat(t(m[0]).css("border-top-width")) || 0), + (R.left += parseFloat(t(m[0]).css("border-left-width")) || 0), + { top: k.top - R.top, left: k.left - R.left } + ); + } + }, + offsetParent: function () { + return this.map(function () { + for ( + var h = this.offsetParent || l.body; + h && !v.test(h.nodeName) && t(h).css("position") == "static"; + + ) + h = h.offsetParent; + return h; + }); + }, + }), + (t.fn.detach = t.fn.remove), + ["width", "height"].forEach(function (h) { + var m = h.replace(/./, function (k) { + return k[0].toUpperCase(); + }); + t.fn[h] = function (k) { + var R, + Z = this[0]; + return k === s + ? G(Z) + ? Z["inner" + m] + : B(Z) + ? Z.documentElement["scroll" + m] + : (R = this.offset()) && R[h] + : this.each(function (W) { + (Z = t(this)), Z.css(h, Pe(this, k, W, Z[h]())); + }); + }; + }); + function Oi(h, m) { + m(h); + for (var k = 0, R = h.childNodes.length; k < R; k++) + Oi(h.childNodes[k], m); + } + return ( + I.forEach(function (h, m) { + var k = m % 2; + (t.fn[h] = function () { + var R, + Z = t.map(arguments, function (ke) { + var Ae = []; + return ( + (R = V(ke)), + R == "array" + ? (ke.forEach(function (ze) { + if (ze.nodeType !== s) return Ae.push(ze); + if (t.zepto.isZ(ze)) return (Ae = Ae.concat(ze.get())); + Ae = Ae.concat(E.fragment(ze)); + }), + Ae) + : R == "object" || ke == null + ? ke + : E.fragment(ke) + ); + }), + W, + Ce = this.length > 1; + return Z.length < 1 + ? this + : this.each(function (ke, Ae) { + (W = k ? Ae : Ae.parentNode), + (Ae = + m == 0 + ? Ae.nextSibling + : m == 1 + ? Ae.firstChild + : m == 2 + ? Ae + : null); + var ze = t.contains(l.documentElement, W); + Z.forEach(function (ut) { + if (Ce) ut = ut.cloneNode(!0); + else if (!W) return t(ut).remove(); + W.insertBefore(ut, Ae), + ze && + Oi(ut, function (Ve) { + if ( + Ve.nodeName != null && + Ve.nodeName.toUpperCase() === "SCRIPT" && + (!Ve.type || Ve.type === "text/javascript") && + !Ve.src + ) { + var Ni = Ve.ownerDocument + ? Ve.ownerDocument.defaultView + : window; + Ni.eval.call(Ni, Ve.innerHTML); + } + }); + }); + }); + }), + (t.fn[k ? h + "To" : "insert" + (m ? "Before" : "After")] = function ( + R + ) { + return t(R)[h](this), this; + }); + }), + (E.Z.prototype = Pi.prototype = t.fn), + (E.uniq = b), + (E.deserializeValue = Di), + (t.zepto = E), + t + ); + })(); + (window.Zepto = xt), + window.$ === void 0 && (window.$ = xt), + (function (s) { + var e = +new Date(), + t = window.document, + i, + n, + r = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, + a = /^(?:text|application)\/javascript/i, + o = /^(?:text|application)\/xml/i, + l = "application/json", + u = "text/html", + c = /^\s*$/, + d = t.createElement("a"); + d.href = window.location.href; + function f(b, S, P) { + var F = s.Event(S); + return s(b).trigger(F, P), !F.isDefaultPrevented(); + } + function g(b, S, P, F) { + if (b.global) return f(S || t, P, F); + } + s.active = 0; + function p(b) { + b.global && s.active++ === 0 && g(b, null, "ajaxStart"); + } + function v(b) { + b.global && !--s.active && g(b, null, "ajaxStop"); + } + function T(b, S) { + var P = S.context; + if ( + S.beforeSend.call(P, b, S) === !1 || + g(S, P, "ajaxBeforeSend", [b, S]) === !1 + ) + return !1; + g(S, P, "ajaxSend", [b, S]); + } + function x(b, S, P, F) { + var V = P.context, + K = "success"; + P.success.call(V, b, K, S), + F && F.resolveWith(V, [b, K, S]), + g(P, V, "ajaxSuccess", [S, P, b]), + L(K, S, P); + } + function I(b, S, P, F, V) { + var K = F.context; + F.error.call(K, P, S, b), + V && V.rejectWith(K, [P, S, b]), + g(F, K, "ajaxError", [P, F, b || S]), + L(S, P, F); + } + function L(b, S, P) { + var F = P.context; + P.complete.call(F, S, b), g(P, F, "ajaxComplete", [S, P]), v(P); + } + function M(b, S, P) { + if (P.dataFilter == O) return b; + var F = P.context; + return P.dataFilter.call(F, b, S); + } + function O() {} + (s.ajaxJSONP = function (b, S) { + if (!("type" in b)) return s.ajax(b); + var P = b.jsonpCallback, + F = (s.isFunction(P) ? P() : P) || "Zepto" + e++, + V = t.createElement("script"), + K = window[F], + G, + B = function (J) { + s(V).triggerHandler("error", J || "abort"); + }, + q = { abort: B }, + X; + return ( + S && S.promise(q), + s(V).on("load error", function (J, z) { + clearTimeout(X), + s(V).off().remove(), + J.type == "error" || !G + ? I(null, z || "error", q, b, S) + : x(G[0], q, b, S), + (window[F] = K), + G && s.isFunction(K) && K(G[0]), + (K = G = void 0); + }), + T(q, b) === !1 + ? (B("abort"), q) + : ((window[F] = function () { + G = arguments; + }), + (V.src = b.url.replace(/\?(.+)=\?/, "?$1=" + F)), + t.head.appendChild(V), + b.timeout > 0 && + (X = setTimeout(function () { + B("timeout"); + }, b.timeout)), + q) + ); + }), + (s.ajaxSettings = { + type: "GET", + beforeSend: O, + success: O, + error: O, + complete: O, + context: null, + global: !0, + xhr: function () { + return new window.XMLHttpRequest(); + }, + accepts: { + script: + "text/javascript, application/javascript, application/x-javascript", + json: l, + xml: "application/xml, text/xml", + html: u, + text: "text/plain", + }, + crossDomain: !1, + timeout: 0, + processData: !0, + cache: !0, + dataFilter: O, + }); + function j(b) { + return ( + b && (b = b.split(";", 2)[0]), + (b && + (b == u + ? "html" + : b == l + ? "json" + : a.test(b) + ? "script" + : o.test(b) && "xml")) || + "text" + ); + } + function U(b, S) { + return S == "" ? b : (b + "&" + S).replace(/[&?]{1,2}/, "?"); + } + function Y(b) { + b.processData && + b.data && + s.type(b.data) != "string" && + (b.data = s.param(b.data, b.traditional)), + b.data && + (!b.type || + b.type.toUpperCase() == "GET" || + b.dataType == "jsonp") && + ((b.url = U(b.url, b.data)), (b.data = void 0)); + } + s.ajax = function (b) { + var S = s.extend({}, b || {}), + P = s.Deferred && s.Deferred(), + F, + V; + for (i in s.ajaxSettings) S[i] === void 0 && (S[i] = s.ajaxSettings[i]); + p(S), + S.crossDomain || + ((F = t.createElement("a")), + (F.href = S.url), + (F.href = F.href), + (S.crossDomain = + d.protocol + "//" + d.host != F.protocol + "//" + F.host)), + S.url || (S.url = window.location.toString()), + (V = S.url.indexOf("#")) > -1 && (S.url = S.url.slice(0, V)), + Y(S); + var K = S.dataType, + G = /\?.+=\?/.test(S.url); + if ( + (G && (K = "jsonp"), + (S.cache === !1 || + ((!b || b.cache !== !0) && (K == "script" || K == "jsonp"))) && + (S.url = U(S.url, "_=" + Date.now())), + K == "jsonp") + ) + return ( + G || + (S.url = U( + S.url, + S.jsonp ? S.jsonp + "=?" : S.jsonp === !1 ? "" : "callback=?" + )), + s.ajaxJSONP(S, P) + ); + var B = S.accepts[K], + q = {}, + X = function (oe, Me) { + q[oe.toLowerCase()] = [oe, Me]; + }, + J = /^([\w-]+:)\/\//.test(S.url) + ? RegExp.$1 + : window.location.protocol, + z = S.xhr(), + Ne = z.setRequestHeader, + me; + if ( + (P && P.promise(z), + S.crossDomain || X("X-Requested-With", "XMLHttpRequest"), + X("Accept", B || "*/*"), + (B = S.mimeType || B) && + (B.indexOf(",") > -1 && (B = B.split(",", 2)[0]), + z.overrideMimeType && z.overrideMimeType(B)), + (S.contentType || + (S.contentType !== !1 && + S.data && + S.type.toUpperCase() != "GET")) && + X( + "Content-Type", + S.contentType || "application/x-www-form-urlencoded" + ), + S.headers) + ) + for (n in S.headers) X(n, S.headers[n]); + if ( + ((z.setRequestHeader = X), + (z.onreadystatechange = function () { + if (z.readyState == 4) { + (z.onreadystatechange = O), clearTimeout(me); + var oe, + Me = !1; + if ( + (z.status >= 200 && z.status < 300) || + z.status == 304 || + (z.status == 0 && J == "file:") + ) { + if ( + ((K = + K || j(S.mimeType || z.getResponseHeader("content-type"))), + z.responseType == "arraybuffer" || z.responseType == "blob") + ) + oe = z.response; + else { + oe = z.responseText; + try { + (oe = M(oe, K, S)), + K == "script" + ? (0, eval)(oe) + : K == "xml" + ? (oe = z.responseXML) + : K == "json" && + (oe = c.test(oe) ? null : s.parseJSON(oe)); + } catch (St) { + Me = St; + } + if (Me) return I(Me, "parsererror", z, S, P); + } + x(oe, z, S, P); + } else + I(z.statusText || null, z.status ? "error" : "abort", z, S, P); + } + }), + T(z, S) === !1) + ) + return z.abort(), I(null, "abort", z, S, P), z; + var Re = "async" in S ? S.async : !0; + if ((z.open(S.type, S.url, Re, S.username, S.password), S.xhrFields)) + for (n in S.xhrFields) z[n] = S.xhrFields[n]; + for (n in q) Ne.apply(z, q[n]); + return ( + S.timeout > 0 && + (me = setTimeout(function () { + (z.onreadystatechange = O), + z.abort(), + I(null, "timeout", z, S, P); + }, S.timeout)), + z.send(S.data ? S.data : null), + z + ); + }; + function _(b, S, P, F) { + return ( + s.isFunction(S) && ((F = P), (P = S), (S = void 0)), + s.isFunction(P) || ((F = P), (P = void 0)), + { url: b, data: S, success: P, dataType: F } + ); + } + (s.get = function () { + return s.ajax(_.apply(null, arguments)); + }), + (s.post = function () { + var b = _.apply(null, arguments); + return (b.type = "POST"), s.ajax(b); + }), + (s.getJSON = function () { + var b = _.apply(null, arguments); + return (b.dataType = "json"), s.ajax(b); + }), + (s.fn.load = function (b, S, P) { + if (!this.length) return this; + var F = this, + V = b.split(/\s/), + K, + G = _(b, S, P), + B = G.success; + return ( + V.length > 1 && ((G.url = V[0]), (K = V[1])), + (G.success = function (q) { + F.html(K ? s("<div>").html(q.replace(r, "")).find(K) : q), + B && B.apply(F, arguments); + }), + s.ajax(G), + this + ); + }); + var E = encodeURIComponent; + function w(b, S, P, F) { + var V, + K = s.isArray(S), + G = s.isPlainObject(S); + s.each(S, function (B, q) { + (V = s.type(q)), + F && + (B = P + ? F + : F + + "[" + + (G || V == "object" || V == "array" ? B : "") + + "]"), + !F && K + ? b.add(q.name, q.value) + : V == "array" || (!P && V == "object") + ? w(b, q, P, B) + : b.add(B, q); + }); + } + s.param = function (b, S) { + var P = []; + return ( + (P.add = function (F, V) { + s.isFunction(V) && (V = V()), + V == null && (V = ""), + this.push(E(F) + "=" + E(V)); + }), + w(P, b, S), + P.join("&").replace(/%20/g, "+") + ); + }; + })(xt), + (function (s) { + s.Callbacks = function (e) { + e = s.extend({}, e); + var t, + i, + n, + r, + a, + o, + l = [], + u = !e.once && [], + c = function (f) { + for ( + t = e.memory && f, + i = !0, + o = r || 0, + r = 0, + a = l.length, + n = !0; + l && o < a; + ++o + ) + if (l[o].apply(f[0], f[1]) === !1 && e.stopOnFalse) { + t = !1; + break; + } + (n = !1), + l && + (u + ? u.length && c(u.shift()) + : t + ? (l.length = 0) + : d.disable()); + }, + d = { + add: function () { + if (l) { + var f = l.length, + g = function (p) { + s.each(p, function (v, T) { + typeof T == "function" + ? (!e.unique || !d.has(T)) && l.push(T) + : T && T.length && typeof T != "string" && g(T); + }); + }; + g(arguments), n ? (a = l.length) : t && ((r = f), c(t)); + } + return this; + }, + remove: function () { + return ( + l && + s.each(arguments, function (f, g) { + for (var p; (p = s.inArray(g, l, p)) > -1; ) + l.splice(p, 1), n && (p <= a && --a, p <= o && --o); + }), + this + ); + }, + has: function (f) { + return !!(l && (f ? s.inArray(f, l) > -1 : l.length)); + }, + empty: function () { + return (a = l.length = 0), this; + }, + disable: function () { + return (l = u = t = void 0), this; + }, + disabled: function () { + return !l; + }, + lock: function () { + return (u = void 0), t || d.disable(), this; + }, + locked: function () { + return !u; + }, + fireWith: function (f, g) { + return ( + l && + (!i || u) && + ((g = g || []), + (g = [f, g.slice ? g.slice() : g]), + n ? u.push(g) : c(g)), + this + ); + }, + fire: function () { + return d.fireWith(this, arguments); + }, + fired: function () { + return !!i; + }, + }; + return d; + }; + })(xt), + (function (s) { + var e = Array.prototype.slice; + function t(i) { + var n = [ + [ + "resolve", + "done", + s.Callbacks({ once: 1, memory: 1 }), + "resolved", + ], + ["reject", "fail", s.Callbacks({ once: 1, memory: 1 }), "rejected"], + ["notify", "progress", s.Callbacks({ memory: 1 })], + ], + r = "pending", + a = { + state: function () { + return r; + }, + always: function () { + return o.done(arguments).fail(arguments), this; + }, + then: function () { + var l = arguments; + return t(function (u) { + s.each(n, function (c, d) { + var f = s.isFunction(l[c]) && l[c]; + o[d[1]](function () { + var g = f && f.apply(this, arguments); + if (g && s.isFunction(g.promise)) + g.promise() + .done(u.resolve) + .fail(u.reject) + .progress(u.notify); + else { + var p = this === a ? u.promise() : this, + v = f ? [g] : arguments; + u[d[0] + "With"](p, v); + } + }); + }), + (l = null); + }).promise(); + }, + promise: function (l) { + return l != null ? s.extend(l, a) : a; + }, + }, + o = {}; + return ( + s.each(n, function (l, u) { + var c = u[2], + d = u[3]; + (a[u[1]] = c.add), + d && + c.add( + function () { + r = d; + }, + n[l ^ 1][2].disable, + n[2][2].lock + ), + (o[u[0]] = function () { + return o[u[0] + "With"](this === o ? a : this, arguments), this; + }), + (o[u[0] + "With"] = c.fireWith); + }), + a.promise(o), + i && i.call(o, o), + o + ); + } + (s.when = function (i) { + var n = e.call(arguments), + r = n.length, + a = 0, + o = r !== 1 || (i && s.isFunction(i.promise)) ? r : 0, + l = o === 1 ? i : t(), + u, + c, + d, + f = function (g, p, v) { + return function (T) { + (p[g] = this), + (v[g] = arguments.length > 1 ? e.call(arguments) : T), + v === u ? l.notifyWith(p, v) : --o || l.resolveWith(p, v); + }; + }; + if (r > 1) + for (u = new Array(r), c = new Array(r), d = new Array(r); a < r; ++a) + n[a] && s.isFunction(n[a].promise) + ? n[a] + .promise() + .done(f(a, d, n)) + .fail(l.reject) + .progress(f(a, c, u)) + : --o; + return o || l.resolveWith(d, n), l.promise(); + }), + (s.Deferred = t); + })(xt), + (function (s) { + var e = 1, + t, + i = Array.prototype.slice, + n = s.isFunction, + r = function (_) { + return typeof _ == "string"; + }, + a = {}, + o = {}, + l = "onfocusin" in window, + u = { focus: "focusin", blur: "focusout" }, + c = { mouseenter: "mouseover", mouseleave: "mouseout" }; + o.click = o.mousedown = o.mouseup = o.mousemove = "MouseEvents"; + function d(_) { + return _._zid || (_._zid = e++); + } + function f(_, E, w, b) { + if (((E = g(E)), E.ns)) var S = p(E.ns); + return (a[d(_)] || []).filter(function (P) { + return ( + P && + (!E.e || P.e == E.e) && + (!E.ns || S.test(P.ns)) && + (!w || d(P.fn) === d(w)) && + (!b || P.sel == b) + ); + }); + } + function g(_) { + var E = ("" + _).split("."); + return { e: E[0], ns: E.slice(1).sort().join(" ") }; + } + function p(_) { + return new RegExp("(?:^| )" + _.replace(" ", " .* ?") + "(?: |$)"); + } + function v(_, E) { + return (_.del && !l && _.e in u) || !!E; + } + function T(_) { + return c[_] || (l && u[_]) || _; + } + function x(_, E, w, b, S, P, F) { + var V = d(_), + K = a[V] || (a[V] = []); + E.split(/\s/).forEach(function (G) { + if (G == "ready") return s(document).ready(w); + var B = g(G); + (B.fn = w), + (B.sel = S), + B.e in c && + (w = function (X) { + var J = X.relatedTarget; + if (!J || (J !== this && !s.contains(this, J))) + return B.fn.apply(this, arguments); + }), + (B.del = P); + var q = P || w; + (B.proxy = function (X) { + if (((X = U(X)), !X.isImmediatePropagationStopped())) { + X.data = b; + var J = q.apply(_, X._args == t ? [X] : [X].concat(X._args)); + return J === !1 && (X.preventDefault(), X.stopPropagation()), J; + } + }), + (B.i = K.length), + K.push(B), + "addEventListener" in _ && + _.addEventListener(T(B.e), B.proxy, v(B, F)); + }); + } + function I(_, E, w, b, S) { + var P = d(_); + (E || "").split(/\s/).forEach(function (F) { + f(_, F, w, b).forEach(function (V) { + delete a[P][V.i], + "removeEventListener" in _ && + _.removeEventListener(T(V.e), V.proxy, v(V, S)); + }); + }); + } + (s.event = { add: x, remove: I }), + (s.proxy = function (_, E) { + var w = 2 in arguments && i.call(arguments, 2); + if (n(_)) { + var b = function () { + return _.apply(E, w ? w.concat(i.call(arguments)) : arguments); + }; + return (b._zid = d(_)), b; + } else { + if (r(E)) + return w + ? (w.unshift(_[E], _), s.proxy.apply(null, w)) + : s.proxy(_[E], _); + throw new TypeError("expected function"); + } + }), + (s.fn.bind = function (_, E, w) { + return this.on(_, E, w); + }), + (s.fn.unbind = function (_, E) { + return this.off(_, E); + }), + (s.fn.one = function (_, E, w, b) { + return this.on(_, E, w, b, 1); + }); + var L = function () { + return !0; + }, + M = function () { + return !1; + }, + O = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/, + j = { + preventDefault: "isDefaultPrevented", + stopImmediatePropagation: "isImmediatePropagationStopped", + stopPropagation: "isPropagationStopped", + }; + function U(_, E) { + return ( + (E || !_.isDefaultPrevented) && + (E || (E = _), + s.each(j, function (w, b) { + var S = E[w]; + (_[w] = function () { + return (this[b] = L), S && S.apply(E, arguments); + }), + (_[b] = M); + }), + _.timeStamp || (_.timeStamp = Date.now()), + (E.defaultPrevented !== t + ? E.defaultPrevented + : "returnValue" in E + ? E.returnValue === !1 + : E.getPreventDefault && E.getPreventDefault()) && + (_.isDefaultPrevented = L)), + _ + ); + } + function Y(_) { + var E, + w = { originalEvent: _ }; + for (E in _) !O.test(E) && _[E] !== t && (w[E] = _[E]); + return U(w, _); + } + (s.fn.delegate = function (_, E, w) { + return this.on(E, _, w); + }), + (s.fn.undelegate = function (_, E, w) { + return this.off(E, _, w); + }), + (s.fn.live = function (_, E) { + return s(document.body).delegate(this.selector, _, E), this; + }), + (s.fn.die = function (_, E) { + return s(document.body).undelegate(this.selector, _, E), this; + }), + (s.fn.on = function (_, E, w, b, S) { + var P, + F, + V = this; + return _ && !r(_) + ? (s.each(_, function (K, G) { + V.on(K, E, w, G, S); + }), + V) + : (!r(E) && !n(b) && b !== !1 && ((b = w), (w = E), (E = t)), + (b === t || w === !1) && ((b = w), (w = t)), + b === !1 && (b = M), + V.each(function (K, G) { + S && + (P = function (B) { + return I(G, B.type, b), b.apply(this, arguments); + }), + E && + (F = function (B) { + var q, + X = s(B.target).closest(E, G).get(0); + if (X && X !== G) + return ( + (q = s.extend(Y(B), { + currentTarget: X, + liveFired: G, + })), + (P || b).apply(X, [q].concat(i.call(arguments, 1))) + ); + }), + x(G, _, b, w, E, F || P); + })); + }), + (s.fn.off = function (_, E, w) { + var b = this; + return _ && !r(_) + ? (s.each(_, function (S, P) { + b.off(S, E, P); + }), + b) + : (!r(E) && !n(w) && w !== !1 && ((w = E), (E = t)), + w === !1 && (w = M), + b.each(function () { + I(this, _, w, E); + })); + }), + (s.fn.trigger = function (_, E) { + return ( + (_ = r(_) || s.isPlainObject(_) ? s.Event(_) : U(_)), + (_._args = E), + this.each(function () { + _.type in u && typeof this[_.type] == "function" + ? this[_.type]() + : "dispatchEvent" in this + ? this.dispatchEvent(_) + : s(this).triggerHandler(_, E); + }) + ); + }), + (s.fn.triggerHandler = function (_, E) { + var w, b; + return ( + this.each(function (S, P) { + (w = Y(r(_) ? s.Event(_) : _)), + (w._args = E), + (w.target = P), + s.each(f(P, _.type || _), function (F, V) { + if (((b = V.proxy(w)), w.isImmediatePropagationStopped())) + return !1; + }); + }), + b + ); + }), + "focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error" + .split(" ") + .forEach(function (_) { + s.fn[_] = function (E) { + return 0 in arguments ? this.bind(_, E) : this.trigger(_); + }; + }), + (s.Event = function (_, E) { + r(_) || ((E = _), (_ = E.type)); + var w = document.createEvent(o[_] || "Events"), + b = !0; + if (E) for (var S in E) S == "bubbles" ? (b = !!E[S]) : (w[S] = E[S]); + return w.initEvent(_, b, !0), U(w); + }); + })(xt), + (function () { + try { + getComputedStyle(void 0); + } catch { + var s = getComputedStyle; + window.getComputedStyle = function (t, i) { + try { + return s(t, i); + } catch { + return null; + } + }; + } + })(), + (function (s) { + var e = s.zepto, + t = e.qsa, + i = e.matches; + function n(c) { + return ( + (c = s(c)), !!(c.width() || c.height()) && c.css("display") !== "none" + ); + } + var r = (s.expr[":"] = { + visible: function () { + if (n(this)) return this; + }, + hidden: function () { + if (!n(this)) return this; + }, + selected: function () { + if (this.selected) return this; + }, + checked: function () { + if (this.checked) return this; + }, + parent: function () { + return this.parentNode; + }, + first: function (c) { + if (c === 0) return this; + }, + last: function (c, d) { + if (c === d.length - 1) return this; + }, + eq: function (c, d, f) { + if (c === f) return this; + }, + contains: function (c, d, f) { + if (s(this).text().indexOf(f) > -1) return this; + }, + has: function (c, d, f) { + if (e.qsa(this, f).length) return this; + }, + }), + a = new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"), + o = /^\s*>/, + l = "Zepto" + +new Date(); + function u(c, d) { + c = c.replace(/=#\]/g, '="#"]'); + var f, + g, + p = a.exec(c); + if (p && p[2] in r && ((f = r[p[2]]), (g = p[3]), (c = p[1]), g)) { + var v = Number(g); + isNaN(v) ? (g = g.replace(/^["']|["']$/g, "")) : (g = v); + } + return d(c, f, g); + } + (e.qsa = function (c, d) { + return u(d, function (f, g, p) { + try { + var v; + !f && g + ? (f = "*") + : o.test(f) && ((v = s(c).addClass(l)), (f = "." + l + " " + f)); + var T = t(c, f); + } catch (x) { + throw (console.error("error performing selector: %o", d), x); + } finally { + v && v.removeClass(l); + } + return g + ? e.uniq( + s.map(T, function (x, I) { + return g.call(x, I, T, p); + }) + ) + : T; + }); + }), + (e.matches = function (c, d) { + return u(d, function (f, g, p) { + return (!f || i(c, f)) && (!g || g.call(c, null, p) === c); + }); + }); + })(xt); + var Tl = xt, + te = El(Tl); + Array.prototype.find || + Object.defineProperty(Array.prototype, "find", { + value: function (e) { + if (this == null) throw new TypeError('"this" is null or not defined'); + var t = Object(this), + i = t.length >>> 0; + if (typeof e != "function") + throw new TypeError("predicate must be a function"); + for (var n = arguments[1], r = 0; r < i; ) { + var a = t[r]; + if (e.call(n, a, r, t)) return a; + r++; + } + }, + }), + Object.entries || + (Object.entries = function (s) { + for (var e = Object.keys(s), t = e.length, i = new Array(t); t--; ) + i[t] = [e[t], s[e[t]]]; + return i; + }), + Object.values || + (Object.values = function (s) { + for (var e = Object.keys(s), t = e.length, i = new Array(t); t--; ) + i[t] = s[e[t]]; + return i; + }), + typeof Object.assign != "function" && + Object.defineProperty(Object, "assign", { + value: function (e, t) { + if (e == null) + throw new TypeError("Cannot convert undefined or null to object"); + for (var i = Object(e), n = 1; n < arguments.length; n++) { + var r = arguments[n]; + if (r != null) + for (var a in r) + Object.prototype.hasOwnProperty.call(r, a) && (i[a] = r[a]); + } + return i; + }, + writable: !0, + configurable: !0, + }), + Array.prototype.findIndex || + Object.defineProperty(Array.prototype, "findIndex", { + value: function (e) { + if (this == null) + throw new TypeError('"this" is null or not defined'); + var t = Object(this), + i = t.length >>> 0; + if (typeof e != "function") + throw new TypeError("predicate must be a function"); + for (var n = arguments[1], r = 0; r < i; ) { + var a = t[r]; + if (e.call(n, a, r, t)) return r; + r++; + } + return -1; + }, + configurable: !0, + writable: !0, + }); + var bl = + "data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAC721kYXQhEAUgpBv/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3pwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCEQBSCkG//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADengAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAsJtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAALwABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAB7HRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAIAAAAAAAAALwAAAAAAAAAAAAAAAQEAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAAC8AAAAAAAEAAAAAAWRtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAAKxEAAAIAFXEAAAAAAAtaGRscgAAAAAAAAAAc291bgAAAAAAAAAAAAAAAFNvdW5kSGFuZGxlcgAAAAEPbWluZgAAABBzbWhkAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAADTc3RibAAAAGdzdHNkAAAAAAAAAAEAAABXbXA0YQAAAAAAAAABAAAAAAAAAAAAAgAQAAAAAKxEAAAAAAAzZXNkcwAAAAADgICAIgACAASAgIAUQBUAAAAAAfQAAAHz+QWAgIACEhAGgICAAQIAAAAYc3R0cwAAAAAAAAABAAAAAgAABAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAIAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAFzAAABdAAAABRzdGNvAAAAAAAAAAEAAAAsAAAAYnVkdGEAAABabWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAtaWxzdAAAACWpdG9vAAAAHWRhdGEAAAABAAAAAExhdmY1Ni40MC4xMDE=", + Qr = { mp4: bl }, + _l = [ + { name: "Chromium", group: "Chrome", identifier: "Chromium/([0-9.]*)" }, + { + name: "Chrome Mobile", + group: "Chrome", + identifier: "Chrome/([0-9.]*) Mobile", + versionIdentifier: "Chrome/([0-9.]*)", + }, + { name: "Chrome", group: "Chrome", identifier: "Chrome/([0-9.]*)" }, + { + name: "Chrome for iOS", + group: "Chrome", + identifier: "CriOS/([0-9.]*)", + }, + { + name: "Android Browser", + group: "Chrome", + identifier: "CrMo/([0-9.]*)", + }, + { name: "Firefox", group: "Firefox", identifier: "Firefox/([0-9.]*)" }, + { + name: "Opera Mini", + group: "Opera", + identifier: "Opera Mini/([0-9.]*)", + }, + { name: "Opera", group: "Opera", identifier: "Opera ([0-9.]*)" }, + { + name: "Opera", + group: "Opera", + identifier: "Opera/([0-9.]*)", + versionIdentifier: "Version/([0-9.]*)", + }, + { name: "IEMobile", group: "Explorer", identifier: "IEMobile/([0-9.]*)" }, + { + name: "Internet Explorer", + group: "Explorer", + identifier: "MSIE ([a-zA-Z0-9.]*)", + }, + { + name: "Internet Explorer", + group: "Explorer", + identifier: "Trident/([0-9.]*)", + versionIdentifier: "rv:([0-9.]*)", + }, + { + name: "Spartan", + group: "Spartan", + identifier: "Edge/([0-9.]*)", + versionIdentifier: "Edge/([0-9.]*)", + }, + { + name: "Safari", + group: "Safari", + identifier: "Safari/([0-9.]*)", + versionIdentifier: "Version/([0-9.]*)", + }, + ], + kl = [ + { + name: "Windows 2000", + group: "Windows", + identifier: "Windows NT 5.0", + version: "5.0", + }, + { + name: "Windows XP", + group: "Windows", + identifier: "Windows NT 5.1", + version: "5.1", + }, + { + name: "Windows Vista", + group: "Windows", + identifier: "Windows NT 6.0", + version: "6.0", + }, + { + name: "Windows 7", + group: "Windows", + identifier: "Windows NT 6.1", + version: "7.0", + }, + { + name: "Windows 8", + group: "Windows", + identifier: "Windows NT 6.2", + version: "8.0", + }, + { + name: "Windows 8.1", + group: "Windows", + identifier: "Windows NT 6.3", + version: "8.1", + }, + { + name: "Windows 10", + group: "Windows", + identifier: "Windows NT 10.0", + version: "10.0", + }, + { + name: "Windows Phone", + group: "Windows Phone", + identifier: "Windows Phone ([0-9.]*)", + }, + { + name: "Windows Phone", + group: "Windows Phone", + identifier: "Windows Phone OS ([0-9.]*)", + }, + { name: "Windows", group: "Windows", identifier: "Windows" }, + { name: "Chrome OS", group: "Chrome OS", identifier: "CrOS" }, + { + name: "Android", + group: "Android", + identifier: "Android", + versionIdentifier: "Android ([a-zA-Z0-9.-]*)", + }, + { + name: "iPad", + group: "iOS", + identifier: "iPad", + versionIdentifier: "OS ([0-9_]*)", + versionSeparator: "[_|.]", + }, + { + name: "iPod", + group: "iOS", + identifier: "iPod", + versionIdentifier: "OS ([0-9_]*)", + versionSeparator: "[_|.]", + }, + { + name: "iPhone", + group: "iOS", + identifier: "iPhone OS", + versionIdentifier: "OS ([0-9_]*)", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X High Sierra", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])13([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Sierra", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])12([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X El Capitan", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])11([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Yosemite", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])10([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Mavericks", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])9([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Mountain Lion", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])8([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Lion", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])7([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Snow Leopard", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])6([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Leopard", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])5([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Tiger", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])4([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Panther", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])3([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Jaguar", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])2([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Puma", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])1([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Cheetah", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])0([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { name: "Mac OS", group: "Mac OS", identifier: "Mac OS" }, + { + name: "Ubuntu", + group: "Linux", + identifier: "Ubuntu", + versionIdentifier: "Ubuntu/([0-9.]*)", + }, + { name: "Debian", group: "Linux", identifier: "Debian" }, + { name: "Gentoo", group: "Linux", identifier: "Gentoo" }, + { name: "Linux", group: "Linux", identifier: "Linux" }, + { name: "BlackBerry", group: "BlackBerry", identifier: "BlackBerry" }, + ], + ee = {}, + Sl = function () { + try { + return ( + localStorage.setItem("clappr", "clappr"), + localStorage.removeItem("clappr"), + !0 + ); + } catch { + return !1; + } + }, + Cl = function () { + try { + var e = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + return !!e; + } catch { + return !!( + navigator.mimeTypes && + navigator.mimeTypes["application/x-shockwave-flash"] !== void 0 && + navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin + ); + } + }, + xl = function (e) { + var t = + e.match( + /\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i + ) || [], + i; + if (/trident/i.test(t[1])) + return ( + (i = /\brv[ :]+(\d+)/g.exec(e) || []), + { name: "IE", version: parseInt(i[1] || "") } + ); + if (t[1] === "Chrome") { + if (((i = e.match(/\bOPR\/(\d+)/)), i != null)) + return { name: "Opera", version: parseInt(i[1]) }; + if (((i = e.match(/\bEdge\/(\d+)/)), i != null)) + return { name: "Edge", version: parseInt(i[1]) }; + } else + /android/i.test(e) && + (i = e.match(/version\/(\d+)/i)) && + (t.splice(1, 1, "Android WebView"), t.splice(2, 1, i[1])); + return ( + (t = t[2] + ? [t[1], t[2]] + : [navigator.appName, navigator.appVersion, "-?"]), + { name: t[0], version: parseInt(t[1]) } + ); + }, + Ll = function () { + var e = {}, + t = ee.userAgent.toLowerCase(), + i = Zr(_l), + n; + try { + for (i.s(); !(n = i.n()).done; ) { + var r = n.value, + a = new RegExp(r.identifier.toLowerCase()), + o = a.exec(t); + if (o != null && o[1]) { + if (((e.name = r.name), (e.group = r.group), r.versionIdentifier)) { + var l = new RegExp(r.versionIdentifier.toLowerCase()), + u = l.exec(t); + u != null && u[1] && Jr(u[1], e); + } else Jr(o[1], e); + break; + } + } + } catch (c) { + i.e(c); + } finally { + i.f(); + } + return e; + }, + Jr = function (e, t) { + var i = e.split(".", 2); + (t.fullVersion = e), + i[0] && (t.majorVersion = parseInt(i[0])), + i[1] && (t.minorVersion = parseInt(i[1])); + }, + Il = function () { + var e = {}, + t = ee.userAgent.toLowerCase(), + i = Zr(kl), + n; + try { + for (i.s(); !(n = i.n()).done; ) { + var r = n.value, + a = new RegExp(r.identifier.toLowerCase()), + o = a.exec(t); + if (o != null) { + if (((e.name = r.name), (e.group = r.group), r.version)) + En(r.version, r.versionSeparator ? r.versionSeparator : ".", e); + else if (o[1]) + En(o[1], r.versionSeparator ? r.versionSeparator : ".", e); + else if (r.versionIdentifier) { + var l = new RegExp(r.versionIdentifier.toLowerCase()), + u = l.exec(t); + u != null && + u[1] && + En(u[1], r.versionSeparator ? r.versionSeparator : ".", e); + } + break; + } + } + } catch (c) { + i.e(c); + } finally { + i.f(); + } + return e; + }, + En = function (e, t, i) { + var n = t.substr(0, 1) == "[" ? new RegExp(t, "g") : t, + r = e.split(n, 2); + t != "." && (e = e.replace(new RegExp(t, "g"), ".")), + (i.fullVersion = e), + r && r[0] && (i.majorVersion = parseInt(r[0])), + r && r[1] && (i.minorVersion = parseInt(r[1])); + }, + Rl = function () { + var e = {}; + return ( + (e.width = te(window).width()), (e.height = te(window).height()), e + ); + }, + Pl = function () { + switch (window.orientation) { + case -90: + case 90: + ee.viewport.orientation = "landscape"; + break; + default: + ee.viewport.orientation = "portrait"; + break; + } + }, + wl = function (e) { + var t = /\((iP(?:hone|ad|od))?(?:[^;]*; ){0,2}([^)]+(?=\)))/, + i = t.exec(e), + n = (i && (i[1] || i[2])) || ""; + return n; + }, + es = xl(navigator.userAgent); + (ee.isEdge = /Edg|EdgiOS|EdgA/i.test(navigator.userAgent)), + (ee.isChrome = /Chrome|CriOS/i.test(navigator.userAgent) && !ee.isEdge), + (ee.isSafari = + /Safari/i.test(navigator.userAgent) && !ee.isChrome && !ee.isEdge), + (ee.isFirefox = /Firefox/i.test(navigator.userAgent)), + (ee.isLegacyIE = !!window.ActiveXObject), + (ee.isIE = ee.isLegacyIE || /trident.*rv:1\d/i.test(navigator.userAgent)), + (ee.isIE11 = /trident.*rv:11/i.test(navigator.userAgent)), + (ee.isChromecast = ee.isChrome && /CrKey/i.test(navigator.userAgent)), + (ee.isMobile = + /Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Mobile Safari|Opera Mini/i.test( + navigator.userAgent + )), + (ee.isiOS = /iPad|iPhone|iPod/i.test(navigator.userAgent)), + (ee.isAndroid = /Android/i.test(navigator.userAgent)), + (ee.isWindowsPhone = /Windows Phone/i.test(navigator.userAgent)), + (ee.isWin8App = /MSAppHost/i.test(navigator.userAgent)), + (ee.isWiiU = /WiiU/i.test(navigator.userAgent)), + (ee.isPS4 = /PlayStation 4/i.test(navigator.userAgent)), + (ee.hasLocalstorage = Sl()), + (ee.hasFlash = Cl()), + (ee.name = es.name), + (ee.version = es.version), + (ee.userAgent = navigator.userAgent), + (ee.data = Ll()), + (ee.os = Il()), + (ee.isWindows = /^Windows$/i.test(ee.os.group)), + (ee.isMacOS = /^Mac OS$/i.test(ee.os.group)), + (ee.isLinux = /^Linux$/i.test(ee.os.group)), + (ee.viewport = Rl()), + (ee.device = wl(ee.userAgent)), + typeof window.orientation < "u" && Pl(); + var Tn = {}, + bn = [], + ts = ( + window.requestAnimationFrame || + window.mozRequestAnimationFrame || + window.webkitRequestAnimationFrame || + function (s) { + window.setTimeout(s, 1e3 / 60); + } + ).bind(window), + is = ( + window.cancelAnimationFrame || + window.mozCancelAnimationFrame || + window.webkitCancelAnimationFrame || + window.clearTimeout + ).bind(window); + function ns(s, e) { + if (e) + for (var t in e) { + var i = Object.getOwnPropertyDescriptor(e, t); + i ? Object.defineProperty(s, t, i) : (s[t] = e[t]); + } + return s; + } + function Jt(s, e) { + var t = (function (i) { + function n() { + var r; + ve(this, n); + for (var a = arguments.length, o = new Array(a), l = 0; l < a; l++) + o[l] = arguments[l]; + return ( + (r = xe(this, n, [].concat(o))), + e.initialize && e.initialize.apply(r, o), + r + ); + } + return we(n, i), Ee(n); + })(s); + return ns(t.prototype, e), t; + } + function Dl(s, e) { + if (!isFinite(s)) return "--:--"; + (s = s * 1e3), (s = parseInt(s / 1e3)); + var t = s % 60; + s = parseInt(s / 60); + var i = s % 60; + s = parseInt(s / 60); + var n = s % 24, + r = parseInt(s / 24), + a = ""; + return ( + r && r > 0 && ((a += r + ":"), n < 1 && (a += "00:")), + ((n && n > 0) || e) && (a += ("0" + n).slice(-2) + ":"), + (a += ("0" + i).slice(-2) + ":"), + (a += ("0" + t).slice(-2)), + a.trim() + ); + } + var yi = { + fullscreenElement: function () { + return ( + document.fullscreenElement || + document.webkitFullscreenElement || + document.mozFullScreenElement || + document.msFullscreenElement + ); + }, + requestFullscreen: function (e) { + if (e.requestFullscreen) return e.requestFullscreen(); + if (e.webkitRequestFullscreen) { + if (typeof e.then == "function") return e.webkitRequestFullscreen(); + e.webkitRequestFullscreen(); + } else { + if (e.mozRequestFullScreen) return e.mozRequestFullScreen(); + if (e.msRequestFullscreen) return e.msRequestFullscreen(); + e.querySelector && + e.querySelector("video") && + e.querySelector("video").webkitEnterFullScreen + ? e.querySelector("video").webkitEnterFullScreen() + : e.webkitEnterFullScreen && e.webkitEnterFullScreen(); + } + }, + cancelFullscreen: function () { + var e = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : document; + e.exitFullscreen + ? e.exitFullscreen() + : e.webkitCancelFullScreen + ? e.webkitCancelFullScreen() + : e.webkitExitFullscreen + ? e.webkitExitFullscreen() + : e.mozCancelFullScreen + ? e.mozCancelFullScreen() + : e.msExitFullscreen && e.msExitFullscreen(); + }, + fullscreenEnabled: function () { + return !!( + document.fullscreenEnabled || + document.webkitFullscreenEnabled || + document.mozFullScreenEnabled || + document.msFullscreenEnabled + ); + }, + }, + Ol = (function () { + function s() { + ve(this, s); + } + return Ee(s, null, [ + { + key: "_defaultConfig", + value: function () { + return { volume: { value: 100, parse: parseInt } }; + }, + }, + { + key: "_defaultValueFor", + value: function (t) { + try { + return this._defaultConfig()[t].parse( + this._defaultConfig()[t].value + ); + } catch { + return; + } + }, + }, + { + key: "_createKeyspace", + value: function (t) { + return "clappr.".concat(document.domain, ".").concat(t); + }, + }, + { + key: "restore", + value: function (t) { + return ee.hasLocalstorage && localStorage[this._createKeyspace(t)] + ? this._defaultConfig()[t].parse( + localStorage[this._createKeyspace(t)] + ) + : this._defaultValueFor(t); + }, + }, + { + key: "persist", + value: function (t, i) { + if (ee.hasLocalstorage) + try { + return (localStorage[this._createKeyspace(t)] = i), !0; + } catch { + return !1; + } + }, + }, + ]); + })(), + _n = (function () { + function s() { + ve(this, s); + } + return Ee(s, null, [ + { + key: "params", + get: function () { + var t = window.location.search.substring(1); + return ( + t !== this.query && + ((this._urlParams = this.parse(t)), (this.query = t)), + this._urlParams + ); + }, + }, + { + key: "hashParams", + get: function () { + var t = window.location.hash.substring(1); + return ( + t !== this.hash && + ((this._hashParams = this.parse(t)), (this.hash = t)), + this._hashParams + ); + }, + }, + { + key: "parse", + value: function (t) { + for ( + var i, + n = /\+/g, + r = /([^&=]+)=?([^&]*)/g, + a = function (u) { + return decodeURIComponent(u.replace(n, " ")); + }, + o = {}; + (i = r.exec(t)); + + ) + o[a(i[1]).toLowerCase()] = a(i[2]); + return o; + }, + }, + ]); + })(); + function rs() { + var s = + arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "t", + e = 0, + t = _n.params[s] || _n.hashParams[s] || "", + i = t.match(/[0-9]+[hms]+/g) || []; + if (i.length > 0) { + var n = { h: 3600, m: 60, s: 1 }; + i.forEach(function (r) { + if (r) { + var a = r[r.length - 1], + o = parseInt(r.slice(0, r.length - 1), 10); + e += o * n[a]; + } + }); + } else t && (e = parseInt(t, 10)); + return e; + } + function ei(s) { + Tn[s] || (Tn[s] = 0); + var e = ++Tn[s]; + return s + e; + } + function Mi(s) { + return s - parseFloat(s) + 1 >= 0; + } + function ss() { + var s = document.getElementsByTagName("script"); + return s.length ? s[s.length - 1].src : ""; + } + function as() { + return window.navigator && window.navigator.language; + } + function Nl() { + return window.performance && window.performance.now + ? performance.now() + : Date.now(); + } + function Fl(s, e) { + var t = s.indexOf(e); + t >= 0 && s.splice(t, 1); + } + function Ml(s, e) { + return s === void 0 || e === void 0 + ? !1 + : e.find(function (t) { + return s.toLowerCase() === t.toLowerCase(); + }) !== void 0; + } + function os(s, e) { + e = Object.assign( + { + inline: !1, + muted: !1, + timeout: 250, + type: "video", + source: Qr.mp4, + element: null, + }, + e + ); + var t = e.element ? e.element : document.createElement(e.type); + (t.muted = e.muted), + e.muted === !0 && t.setAttribute("muted", "muted"), + e.inline === !0 && t.setAttribute("playsinline", "playsinline"), + (t.src = e.source); + var i = t.play(), + n = setTimeout(function () { + r(!1, new Error("Timeout ".concat(e.timeout, " ms has been reached"))); + }, e.timeout), + r = function (o) { + var l = + arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; + clearTimeout(n), s(o, l); + }; + i !== void 0 + ? i + .then(function () { + return r(!0); + }) + .catch(function (a) { + return r(!1, a); + }) + : r(!0); + } + var ti = (function () { + function s() { + ve(this, s); + } + return Ee(s, null, [ + { + key: "configure", + value: function (t) { + this.options = te.extend(!0, this.options, t); + }, + }, + { + key: "create", + value: function (t) { + return this.options.recycleVideo && t === "video" && bn.length > 0 + ? bn.shift() + : document.createElement(t); + }, + }, + { + key: "garbage", + value: function (t) { + !this.options.recycleVideo || + t.tagName.toUpperCase() !== "VIDEO" || + (te(t).children().remove(), + Object.values(t.attributes).forEach(function (i) { + return t.removeAttribute(i.name); + }), + bn.push(t)); + }, + }, + ]); + })(); + ti.options = { recycleVideo: !1 }; + var ls = (function () { + function s() { + var e = + arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 500; + ve(this, s), (this.delay = e), (this.lastTime = 0); + } + return Ee(s, [ + { + key: "handle", + value: function (t, i) { + var n = + arguments.length > 2 && arguments[2] !== void 0 + ? arguments[2] + : !0, + r = new Date().getTime(), + a = r - this.lastTime; + a < this.delay && a > 0 && (i(), n && t.preventDefault()), + (this.lastTime = r); + }, + }, + ]); + })(), + Ut = { + Config: Ol, + Fullscreen: yi, + QueryString: _n, + DomRecycler: ti, + assign: ns, + extend: Jt, + formatTime: Dl, + seekStringToSeconds: rs, + uniqueId: ei, + currentScriptUrl: ss, + isNumber: Mi, + requestAnimationFrame: ts, + cancelAnimationFrame: is, + getBrowserLanguage: as, + now: Nl, + removeArrayItem: Fl, + listContainsIgnoreCase: Ml, + canAutoPlayMedia: os, + Media: Qr, + DoubleEventHandler: ls, + }, + Bi = "font-weight: bold; font-size: 13px;", + Bl = "color: #006600;" + Bi, + Ul = "color: #0000ff;" + Bi, + us = "color: #ff8000;" + Bi, + cs = "color: #ff0000;" + Bi, + hs = 0, + kn = 1, + ds = 2, + Sn = 3, + $l = Sn, + Vl = [Ul, Bl, us, cs, cs], + fs = ["debug", "info", "warn", "error", "disabled"], + fe = (function () { + function s() { + var e = + arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : kn, + t = + arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : $l; + ve(this, s), + (this.EXCLUDE_LIST = [ + "timeupdate", + "playback:timeupdate", + "playback:progress", + "container:hover", + "container:timeupdate", + "container:progress", + "core:mousemove", + ]), + (this.level = e), + (this.previousLevel = this.level), + (this.offLevel = t); + } + return Ee(s, [ + { + key: "level", + get: function () { + return this._level; + }, + set: function (t) { + this._level = t; + }, + }, + { + key: "debug", + value: function (t) { + this.log(t, hs, Array.prototype.slice.call(arguments, 1)); + }, + }, + { + key: "info", + value: function (t) { + this.log(t, kn, Array.prototype.slice.call(arguments, 1)); + }, + }, + { + key: "warn", + value: function (t) { + this.log(t, ds, Array.prototype.slice.call(arguments, 1)); + }, + }, + { + key: "error", + value: function (t) { + this.log(t, Sn, Array.prototype.slice.call(arguments, 1)); + }, + }, + { + key: "onOff", + value: function () { + this.level === this.offLevel + ? (this.level = this.previousLevel) + : ((this.previousLevel = this.level), + (this.level = this.offLevel)), + window.console && + window.console.log && + window.console.log( + "%c[Clappr.Log] set log level to " + fs[this.level], + us + ); + }, + }, + { + key: "log", + value: function (t, i, n) { + if (!(i < this.level) && !(this.EXCLUDE_LIST.indexOf(n[0]) >= 0)) { + n || ((n = t), (t = null)); + var r = Vl[i], + a = ""; + t && (a = "[" + t + "]"), + window.console && + window.console.log && + window.console.log.apply( + console, + ["%c[" + fs[i] + "]" + a, r].concat(n) + ); + } + }, + }, + ]); + })(); + (fe.LEVEL_DEBUG = hs), + (fe.LEVEL_INFO = kn), + (fe.LEVEL_WARN = ds), + (fe.LEVEL_ERROR = Sn), + (fe.getInstance = function () { + return ( + this._instance === void 0 && (this._instance = new this()), + this._instance + ); + }), + (fe.setLevel = function (s) { + this.getInstance().level = s; + }), + (fe.debug = function () { + this.getInstance().debug.apply(this.getInstance(), arguments); + }), + (fe.info = function () { + this.getInstance().info.apply(this.getInstance(), arguments); + }), + (fe.warn = function () { + this.getInstance().warn.apply(this.getInstance(), arguments); + }), + (fe.error = function () { + this.getInstance().error.apply(this.getInstance(), arguments); + }); + var Gl = Array.prototype.slice, + gs = /\s+/, + Ui = function (e, t, i, n) { + if (!i) return !0; + if (Mt(i) === "object") { + for (var r in i) e[t].apply(e, [r, i[r]].concat(n)); + return !1; + } + if (gs.test(i)) { + for (var a = i.split(gs), o = 0, l = a.length; o < l; o++) + e[t].apply(e, [a[o]].concat(n)); + return !1; + } + return !0; + }, + ps = function (e, t, i, n) { + var r, + a = -1, + o = e.length, + l = t[0], + u = t[1], + c = t[2]; + d(); + function d() { + try { + switch (t.length) { + case 0: + for (; ++a < o; ) (r = e[a]).callback.call(r.ctx); + return; + case 1: + for (; ++a < o; ) (r = e[a]).callback.call(r.ctx, l); + return; + case 2: + for (; ++a < o; ) (r = e[a]).callback.call(r.ctx, l, u); + return; + case 3: + for (; ++a < o; ) (r = e[a]).callback.call(r.ctx, l, u, c); + return; + default: + for (; ++a < o; ) (r = e[a]).callback.apply(r.ctx, t); + return; + } + } catch (f) { + fe.error.apply(fe, [i, "error on event", n, "trigger", "-", f]), d(); + } + } + }, + A = (function () { + function s() { + ve(this, s); + } + return Ee( + s, + [ + { + key: "on", + value: function (t, i, n) { + if (!Ui(this, "on", t, [i, n]) || !i) return this; + this._events || (this._events = {}); + var r = this._events[t] || (this._events[t] = []); + return r.push({ callback: i, context: n, ctx: n || this }), this; + }, + }, + { + key: "once", + value: function (t, i, n) { + var r = this, + a; + if (!Ui(this, "once", t, [i, n]) || !i) return this; + var o = function () { + return r.off(t, a); + }; + return ( + (a = function () { + o(), i.apply(this, arguments); + }), + (a._callback = i), + this.on(t, a, n) + ); + }, + }, + { + key: "off", + value: function (t, i, n) { + var r, a, o, l, u, c, d, f; + if (!this._events || !Ui(this, "off", t, [i, n])) return this; + if (!t && !i && !n) return (this._events = void 0), this; + for ( + l = t ? [t] : Object.keys(this._events), u = 0, c = l.length; + u < c; + u++ + ) + if (((t = l[u]), (o = this._events[t]), o)) { + if (((this._events[t] = r = []), i || n)) + for (d = 0, f = o.length; d < f; d++) + (a = o[d]), + ((i && + i !== a.callback && + i !== a.callback._callback) || + (n && n !== a.context)) && + r.push(a); + r.length || delete this._events[t]; + } + return this; + }, + }, + { + key: "trigger", + value: function (t) { + var i = this.name || this.constructor.name; + if ( + (fe.debug.apply( + fe, + [i].concat(Array.prototype.slice.call(arguments)) + ), + !this._events) + ) + return this; + var n = Gl.call(arguments, 1); + if (!Ui(this, "trigger", t, n)) return this; + var r = this._events[t], + a = this._events.all; + return r && ps(r, n, i, t), a && ps(a, arguments, i, t), this; + }, + }, + { + key: "stopListening", + value: function (t, i, n) { + var r = this._listeningTo; + if (!r) return this; + var a = !i && !n; + !n && Mt(i) === "object" && (n = this), + t && ((r = {})[t._listenId] = t); + for (var o in r) + (t = r[o]), + t.off(i, n, this), + (a || Object.keys(t._events).length === 0) && + delete this._listeningTo[o]; + return this; + }, + }, + ], + [ + { + key: "register", + value: function (t) { + s.Custom || (s.Custom = {}); + var i = typeof t == "string" && t.toUpperCase().trim(); + i && !s.Custom[i] + ? (s.Custom[i] = i + .toLowerCase() + .split("_") + .map(function (n, r) { + return r === 0 + ? n + : (n = n[0].toUpperCase() + n.slice(1)); + }) + .join("")) + : fe.error("Events", "Error when register event: " + t); + }, + }, + { + key: "listAvailableCustomEvents", + value: function () { + return ( + s.Custom || (s.Custom = {}), + Object.keys(s.Custom).filter(function (t) { + return typeof s.Custom[t] == "string"; + }) + ); + }, + }, + ] + ); + })(); + (A.prototype.listenTo = function (s, e, t) { + var i = this._listeningTo || (this._listeningTo = {}), + n = s._listenId || (s._listenId = ei("l")); + return ( + (i[n] = s), !t && Mt(e) === "object" && (t = this), s.on(e, t, this), this + ); + }), + (A.prototype.listenToOnce = function (s, e, t) { + var i = this._listeningTo || (this._listeningTo = {}), + n = s._listenId || (s._listenId = ei("l")); + return ( + (i[n] = s), + !t && Mt(e) === "object" && (t = this), + s.once(e, t, this), + this + ); + }), + (A.PLAYER_READY = "ready"), + (A.PLAYER_RESIZE = "resize"), + (A.PLAYER_FULLSCREEN = "fullscreen"), + (A.PLAYER_PLAY = "play"), + (A.PLAYER_PAUSE = "pause"), + (A.PLAYER_STOP = "stop"), + (A.PLAYER_ENDED = "ended"), + (A.PLAYER_SEEK = "seek"), + (A.PLAYER_ERROR = "playererror"), + (A.ERROR = "error"), + (A.PLAYER_TIMEUPDATE = "timeupdate"), + (A.PLAYER_VOLUMEUPDATE = "volumeupdate"), + (A.PLAYER_SUBTITLE_AVAILABLE = "subtitleavailable"), + (A.PLAYBACK_PIP_ENTER = "playback:picture-in-picture:enter"), + (A.PLAYBACK_PIP_EXIT = "playback:picture-in-picture:exit"), + (A.PLAYBACK_PROGRESS = "playback:progress"), + (A.PLAYBACK_TIMEUPDATE = "playback:timeupdate"), + (A.PLAYBACK_READY = "playback:ready"), + (A.PLAYBACK_BUFFERING = "playback:buffering"), + (A.PLAYBACK_BUFFERFULL = "playback:bufferfull"), + (A.PLAYBACK_SETTINGSUPDATE = "playback:settingsupdate"), + (A.PLAYBACK_LOADEDMETADATA = "playback:loadedmetadata"), + (A.PLAYBACK_HIGHDEFINITIONUPDATE = "playback:highdefinitionupdate"), + (A.PLAYBACK_BITRATE = "playback:bitrate"), + (A.PLAYBACK_LEVELS_AVAILABLE = "playback:levels:available"), + (A.PLAYBACK_LEVEL_SWITCH_START = "playback:levels:switch:start"), + (A.PLAYBACK_LEVEL_SWITCH_END = "playback:levels:switch:end"), + (A.PLAYBACK_PLAYBACKSTATE = "playback:playbackstate"), + (A.PLAYBACK_DVR = "playback:dvr"), + (A.PLAYBACK_MEDIACONTROL_DISABLE = "playback:mediacontrol:disable"), + (A.PLAYBACK_MEDIACONTROL_ENABLE = "playback:mediacontrol:enable"), + (A.PLAYBACK_ENDED = "playback:ended"), + (A.PLAYBACK_PLAY_INTENT = "playback:play:intent"), + (A.PLAYBACK_PLAY = "playback:play"), + (A.PLAYBACK_PAUSE = "playback:pause"), + (A.PLAYBACK_SEEK = "playback:seek"), + (A.PLAYBACK_SEEKED = "playback:seeked"), + (A.PLAYBACK_STOP = "playback:stop"), + (A.PLAYBACK_ERROR = "playback:error"), + (A.PLAYBACK_STATS_ADD = "playback:stats:add"), + (A.PLAYBACK_FRAGMENT_LOADED = "playback:fragment:loaded"), + (A.PLAYBACK_FRAGMENT_BUFFERED = "playback:fragment:buffered"), + (A.PLAYBACK_LEVEL_SWITCH = "playback:level:switch"), + (A.PLAYBACK_SUBTITLE_AVAILABLE = "playback:subtitle:available"), + (A.PLAYBACK_SUBTITLE_CHANGED = "playback:subtitle:changed"), + (A.PLAYBACK_AUDIO_AVAILABLE = "playback:audio:available"), + (A.PLAYBACK_AUDIO_CHANGED = "playback:audio:changed"), + (A.PLAYBACK_RESIZE = "playback:resize"), + (A.CORE_CONTAINERS_CREATED = "core:containers:created"), + (A.CORE_ACTIVE_CONTAINER_CHANGED = "core:active:container:changed"), + (A.CORE_OPTIONS_CHANGE = "core:options:change"), + (A.CORE_READY = "core:ready"), + (A.CORE_FULLSCREEN = "core:fullscreen"), + (A.CORE_RESIZE = "core:resize"), + (A.CORE_SCREEN_ORIENTATION_CHANGED = "core:screen:orientation:changed"), + (A.CORE_MOUSE_MOVE = "core:mousemove"), + (A.CORE_MOUSE_LEAVE = "core:mouseleave"), + (A.CONTAINER_PLAYBACKSTATE = "container:playbackstate"), + (A.CONTAINER_PLAYBACKDVRSTATECHANGED = "container:dvr"), + (A.CONTAINER_BITRATE = "container:bitrate"), + (A.CONTAINER_STATS_REPORT = "container:stats:report"), + (A.CONTAINER_DESTROYED = "container:destroyed"), + (A.CONTAINER_READY = "container:ready"), + (A.CONTAINER_RESIZE = "container:resize"), + (A.CONTAINER_ERROR = "container:error"), + (A.CONTAINER_LOADEDMETADATA = "container:loadedmetadata"), + (A.CONTAINER_SUBTITLE_AVAILABLE = "container:subtitle:available"), + (A.CONTAINER_SUBTITLE_CHANGED = "container:subtitle:changed"), + (A.CONTAINER_AUDIO_AVAILABLE = "container:audio:available"), + (A.CONTAINER_AUDIO_CHANGED = "container:audio:changed"), + (A.CONTAINER_TIMEUPDATE = "container:timeupdate"), + (A.CONTAINER_PROGRESS = "container:progress"), + (A.CONTAINER_PLAY = "container:play"), + (A.CONTAINER_STOP = "container:stop"), + (A.CONTAINER_PAUSE = "container:pause"), + (A.CONTAINER_ENDED = "container:ended"), + (A.CONTAINER_CLICK = "container:click"), + (A.CONTAINER_DBLCLICK = "container:dblclick"), + (A.CONTAINER_CONTEXTMENU = "container:contextmenu"), + (A.CONTAINER_MOUSE_ENTER = "container:mouseenter"), + (A.CONTAINER_MOUSE_LEAVE = "container:mouseleave"), + (A.CONTAINER_MOUSE_UP = "container:mouseup"), + (A.CONTAINER_MOUSE_DOWN = "container:mousedown"), + (A.CONTAINER_PIP_ENTER = "container:picture-in-picture:enter"), + (A.CONTAINER_PIP_EXIT = "container:picture-in-picture:exit"), + (A.CONTAINER_SEEK = "container:seek"), + (A.CONTAINER_SEEKED = "container:seeked"), + (A.CONTAINER_VOLUME = "container:volume"), + (A.CONTAINER_FULLSCREEN = "container:fullscreen"), + (A.CONTAINER_STATE_BUFFERING = "container:state:buffering"), + (A.CONTAINER_STATE_BUFFERFULL = "container:state:bufferfull"), + (A.CONTAINER_SETTINGSUPDATE = "container:settingsupdate"), + (A.CONTAINER_HIGHDEFINITIONUPDATE = "container:highdefinitionupdate"), + (A.CONTAINER_MEDIACONTROL_SHOW = "container:mediacontrol:show"), + (A.CONTAINER_MEDIACONTROL_HIDE = "container:mediacontrol:hide"), + (A.CONTAINER_MEDIACONTROL_DISABLE = "container:mediacontrol:disable"), + (A.CONTAINER_MEDIACONTROL_ENABLE = "container:mediacontrol:enable"), + (A.CONTAINER_STATS_ADD = "container:stats:add"), + (A.CONTAINER_OPTIONS_CHANGE = "container:options:change"), + (A.MEDIACONTROL_RENDERED = "mediacontrol:rendered"), + (A.MEDIACONTROL_FULLSCREEN = "mediacontrol:fullscreen"), + (A.MEDIACONTROL_SHOW = "mediacontrol:show"), + (A.MEDIACONTROL_HIDE = "mediacontrol:hide"), + (A.MEDIACONTROL_MOUSEMOVE_SEEKBAR = "mediacontrol:mousemove:seekbar"), + (A.MEDIACONTROL_MOUSELEAVE_SEEKBAR = "mediacontrol:mouseleave:seekbar"), + (A.MEDIACONTROL_PLAYING = "mediacontrol:playing"), + (A.MEDIACONTROL_NOTPLAYING = "mediacontrol:notplaying"), + (A.MEDIACONTROL_CONTAINERCHANGED = "mediacontrol:containerchanged"), + (A.MEDIACONTROL_OPTIONS_CHANGE = "mediacontrol:options:change"); + var At = (function (s) { + function e() { + var t, + i = + arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + return ( + ve(this, e), + (t = xe(this, e, [i])), + (t._options = i), + (t.uniqueId = ei("o")), + t + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "options", + get: function () { + return this._options; + }, + }, + ]) + ); + })(A), + $t = { + evaluate: /<%([\s\S]+?)%>/g, + interpolate: /<%=([\s\S]+?)%>/g, + escape: /<%-([\s\S]+?)%>/g, + }, + Cn = /(.)^/, + Kl = { + "'": "'", + "\\": "\\", + "\r": "r", + "\n": "n", + " ": "t", + "\u2028": "u2028", + "\u2029": "u2029", + }, + Hl = /\\|'|\r|\n|\t|\u2028|\u2029/g, + Yl = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + }, + zl = new RegExp(`[&<>"']`, "g"), + ms = function (e) { + return e === null + ? "" + : ("" + e).replace(zl, function (t) { + return Yl[t]; + }); + }, + Wl = 0, + He = function (e, t) { + var i, + n = new RegExp( + [ + ($t.escape || Cn).source, + ($t.interpolate || Cn).source, + ($t.evaluate || Cn).source, + ].join("|") + "|$", + "g" + ), + r = 0, + a = "__p+='"; + e.replace(n, function (l, u, c, d, f) { + return ( + (a += e.slice(r, f).replace(Hl, function (g) { + return "\\" + Kl[g]; + })), + u && + (a += + `'+ +((__t=(` + + u + + `))==null?'':escapeExpr(__t))+ +'`), + c && + (a += + `'+ +((__t=(` + + c + + `))==null?'':__t)+ +'`), + d && + (a += + `'; +` + + d + + ` +__p+='`), + (r = f + l.length), + l + ); + }), + (a += `'; +`), + $t.variable || + (a = + `with(obj||{}){ +` + + a + + `} +`), + (a = + `var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');}; +` + + a + + `return __p; +//# sourceURL=/microtemplates/source[` + + Wl++ + + "]"); + try { + i = new Function($t.variable || "obj", "escapeExpr", a); + } catch (l) { + throw ((l.source = a), l); + } + if (t) return i(t, ms); + var o = function (u) { + return i.call(this, u, ms); + }; + return ( + (o.source = + "function(" + + ($t.variable || "obj") + + `){ +` + + a + + "}"), + o + ); + }; + He.settings = $t; + var Ue = { + getStyleFor: function (e) { + var t = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : { baseUrl: "" }; + return te('<style class="clappr-style"></style>').html( + He(e.toString())(t) + ); + }, + }, + jl = /^(\S+)\s*(.*)$/, + ii = (function (s) { + function e(t) { + var i; + return ( + ve(this, e), + (i = xe(this, e, [t])), + (i.cid = ei("c")), + i._ensureElement(), + i.delegateEvents(), + i + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "tagName", + get: function () { + return "div"; + }, + }, + { + key: "events", + get: function () { + return {}; + }, + }, + { + key: "attributes", + get: function () { + return {}; + }, + }, + { + key: "$", + value: function (i) { + return this.$el.find(i); + }, + }, + { + key: "render", + value: function () { + return this; + }, + }, + { + key: "destroy", + value: function () { + return ( + this.$el.remove(), + this.stopListening(), + this.undelegateEvents(), + this + ); + }, + }, + { + key: "setElement", + value: function (i, n) { + return ( + this.$el && this.undelegateEvents(), + (this.$el = te.zepto.isZ(i) ? i : te(i)), + (this.el = this.$el[0]), + n !== !1 && this.delegateEvents(), + this + ); + }, + }, + { + key: "delegateEvents", + value: function (i) { + i || (i = this.events), this.undelegateEvents(); + for (var n in i) { + var r = i[n]; + if ( + (r && r.constructor !== Function && (r = this[i[n]]), !!r) + ) { + var a = n.match(jl), + o = a[1], + l = a[2]; + (o += ".delegateEvents" + this.cid), + l === "" + ? this.$el.on(o, r.bind(this)) + : this.$el.on(o, l, r.bind(this)); + } + } + return this; + }, + }, + { + key: "undelegateEvents", + value: function () { + return this.$el.off(".delegateEvents" + this.cid), this; + }, + }, + { + key: "_ensureElement", + value: function () { + if (this.el) this.setElement(this.el, !1); + else { + var i = te.extend(!0, {}, this.attributes); + this.id && (i.id = this.id), + this.className && (i.class = this.className); + var n = te(ti.create(this.tagName)).attr(i); + this.setElement(n, !1); + } + }, + }, + { + key: "onResize", + value: function () { + return this; + }, + }, + { + key: "resize", + value: function (i) { + var n = Mi(i.width) + ? "".concat(i.width, "px") + : "".concat(i.width), + r = Mi(i.height) + ? "".concat(i.height, "px") + : "".concat(i.height); + return ( + (this.el.style.width = n), + (this.el.style.height = r), + this.onResize(i), + this + ); + }, + }, + ]) + ); + })(At), + Lt = (function (s) { + function e() { + var t, + i = + arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, + n = arguments.length > 1 ? arguments[1] : void 0; + return ve(this, e), (t = xe(this, e, [i])), (t.core = n), t; + } + return ( + we(e, s), + Ee( + e, + [ + { + key: "name", + get: function () { + return "error"; + }, + }, + { + key: "createError", + value: function (i) { + if (!this.core) { + fe.warn(this.name, "Core is not set. Error: ", i); + return; + } + this.core.trigger(A.ERROR, i); + }, + }, + ], + [ + { + key: "Levels", + get: function () { + return { FATAL: "FATAL", WARN: "WARN", INFO: "INFO" }; + }, + }, + ] + ) + ); + })(At), + It = { + createError: function (e) { + var t = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : { useCodePrefix: !0 }, + i = (this.constructor && this.constructor.type) || "", + n = this.name || i, + r = + this.i18n || + (this.core && this.core.i18n) || + (this.container && this.container.i18n), + a = "".concat(n, ":").concat((e && e.code) || "unknown"), + o = { + description: "", + level: Lt.Levels.FATAL, + origin: n, + scope: i, + raw: {}, + }, + l = Object.assign({}, o, e, { code: t.useCodePrefix ? a : e.code }); + if (r && l.level == Lt.Levels.FATAL && !l.UI) { + var u = { + title: r.t("default_error_title"), + message: r.t("default_error_message"), + }; + l.UI = u; + } + return ( + this.playerError + ? this.playerError.createError(l) + : fe.warn(n, "PlayerError is not defined. Error: ", l), + l + ); + }, + }, + Ze = (function (s) { + function e(t) { + var i; + return ( + ve(this, e), + (i = xe(this, e, [t.options])), + (i.core = t), + (i.enabled = !0), + i.bindEvents(), + i.render(), + i + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "playerError", + get: function () { + return this.core.playerError; + }, + }, + { key: "bindEvents", value: function () {} }, + { + key: "getExternalInterface", + value: function () { + return {}; + }, + }, + { + key: "enable", + value: function () { + this.enabled || + (this.bindEvents(), this.$el.show(), (this.enabled = !0)); + }, + }, + { + key: "disable", + value: function () { + this.stopListening(), this.$el.hide(), (this.enabled = !1); + }, + }, + { + key: "render", + value: function () { + return this; + }, + }, + ]) + ); + })(ii); + Object.assign(Ze.prototype, It), + (Ze.extend = function (s) { + return Jt(Ze, s); + }), + (Ze.type = "core"); + var ql = `.container[data-container] { + position: absolute; + background-color: black; + height: 100%; + width: 100%; + max-width: 100%; } + .container[data-container] .chromeless { + cursor: default; } + +[data-player]:not(.nocursor) .container[data-container]:not(.chromeless).pointer-enabled { + cursor: pointer; } +`, + xn = (function (s) { + function e(t, i, n) { + var r; + return ( + ve(this, e), + (r = xe(this, e, [t])), + (r._i18n = i), + (r.currentTime = 0), + (r.volume = 100), + (r.playback = t.playback), + (r.playerError = n), + (r.settings = te.extend(!0, {}, r.playback.settings)), + (r.isReady = !1), + (r.mediaControlDisabled = !1), + (r.plugins = [r.playback]), + (r.dblTapHandler = new ls(500)), + (r.clickTimer = null), + (r.clickDelay = 200), + (r.actionsMetadata = {}), + r.bindEvents(), + r + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "name", + get: function () { + return "Container"; + }, + }, + { + key: "attributes", + get: function () { + return { class: "container", "data-container": "" }; + }, + }, + { + key: "events", + get: function () { + return { + click: "clicked", + dblclick: "dblClicked", + touchend: "dblTap", + contextmenu: "onContextMenu", + mouseenter: "mouseEnter", + mouseleave: "mouseLeave", + mouseup: "onMouseUp", + mousedown: "onMouseDown", + }; + }, + }, + { + key: "ended", + get: function () { + return this.playback.ended; + }, + }, + { + key: "buffering", + get: function () { + return this.playback.buffering; + }, + }, + { + key: "i18n", + get: function () { + return this._i18n; + }, + }, + { + key: "hasClosedCaptionsTracks", + get: function () { + return this.playback.hasClosedCaptionsTracks; + }, + }, + { + key: "closedCaptionsTracks", + get: function () { + return this.playback.closedCaptionsTracks; + }, + }, + { + key: "closedCaptionsTrackId", + get: function () { + return this.playback.closedCaptionsTrackId; + }, + set: function (i) { + this.playback.closedCaptionsTrackId = i; + }, + }, + { + key: "audioTracks", + get: function () { + return this.playback.audioTracks; + }, + }, + { + key: "currentAudioTrack", + get: function () { + return this.playback.currentAudioTrack; + }, + }, + { + key: "isPiPActive", + get: function () { + return this.playback.isPiPActive; + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo( + this.playback, + A.PLAYBACK_PROGRESS, + this.onProgress + ), + this.listenTo( + this.playback, + A.PLAYBACK_TIMEUPDATE, + this.timeUpdated + ), + this.listenTo(this.playback, A.PLAYBACK_READY, this.ready), + this.listenTo( + this.playback, + A.PLAYBACK_BUFFERING, + this.onBuffering + ), + this.listenTo( + this.playback, + A.PLAYBACK_BUFFERFULL, + this.bufferfull + ), + this.listenTo( + this.playback, + A.PLAYBACK_SETTINGSUPDATE, + this.settingsUpdate + ), + this.listenTo( + this.playback, + A.PLAYBACK_LOADEDMETADATA, + this.loadedMetadata + ), + this.listenTo( + this.playback, + A.PLAYBACK_HIGHDEFINITIONUPDATE, + this.highDefinitionUpdate + ), + this.listenTo( + this.playback, + A.PLAYBACK_BITRATE, + this.updateBitrate + ), + this.listenTo( + this.playback, + A.PLAYBACK_PLAYBACKSTATE, + this.playbackStateChanged + ), + this.listenTo( + this.playback, + A.PLAYBACK_DVR, + this.playbackDvrStateChanged + ), + this.listenTo( + this.playback, + A.PLAYBACK_MEDIACONTROL_DISABLE, + this.disableMediaControl + ), + this.listenTo( + this.playback, + A.PLAYBACK_MEDIACONTROL_ENABLE, + this.enableMediaControl + ), + this.listenTo(this.playback, A.PLAYBACK_SEEK, this.onSeek), + this.listenTo(this.playback, A.PLAYBACK_SEEKED, this.onSeeked), + this.listenTo(this.playback, A.PLAYBACK_ENDED, this.onEnded), + this.listenTo(this.playback, A.PLAYBACK_PLAY, this.playing), + this.listenTo(this.playback, A.PLAYBACK_PAUSE, this.paused), + this.listenTo(this.playback, A.PLAYBACK_STOP, this.stopped), + this.listenTo(this.playback, A.PLAYBACK_ERROR, this.error), + this.listenTo( + this.playback, + A.PLAYBACK_SUBTITLE_AVAILABLE, + this.subtitleAvailable + ), + this.listenTo( + this.playback, + A.PLAYBACK_SUBTITLE_CHANGED, + this.subtitleChanged + ), + this.listenTo( + this.playback, + A.PLAYBACK_AUDIO_AVAILABLE, + this.audioAvailable + ), + this.listenTo( + this.playback, + A.PLAYBACK_AUDIO_CHANGED, + this.audioChanged + ), + this.listenTo( + this.playback, + A.PLAYBACK_PIP_ENTER, + this.onEnterPiP + ), + this.listenTo( + this.playback, + A.PLAYBACK_PIP_EXIT, + this.onExitPiP + ); + }, + }, + { + key: "subtitleAvailable", + value: function () { + this.trigger(A.CONTAINER_SUBTITLE_AVAILABLE); + }, + }, + { + key: "subtitleChanged", + value: function (i) { + this.trigger(A.CONTAINER_SUBTITLE_CHANGED, i); + }, + }, + { + key: "audioAvailable", + value: function (i) { + this.trigger(A.CONTAINER_AUDIO_AVAILABLE, i); + }, + }, + { + key: "audioChanged", + value: function (i) { + this.trigger(A.CONTAINER_AUDIO_CHANGED, i); + }, + }, + { + key: "playbackStateChanged", + value: function (i) { + this.trigger(A.CONTAINER_PLAYBACKSTATE, i); + }, + }, + { + key: "playbackDvrStateChanged", + value: function (i) { + (this.settings = this.playback.settings), + (this.dvrInUse = i), + this.trigger(A.CONTAINER_PLAYBACKDVRSTATECHANGED, i); + }, + }, + { + key: "updateBitrate", + value: function (i) { + this.trigger(A.CONTAINER_BITRATE, i); + }, + }, + { + key: "statsReport", + value: function (i) { + this.trigger(A.CONTAINER_STATS_REPORT, i); + }, + }, + { + key: "getPlaybackType", + value: function () { + return this.playback.getPlaybackType(); + }, + }, + { + key: "isDvrEnabled", + value: function () { + return !!this.playback.dvrEnabled; + }, + }, + { + key: "isDvrInUse", + value: function () { + return !!this.dvrInUse; + }, + }, + { + key: "destroy", + value: function () { + this.disableResizeObserver(), + this.trigger(A.CONTAINER_DESTROYED, this, this.name), + this.stopListening(), + this.plugins.forEach(function (i) { + return i.destroy(); + }), + this.$el.remove(), + this.undelegateEvents(); + }, + }, + { + key: "setStyle", + value: function (i) { + this.$el.css(i); + }, + }, + { + key: "ready", + value: function () { + (this.isReady = !0), this.trigger(A.CONTAINER_READY, this.name); + }, + }, + { + key: "isPlaying", + value: function () { + return this.playback.isPlaying(); + }, + }, + { + key: "getStartTimeOffset", + value: function () { + return this.playback.getStartTimeOffset(); + }, + }, + { + key: "getCurrentTime", + value: function () { + return this.currentTime; + }, + }, + { + key: "getDuration", + value: function () { + return this.playback.getDuration(); + }, + }, + { + key: "error", + value: function (i) { + this.isReady || this.ready(), + this.trigger(A.CONTAINER_ERROR, i, this.name); + }, + }, + { + key: "loadedMetadata", + value: function (i) { + this.trigger(A.CONTAINER_LOADEDMETADATA, i); + }, + }, + { + key: "timeUpdated", + value: function (i) { + (this.currentTime = i.current), + this.trigger(A.CONTAINER_TIMEUPDATE, i, this.name); + }, + }, + { + key: "onProgress", + value: function () { + for ( + var i = arguments.length, n = new Array(i), r = 0; + r < i; + r++ + ) + n[r] = arguments[r]; + this.trigger.apply( + this, + [A.CONTAINER_PROGRESS].concat(n, [this.name]) + ); + }, + }, + { + key: "playing", + value: function () { + this.trigger( + A.CONTAINER_PLAY, + this.name, + this.actionsMetadata.playEvent || {} + ), + (this.actionsMetadata.playEvent = {}); + }, + }, + { + key: "paused", + value: function () { + this.trigger( + A.CONTAINER_PAUSE, + this.name, + this.actionsMetadata.pauseEvent || {} + ), + (this.actionsMetadata.pauseEvent = {}); + }, + }, + { + key: "stopped", + value: function () { + this.trigger( + A.CONTAINER_STOP, + this.actionsMetadata.stopEvent || {} + ), + (this.actionsMetadata.stopEvent = {}); + }, + }, + { + key: "play", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + (this.actionsMetadata.playEvent = i), this.playback.play(i); + }, + }, + { + key: "stop", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + (this.actionsMetadata.stopEvent = i), + this.playback.stop(i), + (this.currentTime = 0); + }, + }, + { + key: "switchAudioTrack", + value: function (i) { + this.playback.switchAudioTrack(i); + }, + }, + { + key: "pause", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + (this.actionsMetadata.pauseEvent = i), this.playback.pause(i); + }, + }, + { + key: "onEnded", + value: function () { + this.trigger(A.CONTAINER_ENDED, this, this.name), + (this.currentTime = 0); + }, + }, + { + key: "clicked", + value: function () { + var i = this; + (!this.options.chromeless || this.options.allowUserInteraction) && + (this.clickTimer = setTimeout(function () { + i.clickTimer && i.trigger(A.CONTAINER_CLICK, i, i.name); + }, this.clickDelay)); + }, + }, + { + key: "cancelClicked", + value: function () { + clearTimeout(this.clickTimer), (this.clickTimer = null); + }, + }, + { + key: "dblClicked", + value: function () { + (!this.options.chromeless || this.options.allowUserInteraction) && + (this.cancelClicked(), + this.trigger(A.CONTAINER_DBLCLICK, this, this.name)); + }, + }, + { + key: "dblTap", + value: function (i) { + var n = this; + (!this.options.chromeless || this.options.allowUserInteraction) && + this.dblTapHandler.handle(i, function () { + n.cancelClicked(), n.trigger(A.CONTAINER_DBLCLICK, n, n.name); + }); + }, + }, + { + key: "onContextMenu", + value: function (i) { + (!this.options.chromeless || this.options.allowUserInteraction) && + this.trigger(A.CONTAINER_CONTEXTMENU, i, this.name); + }, + }, + { + key: "seek", + value: function (i) { + this.playback.seek(i); + }, + }, + { + key: "onSeek", + value: function (i) { + this.trigger(A.CONTAINER_SEEK, i, this.name); + }, + }, + { + key: "onSeeked", + value: function () { + this.trigger(A.CONTAINER_SEEKED, this.name); + }, + }, + { + key: "seekPercentage", + value: function (i) { + var n = this.getDuration(); + if (i >= 0 && i <= 100) { + var r = n * (i / 100); + this.seek(r); + } + }, + }, + { + key: "setVolume", + value: function (i) { + (this.volume = parseFloat(i)), + this.trigger(A.CONTAINER_VOLUME, this.volume, this.name), + this.playback.volume(this.volume); + }, + }, + { + key: "fullscreen", + value: function () { + this.trigger(A.CONTAINER_FULLSCREEN, this.name); + }, + }, + { + key: "onBuffering", + value: function () { + this.trigger(A.CONTAINER_STATE_BUFFERING, this.name); + }, + }, + { + key: "bufferfull", + value: function () { + this.trigger(A.CONTAINER_STATE_BUFFERFULL, this.name); + }, + }, + { + key: "onEnterPiP", + value: function () { + this.trigger(A.CONTAINER_PIP_ENTER, this.name); + }, + }, + { + key: "onExitPiP", + value: function () { + this.trigger(A.CONTAINER_PIP_EXIT, this.name); + }, + }, + { + key: "addPlugin", + value: function (i) { + this.plugins.push(i); + }, + }, + { + key: "hasPlugin", + value: function (i) { + return !!this.getPlugin(i); + }, + }, + { + key: "getPlugin", + value: function (i) { + return this.plugins.filter(function (n) { + return n.name === i; + })[0]; + }, + }, + { + key: "mouseEnter", + value: function () { + (!this.options.chromeless || this.options.allowUserInteraction) && + this.trigger(A.CONTAINER_MOUSE_ENTER); + }, + }, + { + key: "mouseLeave", + value: function () { + (!this.options.chromeless || this.options.allowUserInteraction) && + this.trigger(A.CONTAINER_MOUSE_LEAVE); + }, + }, + { + key: "mouseUp", + value: function () { + (!this.options.chromeless || this.options.allowUserInteraction) && + this.trigger(A.CONTAINER_MOUSE_UP); + }, + }, + { + key: "mouseDown", + value: function () { + (!this.options.chromeless || this.options.allowUserInteraction) && + this.trigger(A.CONTAINER_MOUSE_DOWN); + }, + }, + { + key: "enterPiP", + value: function () { + this.playback.enterPiP(); + }, + }, + { + key: "exitPiP", + value: function () { + this.playback.exitPiP(); + }, + }, + { + key: "settingsUpdate", + value: function () { + (this.settings = this.playback.settings), + this.trigger(A.CONTAINER_SETTINGSUPDATE); + }, + }, + { + key: "highDefinitionUpdate", + value: function (i) { + this.trigger(A.CONTAINER_HIGHDEFINITIONUPDATE, i); + }, + }, + { + key: "isHighDefinitionInUse", + value: function () { + return this.playback.isHighDefinitionInUse(); + }, + }, + { + key: "disableMediaControl", + value: function () { + this.mediaControlDisabled || + ((this.mediaControlDisabled = !0), + this.trigger(A.CONTAINER_MEDIACONTROL_DISABLE)); + }, + }, + { + key: "enableMediaControl", + value: function () { + this.mediaControlDisabled && + ((this.mediaControlDisabled = !1), + this.trigger(A.CONTAINER_MEDIACONTROL_ENABLE)); + }, + }, + { + key: "updateStyle", + value: function () { + !this.options.chromeless || this.options.allowUserInteraction + ? this.$el.removeClass("chromeless") + : this.$el.addClass("chromeless"); + }, + }, + { + key: "enableResizeObserver", + value: function () { + var i = this; + this.disableResizeObserver(), + (this.resizeObserverInterval = setInterval(function () { + return i.checkResize(); + }, 500)); + }, + }, + { + key: "disableResizeObserver", + value: function () { + this.resizeObserverInterval && + clearInterval(this.resizeObserverInterval); + }, + }, + { + key: "checkResize", + value: function () { + var i = { + width: this.el.clientWidth, + height: this.el.clientHeight, + }, + n = this.currentSize || {}, + r = n.width, + a = n.height, + o = a !== i.height || r !== i.width; + o && + ((this.currentSize = i), this.trigger(A.CONTAINER_RESIZE, i)); + }, + }, + { + key: "onResize", + value: function (i) { + return this.playback.resize(i), this; + }, + }, + { + key: "configure", + value: function (i) { + (this._options = te.extend(!0, this._options, i)), + this.updateStyle(), + this.playback.configure(this.options), + this.trigger(A.CONTAINER_OPTIONS_CHANGE); + }, + }, + { + key: "render", + value: function () { + var i = Ue.getStyleFor(ql.toString(), { + baseUrl: this.options.baseUrl, + }); + return ( + this.$el.append(i[0]), + this.$el.append(this.playback.render().el), + this.updateStyle(), + this.checkResize(), + this.enableResizeObserver(), + this + ); + }, + }, + ]) + ); + })(ii); + Object.assign(xn.prototype, It); + var ge = (function (s) { + function e(t, i, n) { + var r; + return ( + ve(this, e), + (r = xe(this, e, [t])), + (r.settings = {}), + (r._i18n = i), + (r.playerError = n), + (r._consented = !1), + r + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "isAudioOnly", + get: function () { + return !1; + }, + }, + { + key: "isAdaptive", + get: function () { + return !1; + }, + }, + { + key: "ended", + get: function () { + return !1; + }, + }, + { + key: "i18n", + get: function () { + return this._i18n; + }, + }, + { + key: "buffering", + get: function () { + return !1; + }, + }, + { + key: "latency", + get: function () { + return null; + }, + }, + { + key: "currentProgramDateTime", + get: function () { + return null; + }, + }, + { + key: "isPiPActive", + get: function () { + return !1; + }, + }, + { + key: "consent", + value: function (i) { + typeof i == "function" && i(); + }, + }, + { key: "play", value: function () {} }, + { key: "pause", value: function () {} }, + { key: "stop", value: function () {} }, + { key: "enterPiP", value: function () {} }, + { key: "exitPiP", value: function () {} }, + { key: "seek", value: function (i) {} }, + { key: "seekPercentage", value: function (i) {} }, + { + key: "getStartTimeOffset", + value: function () { + return 0; + }, + }, + { + key: "getDuration", + value: function () { + return 0; + }, + }, + { + key: "isPlaying", + value: function () { + return !1; + }, + }, + { + key: "isReady", + get: function () { + return !1; + }, + }, + { + key: "hasClosedCaptionsTracks", + get: function () { + return this.closedCaptionsTracks.length > 0; + }, + }, + { + key: "closedCaptionsTracks", + get: function () { + return []; + }, + }, + { + key: "closedCaptionsTrackId", + get: function () { + return -1; + }, + set: function (i) {}, + }, + { + key: "audioTracks", + get: function () { + return []; + }, + }, + { + key: "currentAudioTrack", + get: function () { + return null; + }, + }, + { key: "switchAudioTrack", value: function (i) {} }, + { + key: "getPlaybackType", + value: function () { + return e.NO_OP; + }, + }, + { + key: "isHighDefinitionInUse", + value: function () { + return !1; + }, + }, + { key: "mute", value: function () {} }, + { key: "unmute", value: function () {} }, + { key: "volume", value: function (i) {} }, + { + key: "configure", + value: function (i) { + this._options = te.extend(!0, this._options, i); + }, + }, + { + key: "attemptAutoPlay", + value: function () { + var i = this; + this.canAutoPlay(function (n, r) { + n && i.play(); + }); + }, + }, + { + key: "canAutoPlay", + value: function (i) { + i(!0, null); + }, + }, + { + key: "onResize", + value: function (i) { + return this.trigger(A.PLAYBACK_RESIZE, i), this; + }, + }, + ]) + ); + })(ii); + Object.assign(ge.prototype, It), + (ge.extend = function (s) { + return Jt(ge, s); + }), + (ge.canPlay = function (s, e) { + return !1; + }), + (ge.VOD = "vod"), + (ge.AOD = "aod"), + (ge.LIVE = "live"), + (ge.NO_OP = "no_op"), + (ge.type = "playback"); + var Xl = (function (s) { + function e(t, i, n, r) { + var a; + return ( + ve(this, e), + (a = xe(this, e, [t])), + (a._i18n = n), + (a.loader = i), + (a.playerError = r), + a + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "options", + get: function () { + return this._options; + }, + set: function (i) { + this._options = i; + }, + }, + { + key: "createContainers", + value: function () { + var i = this; + return te.Deferred(function (n) { + n.resolve( + i.options.sources.map(function (r) { + return i.createContainer(r); + }) + ); + }); + }, + }, + { + key: "findPlaybackPlugin", + value: function (i, n) { + return this.loader.playbackPlugins.filter(function (r) { + return r.canPlay(i, n); + })[0]; + }, + }, + { + key: "createContainer", + value: function (i) { + var n = null, + r = this.options.mimeType; + Mt(i) === "object" + ? ((n = i.source.toString()), i.mimeType && (r = i.mimeType)) + : (n = i.toString()), + n.match(/^\/\//) && (n = window.location.protocol + n); + var a = Fi(Fi({}, this.options), {}, { src: n, mimeType: r }), + o = this.findPlaybackPlugin(n, r), + l = o ? new o(a, this._i18n, this.playerError) : new ge(); + a = Fi(Fi({}, a), {}, { playback: l }); + var u = new xn(a, this._i18n, this.playerError), + c = te.Deferred(); + return ( + c.promise(u), + this.addContainerPlugins(u), + this.listenToOnce(u, A.CONTAINER_READY, function () { + return c.resolve(u); + }), + u + ); + }, + }, + { + key: "addContainerPlugins", + value: function (i) { + this.loader.containerPlugins.forEach(function (n) { + i.addPlugin(new n(i)); + }); + }, + }, + ]) + ); + })(At), + Zl = `[data-player] { + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -o-user-select: none; + user-select: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + transform: translate3d(0, 0, 0); + position: relative; + margin: 0; + padding: 0; + border: 0; + font-style: normal; + font-weight: normal; + text-align: center; + overflow: hidden; + font-size: 100%; + font-family: "Roboto", "Open Sans", Arial, sans-serif; + text-shadow: 0 0 0; + box-sizing: border-box; } + [data-player]:focus { + outline: 0; } + [data-player] * { + box-sizing: inherit; } + [data-player] > * { + float: none; + max-width: none; } + [data-player] > div { + display: block; } + [data-player].fullscreen { + width: 100% !important; + height: 100% !important; + top: 0; + left: 0; } + [data-player].nocursor { + cursor: none; } + +.clappr-style { + display: none !important; } +`, + Ql = `[data-player] div, [data-player] span, [data-player] applet, [data-player] object, [data-player] iframe, +[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, +[data-player] a, [data-player] abbr, [data-player] acronym, [data-player] address, [data-player] big, [data-player] cite, [data-player] code, +[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, +[data-player] small, [data-player] strike, [data-player] strong, [data-player] sub, [data-player] sup, [data-player] tt, [data-player] var, +[data-player] b, [data-player] u, [data-player] i, [data-player] center, +[data-player] dl, [data-player] dt, [data-player] dd, [data-player] ol, [data-player] ul, [data-player] li, +[data-player] fieldset, [data-player] form, [data-player] label, [data-player] legend, +[data-player] table, [data-player] caption, [data-player] tbody, [data-player] tfoot, [data-player] thead, [data-player] tr, [data-player] th, [data-player] td, +[data-player] article, [data-player] aside, [data-player] canvas, [data-player] details, [data-player] embed, +[data-player] figure, [data-player] figcaption, [data-player] footer, [data-player] header, [data-player] hgroup, +[data-player] menu, [data-player] nav, [data-player] output, [data-player] ruby, [data-player] section, [data-player] summary, +[data-player] time, [data-player] mark, [data-player] audio, [data-player] video { + margin: 0; + padding: 0; + border: 0; + font: inherit; + font-size: 100%; + vertical-align: baseline; } + +[data-player] table { + border-collapse: collapse; + border-spacing: 0; } + +[data-player] caption, [data-player] th, [data-player] td { + text-align: left; + font-weight: normal; + vertical-align: middle; } + +[data-player] q, [data-player] blockquote { + quotes: none; } + [data-player] q:before, [data-player] q:after, [data-player] blockquote:before, [data-player] blockquote:after { + content: ""; + content: none; } + +[data-player] a img { + border: none; } +`, + Ln = (function (s) { + function e(t) { + var i; + return ( + ve(this, e), + (i = xe(this, e, [t])), + (i.playerError = new Lt(t, i)), + i.configureDomRecycler(), + (i.firstResize = !0), + (i.styleRendered = !1), + (i.plugins = []), + (i.containers = []), + (i._boundFullscreenHandler = function () { + return i.handleFullscreenChange(); + }), + (i._boundHandleWindowResize = function (n) { + return i.handleWindowResize(n); + }), + te(document).bind("fullscreenchange", i._boundFullscreenHandler), + te(document).bind("MSFullscreenChange", i._boundFullscreenHandler), + te(document).bind("mozfullscreenchange", i._boundFullscreenHandler), + ee.isMobile && te(window).bind("resize", i._boundHandleWindowResize), + i + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "events", + get: function () { + return { + webkitfullscreenchange: "handleFullscreenChange", + mousemove: "onMouseMove", + mouseleave: "onMouseLeave", + }; + }, + }, + { + key: "attributes", + get: function () { + return { "data-player": "", tabindex: 9999 }; + }, + }, + { + key: "isReady", + get: function () { + return !!this.ready; + }, + }, + { + key: "i18n", + get: function () { + return ( + this.getPlugin("strings") || { + t: function (n) { + return n; + }, + } + ); + }, + }, + { + key: "mediaControl", + get: function () { + return ( + this._mediaControl || + (this._mediaControl = this.getPlugin("media_control")) || + this.dummyMediaControl + ); + }, + }, + { + key: "dummyMediaControl", + get: function () { + return this._dummyMediaControl + ? this._dummyMediaControl + : ((this._dummyMediaControl = new Ze(this)), + this._dummyMediaControl); + }, + }, + { + key: "activeContainer", + get: function () { + return this._activeContainer; + }, + set: function (i) { + (this._activeContainer = i), + this.trigger( + A.CORE_ACTIVE_CONTAINER_CHANGED, + this._activeContainer + ); + }, + }, + { + key: "activePlayback", + get: function () { + return this.activeContainer && this.activeContainer.playback; + }, + }, + { + key: "activePlaybackEl", + get: function () { + if (this.activePlayback) + return this.activePlayback.$el + ? this.activePlayback.$el.find("video")[0] + : this.activePlayback.el; + }, + }, + { + key: "configureDomRecycler", + value: function () { + var i = + this.options && + this.options.playback && + this.options.playback.recycleVideo; + ti.configure({ recycleVideo: i }); + }, + }, + { + key: "createContainers", + value: function (i) { + (this.defer = te.Deferred()), + this.defer.promise(this), + (this.containerFactory = new Xl( + i, + i.loader, + this.i18n, + this.playerError + )), + this.prepareContainers(); + }, + }, + { + key: "prepareContainers", + value: function () { + var i = this; + this.containerFactory + .createContainers() + .then(function (n) { + return i.setupContainers(n); + }) + .then(function (n) { + return i.resolveOnContainersReady(n); + }); + }, + }, + { + key: "updateSize", + value: function () { + this.isFullscreen() ? this.setFullscreen() : this.setPlayerSize(); + }, + }, + { + key: "setFullscreen", + value: function () { + ee.isiOS || + (this.$el.addClass("fullscreen"), + this.$el.removeAttr("style"), + (this.previousSize = { + width: this.options.width, + height: this.options.height, + }), + (this.currentSize = { + width: te(window).width(), + height: te(window).height(), + })); + }, + }, + { + key: "setPlayerSize", + value: function () { + this.$el.removeClass("fullscreen"), + (this.currentSize = this.previousSize), + (this.previousSize = { + width: te(window).width(), + height: te(window).height(), + }), + this.resize(this.currentSize); + }, + }, + { + key: "onResize", + value: function (i) { + return ( + (this.previousSize = { + width: this.options.width, + height: this.options.height, + }), + (this.options.width = i.width), + (this.options.height = i.height), + (this.currentSize = i), + this.triggerResize(this.currentSize), + this + ); + }, + }, + { + key: "enableResizeObserver", + value: function () { + var i = this; + this.disableResizeObserver(); + var n = function () { + i.triggerResize({ + width: i.el.clientWidth, + height: i.el.clientHeight, + }); + }; + this.resizeObserverInterval = setInterval(n, 500); + }, + }, + { + key: "triggerResize", + value: function (i) { + var n = + this.firstResize || + this.oldHeight !== i.height || + this.oldWidth !== i.width; + n && + ((this.oldHeight = i.height), + (this.oldWidth = i.width), + (this.computedSize = i), + (this.firstResize = !1), + this.trigger(A.CORE_RESIZE, i)); + }, + }, + { + key: "disableResizeObserver", + value: function () { + this.resizeObserverInterval && + clearInterval(this.resizeObserverInterval), + (this.resizeObserverInterval = null); + }, + }, + { + key: "resolveOnContainersReady", + value: function (i) { + var n = this; + te.when.apply(te, i).done(function () { + n.defer.resolve(n), (n.ready = !0), n.trigger(A.CORE_READY); + }); + }, + }, + { + key: "addPlugin", + value: function (i) { + this.plugins.push(i); + }, + }, + { + key: "hasPlugin", + value: function (i) { + return !!this.getPlugin(i); + }, + }, + { + key: "getPlugin", + value: function (i) { + return this.plugins.filter(function (n) { + return n.name === i; + })[0]; + }, + }, + { + key: "load", + value: function (i, n) { + (this.options.mimeType = n), + (i = i && i.constructor === Array ? i : [i]), + (this.options.sources = i), + this.containers.forEach(function (r) { + return r.destroy(); + }), + (this.containerFactory.options = te.extend(!0, this.options, { + sources: i, + })), + this.prepareContainers(); + }, + }, + { + key: "destroy", + value: function () { + this.disableResizeObserver(), + this.containers.forEach(function (i) { + return i.destroy(); + }), + this.plugins.forEach(function (i) { + return i.destroy(); + }), + this.$el.remove(), + te(document).unbind( + "fullscreenchange", + this._boundFullscreenHandler + ), + te(document).unbind( + "MSFullscreenChange", + this._boundFullscreenHandler + ), + te(document).unbind( + "mozfullscreenchange", + this._boundFullscreenHandler + ), + ee.isMobile && + te(window).unbind("resize", this._boundHandleWindowResize), + this.stopListening(), + this.undelegateEvents(); + }, + }, + { + key: "handleFullscreenChange", + value: function () { + this.trigger(A.CORE_FULLSCREEN, this.isFullscreen()), + this.updateSize(); + }, + }, + { + key: "handleWindowResize", + value: function (i) { + var n = + window.innerWidth > window.innerHeight + ? "landscape" + : "portrait"; + this._screenOrientation !== n && + ((this._screenOrientation = n), + this.triggerResize({ + width: this.el.clientWidth, + height: this.el.clientHeight, + }), + this.trigger(A.CORE_SCREEN_ORIENTATION_CHANGED, { + event: i, + orientation: this._screenOrientation, + })); + }, + }, + { + key: "removeContainer", + value: function (i) { + this.stopListening(i), + this.containerFactory.stopListening(i), + (this.containers = this.containers.filter(function (n) { + return n !== i; + })); + }, + }, + { + key: "setupContainer", + value: function (i) { + this.listenTo(i, A.CONTAINER_DESTROYED, this.removeContainer), + this.containers.push(i); + }, + }, + { + key: "setupContainers", + value: function (i) { + return ( + i.forEach(this.setupContainer.bind(this)), + this.trigger(A.CORE_CONTAINERS_CREATED), + this.renderContainers(), + (this.activeContainer = i[0]), + this.render(), + this.appendToParent(), + this.containers + ); + }, + }, + { + key: "renderContainers", + value: function () { + var i = this; + this.containers.forEach(function (n) { + return i.el.appendChild(n.render().el); + }); + }, + }, + { + key: "createContainer", + value: function (i, n) { + var r = this.containerFactory.createContainer(i, n); + return ( + this.setupContainer(r), this.el.appendChild(r.render().el), r + ); + }, + }, + { + key: "getCurrentContainer", + value: function () { + return this.activeContainer; + }, + }, + { + key: "getCurrentPlayback", + value: function () { + return this.activePlayback; + }, + }, + { + key: "getPlaybackType", + value: function () { + return ( + this.activeContainer && this.activeContainer.getPlaybackType() + ); + }, + }, + { + key: "isFullscreen", + value: function () { + var i = yi.fullscreenElement(); + return ( + (i && i === this.el) || + (i && i === this.activePlaybackEl) || + (this.activePlaybackEl && + this.activePlaybackEl.webkitDisplayingFullscreen) || + !1 + ); + }, + }, + { + key: "toggleFullscreen", + value: function () { + var i = this; + if (this.isFullscreen()) { + var n = ee.isiOS ? this.activePlaybackEl : document; + yi.cancelFullscreen(n), + !ee.isiOS && this.$el.removeClass("fullscreen nocursor"); + } else { + var r = ee.isiOS ? this.activePlaybackEl : this.el; + if (!r) return; + ee.isSafari || ee.isiOS + ? yi.requestFullscreen(r) + : yi.requestFullscreen(r).then( + function (a) { + return a; + }, + function (a) { + return setTimeout(function () { + if (!i.isFullscreen()) throw new ReferenceError(a); + }, 600); + } + ), + !ee.isiOS && this.$el.addClass("fullscreen"); + } + }, + }, + { + key: "onMouseMove", + value: function (i) { + this.trigger(A.CORE_MOUSE_MOVE, i); + }, + }, + { + key: "onMouseLeave", + value: function (i) { + this.trigger(A.CORE_MOUSE_LEAVE, i); + }, + }, + { + key: "configure", + value: function (i) { + var n = this; + (this._options = te.extend(!0, this._options, i)), + this.configureDomRecycler(); + var r = i.source || i.sources; + r && this.load(r, i.mimeType || this.options.mimeType), + this.trigger(A.CORE_OPTIONS_CHANGE, i), + this.containers.forEach(function (a) { + return a.configure(n.options); + }); + }, + }, + { + key: "appendToParent", + value: function () { + var i = this.$el.parent() && this.$el.parent().length; + !i && this.$el.appendTo(this.options.parentElement); + }, + }, + { + key: "appendStyles", + value: function () { + if (!this.styleRendered) { + var i = Ue.getStyleFor(Zl.toString(), { + baseUrl: this.options.baseUrl, + }); + if ((this.$el.append(i[0]), this.options.includeResetStyle)) { + var n = Ue.getStyleFor(Ql.toString(), { + baseUrl: this.options.baseUrl, + }); + this.$el.append(n[0]); + } + this.styleRendered = !0; + } + }, + }, + { + key: "render", + value: function () { + this.appendStyles(), + (this.options.width = this.options.width || this.$el.width()), + (this.options.height = + this.options.height || this.$el.height()); + var i = { + width: this.options.width, + height: this.options.height, + }; + return ( + (this.previousSize = this.currentSize = this.computedSize = i), + this.updateSize(), + this.enableResizeObserver(), + this + ); + }, + }, + ]) + ); + })(ii); + Object.assign(Ln.prototype, It); + var Jl = (function (s) { + function e(t) { + var i; + return ve(this, e), (i = xe(this, e, [t.options])), (i.player = t), i; + } + return ( + we(e, s), + Ee(e, [ + { + key: "loader", + get: function () { + return this.player.loader; + }, + }, + { + key: "create", + value: function () { + return ( + (this.options.loader = this.loader), + (this.core = new Ln(this.options)), + this.addCorePlugins(), + this.core.createContainers(this.options), + this.core + ); + }, + }, + { + key: "addCorePlugins", + value: function () { + var i = this; + return ( + this.loader.corePlugins.forEach(function (n) { + var r = new n(i.core); + i.core.addPlugin(r), i.setupExternalInterface(r); + }), + this.core + ); + }, + }, + { + key: "setupExternalInterface", + value: function (i) { + var n = i.getExternalInterface(); + for (var r in n) this.player[r] = n[r].bind(i); + }, + }, + ]) + ); + })(At), + eu = /(\d+)(?:\.(\d+))?(?:\.(\d+))?/, + $i = (function () { + function s(e, t, i) { + ve(this, s), + (this.major = parseInt(e || 0, 10)), + (this.minor = parseInt(t || 0, 10)), + (this.patch = parseInt(i || 0, 10)); + } + return Ee( + s, + [ + { + key: "compare", + value: function (t) { + var i = this.major - t.major; + return ( + (i = i || this.minor - t.minor), + (i = i || this.patch - t.patch), + i + ); + }, + }, + { + key: "inc", + value: function () { + var t = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : "patch"; + return typeof this[t] < "u" && (this[t] += 1), this; + }, + }, + { + key: "satisfies", + value: function (t, i) { + return this.compare(t) >= 0 && (!i || this.compare(i) < 0); + }, + }, + { + key: "toString", + value: function () { + return "" + .concat(this.major, ".") + .concat(this.minor, ".") + .concat(this.patch); + }, + }, + ], + [ + { + key: "parse", + value: function () { + var t = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : "", + i = t.match(eu) || [], + n = An(i, 4), + r = n[1], + a = n[2], + o = n[3]; + return typeof r > "u" ? null : new s(r, a, o); + }, + }, + ] + ); + })(), + As = function (e, t) { + return !e || !t + ? {} + : Object.entries(e) + .filter(function (i) { + var n = An(i, 2), + r = n[1]; + return r.type === t; + }) + .reduce(function (i, n) { + var r = An(n, 2), + a = r[0], + o = r[1]; + return (i[a] = o), i; + }, {}); + }, + ct = (function () { + var s = { plugins: {}, playbacks: [] }, + e = "0.11.3"; + return (function () { + function t() { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : [], + n = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : 0; + ve(this, t), + (this.playerId = n), + (this.playbackPlugins = Qt(s.playbacks)); + var r = t.registeredPlugins, + a = r.core, + o = r.container; + (this.containerPlugins = Object.values(o)), + (this.corePlugins = Object.values(a)), + Array.isArray(i) || this.validateExternalPluginsType(i), + this.addExternalPlugins(i); + } + return Ee( + t, + [ + { + key: "groupPluginsByType", + value: function (n) { + return ( + Array.isArray(n) && + (n = n.reduce(function (r, a) { + return ( + r[a.type] || (r[a.type] = []), r[a.type].push(a), r + ); + }, {})), + n + ); + }, + }, + { + key: "removeDups", + value: function (n) { + var r = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : !1, + a = function (d, f) { + return ( + (d[f.prototype.name] && r) || + (d[f.prototype.name] && delete d[f.prototype.name], + (d[f.prototype.name] = f)), + d + ); + }, + o = n.reduceRight(a, Object.create(null)), + l = []; + for (var u in o) l.unshift(o[u]); + return l; + }, + }, + { + key: "addExternalPlugins", + value: function (n) { + var r = + typeof n.loadExternalPluginsFirst == "boolean" + ? n.loadExternalPluginsFirst + : !0, + a = + typeof n.loadExternalPlaybacksFirst == "boolean" + ? n.loadExternalPlaybacksFirst + : !0; + if (((n = this.groupPluginsByType(n)), n.playback)) { + var o = n.playback.filter(function (c) { + return t.checkVersionSupport(c), !0; + }); + this.playbackPlugins = a + ? this.removeDups(o.concat(this.playbackPlugins)) + : this.removeDups(this.playbackPlugins.concat(o), !0); + } + if (n.container) { + var l = n.container.filter(function (c) { + return t.checkVersionSupport(c), !0; + }); + this.containerPlugins = r + ? this.removeDups(l.concat(this.containerPlugins)) + : this.removeDups(this.containerPlugins.concat(l), !0); + } + if (n.core) { + var u = n.core.filter(function (c) { + return t.checkVersionSupport(c), !0; + }); + this.corePlugins = r + ? this.removeDups(u.concat(this.corePlugins)) + : this.removeDups(this.corePlugins.concat(u), !0); + } + }, + }, + { + key: "validateExternalPluginsType", + value: function (n) { + var r = ["playback", "container", "core"]; + r.forEach(function (a) { + (n[a] || []).forEach(function (o) { + var l = "external " + o.type + " plugin on " + a + " array"; + if (o.type !== a) throw new ReferenceError(l); + }); + }); + }, + }, + ], + [ + { + key: "registeredPlaybacks", + get: function () { + return Qt(s.playbacks); + }, + }, + { + key: "registeredPlugins", + get: function () { + var n = s.plugins, + r = As(n, "core"), + a = As(n, "container"); + return { core: r, container: a }; + }, + }, + { + key: "checkVersionSupport", + value: function (n) { + var r = n.prototype, + a = r.supportedVersion, + o = r.name; + if (!a || !a.min) + return ( + fe.warn( + "Loader", + "missing version information for ".concat(o) + ), + !1 + ); + var l = a.max ? $i.parse(a.max) : $i.parse(a.min).inc("minor"), + u = $i.parse(a.min); + return $i.parse(e).satisfies(u, l) + ? !0 + : (fe.warn( + "Loader", + "unsupported plugin " + .concat(o, ": Clappr version ") + .concat(e, " does not match required range [") + .concat(u, ",") + .concat(l, ")") + ), + !1); + }, + }, + { + key: "registerPlugin", + value: function (n) { + if (!n || !n.prototype.name) + return ( + fe.warn( + "Loader", + "missing information to register plugin: ".concat(n) + ), + !1 + ); + t.checkVersionSupport(n); + var r = s.plugins; + if (!r) return !1; + var a = r[n.prototype.name]; + return ( + a && + fe.warn( + "Loader", + "overriding plugin entry: " + .concat(n.prototype.name, " - ") + .concat(a) + ), + (r[n.prototype.name] = n), + !0 + ); + }, + }, + { + key: "registerPlayback", + value: function (n) { + if (!n || !n.prototype.name) return !1; + t.checkVersionSupport(n); + var r = s.playbacks, + a = r.findIndex(function (l) { + return l.prototype.name === n.prototype.name; + }); + if (a >= 0) { + var o = r[a]; + r.splice(a, 1), + fe.warn( + "Loader", + "overriding playback entry: " + .concat(o.name, " - ") + .concat(o) + ); + } + return (s.playbacks = [n].concat(Qt(r))), !0; + }, + }, + { + key: "unregisterPlugin", + value: function (n) { + if (!n) return !1; + var r = s.plugins, + a = r[n]; + return a ? (delete r[n], !0) : !1; + }, + }, + { + key: "unregisterPlayback", + value: function (n) { + if (!n) return !1; + var r = s.playbacks, + a = r.findIndex(function (o) { + return o.prototype.name === n; + }); + return a < 0 ? !1 : (r.splice(a, 1), (s.playbacks = r), !0); + }, + }, + { + key: "clearPlugins", + value: function () { + s.plugins = {}; + }, + }, + { + key: "clearPlaybacks", + value: function () { + s.playbacks = []; + }, + }, + ] + ); + })(); + })(), + tu = ss().replace(/\/[^/]+$/, ""), + ys = (function (s) { + function e(t) { + var i; + ve(this, e), (i = xe(this, e, [t])); + var n = { recycleVideo: !0 }, + r = { + playerId: ei(""), + persistConfig: !0, + width: 640, + height: 360, + baseUrl: tu, + allowUserInteraction: ee.isMobile, + includeResetStyle: !0, + playback: n, + }; + (i._options = te.extend(!0, r, t)), + (i.options.sources = i._normalizeSources(t)), + i.options.chromeless || (i.options.allowUserInteraction = !0), + i.options.allowUserInteraction || + (i.options.disableKeyboardShortcuts = !0), + i._registerOptionEventListeners(i.options.events), + (i._coreFactory = new Jl(i)); + var a = i._getParentElement(i.options); + return a && i.attachTo(a), i; + } + return ( + we(e, s), + Ee(e, [ + { + key: "loader", + get: function () { + return ( + this._loader || + (this._loader = new ct( + this.options.plugins || {}, + this.options.playerId + )), + this._loader + ); + }, + set: function (i) { + this._loader = i; + }, + }, + { + key: "ended", + get: function () { + return this.core.activeContainer.ended; + }, + }, + { + key: "buffering", + get: function () { + return this.core.activeContainer.buffering; + }, + }, + { + key: "isReady", + get: function () { + return !!this._ready; + }, + }, + { + key: "eventsMapping", + get: function () { + return { + onReady: A.PLAYER_READY, + onResize: A.PLAYER_RESIZE, + onPlay: A.PLAYER_PLAY, + onPause: A.PLAYER_PAUSE, + onStop: A.PLAYER_STOP, + onEnded: A.PLAYER_ENDED, + onSeek: A.PLAYER_SEEK, + onError: A.PLAYER_ERROR, + onTimeUpdate: A.PLAYER_TIMEUPDATE, + onVolumeUpdate: A.PLAYER_VOLUMEUPDATE, + onSubtitleAvailable: A.PLAYER_SUBTITLE_AVAILABLE, + }; + }, + }, + { + key: "_getParentElement", + value: function (i) { + var n = i.parentId, + r = i.parent; + return n ? document.querySelector(n) : r; + }, + }, + { + key: "attachTo", + value: function (i) { + return ( + (this.options.parentElement = i), + (this.core = this._coreFactory.create()), + this._addEventListeners(), + this + ); + }, + }, + { + key: "_addEventListeners", + value: function () { + return ( + this.core.isReady + ? this._onReady() + : this.listenToOnce(this.core, A.CORE_READY, this._onReady), + this.listenTo( + this.core, + A.CORE_ACTIVE_CONTAINER_CHANGED, + this._containerChanged + ), + this.listenTo( + this.core, + A.CORE_FULLSCREEN, + this._onFullscreenChange + ), + this.listenTo(this.core, A.CORE_RESIZE, this._onResize), + this + ); + }, + }, + { + key: "_addContainerEventListeners", + value: function () { + var i = this.core.activeContainer; + return ( + i && + (this.listenTo(i, A.CONTAINER_PLAY, this._onPlay), + this.listenTo(i, A.CONTAINER_PAUSE, this._onPause), + this.listenTo(i, A.CONTAINER_STOP, this._onStop), + this.listenTo(i, A.CONTAINER_ENDED, this._onEnded), + this.listenTo(i, A.CONTAINER_SEEK, this._onSeek), + this.listenTo(i, A.CONTAINER_ERROR, this._onError), + this.listenTo(i, A.CONTAINER_TIMEUPDATE, this._onTimeUpdate), + this.listenTo(i, A.CONTAINER_VOLUME, this._onVolumeUpdate), + this.listenTo( + i, + A.CONTAINER_SUBTITLE_AVAILABLE, + this._onSubtitleAvailable + )), + this + ); + }, + }, + { + key: "_registerOptionEventListeners", + value: function () { + var i = this, + n = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}, + r = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : {}, + a = Object.keys(n).length > 0; + return ( + a && + Object.keys(r).forEach(function (o) { + var l = i.eventsMapping[o]; + l && i.off(l, r[o]); + }), + Object.keys(n).forEach(function (o) { + var l = i.eventsMapping[o]; + if (l) { + var u = n[o]; + (u = typeof u == "function" && u), u && i.on(l, u); + } + }), + this + ); + }, + }, + { + key: "_containerChanged", + value: function () { + this.stopListening(), this._addEventListeners(); + }, + }, + { + key: "_onReady", + value: function () { + (this._ready = !0), + this._addContainerEventListeners(), + this.trigger(A.PLAYER_READY); + }, + }, + { + key: "_onFullscreenChange", + value: function (i) { + this.trigger(A.PLAYER_FULLSCREEN, i); + }, + }, + { + key: "_onVolumeUpdate", + value: function (i) { + this.trigger(A.PLAYER_VOLUMEUPDATE, i); + }, + }, + { + key: "_onSubtitleAvailable", + value: function () { + this.trigger(A.PLAYER_SUBTITLE_AVAILABLE); + }, + }, + { + key: "_onResize", + value: function (i) { + this.trigger(A.PLAYER_RESIZE, i); + }, + }, + { + key: "_onPlay", + value: function (i) { + var n = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : {}; + this.trigger(A.PLAYER_PLAY, n); + }, + }, + { + key: "_onPause", + value: function (i) { + var n = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : {}; + this.trigger(A.PLAYER_PAUSE, n); + }, + }, + { + key: "_onStop", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + this.trigger(A.PLAYER_STOP, this.getCurrentTime(), i); + }, + }, + { + key: "_onEnded", + value: function () { + this.trigger(A.PLAYER_ENDED); + }, + }, + { + key: "_onSeek", + value: function (i) { + this.trigger(A.PLAYER_SEEK, i); + }, + }, + { + key: "_onTimeUpdate", + value: function (i) { + this.trigger(A.PLAYER_TIMEUPDATE, i); + }, + }, + { + key: "_onError", + value: function (i) { + this.trigger(A.PLAYER_ERROR, i); + }, + }, + { + key: "_normalizeSources", + value: function (i) { + var n = i.sources || (i.source !== void 0 ? [i.source] : []); + return n.length === 0 ? [{ source: "", mimeType: "" }] : n; + }, + }, + { + key: "resize", + value: function (i) { + return this.core.resize(i), this; + }, + }, + { + key: "load", + value: function (i, n, r) { + return ( + r !== void 0 && this.configure({ autoPlay: !!r }), + this.core.load(i, n), + this + ); + }, + }, + { + key: "destroy", + value: function () { + return this.stopListening(), this.core.destroy(), this; + }, + }, + { + key: "consent", + value: function (i) { + this.core.getCurrentPlayback().consent(i); + }, + }, + { + key: "play", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + return this.core.activeContainer.play(i), this; + }, + }, + { + key: "pause", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + return this.core.activeContainer.pause(i), this; + }, + }, + { + key: "stop", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + return this.core.activeContainer.stop(i), this; + }, + }, + { + key: "seek", + value: function (i) { + return this.core.activeContainer.seek(i), this; + }, + }, + { + key: "seekPercentage", + value: function (i) { + return this.core.activeContainer.seekPercentage(i), this; + }, + }, + { + key: "mute", + value: function () { + return this.core.activePlayback.mute(), this; + }, + }, + { + key: "unmute", + value: function () { + return this.core.activePlayback.unmute(), this; + }, + }, + { + key: "isPlaying", + value: function () { + return this.core.activeContainer.isPlaying(); + }, + }, + { + key: "isDvrEnabled", + value: function () { + return this.core.activeContainer.isDvrEnabled(); + }, + }, + { + key: "isDvrInUse", + value: function () { + return this.core.activeContainer.isDvrInUse(); + }, + }, + { + key: "configure", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + return ( + this._registerOptionEventListeners( + i.events, + this.options.events + ), + this.core.configure(i), + this + ); + }, + }, + { + key: "getPlugin", + value: function (i) { + var n = this.core.plugins.concat( + this.core.activeContainer.plugins + ); + return n.filter(function (r) { + return r.name === i; + })[0]; + }, + }, + { + key: "getCurrentTime", + value: function () { + return this.core.activeContainer.getCurrentTime(); + }, + }, + { + key: "getStartTimeOffset", + value: function () { + return this.core.activeContainer.getStartTimeOffset(); + }, + }, + { + key: "getDuration", + value: function () { + return this.core.activeContainer.getDuration(); + }, + }, + ]) + ); + })(At); + Object.assign(ys.prototype, It); + var yt = (function (s) { + function e(t) { + var i; + return ( + ve(this, e), + (i = xe(this, e, [t.options])), + (i.container = t), + (i.enabled = !0), + i.bindEvents(), + i + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "playerError", + get: function () { + return this.container.playerError; + }, + }, + { + key: "enable", + value: function () { + this.enabled || (this.bindEvents(), (this.enabled = !0)); + }, + }, + { + key: "disable", + value: function () { + this.enabled && (this.stopListening(), (this.enabled = !1)); + }, + }, + { key: "bindEvents", value: function () {} }, + { + key: "destroy", + value: function () { + this.stopListening(); + }, + }, + ]) + ); + })(At); + Object.assign(yt.prototype, It), + (yt.extend = function (s) { + return Jt(yt, s); + }), + (yt.type = "container"); + var vt = (function (s) { + function e(t) { + var i; + return ( + ve(this, e), + (i = xe(this, e, [t.options])), + (i.core = t), + (i.enabled = !0), + i.bindEvents(), + i + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "playerError", + get: function () { + return this.core.playerError; + }, + }, + { key: "bindEvents", value: function () {} }, + { + key: "enable", + value: function () { + this.enabled || (this.bindEvents(), (this.enabled = !0)); + }, + }, + { + key: "disable", + value: function () { + this.enabled && (this.stopListening(), (this.enabled = !1)); + }, + }, + { + key: "getExternalInterface", + value: function () { + return {}; + }, + }, + { + key: "destroy", + value: function () { + this.stopListening(); + }, + }, + ]) + ); + })(At); + Object.assign(vt.prototype, It), + (vt.extend = function (s) { + return Jt(vt, s); + }), + (vt.type = "core"); + var Rt = (function (s) { + function e(t) { + var i; + return ( + ve(this, e), + (i = xe(this, e, [t.options])), + (i.container = t), + (i.enabled = !0), + i.bindEvents(), + i + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "playerError", + get: function () { + return this.container.playerError; + }, + }, + { + key: "enable", + value: function () { + this.enabled || + (this.bindEvents(), this.$el.show(), (this.enabled = !0)); + }, + }, + { + key: "disable", + value: function () { + this.stopListening(), this.$el.hide(), (this.enabled = !1); + }, + }, + { key: "bindEvents", value: function () {} }, + ]) + ); + })(ii); + Object.assign(Rt.prototype, It), + (Rt.extend = function (s) { + return Jt(Rt, s); + }), + (Rt.type = "container"); + var iu = `<% for (var i = 0; i < tracks.length; i++) { %> + <track data-html5-video-track="<%= i %>" kind="<%= tracks[i].kind %>" label="<%= tracks[i].label %>" srclang="<%= tracks[i].lang %>" src="<%= tracks[i].src %>"> +<% }; %> +`, + nu = `[data-html5-video] { + position: absolute; + height: 100%; + width: 100%; + display: block; } +`, + ni = { + mp4: [ + "avc1.42E01E", + "avc1.58A01E", + "avc1.4D401E", + "avc1.64001E", + "mp4v.20.8", + "mp4v.20.240", + "mp4a.40.2", + ].map(function (s) { + return 'video/mp4; codecs="' + s + ', mp4a.40.2"'; + }), + ogg: [ + 'video/ogg; codecs="theora, vorbis"', + 'video/ogg; codecs="dirac"', + 'video/ogg; codecs="theora, speex"', + ], + "3gpp": ['video/3gpp; codecs="mp4v.20.8, samr"'], + webm: ['video/webm; codecs="vp8, vorbis"'], + mkv: ['video/x-matroska; codecs="theora, vorbis"'], + m3u8: ["application/x-mpegurl"], + }; + (ni.ogv = ni.ogg), (ni["3gp"] = ni["3gpp"]); + var vi = { + wav: ["audio/wav"], + mp3: ["audio/mp3", 'audio/mpeg;codecs="mp3"'], + aac: ['audio/mp4;codecs="mp4a.40.5"'], + oga: ["audio/ogg"], + }, + ru = Object.keys(vi).reduce(function (s, e) { + return [].concat(Qt(s), Qt(vi[e])); + }, []), + vs = { code: "unknown", message: "unknown" }, + st = (function (s) { + function e() { + var t; + ve(this, e); + for (var i = arguments.length, n = new Array(i), r = 0; r < i; r++) + n[r] = arguments[r]; + (t = xe(this, e, [].concat(n))), + (t._destroyed = !1), + (t._loadStarted = !1), + (t._isBuffering = !1), + (t._playheadMoving = !1), + (t._playheadMovingTimer = null), + (t._stopped = !1), + (t._ccTrackId = -1), + (t._playheadMovingCheckEnabled = + !t.options.disablePlayheadMovingCheck), + t._setupSrc(t.options.src), + (t._playheadMovingCheckInterval = + t.options.playheadMovingCheckInterval || 500), + t.options.playback || (t.options.playback = t.options || {}), + (t.options.playback.disableContextMenu = + t.options.playback.disableContextMenu || + t.options.disableVideoTagContextMenu), + (t._minDvrSize = t.isValidMinimumDVRSizeConfig + ? t.minimumDVRSizeConfig + : 60); + var a = t.options.playback, + o = a.preload || (ee.isSafari ? "auto" : t.options.preload), + l; + return ( + t.options.poster && + (typeof t.options.poster == "string" + ? (l = t.options.poster) + : typeof t.options.poster.url == "string" && + (l = t.options.poster.url)), + te.extend(!0, t.el, { + muted: t.options.mute, + defaultMuted: t.options.mute, + loop: t.options.loop, + poster: l, + preload: o || "metadata", + crossOrigin: a.crossOrigin, + "x-webkit-playsinline": a.playInline, + }), + (a.controls || t.options.useVideoTagDefaultControls) && + t.$el.attr("controls", ""), + a.playInline && t.$el.attr({ playsinline: "playsinline" }), + a.crossOrigin && t.$el.attr({ crossorigin: a.crossOrigin }), + (t.settings = { default: ["seekbar"] }), + (t.settings.left = ["playpause", "position", "duration"]), + (t.settings.right = ["fullscreen", "volume", "hd-indicator"]), + a.externalTracks && t._setupExternalTracks(a.externalTracks), + t.options.autoPlay && t.attemptAutoPlay(), + t + ); + } + return ( + we(e, s), + Ee(e, [ + { + key: "name", + get: function () { + return "html5_video"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "tagName", + get: function () { + return this.isAudioOnly ? "audio" : "video"; + }, + }, + { + key: "isAudioOnly", + get: function () { + var i = this.options.src, + n = e._mimeTypesForUrl(i, vi, this.options.mimeType); + return ( + (this.options.playback && this.options.playback.audioOnly) || + this.options.audioOnly || + ru.indexOf(n[0]) >= 0 + ); + }, + }, + { + key: "attributes", + get: function () { + return { "data-html5-video": "" }; + }, + }, + { + key: "events", + get: function () { + return { + canplay: "_onCanPlay", + canplaythrough: "_handleBufferingEvents", + durationchange: "_onDurationChange", + ended: "_onEnded", + error: "_onError", + loadeddata: "_onLoadedData", + loadedmetadata: "_onLoadedMetadata", + pause: "_onPause", + playing: "_onPlaying", + progress: "_onProgress", + seeking: "_onSeeking", + seeked: "_onSeeked", + stalled: "_handleBufferingEvents", + timeupdate: "_onTimeUpdate", + waiting: "_onWaiting", + enterpictureinpicture: "_onEnterPiP", + leavepictureinpicture: "_onExitPiP", + }; + }, + }, + { + key: "ended", + get: function () { + return this.el.ended; + }, + }, + { + key: "buffering", + get: function () { + return this._isBuffering; + }, + }, + { + key: "isPiPActive", + get: function () { + return this.el === document.pictureInPictureElement; + }, + }, + { + key: "isLive", + get: function () { + return this.getPlaybackType() === ge.LIVE; + }, + }, + { + key: "dvrEnabled", + get: function () { + return this.getDuration() >= this._minDvrSize && this.isLive; + }, + }, + { + key: "minimumDVRSizeConfig", + get: function () { + return ( + this.options.playback && this.options.playback.minimumDvrSize + ); + }, + }, + { + key: "isValidMinimumDVRSizeConfig", + get: function () { + return ( + typeof this.minimumDVRSizeConfig < "u" && + typeof this.minimumDVRSizeConfig == "number" + ); + }, + }, + { + key: "sourceMedia", + get: function () { + return this._src; + }, + }, + { + key: "configure", + value: function (i) { + Bt(mt(e.prototype), "configure", this).call(this, i), + (this.el.loop = !!i.loop); + }, + }, + { + key: "attemptAutoPlay", + value: function () { + var i = this; + this.canAutoPlay(function (n, r) { + r && + fe.warn(i.name, "autoplay error.", { result: n, error: r }), + n && + setTimeout(function () { + return !i._destroyed && i.play(); + }, 0); + }); + }, + }, + { + key: "canAutoPlay", + value: function (i) { + if (this.options.disableCanAutoPlay) { + i(!0, null); + return; + } + var n = { + timeout: this.options.autoPlayTimeout || 500, + inline: this.options.playback.playInline || !1, + muted: this.options.mute || !1, + }; + ee.isMobile && ti.options.recycleVideo && (n.element = this.el), + os(i, n); + }, + }, + { + key: "_setupExternalTracks", + value: function (i) { + this._externalTracks = i.map(function (n) { + return { + kind: n.kind || "subtitles", + label: n.label, + lang: n.lang, + src: n.src, + }; + }); + }, + }, + { + key: "load", + value: function (i) { + this._setupSrc(i); + }, + }, + { + key: "_setupSrc", + value: function (i) { + this.el.src !== i && + ((this._ccIsSetup = !1), + (this.el.src = i), + (this._src = this.el.src)); + }, + }, + { + key: "_onLoadedMetadata", + value: function (i) { + this._handleBufferingEvents(), + this.trigger(A.PLAYBACK_LOADEDMETADATA, { + duration: i.target.duration, + data: i, + }), + this._updateSettings(); + var n = + typeof this._options.autoSeekFromUrl > "u" || + this._options.autoSeekFromUrl; + this.getPlaybackType() !== ge.LIVE && + n && + this._checkInitialSeek(); + }, + }, + { + key: "_onDurationChange", + value: function () { + this._updateSettings(), this._onTimeUpdate(), this._onProgress(); + }, + }, + { + key: "_updateSettings", + value: function () { + this.getPlaybackType() === ge.VOD || + this.getPlaybackType() === ge.AOD + ? (this.settings.left = ["playpause", "position", "duration"]) + : (this.settings.left = ["playstop"]), + (this.settings.seekEnabled = this.isSeekEnabled()), + this.trigger(A.PLAYBACK_SETTINGSUPDATE); + }, + }, + { + key: "isSeekEnabled", + value: function () { + return isFinite(this.getDuration()); + }, + }, + { + key: "getPlaybackType", + value: function () { + var i = this.tagName === "audio" ? ge.AOD : ge.VOD; + return [0, void 0, 1 / 0].indexOf(this.el.duration) >= 0 + ? ge.LIVE + : i; + }, + }, + { + key: "isHighDefinitionInUse", + value: function () { + return !1; + }, + }, + { + key: "consent", + value: function (i) { + var n = this; + if (this.isPlaying() || this.el._consented) + Bt(mt(e.prototype), "consent", this).call(this, i); + else { + var r = function a() { + n.el.removeEventListener("loadedmetadata", a, !1), + n.el.removeEventListener("error", a, !1), + (n.el._consented = !0), + Bt(mt(e.prototype), "consent", n).call(n, i); + }; + this.el.addEventListener("loadedmetadata", r, !1), + this.el.addEventListener("error", r, !1), + this.el.load(); + } + }, + }, + { + key: "play", + value: function () { + var i = this; + this.trigger(A.PLAYBACK_PLAY_INTENT), + (this._stopped = !1), + this._setupSrc(this._src), + this._handleBufferingEvents(); + var n = this.el.play(); + return ( + n && + n.catch && + n.catch(function (r) { + return fe.warn(i.name, "HTML5 play failed", r); + }), + n + ); + }, + }, + { + key: "pause", + value: function () { + this.el.pause(); + }, + }, + { + key: "stop", + value: function () { + this.pause(), + (this._stopped = !0), + this.el.removeAttribute("src"), + this.el.load(), + this._stopPlayheadMovingChecks(), + this._handleBufferingEvents(), + this.trigger(A.PLAYBACK_STOP); + }, + }, + { + key: "volume", + value: function (i) { + i === 0 + ? (this.$el.attr({ muted: "true" }), (this.el.muted = !0)) + : (this.$el.attr({ muted: null }), + (this.el.muted = !1), + (this.el.volume = i / 100)); + }, + }, + { + key: "mute", + value: function () { + this.el.muted = !0; + }, + }, + { + key: "unmute", + value: function () { + this.el.muted = !1; + }, + }, + { + key: "isMuted", + value: function () { + return this.el.muted === !0 || this.el.volume === 0; + }, + }, + { + key: "isPlaying", + value: function () { + return !this.el.paused && !this.el.ended; + }, + }, + { + key: "isReady", + get: function () { + return this._isReadyState; + }, + }, + { + key: "_startPlayheadMovingChecks", + value: function () { + this._playheadMovingTimer !== null || + !this._playheadMovingCheckEnabled || + ((this._playheadMovingTimeOnCheck = null), + this._determineIfPlayheadMoving(), + (this._playheadMovingTimer = setInterval( + this._determineIfPlayheadMoving.bind(this), + this._playheadMovingCheckInterval + ))); + }, + }, + { + key: "_stopPlayheadMovingChecks", + value: function () { + this._playheadMovingTimer !== null && + (clearInterval(this._playheadMovingTimer), + (this._playheadMovingTimer = null), + (this._playheadMoving = !1)); + }, + }, + { + key: "_determineIfPlayheadMoving", + value: function () { + var i = this._playheadMovingTimeOnCheck, + n = this.el.currentTime; + (this._playheadMoving = i !== n), + (this._playheadMovingTimeOnCheck = n), + this._handleBufferingEvents(); + }, + }, + { + key: "_onWaiting", + value: function () { + (this._loadStarted = !0), this._handleBufferingEvents(); + }, + }, + { + key: "_onLoadedData", + value: function () { + (this._loadStarted = !0), this._handleBufferingEvents(); + }, + }, + { + key: "_onCanPlay", + value: function () { + this._handleBufferingEvents(); + }, + }, + { + key: "_onPlaying", + value: function () { + this._checkForClosedCaptions(), + this._startPlayheadMovingChecks(), + this._handleBufferingEvents(), + this.trigger(A.PLAYBACK_PLAY); + }, + }, + { + key: "_onPause", + value: function () { + this.dvrEnabled && this._updateDvr(!0), + this._stopPlayheadMovingChecks(), + this._handleBufferingEvents(), + this.trigger(A.PLAYBACK_PAUSE); + }, + }, + { + key: "_onSeeking", + value: function () { + var i = this.getCurrentTime(); + this.dvrEnabled && this._updateDvr(i < this.getDuration() - 3), + this.trigger(A.PLAYBACK_SEEK, i), + this._handleBufferingEvents(); + }, + }, + { + key: "_onSeeked", + value: function () { + this._handleBufferingEvents(), this.trigger(A.PLAYBACK_SEEKED); + }, + }, + { + key: "_onEnded", + value: function () { + this._handleBufferingEvents(), + this.trigger(A.PLAYBACK_ENDED, this.name); + }, + }, + { + key: "_onEnterPiP", + value: function () { + this.trigger(A.PLAYBACK_PIP_ENTER, this.name); + }, + }, + { + key: "_onExitPiP", + value: function () { + this.trigger(A.PLAYBACK_PIP_EXIT, this.name); + }, + }, + { + key: "enterPiP", + value: function () { + var i = this; + this.el + .requestPictureInPicture() + .then(function () { + fe.info(i.name, "enter PIP success"); + }) + .catch(function (n) { + fe.warn(i.name, "enter PIP failed", n); + }); + }, + }, + { + key: "exitPiP", + value: function () { + var i = this; + document + .exitPictureInPicture() + .then(function () { + fe.info(i.name, "exit PIP success"); + }) + .catch(function (n) { + fe.warn(i.name, "exit PIP failed", n); + }); + }, + }, + { + key: "_handleBufferingEvents", + value: function () { + var i = this._loadStarted && !this.el.ended && !this._stopped, + n = this.el.readyState < this.el.HAVE_FUTURE_DATA, + r = !this.el.ended && !this.el.paused && !this._playheadMoving, + a = i && n; + this._playheadMovingCheckEnabled && (a = a || (i && r)), + this._isBuffering !== a && + ((this._isBuffering = a), + a + ? this.trigger(A.PLAYBACK_BUFFERING, this.name) + : this.trigger(A.PLAYBACK_BUFFERFULL, this.name)); + }, + }, + { + key: "_onError", + value: function () { + var i = this.el.error || vs, + n = i.code, + r = i.message, + a = n === vs.code, + o = this.createError({ + code: n, + description: r, + raw: this.el.error, + level: a ? Lt.Levels.WARN : Lt.Levels.FATAL, + }); + a + ? fe.warn(this.name, "HTML5 unknown error: ", o) + : this.trigger(A.PLAYBACK_ERROR, o); + }, + }, + { + key: "destroy", + value: function () { + (this._destroyed = !0), + this._stopPlayheadMovingChecks(), + this.handleTextTrackChange && + this.el.textTracks.removeEventListener( + "change", + this.handleTextTrackChange + ), + this.$el.off("contextmenu"), + Bt(mt(e.prototype), "destroy", this).call(this), + this.el.removeAttribute("src"), + this.el.load(), + (this._src = null), + ti.garbage(this.el); + }, + }, + { + key: "_updateDvr", + value: function (i) { + this.trigger(A.PLAYBACK_DVR, i), + this.trigger(A.PLAYBACK_STATS_ADD, { dvr: i }); + }, + }, + { + key: "seek", + value: function (i) { + i < 0 && + (fe.warn( + "Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point." + ), + (i = this.getDuration())), + (i += this.el.seekable.start(0)), + (this.el.currentTime = i); + }, + }, + { + key: "seekPercentage", + value: function (i) { + var n = this.el.duration * (i / 100); + this.seek(n); + }, + }, + { + key: "_checkInitialSeek", + value: function () { + var i = rs(); + i !== 0 && this.seek(i); + }, + }, + { + key: "getCurrentTime", + value: function () { + return this.el.currentTime; + }, + }, + { + key: "getDuration", + value: function () { + if (this.isLive) { + if (this.el.seekable.length > 0) + return this.el.seekable.end(0) - this.el.seekable.start(0); + this._scheduleUpdateSettingsCheck(); + } + return this.el.duration; + }, + }, + { + key: "_scheduleUpdateSettingsCheck", + value: function () { + var i = this; + this._updateSettingsCheckInFlight || + (this._updateSettingsCheckInFlight = setTimeout(function () { + i._updateSettings(), (i._updateSettingsCheckInFlight = null); + }, 1e3)); + }, + }, + { + key: "_onTimeUpdate", + value: function () { + var i = this.isLive ? this.getDuration() : this.el.duration; + this.trigger( + A.PLAYBACK_TIMEUPDATE, + { current: this.el.currentTime, total: i }, + this.name + ); + }, + }, + { + key: "_onProgress", + value: function () { + if (this.el.buffered.length) { + for (var i = [], n = 0, r = 0; r < this.el.buffered.length; r++) + (i = [].concat(Qt(i), [ + { + start: this.el.buffered.start(r), + end: this.el.buffered.end(r), + }, + ])), + this.el.currentTime >= i[r].start && + this.el.currentTime <= i[r].end && + (n = r); + var a = { + start: i[n].start, + current: i[n].end, + total: this.el.duration, + }; + this.trigger(A.PLAYBACK_PROGRESS, a, i); + } + }, + }, + { + key: "_typeFor", + value: function (i) { + var n = e._mimeTypesForUrl(i, ni, this.options.mimeType); + n.length === 0 && + (n = e._mimeTypesForUrl(i, vi, this.options.mimeType)); + var r = n[0] || ""; + return r.split(";")[0]; + }, + }, + { + key: "_ready", + value: function () { + this._isReadyState || + ((this._isReadyState = !0), + this.trigger(A.PLAYBACK_READY, this.name)); + }, + }, + { + key: "_checkForClosedCaptions", + value: function () { + if (this.isHTML5Video && !this._ccIsSetup) { + if (this.hasClosedCaptionsTracks) { + this.trigger(A.PLAYBACK_SUBTITLE_AVAILABLE); + var i = this.closedCaptionsTrackId; + (this.closedCaptionsTrackId = i), + (this.handleTextTrackChange = + this._handleTextTrackChange.bind(this)), + this.el.textTracks.addEventListener( + "change", + this.handleTextTrackChange + ); + } + this._ccIsSetup = !0; + } + }, + }, + { + key: "_handleTextTrackChange", + value: function () { + var i = this.closedCaptionsTracks, + n = i.find(function (r) { + return r.track.mode === "showing"; + }) || { id: -1 }; + this._ccTrackId !== n.id && + ((this._ccTrackId = n.id), + this.trigger(A.PLAYBACK_SUBTITLE_CHANGED, { id: n.id })); + }, + }, + { + key: "isHTML5Video", + get: function () { + return this.name === e.prototype.name; + }, + }, + { + key: "closedCaptionsTracks", + get: function () { + var i = 0, + n = function () { + return i++; + }, + r = this.el.textTracks ? Array.from(this.el.textTracks) : []; + return r + .filter(function (a) { + return a.kind === "subtitles" || a.kind === "captions"; + }) + .map(function (a) { + return { id: n(), name: a.label, track: a }; + }); + }, + }, + { + key: "closedCaptionsTrackId", + get: function () { + return this._ccTrackId; + }, + set: function (i) { + if (Mi(i)) { + var n = this.closedCaptionsTracks, + r; + (i !== -1 && + ((r = n.find(function (a) { + return a.id === i; + })), + !r || r.track.mode === "showing")) || + (n + .filter(function (a) { + return a.track.mode !== "hidden"; + }) + .forEach(function (a) { + return (a.track.mode = "hidden"); + }), + r && (r.track.mode = "showing"), + (this._ccTrackId = i), + this.trigger(A.PLAYBACK_SUBTITLE_CHANGED, { id: i })); + } + }, + }, + { + key: "template", + get: function () { + return He(iu); + }, + }, + { + key: "render", + value: function () { + this.options.playback.disableContextMenu && + this.$el.on("contextmenu", function () { + return !1; + }), + this._externalTracks && + this._externalTracks.length > 0 && + this.$el.html( + this.template({ tracks: this._externalTracks }) + ), + this._ready(); + var i = Ue.getStyleFor(nu.toString(), { + baseUrl: this.options.baseUrl, + }); + return this.$el.append(i[0]), this; + }, + }, + ]) + ); + })(ge); + (st._mimeTypesForUrl = function () { + var s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", + e = arguments.length > 1 ? arguments[1] : void 0, + t = arguments.length > 2 ? arguments[2] : void 0, + i = (s.split("?")[0].match(/.*\.(.*)$/) || [])[1], + n = t || (i && e[i.toLowerCase()]) || []; + return n.constructor === Array ? n : [n]; + }), + (st._canPlay = function (s, e, t, i) { + var n = st._mimeTypesForUrl(t, e, i), + r = document.createElement(s); + return !!n.filter(function (a) { + return !!r.canPlayType(a).replace(/no/, ""); + })[0]; + }), + (st.canPlay = function (s, e) { + return st._canPlay("audio", vi, s, e) || st._canPlay("video", ni, s, e); + }); + var In = (function (s) { + function e() { + return ve(this, e), xe(this, e, arguments); + } + return ( + we(e, s), + Ee(e, [ + { + key: "name", + get: function () { + return "html5_audio"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "tagName", + get: function () { + return "audio"; + }, + }, + { + key: "isAudioOnly", + get: function () { + return !0; + }, + }, + { + key: "updateSettings", + value: function () { + (this.settings.left = ["playpause", "position", "duration"]), + (this.settings.seekEnabled = this.isSeekEnabled()), + this.trigger(A.PLAYBACK_SETTINGSUPDATE); + }, + }, + { + key: "getPlaybackType", + value: function () { + return ge.AOD; + }, + }, + ]) + ); + })(st); + In.canPlay = function (s, e) { + var t = { + wav: ["audio/wav"], + mp3: ["audio/mp3", 'audio/mpeg;codecs="mp3"'], + aac: ['audio/mp4;codecs="mp4a.40.5"'], + oga: ["audio/ogg"], + }; + return st._canPlay("audio", t, s, e); + }; + var su = `[data-html-img] { + max-width: 100%; + max-height: 100%; } +`, + Rn = (function (s) { + function e(t) { + var i; + return ve(this, e), (i = xe(this, e, [t])), (i.el.src = t.src), i; + } + return ( + we(e, s), + Ee(e, [ + { + key: "name", + get: function () { + return "html_img"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "tagName", + get: function () { + return "img"; + }, + }, + { + key: "attributes", + get: function () { + return { "data-html-img": "" }; + }, + }, + { + key: "events", + get: function () { + return { load: "_onLoad", abort: "_onError", error: "_onError" }; + }, + }, + { + key: "getPlaybackType", + value: function () { + return ge.NO_OP; + }, + }, + { + key: "render", + value: function () { + var i = Ue.getStyleFor(su.toString(), { + baseUrl: this.options.baseUrl, + }); + return ( + this.$el.append(i[0]), + this.trigger(A.PLAYBACK_READY, this.name), + this + ); + }, + }, + { + key: "_onLoad", + value: function () { + this.trigger(A.PLAYBACK_ENDED, this.name); + }, + }, + { + key: "_onError", + value: function (i) { + var n = i.type === "error" ? "load error" : "loading aborted"; + this.trigger(A.PLAYBACK_ERROR, { message: n }, this.name); + }, + }, + ]) + ); + })(ge); + Rn.canPlay = function (s) { + return /\.(png|jpg|jpeg|gif|bmp|tiff|pgm|pnm|webp)(|\?.*)$/i.test(s); + }; + var au = `<canvas data-no-op-canvas></canvas> +<p data-no-op-msg><%=message%></p><p> +</p>`, + ou = `[data-no-op] { + position: absolute; + height: 100%; + width: 100%; + text-align: center; } + +[data-no-op] p[data-no-op-msg] { + position: absolute; + text-align: center; + font-size: 25px; + left: 0; + right: 0; + color: white; + padding: 10px; + /* center vertically */ + top: 50%; + transform: translateY(-50%); + max-height: 100%; + overflow: auto; } + +[data-no-op] canvas[data-no-op-canvas] { + background-color: #777; + height: 100%; + width: 100%; } +`, + Es = (function (s) { + function e() { + var t; + ve(this, e); + for (var i = arguments.length, n = new Array(i), r = 0; r < i; r++) + n[r] = arguments[r]; + return (t = xe(this, e, [].concat(n))), (t._noiseFrameNum = -1), t; + } + return ( + we(e, s), + Ee(e, [ + { + key: "name", + get: function () { + return "no_op"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "template", + get: function () { + return He(au); + }, + }, + { + key: "attributes", + get: function () { + return { "data-no-op": "" }; + }, + }, + { + key: "render", + value: function () { + var i = + this.options.playbackNotSupportedMessage || + this.i18n.t("playback_not_supported"), + n = Ue.getStyleFor(ou.toString(), { + baseUrl: this.options.baseUrl, + }); + this.$el.append(n[0]), + this.$el.html(this.template({ message: i })), + this.trigger(A.PLAYBACK_READY, this.name); + var r = !!( + this.options.poster && this.options.poster.showForNoOp + ); + return (this.options.autoPlay || !r) && this._animate(), this; + }, + }, + { + key: "_noise", + value: function () { + if ( + ((this._noiseFrameNum = (this._noiseFrameNum + 1) % 5), + !this._noiseFrameNum) + ) { + var i = this.context.createImageData( + this.context.canvas.width, + this.context.canvas.height + ), + n; + try { + n = new Uint32Array(i.data.buffer); + } catch { + n = new Uint32Array( + this.context.canvas.width * this.context.canvas.height * 4 + ); + for (var r = i.data, a = 0; a < r.length; a++) n[a] = r[a]; + } + for ( + var o = n.length, + l = Math.random() * 6 + 4, + u = 0, + c = 0, + d = 0; + d < o; + + ) { + if (u < 0) { + u = l * Math.random(); + var f = Math.pow(Math.random(), 0.4); + c = (255 * f) << 24; + } + (u -= 1), (n[d++] = c); + } + this.context.putImageData(i, 0, 0); + } + }, + }, + { + key: "_loop", + value: function () { + var i = this; + this._stop || + (this._noise(), + (this._animationHandle = ts(function () { + return i._loop(); + }))); + }, + }, + { + key: "destroy", + value: function () { + this._animationHandle && + (is(this._animationHandle), (this._stop = !0)); + }, + }, + { + key: "_animate", + value: function () { + (this.canvas = this.$el.find("canvas[data-no-op-canvas]")[0]), + (this.context = this.canvas.getContext("2d")), + this._loop(); + }, + }, + ]) + ); + })(ge); + Es.canPlay = function (s) { + return !0; + }; + var lu = (function (s) { + function e(t) { + var i; + return ve(this, e), (i = xe(this, e, [t])), i._initializeMessages(), i; + } + return ( + we(e, s), + Ee(e, [ + { + key: "name", + get: function () { + return "strings"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "t", + value: function (i) { + var n = this._language(), + r = this._messages.en, + a = (n && this._messages[n]) || r; + return a[i] || r[i] || i; + }, + }, + { + key: "_language", + value: function () { + return this.core.options.language || as(); + }, + }, + { + key: "_initializeMessages", + value: function () { + var i = { + en: { + live: "live", + back_to_live: "back to live", + disabled: "Disabled", + playback_not_supported: + "Your browser does not support the playback of this video. Please try using a different browser.", + default_error_title: "Could not play video.", + default_error_message: + "There was a problem trying to load the video.", + }, + de: { + live: "Live", + back_to_live: "Zurück zum Live-Video", + disabled: "Deaktiviert", + playback_not_supported: + "Ihr Browser unterstützt das Playback Verfahren nicht. Bitte vesuchen Sie es mit einem anderen Browser.", + default_error_title: "Video kann nicht abgespielt werden", + default_error_message: + "Es gab ein Problem beim Laden des Videos", + }, + pt: { + live: "ao vivo", + back_to_live: "voltar para o ao vivo", + disabled: "Desativado", + playback_not_supported: + "Seu navegador não suporta a reprodução deste video. Por favor, tente usar um navegador diferente.", + default_error_title: "Não foi possível reproduzir o vídeo.", + default_error_message: + "Ocorreu um problema ao tentar carregar o vídeo.", + }, + es_am: { + live: "vivo", + back_to_live: "volver en vivo", + disabled: "No disponible", + playback_not_supported: + "Su navegador no soporta la reproducción de este video. Por favor, utilice un navegador diferente.", + default_error_title: "No se puede reproducir el video.", + default_error_message: + "Se ha producido un error al cargar el video.", + }, + es: { + live: "en directo", + back_to_live: "volver al directo", + disabled: "No disponible", + playback_not_supported: + "Este navegador no es compatible para reproducir este vídeo. Utilice un navegador diferente.", + default_error_title: "No se puede reproducir el vídeo.", + default_error_message: + "Se ha producido un problema al cargar el vídeo.", + }, + ru: { + live: "прямой эфир", + back_to_live: "к прямому эфиру", + disabled: "Отключено", + playback_not_supported: + "Ваш браузер не поддерживает воспроизведение этого видео. Пожалуйста, попробуйте другой браузер.", + }, + bg: { + live: "на живо", + back_to_live: "Върни на живо", + disabled: "Изключено", + playback_not_supported: + "Вашият браузър не поддържа възпроизвеждането на това видео. Моля, пробвайте с друг браузър.", + default_error_title: "Видеото не може да се възпроизведе.", + default_error_message: + "Възникна проблем при зареждането на видеото.", + }, + fr: { + live: "en direct", + back_to_live: "retour au direct", + disabled: "Désactivé", + playback_not_supported: + "Votre navigateur ne supporte pas la lecture de cette vidéo. Merci de tenter sur un autre navigateur.", + default_error_title: "Impossible de lire la vidéo.", + default_error_message: + "Un problème est survenu lors du chargement de la vidéo.", + }, + tr: { + live: "canlı", + back_to_live: "canlı yayına dön", + disabled: "Engelli", + playback_not_supported: + "Tarayıcınız bu videoyu oynatma desteğine sahip değil. Lütfen farklı bir tarayıcı ile deneyin.", + }, + et: { + live: "Otseülekanne", + back_to_live: "Tagasi otseülekande juurde", + disabled: "Keelatud", + playback_not_supported: + "Teie brauser ei toeta selle video taasesitust. Proovige kasutada muud brauserit.", + }, + ar: { + live: "مباشر", + back_to_live: "الرجوع إلى المباشر", + disabled: "معطّل", + playback_not_supported: + "المتصفح الذي تستخدمه لا يدعم تشغيل هذا الفيديو. الرجاء إستخدام متصفح آخر.", + default_error_title: "غير قادر الى التشغيل.", + default_error_message: "حدثت مشكلة أثناء تحميل الفيديو.", + }, + zh: { + live: "直播", + back_to_live: "返回直播", + disabled: "已禁用", + playback_not_supported: + "您的浏览器不支持该视频的播放。请尝试使用另一个浏览器。", + default_error_title: "无法播放视频。", + default_error_message: "在尝试加载视频时出现了问题。", + }, + }; + (this._messages = te.extend( + !0, + i, + this.core.options.strings || {} + )), + (this._messages["de-DE"] = this._messages.de), + (this._messages["pt-BR"] = this._messages.pt), + (this._messages["en-US"] = this._messages.en), + (this._messages["bg-BG"] = this._messages.bg), + (this._messages["es-419"] = this._messages.es_am), + (this._messages["es-ES"] = this._messages.es), + (this._messages["fr-FR"] = this._messages.fr), + (this._messages["tr-TR"] = this._messages.tr), + (this._messages["et-EE"] = this._messages.et), + (this._messages["ar-IQ"] = this._messages.ar), + (this._messages["zh-CN"] = this._messages.zh); + }, + }, + ]) + ); + })(vt), + uu = (function (s) { + function e() { + return ve(this, e), xe(this, e, arguments); + } + return ( + we(e, s), + Ee(e, [ + { + key: "name", + get: function () { + return "sources"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo( + this.core, + A.CORE_CONTAINERS_CREATED, + this.onContainersCreated + ); + }, + }, + { + key: "onContainersCreated", + value: function () { + var i = + this.core.containers.filter(function (n) { + return n.playback.name !== "no_op"; + })[0] || this.core.containers[0]; + i && + this.core.containers.forEach(function (n) { + n !== i && n.destroy(); + }); + }, + }, + ]) + ); + })(vt), + cu = "0.11.3"; + ct.registerPlugin(lu), + ct.registerPlugin(uu), + ct.registerPlayback(Es), + ct.registerPlayback(Rn), + ct.registerPlayback(In), + ct.registerPlayback(st); + function De(s, e, t) { + return ( + (e = Et(e)), + pu( + s, + Ts() ? Reflect.construct(e, t || [], Et(s).constructor) : e.apply(s, t) + ) + ); + } + function Ts() { + try { + var s = !Boolean.prototype.valueOf.call( + Reflect.construct(Boolean, [], function () {}) + ); + } catch {} + return (Ts = function () { + return !!s; + })(); + } + function hu(s, e) { + var t = + s == null + ? null + : (typeof Symbol < "u" && s[Symbol.iterator]) || s["@@iterator"]; + if (t != null) { + var i, + n, + r, + a, + o = [], + l = !0, + u = !1; + try { + if (((r = (t = t.call(s)).next), e === 0)) { + if (Object(t) !== t) return; + l = !1; + } else + for ( + ; + !(l = (i = r.call(t)).done) && (o.push(i.value), o.length !== e); + l = !0 + ); + } catch (c) { + (u = !0), (n = c); + } finally { + try { + if (!l && t.return != null && ((a = t.return()), Object(a) !== a)) + return; + } finally { + if (u) throw n; + } + } + return o; + } + } + function bs(s, e) { + var t = Object.keys(s); + if (Object.getOwnPropertySymbols) { + var i = Object.getOwnPropertySymbols(s); + e && + (i = i.filter(function (n) { + return Object.getOwnPropertyDescriptor(s, n).enumerable; + })), + t.push.apply(t, i); + } + return t; + } + function Vi(s) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e] != null ? arguments[e] : {}; + e % 2 + ? bs(Object(t), !0).forEach(function (i) { + fu(s, i, t[i]); + }) + : Object.getOwnPropertyDescriptors + ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(t)) + : bs(Object(t)).forEach(function (i) { + Object.defineProperty(s, i, Object.getOwnPropertyDescriptor(t, i)); + }); + } + return s; + } + function du(s, e) { + if (typeof s != "object" || !s) return s; + var t = s[Symbol.toPrimitive]; + if (t !== void 0) { + var i = t.call(s, e); + if (typeof i != "object") return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return String(s); + } + function _s(s) { + var e = du(s, "string"); + return typeof e == "symbol" ? e : e + ""; + } + function Vt(s) { + "@babel/helpers - typeof"; + return ( + (Vt = + typeof Symbol == "function" && typeof Symbol.iterator == "symbol" + ? function (e) { + return typeof e; + } + : function (e) { + return e && + typeof Symbol == "function" && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + }), + Vt(s) + ); + } + function Te(s, e) { + if (!(s instanceof e)) + throw new TypeError("Cannot call a class as a function"); + } + function ks(s, e) { + for (var t = 0; t < e.length; t++) { + var i = e[t]; + (i.enumerable = i.enumerable || !1), + (i.configurable = !0), + "value" in i && (i.writable = !0), + Object.defineProperty(s, _s(i.key), i); + } + } + function be(s, e, t) { + return ( + e && ks(s.prototype, e), + t && ks(s, t), + Object.defineProperty(s, "prototype", { writable: !1 }), + s + ); + } + function fu(s, e, t) { + return ( + (e = _s(e)), + e in s + ? Object.defineProperty(s, e, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0, + }) + : (s[e] = t), + s + ); + } + function Oe(s, e) { + if (typeof e != "function" && e !== null) + throw new TypeError("Super expression must either be null or a function"); + (s.prototype = Object.create(e && e.prototype, { + constructor: { value: s, writable: !0, configurable: !0 }, + })), + Object.defineProperty(s, "prototype", { writable: !1 }), + e && Pn(s, e); + } + function Et(s) { + return ( + (Et = Object.setPrototypeOf + ? Object.getPrototypeOf.bind() + : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }), + Et(s) + ); + } + function Pn(s, e) { + return ( + (Pn = Object.setPrototypeOf + ? Object.setPrototypeOf.bind() + : function (i, n) { + return (i.__proto__ = n), i; + }), + Pn(s, e) + ); + } + function gu(s) { + if (s === void 0) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return s; + } + function pu(s, e) { + if (e && (typeof e == "object" || typeof e == "function")) return e; + if (e !== void 0) + throw new TypeError( + "Derived constructors may only return object or undefined" + ); + return gu(s); + } + function mu(s, e) { + for ( + ; + !Object.prototype.hasOwnProperty.call(s, e) && ((s = Et(s)), s !== null); + + ); + return s; + } + function Gt() { + return ( + typeof Reflect < "u" && Reflect.get + ? (Gt = Reflect.get.bind()) + : (Gt = function (e, t, i) { + var n = mu(e, t); + if (n) { + var r = Object.getOwnPropertyDescriptor(n, t); + return r.get ? r.get.call(arguments.length < 3 ? e : i) : r.value; + } + }), + Gt.apply(this, arguments) + ); + } + function wn(s, e) { + return yu(s) || hu(s, e) || Dn(s, e) || Tu(); + } + function ri(s) { + return Au(s) || vu(s) || Dn(s) || Eu(); + } + function Au(s) { + if (Array.isArray(s)) return On(s); + } + function yu(s) { + if (Array.isArray(s)) return s; + } + function vu(s) { + if ( + (typeof Symbol < "u" && s[Symbol.iterator] != null) || + s["@@iterator"] != null + ) + return Array.from(s); + } + function Dn(s, e) { + if (s) { + if (typeof s == "string") return On(s, e); + var t = Object.prototype.toString.call(s).slice(8, -1); + if ( + (t === "Object" && s.constructor && (t = s.constructor.name), + t === "Map" || t === "Set") + ) + return Array.from(s); + if ( + t === "Arguments" || + /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) + ) + return On(s, e); + } + } + function On(s, e) { + (e == null || e > s.length) && (e = s.length); + for (var t = 0, i = new Array(e); t < e; t++) i[t] = s[t]; + return i; + } + function Eu() { + throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); + } + function Tu() { + throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); + } + function Ss(s, e) { + var t = (typeof Symbol < "u" && s[Symbol.iterator]) || s["@@iterator"]; + if (!t) { + if (Array.isArray(s) || (t = Dn(s)) || e) { + t && (s = t); + var i = 0, + n = function () {}; + return { + s: n, + n: function () { + return i >= s.length ? { done: !0 } : { done: !1, value: s[i++] }; + }, + e: function (l) { + throw l; + }, + f: n, + }; + } + throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); + } + var r = !0, + a = !1, + o; + return { + s: function () { + t = t.call(s); + }, + n: function () { + var l = t.next(); + return (r = l.done), l; + }, + e: function (l) { + (a = !0), (o = l); + }, + f: function () { + try { + !r && t.return != null && t.return(); + } finally { + if (a) throw o; + } + }, + }; + } + function bu(s) { + return s && + s.__esModule && + Object.prototype.hasOwnProperty.call(s, "default") + ? s.default + : s; + } + var Pt = (function () { + var s, + e, + t, + i, + n = [], + r = n.concat, + a = n.filter, + o = n.slice, + l = window.document, + u = {}, + c = {}, + d = { + "column-count": 1, + columns: 1, + "font-weight": 1, + "line-height": 1, + opacity: 1, + "z-index": 1, + zoom: 1, + }, + f = /^\s*<(\w+|!)[^>]*>/, + g = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + p = + /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + v = /^(?:body|html)$/i, + T = /([A-Z])/g, + x = ["val", "css", "html", "text", "data", "width", "height", "offset"], + I = ["after", "prepend", "before", "append"], + L = l.createElement("table"), + M = l.createElement("tr"), + O = { + tr: l.createElement("tbody"), + tbody: L, + thead: L, + tfoot: L, + td: M, + th: M, + "*": l.createElement("div"), + }, + j = /complete|loaded|interactive/, + U = /^[\w-]*$/, + Y = {}, + _ = Y.toString, + E = {}, + w, + b, + S = l.createElement("div"), + P = { + tabindex: "tabIndex", + readonly: "readOnly", + for: "htmlFor", + class: "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable", + }, + F = + Array.isArray || + function (h) { + return h instanceof Array; + }; + E.matches = function (h, m) { + if (!m || !h || h.nodeType !== 1) return !1; + var k = + h.matches || + h.webkitMatchesSelector || + h.mozMatchesSelector || + h.oMatchesSelector || + h.matchesSelector; + if (k) return k.call(h, m); + var R, + Z = h.parentNode, + W = !Z; + return ( + W && (Z = S).appendChild(h), + (R = ~E.qsa(Z, m).indexOf(h)), + W && S.removeChild(h), + R + ); + }; + function V(h) { + return h == null ? String(h) : Y[_.call(h)] || "object"; + } + function K(h) { + return V(h) == "function"; + } + function G(h) { + return h != null && h == h.window; + } + function B(h) { + return h != null && h.nodeType == h.DOCUMENT_NODE; + } + function q(h) { + return V(h) == "object"; + } + function X(h) { + return q(h) && !G(h) && Object.getPrototypeOf(h) == Object.prototype; + } + function J(h) { + var m = !!h && "length" in h && h.length, + k = t.type(h); + return ( + k != "function" && + !G(h) && + (k == "array" || + m === 0 || + (typeof m == "number" && m > 0 && m - 1 in h)) + ); + } + function z(h) { + return a.call(h, function (m) { + return m != null; + }); + } + function Ne(h) { + return h.length > 0 ? t.fn.concat.apply([], h) : h; + } + w = function (h) { + return h.replace(/-+(.)?/g, function (m, k) { + return k ? k.toUpperCase() : ""; + }); + }; + function me(h) { + return h + .replace(/::/g, "/") + .replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2") + .replace(/([a-z\d])([A-Z])/g, "$1_$2") + .replace(/_/g, "-") + .toLowerCase(); + } + b = function (h) { + return a.call(h, function (m, k) { + return h.indexOf(m) == k; + }); + }; + function Re(h) { + return h in c ? c[h] : (c[h] = new RegExp("(^|\\s)" + h + "(\\s|$)")); + } + function oe(h, m) { + return typeof m == "number" && !d[me(h)] ? m + "px" : m; + } + function Me(h) { + var m, k; + return ( + u[h] || + ((m = l.createElement(h)), + l.body.appendChild(m), + (k = getComputedStyle(m, "").getPropertyValue("display")), + m.parentNode.removeChild(m), + k == "none" && (k = "block"), + (u[h] = k)), + u[h] + ); + } + function St(h) { + return "children" in h + ? o.call(h.children) + : t.map(h.childNodes, function (m) { + if (m.nodeType == 1) return m; + }); + } + function Pi(h, m) { + var k, + R = h ? h.length : 0; + for (k = 0; k < R; k++) this[k] = h[k]; + (this.length = R), (this.selector = m || ""); + } + (E.fragment = function (h, m, k) { + var R, Z, W; + return ( + g.test(h) && (R = t(l.createElement(RegExp.$1))), + R || + (h.replace && (h = h.replace(p, "<$1></$2>")), + m === s && (m = f.test(h) && RegExp.$1), + m in O || (m = "*"), + (W = O[m]), + (W.innerHTML = "" + h), + (R = t.each(o.call(W.childNodes), function () { + W.removeChild(this); + }))), + X(k) && + ((Z = t(R)), + t.each(k, function (Ce, ke) { + x.indexOf(Ce) > -1 ? Z[Ce](ke) : Z.attr(Ce, ke); + })), + R + ); + }), + (E.Z = function (h, m) { + return new Pi(h, m); + }), + (E.isZ = function (h) { + return h instanceof E.Z; + }), + (E.init = function (h, m) { + var k; + if (h) + if (typeof h == "string") + if (((h = h.trim()), h[0] == "<" && f.test(h))) + (k = E.fragment(h, RegExp.$1, m)), (h = null); + else { + if (m !== s) return t(m).find(h); + k = E.qsa(l, h); + } + else { + if (K(h)) return t(l).ready(h); + if (E.isZ(h)) return h; + if (F(h)) k = z(h); + else if (q(h)) (k = [h]), (h = null); + else if (f.test(h)) + (k = E.fragment(h.trim(), RegExp.$1, m)), (h = null); + else { + if (m !== s) return t(m).find(h); + k = E.qsa(l, h); + } + } + else return E.Z(); + return E.Z(k, h); + }), + (t = function (h, m) { + return E.init(h, m); + }); + function wi(h, m, k) { + for (e in m) + k && (X(m[e]) || F(m[e])) + ? (X(m[e]) && !X(h[e]) && (h[e] = {}), + F(m[e]) && !F(h[e]) && (h[e] = []), + wi(h[e], m[e], k)) + : m[e] !== s && (h[e] = m[e]); + } + (t.extend = function (h) { + var m, + k = o.call(arguments, 1); + return ( + typeof h == "boolean" && ((m = h), (h = k.shift())), + k.forEach(function (R) { + wi(h, R, m); + }), + h + ); + }), + (E.qsa = function (h, m) { + var k, + R = m[0] == "#", + Z = !R && m[0] == ".", + W = R || Z ? m.slice(1) : m, + Ce = U.test(W); + return h.getElementById && Ce && R + ? (k = h.getElementById(W)) + ? [k] + : [] + : h.nodeType !== 1 && h.nodeType !== 9 && h.nodeType !== 11 + ? [] + : o.call( + Ce && !R && h.getElementsByClassName + ? Z + ? h.getElementsByClassName(W) + : h.getElementsByTagName(m) + : h.querySelectorAll(m) + ); + }); + function Ct(h, m) { + return m == null ? t(h) : t(h).filter(m); + } + t.contains = l.documentElement.contains + ? function (h, m) { + return h !== m && h.contains(m); + } + : function (h, m) { + for (; m && (m = m.parentNode); ) if (m === h) return !0; + return !1; + }; + function Pe(h, m, k, R) { + return K(m) ? m.call(h, k, R) : m; + } + function Zt(h, m, k) { + k == null ? h.removeAttribute(m) : h.setAttribute(m, k); + } + function Ye(h, m) { + var k = h.className || "", + R = k && k.baseVal !== s; + if (m === s) return R ? k.baseVal : k; + R ? (k.baseVal = m) : (h.className = m); + } + function Di(h) { + try { + return ( + h && + (h == "true" || + (h == "false" + ? !1 + : h == "null" + ? null + : +h + "" == h + ? +h + : /^[\[\{]/.test(h) + ? t.parseJSON(h) + : h)) + ); + } catch { + return h; + } + } + (t.type = V), + (t.isFunction = K), + (t.isWindow = G), + (t.isArray = F), + (t.isPlainObject = X), + (t.isEmptyObject = function (h) { + var m; + for (m in h) return !1; + return !0; + }), + (t.isNumeric = function (h) { + var m = Number(h), + k = typeof h; + return ( + (h != null && + k != "boolean" && + (k != "string" || h.length) && + !isNaN(m) && + isFinite(m)) || + !1 + ); + }), + (t.inArray = function (h, m, k) { + return n.indexOf.call(m, h, k); + }), + (t.camelCase = w), + (t.trim = function (h) { + return h == null ? "" : String.prototype.trim.call(h); + }), + (t.uuid = 0), + (t.support = {}), + (t.expr = {}), + (t.noop = function () {}), + (t.map = function (h, m) { + var k, + R = [], + Z, + W; + if (J(h)) + for (Z = 0; Z < h.length; Z++) + (k = m(h[Z], Z)), k != null && R.push(k); + else for (W in h) (k = m(h[W], W)), k != null && R.push(k); + return Ne(R); + }), + (t.each = function (h, m) { + var k, R; + if (J(h)) { + for (k = 0; k < h.length; k++) + if (m.call(h[k], k, h[k]) === !1) return h; + } else for (R in h) if (m.call(h[R], R, h[R]) === !1) return h; + return h; + }), + (t.grep = function (h, m) { + return a.call(h, m); + }), + window.JSON && (t.parseJSON = JSON.parse), + t.each( + "Boolean Number String Function Array Date RegExp Object Error".split( + " " + ), + function (h, m) { + Y["[object " + m + "]"] = m.toLowerCase(); + } + ), + (t.fn = { + constructor: E.Z, + length: 0, + forEach: n.forEach, + reduce: n.reduce, + push: n.push, + sort: n.sort, + splice: n.splice, + indexOf: n.indexOf, + concat: function () { + var h, + m, + k = []; + for (h = 0; h < arguments.length; h++) + (m = arguments[h]), (k[h] = E.isZ(m) ? m.toArray() : m); + return r.apply(E.isZ(this) ? this.toArray() : this, k); + }, + map: function (h) { + return t( + t.map(this, function (m, k) { + return h.call(m, k, m); + }) + ); + }, + slice: function () { + return t(o.apply(this, arguments)); + }, + ready: function (h) { + return ( + j.test(l.readyState) && l.body + ? h(t) + : l.addEventListener( + "DOMContentLoaded", + function () { + h(t); + }, + !1 + ), + this + ); + }, + get: function (h) { + return h === s ? o.call(this) : this[h >= 0 ? h : h + this.length]; + }, + toArray: function () { + return this.get(); + }, + size: function () { + return this.length; + }, + remove: function () { + return this.each(function () { + this.parentNode != null && this.parentNode.removeChild(this); + }); + }, + each: function (h) { + return ( + n.every.call(this, function (m, k) { + return h.call(m, k, m) !== !1; + }), + this + ); + }, + filter: function (h) { + return K(h) + ? this.not(this.not(h)) + : t( + a.call(this, function (m) { + return E.matches(m, h); + }) + ); + }, + add: function (h, m) { + return t(b(this.concat(t(h, m)))); + }, + is: function (h) { + return this.length > 0 && E.matches(this[0], h); + }, + not: function (h) { + var m = []; + if (K(h) && h.call !== s) + this.each(function (R) { + h.call(this, R) || m.push(this); + }); + else { + var k = + typeof h == "string" + ? this.filter(h) + : J(h) && K(h.item) + ? o.call(h) + : t(h); + this.forEach(function (R) { + k.indexOf(R) < 0 && m.push(R); + }); + } + return t(m); + }, + has: function (h) { + return this.filter(function () { + return q(h) ? t.contains(this, h) : t(this).find(h).size(); + }); + }, + eq: function (h) { + return h === -1 ? this.slice(h) : this.slice(h, +h + 1); + }, + first: function () { + var h = this[0]; + return h && !q(h) ? h : t(h); + }, + last: function () { + var h = this[this.length - 1]; + return h && !q(h) ? h : t(h); + }, + find: function (h) { + var m, + k = this; + return ( + h + ? typeof h == "object" + ? (m = t(h).filter(function () { + var R = this; + return n.some.call(k, function (Z) { + return t.contains(Z, R); + }); + })) + : this.length == 1 + ? (m = t(E.qsa(this[0], h))) + : (m = this.map(function () { + return E.qsa(this, h); + })) + : (m = t()), + m + ); + }, + closest: function (h, m) { + var k = [], + R = typeof h == "object" && t(h); + return ( + this.each(function (Z, W) { + for (; W && !(R ? R.indexOf(W) >= 0 : E.matches(W, h)); ) + W = W !== m && !B(W) && W.parentNode; + W && k.indexOf(W) < 0 && k.push(W); + }), + t(k) + ); + }, + parents: function (h) { + for (var m = [], k = this; k.length > 0; ) + k = t.map(k, function (R) { + if ((R = R.parentNode) && !B(R) && m.indexOf(R) < 0) + return m.push(R), R; + }); + return Ct(m, h); + }, + parent: function (h) { + return Ct(b(this.pluck("parentNode")), h); + }, + children: function (h) { + return Ct( + this.map(function () { + return St(this); + }), + h + ); + }, + contents: function () { + return this.map(function () { + return this.contentDocument || o.call(this.childNodes); + }); + }, + siblings: function (h) { + return Ct( + this.map(function (m, k) { + return a.call(St(k.parentNode), function (R) { + return R !== k; + }); + }), + h + ); + }, + empty: function () { + return this.each(function () { + this.innerHTML = ""; + }); + }, + pluck: function (h) { + return t.map(this, function (m) { + return m[h]; + }); + }, + show: function () { + return this.each(function () { + this.style.display == "none" && (this.style.display = ""), + getComputedStyle(this, "").getPropertyValue("display") == + "none" && (this.style.display = Me(this.nodeName)); + }); + }, + replaceWith: function (h) { + return this.before(h).remove(); + }, + wrap: function (h) { + var m = K(h); + if (this[0] && !m) + var k = t(h).get(0), + R = k.parentNode || this.length > 1; + return this.each(function (Z) { + t(this).wrapAll(m ? h.call(this, Z) : R ? k.cloneNode(!0) : k); + }); + }, + wrapAll: function (h) { + if (this[0]) { + t(this[0]).before((h = t(h))); + for (var m; (m = h.children()).length; ) h = m.first(); + t(h).append(this); + } + return this; + }, + wrapInner: function (h) { + var m = K(h); + return this.each(function (k) { + var R = t(this), + Z = R.contents(), + W = m ? h.call(this, k) : h; + Z.length ? Z.wrapAll(W) : R.append(W); + }); + }, + unwrap: function () { + return ( + this.parent().each(function () { + t(this).replaceWith(t(this).children()); + }), + this + ); + }, + clone: function () { + return this.map(function () { + return this.cloneNode(!0); + }); + }, + hide: function () { + return this.css("display", "none"); + }, + toggle: function (h) { + return this.each(function () { + var m = t(this); + (h === s ? m.css("display") == "none" : h) ? m.show() : m.hide(); + }); + }, + prev: function (h) { + return t(this.pluck("previousElementSibling")).filter(h || "*"); + }, + next: function (h) { + return t(this.pluck("nextElementSibling")).filter(h || "*"); + }, + html: function (h) { + return 0 in arguments + ? this.each(function (m) { + var k = this.innerHTML; + t(this).empty().append(Pe(this, h, m, k)); + }) + : 0 in this + ? this[0].innerHTML + : null; + }, + text: function (h) { + return 0 in arguments + ? this.each(function (m) { + var k = Pe(this, h, m, this.textContent); + this.textContent = k == null ? "" : "" + k; + }) + : 0 in this + ? this.pluck("textContent").join("") + : null; + }, + attr: function (h, m) { + var k; + return typeof h == "string" && !(1 in arguments) + ? 0 in this && + this[0].nodeType == 1 && + (k = this[0].getAttribute(h)) != null + ? k + : s + : this.each(function (R) { + if (this.nodeType === 1) + if (q(h)) for (e in h) Zt(this, e, h[e]); + else Zt(this, h, Pe(this, m, R, this.getAttribute(h))); + }); + }, + removeAttr: function (h) { + return this.each(function () { + this.nodeType === 1 && + h.split(" ").forEach(function (m) { + Zt(this, m); + }, this); + }); + }, + prop: function (h, m) { + return ( + (h = P[h] || h), + 1 in arguments + ? this.each(function (k) { + this[h] = Pe(this, m, k, this[h]); + }) + : this[0] && this[0][h] + ); + }, + removeProp: function (h) { + return ( + (h = P[h] || h), + this.each(function () { + delete this[h]; + }) + ); + }, + data: function (h, m) { + var k = "data-" + h.replace(T, "-$1").toLowerCase(), + R = 1 in arguments ? this.attr(k, m) : this.attr(k); + return R !== null ? Di(R) : s; + }, + val: function (h) { + return 0 in arguments + ? (h == null && (h = ""), + this.each(function (m) { + this.value = Pe(this, h, m, this.value); + })) + : this[0] && + (this[0].multiple + ? t(this[0]) + .find("option") + .filter(function () { + return this.selected; + }) + .pluck("value") + : this[0].value); + }, + offset: function (h) { + if (h) + return this.each(function (k) { + var R = t(this), + Z = Pe(this, h, k, R.offset()), + W = R.offsetParent().offset(), + Ce = { top: Z.top - W.top, left: Z.left - W.left }; + R.css("position") == "static" && (Ce.position = "relative"), + R.css(Ce); + }); + if (!this.length) return null; + if ( + l.documentElement !== this[0] && + !t.contains(l.documentElement, this[0]) + ) + return { top: 0, left: 0 }; + var m = this[0].getBoundingClientRect(); + return { + left: m.left + window.pageXOffset, + top: m.top + window.pageYOffset, + width: Math.round(m.width), + height: Math.round(m.height), + }; + }, + css: function (h, m) { + if (arguments.length < 2) { + var k = this[0]; + if (typeof h == "string") + return k + ? k.style[w(h)] || getComputedStyle(k, "").getPropertyValue(h) + : void 0; + if (F(h)) { + if (!k) return; + var R = {}, + Z = getComputedStyle(k, ""); + return ( + t.each(h, function (Ce, ke) { + R[ke] = k.style[w(ke)] || Z.getPropertyValue(ke); + }), + R + ); + } + } + var W = ""; + if (V(h) == "string") + !m && m !== 0 + ? this.each(function () { + this.style.removeProperty(me(h)); + }) + : (W = me(h) + ":" + oe(h, m)); + else + for (e in h) + !h[e] && h[e] !== 0 + ? this.each(function () { + this.style.removeProperty(me(e)); + }) + : (W += me(e) + ":" + oe(e, h[e]) + ";"); + return this.each(function () { + this.style.cssText += ";" + W; + }); + }, + index: function (h) { + return h + ? this.indexOf(t(h)[0]) + : this.parent().children().indexOf(this[0]); + }, + hasClass: function (h) { + return h + ? n.some.call( + this, + function (m) { + return this.test(Ye(m)); + }, + Re(h) + ) + : !1; + }, + addClass: function (h) { + return h + ? this.each(function (m) { + if ("className" in this) { + i = []; + var k = Ye(this), + R = Pe(this, h, m, k); + R.split(/\s+/g).forEach(function (Z) { + t(this).hasClass(Z) || i.push(Z); + }, this), + i.length && Ye(this, k + (k ? " " : "") + i.join(" ")); + } + }) + : this; + }, + removeClass: function (h) { + return this.each(function (m) { + if ("className" in this) { + if (h === s) return Ye(this, ""); + (i = Ye(this)), + Pe(this, h, m, i) + .split(/\s+/g) + .forEach(function (k) { + i = i.replace(Re(k), " "); + }), + Ye(this, i.trim()); + } + }); + }, + toggleClass: function (h, m) { + return h + ? this.each(function (k) { + var R = t(this), + Z = Pe(this, h, k, Ye(this)); + Z.split(/\s+/g).forEach(function (W) { + (m === s ? !R.hasClass(W) : m) + ? R.addClass(W) + : R.removeClass(W); + }); + }) + : this; + }, + scrollTop: function (h) { + if (this.length) { + var m = "scrollTop" in this[0]; + return h === s + ? m + ? this[0].scrollTop + : this[0].pageYOffset + : this.each( + m + ? function () { + this.scrollTop = h; + } + : function () { + this.scrollTo(this.scrollX, h); + } + ); + } + }, + scrollLeft: function (h) { + if (this.length) { + var m = "scrollLeft" in this[0]; + return h === s + ? m + ? this[0].scrollLeft + : this[0].pageXOffset + : this.each( + m + ? function () { + this.scrollLeft = h; + } + : function () { + this.scrollTo(h, this.scrollY); + } + ); + } + }, + position: function () { + if (this.length) { + var h = this[0], + m = this.offsetParent(), + k = this.offset(), + R = v.test(m[0].nodeName) ? { top: 0, left: 0 } : m.offset(); + return ( + (k.top -= parseFloat(t(h).css("margin-top")) || 0), + (k.left -= parseFloat(t(h).css("margin-left")) || 0), + (R.top += parseFloat(t(m[0]).css("border-top-width")) || 0), + (R.left += parseFloat(t(m[0]).css("border-left-width")) || 0), + { top: k.top - R.top, left: k.left - R.left } + ); + } + }, + offsetParent: function () { + return this.map(function () { + for ( + var h = this.offsetParent || l.body; + h && !v.test(h.nodeName) && t(h).css("position") == "static"; + + ) + h = h.offsetParent; + return h; + }); + }, + }), + (t.fn.detach = t.fn.remove), + ["width", "height"].forEach(function (h) { + var m = h.replace(/./, function (k) { + return k[0].toUpperCase(); + }); + t.fn[h] = function (k) { + var R, + Z = this[0]; + return k === s + ? G(Z) + ? Z["inner" + m] + : B(Z) + ? Z.documentElement["scroll" + m] + : (R = this.offset()) && R[h] + : this.each(function (W) { + (Z = t(this)), Z.css(h, Pe(this, k, W, Z[h]())); + }); + }; + }); + function Oi(h, m) { + m(h); + for (var k = 0, R = h.childNodes.length; k < R; k++) + Oi(h.childNodes[k], m); + } + return ( + I.forEach(function (h, m) { + var k = m % 2; + (t.fn[h] = function () { + var R, + Z = t.map(arguments, function (ke) { + var Ae = []; + return ( + (R = V(ke)), + R == "array" + ? (ke.forEach(function (ze) { + if (ze.nodeType !== s) return Ae.push(ze); + if (t.zepto.isZ(ze)) return (Ae = Ae.concat(ze.get())); + Ae = Ae.concat(E.fragment(ze)); + }), + Ae) + : R == "object" || ke == null + ? ke + : E.fragment(ke) + ); + }), + W, + Ce = this.length > 1; + return Z.length < 1 + ? this + : this.each(function (ke, Ae) { + (W = k ? Ae : Ae.parentNode), + (Ae = + m == 0 + ? Ae.nextSibling + : m == 1 + ? Ae.firstChild + : m == 2 + ? Ae + : null); + var ze = t.contains(l.documentElement, W); + Z.forEach(function (ut) { + if (Ce) ut = ut.cloneNode(!0); + else if (!W) return t(ut).remove(); + W.insertBefore(ut, Ae), + ze && + Oi(ut, function (Ve) { + if ( + Ve.nodeName != null && + Ve.nodeName.toUpperCase() === "SCRIPT" && + (!Ve.type || Ve.type === "text/javascript") && + !Ve.src + ) { + var Ni = Ve.ownerDocument + ? Ve.ownerDocument.defaultView + : window; + Ni.eval.call(Ni, Ve.innerHTML); + } + }); + }); + }); + }), + (t.fn[k ? h + "To" : "insert" + (m ? "Before" : "After")] = function ( + R + ) { + return t(R)[h](this), this; + }); + }), + (E.Z.prototype = Pi.prototype = t.fn), + (E.uniq = b), + (E.deserializeValue = Di), + (t.zepto = E), + t + ); + })(); + (window.Zepto = Pt), + window.$ === void 0 && (window.$ = Pt), + (function (s) { + var e = +new Date(), + t = window.document, + i, + n, + r = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, + a = /^(?:text|application)\/javascript/i, + o = /^(?:text|application)\/xml/i, + l = "application/json", + u = "text/html", + c = /^\s*$/, + d = t.createElement("a"); + d.href = window.location.href; + function f(b, S, P) { + var F = s.Event(S); + return s(b).trigger(F, P), !F.isDefaultPrevented(); + } + function g(b, S, P, F) { + if (b.global) return f(S || t, P, F); + } + s.active = 0; + function p(b) { + b.global && s.active++ === 0 && g(b, null, "ajaxStart"); + } + function v(b) { + b.global && !--s.active && g(b, null, "ajaxStop"); + } + function T(b, S) { + var P = S.context; + if ( + S.beforeSend.call(P, b, S) === !1 || + g(S, P, "ajaxBeforeSend", [b, S]) === !1 + ) + return !1; + g(S, P, "ajaxSend", [b, S]); + } + function x(b, S, P, F) { + var V = P.context, + K = "success"; + P.success.call(V, b, K, S), + F && F.resolveWith(V, [b, K, S]), + g(P, V, "ajaxSuccess", [S, P, b]), + L(K, S, P); + } + function I(b, S, P, F, V) { + var K = F.context; + F.error.call(K, P, S, b), + V && V.rejectWith(K, [P, S, b]), + g(F, K, "ajaxError", [P, F, b || S]), + L(S, P, F); + } + function L(b, S, P) { + var F = P.context; + P.complete.call(F, S, b), g(P, F, "ajaxComplete", [S, P]), v(P); + } + function M(b, S, P) { + if (P.dataFilter == O) return b; + var F = P.context; + return P.dataFilter.call(F, b, S); + } + function O() {} + (s.ajaxJSONP = function (b, S) { + if (!("type" in b)) return s.ajax(b); + var P = b.jsonpCallback, + F = (s.isFunction(P) ? P() : P) || "Zepto" + e++, + V = t.createElement("script"), + K = window[F], + G, + B = function (J) { + s(V).triggerHandler("error", J || "abort"); + }, + q = { abort: B }, + X; + return ( + S && S.promise(q), + s(V).on("load error", function (J, z) { + clearTimeout(X), + s(V).off().remove(), + J.type == "error" || !G + ? I(null, z || "error", q, b, S) + : x(G[0], q, b, S), + (window[F] = K), + G && s.isFunction(K) && K(G[0]), + (K = G = void 0); + }), + T(q, b) === !1 + ? (B("abort"), q) + : ((window[F] = function () { + G = arguments; + }), + (V.src = b.url.replace(/\?(.+)=\?/, "?$1=" + F)), + t.head.appendChild(V), + b.timeout > 0 && + (X = setTimeout(function () { + B("timeout"); + }, b.timeout)), + q) + ); + }), + (s.ajaxSettings = { + type: "GET", + beforeSend: O, + success: O, + error: O, + complete: O, + context: null, + global: !0, + xhr: function () { + return new window.XMLHttpRequest(); + }, + accepts: { + script: + "text/javascript, application/javascript, application/x-javascript", + json: l, + xml: "application/xml, text/xml", + html: u, + text: "text/plain", + }, + crossDomain: !1, + timeout: 0, + processData: !0, + cache: !0, + dataFilter: O, + }); + function j(b) { + return ( + b && (b = b.split(";", 2)[0]), + (b && + (b == u + ? "html" + : b == l + ? "json" + : a.test(b) + ? "script" + : o.test(b) && "xml")) || + "text" + ); + } + function U(b, S) { + return S == "" ? b : (b + "&" + S).replace(/[&?]{1,2}/, "?"); + } + function Y(b) { + b.processData && + b.data && + s.type(b.data) != "string" && + (b.data = s.param(b.data, b.traditional)), + b.data && + (!b.type || + b.type.toUpperCase() == "GET" || + b.dataType == "jsonp") && + ((b.url = U(b.url, b.data)), (b.data = void 0)); + } + s.ajax = function (b) { + var S = s.extend({}, b || {}), + P = s.Deferred && s.Deferred(), + F, + V; + for (i in s.ajaxSettings) S[i] === void 0 && (S[i] = s.ajaxSettings[i]); + p(S), + S.crossDomain || + ((F = t.createElement("a")), + (F.href = S.url), + (F.href = F.href), + (S.crossDomain = + d.protocol + "//" + d.host != F.protocol + "//" + F.host)), + S.url || (S.url = window.location.toString()), + (V = S.url.indexOf("#")) > -1 && (S.url = S.url.slice(0, V)), + Y(S); + var K = S.dataType, + G = /\?.+=\?/.test(S.url); + if ( + (G && (K = "jsonp"), + (S.cache === !1 || + ((!b || b.cache !== !0) && (K == "script" || K == "jsonp"))) && + (S.url = U(S.url, "_=" + Date.now())), + K == "jsonp") + ) + return ( + G || + (S.url = U( + S.url, + S.jsonp ? S.jsonp + "=?" : S.jsonp === !1 ? "" : "callback=?" + )), + s.ajaxJSONP(S, P) + ); + var B = S.accepts[K], + q = {}, + X = function (oe, Me) { + q[oe.toLowerCase()] = [oe, Me]; + }, + J = /^([\w-]+:)\/\//.test(S.url) + ? RegExp.$1 + : window.location.protocol, + z = S.xhr(), + Ne = z.setRequestHeader, + me; + if ( + (P && P.promise(z), + S.crossDomain || X("X-Requested-With", "XMLHttpRequest"), + X("Accept", B || "*/*"), + (B = S.mimeType || B) && + (B.indexOf(",") > -1 && (B = B.split(",", 2)[0]), + z.overrideMimeType && z.overrideMimeType(B)), + (S.contentType || + (S.contentType !== !1 && + S.data && + S.type.toUpperCase() != "GET")) && + X( + "Content-Type", + S.contentType || "application/x-www-form-urlencoded" + ), + S.headers) + ) + for (n in S.headers) X(n, S.headers[n]); + if ( + ((z.setRequestHeader = X), + (z.onreadystatechange = function () { + if (z.readyState == 4) { + (z.onreadystatechange = O), clearTimeout(me); + var oe, + Me = !1; + if ( + (z.status >= 200 && z.status < 300) || + z.status == 304 || + (z.status == 0 && J == "file:") + ) { + if ( + ((K = + K || j(S.mimeType || z.getResponseHeader("content-type"))), + z.responseType == "arraybuffer" || z.responseType == "blob") + ) + oe = z.response; + else { + oe = z.responseText; + try { + (oe = M(oe, K, S)), + K == "script" + ? (0, eval)(oe) + : K == "xml" + ? (oe = z.responseXML) + : K == "json" && + (oe = c.test(oe) ? null : s.parseJSON(oe)); + } catch (St) { + Me = St; + } + if (Me) return I(Me, "parsererror", z, S, P); + } + x(oe, z, S, P); + } else + I(z.statusText || null, z.status ? "error" : "abort", z, S, P); + } + }), + T(z, S) === !1) + ) + return z.abort(), I(null, "abort", z, S, P), z; + var Re = "async" in S ? S.async : !0; + if ((z.open(S.type, S.url, Re, S.username, S.password), S.xhrFields)) + for (n in S.xhrFields) z[n] = S.xhrFields[n]; + for (n in q) Ne.apply(z, q[n]); + return ( + S.timeout > 0 && + (me = setTimeout(function () { + (z.onreadystatechange = O), + z.abort(), + I(null, "timeout", z, S, P); + }, S.timeout)), + z.send(S.data ? S.data : null), + z + ); + }; + function _(b, S, P, F) { + return ( + s.isFunction(S) && ((F = P), (P = S), (S = void 0)), + s.isFunction(P) || ((F = P), (P = void 0)), + { url: b, data: S, success: P, dataType: F } + ); + } + (s.get = function () { + return s.ajax(_.apply(null, arguments)); + }), + (s.post = function () { + var b = _.apply(null, arguments); + return (b.type = "POST"), s.ajax(b); + }), + (s.getJSON = function () { + var b = _.apply(null, arguments); + return (b.dataType = "json"), s.ajax(b); + }), + (s.fn.load = function (b, S, P) { + if (!this.length) return this; + var F = this, + V = b.split(/\s/), + K, + G = _(b, S, P), + B = G.success; + return ( + V.length > 1 && ((G.url = V[0]), (K = V[1])), + (G.success = function (q) { + F.html(K ? s("<div>").html(q.replace(r, "")).find(K) : q), + B && B.apply(F, arguments); + }), + s.ajax(G), + this + ); + }); + var E = encodeURIComponent; + function w(b, S, P, F) { + var V, + K = s.isArray(S), + G = s.isPlainObject(S); + s.each(S, function (B, q) { + (V = s.type(q)), + F && + (B = P + ? F + : F + + "[" + + (G || V == "object" || V == "array" ? B : "") + + "]"), + !F && K + ? b.add(q.name, q.value) + : V == "array" || (!P && V == "object") + ? w(b, q, P, B) + : b.add(B, q); + }); + } + s.param = function (b, S) { + var P = []; + return ( + (P.add = function (F, V) { + s.isFunction(V) && (V = V()), + V == null && (V = ""), + this.push(E(F) + "=" + E(V)); + }), + w(P, b, S), + P.join("&").replace(/%20/g, "+") + ); + }; + })(Pt), + (function (s) { + s.Callbacks = function (e) { + e = s.extend({}, e); + var t, + i, + n, + r, + a, + o, + l = [], + u = !e.once && [], + c = function (f) { + for ( + t = e.memory && f, + i = !0, + o = r || 0, + r = 0, + a = l.length, + n = !0; + l && o < a; + ++o + ) + if (l[o].apply(f[0], f[1]) === !1 && e.stopOnFalse) { + t = !1; + break; + } + (n = !1), + l && + (u + ? u.length && c(u.shift()) + : t + ? (l.length = 0) + : d.disable()); + }, + d = { + add: function () { + if (l) { + var f = l.length, + g = function (p) { + s.each(p, function (v, T) { + typeof T == "function" + ? (!e.unique || !d.has(T)) && l.push(T) + : T && T.length && typeof T != "string" && g(T); + }); + }; + g(arguments), n ? (a = l.length) : t && ((r = f), c(t)); + } + return this; + }, + remove: function () { + return ( + l && + s.each(arguments, function (f, g) { + for (var p; (p = s.inArray(g, l, p)) > -1; ) + l.splice(p, 1), n && (p <= a && --a, p <= o && --o); + }), + this + ); + }, + has: function (f) { + return !!(l && (f ? s.inArray(f, l) > -1 : l.length)); + }, + empty: function () { + return (a = l.length = 0), this; + }, + disable: function () { + return (l = u = t = void 0), this; + }, + disabled: function () { + return !l; + }, + lock: function () { + return (u = void 0), t || d.disable(), this; + }, + locked: function () { + return !u; + }, + fireWith: function (f, g) { + return ( + l && + (!i || u) && + ((g = g || []), + (g = [f, g.slice ? g.slice() : g]), + n ? u.push(g) : c(g)), + this + ); + }, + fire: function () { + return d.fireWith(this, arguments); + }, + fired: function () { + return !!i; + }, + }; + return d; + }; + })(Pt), + (function (s) { + var e = Array.prototype.slice; + function t(i) { + var n = [ + [ + "resolve", + "done", + s.Callbacks({ once: 1, memory: 1 }), + "resolved", + ], + ["reject", "fail", s.Callbacks({ once: 1, memory: 1 }), "rejected"], + ["notify", "progress", s.Callbacks({ memory: 1 })], + ], + r = "pending", + a = { + state: function () { + return r; + }, + always: function () { + return o.done(arguments).fail(arguments), this; + }, + then: function () { + var l = arguments; + return t(function (u) { + s.each(n, function (c, d) { + var f = s.isFunction(l[c]) && l[c]; + o[d[1]](function () { + var g = f && f.apply(this, arguments); + if (g && s.isFunction(g.promise)) + g.promise() + .done(u.resolve) + .fail(u.reject) + .progress(u.notify); + else { + var p = this === a ? u.promise() : this, + v = f ? [g] : arguments; + u[d[0] + "With"](p, v); + } + }); + }), + (l = null); + }).promise(); + }, + promise: function (l) { + return l != null ? s.extend(l, a) : a; + }, + }, + o = {}; + return ( + s.each(n, function (l, u) { + var c = u[2], + d = u[3]; + (a[u[1]] = c.add), + d && + c.add( + function () { + r = d; + }, + n[l ^ 1][2].disable, + n[2][2].lock + ), + (o[u[0]] = function () { + return o[u[0] + "With"](this === o ? a : this, arguments), this; + }), + (o[u[0] + "With"] = c.fireWith); + }), + a.promise(o), + i && i.call(o, o), + o + ); + } + (s.when = function (i) { + var n = e.call(arguments), + r = n.length, + a = 0, + o = r !== 1 || (i && s.isFunction(i.promise)) ? r : 0, + l = o === 1 ? i : t(), + u, + c, + d, + f = function (g, p, v) { + return function (T) { + (p[g] = this), + (v[g] = arguments.length > 1 ? e.call(arguments) : T), + v === u ? l.notifyWith(p, v) : --o || l.resolveWith(p, v); + }; + }; + if (r > 1) + for (u = new Array(r), c = new Array(r), d = new Array(r); a < r; ++a) + n[a] && s.isFunction(n[a].promise) + ? n[a] + .promise() + .done(f(a, d, n)) + .fail(l.reject) + .progress(f(a, c, u)) + : --o; + return o || l.resolveWith(d, n), l.promise(); + }), + (s.Deferred = t); + })(Pt), + (function (s) { + var e = 1, + t, + i = Array.prototype.slice, + n = s.isFunction, + r = function (_) { + return typeof _ == "string"; + }, + a = {}, + o = {}, + l = "onfocusin" in window, + u = { focus: "focusin", blur: "focusout" }, + c = { mouseenter: "mouseover", mouseleave: "mouseout" }; + o.click = o.mousedown = o.mouseup = o.mousemove = "MouseEvents"; + function d(_) { + return _._zid || (_._zid = e++); + } + function f(_, E, w, b) { + if (((E = g(E)), E.ns)) var S = p(E.ns); + return (a[d(_)] || []).filter(function (P) { + return ( + P && + (!E.e || P.e == E.e) && + (!E.ns || S.test(P.ns)) && + (!w || d(P.fn) === d(w)) && + (!b || P.sel == b) + ); + }); + } + function g(_) { + var E = ("" + _).split("."); + return { e: E[0], ns: E.slice(1).sort().join(" ") }; + } + function p(_) { + return new RegExp("(?:^| )" + _.replace(" ", " .* ?") + "(?: |$)"); + } + function v(_, E) { + return (_.del && !l && _.e in u) || !!E; + } + function T(_) { + return c[_] || (l && u[_]) || _; + } + function x(_, E, w, b, S, P, F) { + var V = d(_), + K = a[V] || (a[V] = []); + E.split(/\s/).forEach(function (G) { + if (G == "ready") return s(document).ready(w); + var B = g(G); + (B.fn = w), + (B.sel = S), + B.e in c && + (w = function (X) { + var J = X.relatedTarget; + if (!J || (J !== this && !s.contains(this, J))) + return B.fn.apply(this, arguments); + }), + (B.del = P); + var q = P || w; + (B.proxy = function (X) { + if (((X = U(X)), !X.isImmediatePropagationStopped())) { + X.data = b; + var J = q.apply(_, X._args == t ? [X] : [X].concat(X._args)); + return J === !1 && (X.preventDefault(), X.stopPropagation()), J; + } + }), + (B.i = K.length), + K.push(B), + "addEventListener" in _ && + _.addEventListener(T(B.e), B.proxy, v(B, F)); + }); + } + function I(_, E, w, b, S) { + var P = d(_); + (E || "").split(/\s/).forEach(function (F) { + f(_, F, w, b).forEach(function (V) { + delete a[P][V.i], + "removeEventListener" in _ && + _.removeEventListener(T(V.e), V.proxy, v(V, S)); + }); + }); + } + (s.event = { add: x, remove: I }), + (s.proxy = function (_, E) { + var w = 2 in arguments && i.call(arguments, 2); + if (n(_)) { + var b = function () { + return _.apply(E, w ? w.concat(i.call(arguments)) : arguments); + }; + return (b._zid = d(_)), b; + } else { + if (r(E)) + return w + ? (w.unshift(_[E], _), s.proxy.apply(null, w)) + : s.proxy(_[E], _); + throw new TypeError("expected function"); + } + }), + (s.fn.bind = function (_, E, w) { + return this.on(_, E, w); + }), + (s.fn.unbind = function (_, E) { + return this.off(_, E); + }), + (s.fn.one = function (_, E, w, b) { + return this.on(_, E, w, b, 1); + }); + var L = function () { + return !0; + }, + M = function () { + return !1; + }, + O = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/, + j = { + preventDefault: "isDefaultPrevented", + stopImmediatePropagation: "isImmediatePropagationStopped", + stopPropagation: "isPropagationStopped", + }; + function U(_, E) { + return ( + (E || !_.isDefaultPrevented) && + (E || (E = _), + s.each(j, function (w, b) { + var S = E[w]; + (_[w] = function () { + return (this[b] = L), S && S.apply(E, arguments); + }), + (_[b] = M); + }), + _.timeStamp || (_.timeStamp = Date.now()), + (E.defaultPrevented !== t + ? E.defaultPrevented + : "returnValue" in E + ? E.returnValue === !1 + : E.getPreventDefault && E.getPreventDefault()) && + (_.isDefaultPrevented = L)), + _ + ); + } + function Y(_) { + var E, + w = { originalEvent: _ }; + for (E in _) !O.test(E) && _[E] !== t && (w[E] = _[E]); + return U(w, _); + } + (s.fn.delegate = function (_, E, w) { + return this.on(E, _, w); + }), + (s.fn.undelegate = function (_, E, w) { + return this.off(E, _, w); + }), + (s.fn.live = function (_, E) { + return s(document.body).delegate(this.selector, _, E), this; + }), + (s.fn.die = function (_, E) { + return s(document.body).undelegate(this.selector, _, E), this; + }), + (s.fn.on = function (_, E, w, b, S) { + var P, + F, + V = this; + return _ && !r(_) + ? (s.each(_, function (K, G) { + V.on(K, E, w, G, S); + }), + V) + : (!r(E) && !n(b) && b !== !1 && ((b = w), (w = E), (E = t)), + (b === t || w === !1) && ((b = w), (w = t)), + b === !1 && (b = M), + V.each(function (K, G) { + S && + (P = function (B) { + return I(G, B.type, b), b.apply(this, arguments); + }), + E && + (F = function (B) { + var q, + X = s(B.target).closest(E, G).get(0); + if (X && X !== G) + return ( + (q = s.extend(Y(B), { + currentTarget: X, + liveFired: G, + })), + (P || b).apply(X, [q].concat(i.call(arguments, 1))) + ); + }), + x(G, _, b, w, E, F || P); + })); + }), + (s.fn.off = function (_, E, w) { + var b = this; + return _ && !r(_) + ? (s.each(_, function (S, P) { + b.off(S, E, P); + }), + b) + : (!r(E) && !n(w) && w !== !1 && ((w = E), (E = t)), + w === !1 && (w = M), + b.each(function () { + I(this, _, w, E); + })); + }), + (s.fn.trigger = function (_, E) { + return ( + (_ = r(_) || s.isPlainObject(_) ? s.Event(_) : U(_)), + (_._args = E), + this.each(function () { + _.type in u && typeof this[_.type] == "function" + ? this[_.type]() + : "dispatchEvent" in this + ? this.dispatchEvent(_) + : s(this).triggerHandler(_, E); + }) + ); + }), + (s.fn.triggerHandler = function (_, E) { + var w, b; + return ( + this.each(function (S, P) { + (w = Y(r(_) ? s.Event(_) : _)), + (w._args = E), + (w.target = P), + s.each(f(P, _.type || _), function (F, V) { + if (((b = V.proxy(w)), w.isImmediatePropagationStopped())) + return !1; + }); + }), + b + ); + }), + "focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error" + .split(" ") + .forEach(function (_) { + s.fn[_] = function (E) { + return 0 in arguments ? this.bind(_, E) : this.trigger(_); + }; + }), + (s.Event = function (_, E) { + r(_) || ((E = _), (_ = E.type)); + var w = document.createEvent(o[_] || "Events"), + b = !0; + if (E) for (var S in E) S == "bubbles" ? (b = !!E[S]) : (w[S] = E[S]); + return w.initEvent(_, b, !0), U(w); + }); + })(Pt), + (function () { + try { + getComputedStyle(void 0); + } catch { + var s = getComputedStyle; + window.getComputedStyle = function (t, i) { + try { + return s(t, i); + } catch { + return null; + } + }; + } + })(), + (function (s) { + var e = s.zepto, + t = e.qsa, + i = e.matches; + function n(c) { + return ( + (c = s(c)), !!(c.width() || c.height()) && c.css("display") !== "none" + ); + } + var r = (s.expr[":"] = { + visible: function () { + if (n(this)) return this; + }, + hidden: function () { + if (!n(this)) return this; + }, + selected: function () { + if (this.selected) return this; + }, + checked: function () { + if (this.checked) return this; + }, + parent: function () { + return this.parentNode; + }, + first: function (c) { + if (c === 0) return this; + }, + last: function (c, d) { + if (c === d.length - 1) return this; + }, + eq: function (c, d, f) { + if (c === f) return this; + }, + contains: function (c, d, f) { + if (s(this).text().indexOf(f) > -1) return this; + }, + has: function (c, d, f) { + if (e.qsa(this, f).length) return this; + }, + }), + a = new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"), + o = /^\s*>/, + l = "Zepto" + +new Date(); + function u(c, d) { + c = c.replace(/=#\]/g, '="#"]'); + var f, + g, + p = a.exec(c); + if (p && p[2] in r && ((f = r[p[2]]), (g = p[3]), (c = p[1]), g)) { + var v = Number(g); + isNaN(v) ? (g = g.replace(/^["']|["']$/g, "")) : (g = v); + } + return d(c, f, g); + } + (e.qsa = function (c, d) { + return u(d, function (f, g, p) { + try { + var v; + !f && g + ? (f = "*") + : o.test(f) && ((v = s(c).addClass(l)), (f = "." + l + " " + f)); + var T = t(c, f); + } catch (x) { + throw (console.error("error performing selector: %o", d), x); + } finally { + v && v.removeClass(l); + } + return g + ? e.uniq( + s.map(T, function (x, I) { + return g.call(x, I, T, p); + }) + ) + : T; + }); + }), + (e.matches = function (c, d) { + return u(d, function (f, g, p) { + return (!f || i(c, f)) && (!g || g.call(c, null, p) === c); + }); + }); + })(Pt); + var _u = Pt, + ue = bu(_u); + Array.prototype.find || + Object.defineProperty(Array.prototype, "find", { + value: function (e) { + if (this == null) throw new TypeError('"this" is null or not defined'); + var t = Object(this), + i = t.length >>> 0; + if (typeof e != "function") + throw new TypeError("predicate must be a function"); + for (var n = arguments[1], r = 0; r < i; ) { + var a = t[r]; + if (e.call(n, a, r, t)) return a; + r++; + } + }, + }), + Object.entries || + (Object.entries = function (s) { + for (var e = Object.keys(s), t = e.length, i = new Array(t); t--; ) + i[t] = [e[t], s[e[t]]]; + return i; + }), + Object.values || + (Object.values = function (s) { + for (var e = Object.keys(s), t = e.length, i = new Array(t); t--; ) + i[t] = s[e[t]]; + return i; + }), + typeof Object.assign != "function" && + Object.defineProperty(Object, "assign", { + value: function (e, t) { + if (e == null) + throw new TypeError("Cannot convert undefined or null to object"); + for (var i = Object(e), n = 1; n < arguments.length; n++) { + var r = arguments[n]; + if (r != null) + for (var a in r) + Object.prototype.hasOwnProperty.call(r, a) && (i[a] = r[a]); + } + return i; + }, + writable: !0, + configurable: !0, + }), + Array.prototype.findIndex || + Object.defineProperty(Array.prototype, "findIndex", { + value: function (e) { + if (this == null) + throw new TypeError('"this" is null or not defined'); + var t = Object(this), + i = t.length >>> 0; + if (typeof e != "function") + throw new TypeError("predicate must be a function"); + for (var n = arguments[1], r = 0; r < i; ) { + var a = t[r]; + if (e.call(n, a, r, t)) return r; + r++; + } + return -1; + }, + configurable: !0, + writable: !0, + }); + var ku = + "data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAC721kYXQhEAUgpBv/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3pwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCEQBSCkG//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADengAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAsJtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAALwABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAB7HRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAIAAAAAAAAALwAAAAAAAAAAAAAAAQEAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAAC8AAAAAAAEAAAAAAWRtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAAKxEAAAIAFXEAAAAAAAtaGRscgAAAAAAAAAAc291bgAAAAAAAAAAAAAAAFNvdW5kSGFuZGxlcgAAAAEPbWluZgAAABBzbWhkAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAADTc3RibAAAAGdzdHNkAAAAAAAAAAEAAABXbXA0YQAAAAAAAAABAAAAAAAAAAAAAgAQAAAAAKxEAAAAAAAzZXNkcwAAAAADgICAIgACAASAgIAUQBUAAAAAAfQAAAHz+QWAgIACEhAGgICAAQIAAAAYc3R0cwAAAAAAAAABAAAAAgAABAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAIAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAFzAAABdAAAABRzdGNvAAAAAAAAAAEAAAAsAAAAYnVkdGEAAABabWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAtaWxzdAAAACWpdG9vAAAAHWRhdGEAAAABAAAAAExhdmY1Ni40MC4xMDE=", + Cs = { mp4: ku }, + Su = [ + { name: "Chromium", group: "Chrome", identifier: "Chromium/([0-9.]*)" }, + { + name: "Chrome Mobile", + group: "Chrome", + identifier: "Chrome/([0-9.]*) Mobile", + versionIdentifier: "Chrome/([0-9.]*)", + }, + { name: "Chrome", group: "Chrome", identifier: "Chrome/([0-9.]*)" }, + { + name: "Chrome for iOS", + group: "Chrome", + identifier: "CriOS/([0-9.]*)", + }, + { + name: "Android Browser", + group: "Chrome", + identifier: "CrMo/([0-9.]*)", + }, + { name: "Firefox", group: "Firefox", identifier: "Firefox/([0-9.]*)" }, + { + name: "Opera Mini", + group: "Opera", + identifier: "Opera Mini/([0-9.]*)", + }, + { name: "Opera", group: "Opera", identifier: "Opera ([0-9.]*)" }, + { + name: "Opera", + group: "Opera", + identifier: "Opera/([0-9.]*)", + versionIdentifier: "Version/([0-9.]*)", + }, + { name: "IEMobile", group: "Explorer", identifier: "IEMobile/([0-9.]*)" }, + { + name: "Internet Explorer", + group: "Explorer", + identifier: "MSIE ([a-zA-Z0-9.]*)", + }, + { + name: "Internet Explorer", + group: "Explorer", + identifier: "Trident/([0-9.]*)", + versionIdentifier: "rv:([0-9.]*)", + }, + { + name: "Spartan", + group: "Spartan", + identifier: "Edge/([0-9.]*)", + versionIdentifier: "Edge/([0-9.]*)", + }, + { + name: "Safari", + group: "Safari", + identifier: "Safari/([0-9.]*)", + versionIdentifier: "Version/([0-9.]*)", + }, + ], + Cu = [ + { + name: "Windows 2000", + group: "Windows", + identifier: "Windows NT 5.0", + version: "5.0", + }, + { + name: "Windows XP", + group: "Windows", + identifier: "Windows NT 5.1", + version: "5.1", + }, + { + name: "Windows Vista", + group: "Windows", + identifier: "Windows NT 6.0", + version: "6.0", + }, + { + name: "Windows 7", + group: "Windows", + identifier: "Windows NT 6.1", + version: "7.0", + }, + { + name: "Windows 8", + group: "Windows", + identifier: "Windows NT 6.2", + version: "8.0", + }, + { + name: "Windows 8.1", + group: "Windows", + identifier: "Windows NT 6.3", + version: "8.1", + }, + { + name: "Windows 10", + group: "Windows", + identifier: "Windows NT 10.0", + version: "10.0", + }, + { + name: "Windows Phone", + group: "Windows Phone", + identifier: "Windows Phone ([0-9.]*)", + }, + { + name: "Windows Phone", + group: "Windows Phone", + identifier: "Windows Phone OS ([0-9.]*)", + }, + { name: "Windows", group: "Windows", identifier: "Windows" }, + { name: "Chrome OS", group: "Chrome OS", identifier: "CrOS" }, + { + name: "Android", + group: "Android", + identifier: "Android", + versionIdentifier: "Android ([a-zA-Z0-9.-]*)", + }, + { + name: "iPad", + group: "iOS", + identifier: "iPad", + versionIdentifier: "OS ([0-9_]*)", + versionSeparator: "[_|.]", + }, + { + name: "iPod", + group: "iOS", + identifier: "iPod", + versionIdentifier: "OS ([0-9_]*)", + versionSeparator: "[_|.]", + }, + { + name: "iPhone", + group: "iOS", + identifier: "iPhone OS", + versionIdentifier: "OS ([0-9_]*)", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X High Sierra", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])13([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Sierra", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])12([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X El Capitan", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])11([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Yosemite", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])10([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Mavericks", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])9([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Mountain Lion", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])8([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Lion", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])7([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Snow Leopard", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])6([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Leopard", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])5([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Tiger", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])4([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Panther", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])3([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Jaguar", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])2([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Puma", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])1([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { + name: "Mac OS X Cheetah", + group: "Mac OS", + identifier: "Mac OS X (10([_|.])0([0-9_.]*))", + versionSeparator: "[_|.]", + }, + { name: "Mac OS", group: "Mac OS", identifier: "Mac OS" }, + { + name: "Ubuntu", + group: "Linux", + identifier: "Ubuntu", + versionIdentifier: "Ubuntu/([0-9.]*)", + }, + { name: "Debian", group: "Linux", identifier: "Debian" }, + { name: "Gentoo", group: "Linux", identifier: "Gentoo" }, + { name: "Linux", group: "Linux", identifier: "Linux" }, + { name: "BlackBerry", group: "BlackBerry", identifier: "BlackBerry" }, + ], + ie = {}, + xu = function () { + try { + return ( + localStorage.setItem("clappr", "clappr"), + localStorage.removeItem("clappr"), + !0 + ); + } catch { + return !1; + } + }, + Lu = function () { + try { + var e = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + return !!e; + } catch { + return !!( + navigator.mimeTypes && + navigator.mimeTypes["application/x-shockwave-flash"] !== void 0 && + navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin + ); + } + }, + Iu = function (e) { + var t = + e.match( + /\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i + ) || [], + i; + if (/trident/i.test(t[1])) + return ( + (i = /\brv[ :]+(\d+)/g.exec(e) || []), + { name: "IE", version: parseInt(i[1] || "") } + ); + if (t[1] === "Chrome") { + if (((i = e.match(/\bOPR\/(\d+)/)), i != null)) + return { name: "Opera", version: parseInt(i[1]) }; + if (((i = e.match(/\bEdge\/(\d+)/)), i != null)) + return { name: "Edge", version: parseInt(i[1]) }; + } else + /android/i.test(e) && + (i = e.match(/version\/(\d+)/i)) && + (t.splice(1, 1, "Android WebView"), t.splice(2, 1, i[1])); + return ( + (t = t[2] + ? [t[1], t[2]] + : [navigator.appName, navigator.appVersion, "-?"]), + { name: t[0], version: parseInt(t[1]) } + ); + }, + Ru = function () { + var e = {}, + t = ie.userAgent.toLowerCase(), + i = Ss(Su), + n; + try { + for (i.s(); !(n = i.n()).done; ) { + var r = n.value, + a = new RegExp(r.identifier.toLowerCase()), + o = a.exec(t); + if (o != null && o[1]) { + if (((e.name = r.name), (e.group = r.group), r.versionIdentifier)) { + var l = new RegExp(r.versionIdentifier.toLowerCase()), + u = l.exec(t); + u != null && u[1] && xs(u[1], e); + } else xs(o[1], e); + break; + } + } + } catch (c) { + i.e(c); + } finally { + i.f(); + } + return e; + }, + xs = function (e, t) { + var i = e.split(".", 2); + (t.fullVersion = e), + i[0] && (t.majorVersion = parseInt(i[0])), + i[1] && (t.minorVersion = parseInt(i[1])); + }, + Pu = function () { + var e = {}, + t = ie.userAgent.toLowerCase(), + i = Ss(Cu), + n; + try { + for (i.s(); !(n = i.n()).done; ) { + var r = n.value, + a = new RegExp(r.identifier.toLowerCase()), + o = a.exec(t); + if (o != null) { + if (((e.name = r.name), (e.group = r.group), r.version)) + Nn(r.version, r.versionSeparator ? r.versionSeparator : ".", e); + else if (o[1]) + Nn(o[1], r.versionSeparator ? r.versionSeparator : ".", e); + else if (r.versionIdentifier) { + var l = new RegExp(r.versionIdentifier.toLowerCase()), + u = l.exec(t); + u != null && + u[1] && + Nn(u[1], r.versionSeparator ? r.versionSeparator : ".", e); + } + break; + } + } + } catch (c) { + i.e(c); + } finally { + i.f(); + } + return e; + }, + Nn = function (e, t, i) { + var n = t.substr(0, 1) == "[" ? new RegExp(t, "g") : t, + r = e.split(n, 2); + t != "." && (e = e.replace(new RegExp(t, "g"), ".")), + (i.fullVersion = e), + r && r[0] && (i.majorVersion = parseInt(r[0])), + r && r[1] && (i.minorVersion = parseInt(r[1])); + }, + wu = function () { + var e = {}; + return ( + (e.width = ue(window).width()), (e.height = ue(window).height()), e + ); + }, + Du = function () { + switch (window.orientation) { + case -90: + case 90: + ie.viewport.orientation = "landscape"; + break; + default: + ie.viewport.orientation = "portrait"; + break; + } + }, + Ou = function (e) { + var t = /\((iP(?:hone|ad|od))?(?:[^;]*; ){0,2}([^)]+(?=\)))/, + i = t.exec(e), + n = (i && (i[1] || i[2])) || ""; + return n; + }, + Ls = Iu(navigator.userAgent); + (ie.isEdge = /Edg|EdgiOS|EdgA/i.test(navigator.userAgent)), + (ie.isChrome = /Chrome|CriOS/i.test(navigator.userAgent) && !ie.isEdge), + (ie.isSafari = + /Safari/i.test(navigator.userAgent) && !ie.isChrome && !ie.isEdge), + (ie.isFirefox = /Firefox/i.test(navigator.userAgent)), + (ie.isLegacyIE = !!window.ActiveXObject), + (ie.isIE = ie.isLegacyIE || /trident.*rv:1\d/i.test(navigator.userAgent)), + (ie.isIE11 = /trident.*rv:11/i.test(navigator.userAgent)), + (ie.isChromecast = ie.isChrome && /CrKey/i.test(navigator.userAgent)), + (ie.isMobile = + /Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Mobile Safari|Opera Mini/i.test( + navigator.userAgent + )), + (ie.isiOS = /iPad|iPhone|iPod/i.test(navigator.userAgent)), + (ie.isAndroid = /Android/i.test(navigator.userAgent)), + (ie.isWindowsPhone = /Windows Phone/i.test(navigator.userAgent)), + (ie.isWin8App = /MSAppHost/i.test(navigator.userAgent)), + (ie.isWiiU = /WiiU/i.test(navigator.userAgent)), + (ie.isPS4 = /PlayStation 4/i.test(navigator.userAgent)), + (ie.hasLocalstorage = xu()), + (ie.hasFlash = Lu()), + (ie.name = Ls.name), + (ie.version = Ls.version), + (ie.userAgent = navigator.userAgent), + (ie.data = Ru()), + (ie.os = Pu()), + (ie.isWindows = /^Windows$/i.test(ie.os.group)), + (ie.isMacOS = /^Mac OS$/i.test(ie.os.group)), + (ie.isLinux = /^Linux$/i.test(ie.os.group)), + (ie.viewport = wu()), + (ie.device = Ou(ie.userAgent)), + typeof window.orientation < "u" && Du(); + var Fn = {}, + Mn = [], + Is = ( + window.requestAnimationFrame || + window.mozRequestAnimationFrame || + window.webkitRequestAnimationFrame || + function (s) { + window.setTimeout(s, 1e3 / 60); + } + ).bind(window), + Rs = ( + window.cancelAnimationFrame || + window.mozCancelAnimationFrame || + window.webkitCancelAnimationFrame || + window.clearTimeout + ).bind(window); + function Ps(s, e) { + if (e) + for (var t in e) { + var i = Object.getOwnPropertyDescriptor(e, t); + i ? Object.defineProperty(s, t, i) : (s[t] = e[t]); + } + return s; + } + function si(s, e) { + var t = (function (i) { + function n() { + var r; + Te(this, n); + for (var a = arguments.length, o = new Array(a), l = 0; l < a; l++) + o[l] = arguments[l]; + return ( + (r = De(this, n, [].concat(o))), + e.initialize && e.initialize.apply(r, o), + r + ); + } + return Oe(n, i), be(n); + })(s); + return Ps(t.prototype, e), t; + } + function Nu(s, e) { + if (!isFinite(s)) return "--:--"; + (s = s * 1e3), (s = parseInt(s / 1e3)); + var t = s % 60; + s = parseInt(s / 60); + var i = s % 60; + s = parseInt(s / 60); + var n = s % 24, + r = parseInt(s / 24), + a = ""; + return ( + r && r > 0 && ((a += r + ":"), n < 1 && (a += "00:")), + ((n && n > 0) || e) && (a += ("0" + n).slice(-2) + ":"), + (a += ("0" + i).slice(-2) + ":"), + (a += ("0" + t).slice(-2)), + a.trim() + ); + } + var Ei = { + fullscreenElement: function () { + return ( + document.fullscreenElement || + document.webkitFullscreenElement || + document.mozFullScreenElement || + document.msFullscreenElement + ); + }, + requestFullscreen: function (e) { + if (e.requestFullscreen) return e.requestFullscreen(); + if (e.webkitRequestFullscreen) { + if (typeof e.then == "function") return e.webkitRequestFullscreen(); + e.webkitRequestFullscreen(); + } else { + if (e.mozRequestFullScreen) return e.mozRequestFullScreen(); + if (e.msRequestFullscreen) return e.msRequestFullscreen(); + e.querySelector && + e.querySelector("video") && + e.querySelector("video").webkitEnterFullScreen + ? e.querySelector("video").webkitEnterFullScreen() + : e.webkitEnterFullScreen && e.webkitEnterFullScreen(); + } + }, + cancelFullscreen: function () { + var e = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : document; + e.exitFullscreen + ? e.exitFullscreen() + : e.webkitCancelFullScreen + ? e.webkitCancelFullScreen() + : e.webkitExitFullscreen + ? e.webkitExitFullscreen() + : e.mozCancelFullScreen + ? e.mozCancelFullScreen() + : e.msExitFullscreen && e.msExitFullscreen(); + }, + fullscreenEnabled: function () { + return !!( + document.fullscreenEnabled || + document.webkitFullscreenEnabled || + document.mozFullScreenEnabled || + document.msFullscreenEnabled + ); + }, + }, + Fu = (function () { + function s() { + Te(this, s); + } + return be(s, null, [ + { + key: "_defaultConfig", + value: function () { + return { volume: { value: 100, parse: parseInt } }; + }, + }, + { + key: "_defaultValueFor", + value: function (t) { + try { + return this._defaultConfig()[t].parse( + this._defaultConfig()[t].value + ); + } catch { + return; + } + }, + }, + { + key: "_createKeyspace", + value: function (t) { + return "clappr.".concat(document.domain, ".").concat(t); + }, + }, + { + key: "restore", + value: function (t) { + return ie.hasLocalstorage && localStorage[this._createKeyspace(t)] + ? this._defaultConfig()[t].parse( + localStorage[this._createKeyspace(t)] + ) + : this._defaultValueFor(t); + }, + }, + { + key: "persist", + value: function (t, i) { + if (ie.hasLocalstorage) + try { + return (localStorage[this._createKeyspace(t)] = i), !0; + } catch { + return !1; + } + }, + }, + ]); + })(), + Bn = (function () { + function s() { + Te(this, s); + } + return be(s, null, [ + { + key: "params", + get: function () { + var t = window.location.search.substring(1); + return ( + t !== this.query && + ((this._urlParams = this.parse(t)), (this.query = t)), + this._urlParams + ); + }, + }, + { + key: "hashParams", + get: function () { + var t = window.location.hash.substring(1); + return ( + t !== this.hash && + ((this._hashParams = this.parse(t)), (this.hash = t)), + this._hashParams + ); + }, + }, + { + key: "parse", + value: function (t) { + for ( + var i, + n = /\+/g, + r = /([^&=]+)=?([^&]*)/g, + a = function (u) { + return decodeURIComponent(u.replace(n, " ")); + }, + o = {}; + (i = r.exec(t)); + + ) + o[a(i[1]).toLowerCase()] = a(i[2]); + return o; + }, + }, + ]); + })(); + function ws() { + var s = + arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "t", + e = 0, + t = Bn.params[s] || Bn.hashParams[s] || "", + i = t.match(/[0-9]+[hms]+/g) || []; + if (i.length > 0) { + var n = { h: 3600, m: 60, s: 1 }; + i.forEach(function (r) { + if (r) { + var a = r[r.length - 1], + o = parseInt(r.slice(0, r.length - 1), 10); + e += o * n[a]; + } + }); + } else t && (e = parseInt(t, 10)); + return e; + } + function ai(s) { + Fn[s] || (Fn[s] = 0); + var e = ++Fn[s]; + return s + e; + } + function Gi(s) { + return s - parseFloat(s) + 1 >= 0; + } + function Ds() { + var s = document.getElementsByTagName("script"); + return s.length ? s[s.length - 1].src : ""; + } + function Os() { + return window.navigator && window.navigator.language; + } + function Mu() { + return window.performance && window.performance.now + ? performance.now() + : Date.now(); + } + function Bu(s, e) { + var t = s.indexOf(e); + t >= 0 && s.splice(t, 1); + } + function Uu(s, e) { + return s === void 0 || e === void 0 + ? !1 + : e.find(function (t) { + return s.toLowerCase() === t.toLowerCase(); + }) !== void 0; + } + function Ns(s, e) { + e = Object.assign( + { + inline: !1, + muted: !1, + timeout: 250, + type: "video", + source: Cs.mp4, + element: null, + }, + e + ); + var t = e.element ? e.element : document.createElement(e.type); + (t.muted = e.muted), + e.muted === !0 && t.setAttribute("muted", "muted"), + e.inline === !0 && t.setAttribute("playsinline", "playsinline"), + (t.src = e.source); + var i = t.play(), + n = setTimeout(function () { + r(!1, new Error("Timeout ".concat(e.timeout, " ms has been reached"))); + }, e.timeout), + r = function (o) { + var l = + arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; + clearTimeout(n), s(o, l); + }; + i !== void 0 + ? i + .then(function () { + return r(!0); + }) + .catch(function (a) { + return r(!1, a); + }) + : r(!0); + } + var oi = (function () { + function s() { + Te(this, s); + } + return be(s, null, [ + { + key: "configure", + value: function (t) { + this.options = ue.extend(!0, this.options, t); + }, + }, + { + key: "create", + value: function (t) { + return this.options.recycleVideo && t === "video" && Mn.length > 0 + ? Mn.shift() + : document.createElement(t); + }, + }, + { + key: "garbage", + value: function (t) { + !this.options.recycleVideo || + t.tagName.toUpperCase() !== "VIDEO" || + (ue(t).children().remove(), + Object.values(t.attributes).forEach(function (i) { + return t.removeAttribute(i.name); + }), + Mn.push(t)); + }, + }, + ]); + })(); + oi.options = { recycleVideo: !1 }; + var Fs = (function () { + function s() { + var e = + arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 500; + Te(this, s), (this.delay = e), (this.lastTime = 0); + } + return be(s, [ + { + key: "handle", + value: function (t, i) { + var n = + arguments.length > 2 && arguments[2] !== void 0 + ? arguments[2] + : !0, + r = new Date().getTime(), + a = r - this.lastTime; + a < this.delay && a > 0 && (i(), n && t.preventDefault()), + (this.lastTime = r); + }, + }, + ]); + })(), + Ms = { + Config: Fu, + Fullscreen: Ei, + QueryString: Bn, + DomRecycler: oi, + assign: Ps, + extend: si, + formatTime: Nu, + seekStringToSeconds: ws, + uniqueId: ai, + currentScriptUrl: Ds, + isNumber: Gi, + requestAnimationFrame: Is, + cancelAnimationFrame: Rs, + getBrowserLanguage: Os, + now: Mu, + removeArrayItem: Bu, + listContainsIgnoreCase: Uu, + canAutoPlayMedia: Ns, + Media: Cs, + DoubleEventHandler: Fs, + }, + Ki = "font-weight: bold; font-size: 13px;", + $u = "color: #006600;" + Ki, + Vu = "color: #0000ff;" + Ki, + Bs = "color: #ff8000;" + Ki, + Us = "color: #ff0000;" + Ki, + $s = 0, + Un = 1, + Vs = 2, + $n = 3, + Gu = $n, + Ku = [Vu, $u, Bs, Us, Us], + Gs = ["debug", "info", "warn", "error", "disabled"], + le = (function () { + function s() { + var e = + arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Un, + t = + arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Gu; + Te(this, s), + (this.EXCLUDE_LIST = [ + "timeupdate", + "playback:timeupdate", + "playback:progress", + "container:hover", + "container:timeupdate", + "container:progress", + "core:mousemove", + ]), + (this.level = e), + (this.previousLevel = this.level), + (this.offLevel = t); + } + return be(s, [ + { + key: "level", + get: function () { + return this._level; + }, + set: function (t) { + this._level = t; + }, + }, + { + key: "debug", + value: function (t) { + this.log(t, $s, Array.prototype.slice.call(arguments, 1)); + }, + }, + { + key: "info", + value: function (t) { + this.log(t, Un, Array.prototype.slice.call(arguments, 1)); + }, + }, + { + key: "warn", + value: function (t) { + this.log(t, Vs, Array.prototype.slice.call(arguments, 1)); + }, + }, + { + key: "error", + value: function (t) { + this.log(t, $n, Array.prototype.slice.call(arguments, 1)); + }, + }, + { + key: "onOff", + value: function () { + this.level === this.offLevel + ? (this.level = this.previousLevel) + : ((this.previousLevel = this.level), + (this.level = this.offLevel)), + window.console && + window.console.log && + window.console.log( + "%c[Clappr.Log] set log level to " + Gs[this.level], + Bs + ); + }, + }, + { + key: "log", + value: function (t, i, n) { + if (!(i < this.level) && !(this.EXCLUDE_LIST.indexOf(n[0]) >= 0)) { + n || ((n = t), (t = null)); + var r = Ku[i], + a = ""; + t && (a = "[" + t + "]"), + window.console && + window.console.log && + window.console.log.apply( + console, + ["%c[" + Gs[i] + "]" + a, r].concat(n) + ); + } + }, + }, + ]); + })(); + (le.LEVEL_DEBUG = $s), + (le.LEVEL_INFO = Un), + (le.LEVEL_WARN = Vs), + (le.LEVEL_ERROR = $n), + (le.getInstance = function () { + return ( + this._instance === void 0 && (this._instance = new this()), + this._instance + ); + }), + (le.setLevel = function (s) { + this.getInstance().level = s; + }), + (le.debug = function () { + this.getInstance().debug.apply(this.getInstance(), arguments); + }), + (le.info = function () { + this.getInstance().info.apply(this.getInstance(), arguments); + }), + (le.warn = function () { + this.getInstance().warn.apply(this.getInstance(), arguments); + }), + (le.error = function () { + this.getInstance().error.apply(this.getInstance(), arguments); + }); + var Hu = Array.prototype.slice, + Ks = /\s+/, + Hi = function (e, t, i, n) { + if (!i) return !0; + if (Vt(i) === "object") { + for (var r in i) e[t].apply(e, [r, i[r]].concat(n)); + return !1; + } + if (Ks.test(i)) { + for (var a = i.split(Ks), o = 0, l = a.length; o < l; o++) + e[t].apply(e, [a[o]].concat(n)); + return !1; + } + return !0; + }, + Hs = function (e, t, i, n) { + var r, + a = -1, + o = e.length, + l = t[0], + u = t[1], + c = t[2]; + d(); + function d() { + try { + switch (t.length) { + case 0: + for (; ++a < o; ) (r = e[a]).callback.call(r.ctx); + return; + case 1: + for (; ++a < o; ) (r = e[a]).callback.call(r.ctx, l); + return; + case 2: + for (; ++a < o; ) (r = e[a]).callback.call(r.ctx, l, u); + return; + case 3: + for (; ++a < o; ) (r = e[a]).callback.call(r.ctx, l, u, c); + return; + default: + for (; ++a < o; ) (r = e[a]).callback.apply(r.ctx, t); + return; + } + } catch (f) { + le.error.apply(le, [i, "error on event", n, "trigger", "-", f]), d(); + } + } + }, + C = (function () { + function s() { + Te(this, s); + } + return be( + s, + [ + { + key: "on", + value: function (t, i, n) { + if (!Hi(this, "on", t, [i, n]) || !i) return this; + this._events || (this._events = {}); + var r = this._events[t] || (this._events[t] = []); + return r.push({ callback: i, context: n, ctx: n || this }), this; + }, + }, + { + key: "once", + value: function (t, i, n) { + var r = this, + a; + if (!Hi(this, "once", t, [i, n]) || !i) return this; + var o = function () { + return r.off(t, a); + }; + return ( + (a = function () { + o(), i.apply(this, arguments); + }), + (a._callback = i), + this.on(t, a, n) + ); + }, + }, + { + key: "off", + value: function (t, i, n) { + var r, a, o, l, u, c, d, f; + if (!this._events || !Hi(this, "off", t, [i, n])) return this; + if (!t && !i && !n) return (this._events = void 0), this; + for ( + l = t ? [t] : Object.keys(this._events), u = 0, c = l.length; + u < c; + u++ + ) + if (((t = l[u]), (o = this._events[t]), o)) { + if (((this._events[t] = r = []), i || n)) + for (d = 0, f = o.length; d < f; d++) + (a = o[d]), + ((i && + i !== a.callback && + i !== a.callback._callback) || + (n && n !== a.context)) && + r.push(a); + r.length || delete this._events[t]; + } + return this; + }, + }, + { + key: "trigger", + value: function (t) { + var i = this.name || this.constructor.name; + if ( + (le.debug.apply( + le, + [i].concat(Array.prototype.slice.call(arguments)) + ), + !this._events) + ) + return this; + var n = Hu.call(arguments, 1); + if (!Hi(this, "trigger", t, n)) return this; + var r = this._events[t], + a = this._events.all; + return r && Hs(r, n, i, t), a && Hs(a, arguments, i, t), this; + }, + }, + { + key: "stopListening", + value: function (t, i, n) { + var r = this._listeningTo; + if (!r) return this; + var a = !i && !n; + !n && Vt(i) === "object" && (n = this), + t && ((r = {})[t._listenId] = t); + for (var o in r) + (t = r[o]), + t.off(i, n, this), + (a || Object.keys(t._events).length === 0) && + delete this._listeningTo[o]; + return this; + }, + }, + ], + [ + { + key: "register", + value: function (t) { + s.Custom || (s.Custom = {}); + var i = typeof t == "string" && t.toUpperCase().trim(); + i && !s.Custom[i] + ? (s.Custom[i] = i + .toLowerCase() + .split("_") + .map(function (n, r) { + return r === 0 + ? n + : (n = n[0].toUpperCase() + n.slice(1)); + }) + .join("")) + : le.error("Events", "Error when register event: " + t); + }, + }, + { + key: "listAvailableCustomEvents", + value: function () { + return ( + s.Custom || (s.Custom = {}), + Object.keys(s.Custom).filter(function (t) { + return typeof s.Custom[t] == "string"; + }) + ); + }, + }, + ] + ); + })(); + (C.prototype.listenTo = function (s, e, t) { + var i = this._listeningTo || (this._listeningTo = {}), + n = s._listenId || (s._listenId = ai("l")); + return ( + (i[n] = s), !t && Vt(e) === "object" && (t = this), s.on(e, t, this), this + ); + }), + (C.prototype.listenToOnce = function (s, e, t) { + var i = this._listeningTo || (this._listeningTo = {}), + n = s._listenId || (s._listenId = ai("l")); + return ( + (i[n] = s), + !t && Vt(e) === "object" && (t = this), + s.once(e, t, this), + this + ); + }), + (C.PLAYER_READY = "ready"), + (C.PLAYER_RESIZE = "resize"), + (C.PLAYER_FULLSCREEN = "fullscreen"), + (C.PLAYER_PLAY = "play"), + (C.PLAYER_PAUSE = "pause"), + (C.PLAYER_STOP = "stop"), + (C.PLAYER_ENDED = "ended"), + (C.PLAYER_SEEK = "seek"), + (C.PLAYER_ERROR = "playererror"), + (C.ERROR = "error"), + (C.PLAYER_TIMEUPDATE = "timeupdate"), + (C.PLAYER_VOLUMEUPDATE = "volumeupdate"), + (C.PLAYER_SUBTITLE_AVAILABLE = "subtitleavailable"), + (C.PLAYBACK_PIP_ENTER = "playback:picture-in-picture:enter"), + (C.PLAYBACK_PIP_EXIT = "playback:picture-in-picture:exit"), + (C.PLAYBACK_PROGRESS = "playback:progress"), + (C.PLAYBACK_TIMEUPDATE = "playback:timeupdate"), + (C.PLAYBACK_READY = "playback:ready"), + (C.PLAYBACK_BUFFERING = "playback:buffering"), + (C.PLAYBACK_BUFFERFULL = "playback:bufferfull"), + (C.PLAYBACK_SETTINGSUPDATE = "playback:settingsupdate"), + (C.PLAYBACK_LOADEDMETADATA = "playback:loadedmetadata"), + (C.PLAYBACK_HIGHDEFINITIONUPDATE = "playback:highdefinitionupdate"), + (C.PLAYBACK_BITRATE = "playback:bitrate"), + (C.PLAYBACK_LEVELS_AVAILABLE = "playback:levels:available"), + (C.PLAYBACK_LEVEL_SWITCH_START = "playback:levels:switch:start"), + (C.PLAYBACK_LEVEL_SWITCH_END = "playback:levels:switch:end"), + (C.PLAYBACK_PLAYBACKSTATE = "playback:playbackstate"), + (C.PLAYBACK_DVR = "playback:dvr"), + (C.PLAYBACK_MEDIACONTROL_DISABLE = "playback:mediacontrol:disable"), + (C.PLAYBACK_MEDIACONTROL_ENABLE = "playback:mediacontrol:enable"), + (C.PLAYBACK_ENDED = "playback:ended"), + (C.PLAYBACK_PLAY_INTENT = "playback:play:intent"), + (C.PLAYBACK_PLAY = "playback:play"), + (C.PLAYBACK_PAUSE = "playback:pause"), + (C.PLAYBACK_SEEK = "playback:seek"), + (C.PLAYBACK_SEEKED = "playback:seeked"), + (C.PLAYBACK_STOP = "playback:stop"), + (C.PLAYBACK_ERROR = "playback:error"), + (C.PLAYBACK_STATS_ADD = "playback:stats:add"), + (C.PLAYBACK_FRAGMENT_LOADED = "playback:fragment:loaded"), + (C.PLAYBACK_FRAGMENT_BUFFERED = "playback:fragment:buffered"), + (C.PLAYBACK_LEVEL_SWITCH = "playback:level:switch"), + (C.PLAYBACK_SUBTITLE_AVAILABLE = "playback:subtitle:available"), + (C.PLAYBACK_SUBTITLE_CHANGED = "playback:subtitle:changed"), + (C.PLAYBACK_AUDIO_AVAILABLE = "playback:audio:available"), + (C.PLAYBACK_AUDIO_CHANGED = "playback:audio:changed"), + (C.PLAYBACK_RESIZE = "playback:resize"), + (C.CORE_CONTAINERS_CREATED = "core:containers:created"), + (C.CORE_ACTIVE_CONTAINER_CHANGED = "core:active:container:changed"), + (C.CORE_OPTIONS_CHANGE = "core:options:change"), + (C.CORE_READY = "core:ready"), + (C.CORE_FULLSCREEN = "core:fullscreen"), + (C.CORE_RESIZE = "core:resize"), + (C.CORE_SCREEN_ORIENTATION_CHANGED = "core:screen:orientation:changed"), + (C.CORE_MOUSE_MOVE = "core:mousemove"), + (C.CORE_MOUSE_LEAVE = "core:mouseleave"), + (C.CONTAINER_PLAYBACKSTATE = "container:playbackstate"), + (C.CONTAINER_PLAYBACKDVRSTATECHANGED = "container:dvr"), + (C.CONTAINER_BITRATE = "container:bitrate"), + (C.CONTAINER_STATS_REPORT = "container:stats:report"), + (C.CONTAINER_DESTROYED = "container:destroyed"), + (C.CONTAINER_READY = "container:ready"), + (C.CONTAINER_RESIZE = "container:resize"), + (C.CONTAINER_ERROR = "container:error"), + (C.CONTAINER_LOADEDMETADATA = "container:loadedmetadata"), + (C.CONTAINER_SUBTITLE_AVAILABLE = "container:subtitle:available"), + (C.CONTAINER_SUBTITLE_CHANGED = "container:subtitle:changed"), + (C.CONTAINER_AUDIO_AVAILABLE = "container:audio:available"), + (C.CONTAINER_AUDIO_CHANGED = "container:audio:changed"), + (C.CONTAINER_TIMEUPDATE = "container:timeupdate"), + (C.CONTAINER_PROGRESS = "container:progress"), + (C.CONTAINER_PLAY = "container:play"), + (C.CONTAINER_STOP = "container:stop"), + (C.CONTAINER_PAUSE = "container:pause"), + (C.CONTAINER_ENDED = "container:ended"), + (C.CONTAINER_CLICK = "container:click"), + (C.CONTAINER_DBLCLICK = "container:dblclick"), + (C.CONTAINER_CONTEXTMENU = "container:contextmenu"), + (C.CONTAINER_MOUSE_ENTER = "container:mouseenter"), + (C.CONTAINER_MOUSE_LEAVE = "container:mouseleave"), + (C.CONTAINER_MOUSE_UP = "container:mouseup"), + (C.CONTAINER_MOUSE_DOWN = "container:mousedown"), + (C.CONTAINER_PIP_ENTER = "container:picture-in-picture:enter"), + (C.CONTAINER_PIP_EXIT = "container:picture-in-picture:exit"), + (C.CONTAINER_SEEK = "container:seek"), + (C.CONTAINER_SEEKED = "container:seeked"), + (C.CONTAINER_VOLUME = "container:volume"), + (C.CONTAINER_FULLSCREEN = "container:fullscreen"), + (C.CONTAINER_STATE_BUFFERING = "container:state:buffering"), + (C.CONTAINER_STATE_BUFFERFULL = "container:state:bufferfull"), + (C.CONTAINER_SETTINGSUPDATE = "container:settingsupdate"), + (C.CONTAINER_HIGHDEFINITIONUPDATE = "container:highdefinitionupdate"), + (C.CONTAINER_MEDIACONTROL_SHOW = "container:mediacontrol:show"), + (C.CONTAINER_MEDIACONTROL_HIDE = "container:mediacontrol:hide"), + (C.CONTAINER_MEDIACONTROL_DISABLE = "container:mediacontrol:disable"), + (C.CONTAINER_MEDIACONTROL_ENABLE = "container:mediacontrol:enable"), + (C.CONTAINER_STATS_ADD = "container:stats:add"), + (C.CONTAINER_OPTIONS_CHANGE = "container:options:change"), + (C.MEDIACONTROL_RENDERED = "mediacontrol:rendered"), + (C.MEDIACONTROL_FULLSCREEN = "mediacontrol:fullscreen"), + (C.MEDIACONTROL_SHOW = "mediacontrol:show"), + (C.MEDIACONTROL_HIDE = "mediacontrol:hide"), + (C.MEDIACONTROL_MOUSEMOVE_SEEKBAR = "mediacontrol:mousemove:seekbar"), + (C.MEDIACONTROL_MOUSELEAVE_SEEKBAR = "mediacontrol:mouseleave:seekbar"), + (C.MEDIACONTROL_PLAYING = "mediacontrol:playing"), + (C.MEDIACONTROL_NOTPLAYING = "mediacontrol:notplaying"), + (C.MEDIACONTROL_CONTAINERCHANGED = "mediacontrol:containerchanged"), + (C.MEDIACONTROL_OPTIONS_CHANGE = "mediacontrol:options:change"); + var Kt = (function (s) { + function e() { + var t, + i = + arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + return ( + Te(this, e), + (t = De(this, e, [i])), + (t._options = i), + (t.uniqueId = ai("o")), + t + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "options", + get: function () { + return this._options; + }, + }, + ]) + ); + })(C), + Ht = { + evaluate: /<%([\s\S]+?)%>/g, + interpolate: /<%=([\s\S]+?)%>/g, + escape: /<%-([\s\S]+?)%>/g, + }, + Vn = /(.)^/, + Yu = { + "'": "'", + "\\": "\\", + "\r": "r", + "\n": "n", + " ": "t", + "\u2028": "u2028", + "\u2029": "u2029", + }, + zu = /\\|'|\r|\n|\t|\u2028|\u2029/g, + Wu = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + }, + ju = new RegExp(`[&<>"']`, "g"), + Ys = function (e) { + return e === null + ? "" + : ("" + e).replace(ju, function (t) { + return Wu[t]; + }); + }, + qu = 0, + Yi = function (e, t) { + var i, + n = new RegExp( + [ + (Ht.escape || Vn).source, + (Ht.interpolate || Vn).source, + (Ht.evaluate || Vn).source, + ].join("|") + "|$", + "g" + ), + r = 0, + a = "__p+='"; + e.replace(n, function (l, u, c, d, f) { + return ( + (a += e.slice(r, f).replace(zu, function (g) { + return "\\" + Yu[g]; + })), + u && + (a += + `'+ +((__t=(` + + u + + `))==null?'':escapeExpr(__t))+ +'`), + c && + (a += + `'+ +((__t=(` + + c + + `))==null?'':__t)+ +'`), + d && + (a += + `'; +` + + d + + ` +__p+='`), + (r = f + l.length), + l + ); + }), + (a += `'; +`), + Ht.variable || + (a = + `with(obj||{}){ +` + + a + + `} +`), + (a = + `var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');}; +` + + a + + `return __p; +//# sourceURL=/microtemplates/source[` + + qu++ + + "]"); + try { + i = new Function(Ht.variable || "obj", "escapeExpr", a); + } catch (l) { + throw ((l.source = a), l); + } + if (t) return i(t, Ys); + var o = function (u) { + return i.call(this, u, Ys); + }; + return ( + (o.source = + "function(" + + (Ht.variable || "obj") + + `){ +` + + a + + "}"), + o + ); + }; + Yi.settings = Ht; + var li = { + getStyleFor: function (e) { + var t = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : { baseUrl: "" }; + return ue('<style class="clappr-style"></style>').html( + Yi(e.toString())(t) + ); + }, + }, + Xu = /^(\S+)\s*(.*)$/, + Ti = (function (s) { + function e(t) { + var i; + return ( + Te(this, e), + (i = De(this, e, [t])), + (i.cid = ai("c")), + i._ensureElement(), + i.delegateEvents(), + i + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "tagName", + get: function () { + return "div"; + }, + }, + { + key: "events", + get: function () { + return {}; + }, + }, + { + key: "attributes", + get: function () { + return {}; + }, + }, + { + key: "$", + value: function (i) { + return this.$el.find(i); + }, + }, + { + key: "render", + value: function () { + return this; + }, + }, + { + key: "destroy", + value: function () { + return ( + this.$el.remove(), + this.stopListening(), + this.undelegateEvents(), + this + ); + }, + }, + { + key: "setElement", + value: function (i, n) { + return ( + this.$el && this.undelegateEvents(), + (this.$el = ue.zepto.isZ(i) ? i : ue(i)), + (this.el = this.$el[0]), + n !== !1 && this.delegateEvents(), + this + ); + }, + }, + { + key: "delegateEvents", + value: function (i) { + i || (i = this.events), this.undelegateEvents(); + for (var n in i) { + var r = i[n]; + if ( + (r && r.constructor !== Function && (r = this[i[n]]), !!r) + ) { + var a = n.match(Xu), + o = a[1], + l = a[2]; + (o += ".delegateEvents" + this.cid), + l === "" + ? this.$el.on(o, r.bind(this)) + : this.$el.on(o, l, r.bind(this)); + } + } + return this; + }, + }, + { + key: "undelegateEvents", + value: function () { + return this.$el.off(".delegateEvents" + this.cid), this; + }, + }, + { + key: "_ensureElement", + value: function () { + if (this.el) this.setElement(this.el, !1); + else { + var i = ue.extend(!0, {}, this.attributes); + this.id && (i.id = this.id), + this.className && (i.class = this.className); + var n = ue(oi.create(this.tagName)).attr(i); + this.setElement(n, !1); + } + }, + }, + { + key: "onResize", + value: function () { + return this; + }, + }, + { + key: "resize", + value: function (i) { + var n = Gi(i.width) + ? "".concat(i.width, "px") + : "".concat(i.width), + r = Gi(i.height) + ? "".concat(i.height, "px") + : "".concat(i.height); + return ( + (this.el.style.width = n), + (this.el.style.height = r), + this.onResize(i), + this + ); + }, + }, + ]) + ); + })(Kt), + Tt = (function (s) { + function e() { + var t, + i = + arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, + n = arguments.length > 1 ? arguments[1] : void 0; + return Te(this, e), (t = De(this, e, [i])), (t.core = n), t; + } + return ( + Oe(e, s), + be( + e, + [ + { + key: "name", + get: function () { + return "error"; + }, + }, + { + key: "createError", + value: function (i) { + if (!this.core) { + le.warn(this.name, "Core is not set. Error: ", i); + return; + } + this.core.trigger(C.ERROR, i); + }, + }, + ], + [ + { + key: "Levels", + get: function () { + return { FATAL: "FATAL", WARN: "WARN", INFO: "INFO" }; + }, + }, + ] + ) + ); + })(Kt), + wt = { + createError: function (e) { + var t = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : { useCodePrefix: !0 }, + i = (this.constructor && this.constructor.type) || "", + n = this.name || i, + r = + this.i18n || + (this.core && this.core.i18n) || + (this.container && this.container.i18n), + a = "".concat(n, ":").concat((e && e.code) || "unknown"), + o = { + description: "", + level: Tt.Levels.FATAL, + origin: n, + scope: i, + raw: {}, + }, + l = Object.assign({}, o, e, { code: t.useCodePrefix ? a : e.code }); + if (r && l.level == Tt.Levels.FATAL && !l.UI) { + var u = { + title: r.t("default_error_title"), + message: r.t("default_error_message"), + }; + l.UI = u; + } + return ( + this.playerError + ? this.playerError.createError(l) + : le.warn(n, "PlayerError is not defined. Error: ", l), + l + ); + }, + }, + bi = (function (s) { + function e(t) { + var i; + return ( + Te(this, e), + (i = De(this, e, [t.options])), + (i.core = t), + (i.enabled = !0), + i.bindEvents(), + i.render(), + i + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "playerError", + get: function () { + return this.core.playerError; + }, + }, + { key: "bindEvents", value: function () {} }, + { + key: "getExternalInterface", + value: function () { + return {}; + }, + }, + { + key: "enable", + value: function () { + this.enabled || + (this.bindEvents(), this.$el.show(), (this.enabled = !0)); + }, + }, + { + key: "disable", + value: function () { + this.stopListening(), this.$el.hide(), (this.enabled = !1); + }, + }, + { + key: "render", + value: function () { + return this; + }, + }, + ]) + ); + })(Ti); + Object.assign(bi.prototype, wt), + (bi.extend = function (s) { + return si(bi, s); + }), + (bi.type = "core"); + var Zu = `.container[data-container] { + position: absolute; + background-color: black; + height: 100%; + width: 100%; + max-width: 100%; } + .container[data-container] .chromeless { + cursor: default; } + +[data-player]:not(.nocursor) .container[data-container]:not(.chromeless).pointer-enabled { + cursor: pointer; } +`, + zs = (function (s) { + function e(t, i, n) { + var r; + return ( + Te(this, e), + (r = De(this, e, [t])), + (r._i18n = i), + (r.currentTime = 0), + (r.volume = 100), + (r.playback = t.playback), + (r.playerError = n), + (r.settings = ue.extend(!0, {}, r.playback.settings)), + (r.isReady = !1), + (r.mediaControlDisabled = !1), + (r.plugins = [r.playback]), + (r.dblTapHandler = new Fs(500)), + (r.clickTimer = null), + (r.clickDelay = 200), + (r.actionsMetadata = {}), + r.bindEvents(), + r + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "name", + get: function () { + return "Container"; + }, + }, + { + key: "attributes", + get: function () { + return { class: "container", "data-container": "" }; + }, + }, + { + key: "events", + get: function () { + return { + click: "clicked", + dblclick: "dblClicked", + touchend: "dblTap", + contextmenu: "onContextMenu", + mouseenter: "mouseEnter", + mouseleave: "mouseLeave", + mouseup: "onMouseUp", + mousedown: "onMouseDown", + }; + }, + }, + { + key: "ended", + get: function () { + return this.playback.ended; + }, + }, + { + key: "buffering", + get: function () { + return this.playback.buffering; + }, + }, + { + key: "i18n", + get: function () { + return this._i18n; + }, + }, + { + key: "hasClosedCaptionsTracks", + get: function () { + return this.playback.hasClosedCaptionsTracks; + }, + }, + { + key: "closedCaptionsTracks", + get: function () { + return this.playback.closedCaptionsTracks; + }, + }, + { + key: "closedCaptionsTrackId", + get: function () { + return this.playback.closedCaptionsTrackId; + }, + set: function (i) { + this.playback.closedCaptionsTrackId = i; + }, + }, + { + key: "audioTracks", + get: function () { + return this.playback.audioTracks; + }, + }, + { + key: "currentAudioTrack", + get: function () { + return this.playback.currentAudioTrack; + }, + }, + { + key: "isPiPActive", + get: function () { + return this.playback.isPiPActive; + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo( + this.playback, + C.PLAYBACK_PROGRESS, + this.onProgress + ), + this.listenTo( + this.playback, + C.PLAYBACK_TIMEUPDATE, + this.timeUpdated + ), + this.listenTo(this.playback, C.PLAYBACK_READY, this.ready), + this.listenTo( + this.playback, + C.PLAYBACK_BUFFERING, + this.onBuffering + ), + this.listenTo( + this.playback, + C.PLAYBACK_BUFFERFULL, + this.bufferfull + ), + this.listenTo( + this.playback, + C.PLAYBACK_SETTINGSUPDATE, + this.settingsUpdate + ), + this.listenTo( + this.playback, + C.PLAYBACK_LOADEDMETADATA, + this.loadedMetadata + ), + this.listenTo( + this.playback, + C.PLAYBACK_HIGHDEFINITIONUPDATE, + this.highDefinitionUpdate + ), + this.listenTo( + this.playback, + C.PLAYBACK_BITRATE, + this.updateBitrate + ), + this.listenTo( + this.playback, + C.PLAYBACK_PLAYBACKSTATE, + this.playbackStateChanged + ), + this.listenTo( + this.playback, + C.PLAYBACK_DVR, + this.playbackDvrStateChanged + ), + this.listenTo( + this.playback, + C.PLAYBACK_MEDIACONTROL_DISABLE, + this.disableMediaControl + ), + this.listenTo( + this.playback, + C.PLAYBACK_MEDIACONTROL_ENABLE, + this.enableMediaControl + ), + this.listenTo(this.playback, C.PLAYBACK_SEEK, this.onSeek), + this.listenTo(this.playback, C.PLAYBACK_SEEKED, this.onSeeked), + this.listenTo(this.playback, C.PLAYBACK_ENDED, this.onEnded), + this.listenTo(this.playback, C.PLAYBACK_PLAY, this.playing), + this.listenTo(this.playback, C.PLAYBACK_PAUSE, this.paused), + this.listenTo(this.playback, C.PLAYBACK_STOP, this.stopped), + this.listenTo(this.playback, C.PLAYBACK_ERROR, this.error), + this.listenTo( + this.playback, + C.PLAYBACK_SUBTITLE_AVAILABLE, + this.subtitleAvailable + ), + this.listenTo( + this.playback, + C.PLAYBACK_SUBTITLE_CHANGED, + this.subtitleChanged + ), + this.listenTo( + this.playback, + C.PLAYBACK_AUDIO_AVAILABLE, + this.audioAvailable + ), + this.listenTo( + this.playback, + C.PLAYBACK_AUDIO_CHANGED, + this.audioChanged + ), + this.listenTo( + this.playback, + C.PLAYBACK_PIP_ENTER, + this.onEnterPiP + ), + this.listenTo( + this.playback, + C.PLAYBACK_PIP_EXIT, + this.onExitPiP + ); + }, + }, + { + key: "subtitleAvailable", + value: function () { + this.trigger(C.CONTAINER_SUBTITLE_AVAILABLE); + }, + }, + { + key: "subtitleChanged", + value: function (i) { + this.trigger(C.CONTAINER_SUBTITLE_CHANGED, i); + }, + }, + { + key: "audioAvailable", + value: function (i) { + this.trigger(C.CONTAINER_AUDIO_AVAILABLE, i); + }, + }, + { + key: "audioChanged", + value: function (i) { + this.trigger(C.CONTAINER_AUDIO_CHANGED, i); + }, + }, + { + key: "playbackStateChanged", + value: function (i) { + this.trigger(C.CONTAINER_PLAYBACKSTATE, i); + }, + }, + { + key: "playbackDvrStateChanged", + value: function (i) { + (this.settings = this.playback.settings), + (this.dvrInUse = i), + this.trigger(C.CONTAINER_PLAYBACKDVRSTATECHANGED, i); + }, + }, + { + key: "updateBitrate", + value: function (i) { + this.trigger(C.CONTAINER_BITRATE, i); + }, + }, + { + key: "statsReport", + value: function (i) { + this.trigger(C.CONTAINER_STATS_REPORT, i); + }, + }, + { + key: "getPlaybackType", + value: function () { + return this.playback.getPlaybackType(); + }, + }, + { + key: "isDvrEnabled", + value: function () { + return !!this.playback.dvrEnabled; + }, + }, + { + key: "isDvrInUse", + value: function () { + return !!this.dvrInUse; + }, + }, + { + key: "destroy", + value: function () { + this.disableResizeObserver(), + this.trigger(C.CONTAINER_DESTROYED, this, this.name), + this.stopListening(), + this.plugins.forEach(function (i) { + return i.destroy(); + }), + this.$el.remove(), + this.undelegateEvents(); + }, + }, + { + key: "setStyle", + value: function (i) { + this.$el.css(i); + }, + }, + { + key: "ready", + value: function () { + (this.isReady = !0), this.trigger(C.CONTAINER_READY, this.name); + }, + }, + { + key: "isPlaying", + value: function () { + return this.playback.isPlaying(); + }, + }, + { + key: "getStartTimeOffset", + value: function () { + return this.playback.getStartTimeOffset(); + }, + }, + { + key: "getCurrentTime", + value: function () { + return this.currentTime; + }, + }, + { + key: "getDuration", + value: function () { + return this.playback.getDuration(); + }, + }, + { + key: "error", + value: function (i) { + this.isReady || this.ready(), + this.trigger(C.CONTAINER_ERROR, i, this.name); + }, + }, + { + key: "loadedMetadata", + value: function (i) { + this.trigger(C.CONTAINER_LOADEDMETADATA, i); + }, + }, + { + key: "timeUpdated", + value: function (i) { + (this.currentTime = i.current), + this.trigger(C.CONTAINER_TIMEUPDATE, i, this.name); + }, + }, + { + key: "onProgress", + value: function () { + for ( + var i = arguments.length, n = new Array(i), r = 0; + r < i; + r++ + ) + n[r] = arguments[r]; + this.trigger.apply( + this, + [C.CONTAINER_PROGRESS].concat(n, [this.name]) + ); + }, + }, + { + key: "playing", + value: function () { + this.trigger( + C.CONTAINER_PLAY, + this.name, + this.actionsMetadata.playEvent || {} + ), + (this.actionsMetadata.playEvent = {}); + }, + }, + { + key: "paused", + value: function () { + this.trigger( + C.CONTAINER_PAUSE, + this.name, + this.actionsMetadata.pauseEvent || {} + ), + (this.actionsMetadata.pauseEvent = {}); + }, + }, + { + key: "stopped", + value: function () { + this.trigger( + C.CONTAINER_STOP, + this.actionsMetadata.stopEvent || {} + ), + (this.actionsMetadata.stopEvent = {}); + }, + }, + { + key: "play", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + (this.actionsMetadata.playEvent = i), this.playback.play(i); + }, + }, + { + key: "stop", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + (this.actionsMetadata.stopEvent = i), + this.playback.stop(i), + (this.currentTime = 0); + }, + }, + { + key: "switchAudioTrack", + value: function (i) { + this.playback.switchAudioTrack(i); + }, + }, + { + key: "pause", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + (this.actionsMetadata.pauseEvent = i), this.playback.pause(i); + }, + }, + { + key: "onEnded", + value: function () { + this.trigger(C.CONTAINER_ENDED, this, this.name), + (this.currentTime = 0); + }, + }, + { + key: "clicked", + value: function () { + var i = this; + (!this.options.chromeless || this.options.allowUserInteraction) && + (this.clickTimer = setTimeout(function () { + i.clickTimer && i.trigger(C.CONTAINER_CLICK, i, i.name); + }, this.clickDelay)); + }, + }, + { + key: "cancelClicked", + value: function () { + clearTimeout(this.clickTimer), (this.clickTimer = null); + }, + }, + { + key: "dblClicked", + value: function () { + (!this.options.chromeless || this.options.allowUserInteraction) && + (this.cancelClicked(), + this.trigger(C.CONTAINER_DBLCLICK, this, this.name)); + }, + }, + { + key: "dblTap", + value: function (i) { + var n = this; + (!this.options.chromeless || this.options.allowUserInteraction) && + this.dblTapHandler.handle(i, function () { + n.cancelClicked(), n.trigger(C.CONTAINER_DBLCLICK, n, n.name); + }); + }, + }, + { + key: "onContextMenu", + value: function (i) { + (!this.options.chromeless || this.options.allowUserInteraction) && + this.trigger(C.CONTAINER_CONTEXTMENU, i, this.name); + }, + }, + { + key: "seek", + value: function (i) { + this.playback.seek(i); + }, + }, + { + key: "onSeek", + value: function (i) { + this.trigger(C.CONTAINER_SEEK, i, this.name); + }, + }, + { + key: "onSeeked", + value: function () { + this.trigger(C.CONTAINER_SEEKED, this.name); + }, + }, + { + key: "seekPercentage", + value: function (i) { + var n = this.getDuration(); + if (i >= 0 && i <= 100) { + var r = n * (i / 100); + this.seek(r); + } + }, + }, + { + key: "setVolume", + value: function (i) { + (this.volume = parseFloat(i)), + this.trigger(C.CONTAINER_VOLUME, this.volume, this.name), + this.playback.volume(this.volume); + }, + }, + { + key: "fullscreen", + value: function () { + this.trigger(C.CONTAINER_FULLSCREEN, this.name); + }, + }, + { + key: "onBuffering", + value: function () { + this.trigger(C.CONTAINER_STATE_BUFFERING, this.name); + }, + }, + { + key: "bufferfull", + value: function () { + this.trigger(C.CONTAINER_STATE_BUFFERFULL, this.name); + }, + }, + { + key: "onEnterPiP", + value: function () { + this.trigger(C.CONTAINER_PIP_ENTER, this.name); + }, + }, + { + key: "onExitPiP", + value: function () { + this.trigger(C.CONTAINER_PIP_EXIT, this.name); + }, + }, + { + key: "addPlugin", + value: function (i) { + this.plugins.push(i); + }, + }, + { + key: "hasPlugin", + value: function (i) { + return !!this.getPlugin(i); + }, + }, + { + key: "getPlugin", + value: function (i) { + return this.plugins.filter(function (n) { + return n.name === i; + })[0]; + }, + }, + { + key: "mouseEnter", + value: function () { + (!this.options.chromeless || this.options.allowUserInteraction) && + this.trigger(C.CONTAINER_MOUSE_ENTER); + }, + }, + { + key: "mouseLeave", + value: function () { + (!this.options.chromeless || this.options.allowUserInteraction) && + this.trigger(C.CONTAINER_MOUSE_LEAVE); + }, + }, + { + key: "mouseUp", + value: function () { + (!this.options.chromeless || this.options.allowUserInteraction) && + this.trigger(C.CONTAINER_MOUSE_UP); + }, + }, + { + key: "mouseDown", + value: function () { + (!this.options.chromeless || this.options.allowUserInteraction) && + this.trigger(C.CONTAINER_MOUSE_DOWN); + }, + }, + { + key: "enterPiP", + value: function () { + this.playback.enterPiP(); + }, + }, + { + key: "exitPiP", + value: function () { + this.playback.exitPiP(); + }, + }, + { + key: "settingsUpdate", + value: function () { + (this.settings = this.playback.settings), + this.trigger(C.CONTAINER_SETTINGSUPDATE); + }, + }, + { + key: "highDefinitionUpdate", + value: function (i) { + this.trigger(C.CONTAINER_HIGHDEFINITIONUPDATE, i); + }, + }, + { + key: "isHighDefinitionInUse", + value: function () { + return this.playback.isHighDefinitionInUse(); + }, + }, + { + key: "disableMediaControl", + value: function () { + this.mediaControlDisabled || + ((this.mediaControlDisabled = !0), + this.trigger(C.CONTAINER_MEDIACONTROL_DISABLE)); + }, + }, + { + key: "enableMediaControl", + value: function () { + this.mediaControlDisabled && + ((this.mediaControlDisabled = !1), + this.trigger(C.CONTAINER_MEDIACONTROL_ENABLE)); + }, + }, + { + key: "updateStyle", + value: function () { + !this.options.chromeless || this.options.allowUserInteraction + ? this.$el.removeClass("chromeless") + : this.$el.addClass("chromeless"); + }, + }, + { + key: "enableResizeObserver", + value: function () { + var i = this; + this.disableResizeObserver(), + (this.resizeObserverInterval = setInterval(function () { + return i.checkResize(); + }, 500)); + }, + }, + { + key: "disableResizeObserver", + value: function () { + this.resizeObserverInterval && + clearInterval(this.resizeObserverInterval); + }, + }, + { + key: "checkResize", + value: function () { + var i = { + width: this.el.clientWidth, + height: this.el.clientHeight, + }, + n = this.currentSize || {}, + r = n.width, + a = n.height, + o = a !== i.height || r !== i.width; + o && + ((this.currentSize = i), this.trigger(C.CONTAINER_RESIZE, i)); + }, + }, + { + key: "onResize", + value: function (i) { + return this.playback.resize(i), this; + }, + }, + { + key: "configure", + value: function (i) { + (this._options = ue.extend(!0, this._options, i)), + this.updateStyle(), + this.playback.configure(this.options), + this.trigger(C.CONTAINER_OPTIONS_CHANGE); + }, + }, + { + key: "render", + value: function () { + var i = li.getStyleFor(Zu.toString(), { + baseUrl: this.options.baseUrl, + }); + return ( + this.$el.append(i[0]), + this.$el.append(this.playback.render().el), + this.updateStyle(), + this.checkResize(), + this.enableResizeObserver(), + this + ); + }, + }, + ]) + ); + })(Ti); + Object.assign(zs.prototype, wt); + var he = (function (s) { + function e(t, i, n) { + var r; + return ( + Te(this, e), + (r = De(this, e, [t])), + (r.settings = {}), + (r._i18n = i), + (r.playerError = n), + (r._consented = !1), + r + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "isAudioOnly", + get: function () { + return !1; + }, + }, + { + key: "isAdaptive", + get: function () { + return !1; + }, + }, + { + key: "ended", + get: function () { + return !1; + }, + }, + { + key: "i18n", + get: function () { + return this._i18n; + }, + }, + { + key: "buffering", + get: function () { + return !1; + }, + }, + { + key: "latency", + get: function () { + return null; + }, + }, + { + key: "currentProgramDateTime", + get: function () { + return null; + }, + }, + { + key: "isPiPActive", + get: function () { + return !1; + }, + }, + { + key: "consent", + value: function (i) { + typeof i == "function" && i(); + }, + }, + { key: "play", value: function () {} }, + { key: "pause", value: function () {} }, + { key: "stop", value: function () {} }, + { key: "enterPiP", value: function () {} }, + { key: "exitPiP", value: function () {} }, + { key: "seek", value: function (i) {} }, + { key: "seekPercentage", value: function (i) {} }, + { + key: "getStartTimeOffset", + value: function () { + return 0; + }, + }, + { + key: "getDuration", + value: function () { + return 0; + }, + }, + { + key: "isPlaying", + value: function () { + return !1; + }, + }, + { + key: "isReady", + get: function () { + return !1; + }, + }, + { + key: "hasClosedCaptionsTracks", + get: function () { + return this.closedCaptionsTracks.length > 0; + }, + }, + { + key: "closedCaptionsTracks", + get: function () { + return []; + }, + }, + { + key: "closedCaptionsTrackId", + get: function () { + return -1; + }, + set: function (i) {}, + }, + { + key: "audioTracks", + get: function () { + return []; + }, + }, + { + key: "currentAudioTrack", + get: function () { + return null; + }, + }, + { key: "switchAudioTrack", value: function (i) {} }, + { + key: "getPlaybackType", + value: function () { + return e.NO_OP; + }, + }, + { + key: "isHighDefinitionInUse", + value: function () { + return !1; + }, + }, + { key: "mute", value: function () {} }, + { key: "unmute", value: function () {} }, + { key: "volume", value: function (i) {} }, + { + key: "configure", + value: function (i) { + this._options = ue.extend(!0, this._options, i); + }, + }, + { + key: "attemptAutoPlay", + value: function () { + var i = this; + this.canAutoPlay(function (n, r) { + n && i.play(); + }); + }, + }, + { + key: "canAutoPlay", + value: function (i) { + i(!0, null); + }, + }, + { + key: "onResize", + value: function (i) { + return this.trigger(C.PLAYBACK_RESIZE, i), this; + }, + }, + ]) + ); + })(Ti); + Object.assign(he.prototype, wt), + (he.extend = function (s) { + return si(he, s); + }), + (he.canPlay = function (s, e) { + return !1; + }), + (he.VOD = "vod"), + (he.AOD = "aod"), + (he.LIVE = "live"), + (he.NO_OP = "no_op"), + (he.type = "playback"); + var Qu = (function (s) { + function e(t, i, n, r) { + var a; + return ( + Te(this, e), + (a = De(this, e, [t])), + (a._i18n = n), + (a.loader = i), + (a.playerError = r), + a + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "options", + get: function () { + return this._options; + }, + set: function (i) { + this._options = i; + }, + }, + { + key: "createContainers", + value: function () { + var i = this; + return ue.Deferred(function (n) { + n.resolve( + i.options.sources.map(function (r) { + return i.createContainer(r); + }) + ); + }); + }, + }, + { + key: "findPlaybackPlugin", + value: function (i, n) { + return this.loader.playbackPlugins.filter(function (r) { + return r.canPlay(i, n); + })[0]; + }, + }, + { + key: "createContainer", + value: function (i) { + var n = null, + r = this.options.mimeType; + Vt(i) === "object" + ? ((n = i.source.toString()), i.mimeType && (r = i.mimeType)) + : (n = i.toString()), + n.match(/^\/\//) && (n = window.location.protocol + n); + var a = Vi(Vi({}, this.options), {}, { src: n, mimeType: r }), + o = this.findPlaybackPlugin(n, r), + l = o ? new o(a, this._i18n, this.playerError) : new he(); + a = Vi(Vi({}, a), {}, { playback: l }); + var u = new zs(a, this._i18n, this.playerError), + c = ue.Deferred(); + return ( + c.promise(u), + this.addContainerPlugins(u), + this.listenToOnce(u, C.CONTAINER_READY, function () { + return c.resolve(u); + }), + u + ); + }, + }, + { + key: "addContainerPlugins", + value: function (i) { + this.loader.containerPlugins.forEach(function (n) { + i.addPlugin(new n(i)); + }); + }, + }, + ]) + ); + })(Kt), + Ju = `[data-player] { + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -o-user-select: none; + user-select: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + transform: translate3d(0, 0, 0); + position: relative; + margin: 0; + padding: 0; + border: 0; + font-style: normal; + font-weight: normal; + text-align: center; + overflow: hidden; + font-size: 100%; + font-family: "Roboto", "Open Sans", Arial, sans-serif; + text-shadow: 0 0 0; + box-sizing: border-box; } + [data-player]:focus { + outline: 0; } + [data-player] * { + box-sizing: inherit; } + [data-player] > * { + float: none; + max-width: none; } + [data-player] > div { + display: block; } + [data-player].fullscreen { + width: 100% !important; + height: 100% !important; + top: 0; + left: 0; } + [data-player].nocursor { + cursor: none; } + +.clappr-style { + display: none !important; } +`, + ec = `[data-player] div, [data-player] span, [data-player] applet, [data-player] object, [data-player] iframe, +[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, +[data-player] a, [data-player] abbr, [data-player] acronym, [data-player] address, [data-player] big, [data-player] cite, [data-player] code, +[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, +[data-player] small, [data-player] strike, [data-player] strong, [data-player] sub, [data-player] sup, [data-player] tt, [data-player] var, +[data-player] b, [data-player] u, [data-player] i, [data-player] center, +[data-player] dl, [data-player] dt, [data-player] dd, [data-player] ol, [data-player] ul, [data-player] li, +[data-player] fieldset, [data-player] form, [data-player] label, [data-player] legend, +[data-player] table, [data-player] caption, [data-player] tbody, [data-player] tfoot, [data-player] thead, [data-player] tr, [data-player] th, [data-player] td, +[data-player] article, [data-player] aside, [data-player] canvas, [data-player] details, [data-player] embed, +[data-player] figure, [data-player] figcaption, [data-player] footer, [data-player] header, [data-player] hgroup, +[data-player] menu, [data-player] nav, [data-player] output, [data-player] ruby, [data-player] section, [data-player] summary, +[data-player] time, [data-player] mark, [data-player] audio, [data-player] video { + margin: 0; + padding: 0; + border: 0; + font: inherit; + font-size: 100%; + vertical-align: baseline; } + +[data-player] table { + border-collapse: collapse; + border-spacing: 0; } + +[data-player] caption, [data-player] th, [data-player] td { + text-align: left; + font-weight: normal; + vertical-align: middle; } + +[data-player] q, [data-player] blockquote { + quotes: none; } + [data-player] q:before, [data-player] q:after, [data-player] blockquote:before, [data-player] blockquote:after { + content: ""; + content: none; } + +[data-player] a img { + border: none; } +`, + Ws = (function (s) { + function e(t) { + var i; + return ( + Te(this, e), + (i = De(this, e, [t])), + (i.playerError = new Tt(t, i)), + i.configureDomRecycler(), + (i.firstResize = !0), + (i.styleRendered = !1), + (i.plugins = []), + (i.containers = []), + (i._boundFullscreenHandler = function () { + return i.handleFullscreenChange(); + }), + (i._boundHandleWindowResize = function (n) { + return i.handleWindowResize(n); + }), + ue(document).bind("fullscreenchange", i._boundFullscreenHandler), + ue(document).bind("MSFullscreenChange", i._boundFullscreenHandler), + ue(document).bind("mozfullscreenchange", i._boundFullscreenHandler), + ie.isMobile && ue(window).bind("resize", i._boundHandleWindowResize), + i + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "events", + get: function () { + return { + webkitfullscreenchange: "handleFullscreenChange", + mousemove: "onMouseMove", + mouseleave: "onMouseLeave", + }; + }, + }, + { + key: "attributes", + get: function () { + return { "data-player": "", tabindex: 9999 }; + }, + }, + { + key: "isReady", + get: function () { + return !!this.ready; + }, + }, + { + key: "i18n", + get: function () { + return ( + this.getPlugin("strings") || { + t: function (n) { + return n; + }, + } + ); + }, + }, + { + key: "mediaControl", + get: function () { + return ( + this._mediaControl || + (this._mediaControl = this.getPlugin("media_control")) || + this.dummyMediaControl + ); + }, + }, + { + key: "dummyMediaControl", + get: function () { + return this._dummyMediaControl + ? this._dummyMediaControl + : ((this._dummyMediaControl = new bi(this)), + this._dummyMediaControl); + }, + }, + { + key: "activeContainer", + get: function () { + return this._activeContainer; + }, + set: function (i) { + (this._activeContainer = i), + this.trigger( + C.CORE_ACTIVE_CONTAINER_CHANGED, + this._activeContainer + ); + }, + }, + { + key: "activePlayback", + get: function () { + return this.activeContainer && this.activeContainer.playback; + }, + }, + { + key: "activePlaybackEl", + get: function () { + if (this.activePlayback) + return this.activePlayback.$el + ? this.activePlayback.$el.find("video")[0] + : this.activePlayback.el; + }, + }, + { + key: "configureDomRecycler", + value: function () { + var i = + this.options && + this.options.playback && + this.options.playback.recycleVideo; + oi.configure({ recycleVideo: i }); + }, + }, + { + key: "createContainers", + value: function (i) { + (this.defer = ue.Deferred()), + this.defer.promise(this), + (this.containerFactory = new Qu( + i, + i.loader, + this.i18n, + this.playerError + )), + this.prepareContainers(); + }, + }, + { + key: "prepareContainers", + value: function () { + var i = this; + this.containerFactory + .createContainers() + .then(function (n) { + return i.setupContainers(n); + }) + .then(function (n) { + return i.resolveOnContainersReady(n); + }); + }, + }, + { + key: "updateSize", + value: function () { + this.isFullscreen() ? this.setFullscreen() : this.setPlayerSize(); + }, + }, + { + key: "setFullscreen", + value: function () { + ie.isiOS || + (this.$el.addClass("fullscreen"), + this.$el.removeAttr("style"), + (this.previousSize = { + width: this.options.width, + height: this.options.height, + }), + (this.currentSize = { + width: ue(window).width(), + height: ue(window).height(), + })); + }, + }, + { + key: "setPlayerSize", + value: function () { + this.$el.removeClass("fullscreen"), + (this.currentSize = this.previousSize), + (this.previousSize = { + width: ue(window).width(), + height: ue(window).height(), + }), + this.resize(this.currentSize); + }, + }, + { + key: "onResize", + value: function (i) { + return ( + (this.previousSize = { + width: this.options.width, + height: this.options.height, + }), + (this.options.width = i.width), + (this.options.height = i.height), + (this.currentSize = i), + this.triggerResize(this.currentSize), + this + ); + }, + }, + { + key: "enableResizeObserver", + value: function () { + var i = this; + this.disableResizeObserver(); + var n = function () { + i.triggerResize({ + width: i.el.clientWidth, + height: i.el.clientHeight, + }); + }; + this.resizeObserverInterval = setInterval(n, 500); + }, + }, + { + key: "triggerResize", + value: function (i) { + var n = + this.firstResize || + this.oldHeight !== i.height || + this.oldWidth !== i.width; + n && + ((this.oldHeight = i.height), + (this.oldWidth = i.width), + (this.computedSize = i), + (this.firstResize = !1), + this.trigger(C.CORE_RESIZE, i)); + }, + }, + { + key: "disableResizeObserver", + value: function () { + this.resizeObserverInterval && + clearInterval(this.resizeObserverInterval), + (this.resizeObserverInterval = null); + }, + }, + { + key: "resolveOnContainersReady", + value: function (i) { + var n = this; + ue.when.apply(ue, i).done(function () { + n.defer.resolve(n), (n.ready = !0), n.trigger(C.CORE_READY); + }); + }, + }, + { + key: "addPlugin", + value: function (i) { + this.plugins.push(i); + }, + }, + { + key: "hasPlugin", + value: function (i) { + return !!this.getPlugin(i); + }, + }, + { + key: "getPlugin", + value: function (i) { + return this.plugins.filter(function (n) { + return n.name === i; + })[0]; + }, + }, + { + key: "load", + value: function (i, n) { + (this.options.mimeType = n), + (i = i && i.constructor === Array ? i : [i]), + (this.options.sources = i), + this.containers.forEach(function (r) { + return r.destroy(); + }), + (this.containerFactory.options = ue.extend(!0, this.options, { + sources: i, + })), + this.prepareContainers(); + }, + }, + { + key: "destroy", + value: function () { + this.disableResizeObserver(), + this.containers.forEach(function (i) { + return i.destroy(); + }), + this.plugins.forEach(function (i) { + return i.destroy(); + }), + this.$el.remove(), + ue(document).unbind( + "fullscreenchange", + this._boundFullscreenHandler + ), + ue(document).unbind( + "MSFullscreenChange", + this._boundFullscreenHandler + ), + ue(document).unbind( + "mozfullscreenchange", + this._boundFullscreenHandler + ), + ie.isMobile && + ue(window).unbind("resize", this._boundHandleWindowResize), + this.stopListening(), + this.undelegateEvents(); + }, + }, + { + key: "handleFullscreenChange", + value: function () { + this.trigger(C.CORE_FULLSCREEN, this.isFullscreen()), + this.updateSize(); + }, + }, + { + key: "handleWindowResize", + value: function (i) { + var n = + window.innerWidth > window.innerHeight + ? "landscape" + : "portrait"; + this._screenOrientation !== n && + ((this._screenOrientation = n), + this.triggerResize({ + width: this.el.clientWidth, + height: this.el.clientHeight, + }), + this.trigger(C.CORE_SCREEN_ORIENTATION_CHANGED, { + event: i, + orientation: this._screenOrientation, + })); + }, + }, + { + key: "removeContainer", + value: function (i) { + this.stopListening(i), + this.containerFactory.stopListening(i), + (this.containers = this.containers.filter(function (n) { + return n !== i; + })); + }, + }, + { + key: "setupContainer", + value: function (i) { + this.listenTo(i, C.CONTAINER_DESTROYED, this.removeContainer), + this.containers.push(i); + }, + }, + { + key: "setupContainers", + value: function (i) { + return ( + i.forEach(this.setupContainer.bind(this)), + this.trigger(C.CORE_CONTAINERS_CREATED), + this.renderContainers(), + (this.activeContainer = i[0]), + this.render(), + this.appendToParent(), + this.containers + ); + }, + }, + { + key: "renderContainers", + value: function () { + var i = this; + this.containers.forEach(function (n) { + return i.el.appendChild(n.render().el); + }); + }, + }, + { + key: "createContainer", + value: function (i, n) { + var r = this.containerFactory.createContainer(i, n); + return ( + this.setupContainer(r), this.el.appendChild(r.render().el), r + ); + }, + }, + { + key: "getCurrentContainer", + value: function () { + return this.activeContainer; + }, + }, + { + key: "getCurrentPlayback", + value: function () { + return this.activePlayback; + }, + }, + { + key: "getPlaybackType", + value: function () { + return ( + this.activeContainer && this.activeContainer.getPlaybackType() + ); + }, + }, + { + key: "isFullscreen", + value: function () { + var i = Ei.fullscreenElement(); + return ( + (i && i === this.el) || + (i && i === this.activePlaybackEl) || + (this.activePlaybackEl && + this.activePlaybackEl.webkitDisplayingFullscreen) || + !1 + ); + }, + }, + { + key: "toggleFullscreen", + value: function () { + var i = this; + if (this.isFullscreen()) { + var n = ie.isiOS ? this.activePlaybackEl : document; + Ei.cancelFullscreen(n), + !ie.isiOS && this.$el.removeClass("fullscreen nocursor"); + } else { + var r = ie.isiOS ? this.activePlaybackEl : this.el; + if (!r) return; + ie.isSafari || ie.isiOS + ? Ei.requestFullscreen(r) + : Ei.requestFullscreen(r).then( + function (a) { + return a; + }, + function (a) { + return setTimeout(function () { + if (!i.isFullscreen()) throw new ReferenceError(a); + }, 600); + } + ), + !ie.isiOS && this.$el.addClass("fullscreen"); + } + }, + }, + { + key: "onMouseMove", + value: function (i) { + this.trigger(C.CORE_MOUSE_MOVE, i); + }, + }, + { + key: "onMouseLeave", + value: function (i) { + this.trigger(C.CORE_MOUSE_LEAVE, i); + }, + }, + { + key: "configure", + value: function (i) { + var n = this; + (this._options = ue.extend(!0, this._options, i)), + this.configureDomRecycler(); + var r = i.source || i.sources; + r && this.load(r, i.mimeType || this.options.mimeType), + this.trigger(C.CORE_OPTIONS_CHANGE, i), + this.containers.forEach(function (a) { + return a.configure(n.options); + }); + }, + }, + { + key: "appendToParent", + value: function () { + var i = this.$el.parent() && this.$el.parent().length; + !i && this.$el.appendTo(this.options.parentElement); + }, + }, + { + key: "appendStyles", + value: function () { + if (!this.styleRendered) { + var i = li.getStyleFor(Ju.toString(), { + baseUrl: this.options.baseUrl, + }); + if ((this.$el.append(i[0]), this.options.includeResetStyle)) { + var n = li.getStyleFor(ec.toString(), { + baseUrl: this.options.baseUrl, + }); + this.$el.append(n[0]); + } + this.styleRendered = !0; + } + }, + }, + { + key: "render", + value: function () { + this.appendStyles(), + (this.options.width = this.options.width || this.$el.width()), + (this.options.height = + this.options.height || this.$el.height()); + var i = { + width: this.options.width, + height: this.options.height, + }; + return ( + (this.previousSize = this.currentSize = this.computedSize = i), + this.updateSize(), + this.enableResizeObserver(), + this + ); + }, + }, + ]) + ); + })(Ti); + Object.assign(Ws.prototype, wt); + var tc = (function (s) { + function e(t) { + var i; + return Te(this, e), (i = De(this, e, [t.options])), (i.player = t), i; + } + return ( + Oe(e, s), + be(e, [ + { + key: "loader", + get: function () { + return this.player.loader; + }, + }, + { + key: "create", + value: function () { + return ( + (this.options.loader = this.loader), + (this.core = new Ws(this.options)), + this.addCorePlugins(), + this.core.createContainers(this.options), + this.core + ); + }, + }, + { + key: "addCorePlugins", + value: function () { + var i = this; + return ( + this.loader.corePlugins.forEach(function (n) { + var r = new n(i.core); + i.core.addPlugin(r), i.setupExternalInterface(r); + }), + this.core + ); + }, + }, + { + key: "setupExternalInterface", + value: function (i) { + var n = i.getExternalInterface(); + for (var r in n) this.player[r] = n[r].bind(i); + }, + }, + ]) + ); + })(Kt), + ic = /(\d+)(?:\.(\d+))?(?:\.(\d+))?/, + zi = (function () { + function s(e, t, i) { + Te(this, s), + (this.major = parseInt(e || 0, 10)), + (this.minor = parseInt(t || 0, 10)), + (this.patch = parseInt(i || 0, 10)); + } + return be( + s, + [ + { + key: "compare", + value: function (t) { + var i = this.major - t.major; + return ( + (i = i || this.minor - t.minor), + (i = i || this.patch - t.patch), + i + ); + }, + }, + { + key: "inc", + value: function () { + var t = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : "patch"; + return typeof this[t] < "u" && (this[t] += 1), this; + }, + }, + { + key: "satisfies", + value: function (t, i) { + return this.compare(t) >= 0 && (!i || this.compare(i) < 0); + }, + }, + { + key: "toString", + value: function () { + return "" + .concat(this.major, ".") + .concat(this.minor, ".") + .concat(this.patch); + }, + }, + ], + [ + { + key: "parse", + value: function () { + var t = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : "", + i = t.match(ic) || [], + n = wn(i, 4), + r = n[1], + a = n[2], + o = n[3]; + return typeof r > "u" ? null : new s(r, a, o); + }, + }, + ] + ); + })(), + js = function (e, t) { + return !e || !t + ? {} + : Object.entries(e) + .filter(function (i) { + var n = wn(i, 2), + r = n[1]; + return r.type === t; + }) + .reduce(function (i, n) { + var r = wn(n, 2), + a = r[0], + o = r[1]; + return (i[a] = o), i; + }, {}); + }, + Yt = (function () { + var s = { plugins: {}, playbacks: [] }, + e = "0.11.3"; + return (function () { + function t() { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : [], + n = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : 0; + Te(this, t), + (this.playerId = n), + (this.playbackPlugins = ri(s.playbacks)); + var r = t.registeredPlugins, + a = r.core, + o = r.container; + (this.containerPlugins = Object.values(o)), + (this.corePlugins = Object.values(a)), + Array.isArray(i) || this.validateExternalPluginsType(i), + this.addExternalPlugins(i); + } + return be( + t, + [ + { + key: "groupPluginsByType", + value: function (n) { + return ( + Array.isArray(n) && + (n = n.reduce(function (r, a) { + return ( + r[a.type] || (r[a.type] = []), r[a.type].push(a), r + ); + }, {})), + n + ); + }, + }, + { + key: "removeDups", + value: function (n) { + var r = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : !1, + a = function (d, f) { + return ( + (d[f.prototype.name] && r) || + (d[f.prototype.name] && delete d[f.prototype.name], + (d[f.prototype.name] = f)), + d + ); + }, + o = n.reduceRight(a, Object.create(null)), + l = []; + for (var u in o) l.unshift(o[u]); + return l; + }, + }, + { + key: "addExternalPlugins", + value: function (n) { + var r = + typeof n.loadExternalPluginsFirst == "boolean" + ? n.loadExternalPluginsFirst + : !0, + a = + typeof n.loadExternalPlaybacksFirst == "boolean" + ? n.loadExternalPlaybacksFirst + : !0; + if (((n = this.groupPluginsByType(n)), n.playback)) { + var o = n.playback.filter(function (c) { + return t.checkVersionSupport(c), !0; + }); + this.playbackPlugins = a + ? this.removeDups(o.concat(this.playbackPlugins)) + : this.removeDups(this.playbackPlugins.concat(o), !0); + } + if (n.container) { + var l = n.container.filter(function (c) { + return t.checkVersionSupport(c), !0; + }); + this.containerPlugins = r + ? this.removeDups(l.concat(this.containerPlugins)) + : this.removeDups(this.containerPlugins.concat(l), !0); + } + if (n.core) { + var u = n.core.filter(function (c) { + return t.checkVersionSupport(c), !0; + }); + this.corePlugins = r + ? this.removeDups(u.concat(this.corePlugins)) + : this.removeDups(this.corePlugins.concat(u), !0); + } + }, + }, + { + key: "validateExternalPluginsType", + value: function (n) { + var r = ["playback", "container", "core"]; + r.forEach(function (a) { + (n[a] || []).forEach(function (o) { + var l = "external " + o.type + " plugin on " + a + " array"; + if (o.type !== a) throw new ReferenceError(l); + }); + }); + }, + }, + ], + [ + { + key: "registeredPlaybacks", + get: function () { + return ri(s.playbacks); + }, + }, + { + key: "registeredPlugins", + get: function () { + var n = s.plugins, + r = js(n, "core"), + a = js(n, "container"); + return { core: r, container: a }; + }, + }, + { + key: "checkVersionSupport", + value: function (n) { + var r = n.prototype, + a = r.supportedVersion, + o = r.name; + if (!a || !a.min) + return ( + le.warn( + "Loader", + "missing version information for ".concat(o) + ), + !1 + ); + var l = a.max ? zi.parse(a.max) : zi.parse(a.min).inc("minor"), + u = zi.parse(a.min); + return zi.parse(e).satisfies(u, l) + ? !0 + : (le.warn( + "Loader", + "unsupported plugin " + .concat(o, ": Clappr version ") + .concat(e, " does not match required range [") + .concat(u, ",") + .concat(l, ")") + ), + !1); + }, + }, + { + key: "registerPlugin", + value: function (n) { + if (!n || !n.prototype.name) + return ( + le.warn( + "Loader", + "missing information to register plugin: ".concat(n) + ), + !1 + ); + t.checkVersionSupport(n); + var r = s.plugins; + if (!r) return !1; + var a = r[n.prototype.name]; + return ( + a && + le.warn( + "Loader", + "overriding plugin entry: " + .concat(n.prototype.name, " - ") + .concat(a) + ), + (r[n.prototype.name] = n), + !0 + ); + }, + }, + { + key: "registerPlayback", + value: function (n) { + if (!n || !n.prototype.name) return !1; + t.checkVersionSupport(n); + var r = s.playbacks, + a = r.findIndex(function (l) { + return l.prototype.name === n.prototype.name; + }); + if (a >= 0) { + var o = r[a]; + r.splice(a, 1), + le.warn( + "Loader", + "overriding playback entry: " + .concat(o.name, " - ") + .concat(o) + ); + } + return (s.playbacks = [n].concat(ri(r))), !0; + }, + }, + { + key: "unregisterPlugin", + value: function (n) { + if (!n) return !1; + var r = s.plugins, + a = r[n]; + return a ? (delete r[n], !0) : !1; + }, + }, + { + key: "unregisterPlayback", + value: function (n) { + if (!n) return !1; + var r = s.playbacks, + a = r.findIndex(function (o) { + return o.prototype.name === n; + }); + return a < 0 ? !1 : (r.splice(a, 1), (s.playbacks = r), !0); + }, + }, + { + key: "clearPlugins", + value: function () { + s.plugins = {}; + }, + }, + { + key: "clearPlaybacks", + value: function () { + s.playbacks = []; + }, + }, + ] + ); + })(); + })(), + nc = Ds().replace(/\/[^/]+$/, ""), + rc = (function (s) { + function e(t) { + var i; + Te(this, e), (i = De(this, e, [t])); + var n = { recycleVideo: !0 }, + r = { + playerId: ai(""), + persistConfig: !0, + width: 640, + height: 360, + baseUrl: nc, + allowUserInteraction: ie.isMobile, + includeResetStyle: !0, + playback: n, + }; + (i._options = ue.extend(!0, r, t)), + (i.options.sources = i._normalizeSources(t)), + i.options.chromeless || (i.options.allowUserInteraction = !0), + i.options.allowUserInteraction || + (i.options.disableKeyboardShortcuts = !0), + i._registerOptionEventListeners(i.options.events), + (i._coreFactory = new tc(i)); + var a = i._getParentElement(i.options); + return a && i.attachTo(a), i; + } + return ( + Oe(e, s), + be(e, [ + { + key: "loader", + get: function () { + return ( + this._loader || + (this._loader = new Yt( + this.options.plugins || {}, + this.options.playerId + )), + this._loader + ); + }, + set: function (i) { + this._loader = i; + }, + }, + { + key: "ended", + get: function () { + return this.core.activeContainer.ended; + }, + }, + { + key: "buffering", + get: function () { + return this.core.activeContainer.buffering; + }, + }, + { + key: "isReady", + get: function () { + return !!this._ready; + }, + }, + { + key: "eventsMapping", + get: function () { + return { + onReady: C.PLAYER_READY, + onResize: C.PLAYER_RESIZE, + onPlay: C.PLAYER_PLAY, + onPause: C.PLAYER_PAUSE, + onStop: C.PLAYER_STOP, + onEnded: C.PLAYER_ENDED, + onSeek: C.PLAYER_SEEK, + onError: C.PLAYER_ERROR, + onTimeUpdate: C.PLAYER_TIMEUPDATE, + onVolumeUpdate: C.PLAYER_VOLUMEUPDATE, + onSubtitleAvailable: C.PLAYER_SUBTITLE_AVAILABLE, + }; + }, + }, + { + key: "_getParentElement", + value: function (i) { + var n = i.parentId, + r = i.parent; + return n ? document.querySelector(n) : r; + }, + }, + { + key: "attachTo", + value: function (i) { + return ( + (this.options.parentElement = i), + (this.core = this._coreFactory.create()), + this._addEventListeners(), + this + ); + }, + }, + { + key: "_addEventListeners", + value: function () { + return ( + this.core.isReady + ? this._onReady() + : this.listenToOnce(this.core, C.CORE_READY, this._onReady), + this.listenTo( + this.core, + C.CORE_ACTIVE_CONTAINER_CHANGED, + this._containerChanged + ), + this.listenTo( + this.core, + C.CORE_FULLSCREEN, + this._onFullscreenChange + ), + this.listenTo(this.core, C.CORE_RESIZE, this._onResize), + this + ); + }, + }, + { + key: "_addContainerEventListeners", + value: function () { + var i = this.core.activeContainer; + return ( + i && + (this.listenTo(i, C.CONTAINER_PLAY, this._onPlay), + this.listenTo(i, C.CONTAINER_PAUSE, this._onPause), + this.listenTo(i, C.CONTAINER_STOP, this._onStop), + this.listenTo(i, C.CONTAINER_ENDED, this._onEnded), + this.listenTo(i, C.CONTAINER_SEEK, this._onSeek), + this.listenTo(i, C.CONTAINER_ERROR, this._onError), + this.listenTo(i, C.CONTAINER_TIMEUPDATE, this._onTimeUpdate), + this.listenTo(i, C.CONTAINER_VOLUME, this._onVolumeUpdate), + this.listenTo( + i, + C.CONTAINER_SUBTITLE_AVAILABLE, + this._onSubtitleAvailable + )), + this + ); + }, + }, + { + key: "_registerOptionEventListeners", + value: function () { + var i = this, + n = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}, + r = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : {}, + a = Object.keys(n).length > 0; + return ( + a && + Object.keys(r).forEach(function (o) { + var l = i.eventsMapping[o]; + l && i.off(l, r[o]); + }), + Object.keys(n).forEach(function (o) { + var l = i.eventsMapping[o]; + if (l) { + var u = n[o]; + (u = typeof u == "function" && u), u && i.on(l, u); + } + }), + this + ); + }, + }, + { + key: "_containerChanged", + value: function () { + this.stopListening(), this._addEventListeners(); + }, + }, + { + key: "_onReady", + value: function () { + (this._ready = !0), + this._addContainerEventListeners(), + this.trigger(C.PLAYER_READY); + }, + }, + { + key: "_onFullscreenChange", + value: function (i) { + this.trigger(C.PLAYER_FULLSCREEN, i); + }, + }, + { + key: "_onVolumeUpdate", + value: function (i) { + this.trigger(C.PLAYER_VOLUMEUPDATE, i); + }, + }, + { + key: "_onSubtitleAvailable", + value: function () { + this.trigger(C.PLAYER_SUBTITLE_AVAILABLE); + }, + }, + { + key: "_onResize", + value: function (i) { + this.trigger(C.PLAYER_RESIZE, i); + }, + }, + { + key: "_onPlay", + value: function (i) { + var n = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : {}; + this.trigger(C.PLAYER_PLAY, n); + }, + }, + { + key: "_onPause", + value: function (i) { + var n = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : {}; + this.trigger(C.PLAYER_PAUSE, n); + }, + }, + { + key: "_onStop", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + this.trigger(C.PLAYER_STOP, this.getCurrentTime(), i); + }, + }, + { + key: "_onEnded", + value: function () { + this.trigger(C.PLAYER_ENDED); + }, + }, + { + key: "_onSeek", + value: function (i) { + this.trigger(C.PLAYER_SEEK, i); + }, + }, + { + key: "_onTimeUpdate", + value: function (i) { + this.trigger(C.PLAYER_TIMEUPDATE, i); + }, + }, + { + key: "_onError", + value: function (i) { + this.trigger(C.PLAYER_ERROR, i); + }, + }, + { + key: "_normalizeSources", + value: function (i) { + var n = i.sources || (i.source !== void 0 ? [i.source] : []); + return n.length === 0 ? [{ source: "", mimeType: "" }] : n; + }, + }, + { + key: "resize", + value: function (i) { + return this.core.resize(i), this; + }, + }, + { + key: "load", + value: function (i, n, r) { + return ( + r !== void 0 && this.configure({ autoPlay: !!r }), + this.core.load(i, n), + this + ); + }, + }, + { + key: "destroy", + value: function () { + return this.stopListening(), this.core.destroy(), this; + }, + }, + { + key: "consent", + value: function (i) { + this.core.getCurrentPlayback().consent(i); + }, + }, + { + key: "play", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + return this.core.activeContainer.play(i), this; + }, + }, + { + key: "pause", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + return this.core.activeContainer.pause(i), this; + }, + }, + { + key: "stop", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + return this.core.activeContainer.stop(i), this; + }, + }, + { + key: "seek", + value: function (i) { + return this.core.activeContainer.seek(i), this; + }, + }, + { + key: "seekPercentage", + value: function (i) { + return this.core.activeContainer.seekPercentage(i), this; + }, + }, + { + key: "mute", + value: function () { + return this.core.activePlayback.mute(), this; + }, + }, + { + key: "unmute", + value: function () { + return this.core.activePlayback.unmute(), this; + }, + }, + { + key: "isPlaying", + value: function () { + return this.core.activeContainer.isPlaying(); + }, + }, + { + key: "isDvrEnabled", + value: function () { + return this.core.activeContainer.isDvrEnabled(); + }, + }, + { + key: "isDvrInUse", + value: function () { + return this.core.activeContainer.isDvrInUse(); + }, + }, + { + key: "configure", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + return ( + this._registerOptionEventListeners( + i.events, + this.options.events + ), + this.core.configure(i), + this + ); + }, + }, + { + key: "getPlugin", + value: function (i) { + var n = this.core.plugins.concat( + this.core.activeContainer.plugins + ); + return n.filter(function (r) { + return r.name === i; + })[0]; + }, + }, + { + key: "getCurrentTime", + value: function () { + return this.core.activeContainer.getCurrentTime(); + }, + }, + { + key: "getStartTimeOffset", + value: function () { + return this.core.activeContainer.getStartTimeOffset(); + }, + }, + { + key: "getDuration", + value: function () { + return this.core.activeContainer.getDuration(); + }, + }, + ]) + ); + })(Kt); + Object.assign(rc.prototype, wt); + var Wi = (function (s) { + function e(t) { + var i; + return ( + Te(this, e), + (i = De(this, e, [t.options])), + (i.container = t), + (i.enabled = !0), + i.bindEvents(), + i + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "playerError", + get: function () { + return this.container.playerError; + }, + }, + { + key: "enable", + value: function () { + this.enabled || (this.bindEvents(), (this.enabled = !0)); + }, + }, + { + key: "disable", + value: function () { + this.enabled && (this.stopListening(), (this.enabled = !1)); + }, + }, + { key: "bindEvents", value: function () {} }, + { + key: "destroy", + value: function () { + this.stopListening(); + }, + }, + ]) + ); + })(Kt); + Object.assign(Wi.prototype, wt), + (Wi.extend = function (s) { + return si(Wi, s); + }), + (Wi.type = "container"); + var ui = (function (s) { + function e(t) { + var i; + return ( + Te(this, e), + (i = De(this, e, [t.options])), + (i.core = t), + (i.enabled = !0), + i.bindEvents(), + i + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "playerError", + get: function () { + return this.core.playerError; + }, + }, + { key: "bindEvents", value: function () {} }, + { + key: "enable", + value: function () { + this.enabled || (this.bindEvents(), (this.enabled = !0)); + }, + }, + { + key: "disable", + value: function () { + this.enabled && (this.stopListening(), (this.enabled = !1)); + }, + }, + { + key: "getExternalInterface", + value: function () { + return {}; + }, + }, + { + key: "destroy", + value: function () { + this.stopListening(); + }, + }, + ]) + ); + })(Kt); + Object.assign(ui.prototype, wt), + (ui.extend = function (s) { + return si(ui, s); + }), + (ui.type = "core"); + var ji = (function (s) { + function e(t) { + var i; + return ( + Te(this, e), + (i = De(this, e, [t.options])), + (i.container = t), + (i.enabled = !0), + i.bindEvents(), + i + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "playerError", + get: function () { + return this.container.playerError; + }, + }, + { + key: "enable", + value: function () { + this.enabled || + (this.bindEvents(), this.$el.show(), (this.enabled = !0)); + }, + }, + { + key: "disable", + value: function () { + this.stopListening(), this.$el.hide(), (this.enabled = !1); + }, + }, + { key: "bindEvents", value: function () {} }, + ]) + ); + })(Ti); + Object.assign(ji.prototype, wt), + (ji.extend = function (s) { + return si(ji, s); + }), + (ji.type = "container"); + var sc = `<% for (var i = 0; i < tracks.length; i++) { %> + <track data-html5-video-track="<%= i %>" kind="<%= tracks[i].kind %>" label="<%= tracks[i].label %>" srclang="<%= tracks[i].lang %>" src="<%= tracks[i].src %>"> +<% }; %> +`, + ac = `[data-html5-video] { + position: absolute; + height: 100%; + width: 100%; + display: block; } +`, + ci = { + mp4: [ + "avc1.42E01E", + "avc1.58A01E", + "avc1.4D401E", + "avc1.64001E", + "mp4v.20.8", + "mp4v.20.240", + "mp4a.40.2", + ].map(function (s) { + return 'video/mp4; codecs="' + s + ', mp4a.40.2"'; + }), + ogg: [ + 'video/ogg; codecs="theora, vorbis"', + 'video/ogg; codecs="dirac"', + 'video/ogg; codecs="theora, speex"', + ], + "3gpp": ['video/3gpp; codecs="mp4v.20.8, samr"'], + webm: ['video/webm; codecs="vp8, vorbis"'], + mkv: ['video/x-matroska; codecs="theora, vorbis"'], + m3u8: ["application/x-mpegurl"], + }; + (ci.ogv = ci.ogg), (ci["3gp"] = ci["3gpp"]); + var _i = { + wav: ["audio/wav"], + mp3: ["audio/mp3", 'audio/mpeg;codecs="mp3"'], + aac: ['audio/mp4;codecs="mp4a.40.5"'], + oga: ["audio/ogg"], + }, + oc = Object.keys(_i).reduce(function (s, e) { + return [].concat(ri(s), ri(_i[e])); + }, []), + qs = { code: "unknown", message: "unknown" }, + ht = (function (s) { + function e() { + var t; + Te(this, e); + for (var i = arguments.length, n = new Array(i), r = 0; r < i; r++) + n[r] = arguments[r]; + (t = De(this, e, [].concat(n))), + (t._destroyed = !1), + (t._loadStarted = !1), + (t._isBuffering = !1), + (t._playheadMoving = !1), + (t._playheadMovingTimer = null), + (t._stopped = !1), + (t._ccTrackId = -1), + (t._playheadMovingCheckEnabled = + !t.options.disablePlayheadMovingCheck), + t._setupSrc(t.options.src), + (t._playheadMovingCheckInterval = + t.options.playheadMovingCheckInterval || 500), + t.options.playback || (t.options.playback = t.options || {}), + (t.options.playback.disableContextMenu = + t.options.playback.disableContextMenu || + t.options.disableVideoTagContextMenu), + (t._minDvrSize = t.isValidMinimumDVRSizeConfig + ? t.minimumDVRSizeConfig + : 60); + var a = t.options.playback, + o = a.preload || (ie.isSafari ? "auto" : t.options.preload), + l; + return ( + t.options.poster && + (typeof t.options.poster == "string" + ? (l = t.options.poster) + : typeof t.options.poster.url == "string" && + (l = t.options.poster.url)), + ue.extend(!0, t.el, { + muted: t.options.mute, + defaultMuted: t.options.mute, + loop: t.options.loop, + poster: l, + preload: o || "metadata", + crossOrigin: a.crossOrigin, + "x-webkit-playsinline": a.playInline, + }), + (a.controls || t.options.useVideoTagDefaultControls) && + t.$el.attr("controls", ""), + a.playInline && t.$el.attr({ playsinline: "playsinline" }), + a.crossOrigin && t.$el.attr({ crossorigin: a.crossOrigin }), + (t.settings = { default: ["seekbar"] }), + (t.settings.left = ["playpause", "position", "duration"]), + (t.settings.right = ["fullscreen", "volume", "hd-indicator"]), + a.externalTracks && t._setupExternalTracks(a.externalTracks), + t.options.autoPlay && t.attemptAutoPlay(), + t + ); + } + return ( + Oe(e, s), + be(e, [ + { + key: "name", + get: function () { + return "html5_video"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "tagName", + get: function () { + return this.isAudioOnly ? "audio" : "video"; + }, + }, + { + key: "isAudioOnly", + get: function () { + var i = this.options.src, + n = e._mimeTypesForUrl(i, _i, this.options.mimeType); + return ( + (this.options.playback && this.options.playback.audioOnly) || + this.options.audioOnly || + oc.indexOf(n[0]) >= 0 + ); + }, + }, + { + key: "attributes", + get: function () { + return { "data-html5-video": "" }; + }, + }, + { + key: "events", + get: function () { + return { + canplay: "_onCanPlay", + canplaythrough: "_handleBufferingEvents", + durationchange: "_onDurationChange", + ended: "_onEnded", + error: "_onError", + loadeddata: "_onLoadedData", + loadedmetadata: "_onLoadedMetadata", + pause: "_onPause", + playing: "_onPlaying", + progress: "_onProgress", + seeking: "_onSeeking", + seeked: "_onSeeked", + stalled: "_handleBufferingEvents", + timeupdate: "_onTimeUpdate", + waiting: "_onWaiting", + enterpictureinpicture: "_onEnterPiP", + leavepictureinpicture: "_onExitPiP", + }; + }, + }, + { + key: "ended", + get: function () { + return this.el.ended; + }, + }, + { + key: "buffering", + get: function () { + return this._isBuffering; + }, + }, + { + key: "isPiPActive", + get: function () { + return this.el === document.pictureInPictureElement; + }, + }, + { + key: "isLive", + get: function () { + return this.getPlaybackType() === he.LIVE; + }, + }, + { + key: "dvrEnabled", + get: function () { + return this.getDuration() >= this._minDvrSize && this.isLive; + }, + }, + { + key: "minimumDVRSizeConfig", + get: function () { + return ( + this.options.playback && this.options.playback.minimumDvrSize + ); + }, + }, + { + key: "isValidMinimumDVRSizeConfig", + get: function () { + return ( + typeof this.minimumDVRSizeConfig < "u" && + typeof this.minimumDVRSizeConfig == "number" + ); + }, + }, + { + key: "sourceMedia", + get: function () { + return this._src; + }, + }, + { + key: "configure", + value: function (i) { + Gt(Et(e.prototype), "configure", this).call(this, i), + (this.el.loop = !!i.loop); + }, + }, + { + key: "attemptAutoPlay", + value: function () { + var i = this; + this.canAutoPlay(function (n, r) { + r && + le.warn(i.name, "autoplay error.", { result: n, error: r }), + n && + setTimeout(function () { + return !i._destroyed && i.play(); + }, 0); + }); + }, + }, + { + key: "canAutoPlay", + value: function (i) { + if (this.options.disableCanAutoPlay) { + i(!0, null); + return; + } + var n = { + timeout: this.options.autoPlayTimeout || 500, + inline: this.options.playback.playInline || !1, + muted: this.options.mute || !1, + }; + ie.isMobile && oi.options.recycleVideo && (n.element = this.el), + Ns(i, n); + }, + }, + { + key: "_setupExternalTracks", + value: function (i) { + this._externalTracks = i.map(function (n) { + return { + kind: n.kind || "subtitles", + label: n.label, + lang: n.lang, + src: n.src, + }; + }); + }, + }, + { + key: "load", + value: function (i) { + this._setupSrc(i); + }, + }, + { + key: "_setupSrc", + value: function (i) { + this.el.src !== i && + ((this._ccIsSetup = !1), + (this.el.src = i), + (this._src = this.el.src)); + }, + }, + { + key: "_onLoadedMetadata", + value: function (i) { + this._handleBufferingEvents(), + this.trigger(C.PLAYBACK_LOADEDMETADATA, { + duration: i.target.duration, + data: i, + }), + this._updateSettings(); + var n = + typeof this._options.autoSeekFromUrl > "u" || + this._options.autoSeekFromUrl; + this.getPlaybackType() !== he.LIVE && + n && + this._checkInitialSeek(); + }, + }, + { + key: "_onDurationChange", + value: function () { + this._updateSettings(), this._onTimeUpdate(), this._onProgress(); + }, + }, + { + key: "_updateSettings", + value: function () { + this.getPlaybackType() === he.VOD || + this.getPlaybackType() === he.AOD + ? (this.settings.left = ["playpause", "position", "duration"]) + : (this.settings.left = ["playstop"]), + (this.settings.seekEnabled = this.isSeekEnabled()), + this.trigger(C.PLAYBACK_SETTINGSUPDATE); + }, + }, + { + key: "isSeekEnabled", + value: function () { + return isFinite(this.getDuration()); + }, + }, + { + key: "getPlaybackType", + value: function () { + var i = this.tagName === "audio" ? he.AOD : he.VOD; + return [0, void 0, 1 / 0].indexOf(this.el.duration) >= 0 + ? he.LIVE + : i; + }, + }, + { + key: "isHighDefinitionInUse", + value: function () { + return !1; + }, + }, + { + key: "consent", + value: function (i) { + var n = this; + if (this.isPlaying() || this.el._consented) + Gt(Et(e.prototype), "consent", this).call(this, i); + else { + var r = function a() { + n.el.removeEventListener("loadedmetadata", a, !1), + n.el.removeEventListener("error", a, !1), + (n.el._consented = !0), + Gt(Et(e.prototype), "consent", n).call(n, i); + }; + this.el.addEventListener("loadedmetadata", r, !1), + this.el.addEventListener("error", r, !1), + this.el.load(); + } + }, + }, + { + key: "play", + value: function () { + var i = this; + this.trigger(C.PLAYBACK_PLAY_INTENT), + (this._stopped = !1), + this._setupSrc(this._src), + this._handleBufferingEvents(); + var n = this.el.play(); + return ( + n && + n.catch && + n.catch(function (r) { + return le.warn(i.name, "HTML5 play failed", r); + }), + n + ); + }, + }, + { + key: "pause", + value: function () { + this.el.pause(); + }, + }, + { + key: "stop", + value: function () { + this.pause(), + (this._stopped = !0), + this.el.removeAttribute("src"), + this.el.load(), + this._stopPlayheadMovingChecks(), + this._handleBufferingEvents(), + this.trigger(C.PLAYBACK_STOP); + }, + }, + { + key: "volume", + value: function (i) { + i === 0 + ? (this.$el.attr({ muted: "true" }), (this.el.muted = !0)) + : (this.$el.attr({ muted: null }), + (this.el.muted = !1), + (this.el.volume = i / 100)); + }, + }, + { + key: "mute", + value: function () { + this.el.muted = !0; + }, + }, + { + key: "unmute", + value: function () { + this.el.muted = !1; + }, + }, + { + key: "isMuted", + value: function () { + return this.el.muted === !0 || this.el.volume === 0; + }, + }, + { + key: "isPlaying", + value: function () { + return !this.el.paused && !this.el.ended; + }, + }, + { + key: "isReady", + get: function () { + return this._isReadyState; + }, + }, + { + key: "_startPlayheadMovingChecks", + value: function () { + this._playheadMovingTimer !== null || + !this._playheadMovingCheckEnabled || + ((this._playheadMovingTimeOnCheck = null), + this._determineIfPlayheadMoving(), + (this._playheadMovingTimer = setInterval( + this._determineIfPlayheadMoving.bind(this), + this._playheadMovingCheckInterval + ))); + }, + }, + { + key: "_stopPlayheadMovingChecks", + value: function () { + this._playheadMovingTimer !== null && + (clearInterval(this._playheadMovingTimer), + (this._playheadMovingTimer = null), + (this._playheadMoving = !1)); + }, + }, + { + key: "_determineIfPlayheadMoving", + value: function () { + var i = this._playheadMovingTimeOnCheck, + n = this.el.currentTime; + (this._playheadMoving = i !== n), + (this._playheadMovingTimeOnCheck = n), + this._handleBufferingEvents(); + }, + }, + { + key: "_onWaiting", + value: function () { + (this._loadStarted = !0), this._handleBufferingEvents(); + }, + }, + { + key: "_onLoadedData", + value: function () { + (this._loadStarted = !0), this._handleBufferingEvents(); + }, + }, + { + key: "_onCanPlay", + value: function () { + this._handleBufferingEvents(); + }, + }, + { + key: "_onPlaying", + value: function () { + this._checkForClosedCaptions(), + this._startPlayheadMovingChecks(), + this._handleBufferingEvents(), + this.trigger(C.PLAYBACK_PLAY); + }, + }, + { + key: "_onPause", + value: function () { + this.dvrEnabled && this._updateDvr(!0), + this._stopPlayheadMovingChecks(), + this._handleBufferingEvents(), + this.trigger(C.PLAYBACK_PAUSE); + }, + }, + { + key: "_onSeeking", + value: function () { + var i = this.getCurrentTime(); + this.dvrEnabled && this._updateDvr(i < this.getDuration() - 3), + this.trigger(C.PLAYBACK_SEEK, i), + this._handleBufferingEvents(); + }, + }, + { + key: "_onSeeked", + value: function () { + this._handleBufferingEvents(), this.trigger(C.PLAYBACK_SEEKED); + }, + }, + { + key: "_onEnded", + value: function () { + this._handleBufferingEvents(), + this.trigger(C.PLAYBACK_ENDED, this.name); + }, + }, + { + key: "_onEnterPiP", + value: function () { + this.trigger(C.PLAYBACK_PIP_ENTER, this.name); + }, + }, + { + key: "_onExitPiP", + value: function () { + this.trigger(C.PLAYBACK_PIP_EXIT, this.name); + }, + }, + { + key: "enterPiP", + value: function () { + var i = this; + this.el + .requestPictureInPicture() + .then(function () { + le.info(i.name, "enter PIP success"); + }) + .catch(function (n) { + le.warn(i.name, "enter PIP failed", n); + }); + }, + }, + { + key: "exitPiP", + value: function () { + var i = this; + document + .exitPictureInPicture() + .then(function () { + le.info(i.name, "exit PIP success"); + }) + .catch(function (n) { + le.warn(i.name, "exit PIP failed", n); + }); + }, + }, + { + key: "_handleBufferingEvents", + value: function () { + var i = this._loadStarted && !this.el.ended && !this._stopped, + n = this.el.readyState < this.el.HAVE_FUTURE_DATA, + r = !this.el.ended && !this.el.paused && !this._playheadMoving, + a = i && n; + this._playheadMovingCheckEnabled && (a = a || (i && r)), + this._isBuffering !== a && + ((this._isBuffering = a), + a + ? this.trigger(C.PLAYBACK_BUFFERING, this.name) + : this.trigger(C.PLAYBACK_BUFFERFULL, this.name)); + }, + }, + { + key: "_onError", + value: function () { + var i = this.el.error || qs, + n = i.code, + r = i.message, + a = n === qs.code, + o = this.createError({ + code: n, + description: r, + raw: this.el.error, + level: a ? Tt.Levels.WARN : Tt.Levels.FATAL, + }); + a + ? le.warn(this.name, "HTML5 unknown error: ", o) + : this.trigger(C.PLAYBACK_ERROR, o); + }, + }, + { + key: "destroy", + value: function () { + (this._destroyed = !0), + this._stopPlayheadMovingChecks(), + this.handleTextTrackChange && + this.el.textTracks.removeEventListener( + "change", + this.handleTextTrackChange + ), + this.$el.off("contextmenu"), + Gt(Et(e.prototype), "destroy", this).call(this), + this.el.removeAttribute("src"), + this.el.load(), + (this._src = null), + oi.garbage(this.el); + }, + }, + { + key: "_updateDvr", + value: function (i) { + this.trigger(C.PLAYBACK_DVR, i), + this.trigger(C.PLAYBACK_STATS_ADD, { dvr: i }); + }, + }, + { + key: "seek", + value: function (i) { + i < 0 && + (le.warn( + "Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point." + ), + (i = this.getDuration())), + (i += this.el.seekable.start(0)), + (this.el.currentTime = i); + }, + }, + { + key: "seekPercentage", + value: function (i) { + var n = this.el.duration * (i / 100); + this.seek(n); + }, + }, + { + key: "_checkInitialSeek", + value: function () { + var i = ws(); + i !== 0 && this.seek(i); + }, + }, + { + key: "getCurrentTime", + value: function () { + return this.el.currentTime; + }, + }, + { + key: "getDuration", + value: function () { + if (this.isLive) { + if (this.el.seekable.length > 0) + return this.el.seekable.end(0) - this.el.seekable.start(0); + this._scheduleUpdateSettingsCheck(); + } + return this.el.duration; + }, + }, + { + key: "_scheduleUpdateSettingsCheck", + value: function () { + var i = this; + this._updateSettingsCheckInFlight || + (this._updateSettingsCheckInFlight = setTimeout(function () { + i._updateSettings(), (i._updateSettingsCheckInFlight = null); + }, 1e3)); + }, + }, + { + key: "_onTimeUpdate", + value: function () { + var i = this.isLive ? this.getDuration() : this.el.duration; + this.trigger( + C.PLAYBACK_TIMEUPDATE, + { current: this.el.currentTime, total: i }, + this.name + ); + }, + }, + { + key: "_onProgress", + value: function () { + if (this.el.buffered.length) { + for (var i = [], n = 0, r = 0; r < this.el.buffered.length; r++) + (i = [].concat(ri(i), [ + { + start: this.el.buffered.start(r), + end: this.el.buffered.end(r), + }, + ])), + this.el.currentTime >= i[r].start && + this.el.currentTime <= i[r].end && + (n = r); + var a = { + start: i[n].start, + current: i[n].end, + total: this.el.duration, + }; + this.trigger(C.PLAYBACK_PROGRESS, a, i); + } + }, + }, + { + key: "_typeFor", + value: function (i) { + var n = e._mimeTypesForUrl(i, ci, this.options.mimeType); + n.length === 0 && + (n = e._mimeTypesForUrl(i, _i, this.options.mimeType)); + var r = n[0] || ""; + return r.split(";")[0]; + }, + }, + { + key: "_ready", + value: function () { + this._isReadyState || + ((this._isReadyState = !0), + this.trigger(C.PLAYBACK_READY, this.name)); + }, + }, + { + key: "_checkForClosedCaptions", + value: function () { + if (this.isHTML5Video && !this._ccIsSetup) { + if (this.hasClosedCaptionsTracks) { + this.trigger(C.PLAYBACK_SUBTITLE_AVAILABLE); + var i = this.closedCaptionsTrackId; + (this.closedCaptionsTrackId = i), + (this.handleTextTrackChange = + this._handleTextTrackChange.bind(this)), + this.el.textTracks.addEventListener( + "change", + this.handleTextTrackChange + ); + } + this._ccIsSetup = !0; + } + }, + }, + { + key: "_handleTextTrackChange", + value: function () { + var i = this.closedCaptionsTracks, + n = i.find(function (r) { + return r.track.mode === "showing"; + }) || { id: -1 }; + this._ccTrackId !== n.id && + ((this._ccTrackId = n.id), + this.trigger(C.PLAYBACK_SUBTITLE_CHANGED, { id: n.id })); + }, + }, + { + key: "isHTML5Video", + get: function () { + return this.name === e.prototype.name; + }, + }, + { + key: "closedCaptionsTracks", + get: function () { + var i = 0, + n = function () { + return i++; + }, + r = this.el.textTracks ? Array.from(this.el.textTracks) : []; + return r + .filter(function (a) { + return a.kind === "subtitles" || a.kind === "captions"; + }) + .map(function (a) { + return { id: n(), name: a.label, track: a }; + }); + }, + }, + { + key: "closedCaptionsTrackId", + get: function () { + return this._ccTrackId; + }, + set: function (i) { + if (Gi(i)) { + var n = this.closedCaptionsTracks, + r; + (i !== -1 && + ((r = n.find(function (a) { + return a.id === i; + })), + !r || r.track.mode === "showing")) || + (n + .filter(function (a) { + return a.track.mode !== "hidden"; + }) + .forEach(function (a) { + return (a.track.mode = "hidden"); + }), + r && (r.track.mode = "showing"), + (this._ccTrackId = i), + this.trigger(C.PLAYBACK_SUBTITLE_CHANGED, { id: i })); + } + }, + }, + { + key: "template", + get: function () { + return Yi(sc); + }, + }, + { + key: "render", + value: function () { + this.options.playback.disableContextMenu && + this.$el.on("contextmenu", function () { + return !1; + }), + this._externalTracks && + this._externalTracks.length > 0 && + this.$el.html( + this.template({ tracks: this._externalTracks }) + ), + this._ready(); + var i = li.getStyleFor(ac.toString(), { + baseUrl: this.options.baseUrl, + }); + return this.$el.append(i[0]), this; + }, + }, + ]) + ); + })(he); + (ht._mimeTypesForUrl = function () { + var s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", + e = arguments.length > 1 ? arguments[1] : void 0, + t = arguments.length > 2 ? arguments[2] : void 0, + i = (s.split("?")[0].match(/.*\.(.*)$/) || [])[1], + n = t || (i && e[i.toLowerCase()]) || []; + return n.constructor === Array ? n : [n]; + }), + (ht._canPlay = function (s, e, t, i) { + var n = ht._mimeTypesForUrl(t, e, i), + r = document.createElement(s); + return !!n.filter(function (a) { + return !!r.canPlayType(a).replace(/no/, ""); + })[0]; + }), + (ht.canPlay = function (s, e) { + return ht._canPlay("audio", _i, s, e) || ht._canPlay("video", ci, s, e); + }); + var Xs = (function (s) { + function e() { + return Te(this, e), De(this, e, arguments); + } + return ( + Oe(e, s), + be(e, [ + { + key: "name", + get: function () { + return "html5_audio"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "tagName", + get: function () { + return "audio"; + }, + }, + { + key: "isAudioOnly", + get: function () { + return !0; + }, + }, + { + key: "updateSettings", + value: function () { + (this.settings.left = ["playpause", "position", "duration"]), + (this.settings.seekEnabled = this.isSeekEnabled()), + this.trigger(C.PLAYBACK_SETTINGSUPDATE); + }, + }, + { + key: "getPlaybackType", + value: function () { + return he.AOD; + }, + }, + ]) + ); + })(ht); + Xs.canPlay = function (s, e) { + var t = { + wav: ["audio/wav"], + mp3: ["audio/mp3", 'audio/mpeg;codecs="mp3"'], + aac: ['audio/mp4;codecs="mp4a.40.5"'], + oga: ["audio/ogg"], + }; + return ht._canPlay("audio", t, s, e); + }; + var lc = `[data-html-img] { + max-width: 100%; + max-height: 100%; } +`, + Zs = (function (s) { + function e(t) { + var i; + return Te(this, e), (i = De(this, e, [t])), (i.el.src = t.src), i; + } + return ( + Oe(e, s), + be(e, [ + { + key: "name", + get: function () { + return "html_img"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "tagName", + get: function () { + return "img"; + }, + }, + { + key: "attributes", + get: function () { + return { "data-html-img": "" }; + }, + }, + { + key: "events", + get: function () { + return { load: "_onLoad", abort: "_onError", error: "_onError" }; + }, + }, + { + key: "getPlaybackType", + value: function () { + return he.NO_OP; + }, + }, + { + key: "render", + value: function () { + var i = li.getStyleFor(lc.toString(), { + baseUrl: this.options.baseUrl, + }); + return ( + this.$el.append(i[0]), + this.trigger(C.PLAYBACK_READY, this.name), + this + ); + }, + }, + { + key: "_onLoad", + value: function () { + this.trigger(C.PLAYBACK_ENDED, this.name); + }, + }, + { + key: "_onError", + value: function (i) { + var n = i.type === "error" ? "load error" : "loading aborted"; + this.trigger(C.PLAYBACK_ERROR, { message: n }, this.name); + }, + }, + ]) + ); + })(he); + Zs.canPlay = function (s) { + return /\.(png|jpg|jpeg|gif|bmp|tiff|pgm|pnm|webp)(|\?.*)$/i.test(s); + }; + var uc = `<canvas data-no-op-canvas></canvas> +<p data-no-op-msg><%=message%></p><p> +</p>`, + cc = `[data-no-op] { + position: absolute; + height: 100%; + width: 100%; + text-align: center; } + +[data-no-op] p[data-no-op-msg] { + position: absolute; + text-align: center; + font-size: 25px; + left: 0; + right: 0; + color: white; + padding: 10px; + /* center vertically */ + top: 50%; + transform: translateY(-50%); + max-height: 100%; + overflow: auto; } + +[data-no-op] canvas[data-no-op-canvas] { + background-color: #777; + height: 100%; + width: 100%; } +`, + Qs = (function (s) { + function e() { + var t; + Te(this, e); + for (var i = arguments.length, n = new Array(i), r = 0; r < i; r++) + n[r] = arguments[r]; + return (t = De(this, e, [].concat(n))), (t._noiseFrameNum = -1), t; + } + return ( + Oe(e, s), + be(e, [ + { + key: "name", + get: function () { + return "no_op"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "template", + get: function () { + return Yi(uc); + }, + }, + { + key: "attributes", + get: function () { + return { "data-no-op": "" }; + }, + }, + { + key: "render", + value: function () { + var i = + this.options.playbackNotSupportedMessage || + this.i18n.t("playback_not_supported"), + n = li.getStyleFor(cc.toString(), { + baseUrl: this.options.baseUrl, + }); + this.$el.append(n[0]), + this.$el.html(this.template({ message: i })), + this.trigger(C.PLAYBACK_READY, this.name); + var r = !!( + this.options.poster && this.options.poster.showForNoOp + ); + return (this.options.autoPlay || !r) && this._animate(), this; + }, + }, + { + key: "_noise", + value: function () { + if ( + ((this._noiseFrameNum = (this._noiseFrameNum + 1) % 5), + !this._noiseFrameNum) + ) { + var i = this.context.createImageData( + this.context.canvas.width, + this.context.canvas.height + ), + n; + try { + n = new Uint32Array(i.data.buffer); + } catch { + n = new Uint32Array( + this.context.canvas.width * this.context.canvas.height * 4 + ); + for (var r = i.data, a = 0; a < r.length; a++) n[a] = r[a]; + } + for ( + var o = n.length, + l = Math.random() * 6 + 4, + u = 0, + c = 0, + d = 0; + d < o; + + ) { + if (u < 0) { + u = l * Math.random(); + var f = Math.pow(Math.random(), 0.4); + c = (255 * f) << 24; + } + (u -= 1), (n[d++] = c); + } + this.context.putImageData(i, 0, 0); + } + }, + }, + { + key: "_loop", + value: function () { + var i = this; + this._stop || + (this._noise(), + (this._animationHandle = Is(function () { + return i._loop(); + }))); + }, + }, + { + key: "destroy", + value: function () { + this._animationHandle && + (Rs(this._animationHandle), (this._stop = !0)); + }, + }, + { + key: "_animate", + value: function () { + (this.canvas = this.$el.find("canvas[data-no-op-canvas]")[0]), + (this.context = this.canvas.getContext("2d")), + this._loop(); + }, + }, + ]) + ); + })(he); + Qs.canPlay = function (s) { + return !0; + }; + var hc = (function (s) { + function e(t) { + var i; + return Te(this, e), (i = De(this, e, [t])), i._initializeMessages(), i; + } + return ( + Oe(e, s), + be(e, [ + { + key: "name", + get: function () { + return "strings"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "t", + value: function (i) { + var n = this._language(), + r = this._messages.en, + a = (n && this._messages[n]) || r; + return a[i] || r[i] || i; + }, + }, + { + key: "_language", + value: function () { + return this.core.options.language || Os(); + }, + }, + { + key: "_initializeMessages", + value: function () { + var i = { + en: { + live: "live", + back_to_live: "back to live", + disabled: "Disabled", + playback_not_supported: + "Your browser does not support the playback of this video. Please try using a different browser.", + default_error_title: "Could not play video.", + default_error_message: + "There was a problem trying to load the video.", + }, + de: { + live: "Live", + back_to_live: "Zurück zum Live-Video", + disabled: "Deaktiviert", + playback_not_supported: + "Ihr Browser unterstützt das Playback Verfahren nicht. Bitte vesuchen Sie es mit einem anderen Browser.", + default_error_title: "Video kann nicht abgespielt werden", + default_error_message: + "Es gab ein Problem beim Laden des Videos", + }, + pt: { + live: "ao vivo", + back_to_live: "voltar para o ao vivo", + disabled: "Desativado", + playback_not_supported: + "Seu navegador não suporta a reprodução deste video. Por favor, tente usar um navegador diferente.", + default_error_title: "Não foi possível reproduzir o vídeo.", + default_error_message: + "Ocorreu um problema ao tentar carregar o vídeo.", + }, + es_am: { + live: "vivo", + back_to_live: "volver en vivo", + disabled: "No disponible", + playback_not_supported: + "Su navegador no soporta la reproducción de este video. Por favor, utilice un navegador diferente.", + default_error_title: "No se puede reproducir el video.", + default_error_message: + "Se ha producido un error al cargar el video.", + }, + es: { + live: "en directo", + back_to_live: "volver al directo", + disabled: "No disponible", + playback_not_supported: + "Este navegador no es compatible para reproducir este vídeo. Utilice un navegador diferente.", + default_error_title: "No se puede reproducir el vídeo.", + default_error_message: + "Se ha producido un problema al cargar el vídeo.", + }, + ru: { + live: "прямой эфир", + back_to_live: "к прямому эфиру", + disabled: "Отключено", + playback_not_supported: + "Ваш браузер не поддерживает воспроизведение этого видео. Пожалуйста, попробуйте другой браузер.", + }, + bg: { + live: "на живо", + back_to_live: "Върни на живо", + disabled: "Изключено", + playback_not_supported: + "Вашият браузър не поддържа възпроизвеждането на това видео. Моля, пробвайте с друг браузър.", + default_error_title: "Видеото не може да се възпроизведе.", + default_error_message: + "Възникна проблем при зареждането на видеото.", + }, + fr: { + live: "en direct", + back_to_live: "retour au direct", + disabled: "Désactivé", + playback_not_supported: + "Votre navigateur ne supporte pas la lecture de cette vidéo. Merci de tenter sur un autre navigateur.", + default_error_title: "Impossible de lire la vidéo.", + default_error_message: + "Un problème est survenu lors du chargement de la vidéo.", + }, + tr: { + live: "canlı", + back_to_live: "canlı yayına dön", + disabled: "Engelli", + playback_not_supported: + "Tarayıcınız bu videoyu oynatma desteğine sahip değil. Lütfen farklı bir tarayıcı ile deneyin.", + }, + et: { + live: "Otseülekanne", + back_to_live: "Tagasi otseülekande juurde", + disabled: "Keelatud", + playback_not_supported: + "Teie brauser ei toeta selle video taasesitust. Proovige kasutada muud brauserit.", + }, + ar: { + live: "مباشر", + back_to_live: "الرجوع إلى المباشر", + disabled: "معطّل", + playback_not_supported: + "المتصفح الذي تستخدمه لا يدعم تشغيل هذا الفيديو. الرجاء إستخدام متصفح آخر.", + default_error_title: "غير قادر الى التشغيل.", + default_error_message: "حدثت مشكلة أثناء تحميل الفيديو.", + }, + zh: { + live: "直播", + back_to_live: "返回直播", + disabled: "已禁用", + playback_not_supported: + "您的浏览器不支持该视频的播放。请尝试使用另一个浏览器。", + default_error_title: "无法播放视频。", + default_error_message: "在尝试加载视频时出现了问题。", + }, + }; + (this._messages = ue.extend( + !0, + i, + this.core.options.strings || {} + )), + (this._messages["de-DE"] = this._messages.de), + (this._messages["pt-BR"] = this._messages.pt), + (this._messages["en-US"] = this._messages.en), + (this._messages["bg-BG"] = this._messages.bg), + (this._messages["es-419"] = this._messages.es_am), + (this._messages["es-ES"] = this._messages.es), + (this._messages["fr-FR"] = this._messages.fr), + (this._messages["tr-TR"] = this._messages.tr), + (this._messages["et-EE"] = this._messages.et), + (this._messages["ar-IQ"] = this._messages.ar), + (this._messages["zh-CN"] = this._messages.zh); + }, + }, + ]) + ); + })(ui), + dc = (function (s) { + function e() { + return Te(this, e), De(this, e, arguments); + } + return ( + Oe(e, s), + be(e, [ + { + key: "name", + get: function () { + return "sources"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo( + this.core, + C.CORE_CONTAINERS_CREATED, + this.onContainersCreated + ); + }, + }, + { + key: "onContainersCreated", + value: function () { + var i = + this.core.containers.filter(function (n) { + return n.playback.name !== "no_op"; + })[0] || this.core.containers[0]; + i && + this.core.containers.forEach(function (n) { + n !== i && n.destroy(); + }); + }, + }, + ]) + ); + })(ui); + Yt.registerPlugin(hc), + Yt.registerPlugin(dc), + Yt.registerPlayback(Qs), + Yt.registerPlayback(Zs), + Yt.registerPlayback(Xs), + Yt.registerPlayback(ht); + function Js(s, e) { + var t = Object.keys(s); + if (Object.getOwnPropertySymbols) { + var i = Object.getOwnPropertySymbols(s); + e && + (i = i.filter(function (n) { + return Object.getOwnPropertyDescriptor(s, n).enumerable; + })), + t.push.apply(t, i); + } + return t; + } + function Gn(s) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e] != null ? arguments[e] : {}; + e % 2 + ? Js(Object(t), !0).forEach(function (i) { + pc(s, i, t[i]); + }) + : Object.getOwnPropertyDescriptors + ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(t)) + : Js(Object(t)).forEach(function (i) { + Object.defineProperty(s, i, Object.getOwnPropertyDescriptor(t, i)); + }); + } + return s; + } + function fc(s, e) { + if (!(s instanceof e)) + throw new TypeError("Cannot call a class as a function"); + } + function ea(s, e) { + for (var t = 0; t < e.length; t++) { + var i = e[t]; + (i.enumerable = i.enumerable || !1), + (i.configurable = !0), + "value" in i && (i.writable = !0), + Object.defineProperty(s, ta(i.key), i); + } + } + function gc(s, e, t) { + return ( + e && ea(s.prototype, e), + t && ea(s, t), + Object.defineProperty(s, "prototype", { writable: !1 }), + s + ); + } + function pc(s, e, t) { + return ( + (e = ta(e)), + e in s + ? Object.defineProperty(s, e, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0, + }) + : (s[e] = t), + s + ); + } + function mc(s, e) { + if (typeof e != "function" && e !== null) + throw new TypeError("Super expression must either be null or a function"); + (s.prototype = Object.create(e && e.prototype, { + constructor: { value: s, writable: !0, configurable: !0 }, + })), + Object.defineProperty(s, "prototype", { writable: !1 }), + e && Kn(s, e); + } + function dt(s) { + return ( + (dt = Object.setPrototypeOf + ? Object.getPrototypeOf.bind() + : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }), + dt(s) + ); + } + function Kn(s, e) { + return ( + (Kn = Object.setPrototypeOf + ? Object.setPrototypeOf.bind() + : function (i, n) { + return (i.__proto__ = n), i; + }), + Kn(s, e) + ); + } + function Ac() { + if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) + return !1; + if (typeof Proxy == "function") return !0; + try { + return ( + Boolean.prototype.valueOf.call( + Reflect.construct(Boolean, [], function () {}) + ), + !0 + ); + } catch { + return !1; + } + } + function yc(s) { + if (s === void 0) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return s; + } + function vc(s, e) { + if (e && (typeof e == "object" || typeof e == "function")) return e; + if (e !== void 0) + throw new TypeError( + "Derived constructors may only return object or undefined" + ); + return yc(s); + } + function Ec(s) { + var e = Ac(); + return function () { + var i = dt(s), + n; + if (e) { + var r = dt(this).constructor; + n = Reflect.construct(i, arguments, r); + } else n = i.apply(this, arguments); + return vc(this, n); + }; + } + function Tc(s, e) { + for ( + ; + !Object.prototype.hasOwnProperty.call(s, e) && ((s = dt(s)), s !== null); + + ); + return s; + } + function Dt() { + return ( + typeof Reflect < "u" && Reflect.get + ? (Dt = Reflect.get.bind()) + : (Dt = function (e, t, i) { + var n = Tc(e, t); + if (n) { + var r = Object.getOwnPropertyDescriptor(n, t); + return r.get ? r.get.call(arguments.length < 3 ? e : i) : r.value; + } + }), + Dt.apply(this, arguments) + ); + } + function bc(s) { + return _c(s) || kc(s) || Sc(s) || Cc(); + } + function _c(s) { + if (Array.isArray(s)) return Hn(s); + } + function kc(s) { + if ( + (typeof Symbol < "u" && s[Symbol.iterator] != null) || + s["@@iterator"] != null + ) + return Array.from(s); + } + function Sc(s, e) { + if (s) { + if (typeof s == "string") return Hn(s, e); + var t = Object.prototype.toString.call(s).slice(8, -1); + if ( + (t === "Object" && s.constructor && (t = s.constructor.name), + t === "Map" || t === "Set") + ) + return Array.from(s); + if ( + t === "Arguments" || + /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) + ) + return Hn(s, e); + } + } + function Hn(s, e) { + (e == null || e > s.length) && (e = s.length); + for (var t = 0, i = new Array(e); t < e; t++) i[t] = s[t]; + return i; + } + function Cc() { + throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); + } + function xc(s, e) { + if (typeof s != "object" || s === null) return s; + var t = s[Symbol.toPrimitive]; + if (t !== void 0) { + var i = t.call(s, e || "default"); + if (typeof i != "object") return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (e === "string" ? String : Number)(s); + } + function ta(s) { + var e = xc(s, "string"); + return typeof e == "symbol" ? e : String(e); + } + function Lc(s) { + return s && + s.__esModule && + Object.prototype.hasOwnProperty.call(s, "default") + ? s.default + : s; + } + var ia = { exports: {} }; + (function (s, e) { + (function (t) { + var i = + /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/, + n = /^(?=([^\/?#]*))\1([^]*)$/, + r = /(?:\/|^)\.(?=\/)/g, + a = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g, + o = { + buildAbsoluteURL: function (l, u, c) { + if (((c = c || {}), (l = l.trim()), (u = u.trim()), !u)) { + if (!c.alwaysNormalize) return l; + var d = o.parseURL(l); + if (!d) throw new Error("Error trying to parse base URL."); + return (d.path = o.normalizePath(d.path)), o.buildURLFromParts(d); + } + var f = o.parseURL(u); + if (!f) throw new Error("Error trying to parse relative URL."); + if (f.scheme) + return c.alwaysNormalize + ? ((f.path = o.normalizePath(f.path)), o.buildURLFromParts(f)) + : u; + var g = o.parseURL(l); + if (!g) throw new Error("Error trying to parse base URL."); + if (!g.netLoc && g.path && g.path[0] !== "/") { + var p = n.exec(g.path); + (g.netLoc = p[1]), (g.path = p[2]); + } + g.netLoc && !g.path && (g.path = "/"); + var v = { + scheme: g.scheme, + netLoc: f.netLoc, + path: null, + params: f.params, + query: f.query, + fragment: f.fragment, + }; + if (!f.netLoc && ((v.netLoc = g.netLoc), f.path[0] !== "/")) + if (!f.path) + (v.path = g.path), + f.params || + ((v.params = g.params), f.query || (v.query = g.query)); + else { + var T = g.path, + x = T.substring(0, T.lastIndexOf("/") + 1) + f.path; + v.path = o.normalizePath(x); + } + return ( + v.path === null && + (v.path = c.alwaysNormalize ? o.normalizePath(f.path) : f.path), + o.buildURLFromParts(v) + ); + }, + parseURL: function (l) { + var u = i.exec(l); + return u + ? { + scheme: u[1] || "", + netLoc: u[2] || "", + path: u[3] || "", + params: u[4] || "", + query: u[5] || "", + fragment: u[6] || "", + } + : null; + }, + normalizePath: function (l) { + for ( + l = l.split("").reverse().join("").replace(r, ""); + l.length !== (l = l.replace(a, "")).length; + + ); + return l.split("").reverse().join(""); + }, + buildURLFromParts: function (l) { + return ( + l.scheme + l.netLoc + l.path + l.params + l.query + l.fragment + ); + }, + }; + s.exports = o; + })(); + })(ia); + var Yn = ia.exports; + function na(s, e) { + var t = Object.keys(s); + if (Object.getOwnPropertySymbols) { + var i = Object.getOwnPropertySymbols(s); + e && + (i = i.filter(function (n) { + return Object.getOwnPropertyDescriptor(s, n).enumerable; + })), + t.push.apply(t, i); + } + return t; + } + function We(s) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e] != null ? arguments[e] : {}; + e % 2 + ? na(Object(t), !0).forEach(function (i) { + Ic(s, i, t[i]); + }) + : Object.getOwnPropertyDescriptors + ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(t)) + : na(Object(t)).forEach(function (i) { + Object.defineProperty(s, i, Object.getOwnPropertyDescriptor(t, i)); + }); + } + return s; + } + function Ic(s, e, t) { + return ( + (e = Pc(e)), + e in s + ? Object.defineProperty(s, e, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0, + }) + : (s[e] = t), + s + ); + } + function Fe() { + return ( + (Fe = Object.assign + ? Object.assign.bind() + : function (s) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e]; + for (var i in t) + Object.prototype.hasOwnProperty.call(t, i) && (s[i] = t[i]); + } + return s; + }), + Fe.apply(this, arguments) + ); + } + function Rc(s, e) { + if (typeof s != "object" || s === null) return s; + var t = s[Symbol.toPrimitive]; + if (t !== void 0) { + var i = t.call(s, e || "default"); + if (typeof i != "object") return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (e === "string" ? String : Number)(s); + } + function Pc(s) { + var e = Rc(s, "string"); + return typeof e == "symbol" ? e : String(e); + } + const ne = + Number.isFinite || + function (s) { + return typeof s == "number" && isFinite(s); + }; + let y = (function (s) { + return ( + (s.MEDIA_ATTACHING = "hlsMediaAttaching"), + (s.MEDIA_ATTACHED = "hlsMediaAttached"), + (s.MEDIA_DETACHING = "hlsMediaDetaching"), + (s.MEDIA_DETACHED = "hlsMediaDetached"), + (s.BUFFER_RESET = "hlsBufferReset"), + (s.BUFFER_CODECS = "hlsBufferCodecs"), + (s.BUFFER_CREATED = "hlsBufferCreated"), + (s.BUFFER_APPENDING = "hlsBufferAppending"), + (s.BUFFER_APPENDED = "hlsBufferAppended"), + (s.BUFFER_EOS = "hlsBufferEos"), + (s.BUFFER_FLUSHING = "hlsBufferFlushing"), + (s.BUFFER_FLUSHED = "hlsBufferFlushed"), + (s.MANIFEST_LOADING = "hlsManifestLoading"), + (s.MANIFEST_LOADED = "hlsManifestLoaded"), + (s.MANIFEST_PARSED = "hlsManifestParsed"), + (s.LEVEL_SWITCHING = "hlsLevelSwitching"), + (s.LEVEL_SWITCHED = "hlsLevelSwitched"), + (s.LEVEL_LOADING = "hlsLevelLoading"), + (s.LEVEL_LOADED = "hlsLevelLoaded"), + (s.LEVEL_UPDATED = "hlsLevelUpdated"), + (s.LEVEL_PTS_UPDATED = "hlsLevelPtsUpdated"), + (s.LEVELS_UPDATED = "hlsLevelsUpdated"), + (s.AUDIO_TRACKS_UPDATED = "hlsAudioTracksUpdated"), + (s.AUDIO_TRACK_SWITCHING = "hlsAudioTrackSwitching"), + (s.AUDIO_TRACK_SWITCHED = "hlsAudioTrackSwitched"), + (s.AUDIO_TRACK_LOADING = "hlsAudioTrackLoading"), + (s.AUDIO_TRACK_LOADED = "hlsAudioTrackLoaded"), + (s.SUBTITLE_TRACKS_UPDATED = "hlsSubtitleTracksUpdated"), + (s.SUBTITLE_TRACKS_CLEARED = "hlsSubtitleTracksCleared"), + (s.SUBTITLE_TRACK_SWITCH = "hlsSubtitleTrackSwitch"), + (s.SUBTITLE_TRACK_LOADING = "hlsSubtitleTrackLoading"), + (s.SUBTITLE_TRACK_LOADED = "hlsSubtitleTrackLoaded"), + (s.SUBTITLE_FRAG_PROCESSED = "hlsSubtitleFragProcessed"), + (s.CUES_PARSED = "hlsCuesParsed"), + (s.NON_NATIVE_TEXT_TRACKS_FOUND = "hlsNonNativeTextTracksFound"), + (s.INIT_PTS_FOUND = "hlsInitPtsFound"), + (s.FRAG_LOADING = "hlsFragLoading"), + (s.FRAG_LOAD_EMERGENCY_ABORTED = "hlsFragLoadEmergencyAborted"), + (s.FRAG_LOADED = "hlsFragLoaded"), + (s.FRAG_DECRYPTED = "hlsFragDecrypted"), + (s.FRAG_PARSING_INIT_SEGMENT = "hlsFragParsingInitSegment"), + (s.FRAG_PARSING_USERDATA = "hlsFragParsingUserdata"), + (s.FRAG_PARSING_METADATA = "hlsFragParsingMetadata"), + (s.FRAG_PARSED = "hlsFragParsed"), + (s.FRAG_BUFFERED = "hlsFragBuffered"), + (s.FRAG_CHANGED = "hlsFragChanged"), + (s.FPS_DROP = "hlsFpsDrop"), + (s.FPS_DROP_LEVEL_CAPPING = "hlsFpsDropLevelCapping"), + (s.ERROR = "hlsError"), + (s.DESTROYING = "hlsDestroying"), + (s.KEY_LOADING = "hlsKeyLoading"), + (s.KEY_LOADED = "hlsKeyLoaded"), + (s.LIVE_BACK_BUFFER_REACHED = "hlsLiveBackBufferReached"), + (s.BACK_BUFFER_REACHED = "hlsBackBufferReached"), + s + ); + })({}), + re = (function (s) { + return ( + (s.NETWORK_ERROR = "networkError"), + (s.MEDIA_ERROR = "mediaError"), + (s.KEY_SYSTEM_ERROR = "keySystemError"), + (s.MUX_ERROR = "muxError"), + (s.OTHER_ERROR = "otherError"), + s + ); + })({}), + $ = (function (s) { + return ( + (s.KEY_SYSTEM_NO_KEYS = "keySystemNoKeys"), + (s.KEY_SYSTEM_NO_ACCESS = "keySystemNoAccess"), + (s.KEY_SYSTEM_NO_SESSION = "keySystemNoSession"), + (s.KEY_SYSTEM_NO_CONFIGURED_LICENSE = "keySystemNoConfiguredLicense"), + (s.KEY_SYSTEM_LICENSE_REQUEST_FAILED = "keySystemLicenseRequestFailed"), + (s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED = + "keySystemServerCertificateRequestFailed"), + (s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED = + "keySystemServerCertificateUpdateFailed"), + (s.KEY_SYSTEM_SESSION_UPDATE_FAILED = "keySystemSessionUpdateFailed"), + (s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED = + "keySystemStatusOutputRestricted"), + (s.KEY_SYSTEM_STATUS_INTERNAL_ERROR = "keySystemStatusInternalError"), + (s.MANIFEST_LOAD_ERROR = "manifestLoadError"), + (s.MANIFEST_LOAD_TIMEOUT = "manifestLoadTimeOut"), + (s.MANIFEST_PARSING_ERROR = "manifestParsingError"), + (s.MANIFEST_INCOMPATIBLE_CODECS_ERROR = + "manifestIncompatibleCodecsError"), + (s.LEVEL_EMPTY_ERROR = "levelEmptyError"), + (s.LEVEL_LOAD_ERROR = "levelLoadError"), + (s.LEVEL_LOAD_TIMEOUT = "levelLoadTimeOut"), + (s.LEVEL_PARSING_ERROR = "levelParsingError"), + (s.LEVEL_SWITCH_ERROR = "levelSwitchError"), + (s.AUDIO_TRACK_LOAD_ERROR = "audioTrackLoadError"), + (s.AUDIO_TRACK_LOAD_TIMEOUT = "audioTrackLoadTimeOut"), + (s.SUBTITLE_LOAD_ERROR = "subtitleTrackLoadError"), + (s.SUBTITLE_TRACK_LOAD_TIMEOUT = "subtitleTrackLoadTimeOut"), + (s.FRAG_LOAD_ERROR = "fragLoadError"), + (s.FRAG_LOAD_TIMEOUT = "fragLoadTimeOut"), + (s.FRAG_DECRYPT_ERROR = "fragDecryptError"), + (s.FRAG_PARSING_ERROR = "fragParsingError"), + (s.FRAG_GAP = "fragGap"), + (s.REMUX_ALLOC_ERROR = "remuxAllocError"), + (s.KEY_LOAD_ERROR = "keyLoadError"), + (s.KEY_LOAD_TIMEOUT = "keyLoadTimeOut"), + (s.BUFFER_ADD_CODEC_ERROR = "bufferAddCodecError"), + (s.BUFFER_INCOMPATIBLE_CODECS_ERROR = "bufferIncompatibleCodecsError"), + (s.BUFFER_APPEND_ERROR = "bufferAppendError"), + (s.BUFFER_APPENDING_ERROR = "bufferAppendingError"), + (s.BUFFER_STALLED_ERROR = "bufferStalledError"), + (s.BUFFER_FULL_ERROR = "bufferFullError"), + (s.BUFFER_SEEK_OVER_HOLE = "bufferSeekOverHole"), + (s.BUFFER_NUDGE_ON_STALL = "bufferNudgeOnStall"), + (s.INTERNAL_EXCEPTION = "internalException"), + (s.INTERNAL_ABORTED = "aborted"), + (s.UNKNOWN = "unknown"), + s + ); + })({}); + const zt = function () {}, + zn = { trace: zt, debug: zt, log: zt, warn: zt, info: zt, error: zt }; + let ki = zn; + function wc(s) { + const e = self.console[s]; + return e ? e.bind(self.console, `[${s}] >`) : zt; + } + function Dc(s, ...e) { + e.forEach(function (t) { + ki[t] = s[t] ? s[t].bind(s) : wc(t); + }); + } + function Oc(s, e) { + if ((self.console && s === !0) || typeof s == "object") { + Dc(s, "debug", "log", "info", "warn", "error"); + try { + ki.log(`Debug logs enabled for "${e}" in hls.js version 1.4.10`); + } catch { + ki = zn; + } + } else ki = zn; + } + const D = ki, + Nc = /^(\d+)x(\d+)$/, + ra = /(.+?)=(".*?"|.*?)(?:,|$)/g; + class Le { + constructor(e) { + typeof e == "string" && (e = Le.parseAttrList(e)); + for (const t in e) + e.hasOwnProperty(t) && + (t.substring(0, 2) === "X-" && + ((this.clientAttrs = this.clientAttrs || []), + this.clientAttrs.push(t)), + (this[t] = e[t])); + } + decimalInteger(e) { + const t = parseInt(this[e], 10); + return t > Number.MAX_SAFE_INTEGER ? 1 / 0 : t; + } + hexadecimalInteger(e) { + if (this[e]) { + let t = (this[e] || "0x").slice(2); + t = (t.length & 1 ? "0" : "") + t; + const i = new Uint8Array(t.length / 2); + for (let n = 0; n < t.length / 2; n++) + i[n] = parseInt(t.slice(n * 2, n * 2 + 2), 16); + return i; + } else return null; + } + hexadecimalIntegerAsNumber(e) { + const t = parseInt(this[e], 16); + return t > Number.MAX_SAFE_INTEGER ? 1 / 0 : t; + } + decimalFloatingPoint(e) { + return parseFloat(this[e]); + } + optionalFloat(e, t) { + const i = this[e]; + return i ? parseFloat(i) : t; + } + enumeratedString(e) { + return this[e]; + } + bool(e) { + return this[e] === "YES"; + } + decimalResolution(e) { + const t = Nc.exec(this[e]); + if (t !== null) + return { width: parseInt(t[1], 10), height: parseInt(t[2], 10) }; + } + static parseAttrList(e) { + let t; + const i = {}, + n = '"'; + for (ra.lastIndex = 0; (t = ra.exec(e)) !== null; ) { + let r = t[2]; + r.indexOf(n) === 0 && + r.lastIndexOf(n) === r.length - 1 && + (r = r.slice(1, -1)); + const a = t[1].trim(); + i[a] = r; + } + return i; + } + } + function Fc(s) { + return ( + s !== "ID" && + s !== "CLASS" && + s !== "START-DATE" && + s !== "DURATION" && + s !== "END-DATE" && + s !== "END-ON-NEXT" + ); + } + function Mc(s) { + return s === "SCTE35-OUT" || s === "SCTE35-IN"; + } + class sa { + constructor(e, t) { + if ( + ((this.attr = void 0), + (this._startDate = void 0), + (this._endDate = void 0), + (this._badValueForSameId = void 0), + t) + ) { + const i = t.attr; + for (const n in i) + if (Object.prototype.hasOwnProperty.call(e, n) && e[n] !== i[n]) { + D.warn( + `DATERANGE tag attribute: "${n}" does not match for tags with ID: "${e.ID}"` + ), + (this._badValueForSameId = n); + break; + } + e = Fe(new Le({}), i, e); + } + if ( + ((this.attr = e), + (this._startDate = new Date(e["START-DATE"])), + "END-DATE" in this.attr) + ) { + const i = new Date(this.attr["END-DATE"]); + ne(i.getTime()) && (this._endDate = i); + } + } + get id() { + return this.attr.ID; + } + get class() { + return this.attr.CLASS; + } + get startDate() { + return this._startDate; + } + get endDate() { + if (this._endDate) return this._endDate; + const e = this.duration; + return e !== null ? new Date(this._startDate.getTime() + e * 1e3) : null; + } + get duration() { + if ("DURATION" in this.attr) { + const e = this.attr.decimalFloatingPoint("DURATION"); + if (ne(e)) return e; + } else if (this._endDate) return (this._endDate.getTime() - this._startDate.getTime()) / 1e3; + return null; + } + get plannedDuration() { + return "PLANNED-DURATION" in this.attr + ? this.attr.decimalFloatingPoint("PLANNED-DURATION") + : null; + } + get endOnNext() { + return this.attr.bool("END-ON-NEXT"); + } + get isValid() { + return ( + !!this.id && + !this._badValueForSameId && + ne(this.startDate.getTime()) && + (this.duration === null || this.duration >= 0) && + (!this.endOnNext || !!this.class) + ); + } + } + class qi { + constructor() { + (this.aborted = !1), + (this.loaded = 0), + (this.retry = 0), + (this.total = 0), + (this.chunkCount = 0), + (this.bwEstimate = 0), + (this.loading = { start: 0, first: 0, end: 0 }), + (this.parsing = { start: 0, end: 0 }), + (this.buffering = { start: 0, first: 0, end: 0 }); + } + } + var _e = { AUDIO: "audio", VIDEO: "video", AUDIOVIDEO: "audiovideo" }; + class aa { + constructor(e) { + (this._byteRange = null), + (this._url = null), + (this.baseurl = void 0), + (this.relurl = void 0), + (this.elementaryStreams = { + [_e.AUDIO]: null, + [_e.VIDEO]: null, + [_e.AUDIOVIDEO]: null, + }), + (this.baseurl = e); + } + setByteRange(e, t) { + const i = e.split("@", 2), + n = []; + i.length === 1 + ? (n[0] = t ? t.byteRangeEndOffset : 0) + : (n[0] = parseInt(i[1])), + (n[1] = parseInt(i[0]) + n[0]), + (this._byteRange = n); + } + get byteRange() { + return this._byteRange ? this._byteRange : []; + } + get byteRangeStartOffset() { + return this.byteRange[0]; + } + get byteRangeEndOffset() { + return this.byteRange[1]; + } + get url() { + return ( + !this._url && + this.baseurl && + this.relurl && + (this._url = Yn.buildAbsoluteURL(this.baseurl, this.relurl, { + alwaysNormalize: !0, + })), + this._url || "" + ); + } + set url(e) { + this._url = e; + } + } + class Wn extends aa { + constructor(e, t) { + super(t), + (this._decryptdata = null), + (this.rawProgramDateTime = null), + (this.programDateTime = null), + (this.tagList = []), + (this.duration = 0), + (this.sn = 0), + (this.levelkeys = void 0), + (this.type = void 0), + (this.loader = null), + (this.keyLoader = null), + (this.level = -1), + (this.cc = 0), + (this.startPTS = void 0), + (this.endPTS = void 0), + (this.startDTS = void 0), + (this.endDTS = void 0), + (this.start = 0), + (this.deltaPTS = void 0), + (this.maxStartPTS = void 0), + (this.minEndPTS = void 0), + (this.stats = new qi()), + (this.urlId = 0), + (this.data = void 0), + (this.bitrateTest = !1), + (this.title = null), + (this.initSegment = null), + (this.endList = void 0), + (this.gap = void 0), + (this.type = e); + } + get decryptdata() { + const { levelkeys: e } = this; + if (!e && !this._decryptdata) return null; + if (!this._decryptdata && this.levelkeys && !this.levelkeys.NONE) { + const t = this.levelkeys.identity; + if (t) this._decryptdata = t.getDecryptData(this.sn); + else { + const i = Object.keys(this.levelkeys); + if (i.length === 1) + return (this._decryptdata = this.levelkeys[i[0]].getDecryptData( + this.sn + )); + } + } + return this._decryptdata; + } + get end() { + return this.start + this.duration; + } + get endProgramDateTime() { + if (this.programDateTime === null || !ne(this.programDateTime)) + return null; + const e = ne(this.duration) ? this.duration : 0; + return this.programDateTime + e * 1e3; + } + get encrypted() { + var e; + if ((e = this._decryptdata) != null && e.encrypted) return !0; + if (this.levelkeys) { + const t = Object.keys(this.levelkeys), + i = t.length; + if (i > 1 || (i === 1 && this.levelkeys[t[0]].encrypted)) return !0; + } + return !1; + } + setKeyFormat(e) { + if (this.levelkeys) { + const t = this.levelkeys[e]; + t && + !this._decryptdata && + (this._decryptdata = t.getDecryptData(this.sn)); + } + } + abortRequests() { + var e, t; + (e = this.loader) == null || e.abort(), + (t = this.keyLoader) == null || t.abort(); + } + setElementaryStreamInfo(e, t, i, n, r, a = !1) { + const { elementaryStreams: o } = this, + l = o[e]; + if (!l) { + o[e] = { startPTS: t, endPTS: i, startDTS: n, endDTS: r, partial: a }; + return; + } + (l.startPTS = Math.min(l.startPTS, t)), + (l.endPTS = Math.max(l.endPTS, i)), + (l.startDTS = Math.min(l.startDTS, n)), + (l.endDTS = Math.max(l.endDTS, r)); + } + clearElementaryStreamInfo() { + const { elementaryStreams: e } = this; + (e[_e.AUDIO] = null), (e[_e.VIDEO] = null), (e[_e.AUDIOVIDEO] = null); + } + } + class Bc extends aa { + constructor(e, t, i, n, r) { + super(i), + (this.fragOffset = 0), + (this.duration = 0), + (this.gap = !1), + (this.independent = !1), + (this.relurl = void 0), + (this.fragment = void 0), + (this.index = void 0), + (this.stats = new qi()), + (this.duration = e.decimalFloatingPoint("DURATION")), + (this.gap = e.bool("GAP")), + (this.independent = e.bool("INDEPENDENT")), + (this.relurl = e.enumeratedString("URI")), + (this.fragment = t), + (this.index = n); + const a = e.enumeratedString("BYTERANGE"); + a && this.setByteRange(a, r), + r && (this.fragOffset = r.fragOffset + r.duration); + } + get start() { + return this.fragment.start + this.fragOffset; + } + get end() { + return this.start + this.duration; + } + get loaded() { + const { elementaryStreams: e } = this; + return !!(e.audio || e.video || e.audiovideo); + } + } + const Uc = 10; + class $c { + constructor(e) { + (this.PTSKnown = !1), + (this.alignedSliding = !1), + (this.averagetargetduration = void 0), + (this.endCC = 0), + (this.endSN = 0), + (this.fragments = void 0), + (this.fragmentHint = void 0), + (this.partList = null), + (this.dateRanges = void 0), + (this.live = !0), + (this.ageHeader = 0), + (this.advancedDateTime = void 0), + (this.updated = !0), + (this.advanced = !0), + (this.availabilityDelay = void 0), + (this.misses = 0), + (this.startCC = 0), + (this.startSN = 0), + (this.startTimeOffset = null), + (this.targetduration = 0), + (this.totalduration = 0), + (this.type = null), + (this.url = void 0), + (this.m3u8 = ""), + (this.version = null), + (this.canBlockReload = !1), + (this.canSkipUntil = 0), + (this.canSkipDateRanges = !1), + (this.skippedSegments = 0), + (this.recentlyRemovedDateranges = void 0), + (this.partHoldBack = 0), + (this.holdBack = 0), + (this.partTarget = 0), + (this.preloadHint = void 0), + (this.renditionReports = void 0), + (this.tuneInGoal = 0), + (this.deltaUpdateFailed = void 0), + (this.driftStartTime = 0), + (this.driftEndTime = 0), + (this.driftStart = 0), + (this.driftEnd = 0), + (this.encryptedFragments = void 0), + (this.playlistParsingError = null), + (this.variableList = null), + (this.hasVariableRefs = !1), + (this.fragments = []), + (this.encryptedFragments = []), + (this.dateRanges = {}), + (this.url = e); + } + reloaded(e) { + if (!e) { + (this.advanced = !0), (this.updated = !0); + return; + } + const t = this.lastPartSn - e.lastPartSn, + i = this.lastPartIndex - e.lastPartIndex; + (this.updated = this.endSN !== e.endSN || !!i || !!t), + (this.advanced = this.endSN > e.endSN || t > 0 || (t === 0 && i > 0)), + this.updated || this.advanced + ? (this.misses = Math.floor(e.misses * 0.6)) + : (this.misses = e.misses + 1), + (this.availabilityDelay = e.availabilityDelay); + } + get hasProgramDateTime() { + return this.fragments.length + ? ne(this.fragments[this.fragments.length - 1].programDateTime) + : !1; + } + get levelTargetDuration() { + return this.averagetargetduration || this.targetduration || Uc; + } + get drift() { + const e = this.driftEndTime - this.driftStartTime; + return e > 0 ? ((this.driftEnd - this.driftStart) * 1e3) / e : 1; + } + get edge() { + return this.partEnd || this.fragmentEnd; + } + get partEnd() { + var e; + return (e = this.partList) != null && e.length + ? this.partList[this.partList.length - 1].end + : this.fragmentEnd; + } + get fragmentEnd() { + var e; + return (e = this.fragments) != null && e.length + ? this.fragments[this.fragments.length - 1].end + : 0; + } + get age() { + return this.advancedDateTime + ? Math.max(Date.now() - this.advancedDateTime, 0) / 1e3 + : 0; + } + get lastPartIndex() { + var e; + return (e = this.partList) != null && e.length + ? this.partList[this.partList.length - 1].index + : -1; + } + get lastPartSn() { + var e; + return (e = this.partList) != null && e.length + ? this.partList[this.partList.length - 1].fragment.sn + : this.endSN; + } + } + function jn(s) { + return Uint8Array.from(atob(s), (e) => e.charCodeAt(0)); + } + function Vc(s) { + const e = oa(s).subarray(0, 16), + t = new Uint8Array(16); + return t.set(e, 16 - e.length), t; + } + function Gc(s) { + const e = function (i, n, r) { + const a = i[n]; + (i[n] = i[r]), (i[r] = a); + }; + e(s, 0, 3), e(s, 1, 2), e(s, 4, 5), e(s, 6, 7); + } + function Kc(s) { + const e = s.split(":"); + let t = null; + if (e[0] === "data" && e.length === 2) { + const i = e[1].split(";"), + n = i[i.length - 1].split(","); + if (n.length === 2) { + const r = n[0] === "base64", + a = n[1]; + r ? (i.splice(-1, 1), (t = jn(a))) : (t = Vc(a)); + } + } + return t; + } + function oa(s) { + return Uint8Array.from(unescape(encodeURIComponent(s)), (e) => + e.charCodeAt(0) + ); + } + var Ie = { + CLEARKEY: "org.w3.clearkey", + FAIRPLAY: "com.apple.fps", + PLAYREADY: "com.microsoft.playready", + WIDEVINE: "com.widevine.alpha", + }, + je = { + CLEARKEY: "org.w3.clearkey", + FAIRPLAY: "com.apple.streamingkeydelivery", + PLAYREADY: "com.microsoft.playready", + WIDEVINE: "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed", + }; + function la(s) { + switch (s) { + case je.FAIRPLAY: + return Ie.FAIRPLAY; + case je.PLAYREADY: + return Ie.PLAYREADY; + case je.WIDEVINE: + return Ie.WIDEVINE; + case je.CLEARKEY: + return Ie.CLEARKEY; + } + } + var ua = { WIDEVINE: "edef8ba979d64acea3c827dcd51d21ed" }; + function Hc(s) { + if (s === ua.WIDEVINE) return Ie.WIDEVINE; + } + function ca(s) { + switch (s) { + case Ie.FAIRPLAY: + return je.FAIRPLAY; + case Ie.PLAYREADY: + return je.PLAYREADY; + case Ie.WIDEVINE: + return je.WIDEVINE; + case Ie.CLEARKEY: + return je.CLEARKEY; + } + } + function qn(s) { + const { drmSystems: e, widevineLicenseUrl: t } = s, + i = e + ? [Ie.FAIRPLAY, Ie.WIDEVINE, Ie.PLAYREADY, Ie.CLEARKEY].filter( + (n) => !!e[n] + ) + : []; + return !i[Ie.WIDEVINE] && t && i.push(Ie.WIDEVINE), i; + } + const ha = (function () { + return typeof self < "u" && + self.navigator && + self.navigator.requestMediaKeySystemAccess + ? self.navigator.requestMediaKeySystemAccess.bind(self.navigator) + : null; + })(); + function Yc(s, e, t, i) { + let n; + switch (s) { + case Ie.FAIRPLAY: + n = ["cenc", "sinf"]; + break; + case Ie.WIDEVINE: + case Ie.PLAYREADY: + n = ["cenc"]; + break; + case Ie.CLEARKEY: + n = ["cenc", "keyids"]; + break; + default: + throw new Error(`Unknown key-system: ${s}`); + } + return zc(n, e, t, i); + } + function zc(s, e, t, i) { + return [ + { + initDataTypes: s, + persistentState: i.persistentState || "not-allowed", + distinctiveIdentifier: i.distinctiveIdentifier || "not-allowed", + sessionTypes: i.sessionTypes || [i.sessionType || "temporary"], + audioCapabilities: e.map((r) => ({ + contentType: `audio/mp4; codecs="${r}"`, + robustness: i.audioRobustness || "", + encryptionScheme: i.audioEncryptionScheme || null, + })), + videoCapabilities: t.map((r) => ({ + contentType: `video/mp4; codecs="${r}"`, + robustness: i.videoRobustness || "", + encryptionScheme: i.videoEncryptionScheme || null, + })), + }, + ]; + } + function Wt(s, e, t) { + return Uint8Array.prototype.slice + ? s.slice(e, t) + : new Uint8Array(Array.prototype.slice.call(s, e, t)); + } + const Xn = (s, e) => + e + 10 <= s.length && + s[e] === 73 && + s[e + 1] === 68 && + s[e + 2] === 51 && + s[e + 3] < 255 && + s[e + 4] < 255 && + s[e + 6] < 128 && + s[e + 7] < 128 && + s[e + 8] < 128 && + s[e + 9] < 128, + da = (s, e) => + e + 10 <= s.length && + s[e] === 51 && + s[e + 1] === 68 && + s[e + 2] === 73 && + s[e + 3] < 255 && + s[e + 4] < 255 && + s[e + 6] < 128 && + s[e + 7] < 128 && + s[e + 8] < 128 && + s[e + 9] < 128, + Xi = (s, e) => { + const t = e; + let i = 0; + for (; Xn(s, e); ) { + i += 10; + const n = Zi(s, e + 6); + (i += n), da(s, e + 10) && (i += 10), (e += i); + } + if (i > 0) return s.subarray(t, t + i); + }, + Zi = (s, e) => { + let t = 0; + return ( + (t = (s[e] & 127) << 21), + (t |= (s[e + 1] & 127) << 14), + (t |= (s[e + 2] & 127) << 7), + (t |= s[e + 3] & 127), + t + ); + }, + Wc = (s, e) => Xn(s, e) && Zi(s, e + 6) + 10 <= s.length - e, + jc = (s) => { + const e = ga(s); + for (let t = 0; t < e.length; t++) { + const i = e[t]; + if (fa(i)) return eh(i); + } + }, + fa = (s) => + s && + s.key === "PRIV" && + s.info === "com.apple.streaming.transportStreamTimestamp", + qc = (s) => { + const e = String.fromCharCode(s[0], s[1], s[2], s[3]), + t = Zi(s, 4), + i = 10; + return { type: e, size: t, data: s.subarray(i, i + t) }; + }, + ga = (s) => { + let e = 0; + const t = []; + for (; Xn(s, e); ) { + const i = Zi(s, e + 6); + e += 10; + const n = e + i; + for (; e + 8 < n; ) { + const r = qc(s.subarray(e)), + a = Xc(r); + a && t.push(a), (e += r.size + 10); + } + da(s, e) && (e += 10); + } + return t; + }, + Xc = (s) => (s.type === "PRIV" ? Zc(s) : s.type[0] === "W" ? Jc(s) : Qc(s)), + Zc = (s) => { + if (s.size < 2) return; + const e = ft(s.data, !0), + t = new Uint8Array(s.data.subarray(e.length + 1)); + return { key: s.type, info: e, data: t.buffer }; + }, + Qc = (s) => { + if (s.size < 2) return; + if (s.type === "TXXX") { + let t = 1; + const i = ft(s.data.subarray(t), !0); + t += i.length + 1; + const n = ft(s.data.subarray(t)); + return { key: s.type, info: i, data: n }; + } + const e = ft(s.data.subarray(1)); + return { key: s.type, data: e }; + }, + Jc = (s) => { + if (s.type === "WXXX") { + if (s.size < 2) return; + let t = 1; + const i = ft(s.data.subarray(t), !0); + t += i.length + 1; + const n = ft(s.data.subarray(t)); + return { key: s.type, info: i, data: n }; + } + const e = ft(s.data); + return { key: s.type, data: e }; + }, + eh = (s) => { + if (s.data.byteLength === 8) { + const e = new Uint8Array(s.data), + t = e[3] & 1; + let i = (e[4] << 23) + (e[5] << 15) + (e[6] << 7) + e[7]; + return (i /= 45), t && (i += 4772185884e-2), Math.round(i); + } + }, + ft = (s, e = !1) => { + const t = th(); + if (t) { + const u = t.decode(s); + if (e) { + const c = u.indexOf("\0"); + return c !== -1 ? u.substring(0, c) : u; + } + return u.replace(/\0/g, ""); + } + const i = s.length; + let n, + r, + a, + o = "", + l = 0; + for (; l < i; ) { + if (((n = s[l++]), n === 0 && e)) return o; + if (n === 0 || n === 3) continue; + switch (n >> 4) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + o += String.fromCharCode(n); + break; + case 12: + case 13: + (r = s[l++]), + (o += String.fromCharCode(((n & 31) << 6) | (r & 63))); + break; + case 14: + (r = s[l++]), + (a = s[l++]), + (o += String.fromCharCode( + ((n & 15) << 12) | ((r & 63) << 6) | ((a & 63) << 0) + )); + break; + } + } + return o; + }; + let Zn; + function th() { + return ( + !Zn && + typeof self.TextDecoder < "u" && + (Zn = new self.TextDecoder("utf-8")), + Zn + ); + } + const gt = { + hexDump: function (s) { + let e = ""; + for (let t = 0; t < s.length; t++) { + let i = s[t].toString(16); + i.length < 2 && (i = "0" + i), (e += i); + } + return e; + }, + }, + Qi = Math.pow(2, 32) - 1, + ih = [].push, + pa = { video: 1, audio: 2, id3: 3, text: 4 }; + function $e(s) { + return String.fromCharCode.apply(null, s); + } + function ma(s, e) { + const t = (s[e] << 8) | s[e + 1]; + return t < 0 ? 65536 + t : t; + } + function ae(s, e) { + const t = Aa(s, e); + return t < 0 ? 4294967296 + t : t; + } + function Aa(s, e) { + return (s[e] << 24) | (s[e + 1] << 16) | (s[e + 2] << 8) | s[e + 3]; + } + function Qn(s, e, t) { + (s[e] = t >> 24), + (s[e + 1] = (t >> 16) & 255), + (s[e + 2] = (t >> 8) & 255), + (s[e + 3] = t & 255); + } + function ce(s, e) { + const t = []; + if (!e.length) return t; + const i = s.byteLength; + for (let n = 0; n < i; ) { + const r = ae(s, n), + a = $e(s.subarray(n + 4, n + 8)), + o = r > 1 ? n + r : i; + if (a === e[0]) + if (e.length === 1) t.push(s.subarray(n + 8, o)); + else { + const l = ce(s.subarray(n + 8, o), e.slice(1)); + l.length && ih.apply(t, l); + } + n = o; + } + return t; + } + function nh(s) { + const e = [], + t = s[0]; + let i = 8; + const n = ae(s, i); + i += 4; + const r = 0, + a = 0; + t === 0 ? (i += 8) : (i += 16), (i += 2); + let o = s.length + a; + const l = ma(s, i); + i += 2; + for (let u = 0; u < l; u++) { + let c = i; + const d = ae(s, c); + c += 4; + const f = d & 2147483647; + if ((d & 2147483648) >>> 31 === 1) + return D.warn("SIDX has hierarchical references (not supported)"), null; + const p = ae(s, c); + (c += 4), + e.push({ + referenceSize: f, + subsegmentDuration: p, + info: { duration: p / n, start: o, end: o + f - 1 }, + }), + (o += f), + (c += 4), + (i = c); + } + return { + earliestPresentationTime: r, + timescale: n, + version: t, + referencesCount: l, + references: e, + }; + } + function ya(s) { + const e = [], + t = ce(s, ["moov", "trak"]); + for (let n = 0; n < t.length; n++) { + const r = t[n], + a = ce(r, ["tkhd"])[0]; + if (a) { + let o = a[0], + l = o === 0 ? 12 : 20; + const u = ae(a, l), + c = ce(r, ["mdia", "mdhd"])[0]; + if (c) { + (o = c[0]), (l = o === 0 ? 12 : 20); + const d = ae(c, l), + f = ce(r, ["mdia", "hdlr"])[0]; + if (f) { + const g = $e(f.subarray(8, 12)), + p = { soun: _e.AUDIO, vide: _e.VIDEO }[g]; + if (p) { + const v = ce(r, ["mdia", "minf", "stbl", "stsd"])[0]; + let T; + v && (T = $e(v.subarray(12, 16))), + (e[u] = { timescale: d, type: p }), + (e[p] = { timescale: d, id: u, codec: T }); + } + } + } + } + } + return ( + ce(s, ["moov", "mvex", "trex"]).forEach((n) => { + const r = ae(n, 4), + a = e[r]; + a && (a.default = { duration: ae(n, 12), flags: ae(n, 20) }); + }), + e + ); + } + function rh(s, e) { + if (!s || !e) return s; + const t = e.keyId; + return ( + t && + e.isCommonEncryption && + ce(s, ["moov", "trak"]).forEach((n) => { + const a = ce(n, ["mdia", "minf", "stbl", "stsd"])[0].subarray(8); + let o = ce(a, ["enca"]); + const l = o.length > 0; + l || (o = ce(a, ["encv"])), + o.forEach((u) => { + const c = l ? u.subarray(28) : u.subarray(78); + ce(c, ["sinf"]).forEach((f) => { + const g = va(f); + if (g) { + const p = g.subarray(8, 24); + p.some((v) => v !== 0) || + (D.log( + `[eme] Patching keyId in 'enc${ + l ? "a" : "v" + }>sinf>>tenc' box: ${gt.hexDump(p)} -> ${gt.hexDump(t)}` + ), + g.set(t, 8)); + } + }); + }); + }), + s + ); + } + function va(s) { + const e = ce(s, ["schm"])[0]; + if (e) { + const t = $e(e.subarray(4, 8)); + if (t === "cbcs" || t === "cenc") return ce(s, ["schi", "tenc"])[0]; + } + return D.error("[eme] missing 'schm' box"), null; + } + function sh(s, e) { + return ce(e, ["moof", "traf"]).reduce((t, i) => { + const n = ce(i, ["tfdt"])[0], + r = n[0], + a = ce(i, ["tfhd"]).reduce((o, l) => { + const u = ae(l, 4), + c = s[u]; + if (c) { + let d = ae(n, 4); + if (r === 1) { + if (d === Qi) + return ( + D.warn( + "[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time" + ), + o + ); + (d *= Qi + 1), (d += ae(n, 8)); + } + const f = c.timescale || 9e4, + g = d / f; + if (isFinite(g) && (o === null || g < o)) return g; + } + return o; + }, null); + return a !== null && isFinite(a) && (t === null || a < t) ? a : t; + }, null); + } + function ah(s, e) { + let t = 0, + i = 0, + n = 0; + const r = ce(s, ["moof", "traf"]); + for (let a = 0; a < r.length; a++) { + const o = r[a], + l = ce(o, ["tfhd"])[0], + u = ae(l, 4), + c = e[u]; + if (!c) continue; + const d = c.default, + f = ae(l, 0) | (d == null ? void 0 : d.flags); + let g = d == null ? void 0 : d.duration; + f & 8 && (f & 2 ? (g = ae(l, 12)) : (g = ae(l, 8))); + const p = c.timescale || 9e4, + v = ce(o, ["trun"]); + for (let T = 0; T < v.length; T++) { + if (((t = oh(v[T])), !t && g)) { + const x = ae(v[T], 4); + t = g * x; + } + c.type === _e.VIDEO + ? (i += t / p) + : c.type === _e.AUDIO && (n += t / p); + } + } + if (i === 0 && n === 0) { + let a = 0; + const o = ce(s, ["sidx"]); + for (let l = 0; l < o.length; l++) { + const u = nh(o[l]); + u != null && + u.references && + (a += u.references.reduce((c, d) => c + d.info.duration || 0, 0)); + } + return a; + } + return i || n; + } + function oh(s) { + const e = ae(s, 0); + let t = 8; + e & 1 && (t += 4), e & 4 && (t += 4); + let i = 0; + const n = ae(s, 4); + for (let r = 0; r < n; r++) { + if (e & 256) { + const a = ae(s, t); + (i += a), (t += 4); + } + e & 512 && (t += 4), e & 1024 && (t += 4), e & 2048 && (t += 4); + } + return i; + } + function lh(s, e, t) { + ce(e, ["moof", "traf"]).forEach((i) => { + ce(i, ["tfhd"]).forEach((n) => { + const r = ae(n, 4), + a = s[r]; + if (!a) return; + const o = a.timescale || 9e4; + ce(i, ["tfdt"]).forEach((l) => { + const u = l[0]; + let c = ae(l, 4); + if (u === 0) (c -= t * o), (c = Math.max(c, 0)), Qn(l, 4, c); + else { + (c *= Math.pow(2, 32)), + (c += ae(l, 8)), + (c -= t * o), + (c = Math.max(c, 0)); + const d = Math.floor(c / (Qi + 1)), + f = Math.floor(c % (Qi + 1)); + Qn(l, 4, d), Qn(l, 8, f); + } + }); + }); + }); + } + function uh(s) { + const e = { valid: null, remainder: null }, + t = ce(s, ["moof"]); + if (t) { + if (t.length < 2) return (e.remainder = s), e; + } else return e; + const i = t[t.length - 1]; + return ( + (e.valid = Wt(s, 0, i.byteOffset - 8)), + (e.remainder = Wt(s, i.byteOffset - 8)), + e + ); + } + function jt(s, e) { + const t = new Uint8Array(s.length + e.length); + return t.set(s), t.set(e, s.length), t; + } + function Ea(s, e) { + const t = [], + i = e.samples, + n = e.timescale, + r = e.id; + let a = !1; + return ( + ce(i, ["moof"]).map((l) => { + const u = l.byteOffset - 8; + ce(l, ["traf"]).map((d) => { + const f = ce(d, ["tfdt"]).map((g) => { + const p = g[0]; + let v = ae(g, 4); + return p === 1 && ((v *= Math.pow(2, 32)), (v += ae(g, 8))), v / n; + })[0]; + return ( + f !== void 0 && (s = f), + ce(d, ["tfhd"]).map((g) => { + const p = ae(g, 4), + v = ae(g, 0) & 16777215, + T = (v & 1) !== 0, + x = (v & 2) !== 0, + I = (v & 8) !== 0; + let L = 0; + const M = (v & 16) !== 0; + let O = 0; + const j = (v & 32) !== 0; + let U = 8; + p === r && + (T && (U += 8), + x && (U += 4), + I && ((L = ae(g, U)), (U += 4)), + M && ((O = ae(g, U)), (U += 4)), + j && (U += 4), + e.type === "video" && (a = ch(e.codec)), + ce(d, ["trun"]).map((Y) => { + const _ = Y[0], + E = ae(Y, 0) & 16777215, + w = (E & 1) !== 0; + let b = 0; + const S = (E & 4) !== 0, + P = (E & 256) !== 0; + let F = 0; + const V = (E & 512) !== 0; + let K = 0; + const G = (E & 1024) !== 0, + B = (E & 2048) !== 0; + let q = 0; + const X = ae(Y, 4); + let J = 8; + w && ((b = ae(Y, J)), (J += 4)), S && (J += 4); + let z = b + u; + for (let Ne = 0; Ne < X; Ne++) { + if ( + (P ? ((F = ae(Y, J)), (J += 4)) : (F = L), + V ? ((K = ae(Y, J)), (J += 4)) : (K = O), + G && (J += 4), + B && + (_ === 0 ? (q = ae(Y, J)) : (q = Aa(Y, J)), (J += 4)), + e.type === _e.VIDEO) + ) { + let me = 0; + for (; me < K; ) { + const Re = ae(i, z); + if (((z += 4), hh(a, i[z]))) { + const oe = i.subarray(z, z + Re); + Ta(oe, a ? 2 : 1, s + q / n, t); + } + (z += Re), (me += Re + 4); + } + } + s += F / n; + } + })); + }) + ); + }); + }), + t + ); + } + function ch(s) { + if (!s) return !1; + const e = s.indexOf("."), + t = e < 0 ? s : s.substring(0, e); + return t === "hvc1" || t === "hev1" || t === "dvh1" || t === "dvhe"; + } + function hh(s, e) { + if (s) { + const t = (e >> 1) & 63; + return t === 39 || t === 40; + } else return (e & 31) === 6; + } + function Ta(s, e, t, i) { + const n = ba(s); + let r = 0; + r += e; + let a = 0, + o = 0, + l = !1, + u = 0; + for (; r < n.length; ) { + a = 0; + do { + if (r >= n.length) break; + (u = n[r++]), (a += u); + } while (u === 255); + o = 0; + do { + if (r >= n.length) break; + (u = n[r++]), (o += u); + } while (u === 255); + const c = n.length - r; + if (!l && a === 4 && r < n.length) { + if (((l = !0), n[r++] === 181)) { + const f = ma(n, r); + if (((r += 2), f === 49)) { + const g = ae(n, r); + if (((r += 4), g === 1195456820)) { + const p = n[r++]; + if (p === 3) { + const v = n[r++], + T = 31 & v, + x = 64 & v, + I = x ? 2 + T * 3 : 0, + L = new Uint8Array(I); + if (x) { + L[0] = v; + for (let M = 1; M < I; M++) L[M] = n[r++]; + } + i.push({ type: p, payloadType: a, pts: t, bytes: L }); + } + } + } + } + } else if (a === 5 && o < c) { + if (((l = !0), o > 16)) { + const d = []; + for (let p = 0; p < 16; p++) { + const v = n[r++].toString(16); + d.push(v.length == 1 ? "0" + v : v), + (p === 3 || p === 5 || p === 7 || p === 9) && d.push("-"); + } + const f = o - 16, + g = new Uint8Array(f); + for (let p = 0; p < f; p++) g[p] = n[r++]; + i.push({ + payloadType: a, + pts: t, + uuid: d.join(""), + userData: ft(g), + userDataBytes: g, + }); + } + } else if (o < c) r += o; + else if (o > c) break; + } + } + function ba(s) { + const e = s.byteLength, + t = []; + let i = 1; + for (; i < e - 2; ) + s[i] === 0 && s[i + 1] === 0 && s[i + 2] === 3 + ? (t.push(i + 2), (i += 2)) + : i++; + if (t.length === 0) return s; + const n = e - t.length, + r = new Uint8Array(n); + let a = 0; + for (i = 0; i < n; a++, i++) a === t[0] && (a++, t.shift()), (r[i] = s[a]); + return r; + } + function dh(s) { + const e = s[0]; + let t = "", + i = "", + n = 0, + r = 0, + a = 0, + o = 0, + l = 0, + u = 0; + if (e === 0) { + for (; $e(s.subarray(u, u + 1)) !== "\0"; ) + (t += $e(s.subarray(u, u + 1))), (u += 1); + for ( + t += $e(s.subarray(u, u + 1)), u += 1; + $e(s.subarray(u, u + 1)) !== "\0"; + + ) + (i += $e(s.subarray(u, u + 1))), (u += 1); + (i += $e(s.subarray(u, u + 1))), + (u += 1), + (n = ae(s, 12)), + (r = ae(s, 16)), + (o = ae(s, 20)), + (l = ae(s, 24)), + (u = 28); + } else if (e === 1) { + (u += 4), (n = ae(s, u)), (u += 4); + const d = ae(s, u); + u += 4; + const f = ae(s, u); + for ( + u += 4, + a = 2 ** 32 * d + f, + Number.isSafeInteger(a) || + ((a = Number.MAX_SAFE_INTEGER), + D.warn( + "Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box" + )), + o = ae(s, u), + u += 4, + l = ae(s, u), + u += 4; + $e(s.subarray(u, u + 1)) !== "\0"; + + ) + (t += $e(s.subarray(u, u + 1))), (u += 1); + for ( + t += $e(s.subarray(u, u + 1)), u += 1; + $e(s.subarray(u, u + 1)) !== "\0"; + + ) + (i += $e(s.subarray(u, u + 1))), (u += 1); + (i += $e(s.subarray(u, u + 1))), (u += 1); + } + const c = s.subarray(u, s.byteLength); + return { + schemeIdUri: t, + value: i, + timeScale: n, + presentationTime: a, + presentationTimeDelta: r, + eventDuration: o, + id: l, + payload: c, + }; + } + function fh(s, ...e) { + const t = e.length; + let i = 8, + n = t; + for (; n--; ) i += e[n].byteLength; + const r = new Uint8Array(i); + for ( + r[0] = (i >> 24) & 255, + r[1] = (i >> 16) & 255, + r[2] = (i >> 8) & 255, + r[3] = i & 255, + r.set(s, 4), + n = 0, + i = 8; + n < t; + n++ + ) + r.set(e[n], i), (i += e[n].byteLength); + return r; + } + function gh(s, e, t) { + if (s.byteLength !== 16) throw new RangeError("Invalid system id"); + let i, n; + (i = 0), (n = new Uint8Array()); + let r; + i > 0 + ? ((r = new Uint8Array(4)), + e.length > 0 && new DataView(r.buffer).setUint32(0, e.length, !1)) + : (r = new Uint8Array()); + const a = new Uint8Array(4); + return ( + t && + t.byteLength > 0 && + new DataView(a.buffer).setUint32(0, t.byteLength, !1), + fh( + [112, 115, 115, 104], + new Uint8Array([i, 0, 0, 0]), + s, + r, + n, + a, + t || new Uint8Array() + ) + ); + } + function ph(s) { + if (!(s instanceof ArrayBuffer) || s.byteLength < 32) return null; + const e = { version: 0, systemId: "", kids: null, data: null }, + t = new DataView(s), + i = t.getUint32(0); + if ( + (s.byteLength !== i && i > 44) || + t.getUint32(4) !== 1886614376 || + ((e.version = t.getUint32(8) >>> 24), e.version > 1) + ) + return null; + e.systemId = gt.hexDump(new Uint8Array(s, 12, 16)); + const r = t.getUint32(28); + if (e.version === 0) { + if (i - 32 < r) return null; + e.data = new Uint8Array(s, 32, r); + } else if (e.version === 1) { + e.kids = []; + for (let a = 0; a < r; a++) + e.kids.push(new Uint8Array(s, 32 + a * 16, 16)); + } + return e; + } + let Ji = {}; + class Si { + static clearKeyUriToKeyIdMap() { + Ji = {}; + } + constructor(e, t, i, n = [1], r = null) { + (this.uri = void 0), + (this.method = void 0), + (this.keyFormat = void 0), + (this.keyFormatVersions = void 0), + (this.encrypted = void 0), + (this.isCommonEncryption = void 0), + (this.iv = null), + (this.key = null), + (this.keyId = null), + (this.pssh = null), + (this.method = e), + (this.uri = t), + (this.keyFormat = i), + (this.keyFormatVersions = n), + (this.iv = r), + (this.encrypted = e ? e !== "NONE" : !1), + (this.isCommonEncryption = this.encrypted && e !== "AES-128"); + } + isSupported() { + if (this.method) { + if (this.method === "AES-128" || this.method === "NONE") return !0; + if (this.keyFormat === "identity") return this.method === "SAMPLE-AES"; + switch (this.keyFormat) { + case je.FAIRPLAY: + case je.WIDEVINE: + case je.PLAYREADY: + case je.CLEARKEY: + return ( + [ + "ISO-23001-7", + "SAMPLE-AES", + "SAMPLE-AES-CENC", + "SAMPLE-AES-CTR", + ].indexOf(this.method) !== -1 + ); + } + } + return !1; + } + getDecryptData(e) { + if (!this.encrypted || !this.uri) return null; + if (this.method === "AES-128" && this.uri && !this.iv) { + typeof e != "number" && + (this.method === "AES-128" && + !this.iv && + D.warn( + `missing IV for initialization segment with method="${this.method}" - compliance issue` + ), + (e = 0)); + const i = mh(e); + return new Si( + this.method, + this.uri, + "identity", + this.keyFormatVersions, + i + ); + } + const t = Kc(this.uri); + if (t) + switch (this.keyFormat) { + case je.WIDEVINE: + (this.pssh = t), + t.length >= 22 && + (this.keyId = t.subarray(t.length - 22, t.length - 6)); + break; + case je.PLAYREADY: { + const i = new Uint8Array([ + 154, 4, 240, 121, 152, 64, 66, 134, 171, 146, 230, 91, 224, 136, + 95, 149, + ]); + this.pssh = gh(i, null, t); + const n = new Uint16Array(t.buffer, t.byteOffset, t.byteLength / 2), + r = String.fromCharCode.apply(null, Array.from(n)), + a = r.substring(r.indexOf("<"), r.length), + u = new DOMParser() + .parseFromString(a, "text/xml") + .getElementsByTagName("KID")[0]; + if (u) { + const c = u.childNodes[0] + ? u.childNodes[0].nodeValue + : u.getAttribute("VALUE"); + if (c) { + const d = jn(c).subarray(0, 16); + Gc(d), (this.keyId = d); + } + } + break; + } + default: { + let i = t.subarray(0, 16); + if (i.length !== 16) { + const n = new Uint8Array(16); + n.set(i, 16 - i.length), (i = n); + } + this.keyId = i; + break; + } + } + if (!this.keyId || this.keyId.byteLength !== 16) { + let i = Ji[this.uri]; + if (!i) { + const n = Object.keys(Ji).length % Number.MAX_SAFE_INTEGER; + (i = new Uint8Array(16)), + new DataView(i.buffer, 12, 4).setUint32(0, n), + (Ji[this.uri] = i); + } + this.keyId = i; + } + return this; + } + } + function mh(s) { + const e = new Uint8Array(16); + for (let t = 12; t < 16; t++) e[t] = (s >> (8 * (15 - t))) & 255; + return e; + } + const _a = /\{\$([a-zA-Z0-9-_]+)\}/g; + function ka(s) { + return _a.test(s); + } + function qe(s, e, t) { + if (s.variableList !== null || s.hasVariableRefs) + for (let i = t.length; i--; ) { + const n = t[i], + r = e[n]; + r && (e[n] = Jn(s, r)); + } + } + function Jn(s, e) { + if (s.variableList !== null || s.hasVariableRefs) { + const t = s.variableList; + return e.replace(_a, (i) => { + const n = i.substring(2, i.length - 1), + r = t == null ? void 0 : t[n]; + return r === void 0 + ? (s.playlistParsingError || + (s.playlistParsingError = new Error( + `Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"` + )), + i) + : r; + }); + } + return e; + } + function Sa(s, e, t) { + let i = s.variableList; + i || (s.variableList = i = {}); + let n, r; + if ("QUERYPARAM" in e) { + n = e.QUERYPARAM; + try { + const a = new self.URL(t).searchParams; + if (a.has(n)) r = a.get(n); + else + throw new Error( + `"${n}" does not match any query parameter in URI: "${t}"` + ); + } catch (a) { + s.playlistParsingError || + (s.playlistParsingError = new Error( + `EXT-X-DEFINE QUERYPARAM: ${a.message}` + )); + } + } else (n = e.NAME), (r = e.VALUE); + n in i + ? s.playlistParsingError || + (s.playlistParsingError = new Error( + `EXT-X-DEFINE duplicate Variable Name declarations: "${n}"` + )) + : (i[n] = r || ""); + } + function Ah(s, e, t) { + const i = e.IMPORT; + if (t && i in t) { + let n = s.variableList; + n || (s.variableList = n = {}), (n[i] = t[i]); + } else s.playlistParsingError || (s.playlistParsingError = new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`)); + } + function en() { + if (!(typeof self > "u")) return self.MediaSource || self.WebKitMediaSource; + } + const yh = { + audio: { + a3ds: !0, + "ac-3": !0, + "ac-4": !0, + alac: !0, + alaw: !0, + dra1: !0, + "dts+": !0, + "dts-": !0, + dtsc: !0, + dtse: !0, + dtsh: !0, + "ec-3": !0, + enca: !0, + g719: !0, + g726: !0, + m4ae: !0, + mha1: !0, + mha2: !0, + mhm1: !0, + mhm2: !0, + mlpa: !0, + mp4a: !0, + "raw ": !0, + Opus: !0, + opus: !0, + samr: !0, + sawb: !0, + sawp: !0, + sevc: !0, + sqcp: !0, + ssmv: !0, + twos: !0, + ulaw: !0, + }, + video: { + avc1: !0, + avc2: !0, + avc3: !0, + avc4: !0, + avcp: !0, + av01: !0, + drac: !0, + dva1: !0, + dvav: !0, + dvh1: !0, + dvhe: !0, + encv: !0, + hev1: !0, + hvc1: !0, + mjp2: !0, + mp4v: !0, + mvc1: !0, + mvc2: !0, + mvc3: !0, + mvc4: !0, + resv: !0, + rv60: !0, + s263: !0, + svc1: !0, + svc2: !0, + "vc-1": !0, + vp08: !0, + vp09: !0, + }, + text: { stpp: !0, wvtt: !0 }, + }, + Ca = en(); + function vh(s, e) { + const t = yh[e]; + return !!t && t[s.slice(0, 4)] === !0; + } + function er(s, e) { + var t; + return (t = + Ca == null + ? void 0 + : Ca.isTypeSupported(`${e || "video"}/mp4;codecs="${s}"`)) != null + ? t + : !1; + } + const xa = + /#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g, + La = /#EXT-X-MEDIA:(.*)/g, + Eh = /^#EXT(?:INF|-X-TARGETDURATION):/m, + Ia = new RegExp( + [ + /#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source, + /(?!#) *(\S[\S ]*)/.source, + /#EXT-X-BYTERANGE:*(.+)/.source, + /#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, + /#.*/.source, + ].join("|"), + "g" + ), + Th = new RegExp( + [ + /#(EXTM3U)/.source, + /#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/ + .source, + /#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/ + .source, + /#EXT-X-(DISCONTINUITY|ENDLIST|GAP)/.source, + /(#)([^:]*):(.*)/.source, + /(#)(.*)(?:.*)\r?\n?/.source, + ].join("|") + ); + class at { + static findGroup(e, t) { + for (let i = 0; i < e.length; i++) { + const n = e[i]; + if (n.id === t) return n; + } + } + static convertAVC1ToAVCOTI(e) { + const t = e.split("."); + if (t.length > 2) { + let i = t.shift() + "."; + return ( + (i += parseInt(t.shift()).toString(16)), + (i += ("000" + parseInt(t.shift()).toString(16)).slice(-4)), + i + ); + } + return e; + } + static resolve(e, t) { + return Yn.buildAbsoluteURL(t, e, { alwaysNormalize: !0 }); + } + static isMediaPlaylist(e) { + return Eh.test(e); + } + static parseMasterPlaylist(e, t) { + const i = ka(e), + n = { + contentSteering: null, + levels: [], + playlistParsingError: null, + sessionData: null, + sessionKeys: null, + startTimeOffset: null, + variableList: null, + hasVariableRefs: i, + }, + r = []; + xa.lastIndex = 0; + let a; + for (; (a = xa.exec(e)) != null; ) + if (a[1]) { + var o; + const u = new Le(a[1]); + qe(n, u, [ + "CODECS", + "SUPPLEMENTAL-CODECS", + "ALLOWED-CPC", + "PATHWAY-ID", + "STABLE-VARIANT-ID", + "AUDIO", + "VIDEO", + "SUBTITLES", + "CLOSED-CAPTIONS", + "NAME", + ]); + const c = Jn(n, a[2]), + d = { + attrs: u, + bitrate: + u.decimalInteger("AVERAGE-BANDWIDTH") || + u.decimalInteger("BANDWIDTH"), + name: u.NAME, + url: at.resolve(c, t), + }, + f = u.decimalResolution("RESOLUTION"); + f && ((d.width = f.width), (d.height = f.height)), + bh( + (u.CODECS || "").split(/[ ,]+/).filter((g) => g), + d + ), + d.videoCodec && + d.videoCodec.indexOf("avc1") !== -1 && + (d.videoCodec = at.convertAVC1ToAVCOTI(d.videoCodec)), + ((o = d.unknownCodecs) != null && o.length) || r.push(d), + n.levels.push(d); + } else if (a[3]) { + const u = a[3], + c = a[4]; + switch (u) { + case "SESSION-DATA": { + const d = new Le(c); + qe(n, d, ["DATA-ID", "LANGUAGE", "VALUE", "URI"]); + const f = d["DATA-ID"]; + f && + (n.sessionData === null && (n.sessionData = {}), + (n.sessionData[f] = d)); + break; + } + case "SESSION-KEY": { + const d = Ra(c, t, n); + d.encrypted && d.isSupported() + ? (n.sessionKeys === null && (n.sessionKeys = []), + n.sessionKeys.push(d)) + : D.warn( + `[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"` + ); + break; + } + case "DEFINE": { + { + const d = new Le(c); + qe(n, d, ["NAME", "VALUE", "QUERYPARAM"]), Sa(n, d, t); + } + break; + } + case "CONTENT-STEERING": { + const d = new Le(c); + qe(n, d, ["SERVER-URI", "PATHWAY-ID"]), + (n.contentSteering = { + uri: at.resolve(d["SERVER-URI"], t), + pathwayId: d["PATHWAY-ID"] || ".", + }); + break; + } + case "START": { + n.startTimeOffset = Pa(c); + break; + } + } + } + const l = r.length > 0 && r.length < n.levels.length; + return ( + (n.levels = l ? r : n.levels), + n.levels.length === 0 && + (n.playlistParsingError = new Error("no levels found in manifest")), + n + ); + } + static parseMasterPlaylistMedia(e, t, i) { + let n; + const r = {}, + a = i.levels, + o = { + AUDIO: a.map((u) => ({ + id: u.attrs.AUDIO, + audioCodec: u.audioCodec, + })), + SUBTITLES: a.map((u) => ({ + id: u.attrs.SUBTITLES, + textCodec: u.textCodec, + })), + "CLOSED-CAPTIONS": [], + }; + let l = 0; + for (La.lastIndex = 0; (n = La.exec(e)) !== null; ) { + const u = new Le(n[1]), + c = u.TYPE; + if (c) { + const d = o[c], + f = r[c] || []; + (r[c] = f), + qe(i, u, [ + "URI", + "GROUP-ID", + "LANGUAGE", + "ASSOC-LANGUAGE", + "STABLE-RENDITION-ID", + "NAME", + "INSTREAM-ID", + "CHARACTERISTICS", + "CHANNELS", + ]); + const g = { + attrs: u, + bitrate: 0, + id: l++, + groupId: u["GROUP-ID"] || "", + instreamId: u["INSTREAM-ID"], + name: u.NAME || u.LANGUAGE || "", + type: c, + default: u.bool("DEFAULT"), + autoselect: u.bool("AUTOSELECT"), + forced: u.bool("FORCED"), + lang: u.LANGUAGE, + url: u.URI ? at.resolve(u.URI, t) : "", + }; + if (d != null && d.length) { + const p = at.findGroup(d, g.groupId) || d[0]; + wa(g, p, "audioCodec"), wa(g, p, "textCodec"); + } + f.push(g); + } + } + return r; + } + static parseLevelPlaylist(e, t, i, n, r, a) { + const o = new $c(t), + l = o.fragments; + let u = null, + c = 0, + d = 0, + f = 0, + g = 0, + p = null, + v = new Wn(n, t), + T, + x, + I, + L = -1, + M = !1; + for ( + Ia.lastIndex = 0, o.m3u8 = e, o.hasVariableRefs = ka(e); + (T = Ia.exec(e)) !== null; + + ) { + M && + ((M = !1), + (v = new Wn(n, t)), + (v.start = f), + (v.sn = c), + (v.cc = g), + (v.level = i), + u && + ((v.initSegment = u), + (v.rawProgramDateTime = u.rawProgramDateTime), + (u.rawProgramDateTime = null))); + const Y = T[1]; + if (Y) { + v.duration = parseFloat(Y); + const _ = (" " + T[2]).slice(1); + (v.title = _ || null), v.tagList.push(_ ? ["INF", Y, _] : ["INF", Y]); + } else if (T[3]) { + if (ne(v.duration)) { + (v.start = f), + I && Na(v, I, o), + (v.sn = c), + (v.level = i), + (v.cc = g), + (v.urlId = r), + l.push(v); + const _ = (" " + T[3]).slice(1); + (v.relurl = Jn(o, _)), + Da(v, p), + (p = v), + (f += v.duration), + c++, + (d = 0), + (M = !0); + } + } else if (T[4]) { + const _ = (" " + T[4]).slice(1); + p ? v.setByteRange(_, p) : v.setByteRange(_); + } else if (T[5]) + (v.rawProgramDateTime = (" " + T[5]).slice(1)), + v.tagList.push(["PROGRAM-DATE-TIME", v.rawProgramDateTime]), + L === -1 && (L = l.length); + else { + if (((T = T[0].match(Th)), !T)) { + D.warn("No matches on slow regex match for level playlist!"); + continue; + } + for (x = 1; x < T.length && !(typeof T[x] < "u"); x++); + const _ = (" " + T[x]).slice(1), + E = (" " + T[x + 1]).slice(1), + w = T[x + 2] ? (" " + T[x + 2]).slice(1) : ""; + switch (_) { + case "PLAYLIST-TYPE": + o.type = E.toUpperCase(); + break; + case "MEDIA-SEQUENCE": + c = o.startSN = parseInt(E); + break; + case "SKIP": { + const b = new Le(E); + qe(o, b, ["RECENTLY-REMOVED-DATERANGES"]); + const S = b.decimalInteger("SKIPPED-SEGMENTS"); + if (ne(S)) { + o.skippedSegments = S; + for (let F = S; F--; ) l.unshift(null); + c += S; + } + const P = b.enumeratedString("RECENTLY-REMOVED-DATERANGES"); + P && (o.recentlyRemovedDateranges = P.split(" ")); + break; + } + case "TARGETDURATION": + o.targetduration = Math.max(parseInt(E), 1); + break; + case "VERSION": + o.version = parseInt(E); + break; + case "EXTM3U": + break; + case "ENDLIST": + o.live = !1; + break; + case "#": + (E || w) && v.tagList.push(w ? [E, w] : [E]); + break; + case "DISCONTINUITY": + g++, v.tagList.push(["DIS"]); + break; + case "GAP": + (v.gap = !0), v.tagList.push([_]); + break; + case "BITRATE": + v.tagList.push([_, E]); + break; + case "DATERANGE": { + const b = new Le(E); + qe(o, b, [ + "ID", + "CLASS", + "START-DATE", + "END-DATE", + "SCTE35-CMD", + "SCTE35-OUT", + "SCTE35-IN", + ]), + qe(o, b, b.clientAttrs); + const S = new sa(b, o.dateRanges[b.ID]); + S.isValid || o.skippedSegments + ? (o.dateRanges[S.id] = S) + : D.warn(`Ignoring invalid DATERANGE tag: "${E}"`), + v.tagList.push(["EXT-X-DATERANGE", E]); + break; + } + case "DEFINE": { + { + const b = new Le(E); + qe(o, b, ["NAME", "VALUE", "IMPORT", "QUERYPARAM"]), + "IMPORT" in b ? Ah(o, b, a) : Sa(o, b, t); + } + break; + } + case "DISCONTINUITY-SEQUENCE": + g = parseInt(E); + break; + case "KEY": { + const b = Ra(E, t, o); + if (b.isSupported()) { + if (b.method === "NONE") { + I = void 0; + break; + } + I || (I = {}), + I[b.keyFormat] && (I = Fe({}, I)), + (I[b.keyFormat] = b); + } else D.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${E}"`); + break; + } + case "START": + o.startTimeOffset = Pa(E); + break; + case "MAP": { + const b = new Le(E); + if ((qe(o, b, ["BYTERANGE", "URI"]), v.duration)) { + const S = new Wn(n, t); + Oa(S, b, i, I), + (u = S), + (v.initSegment = u), + u.rawProgramDateTime && + !v.rawProgramDateTime && + (v.rawProgramDateTime = u.rawProgramDateTime); + } else Oa(v, b, i, I), (u = v), (M = !0); + break; + } + case "SERVER-CONTROL": { + const b = new Le(E); + (o.canBlockReload = b.bool("CAN-BLOCK-RELOAD")), + (o.canSkipUntil = b.optionalFloat("CAN-SKIP-UNTIL", 0)), + (o.canSkipDateRanges = + o.canSkipUntil > 0 && b.bool("CAN-SKIP-DATERANGES")), + (o.partHoldBack = b.optionalFloat("PART-HOLD-BACK", 0)), + (o.holdBack = b.optionalFloat("HOLD-BACK", 0)); + break; + } + case "PART-INF": { + const b = new Le(E); + o.partTarget = b.decimalFloatingPoint("PART-TARGET"); + break; + } + case "PART": { + let b = o.partList; + b || (b = o.partList = []); + const S = d > 0 ? b[b.length - 1] : void 0, + P = d++, + F = new Le(E); + qe(o, F, ["BYTERANGE", "URI"]); + const V = new Bc(F, v, t, P, S); + b.push(V), (v.duration += V.duration); + break; + } + case "PRELOAD-HINT": { + const b = new Le(E); + qe(o, b, ["URI"]), (o.preloadHint = b); + break; + } + case "RENDITION-REPORT": { + const b = new Le(E); + qe(o, b, ["URI"]), + (o.renditionReports = o.renditionReports || []), + o.renditionReports.push(b); + break; + } + default: + D.warn(`line parsed but not handled: ${T}`); + break; + } + } + } + p && !p.relurl + ? (l.pop(), (f -= p.duration), o.partList && (o.fragmentHint = p)) + : o.partList && + (Da(v, p), (v.cc = g), (o.fragmentHint = v), I && Na(v, I, o)); + const O = l.length, + j = l[0], + U = l[O - 1]; + if (((f += o.skippedSegments * o.targetduration), f > 0 && O && U)) { + o.averagetargetduration = f / O; + const Y = U.sn; + (o.endSN = Y !== "initSegment" ? Y : 0), + o.live || (U.endList = !0), + j && (o.startCC = j.cc); + } else (o.endSN = 0), (o.startCC = 0); + return ( + o.fragmentHint && (f += o.fragmentHint.duration), + (o.totalduration = f), + (o.endCC = g), + L > 0 && _h(l, L), + o + ); + } + } + function Ra(s, e, t) { + var i, n; + const r = new Le(s); + qe(t, r, ["KEYFORMAT", "KEYFORMATVERSIONS", "URI", "IV", "URI"]); + const a = (i = r.METHOD) != null ? i : "", + o = r.URI, + l = r.hexadecimalInteger("IV"), + u = r.KEYFORMATVERSIONS, + c = (n = r.KEYFORMAT) != null ? n : "identity"; + o && r.IV && !l && D.error(`Invalid IV: ${r.IV}`); + const d = o ? at.resolve(o, e) : "", + f = (u || "1").split("/").map(Number).filter(Number.isFinite); + return new Si(a, d, c, f, l); + } + function Pa(s) { + const t = new Le(s).decimalFloatingPoint("TIME-OFFSET"); + return ne(t) ? t : null; + } + function bh(s, e) { + ["video", "audio", "text"].forEach((t) => { + const i = s.filter((n) => vh(n, t)); + if (i.length) { + const n = i.filter( + (r) => + r.lastIndexOf("avc1", 0) === 0 || r.lastIndexOf("mp4a", 0) === 0 + ); + (e[`${t}Codec`] = n.length > 0 ? n[0] : i[0]), + (s = s.filter((r) => i.indexOf(r) === -1)); + } + }), + (e.unknownCodecs = s); + } + function wa(s, e, t) { + const i = e[t]; + i && (s[t] = i); + } + function _h(s, e) { + let t = s[e]; + for (let i = e; i--; ) { + const n = s[i]; + if (!n) return; + (n.programDateTime = t.programDateTime - n.duration * 1e3), (t = n); + } + } + function Da(s, e) { + s.rawProgramDateTime + ? (s.programDateTime = Date.parse(s.rawProgramDateTime)) + : e != null && + e.programDateTime && + (s.programDateTime = e.endProgramDateTime), + ne(s.programDateTime) || + ((s.programDateTime = null), (s.rawProgramDateTime = null)); + } + function Oa(s, e, t, i) { + (s.relurl = e.URI), + e.BYTERANGE && s.setByteRange(e.BYTERANGE), + (s.level = t), + (s.sn = "initSegment"), + i && (s.levelkeys = i), + (s.initSegment = null); + } + function Na(s, e, t) { + s.levelkeys = e; + const { encryptedFragments: i } = t; + (!i.length || i[i.length - 1].levelkeys !== e) && + Object.keys(e).some((n) => e[n].isCommonEncryption) && + i.push(s); + } + var de = { + MANIFEST: "manifest", + LEVEL: "level", + AUDIO_TRACK: "audioTrack", + SUBTITLE_TRACK: "subtitleTrack", + }, + se = { MAIN: "main", AUDIO: "audio", SUBTITLE: "subtitle" }; + function Fa(s) { + const { type: e } = s; + switch (e) { + case de.AUDIO_TRACK: + return se.AUDIO; + case de.SUBTITLE_TRACK: + return se.SUBTITLE; + default: + return se.MAIN; + } + } + function tr(s, e) { + let t = s.url; + return (t === void 0 || t.indexOf("data:") === 0) && (t = e.url), t; + } + class kh { + constructor(e) { + (this.hls = void 0), + (this.loaders = Object.create(null)), + (this.variableList = null), + (this.hls = e), + this.registerListeners(); + } + startLoad(e) {} + stopLoad() { + this.destroyInternalLoaders(); + } + registerListeners() { + const { hls: e } = this; + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.LEVEL_LOADING, this.onLevelLoading, this), + e.on(y.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this), + e.on(y.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this); + } + unregisterListeners() { + const { hls: e } = this; + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.LEVEL_LOADING, this.onLevelLoading, this), + e.off(y.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this), + e.off(y.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this); + } + createInternalLoader(e) { + const t = this.hls.config, + i = t.pLoader, + n = t.loader, + r = i || n, + a = new r(t); + return (this.loaders[e.type] = a), a; + } + getInternalLoader(e) { + return this.loaders[e.type]; + } + resetInternalLoader(e) { + this.loaders[e] && delete this.loaders[e]; + } + destroyInternalLoaders() { + for (const e in this.loaders) { + const t = this.loaders[e]; + t && t.destroy(), this.resetInternalLoader(e); + } + } + destroy() { + (this.variableList = null), + this.unregisterListeners(), + this.destroyInternalLoaders(); + } + onManifestLoading(e, t) { + const { url: i } = t; + (this.variableList = null), + this.load({ + id: null, + level: 0, + responseType: "text", + type: de.MANIFEST, + url: i, + deliveryDirectives: null, + }); + } + onLevelLoading(e, t) { + const { id: i, level: n, url: r, deliveryDirectives: a } = t; + this.load({ + id: i, + level: n, + responseType: "text", + type: de.LEVEL, + url: r, + deliveryDirectives: a, + }); + } + onAudioTrackLoading(e, t) { + const { id: i, groupId: n, url: r, deliveryDirectives: a } = t; + this.load({ + id: i, + groupId: n, + level: null, + responseType: "text", + type: de.AUDIO_TRACK, + url: r, + deliveryDirectives: a, + }); + } + onSubtitleTrackLoading(e, t) { + const { id: i, groupId: n, url: r, deliveryDirectives: a } = t; + this.load({ + id: i, + groupId: n, + level: null, + responseType: "text", + type: de.SUBTITLE_TRACK, + url: r, + deliveryDirectives: a, + }); + } + load(e) { + var t; + const i = this.hls.config; + let n = this.getInternalLoader(e); + if (n) { + const u = n.context; + if (u && u.url === e.url) { + D.trace("[playlist-loader]: playlist request ongoing"); + return; + } + D.log( + `[playlist-loader]: aborting previous loader for type: ${e.type}` + ), + n.abort(); + } + let r; + if ( + (e.type === de.MANIFEST + ? (r = i.manifestLoadPolicy.default) + : (r = Fe({}, i.playlistLoadPolicy.default, { + timeoutRetry: null, + errorRetry: null, + })), + (n = this.createInternalLoader(e)), + (t = e.deliveryDirectives) != null && t.part) + ) { + let u; + if ( + (e.type === de.LEVEL && e.level !== null + ? (u = this.hls.levels[e.level].details) + : e.type === de.AUDIO_TRACK && e.id !== null + ? (u = this.hls.audioTracks[e.id].details) + : e.type === de.SUBTITLE_TRACK && + e.id !== null && + (u = this.hls.subtitleTracks[e.id].details), + u) + ) { + const c = u.partTarget, + d = u.targetduration; + if (c && d) { + const f = Math.max(c * 3, d * 0.8) * 1e3; + r = Fe({}, r, { + maxTimeToFirstByteMs: Math.min(f, r.maxTimeToFirstByteMs), + maxLoadTimeMs: Math.min(f, r.maxTimeToFirstByteMs), + }); + } + } + } + const a = r.errorRetry || r.timeoutRetry || {}, + o = { + loadPolicy: r, + timeout: r.maxLoadTimeMs, + maxRetry: a.maxNumRetry || 0, + retryDelay: a.retryDelayMs || 0, + maxRetryDelay: a.maxRetryDelayMs || 0, + }, + l = { + onSuccess: (u, c, d, f) => { + const g = this.getInternalLoader(d); + this.resetInternalLoader(d.type); + const p = u.data; + if (p.indexOf("#EXTM3U") !== 0) { + this.handleManifestParsingError( + u, + d, + new Error("no EXTM3U delimiter"), + f || null, + c + ); + return; + } + (c.parsing.start = performance.now()), + at.isMediaPlaylist(p) + ? this.handleTrackOrLevelPlaylist(u, c, d, f || null, g) + : this.handleMasterPlaylist(u, c, d, f); + }, + onError: (u, c, d, f) => { + this.handleNetworkError(c, d, !1, u, f); + }, + onTimeout: (u, c, d) => { + this.handleNetworkError(c, d, !0, void 0, u); + }, + }; + n.load(e, o, l); + } + handleMasterPlaylist(e, t, i, n) { + const r = this.hls, + a = e.data, + o = tr(e, i), + l = at.parseMasterPlaylist(a, o); + if (l.playlistParsingError) { + this.handleManifestParsingError(e, i, l.playlistParsingError, n, t); + return; + } + const { + contentSteering: u, + levels: c, + sessionData: d, + sessionKeys: f, + startTimeOffset: g, + variableList: p, + } = l; + this.variableList = p; + const { + AUDIO: v = [], + SUBTITLES: T, + "CLOSED-CAPTIONS": x, + } = at.parseMasterPlaylistMedia(a, o, l); + v.length && + !v.some((L) => !L.url) && + c[0].audioCodec && + !c[0].attrs.AUDIO && + (D.log( + "[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one" + ), + v.unshift({ + type: "main", + name: "main", + groupId: "main", + default: !1, + autoselect: !1, + forced: !1, + id: -1, + attrs: new Le({}), + bitrate: 0, + url: "", + })), + r.trigger(y.MANIFEST_LOADED, { + levels: c, + audioTracks: v, + subtitles: T, + captions: x, + contentSteering: u, + url: o, + stats: t, + networkDetails: n, + sessionData: d, + sessionKeys: f, + startTimeOffset: g, + variableList: p, + }); + } + handleTrackOrLevelPlaylist(e, t, i, n, r) { + const a = this.hls, + { id: o, level: l, type: u } = i, + c = tr(e, i), + d = ne(o) ? o : 0, + f = ne(l) ? l : d, + g = Fa(i), + p = at.parseLevelPlaylist(e.data, c, f, g, d, this.variableList); + if (u === de.MANIFEST) { + const v = { + attrs: new Le({}), + bitrate: 0, + details: p, + name: "", + url: c, + }; + a.trigger(y.MANIFEST_LOADED, { + levels: [v], + audioTracks: [], + url: c, + stats: t, + networkDetails: n, + sessionData: null, + sessionKeys: null, + contentSteering: null, + startTimeOffset: null, + variableList: null, + }); + } + (t.parsing.end = performance.now()), + (i.levelDetails = p), + this.handlePlaylistLoaded(p, e, t, i, n, r); + } + handleManifestParsingError(e, t, i, n, r) { + this.hls.trigger(y.ERROR, { + type: re.NETWORK_ERROR, + details: $.MANIFEST_PARSING_ERROR, + fatal: t.type === de.MANIFEST, + url: e.url, + err: i, + error: i, + reason: i.message, + response: e, + context: t, + networkDetails: n, + stats: r, + }); + } + handleNetworkError(e, t, i = !1, n, r) { + let a = `A network ${ + i ? "timeout" : "error" + (n ? " (status " + n.code + ")" : "") + } occurred while loading ${e.type}`; + e.type === de.LEVEL + ? (a += `: ${e.level} id: ${e.id}`) + : (e.type === de.AUDIO_TRACK || e.type === de.SUBTITLE_TRACK) && + (a += ` id: ${e.id} group-id: "${e.groupId}"`); + const o = new Error(a); + D.warn(`[playlist-loader]: ${a}`); + let l = $.UNKNOWN, + u = !1; + const c = this.getInternalLoader(e); + switch (e.type) { + case de.MANIFEST: + (l = i ? $.MANIFEST_LOAD_TIMEOUT : $.MANIFEST_LOAD_ERROR), (u = !0); + break; + case de.LEVEL: + (l = i ? $.LEVEL_LOAD_TIMEOUT : $.LEVEL_LOAD_ERROR), (u = !1); + break; + case de.AUDIO_TRACK: + (l = i ? $.AUDIO_TRACK_LOAD_TIMEOUT : $.AUDIO_TRACK_LOAD_ERROR), + (u = !1); + break; + case de.SUBTITLE_TRACK: + (l = i ? $.SUBTITLE_TRACK_LOAD_TIMEOUT : $.SUBTITLE_LOAD_ERROR), + (u = !1); + break; + } + c && this.resetInternalLoader(e.type); + const d = { + type: re.NETWORK_ERROR, + details: l, + fatal: u, + url: e.url, + loader: c, + context: e, + error: o, + networkDetails: t, + stats: r, + }; + if (n) { + const f = (t == null ? void 0 : t.url) || e.url; + d.response = We({ url: f, data: void 0 }, n); + } + this.hls.trigger(y.ERROR, d); + } + handlePlaylistLoaded(e, t, i, n, r, a) { + const o = this.hls, + { type: l, level: u, id: c, groupId: d, deliveryDirectives: f } = n, + g = tr(t, n), + p = Fa(n), + v = typeof n.level == "number" && p === se.MAIN ? u : void 0; + if (!e.fragments.length) { + const x = new Error("No Segments found in Playlist"); + o.trigger(y.ERROR, { + type: re.NETWORK_ERROR, + details: $.LEVEL_EMPTY_ERROR, + fatal: !1, + url: g, + error: x, + reason: x.message, + response: t, + context: n, + level: v, + parent: p, + networkDetails: r, + stats: i, + }); + return; + } + e.targetduration || + (e.playlistParsingError = new Error("Missing Target Duration")); + const T = e.playlistParsingError; + if (T) { + o.trigger(y.ERROR, { + type: re.NETWORK_ERROR, + details: $.LEVEL_PARSING_ERROR, + fatal: !1, + url: g, + error: T, + reason: T.message, + response: t, + context: n, + level: v, + parent: p, + networkDetails: r, + stats: i, + }); + return; + } + switch ( + (e.live && + a && + (a.getCacheAge && (e.ageHeader = a.getCacheAge() || 0), + (!a.getCacheAge || isNaN(e.ageHeader)) && (e.ageHeader = 0)), + l) + ) { + case de.MANIFEST: + case de.LEVEL: + o.trigger(y.LEVEL_LOADED, { + details: e, + level: v || 0, + id: c || 0, + stats: i, + networkDetails: r, + deliveryDirectives: f, + }); + break; + case de.AUDIO_TRACK: + o.trigger(y.AUDIO_TRACK_LOADED, { + details: e, + id: c || 0, + groupId: d || "", + stats: i, + networkDetails: r, + deliveryDirectives: f, + }); + break; + case de.SUBTITLE_TRACK: + o.trigger(y.SUBTITLE_TRACK_LOADED, { + details: e, + id: c || 0, + groupId: d || "", + stats: i, + networkDetails: r, + deliveryDirectives: f, + }); + break; + } + } + } + function Ma(s, e) { + let t; + try { + t = new Event("addtrack"); + } catch { + (t = document.createEvent("Event")), t.initEvent("addtrack", !1, !1); + } + (t.track = s), e.dispatchEvent(t); + } + function Ba(s, e) { + const t = s.mode; + if ( + (t === "disabled" && (s.mode = "hidden"), + s.cues && !s.cues.getCueById(e.id)) + ) + try { + if ((s.addCue(e), !s.cues.getCueById(e.id))) + throw new Error(`addCue is failed for: ${e}`); + } catch (i) { + D.debug(`[texttrack-utils]: ${i}`); + try { + const n = new self.TextTrackCue(e.startTime, e.endTime, e.text); + (n.id = e.id), s.addCue(n); + } catch (n) { + D.debug( + `[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}` + ); + } + } + t === "disabled" && (s.mode = t); + } + function hi(s) { + const e = s.mode; + if ((e === "disabled" && (s.mode = "hidden"), s.cues)) + for (let t = s.cues.length; t--; ) s.removeCue(s.cues[t]); + e === "disabled" && (s.mode = e); + } + function ir(s, e, t, i) { + const n = s.mode; + if ( + (n === "disabled" && (s.mode = "hidden"), s.cues && s.cues.length > 0) + ) { + const r = Ch(s.cues, e, t); + for (let a = 0; a < r.length; a++) (!i || i(r[a])) && s.removeCue(r[a]); + } + n === "disabled" && (s.mode = n); + } + function Sh(s, e) { + if (e < s[0].startTime) return 0; + const t = s.length - 1; + if (e > s[t].endTime) return -1; + let i = 0, + n = t; + for (; i <= n; ) { + const r = Math.floor((n + i) / 2); + if (e < s[r].startTime) n = r - 1; + else if (e > s[r].startTime && i < t) i = r + 1; + else return r; + } + return s[i].startTime - e < e - s[n].startTime ? i : n; + } + function Ch(s, e, t) { + const i = [], + n = Sh(s, e); + if (n > -1) + for (let r = n, a = s.length; r < a; r++) { + const o = s[r]; + if (o.startTime >= e && o.endTime <= t) i.push(o); + else if (o.startTime > t) return i; + } + return i; + } + var ot = { + audioId3: "org.id3", + dateRange: "com.apple.quicktime.HLS", + emsg: "https://aomedia.org/emsg/ID3", + }; + const xh = 0.25; + function nr() { + if (!(typeof self > "u")) + return self.WebKitDataCue || self.VTTCue || self.TextTrackCue; + } + const tn = (() => { + const s = nr(); + try { + new s(0, Number.POSITIVE_INFINITY, ""); + } catch { + return Number.MAX_VALUE; + } + return Number.POSITIVE_INFINITY; + })(); + function rr(s, e) { + return s.getTime() / 1e3 - e; + } + function Lh(s) { + return Uint8Array.from( + s + .replace(/^0x/, "") + .replace(/([\da-fA-F]{2}) ?/g, "0x$1 ") + .replace(/ +$/, "") + .split(" ") + ).buffer; + } + class Ih { + constructor(e) { + (this.hls = void 0), + (this.id3Track = null), + (this.media = null), + (this.dateRangeCuesAppended = {}), + (this.hls = e), + this._registerListeners(); + } + destroy() { + this._unregisterListeners(), + (this.id3Track = null), + (this.media = null), + (this.dateRangeCuesAppended = {}), + (this.hls = null); + } + _registerListeners() { + const { hls: e } = this; + e.on(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.on(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this), + e.on(y.BUFFER_FLUSHING, this.onBufferFlushing, this), + e.on(y.LEVEL_UPDATED, this.onLevelUpdated, this); + } + _unregisterListeners() { + const { hls: e } = this; + e.off(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.off(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this), + e.off(y.BUFFER_FLUSHING, this.onBufferFlushing, this), + e.off(y.LEVEL_UPDATED, this.onLevelUpdated, this); + } + onMediaAttached(e, t) { + this.media = t.media; + } + onMediaDetaching() { + this.id3Track && + (hi(this.id3Track), + (this.id3Track = null), + (this.media = null), + (this.dateRangeCuesAppended = {})); + } + onManifestLoading() { + this.dateRangeCuesAppended = {}; + } + createTrack(e) { + const t = this.getID3Track(e.textTracks); + return (t.mode = "hidden"), t; + } + getID3Track(e) { + if (this.media) { + for (let t = 0; t < e.length; t++) { + const i = e[t]; + if (i.kind === "metadata" && i.label === "id3") + return Ma(i, this.media), i; + } + return this.media.addTextTrack("metadata", "id3"); + } + } + onFragParsingMetadata(e, t) { + if (!this.media) return; + const { + hls: { + config: { enableEmsgMetadataCues: i, enableID3MetadataCues: n }, + }, + } = this; + if (!i && !n) return; + const { samples: r } = t; + this.id3Track || (this.id3Track = this.createTrack(this.media)); + const a = nr(); + for (let o = 0; o < r.length; o++) { + const l = r[o].type; + if ((l === ot.emsg && !i) || !n) continue; + const u = ga(r[o].data); + if (u) { + const c = r[o].pts; + let d = c + r[o].duration; + d > tn && (d = tn), d - c <= 0 && (d = c + xh); + for (let g = 0; g < u.length; g++) { + const p = u[g]; + if (!fa(p)) { + this.updateId3CueEnds(c, l); + const v = new a(c, d, ""); + (v.value = p), l && (v.type = l), this.id3Track.addCue(v); + } + } + } + } + } + updateId3CueEnds(e, t) { + var i; + const n = (i = this.id3Track) == null ? void 0 : i.cues; + if (n) + for (let r = n.length; r--; ) { + const a = n[r]; + a.type === t && + a.startTime < e && + a.endTime === tn && + (a.endTime = e); + } + } + onBufferFlushing(e, { startOffset: t, endOffset: i, type: n }) { + const { id3Track: r, hls: a } = this; + if (!a) return; + const { + config: { enableEmsgMetadataCues: o, enableID3MetadataCues: l }, + } = a; + if (r && (o || l)) { + let u; + n === "audio" + ? (u = (c) => c.type === ot.audioId3 && l) + : n === "video" + ? (u = (c) => c.type === ot.emsg && o) + : (u = (c) => + (c.type === ot.audioId3 && l) || (c.type === ot.emsg && o)), + ir(r, t, i, u); + } + } + onLevelUpdated(e, { details: t }) { + if ( + !this.media || + !t.hasProgramDateTime || + !this.hls.config.enableDateRangeMetadataCues + ) + return; + const { dateRangeCuesAppended: i, id3Track: n } = this, + { dateRanges: r } = t, + a = Object.keys(r); + if (n) { + const c = Object.keys(i).filter((d) => !a.includes(d)); + for (let d = c.length; d--; ) { + const f = c[d]; + Object.keys(i[f].cues).forEach((g) => { + n.removeCue(i[f].cues[g]); + }), + delete i[f]; + } + } + const o = t.fragments[t.fragments.length - 1]; + if (a.length === 0 || !ne(o == null ? void 0 : o.programDateTime)) return; + this.id3Track || (this.id3Track = this.createTrack(this.media)); + const l = o.programDateTime / 1e3 - o.start, + u = nr(); + for (let c = 0; c < a.length; c++) { + const d = a[c], + f = r[d], + g = i[d], + p = (g == null ? void 0 : g.cues) || {}; + let v = (g == null ? void 0 : g.durationKnown) || !1; + const T = rr(f.startDate, l); + let x = tn; + const I = f.endDate; + if (I) (x = rr(I, l)), (v = !0); + else if (f.endOnNext && !v) { + const M = a + .reduce((O, j) => { + const U = r[j]; + return ( + U.class === f.class && + U.id !== j && + U.startDate > f.startDate && + O.push(U), + O + ); + }, []) + .sort((O, j) => O.startDate.getTime() - j.startDate.getTime())[0]; + M && ((x = rr(M.startDate, l)), (v = !0)); + } + const L = Object.keys(f.attr); + for (let M = 0; M < L.length; M++) { + const O = L[M]; + if (!Fc(O)) continue; + let j = p[O]; + if (j) v && !g.durationKnown && (j.endTime = x); + else { + let U = f.attr[O]; + (j = new u(T, x, "")), + Mc(O) && (U = Lh(U)), + (j.value = { key: O, data: U }), + (j.type = ot.dateRange), + (j.id = d), + this.id3Track.addCue(j), + (p[O] = j); + } + } + i[d] = { cues: p, dateRange: f, durationKnown: v }; + } + } + } + class Rh { + constructor(e) { + (this.hls = void 0), + (this.config = void 0), + (this.media = null), + (this.levelDetails = null), + (this.currentTime = 0), + (this.stallCount = 0), + (this._latency = null), + (this.timeupdateHandler = () => this.timeupdate()), + (this.hls = e), + (this.config = e.config), + this.registerListeners(); + } + get latency() { + return this._latency || 0; + } + get maxLatency() { + const { config: e, levelDetails: t } = this; + return e.liveMaxLatencyDuration !== void 0 + ? e.liveMaxLatencyDuration + : t + ? e.liveMaxLatencyDurationCount * t.targetduration + : 0; + } + get targetLatency() { + const { levelDetails: e } = this; + if (e === null) return null; + const { holdBack: t, partHoldBack: i, targetduration: n } = e, + { + liveSyncDuration: r, + liveSyncDurationCount: a, + lowLatencyMode: o, + } = this.config, + l = this.hls.userConfig; + let u = (o && i) || t; + (l.liveSyncDuration || l.liveSyncDurationCount || u === 0) && + (u = r !== void 0 ? r : a * n); + const c = n; + return u + Math.min(this.stallCount * 1, c); + } + get liveSyncPosition() { + const e = this.estimateLiveEdge(), + t = this.targetLatency, + i = this.levelDetails; + if (e === null || t === null || i === null) return null; + const n = i.edge, + r = e - t - this.edgeStalled, + a = n - i.totalduration, + o = + n - + ((this.config.lowLatencyMode && i.partTarget) || i.targetduration); + return Math.min(Math.max(a, r), o); + } + get drift() { + const { levelDetails: e } = this; + return e === null ? 1 : e.drift; + } + get edgeStalled() { + const { levelDetails: e } = this; + if (e === null) return 0; + const t = + ((this.config.lowLatencyMode && e.partTarget) || e.targetduration) * 3; + return Math.max(e.age - t, 0); + } + get forwardBufferLength() { + const { media: e, levelDetails: t } = this; + if (!e || !t) return 0; + const i = e.buffered.length; + return (i ? e.buffered.end(i - 1) : t.edge) - this.currentTime; + } + destroy() { + this.unregisterListeners(), + this.onMediaDetaching(), + (this.levelDetails = null), + (this.hls = this.timeupdateHandler = null); + } + registerListeners() { + this.hls.on(y.MEDIA_ATTACHED, this.onMediaAttached, this), + this.hls.on(y.MEDIA_DETACHING, this.onMediaDetaching, this), + this.hls.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + this.hls.on(y.LEVEL_UPDATED, this.onLevelUpdated, this), + this.hls.on(y.ERROR, this.onError, this); + } + unregisterListeners() { + this.hls.off(y.MEDIA_ATTACHED, this.onMediaAttached, this), + this.hls.off(y.MEDIA_DETACHING, this.onMediaDetaching, this), + this.hls.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + this.hls.off(y.LEVEL_UPDATED, this.onLevelUpdated, this), + this.hls.off(y.ERROR, this.onError, this); + } + onMediaAttached(e, t) { + (this.media = t.media), + this.media.addEventListener("timeupdate", this.timeupdateHandler); + } + onMediaDetaching() { + this.media && + (this.media.removeEventListener("timeupdate", this.timeupdateHandler), + (this.media = null)); + } + onManifestLoading() { + (this.levelDetails = null), (this._latency = null), (this.stallCount = 0); + } + onLevelUpdated(e, { details: t }) { + (this.levelDetails = t), + t.advanced && this.timeupdate(), + !t.live && + this.media && + this.media.removeEventListener("timeupdate", this.timeupdateHandler); + } + onError(e, t) { + var i; + t.details === $.BUFFER_STALLED_ERROR && + (this.stallCount++, + (i = this.levelDetails) != null && + i.live && + D.warn( + "[playback-rate-controller]: Stall detected, adjusting target latency" + )); + } + timeupdate() { + const { media: e, levelDetails: t } = this; + if (!e || !t) return; + this.currentTime = e.currentTime; + const i = this.computeLatency(); + if (i === null) return; + this._latency = i; + const { lowLatencyMode: n, maxLiveSyncPlaybackRate: r } = this.config; + if (!n || r === 1) return; + const a = this.targetLatency; + if (a === null) return; + const o = i - a, + l = Math.min(this.maxLatency, a + t.targetduration), + u = o < l; + if (t.live && u && o > 0.05 && this.forwardBufferLength > 1) { + const c = Math.min(2, Math.max(1, r)), + d = + Math.round( + (2 / (1 + Math.exp(-0.75 * o - this.edgeStalled))) * 20 + ) / 20; + e.playbackRate = Math.min(c, Math.max(1, d)); + } else e.playbackRate !== 1 && e.playbackRate !== 0 && (e.playbackRate = 1); + } + estimateLiveEdge() { + const { levelDetails: e } = this; + return e === null ? null : e.edge + e.age; + } + computeLatency() { + const e = this.estimateLiveEdge(); + return e === null ? null : e - this.currentTime; + } + } + const sr = ["NONE", "TYPE-0", "TYPE-1", null]; + var Ci = { No: "", Yes: "YES", v2: "v2" }; + function Ph(s, e) { + const { canSkipUntil: t, canSkipDateRanges: i, endSN: n } = s, + r = e !== void 0 ? e - n : 0; + return t && r < t ? (i ? Ci.v2 : Ci.Yes) : Ci.No; + } + class Ua { + constructor(e, t, i) { + (this.msn = void 0), + (this.part = void 0), + (this.skip = void 0), + (this.msn = e), + (this.part = t), + (this.skip = i); + } + addDirectives(e) { + const t = new self.URL(e); + return ( + this.msn !== void 0 && + t.searchParams.set("_HLS_msn", this.msn.toString()), + this.part !== void 0 && + t.searchParams.set("_HLS_part", this.part.toString()), + this.skip && t.searchParams.set("_HLS_skip", this.skip), + t.href + ); + } + } + class xi { + constructor(e) { + (this._attrs = void 0), + (this.audioCodec = void 0), + (this.bitrate = void 0), + (this.codecSet = void 0), + (this.height = void 0), + (this.id = void 0), + (this.name = void 0), + (this.videoCodec = void 0), + (this.width = void 0), + (this.unknownCodecs = void 0), + (this.audioGroupIds = void 0), + (this.details = void 0), + (this.fragmentError = 0), + (this.loadError = 0), + (this.loaded = void 0), + (this.realBitrate = 0), + (this.textGroupIds = void 0), + (this.url = void 0), + (this._urlId = 0), + (this.url = [e.url]), + (this._attrs = [e.attrs]), + (this.bitrate = e.bitrate), + e.details && (this.details = e.details), + (this.id = e.id || 0), + (this.name = e.name), + (this.width = e.width || 0), + (this.height = e.height || 0), + (this.audioCodec = e.audioCodec), + (this.videoCodec = e.videoCodec), + (this.unknownCodecs = e.unknownCodecs), + (this.codecSet = [e.videoCodec, e.audioCodec] + .filter((t) => t) + .join(",") + .replace(/\.[^.,]+/g, "")); + } + get maxBitrate() { + return Math.max(this.realBitrate, this.bitrate); + } + get attrs() { + return this._attrs[this._urlId]; + } + get pathwayId() { + return this.attrs["PATHWAY-ID"] || "."; + } + get uri() { + return this.url[this._urlId] || ""; + } + get urlId() { + return this._urlId; + } + set urlId(e) { + const t = e % this.url.length; + this._urlId !== t && + ((this.fragmentError = 0), + (this.loadError = 0), + (this.details = void 0), + (this._urlId = t)); + } + get audioGroupId() { + var e; + return (e = this.audioGroupIds) == null ? void 0 : e[this.urlId]; + } + get textGroupId() { + var e; + return (e = this.textGroupIds) == null ? void 0 : e[this.urlId]; + } + addFallback(e) { + this.url.push(e.url), this._attrs.push(e.attrs); + } + } + function ar(s, e) { + const t = e.startPTS; + if (ne(t)) { + let i = 0, + n; + e.sn > s.sn ? ((i = t - s.start), (n = s)) : ((i = s.start - t), (n = e)), + n.duration !== i && (n.duration = i); + } else e.sn > s.sn ? (s.cc === e.cc && s.minEndPTS ? (e.start = s.start + (s.minEndPTS - s.start)) : (e.start = s.start + s.duration)) : (e.start = Math.max(s.start - e.duration, 0)); + } + function $a(s, e, t, i, n, r) { + i - t <= 0 && + (D.warn("Fragment should have a positive duration", e), + (i = t + e.duration), + (r = n + e.duration)); + let o = t, + l = i; + const u = e.startPTS, + c = e.endPTS; + if (ne(u)) { + const T = Math.abs(u - t); + ne(e.deltaPTS) + ? (e.deltaPTS = Math.max(T, e.deltaPTS)) + : (e.deltaPTS = T), + (o = Math.max(t, u)), + (t = Math.min(t, u)), + (n = Math.min(n, e.startDTS)), + (l = Math.min(i, c)), + (i = Math.max(i, c)), + (r = Math.max(r, e.endDTS)); + } + const d = t - e.start; + e.start !== 0 && (e.start = t), + (e.duration = i - e.start), + (e.startPTS = t), + (e.maxStartPTS = o), + (e.startDTS = n), + (e.endPTS = i), + (e.minEndPTS = l), + (e.endDTS = r); + const f = e.sn; + if (!s || f < s.startSN || f > s.endSN) return 0; + let g; + const p = f - s.startSN, + v = s.fragments; + for (v[p] = e, g = p; g > 0; g--) ar(v[g], v[g - 1]); + for (g = p; g < v.length - 1; g++) ar(v[g], v[g + 1]); + return ( + s.fragmentHint && ar(v[v.length - 1], s.fragmentHint), + (s.PTSKnown = s.alignedSliding = !0), + d + ); + } + function wh(s, e) { + let t = null; + const i = s.fragments; + for (let l = i.length - 1; l >= 0; l--) { + const u = i[l].initSegment; + if (u) { + t = u; + break; + } + } + s.fragmentHint && delete s.fragmentHint.endPTS; + let n = 0, + r; + if ( + (Nh(s, e, (l, u) => { + l.relurl && (n = l.cc - u.cc), + ne(l.startPTS) && + ne(l.endPTS) && + ((u.start = u.startPTS = l.startPTS), + (u.startDTS = l.startDTS), + (u.maxStartPTS = l.maxStartPTS), + (u.endPTS = l.endPTS), + (u.endDTS = l.endDTS), + (u.minEndPTS = l.minEndPTS), + (u.duration = l.endPTS - l.startPTS), + u.duration && (r = u), + (e.PTSKnown = e.alignedSliding = !0)), + (u.elementaryStreams = l.elementaryStreams), + (u.loader = l.loader), + (u.stats = l.stats), + (u.urlId = l.urlId), + l.initSegment && + ((u.initSegment = l.initSegment), (t = l.initSegment)); + }), + t && + (e.fragmentHint + ? e.fragments.concat(e.fragmentHint) + : e.fragments + ).forEach((u) => { + var c; + (!u.initSegment || + u.initSegment.relurl === ((c = t) == null ? void 0 : c.relurl)) && + (u.initSegment = t); + }), + e.skippedSegments) + ) + if ( + ((e.deltaUpdateFailed = e.fragments.some((l) => !l)), + e.deltaUpdateFailed) + ) { + D.warn( + "[level-helper] Previous playlist missing segments skipped in delta playlist" + ); + for (let l = e.skippedSegments; l--; ) e.fragments.shift(); + (e.startSN = e.fragments[0].sn), (e.startCC = e.fragments[0].cc); + } else + e.canSkipDateRanges && + (e.dateRanges = Dh( + s.dateRanges, + e.dateRanges, + e.recentlyRemovedDateranges + )); + const a = e.fragments; + if (n) { + D.warn("discontinuity sliding from playlist, take drift into account"); + for (let l = 0; l < a.length; l++) a[l].cc += n; + } + e.skippedSegments && (e.startCC = e.fragments[0].cc), + Oh(s.partList, e.partList, (l, u) => { + (u.elementaryStreams = l.elementaryStreams), (u.stats = l.stats); + }), + r ? $a(e, r, r.startPTS, r.endPTS, r.startDTS, r.endDTS) : Va(s, e), + a.length && (e.totalduration = e.edge - a[0].start), + (e.driftStartTime = s.driftStartTime), + (e.driftStart = s.driftStart); + const o = e.advancedDateTime; + if (e.advanced && o) { + const l = e.edge; + e.driftStart || ((e.driftStartTime = o), (e.driftStart = l)), + (e.driftEndTime = o), + (e.driftEnd = l); + } else (e.driftEndTime = s.driftEndTime), (e.driftEnd = s.driftEnd), (e.advancedDateTime = s.advancedDateTime); + } + function Dh(s, e, t) { + const i = Fe({}, s); + return ( + t && + t.forEach((n) => { + delete i[n]; + }), + Object.keys(e).forEach((n) => { + const r = new sa(e[n].attr, i[n]); + r.isValid + ? (i[n] = r) + : D.warn( + `Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify( + e[n].attr + )}"` + ); + }), + i + ); + } + function Oh(s, e, t) { + if (s && e) { + let i = 0; + for (let n = 0, r = s.length; n <= r; n++) { + const a = s[n], + o = e[n + i]; + a && o && a.index === o.index && a.fragment.sn === o.fragment.sn + ? t(a, o) + : i--; + } + } + } + function Nh(s, e, t) { + const i = e.skippedSegments, + n = Math.max(s.startSN, e.startSN) - e.startSN, + r = + (s.fragmentHint ? 1 : 0) + + (i ? e.endSN : Math.min(s.endSN, e.endSN)) - + e.startSN, + a = e.startSN - s.startSN, + o = e.fragmentHint ? e.fragments.concat(e.fragmentHint) : e.fragments, + l = s.fragmentHint ? s.fragments.concat(s.fragmentHint) : s.fragments; + for (let u = n; u <= r; u++) { + const c = l[a + u]; + let d = o[u]; + i && !d && u < i && (d = e.fragments[u] = c), c && d && t(c, d); + } + } + function Va(s, e) { + const t = e.startSN + e.skippedSegments - s.startSN, + i = s.fragments; + t < 0 || t >= i.length || or(e, i[t].start); + } + function or(s, e) { + if (e) { + const t = s.fragments; + for (let i = s.skippedSegments; i < t.length; i++) t[i].start += e; + s.fragmentHint && (s.fragmentHint.start += e); + } + } + function Fh(s, e = 1 / 0) { + let t = 1e3 * s.targetduration; + if (s.updated) { + const i = s.fragments; + if (i.length && t * 4 > e) { + const r = i[i.length - 1].duration * 1e3; + r < t && (t = r); + } + } else t /= 2; + return Math.round(t); + } + function Mh(s, e, t) { + if (!(s != null && s.details)) return null; + const i = s.details; + let n = i.fragments[e - i.startSN]; + return n || ((n = i.fragmentHint), n && n.sn === e) + ? n + : e < i.startSN && t && t.sn === e + ? t + : null; + } + function Ga(s, e, t) { + var i; + return s != null && s.details + ? Ka((i = s.details) == null ? void 0 : i.partList, e, t) + : null; + } + function Ka(s, e, t) { + if (s) + for (let i = s.length; i--; ) { + const n = s[i]; + if (n.index === t && n.fragment.sn === e) return n; + } + return null; + } + function nn(s) { + switch (s.details) { + case $.FRAG_LOAD_TIMEOUT: + case $.KEY_LOAD_TIMEOUT: + case $.LEVEL_LOAD_TIMEOUT: + case $.MANIFEST_LOAD_TIMEOUT: + return !0; + } + return !1; + } + function Ha(s, e) { + const t = nn(e); + return s.default[`${t ? "timeout" : "error"}Retry`]; + } + function lr(s, e) { + const t = s.backoff === "linear" ? 1 : Math.pow(2, e); + return Math.min(t * s.retryDelayMs, s.maxRetryDelayMs); + } + function Ya(s) { + return We(We({}, s), { errorRetry: null, timeoutRetry: null }); + } + function rn(s, e, t, i) { + return !!s && e < s.maxNumRetry && (Bh(i) || !!t); + } + function Bh(s) { + return ( + (s === 0 && navigator.onLine === !1) || (!!s && (s < 400 || s > 499)) + ); + } + const za = { + search: function (s, e) { + let t = 0, + i = s.length - 1, + n = null, + r = null; + for (; t <= i; ) { + (n = ((t + i) / 2) | 0), (r = s[n]); + const a = e(r); + if (a > 0) t = n + 1; + else if (a < 0) i = n - 1; + else return r; + } + return null; + }, + }; + function Uh(s, e, t) { + if (e === null || !Array.isArray(s) || !s.length || !ne(e)) return null; + const i = s[0].programDateTime; + if (e < (i || 0)) return null; + const n = s[s.length - 1].endProgramDateTime; + if (e >= (n || 0)) return null; + t = t || 0; + for (let r = 0; r < s.length; ++r) { + const a = s[r]; + if ($h(e, t, a)) return a; + } + return null; + } + function Li(s, e, t = 0, i = 0) { + let n = null; + if ( + (s + ? (n = e[s.sn - e[0].sn + 1] || null) + : t === 0 && e[0].start === 0 && (n = e[0]), + n && ur(t, i, n) === 0) + ) + return n; + const r = za.search(e, ur.bind(null, t, i)); + return r && (r !== s || !n) ? r : n; + } + function ur(s = 0, e = 0, t) { + if (t.start <= s && t.start + t.duration > s) return 0; + const i = Math.min(e, t.duration + (t.deltaPTS ? t.deltaPTS : 0)); + return t.start + t.duration - i <= s + ? 1 + : t.start - i > s && t.start + ? -1 + : 0; + } + function $h(s, e, t) { + const i = Math.min(e, t.duration + (t.deltaPTS ? t.deltaPTS : 0)) * 1e3; + return (t.endProgramDateTime || 0) - i > s; + } + function Vh(s, e) { + return za.search(s, (t) => (t.cc < e ? 1 : t.cc > e ? -1 : 0)); + } + const Gh = 3e5; + var Ge = { + DoNothing: 0, + SendEndCallback: 1, + SendAlternateToPenaltyBox: 2, + RemoveAlternatePermanently: 3, + InsertDiscontinuity: 4, + RetryRequest: 5, + }, + it = { + None: 0, + MoveAllAlternatesMatchingHost: 1, + MoveAllAlternatesMatchingHDCP: 2, + SwitchToSDR: 4, + }; + class Kh { + constructor(e) { + (this.hls = void 0), + (this.playlistError = 0), + (this.penalizedRenditions = {}), + (this.log = void 0), + (this.warn = void 0), + (this.error = void 0), + (this.hls = e), + (this.log = D.log.bind(D, "[info]:")), + (this.warn = D.warn.bind(D, "[warning]:")), + (this.error = D.error.bind(D, "[error]:")), + this.registerListeners(); + } + registerListeners() { + const e = this.hls; + e.on(y.ERROR, this.onError, this), + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.LEVEL_UPDATED, this.onLevelUpdated, this); + } + unregisterListeners() { + const e = this.hls; + e && + (e.off(y.ERROR, this.onError, this), + e.off(y.ERROR, this.onErrorOut, this), + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.LEVEL_UPDATED, this.onLevelUpdated, this)); + } + destroy() { + this.unregisterListeners(), + (this.hls = null), + (this.penalizedRenditions = {}); + } + startLoad(e) { + this.playlistError = 0; + } + stopLoad() {} + getVariantLevelIndex(e) { + return (e == null ? void 0 : e.type) === se.MAIN + ? e.level + : this.hls.loadLevel; + } + onManifestLoading() { + (this.playlistError = 0), (this.penalizedRenditions = {}); + } + onLevelUpdated() { + this.playlistError = 0; + } + onError(e, t) { + var i, n; + if (t.fatal) return; + const r = this.hls, + a = t.context; + switch (t.details) { + case $.FRAG_LOAD_ERROR: + case $.FRAG_LOAD_TIMEOUT: + case $.KEY_LOAD_ERROR: + case $.KEY_LOAD_TIMEOUT: + t.errorAction = this.getFragRetryOrSwitchAction(t); + return; + case $.FRAG_PARSING_ERROR: + if ((i = t.frag) != null && i.gap) { + t.errorAction = { action: Ge.DoNothing, flags: it.None }; + return; + } + case $.FRAG_GAP: + case $.FRAG_DECRYPT_ERROR: { + (t.errorAction = this.getFragRetryOrSwitchAction(t)), + (t.errorAction.action = Ge.SendAlternateToPenaltyBox); + return; + } + case $.LEVEL_EMPTY_ERROR: + case $.LEVEL_PARSING_ERROR: + { + var o, l; + const u = t.parent === se.MAIN ? t.level : r.loadLevel; + t.details === $.LEVEL_EMPTY_ERROR && + (o = t.context) != null && + (l = o.levelDetails) != null && + l.live + ? (t.errorAction = this.getPlaylistRetryOrSwitchAction(t, u)) + : ((t.levelRetry = !1), + (t.errorAction = this.getLevelSwitchAction(t, u))); + } + return; + case $.LEVEL_LOAD_ERROR: + case $.LEVEL_LOAD_TIMEOUT: + typeof (a == null ? void 0 : a.level) == "number" && + (t.errorAction = this.getPlaylistRetryOrSwitchAction(t, a.level)); + return; + case $.AUDIO_TRACK_LOAD_ERROR: + case $.AUDIO_TRACK_LOAD_TIMEOUT: + case $.SUBTITLE_LOAD_ERROR: + case $.SUBTITLE_TRACK_LOAD_TIMEOUT: + if (a) { + const u = r.levels[r.loadLevel]; + if ( + u && + ((a.type === de.AUDIO_TRACK && a.groupId === u.audioGroupId) || + (a.type === de.SUBTITLE_TRACK && a.groupId === u.textGroupId)) + ) { + (t.errorAction = this.getPlaylistRetryOrSwitchAction( + t, + r.loadLevel + )), + (t.errorAction.action = Ge.SendAlternateToPenaltyBox), + (t.errorAction.flags = it.MoveAllAlternatesMatchingHost); + return; + } + } + return; + case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED: + { + const u = r.levels[r.loadLevel], + c = u == null ? void 0 : u.attrs["HDCP-LEVEL"]; + c && + (t.errorAction = { + action: Ge.SendAlternateToPenaltyBox, + flags: it.MoveAllAlternatesMatchingHDCP, + hdcpLevel: c, + }); + } + return; + case $.BUFFER_ADD_CODEC_ERROR: + case $.REMUX_ALLOC_ERROR: + t.errorAction = this.getLevelSwitchAction( + t, + (n = t.level) != null ? n : r.loadLevel + ); + return; + case $.INTERNAL_EXCEPTION: + case $.BUFFER_APPENDING_ERROR: + case $.BUFFER_APPEND_ERROR: + case $.BUFFER_FULL_ERROR: + case $.LEVEL_SWITCH_ERROR: + case $.BUFFER_STALLED_ERROR: + case $.BUFFER_SEEK_OVER_HOLE: + case $.BUFFER_NUDGE_ON_STALL: + t.errorAction = { action: Ge.DoNothing, flags: it.None }; + return; + } + if (t.type === re.KEY_SYSTEM_ERROR) { + const u = this.getVariantLevelIndex(t.frag); + (t.levelRetry = !1), (t.errorAction = this.getLevelSwitchAction(t, u)); + return; + } + } + getPlaylistRetryOrSwitchAction(e, t) { + var i; + const n = this.hls, + r = Ha(n.config.playlistLoadPolicy, e), + a = this.playlistError++, + o = (i = e.response) == null ? void 0 : i.code; + if (rn(r, a, nn(e), o)) + return { + action: Ge.RetryRequest, + flags: it.None, + retryConfig: r, + retryCount: a, + }; + const u = this.getLevelSwitchAction(e, t); + return r && ((u.retryConfig = r), (u.retryCount = a)), u; + } + getFragRetryOrSwitchAction(e) { + const t = this.hls, + i = this.getVariantLevelIndex(e.frag), + n = t.levels[i], + { fragLoadPolicy: r, keyLoadPolicy: a } = t.config, + o = Ha(e.details.startsWith("key") ? a : r, e), + l = t.levels.reduce((d, f) => d + f.fragmentError, 0); + if (n) { + var u; + e.details !== $.FRAG_GAP && n.fragmentError++; + const d = (u = e.response) == null ? void 0 : u.code; + if (rn(o, l, nn(e), d)) + return { + action: Ge.RetryRequest, + flags: it.None, + retryConfig: o, + retryCount: l, + }; + } + const c = this.getLevelSwitchAction(e, i); + return o && ((c.retryConfig = o), (c.retryCount = l)), c; + } + getLevelSwitchAction(e, t) { + const i = this.hls; + t == null && (t = i.loadLevel); + const n = this.hls.levels[t]; + if (n && (n.loadError++, i.autoLevelEnabled)) { + var r, a; + let o = -1; + const { levels: l, loadLevel: u, minAutoLevel: c, maxAutoLevel: d } = i, + f = (r = e.frag) == null ? void 0 : r.type, + { type: g, groupId: p } = (a = e.context) != null ? a : {}; + for (let v = l.length; v--; ) { + const T = (v + u) % l.length; + if (T !== u && T >= c && T <= d && l[T].loadError === 0) { + const x = l[T]; + if (e.details === $.FRAG_GAP && e.frag) { + const I = l[T].details; + if (I) { + const L = Li(e.frag, I.fragments, e.frag.start); + if (L != null && L.gap) continue; + } + } else { + if ( + (g === de.AUDIO_TRACK && p === x.audioGroupId) || + (g === de.SUBTITLE_TRACK && p === x.textGroupId) + ) + continue; + if ( + (f === se.AUDIO && n.audioGroupId === x.audioGroupId) || + (f === se.SUBTITLE && n.textGroupId === x.textGroupId) + ) + continue; + } + o = T; + break; + } + } + if (o > -1 && i.loadLevel !== o) + return ( + (e.levelRetry = !0), + (this.playlistError = 0), + { + action: Ge.SendAlternateToPenaltyBox, + flags: it.None, + nextAutoLevel: o, + } + ); + } + return { + action: Ge.SendAlternateToPenaltyBox, + flags: it.MoveAllAlternatesMatchingHost, + }; + } + onErrorOut(e, t) { + var i; + switch ((i = t.errorAction) == null ? void 0 : i.action) { + case Ge.DoNothing: + break; + case Ge.SendAlternateToPenaltyBox: + this.sendAlternateToPenaltyBox(t), + !t.errorAction.resolved && + t.details !== $.FRAG_GAP && + (t.fatal = !0); + break; + } + if (t.fatal) { + this.hls.stopLoad(); + return; + } + } + sendAlternateToPenaltyBox(e) { + const t = this.hls, + i = e.errorAction; + if (!i) return; + const { flags: n, hdcpLevel: r, nextAutoLevel: a } = i; + switch (n) { + case it.None: + this.switchLevel(e, a); + break; + case it.MoveAllAlternatesMatchingHost: + i.resolved || (i.resolved = this.redundantFailover(e)); + break; + case it.MoveAllAlternatesMatchingHDCP: + r && ((t.maxHdcpLevel = sr[sr.indexOf(r) - 1]), (i.resolved = !0)), + this.warn( + `Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower` + ); + break; + } + i.resolved || this.switchLevel(e, a); + } + switchLevel(e, t) { + t !== void 0 && + e.errorAction && + (this.warn(`switching to level ${t} after ${e.details}`), + (this.hls.nextAutoLevel = t), + (e.errorAction.resolved = !0), + (this.hls.nextLoadLevel = this.hls.nextAutoLevel)); + } + redundantFailover(e) { + const { hls: t, penalizedRenditions: i } = this, + n = e.parent === se.MAIN ? e.level : t.loadLevel, + r = t.levels[n], + a = r.url.length, + o = e.frag ? e.frag.urlId : r.urlId; + r.urlId === o && (!e.frag || r.details) && this.penalizeRendition(r, e); + for (let l = 1; l < a; l++) { + const u = (o + l) % a, + c = i[u]; + if (!c || Hh(c, e, i[o])) + return ( + this.warn( + `Switching to Redundant Stream ${u + 1}/${a}: "${ + r.url[u] + }" after ${e.details}` + ), + (this.playlistError = 0), + t.levels.forEach((d) => { + d.urlId = u; + }), + (t.nextLoadLevel = n), + !0 + ); + } + return !1; + } + penalizeRendition(e, t) { + const { penalizedRenditions: i } = this, + n = i[e.urlId] || { lastErrorPerfMs: 0, errors: [], details: void 0 }; + (n.lastErrorPerfMs = performance.now()), + n.errors.push(t), + (n.details = e.details), + (i[e.urlId] = n); + } + } + function Hh(s, e, t) { + if (performance.now() - s.lastErrorPerfMs > Gh) return !0; + const i = s.details; + if (e.details === $.FRAG_GAP && i && e.frag) { + const n = e.frag.start, + r = Li(null, i.fragments, n); + if (r && !r.gap) return !0; + } + if (t && s.errors.length < t.errors.length) { + const n = s.errors[s.errors.length - 1]; + if ( + i && + n.frag && + e.frag && + Math.abs(n.frag.start - e.frag.start) > i.targetduration * 3 + ) + return !0; + } + return !1; + } + class cr { + constructor(e, t) { + (this.hls = void 0), + (this.timer = -1), + (this.requestScheduled = -1), + (this.canLoad = !1), + (this.log = void 0), + (this.warn = void 0), + (this.log = D.log.bind(D, `${t}:`)), + (this.warn = D.warn.bind(D, `${t}:`)), + (this.hls = e); + } + destroy() { + this.clearTimer(), (this.hls = this.log = this.warn = null); + } + clearTimer() { + clearTimeout(this.timer), (this.timer = -1); + } + startLoad() { + (this.canLoad = !0), (this.requestScheduled = -1), this.loadPlaylist(); + } + stopLoad() { + (this.canLoad = !1), this.clearTimer(); + } + switchParams(e, t) { + const i = t == null ? void 0 : t.renditionReports; + if (i) { + let n = -1; + for (let r = 0; r < i.length; r++) { + const a = i[r]; + let o; + try { + o = new self.URL(a.URI, t.url).href; + } catch (l) { + D.warn(`Could not construct new URL for Rendition Report: ${l}`), + (o = a.URI || ""); + } + if (o === e) { + n = r; + break; + } else o === e.substring(0, o.length) && (n = r); + } + if (n !== -1) { + const r = i[n], + a = parseInt(r["LAST-MSN"]) || (t == null ? void 0 : t.lastPartSn); + let o = + parseInt(r["LAST-PART"]) || (t == null ? void 0 : t.lastPartIndex); + if (this.hls.config.lowLatencyMode) { + const l = Math.min(t.age - t.partTarget, t.targetduration); + o >= 0 && l > t.partTarget && (o += 1); + } + return new Ua(a, o >= 0 ? o : void 0, Ci.No); + } + } + } + loadPlaylist(e) { + this.requestScheduled === -1 && + (this.requestScheduled = self.performance.now()); + } + shouldLoadPlaylist(e) { + return this.canLoad && !!e && !!e.url && (!e.details || e.details.live); + } + shouldReloadPlaylist(e) { + return ( + this.timer === -1 && + this.requestScheduled === -1 && + this.shouldLoadPlaylist(e) + ); + } + playlistLoaded(e, t, i) { + const { details: n, stats: r } = t, + a = self.performance.now(), + o = r.loading.first ? Math.max(0, a - r.loading.first) : 0; + if ( + ((n.advancedDateTime = Date.now() - o), n.live || (i != null && i.live)) + ) { + if ( + (n.reloaded(i), + i && + this.log( + `live playlist ${e} ${ + n.advanced + ? "REFRESHED " + n.lastPartSn + "-" + n.lastPartIndex + : "MISSED" + }` + ), + i && n.fragments.length > 0 && wh(i, n), + !this.canLoad || !n.live) + ) + return; + let l, u, c; + if (n.canBlockReload && n.endSN && n.advanced) { + const T = this.hls.config.lowLatencyMode, + x = n.lastPartSn, + I = n.endSN, + L = n.lastPartIndex, + M = L !== -1, + O = x === I, + j = T ? 0 : L; + M ? ((u = O ? I + 1 : x), (c = O ? j : L + 1)) : (u = I + 1); + const U = n.age, + Y = U + n.ageHeader; + let _ = Math.min(Y - n.partTarget, n.targetduration * 1.5); + if (_ > 0) { + if (i && _ > i.tuneInGoal) + this.warn( + `CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${_} with playlist age: ${n.age}` + ), + (_ = 0); + else { + const E = Math.floor(_ / n.targetduration); + if (((u += E), c !== void 0)) { + const w = Math.round((_ % n.targetduration) / n.partTarget); + c += w; + } + this.log( + `CDN Tune-in age: ${n.ageHeader}s last advanced ${U.toFixed( + 2 + )}s goal: ${_} skip sn ${E} to part ${c}` + ); + } + n.tuneInGoal = _; + } + if ( + ((l = this.getDeliveryDirectives(n, t.deliveryDirectives, u, c)), + T || !O) + ) { + this.loadPlaylist(l); + return; + } + } else + n.canBlockReload && + (l = this.getDeliveryDirectives(n, t.deliveryDirectives, u, c)); + const d = this.hls.mainForwardBufferInfo, + f = d ? d.end - d.len : 0, + g = (n.edge - f) * 1e3, + p = Fh(n, g); + n.updated && + a > this.requestScheduled + p && + (this.requestScheduled = r.loading.start), + u !== void 0 && n.canBlockReload + ? (this.requestScheduled = + r.loading.first + p - (n.partTarget * 1e3 || 1e3)) + : this.requestScheduled === -1 || this.requestScheduled + p < a + ? (this.requestScheduled = a) + : this.requestScheduled - a <= 0 && (this.requestScheduled += p); + let v = this.requestScheduled - a; + (v = Math.max(0, v)), + this.log(`reload live playlist ${e} in ${Math.round(v)} ms`), + (this.timer = self.setTimeout(() => this.loadPlaylist(l), v)); + } else this.clearTimer(); + } + getDeliveryDirectives(e, t, i, n) { + let r = Ph(e, i); + return ( + t != null && + t.skip && + e.deltaUpdateFailed && + ((i = t.msn), (n = t.part), (r = Ci.No)), + new Ua(i, n, r) + ); + } + checkRetry(e) { + const t = e.details, + i = nn(e), + n = e.errorAction, + { action: r, retryCount: a = 0, retryConfig: o } = n || {}, + l = + !!n && + !!o && + (r === Ge.RetryRequest || + (!n.resolved && r === Ge.SendAlternateToPenaltyBox)); + if (l) { + var u; + if (((this.requestScheduled = -1), a >= o.maxNumRetry)) return !1; + if (i && (u = e.context) != null && u.deliveryDirectives) + this.warn( + `Retrying playlist loading ${a + 1}/${ + o.maxNumRetry + } after "${t}" without delivery-directives` + ), + this.loadPlaylist(); + else { + const c = lr(o, a); + (this.timer = self.setTimeout(() => this.loadPlaylist(), c)), + this.warn( + `Retrying playlist loading ${a + 1}/${ + o.maxNumRetry + } after "${t}" in ${c}ms` + ); + } + (e.levelRetry = !0), (n.resolved = !0); + } + return l; + } + } + let hr; + class Yh extends cr { + constructor(e, t) { + super(e, "[level-controller]"), + (this._levels = []), + (this._firstLevel = -1), + (this._startLevel = void 0), + (this.currentLevel = null), + (this.currentLevelIndex = -1), + (this.manualLevelIndex = -1), + (this.steering = void 0), + (this.onParsedComplete = void 0), + (this.steering = t), + this._registerListeners(); + } + _registerListeners() { + const { hls: e } = this; + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.MANIFEST_LOADED, this.onManifestLoaded, this), + e.on(y.LEVEL_LOADED, this.onLevelLoaded, this), + e.on(y.LEVELS_UPDATED, this.onLevelsUpdated, this), + e.on(y.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), + e.on(y.FRAG_LOADED, this.onFragLoaded, this), + e.on(y.ERROR, this.onError, this); + } + _unregisterListeners() { + const { hls: e } = this; + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.MANIFEST_LOADED, this.onManifestLoaded, this), + e.off(y.LEVEL_LOADED, this.onLevelLoaded, this), + e.off(y.LEVELS_UPDATED, this.onLevelsUpdated, this), + e.off(y.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), + e.off(y.FRAG_LOADED, this.onFragLoaded, this), + e.off(y.ERROR, this.onError, this); + } + destroy() { + this._unregisterListeners(), + (this.steering = null), + this.resetLevels(), + super.destroy(); + } + startLoad() { + this._levels.forEach((t) => { + (t.loadError = 0), (t.fragmentError = 0); + }), + super.startLoad(); + } + resetLevels() { + (this._startLevel = void 0), + (this.manualLevelIndex = -1), + (this.currentLevelIndex = -1), + (this.currentLevel = null), + (this._levels = []); + } + onManifestLoading(e, t) { + this.resetLevels(); + } + onManifestLoaded(e, t) { + const i = [], + n = {}; + let r; + t.levels.forEach((a) => { + var o; + const l = a.attrs; + ((o = a.audioCodec) == null ? void 0 : o.indexOf("mp4a.40.34")) !== + -1 && + (hr || (hr = /chrome|firefox/i.test(navigator.userAgent)), + hr && (a.audioCodec = void 0)); + const { + AUDIO: u, + CODECS: c, + "FRAME-RATE": d, + "PATHWAY-ID": f, + RESOLUTION: g, + SUBTITLES: p, + } = l, + T = `${`${f || "."}-`}${a.bitrate}-${g}-${d}-${c}`; + (r = n[T]), + r ? r.addFallback(a) : ((r = new xi(a)), (n[T] = r), i.push(r)), + sn(r, "audio", u), + sn(r, "text", p); + }), + this.filterAndSortMediaOptions(i, t); + } + filterAndSortMediaOptions(e, t) { + let i = [], + n = [], + r = !1, + a = !1, + o = !1, + l = e.filter( + ({ + audioCodec: g, + videoCodec: p, + width: v, + height: T, + unknownCodecs: x, + }) => ( + r || (r = !!(v && T)), + a || (a = !!p), + o || (o = !!g), + !(x != null && x.length) && + (!g || er(g, "audio")) && + (!p || er(p, "video")) + ) + ); + if ( + ((r || a) && + o && + (l = l.filter( + ({ videoCodec: g, width: p, height: v }) => !!g || !!(p && v) + )), + l.length === 0) + ) { + Promise.resolve().then(() => { + if (this.hls) { + const g = new Error( + "no level with compatible codecs found in manifest" + ); + this.hls.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.MANIFEST_INCOMPATIBLE_CODECS_ERROR, + fatal: !0, + url: t.url, + error: g, + reason: g.message, + }); + } + }); + return; + } + t.audioTracks && + ((i = t.audioTracks.filter( + (g) => !g.audioCodec || er(g.audioCodec, "audio") + )), + Wa(i)), + t.subtitles && ((n = t.subtitles), Wa(n)); + const u = l.slice(0); + l.sort((g, p) => + g.attrs["HDCP-LEVEL"] !== p.attrs["HDCP-LEVEL"] + ? (g.attrs["HDCP-LEVEL"] || "") > (p.attrs["HDCP-LEVEL"] || "") + ? 1 + : -1 + : g.bitrate !== p.bitrate + ? g.bitrate - p.bitrate + : g.attrs["FRAME-RATE"] !== p.attrs["FRAME-RATE"] + ? g.attrs.decimalFloatingPoint("FRAME-RATE") - + p.attrs.decimalFloatingPoint("FRAME-RATE") + : g.attrs.SCORE !== p.attrs.SCORE + ? g.attrs.decimalFloatingPoint("SCORE") - + p.attrs.decimalFloatingPoint("SCORE") + : r && g.height !== p.height + ? g.height - p.height + : 0 + ); + let c = u[0]; + if ( + this.steering && + ((l = this.steering.filterParsedLevels(l)), l.length !== u.length) + ) { + for (let g = 0; g < u.length; g++) + if (u[g].pathwayId === l[0].pathwayId) { + c = u[g]; + break; + } + } + this._levels = l; + for (let g = 0; g < l.length; g++) + if (l[g] === c) { + (this._firstLevel = g), + this.log( + `manifest loaded, ${l.length} level(s) found, first bitrate: ${c.bitrate}` + ); + break; + } + const d = o && !a, + f = { + levels: l, + audioTracks: i, + subtitleTracks: n, + sessionData: t.sessionData, + sessionKeys: t.sessionKeys, + firstLevel: this._firstLevel, + stats: t.stats, + audio: o, + video: a, + altAudio: !d && i.some((g) => !!g.url), + }; + this.hls.trigger(y.MANIFEST_PARSED, f), + (this.hls.config.autoStartLoad || this.hls.forceStartLoad) && + this.hls.startLoad(this.hls.config.startPosition); + } + get levels() { + return this._levels.length === 0 ? null : this._levels; + } + get level() { + return this.currentLevelIndex; + } + set level(e) { + const t = this._levels; + if (t.length === 0) return; + if (e < 0 || e >= t.length) { + const c = new Error("invalid level idx"), + d = e < 0; + if ( + (this.hls.trigger(y.ERROR, { + type: re.OTHER_ERROR, + details: $.LEVEL_SWITCH_ERROR, + level: e, + fatal: d, + error: c, + reason: c.message, + }), + d) + ) + return; + e = Math.min(e, t.length - 1); + } + const i = this.currentLevelIndex, + n = this.currentLevel, + r = n ? n.attrs["PATHWAY-ID"] : void 0, + a = t[e], + o = a.attrs["PATHWAY-ID"]; + if ( + ((this.currentLevelIndex = e), + (this.currentLevel = a), + i === e && a.details && n && r === o) + ) + return; + this.log( + `Switching to level ${e}${ + o ? " with Pathway " + o : "" + } from level ${i}${r ? " with Pathway " + r : ""}` + ); + const l = Fe({}, a, { + level: e, + maxBitrate: a.maxBitrate, + attrs: a.attrs, + uri: a.uri, + urlId: a.urlId, + }); + delete l._attrs, delete l._urlId, this.hls.trigger(y.LEVEL_SWITCHING, l); + const u = a.details; + if (!u || u.live) { + const c = this.switchParams(a.uri, n == null ? void 0 : n.details); + this.loadPlaylist(c); + } + } + get manualLevel() { + return this.manualLevelIndex; + } + set manualLevel(e) { + (this.manualLevelIndex = e), + this._startLevel === void 0 && (this._startLevel = e), + e !== -1 && (this.level = e); + } + get firstLevel() { + return this._firstLevel; + } + set firstLevel(e) { + this._firstLevel = e; + } + get startLevel() { + if (this._startLevel === void 0) { + const e = this.hls.config.startLevel; + return e !== void 0 ? e : this._firstLevel; + } else return this._startLevel; + } + set startLevel(e) { + this._startLevel = e; + } + onError(e, t) { + t.fatal || + !t.context || + (t.context.type === de.LEVEL && + t.context.level === this.level && + this.checkRetry(t)); + } + onFragLoaded(e, { frag: t }) { + if (t !== void 0 && t.type === se.MAIN) { + const i = this._levels[t.level]; + i !== void 0 && (i.loadError = 0); + } + } + onLevelLoaded(e, t) { + var i; + const { level: n, details: r } = t, + a = this._levels[n]; + if (!a) { + var o; + this.warn(`Invalid level index ${n}`), + (o = t.deliveryDirectives) != null && + o.skip && + (r.deltaUpdateFailed = !0); + return; + } + n === this.currentLevelIndex + ? (a.fragmentError === 0 && (a.loadError = 0), + this.playlistLoaded(n, t, a.details)) + : (i = t.deliveryDirectives) != null && + i.skip && + (r.deltaUpdateFailed = !0); + } + onAudioTrackSwitched(e, t) { + const i = this.currentLevel; + if (!i) return; + const n = this.hls.audioTracks[t.id].groupId; + if (i.audioGroupIds && i.audioGroupId !== n) { + let r = -1; + for (let a = 0; a < i.audioGroupIds.length; a++) + if (i.audioGroupIds[a] === n) { + r = a; + break; + } + r !== -1 && + r !== i.urlId && + ((i.urlId = r), this.canLoad && this.startLoad()); + } + } + loadPlaylist(e) { + super.loadPlaylist(); + const t = this.currentLevelIndex, + i = this.currentLevel; + if (i && this.shouldLoadPlaylist(i)) { + const n = i.urlId; + let r = i.uri; + if (e) + try { + r = e.addDirectives(r); + } catch (o) { + this.warn( + `Could not construct new URL with HLS Delivery Directives: ${o}` + ); + } + const a = i.attrs["PATHWAY-ID"]; + this.log( + `Loading level index ${t}${ + (e == null ? void 0 : e.msn) !== void 0 + ? " at sn " + e.msn + " part " + e.part + : "" + } with${a ? " Pathway " + a : ""} URI ${n + 1}/${i.url.length} ${r}` + ), + this.clearTimer(), + this.hls.trigger(y.LEVEL_LOADING, { + url: r, + level: t, + id: n, + deliveryDirectives: e || null, + }); + } + } + get nextLoadLevel() { + return this.manualLevelIndex !== -1 + ? this.manualLevelIndex + : this.hls.nextAutoLevel; + } + set nextLoadLevel(e) { + (this.level = e), + this.manualLevelIndex === -1 && (this.hls.nextAutoLevel = e); + } + removeLevel(e, t) { + const i = (r, a) => a !== t, + n = this._levels.filter((r, a) => + a !== e + ? !0 + : r.url.length > 1 && t !== void 0 + ? ((r.url = r.url.filter(i)), + r.audioGroupIds && (r.audioGroupIds = r.audioGroupIds.filter(i)), + r.textGroupIds && (r.textGroupIds = r.textGroupIds.filter(i)), + (r.urlId = 0), + !0) + : (this.steering && this.steering.removeLevel(r), !1) + ); + this.hls.trigger(y.LEVELS_UPDATED, { levels: n }); + } + onLevelsUpdated(e, { levels: t }) { + t.forEach((i, n) => { + const { details: r } = i; + r != null && + r.fragments && + r.fragments.forEach((a) => { + a.level = n; + }); + }), + (this._levels = t); + } + } + function sn(s, e, t) { + t && + (e === "audio" + ? (s.audioGroupIds || (s.audioGroupIds = []), + (s.audioGroupIds[s.url.length - 1] = t)) + : e === "text" && + (s.textGroupIds || (s.textGroupIds = []), + (s.textGroupIds[s.url.length - 1] = t))); + } + function Wa(s) { + const e = {}; + s.forEach((t) => { + const i = t.groupId || ""; + (t.id = e[i] = e[i] || 0), e[i]++; + }); + } + var Be = { + NOT_LOADED: "NOT_LOADED", + APPENDING: "APPENDING", + PARTIAL: "PARTIAL", + OK: "OK", + }; + class zh { + constructor(e) { + (this.activePartLists = Object.create(null)), + (this.endListFragments = Object.create(null)), + (this.fragments = Object.create(null)), + (this.timeRanges = Object.create(null)), + (this.bufferPadding = 0.2), + (this.hls = void 0), + (this.hasGaps = !1), + (this.hls = e), + this._registerListeners(); + } + _registerListeners() { + const { hls: e } = this; + e.on(y.BUFFER_APPENDED, this.onBufferAppended, this), + e.on(y.FRAG_BUFFERED, this.onFragBuffered, this), + e.on(y.FRAG_LOADED, this.onFragLoaded, this); + } + _unregisterListeners() { + const { hls: e } = this; + e.off(y.BUFFER_APPENDED, this.onBufferAppended, this), + e.off(y.FRAG_BUFFERED, this.onFragBuffered, this), + e.off(y.FRAG_LOADED, this.onFragLoaded, this); + } + destroy() { + this._unregisterListeners(), + (this.fragments = + this.activePartLists = + this.endListFragments = + this.timeRanges = + null); + } + getAppendedFrag(e, t) { + const i = this.activePartLists[t]; + if (i) + for (let n = i.length; n--; ) { + const r = i[n]; + if (!r) break; + const a = r.end; + if (r.start <= e && a !== null && e <= a) return r; + } + return this.getBufferedFrag(e, t); + } + getBufferedFrag(e, t) { + const { fragments: i } = this, + n = Object.keys(i); + for (let r = n.length; r--; ) { + const a = i[n[r]]; + if ((a == null ? void 0 : a.body.type) === t && a.buffered) { + const o = a.body; + if (o.start <= e && e <= o.end) return o; + } + } + return null; + } + detectEvictedFragments(e, t, i, n) { + this.timeRanges && (this.timeRanges[e] = t); + const r = (n == null ? void 0 : n.fragment.sn) || -1; + Object.keys(this.fragments).forEach((a) => { + const o = this.fragments[a]; + if (!o || r >= o.body.sn) return; + if (!o.buffered && !o.loaded) { + o.body.type === i && this.removeFragment(o.body); + return; + } + const l = o.range[e]; + l && + l.time.some((u) => { + const c = !this.isTimeBuffered(u.startPTS, u.endPTS, t); + return c && this.removeFragment(o.body), c; + }); + }); + } + detectPartialFragments(e) { + const t = this.timeRanges, + { frag: i, part: n } = e; + if (!t || i.sn === "initSegment") return; + const r = di(i), + a = this.fragments[r]; + if (!a || (a.buffered && i.gap)) return; + const o = !i.relurl; + Object.keys(t).forEach((l) => { + const u = i.elementaryStreams[l]; + if (!u) return; + const c = t[l], + d = o || u.partial === !0; + a.range[l] = this.getBufferedTimes(i, n, d, c); + }), + (a.loaded = null), + Object.keys(a.range).length + ? ((a.buffered = !0), + a.body.endList && (this.endListFragments[a.body.type] = a), + an(a) || this.removeParts(i.sn - 1, i.type)) + : this.removeFragment(a.body); + } + removeParts(e, t) { + const i = this.activePartLists[t]; + i && (this.activePartLists[t] = i.filter((n) => n.fragment.sn >= e)); + } + fragBuffered(e, t) { + const i = di(e); + let n = this.fragments[i]; + !n && + t && + ((n = this.fragments[i] = + { + body: e, + appendedPTS: null, + loaded: null, + buffered: !1, + range: Object.create(null), + }), + e.gap && (this.hasGaps = !0)), + n && ((n.loaded = null), (n.buffered = !0)); + } + getBufferedTimes(e, t, i, n) { + const r = { time: [], partial: i }, + a = e.start, + o = e.end, + l = e.minEndPTS || o, + u = e.maxStartPTS || a; + for (let c = 0; c < n.length; c++) { + const d = n.start(c) - this.bufferPadding, + f = n.end(c) + this.bufferPadding; + if (u >= d && l <= f) { + r.time.push({ + startPTS: Math.max(a, n.start(c)), + endPTS: Math.min(o, n.end(c)), + }); + break; + } else if (a < f && o > d) + (r.partial = !0), + r.time.push({ + startPTS: Math.max(a, n.start(c)), + endPTS: Math.min(o, n.end(c)), + }); + else if (o <= d) break; + } + return r; + } + getPartialFragment(e) { + let t = null, + i, + n, + r, + a = 0; + const { bufferPadding: o, fragments: l } = this; + return ( + Object.keys(l).forEach((u) => { + const c = l[u]; + c && + an(c) && + ((n = c.body.start - o), + (r = c.body.end + o), + e >= n && + e <= r && + ((i = Math.min(e - n, r - e)), + a <= i && ((t = c.body), (a = i)))); + }), + t + ); + } + isEndListAppended(e) { + const t = this.endListFragments[e]; + return t !== void 0 && (t.buffered || an(t)); + } + getState(e) { + const t = di(e), + i = this.fragments[t]; + return i + ? i.buffered + ? an(i) + ? Be.PARTIAL + : Be.OK + : Be.APPENDING + : Be.NOT_LOADED; + } + isTimeBuffered(e, t, i) { + let n, r; + for (let a = 0; a < i.length; a++) { + if ( + ((n = i.start(a) - this.bufferPadding), + (r = i.end(a) + this.bufferPadding), + e >= n && t <= r) + ) + return !0; + if (t <= n) return !1; + } + return !1; + } + onFragLoaded(e, t) { + const { frag: i, part: n } = t; + if (i.sn === "initSegment" || i.bitrateTest) return; + const r = n ? null : t, + a = di(i); + this.fragments[a] = { + body: i, + appendedPTS: null, + loaded: r, + buffered: !1, + range: Object.create(null), + }; + } + onBufferAppended(e, t) { + const { frag: i, part: n, timeRanges: r } = t; + if (i.sn === "initSegment") return; + const a = i.type; + if (n) { + let o = this.activePartLists[a]; + o || (this.activePartLists[a] = o = []), o.push(n); + } + (this.timeRanges = r), + Object.keys(r).forEach((o) => { + const l = r[o]; + this.detectEvictedFragments(o, l, a, n); + }); + } + onFragBuffered(e, t) { + this.detectPartialFragments(t); + } + hasFragment(e) { + const t = di(e); + return !!this.fragments[t]; + } + hasParts(e) { + var t; + return !!((t = this.activePartLists[e]) != null && t.length); + } + removeFragmentsInRange(e, t, i, n, r) { + (n && !this.hasGaps) || + Object.keys(this.fragments).forEach((a) => { + const o = this.fragments[a]; + if (!o) return; + const l = o.body; + l.type !== i || + (n && !l.gap) || + (l.start < t && + l.end > e && + (o.buffered || r) && + this.removeFragment(l)); + }); + } + removeFragment(e) { + const t = di(e); + (e.stats.loaded = 0), e.clearElementaryStreamInfo(); + const i = this.activePartLists[e.type]; + if (i) { + const n = e.sn; + this.activePartLists[e.type] = i.filter((r) => r.fragment.sn !== n); + } + delete this.fragments[t], + e.endList && delete this.endListFragments[e.type]; + } + removeAllFragments() { + (this.fragments = Object.create(null)), + (this.endListFragments = Object.create(null)), + (this.activePartLists = Object.create(null)), + (this.hasGaps = !1); + } + } + function an(s) { + var e, t, i; + return ( + s.buffered && + (s.body.gap || + ((e = s.range.video) == null ? void 0 : e.partial) || + ((t = s.range.audio) == null ? void 0 : t.partial) || + ((i = s.range.audiovideo) == null ? void 0 : i.partial)) + ); + } + function di(s) { + return `${s.type}_${s.level}_${s.urlId}_${s.sn}`; + } + const ja = Math.pow(2, 17); + class Wh { + constructor(e) { + (this.config = void 0), + (this.loader = null), + (this.partLoadTimeout = -1), + (this.config = e); + } + destroy() { + this.loader && (this.loader.destroy(), (this.loader = null)); + } + abort() { + this.loader && this.loader.abort(); + } + load(e, t) { + const i = e.url; + if (!i) + return Promise.reject( + new bt({ + type: re.NETWORK_ERROR, + details: $.FRAG_LOAD_ERROR, + fatal: !1, + frag: e, + error: new Error( + `Fragment does not have a ${i ? "part list" : "url"}` + ), + networkDetails: null, + }) + ); + this.abort(); + const n = this.config, + r = n.fLoader, + a = n.loader; + return new Promise((o, l) => { + if ((this.loader && this.loader.destroy(), e.gap)) + if (e.tagList.some((g) => g[0] === "GAP")) { + l(Xa(e)); + return; + } else e.gap = !1; + const u = (this.loader = e.loader = r ? new r(n) : new a(n)), + c = qa(e), + d = Ya(n.fragLoadPolicy.default), + f = { + loadPolicy: d, + timeout: d.maxLoadTimeMs, + maxRetry: 0, + retryDelay: 0, + maxRetryDelay: 0, + highWaterMark: e.sn === "initSegment" ? 1 / 0 : ja, + }; + (e.stats = u.stats), + u.load(c, f, { + onSuccess: (g, p, v, T) => { + this.resetLoader(e, u); + let x = g.data; + v.resetIV && + e.decryptdata && + ((e.decryptdata.iv = new Uint8Array(x.slice(0, 16))), + (x = x.slice(16))), + o({ frag: e, part: null, payload: x, networkDetails: T }); + }, + onError: (g, p, v, T) => { + this.resetLoader(e, u), + l( + new bt({ + type: re.NETWORK_ERROR, + details: $.FRAG_LOAD_ERROR, + fatal: !1, + frag: e, + response: We({ url: i, data: void 0 }, g), + error: new Error(`HTTP Error ${g.code} ${g.text}`), + networkDetails: v, + stats: T, + }) + ); + }, + onAbort: (g, p, v) => { + this.resetLoader(e, u), + l( + new bt({ + type: re.NETWORK_ERROR, + details: $.INTERNAL_ABORTED, + fatal: !1, + frag: e, + error: new Error("Aborted"), + networkDetails: v, + stats: g, + }) + ); + }, + onTimeout: (g, p, v) => { + this.resetLoader(e, u), + l( + new bt({ + type: re.NETWORK_ERROR, + details: $.FRAG_LOAD_TIMEOUT, + fatal: !1, + frag: e, + error: new Error(`Timeout after ${f.timeout}ms`), + networkDetails: v, + stats: g, + }) + ); + }, + onProgress: (g, p, v, T) => { + t && t({ frag: e, part: null, payload: v, networkDetails: T }); + }, + }); + }); + } + loadPart(e, t, i) { + this.abort(); + const n = this.config, + r = n.fLoader, + a = n.loader; + return new Promise((o, l) => { + if ((this.loader && this.loader.destroy(), e.gap || t.gap)) { + l(Xa(e, t)); + return; + } + const u = (this.loader = e.loader = r ? new r(n) : new a(n)), + c = qa(e, t), + d = Ya(n.fragLoadPolicy.default), + f = { + loadPolicy: d, + timeout: d.maxLoadTimeMs, + maxRetry: 0, + retryDelay: 0, + maxRetryDelay: 0, + highWaterMark: ja, + }; + (t.stats = u.stats), + u.load(c, f, { + onSuccess: (g, p, v, T) => { + this.resetLoader(e, u), this.updateStatsFromPart(e, t); + const x = { + frag: e, + part: t, + payload: g.data, + networkDetails: T, + }; + i(x), o(x); + }, + onError: (g, p, v, T) => { + this.resetLoader(e, u), + l( + new bt({ + type: re.NETWORK_ERROR, + details: $.FRAG_LOAD_ERROR, + fatal: !1, + frag: e, + part: t, + response: We({ url: c.url, data: void 0 }, g), + error: new Error(`HTTP Error ${g.code} ${g.text}`), + networkDetails: v, + stats: T, + }) + ); + }, + onAbort: (g, p, v) => { + (e.stats.aborted = t.stats.aborted), + this.resetLoader(e, u), + l( + new bt({ + type: re.NETWORK_ERROR, + details: $.INTERNAL_ABORTED, + fatal: !1, + frag: e, + part: t, + error: new Error("Aborted"), + networkDetails: v, + stats: g, + }) + ); + }, + onTimeout: (g, p, v) => { + this.resetLoader(e, u), + l( + new bt({ + type: re.NETWORK_ERROR, + details: $.FRAG_LOAD_TIMEOUT, + fatal: !1, + frag: e, + part: t, + error: new Error(`Timeout after ${f.timeout}ms`), + networkDetails: v, + stats: g, + }) + ); + }, + }); + }); + } + updateStatsFromPart(e, t) { + const i = e.stats, + n = t.stats, + r = n.total; + if (((i.loaded += n.loaded), r)) { + const l = Math.round(e.duration / t.duration), + u = Math.min(Math.round(i.loaded / r), l), + d = (l - u) * Math.round(i.loaded / u); + i.total = i.loaded + d; + } else i.total = Math.max(i.loaded, i.total); + const a = i.loading, + o = n.loading; + a.start + ? (a.first += o.first - o.start) + : ((a.start = o.start), (a.first = o.first)), + (a.end = o.end); + } + resetLoader(e, t) { + (e.loader = null), + this.loader === t && + (self.clearTimeout(this.partLoadTimeout), (this.loader = null)), + t.destroy(); + } + } + function qa(s, e = null) { + const t = e || s, + i = { + frag: s, + part: e, + responseType: "arraybuffer", + url: t.url, + headers: {}, + rangeStart: 0, + rangeEnd: 0, + }, + n = t.byteRangeStartOffset, + r = t.byteRangeEndOffset; + if (ne(n) && ne(r)) { + var a; + let o = n, + l = r; + if ( + s.sn === "initSegment" && + ((a = s.decryptdata) == null ? void 0 : a.method) === "AES-128" + ) { + const u = r - n; + u % 16 && (l = r + (16 - (u % 16))), + n !== 0 && ((i.resetIV = !0), (o = n - 16)); + } + (i.rangeStart = o), (i.rangeEnd = l); + } + return i; + } + function Xa(s, e) { + const t = new Error(`GAP ${s.gap ? "tag" : "attribute"} found`), + i = { + type: re.MEDIA_ERROR, + details: $.FRAG_GAP, + fatal: !1, + frag: s, + error: t, + networkDetails: null, + }; + return e && (i.part = e), ((e || s).stats.aborted = !0), new bt(i); + } + class bt extends Error { + constructor(e) { + super(e.error.message), (this.data = void 0), (this.data = e); + } + } + class jh { + constructor(e) { + (this.config = void 0), + (this.keyUriToKeyInfo = {}), + (this.emeController = null), + (this.config = e); + } + abort(e) { + for (const t in this.keyUriToKeyInfo) { + const i = this.keyUriToKeyInfo[t].loader; + if (i) { + if (e && e !== i.context.frag.type) return; + i.abort(); + } + } + } + detach() { + for (const e in this.keyUriToKeyInfo) { + const t = this.keyUriToKeyInfo[e]; + (t.mediaKeySessionContext || t.decryptdata.isCommonEncryption) && + delete this.keyUriToKeyInfo[e]; + } + } + destroy() { + this.detach(); + for (const e in this.keyUriToKeyInfo) { + const t = this.keyUriToKeyInfo[e].loader; + t && t.destroy(); + } + this.keyUriToKeyInfo = {}; + } + createKeyLoadError(e, t = $.KEY_LOAD_ERROR, i, n, r) { + return new bt({ + type: re.NETWORK_ERROR, + details: t, + fatal: !1, + frag: e, + response: r, + error: i, + networkDetails: n, + }); + } + loadClear(e, t) { + if (this.emeController && this.config.emeEnabled) { + const { sn: i, cc: n } = e; + for (let r = 0; r < t.length; r++) { + const a = t[r]; + if ( + n <= a.cc && + (i === "initSegment" || a.sn === "initSegment" || i < a.sn) + ) { + this.emeController.selectKeySystemFormat(a).then((o) => { + a.setKeyFormat(o); + }); + break; + } + } + } + } + load(e) { + return !e.decryptdata && e.encrypted && this.emeController + ? this.emeController + .selectKeySystemFormat(e) + .then((t) => this.loadInternal(e, t)) + : this.loadInternal(e); + } + loadInternal(e, t) { + var i, n; + t && e.setKeyFormat(t); + const r = e.decryptdata; + if (!r) { + const u = new Error( + t + ? `Expected frag.decryptdata to be defined after setting format ${t}` + : "Missing decryption data on fragment in onKeyLoading" + ); + return Promise.reject(this.createKeyLoadError(e, $.KEY_LOAD_ERROR, u)); + } + const a = r.uri; + if (!a) + return Promise.reject( + this.createKeyLoadError( + e, + $.KEY_LOAD_ERROR, + new Error(`Invalid key URI: "${a}"`) + ) + ); + let o = this.keyUriToKeyInfo[a]; + if ((i = o) != null && i.decryptdata.key) + return ( + (r.key = o.decryptdata.key), Promise.resolve({ frag: e, keyInfo: o }) + ); + if ((n = o) != null && n.keyLoadPromise) { + var l; + switch ((l = o.mediaKeySessionContext) == null ? void 0 : l.keyStatus) { + case void 0: + case "status-pending": + case "usable": + case "usable-in-future": + return o.keyLoadPromise.then( + (u) => ( + (r.key = u.keyInfo.decryptdata.key), { frag: e, keyInfo: o } + ) + ); + } + } + switch ( + ((o = this.keyUriToKeyInfo[a] = + { + decryptdata: r, + keyLoadPromise: null, + loader: null, + mediaKeySessionContext: null, + }), + r.method) + ) { + case "ISO-23001-7": + case "SAMPLE-AES": + case "SAMPLE-AES-CENC": + case "SAMPLE-AES-CTR": + return r.keyFormat === "identity" + ? this.loadKeyHTTP(o, e) + : this.loadKeyEME(o, e); + case "AES-128": + return this.loadKeyHTTP(o, e); + default: + return Promise.reject( + this.createKeyLoadError( + e, + $.KEY_LOAD_ERROR, + new Error(`Key supplied with unsupported METHOD: "${r.method}"`) + ) + ); + } + } + loadKeyEME(e, t) { + const i = { frag: t, keyInfo: e }; + if (this.emeController && this.config.emeEnabled) { + const n = this.emeController.loadKey(i); + if (n) + return (e.keyLoadPromise = n.then( + (r) => ((e.mediaKeySessionContext = r), i) + )).catch((r) => { + throw ((e.keyLoadPromise = null), r); + }); + } + return Promise.resolve(i); + } + loadKeyHTTP(e, t) { + const i = this.config, + n = i.loader, + r = new n(i); + return ( + (t.keyLoader = e.loader = r), + (e.keyLoadPromise = new Promise((a, o) => { + const l = { + keyInfo: e, + frag: t, + responseType: "arraybuffer", + url: e.decryptdata.uri, + }, + u = i.keyLoadPolicy.default, + c = { + loadPolicy: u, + timeout: u.maxLoadTimeMs, + maxRetry: 0, + retryDelay: 0, + maxRetryDelay: 0, + }, + d = { + onSuccess: (f, g, p, v) => { + const { frag: T, keyInfo: x, url: I } = p; + if (!T.decryptdata || x !== this.keyUriToKeyInfo[I]) + return o( + this.createKeyLoadError( + T, + $.KEY_LOAD_ERROR, + new Error("after key load, decryptdata unset or changed"), + v + ) + ); + (x.decryptdata.key = T.decryptdata.key = + new Uint8Array(f.data)), + (T.keyLoader = null), + (x.loader = null), + a({ frag: T, keyInfo: x }); + }, + onError: (f, g, p, v) => { + this.resetLoader(g), + o( + this.createKeyLoadError( + t, + $.KEY_LOAD_ERROR, + new Error(`HTTP Error ${f.code} loading key ${f.text}`), + p, + We({ url: l.url, data: void 0 }, f) + ) + ); + }, + onTimeout: (f, g, p) => { + this.resetLoader(g), + o( + this.createKeyLoadError( + t, + $.KEY_LOAD_TIMEOUT, + new Error("key loading timed out"), + p + ) + ); + }, + onAbort: (f, g, p) => { + this.resetLoader(g), + o( + this.createKeyLoadError( + t, + $.INTERNAL_ABORTED, + new Error("key loading aborted"), + p + ) + ); + }, + }; + r.load(l, c, d); + })) + ); + } + resetLoader(e) { + const { frag: t, keyInfo: i, url: n } = e, + r = i.loader; + t.keyLoader === r && ((t.keyLoader = null), (i.loader = null)), + delete this.keyUriToKeyInfo[n], + r && r.destroy(); + } + } + class qh { + constructor() { + (this._boundTick = void 0), + (this._tickTimer = null), + (this._tickInterval = null), + (this._tickCallCount = 0), + (this._boundTick = this.tick.bind(this)); + } + destroy() { + this.onHandlerDestroying(), this.onHandlerDestroyed(); + } + onHandlerDestroying() { + this.clearNextTick(), this.clearInterval(); + } + onHandlerDestroyed() {} + hasInterval() { + return !!this._tickInterval; + } + hasNextTick() { + return !!this._tickTimer; + } + setInterval(e) { + return this._tickInterval + ? !1 + : ((this._tickCallCount = 0), + (this._tickInterval = self.setInterval(this._boundTick, e)), + !0); + } + clearInterval() { + return this._tickInterval + ? (self.clearInterval(this._tickInterval), + (this._tickInterval = null), + !0) + : !1; + } + clearNextTick() { + return this._tickTimer + ? (self.clearTimeout(this._tickTimer), (this._tickTimer = null), !0) + : !1; + } + tick() { + this._tickCallCount++, + this._tickCallCount === 1 && + (this.doTick(), + this._tickCallCount > 1 && this.tickImmediate(), + (this._tickCallCount = 0)); + } + tickImmediate() { + this.clearNextTick(), + (this._tickTimer = self.setTimeout(this._boundTick, 0)); + } + doTick() {} + } + const Xh = { length: 0, start: () => 0, end: () => 0 }; + class Se { + static isBuffered(e, t) { + try { + if (e) { + const i = Se.getBuffered(e); + for (let n = 0; n < i.length; n++) + if (t >= i.start(n) && t <= i.end(n)) return !0; + } + } catch {} + return !1; + } + static bufferInfo(e, t, i) { + try { + if (e) { + const n = Se.getBuffered(e), + r = []; + let a; + for (a = 0; a < n.length; a++) + r.push({ start: n.start(a), end: n.end(a) }); + return this.bufferedInfo(r, t, i); + } + } catch {} + return { len: 0, start: t, end: t, nextStart: void 0 }; + } + static bufferedInfo(e, t, i) { + (t = Math.max(0, t)), + e.sort(function (u, c) { + const d = u.start - c.start; + return d || c.end - u.end; + }); + let n = []; + if (i) + for (let u = 0; u < e.length; u++) { + const c = n.length; + if (c) { + const d = n[c - 1].end; + e[u].start - d < i + ? e[u].end > d && (n[c - 1].end = e[u].end) + : n.push(e[u]); + } else n.push(e[u]); + } + else n = e; + let r = 0, + a, + o = t, + l = t; + for (let u = 0; u < n.length; u++) { + const c = n[u].start, + d = n[u].end; + if (t + i >= c && t < d) (o = c), (l = d), (r = l - t); + else if (t + i < c) { + a = c; + break; + } + } + return { len: r, start: o || 0, end: l || 0, nextStart: a }; + } + static getBuffered(e) { + try { + return e.buffered; + } catch (t) { + return D.log("failed to get media.buffered", t), Xh; + } + } + } + class dr { + constructor(e, t, i, n = 0, r = -1, a = !1) { + (this.level = void 0), + (this.sn = void 0), + (this.part = void 0), + (this.id = void 0), + (this.size = void 0), + (this.partial = void 0), + (this.transmuxing = on()), + (this.buffering = { audio: on(), video: on(), audiovideo: on() }), + (this.level = e), + (this.sn = t), + (this.id = i), + (this.size = n), + (this.part = r), + (this.partial = a); + } + } + function on() { + return { start: 0, executeStart: 0, executeEnd: 0, end: 0 }; + } + function Za(s, e) { + let t = null; + for (let i = 0, n = s.length; i < n; i++) { + const r = s[i]; + if (r && r.cc === e) { + t = r; + break; + } + } + return t; + } + function Zh(s, e, t) { + return !!(e.details && (t.endCC > t.startCC || (s && s.cc < t.startCC))); + } + function Qh(s, e, t = 0) { + const i = s.fragments, + n = e.fragments; + if (!n.length || !i.length) { + D.log("No fragments to align"); + return; + } + const r = Za(i, n[0].cc); + if (!r || (r && !r.startPTS)) { + D.log("No frag in previous level to align on"); + return; + } + return r; + } + function Qa(s, e) { + if (s) { + const t = s.start + e; + (s.start = s.startPTS = t), (s.endPTS = t + s.duration); + } + } + function fr(s, e) { + const t = e.fragments; + for (let i = 0, n = t.length; i < n; i++) Qa(t[i], s); + e.fragmentHint && Qa(e.fragmentHint, s), (e.alignedSliding = !0); + } + function Jh(s, e, t) { + e && + (ed(s, t, e), + !t.alignedSliding && e.details && td(t, e.details), + !t.alignedSliding && e.details && !t.skippedSegments && Va(e.details, t)); + } + function ed(s, e, t) { + if (Zh(s, t, e)) { + const i = Qh(t.details, e); + i && + ne(i.start) && + (D.log( + `Adjusting PTS using last level due to CC increase within current level ${e.url}` + ), + fr(i.start, e)); + } + } + function td(s, e) { + if (!e.fragments.length || !s.hasProgramDateTime || !e.hasProgramDateTime) + return; + const t = e.fragments[0].programDateTime, + i = s.fragments[0].programDateTime, + n = (i - t) / 1e3 + e.fragments[0].start; + n && + ne(n) && + (D.log( + `Adjusting PTS using programDateTime delta ${ + i - t + }ms, sliding:${n.toFixed(3)} ${s.url} ` + ), + fr(n, s)); + } + function Ja(s, e) { + if (!s.hasProgramDateTime || !e.hasProgramDateTime) return; + const t = s.fragments, + i = e.fragments; + if (!t.length || !i.length) return; + const n = Math.round(i.length / 2) - 1, + r = i[n], + a = Za(t, r.cc) || t[Math.round(t.length / 2) - 1], + o = r.programDateTime, + l = a.programDateTime; + if (o === null || l === null) return; + const u = (l - o) / 1e3 - (a.start - r.start); + fr(u, s); + } + class id { + constructor(e, t) { + (this.subtle = void 0), + (this.aesIV = void 0), + (this.subtle = e), + (this.aesIV = t); + } + decrypt(e, t) { + return this.subtle.decrypt({ name: "AES-CBC", iv: this.aesIV }, t, e); + } + } + class nd { + constructor(e, t) { + (this.subtle = void 0), + (this.key = void 0), + (this.subtle = e), + (this.key = t); + } + expandKey() { + return this.subtle.importKey("raw", this.key, { name: "AES-CBC" }, !1, [ + "encrypt", + "decrypt", + ]); + } + } + function rd(s) { + const e = s.byteLength, + t = e && new DataView(s.buffer).getUint8(e - 1); + return t ? Wt(s, 0, e - t) : s; + } + class sd { + constructor() { + (this.rcon = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54]), + (this.subMix = [ + new Uint32Array(256), + new Uint32Array(256), + new Uint32Array(256), + new Uint32Array(256), + ]), + (this.invSubMix = [ + new Uint32Array(256), + new Uint32Array(256), + new Uint32Array(256), + new Uint32Array(256), + ]), + (this.sBox = new Uint32Array(256)), + (this.invSBox = new Uint32Array(256)), + (this.key = new Uint32Array(0)), + (this.ksRows = 0), + (this.keySize = 0), + (this.keySchedule = void 0), + (this.invKeySchedule = void 0), + this.initTable(); + } + uint8ArrayToUint32Array_(e) { + const t = new DataView(e), + i = new Uint32Array(4); + for (let n = 0; n < 4; n++) i[n] = t.getUint32(n * 4); + return i; + } + initTable() { + const e = this.sBox, + t = this.invSBox, + i = this.subMix, + n = i[0], + r = i[1], + a = i[2], + o = i[3], + l = this.invSubMix, + u = l[0], + c = l[1], + d = l[2], + f = l[3], + g = new Uint32Array(256); + let p = 0, + v = 0, + T = 0; + for (T = 0; T < 256; T++) + T < 128 ? (g[T] = T << 1) : (g[T] = (T << 1) ^ 283); + for (T = 0; T < 256; T++) { + let x = v ^ (v << 1) ^ (v << 2) ^ (v << 3) ^ (v << 4); + (x = (x >>> 8) ^ (x & 255) ^ 99), (e[p] = x), (t[x] = p); + const I = g[p], + L = g[I], + M = g[L]; + let O = (g[x] * 257) ^ (x * 16843008); + (n[p] = (O << 24) | (O >>> 8)), + (r[p] = (O << 16) | (O >>> 16)), + (a[p] = (O << 8) | (O >>> 24)), + (o[p] = O), + (O = (M * 16843009) ^ (L * 65537) ^ (I * 257) ^ (p * 16843008)), + (u[x] = (O << 24) | (O >>> 8)), + (c[x] = (O << 16) | (O >>> 16)), + (d[x] = (O << 8) | (O >>> 24)), + (f[x] = O), + p ? ((p = I ^ g[g[g[M ^ I]]]), (v ^= g[g[v]])) : (p = v = 1); + } + } + expandKey(e) { + const t = this.uint8ArrayToUint32Array_(e); + let i = !0, + n = 0; + for (; n < t.length && i; ) (i = t[n] === this.key[n]), n++; + if (i) return; + this.key = t; + const r = (this.keySize = t.length); + if (r !== 4 && r !== 6 && r !== 8) + throw new Error("Invalid aes key size=" + r); + const a = (this.ksRows = (r + 6 + 1) * 4); + let o, l; + const u = (this.keySchedule = new Uint32Array(a)), + c = (this.invKeySchedule = new Uint32Array(a)), + d = this.sBox, + f = this.rcon, + g = this.invSubMix, + p = g[0], + v = g[1], + T = g[2], + x = g[3]; + let I, L; + for (o = 0; o < a; o++) { + if (o < r) { + I = u[o] = t[o]; + continue; + } + (L = I), + o % r === 0 + ? ((L = (L << 8) | (L >>> 24)), + (L = + (d[L >>> 24] << 24) | + (d[(L >>> 16) & 255] << 16) | + (d[(L >>> 8) & 255] << 8) | + d[L & 255]), + (L ^= f[(o / r) | 0] << 24)) + : r > 6 && + o % r === 4 && + (L = + (d[L >>> 24] << 24) | + (d[(L >>> 16) & 255] << 16) | + (d[(L >>> 8) & 255] << 8) | + d[L & 255]), + (u[o] = I = (u[o - r] ^ L) >>> 0); + } + for (l = 0; l < a; l++) + (o = a - l), + l & 3 ? (L = u[o]) : (L = u[o - 4]), + l < 4 || o <= 4 + ? (c[l] = L) + : (c[l] = + p[d[L >>> 24]] ^ + v[d[(L >>> 16) & 255]] ^ + T[d[(L >>> 8) & 255]] ^ + x[d[L & 255]]), + (c[l] = c[l] >>> 0); + } + networkToHostOrderSwap(e) { + return ( + (e << 24) | ((e & 65280) << 8) | ((e & 16711680) >> 8) | (e >>> 24) + ); + } + decrypt(e, t, i) { + const n = this.keySize + 6, + r = this.invKeySchedule, + a = this.invSBox, + o = this.invSubMix, + l = o[0], + u = o[1], + c = o[2], + d = o[3], + f = this.uint8ArrayToUint32Array_(i); + let g = f[0], + p = f[1], + v = f[2], + T = f[3]; + const x = new Int32Array(e), + I = new Int32Array(x.length); + let L, M, O, j, U, Y, _, E, w, b, S, P, F, V; + const K = this.networkToHostOrderSwap; + for (; t < x.length; ) { + for ( + w = K(x[t]), + b = K(x[t + 1]), + S = K(x[t + 2]), + P = K(x[t + 3]), + U = w ^ r[0], + Y = P ^ r[1], + _ = S ^ r[2], + E = b ^ r[3], + F = 4, + V = 1; + V < n; + V++ + ) + (L = + l[U >>> 24] ^ + u[(Y >> 16) & 255] ^ + c[(_ >> 8) & 255] ^ + d[E & 255] ^ + r[F]), + (M = + l[Y >>> 24] ^ + u[(_ >> 16) & 255] ^ + c[(E >> 8) & 255] ^ + d[U & 255] ^ + r[F + 1]), + (O = + l[_ >>> 24] ^ + u[(E >> 16) & 255] ^ + c[(U >> 8) & 255] ^ + d[Y & 255] ^ + r[F + 2]), + (j = + l[E >>> 24] ^ + u[(U >> 16) & 255] ^ + c[(Y >> 8) & 255] ^ + d[_ & 255] ^ + r[F + 3]), + (U = L), + (Y = M), + (_ = O), + (E = j), + (F = F + 4); + (L = + (a[U >>> 24] << 24) ^ + (a[(Y >> 16) & 255] << 16) ^ + (a[(_ >> 8) & 255] << 8) ^ + a[E & 255] ^ + r[F]), + (M = + (a[Y >>> 24] << 24) ^ + (a[(_ >> 16) & 255] << 16) ^ + (a[(E >> 8) & 255] << 8) ^ + a[U & 255] ^ + r[F + 1]), + (O = + (a[_ >>> 24] << 24) ^ + (a[(E >> 16) & 255] << 16) ^ + (a[(U >> 8) & 255] << 8) ^ + a[Y & 255] ^ + r[F + 2]), + (j = + (a[E >>> 24] << 24) ^ + (a[(U >> 16) & 255] << 16) ^ + (a[(Y >> 8) & 255] << 8) ^ + a[_ & 255] ^ + r[F + 3]), + (I[t] = K(L ^ g)), + (I[t + 1] = K(j ^ p)), + (I[t + 2] = K(O ^ v)), + (I[t + 3] = K(M ^ T)), + (g = w), + (p = b), + (v = S), + (T = P), + (t = t + 4); + } + return I.buffer; + } + } + const ad = 16; + class gr { + constructor(e, { removePKCS7Padding: t = !0 } = {}) { + if ( + ((this.logEnabled = !0), + (this.removePKCS7Padding = void 0), + (this.subtle = null), + (this.softwareDecrypter = null), + (this.key = null), + (this.fastAesKey = null), + (this.remainderData = null), + (this.currentIV = null), + (this.currentResult = null), + (this.useSoftware = void 0), + (this.useSoftware = e.enableSoftwareAES), + (this.removePKCS7Padding = t), + t) + ) + try { + const i = self.crypto; + i && (this.subtle = i.subtle || i.webkitSubtle); + } catch {} + this.subtle === null && (this.useSoftware = !0); + } + destroy() { + (this.subtle = null), + (this.softwareDecrypter = null), + (this.key = null), + (this.fastAesKey = null), + (this.remainderData = null), + (this.currentIV = null), + (this.currentResult = null); + } + isSync() { + return this.useSoftware; + } + flush() { + const { currentResult: e, remainderData: t } = this; + if (!e || t) return this.reset(), null; + const i = new Uint8Array(e); + return this.reset(), this.removePKCS7Padding ? rd(i) : i; + } + reset() { + (this.currentResult = null), + (this.currentIV = null), + (this.remainderData = null), + this.softwareDecrypter && (this.softwareDecrypter = null); + } + decrypt(e, t, i) { + return this.useSoftware + ? new Promise((n, r) => { + this.softwareDecrypt(new Uint8Array(e), t, i); + const a = this.flush(); + a + ? n(a.buffer) + : r(new Error("[softwareDecrypt] Failed to decrypt data")); + }) + : this.webCryptoDecrypt(new Uint8Array(e), t, i); + } + softwareDecrypt(e, t, i) { + const { currentIV: n, currentResult: r, remainderData: a } = this; + this.logOnce("JS AES decrypt"), + a && ((e = jt(a, e)), (this.remainderData = null)); + const o = this.getValidChunk(e); + if (!o.length) return null; + n && (i = n); + let l = this.softwareDecrypter; + l || (l = this.softwareDecrypter = new sd()), l.expandKey(t); + const u = r; + return ( + (this.currentResult = l.decrypt(o.buffer, 0, i)), + (this.currentIV = Wt(o, -16).buffer), + u || null + ); + } + webCryptoDecrypt(e, t, i) { + const n = this.subtle; + return ( + (this.key !== t || !this.fastAesKey) && + ((this.key = t), (this.fastAesKey = new nd(n, t))), + this.fastAesKey + .expandKey() + .then((r) => + n + ? (this.logOnce("WebCrypto AES decrypt"), + new id(n, new Uint8Array(i)).decrypt(e.buffer, r)) + : Promise.reject(new Error("web crypto not initialized")) + ) + .catch( + (r) => ( + D.warn( + `[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}` + ), + this.onWebCryptoError(e, t, i) + ) + ) + ); + } + onWebCryptoError(e, t, i) { + (this.useSoftware = !0), + (this.logEnabled = !0), + this.softwareDecrypt(e, t, i); + const n = this.flush(); + if (n) return n.buffer; + throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data"); + } + getValidChunk(e) { + let t = e; + const i = e.length - (e.length % ad); + return ( + i !== e.length && ((t = Wt(e, 0, i)), (this.remainderData = Wt(e, i))), + t + ); + } + logOnce(e) { + this.logEnabled && (D.log(`[decrypter]: ${e}`), (this.logEnabled = !1)); + } + } + const od = { + toString: function (s) { + let e = ""; + const t = s.length; + for (let i = 0; i < t; i++) + e += `[${s.start(i).toFixed(3)}-${s.end(i).toFixed(3)}]`; + return e; + }, + }, + H = { + STOPPED: "STOPPED", + IDLE: "IDLE", + KEY_LOADING: "KEY_LOADING", + FRAG_LOADING: "FRAG_LOADING", + FRAG_LOADING_WAITING_RETRY: "FRAG_LOADING_WAITING_RETRY", + WAITING_TRACK: "WAITING_TRACK", + PARSING: "PARSING", + PARSED: "PARSED", + ENDED: "ENDED", + ERROR: "ERROR", + WAITING_INIT_PTS: "WAITING_INIT_PTS", + WAITING_LEVEL: "WAITING_LEVEL", + }; + class pr extends qh { + constructor(e, t, i, n, r) { + super(), + (this.hls = void 0), + (this.fragPrevious = null), + (this.fragCurrent = null), + (this.fragmentTracker = void 0), + (this.transmuxer = null), + (this._state = H.STOPPED), + (this.playlistType = void 0), + (this.media = null), + (this.mediaBuffer = null), + (this.config = void 0), + (this.bitrateTest = !1), + (this.lastCurrentTime = 0), + (this.nextLoadPosition = 0), + (this.startPosition = 0), + (this.startTimeOffset = null), + (this.loadedmetadata = !1), + (this.retryDate = 0), + (this.levels = null), + (this.fragmentLoader = void 0), + (this.keyLoader = void 0), + (this.levelLastLoaded = null), + (this.startFragRequested = !1), + (this.decrypter = void 0), + (this.initPTS = []), + (this.onvseeking = null), + (this.onvended = null), + (this.logPrefix = ""), + (this.log = void 0), + (this.warn = void 0), + (this.playlistType = r), + (this.logPrefix = n), + (this.log = D.log.bind(D, `${n}:`)), + (this.warn = D.warn.bind(D, `${n}:`)), + (this.hls = e), + (this.fragmentLoader = new Wh(e.config)), + (this.keyLoader = i), + (this.fragmentTracker = t), + (this.config = e.config), + (this.decrypter = new gr(e.config)), + e.on(y.MANIFEST_LOADED, this.onManifestLoaded, this); + } + doTick() { + this.onTickEnd(); + } + onTickEnd() {} + startLoad(e) {} + stopLoad() { + this.fragmentLoader.abort(), this.keyLoader.abort(this.playlistType); + const e = this.fragCurrent; + e != null && + e.loader && + (e.abortRequests(), this.fragmentTracker.removeFragment(e)), + this.resetTransmuxer(), + (this.fragCurrent = null), + (this.fragPrevious = null), + this.clearInterval(), + this.clearNextTick(), + (this.state = H.STOPPED); + } + _streamEnded(e, t) { + if (t.live || e.nextStart || !e.end || !this.media) return !1; + const i = t.partList; + if (i != null && i.length) { + const r = i[i.length - 1]; + return Se.isBuffered(this.media, r.start + r.duration / 2); + } + const n = t.fragments[t.fragments.length - 1].type; + return this.fragmentTracker.isEndListAppended(n); + } + getLevelDetails() { + if (this.levels && this.levelLastLoaded !== null) { + var e; + return (e = this.levels[this.levelLastLoaded]) == null + ? void 0 + : e.details; + } + } + onMediaAttached(e, t) { + const i = (this.media = this.mediaBuffer = t.media); + (this.onvseeking = this.onMediaSeeking.bind(this)), + (this.onvended = this.onMediaEnded.bind(this)), + i.addEventListener("seeking", this.onvseeking), + i.addEventListener("ended", this.onvended); + const n = this.config; + this.levels && + n.autoStartLoad && + this.state === H.STOPPED && + this.startLoad(n.startPosition); + } + onMediaDetaching() { + const e = this.media; + e != null && + e.ended && + (this.log("MSE detaching and video ended, reset startPosition"), + (this.startPosition = this.lastCurrentTime = 0)), + e && + this.onvseeking && + this.onvended && + (e.removeEventListener("seeking", this.onvseeking), + e.removeEventListener("ended", this.onvended), + (this.onvseeking = this.onvended = null)), + this.keyLoader && this.keyLoader.detach(), + (this.media = this.mediaBuffer = null), + (this.loadedmetadata = !1), + this.fragmentTracker.removeAllFragments(), + this.stopLoad(); + } + onMediaSeeking() { + const { + config: e, + fragCurrent: t, + media: i, + mediaBuffer: n, + state: r, + } = this, + a = i ? i.currentTime : 0, + o = Se.bufferInfo(n || i, a, e.maxBufferHole); + if ( + (this.log(`media seeking to ${ne(a) ? a.toFixed(3) : a}, state: ${r}`), + this.state === H.ENDED) + ) + this.resetLoadingState(); + else if (t) { + const l = e.maxFragLookUpTolerance, + u = t.start - l, + c = t.start + t.duration + l; + if (!o.len || c < o.start || u > o.end) { + const d = a > c; + (a < u || d) && + (d && + t.loader && + (this.log( + "seeking outside of buffer while fragment load in progress, cancel fragment load" + ), + t.abortRequests(), + this.resetLoadingState()), + (this.fragPrevious = null)); + } + } + i && + (this.fragmentTracker.removeFragmentsInRange( + a, + 1 / 0, + this.playlistType, + !0 + ), + (this.lastCurrentTime = a)), + !this.loadedmetadata && + !o.len && + (this.nextLoadPosition = this.startPosition = a), + this.tickImmediate(); + } + onMediaEnded() { + this.startPosition = this.lastCurrentTime = 0; + } + onManifestLoaded(e, t) { + (this.startTimeOffset = t.startTimeOffset), (this.initPTS = []); + } + onHandlerDestroying() { + this.stopLoad(), super.onHandlerDestroying(); + } + onHandlerDestroyed() { + (this.state = H.STOPPED), + this.fragmentLoader && this.fragmentLoader.destroy(), + this.keyLoader && this.keyLoader.destroy(), + this.decrypter && this.decrypter.destroy(), + (this.hls = + this.log = + this.warn = + this.decrypter = + this.keyLoader = + this.fragmentLoader = + this.fragmentTracker = + null), + super.onHandlerDestroyed(); + } + loadFragment(e, t, i) { + this._loadFragForPlayback(e, t, i); + } + _loadFragForPlayback(e, t, i) { + const n = (r) => { + if (this.fragContextChanged(e)) { + this.warn( + `Fragment ${e.sn}${r.part ? " p: " + r.part.index : ""} of level ${ + e.level + } was dropped during download.` + ), + this.fragmentTracker.removeFragment(e); + return; + } + e.stats.chunkCount++, this._handleFragmentLoadProgress(r); + }; + this._doFragLoad(e, t, i, n) + .then((r) => { + if (!r) return; + const a = this.state; + if (this.fragContextChanged(e)) { + (a === H.FRAG_LOADING || (!this.fragCurrent && a === H.PARSING)) && + (this.fragmentTracker.removeFragment(e), (this.state = H.IDLE)); + return; + } + "payload" in r && + (this.log(`Loaded fragment ${e.sn} of level ${e.level}`), + this.hls.trigger(y.FRAG_LOADED, r)), + this._handleFragmentLoadComplete(r); + }) + .catch((r) => { + this.state === H.STOPPED || + this.state === H.ERROR || + (this.warn(r), this.resetFragmentLoading(e)); + }); + } + clearTrackerIfNeeded(e) { + var t; + const { fragmentTracker: i } = this; + if (i.getState(e) === Be.APPENDING) { + const r = e.type, + a = this.getFwdBufferInfo(this.mediaBuffer, r), + o = Math.max(e.duration, a ? a.len : this.config.maxBufferLength); + this.reduceMaxBufferLength(o) && i.removeFragment(e); + } else ((t = this.mediaBuffer) == null ? void 0 : t.buffered.length) === 0 ? i.removeAllFragments() : i.hasParts(e.type) && (i.detectPartialFragments({ frag: e, part: null, stats: e.stats, id: e.type }), i.getState(e) === Be.PARTIAL && i.removeFragment(e)); + } + flushMainBuffer(e, t, i = null) { + if (!(e - t)) return; + const n = { startOffset: e, endOffset: t, type: i }; + this.hls.trigger(y.BUFFER_FLUSHING, n); + } + _loadInitSegment(e, t) { + this._doFragLoad(e, t) + .then((i) => { + if (!i || this.fragContextChanged(e) || !this.levels) + throw new Error("init load aborted"); + return i; + }) + .then((i) => { + const { hls: n } = this, + { payload: r } = i, + a = e.decryptdata; + if ( + r && + r.byteLength > 0 && + a && + a.key && + a.iv && + a.method === "AES-128" + ) { + const o = self.performance.now(); + return this.decrypter + .decrypt(new Uint8Array(r), a.key.buffer, a.iv.buffer) + .catch((l) => { + throw ( + (n.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.FRAG_DECRYPT_ERROR, + fatal: !1, + error: l, + reason: l.message, + frag: e, + }), + l) + ); + }) + .then((l) => { + const u = self.performance.now(); + return ( + n.trigger(y.FRAG_DECRYPTED, { + frag: e, + payload: l, + stats: { tstart: o, tdecrypt: u }, + }), + (i.payload = l), + i + ); + }); + } + return i; + }) + .then((i) => { + const { fragCurrent: n, hls: r, levels: a } = this; + if (!a) throw new Error("init load aborted, missing levels"); + const o = e.stats; + (this.state = H.IDLE), + (t.fragmentError = 0), + (e.data = new Uint8Array(i.payload)), + (o.parsing.start = o.buffering.start = self.performance.now()), + (o.parsing.end = o.buffering.end = self.performance.now()), + i.frag === n && + r.trigger(y.FRAG_BUFFERED, { + stats: o, + frag: n, + part: null, + id: e.type, + }), + this.tick(); + }) + .catch((i) => { + this.state === H.STOPPED || + this.state === H.ERROR || + (this.warn(i), this.resetFragmentLoading(e)); + }); + } + fragContextChanged(e) { + const { fragCurrent: t } = this; + return ( + !e || !t || e.level !== t.level || e.sn !== t.sn || e.urlId !== t.urlId + ); + } + fragBufferedComplete(e, t) { + var i, n, r, a; + const o = this.mediaBuffer ? this.mediaBuffer : this.media; + this.log( + `Buffered ${e.type} sn: ${e.sn}${t ? " part: " + t.index : ""} of ${ + this.playlistType === se.MAIN ? "level" : "track" + } ${e.level} (frag:[${((i = e.startPTS) != null ? i : NaN).toFixed( + 3 + )}-${((n = e.endPTS) != null ? n : NaN).toFixed(3)}] > buffer:${ + o ? od.toString(Se.getBuffered(o)) : "(detached)" + })` + ), + (this.state = H.IDLE), + o && + (!this.loadedmetadata && + e.type == se.MAIN && + o.buffered.length && + ((r = this.fragCurrent) == null ? void 0 : r.sn) === + ((a = this.fragPrevious) == null ? void 0 : a.sn) && + ((this.loadedmetadata = !0), this.seekToStartPos()), + this.tick()); + } + seekToStartPos() {} + _handleFragmentLoadComplete(e) { + const { transmuxer: t } = this; + if (!t) return; + const { frag: i, part: n, partsLoaded: r } = e, + a = !r || r.length === 0 || r.some((l) => !l), + o = new dr( + i.level, + i.sn, + i.stats.chunkCount + 1, + 0, + n ? n.index : -1, + !a + ); + t.flush(o); + } + _handleFragmentLoadProgress(e) {} + _doFragLoad(e, t, i = null, n) { + var r; + const a = t == null ? void 0 : t.details; + if (!this.levels || !a) + throw new Error( + `frag load aborted, missing level${a ? "" : " detail"}s` + ); + let o = null; + if ( + (e.encrypted && !((r = e.decryptdata) != null && r.key) + ? (this.log( + `Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${ + this.logPrefix === "[stream-controller]" ? "level" : "track" + } ${e.level}` + ), + (this.state = H.KEY_LOADING), + (this.fragCurrent = e), + (o = this.keyLoader.load(e).then((c) => { + if (!this.fragContextChanged(c.frag)) + return ( + this.hls.trigger(y.KEY_LOADED, c), + this.state === H.KEY_LOADING && (this.state = H.IDLE), + c + ); + })), + this.hls.trigger(y.KEY_LOADING, { frag: e }), + this.fragCurrent === null && + (o = Promise.reject( + new Error("frag load aborted, context changed in KEY_LOADING") + ))) + : !e.encrypted && + a.encryptedFragments.length && + this.keyLoader.loadClear(e, a.encryptedFragments), + (i = Math.max(e.start, i || 0)), + this.config.lowLatencyMode && e.sn !== "initSegment") + ) { + const c = a.partList; + if (c && n) { + i > e.end && a.fragmentHint && (e = a.fragmentHint); + const d = this.getNextPart(c, e, i); + if (d > -1) { + const f = c[d]; + this.log( + `Loading part sn: ${e.sn} p: ${f.index} cc: ${ + e.cc + } of playlist [${a.startSN}-${a.endSN}] parts [0-${d}-${ + c.length - 1 + }] ${ + this.logPrefix === "[stream-controller]" ? "level" : "track" + }: ${e.level}, target: ${parseFloat(i.toFixed(3))}` + ), + (this.nextLoadPosition = f.start + f.duration), + (this.state = H.FRAG_LOADING); + let g; + return ( + o + ? (g = o + .then((p) => + !p || this.fragContextChanged(p.frag) + ? null + : this.doFragPartsLoad(e, f, t, n) + ) + .catch((p) => this.handleFragLoadError(p))) + : (g = this.doFragPartsLoad(e, f, t, n).catch((p) => + this.handleFragLoadError(p) + )), + this.hls.trigger(y.FRAG_LOADING, { + frag: e, + part: f, + targetBufferTime: i, + }), + this.fragCurrent === null + ? Promise.reject( + new Error( + "frag load aborted, context changed in FRAG_LOADING parts" + ) + ) + : g + ); + } else if (!e.url || this.loadedEndOfParts(c, i)) + return Promise.resolve(null); + } + } + this.log( + `Loading fragment ${e.sn} cc: ${e.cc} ${ + a ? "of [" + a.startSN + "-" + a.endSN + "] " : "" + }${this.logPrefix === "[stream-controller]" ? "level" : "track"}: ${ + e.level + }, target: ${parseFloat(i.toFixed(3))}` + ), + ne(e.sn) && + !this.bitrateTest && + (this.nextLoadPosition = e.start + e.duration), + (this.state = H.FRAG_LOADING); + const l = this.config.progressive; + let u; + return ( + l && o + ? (u = o + .then((c) => + !c || this.fragContextChanged(c == null ? void 0 : c.frag) + ? null + : this.fragmentLoader.load(e, n) + ) + .catch((c) => this.handleFragLoadError(c))) + : (u = Promise.all([this.fragmentLoader.load(e, l ? n : void 0), o]) + .then(([c]) => (!l && c && n && n(c), c)) + .catch((c) => this.handleFragLoadError(c))), + this.hls.trigger(y.FRAG_LOADING, { frag: e, targetBufferTime: i }), + this.fragCurrent === null + ? Promise.reject( + new Error("frag load aborted, context changed in FRAG_LOADING") + ) + : u + ); + } + doFragPartsLoad(e, t, i, n) { + return new Promise((r, a) => { + var o; + const l = [], + u = (o = i.details) == null ? void 0 : o.partList, + c = (d) => { + this.fragmentLoader + .loadPart(e, d, n) + .then((f) => { + l[d.index] = f; + const g = f.part; + this.hls.trigger(y.FRAG_LOADED, f); + const p = Ga(i, e.sn, d.index + 1) || Ka(u, e.sn, d.index + 1); + if (p) c(p); + else return r({ frag: e, part: g, partsLoaded: l }); + }) + .catch(a); + }; + c(t); + }); + } + handleFragLoadError(e) { + if ("data" in e) { + const t = e.data; + e.data && t.details === $.INTERNAL_ABORTED + ? this.handleFragLoadAborted(t.frag, t.part) + : this.hls.trigger(y.ERROR, t); + } else this.hls.trigger(y.ERROR, { type: re.OTHER_ERROR, details: $.INTERNAL_EXCEPTION, err: e, error: e, fatal: !0 }); + return null; + } + _handleTransmuxerFlush(e) { + const t = this.getCurrentContext(e); + if (!t || this.state !== H.PARSING) { + !this.fragCurrent && + this.state !== H.STOPPED && + this.state !== H.ERROR && + (this.state = H.IDLE); + return; + } + const { frag: i, part: n, level: r } = t, + a = self.performance.now(); + (i.stats.parsing.end = a), + n && (n.stats.parsing.end = a), + this.updateLevelTiming(i, n, r, e.partial); + } + getCurrentContext(e) { + const { levels: t, fragCurrent: i } = this, + { level: n, sn: r, part: a } = e; + if (!(t != null && t[n])) + return ( + this.warn( + `Levels object was unset while buffering fragment ${r} of level ${n}. The current chunk will not be buffered.` + ), + null + ); + const o = t[n], + l = a > -1 ? Ga(o, r, a) : null, + u = l ? l.fragment : Mh(o, r, i); + return u + ? (i && i !== u && (u.stats = i.stats), { frag: u, part: l, level: o }) + : null; + } + bufferFragmentData(e, t, i, n, r) { + var a; + if (!e || this.state !== H.PARSING) return; + const { data1: o, data2: l } = e; + let u = o; + if ((o && l && (u = jt(o, l)), !((a = u) != null && a.length))) return; + const c = { + type: e.type, + frag: t, + part: i, + chunkMeta: n, + parent: t.type, + data: u, + }; + if ( + (this.hls.trigger(y.BUFFER_APPENDING, c), + e.dropped && e.independent && !i) + ) { + if (r) return; + this.flushBufferGap(t); + } + } + flushBufferGap(e) { + const t = this.media; + if (!t) return; + if (!Se.isBuffered(t, t.currentTime)) { + this.flushMainBuffer(0, e.start); + return; + } + const i = t.currentTime, + n = Se.bufferInfo(t, i, 0), + r = e.duration, + a = Math.min(this.config.maxFragLookUpTolerance * 2, r * 0.25), + o = Math.max(Math.min(e.start - a, n.end - a), i + a); + e.start - o > a && this.flushMainBuffer(o, e.start); + } + getFwdBufferInfo(e, t) { + const i = this.getLoadPosition(); + return ne(i) ? this.getFwdBufferInfoAtPos(e, i, t) : null; + } + getFwdBufferInfoAtPos(e, t, i) { + const { + config: { maxBufferHole: n }, + } = this, + r = Se.bufferInfo(e, t, n); + if (r.len === 0 && r.nextStart !== void 0) { + const a = this.fragmentTracker.getBufferedFrag(t, i); + if (a && r.nextStart < a.end) + return Se.bufferInfo(e, t, Math.max(r.nextStart, n)); + } + return r; + } + getMaxBufferLength(e) { + const { config: t } = this; + let i; + return ( + e + ? (i = Math.max((8 * t.maxBufferSize) / e, t.maxBufferLength)) + : (i = t.maxBufferLength), + Math.min(i, t.maxMaxBufferLength) + ); + } + reduceMaxBufferLength(e) { + const t = this.config, + i = e || t.maxBufferLength; + return t.maxMaxBufferLength >= i + ? ((t.maxMaxBufferLength /= 2), + this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`), + !0) + : !1; + } + getAppendedFrag(e, t = se.MAIN) { + const i = this.fragmentTracker.getAppendedFrag(e, se.MAIN); + return i && "fragment" in i ? i.fragment : i; + } + getNextFragment(e, t) { + const i = t.fragments, + n = i.length; + if (!n) return null; + const { config: r } = this, + a = i[0].start; + let o; + if (t.live) { + const l = r.initialLiveManifestSize; + if (n < l) + return ( + this.warn( + `Not enough fragments to start playback (have: ${n}, need: ${l})` + ), + null + ); + !t.PTSKnown && + !this.startFragRequested && + this.startPosition === -1 && + ((o = this.getInitialLiveFragment(t, i)), + (this.startPosition = o ? this.hls.liveSyncPosition || o.start : e)); + } else e <= a && (o = i[0]); + if (!o) { + const l = r.lowLatencyMode ? t.partEnd : t.fragmentEnd; + o = this.getFragmentAtPosition(e, l, t); + } + return this.mapToInitFragWhenRequired(o); + } + isLoopLoading(e, t) { + const i = this.fragmentTracker.getState(e); + return ( + (i === Be.OK || (i === Be.PARTIAL && !!e.gap)) && + this.nextLoadPosition > t + ); + } + getNextFragmentLoopLoading(e, t, i, n, r) { + const a = e.gap, + o = this.getNextFragment(this.nextLoadPosition, t); + if (o === null) return o; + if (((e = o), a && e && !e.gap && i.nextStart)) { + const l = this.getFwdBufferInfoAtPos( + this.mediaBuffer ? this.mediaBuffer : this.media, + i.nextStart, + n + ); + if (l !== null && i.len + l.len >= r) + return ( + this.log( + `buffer full after gaps in "${n}" playlist starting at sn: ${e.sn}` + ), + null + ); + } + return e; + } + mapToInitFragWhenRequired(e) { + return e != null && + e.initSegment && + !(e != null && e.initSegment.data) && + !this.bitrateTest + ? e.initSegment + : e; + } + getNextPart(e, t, i) { + let n = -1, + r = !1, + a = !0; + for (let o = 0, l = e.length; o < l; o++) { + const u = e[o]; + if (((a = a && !u.independent), n > -1 && i < u.start)) break; + const c = u.loaded; + c ? (n = -1) : (r || u.independent || a) && u.fragment === t && (n = o), + (r = c); + } + return n; + } + loadedEndOfParts(e, t) { + const i = e[e.length - 1]; + return i && t > i.start && i.loaded; + } + getInitialLiveFragment(e, t) { + const i = this.fragPrevious; + let n = null; + if (i) { + if ( + (e.hasProgramDateTime && + (this.log( + `Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}` + ), + (n = Uh( + t, + i.endProgramDateTime, + this.config.maxFragLookUpTolerance + ))), + !n) + ) { + const r = i.sn + 1; + if (r >= e.startSN && r <= e.endSN) { + const a = t[r - e.startSN]; + i.cc === a.cc && + ((n = a), + this.log( + `Live playlist, switching playlist, load frag with next SN: ${n.sn}` + )); + } + n || + ((n = Vh(t, i.cc)), + n && + this.log( + `Live playlist, switching playlist, load frag with same CC: ${n.sn}` + )); + } + } else { + const r = this.hls.liveSyncPosition; + r !== null && + (n = this.getFragmentAtPosition( + r, + this.bitrateTest ? e.fragmentEnd : e.edge, + e + )); + } + return n; + } + getFragmentAtPosition(e, t, i) { + const { config: n } = this; + let { fragPrevious: r } = this, + { fragments: a, endSN: o } = i; + const { fragmentHint: l } = i, + u = n.maxFragLookUpTolerance, + c = i.partList, + d = !!(n.lowLatencyMode && c != null && c.length && l); + d && l && !this.bitrateTest && ((a = a.concat(l)), (o = l.sn)); + let f; + if (e < t) { + const g = e > t - u ? 0 : u; + f = Li(r, a, e, g); + } else f = a[a.length - 1]; + if (f) { + const g = f.sn - i.startSN, + p = this.fragmentTracker.getState(f); + if ( + ((p === Be.OK || (p === Be.PARTIAL && f.gap)) && (r = f), + r && + f.sn === r.sn && + (!d || c[0].fragment.sn > f.sn) && + r && + f.level === r.level) + ) { + const T = a[g + 1]; + f.sn < o && this.fragmentTracker.getState(T) !== Be.OK + ? (f = T) + : (f = null); + } + } + return f; + } + synchronizeToLiveEdge(e) { + const { config: t, media: i } = this; + if (!i) return; + const n = this.hls.liveSyncPosition, + r = i.currentTime, + a = e.fragments[0].start, + o = e.edge, + l = r >= a - t.maxFragLookUpTolerance && r <= o; + if (n !== null && i.duration > n && (r < n || !l)) { + const u = + t.liveMaxLatencyDuration !== void 0 + ? t.liveMaxLatencyDuration + : t.liveMaxLatencyDurationCount * e.targetduration; + ((!l && i.readyState < 4) || r < o - u) && + (this.loadedmetadata || (this.nextLoadPosition = n), + i.readyState && + (this.warn( + `Playback: ${r.toFixed( + 3 + )} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${n.toFixed( + 3 + )}` + ), + (i.currentTime = n))); + } + } + alignPlaylists(e, t) { + const { levels: i, levelLastLoaded: n, fragPrevious: r } = this, + a = n !== null ? i[n] : null, + o = e.fragments.length; + if (!o) return this.warn("No fragments in live playlist"), 0; + const l = e.fragments[0].start, + u = !t, + c = e.alignedSliding && ne(l); + if (u || (!c && !l)) { + Jh(r, a, e); + const d = e.fragments[0].start; + return ( + this.log( + `Live playlist sliding: ${d.toFixed(2)} start-sn: ${ + t ? t.startSN : "na" + }->${e.startSN} prev-sn: ${r ? r.sn : "na"} fragments: ${o}` + ), + d + ); + } + return l; + } + waitForCdnTuneIn(e) { + return ( + e.live && + e.canBlockReload && + e.partTarget && + e.tuneInGoal > Math.max(e.partHoldBack, e.partTarget * 3) + ); + } + setStartPosition(e, t) { + let i = this.startPosition; + if ((i < t && (i = -1), i === -1 || this.lastCurrentTime === -1)) { + const n = this.startTimeOffset !== null, + r = n ? this.startTimeOffset : e.startTimeOffset; + r !== null && ne(r) + ? ((i = t + r), + r < 0 && (i += e.totalduration), + (i = Math.min(Math.max(t, i), t + e.totalduration)), + this.log( + `Start time offset ${r} found in ${ + n ? "multivariant" : "media" + } playlist, adjust startPosition to ${i}` + ), + (this.startPosition = i)) + : e.live + ? (i = this.hls.liveSyncPosition || t) + : (this.startPosition = i = 0), + (this.lastCurrentTime = i); + } + this.nextLoadPosition = i; + } + getLoadPosition() { + const { media: e } = this; + let t = 0; + return ( + this.loadedmetadata && e + ? (t = e.currentTime) + : this.nextLoadPosition && (t = this.nextLoadPosition), + t + ); + } + handleFragLoadAborted(e, t) { + this.transmuxer && + e.sn !== "initSegment" && + e.stats.aborted && + (this.warn( + `Fragment ${e.sn}${t ? " part " + t.index : ""} of level ${ + e.level + } was aborted` + ), + this.resetFragmentLoading(e)); + } + resetFragmentLoading(e) { + (!this.fragCurrent || + (!this.fragContextChanged(e) && + this.state !== H.FRAG_LOADING_WAITING_RETRY)) && + (this.state = H.IDLE); + } + onFragmentOrKeyLoadError(e, t) { + if (t.chunkMeta && !t.frag) { + const d = this.getCurrentContext(t.chunkMeta); + d && (t.frag = d.frag); + } + const i = t.frag; + if (!i || i.type !== e || !this.levels) return; + if (this.fragContextChanged(i)) { + var n; + this.warn( + `Frag load error must match current frag to retry ${i.url} > ${ + (n = this.fragCurrent) == null ? void 0 : n.url + }` + ); + return; + } + const r = t.details === $.FRAG_GAP; + r && this.fragmentTracker.fragBuffered(i, !0); + const a = t.errorAction, + { action: o, retryCount: l = 0, retryConfig: u } = a || {}; + if (a && o === Ge.RetryRequest && u) { + var c; + this.resetStartWhenNotLoaded( + (c = this.levelLastLoaded) != null ? c : i.level + ); + const d = lr(u, l); + this.warn( + `Fragment ${i.sn} of ${e} ${i.level} errored with ${ + t.details + }, retrying loading ${l + 1}/${u.maxNumRetry} in ${d}ms` + ), + (a.resolved = !0), + (this.retryDate = self.performance.now() + d), + (this.state = H.FRAG_LOADING_WAITING_RETRY); + } else u && a ? (this.resetFragmentErrors(e), l < u.maxNumRetry ? r || (a.resolved = !0) : D.warn(`${t.details} reached or exceeded max retry (${l})`)) : (a == null ? void 0 : a.action) === Ge.SendAlternateToPenaltyBox ? (this.state = H.WAITING_LEVEL) : (this.state = H.ERROR); + this.tickImmediate(); + } + reduceLengthAndFlushBuffer(e) { + if (this.state === H.PARSING || this.state === H.PARSED) { + const t = e.parent, + i = this.getFwdBufferInfo(this.mediaBuffer, t), + n = i && i.len > 0.5; + n && this.reduceMaxBufferLength(i.len); + const r = !n; + return ( + r && + this.warn( + `Buffer full error while media.currentTime is not buffered, flush ${t} buffer` + ), + e.frag && + (this.fragmentTracker.removeFragment(e.frag), + (this.nextLoadPosition = e.frag.start)), + this.resetLoadingState(), + r + ); + } + return !1; + } + resetFragmentErrors(e) { + e === se.AUDIO && (this.fragCurrent = null), + this.loadedmetadata || (this.startFragRequested = !1), + this.state !== H.STOPPED && (this.state = H.IDLE); + } + afterBufferFlushed(e, t, i) { + if (!e) return; + const n = Se.getBuffered(e); + this.fragmentTracker.detectEvictedFragments(t, n, i), + this.state === H.ENDED && this.resetLoadingState(); + } + resetLoadingState() { + this.log("Reset loading state"), + (this.fragCurrent = null), + (this.fragPrevious = null), + (this.state = H.IDLE); + } + resetStartWhenNotLoaded(e) { + if (!this.loadedmetadata) { + this.startFragRequested = !1; + const t = this.levels ? this.levels[e].details : null; + t != null && t.live + ? ((this.startPosition = -1), + this.setStartPosition(t, 0), + this.resetLoadingState()) + : (this.nextLoadPosition = this.startPosition); + } + } + resetWhenMissingContext(e) { + var t; + this.warn( + `The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.` + ), + this.removeUnbufferedFrags(), + this.resetStartWhenNotLoaded( + (t = this.levelLastLoaded) != null ? t : e.level + ), + this.resetLoadingState(); + } + removeUnbufferedFrags(e = 0) { + this.fragmentTracker.removeFragmentsInRange( + e, + 1 / 0, + this.playlistType, + !1, + !0 + ); + } + updateLevelTiming(e, t, i, n) { + var r; + const a = i.details; + if (!a) { + this.warn("level.details undefined"); + return; + } + if ( + Object.keys(e.elementaryStreams).reduce((l, u) => { + const c = e.elementaryStreams[u]; + if (c) { + const d = c.endPTS - c.startPTS; + if (d <= 0) + return ( + this.warn( + `Could not parse fragment ${e.sn} ${u} duration reliably (${d})` + ), + l || !1 + ); + const f = n + ? 0 + : $a(a, e, c.startPTS, c.endPTS, c.startDTS, c.endDTS); + return ( + this.hls.trigger(y.LEVEL_PTS_UPDATED, { + details: a, + level: i, + drift: f, + type: u, + frag: e, + start: c.startPTS, + end: c.endPTS, + }), + !0 + ); + } + return l; + }, !1) + ) + i.fragmentError = 0; + else if (((r = this.transmuxer) == null ? void 0 : r.error) === null) { + const l = new Error( + `Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing` + ); + if ( + (i.fragmentError === 0 && + (i.fragmentError++, + (e.gap = !0), + this.fragmentTracker.removeFragment(e), + this.fragmentTracker.fragBuffered(e, !0)), + this.warn(l.message), + this.hls.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.FRAG_PARSING_ERROR, + fatal: !1, + error: l, + frag: e, + reason: `Found no media in msn ${e.sn} of level "${i.url}"`, + }), + !this.hls) + ) + return; + this.resetTransmuxer(); + } + (this.state = H.PARSED), + this.hls.trigger(y.FRAG_PARSED, { frag: e, part: t }); + } + resetTransmuxer() { + this.transmuxer && (this.transmuxer.destroy(), (this.transmuxer = null)); + } + recoverWorkerError(e) { + if (e.event === "demuxerWorker") { + var t, i, n; + this.fragmentTracker.removeAllFragments(), + this.resetTransmuxer(), + this.resetStartWhenNotLoaded( + (t = + (i = this.levelLastLoaded) != null + ? i + : (n = this.fragCurrent) == null + ? void 0 + : n.level) != null + ? t + : 0 + ), + this.resetLoadingState(); + } + } + set state(e) { + const t = this._state; + t !== e && ((this._state = e), this.log(`${t}->${e}`)); + } + get state() { + return this._state; + } + } + function eo() { + return self.SourceBuffer || self.WebKitSourceBuffer; + } + function ld() { + const s = en(); + if (!s) return !1; + const e = eo(), + t = + s && + typeof s.isTypeSupported == "function" && + s.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'), + i = + !e || + (e.prototype && + typeof e.prototype.appendBuffer == "function" && + typeof e.prototype.remove == "function"); + return !!t && !!i; + } + function ud() { + var s; + const e = eo(); + return ( + typeof (e == null || (s = e.prototype) == null ? void 0 : s.changeType) == + "function" + ); + } + function cd() { + return typeof __HLS_WORKER_BUNDLE__ == "function"; + } + function hd() { + const s = new self.Blob( + [ + `var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`, + ], + { type: "text/javascript" } + ), + e = self.URL.createObjectURL(s); + return { worker: new self.Worker(e), objectURL: e }; + } + function dd(s) { + const e = new self.URL(s, self.location.href).href; + return { worker: new self.Worker(e), scriptURL: e }; + } + function pt(s = "", e = 9e4) { + return { + type: s, + id: -1, + pid: -1, + inputTimeScale: e, + sequenceNumber: -1, + samples: [], + dropped: 0, + }; + } + class to { + constructor() { + (this._audioTrack = void 0), + (this._id3Track = void 0), + (this.frameIndex = 0), + (this.cachedData = null), + (this.basePTS = null), + (this.initPTS = null), + (this.lastPTS = null); + } + resetInitSegment(e, t, i, n) { + this._id3Track = { + type: "id3", + id: 3, + pid: -1, + inputTimeScale: 9e4, + sequenceNumber: 0, + samples: [], + dropped: 0, + }; + } + resetTimeStamp(e) { + (this.initPTS = e), this.resetContiguity(); + } + resetContiguity() { + (this.basePTS = null), (this.lastPTS = null), (this.frameIndex = 0); + } + canParse(e, t) { + return !1; + } + appendFrame(e, t, i) {} + demux(e, t) { + this.cachedData && + ((e = jt(this.cachedData, e)), (this.cachedData = null)); + let i = Xi(e, 0), + n = i ? i.length : 0, + r; + const a = this._audioTrack, + o = this._id3Track, + l = i ? jc(i) : void 0, + u = e.length; + for ( + (this.basePTS === null || (this.frameIndex === 0 && ne(l))) && + ((this.basePTS = fd(l, t, this.initPTS)), + (this.lastPTS = this.basePTS)), + this.lastPTS === null && (this.lastPTS = this.basePTS), + i && + i.length > 0 && + o.samples.push({ + pts: this.lastPTS, + dts: this.lastPTS, + data: i, + type: ot.audioId3, + duration: Number.POSITIVE_INFINITY, + }); + n < u; + + ) { + if (this.canParse(e, n)) { + const c = this.appendFrame(a, e, n); + c + ? (this.frameIndex++, + (this.lastPTS = c.sample.pts), + (n += c.length), + (r = n)) + : (n = u); + } else + Wc(e, n) + ? ((i = Xi(e, n)), + o.samples.push({ + pts: this.lastPTS, + dts: this.lastPTS, + data: i, + type: ot.audioId3, + duration: Number.POSITIVE_INFINITY, + }), + (n += i.length), + (r = n)) + : n++; + if (n === u && r !== u) { + const c = Wt(e, r); + this.cachedData + ? (this.cachedData = jt(this.cachedData, c)) + : (this.cachedData = c); + } + } + return { audioTrack: a, videoTrack: pt(), id3Track: o, textTrack: pt() }; + } + demuxSampleAes(e, t, i) { + return Promise.reject( + new Error( + `[${this}] This demuxer does not support Sample-AES decryption` + ) + ); + } + flush(e) { + const t = this.cachedData; + return ( + t && ((this.cachedData = null), this.demux(t, 0)), + { + audioTrack: this._audioTrack, + videoTrack: pt(), + id3Track: this._id3Track, + textTrack: pt(), + } + ); + } + destroy() {} + } + const fd = (s, e, t) => { + if (ne(s)) return s * 90; + const i = t ? (t.baseTime * 9e4) / t.timescale : 0; + return e * 9e4 + i; + }; + function gd(s, e, t, i) { + let n, r, a, o; + const l = navigator.userAgent.toLowerCase(), + u = i, + c = [ + 96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, + 8e3, 7350, + ]; + n = ((e[t + 2] & 192) >>> 6) + 1; + const d = (e[t + 2] & 60) >>> 2; + if (d > c.length - 1) { + s.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.FRAG_PARSING_ERROR, + fatal: !0, + reason: `invalid ADTS sampling index:${d}`, + }); + return; + } + return ( + (a = (e[t + 2] & 1) << 2), + (a |= (e[t + 3] & 192) >>> 6), + D.log(`manifest codec:${i}, ADTS type:${n}, samplingIndex:${d}`), + /firefox/i.test(l) + ? d >= 6 + ? ((n = 5), (o = new Array(4)), (r = d - 3)) + : ((n = 2), (o = new Array(2)), (r = d)) + : l.indexOf("android") !== -1 + ? ((n = 2), (o = new Array(2)), (r = d)) + : ((n = 5), + (o = new Array(4)), + (i && + (i.indexOf("mp4a.40.29") !== -1 || + i.indexOf("mp4a.40.5") !== -1)) || + (!i && d >= 6) + ? (r = d - 3) + : (((i && + i.indexOf("mp4a.40.2") !== -1 && + ((d >= 6 && a === 1) || /vivaldi/i.test(l))) || + (!i && a === 1)) && + ((n = 2), (o = new Array(2))), + (r = d))), + (o[0] = n << 3), + (o[0] |= (d & 14) >> 1), + (o[1] |= (d & 1) << 7), + (o[1] |= a << 3), + n === 5 && + ((o[1] |= (r & 14) >> 1), + (o[2] = (r & 1) << 7), + (o[2] |= 8), + (o[3] = 0)), + { + config: o, + samplerate: c[d], + channelCount: a, + codec: "mp4a.40." + n, + manifestCodec: u, + } + ); + } + function io(s, e) { + return s[e] === 255 && (s[e + 1] & 246) === 240; + } + function no(s, e) { + return s[e + 1] & 1 ? 7 : 9; + } + function mr(s, e) { + return ((s[e + 3] & 3) << 11) | (s[e + 4] << 3) | ((s[e + 5] & 224) >>> 5); + } + function pd(s, e) { + return e + 5 < s.length; + } + function ln(s, e) { + return e + 1 < s.length && io(s, e); + } + function md(s, e) { + return pd(s, e) && io(s, e) && mr(s, e) <= s.length - e; + } + function Ad(s, e) { + if (ln(s, e)) { + const t = no(s, e); + if (e + t >= s.length) return !1; + const i = mr(s, e); + if (i <= t) return !1; + const n = e + i; + return n === s.length || ln(s, n); + } + return !1; + } + function ro(s, e, t, i, n) { + if (!s.samplerate) { + const r = gd(e, t, i, n); + if (!r) return; + (s.config = r.config), + (s.samplerate = r.samplerate), + (s.channelCount = r.channelCount), + (s.codec = r.codec), + (s.manifestCodec = r.manifestCodec), + D.log( + `parsed codec:${s.codec}, rate:${r.samplerate}, channels:${r.channelCount}` + ); + } + } + function so(s) { + return (1024 * 9e4) / s; + } + function yd(s, e) { + const t = no(s, e); + if (e + t <= s.length) { + const i = mr(s, e) - t; + if (i > 0) return { headerLength: t, frameLength: i }; + } + } + function ao(s, e, t, i, n) { + const r = so(s.samplerate), + a = i + n * r, + o = yd(e, t); + let l; + if (o) { + const { frameLength: d, headerLength: f } = o, + g = f + d, + p = Math.max(0, t + g - e.length); + p + ? ((l = new Uint8Array(g - f)), l.set(e.subarray(t + f, e.length), 0)) + : (l = e.subarray(t + f, t + g)); + const v = { unit: l, pts: a }; + return p || s.samples.push(v), { sample: v, length: g, missing: p }; + } + const u = e.length - t; + return ( + (l = new Uint8Array(u)), + l.set(e.subarray(t, e.length), 0), + { sample: { unit: l, pts: a }, length: u, missing: -1 } + ); + } + class vd extends to { + constructor(e, t) { + super(), + (this.observer = void 0), + (this.config = void 0), + (this.observer = e), + (this.config = t); + } + resetInitSegment(e, t, i, n) { + super.resetInitSegment(e, t, i, n), + (this._audioTrack = { + container: "audio/adts", + type: "audio", + id: 2, + pid: -1, + sequenceNumber: 0, + segmentCodec: "aac", + samples: [], + manifestCodec: t, + duration: n, + inputTimeScale: 9e4, + dropped: 0, + }); + } + static probe(e) { + if (!e) return !1; + let i = (Xi(e, 0) || []).length; + for (let n = e.length; i < n; i++) + if (Ad(e, i)) return D.log("ADTS sync word found !"), !0; + return !1; + } + canParse(e, t) { + return md(e, t); + } + appendFrame(e, t, i) { + ro(e, this.observer, t, i, e.manifestCodec); + const n = ao(e, t, i, this.basePTS, this.frameIndex); + if (n && n.missing === 0) return n; + } + } + const Ed = /\/emsg[-/]ID3/i; + class Td { + constructor(e, t) { + (this.remainderData = null), + (this.timeOffset = 0), + (this.config = void 0), + (this.videoTrack = void 0), + (this.audioTrack = void 0), + (this.id3Track = void 0), + (this.txtTrack = void 0), + (this.config = t); + } + resetTimeStamp() {} + resetInitSegment(e, t, i, n) { + const r = (this.videoTrack = pt("video", 1)), + a = (this.audioTrack = pt("audio", 1)), + o = (this.txtTrack = pt("text", 1)); + if ( + ((this.id3Track = pt("id3", 1)), + (this.timeOffset = 0), + !(e != null && e.byteLength)) + ) + return; + const l = ya(e); + if (l.video) { + const { id: u, timescale: c, codec: d } = l.video; + (r.id = u), (r.timescale = o.timescale = c), (r.codec = d); + } + if (l.audio) { + const { id: u, timescale: c, codec: d } = l.audio; + (a.id = u), (a.timescale = c), (a.codec = d); + } + (o.id = pa.text), (r.sampleDuration = 0), (r.duration = a.duration = n); + } + resetContiguity() { + this.remainderData = null; + } + static probe(e) { + return ( + (e = e.length > 16384 ? e.subarray(0, 16384) : e), + ce(e, ["moof"]).length > 0 + ); + } + demux(e, t) { + this.timeOffset = t; + let i = e; + const n = this.videoTrack, + r = this.txtTrack; + if (this.config.progressive) { + this.remainderData && (i = jt(this.remainderData, e)); + const o = uh(i); + (this.remainderData = o.remainder), + (n.samples = o.valid || new Uint8Array()); + } else n.samples = i; + const a = this.extractID3Track(n, t); + return ( + (r.samples = Ea(t, n)), + { + videoTrack: n, + audioTrack: this.audioTrack, + id3Track: a, + textTrack: this.txtTrack, + } + ); + } + flush() { + const e = this.timeOffset, + t = this.videoTrack, + i = this.txtTrack; + (t.samples = this.remainderData || new Uint8Array()), + (this.remainderData = null); + const n = this.extractID3Track(t, this.timeOffset); + return ( + (i.samples = Ea(e, t)), + { videoTrack: t, audioTrack: pt(), id3Track: n, textTrack: pt() } + ); + } + extractID3Track(e, t) { + const i = this.id3Track; + if (e.samples.length) { + const n = ce(e.samples, ["emsg"]); + n && + n.forEach((r) => { + const a = dh(r); + if (Ed.test(a.schemeIdUri)) { + const o = ne(a.presentationTime) + ? a.presentationTime / a.timeScale + : t + a.presentationTimeDelta / a.timeScale; + let l = + a.eventDuration === 4294967295 + ? Number.POSITIVE_INFINITY + : a.eventDuration / a.timeScale; + l <= 0.001 && (l = Number.POSITIVE_INFINITY); + const u = a.payload; + i.samples.push({ + data: u, + len: u.byteLength, + dts: o, + pts: o, + type: ot.emsg, + duration: l, + }); + } + }); + } + return i; + } + demuxSampleAes(e, t, i) { + return Promise.reject( + new Error("The MP4 demuxer does not support SAMPLE-AES decryption") + ); + } + destroy() {} + } + let un = null; + const bd = [ + 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, + 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 32, 40, 48, 56, + 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 32, 48, 56, 64, 80, 96, + 112, 128, 144, 160, 176, 192, 224, 256, 8, 16, 24, 32, 40, 48, 56, 64, 80, + 96, 112, 128, 144, 160, + ], + _d = [44100, 48e3, 32e3, 22050, 24e3, 16e3, 11025, 12e3, 8e3], + kd = [ + [0, 72, 144, 12], + [0, 0, 0, 0], + [0, 72, 144, 12], + [0, 144, 144, 12], + ], + Sd = [0, 1, 1, 4]; + function oo(s, e, t, i, n) { + if (t + 24 > e.length) return; + const r = lo(e, t); + if (r && t + r.frameLength <= e.length) { + const a = (r.samplesPerFrame * 9e4) / r.sampleRate, + o = i + n * a, + l = { unit: e.subarray(t, t + r.frameLength), pts: o, dts: o }; + return ( + (s.config = []), + (s.channelCount = r.channelCount), + (s.samplerate = r.sampleRate), + s.samples.push(l), + { sample: l, length: r.frameLength, missing: 0 } + ); + } + } + function lo(s, e) { + const t = (s[e + 1] >> 3) & 3, + i = (s[e + 1] >> 1) & 3, + n = (s[e + 2] >> 4) & 15, + r = (s[e + 2] >> 2) & 3; + if (t !== 1 && n !== 0 && n !== 15 && r !== 3) { + const a = (s[e + 2] >> 1) & 1, + o = s[e + 3] >> 6, + l = t === 3 ? 3 - i : i === 3 ? 3 : 4, + u = bd[l * 14 + n - 1] * 1e3, + d = _d[(t === 3 ? 0 : t === 2 ? 1 : 2) * 3 + r], + f = o === 3 ? 1 : 2, + g = kd[t][i], + p = Sd[i], + v = g * 8 * p, + T = Math.floor((g * u) / d + a) * p; + if (un === null) { + const L = (navigator.userAgent || "").match(/Chrome\/(\d+)/i); + un = L ? parseInt(L[1]) : 0; + } + return ( + !!un && + un <= 87 && + i === 2 && + u >= 224e3 && + o === 0 && + (s[e + 3] = s[e + 3] | 128), + { sampleRate: d, channelCount: f, frameLength: T, samplesPerFrame: v } + ); + } + } + function Ar(s, e) { + return s[e] === 255 && (s[e + 1] & 224) === 224 && (s[e + 1] & 6) !== 0; + } + function uo(s, e) { + return e + 1 < s.length && Ar(s, e); + } + function Cd(s, e) { + return Ar(s, e) && 4 <= s.length - e; + } + function xd(s, e) { + if (e + 1 < s.length && Ar(s, e)) { + const i = lo(s, e); + let n = 4; + i != null && i.frameLength && (n = i.frameLength); + const r = e + n; + return r === s.length || uo(s, r); + } + return !1; + } + class co { + constructor(e) { + (this.data = void 0), + (this.bytesAvailable = void 0), + (this.word = void 0), + (this.bitsAvailable = void 0), + (this.data = e), + (this.bytesAvailable = e.byteLength), + (this.word = 0), + (this.bitsAvailable = 0); + } + loadWord() { + const e = this.data, + t = this.bytesAvailable, + i = e.byteLength - t, + n = new Uint8Array(4), + r = Math.min(4, t); + if (r === 0) throw new Error("no bytes available"); + n.set(e.subarray(i, i + r)), + (this.word = new DataView(n.buffer).getUint32(0)), + (this.bitsAvailable = r * 8), + (this.bytesAvailable -= r); + } + skipBits(e) { + let t; + (e = Math.min(e, this.bytesAvailable * 8 + this.bitsAvailable)), + this.bitsAvailable > e + ? ((this.word <<= e), (this.bitsAvailable -= e)) + : ((e -= this.bitsAvailable), + (t = e >> 3), + (e -= t << 3), + (this.bytesAvailable -= t), + this.loadWord(), + (this.word <<= e), + (this.bitsAvailable -= e)); + } + readBits(e) { + let t = Math.min(this.bitsAvailable, e); + const i = this.word >>> (32 - t); + if ( + (e > 32 && D.error("Cannot read more than 32 bits at a time"), + (this.bitsAvailable -= t), + this.bitsAvailable > 0) + ) + this.word <<= t; + else if (this.bytesAvailable > 0) this.loadWord(); + else throw new Error("no bits available"); + return ( + (t = e - t), + t > 0 && this.bitsAvailable ? (i << t) | this.readBits(t) : i + ); + } + skipLZ() { + let e; + for (e = 0; e < this.bitsAvailable; ++e) + if (this.word & (2147483648 >>> e)) + return (this.word <<= e), (this.bitsAvailable -= e), e; + return this.loadWord(), e + this.skipLZ(); + } + skipUEG() { + this.skipBits(1 + this.skipLZ()); + } + skipEG() { + this.skipBits(1 + this.skipLZ()); + } + readUEG() { + const e = this.skipLZ(); + return this.readBits(e + 1) - 1; + } + readEG() { + const e = this.readUEG(); + return 1 & e ? (1 + e) >>> 1 : -1 * (e >>> 1); + } + readBoolean() { + return this.readBits(1) === 1; + } + readUByte() { + return this.readBits(8); + } + readUShort() { + return this.readBits(16); + } + readUInt() { + return this.readBits(32); + } + skipScalingList(e) { + let t = 8, + i = 8, + n; + for (let r = 0; r < e; r++) + i !== 0 && ((n = this.readEG()), (i = (t + n + 256) % 256)), + (t = i === 0 ? t : i); + } + readSPS() { + let e = 0, + t = 0, + i = 0, + n = 0, + r, + a, + o; + const l = this.readUByte.bind(this), + u = this.readBits.bind(this), + c = this.readUEG.bind(this), + d = this.readBoolean.bind(this), + f = this.skipBits.bind(this), + g = this.skipEG.bind(this), + p = this.skipUEG.bind(this), + v = this.skipScalingList.bind(this); + l(); + const T = l(); + if ( + (u(5), + f(3), + l(), + p(), + T === 100 || + T === 110 || + T === 122 || + T === 244 || + T === 44 || + T === 83 || + T === 86 || + T === 118 || + T === 128) + ) { + const j = c(); + if ((j === 3 && f(1), p(), p(), f(1), d())) + for (a = j !== 3 ? 8 : 12, o = 0; o < a; o++) + d() && (o < 6 ? v(16) : v(64)); + } + p(); + const x = c(); + if (x === 0) c(); + else if (x === 1) for (f(1), g(), g(), r = c(), o = 0; o < r; o++) g(); + p(), f(1); + const I = c(), + L = c(), + M = u(1); + M === 0 && f(1), + f(1), + d() && ((e = c()), (t = c()), (i = c()), (n = c())); + let O = [1, 1]; + if (d() && d()) + switch (l()) { + case 1: + O = [1, 1]; + break; + case 2: + O = [12, 11]; + break; + case 3: + O = [10, 11]; + break; + case 4: + O = [16, 11]; + break; + case 5: + O = [40, 33]; + break; + case 6: + O = [24, 11]; + break; + case 7: + O = [20, 11]; + break; + case 8: + O = [32, 11]; + break; + case 9: + O = [80, 33]; + break; + case 10: + O = [18, 11]; + break; + case 11: + O = [15, 11]; + break; + case 12: + O = [64, 33]; + break; + case 13: + O = [160, 99]; + break; + case 14: + O = [4, 3]; + break; + case 15: + O = [3, 2]; + break; + case 16: + O = [2, 1]; + break; + case 255: { + O = [(l() << 8) | l(), (l() << 8) | l()]; + break; + } + } + return { + width: Math.ceil((I + 1) * 16 - e * 2 - t * 2), + height: (2 - M) * (L + 1) * 16 - (M ? 2 : 4) * (i + n), + pixelRatio: O, + }; + } + readSliceType() { + return this.readUByte(), this.readUEG(), this.readUEG(); + } + } + class Ld { + constructor(e, t, i) { + (this.keyData = void 0), + (this.decrypter = void 0), + (this.keyData = i), + (this.decrypter = new gr(t, { removePKCS7Padding: !1 })); + } + decryptBuffer(e) { + return this.decrypter.decrypt( + e, + this.keyData.key.buffer, + this.keyData.iv.buffer + ); + } + decryptAacSample(e, t, i) { + const n = e[t].unit; + if (n.length <= 16) return; + const r = n.subarray(16, n.length - (n.length % 16)), + a = r.buffer.slice(r.byteOffset, r.byteOffset + r.length); + this.decryptBuffer(a).then((o) => { + const l = new Uint8Array(o); + n.set(l, 16), + this.decrypter.isSync() || this.decryptAacSamples(e, t + 1, i); + }); + } + decryptAacSamples(e, t, i) { + for (; ; t++) { + if (t >= e.length) { + i(); + return; + } + if ( + !(e[t].unit.length < 32) && + (this.decryptAacSample(e, t, i), !this.decrypter.isSync()) + ) + return; + } + } + getAvcEncryptedData(e) { + const t = Math.floor((e.length - 48) / 160) * 16 + 16, + i = new Int8Array(t); + let n = 0; + for (let r = 32; r < e.length - 16; r += 160, n += 16) + i.set(e.subarray(r, r + 16), n); + return i; + } + getAvcDecryptedUnit(e, t) { + const i = new Uint8Array(t); + let n = 0; + for (let r = 32; r < e.length - 16; r += 160, n += 16) + e.set(i.subarray(n, n + 16), r); + return e; + } + decryptAvcSample(e, t, i, n, r) { + const a = ba(r.data), + o = this.getAvcEncryptedData(a); + this.decryptBuffer(o.buffer).then((l) => { + (r.data = this.getAvcDecryptedUnit(a, l)), + this.decrypter.isSync() || this.decryptAvcSamples(e, t, i + 1, n); + }); + } + decryptAvcSamples(e, t, i, n) { + if (e instanceof Uint8Array) + throw new Error("Cannot decrypt samples of type Uint8Array"); + for (; ; t++, i = 0) { + if (t >= e.length) { + n(); + return; + } + const r = e[t].units; + for (; !(i >= r.length); i++) { + const a = r[i]; + if ( + !(a.data.length <= 48 || (a.type !== 1 && a.type !== 5)) && + (this.decryptAvcSample(e, t, i, n, a), !this.decrypter.isSync()) + ) + return; + } + } + } + } + const Ke = 188; + class Ot { + constructor(e, t, i) { + (this.observer = void 0), + (this.config = void 0), + (this.typeSupported = void 0), + (this.sampleAes = null), + (this.pmtParsed = !1), + (this.audioCodec = void 0), + (this.videoCodec = void 0), + (this._duration = 0), + (this._pmtId = -1), + (this._avcTrack = void 0), + (this._audioTrack = void 0), + (this._id3Track = void 0), + (this._txtTrack = void 0), + (this.aacOverFlow = null), + (this.avcSample = null), + (this.remainderData = null), + (this.observer = e), + (this.config = t), + (this.typeSupported = i); + } + static probe(e) { + const t = Ot.syncOffset(e); + return ( + t > 0 && + D.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`), + t !== -1 + ); + } + static syncOffset(e) { + const t = e.length; + let i = Math.min(Ke * 5, e.length - Ke) + 1, + n = 0; + for (; n < i; ) { + let r = !1, + a = -1, + o = 0; + for (let l = n; l < t; l += Ke) + if (e[l] === 71) { + if ( + (o++, + a === -1 && + ((a = l), + a !== 0 && (i = Math.min(a + Ke * 99, e.length - Ke) + 1)), + r || (r = yr(e, l) === 0), + r && o > 1 && ((a === 0 && o > 2) || l + Ke > i)) + ) + return a; + } else { + if (o) return -1; + break; + } + n++; + } + return -1; + } + static createTrack(e, t) { + return { + container: e === "video" || e === "audio" ? "video/mp2t" : void 0, + type: e, + id: pa[e], + pid: -1, + inputTimeScale: 9e4, + sequenceNumber: 0, + samples: [], + dropped: 0, + duration: e === "audio" ? t : void 0, + }; + } + resetInitSegment(e, t, i, n) { + (this.pmtParsed = !1), + (this._pmtId = -1), + (this._avcTrack = Ot.createTrack("video")), + (this._audioTrack = Ot.createTrack("audio", n)), + (this._id3Track = Ot.createTrack("id3")), + (this._txtTrack = Ot.createTrack("text")), + (this._audioTrack.segmentCodec = "aac"), + (this.aacOverFlow = null), + (this.avcSample = null), + (this.remainderData = null), + (this.audioCodec = t), + (this.videoCodec = i), + (this._duration = n); + } + resetTimeStamp() {} + resetContiguity() { + const { _audioTrack: e, _avcTrack: t, _id3Track: i } = this; + e && (e.pesData = null), + t && (t.pesData = null), + i && (i.pesData = null), + (this.aacOverFlow = null), + (this.avcSample = null), + (this.remainderData = null); + } + demux(e, t, i = !1, n = !1) { + i || (this.sampleAes = null); + let r; + const a = this._avcTrack, + o = this._audioTrack, + l = this._id3Track, + u = this._txtTrack; + let c = a.pid, + d = a.pesData, + f = o.pid, + g = l.pid, + p = o.pesData, + v = l.pesData, + T = null, + x = this.pmtParsed, + I = this._pmtId, + L = e.length; + if ( + (this.remainderData && + ((e = jt(this.remainderData, e)), + (L = e.length), + (this.remainderData = null)), + L < Ke && !n) + ) + return ( + (this.remainderData = e), + { audioTrack: o, videoTrack: a, id3Track: l, textTrack: u } + ); + const M = Math.max(0, Ot.syncOffset(e)); + (L -= (L - M) % Ke), + L < e.byteLength && + !n && + (this.remainderData = new Uint8Array( + e.buffer, + L, + e.buffer.byteLength - L + )); + let O = 0; + for (let U = M; U < L; U += Ke) + if (e[U] === 71) { + const Y = !!(e[U + 1] & 64), + _ = yr(e, U), + E = (e[U + 3] & 48) >> 4; + let w; + if (E > 1) { + if (((w = U + 5 + e[U + 4]), w === U + Ke)) continue; + } else w = U + 4; + switch (_) { + case c: + Y && + (d && (r = fi(d)) && this.parseAVCPES(a, u, r, !1), + (d = { data: [], size: 0 })), + d && + (d.data.push(e.subarray(w, U + Ke)), (d.size += U + Ke - w)); + break; + case f: + if (Y) { + if (p && (r = fi(p))) + switch (o.segmentCodec) { + case "aac": + this.parseAACPES(o, r); + break; + case "mp3": + this.parseMPEGPES(o, r); + break; + } + p = { data: [], size: 0 }; + } + p && (p.data.push(e.subarray(w, U + Ke)), (p.size += U + Ke - w)); + break; + case g: + Y && + (v && (r = fi(v)) && this.parseID3PES(l, r), + (v = { data: [], size: 0 })), + v && + (v.data.push(e.subarray(w, U + Ke)), (v.size += U + Ke - w)); + break; + case 0: + Y && (w += e[w] + 1), (I = this._pmtId = Id(e, w)); + break; + case I: { + Y && (w += e[w] + 1); + const b = Rd(e, w, this.typeSupported, i); + (c = b.avc), + c > 0 && (a.pid = c), + (f = b.audio), + f > 0 && ((o.pid = f), (o.segmentCodec = b.segmentCodec)), + (g = b.id3), + g > 0 && (l.pid = g), + T !== null && + !x && + (D.warn( + `MPEG-TS PMT found at ${U} after unknown PID '${T}'. Backtracking to sync byte @${M} to parse all TS packets.` + ), + (T = null), + (U = M - 188)), + (x = this.pmtParsed = !0); + break; + } + case 17: + case 8191: + break; + default: + T = _; + break; + } + } else O++; + if (O > 0) { + const U = new Error( + `Found ${O} TS packet/s that do not start with 0x47` + ); + this.observer.emit(y.ERROR, y.ERROR, { + type: re.MEDIA_ERROR, + details: $.FRAG_PARSING_ERROR, + fatal: !1, + error: U, + reason: U.message, + }); + } + (a.pesData = d), (o.pesData = p), (l.pesData = v); + const j = { audioTrack: o, videoTrack: a, id3Track: l, textTrack: u }; + return n && this.extractRemainingSamples(j), j; + } + flush() { + const { remainderData: e } = this; + this.remainderData = null; + let t; + return ( + e + ? (t = this.demux(e, -1, !1, !0)) + : (t = { + videoTrack: this._avcTrack, + audioTrack: this._audioTrack, + id3Track: this._id3Track, + textTrack: this._txtTrack, + }), + this.extractRemainingSamples(t), + this.sampleAes ? this.decrypt(t, this.sampleAes) : t + ); + } + extractRemainingSamples(e) { + const { audioTrack: t, videoTrack: i, id3Track: n, textTrack: r } = e, + a = i.pesData, + o = t.pesData, + l = n.pesData; + let u; + if ( + (a && (u = fi(a)) + ? (this.parseAVCPES(i, r, u, !0), (i.pesData = null)) + : (i.pesData = a), + o && (u = fi(o))) + ) { + switch (t.segmentCodec) { + case "aac": + this.parseAACPES(t, u); + break; + case "mp3": + this.parseMPEGPES(t, u); + break; + } + t.pesData = null; + } else o != null && o.size && D.log("last AAC PES packet truncated,might overlap between fragments"), (t.pesData = o); + l && (u = fi(l)) + ? (this.parseID3PES(n, u), (n.pesData = null)) + : (n.pesData = l); + } + demuxSampleAes(e, t, i) { + const n = this.demux(e, i, !0, !this.config.progressive), + r = (this.sampleAes = new Ld(this.observer, this.config, t)); + return this.decrypt(n, r); + } + decrypt(e, t) { + return new Promise((i) => { + const { audioTrack: n, videoTrack: r } = e; + n.samples && n.segmentCodec === "aac" + ? t.decryptAacSamples(n.samples, 0, () => { + r.samples + ? t.decryptAvcSamples(r.samples, 0, 0, () => { + i(e); + }) + : i(e); + }) + : r.samples && + t.decryptAvcSamples(r.samples, 0, 0, () => { + i(e); + }); + }); + } + destroy() { + this._duration = 0; + } + parseAVCPES(e, t, i, n) { + const r = this.parseAVCNALu(e, i.data); + let a = this.avcSample, + o, + l = !1; + (i.data = null), + a && + r.length && + !e.audFound && + (Ii(a, e), (a = this.avcSample = cn(!1, i.pts, i.dts, ""))), + r.forEach((u) => { + var c; + switch (u.type) { + case 1: { + let f = !1; + o = !0; + const g = u.data; + if (l && g.length > 4) { + const p = new co(g).readSliceType(); + (p === 2 || p === 4 || p === 7 || p === 9) && (f = !0); + } + if (f) { + var d; + (d = a) != null && + d.frame && + !a.key && + (Ii(a, e), (a = this.avcSample = null)); + } + a || (a = this.avcSample = cn(!0, i.pts, i.dts, "")), + (a.frame = !0), + (a.key = f); + break; + } + case 5: + (o = !0), + (c = a) != null && + c.frame && + !a.key && + (Ii(a, e), (a = this.avcSample = null)), + a || (a = this.avcSample = cn(!0, i.pts, i.dts, "")), + (a.key = !0), + (a.frame = !0); + break; + case 6: { + (o = !0), Ta(u.data, 1, i.pts, t.samples); + break; + } + case 7: + if (((o = !0), (l = !0), !e.sps)) { + const f = u.data, + p = new co(f).readSPS(); + (e.width = p.width), + (e.height = p.height), + (e.pixelRatio = p.pixelRatio), + (e.sps = [f]), + (e.duration = this._duration); + const v = f.subarray(1, 4); + let T = "avc1."; + for (let x = 0; x < 3; x++) { + let I = v[x].toString(16); + I.length < 2 && (I = "0" + I), (T += I); + } + e.codec = T; + } + break; + case 8: + (o = !0), e.pps || (e.pps = [u.data]); + break; + case 9: + (o = !1), + (e.audFound = !0), + a && Ii(a, e), + (a = this.avcSample = cn(!1, i.pts, i.dts, "")); + break; + case 12: + o = !0; + break; + default: + (o = !1), a && (a.debug += "unknown NAL " + u.type + " "); + break; + } + a && o && a.units.push(u); + }), + n && a && (Ii(a, e), (this.avcSample = null)); + } + getLastNalUnit(e) { + var t; + let i = this.avcSample, + n; + if ( + ((!i || i.units.length === 0) && (i = e[e.length - 1]), + (t = i) != null && t.units) + ) { + const r = i.units; + n = r[r.length - 1]; + } + return n; + } + parseAVCNALu(e, t) { + const i = t.byteLength; + let n = e.naluState || 0; + const r = n, + a = []; + let o = 0, + l, + u, + c, + d = -1, + f = 0; + for (n === -1 && ((d = 0), (f = t[0] & 31), (n = 0), (o = 1)); o < i; ) { + if (((l = t[o++]), !n)) { + n = l ? 0 : 1; + continue; + } + if (n === 1) { + n = l ? 0 : 2; + continue; + } + if (!l) n = 3; + else if (l === 1) { + if (d >= 0) { + const g = { data: t.subarray(d, o - n - 1), type: f }; + a.push(g); + } else { + const g = this.getLastNalUnit(e.samples); + if ( + g && + (r && + o <= 4 - r && + g.state && + (g.data = g.data.subarray(0, g.data.byteLength - r)), + (u = o - n - 1), + u > 0) + ) { + const p = new Uint8Array(g.data.byteLength + u); + p.set(g.data, 0), + p.set(t.subarray(0, u), g.data.byteLength), + (g.data = p), + (g.state = 0); + } + } + o < i ? ((c = t[o] & 31), (d = o), (f = c), (n = 0)) : (n = -1); + } else n = 0; + } + if (d >= 0 && n >= 0) { + const g = { data: t.subarray(d, i), type: f, state: n }; + a.push(g); + } + if (a.length === 0) { + const g = this.getLastNalUnit(e.samples); + if (g) { + const p = new Uint8Array(g.data.byteLength + t.byteLength); + p.set(g.data, 0), p.set(t, g.data.byteLength), (g.data = p); + } + } + return (e.naluState = n), a; + } + parseAACPES(e, t) { + let i = 0; + const n = this.aacOverFlow; + let r = t.data; + if (n) { + this.aacOverFlow = null; + const d = n.missing, + f = n.sample.unit.byteLength; + if (d === -1) { + const g = new Uint8Array(f + r.byteLength); + g.set(n.sample.unit, 0), g.set(r, f), (r = g); + } else { + const g = f - d; + n.sample.unit.set(r.subarray(0, d), g), + e.samples.push(n.sample), + (i = n.missing); + } + } + let a, o; + for (a = i, o = r.length; a < o - 1 && !ln(r, a); a++); + if (a !== i) { + let d; + const f = a < o - 1; + f + ? (d = `AAC PES did not start with ADTS header,offset:${a}`) + : (d = "No ADTS header found in AAC PES"); + const g = new Error(d); + if ( + (D.warn(`parsing error: ${d}`), + this.observer.emit(y.ERROR, y.ERROR, { + type: re.MEDIA_ERROR, + details: $.FRAG_PARSING_ERROR, + fatal: !1, + levelRetry: f, + error: g, + reason: d, + }), + !f) + ) + return; + } + ro(e, this.observer, r, a, this.audioCodec); + let l; + if (t.pts !== void 0) l = t.pts; + else if (n) { + const d = so(e.samplerate); + l = n.sample.pts + d; + } else { + D.warn("[tsdemuxer]: AAC PES unknown PTS"); + return; + } + let u = 0, + c; + for (; a < o; ) + if (((c = ao(e, r, a, l, u)), (a += c.length), c.missing)) { + this.aacOverFlow = c; + break; + } else for (u++; a < o - 1 && !ln(r, a); a++); + } + parseMPEGPES(e, t) { + const i = t.data, + n = i.length; + let r = 0, + a = 0; + const o = t.pts; + if (o === void 0) { + D.warn("[tsdemuxer]: MPEG PES unknown PTS"); + return; + } + for (; a < n; ) + if (uo(i, a)) { + const l = oo(e, i, a, o, r); + if (l) (a += l.length), r++; + else break; + } else a++; + } + parseID3PES(e, t) { + if (t.pts === void 0) { + D.warn("[tsdemuxer]: ID3 PES unknown PTS"); + return; + } + const i = Fe({}, t, { + type: this._avcTrack ? ot.emsg : ot.audioId3, + duration: Number.POSITIVE_INFINITY, + }); + e.samples.push(i); + } + } + function cn(s, e, t, i) { + return { + key: s, + frame: !1, + pts: e, + dts: t, + units: [], + debug: i, + length: 0, + }; + } + function yr(s, e) { + return ((s[e + 1] & 31) << 8) + s[e + 2]; + } + function Id(s, e) { + return ((s[e + 10] & 31) << 8) | s[e + 11]; + } + function Rd(s, e, t, i) { + const n = { audio: -1, avc: -1, id3: -1, segmentCodec: "aac" }, + r = ((s[e + 1] & 15) << 8) | s[e + 2], + a = e + 3 + r - 4, + o = ((s[e + 10] & 15) << 8) | s[e + 11]; + for (e += 12 + o; e < a; ) { + const l = yr(s, e); + switch (s[e]) { + case 207: + if (!i) { + D.log( + "ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream" + ); + break; + } + case 15: + n.audio === -1 && (n.audio = l); + break; + case 21: + n.id3 === -1 && (n.id3 = l); + break; + case 219: + if (!i) { + D.log( + "H.264 with AES-128-CBC slice encryption found in unencrypted stream" + ); + break; + } + case 27: + n.avc === -1 && (n.avc = l); + break; + case 3: + case 4: + t.mpeg !== !0 && t.mp3 !== !0 + ? D.log("MPEG audio found, not supported in this browser") + : n.audio === -1 && ((n.audio = l), (n.segmentCodec = "mp3")); + break; + case 36: + D.warn("Unsupported HEVC stream type found"); + break; + } + e += (((s[e + 3] & 15) << 8) | s[e + 4]) + 5; + } + return n; + } + function fi(s) { + let e = 0, + t, + i, + n, + r, + a; + const o = s.data; + if (!s || s.size === 0) return null; + for (; o[0].length < 19 && o.length > 1; ) { + const u = new Uint8Array(o[0].length + o[1].length); + u.set(o[0]), u.set(o[1], o[0].length), (o[0] = u), o.splice(1, 1); + } + if (((t = o[0]), (t[0] << 16) + (t[1] << 8) + t[2] === 1)) { + if (((i = (t[4] << 8) + t[5]), i && i > s.size - 6)) return null; + const u = t[7]; + u & 192 && + ((r = + (t[9] & 14) * 536870912 + + (t[10] & 255) * 4194304 + + (t[11] & 254) * 16384 + + (t[12] & 255) * 128 + + (t[13] & 254) / 2), + u & 64 + ? ((a = + (t[14] & 14) * 536870912 + + (t[15] & 255) * 4194304 + + (t[16] & 254) * 16384 + + (t[17] & 255) * 128 + + (t[18] & 254) / 2), + r - a > 60 * 9e4 && + (D.warn( + `${Math.round( + (r - a) / 9e4 + )}s delta between PTS and DTS, align them` + ), + (r = a))) + : (a = r)), + (n = t[8]); + let c = n + 9; + if (s.size <= c) return null; + s.size -= c; + const d = new Uint8Array(s.size); + for (let f = 0, g = o.length; f < g; f++) { + t = o[f]; + let p = t.byteLength; + if (c) + if (c > p) { + c -= p; + continue; + } else (t = t.subarray(c)), (p -= c), (c = 0); + d.set(t, e), (e += p); + } + return i && (i -= n + 3), { data: d, pts: r, dts: a, len: i }; + } + return null; + } + function Ii(s, e) { + if (s.units.length && s.frame) { + if (s.pts === void 0) { + const t = e.samples, + i = t.length; + if (i) { + const n = t[i - 1]; + (s.pts = n.pts), (s.dts = n.dts); + } else { + e.dropped++; + return; + } + } + e.samples.push(s); + } + s.debug.length && D.log(s.pts + "/" + s.dts + ":" + s.debug); + } + class Pd extends to { + resetInitSegment(e, t, i, n) { + super.resetInitSegment(e, t, i, n), + (this._audioTrack = { + container: "audio/mpeg", + type: "audio", + id: 2, + pid: -1, + sequenceNumber: 0, + segmentCodec: "mp3", + samples: [], + manifestCodec: t, + duration: n, + inputTimeScale: 9e4, + dropped: 0, + }); + } + static probe(e) { + if (!e) return !1; + let i = (Xi(e, 0) || []).length; + for (let n = e.length; i < n; i++) + if (xd(e, i)) return D.log("MPEG Audio sync word found !"), !0; + return !1; + } + canParse(e, t) { + return Cd(e, t); + } + appendFrame(e, t, i) { + if (this.basePTS !== null) + return oo(e, t, i, this.basePTS, this.frameIndex); + } + } + class ho { + static getSilentFrame(e, t) { + switch (e) { + case "mp4a.40.2": + if (t === 1) return new Uint8Array([0, 200, 0, 128, 35, 128]); + if (t === 2) + return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]); + if (t === 3) + return new Uint8Array([ + 0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142, + ]); + if (t === 4) + return new Uint8Array([ + 0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, + 56, + ]); + if (t === 5) + return new Uint8Array([ + 0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, + 33, 144, 2, 56, + ]); + if (t === 6) + return new Uint8Array([ + 0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, + 33, 144, 2, 0, 178, 0, 32, 8, 224, + ]); + break; + default: + if (t === 1) + return new Uint8Array([ + 1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6, 241, + 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94, + ]); + if (t === 2) + return new Uint8Array([ + 1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, + 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 94, + ]); + if (t === 3) + return new Uint8Array([ + 1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, + 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 94, + ]); + break; + } + } + } + const Nt = Math.pow(2, 32) - 1; + class N { + static init() { + N.types = { + avc1: [], + avcC: [], + btrt: [], + dinf: [], + dref: [], + esds: [], + ftyp: [], + hdlr: [], + mdat: [], + mdhd: [], + mdia: [], + mfhd: [], + minf: [], + moof: [], + moov: [], + mp4a: [], + ".mp3": [], + mvex: [], + mvhd: [], + pasp: [], + sdtp: [], + stbl: [], + stco: [], + stsc: [], + stsd: [], + stsz: [], + stts: [], + tfdt: [], + tfhd: [], + traf: [], + trak: [], + trun: [], + trex: [], + tkhd: [], + vmhd: [], + smhd: [], + }; + let e; + for (e in N.types) + N.types.hasOwnProperty(e) && + (N.types[e] = [ + e.charCodeAt(0), + e.charCodeAt(1), + e.charCodeAt(2), + e.charCodeAt(3), + ]); + const t = new Uint8Array([ + 0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0, + ]), + i = new Uint8Array([ + 0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0, + ]); + N.HDLR_TYPES = { video: t, audio: i }; + const n = new Uint8Array([ + 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1, + ]), + r = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]); + (N.STTS = N.STSC = N.STCO = r), + (N.STSZ = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), + (N.VMHD = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0])), + (N.SMHD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0])), + (N.STSD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1])); + const a = new Uint8Array([105, 115, 111, 109]), + o = new Uint8Array([97, 118, 99, 49]), + l = new Uint8Array([0, 0, 0, 1]); + (N.FTYP = N.box(N.types.ftyp, a, l, a, o)), + (N.DINF = N.box(N.types.dinf, N.box(N.types.dref, n))); + } + static box(e, ...t) { + let i = 8, + n = t.length; + const r = n; + for (; n--; ) i += t[n].byteLength; + const a = new Uint8Array(i); + for ( + a[0] = (i >> 24) & 255, + a[1] = (i >> 16) & 255, + a[2] = (i >> 8) & 255, + a[3] = i & 255, + a.set(e, 4), + n = 0, + i = 8; + n < r; + n++ + ) + a.set(t[n], i), (i += t[n].byteLength); + return a; + } + static hdlr(e) { + return N.box(N.types.hdlr, N.HDLR_TYPES[e]); + } + static mdat(e) { + return N.box(N.types.mdat, e); + } + static mdhd(e, t) { + t *= e; + const i = Math.floor(t / (Nt + 1)), + n = Math.floor(t % (Nt + 1)); + return N.box( + N.types.mdhd, + new Uint8Array([ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + (e >> 24) & 255, + (e >> 16) & 255, + (e >> 8) & 255, + e & 255, + i >> 24, + (i >> 16) & 255, + (i >> 8) & 255, + i & 255, + n >> 24, + (n >> 16) & 255, + (n >> 8) & 255, + n & 255, + 85, + 196, + 0, + 0, + ]) + ); + } + static mdia(e) { + return N.box( + N.types.mdia, + N.mdhd(e.timescale, e.duration), + N.hdlr(e.type), + N.minf(e) + ); + } + static mfhd(e) { + return N.box( + N.types.mfhd, + new Uint8Array([ + 0, + 0, + 0, + 0, + e >> 24, + (e >> 16) & 255, + (e >> 8) & 255, + e & 255, + ]) + ); + } + static minf(e) { + return e.type === "audio" + ? N.box(N.types.minf, N.box(N.types.smhd, N.SMHD), N.DINF, N.stbl(e)) + : N.box(N.types.minf, N.box(N.types.vmhd, N.VMHD), N.DINF, N.stbl(e)); + } + static moof(e, t, i) { + return N.box(N.types.moof, N.mfhd(e), N.traf(i, t)); + } + static moov(e) { + let t = e.length; + const i = []; + for (; t--; ) i[t] = N.trak(e[t]); + return N.box.apply( + null, + [N.types.moov, N.mvhd(e[0].timescale, e[0].duration)] + .concat(i) + .concat(N.mvex(e)) + ); + } + static mvex(e) { + let t = e.length; + const i = []; + for (; t--; ) i[t] = N.trex(e[t]); + return N.box.apply(null, [N.types.mvex, ...i]); + } + static mvhd(e, t) { + t *= e; + const i = Math.floor(t / (Nt + 1)), + n = Math.floor(t % (Nt + 1)), + r = new Uint8Array([ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + (e >> 24) & 255, + (e >> 16) & 255, + (e >> 8) & 255, + e & 255, + i >> 24, + (i >> 16) & 255, + (i >> 8) & 255, + i & 255, + n >> 24, + (n >> 16) & 255, + (n >> 8) & 255, + n & 255, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 64, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 255, + 255, + 255, + 255, + ]); + return N.box(N.types.mvhd, r); + } + static sdtp(e) { + const t = e.samples || [], + i = new Uint8Array(4 + t.length); + let n, r; + for (n = 0; n < t.length; n++) + (r = t[n].flags), + (i[n + 4] = + (r.dependsOn << 4) | (r.isDependedOn << 2) | r.hasRedundancy); + return N.box(N.types.sdtp, i); + } + static stbl(e) { + return N.box( + N.types.stbl, + N.stsd(e), + N.box(N.types.stts, N.STTS), + N.box(N.types.stsc, N.STSC), + N.box(N.types.stsz, N.STSZ), + N.box(N.types.stco, N.STCO) + ); + } + static avc1(e) { + let t = [], + i = [], + n, + r, + a; + for (n = 0; n < e.sps.length; n++) + (r = e.sps[n]), + (a = r.byteLength), + t.push((a >>> 8) & 255), + t.push(a & 255), + (t = t.concat(Array.prototype.slice.call(r))); + for (n = 0; n < e.pps.length; n++) + (r = e.pps[n]), + (a = r.byteLength), + i.push((a >>> 8) & 255), + i.push(a & 255), + (i = i.concat(Array.prototype.slice.call(r))); + const o = N.box( + N.types.avcC, + new Uint8Array( + [1, t[3], t[4], t[5], 255, 224 | e.sps.length] + .concat(t) + .concat([e.pps.length]) + .concat(i) + ) + ), + l = e.width, + u = e.height, + c = e.pixelRatio[0], + d = e.pixelRatio[1]; + return N.box( + N.types.avc1, + new Uint8Array([ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + (l >> 8) & 255, + l & 255, + (u >> 8) & 255, + u & 255, + 0, + 72, + 0, + 0, + 0, + 72, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 18, + 100, + 97, + 105, + 108, + 121, + 109, + 111, + 116, + 105, + 111, + 110, + 47, + 104, + 108, + 115, + 46, + 106, + 115, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 24, + 17, + 17, + ]), + o, + N.box( + N.types.btrt, + new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198, 192]) + ), + N.box( + N.types.pasp, + new Uint8Array([ + c >> 24, + (c >> 16) & 255, + (c >> 8) & 255, + c & 255, + d >> 24, + (d >> 16) & 255, + (d >> 8) & 255, + d & 255, + ]) + ) + ); + } + static esds(e) { + const t = e.config.length; + return new Uint8Array( + [ + 0, + 0, + 0, + 0, + 3, + 23 + t, + 0, + 1, + 0, + 4, + 15 + t, + 64, + 21, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + ] + .concat([t]) + .concat(e.config) + .concat([6, 1, 2]) + ); + } + static mp4a(e) { + const t = e.samplerate; + return N.box( + N.types.mp4a, + new Uint8Array([ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + e.channelCount, + 0, + 16, + 0, + 0, + 0, + 0, + (t >> 8) & 255, + t & 255, + 0, + 0, + ]), + N.box(N.types.esds, N.esds(e)) + ); + } + static mp3(e) { + const t = e.samplerate; + return N.box( + N.types[".mp3"], + new Uint8Array([ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + e.channelCount, + 0, + 16, + 0, + 0, + 0, + 0, + (t >> 8) & 255, + t & 255, + 0, + 0, + ]) + ); + } + static stsd(e) { + return e.type === "audio" + ? e.segmentCodec === "mp3" && e.codec === "mp3" + ? N.box(N.types.stsd, N.STSD, N.mp3(e)) + : N.box(N.types.stsd, N.STSD, N.mp4a(e)) + : N.box(N.types.stsd, N.STSD, N.avc1(e)); + } + static tkhd(e) { + const t = e.id, + i = e.duration * e.timescale, + n = e.width, + r = e.height, + a = Math.floor(i / (Nt + 1)), + o = Math.floor(i % (Nt + 1)); + return N.box( + N.types.tkhd, + new Uint8Array([ + 1, + 0, + 0, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + (t >> 24) & 255, + (t >> 16) & 255, + (t >> 8) & 255, + t & 255, + 0, + 0, + 0, + 0, + a >> 24, + (a >> 16) & 255, + (a >> 8) & 255, + a & 255, + o >> 24, + (o >> 16) & 255, + (o >> 8) & 255, + o & 255, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 64, + 0, + 0, + 0, + (n >> 8) & 255, + n & 255, + 0, + 0, + (r >> 8) & 255, + r & 255, + 0, + 0, + ]) + ); + } + static traf(e, t) { + const i = N.sdtp(e), + n = e.id, + r = Math.floor(t / (Nt + 1)), + a = Math.floor(t % (Nt + 1)); + return N.box( + N.types.traf, + N.box( + N.types.tfhd, + new Uint8Array([ + 0, + 0, + 0, + 0, + n >> 24, + (n >> 16) & 255, + (n >> 8) & 255, + n & 255, + ]) + ), + N.box( + N.types.tfdt, + new Uint8Array([ + 1, + 0, + 0, + 0, + r >> 24, + (r >> 16) & 255, + (r >> 8) & 255, + r & 255, + a >> 24, + (a >> 16) & 255, + (a >> 8) & 255, + a & 255, + ]) + ), + N.trun(e, i.length + 16 + 20 + 8 + 16 + 8 + 8), + i + ); + } + static trak(e) { + return ( + (e.duration = e.duration || 4294967295), + N.box(N.types.trak, N.tkhd(e), N.mdia(e)) + ); + } + static trex(e) { + const t = e.id; + return N.box( + N.types.trex, + new Uint8Array([ + 0, + 0, + 0, + 0, + t >> 24, + (t >> 16) & 255, + (t >> 8) & 255, + t & 255, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + ]) + ); + } + static trun(e, t) { + const i = e.samples || [], + n = i.length, + r = 12 + 16 * n, + a = new Uint8Array(r); + let o, l, u, c, d, f; + for ( + t += 8 + r, + a.set( + [ + e.type === "video" ? 1 : 0, + 0, + 15, + 1, + (n >>> 24) & 255, + (n >>> 16) & 255, + (n >>> 8) & 255, + n & 255, + (t >>> 24) & 255, + (t >>> 16) & 255, + (t >>> 8) & 255, + t & 255, + ], + 0 + ), + o = 0; + o < n; + o++ + ) + (l = i[o]), + (u = l.duration), + (c = l.size), + (d = l.flags), + (f = l.cts), + a.set( + [ + (u >>> 24) & 255, + (u >>> 16) & 255, + (u >>> 8) & 255, + u & 255, + (c >>> 24) & 255, + (c >>> 16) & 255, + (c >>> 8) & 255, + c & 255, + (d.isLeading << 2) | d.dependsOn, + (d.isDependedOn << 6) | + (d.hasRedundancy << 4) | + (d.paddingValue << 1) | + d.isNonSync, + d.degradPrio & 61440, + d.degradPrio & 15, + (f >>> 24) & 255, + (f >>> 16) & 255, + (f >>> 8) & 255, + f & 255, + ], + 12 + 16 * o + ); + return N.box(N.types.trun, a); + } + static initSegment(e) { + N.types || N.init(); + const t = N.moov(e), + i = new Uint8Array(N.FTYP.byteLength + t.byteLength); + return i.set(N.FTYP), i.set(t, N.FTYP.byteLength), i; + } + } + (N.types = void 0), + (N.HDLR_TYPES = void 0), + (N.STTS = void 0), + (N.STSC = void 0), + (N.STCO = void 0), + (N.STSZ = void 0), + (N.VMHD = void 0), + (N.SMHD = void 0), + (N.STSD = void 0), + (N.FTYP = void 0), + (N.DINF = void 0); + const fo = 9e4; + function vr(s, e, t = 1, i = !1) { + const n = s * e * t; + return i ? Math.round(n) : n; + } + function wd(s, e, t = 1, i = !1) { + return vr(s, e, 1 / t, i); + } + function Ri(s, e = !1) { + return vr(s, 1e3, 1 / fo, e); + } + function Dd(s, e = 1) { + return vr(s, fo, 1 / e); + } + const Od = 10 * 1e3, + go = 1024, + Nd = 1152; + let hn = null, + Er = null; + class Tr { + constructor(e, t, i, n = "") { + if ( + ((this.observer = void 0), + (this.config = void 0), + (this.typeSupported = void 0), + (this.ISGenerated = !1), + (this._initPTS = null), + (this._initDTS = null), + (this.nextAvcDts = null), + (this.nextAudioPts = null), + (this.videoSampleDuration = null), + (this.isAudioContiguous = !1), + (this.isVideoContiguous = !1), + (this.observer = e), + (this.config = t), + (this.typeSupported = i), + (this.ISGenerated = !1), + hn === null) + ) { + const a = (navigator.userAgent || "").match(/Chrome\/(\d+)/i); + hn = a ? parseInt(a[1]) : 0; + } + if (Er === null) { + const r = navigator.userAgent.match(/Safari\/(\d+)/i); + Er = r ? parseInt(r[1]) : 0; + } + } + destroy() {} + resetTimeStamp(e) { + D.log("[mp4-remuxer]: initPTS & initDTS reset"), + (this._initPTS = this._initDTS = e); + } + resetNextTimestamp() { + D.log("[mp4-remuxer]: reset next timestamp"), + (this.isVideoContiguous = !1), + (this.isAudioContiguous = !1); + } + resetInitSegment() { + D.log("[mp4-remuxer]: ISGenerated flag reset"), (this.ISGenerated = !1); + } + getVideoStartPts(e) { + let t = !1; + const i = e.reduce((n, r) => { + const a = r.pts - n; + return a < -4294967296 ? ((t = !0), nt(n, r.pts)) : a > 0 ? n : r.pts; + }, e[0].pts); + return t && D.debug("PTS rollover detected"), i; + } + remux(e, t, i, n, r, a, o, l) { + let u, + c, + d, + f, + g, + p, + v = r, + T = r; + const x = e.pid > -1, + I = t.pid > -1, + L = t.samples.length, + M = e.samples.length > 0, + O = (o && L > 0) || L > 1; + if (((!x || M) && (!I || O)) || this.ISGenerated || o) { + this.ISGenerated || (d = this.generateIS(e, t, r, a)); + const U = this.isVideoContiguous; + let Y = -1, + _; + if ( + O && + ((Y = Fd(t.samples)), !U && this.config.forceKeyFrameOnDiscontinuity) + ) + if (((p = !0), Y > 0)) { + D.warn( + `[mp4-remuxer]: Dropped ${Y} out of ${L} video samples due to a missing keyframe` + ); + const E = this.getVideoStartPts(t.samples); + (t.samples = t.samples.slice(Y)), + (t.dropped += Y), + (T += (t.samples[0].pts - E) / t.inputTimeScale), + (_ = T); + } else + Y === -1 && + (D.warn( + `[mp4-remuxer]: No keyframe found out of ${L} video samples` + ), + (p = !1)); + if (this.ISGenerated) { + if (M && O) { + const E = this.getVideoStartPts(t.samples), + b = (nt(e.samples[0].pts, E) - E) / t.inputTimeScale; + (v += Math.max(0, b)), (T += Math.max(0, -b)); + } + if (M) { + if ( + (e.samplerate || + (D.warn( + "[mp4-remuxer]: regenerate InitSegment as audio detected" + ), + (d = this.generateIS(e, t, r, a))), + (c = this.remuxAudio( + e, + v, + this.isAudioContiguous, + a, + I || O || l === se.AUDIO ? T : void 0 + )), + O) + ) { + const E = c ? c.endPTS - c.startPTS : 0; + t.inputTimeScale || + (D.warn( + "[mp4-remuxer]: regenerate InitSegment as video detected" + ), + (d = this.generateIS(e, t, r, a))), + (u = this.remuxVideo(t, T, U, E)); + } + } else O && (u = this.remuxVideo(t, T, U, 0)); + u && + ((u.firstKeyFrame = Y), + (u.independent = Y !== -1), + (u.firstKeyFramePTS = _)); + } + } + return ( + this.ISGenerated && + this._initPTS && + this._initDTS && + (i.samples.length && (g = po(i, r, this._initPTS, this._initDTS)), + n.samples.length && (f = mo(n, r, this._initPTS))), + { audio: c, video: u, initSegment: d, independent: p, text: f, id3: g } + ); + } + generateIS(e, t, i, n) { + const r = e.samples, + a = t.samples, + o = this.typeSupported, + l = {}, + u = this._initPTS; + let c = !u || n, + d = "audio/mp4", + f, + g, + p; + if ((c && (f = g = 1 / 0), e.config && r.length)) { + switch (((e.timescale = e.samplerate), e.segmentCodec)) { + case "mp3": + o.mpeg + ? ((d = "audio/mpeg"), (e.codec = "")) + : o.mp3 && (e.codec = "mp3"); + break; + } + (l.audio = { + id: "audio", + container: d, + codec: e.codec, + initSegment: + e.segmentCodec === "mp3" && o.mpeg + ? new Uint8Array(0) + : N.initSegment([e]), + metadata: { channelCount: e.channelCount }, + }), + c && + ((p = e.inputTimeScale), + !u || p !== u.timescale + ? (f = g = r[0].pts - Math.round(p * i)) + : (c = !1)); + } + if ( + t.sps && + t.pps && + a.length && + ((t.timescale = t.inputTimeScale), + (l.video = { + id: "main", + container: "video/mp4", + codec: t.codec, + initSegment: N.initSegment([t]), + metadata: { width: t.width, height: t.height }, + }), + c) + ) + if (((p = t.inputTimeScale), !u || p !== u.timescale)) { + const v = this.getVideoStartPts(a), + T = Math.round(p * i); + (g = Math.min(g, nt(a[0].dts, v) - T)), (f = Math.min(f, v - T)); + } else c = !1; + if (Object.keys(l).length) + return ( + (this.ISGenerated = !0), + c + ? ((this._initPTS = { baseTime: f, timescale: p }), + (this._initDTS = { baseTime: g, timescale: p })) + : (f = p = void 0), + { tracks: l, initPTS: f, timescale: p } + ); + } + remuxVideo(e, t, i, n) { + const r = e.inputTimeScale, + a = e.samples, + o = [], + l = a.length, + u = this._initPTS; + let c = this.nextAvcDts, + d = 8, + f = this.videoSampleDuration, + g, + p, + v = Number.POSITIVE_INFINITY, + T = Number.NEGATIVE_INFINITY, + x = !1; + if (!i || c === null) { + const G = t * r, + B = a[0].pts - nt(a[0].dts, a[0].pts); + c = G - B; + } + const I = (u.baseTime * r) / u.timescale; + for (let G = 0; G < l; G++) { + const B = a[G]; + (B.pts = nt(B.pts - I, c)), + (B.dts = nt(B.dts - I, c)), + B.dts < a[G > 0 ? G - 1 : G].dts && (x = !0); + } + x && + a.sort(function (G, B) { + const q = G.dts - B.dts, + X = G.pts - B.pts; + return q || X; + }), + (g = a[0].dts), + (p = a[a.length - 1].dts); + const L = p - g, + M = L ? Math.round(L / (l - 1)) : f || e.inputTimeScale / 30; + if (i) { + const G = g - c, + B = G > M, + q = G < -1; + if ( + (B || q) && + (B + ? D.warn( + `AVC: ${Ri( + G, + !0 + )} ms (${G}dts) hole between fragments detected, filling it` + ) + : D.warn( + `AVC: ${Ri( + -G, + !0 + )} ms (${G}dts) overlapping between fragments detected` + ), + !q || c >= a[0].pts) + ) { + g = c; + const X = a[0].pts - G; + (a[0].dts = g), + (a[0].pts = X), + D.log( + `Video: First PTS/DTS adjusted: ${Ri(X, !0)}/${Ri( + g, + !0 + )}, delta: ${Ri(G, !0)} ms` + ); + } + } + g = Math.max(0, g); + let O = 0, + j = 0; + for (let G = 0; G < l; G++) { + const B = a[G], + q = B.units, + X = q.length; + let J = 0; + for (let z = 0; z < X; z++) J += q[z].data.length; + (j += J), + (O += X), + (B.length = J), + (B.dts = Math.max(B.dts, g)), + (v = Math.min(B.pts, v)), + (T = Math.max(B.pts, T)); + } + p = a[l - 1].dts; + const U = j + 4 * O + 8; + let Y; + try { + Y = new Uint8Array(U); + } catch (G) { + this.observer.emit(y.ERROR, y.ERROR, { + type: re.MUX_ERROR, + details: $.REMUX_ALLOC_ERROR, + fatal: !1, + error: G, + bytes: U, + reason: `fail allocating video mdat ${U}`, + }); + return; + } + const _ = new DataView(Y.buffer); + _.setUint32(0, U), Y.set(N.types.mdat, 4); + let E = !1, + w = Number.POSITIVE_INFINITY, + b = Number.POSITIVE_INFINITY, + S = Number.NEGATIVE_INFINITY, + P = Number.NEGATIVE_INFINITY; + for (let G = 0; G < l; G++) { + const B = a[G], + q = B.units; + let X = 0; + for (let Ne = 0, me = q.length; Ne < me; Ne++) { + const Re = q[Ne], + oe = Re.data, + Me = Re.data.byteLength; + _.setUint32(d, Me), (d += 4), Y.set(oe, d), (d += Me), (X += 4 + Me); + } + let J; + if (G < l - 1) (f = a[G + 1].dts - B.dts), (J = a[G + 1].pts - B.pts); + else { + const Ne = this.config, + me = G > 0 ? B.dts - a[G - 1].dts : M; + if ( + ((J = G > 0 ? B.pts - a[G - 1].pts : M), + Ne.stretchShortVideoTrack && this.nextAudioPts !== null) + ) { + const Re = Math.floor(Ne.maxBufferHole * r), + oe = (n ? v + n * r : this.nextAudioPts) - B.pts; + oe > Re + ? ((f = oe - me), + f < 0 ? (f = me) : (E = !0), + D.log( + `[mp4-remuxer]: It is approximately ${ + oe / 90 + } ms to the next segment; using duration ${ + f / 90 + } ms for the last video frame.` + )) + : (f = me); + } else f = me; + } + const z = Math.round(B.pts - B.dts); + (w = Math.min(w, f)), + (S = Math.max(S, f)), + (b = Math.min(b, J)), + (P = Math.max(P, J)), + o.push(new Ao(B.key, f, X, z)); + } + if (o.length) { + if (hn) { + if (hn < 70) { + const G = o[0].flags; + (G.dependsOn = 2), (G.isNonSync = 0); + } + } else if (Er && P - b < S - w && M / S < 0.025 && o[0].cts === 0) { + D.warn( + "Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration." + ); + let G = g; + for (let B = 0, q = o.length; B < q; B++) { + const X = G + o[B].duration, + J = G + o[B].cts; + if (B < q - 1) { + const z = X + o[B + 1].cts; + o[B].duration = z - J; + } else o[B].duration = B ? o[B - 1].duration : M; + (o[B].cts = 0), (G = X); + } + } + } + (f = E || !f ? M : f), + (this.nextAvcDts = c = p + f), + (this.videoSampleDuration = f), + (this.isVideoContiguous = !0); + const K = { + data1: N.moof(e.sequenceNumber++, g, Fe({}, e, { samples: o })), + data2: Y, + startPTS: v / r, + endPTS: (T + f) / r, + startDTS: g / r, + endDTS: c / r, + type: "video", + hasAudio: !1, + hasVideo: !0, + nb: o.length, + dropped: e.dropped, + }; + return (e.samples = []), (e.dropped = 0), K; + } + remuxAudio(e, t, i, n, r) { + const a = e.inputTimeScale, + o = e.samplerate ? e.samplerate : a, + l = a / o, + u = e.segmentCodec === "aac" ? go : Nd, + c = u * l, + d = this._initPTS, + f = e.segmentCodec === "mp3" && this.typeSupported.mpeg, + g = [], + p = r !== void 0; + let v = e.samples, + T = f ? 0 : 8, + x = this.nextAudioPts || -1; + const I = t * a, + L = (d.baseTime * a) / d.timescale; + if ( + ((this.isAudioContiguous = i = + i || + (v.length && + x > 0 && + ((n && Math.abs(I - x) < 9e3) || + Math.abs(nt(v[0].pts - L, I) - x) < 20 * c))), + v.forEach(function (V) { + V.pts = nt(V.pts - L, I); + }), + !i || x < 0) + ) { + if (((v = v.filter((V) => V.pts >= 0)), !v.length)) return; + r === 0 ? (x = 0) : n && !p ? (x = Math.max(0, I)) : (x = v[0].pts); + } + if (e.segmentCodec === "aac") { + const V = this.config.maxAudioFramesDrift; + for (let K = 0, G = x; K < v.length; K++) { + const B = v[K], + q = B.pts, + X = q - G, + J = Math.abs((1e3 * X) / a); + if (X <= -V * c && p) + K === 0 && + (D.warn( + `Audio frame @ ${(q / a).toFixed( + 3 + )}s overlaps nextAudioPts by ${Math.round((1e3 * X) / a)} ms.` + ), + (this.nextAudioPts = x = G = q)); + else if (X >= V * c && J < Od && p) { + let z = Math.round(X / c); + (G = q - z * c), + G < 0 && (z--, (G += c)), + K === 0 && (this.nextAudioPts = x = G), + D.warn( + `[mp4-remuxer]: Injecting ${z} audio frame @ ${(G / a).toFixed( + 3 + )}s due to ${Math.round((1e3 * X) / a)} ms gap.` + ); + for (let Ne = 0; Ne < z; Ne++) { + const me = Math.max(G, 0); + let Re = ho.getSilentFrame( + e.manifestCodec || e.codec, + e.channelCount + ); + Re || + (D.log( + "[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead." + ), + (Re = B.unit.subarray())), + v.splice(K, 0, { unit: Re, pts: me }), + (G += c), + K++; + } + } + (B.pts = G), (G += c); + } + } + let M = null, + O = null, + j, + U = 0, + Y = v.length; + for (; Y--; ) U += v[Y].unit.byteLength; + for (let V = 0, K = v.length; V < K; V++) { + const G = v[V], + B = G.unit; + let q = G.pts; + if (O !== null) { + const J = g[V - 1]; + J.duration = Math.round((q - O) / l); + } else if ((i && e.segmentCodec === "aac" && (q = x), (M = q), U > 0)) { + U += T; + try { + j = new Uint8Array(U); + } catch (J) { + this.observer.emit(y.ERROR, y.ERROR, { + type: re.MUX_ERROR, + details: $.REMUX_ALLOC_ERROR, + fatal: !1, + error: J, + bytes: U, + reason: `fail allocating audio mdat ${U}`, + }); + return; + } + f || (new DataView(j.buffer).setUint32(0, U), j.set(N.types.mdat, 4)); + } else return; + j.set(B, T); + const X = B.byteLength; + (T += X), g.push(new Ao(!0, u, X, 0)), (O = q); + } + const _ = g.length; + if (!_) return; + const E = g[g.length - 1]; + this.nextAudioPts = x = O + l * E.duration; + const w = f + ? new Uint8Array(0) + : N.moof(e.sequenceNumber++, M / l, Fe({}, e, { samples: g })); + e.samples = []; + const b = M / a, + S = x / a, + F = { + data1: w, + data2: j, + startPTS: b, + endPTS: S, + startDTS: b, + endDTS: S, + type: "audio", + hasAudio: !0, + hasVideo: !1, + nb: _, + }; + return (this.isAudioContiguous = !0), F; + } + remuxEmptyAudio(e, t, i, n) { + const r = e.inputTimeScale, + a = e.samplerate ? e.samplerate : r, + o = r / a, + l = this.nextAudioPts, + u = this._initDTS, + c = (u.baseTime * 9e4) / u.timescale, + d = (l !== null ? l : n.startDTS * r) + c, + f = n.endDTS * r + c, + g = o * go, + p = Math.ceil((f - d) / g), + v = ho.getSilentFrame(e.manifestCodec || e.codec, e.channelCount); + if ((D.warn("[mp4-remuxer]: remux empty Audio"), !v)) { + D.trace( + "[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec" + ); + return; + } + const T = []; + for (let x = 0; x < p; x++) { + const I = d + x * g; + T.push({ unit: v, pts: I, dts: I }); + } + return (e.samples = T), this.remuxAudio(e, t, i, !1); + } + } + function nt(s, e) { + let t; + if (e === null) return s; + for ( + e < s ? (t = -8589934592) : (t = 8589934592); + Math.abs(s - e) > 4294967296; + + ) + s += t; + return s; + } + function Fd(s) { + for (let e = 0; e < s.length; e++) if (s[e].key) return e; + return -1; + } + function po(s, e, t, i) { + const n = s.samples.length; + if (!n) return; + const r = s.inputTimeScale; + for (let o = 0; o < n; o++) { + const l = s.samples[o]; + (l.pts = nt(l.pts - (t.baseTime * r) / t.timescale, e * r) / r), + (l.dts = nt(l.dts - (i.baseTime * r) / i.timescale, e * r) / r); + } + const a = s.samples; + return (s.samples = []), { samples: a }; + } + function mo(s, e, t) { + const i = s.samples.length; + if (!i) return; + const n = s.inputTimeScale; + for (let a = 0; a < i; a++) { + const o = s.samples[a]; + o.pts = nt(o.pts - (t.baseTime * n) / t.timescale, e * n) / n; + } + s.samples.sort((a, o) => a.pts - o.pts); + const r = s.samples; + return (s.samples = []), { samples: r }; + } + class Ao { + constructor(e, t, i, n) { + (this.size = void 0), + (this.duration = void 0), + (this.cts = void 0), + (this.flags = void 0), + (this.duration = t), + (this.size = i), + (this.cts = n), + (this.flags = new Md(e)); + } + } + class Md { + constructor(e) { + (this.isLeading = 0), + (this.isDependedOn = 0), + (this.hasRedundancy = 0), + (this.degradPrio = 0), + (this.dependsOn = 1), + (this.isNonSync = 1), + (this.dependsOn = e ? 2 : 1), + (this.isNonSync = e ? 0 : 1); + } + } + class Bd { + constructor() { + (this.emitInitSegment = !1), + (this.audioCodec = void 0), + (this.videoCodec = void 0), + (this.initData = void 0), + (this.initPTS = null), + (this.initTracks = void 0), + (this.lastEndTime = null); + } + destroy() {} + resetTimeStamp(e) { + (this.initPTS = e), (this.lastEndTime = null); + } + resetNextTimestamp() { + this.lastEndTime = null; + } + resetInitSegment(e, t, i, n) { + (this.audioCodec = t), + (this.videoCodec = i), + this.generateInitSegment(rh(e, n)), + (this.emitInitSegment = !0); + } + generateInitSegment(e) { + let { audioCodec: t, videoCodec: i } = this; + if (!(e != null && e.byteLength)) { + (this.initTracks = void 0), (this.initData = void 0); + return; + } + const n = (this.initData = ya(e)); + t || (t = yo(n.audio, _e.AUDIO)), i || (i = yo(n.video, _e.VIDEO)); + const r = {}; + n.audio && n.video + ? (r.audiovideo = { + container: "video/mp4", + codec: t + "," + i, + initSegment: e, + id: "main", + }) + : n.audio + ? (r.audio = { + container: "audio/mp4", + codec: t, + initSegment: e, + id: "audio", + }) + : n.video + ? (r.video = { + container: "video/mp4", + codec: i, + initSegment: e, + id: "main", + }) + : D.warn( + "[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes." + ), + (this.initTracks = r); + } + remux(e, t, i, n, r, a) { + var o, l; + let { initPTS: u, lastEndTime: c } = this; + const d = { + audio: void 0, + video: void 0, + text: n, + id3: i, + initSegment: void 0, + }; + ne(c) || (c = this.lastEndTime = r || 0); + const f = t.samples; + if (!(f != null && f.length)) return d; + const g = { initPTS: void 0, timescale: 1 }; + let p = this.initData; + if ( + (((o = p) != null && o.length) || + (this.generateInitSegment(f), (p = this.initData)), + !((l = p) != null && l.length)) + ) + return ( + D.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."), d + ); + this.emitInitSegment && + ((g.tracks = this.initTracks), (this.emitInitSegment = !1)); + const v = ah(f, p), + T = sh(p, f), + x = T === null ? r : T; + (Ud(u, x, r, v) || (g.timescale !== u.timescale && a)) && + ((g.initPTS = x - r), + u && + u.timescale === 1 && + D.warn(`Adjusting initPTS by ${g.initPTS - u.baseTime}`), + (this.initPTS = u = { baseTime: g.initPTS, timescale: 1 })); + const I = e ? x - u.baseTime / u.timescale : c, + L = I + v; + lh(p, f, u.baseTime / u.timescale), + v > 0 + ? (this.lastEndTime = L) + : (D.warn("Duration parsed from mp4 should be greater than zero"), + this.resetNextTimestamp()); + const M = !!p.audio, + O = !!p.video; + let j = ""; + M && (j += "audio"), O && (j += "video"); + const U = { + data1: f, + startPTS: I, + startDTS: I, + endPTS: L, + endDTS: L, + type: j, + hasAudio: M, + hasVideo: O, + nb: 1, + dropped: 0, + }; + return ( + (d.audio = U.type === "audio" ? U : void 0), + (d.video = U.type !== "audio" ? U : void 0), + (d.initSegment = g), + (d.id3 = po(i, r, u, u)), + n.samples.length && (d.text = mo(n, r, u)), + d + ); + } + } + function Ud(s, e, t, i) { + if (s === null) return !0; + const n = Math.max(i, 1), + r = e - s.baseTime / s.timescale; + return Math.abs(r - t) > n; + } + function yo(s, e) { + const t = s == null ? void 0 : s.codec; + return t && t.length > 4 + ? t + : t === "hvc1" || t === "hev1" + ? "hvc1.1.6.L120.90" + : t === "av01" + ? "av01.0.04M.08" + : t === "avc1" || e === _e.VIDEO + ? "avc1.42e01e" + : "mp4a.40.5"; + } + let _t; + try { + _t = self.performance.now.bind(self.performance); + } catch { + D.debug("Unable to use Performance API on this environment"), + (_t = typeof self < "u" && self.Date.now); + } + const br = [ + { demux: Td, remux: Bd }, + { demux: Ot, remux: Tr }, + { demux: vd, remux: Tr }, + { demux: Pd, remux: Tr }, + ]; + class vo { + constructor(e, t, i, n, r) { + (this.async = !1), + (this.observer = void 0), + (this.typeSupported = void 0), + (this.config = void 0), + (this.vendor = void 0), + (this.id = void 0), + (this.demuxer = void 0), + (this.remuxer = void 0), + (this.decrypter = void 0), + (this.probe = void 0), + (this.decryptionPromise = null), + (this.transmuxConfig = void 0), + (this.currentTransmuxState = void 0), + (this.observer = e), + (this.typeSupported = t), + (this.config = i), + (this.vendor = n), + (this.id = r); + } + configure(e) { + (this.transmuxConfig = e), this.decrypter && this.decrypter.reset(); + } + push(e, t, i, n) { + const r = i.transmuxing; + r.executeStart = _t(); + let a = new Uint8Array(e); + const { currentTransmuxState: o, transmuxConfig: l } = this; + n && (this.currentTransmuxState = n); + const { + contiguous: u, + discontinuity: c, + trackSwitch: d, + accurateTimeOffset: f, + timeOffset: g, + initSegmentChange: p, + } = n || o, + { + audioCodec: v, + videoCodec: T, + defaultInitPts: x, + duration: I, + initSegmentData: L, + } = l, + M = $d(a, t); + if (M && M.method === "AES-128") { + const Y = this.getDecrypter(); + if (Y.isSync()) { + let _ = Y.softwareDecrypt(a, M.key.buffer, M.iv.buffer); + if ((i.part > -1 && (_ = Y.flush()), !_)) + return (r.executeEnd = _t()), _r(i); + a = new Uint8Array(_); + } else + return ( + (this.decryptionPromise = Y.webCryptoDecrypt( + a, + M.key.buffer, + M.iv.buffer + ).then((_) => { + const E = this.push(_, null, i); + return (this.decryptionPromise = null), E; + })), + this.decryptionPromise + ); + } + const O = this.needsProbing(c, d); + if (O) { + const Y = this.configureTransmuxer(a); + if (Y) + return ( + D.warn(`[transmuxer] ${Y.message}`), + this.observer.emit(y.ERROR, y.ERROR, { + type: re.MEDIA_ERROR, + details: $.FRAG_PARSING_ERROR, + fatal: !1, + error: Y, + reason: Y.message, + }), + (r.executeEnd = _t()), + _r(i) + ); + } + (c || d || p || O) && this.resetInitSegment(L, v, T, I, t), + (c || p || O) && this.resetInitialTimestamp(x), + u || this.resetContiguity(); + const j = this.transmux(a, M, g, f, i), + U = this.currentTransmuxState; + return ( + (U.contiguous = !0), + (U.discontinuity = !1), + (U.trackSwitch = !1), + (r.executeEnd = _t()), + j + ); + } + flush(e) { + const t = e.transmuxing; + t.executeStart = _t(); + const { + decrypter: i, + currentTransmuxState: n, + decryptionPromise: r, + } = this; + if (r) return r.then(() => this.flush(e)); + const a = [], + { timeOffset: o } = n; + if (i) { + const d = i.flush(); + d && a.push(this.push(d, null, e)); + } + const { demuxer: l, remuxer: u } = this; + if (!l || !u) return (t.executeEnd = _t()), [_r(e)]; + const c = l.flush(o); + return dn(c) + ? c.then((d) => (this.flushRemux(a, d, e), a)) + : (this.flushRemux(a, c, e), a); + } + flushRemux(e, t, i) { + const { audioTrack: n, videoTrack: r, id3Track: a, textTrack: o } = t, + { accurateTimeOffset: l, timeOffset: u } = this.currentTransmuxState; + D.log( + `[transmuxer.ts]: Flushed fragment ${i.sn}${ + i.part > -1 ? " p: " + i.part : "" + } of level ${i.level}` + ); + const c = this.remuxer.remux(n, r, a, o, u, l, !0, this.id); + e.push({ remuxResult: c, chunkMeta: i }), + (i.transmuxing.executeEnd = _t()); + } + resetInitialTimestamp(e) { + const { demuxer: t, remuxer: i } = this; + !t || !i || (t.resetTimeStamp(e), i.resetTimeStamp(e)); + } + resetContiguity() { + const { demuxer: e, remuxer: t } = this; + !e || !t || (e.resetContiguity(), t.resetNextTimestamp()); + } + resetInitSegment(e, t, i, n, r) { + const { demuxer: a, remuxer: o } = this; + !a || + !o || + (a.resetInitSegment(e, t, i, n), o.resetInitSegment(e, t, i, r)); + } + destroy() { + this.demuxer && (this.demuxer.destroy(), (this.demuxer = void 0)), + this.remuxer && (this.remuxer.destroy(), (this.remuxer = void 0)); + } + transmux(e, t, i, n, r) { + let a; + return ( + t && t.method === "SAMPLE-AES" + ? (a = this.transmuxSampleAes(e, t, i, n, r)) + : (a = this.transmuxUnencrypted(e, i, n, r)), + a + ); + } + transmuxUnencrypted(e, t, i, n) { + const { + audioTrack: r, + videoTrack: a, + id3Track: o, + textTrack: l, + } = this.demuxer.demux(e, t, !1, !this.config.progressive); + return { + remuxResult: this.remuxer.remux(r, a, o, l, t, i, !1, this.id), + chunkMeta: n, + }; + } + transmuxSampleAes(e, t, i, n, r) { + return this.demuxer + .demuxSampleAes(e, t, i) + .then((a) => ({ + remuxResult: this.remuxer.remux( + a.audioTrack, + a.videoTrack, + a.id3Track, + a.textTrack, + i, + n, + !1, + this.id + ), + chunkMeta: r, + })); + } + configureTransmuxer(e) { + const { config: t, observer: i, typeSupported: n, vendor: r } = this; + let a; + for (let d = 0, f = br.length; d < f; d++) + if (br[d].demux.probe(e)) { + a = br[d]; + break; + } + if (!a) + return new Error("Failed to find demuxer by probing fragment data"); + const o = this.demuxer, + l = this.remuxer, + u = a.remux, + c = a.demux; + (!l || !(l instanceof u)) && (this.remuxer = new u(i, t, n, r)), + (!o || !(o instanceof c)) && + ((this.demuxer = new c(i, t, n)), (this.probe = c.probe)); + } + needsProbing(e, t) { + return !this.demuxer || !this.remuxer || e || t; + } + getDecrypter() { + let e = this.decrypter; + return e || (e = this.decrypter = new gr(this.config)), e; + } + } + function $d(s, e) { + let t = null; + return ( + s.byteLength > 0 && + e != null && + e.key != null && + e.iv !== null && + e.method != null && + (t = e), + t + ); + } + const _r = (s) => ({ remuxResult: {}, chunkMeta: s }); + function dn(s) { + return "then" in s && s.then instanceof Function; + } + class Vd { + constructor(e, t, i, n, r) { + (this.audioCodec = void 0), + (this.videoCodec = void 0), + (this.initSegmentData = void 0), + (this.duration = void 0), + (this.defaultInitPts = void 0), + (this.audioCodec = e), + (this.videoCodec = t), + (this.initSegmentData = i), + (this.duration = n), + (this.defaultInitPts = r || null); + } + } + class Gd { + constructor(e, t, i, n, r, a) { + (this.discontinuity = void 0), + (this.contiguous = void 0), + (this.accurateTimeOffset = void 0), + (this.trackSwitch = void 0), + (this.timeOffset = void 0), + (this.initSegmentChange = void 0), + (this.discontinuity = e), + (this.contiguous = t), + (this.accurateTimeOffset = i), + (this.trackSwitch = n), + (this.timeOffset = r), + (this.initSegmentChange = a); + } + } + var Eo = { exports: {} }; + (function (s) { + var e = Object.prototype.hasOwnProperty, + t = "~"; + function i() {} + Object.create && + ((i.prototype = Object.create(null)), new i().__proto__ || (t = !1)); + function n(l, u, c) { + (this.fn = l), (this.context = u), (this.once = c || !1); + } + function r(l, u, c, d, f) { + if (typeof c != "function") + throw new TypeError("The listener must be a function"); + var g = new n(c, d || l, f), + p = t ? t + u : u; + return ( + l._events[p] + ? l._events[p].fn + ? (l._events[p] = [l._events[p], g]) + : l._events[p].push(g) + : ((l._events[p] = g), l._eventsCount++), + l + ); + } + function a(l, u) { + --l._eventsCount === 0 ? (l._events = new i()) : delete l._events[u]; + } + function o() { + (this._events = new i()), (this._eventsCount = 0); + } + (o.prototype.eventNames = function () { + var u = [], + c, + d; + if (this._eventsCount === 0) return u; + for (d in (c = this._events)) e.call(c, d) && u.push(t ? d.slice(1) : d); + return Object.getOwnPropertySymbols + ? u.concat(Object.getOwnPropertySymbols(c)) + : u; + }), + (o.prototype.listeners = function (u) { + var c = t ? t + u : u, + d = this._events[c]; + if (!d) return []; + if (d.fn) return [d.fn]; + for (var f = 0, g = d.length, p = new Array(g); f < g; f++) + p[f] = d[f].fn; + return p; + }), + (o.prototype.listenerCount = function (u) { + var c = t ? t + u : u, + d = this._events[c]; + return d ? (d.fn ? 1 : d.length) : 0; + }), + (o.prototype.emit = function (u, c, d, f, g, p) { + var v = t ? t + u : u; + if (!this._events[v]) return !1; + var T = this._events[v], + x = arguments.length, + I, + L; + if (T.fn) { + switch ((T.once && this.removeListener(u, T.fn, void 0, !0), x)) { + case 1: + return T.fn.call(T.context), !0; + case 2: + return T.fn.call(T.context, c), !0; + case 3: + return T.fn.call(T.context, c, d), !0; + case 4: + return T.fn.call(T.context, c, d, f), !0; + case 5: + return T.fn.call(T.context, c, d, f, g), !0; + case 6: + return T.fn.call(T.context, c, d, f, g, p), !0; + } + for (L = 1, I = new Array(x - 1); L < x; L++) I[L - 1] = arguments[L]; + T.fn.apply(T.context, I); + } else { + var M = T.length, + O; + for (L = 0; L < M; L++) + switch ( + (T[L].once && this.removeListener(u, T[L].fn, void 0, !0), x) + ) { + case 1: + T[L].fn.call(T[L].context); + break; + case 2: + T[L].fn.call(T[L].context, c); + break; + case 3: + T[L].fn.call(T[L].context, c, d); + break; + case 4: + T[L].fn.call(T[L].context, c, d, f); + break; + default: + if (!I) + for (O = 1, I = new Array(x - 1); O < x; O++) + I[O - 1] = arguments[O]; + T[L].fn.apply(T[L].context, I); + } + } + return !0; + }), + (o.prototype.on = function (u, c, d) { + return r(this, u, c, d, !1); + }), + (o.prototype.once = function (u, c, d) { + return r(this, u, c, d, !0); + }), + (o.prototype.removeListener = function (u, c, d, f) { + var g = t ? t + u : u; + if (!this._events[g]) return this; + if (!c) return a(this, g), this; + var p = this._events[g]; + if (p.fn) + p.fn === c && (!f || p.once) && (!d || p.context === d) && a(this, g); + else { + for (var v = 0, T = [], x = p.length; v < x; v++) + (p[v].fn !== c || (f && !p[v].once) || (d && p[v].context !== d)) && + T.push(p[v]); + T.length ? (this._events[g] = T.length === 1 ? T[0] : T) : a(this, g); + } + return this; + }), + (o.prototype.removeAllListeners = function (u) { + var c; + return ( + u + ? ((c = t ? t + u : u), this._events[c] && a(this, c)) + : ((this._events = new i()), (this._eventsCount = 0)), + this + ); + }), + (o.prototype.off = o.prototype.removeListener), + (o.prototype.addListener = o.prototype.on), + (o.prefixed = t), + (o.EventEmitter = o), + (s.exports = o); + })(Eo); + var Kd = Eo.exports, + kr = Lc(Kd); + const Sr = en() || { isTypeSupported: () => !1 }; + class To { + constructor(e, t, i, n) { + (this.error = null), + (this.hls = void 0), + (this.id = void 0), + (this.observer = void 0), + (this.frag = null), + (this.part = null), + (this.useWorker = void 0), + (this.workerContext = null), + (this.onwmsg = void 0), + (this.transmuxer = null), + (this.onTransmuxComplete = void 0), + (this.onFlush = void 0); + const r = e.config; + (this.hls = e), + (this.id = t), + (this.useWorker = !!r.enableWorker), + (this.onTransmuxComplete = i), + (this.onFlush = n); + const a = (u, c) => { + (c = c || {}), + (c.frag = this.frag), + (c.id = this.id), + u === y.ERROR && (this.error = c.error), + this.hls.trigger(u, c); + }; + (this.observer = new kr()), + this.observer.on(y.FRAG_DECRYPTED, a), + this.observer.on(y.ERROR, a); + const o = { + mp4: Sr.isTypeSupported("video/mp4"), + mpeg: Sr.isTypeSupported("audio/mpeg"), + mp3: Sr.isTypeSupported('audio/mp4; codecs="mp3"'), + }, + l = navigator.vendor; + if (this.useWorker && typeof Worker < "u" && (r.workerPath || cd())) { + try { + r.workerPath + ? (D.log(`loading Web Worker ${r.workerPath} for "${t}"`), + (this.workerContext = dd(r.workerPath))) + : (D.log(`injecting Web Worker for "${t}"`), + (this.workerContext = hd())), + (this.onwmsg = (d) => this.onWorkerMessage(d)); + const { worker: c } = this.workerContext; + c.addEventListener("message", this.onwmsg), + (c.onerror = (d) => { + const f = new Error(`${d.message} (${d.filename}:${d.lineno})`); + (r.enableWorker = !1), + D.warn(`Error in "${t}" Web Worker, fallback to inline`), + this.hls.trigger(y.ERROR, { + type: re.OTHER_ERROR, + details: $.INTERNAL_EXCEPTION, + fatal: !1, + event: "demuxerWorker", + error: f, + }); + }), + c.postMessage({ + cmd: "init", + typeSupported: o, + vendor: l, + id: t, + config: JSON.stringify(r), + }); + } catch (c) { + D.warn(`Error setting up "${t}" Web Worker, fallback to inline`, c), + this.resetWorker(), + (this.error = null), + (this.transmuxer = new vo(this.observer, o, r, l, t)); + } + return; + } + this.transmuxer = new vo(this.observer, o, r, l, t); + } + resetWorker() { + if (this.workerContext) { + const { worker: e, objectURL: t } = this.workerContext; + t && self.URL.revokeObjectURL(t), + e.removeEventListener("message", this.onwmsg), + (e.onerror = null), + e.terminate(), + (this.workerContext = null); + } + } + destroy() { + if (this.workerContext) this.resetWorker(), (this.onwmsg = void 0); + else { + const t = this.transmuxer; + t && (t.destroy(), (this.transmuxer = null)); + } + const e = this.observer; + e && e.removeAllListeners(), + (this.frag = null), + (this.observer = null), + (this.hls = null); + } + push(e, t, i, n, r, a, o, l, u, c) { + var d, f; + u.transmuxing.start = self.performance.now(); + const { transmuxer: g } = this, + p = a ? a.start : r.start, + v = r.decryptdata, + T = this.frag, + x = !(T && r.cc === T.cc), + I = !(T && u.level === T.level), + L = T ? u.sn - T.sn : -1, + M = this.part ? u.part - this.part.index : -1, + O = + L === 0 && + u.id > 1 && + u.id === (T == null ? void 0 : T.stats.chunkCount), + j = !I && (L === 1 || (L === 0 && (M === 1 || (O && M <= 0)))), + U = self.performance.now(); + (I || L || r.stats.parsing.start === 0) && (r.stats.parsing.start = U), + a && (M || !j) && (a.stats.parsing.start = U); + const Y = !( + T && + ((d = r.initSegment) == null ? void 0 : d.url) === + ((f = T.initSegment) == null ? void 0 : f.url) + ), + _ = new Gd(x, j, l, I, p, Y); + if (!j || x || Y) { + D.log(`[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${u.sn} p: ${u.part} level: ${u.level} id: ${u.id} + discontinuity: ${x} + trackSwitch: ${I} + contiguous: ${j} + accurateTimeOffset: ${l} + timeOffset: ${p} + initSegmentChange: ${Y}`); + const E = new Vd(i, n, t, o, c); + this.configureTransmuxer(E); + } + if (((this.frag = r), (this.part = a), this.workerContext)) + this.workerContext.worker.postMessage( + { cmd: "demux", data: e, decryptdata: v, chunkMeta: u, state: _ }, + e instanceof ArrayBuffer ? [e] : [] + ); + else if (g) { + const E = g.push(e, v, u, _); + dn(E) + ? ((g.async = !0), + E.then((w) => { + this.handleTransmuxComplete(w); + }).catch((w) => { + this.transmuxerError(w, u, "transmuxer-interface push error"); + })) + : ((g.async = !1), this.handleTransmuxComplete(E)); + } + } + flush(e) { + e.transmuxing.start = self.performance.now(); + const { transmuxer: t } = this; + if (this.workerContext) + this.workerContext.worker.postMessage({ cmd: "flush", chunkMeta: e }); + else if (t) { + let i = t.flush(e); + dn(i) || t.async + ? (dn(i) || (i = Promise.resolve(i)), + i + .then((r) => { + this.handleFlushResult(r, e); + }) + .catch((r) => { + this.transmuxerError(r, e, "transmuxer-interface flush error"); + })) + : this.handleFlushResult(i, e); + } + } + transmuxerError(e, t, i) { + this.hls && + ((this.error = e), + this.hls.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.FRAG_PARSING_ERROR, + chunkMeta: t, + fatal: !1, + error: e, + err: e, + reason: i, + })); + } + handleFlushResult(e, t) { + e.forEach((i) => { + this.handleTransmuxComplete(i); + }), + this.onFlush(t); + } + onWorkerMessage(e) { + const t = e.data, + i = this.hls; + switch (t.event) { + case "init": { + var n; + const r = (n = this.workerContext) == null ? void 0 : n.objectURL; + r && self.URL.revokeObjectURL(r); + break; + } + case "transmuxComplete": { + this.handleTransmuxComplete(t.data); + break; + } + case "flush": { + this.onFlush(t.data); + break; + } + case "workerLog": + D[t.data.logType] && D[t.data.logType](t.data.message); + break; + default: { + (t.data = t.data || {}), + (t.data.frag = this.frag), + (t.data.id = this.id), + i.trigger(t.event, t.data); + break; + } + } + } + configureTransmuxer(e) { + const { transmuxer: t } = this; + this.workerContext + ? this.workerContext.worker.postMessage({ cmd: "configure", config: e }) + : t && t.configure(e); + } + handleTransmuxComplete(e) { + (e.chunkMeta.transmuxing.end = self.performance.now()), + this.onTransmuxComplete(e); + } + } + const Hd = 250, + Cr = 2, + Yd = 0.1, + zd = 0.05; + class Wd { + constructor(e, t, i, n) { + (this.config = void 0), + (this.media = null), + (this.fragmentTracker = void 0), + (this.hls = void 0), + (this.nudgeRetry = 0), + (this.stallReported = !1), + (this.stalled = null), + (this.moved = !1), + (this.seeking = !1), + (this.config = e), + (this.media = t), + (this.fragmentTracker = i), + (this.hls = n); + } + destroy() { + (this.media = null), (this.hls = this.fragmentTracker = null); + } + poll(e, t) { + const { config: i, media: n, stalled: r } = this; + if (n === null) return; + const { currentTime: a, seeking: o } = n, + l = this.seeking && !o, + u = !this.seeking && o; + if (((this.seeking = o), a !== e)) { + if (((this.moved = !0), r !== null)) { + if (this.stallReported) { + const x = self.performance.now() - r; + D.warn( + `playback not stuck anymore @${a}, after ${Math.round(x)}ms` + ), + (this.stallReported = !1); + } + (this.stalled = null), (this.nudgeRetry = 0); + } + return; + } + if (u || l) { + this.stalled = null; + return; + } + if ( + (n.paused && !o) || + n.ended || + n.playbackRate === 0 || + !Se.getBuffered(n).length + ) + return; + const c = Se.bufferInfo(n, a, 0), + d = c.len > 0, + f = c.nextStart || 0; + if (!d && !f) return; + if (o) { + const x = c.len > Cr, + I = + !f || + (t && t.start <= a) || + (f - a > Cr && !this.fragmentTracker.getPartialFragment(a)); + if (x || I) return; + this.moved = !1; + } + if (!this.moved && this.stalled !== null) { + var g; + const x = Math.max(f, c.start || 0) - a, + I = this.hls.levels ? this.hls.levels[this.hls.currentLevel] : null, + M = (I == null || (g = I.details) == null ? void 0 : g.live) + ? I.details.targetduration * 2 + : Cr, + O = this.fragmentTracker.getPartialFragment(a); + if (x > 0 && (x <= M || O)) { + this._trySkipBufferHole(O); + return; + } + } + const p = self.performance.now(); + if (r === null) { + this.stalled = p; + return; + } + const v = p - r; + if (!o && v >= Hd && (this._reportStall(c), !this.media)) return; + const T = Se.bufferInfo(n, a, i.maxBufferHole); + this._tryFixBufferStall(T, v); + } + _tryFixBufferStall(e, t) { + const { config: i, fragmentTracker: n, media: r } = this; + if (r === null) return; + const a = r.currentTime, + o = n.getPartialFragment(a); + (o && (this._trySkipBufferHole(o) || !this.media)) || + ((e.len > i.maxBufferHole || + (e.nextStart && e.nextStart - a < i.maxBufferHole)) && + t > i.highBufferWatchdogPeriod * 1e3 && + (D.warn("Trying to nudge playhead over buffer-hole"), + (this.stalled = null), + this._tryNudgeBuffer())); + } + _reportStall(e) { + const { hls: t, media: i, stallReported: n } = this; + if (!n && i) { + this.stallReported = !0; + const r = new Error( + `Playback stalling at @${ + i.currentTime + } due to low buffer (${JSON.stringify(e)})` + ); + D.warn(r.message), + t.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.BUFFER_STALLED_ERROR, + fatal: !1, + error: r, + buffer: e.len, + }); + } + } + _trySkipBufferHole(e) { + const { config: t, hls: i, media: n } = this; + if (n === null) return 0; + const r = n.currentTime, + a = Se.bufferInfo(n, r, 0), + o = r < a.start ? a.start : a.nextStart; + if (o) { + const l = a.len <= t.maxBufferHole, + u = a.len > 0 && a.len < 1 && n.readyState < 3, + c = o - r; + if (c > 0 && (l || u)) { + if (c > t.maxBufferHole) { + const { fragmentTracker: f } = this; + let g = !1; + if (r === 0) { + const p = f.getAppendedFrag(0, se.MAIN); + p && o < p.end && (g = !0); + } + if (!g) { + const p = e || f.getAppendedFrag(r, se.MAIN); + if (p) { + let v = !1, + T = p.end; + for (; T < o; ) { + const x = f.getPartialFragment(T); + if (x) T += x.duration; + else { + v = !0; + break; + } + } + if (v) return 0; + } + } + } + const d = Math.max(o + zd, r + Yd); + if ( + (D.warn(`skipping hole, adjusting currentTime from ${r} to ${d}`), + (this.moved = !0), + (this.stalled = null), + (n.currentTime = d), + e && !e.gap) + ) { + const f = new Error( + `fragment loaded with buffer holes, seeking from ${r} to ${d}` + ); + i.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.BUFFER_SEEK_OVER_HOLE, + fatal: !1, + error: f, + reason: f.message, + frag: e, + }); + } + return d; + } + } + return 0; + } + _tryNudgeBuffer() { + const { config: e, hls: t, media: i, nudgeRetry: n } = this; + if (i === null) return; + const r = i.currentTime; + if ((this.nudgeRetry++, n < e.nudgeMaxRetry)) { + const a = r + (n + 1) * e.nudgeOffset, + o = new Error(`Nudging 'currentTime' from ${r} to ${a}`); + D.warn(o.message), + (i.currentTime = a), + t.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.BUFFER_NUDGE_ON_STALL, + error: o, + fatal: !1, + }); + } else { + const a = new Error( + `Playhead still not moving while enough data buffered @${r} after ${e.nudgeMaxRetry} nudges` + ); + D.error(a.message), + t.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.BUFFER_STALLED_ERROR, + error: a, + fatal: !0, + }); + } + } + } + const jd = 100; + class qd extends pr { + constructor(e, t, i) { + super(e, t, i, "[stream-controller]", se.MAIN), + (this.audioCodecSwap = !1), + (this.gapController = null), + (this.level = -1), + (this._forceStartLoad = !1), + (this.altAudio = !1), + (this.audioOnly = !1), + (this.fragPlaying = null), + (this.onvplaying = null), + (this.onvseeked = null), + (this.fragLastKbps = 0), + (this.couldBacktrack = !1), + (this.backtrackFragment = null), + (this.audioCodecSwitch = !1), + (this.videoBuffer = null), + this._registerListeners(); + } + _registerListeners() { + const { hls: e } = this; + e.on(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.on(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.on(y.LEVEL_LOADING, this.onLevelLoading, this), + e.on(y.LEVEL_LOADED, this.onLevelLoaded, this), + e.on( + y.FRAG_LOAD_EMERGENCY_ABORTED, + this.onFragLoadEmergencyAborted, + this + ), + e.on(y.ERROR, this.onError, this), + e.on(y.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), + e.on(y.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), + e.on(y.BUFFER_CREATED, this.onBufferCreated, this), + e.on(y.BUFFER_FLUSHED, this.onBufferFlushed, this), + e.on(y.LEVELS_UPDATED, this.onLevelsUpdated, this), + e.on(y.FRAG_BUFFERED, this.onFragBuffered, this); + } + _unregisterListeners() { + const { hls: e } = this; + e.off(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.off(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.off(y.LEVEL_LOADED, this.onLevelLoaded, this), + e.off( + y.FRAG_LOAD_EMERGENCY_ABORTED, + this.onFragLoadEmergencyAborted, + this + ), + e.off(y.ERROR, this.onError, this), + e.off(y.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), + e.off(y.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), + e.off(y.BUFFER_CREATED, this.onBufferCreated, this), + e.off(y.BUFFER_FLUSHED, this.onBufferFlushed, this), + e.off(y.LEVELS_UPDATED, this.onLevelsUpdated, this), + e.off(y.FRAG_BUFFERED, this.onFragBuffered, this); + } + onHandlerDestroying() { + this._unregisterListeners(), this.onMediaDetaching(); + } + startLoad(e) { + if (this.levels) { + const { lastCurrentTime: t, hls: i } = this; + if ( + (this.stopLoad(), + this.setInterval(jd), + (this.level = -1), + !this.startFragRequested) + ) { + let n = i.startLevel; + n === -1 && + (i.config.testBandwidth && this.levels.length > 1 + ? ((n = 0), (this.bitrateTest = !0)) + : (n = i.nextAutoLevel)), + (this.level = i.nextLoadLevel = n), + (this.loadedmetadata = !1); + } + t > 0 && + e === -1 && + (this.log( + `Override startPosition with lastCurrentTime @${t.toFixed(3)}` + ), + (e = t)), + (this.state = H.IDLE), + (this.nextLoadPosition = + this.startPosition = + this.lastCurrentTime = + e), + this.tick(); + } else (this._forceStartLoad = !0), (this.state = H.STOPPED); + } + stopLoad() { + (this._forceStartLoad = !1), super.stopLoad(); + } + doTick() { + switch (this.state) { + case H.WAITING_LEVEL: { + var e; + const { levels: i, level: n } = this, + r = i == null || (e = i[n]) == null ? void 0 : e.details; + if (r && (!r.live || this.levelLastLoaded === this.level)) { + if (this.waitForCdnTuneIn(r)) break; + this.state = H.IDLE; + break; + } else if (this.hls.nextLoadLevel !== this.level) { + this.state = H.IDLE; + break; + } + break; + } + case H.FRAG_LOADING_WAITING_RETRY: + { + var t; + const i = self.performance.now(), + n = this.retryDate; + (!n || i >= n || ((t = this.media) != null && t.seeking)) && + (this.resetStartWhenNotLoaded(this.level), (this.state = H.IDLE)); + } + break; + } + this.state === H.IDLE && this.doTickIdle(), this.onTickEnd(); + } + onTickEnd() { + super.onTickEnd(), this.checkBuffer(), this.checkFragmentChanged(); + } + doTickIdle() { + const { hls: e, levelLastLoaded: t, levels: i, media: n } = this, + { config: r, nextLoadLevel: a } = e; + if ( + t === null || + (!n && (this.startFragRequested || !r.startFragPrefetch)) || + (this.altAudio && this.audioOnly) || + !(i != null && i[a]) + ) + return; + const o = i[a], + l = this.getMainFwdBufferInfo(); + if (l === null) return; + const u = this.getLevelDetails(); + if (u && this._streamEnded(l, u)) { + const T = {}; + this.altAudio && (T.type = "video"), + this.hls.trigger(y.BUFFER_EOS, T), + (this.state = H.ENDED); + return; + } + e.loadLevel !== a && + e.manualLevel === -1 && + this.log(`Adapting to level ${a} from level ${this.level}`), + (this.level = e.nextLoadLevel = a); + const c = o.details; + if ( + !c || + this.state === H.WAITING_LEVEL || + (c.live && this.levelLastLoaded !== a) + ) { + (this.level = a), (this.state = H.WAITING_LEVEL); + return; + } + const d = l.len, + f = this.getMaxBufferLength(o.maxBitrate); + if (d >= f) return; + this.backtrackFragment && + this.backtrackFragment.start > l.end && + (this.backtrackFragment = null); + const g = this.backtrackFragment ? this.backtrackFragment.start : l.end; + let p = this.getNextFragment(g, c); + if ( + this.couldBacktrack && + !this.fragPrevious && + p && + p.sn !== "initSegment" && + this.fragmentTracker.getState(p) !== Be.OK + ) { + var v; + const x = ((v = this.backtrackFragment) != null ? v : p).sn - c.startSN, + I = c.fragments[x - 1]; + I && p.cc === I.cc && ((p = I), this.fragmentTracker.removeFragment(I)); + } else this.backtrackFragment && l.len && (this.backtrackFragment = null); + if (p && this.isLoopLoading(p, g)) { + if (!p.gap) { + const x = this.audioOnly && !this.altAudio ? _e.AUDIO : _e.VIDEO, + I = + (x === _e.VIDEO ? this.videoBuffer : this.mediaBuffer) || + this.media; + I && this.afterBufferFlushed(I, x, se.MAIN); + } + p = this.getNextFragmentLoopLoading(p, c, l, se.MAIN, f); + } + p && + (p.initSegment && + !p.initSegment.data && + !this.bitrateTest && + (p = p.initSegment), + this.loadFragment(p, o, g)); + } + loadFragment(e, t, i) { + const n = this.fragmentTracker.getState(e); + (this.fragCurrent = e), + n === Be.NOT_LOADED || n === Be.PARTIAL + ? e.sn === "initSegment" + ? this._loadInitSegment(e, t) + : this.bitrateTest + ? (this.log( + `Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered` + ), + this._loadBitrateTestFrag(e, t)) + : ((this.startFragRequested = !0), super.loadFragment(e, t, i)) + : this.clearTrackerIfNeeded(e); + } + getBufferedFrag(e) { + return this.fragmentTracker.getBufferedFrag(e, se.MAIN); + } + followingBufferedFrag(e) { + return e ? this.getBufferedFrag(e.end + 0.5) : null; + } + immediateLevelSwitch() { + this.abortCurrentFrag(), + this.flushMainBuffer(0, Number.POSITIVE_INFINITY); + } + nextLevelSwitch() { + const { levels: e, media: t } = this; + if (t != null && t.readyState) { + let i; + const n = this.getAppendedFrag(t.currentTime); + n && n.start > 1 && this.flushMainBuffer(0, n.start - 1); + const r = this.getLevelDetails(); + if (r != null && r.live) { + const o = this.getMainFwdBufferInfo(); + if (!o || o.len < r.targetduration * 2) return; + } + if (!t.paused && e) { + const o = this.hls.nextLoadLevel, + l = e[o], + u = this.fragLastKbps; + u && this.fragCurrent + ? (i = (this.fragCurrent.duration * l.maxBitrate) / (1e3 * u) + 1) + : (i = 0); + } else i = 0; + const a = this.getBufferedFrag(t.currentTime + i); + if (a) { + const o = this.followingBufferedFrag(a); + if (o) { + this.abortCurrentFrag(); + const l = o.maxStartPTS ? o.maxStartPTS : o.start, + u = o.duration, + c = Math.max( + a.end, + l + + Math.min( + Math.max(u - this.config.maxFragLookUpTolerance, u * 0.5), + u * 0.75 + ) + ); + this.flushMainBuffer(c, Number.POSITIVE_INFINITY); + } + } + } + } + abortCurrentFrag() { + const e = this.fragCurrent; + switch ( + ((this.fragCurrent = null), + (this.backtrackFragment = null), + e && (e.abortRequests(), this.fragmentTracker.removeFragment(e)), + this.state) + ) { + case H.KEY_LOADING: + case H.FRAG_LOADING: + case H.FRAG_LOADING_WAITING_RETRY: + case H.PARSING: + case H.PARSED: + this.state = H.IDLE; + break; + } + this.nextLoadPosition = this.getLoadPosition(); + } + flushMainBuffer(e, t) { + super.flushMainBuffer(e, t, this.altAudio ? "video" : null); + } + onMediaAttached(e, t) { + super.onMediaAttached(e, t); + const i = t.media; + (this.onvplaying = this.onMediaPlaying.bind(this)), + (this.onvseeked = this.onMediaSeeked.bind(this)), + i.addEventListener("playing", this.onvplaying), + i.addEventListener("seeked", this.onvseeked), + (this.gapController = new Wd( + this.config, + i, + this.fragmentTracker, + this.hls + )); + } + onMediaDetaching() { + const { media: e } = this; + e && + this.onvplaying && + this.onvseeked && + (e.removeEventListener("playing", this.onvplaying), + e.removeEventListener("seeked", this.onvseeked), + (this.onvplaying = this.onvseeked = null), + (this.videoBuffer = null)), + (this.fragPlaying = null), + this.gapController && + (this.gapController.destroy(), (this.gapController = null)), + super.onMediaDetaching(); + } + onMediaPlaying() { + this.tick(); + } + onMediaSeeked() { + const e = this.media, + t = e ? e.currentTime : null; + ne(t) && this.log(`Media seeked to ${t.toFixed(3)}`); + const i = this.getMainFwdBufferInfo(); + if (i === null || i.len === 0) { + this.warn( + `Main forward buffer length on "seeked" event ${i ? i.len : "empty"})` + ); + return; + } + this.tick(); + } + onManifestLoading() { + this.log("Trigger BUFFER_RESET"), + this.hls.trigger(y.BUFFER_RESET, void 0), + this.fragmentTracker.removeAllFragments(), + (this.couldBacktrack = !1), + (this.startPosition = this.lastCurrentTime = 0), + (this.levels = this.fragPlaying = this.backtrackFragment = null), + (this.altAudio = this.audioOnly = !1); + } + onManifestParsed(e, t) { + let i = !1, + n = !1, + r; + t.levels.forEach((a) => { + (r = a.audioCodec), + r && + (r.indexOf("mp4a.40.2") !== -1 && (i = !0), + r.indexOf("mp4a.40.5") !== -1 && (n = !0)); + }), + (this.audioCodecSwitch = i && n && !ud()), + this.audioCodecSwitch && + this.log( + "Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC" + ), + (this.levels = t.levels), + (this.startFragRequested = !1); + } + onLevelLoading(e, t) { + const { levels: i } = this; + if (!i || this.state !== H.IDLE) return; + const n = i[t.level]; + (!n.details || + (n.details.live && this.levelLastLoaded !== t.level) || + this.waitForCdnTuneIn(n.details)) && + (this.state = H.WAITING_LEVEL); + } + onLevelLoaded(e, t) { + var i; + const { levels: n } = this, + r = t.level, + a = t.details, + o = a.totalduration; + if (!n) { + this.warn(`Levels were reset while loading level ${r}`); + return; + } + this.log( + `Level ${r} loaded [${a.startSN},${a.endSN}]${ + a.lastPartSn ? `[part-${a.lastPartSn}-${a.lastPartIndex}]` : "" + }, cc [${a.startCC}, ${a.endCC}] duration:${o}` + ); + const l = n[r], + u = this.fragCurrent; + u && + (this.state === H.FRAG_LOADING || + this.state === H.FRAG_LOADING_WAITING_RETRY) && + (u.level !== t.level || u.urlId !== l.urlId) && + u.loader && + this.abortCurrentFrag(); + let c = 0; + if (a.live || ((i = l.details) != null && i.live)) { + if ((a.fragments[0] || (a.deltaUpdateFailed = !0), a.deltaUpdateFailed)) + return; + c = this.alignPlaylists(a, l.details); + } + if ( + ((l.details = a), + (this.levelLastLoaded = r), + this.hls.trigger(y.LEVEL_UPDATED, { details: a, level: r }), + this.state === H.WAITING_LEVEL) + ) { + if (this.waitForCdnTuneIn(a)) return; + this.state = H.IDLE; + } + this.startFragRequested + ? a.live && this.synchronizeToLiveEdge(a) + : this.setStartPosition(a, c), + this.tick(); + } + _handleFragmentLoadProgress(e) { + var t; + const { frag: i, part: n, payload: r } = e, + { levels: a } = this; + if (!a) { + this.warn( + `Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered` + ); + return; + } + const o = a[i.level], + l = o.details; + if (!l) { + this.warn( + `Dropping fragment ${i.sn} of level ${i.level} after level details were reset` + ), + this.fragmentTracker.removeFragment(i); + return; + } + const u = o.videoCodec, + c = l.PTSKnown || !l.live, + d = (t = i.initSegment) == null ? void 0 : t.data, + f = this._getAudioCodec(o), + g = (this.transmuxer = + this.transmuxer || + new To( + this.hls, + se.MAIN, + this._handleTransmuxComplete.bind(this), + this._handleTransmuxerFlush.bind(this) + )), + p = n ? n.index : -1, + v = p !== -1, + T = new dr(i.level, i.sn, i.stats.chunkCount, r.byteLength, p, v), + x = this.initPTS[i.cc]; + g.push(r, d, f, u, i, n, l.totalduration, c, T, x); + } + onAudioTrackSwitching(e, t) { + const i = this.altAudio; + if (!!!t.url) { + if (this.mediaBuffer !== this.media) { + this.log( + "Switching on main audio, use media.buffered to schedule main fragment loading" + ), + (this.mediaBuffer = this.media); + const a = this.fragCurrent; + a && + (this.log( + "Switching to main audio track, cancel main fragment load" + ), + a.abortRequests(), + this.fragmentTracker.removeFragment(a)), + this.resetTransmuxer(), + this.resetLoadingState(); + } else this.audioOnly && this.resetTransmuxer(); + const r = this.hls; + i && + (r.trigger(y.BUFFER_FLUSHING, { + startOffset: 0, + endOffset: Number.POSITIVE_INFINITY, + type: null, + }), + this.fragmentTracker.removeAllFragments()), + r.trigger(y.AUDIO_TRACK_SWITCHED, t); + } + } + onAudioTrackSwitched(e, t) { + const i = t.id, + n = !!this.hls.audioTracks[i].url; + if (n) { + const r = this.videoBuffer; + r && + this.mediaBuffer !== r && + (this.log( + "Switching on alternate audio, use video.buffered to schedule main fragment loading" + ), + (this.mediaBuffer = r)); + } + (this.altAudio = n), this.tick(); + } + onBufferCreated(e, t) { + const i = t.tracks; + let n, + r, + a = !1; + for (const o in i) { + const l = i[o]; + if (l.id === "main") { + if (((r = o), (n = l), o === "video")) { + const u = i[o]; + u && (this.videoBuffer = u.buffer); + } + } else a = !0; + } + a && n + ? (this.log( + `Alternate track found, use ${r}.buffered to schedule main fragment loading` + ), + (this.mediaBuffer = n.buffer)) + : (this.mediaBuffer = this.media); + } + onFragBuffered(e, t) { + const { frag: i, part: n } = t; + if (i && i.type !== se.MAIN) return; + if (this.fragContextChanged(i)) { + this.warn( + `Fragment ${i.sn}${n ? " p: " + n.index : ""} of level ${ + i.level + } finished buffering, but was aborted. state: ${this.state}` + ), + this.state === H.PARSED && (this.state = H.IDLE); + return; + } + const r = n ? n.stats : i.stats; + (this.fragLastKbps = Math.round( + (8 * r.total) / (r.buffering.end - r.loading.first) + )), + i.sn !== "initSegment" && (this.fragPrevious = i), + this.fragBufferedComplete(i, n); + } + onError(e, t) { + var i; + if (t.fatal) { + this.state = H.ERROR; + return; + } + switch (t.details) { + case $.FRAG_GAP: + case $.FRAG_PARSING_ERROR: + case $.FRAG_DECRYPT_ERROR: + case $.FRAG_LOAD_ERROR: + case $.FRAG_LOAD_TIMEOUT: + case $.KEY_LOAD_ERROR: + case $.KEY_LOAD_TIMEOUT: + this.onFragmentOrKeyLoadError(se.MAIN, t); + break; + case $.LEVEL_LOAD_ERROR: + case $.LEVEL_LOAD_TIMEOUT: + case $.LEVEL_PARSING_ERROR: + !t.levelRetry && + this.state === H.WAITING_LEVEL && + ((i = t.context) == null ? void 0 : i.type) === de.LEVEL && + (this.state = H.IDLE); + break; + case $.BUFFER_FULL_ERROR: + if (!t.parent || t.parent !== "main") return; + this.reduceLengthAndFlushBuffer(t) && + this.flushMainBuffer(0, Number.POSITIVE_INFINITY); + break; + case $.INTERNAL_EXCEPTION: + this.recoverWorkerError(t); + break; + } + } + checkBuffer() { + const { media: e, gapController: t } = this; + if (!(!e || !t || !e.readyState)) { + if (this.loadedmetadata || !Se.getBuffered(e).length) { + const i = this.state !== H.IDLE ? this.fragCurrent : null; + t.poll(this.lastCurrentTime, i); + } + this.lastCurrentTime = e.currentTime; + } + } + onFragLoadEmergencyAborted() { + (this.state = H.IDLE), + this.loadedmetadata || + ((this.startFragRequested = !1), + (this.nextLoadPosition = this.startPosition)), + this.tickImmediate(); + } + onBufferFlushed(e, { type: t }) { + if (t !== _e.AUDIO || (this.audioOnly && !this.altAudio)) { + const i = + (t === _e.VIDEO ? this.videoBuffer : this.mediaBuffer) || this.media; + this.afterBufferFlushed(i, t, se.MAIN); + } + } + onLevelsUpdated(e, t) { + this.levels = t.levels; + } + swapAudioCodec() { + this.audioCodecSwap = !this.audioCodecSwap; + } + seekToStartPos() { + const { media: e } = this; + if (!e) return; + const t = e.currentTime; + let i = this.startPosition; + if (i >= 0 && t < i) { + if (e.seeking) { + this.log(`could not seek to ${i}, already seeking at ${t}`); + return; + } + const n = Se.getBuffered(e), + a = (n.length ? n.start(0) : 0) - i; + a > 0 && + (a < this.config.maxBufferHole || + a < this.config.maxFragLookUpTolerance) && + (this.log(`adjusting start position by ${a} to match buffer start`), + (i += a), + (this.startPosition = i)), + this.log(`seek to target start position ${i} from current time ${t}`), + (e.currentTime = i); + } + } + _getAudioCodec(e) { + let t = this.config.defaultAudioCodec || e.audioCodec; + return ( + this.audioCodecSwap && + t && + (this.log("Swapping audio codec"), + t.indexOf("mp4a.40.5") !== -1 + ? (t = "mp4a.40.2") + : (t = "mp4a.40.5")), + t + ); + } + _loadBitrateTestFrag(e, t) { + (e.bitrateTest = !0), + this._doFragLoad(e, t).then((i) => { + const { hls: n } = this; + if (!i || this.fragContextChanged(e)) return; + (t.fragmentError = 0), + (this.state = H.IDLE), + (this.startFragRequested = !1), + (this.bitrateTest = !1); + const r = e.stats; + (r.parsing.start = + r.parsing.end = + r.buffering.start = + r.buffering.end = + self.performance.now()), + n.trigger(y.FRAG_LOADED, i), + (e.bitrateTest = !1); + }); + } + _handleTransmuxComplete(e) { + var t; + const i = "main", + { hls: n } = this, + { remuxResult: r, chunkMeta: a } = e, + o = this.getCurrentContext(a); + if (!o) { + this.resetWhenMissingContext(a); + return; + } + const { frag: l, part: u, level: c } = o, + { video: d, text: f, id3: g, initSegment: p } = r, + { details: v } = c, + T = this.altAudio ? void 0 : r.audio; + if (this.fragContextChanged(l)) { + this.fragmentTracker.removeFragment(l); + return; + } + if (((this.state = H.PARSING), p)) { + if (p != null && p.tracks) { + const L = l.initSegment || l; + this._bufferInitSegment(c, p.tracks, L, a), + n.trigger(y.FRAG_PARSING_INIT_SEGMENT, { + frag: L, + id: i, + tracks: p.tracks, + }); + } + const x = p.initPTS, + I = p.timescale; + ne(x) && + ((this.initPTS[l.cc] = { baseTime: x, timescale: I }), + n.trigger(y.INIT_PTS_FOUND, { + frag: l, + id: i, + initPTS: x, + timescale: I, + })); + } + if (d && v && l.sn !== "initSegment") { + const x = v.fragments[l.sn - 1 - v.startSN], + I = l.sn === v.startSN, + L = !x || l.cc > x.cc; + if (r.independent !== !1) { + const { startPTS: M, endPTS: O, startDTS: j, endDTS: U } = d; + if (u) + u.elementaryStreams[d.type] = { + startPTS: M, + endPTS: O, + startDTS: j, + endDTS: U, + }; + else if ( + (d.firstKeyFrame && + d.independent && + a.id === 1 && + !L && + (this.couldBacktrack = !0), + d.dropped && d.independent) + ) { + const Y = this.getMainFwdBufferInfo(), + _ = + (Y ? Y.end : this.getLoadPosition()) + + this.config.maxBufferHole, + E = d.firstKeyFramePTS ? d.firstKeyFramePTS : M; + if (!I && _ < E - this.config.maxBufferHole && !L) { + this.backtrack(l); + return; + } else L && (l.gap = !0); + l.setElementaryStreamInfo(d.type, l.start, O, l.start, U, !0); + } + l.setElementaryStreamInfo(d.type, M, O, j, U), + this.backtrackFragment && (this.backtrackFragment = l), + this.bufferFragmentData(d, l, u, a, I || L); + } else if (I || L) l.gap = !0; + else { + this.backtrack(l); + return; + } + } + if (T) { + const { startPTS: x, endPTS: I, startDTS: L, endDTS: M } = T; + u && + (u.elementaryStreams[_e.AUDIO] = { + startPTS: x, + endPTS: I, + startDTS: L, + endDTS: M, + }), + l.setElementaryStreamInfo(_e.AUDIO, x, I, L, M), + this.bufferFragmentData(T, l, u, a); + } + if (v && g != null && (t = g.samples) != null && t.length) { + const x = { id: i, frag: l, details: v, samples: g.samples }; + n.trigger(y.FRAG_PARSING_METADATA, x); + } + if (v && f) { + const x = { id: i, frag: l, details: v, samples: f.samples }; + n.trigger(y.FRAG_PARSING_USERDATA, x); + } + } + _bufferInitSegment(e, t, i, n) { + if (this.state !== H.PARSING) return; + (this.audioOnly = !!t.audio && !t.video), + this.altAudio && !this.audioOnly && delete t.audio; + const { audio: r, video: a, audiovideo: o } = t; + if (r) { + let l = e.audioCodec; + const u = navigator.userAgent.toLowerCase(); + this.audioCodecSwitch && + (l && + (l.indexOf("mp4a.40.5") !== -1 + ? (l = "mp4a.40.2") + : (l = "mp4a.40.5")), + r.metadata.channelCount !== 1 && + u.indexOf("firefox") === -1 && + (l = "mp4a.40.5")), + u.indexOf("android") !== -1 && + r.container !== "audio/mpeg" && + ((l = "mp4a.40.2"), this.log(`Android: force audio codec to ${l}`)), + e.audioCodec && + e.audioCodec !== l && + this.log( + `Swapping manifest audio codec "${e.audioCodec}" for "${l}"` + ), + (r.levelCodec = l), + (r.id = "main"), + this.log( + `Init audio buffer, container:${ + r.container + }, codecs[selected/level/parsed]=[${l || ""}/${ + e.audioCodec || "" + }/${r.codec}]` + ); + } + a && + ((a.levelCodec = e.videoCodec), + (a.id = "main"), + this.log( + `Init video buffer, container:${a.container}, codecs[level/parsed]=[${ + e.videoCodec || "" + }/${a.codec}]` + )), + o && + this.log( + `Init audiovideo buffer, container:${ + o.container + }, codecs[level/parsed]=[${e.attrs.CODECS || ""}/${o.codec}]` + ), + this.hls.trigger(y.BUFFER_CODECS, t), + Object.keys(t).forEach((l) => { + const c = t[l].initSegment; + c != null && + c.byteLength && + this.hls.trigger(y.BUFFER_APPENDING, { + type: l, + data: c, + frag: i, + part: null, + chunkMeta: n, + parent: i.type, + }); + }), + this.tick(); + } + getMainFwdBufferInfo() { + return this.getFwdBufferInfo( + this.mediaBuffer ? this.mediaBuffer : this.media, + se.MAIN + ); + } + backtrack(e) { + (this.couldBacktrack = !0), + (this.backtrackFragment = e), + this.resetTransmuxer(), + this.flushBufferGap(e), + this.fragmentTracker.removeFragment(e), + (this.fragPrevious = null), + (this.nextLoadPosition = e.start), + (this.state = H.IDLE); + } + checkFragmentChanged() { + const e = this.media; + let t = null; + if (e && e.readyState > 1 && e.seeking === !1) { + const i = e.currentTime; + if ( + (Se.isBuffered(e, i) + ? (t = this.getAppendedFrag(i)) + : Se.isBuffered(e, i + 0.1) && (t = this.getAppendedFrag(i + 0.1)), + t) + ) { + this.backtrackFragment = null; + const n = this.fragPlaying, + r = t.level; + (!n || t.sn !== n.sn || n.level !== r || t.urlId !== n.urlId) && + ((this.fragPlaying = t), + this.hls.trigger(y.FRAG_CHANGED, { frag: t }), + (!n || n.level !== r) && + this.hls.trigger(y.LEVEL_SWITCHED, { level: r })); + } + } + } + get nextLevel() { + const e = this.nextBufferedFrag; + return e ? e.level : -1; + } + get currentFrag() { + const e = this.media; + return e ? this.fragPlaying || this.getAppendedFrag(e.currentTime) : null; + } + get currentProgramDateTime() { + const e = this.media; + if (e) { + const t = e.currentTime, + i = this.currentFrag; + if (i && ne(t) && ne(i.programDateTime)) { + const n = i.programDateTime + (t - i.start) * 1e3; + return new Date(n); + } + } + return null; + } + get currentLevel() { + const e = this.currentFrag; + return e ? e.level : -1; + } + get nextBufferedFrag() { + const e = this.currentFrag; + return e ? this.followingBufferedFrag(e) : null; + } + get forceStartLoad() { + return this._forceStartLoad; + } + } + class gi { + constructor(e, t = 0, i = 0) { + (this.halfLife = void 0), + (this.alpha_ = void 0), + (this.estimate_ = void 0), + (this.totalWeight_ = void 0), + (this.halfLife = e), + (this.alpha_ = e ? Math.exp(Math.log(0.5) / e) : 0), + (this.estimate_ = t), + (this.totalWeight_ = i); + } + sample(e, t) { + const i = Math.pow(this.alpha_, e); + (this.estimate_ = t * (1 - i) + i * this.estimate_), + (this.totalWeight_ += e); + } + getTotalWeight() { + return this.totalWeight_; + } + getEstimate() { + if (this.alpha_) { + const e = 1 - Math.pow(this.alpha_, this.totalWeight_); + if (e) return this.estimate_ / e; + } + return this.estimate_; + } + } + class Xd { + constructor(e, t, i, n = 100) { + (this.defaultEstimate_ = void 0), + (this.minWeight_ = void 0), + (this.minDelayMs_ = void 0), + (this.slow_ = void 0), + (this.fast_ = void 0), + (this.defaultTTFB_ = void 0), + (this.ttfb_ = void 0), + (this.defaultEstimate_ = i), + (this.minWeight_ = 0.001), + (this.minDelayMs_ = 50), + (this.slow_ = new gi(e)), + (this.fast_ = new gi(t)), + (this.defaultTTFB_ = n), + (this.ttfb_ = new gi(e)); + } + update(e, t) { + const { slow_: i, fast_: n, ttfb_: r } = this; + i.halfLife !== e && + (this.slow_ = new gi(e, i.getEstimate(), i.getTotalWeight())), + n.halfLife !== t && + (this.fast_ = new gi(t, n.getEstimate(), n.getTotalWeight())), + r.halfLife !== e && + (this.ttfb_ = new gi(e, r.getEstimate(), r.getTotalWeight())); + } + sample(e, t) { + e = Math.max(e, this.minDelayMs_); + const i = 8 * t, + n = e / 1e3, + r = i / n; + this.fast_.sample(n, r), this.slow_.sample(n, r); + } + sampleTTFB(e) { + const t = e / 1e3, + i = Math.sqrt(2) * Math.exp(-Math.pow(t, 2) / 2); + this.ttfb_.sample(i, Math.max(e, 5)); + } + canEstimate() { + return this.fast_.getTotalWeight() >= this.minWeight_; + } + getEstimate() { + return this.canEstimate() + ? Math.min(this.fast_.getEstimate(), this.slow_.getEstimate()) + : this.defaultEstimate_; + } + getEstimateTTFB() { + return this.ttfb_.getTotalWeight() >= this.minWeight_ + ? this.ttfb_.getEstimate() + : this.defaultTTFB_; + } + destroy() {} + } + class Zd { + constructor(e) { + (this.hls = void 0), + (this.lastLevelLoadSec = 0), + (this.lastLoadedFragLevel = 0), + (this._nextAutoLevel = -1), + (this.timer = -1), + (this.onCheck = this._abandonRulesCheck.bind(this)), + (this.fragCurrent = null), + (this.partCurrent = null), + (this.bitrateTestDelay = 0), + (this.bwEstimator = void 0), + (this.hls = e); + const t = e.config; + (this.bwEstimator = new Xd( + t.abrEwmaSlowVoD, + t.abrEwmaFastVoD, + t.abrEwmaDefaultEstimate + )), + this.registerListeners(); + } + registerListeners() { + const { hls: e } = this; + e.on(y.FRAG_LOADING, this.onFragLoading, this), + e.on(y.FRAG_LOADED, this.onFragLoaded, this), + e.on(y.FRAG_BUFFERED, this.onFragBuffered, this), + e.on(y.LEVEL_SWITCHING, this.onLevelSwitching, this), + e.on(y.LEVEL_LOADED, this.onLevelLoaded, this); + } + unregisterListeners() { + const { hls: e } = this; + e.off(y.FRAG_LOADING, this.onFragLoading, this), + e.off(y.FRAG_LOADED, this.onFragLoaded, this), + e.off(y.FRAG_BUFFERED, this.onFragBuffered, this), + e.off(y.LEVEL_SWITCHING, this.onLevelSwitching, this), + e.off(y.LEVEL_LOADED, this.onLevelLoaded, this); + } + destroy() { + this.unregisterListeners(), + this.clearTimer(), + (this.hls = this.onCheck = null), + (this.fragCurrent = this.partCurrent = null); + } + onFragLoading(e, t) { + var i; + const n = t.frag; + this.ignoreFragment(n) || + ((this.fragCurrent = n), + (this.partCurrent = (i = t.part) != null ? i : null), + this.clearTimer(), + (this.timer = self.setInterval(this.onCheck, 100))); + } + onLevelSwitching(e, t) { + this.clearTimer(); + } + getTimeToLoadFrag(e, t, i, n) { + const r = e + i / t, + a = n ? this.lastLevelLoadSec : 0; + return r + a; + } + onLevelLoaded(e, t) { + const i = this.hls.config, + { total: n, bwEstimate: r } = t.stats; + ne(n) && ne(r) && (this.lastLevelLoadSec = (8 * n) / r), + t.details.live + ? this.bwEstimator.update(i.abrEwmaSlowLive, i.abrEwmaFastLive) + : this.bwEstimator.update(i.abrEwmaSlowVoD, i.abrEwmaFastVoD); + } + _abandonRulesCheck() { + const { fragCurrent: e, partCurrent: t, hls: i } = this, + { autoLevelEnabled: n, media: r } = i; + if (!e || !r) return; + const a = performance.now(), + o = t ? t.stats : e.stats, + l = t ? t.duration : e.duration, + u = a - o.loading.start; + if (o.aborted || (o.loaded && o.loaded === o.total) || e.level === 0) { + this.clearTimer(), (this._nextAutoLevel = -1); + return; + } + if (!n || r.paused || !r.playbackRate || !r.readyState) return; + const c = i.mainForwardBufferInfo; + if (c === null) return; + const d = this.bwEstimator.getEstimateTTFB(), + f = Math.abs(r.playbackRate); + if (u <= Math.max(d, 1e3 * (l / (f * 2)))) return; + const g = c.len / f; + if (g >= (2 * l) / f) return; + const p = o.loading.first ? o.loading.first - o.loading.start : -1, + v = o.loaded && p > -1, + T = this.bwEstimator.getEstimate(), + { levels: x, minAutoLevel: I } = i, + L = x[e.level], + M = o.total || Math.max(o.loaded, Math.round((l * L.maxBitrate) / 8)); + let O = u - p; + O < 1 && v && (O = Math.min(u, (o.loaded * 8) / T)); + const j = v ? (o.loaded * 1e3) / O : 0, + U = j ? (M - o.loaded) / j : (M * 8) / T + d / 1e3; + if (U <= g) return; + const Y = j ? j * 8 : T; + let _ = Number.POSITIVE_INFINITY, + E; + for (E = e.level - 1; E > I; E--) { + const w = x[E].maxBitrate; + if ( + ((_ = this.getTimeToLoadFrag(d / 1e3, Y, l * w, !x[E].details)), + _ < g) + ) + break; + } + _ >= U || + _ > l * 10 || + ((i.nextLoadLevel = E), + v + ? this.bwEstimator.sample(u - Math.min(d, p), o.loaded) + : this.bwEstimator.sampleTTFB(u), + this.clearTimer(), + D.warn(`[abr] Fragment ${e.sn}${t ? " part " + t.index : ""} of level ${ + e.level + } is loading too slowly; + Time to underbuffer: ${g.toFixed(3)} s + Estimated load time for current fragment: ${U.toFixed(3)} s + Estimated load time for down switch fragment: ${_.toFixed(3)} s + TTFB estimate: ${p} + Current BW estimate: ${ne(T) ? (T / 1024).toFixed(3) : "Unknown"} Kb/s + New BW estimate: ${(this.bwEstimator.getEstimate() / 1024).toFixed( + 3 + )} Kb/s + Aborting and switching to level ${E}`), + e.loader && + ((this.fragCurrent = this.partCurrent = null), e.abortRequests()), + i.trigger(y.FRAG_LOAD_EMERGENCY_ABORTED, { + frag: e, + part: t, + stats: o, + })); + } + onFragLoaded(e, { frag: t, part: i }) { + const n = i ? i.stats : t.stats; + if ( + (t.type === se.MAIN && + this.bwEstimator.sampleTTFB(n.loading.first - n.loading.start), + !this.ignoreFragment(t)) + ) { + if ( + (this.clearTimer(), + (this.lastLoadedFragLevel = t.level), + (this._nextAutoLevel = -1), + this.hls.config.abrMaxWithRealBitrate) + ) { + const r = i ? i.duration : t.duration, + a = this.hls.levels[t.level], + o = (a.loaded ? a.loaded.bytes : 0) + n.loaded, + l = (a.loaded ? a.loaded.duration : 0) + r; + (a.loaded = { bytes: o, duration: l }), + (a.realBitrate = Math.round((8 * o) / l)); + } + if (t.bitrateTest) { + const r = { stats: n, frag: t, part: i, id: t.type }; + this.onFragBuffered(y.FRAG_BUFFERED, r), (t.bitrateTest = !1); + } + } + } + onFragBuffered(e, t) { + const { frag: i, part: n } = t, + r = n != null && n.stats.loaded ? n.stats : i.stats; + if (r.aborted || this.ignoreFragment(i)) return; + const a = + r.parsing.end - + r.loading.start - + Math.min( + r.loading.first - r.loading.start, + this.bwEstimator.getEstimateTTFB() + ); + this.bwEstimator.sample(a, r.loaded), + (r.bwEstimate = this.bwEstimator.getEstimate()), + i.bitrateTest + ? (this.bitrateTestDelay = a / 1e3) + : (this.bitrateTestDelay = 0); + } + ignoreFragment(e) { + return e.type !== se.MAIN || e.sn === "initSegment"; + } + clearTimer() { + self.clearInterval(this.timer); + } + get nextAutoLevel() { + const e = this._nextAutoLevel, + t = this.bwEstimator; + if (e !== -1 && !t.canEstimate()) return e; + let i = this.getNextABRAutoLevel(); + if (e !== -1) { + const n = this.hls.levels; + if (n.length > Math.max(e, i) && n[e].loadError <= n[i].loadError) + return e; + } + return e !== -1 && (i = Math.min(e, i)), i; + } + getNextABRAutoLevel() { + const { fragCurrent: e, partCurrent: t, hls: i } = this, + { maxAutoLevel: n, config: r, minAutoLevel: a, media: o } = i, + l = t ? t.duration : e ? e.duration : 0, + u = o && o.playbackRate !== 0 ? Math.abs(o.playbackRate) : 1, + c = this.bwEstimator + ? this.bwEstimator.getEstimate() + : r.abrEwmaDefaultEstimate, + d = i.mainForwardBufferInfo, + f = (d ? d.len : 0) / u; + let g = this.findBestLevel( + c, + a, + n, + f, + r.abrBandWidthFactor, + r.abrBandWidthUpFactor + ); + if (g >= 0) return g; + D.trace( + `[abr] ${ + f ? "rebuffering expected" : "buffer is empty" + }, finding optimal quality level` + ); + let p = l ? Math.min(l, r.maxStarvationDelay) : r.maxStarvationDelay, + v = r.abrBandWidthFactor, + T = r.abrBandWidthUpFactor; + if (!f) { + const x = this.bitrateTestDelay; + x && + ((p = (l ? Math.min(l, r.maxLoadingDelay) : r.maxLoadingDelay) - x), + D.trace( + `[abr] bitrate test took ${Math.round( + 1e3 * x + )}ms, set first fragment max fetchDuration to ${Math.round( + 1e3 * p + )} ms` + ), + (v = T = 1)); + } + return (g = this.findBestLevel(c, a, n, f + p, v, T)), Math.max(g, 0); + } + findBestLevel(e, t, i, n, r, a) { + var o; + const { fragCurrent: l, partCurrent: u, lastLoadedFragLevel: c } = this, + { levels: d } = this.hls, + f = d[c], + g = !!(f != null && (o = f.details) != null && o.live), + p = f == null ? void 0 : f.codecSet, + v = u ? u.duration : l ? l.duration : 0, + T = this.bwEstimator.getEstimateTTFB() / 1e3; + let x = t, + I = -1; + for (let L = i; L >= t; L--) { + const M = d[L]; + if (!M || (p && M.codecSet !== p)) { + M && ((x = Math.min(L, x)), (I = Math.max(L, I))); + continue; + } + I !== -1 && + D.trace( + `[abr] Skipped level(s) ${x}-${I} with CODECS:"${d[I].attrs.CODECS}"; not compatible with "${f.attrs.CODECS}"` + ); + const O = M.details, + j = + (u + ? O == null + ? void 0 + : O.partTarget + : O == null + ? void 0 + : O.averagetargetduration) || v; + let U; + L <= c ? (U = r * e) : (U = a * e); + const Y = d[L].maxBitrate, + _ = this.getTimeToLoadFrag(T, U, Y * j, O === void 0); + if ( + (D.trace( + `[abr] level:${L} adjustedbw-bitrate:${Math.round( + U - Y + )} avgDuration:${j.toFixed(1)} maxFetchDuration:${n.toFixed( + 1 + )} fetchDuration:${_.toFixed(1)}` + ), + U > Y && + (_ === 0 || !ne(_) || (g && !this.bitrateTestDelay) || _ < n)) + ) + return L; + } + return -1; + } + set nextAutoLevel(e) { + this._nextAutoLevel = e; + } + } + class bo { + constructor() { + (this.chunks = []), (this.dataLength = 0); + } + push(e) { + this.chunks.push(e), (this.dataLength += e.length); + } + flush() { + const { chunks: e, dataLength: t } = this; + let i; + if (e.length) e.length === 1 ? (i = e[0]) : (i = Qd(e, t)); + else return new Uint8Array(0); + return this.reset(), i; + } + reset() { + (this.chunks.length = 0), (this.dataLength = 0); + } + } + function Qd(s, e) { + const t = new Uint8Array(e); + let i = 0; + for (let n = 0; n < s.length; n++) { + const r = s[n]; + t.set(r, i), (i += r.length); + } + return t; + } + const _o = 100; + class Jd extends pr { + constructor(e, t, i) { + super(e, t, i, "[audio-stream-controller]", se.AUDIO), + (this.videoBuffer = null), + (this.videoTrackCC = -1), + (this.waitingVideoCC = -1), + (this.bufferedTrack = null), + (this.switchingTrack = null), + (this.trackId = -1), + (this.waitingData = null), + (this.mainDetails = null), + (this.bufferFlushed = !1), + (this.cachedTrackLoadedData = null), + this._registerListeners(); + } + onHandlerDestroying() { + this._unregisterListeners(), + (this.mainDetails = null), + (this.bufferedTrack = null), + (this.switchingTrack = null); + } + _registerListeners() { + const { hls: e } = this; + e.on(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.on(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.LEVEL_LOADED, this.onLevelLoaded, this), + e.on(y.AUDIO_TRACKS_UPDATED, this.onAudioTracksUpdated, this), + e.on(y.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), + e.on(y.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), + e.on(y.ERROR, this.onError, this), + e.on(y.BUFFER_RESET, this.onBufferReset, this), + e.on(y.BUFFER_CREATED, this.onBufferCreated, this), + e.on(y.BUFFER_FLUSHED, this.onBufferFlushed, this), + e.on(y.INIT_PTS_FOUND, this.onInitPtsFound, this), + e.on(y.FRAG_BUFFERED, this.onFragBuffered, this); + } + _unregisterListeners() { + const { hls: e } = this; + e.off(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.off(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.LEVEL_LOADED, this.onLevelLoaded, this), + e.off(y.AUDIO_TRACKS_UPDATED, this.onAudioTracksUpdated, this), + e.off(y.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), + e.off(y.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), + e.off(y.ERROR, this.onError, this), + e.off(y.BUFFER_RESET, this.onBufferReset, this), + e.off(y.BUFFER_CREATED, this.onBufferCreated, this), + e.off(y.BUFFER_FLUSHED, this.onBufferFlushed, this), + e.off(y.INIT_PTS_FOUND, this.onInitPtsFound, this), + e.off(y.FRAG_BUFFERED, this.onFragBuffered, this); + } + onInitPtsFound(e, { frag: t, id: i, initPTS: n, timescale: r }) { + if (i === "main") { + const a = t.cc; + (this.initPTS[t.cc] = { baseTime: n, timescale: r }), + this.log(`InitPTS for cc: ${a} found from main: ${n}`), + (this.videoTrackCC = a), + this.state === H.WAITING_INIT_PTS && this.tick(); + } + } + startLoad(e) { + if (!this.levels) { + (this.startPosition = e), (this.state = H.STOPPED); + return; + } + const t = this.lastCurrentTime; + this.stopLoad(), + this.setInterval(_o), + t > 0 && e === -1 + ? (this.log( + `Override startPosition with lastCurrentTime @${t.toFixed(3)}` + ), + (e = t), + (this.state = H.IDLE)) + : ((this.loadedmetadata = !1), (this.state = H.WAITING_TRACK)), + (this.nextLoadPosition = this.startPosition = this.lastCurrentTime = e), + this.tick(); + } + doTick() { + switch (this.state) { + case H.IDLE: + this.doTickIdle(); + break; + case H.WAITING_TRACK: { + var e; + const { levels: i, trackId: n } = this, + r = i == null || (e = i[n]) == null ? void 0 : e.details; + if (r) { + if (this.waitForCdnTuneIn(r)) break; + this.state = H.WAITING_INIT_PTS; + } + break; + } + case H.FRAG_LOADING_WAITING_RETRY: { + var t; + const i = performance.now(), + n = this.retryDate; + (!n || i >= n || ((t = this.media) != null && t.seeking)) && + (this.log("RetryDate reached, switch back to IDLE state"), + this.resetStartWhenNotLoaded(this.trackId), + (this.state = H.IDLE)); + break; + } + case H.WAITING_INIT_PTS: { + const i = this.waitingData; + if (i) { + const { frag: n, part: r, cache: a, complete: o } = i; + if (this.initPTS[n.cc] !== void 0) { + (this.waitingData = null), + (this.waitingVideoCC = -1), + (this.state = H.FRAG_LOADING); + const l = a.flush(), + u = { frag: n, part: r, payload: l, networkDetails: null }; + this._handleFragmentLoadProgress(u), + o && super._handleFragmentLoadComplete(u); + } else if (this.videoTrackCC !== this.waitingVideoCC) + this.log( + `Waiting fragment cc (${n.cc}) cancelled because video is at cc ${this.videoTrackCC}` + ), + this.clearWaitingFragment(); + else { + const l = this.getLoadPosition(), + u = Se.bufferInfo( + this.mediaBuffer, + l, + this.config.maxBufferHole + ); + ur(u.end, this.config.maxFragLookUpTolerance, n) < 0 && + (this.log( + `Waiting fragment cc (${n.cc}) @ ${n.start} cancelled because another fragment at ${u.end} is needed` + ), + this.clearWaitingFragment()); + } + } else this.state = H.IDLE; + } + } + this.onTickEnd(); + } + clearWaitingFragment() { + const e = this.waitingData; + e && + (this.fragmentTracker.removeFragment(e.frag), + (this.waitingData = null), + (this.waitingVideoCC = -1), + (this.state = H.IDLE)); + } + resetLoadingState() { + this.clearWaitingFragment(), super.resetLoadingState(); + } + onTickEnd() { + const { media: e } = this; + e != null && e.readyState && (this.lastCurrentTime = e.currentTime); + } + doTickIdle() { + const { hls: e, levels: t, media: i, trackId: n } = this, + r = e.config; + if ( + !(t != null && t[n]) || + (!i && (this.startFragRequested || !r.startFragPrefetch)) + ) + return; + const a = t[n], + o = a.details; + if ( + !o || + (o.live && this.levelLastLoaded !== n) || + this.waitForCdnTuneIn(o) + ) { + this.state = H.WAITING_TRACK; + return; + } + const l = this.mediaBuffer ? this.mediaBuffer : this.media; + this.bufferFlushed && + l && + ((this.bufferFlushed = !1), + this.afterBufferFlushed(l, _e.AUDIO, se.AUDIO)); + const u = this.getFwdBufferInfo(l, se.AUDIO); + if (u === null) return; + const { bufferedTrack: c, switchingTrack: d } = this; + if (!d && this._streamEnded(u, o)) { + e.trigger(y.BUFFER_EOS, { type: "audio" }), (this.state = H.ENDED); + return; + } + const f = this.getFwdBufferInfo( + this.videoBuffer ? this.videoBuffer : this.media, + se.MAIN + ), + g = u.len, + p = this.getMaxBufferLength(f == null ? void 0 : f.len); + if (g >= p && !d) return; + const T = o.fragments[0].start; + let x = u.end; + if (d && i) { + const O = this.getLoadPosition(); + c && d.attrs !== c.attrs && (x = O), + o.PTSKnown && + O < T && + (u.end > T || u.nextStart) && + (this.log( + "Alt audio track ahead of main track, seek to start of alt audio track" + ), + (i.currentTime = T + 0.05)); + } + let I = this.getNextFragment(x, o), + L = !1; + if ( + (I && + this.isLoopLoading(I, x) && + ((L = !!I.gap), + (I = this.getNextFragmentLoopLoading(I, o, u, se.MAIN, p))), + !I) + ) { + this.bufferFlushed = !0; + return; + } + const M = f && I.start > f.end + o.targetduration; + if (M || (!(f != null && f.len) && u.len)) { + const O = this.getAppendedFrag(I.start, se.MAIN); + if ( + O === null || + (L || (L = !!O.gap || (!!M && f.len === 0)), + (M && !L) || (L && u.nextStart && u.nextStart < O.end)) + ) + return; + } + this.loadFragment(I, a, x); + } + getMaxBufferLength(e) { + const t = super.getMaxBufferLength(); + return e ? Math.min(Math.max(t, e), this.config.maxMaxBufferLength) : t; + } + onMediaDetaching() { + (this.videoBuffer = null), super.onMediaDetaching(); + } + onAudioTracksUpdated(e, { audioTracks: t }) { + this.resetTransmuxer(), (this.levels = t.map((i) => new xi(i))); + } + onAudioTrackSwitching(e, t) { + const i = !!t.url; + this.trackId = t.id; + const { fragCurrent: n } = this; + n && (n.abortRequests(), this.removeUnbufferedFrags(n.start)), + this.resetLoadingState(), + i ? this.setInterval(_o) : this.resetTransmuxer(), + i + ? ((this.switchingTrack = t), (this.state = H.IDLE)) + : ((this.switchingTrack = null), + (this.bufferedTrack = t), + (this.state = H.STOPPED)), + this.tick(); + } + onManifestLoading() { + this.fragmentTracker.removeAllFragments(), + (this.startPosition = this.lastCurrentTime = 0), + (this.bufferFlushed = !1), + (this.levels = + this.mainDetails = + this.waitingData = + this.bufferedTrack = + this.cachedTrackLoadedData = + this.switchingTrack = + null), + (this.startFragRequested = !1), + (this.trackId = this.videoTrackCC = this.waitingVideoCC = -1); + } + onLevelLoaded(e, t) { + (this.mainDetails = t.details), + this.cachedTrackLoadedData !== null && + (this.hls.trigger(y.AUDIO_TRACK_LOADED, this.cachedTrackLoadedData), + (this.cachedTrackLoadedData = null)); + } + onAudioTrackLoaded(e, t) { + var i; + if (this.mainDetails == null) { + this.cachedTrackLoadedData = t; + return; + } + const { levels: n } = this, + { details: r, id: a } = t; + if (!n) { + this.warn(`Audio tracks were reset while loading level ${a}`); + return; + } + this.log( + `Track ${a} loaded [${r.startSN},${r.endSN}]${ + r.lastPartSn ? `[part-${r.lastPartSn}-${r.lastPartIndex}]` : "" + },duration:${r.totalduration}` + ); + const o = n[a]; + let l = 0; + if (r.live || ((i = o.details) != null && i.live)) { + const u = this.mainDetails; + if ( + (r.fragments[0] || (r.deltaUpdateFailed = !0), + r.deltaUpdateFailed || !u) + ) + return; + !o.details && r.hasProgramDateTime && u.hasProgramDateTime + ? (Ja(r, u), (l = r.fragments[0].start)) + : (l = this.alignPlaylists(r, o.details)); + } + (o.details = r), + (this.levelLastLoaded = a), + !this.startFragRequested && + (this.mainDetails || !r.live) && + this.setStartPosition(o.details, l), + this.state === H.WAITING_TRACK && + !this.waitForCdnTuneIn(r) && + (this.state = H.IDLE), + this.tick(); + } + _handleFragmentLoadProgress(e) { + var t; + const { frag: i, part: n, payload: r } = e, + { config: a, trackId: o, levels: l } = this; + if (!l) { + this.warn( + `Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered` + ); + return; + } + const u = l[o]; + if (!u) { + this.warn("Audio track is undefined on fragment load progress"); + return; + } + const c = u.details; + if (!c) { + this.warn("Audio track details undefined on fragment load progress"), + this.removeUnbufferedFrags(i.start); + return; + } + const d = a.defaultAudioCodec || u.audioCodec || "mp4a.40.2"; + let f = this.transmuxer; + f || + (f = this.transmuxer = + new To( + this.hls, + se.AUDIO, + this._handleTransmuxComplete.bind(this), + this._handleTransmuxerFlush.bind(this) + )); + const g = this.initPTS[i.cc], + p = (t = i.initSegment) == null ? void 0 : t.data; + if (g !== void 0) { + const T = n ? n.index : -1, + x = T !== -1, + I = new dr(i.level, i.sn, i.stats.chunkCount, r.byteLength, T, x); + f.push(r, p, d, "", i, n, c.totalduration, !1, I, g); + } else { + this.log( + `Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${c.startSN} ,${c.endSN}],track ${o}` + ); + const { cache: v } = (this.waitingData = this.waitingData || { + frag: i, + part: n, + cache: new bo(), + complete: !1, + }); + v.push(new Uint8Array(r)), + (this.waitingVideoCC = this.videoTrackCC), + (this.state = H.WAITING_INIT_PTS); + } + } + _handleFragmentLoadComplete(e) { + if (this.waitingData) { + this.waitingData.complete = !0; + return; + } + super._handleFragmentLoadComplete(e); + } + onBufferReset() { + (this.mediaBuffer = this.videoBuffer = null), (this.loadedmetadata = !1); + } + onBufferCreated(e, t) { + const i = t.tracks.audio; + i && (this.mediaBuffer = i.buffer || null), + t.tracks.video && (this.videoBuffer = t.tracks.video.buffer || null); + } + onFragBuffered(e, t) { + const { frag: i, part: n } = t; + if (i.type !== se.AUDIO) { + if (!this.loadedmetadata && i.type === se.MAIN) { + const r = this.videoBuffer || this.media; + r && Se.getBuffered(r).length && (this.loadedmetadata = !0); + } + return; + } + if (this.fragContextChanged(i)) { + this.warn( + `Fragment ${i.sn}${n ? " p: " + n.index : ""} of level ${ + i.level + } finished buffering, but was aborted. state: ${ + this.state + }, audioSwitch: ${ + this.switchingTrack ? this.switchingTrack.name : "false" + }` + ); + return; + } + if (i.sn !== "initSegment") { + this.fragPrevious = i; + const r = this.switchingTrack; + r && + ((this.bufferedTrack = r), + (this.switchingTrack = null), + this.hls.trigger(y.AUDIO_TRACK_SWITCHED, We({}, r))); + } + this.fragBufferedComplete(i, n); + } + onError(e, t) { + var i; + if (t.fatal) { + this.state = H.ERROR; + return; + } + switch (t.details) { + case $.FRAG_GAP: + case $.FRAG_PARSING_ERROR: + case $.FRAG_DECRYPT_ERROR: + case $.FRAG_LOAD_ERROR: + case $.FRAG_LOAD_TIMEOUT: + case $.KEY_LOAD_ERROR: + case $.KEY_LOAD_TIMEOUT: + this.onFragmentOrKeyLoadError(se.AUDIO, t); + break; + case $.AUDIO_TRACK_LOAD_ERROR: + case $.AUDIO_TRACK_LOAD_TIMEOUT: + case $.LEVEL_PARSING_ERROR: + !t.levelRetry && + this.state === H.WAITING_TRACK && + ((i = t.context) == null ? void 0 : i.type) === de.AUDIO_TRACK && + (this.state = H.IDLE); + break; + case $.BUFFER_FULL_ERROR: + if (!t.parent || t.parent !== "audio") return; + this.reduceLengthAndFlushBuffer(t) && + ((this.bufferedTrack = null), + super.flushMainBuffer(0, Number.POSITIVE_INFINITY, "audio")); + break; + case $.INTERNAL_EXCEPTION: + this.recoverWorkerError(t); + break; + } + } + onBufferFlushed(e, { type: t }) { + t === _e.AUDIO && + ((this.bufferFlushed = !0), + this.state === H.ENDED && (this.state = H.IDLE)); + } + _handleTransmuxComplete(e) { + var t; + const i = "audio", + { hls: n } = this, + { remuxResult: r, chunkMeta: a } = e, + o = this.getCurrentContext(a); + if (!o) { + this.resetWhenMissingContext(a); + return; + } + const { frag: l, part: u, level: c } = o, + { details: d } = c, + { audio: f, text: g, id3: p, initSegment: v } = r; + if (this.fragContextChanged(l) || !d) { + this.fragmentTracker.removeFragment(l); + return; + } + if ( + ((this.state = H.PARSING), + this.switchingTrack && + f && + this.completeAudioSwitch(this.switchingTrack), + v != null && v.tracks) + ) { + const T = l.initSegment || l; + this._bufferInitSegment(v.tracks, T, a), + n.trigger(y.FRAG_PARSING_INIT_SEGMENT, { + frag: T, + id: i, + tracks: v.tracks, + }); + } + if (f) { + const { startPTS: T, endPTS: x, startDTS: I, endDTS: L } = f; + u && + (u.elementaryStreams[_e.AUDIO] = { + startPTS: T, + endPTS: x, + startDTS: I, + endDTS: L, + }), + l.setElementaryStreamInfo(_e.AUDIO, T, x, I, L), + this.bufferFragmentData(f, l, u, a); + } + if (p != null && (t = p.samples) != null && t.length) { + const T = Fe({ id: i, frag: l, details: d }, p); + n.trigger(y.FRAG_PARSING_METADATA, T); + } + if (g) { + const T = Fe({ id: i, frag: l, details: d }, g); + n.trigger(y.FRAG_PARSING_USERDATA, T); + } + } + _bufferInitSegment(e, t, i) { + if (this.state !== H.PARSING) return; + e.video && delete e.video; + const n = e.audio; + if (!n) return; + (n.levelCodec = n.codec), + (n.id = "audio"), + this.log( + `Init audio buffer, container:${n.container}, codecs[parsed]=[${n.codec}]` + ), + this.hls.trigger(y.BUFFER_CODECS, e); + const r = n.initSegment; + if (r != null && r.byteLength) { + const a = { + type: "audio", + frag: t, + part: null, + chunkMeta: i, + parent: t.type, + data: r, + }; + this.hls.trigger(y.BUFFER_APPENDING, a); + } + this.tick(); + } + loadFragment(e, t, i) { + const n = this.fragmentTracker.getState(e); + if ( + ((this.fragCurrent = e), + this.switchingTrack || n === Be.NOT_LOADED || n === Be.PARTIAL) + ) { + var r; + e.sn === "initSegment" + ? this._loadInitSegment(e, t) + : (r = t.details) != null && r.live && !this.initPTS[e.cc] + ? (this.log( + `Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}` + ), + (this.state = H.WAITING_INIT_PTS)) + : ((this.startFragRequested = !0), super.loadFragment(e, t, i)); + } else this.clearTrackerIfNeeded(e); + } + completeAudioSwitch(e) { + const { hls: t, media: i, bufferedTrack: n } = this, + r = n == null ? void 0 : n.attrs, + a = e.attrs; + i && + r && + (r.CHANNELS !== a.CHANNELS || + r.NAME !== a.NAME || + r.LANGUAGE !== a.LANGUAGE) && + (this.log("Switching audio track : flushing all audio"), + super.flushMainBuffer(0, Number.POSITIVE_INFINITY, "audio")), + (this.bufferedTrack = e), + (this.switchingTrack = null), + t.trigger(y.AUDIO_TRACK_SWITCHED, We({}, e)); + } + } + class ef extends cr { + constructor(e) { + super(e, "[audio-track-controller]"), + (this.tracks = []), + (this.groupId = null), + (this.tracksInGroup = []), + (this.trackId = -1), + (this.currentTrack = null), + (this.selectDefaultTrack = !0), + this.registerListeners(); + } + registerListeners() { + const { hls: e } = this; + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.on(y.LEVEL_LOADING, this.onLevelLoading, this), + e.on(y.LEVEL_SWITCHING, this.onLevelSwitching, this), + e.on(y.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), + e.on(y.ERROR, this.onError, this); + } + unregisterListeners() { + const { hls: e } = this; + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.off(y.LEVEL_LOADING, this.onLevelLoading, this), + e.off(y.LEVEL_SWITCHING, this.onLevelSwitching, this), + e.off(y.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), + e.off(y.ERROR, this.onError, this); + } + destroy() { + this.unregisterListeners(), + (this.tracks.length = 0), + (this.tracksInGroup.length = 0), + (this.currentTrack = null), + super.destroy(); + } + onManifestLoading() { + (this.tracks = []), + (this.groupId = null), + (this.tracksInGroup = []), + (this.trackId = -1), + (this.currentTrack = null), + (this.selectDefaultTrack = !0); + } + onManifestParsed(e, t) { + this.tracks = t.audioTracks || []; + } + onAudioTrackLoaded(e, t) { + const { id: i, groupId: n, details: r } = t, + a = this.tracksInGroup[i]; + if (!a || a.groupId !== n) { + this.warn( + `Track with id:${i} and group:${n} not found in active group ${a.groupId}` + ); + return; + } + const o = a.details; + (a.details = t.details), + this.log( + `audio-track ${i} "${a.name}" lang:${a.lang} group:${n} loaded [${r.startSN}-${r.endSN}]` + ), + i === this.trackId && this.playlistLoaded(i, t, o); + } + onLevelLoading(e, t) { + this.switchLevel(t.level); + } + onLevelSwitching(e, t) { + this.switchLevel(t.level); + } + switchLevel(e) { + const t = this.hls.levels[e]; + if (!(t != null && t.audioGroupIds)) return; + const i = t.audioGroupIds[t.urlId]; + if (this.groupId !== i) { + this.groupId = i || null; + const n = this.tracks.filter((a) => !i || a.groupId === i); + this.selectDefaultTrack && + !n.some((a) => a.default) && + (this.selectDefaultTrack = !1), + (this.tracksInGroup = n); + const r = { audioTracks: n }; + this.log( + `Updating audio tracks, ${n.length} track(s) found in group:${i}` + ), + this.hls.trigger(y.AUDIO_TRACKS_UPDATED, r), + this.selectInitialTrack(); + } else this.shouldReloadPlaylist(this.currentTrack) && this.setAudioTrack(this.trackId); + } + onError(e, t) { + t.fatal || + !t.context || + (t.context.type === de.AUDIO_TRACK && + t.context.id === this.trackId && + t.context.groupId === this.groupId && + ((this.requestScheduled = -1), this.checkRetry(t))); + } + get audioTracks() { + return this.tracksInGroup; + } + get audioTrack() { + return this.trackId; + } + set audioTrack(e) { + (this.selectDefaultTrack = !1), this.setAudioTrack(e); + } + setAudioTrack(e) { + const t = this.tracksInGroup; + if (e < 0 || e >= t.length) { + this.warn("Invalid id passed to audio-track controller"); + return; + } + this.clearTimer(); + const i = this.currentTrack; + t[this.trackId]; + const n = t[e], + { groupId: r, name: a } = n; + if ( + (this.log( + `Switching to audio-track ${e} "${a}" lang:${n.lang} group:${r}` + ), + (this.trackId = e), + (this.currentTrack = n), + (this.selectDefaultTrack = !1), + this.hls.trigger(y.AUDIO_TRACK_SWITCHING, We({}, n)), + n.details && !n.details.live) + ) + return; + const o = this.switchParams(n.url, i == null ? void 0 : i.details); + this.loadPlaylist(o); + } + selectInitialTrack() { + const e = this.tracksInGroup, + t = this.findTrackId(this.currentTrack) | this.findTrackId(null); + if (t !== -1) this.setAudioTrack(t); + else { + const i = new Error( + `No track found for running audio group-ID: ${this.groupId} track count: ${e.length}` + ); + this.warn(i.message), + this.hls.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.AUDIO_TRACK_LOAD_ERROR, + fatal: !0, + error: i, + }); + } + } + findTrackId(e) { + const t = this.tracksInGroup; + for (let i = 0; i < t.length; i++) { + const n = t[i]; + if ( + (!this.selectDefaultTrack || n.default) && + (!e || + (e.attrs["STABLE-RENDITION-ID"] !== void 0 && + e.attrs["STABLE-RENDITION-ID"] === + n.attrs["STABLE-RENDITION-ID"]) || + (e.name === n.name && e.lang === n.lang)) + ) + return n.id; + } + return -1; + } + loadPlaylist(e) { + super.loadPlaylist(); + const t = this.tracksInGroup[this.trackId]; + if (this.shouldLoadPlaylist(t)) { + const i = t.id, + n = t.groupId; + let r = t.url; + if (e) + try { + r = e.addDirectives(r); + } catch (a) { + this.warn( + `Could not construct new URL with HLS Delivery Directives: ${a}` + ); + } + this.log( + `loading audio-track playlist ${i} "${t.name}" lang:${t.lang} group:${n}` + ), + this.clearTimer(), + this.hls.trigger(y.AUDIO_TRACK_LOADING, { + url: r, + id: i, + groupId: n, + deliveryDirectives: e || null, + }); + } + } + } + function ko(s, e) { + if (s.length !== e.length) return !1; + for (let t = 0; t < s.length; t++) + if (!tf(s[t].attrs, e[t].attrs)) return !1; + return !0; + } + function tf(s, e) { + const t = s["STABLE-RENDITION-ID"]; + return t + ? t === e["STABLE-RENDITION-ID"] + : ![ + "LANGUAGE", + "NAME", + "CHARACTERISTICS", + "AUTOSELECT", + "DEFAULT", + "FORCED", + ].some((i) => s[i] !== e[i]); + } + const So = 500; + class nf extends pr { + constructor(e, t, i) { + super(e, t, i, "[subtitle-stream-controller]", se.SUBTITLE), + (this.levels = []), + (this.currentTrackId = -1), + (this.tracksBuffered = []), + (this.mainDetails = null), + this._registerListeners(); + } + onHandlerDestroying() { + this._unregisterListeners(), (this.mainDetails = null); + } + _registerListeners() { + const { hls: e } = this; + e.on(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.on(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.LEVEL_LOADED, this.onLevelLoaded, this), + e.on(y.ERROR, this.onError, this), + e.on(y.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), + e.on(y.SUBTITLE_TRACK_SWITCH, this.onSubtitleTrackSwitch, this), + e.on(y.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), + e.on(y.SUBTITLE_FRAG_PROCESSED, this.onSubtitleFragProcessed, this), + e.on(y.BUFFER_FLUSHING, this.onBufferFlushing, this), + e.on(y.FRAG_BUFFERED, this.onFragBuffered, this); + } + _unregisterListeners() { + const { hls: e } = this; + e.off(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.off(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.LEVEL_LOADED, this.onLevelLoaded, this), + e.off(y.ERROR, this.onError, this), + e.off(y.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), + e.off(y.SUBTITLE_TRACK_SWITCH, this.onSubtitleTrackSwitch, this), + e.off(y.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), + e.off(y.SUBTITLE_FRAG_PROCESSED, this.onSubtitleFragProcessed, this), + e.off(y.BUFFER_FLUSHING, this.onBufferFlushing, this), + e.off(y.FRAG_BUFFERED, this.onFragBuffered, this); + } + startLoad(e) { + this.stopLoad(), + (this.state = H.IDLE), + this.setInterval(So), + (this.nextLoadPosition = this.startPosition = this.lastCurrentTime = e), + this.tick(); + } + onManifestLoading() { + (this.mainDetails = null), this.fragmentTracker.removeAllFragments(); + } + onMediaDetaching() { + (this.tracksBuffered = []), super.onMediaDetaching(); + } + onLevelLoaded(e, t) { + this.mainDetails = t.details; + } + onSubtitleFragProcessed(e, t) { + const { frag: i, success: n } = t; + if (((this.fragPrevious = i), (this.state = H.IDLE), !n)) return; + const r = this.tracksBuffered[this.currentTrackId]; + if (!r) return; + let a; + const o = i.start; + for (let u = 0; u < r.length; u++) + if (o >= r[u].start && o <= r[u].end) { + a = r[u]; + break; + } + const l = i.start + i.duration; + a ? (a.end = l) : ((a = { start: o, end: l }), r.push(a)), + this.fragmentTracker.fragBuffered(i); + } + onBufferFlushing(e, t) { + const { startOffset: i, endOffset: n } = t; + if (i === 0 && n !== Number.POSITIVE_INFINITY) { + const r = n - 1; + if (r <= 0) return; + (t.endOffsetSubtitles = Math.max(0, r)), + this.tracksBuffered.forEach((a) => { + for (let o = 0; o < a.length; ) { + if (a[o].end <= r) { + a.shift(); + continue; + } else if (a[o].start < r) a[o].start = r; + else break; + o++; + } + }), + this.fragmentTracker.removeFragmentsInRange(i, r, se.SUBTITLE); + } + } + onFragBuffered(e, t) { + if (!this.loadedmetadata && t.frag.type === se.MAIN) { + var i; + (i = this.media) != null && + i.buffered.length && + (this.loadedmetadata = !0); + } + } + onError(e, t) { + const i = t.frag; + (i == null ? void 0 : i.type) === se.SUBTITLE && + (this.fragCurrent && this.fragCurrent.abortRequests(), + this.state !== H.STOPPED && (this.state = H.IDLE)); + } + onSubtitleTracksUpdated(e, { subtitleTracks: t }) { + if (ko(this.levels, t)) { + this.levels = t.map((i) => new xi(i)); + return; + } + (this.tracksBuffered = []), + (this.levels = t.map((i) => { + const n = new xi(i); + return (this.tracksBuffered[n.id] = []), n; + })), + this.fragmentTracker.removeFragmentsInRange( + 0, + Number.POSITIVE_INFINITY, + se.SUBTITLE + ), + (this.fragPrevious = null), + (this.mediaBuffer = null); + } + onSubtitleTrackSwitch(e, t) { + if ( + ((this.currentTrackId = t.id), + !this.levels.length || this.currentTrackId === -1) + ) { + this.clearInterval(); + return; + } + const i = this.levels[this.currentTrackId]; + i != null && i.details + ? (this.mediaBuffer = this.mediaBufferTimeRanges) + : (this.mediaBuffer = null), + i && this.setInterval(So); + } + onSubtitleTrackLoaded(e, t) { + var i; + const { details: n, id: r } = t, + { currentTrackId: a, levels: o } = this; + if (!o.length) return; + const l = o[a]; + if (r >= o.length || r !== a || !l) return; + this.mediaBuffer = this.mediaBufferTimeRanges; + let u = 0; + if (n.live || ((i = l.details) != null && i.live)) { + const c = this.mainDetails; + if (n.deltaUpdateFailed || !c) return; + const d = c.fragments[0]; + l.details + ? ((u = this.alignPlaylists(n, l.details)), + u === 0 && d && ((u = d.start), or(n, u))) + : n.hasProgramDateTime && c.hasProgramDateTime + ? (Ja(n, c), (u = n.fragments[0].start)) + : d && ((u = d.start), or(n, u)); + } + (l.details = n), + (this.levelLastLoaded = r), + !this.startFragRequested && + (this.mainDetails || !n.live) && + this.setStartPosition(l.details, u), + this.tick(), + n.live && + !this.fragCurrent && + this.media && + this.state === H.IDLE && + (Li(null, n.fragments, this.media.currentTime, 0) || + (this.warn("Subtitle playlist not aligned with playback"), + (l.details = void 0))); + } + _handleFragmentLoadComplete(e) { + const { frag: t, payload: i } = e, + n = t.decryptdata, + r = this.hls; + if ( + !this.fragContextChanged(t) && + i && + i.byteLength > 0 && + n && + n.key && + n.iv && + n.method === "AES-128" + ) { + const a = performance.now(); + this.decrypter + .decrypt(new Uint8Array(i), n.key.buffer, n.iv.buffer) + .catch((o) => { + throw ( + (r.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.FRAG_DECRYPT_ERROR, + fatal: !1, + error: o, + reason: o.message, + frag: t, + }), + o) + ); + }) + .then((o) => { + const l = performance.now(); + r.trigger(y.FRAG_DECRYPTED, { + frag: t, + payload: o, + stats: { tstart: a, tdecrypt: l }, + }); + }) + .catch((o) => { + this.warn(`${o.name}: ${o.message}`), (this.state = H.IDLE); + }); + } + } + doTick() { + if (!this.media) { + this.state = H.IDLE; + return; + } + if (this.state === H.IDLE) { + const { currentTrackId: e, levels: t } = this, + i = t[e]; + if (!t.length || !i || !i.details) return; + const { config: n } = this, + r = this.getLoadPosition(), + a = Se.bufferedInfo( + this.tracksBuffered[this.currentTrackId] || [], + r, + n.maxBufferHole + ), + { end: o, len: l } = a, + u = this.getFwdBufferInfo(this.media, se.MAIN), + c = i.details, + d = + this.getMaxBufferLength(u == null ? void 0 : u.len) + + c.levelTargetDuration; + if (l > d) return; + const f = c.fragments, + g = f.length, + p = c.edge; + let v = null; + const T = this.fragPrevious; + if (o < p) { + const x = n.maxFragLookUpTolerance, + I = o > p - x ? 0 : x; + (v = Li(T, f, Math.max(f[0].start, o), I)), + !v && T && T.start < f[0].start && (v = f[0]); + } else v = f[g - 1]; + if (!v) return; + if (((v = this.mapToInitFragWhenRequired(v)), v.sn !== "initSegment")) { + const x = v.sn - c.startSN, + I = f[x - 1]; + I && + I.cc === v.cc && + this.fragmentTracker.getState(I) === Be.NOT_LOADED && + (v = I); + } + this.fragmentTracker.getState(v) === Be.NOT_LOADED && + this.loadFragment(v, i, o); + } + } + getMaxBufferLength(e) { + const t = super.getMaxBufferLength(); + return e ? Math.max(t, e) : t; + } + loadFragment(e, t, i) { + (this.fragCurrent = e), + e.sn === "initSegment" + ? this._loadInitSegment(e, t) + : ((this.startFragRequested = !0), super.loadFragment(e, t, i)); + } + get mediaBufferTimeRanges() { + return new rf(this.tracksBuffered[this.currentTrackId] || []); + } + } + class rf { + constructor(e) { + this.buffered = void 0; + const t = (i, n, r) => { + if (((n = n >>> 0), n > r - 1)) + throw new DOMException( + `Failed to execute '${i}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${r})` + ); + return e[n][i]; + }; + this.buffered = { + get length() { + return e.length; + }, + end(i) { + return t("end", i, e.length); + }, + start(i) { + return t("start", i, e.length); + }, + }; + } + } + class sf extends cr { + constructor(e) { + super(e, "[subtitle-track-controller]"), + (this.media = null), + (this.tracks = []), + (this.groupId = null), + (this.tracksInGroup = []), + (this.trackId = -1), + (this.selectDefaultTrack = !0), + (this.queuedDefaultTrack = -1), + (this.trackChangeListener = () => this.onTextTracksChanged()), + (this.asyncPollTrackChange = () => this.pollTrackChange(0)), + (this.useTextTrackPolling = !1), + (this.subtitlePollingInterval = -1), + (this._subtitleDisplay = !0), + this.registerListeners(); + } + destroy() { + this.unregisterListeners(), + (this.tracks.length = 0), + (this.tracksInGroup.length = 0), + (this.trackChangeListener = this.asyncPollTrackChange = null), + super.destroy(); + } + get subtitleDisplay() { + return this._subtitleDisplay; + } + set subtitleDisplay(e) { + (this._subtitleDisplay = e), + this.trackId > -1 && this.toggleTrackModes(this.trackId); + } + registerListeners() { + const { hls: e } = this; + e.on(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.on(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.on(y.LEVEL_LOADING, this.onLevelLoading, this), + e.on(y.LEVEL_SWITCHING, this.onLevelSwitching, this), + e.on(y.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), + e.on(y.ERROR, this.onError, this); + } + unregisterListeners() { + const { hls: e } = this; + e.off(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.off(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.off(y.LEVEL_LOADING, this.onLevelLoading, this), + e.off(y.LEVEL_SWITCHING, this.onLevelSwitching, this), + e.off(y.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), + e.off(y.ERROR, this.onError, this); + } + onMediaAttached(e, t) { + (this.media = t.media), + this.media && + (this.queuedDefaultTrack > -1 && + ((this.subtitleTrack = this.queuedDefaultTrack), + (this.queuedDefaultTrack = -1)), + (this.useTextTrackPolling = !( + this.media.textTracks && "onchange" in this.media.textTracks + )), + this.useTextTrackPolling + ? this.pollTrackChange(500) + : this.media.textTracks.addEventListener( + "change", + this.asyncPollTrackChange + )); + } + pollTrackChange(e) { + self.clearInterval(this.subtitlePollingInterval), + (this.subtitlePollingInterval = self.setInterval( + this.trackChangeListener, + e + )); + } + onMediaDetaching() { + if (!this.media) return; + self.clearInterval(this.subtitlePollingInterval), + this.useTextTrackPolling || + this.media.textTracks.removeEventListener( + "change", + this.asyncPollTrackChange + ), + this.trackId > -1 && (this.queuedDefaultTrack = this.trackId), + xr(this.media.textTracks).forEach((t) => { + hi(t); + }), + (this.subtitleTrack = -1), + (this.media = null); + } + onManifestLoading() { + (this.tracks = []), + (this.groupId = null), + (this.tracksInGroup = []), + (this.trackId = -1), + (this.selectDefaultTrack = !0); + } + onManifestParsed(e, t) { + this.tracks = t.subtitleTracks; + } + onSubtitleTrackLoaded(e, t) { + const { id: i, details: n } = t, + { trackId: r } = this, + a = this.tracksInGroup[r]; + if (!a) { + this.warn(`Invalid subtitle track id ${i}`); + return; + } + const o = a.details; + (a.details = t.details), + this.log(`subtitle track ${i} loaded [${n.startSN}-${n.endSN}]`), + i === this.trackId && this.playlistLoaded(i, t, o); + } + onLevelLoading(e, t) { + this.switchLevel(t.level); + } + onLevelSwitching(e, t) { + this.switchLevel(t.level); + } + switchLevel(e) { + const t = this.hls.levels[e]; + if (!(t != null && t.textGroupIds)) return; + const i = t.textGroupIds[t.urlId], + n = this.tracksInGroup ? this.tracksInGroup[this.trackId] : void 0; + if (this.groupId !== i) { + const r = this.tracks.filter((l) => !i || l.groupId === i); + this.tracksInGroup = r; + const a = + this.findTrackId(n == null ? void 0 : n.name) || this.findTrackId(); + this.groupId = i || null; + const o = { subtitleTracks: r }; + this.log( + `Updating subtitle tracks, ${r.length} track(s) found in "${i}" group-id` + ), + this.hls.trigger(y.SUBTITLE_TRACKS_UPDATED, o), + a !== -1 && this.setSubtitleTrack(a, n); + } else this.shouldReloadPlaylist(n) && this.setSubtitleTrack(this.trackId, n); + } + findTrackId(e) { + const t = this.tracksInGroup; + for (let i = 0; i < t.length; i++) { + const n = t[i]; + if ((!this.selectDefaultTrack || n.default) && (!e || e === n.name)) + return n.id; + } + return -1; + } + onError(e, t) { + t.fatal || + !t.context || + (t.context.type === de.SUBTITLE_TRACK && + t.context.id === this.trackId && + t.context.groupId === this.groupId && + this.checkRetry(t)); + } + get subtitleTracks() { + return this.tracksInGroup; + } + get subtitleTrack() { + return this.trackId; + } + set subtitleTrack(e) { + this.selectDefaultTrack = !1; + const t = this.tracksInGroup ? this.tracksInGroup[this.trackId] : void 0; + this.setSubtitleTrack(e, t); + } + loadPlaylist(e) { + super.loadPlaylist(); + const t = this.tracksInGroup[this.trackId]; + if (this.shouldLoadPlaylist(t)) { + const i = t.id, + n = t.groupId; + let r = t.url; + if (e) + try { + r = e.addDirectives(r); + } catch (a) { + this.warn( + `Could not construct new URL with HLS Delivery Directives: ${a}` + ); + } + this.log(`Loading subtitle playlist for id ${i}`), + this.hls.trigger(y.SUBTITLE_TRACK_LOADING, { + url: r, + id: i, + groupId: n, + deliveryDirectives: e || null, + }); + } + } + toggleTrackModes(e) { + const { media: t, trackId: i } = this; + if (!t) return; + const n = xr(t.textTracks), + r = n.filter((o) => o.groupId === this.groupId); + if (e === -1) + [].slice.call(n).forEach((o) => { + o.mode = "disabled"; + }); + else { + const o = r[i]; + o && (o.mode = "disabled"); + } + const a = r[e]; + a && (a.mode = this.subtitleDisplay ? "showing" : "hidden"); + } + setSubtitleTrack(e, t) { + var i; + const n = this.tracksInGroup; + if (!this.media) { + this.queuedDefaultTrack = e; + return; + } + if ( + (this.trackId !== e && this.toggleTrackModes(e), + (this.trackId === e && + (e === -1 || ((i = n[e]) != null && i.details))) || + e < -1 || + e >= n.length) + ) + return; + this.clearTimer(); + const r = n[e]; + if ( + (this.log( + `Switching to subtitle-track ${e}` + + (r ? ` "${r.name}" lang:${r.lang} group:${r.groupId}` : "") + ), + (this.trackId = e), + r) + ) { + const { id: a, groupId: o = "", name: l, type: u, url: c } = r; + this.hls.trigger(y.SUBTITLE_TRACK_SWITCH, { + id: a, + groupId: o, + name: l, + type: u, + url: c, + }); + const d = this.switchParams(r.url, t == null ? void 0 : t.details); + this.loadPlaylist(d); + } else this.hls.trigger(y.SUBTITLE_TRACK_SWITCH, { id: e }); + } + onTextTracksChanged() { + if ( + (this.useTextTrackPolling || + self.clearInterval(this.subtitlePollingInterval), + !this.media || !this.hls.config.renderTextTracksNatively) + ) + return; + let e = -1; + const t = xr(this.media.textTracks); + for (let i = 0; i < t.length; i++) + if (t[i].mode === "hidden") e = i; + else if (t[i].mode === "showing") { + e = i; + break; + } + this.subtitleTrack !== e && (this.subtitleTrack = e); + } + } + function xr(s) { + const e = []; + for (let t = 0; t < s.length; t++) { + const i = s[t]; + (i.kind === "subtitles" || i.kind === "captions") && + i.label && + e.push(s[t]); + } + return e; + } + class af { + constructor(e) { + (this.buffers = void 0), + (this.queues = { video: [], audio: [], audiovideo: [] }), + (this.buffers = e); + } + append(e, t) { + const i = this.queues[t]; + i.push(e), i.length === 1 && this.buffers[t] && this.executeNext(t); + } + insertAbort(e, t) { + this.queues[t].unshift(e), this.executeNext(t); + } + appendBlocker(e) { + let t; + const i = new Promise((r) => { + t = r; + }), + n = { + execute: t, + onStart: () => {}, + onComplete: () => {}, + onError: () => {}, + }; + return this.append(n, e), i; + } + executeNext(e) { + const { buffers: t, queues: i } = this, + n = t[e], + r = i[e]; + if (r.length) { + const a = r[0]; + try { + a.execute(); + } catch (o) { + D.warn( + "[buffer-operation-queue]: Unhandled exception executing the current operation" + ), + a.onError(o), + (n != null && n.updating) || (r.shift(), this.executeNext(e)); + } + } + } + shiftAndExecuteNext(e) { + this.queues[e].shift(), this.executeNext(e); + } + current(e) { + return this.queues[e][0]; + } + } + const Co = en(), + xo = /([ha]vc.)(?:\.[^.,]+)+/; + class of { + constructor(e) { + (this.details = null), + (this._objectUrl = null), + (this.operationQueue = void 0), + (this.listeners = void 0), + (this.hls = void 0), + (this.bufferCodecEventsExpected = 0), + (this._bufferCodecEventsTotal = 0), + (this.media = null), + (this.mediaSource = null), + (this.lastMpegAudioChunk = null), + (this.appendError = 0), + (this.tracks = {}), + (this.pendingTracks = {}), + (this.sourceBuffer = void 0), + (this._onMediaSourceOpen = () => { + const { media: t, mediaSource: i } = this; + D.log("[buffer-controller]: Media source opened"), + t && + (t.removeEventListener("emptied", this._onMediaEmptied), + this.updateMediaElementDuration(), + this.hls.trigger(y.MEDIA_ATTACHED, { media: t })), + i && i.removeEventListener("sourceopen", this._onMediaSourceOpen), + this.checkPendingTracks(); + }), + (this._onMediaSourceClose = () => { + D.log("[buffer-controller]: Media source closed"); + }), + (this._onMediaSourceEnded = () => { + D.log("[buffer-controller]: Media source ended"); + }), + (this._onMediaEmptied = () => { + const { media: t, _objectUrl: i } = this; + t && + t.src !== i && + D.error( + `Media element src was set while attaching MediaSource (${i} > ${t.src})` + ); + }), + (this.hls = e), + this._initSourceBuffer(), + this.registerListeners(); + } + hasSourceTypes() { + return ( + this.getSourceBufferTypes().length > 0 || + Object.keys(this.pendingTracks).length > 0 + ); + } + destroy() { + this.unregisterListeners(), + (this.details = null), + (this.lastMpegAudioChunk = null); + } + registerListeners() { + const { hls: e } = this; + e.on(y.MEDIA_ATTACHING, this.onMediaAttaching, this), + e.on(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.on(y.BUFFER_RESET, this.onBufferReset, this), + e.on(y.BUFFER_APPENDING, this.onBufferAppending, this), + e.on(y.BUFFER_CODECS, this.onBufferCodecs, this), + e.on(y.BUFFER_EOS, this.onBufferEos, this), + e.on(y.BUFFER_FLUSHING, this.onBufferFlushing, this), + e.on(y.LEVEL_UPDATED, this.onLevelUpdated, this), + e.on(y.FRAG_PARSED, this.onFragParsed, this), + e.on(y.FRAG_CHANGED, this.onFragChanged, this); + } + unregisterListeners() { + const { hls: e } = this; + e.off(y.MEDIA_ATTACHING, this.onMediaAttaching, this), + e.off(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.off(y.BUFFER_RESET, this.onBufferReset, this), + e.off(y.BUFFER_APPENDING, this.onBufferAppending, this), + e.off(y.BUFFER_CODECS, this.onBufferCodecs, this), + e.off(y.BUFFER_EOS, this.onBufferEos, this), + e.off(y.BUFFER_FLUSHING, this.onBufferFlushing, this), + e.off(y.LEVEL_UPDATED, this.onLevelUpdated, this), + e.off(y.FRAG_PARSED, this.onFragParsed, this), + e.off(y.FRAG_CHANGED, this.onFragChanged, this); + } + _initSourceBuffer() { + (this.sourceBuffer = {}), + (this.operationQueue = new af(this.sourceBuffer)), + (this.listeners = { audio: [], video: [], audiovideo: [] }), + (this.lastMpegAudioChunk = null); + } + onManifestLoading() { + (this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = 0), + (this.details = null); + } + onManifestParsed(e, t) { + let i = 2; + ((t.audio && !t.video) || !t.altAudio) && (i = 1), + (this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = i), + D.log( + `${this.bufferCodecEventsExpected} bufferCodec event(s) expected` + ); + } + onMediaAttaching(e, t) { + const i = (this.media = t.media); + if (i && Co) { + const n = (this.mediaSource = new Co()); + n.addEventListener("sourceopen", this._onMediaSourceOpen), + n.addEventListener("sourceended", this._onMediaSourceEnded), + n.addEventListener("sourceclose", this._onMediaSourceClose), + (i.src = self.URL.createObjectURL(n)), + (this._objectUrl = i.src), + i.addEventListener("emptied", this._onMediaEmptied); + } + } + onMediaDetaching() { + const { media: e, mediaSource: t, _objectUrl: i } = this; + if (t) { + if ( + (D.log("[buffer-controller]: media source detaching"), + t.readyState === "open") + ) + try { + t.endOfStream(); + } catch (n) { + D.warn( + `[buffer-controller]: onMediaDetaching: ${n.message} while calling endOfStream` + ); + } + this.onBufferReset(), + t.removeEventListener("sourceopen", this._onMediaSourceOpen), + t.removeEventListener("sourceended", this._onMediaSourceEnded), + t.removeEventListener("sourceclose", this._onMediaSourceClose), + e && + (e.removeEventListener("emptied", this._onMediaEmptied), + i && self.URL.revokeObjectURL(i), + e.src === i + ? (e.removeAttribute("src"), e.load()) + : D.warn( + "[buffer-controller]: media.src was changed by a third party - skip cleanup" + )), + (this.mediaSource = null), + (this.media = null), + (this._objectUrl = null), + (this.bufferCodecEventsExpected = this._bufferCodecEventsTotal), + (this.pendingTracks = {}), + (this.tracks = {}); + } + this.hls.trigger(y.MEDIA_DETACHED, void 0); + } + onBufferReset() { + this.getSourceBufferTypes().forEach((e) => { + const t = this.sourceBuffer[e]; + try { + t && + (this.removeBufferListeners(e), + this.mediaSource && this.mediaSource.removeSourceBuffer(t), + (this.sourceBuffer[e] = void 0)); + } catch (i) { + D.warn(`[buffer-controller]: Failed to reset the ${e} buffer`, i); + } + }), + this._initSourceBuffer(); + } + onBufferCodecs(e, t) { + const i = this.getSourceBufferTypes().length; + Object.keys(t).forEach((n) => { + if (i) { + const r = this.tracks[n]; + if (r && typeof r.buffer.changeType == "function") { + const { + id: a, + codec: o, + levelCodec: l, + container: u, + metadata: c, + } = t[n], + d = (r.levelCodec || r.codec).replace(xo, "$1"), + f = (l || o).replace(xo, "$1"); + if (d !== f) { + const g = `${u};codecs=${l || o}`; + this.appendChangeType(n, g), + D.log(`[buffer-controller]: switching codec ${d} to ${f}`), + (this.tracks[n] = { + buffer: r.buffer, + codec: o, + container: u, + levelCodec: l, + metadata: c, + id: a, + }); + } + } + } else this.pendingTracks[n] = t[n]; + }), + !i && + ((this.bufferCodecEventsExpected = Math.max( + this.bufferCodecEventsExpected - 1, + 0 + )), + this.mediaSource && + this.mediaSource.readyState === "open" && + this.checkPendingTracks()); + } + appendChangeType(e, t) { + const { operationQueue: i } = this, + n = { + execute: () => { + const r = this.sourceBuffer[e]; + r && + (D.log( + `[buffer-controller]: changing ${e} sourceBuffer type to ${t}` + ), + r.changeType(t)), + i.shiftAndExecuteNext(e); + }, + onStart: () => {}, + onComplete: () => {}, + onError: (r) => { + D.warn( + `[buffer-controller]: Failed to change ${e} SourceBuffer type`, + r + ); + }, + }; + i.append(n, e); + } + onBufferAppending(e, t) { + const { hls: i, operationQueue: n, tracks: r } = this, + { data: a, type: o, frag: l, part: u, chunkMeta: c } = t, + d = c.buffering[o], + f = self.performance.now(); + d.start = f; + const g = l.stats.buffering, + p = u ? u.stats.buffering : null; + g.start === 0 && (g.start = f), p && p.start === 0 && (p.start = f); + const v = r.audio; + let T = !1; + o === "audio" && + (v == null ? void 0 : v.container) === "audio/mpeg" && + ((T = + !this.lastMpegAudioChunk || + c.id === 1 || + this.lastMpegAudioChunk.sn !== c.sn), + (this.lastMpegAudioChunk = c)); + const x = l.start, + I = { + execute: () => { + if (((d.executeStart = self.performance.now()), T)) { + const L = this.sourceBuffer[o]; + if (L) { + const M = x - L.timestampOffset; + Math.abs(M) >= 0.1 && + (D.log( + `[buffer-controller]: Updating audio SourceBuffer timestampOffset to ${x} (delta: ${M}) sn: ${l.sn})` + ), + (L.timestampOffset = x)); + } + } + this.appendExecutor(a, o); + }, + onStart: () => {}, + onComplete: () => { + const L = self.performance.now(); + (d.executeEnd = d.end = L), + g.first === 0 && (g.first = L), + p && p.first === 0 && (p.first = L); + const { sourceBuffer: M } = this, + O = {}; + for (const j in M) O[j] = Se.getBuffered(M[j]); + (this.appendError = 0), + this.hls.trigger(y.BUFFER_APPENDED, { + type: o, + frag: l, + part: u, + chunkMeta: c, + parent: l.type, + timeRanges: O, + }); + }, + onError: (L) => { + D.error( + `[buffer-controller]: Error encountered while trying to append to the ${o} SourceBuffer`, + L + ); + const M = { + type: re.MEDIA_ERROR, + parent: l.type, + details: $.BUFFER_APPEND_ERROR, + frag: l, + part: u, + chunkMeta: c, + error: L, + err: L, + fatal: !1, + }; + L.code === DOMException.QUOTA_EXCEEDED_ERR + ? (M.details = $.BUFFER_FULL_ERROR) + : (this.appendError++, + (M.details = $.BUFFER_APPEND_ERROR), + this.appendError > i.config.appendErrorMaxRetry && + (D.error( + `[buffer-controller]: Failed ${i.config.appendErrorMaxRetry} times to append segment in sourceBuffer` + ), + (M.fatal = !0))), + i.trigger(y.ERROR, M); + }, + }; + n.append(I, o); + } + onBufferFlushing(e, t) { + const { operationQueue: i } = this, + n = (r) => ({ + execute: this.removeExecutor.bind( + this, + r, + t.startOffset, + t.endOffset + ), + onStart: () => {}, + onComplete: () => { + this.hls.trigger(y.BUFFER_FLUSHED, { type: r }); + }, + onError: (a) => { + D.warn( + `[buffer-controller]: Failed to remove from ${r} SourceBuffer`, + a + ); + }, + }); + t.type + ? i.append(n(t.type), t.type) + : this.getSourceBufferTypes().forEach((r) => { + i.append(n(r), r); + }); + } + onFragParsed(e, t) { + const { frag: i, part: n } = t, + r = [], + a = n ? n.elementaryStreams : i.elementaryStreams; + a[_e.AUDIOVIDEO] + ? r.push("audiovideo") + : (a[_e.AUDIO] && r.push("audio"), a[_e.VIDEO] && r.push("video")); + const o = () => { + const l = self.performance.now(); + (i.stats.buffering.end = l), n && (n.stats.buffering.end = l); + const u = n ? n.stats : i.stats; + this.hls.trigger(y.FRAG_BUFFERED, { + frag: i, + part: n, + stats: u, + id: i.type, + }); + }; + r.length === 0 && + D.warn( + `Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}` + ), + this.blockBuffers(o, r); + } + onFragChanged(e, t) { + this.flushBackBuffer(); + } + onBufferEos(e, t) { + this.getSourceBufferTypes().reduce((n, r) => { + const a = this.sourceBuffer[r]; + return ( + a && + (!t.type || t.type === r) && + ((a.ending = !0), + a.ended || + ((a.ended = !0), + D.log(`[buffer-controller]: ${r} sourceBuffer now EOS`))), + n && !!(!a || a.ended) + ); + }, !0) && + (D.log("[buffer-controller]: Queueing mediaSource.endOfStream()"), + this.blockBuffers(() => { + this.getSourceBufferTypes().forEach((r) => { + const a = this.sourceBuffer[r]; + a && (a.ending = !1); + }); + const { mediaSource: n } = this; + if (!n || n.readyState !== "open") { + n && + D.info( + `[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: ${n.readyState}` + ); + return; + } + D.log("[buffer-controller]: Calling mediaSource.endOfStream()"), + n.endOfStream(); + })); + } + onLevelUpdated(e, { details: t }) { + t.fragments.length && + ((this.details = t), + this.getSourceBufferTypes().length + ? this.blockBuffers(this.updateMediaElementDuration.bind(this)) + : this.updateMediaElementDuration()); + } + flushBackBuffer() { + const { hls: e, details: t, media: i, sourceBuffer: n } = this; + if (!i || t === null) return; + const r = this.getSourceBufferTypes(); + if (!r.length) return; + const a = + t.live && e.config.liveBackBufferLength !== null + ? e.config.liveBackBufferLength + : e.config.backBufferLength; + if (!ne(a) || a < 0) return; + const o = i.currentTime, + l = t.levelTargetDuration, + u = Math.max(a, l), + c = Math.floor(o / l) * l - u; + r.forEach((d) => { + const f = n[d]; + if (f) { + const g = Se.getBuffered(f); + if (g.length > 0 && c > g.start(0)) { + if ((e.trigger(y.BACK_BUFFER_REACHED, { bufferEnd: c }), t.live)) + e.trigger(y.LIVE_BACK_BUFFER_REACHED, { bufferEnd: c }); + else if (f.ended && g.end(g.length - 1) - o < l * 2) { + D.info( + `[buffer-controller]: Cannot flush ${d} back buffer while SourceBuffer is in ended state` + ); + return; + } + e.trigger(y.BUFFER_FLUSHING, { + startOffset: 0, + endOffset: c, + type: d, + }); + } + } + }); + } + updateMediaElementDuration() { + if ( + !this.details || + !this.media || + !this.mediaSource || + this.mediaSource.readyState !== "open" + ) + return; + const { details: e, hls: t, media: i, mediaSource: n } = this, + r = e.fragments[0].start + e.totalduration, + a = i.duration, + o = ne(n.duration) ? n.duration : 0; + e.live && t.config.liveDurationInfinity + ? (D.log( + "[buffer-controller]: Media Source duration is set to Infinity" + ), + (n.duration = 1 / 0), + this.updateSeekableRange(e)) + : ((r > o && r > a) || !ne(a)) && + (D.log( + `[buffer-controller]: Updating Media Source duration to ${r.toFixed( + 3 + )}` + ), + (n.duration = r)); + } + updateSeekableRange(e) { + const t = this.mediaSource, + i = e.fragments; + if (i.length && e.live && t != null && t.setLiveSeekableRange) { + const r = Math.max(0, i[0].start), + a = Math.max(r, r + e.totalduration); + t.setLiveSeekableRange(r, a); + } + } + checkPendingTracks() { + const { + bufferCodecEventsExpected: e, + operationQueue: t, + pendingTracks: i, + } = this, + n = Object.keys(i).length; + if ((n && !e) || n === 2) { + this.createSourceBuffers(i), (this.pendingTracks = {}); + const r = this.getSourceBufferTypes(); + if (r.length) + this.hls.trigger(y.BUFFER_CREATED, { tracks: this.tracks }), + r.forEach((a) => { + t.executeNext(a); + }); + else { + const a = new Error( + "could not create source buffer for media codec(s)" + ); + this.hls.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.BUFFER_INCOMPATIBLE_CODECS_ERROR, + fatal: !0, + error: a, + reason: a.message, + }); + } + } + } + createSourceBuffers(e) { + const { sourceBuffer: t, mediaSource: i } = this; + if (!i) + throw Error("createSourceBuffers called when mediaSource was null"); + for (const n in e) + if (!t[n]) { + const r = e[n]; + if (!r) + throw Error( + `source buffer exists for track ${n}, however track does not` + ); + const a = r.levelCodec || r.codec, + o = `${r.container};codecs=${a}`; + D.log(`[buffer-controller]: creating sourceBuffer(${o})`); + try { + const l = (t[n] = i.addSourceBuffer(o)), + u = n; + this.addBufferListener(u, "updatestart", this._onSBUpdateStart), + this.addBufferListener(u, "updateend", this._onSBUpdateEnd), + this.addBufferListener(u, "error", this._onSBUpdateError), + (this.tracks[n] = { + buffer: l, + codec: a, + container: r.container, + levelCodec: r.levelCodec, + metadata: r.metadata, + id: r.id, + }); + } catch (l) { + D.error( + `[buffer-controller]: error while trying to add sourceBuffer: ${l.message}` + ), + this.hls.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.BUFFER_ADD_CODEC_ERROR, + fatal: !1, + error: l, + mimeType: o, + }); + } + } + } + _onSBUpdateStart(e) { + const { operationQueue: t } = this; + t.current(e).onStart(); + } + _onSBUpdateEnd(e) { + const { operationQueue: t } = this; + t.current(e).onComplete(), t.shiftAndExecuteNext(e); + } + _onSBUpdateError(e, t) { + const i = new Error(`${e} SourceBuffer error`); + D.error(`[buffer-controller]: ${i}`, t), + this.hls.trigger(y.ERROR, { + type: re.MEDIA_ERROR, + details: $.BUFFER_APPENDING_ERROR, + error: i, + fatal: !1, + }); + const n = this.operationQueue.current(e); + n && n.onError(t); + } + removeExecutor(e, t, i) { + const { + media: n, + mediaSource: r, + operationQueue: a, + sourceBuffer: o, + } = this, + l = o[e]; + if (!n || !r || !l) { + D.warn( + `[buffer-controller]: Attempting to remove from the ${e} SourceBuffer, but it does not exist` + ), + a.shiftAndExecuteNext(e); + return; + } + const u = ne(n.duration) ? n.duration : 1 / 0, + c = ne(r.duration) ? r.duration : 1 / 0, + d = Math.max(0, t), + f = Math.min(i, u, c); + f > d && !l.ending + ? ((l.ended = !1), + D.log( + `[buffer-controller]: Removing [${d},${f}] from the ${e} SourceBuffer` + ), + l.remove(d, f)) + : a.shiftAndExecuteNext(e); + } + appendExecutor(e, t) { + const { operationQueue: i, sourceBuffer: n } = this, + r = n[t]; + if (!r) { + D.warn( + `[buffer-controller]: Attempting to append to the ${t} SourceBuffer, but it does not exist` + ), + i.shiftAndExecuteNext(t); + return; + } + (r.ended = !1), r.appendBuffer(e); + } + blockBuffers(e, t = this.getSourceBufferTypes()) { + if (!t.length) { + D.log( + "[buffer-controller]: Blocking operation requested, but no SourceBuffers exist" + ), + Promise.resolve().then(e); + return; + } + const { operationQueue: i } = this, + n = t.map((r) => i.appendBlocker(r)); + Promise.all(n).then(() => { + e(), + t.forEach((r) => { + const a = this.sourceBuffer[r]; + (a != null && a.updating) || i.shiftAndExecuteNext(r); + }); + }); + } + getSourceBufferTypes() { + return Object.keys(this.sourceBuffer); + } + addBufferListener(e, t, i) { + const n = this.sourceBuffer[e]; + if (!n) return; + const r = i.bind(this, e); + this.listeners[e].push({ event: t, listener: r }), + n.addEventListener(t, r); + } + removeBufferListeners(e) { + const t = this.sourceBuffer[e]; + t && + this.listeners[e].forEach((i) => { + t.removeEventListener(i.event, i.listener); + }); + } + } + const Lo = { + 42: 225, + 92: 233, + 94: 237, + 95: 243, + 96: 250, + 123: 231, + 124: 247, + 125: 209, + 126: 241, + 127: 9608, + 128: 174, + 129: 176, + 130: 189, + 131: 191, + 132: 8482, + 133: 162, + 134: 163, + 135: 9834, + 136: 224, + 137: 32, + 138: 232, + 139: 226, + 140: 234, + 141: 238, + 142: 244, + 143: 251, + 144: 193, + 145: 201, + 146: 211, + 147: 218, + 148: 220, + 149: 252, + 150: 8216, + 151: 161, + 152: 42, + 153: 8217, + 154: 9473, + 155: 169, + 156: 8480, + 157: 8226, + 158: 8220, + 159: 8221, + 160: 192, + 161: 194, + 162: 199, + 163: 200, + 164: 202, + 165: 203, + 166: 235, + 167: 206, + 168: 207, + 169: 239, + 170: 212, + 171: 217, + 172: 249, + 173: 219, + 174: 171, + 175: 187, + 176: 195, + 177: 227, + 178: 205, + 179: 204, + 180: 236, + 181: 210, + 182: 242, + 183: 213, + 184: 245, + 185: 123, + 186: 125, + 187: 92, + 188: 94, + 189: 95, + 190: 124, + 191: 8764, + 192: 196, + 193: 228, + 194: 214, + 195: 246, + 196: 223, + 197: 165, + 198: 164, + 199: 9475, + 200: 197, + 201: 229, + 202: 216, + 203: 248, + 204: 9487, + 205: 9491, + 206: 9495, + 207: 9499, + }, + Io = function (e) { + let t = e; + return Lo.hasOwnProperty(e) && (t = Lo[e]), String.fromCharCode(t); + }, + lt = 15, + kt = 100, + lf = { 17: 1, 18: 3, 21: 5, 22: 7, 23: 9, 16: 11, 19: 12, 20: 14 }, + uf = { 17: 2, 18: 4, 21: 6, 22: 8, 23: 10, 19: 13, 20: 15 }, + cf = { 25: 1, 26: 3, 29: 5, 30: 7, 31: 9, 24: 11, 27: 12, 28: 14 }, + hf = { 25: 2, 26: 4, 29: 6, 30: 8, 31: 10, 27: 13, 28: 15 }, + df = [ + "white", + "green", + "blue", + "cyan", + "red", + "yellow", + "magenta", + "black", + "transparent", + ]; + class ff { + constructor() { + (this.time = null), (this.verboseLevel = 0); + } + log(e, t) { + if (this.verboseLevel >= e) { + const i = typeof t == "function" ? t() : t; + D.log(`${this.time} [${e}] ${i}`); + } + } + } + const qt = function (e) { + const t = []; + for (let i = 0; i < e.length; i++) t.push(e[i].toString(16)); + return t; + }; + class Ro { + constructor(e, t, i, n, r) { + (this.foreground = void 0), + (this.underline = void 0), + (this.italics = void 0), + (this.background = void 0), + (this.flash = void 0), + (this.foreground = e || "white"), + (this.underline = t || !1), + (this.italics = i || !1), + (this.background = n || "black"), + (this.flash = r || !1); + } + reset() { + (this.foreground = "white"), + (this.underline = !1), + (this.italics = !1), + (this.background = "black"), + (this.flash = !1); + } + setStyles(e) { + const t = ["foreground", "underline", "italics", "background", "flash"]; + for (let i = 0; i < t.length; i++) { + const n = t[i]; + e.hasOwnProperty(n) && (this[n] = e[n]); + } + } + isDefault() { + return ( + this.foreground === "white" && + !this.underline && + !this.italics && + this.background === "black" && + !this.flash + ); + } + equals(e) { + return ( + this.foreground === e.foreground && + this.underline === e.underline && + this.italics === e.italics && + this.background === e.background && + this.flash === e.flash + ); + } + copy(e) { + (this.foreground = e.foreground), + (this.underline = e.underline), + (this.italics = e.italics), + (this.background = e.background), + (this.flash = e.flash); + } + toString() { + return ( + "color=" + + this.foreground + + ", underline=" + + this.underline + + ", italics=" + + this.italics + + ", background=" + + this.background + + ", flash=" + + this.flash + ); + } + } + class gf { + constructor(e, t, i, n, r, a) { + (this.uchar = void 0), + (this.penState = void 0), + (this.uchar = e || " "), + (this.penState = new Ro(t, i, n, r, a)); + } + reset() { + (this.uchar = " "), this.penState.reset(); + } + setChar(e, t) { + (this.uchar = e), this.penState.copy(t); + } + setPenState(e) { + this.penState.copy(e); + } + equals(e) { + return this.uchar === e.uchar && this.penState.equals(e.penState); + } + copy(e) { + (this.uchar = e.uchar), this.penState.copy(e.penState); + } + isEmpty() { + return this.uchar === " " && this.penState.isDefault(); + } + } + class pf { + constructor(e) { + (this.chars = void 0), + (this.pos = void 0), + (this.currPenState = void 0), + (this.cueStartTime = void 0), + (this.logger = void 0), + (this.chars = []); + for (let t = 0; t < kt; t++) this.chars.push(new gf()); + (this.logger = e), (this.pos = 0), (this.currPenState = new Ro()); + } + equals(e) { + let t = !0; + for (let i = 0; i < kt; i++) + if (!this.chars[i].equals(e.chars[i])) { + t = !1; + break; + } + return t; + } + copy(e) { + for (let t = 0; t < kt; t++) this.chars[t].copy(e.chars[t]); + } + isEmpty() { + let e = !0; + for (let t = 0; t < kt; t++) + if (!this.chars[t].isEmpty()) { + e = !1; + break; + } + return e; + } + setCursor(e) { + this.pos !== e && (this.pos = e), + this.pos < 0 + ? (this.logger.log(3, "Negative cursor position " + this.pos), + (this.pos = 0)) + : this.pos > kt && + (this.logger.log(3, "Too large cursor position " + this.pos), + (this.pos = kt)); + } + moveCursor(e) { + const t = this.pos + e; + if (e > 1) + for (let i = this.pos + 1; i < t + 1; i++) + this.chars[i].setPenState(this.currPenState); + this.setCursor(t); + } + backSpace() { + this.moveCursor(-1), this.chars[this.pos].setChar(" ", this.currPenState); + } + insertChar(e) { + e >= 144 && this.backSpace(); + const t = Io(e); + if (this.pos >= kt) { + this.logger.log( + 0, + () => + "Cannot insert " + + e.toString(16) + + " (" + + t + + ") at position " + + this.pos + + ". Skipping it!" + ); + return; + } + this.chars[this.pos].setChar(t, this.currPenState), this.moveCursor(1); + } + clearFromPos(e) { + let t; + for (t = e; t < kt; t++) this.chars[t].reset(); + } + clear() { + this.clearFromPos(0), (this.pos = 0), this.currPenState.reset(); + } + clearToEndOfRow() { + this.clearFromPos(this.pos); + } + getTextString() { + const e = []; + let t = !0; + for (let i = 0; i < kt; i++) { + const n = this.chars[i].uchar; + n !== " " && (t = !1), e.push(n); + } + return t ? "" : e.join(""); + } + setPenStyles(e) { + this.currPenState.setStyles(e), + this.chars[this.pos].setPenState(this.currPenState); + } + } + class Lr { + constructor(e) { + (this.rows = void 0), + (this.currRow = void 0), + (this.nrRollUpRows = void 0), + (this.lastOutputScreen = void 0), + (this.logger = void 0), + (this.rows = []); + for (let t = 0; t < lt; t++) this.rows.push(new pf(e)); + (this.logger = e), + (this.currRow = lt - 1), + (this.nrRollUpRows = null), + (this.lastOutputScreen = null), + this.reset(); + } + reset() { + for (let e = 0; e < lt; e++) this.rows[e].clear(); + this.currRow = lt - 1; + } + equals(e) { + let t = !0; + for (let i = 0; i < lt; i++) + if (!this.rows[i].equals(e.rows[i])) { + t = !1; + break; + } + return t; + } + copy(e) { + for (let t = 0; t < lt; t++) this.rows[t].copy(e.rows[t]); + } + isEmpty() { + let e = !0; + for (let t = 0; t < lt; t++) + if (!this.rows[t].isEmpty()) { + e = !1; + break; + } + return e; + } + backSpace() { + this.rows[this.currRow].backSpace(); + } + clearToEndOfRow() { + this.rows[this.currRow].clearToEndOfRow(); + } + insertChar(e) { + this.rows[this.currRow].insertChar(e); + } + setPen(e) { + this.rows[this.currRow].setPenStyles(e); + } + moveCursor(e) { + this.rows[this.currRow].moveCursor(e); + } + setCursor(e) { + this.logger.log(2, "setCursor: " + e), + this.rows[this.currRow].setCursor(e); + } + setPAC(e) { + this.logger.log(2, () => "pacData = " + JSON.stringify(e)); + let t = e.row - 1; + if ( + (this.nrRollUpRows && + t < this.nrRollUpRows - 1 && + (t = this.nrRollUpRows - 1), + this.nrRollUpRows && this.currRow !== t) + ) { + for (let o = 0; o < lt; o++) this.rows[o].clear(); + const r = this.currRow + 1 - this.nrRollUpRows, + a = this.lastOutputScreen; + if (a) { + const o = a.rows[r].cueStartTime, + l = this.logger.time; + if (o && l !== null && o < l) + for (let u = 0; u < this.nrRollUpRows; u++) + this.rows[t - this.nrRollUpRows + u + 1].copy(a.rows[r + u]); + } + } + this.currRow = t; + const i = this.rows[this.currRow]; + if (e.indent !== null) { + const r = e.indent, + a = Math.max(r - 1, 0); + i.setCursor(e.indent), (e.color = i.chars[a].penState.foreground); + } + const n = { + foreground: e.color, + underline: e.underline, + italics: e.italics, + background: "black", + flash: !1, + }; + this.setPen(n); + } + setBkgData(e) { + this.logger.log(2, () => "bkgData = " + JSON.stringify(e)), + this.backSpace(), + this.setPen(e), + this.insertChar(32); + } + setRollUpRows(e) { + this.nrRollUpRows = e; + } + rollUp() { + if (this.nrRollUpRows === null) { + this.logger.log(3, "roll_up but nrRollUpRows not set yet"); + return; + } + this.logger.log(1, () => this.getDisplayText()); + const e = this.currRow + 1 - this.nrRollUpRows, + t = this.rows.splice(e, 1)[0]; + t.clear(), + this.rows.splice(this.currRow, 0, t), + this.logger.log(2, "Rolling up"); + } + getDisplayText(e) { + e = e || !1; + const t = []; + let i = "", + n = -1; + for (let r = 0; r < lt; r++) { + const a = this.rows[r].getTextString(); + a && + ((n = r + 1), + e ? t.push("Row " + n + ": '" + a + "'") : t.push(a.trim())); + } + return ( + t.length > 0 && + (e + ? (i = "[" + t.join(" | ") + "]") + : (i = t.join(` +`))), + i + ); + } + getTextAndFormat() { + return this.rows; + } + } + class Po { + constructor(e, t, i) { + (this.chNr = void 0), + (this.outputFilter = void 0), + (this.mode = void 0), + (this.verbose = void 0), + (this.displayedMemory = void 0), + (this.nonDisplayedMemory = void 0), + (this.lastOutputScreen = void 0), + (this.currRollUpRow = void 0), + (this.writeScreen = void 0), + (this.cueStartTime = void 0), + (this.logger = void 0), + (this.chNr = e), + (this.outputFilter = t), + (this.mode = null), + (this.verbose = 0), + (this.displayedMemory = new Lr(i)), + (this.nonDisplayedMemory = new Lr(i)), + (this.lastOutputScreen = new Lr(i)), + (this.currRollUpRow = this.displayedMemory.rows[lt - 1]), + (this.writeScreen = this.displayedMemory), + (this.mode = null), + (this.cueStartTime = null), + (this.logger = i); + } + reset() { + (this.mode = null), + this.displayedMemory.reset(), + this.nonDisplayedMemory.reset(), + this.lastOutputScreen.reset(), + this.outputFilter.reset(), + (this.currRollUpRow = this.displayedMemory.rows[lt - 1]), + (this.writeScreen = this.displayedMemory), + (this.mode = null), + (this.cueStartTime = null); + } + getHandler() { + return this.outputFilter; + } + setHandler(e) { + this.outputFilter = e; + } + setPAC(e) { + this.writeScreen.setPAC(e); + } + setBkgData(e) { + this.writeScreen.setBkgData(e); + } + setMode(e) { + e !== this.mode && + ((this.mode = e), + this.logger.log(2, () => "MODE=" + e), + this.mode === "MODE_POP-ON" + ? (this.writeScreen = this.nonDisplayedMemory) + : ((this.writeScreen = this.displayedMemory), + this.writeScreen.reset()), + this.mode !== "MODE_ROLL-UP" && + ((this.displayedMemory.nrRollUpRows = null), + (this.nonDisplayedMemory.nrRollUpRows = null)), + (this.mode = e)); + } + insertChars(e) { + for (let i = 0; i < e.length; i++) this.writeScreen.insertChar(e[i]); + const t = this.writeScreen === this.displayedMemory ? "DISP" : "NON_DISP"; + this.logger.log(2, () => t + ": " + this.writeScreen.getDisplayText(!0)), + (this.mode === "MODE_PAINT-ON" || this.mode === "MODE_ROLL-UP") && + (this.logger.log( + 1, + () => "DISPLAYED: " + this.displayedMemory.getDisplayText(!0) + ), + this.outputDataUpdate()); + } + ccRCL() { + this.logger.log(2, "RCL - Resume Caption Loading"), + this.setMode("MODE_POP-ON"); + } + ccBS() { + this.logger.log(2, "BS - BackSpace"), + this.mode !== "MODE_TEXT" && + (this.writeScreen.backSpace(), + this.writeScreen === this.displayedMemory && this.outputDataUpdate()); + } + ccAOF() {} + ccAON() {} + ccDER() { + this.logger.log(2, "DER- Delete to End of Row"), + this.writeScreen.clearToEndOfRow(), + this.outputDataUpdate(); + } + ccRU(e) { + this.logger.log(2, "RU(" + e + ") - Roll Up"), + (this.writeScreen = this.displayedMemory), + this.setMode("MODE_ROLL-UP"), + this.writeScreen.setRollUpRows(e); + } + ccFON() { + this.logger.log(2, "FON - Flash On"), + this.writeScreen.setPen({ flash: !0 }); + } + ccRDC() { + this.logger.log(2, "RDC - Resume Direct Captioning"), + this.setMode("MODE_PAINT-ON"); + } + ccTR() { + this.logger.log(2, "TR"), this.setMode("MODE_TEXT"); + } + ccRTD() { + this.logger.log(2, "RTD"), this.setMode("MODE_TEXT"); + } + ccEDM() { + this.logger.log(2, "EDM - Erase Displayed Memory"), + this.displayedMemory.reset(), + this.outputDataUpdate(!0); + } + ccCR() { + this.logger.log(2, "CR - Carriage Return"), + this.writeScreen.rollUp(), + this.outputDataUpdate(!0); + } + ccENM() { + this.logger.log(2, "ENM - Erase Non-displayed Memory"), + this.nonDisplayedMemory.reset(); + } + ccEOC() { + if ( + (this.logger.log(2, "EOC - End Of Caption"), + this.mode === "MODE_POP-ON") + ) { + const e = this.displayedMemory; + (this.displayedMemory = this.nonDisplayedMemory), + (this.nonDisplayedMemory = e), + (this.writeScreen = this.nonDisplayedMemory), + this.logger.log( + 1, + () => "DISP: " + this.displayedMemory.getDisplayText() + ); + } + this.outputDataUpdate(!0); + } + ccTO(e) { + this.logger.log(2, "TO(" + e + ") - Tab Offset"), + this.writeScreen.moveCursor(e); + } + ccMIDROW(e) { + const t = { flash: !1 }; + if (((t.underline = e % 2 === 1), (t.italics = e >= 46), t.italics)) + t.foreground = "white"; + else { + const i = Math.floor(e / 2) - 16, + n = ["white", "green", "blue", "cyan", "red", "yellow", "magenta"]; + t.foreground = n[i]; + } + this.logger.log(2, "MIDROW: " + JSON.stringify(t)), + this.writeScreen.setPen(t); + } + outputDataUpdate(e = !1) { + const t = this.logger.time; + t !== null && + this.outputFilter && + (this.cueStartTime === null && !this.displayedMemory.isEmpty() + ? (this.cueStartTime = t) + : this.displayedMemory.equals(this.lastOutputScreen) || + (this.outputFilter.newCue( + this.cueStartTime, + t, + this.lastOutputScreen + ), + e && + this.outputFilter.dispatchCue && + this.outputFilter.dispatchCue(), + (this.cueStartTime = this.displayedMemory.isEmpty() ? null : t)), + this.lastOutputScreen.copy(this.displayedMemory)); + } + cueSplitAtTime(e) { + this.outputFilter && + (this.displayedMemory.isEmpty() || + (this.outputFilter.newCue && + this.outputFilter.newCue( + this.cueStartTime, + e, + this.displayedMemory + ), + (this.cueStartTime = e))); + } + } + class wo { + constructor(e, t, i) { + (this.channels = void 0), + (this.currentChannel = 0), + (this.cmdHistory = void 0), + (this.logger = void 0); + const n = new ff(); + (this.channels = [null, new Po(e, t, n), new Po(e + 1, i, n)]), + (this.cmdHistory = Oo()), + (this.logger = n); + } + getHandler(e) { + return this.channels[e].getHandler(); + } + setHandler(e, t) { + this.channels[e].setHandler(t); + } + addData(e, t) { + let i, + n, + r, + a = !1; + this.logger.time = e; + for (let o = 0; o < t.length; o += 2) + if (((n = t[o] & 127), (r = t[o + 1] & 127), !(n === 0 && r === 0))) { + if ( + (this.logger.log( + 3, + "[" + qt([t[o], t[o + 1]]) + "] -> (" + qt([n, r]) + ")" + ), + (i = this.parseCmd(n, r)), + i || (i = this.parseMidrow(n, r)), + i || (i = this.parsePAC(n, r)), + i || (i = this.parseBackgroundAttributes(n, r)), + !i && ((a = this.parseChars(n, r)), a)) + ) { + const l = this.currentChannel; + l && l > 0 + ? this.channels[l].insertChars(a) + : this.logger.log(2, "No channel found yet. TEXT-MODE?"); + } + !i && + !a && + this.logger.log( + 2, + "Couldn't parse cleaned data " + + qt([n, r]) + + " orig: " + + qt([t[o], t[o + 1]]) + ); + } + } + parseCmd(e, t) { + const { cmdHistory: i } = this, + n = + (e === 20 || e === 28 || e === 21 || e === 29) && t >= 32 && t <= 47, + r = (e === 23 || e === 31) && t >= 33 && t <= 35; + if (!(n || r)) return !1; + if (Do(e, t, i)) + return ( + pi(null, null, i), + this.logger.log( + 3, + "Repeated command (" + qt([e, t]) + ") is dropped" + ), + !0 + ); + const a = e === 20 || e === 21 || e === 23 ? 1 : 2, + o = this.channels[a]; + return ( + e === 20 || e === 21 || e === 28 || e === 29 + ? t === 32 + ? o.ccRCL() + : t === 33 + ? o.ccBS() + : t === 34 + ? o.ccAOF() + : t === 35 + ? o.ccAON() + : t === 36 + ? o.ccDER() + : t === 37 + ? o.ccRU(2) + : t === 38 + ? o.ccRU(3) + : t === 39 + ? o.ccRU(4) + : t === 40 + ? o.ccFON() + : t === 41 + ? o.ccRDC() + : t === 42 + ? o.ccTR() + : t === 43 + ? o.ccRTD() + : t === 44 + ? o.ccEDM() + : t === 45 + ? o.ccCR() + : t === 46 + ? o.ccENM() + : t === 47 && o.ccEOC() + : o.ccTO(t - 32), + pi(e, t, i), + (this.currentChannel = a), + !0 + ); + } + parseMidrow(e, t) { + let i = 0; + if ((e === 17 || e === 25) && t >= 32 && t <= 47) { + if ((e === 17 ? (i = 1) : (i = 2), i !== this.currentChannel)) + return this.logger.log(0, "Mismatch channel in midrow parsing"), !1; + const n = this.channels[i]; + return n + ? (n.ccMIDROW(t), + this.logger.log(3, "MIDROW (" + qt([e, t]) + ")"), + !0) + : !1; + } + return !1; + } + parsePAC(e, t) { + let i; + const n = this.cmdHistory, + r = + ((e >= 17 && e <= 23) || (e >= 25 && e <= 31)) && t >= 64 && t <= 127, + a = (e === 16 || e === 24) && t >= 64 && t <= 95; + if (!(r || a)) return !1; + if (Do(e, t, n)) return pi(null, null, n), !0; + const o = e <= 23 ? 1 : 2; + t >= 64 && t <= 95 + ? (i = o === 1 ? lf[e] : cf[e]) + : (i = o === 1 ? uf[e] : hf[e]); + const l = this.channels[o]; + return l + ? (l.setPAC(this.interpretPAC(i, t)), + pi(e, t, n), + (this.currentChannel = o), + !0) + : !1; + } + interpretPAC(e, t) { + let i; + const n = { + color: null, + italics: !1, + indent: null, + underline: !1, + row: e, + }; + return ( + t > 95 ? (i = t - 96) : (i = t - 64), + (n.underline = (i & 1) === 1), + i <= 13 + ? (n.color = [ + "white", + "green", + "blue", + "cyan", + "red", + "yellow", + "magenta", + "white", + ][Math.floor(i / 2)]) + : i <= 15 + ? ((n.italics = !0), (n.color = "white")) + : (n.indent = Math.floor((i - 16) / 2) * 4), + n + ); + } + parseChars(e, t) { + let i, + n = null, + r = null; + if ( + (e >= 25 ? ((i = 2), (r = e - 8)) : ((i = 1), (r = e)), + r >= 17 && r <= 19) + ) { + let a; + r === 17 ? (a = t + 80) : r === 18 ? (a = t + 112) : (a = t + 144), + this.logger.log(2, "Special char '" + Io(a) + "' in channel " + i), + (n = [a]); + } else e >= 32 && e <= 127 && (n = t === 0 ? [e] : [e, t]); + if (n) { + const a = qt(n); + this.logger.log(3, "Char codes = " + a.join(",")), + pi(e, t, this.cmdHistory); + } + return n; + } + parseBackgroundAttributes(e, t) { + const i = (e === 16 || e === 24) && t >= 32 && t <= 47, + n = (e === 23 || e === 31) && t >= 45 && t <= 47; + if (!(i || n)) return !1; + let r; + const a = {}; + e === 16 || e === 24 + ? ((r = Math.floor((t - 32) / 2)), + (a.background = df[r]), + t % 2 === 1 && (a.background = a.background + "_semi")) + : t === 45 + ? (a.background = "transparent") + : ((a.foreground = "black"), t === 47 && (a.underline = !0)); + const o = e <= 23 ? 1 : 2; + return this.channels[o].setBkgData(a), pi(e, t, this.cmdHistory), !0; + } + reset() { + for (let e = 0; e < Object.keys(this.channels).length; e++) { + const t = this.channels[e]; + t && t.reset(); + } + this.cmdHistory = Oo(); + } + cueSplitAtTime(e) { + for (let t = 0; t < this.channels.length; t++) { + const i = this.channels[t]; + i && i.cueSplitAtTime(e); + } + } + } + function pi(s, e, t) { + (t.a = s), (t.b = e); + } + function Do(s, e, t) { + return t.a === s && t.b === e; + } + function Oo() { + return { a: null, b: null }; + } + class fn { + constructor(e, t) { + (this.timelineController = void 0), + (this.cueRanges = []), + (this.trackName = void 0), + (this.startTime = null), + (this.endTime = null), + (this.screen = null), + (this.timelineController = e), + (this.trackName = t); + } + dispatchCue() { + this.startTime !== null && + (this.timelineController.addCues( + this.trackName, + this.startTime, + this.endTime, + this.screen, + this.cueRanges + ), + (this.startTime = null)); + } + newCue(e, t, i) { + (this.startTime === null || this.startTime > e) && (this.startTime = e), + (this.endTime = t), + (this.screen = i), + this.timelineController.createCaptionsTrack(this.trackName); + } + reset() { + (this.cueRanges = []), (this.startTime = null); + } + } + var Ir = (function () { + if (typeof self < "u" && self.VTTCue) return self.VTTCue; + const s = ["", "lr", "rl"], + e = ["start", "middle", "end", "left", "right"]; + function t(o, l) { + if (typeof l != "string" || !Array.isArray(o)) return !1; + const u = l.toLowerCase(); + return ~o.indexOf(u) ? u : !1; + } + function i(o) { + return t(s, o); + } + function n(o) { + return t(e, o); + } + function r(o, ...l) { + let u = 1; + for (; u < arguments.length; u++) { + const c = arguments[u]; + for (const d in c) o[d] = c[d]; + } + return o; + } + function a(o, l, u) { + const c = this, + d = { enumerable: !0 }; + c.hasBeenReset = !1; + let f = "", + g = !1, + p = o, + v = l, + T = u, + x = null, + I = "", + L = !0, + M = "auto", + O = "start", + j = 50, + U = "middle", + Y = 50, + _ = "middle"; + Object.defineProperty( + c, + "id", + r({}, d, { + get: function () { + return f; + }, + set: function (E) { + f = "" + E; + }, + }) + ), + Object.defineProperty( + c, + "pauseOnExit", + r({}, d, { + get: function () { + return g; + }, + set: function (E) { + g = !!E; + }, + }) + ), + Object.defineProperty( + c, + "startTime", + r({}, d, { + get: function () { + return p; + }, + set: function (E) { + if (typeof E != "number") + throw new TypeError("Start time must be set to a number."); + (p = E), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "endTime", + r({}, d, { + get: function () { + return v; + }, + set: function (E) { + if (typeof E != "number") + throw new TypeError("End time must be set to a number."); + (v = E), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "text", + r({}, d, { + get: function () { + return T; + }, + set: function (E) { + (T = "" + E), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "region", + r({}, d, { + get: function () { + return x; + }, + set: function (E) { + (x = E), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "vertical", + r({}, d, { + get: function () { + return I; + }, + set: function (E) { + const w = i(E); + if (w === !1) + throw new SyntaxError( + "An invalid or illegal string was specified." + ); + (I = w), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "snapToLines", + r({}, d, { + get: function () { + return L; + }, + set: function (E) { + (L = !!E), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "line", + r({}, d, { + get: function () { + return M; + }, + set: function (E) { + if (typeof E != "number" && E !== "auto") + throw new SyntaxError( + "An invalid number or illegal string was specified." + ); + (M = E), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "lineAlign", + r({}, d, { + get: function () { + return O; + }, + set: function (E) { + const w = n(E); + if (!w) + throw new SyntaxError( + "An invalid or illegal string was specified." + ); + (O = w), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "position", + r({}, d, { + get: function () { + return j; + }, + set: function (E) { + if (E < 0 || E > 100) + throw new Error("Position must be between 0 and 100."); + (j = E), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "positionAlign", + r({}, d, { + get: function () { + return U; + }, + set: function (E) { + const w = n(E); + if (!w) + throw new SyntaxError( + "An invalid or illegal string was specified." + ); + (U = w), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "size", + r({}, d, { + get: function () { + return Y; + }, + set: function (E) { + if (E < 0 || E > 100) + throw new Error("Size must be between 0 and 100."); + (Y = E), (this.hasBeenReset = !0); + }, + }) + ), + Object.defineProperty( + c, + "align", + r({}, d, { + get: function () { + return _; + }, + set: function (E) { + const w = n(E); + if (!w) + throw new SyntaxError( + "An invalid or illegal string was specified." + ); + (_ = w), (this.hasBeenReset = !0); + }, + }) + ), + (c.displayState = void 0); + } + return ( + (a.prototype.getCueAsHTML = function () { + return self.WebVTT.convertCueToDOMTree(self, this.text); + }), + a + ); + })(); + class mf { + decode(e, t) { + if (!e) return ""; + if (typeof e != "string") + throw new Error("Error - expected string data."); + return decodeURIComponent(encodeURIComponent(e)); + } + } + function No(s) { + function e(i, n, r, a) { + return (i | 0) * 3600 + (n | 0) * 60 + (r | 0) + parseFloat(a || 0); + } + const t = s.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/); + return t + ? parseFloat(t[2]) > 59 + ? e(t[2], t[3], 0, t[4]) + : e(t[1], t[2], t[3], t[4]) + : null; + } + class Af { + constructor() { + this.values = Object.create(null); + } + set(e, t) { + !this.get(e) && t !== "" && (this.values[e] = t); + } + get(e, t, i) { + return i + ? this.has(e) + ? this.values[e] + : t[i] + : this.has(e) + ? this.values[e] + : t; + } + has(e) { + return e in this.values; + } + alt(e, t, i) { + for (let n = 0; n < i.length; ++n) + if (t === i[n]) { + this.set(e, t); + break; + } + } + integer(e, t) { + /^-?\d+$/.test(t) && this.set(e, parseInt(t, 10)); + } + percent(e, t) { + if (/^([\d]{1,3})(\.[\d]*)?%$/.test(t)) { + const i = parseFloat(t); + if (i >= 0 && i <= 100) return this.set(e, i), !0; + } + return !1; + } + } + function Fo(s, e, t, i) { + const n = i ? s.split(i) : [s]; + for (const r in n) { + if (typeof n[r] != "string") continue; + const a = n[r].split(t); + if (a.length !== 2) continue; + const o = a[0], + l = a[1]; + e(o, l); + } + } + const Rr = new Ir(0, 0, ""), + gn = Rr.align === "middle" ? "middle" : "center"; + function yf(s, e, t) { + const i = s; + function n() { + const o = No(s); + if (o === null) throw new Error("Malformed timestamp: " + i); + return (s = s.replace(/^[^\sa-zA-Z-]+/, "")), o; + } + function r(o, l) { + const u = new Af(); + Fo( + o, + function (f, g) { + let p; + switch (f) { + case "region": + for (let v = t.length - 1; v >= 0; v--) + if (t[v].id === g) { + u.set(f, t[v].region); + break; + } + break; + case "vertical": + u.alt(f, g, ["rl", "lr"]); + break; + case "line": + (p = g.split(",")), + u.integer(f, p[0]), + u.percent(f, p[0]) && u.set("snapToLines", !1), + u.alt(f, p[0], ["auto"]), + p.length === 2 && + u.alt("lineAlign", p[1], ["start", gn, "end"]); + break; + case "position": + (p = g.split(",")), + u.percent(f, p[0]), + p.length === 2 && + u.alt("positionAlign", p[1], [ + "start", + gn, + "end", + "line-left", + "line-right", + "auto", + ]); + break; + case "size": + u.percent(f, g); + break; + case "align": + u.alt(f, g, ["start", gn, "end", "left", "right"]); + break; + } + }, + /:/, + /\s/ + ), + (l.region = u.get("region", null)), + (l.vertical = u.get("vertical", "")); + let c = u.get("line", "auto"); + c === "auto" && Rr.line === -1 && (c = -1), + (l.line = c), + (l.lineAlign = u.get("lineAlign", "start")), + (l.snapToLines = u.get("snapToLines", !0)), + (l.size = u.get("size", 100)), + (l.align = u.get("align", gn)); + let d = u.get("position", "auto"); + d === "auto" && + Rr.position === 50 && + (d = + l.align === "start" || l.align === "left" + ? 0 + : l.align === "end" || l.align === "right" + ? 100 + : 50), + (l.position = d); + } + function a() { + s = s.replace(/^\s+/, ""); + } + if ((a(), (e.startTime = n()), a(), s.slice(0, 3) !== "-->")) + throw new Error( + "Malformed time stamp (time stamps must be separated by '-->'): " + i + ); + (s = s.slice(3)), a(), (e.endTime = n()), a(), r(s, e); + } + function Mo(s) { + return s.replace( + /<br(?: \/)?>/gi, + ` +` + ); + } + class vf { + constructor() { + (this.state = "INITIAL"), + (this.buffer = ""), + (this.decoder = new mf()), + (this.regionList = []), + (this.cue = null), + (this.oncue = void 0), + (this.onparsingerror = void 0), + (this.onflush = void 0); + } + parse(e) { + const t = this; + e && (t.buffer += t.decoder.decode(e, { stream: !0 })); + function i() { + let r = t.buffer, + a = 0; + for ( + r = Mo(r); + a < r.length && + r[a] !== "\r" && + r[a] !== + ` +`; + + ) + ++a; + const o = r.slice(0, a); + return ( + r[a] === "\r" && ++a, + r[a] === + ` +` && ++a, + (t.buffer = r.slice(a)), + o + ); + } + function n(r) { + Fo(r, function (a, o) {}, /:/); + } + try { + let r = ""; + if (t.state === "INITIAL") { + if (!/\r\n|\n/.test(t.buffer)) return this; + r = i(); + const o = r.match(/^()?WEBVTT([ \t].*)?$/); + if (!(o != null && o[0])) + throw new Error("Malformed WebVTT signature."); + t.state = "HEADER"; + } + let a = !1; + for (; t.buffer; ) { + if (!/\r\n|\n/.test(t.buffer)) return this; + switch ((a ? (a = !1) : (r = i()), t.state)) { + case "HEADER": + /:/.test(r) ? n(r) : r || (t.state = "ID"); + continue; + case "NOTE": + r || (t.state = "ID"); + continue; + case "ID": + if (/^NOTE($|[ \t])/.test(r)) { + t.state = "NOTE"; + break; + } + if (!r) continue; + if ( + ((t.cue = new Ir(0, 0, "")), + (t.state = "CUE"), + r.indexOf("-->") === -1) + ) { + t.cue.id = r; + continue; + } + case "CUE": + if (!t.cue) { + t.state = "BADCUE"; + continue; + } + try { + yf(r, t.cue, t.regionList); + } catch { + (t.cue = null), (t.state = "BADCUE"); + continue; + } + t.state = "CUETEXT"; + continue; + case "CUETEXT": + { + const o = r.indexOf("-->") !== -1; + if (!r || (o && (a = !0))) { + t.oncue && t.cue && t.oncue(t.cue), + (t.cue = null), + (t.state = "ID"); + continue; + } + if (t.cue === null) continue; + t.cue.text && + (t.cue.text += ` +`), + (t.cue.text += r); + } + continue; + case "BADCUE": + r || (t.state = "ID"); + } + } + } catch { + t.state === "CUETEXT" && t.cue && t.oncue && t.oncue(t.cue), + (t.cue = null), + (t.state = t.state === "INITIAL" ? "BADWEBVTT" : "BADCUE"); + } + return this; + } + flush() { + const e = this; + try { + if ( + ((e.cue || e.state === "HEADER") && + ((e.buffer += ` + +`), + e.parse()), + e.state === "INITIAL" || e.state === "BADWEBVTT") + ) + throw new Error("Malformed WebVTT signature."); + } catch (t) { + e.onparsingerror && e.onparsingerror(t); + } + return e.onflush && e.onflush(), this; + } + } + const Ef = /\r\n|\n\r|\n|\r/g, + Pr = function (e, t, i = 0) { + return e.slice(i, i + t.length) === t; + }, + Tf = function (e) { + let t = parseInt(e.slice(-3)); + const i = parseInt(e.slice(-6, -4)), + n = parseInt(e.slice(-9, -7)), + r = e.length > 9 ? parseInt(e.substring(0, e.indexOf(":"))) : 0; + if (!ne(t) || !ne(i) || !ne(n) || !ne(r)) + throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`); + return (t += 1e3 * i), (t += 60 * 1e3 * n), (t += 60 * 60 * 1e3 * r), t; + }, + wr = function (e) { + let t = 5381, + i = e.length; + for (; i; ) t = (t * 33) ^ e.charCodeAt(--i); + return (t >>> 0).toString(); + }; + function Dr(s, e, t) { + return wr(s.toString()) + wr(e.toString()) + wr(t); + } + const bf = function (e, t, i) { + let n = e[t], + r = e[n.prevCC]; + if (!r || (!r.new && n.new)) { + (e.ccOffset = e.presentationOffset = n.start), (n.new = !1); + return; + } + for (; (a = r) != null && a.new; ) { + var a; + (e.ccOffset += n.start - r.start), + (n.new = !1), + (n = r), + (r = e[n.prevCC]); + } + e.presentationOffset = i; + }; + function _f(s, e, t, i, n, r, a) { + const o = new vf(), + l = ft(new Uint8Array(s)) + .trim() + .replace( + Ef, + ` +` + ).split(` +`), + u = [], + c = e ? Dd(e.baseTime, e.timescale) : 0; + let d = "00:00.000", + f = 0, + g = 0, + p, + v = !0; + (o.oncue = function (T) { + const x = t[i]; + let I = t.ccOffset; + const L = (f - c) / 9e4; + if ( + (x != null && + x.new && + (g !== void 0 ? (I = t.ccOffset = x.start) : bf(t, i, L)), + L) + ) { + if (!e) { + p = new Error("Missing initPTS for VTT MPEGTS"); + return; + } + I = L - t.presentationOffset; + } + const M = T.endTime - T.startTime, + O = nt((T.startTime + I - g) * 9e4, n * 9e4) / 9e4; + (T.startTime = Math.max(O, 0)), (T.endTime = Math.max(O + M, 0)); + const j = T.text.trim(); + (T.text = decodeURIComponent(encodeURIComponent(j))), + T.id || (T.id = Dr(T.startTime, T.endTime, j)), + T.endTime > 0 && u.push(T); + }), + (o.onparsingerror = function (T) { + p = T; + }), + (o.onflush = function () { + if (p) { + a(p); + return; + } + r(u); + }), + l.forEach((T) => { + if (v) + if (Pr(T, "X-TIMESTAMP-MAP=")) { + (v = !1), + T.slice(16) + .split(",") + .forEach((x) => { + Pr(x, "LOCAL:") + ? (d = x.slice(6)) + : Pr(x, "MPEGTS:") && (f = parseInt(x.slice(7))); + }); + try { + g = Tf(d) / 1e3; + } catch (x) { + p = x; + } + return; + } else T === "" && (v = !1); + o.parse( + T + + ` +` + ); + }), + o.flush(); + } + const Or = "stpp.ttml.im1t", + Bo = /^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/, + Uo = /^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/, + kf = { + left: "start", + center: "center", + right: "end", + start: "start", + end: "end", + }; + function $o(s, e, t, i) { + const n = ce(new Uint8Array(s), ["mdat"]); + if (n.length === 0) { + i(new Error("Could not parse IMSC1 mdat")); + return; + } + const r = n.map((o) => ft(o)), + a = wd(e.baseTime, 1, e.timescale); + try { + r.forEach((o) => t(Sf(o, a))); + } catch (o) { + i(o); + } + } + function Sf(s, e) { + const n = new DOMParser() + .parseFromString(s, "text/xml") + .getElementsByTagName("tt")[0]; + if (!n) throw new Error("Invalid ttml"); + const r = { + frameRate: 30, + subFrameRate: 1, + frameRateMultiplier: 0, + tickRate: 0, + }, + a = Object.keys(r).reduce( + (d, f) => ((d[f] = n.getAttribute(`ttp:${f}`) || r[f]), d), + {} + ), + o = n.getAttribute("xml:space") !== "preserve", + l = Vo(Nr(n, "styling", "style")), + u = Vo(Nr(n, "layout", "region")), + c = Nr(n, "body", "[begin]"); + return [].map + .call(c, (d) => { + const f = Go(d, o); + if (!f || !d.hasAttribute("begin")) return null; + const g = Mr(d.getAttribute("begin"), a), + p = Mr(d.getAttribute("dur"), a); + let v = Mr(d.getAttribute("end"), a); + if (g === null) throw Ko(d); + if (v === null) { + if (p === null) throw Ko(d); + v = g + p; + } + const T = new Ir(g - e, v - e, f); + T.id = Dr(T.startTime, T.endTime, T.text); + const x = u[d.getAttribute("region")], + I = l[d.getAttribute("style")], + L = Cf(x, I, l), + { textAlign: M } = L; + if (M) { + const O = kf[M]; + O && (T.lineAlign = O), (T.align = M); + } + return Fe(T, L), T; + }) + .filter((d) => d !== null); + } + function Nr(s, e, t) { + const i = s.getElementsByTagName(e)[0]; + return i ? [].slice.call(i.querySelectorAll(t)) : []; + } + function Vo(s) { + return s.reduce((e, t) => { + const i = t.getAttribute("xml:id"); + return i && (e[i] = t), e; + }, {}); + } + function Go(s, e) { + return [].slice.call(s.childNodes).reduce((t, i, n) => { + var r; + return i.nodeName === "br" && n + ? t + + ` +` + : (r = i.childNodes) != null && r.length + ? Go(i, e) + : e + ? t + i.textContent.trim().replace(/\s+/g, " ") + : t + i.textContent; + }, ""); + } + function Cf(s, e, t) { + const i = "http://www.w3.org/ns/ttml#styling"; + let n = null; + const r = [ + "displayAlign", + "textAlign", + "color", + "backgroundColor", + "fontSize", + "fontFamily", + ], + a = s != null && s.hasAttribute("style") ? s.getAttribute("style") : null; + return ( + a && t.hasOwnProperty(a) && (n = t[a]), + r.reduce((o, l) => { + const u = Fr(e, i, l) || Fr(s, i, l) || Fr(n, i, l); + return u && (o[l] = u), o; + }, {}) + ); + } + function Fr(s, e, t) { + return s && s.hasAttributeNS(e, t) ? s.getAttributeNS(e, t) : null; + } + function Ko(s) { + return new Error(`Could not parse ttml timestamp ${s}`); + } + function Mr(s, e) { + if (!s) return null; + let t = No(s); + return ( + t === null && + (Bo.test(s) ? (t = xf(s, e)) : Uo.test(s) && (t = Lf(s, e))), + t + ); + } + function xf(s, e) { + const t = Bo.exec(s), + i = (t[4] | 0) + (t[5] | 0) / e.subFrameRate; + return (t[1] | 0) * 3600 + (t[2] | 0) * 60 + (t[3] | 0) + i / e.frameRate; + } + function Lf(s, e) { + const t = Uo.exec(s), + i = Number(t[1]); + switch (t[2]) { + case "h": + return i * 3600; + case "m": + return i * 60; + case "ms": + return i * 1e3; + case "f": + return i / e.frameRate; + case "t": + return i / e.tickRate; + } + return i; + } + class If { + constructor(e) { + if ( + ((this.hls = void 0), + (this.media = null), + (this.config = void 0), + (this.enabled = !0), + (this.Cues = void 0), + (this.textTracks = []), + (this.tracks = []), + (this.initPTS = []), + (this.unparsedVttFrags = []), + (this.captionsTracks = {}), + (this.nonNativeCaptionsTracks = {}), + (this.cea608Parser1 = void 0), + (this.cea608Parser2 = void 0), + (this.lastSn = -1), + (this.lastPartIndex = -1), + (this.prevCC = -1), + (this.vttCCs = Ho()), + (this.captionsProperties = void 0), + (this.hls = e), + (this.config = e.config), + (this.Cues = e.config.cueHandler), + (this.captionsProperties = { + textTrack1: { + label: this.config.captionsTextTrack1Label, + languageCode: this.config.captionsTextTrack1LanguageCode, + }, + textTrack2: { + label: this.config.captionsTextTrack2Label, + languageCode: this.config.captionsTextTrack2LanguageCode, + }, + textTrack3: { + label: this.config.captionsTextTrack3Label, + languageCode: this.config.captionsTextTrack3LanguageCode, + }, + textTrack4: { + label: this.config.captionsTextTrack4Label, + languageCode: this.config.captionsTextTrack4LanguageCode, + }, + }), + this.config.enableCEA708Captions) + ) { + const t = new fn(this, "textTrack1"), + i = new fn(this, "textTrack2"), + n = new fn(this, "textTrack3"), + r = new fn(this, "textTrack4"); + (this.cea608Parser1 = new wo(1, t, i)), + (this.cea608Parser2 = new wo(3, n, r)); + } + e.on(y.MEDIA_ATTACHING, this.onMediaAttaching, this), + e.on(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.MANIFEST_LOADED, this.onManifestLoaded, this), + e.on(y.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), + e.on(y.FRAG_LOADING, this.onFragLoading, this), + e.on(y.FRAG_LOADED, this.onFragLoaded, this), + e.on(y.FRAG_PARSING_USERDATA, this.onFragParsingUserdata, this), + e.on(y.FRAG_DECRYPTED, this.onFragDecrypted, this), + e.on(y.INIT_PTS_FOUND, this.onInitPtsFound, this), + e.on(y.SUBTITLE_TRACKS_CLEARED, this.onSubtitleTracksCleared, this), + e.on(y.BUFFER_FLUSHING, this.onBufferFlushing, this); + } + destroy() { + const { hls: e } = this; + e.off(y.MEDIA_ATTACHING, this.onMediaAttaching, this), + e.off(y.MEDIA_DETACHING, this.onMediaDetaching, this), + e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.MANIFEST_LOADED, this.onManifestLoaded, this), + e.off(y.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), + e.off(y.FRAG_LOADING, this.onFragLoading, this), + e.off(y.FRAG_LOADED, this.onFragLoaded, this), + e.off(y.FRAG_PARSING_USERDATA, this.onFragParsingUserdata, this), + e.off(y.FRAG_DECRYPTED, this.onFragDecrypted, this), + e.off(y.INIT_PTS_FOUND, this.onInitPtsFound, this), + e.off(y.SUBTITLE_TRACKS_CLEARED, this.onSubtitleTracksCleared, this), + e.off(y.BUFFER_FLUSHING, this.onBufferFlushing, this), + (this.hls = + this.config = + this.cea608Parser1 = + this.cea608Parser2 = + null); + } + addCues(e, t, i, n, r) { + let a = !1; + for (let o = r.length; o--; ) { + const l = r[o], + u = Pf(l[0], l[1], t, i); + if ( + u >= 0 && + ((l[0] = Math.min(l[0], t)), + (l[1] = Math.max(l[1], i)), + (a = !0), + u / (i - t) > 0.5) + ) + return; + } + if ((a || r.push([t, i]), this.config.renderTextTracksNatively)) { + const o = this.captionsTracks[e]; + this.Cues.newCue(o, t, i, n); + } else { + const o = this.Cues.newCue(null, t, i, n); + this.hls.trigger(y.CUES_PARSED, { + type: "captions", + cues: o, + track: e, + }); + } + } + onInitPtsFound(e, { frag: t, id: i, initPTS: n, timescale: r }) { + const { unparsedVttFrags: a } = this; + i === "main" && (this.initPTS[t.cc] = { baseTime: n, timescale: r }), + a.length && + ((this.unparsedVttFrags = []), + a.forEach((o) => { + this.onFragLoaded(y.FRAG_LOADED, o); + })); + } + getExistingTrack(e) { + const { media: t } = this; + if (t) + for (let i = 0; i < t.textTracks.length; i++) { + const n = t.textTracks[i]; + if (n[e]) return n; + } + return null; + } + createCaptionsTrack(e) { + this.config.renderTextTracksNatively + ? this.createNativeTrack(e) + : this.createNonNativeTrack(e); + } + createNativeTrack(e) { + if (this.captionsTracks[e]) return; + const { captionsProperties: t, captionsTracks: i, media: n } = this, + { label: r, languageCode: a } = t[e], + o = this.getExistingTrack(e); + if (o) (i[e] = o), hi(i[e]), Ma(i[e], n); + else { + const l = this.createTextTrack("captions", r, a); + l && ((l[e] = !0), (i[e] = l)); + } + } + createNonNativeTrack(e) { + if (this.nonNativeCaptionsTracks[e]) return; + const t = this.captionsProperties[e]; + if (!t) return; + const i = t.label, + n = { + _id: e, + label: i, + kind: "captions", + default: t.media ? !!t.media.default : !1, + closedCaptions: t.media, + }; + (this.nonNativeCaptionsTracks[e] = n), + this.hls.trigger(y.NON_NATIVE_TEXT_TRACKS_FOUND, { tracks: [n] }); + } + createTextTrack(e, t, i) { + const n = this.media; + if (n) return n.addTextTrack(e, t, i); + } + onMediaAttaching(e, t) { + (this.media = t.media), this._cleanTracks(); + } + onMediaDetaching() { + const { captionsTracks: e } = this; + Object.keys(e).forEach((t) => { + hi(e[t]), delete e[t]; + }), + (this.nonNativeCaptionsTracks = {}); + } + onManifestLoading() { + (this.lastSn = -1), + (this.lastPartIndex = -1), + (this.prevCC = -1), + (this.vttCCs = Ho()), + this._cleanTracks(), + (this.tracks = []), + (this.captionsTracks = {}), + (this.nonNativeCaptionsTracks = {}), + (this.textTracks = []), + (this.unparsedVttFrags = []), + (this.initPTS = []), + this.cea608Parser1 && + this.cea608Parser2 && + (this.cea608Parser1.reset(), this.cea608Parser2.reset()); + } + _cleanTracks() { + const { media: e } = this; + if (!e) return; + const t = e.textTracks; + if (t) for (let i = 0; i < t.length; i++) hi(t[i]); + } + onSubtitleTracksUpdated(e, t) { + const i = t.subtitleTracks || [], + n = i.some((r) => r.textCodec === Or); + if (this.config.enableWebVTT || (n && this.config.enableIMSC1)) { + if (ko(this.tracks, i)) { + this.tracks = i; + return; + } + if ( + ((this.textTracks = []), + (this.tracks = i), + this.config.renderTextTracksNatively) + ) { + const a = this.media ? this.media.textTracks : null; + this.tracks.forEach((o, l) => { + let u; + if (a && l < a.length) { + let c = null; + for (let d = 0; d < a.length; d++) + if (Rf(a[d], o)) { + c = a[d]; + break; + } + c && (u = c); + } + if (u) hi(u); + else { + const c = this._captionsOrSubtitlesFromCharacteristics(o); + (u = this.createTextTrack(c, o.name, o.lang)), + u && (u.mode = "disabled"); + } + u && ((u.groupId = o.groupId), this.textTracks.push(u)); + }); + } else if (this.tracks.length) { + const a = this.tracks.map((o) => ({ + label: o.name, + kind: o.type.toLowerCase(), + default: o.default, + subtitleTrack: o, + })); + this.hls.trigger(y.NON_NATIVE_TEXT_TRACKS_FOUND, { tracks: a }); + } + } + } + _captionsOrSubtitlesFromCharacteristics(e) { + if (e.attrs.CHARACTERISTICS) { + const t = /transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS), + i = /describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS); + if (t && i) return "captions"; + } + return "subtitles"; + } + onManifestLoaded(e, t) { + this.config.enableCEA708Captions && + t.captions && + t.captions.forEach((i) => { + const n = /(?:CC|SERVICE)([1-4])/.exec(i.instreamId); + if (!n) return; + const r = `textTrack${n[1]}`, + a = this.captionsProperties[r]; + a && + ((a.label = i.name), + i.lang && (a.languageCode = i.lang), + (a.media = i)); + }); + } + closedCaptionsForLevel(e) { + const t = this.hls.levels[e.level]; + return t == null ? void 0 : t.attrs["CLOSED-CAPTIONS"]; + } + onFragLoading(e, t) { + const { + cea608Parser1: i, + cea608Parser2: n, + lastSn: r, + lastPartIndex: a, + } = this; + if (!(!this.enabled || !(i && n)) && t.frag.type === se.MAIN) { + var o, l; + const u = t.frag.sn, + c = + (o = t == null || (l = t.part) == null ? void 0 : l.index) != null + ? o + : -1; + u === r + 1 || (u === r && c === a + 1) || (i.reset(), n.reset()), + (this.lastSn = u), + (this.lastPartIndex = c); + } + } + onFragLoaded(e, t) { + const { frag: i, payload: n } = t; + if (i.type === se.SUBTITLE) + if (n.byteLength) { + const r = i.decryptdata, + a = "stats" in t; + if (r == null || !r.encrypted || a) { + const o = this.tracks[i.level], + l = this.vttCCs; + l[i.cc] || + ((l[i.cc] = { start: i.start, prevCC: this.prevCC, new: !0 }), + (this.prevCC = i.cc)), + o && o.textCodec === Or + ? this._parseIMSC1(i, n) + : this._parseVTTs(t); + } + } else + this.hls.trigger(y.SUBTITLE_FRAG_PROCESSED, { + success: !1, + frag: i, + error: new Error("Empty subtitle payload"), + }); + } + _parseIMSC1(e, t) { + const i = this.hls; + $o( + t, + this.initPTS[e.cc], + (n) => { + this._appendCues(n, e.level), + i.trigger(y.SUBTITLE_FRAG_PROCESSED, { success: !0, frag: e }); + }, + (n) => { + D.log(`Failed to parse IMSC1: ${n}`), + i.trigger(y.SUBTITLE_FRAG_PROCESSED, { + success: !1, + frag: e, + error: n, + }); + } + ); + } + _parseVTTs(e) { + var t; + const { frag: i, payload: n } = e, + { initPTS: r, unparsedVttFrags: a } = this, + o = r.length - 1; + if (!r[i.cc] && o === -1) { + a.push(e); + return; + } + const l = this.hls, + u = + (t = i.initSegment) != null && t.data + ? jt(i.initSegment.data, new Uint8Array(n)) + : n; + _f( + u, + this.initPTS[i.cc], + this.vttCCs, + i.cc, + i.start, + (c) => { + this._appendCues(c, i.level), + l.trigger(y.SUBTITLE_FRAG_PROCESSED, { success: !0, frag: i }); + }, + (c) => { + const d = c.message === "Missing initPTS for VTT MPEGTS"; + d ? a.push(e) : this._fallbackToIMSC1(i, n), + D.log(`Failed to parse VTT cue: ${c}`), + !(d && o > i.cc) && + l.trigger(y.SUBTITLE_FRAG_PROCESSED, { + success: !1, + frag: i, + error: c, + }); + } + ); + } + _fallbackToIMSC1(e, t) { + const i = this.tracks[e.level]; + i.textCodec || + $o( + t, + this.initPTS[e.cc], + () => { + (i.textCodec = Or), this._parseIMSC1(e, t); + }, + () => { + i.textCodec = "wvtt"; + } + ); + } + _appendCues(e, t) { + const i = this.hls; + if (this.config.renderTextTracksNatively) { + const n = this.textTracks[t]; + if (!n || n.mode === "disabled") return; + e.forEach((r) => Ba(n, r)); + } else { + const n = this.tracks[t]; + if (!n) return; + const r = n.default ? "default" : "subtitles" + t; + i.trigger(y.CUES_PARSED, { type: "subtitles", cues: e, track: r }); + } + } + onFragDecrypted(e, t) { + const { frag: i } = t; + i.type === se.SUBTITLE && this.onFragLoaded(y.FRAG_LOADED, t); + } + onSubtitleTracksCleared() { + (this.tracks = []), (this.captionsTracks = {}); + } + onFragParsingUserdata(e, t) { + const { cea608Parser1: i, cea608Parser2: n } = this; + if (!this.enabled || !(i && n)) return; + const { frag: r, samples: a } = t; + if (!(r.type === se.MAIN && this.closedCaptionsForLevel(r) === "NONE")) + for (let o = 0; o < a.length; o++) { + const l = a[o].bytes; + if (l) { + const u = this.extractCea608Data(l); + i.addData(a[o].pts, u[0]), n.addData(a[o].pts, u[1]); + } + } + } + onBufferFlushing( + e, + { startOffset: t, endOffset: i, endOffsetSubtitles: n, type: r } + ) { + const { media: a } = this; + if (!(!a || a.currentTime < i)) { + if (!r || r === "video") { + const { captionsTracks: o } = this; + Object.keys(o).forEach((l) => ir(o[l], t, i)); + } + if (this.config.renderTextTracksNatively && t === 0 && n !== void 0) { + const { textTracks: o } = this; + Object.keys(o).forEach((l) => ir(o[l], t, n)); + } + } + } + extractCea608Data(e) { + const t = [[], []], + i = e[0] & 31; + let n = 2; + for (let r = 0; r < i; r++) { + const a = e[n++], + o = 127 & e[n++], + l = 127 & e[n++]; + if (o === 0 && l === 0) continue; + if ((4 & a) !== 0) { + const c = 3 & a; + (c === 0 || c === 1) && (t[c].push(o), t[c].push(l)); + } + } + return t; + } + } + function Rf(s, e) { + return !!s && s.label === e.name && !(s.textTrack1 || s.textTrack2); + } + function Pf(s, e, t, i) { + return Math.min(e, i) - Math.max(s, t); + } + function Ho() { + return { + ccOffset: 0, + presentationOffset: 0, + 0: { start: 0, prevCC: -1, new: !0 }, + }; + } + class Br { + constructor(e) { + (this.hls = void 0), + (this.autoLevelCapping = void 0), + (this.firstLevel = void 0), + (this.media = void 0), + (this.restrictedLevels = void 0), + (this.timer = void 0), + (this.clientRect = void 0), + (this.streamController = void 0), + (this.hls = e), + (this.autoLevelCapping = Number.POSITIVE_INFINITY), + (this.firstLevel = -1), + (this.media = null), + (this.restrictedLevels = []), + (this.timer = void 0), + (this.clientRect = null), + this.registerListeners(); + } + setStreamController(e) { + this.streamController = e; + } + destroy() { + this.unregisterListener(), + this.hls.config.capLevelToPlayerSize && this.stopCapping(), + (this.media = null), + (this.clientRect = null), + (this.hls = this.streamController = null); + } + registerListeners() { + const { hls: e } = this; + e.on(y.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this), + e.on(y.MEDIA_ATTACHING, this.onMediaAttaching, this), + e.on(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.on(y.BUFFER_CODECS, this.onBufferCodecs, this), + e.on(y.MEDIA_DETACHING, this.onMediaDetaching, this); + } + unregisterListener() { + const { hls: e } = this; + e.off(y.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this), + e.off(y.MEDIA_ATTACHING, this.onMediaAttaching, this), + e.off(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.off(y.BUFFER_CODECS, this.onBufferCodecs, this), + e.off(y.MEDIA_DETACHING, this.onMediaDetaching, this); + } + onFpsDropLevelCapping(e, t) { + const i = this.hls.levels[t.droppedLevel]; + this.isLevelAllowed(i) && + this.restrictedLevels.push({ + bitrate: i.bitrate, + height: i.height, + width: i.width, + }); + } + onMediaAttaching(e, t) { + (this.media = t.media instanceof HTMLVideoElement ? t.media : null), + (this.clientRect = null); + } + onManifestParsed(e, t) { + const i = this.hls; + (this.restrictedLevels = []), + (this.firstLevel = t.firstLevel), + i.config.capLevelToPlayerSize && t.video && this.startCapping(); + } + onBufferCodecs(e, t) { + this.hls.config.capLevelToPlayerSize && t.video && this.startCapping(); + } + onMediaDetaching() { + this.stopCapping(); + } + detectPlayerSize() { + if (this.media && this.mediaHeight > 0 && this.mediaWidth > 0) { + const e = this.hls.levels; + if (e.length) { + const t = this.hls; + (t.autoLevelCapping = this.getMaxLevel(e.length - 1)), + t.autoLevelCapping > this.autoLevelCapping && + this.streamController && + this.streamController.nextLevelSwitch(), + (this.autoLevelCapping = t.autoLevelCapping); + } + } + } + getMaxLevel(e) { + const t = this.hls.levels; + if (!t.length) return -1; + const i = t.filter((n, r) => this.isLevelAllowed(n) && r <= e); + return ( + (this.clientRect = null), + Br.getMaxLevelByMediaSize(i, this.mediaWidth, this.mediaHeight) + ); + } + startCapping() { + this.timer || + ((this.autoLevelCapping = Number.POSITIVE_INFINITY), + (this.hls.firstLevel = this.getMaxLevel(this.firstLevel)), + self.clearInterval(this.timer), + (this.timer = self.setInterval(this.detectPlayerSize.bind(this), 1e3)), + this.detectPlayerSize()); + } + stopCapping() { + (this.restrictedLevels = []), + (this.firstLevel = -1), + (this.autoLevelCapping = Number.POSITIVE_INFINITY), + this.timer && (self.clearInterval(this.timer), (this.timer = void 0)); + } + getDimensions() { + if (this.clientRect) return this.clientRect; + const e = this.media, + t = { width: 0, height: 0 }; + if (e) { + const i = e.getBoundingClientRect(); + (t.width = i.width), + (t.height = i.height), + !t.width && + !t.height && + ((t.width = i.right - i.left || e.width || 0), + (t.height = i.bottom - i.top || e.height || 0)); + } + return (this.clientRect = t), t; + } + get mediaWidth() { + return this.getDimensions().width * this.contentScaleFactor; + } + get mediaHeight() { + return this.getDimensions().height * this.contentScaleFactor; + } + get contentScaleFactor() { + let e = 1; + if (!this.hls.config.ignoreDevicePixelRatio) + try { + e = self.devicePixelRatio; + } catch {} + return e; + } + isLevelAllowed(e) { + return !this.restrictedLevels.some( + (i) => + e.bitrate === i.bitrate && + e.width === i.width && + e.height === i.height + ); + } + static getMaxLevelByMediaSize(e, t, i) { + if (!(e != null && e.length)) return -1; + const n = (a, o) => + o ? a.width !== o.width || a.height !== o.height : !0; + let r = e.length - 1; + for (let a = 0; a < e.length; a += 1) { + const o = e[a]; + if ((o.width >= t || o.height >= i) && n(o, e[a + 1])) { + r = a; + break; + } + } + return r; + } + } + class wf { + constructor(e) { + (this.hls = void 0), + (this.isVideoPlaybackQualityAvailable = !1), + (this.timer = void 0), + (this.media = null), + (this.lastTime = void 0), + (this.lastDroppedFrames = 0), + (this.lastDecodedFrames = 0), + (this.streamController = void 0), + (this.hls = e), + this.registerListeners(); + } + setStreamController(e) { + this.streamController = e; + } + registerListeners() { + this.hls.on(y.MEDIA_ATTACHING, this.onMediaAttaching, this); + } + unregisterListeners() { + this.hls.off(y.MEDIA_ATTACHING, this.onMediaAttaching, this); + } + destroy() { + this.timer && clearInterval(this.timer), + this.unregisterListeners(), + (this.isVideoPlaybackQualityAvailable = !1), + (this.media = null); + } + onMediaAttaching(e, t) { + const i = this.hls.config; + if (i.capLevelOnFPSDrop) { + const n = t.media instanceof self.HTMLVideoElement ? t.media : null; + (this.media = n), + n && + typeof n.getVideoPlaybackQuality == "function" && + (this.isVideoPlaybackQualityAvailable = !0), + self.clearInterval(this.timer), + (this.timer = self.setInterval( + this.checkFPSInterval.bind(this), + i.fpsDroppedMonitoringPeriod + )); + } + } + checkFPS(e, t, i) { + const n = performance.now(); + if (t) { + if (this.lastTime) { + const r = n - this.lastTime, + a = i - this.lastDroppedFrames, + o = t - this.lastDecodedFrames, + l = (1e3 * a) / r, + u = this.hls; + if ( + (u.trigger(y.FPS_DROP, { + currentDropped: a, + currentDecoded: o, + totalDroppedFrames: i, + }), + l > 0 && a > u.config.fpsDroppedMonitoringThreshold * o) + ) { + let c = u.currentLevel; + D.warn( + "drop FPS ratio greater than max allowed value for currentLevel: " + + c + ), + c > 0 && + (u.autoLevelCapping === -1 || u.autoLevelCapping >= c) && + ((c = c - 1), + u.trigger(y.FPS_DROP_LEVEL_CAPPING, { + level: c, + droppedLevel: u.currentLevel, + }), + (u.autoLevelCapping = c), + this.streamController.nextLevelSwitch()); + } + } + (this.lastTime = n), + (this.lastDroppedFrames = i), + (this.lastDecodedFrames = t); + } + } + checkFPSInterval() { + const e = this.media; + if (e) + if (this.isVideoPlaybackQualityAvailable) { + const t = e.getVideoPlaybackQuality(); + this.checkFPS(e, t.totalVideoFrames, t.droppedVideoFrames); + } else + this.checkFPS( + e, + e.webkitDecodedFrameCount, + e.webkitDroppedFrameCount + ); + } + } + const pn = "[eme]"; + class mi { + constructor(e) { + (this.hls = void 0), + (this.config = void 0), + (this.media = null), + (this.keyFormatPromise = null), + (this.keySystemAccessPromises = {}), + (this._requestLicenseFailureCount = 0), + (this.mediaKeySessions = []), + (this.keyIdToKeySessionPromise = {}), + (this.setMediaKeysQueue = mi.CDMCleanupPromise + ? [mi.CDMCleanupPromise] + : []), + (this.onMediaEncrypted = this._onMediaEncrypted.bind(this)), + (this.onWaitingForKey = this._onWaitingForKey.bind(this)), + (this.debug = D.debug.bind(D, pn)), + (this.log = D.log.bind(D, pn)), + (this.warn = D.warn.bind(D, pn)), + (this.error = D.error.bind(D, pn)), + (this.hls = e), + (this.config = e.config), + this.registerListeners(); + } + destroy() { + this.unregisterListeners(), this.onMediaDetached(); + const e = this.config; + (e.requestMediaKeySystemAccessFunc = null), + (e.licenseXhrSetup = e.licenseResponseCallback = void 0), + (e.drmSystems = e.drmSystemOptions = {}), + (this.hls = + this.onMediaEncrypted = + this.onWaitingForKey = + this.keyIdToKeySessionPromise = + null), + (this.config = null); + } + registerListeners() { + this.hls.on(y.MEDIA_ATTACHED, this.onMediaAttached, this), + this.hls.on(y.MEDIA_DETACHED, this.onMediaDetached, this), + this.hls.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + this.hls.on(y.MANIFEST_LOADED, this.onManifestLoaded, this); + } + unregisterListeners() { + this.hls.off(y.MEDIA_ATTACHED, this.onMediaAttached, this), + this.hls.off(y.MEDIA_DETACHED, this.onMediaDetached, this), + this.hls.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + this.hls.off(y.MANIFEST_LOADED, this.onManifestLoaded, this); + } + getLicenseServerUrl(e) { + const { drmSystems: t, widevineLicenseUrl: i } = this.config, + n = t[e]; + if (n) return n.licenseUrl; + if (e === Ie.WIDEVINE && i) return i; + throw new Error(`no license server URL configured for key-system "${e}"`); + } + getServerCertificateUrl(e) { + const { drmSystems: t } = this.config, + i = t[e]; + if (i) return i.serverCertificateUrl; + this.log(`No Server Certificate in config.drmSystems["${e}"]`); + } + attemptKeySystemAccess(e) { + const t = this.hls.levels, + i = (a, o, l) => !!a && l.indexOf(a) === o, + n = t.map((a) => a.audioCodec).filter(i), + r = t.map((a) => a.videoCodec).filter(i); + return ( + n.length + r.length === 0 && r.push("avc1.42e01e"), + new Promise((a, o) => { + const l = (u) => { + const c = u.shift(); + this.getMediaKeysPromise(c, n, r) + .then((d) => a({ keySystem: c, mediaKeys: d })) + .catch((d) => { + u.length + ? l(u) + : d instanceof rt + ? o(d) + : o( + new rt( + { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_NO_ACCESS, + error: d, + fatal: !0, + }, + d.message + ) + ); + }); + }; + l(e); + }) + ); + } + requestMediaKeySystemAccess(e, t) { + const { requestMediaKeySystemAccessFunc: i } = this.config; + if (typeof i != "function") { + let n = `Configured requestMediaKeySystemAccess is not a function ${i}`; + return ( + ha === null && + self.location.protocol === "http:" && + (n = `navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`), + Promise.reject(new Error(n)) + ); + } + return i(e, t); + } + getMediaKeysPromise(e, t, i) { + const n = Yc(e, t, i, this.config.drmSystemOptions), + r = this.keySystemAccessPromises[e]; + let a = r == null ? void 0 : r.keySystemAccess; + if (!a) { + this.log( + `Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify( + n + )}` + ), + (a = this.requestMediaKeySystemAccess(e, n)); + const o = (this.keySystemAccessPromises[e] = { keySystemAccess: a }); + return ( + a.catch((l) => { + this.log(`Failed to obtain access to key-system "${e}": ${l}`); + }), + a.then((l) => { + this.log(`Access for key-system "${l.keySystem}" obtained`); + const u = this.fetchServerCertificate(e); + return ( + this.log(`Create media-keys for "${e}"`), + (o.mediaKeys = l + .createMediaKeys() + .then( + (c) => ( + this.log(`Media-keys created for "${e}"`), + u.then((d) => + d ? this.setMediaKeysServerCertificate(c, e, d) : c + ) + ) + )), + o.mediaKeys.catch((c) => { + this.error(`Failed to create media-keys for "${e}"}: ${c}`); + }), + o.mediaKeys + ); + }) + ); + } + return a.then(() => r.mediaKeys); + } + createMediaKeySessionContext({ + decryptdata: e, + keySystem: t, + mediaKeys: i, + }) { + this.log( + `Creating key-system session "${t}" keyId: ${gt.hexDump(e.keyId || [])}` + ); + const n = i.createSession(), + r = { + decryptdata: e, + keySystem: t, + mediaKeys: i, + mediaKeysSession: n, + keyStatus: "status-pending", + }; + return this.mediaKeySessions.push(r), r; + } + renewKeySession(e) { + const t = e.decryptdata; + if (t.pssh) { + const i = this.createMediaKeySessionContext(e), + n = this.getKeyIdString(t), + r = "cenc"; + this.keyIdToKeySessionPromise[n] = + this.generateRequestWithPreferredKeySession(i, r, t.pssh, "expired"); + } else this.warn("Could not renew expired session. Missing pssh initData."); + this.removeSession(e); + } + getKeyIdString(e) { + if (!e) throw new Error("Could not read keyId of undefined decryptdata"); + if (e.keyId === null) throw new Error("keyId is null"); + return gt.hexDump(e.keyId); + } + updateKeySession(e, t) { + var i; + const n = e.mediaKeysSession; + return ( + this.log(`Updating key-session "${n.sessionId}" for keyID ${gt.hexDump( + ((i = e.decryptdata) == null ? void 0 : i.keyId) || [] + )} + } (data length: ${t && t.byteLength})`), + n.update(t) + ); + } + selectKeySystemFormat(e) { + const t = Object.keys(e.levelkeys || {}); + return ( + this.keyFormatPromise || + (this.log( + `Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${ + e.level + }) key formats ${t.join(", ")}` + ), + (this.keyFormatPromise = this.getKeyFormatPromise(t))), + this.keyFormatPromise + ); + } + getKeyFormatPromise(e) { + return new Promise((t, i) => { + const n = qn(this.config), + r = e.map(la).filter((a) => !!a && n.indexOf(a) !== -1); + return this.getKeySystemSelectionPromise(r) + .then(({ keySystem: a }) => { + const o = ca(a); + o + ? t(o) + : i(new Error(`Unable to find format for key-system "${a}"`)); + }) + .catch(i); + }); + } + loadKey(e) { + const t = e.keyInfo.decryptdata, + i = this.getKeyIdString(t), + n = `(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`; + this.log(`Starting session for key ${n}`); + let r = this.keyIdToKeySessionPromise[i]; + return ( + r || + ((r = this.keyIdToKeySessionPromise[i] = + this.getKeySystemForKeyPromise(t).then( + ({ keySystem: a, mediaKeys: o }) => ( + this.throwIfDestroyed(), + this.log( + `Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}` + ), + this.attemptSetMediaKeys(a, o).then(() => { + this.throwIfDestroyed(); + const l = this.createMediaKeySessionContext({ + keySystem: a, + mediaKeys: o, + decryptdata: t, + }); + return this.generateRequestWithPreferredKeySession( + l, + "cenc", + t.pssh, + "playlist-key" + ); + }) + ) + )), + r.catch((a) => this.handleError(a))), + r + ); + } + throwIfDestroyed(e = "Invalid state") { + if (!this.hls) throw new Error("invalid state"); + } + handleError(e) { + this.hls && + (this.error(e.message), + e instanceof rt + ? this.hls.trigger(y.ERROR, e.data) + : this.hls.trigger(y.ERROR, { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_NO_KEYS, + error: e, + fatal: !0, + })); + } + getKeySystemForKeyPromise(e) { + const t = this.getKeyIdString(e), + i = this.keyIdToKeySessionPromise[t]; + if (!i) { + const n = la(e.keyFormat), + r = n ? [n] : qn(this.config); + return this.attemptKeySystemAccess(r); + } + return i; + } + getKeySystemSelectionPromise(e) { + if ((e.length || (e = qn(this.config)), e.length === 0)) + throw new rt( + { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_NO_CONFIGURED_LICENSE, + fatal: !0, + }, + `Missing key-system license configuration options ${JSON.stringify({ + drmSystems: this.config.drmSystems, + })}` + ); + return this.attemptKeySystemAccess(e); + } + _onMediaEncrypted(e) { + const { initDataType: t, initData: i } = e; + if ((this.debug(`"${e.type}" event: init data type: "${t}"`), i === null)) + return; + let n, r; + if (t === "sinf" && this.config.drmSystems[Ie.FAIRPLAY]) { + const c = $e(new Uint8Array(i)); + try { + const d = jn(JSON.parse(c).sinf), + f = va(new Uint8Array(d)); + if (!f) return; + (n = f.subarray(8, 24)), (r = Ie.FAIRPLAY); + } catch { + this.warn('Failed to parse sinf "encrypted" event message initData'); + return; + } + } else { + const c = ph(i); + if (c === null) return; + c.version === 0 && + c.systemId === ua.WIDEVINE && + c.data && + (n = c.data.subarray(8, 24)), + (r = Hc(c.systemId)); + } + if (!r || !n) return; + const a = gt.hexDump(n), + { keyIdToKeySessionPromise: o, mediaKeySessions: l } = this; + let u = o[a]; + for (let c = 0; c < l.length; c++) { + const d = l[c], + f = d.decryptdata; + if (f.pssh || !f.keyId) continue; + const g = gt.hexDump(f.keyId); + if (a === g || f.uri.replace(/-/g, "").indexOf(a) !== -1) { + (u = o[g]), + delete o[g], + (f.pssh = new Uint8Array(i)), + (f.keyId = n), + (u = o[a] = + u.then(() => + this.generateRequestWithPreferredKeySession( + d, + t, + i, + "encrypted-event-key-match" + ) + )); + break; + } + } + u || + (u = o[a] = + this.getKeySystemSelectionPromise([r]).then( + ({ keySystem: c, mediaKeys: d }) => { + var f; + this.throwIfDestroyed(); + const g = new Si("ISO-23001-7", a, (f = ca(c)) != null ? f : ""); + return ( + (g.pssh = new Uint8Array(i)), + (g.keyId = n), + this.attemptSetMediaKeys(c, d).then(() => { + this.throwIfDestroyed(); + const p = this.createMediaKeySessionContext({ + decryptdata: g, + keySystem: c, + mediaKeys: d, + }); + return this.generateRequestWithPreferredKeySession( + p, + t, + i, + "encrypted-event-no-match" + ); + }) + ); + } + )), + u.catch((c) => this.handleError(c)); + } + _onWaitingForKey(e) { + this.log(`"${e.type}" event`); + } + attemptSetMediaKeys(e, t) { + const i = this.setMediaKeysQueue.slice(); + this.log(`Setting media-keys for "${e}"`); + const n = Promise.all(i).then(() => { + if (!this.media) + throw new Error( + "Attempted to set mediaKeys without media element attached" + ); + return this.media.setMediaKeys(t); + }); + return ( + this.setMediaKeysQueue.push(n), + n.then(() => { + this.log(`Media-keys set for "${e}"`), + i.push(n), + (this.setMediaKeysQueue = this.setMediaKeysQueue.filter( + (r) => i.indexOf(r) === -1 + )); + }) + ); + } + generateRequestWithPreferredKeySession(e, t, i, n) { + var r, a; + const o = + (r = this.config.drmSystems) == null || (a = r[e.keySystem]) == null + ? void 0 + : a.generateRequest; + if (o) + try { + const f = o.call(this.hls, t, i, e); + if (!f) + throw new Error( + "Invalid response from configured generateRequest filter" + ); + (t = f.initDataType), + (i = e.decryptdata.pssh = + f.initData ? new Uint8Array(f.initData) : null); + } catch (f) { + var l; + if ((this.warn(f.message), (l = this.hls) != null && l.config.debug)) + throw f; + } + if (i === null) + return ( + this.log(`Skipping key-session request for "${n}" (no initData)`), + Promise.resolve(e) + ); + const u = this.getKeyIdString(e.decryptdata); + this.log( + `Generating key-session request for "${n}": ${u} (init data type: ${t} length: ${ + i ? i.byteLength : null + })` + ); + const c = new kr(); + (e.mediaKeysSession.onmessage = (f) => { + const g = e.mediaKeysSession; + if (!g) { + c.emit("error", new Error("invalid state")); + return; + } + const { messageType: p, message: v } = f; + this.log( + `"${p}" message event for session "${g.sessionId}" message size: ${v.byteLength}` + ), + p === "license-request" || p === "license-renewal" + ? this.renewLicense(e, v).catch((T) => { + this.handleError(T), c.emit("error", T); + }) + : p === "license-release" + ? e.keySystem === Ie.FAIRPLAY && + (this.updateKeySession(e, oa("acknowledged")), + this.removeSession(e)) + : this.warn(`unhandled media key message type "${p}"`); + }), + (e.mediaKeysSession.onkeystatuseschange = (f) => { + if (!e.mediaKeysSession) { + c.emit("error", new Error("invalid state")); + return; + } + this.onKeyStatusChange(e); + const p = e.keyStatus; + c.emit("keyStatus", p), + p === "expired" && + (this.warn(`${e.keySystem} expired for key ${u}`), + this.renewKeySession(e)); + }); + const d = new Promise((f, g) => { + c.on("error", g), + c.on("keyStatus", (p) => { + p.startsWith("usable") + ? f() + : p === "output-restricted" + ? g( + new rt( + { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED, + fatal: !1, + }, + "HDCP level output restricted" + ) + ) + : p === "internal-error" + ? g( + new rt( + { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_STATUS_INTERNAL_ERROR, + fatal: !0, + }, + `key status changed to "${p}"` + ) + ) + : p === "expired" + ? g(new Error("key expired while generating request")) + : this.warn(`unhandled key status change "${p}"`); + }); + }); + return e.mediaKeysSession + .generateRequest(t, i) + .then(() => { + var f; + this.log( + `Request generated for key-session "${ + (f = e.mediaKeysSession) == null ? void 0 : f.sessionId + }" keyId: ${u}` + ); + }) + .catch((f) => { + throw new rt( + { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_NO_SESSION, + error: f, + fatal: !1, + }, + `Error generating key-session request: ${f}` + ); + }) + .then(() => d) + .catch((f) => { + throw (c.removeAllListeners(), this.removeSession(e), f); + }) + .then(() => (c.removeAllListeners(), e)); + } + onKeyStatusChange(e) { + e.mediaKeysSession.keyStatuses.forEach((t, i) => { + this.log( + `key status change "${t}" for keyStatuses keyId: ${gt.hexDump( + "buffer" in i + ? new Uint8Array(i.buffer, i.byteOffset, i.byteLength) + : new Uint8Array(i) + )} session keyId: ${gt.hexDump( + new Uint8Array(e.decryptdata.keyId || []) + )} uri: ${e.decryptdata.uri}` + ), + (e.keyStatus = t); + }); + } + fetchServerCertificate(e) { + const t = this.config, + i = t.loader, + n = new i(t), + r = this.getServerCertificateUrl(e); + return r + ? (this.log(`Fetching serverCertificate for "${e}"`), + new Promise((a, o) => { + const l = { responseType: "arraybuffer", url: r }, + u = t.certLoadPolicy.default, + c = { + loadPolicy: u, + timeout: u.maxLoadTimeMs, + maxRetry: 0, + retryDelay: 0, + maxRetryDelay: 0, + }, + d = { + onSuccess: (f, g, p, v) => { + a(f.data); + }, + onError: (f, g, p, v) => { + o( + new rt( + { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED, + fatal: !0, + networkDetails: p, + response: We({ url: l.url, data: void 0 }, f), + }, + `"${e}" certificate request failed (${r}). Status: ${f.code} (${f.text})` + ) + ); + }, + onTimeout: (f, g, p) => { + o( + new rt( + { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED, + fatal: !0, + networkDetails: p, + response: { url: l.url, data: void 0 }, + }, + `"${e}" certificate request timed out (${r})` + ) + ); + }, + onAbort: (f, g, p) => { + o(new Error("aborted")); + }, + }; + n.load(l, c, d); + })) + : Promise.resolve(); + } + setMediaKeysServerCertificate(e, t, i) { + return new Promise((n, r) => { + e.setServerCertificate(i) + .then((a) => { + this.log( + `setServerCertificate ${ + a ? "success" : "not supported by CDM" + } (${i == null ? void 0 : i.byteLength}) on "${t}"` + ), + n(e); + }) + .catch((a) => { + r( + new rt( + { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED, + error: a, + fatal: !0, + }, + a.message + ) + ); + }); + }); + } + renewLicense(e, t) { + return this.requestLicense(e, new Uint8Array(t)).then((i) => + this.updateKeySession(e, new Uint8Array(i)).catch((n) => { + throw new rt( + { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_SESSION_UPDATE_FAILED, + error: n, + fatal: !0, + }, + n.message + ); + }) + ); + } + setupLicenseXHR(e, t, i, n) { + const r = this.config.licenseXhrSetup; + return r + ? Promise.resolve() + .then(() => { + if (!i.decryptdata) throw new Error("Key removed"); + return r.call(this.hls, e, t, i, n); + }) + .catch((a) => { + if (!i.decryptdata) throw a; + return e.open("POST", t, !0), r.call(this.hls, e, t, i, n); + }) + .then( + (a) => ( + e.readyState || e.open("POST", t, !0), + { xhr: e, licenseChallenge: a || n } + ) + ) + : (e.open("POST", t, !0), + Promise.resolve({ xhr: e, licenseChallenge: n })); + } + requestLicense(e, t) { + const i = this.config.keyLoadPolicy.default; + return new Promise((n, r) => { + const a = this.getLicenseServerUrl(e.keySystem); + this.log(`Sending license request to URL: ${a}`); + const o = new XMLHttpRequest(); + (o.responseType = "arraybuffer"), + (o.onreadystatechange = () => { + if (!this.hls || !e.mediaKeysSession) + return r(new Error("invalid state")); + if (o.readyState === 4) + if (o.status === 200) { + this._requestLicenseFailureCount = 0; + let l = o.response; + this.log( + `License received ${ + l instanceof ArrayBuffer ? l.byteLength : l + }` + ); + const u = this.config.licenseResponseCallback; + if (u) + try { + l = u.call(this.hls, o, a, e); + } catch (c) { + this.error(c); + } + n(l); + } else { + const l = i.errorRetry, + u = l ? l.maxNumRetry : 0; + if ( + (this._requestLicenseFailureCount++, + this._requestLicenseFailureCount > u || + (o.status >= 400 && o.status < 500)) + ) + r( + new rt( + { + type: re.KEY_SYSTEM_ERROR, + details: $.KEY_SYSTEM_LICENSE_REQUEST_FAILED, + fatal: !0, + networkDetails: o, + response: { + url: a, + data: void 0, + code: o.status, + text: o.statusText, + }, + }, + `License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})` + ) + ); + else { + const c = u - this._requestLicenseFailureCount + 1; + this.warn(`Retrying license request, ${c} attempts left`), + this.requestLicense(e, t).then(n, r); + } + } + }), + e.licenseXhr && + e.licenseXhr.readyState !== XMLHttpRequest.DONE && + e.licenseXhr.abort(), + (e.licenseXhr = o), + this.setupLicenseXHR(o, a, e, t).then( + ({ xhr: l, licenseChallenge: u }) => { + l.send(u); + } + ); + }); + } + onMediaAttached(e, t) { + if (!this.config.emeEnabled) return; + const i = t.media; + (this.media = i), + i.addEventListener("encrypted", this.onMediaEncrypted), + i.addEventListener("waitingforkey", this.onWaitingForKey); + } + onMediaDetached() { + const e = this.media, + t = this.mediaKeySessions; + e && + (e.removeEventListener("encrypted", this.onMediaEncrypted), + e.removeEventListener("waitingforkey", this.onWaitingForKey), + (this.media = null)), + (this._requestLicenseFailureCount = 0), + (this.setMediaKeysQueue = []), + (this.mediaKeySessions = []), + (this.keyIdToKeySessionPromise = {}), + Si.clearKeyUriToKeyIdMap(); + const i = t.length; + mi.CDMCleanupPromise = Promise.all( + t + .map((n) => this.removeSession(n)) + .concat( + e == null + ? void 0 + : e.setMediaKeys(null).catch((n) => { + this.log( + `Could not clear media keys: ${n}. media.src: ${ + e == null ? void 0 : e.src + }` + ); + }) + ) + ) + .then(() => { + i && + (this.log("finished closing key sessions and clearing media keys"), + (t.length = 0)); + }) + .catch((n) => { + this.log( + `Could not close sessions and clear media keys: ${n}. media.src: ${ + e == null ? void 0 : e.src + }` + ); + }); + } + onManifestLoading() { + this.keyFormatPromise = null; + } + onManifestLoaded(e, { sessionKeys: t }) { + if (!(!t || !this.config.emeEnabled) && !this.keyFormatPromise) { + const i = t.reduce( + (n, r) => (n.indexOf(r.keyFormat) === -1 && n.push(r.keyFormat), n), + [] + ); + this.log(`Selecting key-system from session-keys ${i.join(", ")}`), + (this.keyFormatPromise = this.getKeyFormatPromise(i)); + } + } + removeSession(e) { + const { mediaKeysSession: t, licenseXhr: i } = e; + if (t) { + this.log(`Remove licenses and keys and close session ${t.sessionId}`), + (t.onmessage = null), + (t.onkeystatuseschange = null), + i && i.readyState !== XMLHttpRequest.DONE && i.abort(), + (e.mediaKeysSession = e.decryptdata = e.licenseXhr = void 0); + const n = this.mediaKeySessions.indexOf(e); + return ( + n > -1 && this.mediaKeySessions.splice(n, 1), + t + .remove() + .catch((r) => { + this.log(`Could not remove session: ${r}`); + }) + .then(() => t.close()) + .catch((r) => { + this.log(`Could not close session: ${r}`); + }) + ); + } + } + } + mi.CDMCleanupPromise = void 0; + class rt extends Error { + constructor(e, t) { + super(t), + (this.data = void 0), + e.error || (e.error = new Error(t)), + (this.data = e), + (e.err = e.error); + } + } + const Df = 1; + var Xe = { + MANIFEST: "m", + AUDIO: "a", + VIDEO: "v", + MUXED: "av", + INIT: "i", + CAPTION: "c", + TIMED_TEXT: "tt", + KEY: "k", + OTHER: "o", + }; + const Of = "h"; + class Ft { + constructor(e) { + (this.hls = void 0), + (this.config = void 0), + (this.media = void 0), + (this.sid = void 0), + (this.cid = void 0), + (this.useHeaders = !1), + (this.initialized = !1), + (this.starved = !1), + (this.buffering = !0), + (this.audioBuffer = void 0), + (this.videoBuffer = void 0), + (this.onWaiting = () => { + this.initialized && (this.starved = !0), (this.buffering = !0); + }), + (this.onPlaying = () => { + this.initialized || (this.initialized = !0), (this.buffering = !1); + }), + (this.applyPlaylistData = (n) => { + try { + this.apply(n, { ot: Xe.MANIFEST, su: !this.initialized }); + } catch (r) { + D.warn("Could not generate manifest CMCD data.", r); + } + }), + (this.applyFragmentData = (n) => { + try { + const r = n.frag, + a = this.hls.levels[r.level], + o = this.getObjectType(r), + l = { d: r.duration * 1e3, ot: o }; + (o === Xe.VIDEO || o === Xe.AUDIO || o == Xe.MUXED) && + ((l.br = a.bitrate / 1e3), + (l.tb = this.getTopBandwidth(o) / 1e3), + (l.bl = this.getBufferLength(o))), + this.apply(n, l); + } catch (r) { + D.warn("Could not generate segment CMCD data.", r); + } + }), + (this.hls = e); + const t = (this.config = e.config), + { cmcd: i } = t; + i != null && + ((t.pLoader = this.createPlaylistLoader()), + (t.fLoader = this.createFragmentLoader()), + (this.sid = i.sessionId || Ft.uuid()), + (this.cid = i.contentId), + (this.useHeaders = i.useHeaders === !0), + this.registerListeners()); + } + registerListeners() { + const e = this.hls; + e.on(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.on(y.MEDIA_DETACHED, this.onMediaDetached, this), + e.on(y.BUFFER_CREATED, this.onBufferCreated, this); + } + unregisterListeners() { + const e = this.hls; + e.off(y.MEDIA_ATTACHED, this.onMediaAttached, this), + e.off(y.MEDIA_DETACHED, this.onMediaDetached, this), + e.off(y.BUFFER_CREATED, this.onBufferCreated, this); + } + destroy() { + this.unregisterListeners(), + this.onMediaDetached(), + (this.hls = this.config = this.audioBuffer = this.videoBuffer = null); + } + onMediaAttached(e, t) { + (this.media = t.media), + this.media.addEventListener("waiting", this.onWaiting), + this.media.addEventListener("playing", this.onPlaying); + } + onMediaDetached() { + this.media && + (this.media.removeEventListener("waiting", this.onWaiting), + this.media.removeEventListener("playing", this.onPlaying), + (this.media = null)); + } + onBufferCreated(e, t) { + var i, n; + (this.audioBuffer = (i = t.tracks.audio) == null ? void 0 : i.buffer), + (this.videoBuffer = (n = t.tracks.video) == null ? void 0 : n.buffer); + } + createData() { + var e; + return { + v: Df, + sf: Of, + sid: this.sid, + cid: this.cid, + pr: (e = this.media) == null ? void 0 : e.playbackRate, + mtp: this.hls.bandwidthEstimate / 1e3, + }; + } + apply(e, t = {}) { + Fe(t, this.createData()); + const i = t.ot === Xe.INIT || t.ot === Xe.VIDEO || t.ot === Xe.MUXED; + if ( + (this.starved && i && ((t.bs = !0), (t.su = !0), (this.starved = !1)), + t.su == null && (t.su = this.buffering), + this.useHeaders) + ) { + const n = Ft.toHeaders(t); + if (!Object.keys(n).length) return; + e.headers || (e.headers = {}), Fe(e.headers, n); + } else { + const n = Ft.toQuery(t); + if (!n) return; + e.url = Ft.appendQueryToUri(e.url, n); + } + } + getObjectType(e) { + const { type: t } = e; + if (t === "subtitle") return Xe.TIMED_TEXT; + if (e.sn === "initSegment") return Xe.INIT; + if (t === "audio") return Xe.AUDIO; + if (t === "main") + return this.hls.audioTracks.length ? Xe.VIDEO : Xe.MUXED; + } + getTopBandwidth(e) { + let t = 0, + i; + const n = this.hls; + if (e === Xe.AUDIO) i = n.audioTracks; + else { + const r = n.maxAutoLevel, + a = r > -1 ? r + 1 : n.levels.length; + i = n.levels.slice(0, a); + } + for (const r of i) r.bitrate > t && (t = r.bitrate); + return t > 0 ? t : NaN; + } + getBufferLength(e) { + const t = this.hls.media, + i = e === Xe.AUDIO ? this.audioBuffer : this.videoBuffer; + return !i || !t + ? NaN + : Se.bufferInfo(i, t.currentTime, this.config.maxBufferHole).len * 1e3; + } + createPlaylistLoader() { + const { pLoader: e } = this.config, + t = this.applyPlaylistData, + i = e || this.config.loader; + return class { + constructor(r) { + (this.loader = void 0), (this.loader = new i(r)); + } + get stats() { + return this.loader.stats; + } + get context() { + return this.loader.context; + } + destroy() { + this.loader.destroy(); + } + abort() { + this.loader.abort(); + } + load(r, a, o) { + t(r), this.loader.load(r, a, o); + } + }; + } + createFragmentLoader() { + const { fLoader: e } = this.config, + t = this.applyFragmentData, + i = e || this.config.loader; + return class { + constructor(r) { + (this.loader = void 0), (this.loader = new i(r)); + } + get stats() { + return this.loader.stats; + } + get context() { + return this.loader.context; + } + destroy() { + this.loader.destroy(); + } + abort() { + this.loader.abort(); + } + load(r, a, o) { + t(r), this.loader.load(r, a, o); + } + }; + } + static uuid() { + const e = URL.createObjectURL(new Blob()), + t = e.toString(); + return URL.revokeObjectURL(e), t.slice(t.lastIndexOf("/") + 1); + } + static serialize(e) { + const t = [], + i = (u) => !Number.isNaN(u) && u != null && u !== "" && u !== !1, + n = (u) => Math.round(u), + r = (u) => n(u / 100) * 100, + o = { + br: n, + d: n, + bl: r, + dl: r, + mtp: r, + nor: (u) => encodeURIComponent(u), + rtp: r, + tb: n, + }, + l = Object.keys(e || {}).sort(); + for (const u of l) { + let c = e[u]; + if (!i(c) || (u === "v" && c === 1) || (u == "pr" && c === 1)) continue; + const d = o[u]; + d && (c = d(c)); + const f = typeof c; + let g; + u === "ot" || u === "sf" || u === "st" + ? (g = `${u}=${c}`) + : f === "boolean" + ? (g = u) + : f === "number" + ? (g = `${u}=${c}`) + : (g = `${u}=${JSON.stringify(c)}`), + t.push(g); + } + return t.join(","); + } + static toHeaders(e) { + const t = Object.keys(e), + i = {}, + n = ["Object", "Request", "Session", "Status"], + r = [{}, {}, {}, {}], + a = { + br: 0, + d: 0, + ot: 0, + tb: 0, + bl: 1, + dl: 1, + mtp: 1, + nor: 1, + nrr: 1, + su: 1, + cid: 2, + pr: 2, + sf: 2, + sid: 2, + st: 2, + v: 2, + bs: 3, + rtp: 3, + }; + for (const o of t) { + const l = a[o] != null ? a[o] : 1; + r[l][o] = e[o]; + } + for (let o = 0; o < r.length; o++) { + const l = Ft.serialize(r[o]); + l && (i[`CMCD-${n[o]}`] = l); + } + return i; + } + static toQuery(e) { + return `CMCD=${encodeURIComponent(Ft.serialize(e))}`; + } + static appendQueryToUri(e, t) { + if (!t) return e; + const i = e.includes("?") ? "&" : "?"; + return `${e}${i}${t}`; + } + } + const Nf = 3e5; + class Ff { + constructor(e) { + (this.hls = void 0), + (this.log = void 0), + (this.loader = null), + (this.uri = null), + (this.pathwayId = "."), + (this.pathwayPriority = null), + (this.timeToLoad = 300), + (this.reloadTimer = -1), + (this.updated = 0), + (this.started = !1), + (this.enabled = !0), + (this.levels = null), + (this.audioTracks = null), + (this.subtitleTracks = null), + (this.penalizedPathways = {}), + (this.hls = e), + (this.log = D.log.bind(D, "[content-steering]:")), + this.registerListeners(); + } + registerListeners() { + const e = this.hls; + e.on(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.on(y.MANIFEST_LOADED, this.onManifestLoaded, this), + e.on(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.on(y.ERROR, this.onError, this); + } + unregisterListeners() { + const e = this.hls; + e && + (e.off(y.MANIFEST_LOADING, this.onManifestLoading, this), + e.off(y.MANIFEST_LOADED, this.onManifestLoaded, this), + e.off(y.MANIFEST_PARSED, this.onManifestParsed, this), + e.off(y.ERROR, this.onError, this)); + } + startLoad() { + if ( + ((this.started = !0), + self.clearTimeout(this.reloadTimer), + this.enabled && this.uri) + ) + if (this.updated) { + const e = Math.max( + this.timeToLoad * 1e3 - (performance.now() - this.updated), + 0 + ); + this.scheduleRefresh(this.uri, e); + } else this.loadSteeringManifest(this.uri); + } + stopLoad() { + (this.started = !1), + this.loader && (this.loader.destroy(), (this.loader = null)), + self.clearTimeout(this.reloadTimer); + } + destroy() { + this.unregisterListeners(), + this.stopLoad(), + (this.hls = null), + (this.levels = this.audioTracks = this.subtitleTracks = null); + } + removeLevel(e) { + const t = this.levels; + t && (this.levels = t.filter((i) => i !== e)); + } + onManifestLoading() { + this.stopLoad(), + (this.enabled = !0), + (this.timeToLoad = 300), + (this.updated = 0), + (this.uri = null), + (this.pathwayId = "."), + (this.levels = this.audioTracks = this.subtitleTracks = null); + } + onManifestLoaded(e, t) { + const { contentSteering: i } = t; + i !== null && + ((this.pathwayId = i.pathwayId), + (this.uri = i.uri), + this.started && this.startLoad()); + } + onManifestParsed(e, t) { + (this.audioTracks = t.audioTracks), + (this.subtitleTracks = t.subtitleTracks); + } + onError(e, t) { + const { errorAction: i } = t; + if ( + (i == null ? void 0 : i.action) === Ge.SendAlternateToPenaltyBox && + i.flags === it.MoveAllAlternatesMatchingHost + ) { + let n = this.pathwayPriority; + const r = this.pathwayId; + this.penalizedPathways[r] || + (this.penalizedPathways[r] = performance.now()), + !n && + this.levels && + (n = this.levels.reduce( + (a, o) => ( + a.indexOf(o.pathwayId) === -1 && a.push(o.pathwayId), a + ), + [] + )), + n && + n.length > 1 && + (this.updatePathwayPriority(n), + (i.resolved = this.pathwayId !== r)); + } + } + filterParsedLevels(e) { + this.levels = e; + let t = this.getLevelsForPathway(this.pathwayId); + if (t.length === 0) { + const i = e[0].pathwayId; + this.log( + `No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"` + ), + (t = this.getLevelsForPathway(i)), + (this.pathwayId = i); + } + return t.length !== e.length + ? (this.log( + `Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"` + ), + t) + : e; + } + getLevelsForPathway(e) { + return this.levels === null + ? [] + : this.levels.filter((t) => e === t.pathwayId); + } + updatePathwayPriority(e) { + this.pathwayPriority = e; + let t; + const i = this.penalizedPathways, + n = performance.now(); + Object.keys(i).forEach((r) => { + n - i[r] > Nf && delete i[r]; + }); + for (let r = 0; r < e.length; r++) { + const a = e[r]; + if (i[a]) continue; + if (a === this.pathwayId) return; + const o = this.hls.nextLoadLevel, + l = this.hls.levels[o]; + if (((t = this.getLevelsForPathway(a)), t.length > 0)) { + this.log(`Setting Pathway to "${a}"`), + (this.pathwayId = a), + this.hls.trigger(y.LEVELS_UPDATED, { levels: t }); + const u = this.hls.levels[o]; + l && + u && + this.levels && + (u.attrs["STABLE-VARIANT-ID"] !== l.attrs["STABLE-VARIANT-ID"] && + u.bitrate !== l.bitrate && + this.log( + `Unstable Pathways change from bitrate ${l.bitrate} to ${u.bitrate}` + ), + (this.hls.nextLoadLevel = o)); + break; + } + } + } + clonePathways(e) { + const t = this.levels; + if (!t) return; + const i = {}, + n = {}; + e.forEach((r) => { + const { ID: a, "BASE-ID": o, "URI-REPLACEMENT": l } = r; + if (t.some((c) => c.pathwayId === a)) return; + const u = this.getLevelsForPathway(o).map((c) => { + const d = Fe({}, c); + (d.details = void 0), + (d.url = zo( + c.uri, + c.attrs["STABLE-VARIANT-ID"], + "PER-VARIANT-URIS", + l + )); + const f = new Le(c.attrs); + f["PATHWAY-ID"] = a; + const g = f.AUDIO && `${f.AUDIO}_clone_${a}`, + p = f.SUBTITLES && `${f.SUBTITLES}_clone_${a}`; + g && ((i[f.AUDIO] = g), (f.AUDIO = g)), + p && ((n[f.SUBTITLES] = p), (f.SUBTITLES = p)), + (d.attrs = f); + const v = new xi(d); + return sn(v, "audio", g), sn(v, "text", p), v; + }); + t.push(...u), + Yo(this.audioTracks, i, l, a), + Yo(this.subtitleTracks, n, l, a); + }); + } + loadSteeringManifest(e) { + const t = this.hls.config, + i = t.loader; + this.loader && this.loader.destroy(), (this.loader = new i(t)); + let n; + try { + n = new self.URL(e); + } catch { + (this.enabled = !1), + this.log(`Failed to parse Steering Manifest URI: ${e}`); + return; + } + if (n.protocol !== "data:") { + const c = (this.hls.bandwidthEstimate || t.abrEwmaDefaultEstimate) | 0; + n.searchParams.set("_HLS_pathway", this.pathwayId), + n.searchParams.set("_HLS_throughput", "" + c); + } + const r = { responseType: "json", url: n.href }, + a = t.steeringManifestLoadPolicy.default, + o = a.errorRetry || a.timeoutRetry || {}, + l = { + loadPolicy: a, + timeout: a.maxLoadTimeMs, + maxRetry: o.maxNumRetry || 0, + retryDelay: o.retryDelayMs || 0, + maxRetryDelay: o.maxRetryDelayMs || 0, + }, + u = { + onSuccess: (c, d, f, g) => { + this.log(`Loaded steering manifest: "${n}"`); + const p = c.data; + if (p.VERSION !== 1) { + this.log(`Steering VERSION ${p.VERSION} not supported!`); + return; + } + (this.updated = performance.now()), (this.timeToLoad = p.TTL); + const { + "RELOAD-URI": v, + "PATHWAY-CLONES": T, + "PATHWAY-PRIORITY": x, + } = p; + if (v) + try { + this.uri = new self.URL(v, n).href; + } catch { + (this.enabled = !1), + this.log( + `Failed to parse Steering Manifest RELOAD-URI: ${v}` + ); + return; + } + this.scheduleRefresh(this.uri || f.url), + T && this.clonePathways(T), + x && this.updatePathwayPriority(x); + }, + onError: (c, d, f, g) => { + if ( + (this.log( + `Error loading steering manifest: ${c.code} ${c.text} (${d.url})` + ), + this.stopLoad(), + c.code === 410) + ) { + (this.enabled = !1), + this.log(`Steering manifest ${d.url} no longer available`); + return; + } + let p = this.timeToLoad * 1e3; + if (c.code === 429) { + const v = this.loader; + if ( + typeof (v == null ? void 0 : v.getResponseHeader) == "function" + ) { + const T = v.getResponseHeader("Retry-After"); + T && (p = parseFloat(T) * 1e3); + } + this.log(`Steering manifest ${d.url} rate limited`); + return; + } + this.scheduleRefresh(this.uri || d.url, p); + }, + onTimeout: (c, d, f) => { + this.log(`Timeout loading steering manifest (${d.url})`), + this.scheduleRefresh(this.uri || d.url); + }, + }; + this.log(`Requesting steering manifest: ${n}`), this.loader.load(r, l, u); + } + scheduleRefresh(e, t = this.timeToLoad * 1e3) { + self.clearTimeout(this.reloadTimer), + (this.reloadTimer = self.setTimeout(() => { + this.loadSteeringManifest(e); + }, t)); + } + } + function Yo(s, e, t, i) { + s && + Object.keys(e).forEach((n) => { + const r = s + .filter((a) => a.groupId === n) + .map((a) => { + const o = Fe({}, a); + return ( + (o.details = void 0), + (o.attrs = new Le(o.attrs)), + (o.url = o.attrs.URI = + zo( + a.url, + a.attrs["STABLE-RENDITION-ID"], + "PER-RENDITION-URIS", + t + )), + (o.groupId = o.attrs["GROUP-ID"] = e[n]), + (o.attrs["PATHWAY-ID"] = i), + o + ); + }); + s.push(...r); + }); + } + function zo(s, e, t, i) { + const { HOST: n, PARAMS: r, [t]: a } = i; + let o; + e && ((o = a == null ? void 0 : a[e]), o && (s = o)); + const l = new self.URL(s); + return ( + n && !o && (l.host = n), + r && + Object.keys(r) + .sort() + .forEach((u) => { + u && l.searchParams.set(u, r[u]); + }), + l.href + ); + } + const Mf = /^age:\s*[\d.]+\s*$/im; + class Wo { + constructor(e) { + (this.xhrSetup = void 0), + (this.requestTimeout = void 0), + (this.retryTimeout = void 0), + (this.retryDelay = void 0), + (this.config = null), + (this.callbacks = null), + (this.context = void 0), + (this.loader = null), + (this.stats = void 0), + (this.xhrSetup = (e && e.xhrSetup) || null), + (this.stats = new qi()), + (this.retryDelay = 0); + } + destroy() { + (this.callbacks = null), + this.abortInternal(), + (this.loader = null), + (this.config = null); + } + abortInternal() { + const e = this.loader; + self.clearTimeout(this.requestTimeout), + self.clearTimeout(this.retryTimeout), + e && + ((e.onreadystatechange = null), + (e.onprogress = null), + e.readyState !== 4 && ((this.stats.aborted = !0), e.abort())); + } + abort() { + var e; + this.abortInternal(), + (e = this.callbacks) != null && + e.onAbort && + this.callbacks.onAbort(this.stats, this.context, this.loader); + } + load(e, t, i) { + if (this.stats.loading.start) + throw new Error("Loader can only be used once."); + (this.stats.loading.start = self.performance.now()), + (this.context = e), + (this.config = t), + (this.callbacks = i), + this.loadInternal(); + } + loadInternal() { + const { config: e, context: t } = this; + if (!e) return; + const i = (this.loader = new self.XMLHttpRequest()), + n = this.stats; + (n.loading.first = 0), (n.loaded = 0), (n.aborted = !1); + const r = this.xhrSetup; + r + ? Promise.resolve() + .then(() => { + if (!this.stats.aborted) return r(i, t.url); + }) + .catch((a) => (i.open("GET", t.url, !0), r(i, t.url))) + .then(() => { + this.stats.aborted || this.openAndSendXhr(i, t, e); + }) + .catch((a) => { + this.callbacks.onError( + { code: i.status, text: a.message }, + t, + i, + n + ); + }) + : this.openAndSendXhr(i, t, e); + } + openAndSendXhr(e, t, i) { + e.readyState || e.open("GET", t.url, !0); + const n = this.context.headers, + { maxTimeToFirstByteMs: r, maxLoadTimeMs: a } = i.loadPolicy; + if (n) for (const o in n) e.setRequestHeader(o, n[o]); + t.rangeEnd && + e.setRequestHeader( + "Range", + "bytes=" + t.rangeStart + "-" + (t.rangeEnd - 1) + ), + (e.onreadystatechange = this.readystatechange.bind(this)), + (e.onprogress = this.loadprogress.bind(this)), + (e.responseType = t.responseType), + self.clearTimeout(this.requestTimeout), + (i.timeout = r && ne(r) ? r : a), + (this.requestTimeout = self.setTimeout( + this.loadtimeout.bind(this), + i.timeout + )), + e.send(); + } + readystatechange() { + const { context: e, loader: t, stats: i } = this; + if (!e || !t) return; + const n = t.readyState, + r = this.config; + if ( + !i.aborted && + n >= 2 && + (i.loading.first === 0 && + ((i.loading.first = Math.max( + self.performance.now(), + i.loading.start + )), + r.timeout !== r.loadPolicy.maxLoadTimeMs && + (self.clearTimeout(this.requestTimeout), + (r.timeout = r.loadPolicy.maxLoadTimeMs), + (this.requestTimeout = self.setTimeout( + this.loadtimeout.bind(this), + r.loadPolicy.maxLoadTimeMs - (i.loading.first - i.loading.start) + )))), + n === 4) + ) { + self.clearTimeout(this.requestTimeout), + (t.onreadystatechange = null), + (t.onprogress = null); + const a = t.status, + o = t.responseType !== "text"; + if ( + a >= 200 && + a < 300 && + ((o && t.response) || t.responseText !== null) + ) { + i.loading.end = Math.max(self.performance.now(), i.loading.first); + const l = o ? t.response : t.responseText, + u = t.responseType === "arraybuffer" ? l.byteLength : l.length; + if ( + ((i.loaded = i.total = u), + (i.bwEstimate = + (i.total * 8e3) / (i.loading.end - i.loading.first)), + !this.callbacks) + ) + return; + const c = this.callbacks.onProgress; + if ((c && c(i, e, l, t), !this.callbacks)) return; + const d = { url: t.responseURL, data: l, code: a }; + this.callbacks.onSuccess(d, i, e, t); + } else { + const l = r.loadPolicy.errorRetry, + u = i.retry; + rn(l, u, !1, a) + ? this.retry(l) + : (D.error(`${a} while loading ${e.url}`), + this.callbacks.onError({ code: a, text: t.statusText }, e, t, i)); + } + } + } + loadtimeout() { + var e; + const t = (e = this.config) == null ? void 0 : e.loadPolicy.timeoutRetry, + i = this.stats.retry; + if (rn(t, i, !0)) this.retry(t); + else { + D.warn(`timeout while loading ${this.context.url}`); + const n = this.callbacks; + n && + (this.abortInternal(), + n.onTimeout(this.stats, this.context, this.loader)); + } + } + retry(e) { + const { context: t, stats: i } = this; + (this.retryDelay = lr(e, i.retry)), + i.retry++, + D.warn( + `${status ? "HTTP Status " + status : "Timeout"} while loading ${ + t.url + }, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms` + ), + this.abortInternal(), + (this.loader = null), + self.clearTimeout(this.retryTimeout), + (this.retryTimeout = self.setTimeout( + this.loadInternal.bind(this), + this.retryDelay + )); + } + loadprogress(e) { + const t = this.stats; + (t.loaded = e.loaded), e.lengthComputable && (t.total = e.total); + } + getCacheAge() { + let e = null; + if (this.loader && Mf.test(this.loader.getAllResponseHeaders())) { + const t = this.loader.getResponseHeader("age"); + e = t ? parseFloat(t) : null; + } + return e; + } + getResponseHeader(e) { + return this.loader && + new RegExp(`^${e}:\\s*[\\d.]+\\s*$`, "im").test( + this.loader.getAllResponseHeaders() + ) + ? this.loader.getResponseHeader(e) + : null; + } + } + function Bf() { + if ( + self.fetch && + self.AbortController && + self.ReadableStream && + self.Request + ) + try { + return new self.ReadableStream({}), !0; + } catch {} + return !1; + } + const Uf = /(\d+)-(\d+)\/(\d+)/; + class jo { + constructor(e) { + (this.fetchSetup = void 0), + (this.requestTimeout = void 0), + (this.request = void 0), + (this.response = void 0), + (this.controller = void 0), + (this.context = void 0), + (this.config = null), + (this.callbacks = null), + (this.stats = void 0), + (this.loader = null), + (this.fetchSetup = e.fetchSetup || Kf), + (this.controller = new self.AbortController()), + (this.stats = new qi()); + } + destroy() { + (this.loader = this.callbacks = null), this.abortInternal(); + } + abortInternal() { + const e = this.response; + (e != null && e.ok) || + ((this.stats.aborted = !0), this.controller.abort()); + } + abort() { + var e; + this.abortInternal(), + (e = this.callbacks) != null && + e.onAbort && + this.callbacks.onAbort(this.stats, this.context, this.response); + } + load(e, t, i) { + const n = this.stats; + if (n.loading.start) throw new Error("Loader can only be used once."); + n.loading.start = self.performance.now(); + const r = $f(e, this.controller.signal), + a = i.onProgress, + o = e.responseType === "arraybuffer", + l = o ? "byteLength" : "length", + { maxTimeToFirstByteMs: u, maxLoadTimeMs: c } = t.loadPolicy; + (this.context = e), + (this.config = t), + (this.callbacks = i), + (this.request = this.fetchSetup(e, r)), + self.clearTimeout(this.requestTimeout), + (t.timeout = u && ne(u) ? u : c), + (this.requestTimeout = self.setTimeout(() => { + this.abortInternal(), i.onTimeout(n, e, this.response); + }, t.timeout)), + self + .fetch(this.request) + .then((d) => { + this.response = this.loader = d; + const f = Math.max(self.performance.now(), n.loading.start); + if ( + (self.clearTimeout(this.requestTimeout), + (t.timeout = c), + (this.requestTimeout = self.setTimeout(() => { + this.abortInternal(), i.onTimeout(n, e, this.response); + }, c - (f - n.loading.start))), + !d.ok) + ) { + const { status: g, statusText: p } = d; + throw new Hf(p || "fetch, bad network response", g, d); + } + return ( + (n.loading.first = f), + (n.total = Gf(d.headers) || n.total), + a && ne(t.highWaterMark) + ? this.loadProgressively(d, n, e, t.highWaterMark, a) + : o + ? d.arrayBuffer() + : e.responseType === "json" + ? d.json() + : d.text() + ); + }) + .then((d) => { + const { response: f } = this; + self.clearTimeout(this.requestTimeout), + (n.loading.end = Math.max( + self.performance.now(), + n.loading.first + )); + const g = d[l]; + g && (n.loaded = n.total = g); + const p = { url: f.url, data: d, code: f.status }; + a && !ne(t.highWaterMark) && a(n, e, d, f), i.onSuccess(p, n, e, f); + }) + .catch((d) => { + if ((self.clearTimeout(this.requestTimeout), n.aborted)) return; + const f = (d && d.code) || 0, + g = d ? d.message : null; + i.onError({ code: f, text: g }, e, d ? d.details : null, n); + }); + } + getCacheAge() { + let e = null; + if (this.response) { + const t = this.response.headers.get("age"); + e = t ? parseFloat(t) : null; + } + return e; + } + getResponseHeader(e) { + return this.response ? this.response.headers.get(e) : null; + } + loadProgressively(e, t, i, n = 0, r) { + const a = new bo(), + o = e.body.getReader(), + l = () => + o + .read() + .then((u) => { + if (u.done) + return ( + a.dataLength && r(t, i, a.flush(), e), + Promise.resolve(new ArrayBuffer(0)) + ); + const c = u.value, + d = c.length; + return ( + (t.loaded += d), + d < n || a.dataLength + ? (a.push(c), a.dataLength >= n && r(t, i, a.flush(), e)) + : r(t, i, c, e), + l() + ); + }) + .catch(() => Promise.reject()); + return l(); + } + } + function $f(s, e) { + const t = { + method: "GET", + mode: "cors", + credentials: "same-origin", + signal: e, + headers: new self.Headers(Fe({}, s.headers)), + }; + return ( + s.rangeEnd && + t.headers.set( + "Range", + "bytes=" + s.rangeStart + "-" + String(s.rangeEnd - 1) + ), + t + ); + } + function Vf(s) { + const e = Uf.exec(s); + if (e) return parseInt(e[2]) - parseInt(e[1]) + 1; + } + function Gf(s) { + const e = s.get("Content-Range"); + if (e) { + const i = Vf(e); + if (ne(i)) return i; + } + const t = s.get("Content-Length"); + if (t) return parseInt(t); + } + function Kf(s, e) { + return new self.Request(s.url, e); + } + class Hf extends Error { + constructor(e, t, i) { + super(e), + (this.code = void 0), + (this.details = void 0), + (this.code = t), + (this.details = i); + } + } + const Yf = /\s/, + zf = { + newCue(s, e, t, i) { + const n = []; + let r, a, o, l, u; + const c = self.VTTCue || self.TextTrackCue; + for (let f = 0; f < i.rows.length; f++) + if (((r = i.rows[f]), (o = !0), (l = 0), (u = ""), !r.isEmpty())) { + var d; + for (let v = 0; v < r.chars.length; v++) + Yf.test(r.chars[v].uchar) && o + ? l++ + : ((u += r.chars[v].uchar), (o = !1)); + (r.cueStartTime = e), e === t && (t += 1e-4), l >= 16 ? l-- : l++; + const g = Mo(u.trim()), + p = Dr(e, t, g); + (s != null && (d = s.cues) != null && d.getCueById(p)) || + ((a = new c(e, t, g)), + (a.id = p), + (a.line = f + 1), + (a.align = "left"), + (a.position = 10 + Math.min(80, Math.floor((l * 8) / 32) * 10)), + n.push(a)); + } + return ( + s && + n.length && + (n.sort((f, g) => + f.line === "auto" || g.line === "auto" + ? 0 + : f.line > 8 && g.line > 8 + ? g.line - f.line + : f.line - g.line + ), + n.forEach((f) => Ba(s, f))), + n + ); + }, + }, + Wf = { + maxTimeToFirstByteMs: 8e3, + maxLoadTimeMs: 2e4, + timeoutRetry: null, + errorRetry: null, + }, + jf = We( + We( + { + autoStartLoad: !0, + startPosition: -1, + defaultAudioCodec: void 0, + debug: !1, + capLevelOnFPSDrop: !1, + capLevelToPlayerSize: !1, + ignoreDevicePixelRatio: !1, + initialLiveManifestSize: 1, + maxBufferLength: 30, + backBufferLength: 1 / 0, + maxBufferSize: 60 * 1e3 * 1e3, + maxBufferHole: 0.1, + highBufferWatchdogPeriod: 2, + nudgeOffset: 0.1, + nudgeMaxRetry: 3, + maxFragLookUpTolerance: 0.25, + liveSyncDurationCount: 3, + liveMaxLatencyDurationCount: 1 / 0, + liveSyncDuration: void 0, + liveMaxLatencyDuration: void 0, + maxLiveSyncPlaybackRate: 1, + liveDurationInfinity: !1, + liveBackBufferLength: null, + maxMaxBufferLength: 600, + enableWorker: !0, + workerPath: null, + enableSoftwareAES: !0, + startLevel: void 0, + startFragPrefetch: !1, + fpsDroppedMonitoringPeriod: 5e3, + fpsDroppedMonitoringThreshold: 0.2, + appendErrorMaxRetry: 3, + loader: Wo, + fLoader: void 0, + pLoader: void 0, + xhrSetup: void 0, + licenseXhrSetup: void 0, + licenseResponseCallback: void 0, + abrController: Zd, + bufferController: of, + capLevelController: Br, + errorController: Kh, + fpsController: wf, + stretchShortVideoTrack: !1, + maxAudioFramesDrift: 1, + forceKeyFrameOnDiscontinuity: !0, + abrEwmaFastLive: 3, + abrEwmaSlowLive: 9, + abrEwmaFastVoD: 3, + abrEwmaSlowVoD: 9, + abrEwmaDefaultEstimate: 5e5, + abrBandWidthFactor: 0.95, + abrBandWidthUpFactor: 0.7, + abrMaxWithRealBitrate: !1, + maxStarvationDelay: 4, + maxLoadingDelay: 4, + minAutoBitrate: 0, + emeEnabled: !1, + widevineLicenseUrl: void 0, + drmSystems: {}, + drmSystemOptions: {}, + requestMediaKeySystemAccessFunc: ha, + testBandwidth: !0, + progressive: !1, + lowLatencyMode: !0, + cmcd: void 0, + enableDateRangeMetadataCues: !0, + enableEmsgMetadataCues: !0, + enableID3MetadataCues: !0, + certLoadPolicy: { default: Wf }, + keyLoadPolicy: { + default: { + maxTimeToFirstByteMs: 8e3, + maxLoadTimeMs: 2e4, + timeoutRetry: { + maxNumRetry: 1, + retryDelayMs: 1e3, + maxRetryDelayMs: 2e4, + backoff: "linear", + }, + errorRetry: { + maxNumRetry: 8, + retryDelayMs: 1e3, + maxRetryDelayMs: 2e4, + backoff: "linear", + }, + }, + }, + manifestLoadPolicy: { + default: { + maxTimeToFirstByteMs: 1 / 0, + maxLoadTimeMs: 2e4, + timeoutRetry: { + maxNumRetry: 2, + retryDelayMs: 0, + maxRetryDelayMs: 0, + }, + errorRetry: { + maxNumRetry: 1, + retryDelayMs: 1e3, + maxRetryDelayMs: 8e3, + }, + }, + }, + playlistLoadPolicy: { + default: { + maxTimeToFirstByteMs: 1e4, + maxLoadTimeMs: 2e4, + timeoutRetry: { + maxNumRetry: 2, + retryDelayMs: 0, + maxRetryDelayMs: 0, + }, + errorRetry: { + maxNumRetry: 2, + retryDelayMs: 1e3, + maxRetryDelayMs: 8e3, + }, + }, + }, + fragLoadPolicy: { + default: { + maxTimeToFirstByteMs: 1e4, + maxLoadTimeMs: 12e4, + timeoutRetry: { + maxNumRetry: 4, + retryDelayMs: 0, + maxRetryDelayMs: 0, + }, + errorRetry: { + maxNumRetry: 6, + retryDelayMs: 1e3, + maxRetryDelayMs: 8e3, + }, + }, + }, + steeringManifestLoadPolicy: { + default: { + maxTimeToFirstByteMs: 1e4, + maxLoadTimeMs: 2e4, + timeoutRetry: { + maxNumRetry: 2, + retryDelayMs: 0, + maxRetryDelayMs: 0, + }, + errorRetry: { + maxNumRetry: 1, + retryDelayMs: 1e3, + maxRetryDelayMs: 8e3, + }, + }, + }, + manifestLoadingTimeOut: 1e4, + manifestLoadingMaxRetry: 1, + manifestLoadingRetryDelay: 1e3, + manifestLoadingMaxRetryTimeout: 64e3, + levelLoadingTimeOut: 1e4, + levelLoadingMaxRetry: 4, + levelLoadingRetryDelay: 1e3, + levelLoadingMaxRetryTimeout: 64e3, + fragLoadingTimeOut: 2e4, + fragLoadingMaxRetry: 6, + fragLoadingRetryDelay: 1e3, + fragLoadingMaxRetryTimeout: 64e3, + }, + qf() + ), + {}, + { + subtitleStreamController: nf, + subtitleTrackController: sf, + timelineController: If, + audioStreamController: Jd, + audioTrackController: ef, + emeController: mi, + cmcdController: Ft, + contentSteeringController: Ff, + } + ); + function qf() { + return { + cueHandler: zf, + enableWebVTT: !0, + enableIMSC1: !0, + enableCEA708Captions: !0, + captionsTextTrack1Label: "English", + captionsTextTrack1LanguageCode: "en", + captionsTextTrack2Label: "Spanish", + captionsTextTrack2LanguageCode: "es", + captionsTextTrack3Label: "Unknown CC", + captionsTextTrack3LanguageCode: "", + captionsTextTrack4Label: "Unknown CC", + captionsTextTrack4LanguageCode: "", + renderTextTracksNatively: !0, + }; + } + function Xf(s, e) { + if ( + (e.liveSyncDurationCount || e.liveMaxLatencyDurationCount) && + (e.liveSyncDuration || e.liveMaxLatencyDuration) + ) + throw new Error( + "Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration" + ); + if ( + e.liveMaxLatencyDurationCount !== void 0 && + (e.liveSyncDurationCount === void 0 || + e.liveMaxLatencyDurationCount <= e.liveSyncDurationCount) + ) + throw new Error( + 'Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"' + ); + if ( + e.liveMaxLatencyDuration !== void 0 && + (e.liveSyncDuration === void 0 || + e.liveMaxLatencyDuration <= e.liveSyncDuration) + ) + throw new Error( + 'Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"' + ); + const t = Ur(s), + i = ["manifest", "level", "frag"], + n = ["TimeOut", "MaxRetry", "RetryDelay", "MaxRetryTimeout"]; + return ( + i.forEach((r) => { + const a = `${r === "level" ? "playlist" : r}LoadPolicy`, + o = e[a] === void 0, + l = []; + n.forEach((u) => { + const c = `${r}Loading${u}`, + d = e[c]; + if (d !== void 0 && o) { + l.push(c); + const f = t[a].default; + switch (((e[a] = { default: f }), u)) { + case "TimeOut": + (f.maxLoadTimeMs = d), (f.maxTimeToFirstByteMs = d); + break; + case "MaxRetry": + (f.errorRetry.maxNumRetry = d), + (f.timeoutRetry.maxNumRetry = d); + break; + case "RetryDelay": + (f.errorRetry.retryDelayMs = d), + (f.timeoutRetry.retryDelayMs = d); + break; + case "MaxRetryTimeout": + (f.errorRetry.maxRetryDelayMs = d), + (f.timeoutRetry.maxRetryDelayMs = d); + break; + } + } + }), + l.length && + D.warn( + `hls.js config: "${l.join( + '", "' + )}" setting(s) are deprecated, use "${a}": ${JSON.stringify( + e[a] + )}` + ); + }), + We(We({}, t), e) + ); + } + function Ur(s) { + return s && typeof s == "object" + ? Array.isArray(s) + ? s.map(Ur) + : Object.keys(s).reduce((e, t) => ((e[t] = Ur(s[t])), e), {}) + : s; + } + function Zf(s) { + const e = s.loader; + e !== jo && e !== Wo + ? (D.log( + "[config]: Custom loader detected, cannot enable progressive streaming" + ), + (s.progressive = !1)) + : Bf() && + ((s.loader = jo), + (s.progressive = !0), + (s.enableSoftwareAES = !0), + D.log("[config]: Progressive streaming enabled, using FetchLoader")); + } + class pe { + static get version() { + return "1.4.10"; + } + static isSupported() { + return ld(); + } + static get Events() { + return y; + } + static get ErrorTypes() { + return re; + } + static get ErrorDetails() { + return $; + } + static get DefaultConfig() { + return pe.defaultConfig ? pe.defaultConfig : jf; + } + static set DefaultConfig(e) { + pe.defaultConfig = e; + } + constructor(e = {}) { + (this.config = void 0), + (this.userConfig = void 0), + (this.coreComponents = void 0), + (this.networkControllers = void 0), + (this._emitter = new kr()), + (this._autoLevelCapping = void 0), + (this._maxHdcpLevel = null), + (this.abrController = void 0), + (this.bufferController = void 0), + (this.capLevelController = void 0), + (this.latencyController = void 0), + (this.levelController = void 0), + (this.streamController = void 0), + (this.audioTrackController = void 0), + (this.subtitleTrackController = void 0), + (this.emeController = void 0), + (this.cmcdController = void 0), + (this._media = null), + (this.url = null), + Oc(e.debug || !1, "Hls instance"); + const t = (this.config = Xf(pe.DefaultConfig, e)); + (this.userConfig = e), + (this._autoLevelCapping = -1), + t.progressive && Zf(t); + const { + abrController: i, + bufferController: n, + capLevelController: r, + errorController: a, + fpsController: o, + } = t, + l = new a(this), + u = (this.abrController = new i(this)), + c = (this.bufferController = new n(this)), + d = (this.capLevelController = new r(this)), + f = new o(this), + g = new kh(this), + p = new Ih(this), + v = t.contentSteeringController, + T = v ? new v(this) : null, + x = (this.levelController = new Yh(this, T)), + I = new zh(this), + L = new jh(this.config), + M = (this.streamController = new qd(this, I, L)); + d.setStreamController(M), f.setStreamController(M); + const O = [g, x, M]; + T && O.splice(1, 0, T), (this.networkControllers = O); + const j = [u, c, d, f, p, I]; + this.audioTrackController = this.createController( + t.audioTrackController, + O + ); + const U = t.audioStreamController; + U && O.push(new U(this, I, L)), + (this.subtitleTrackController = this.createController( + t.subtitleTrackController, + O + )); + const Y = t.subtitleStreamController; + Y && O.push(new Y(this, I, L)), + this.createController(t.timelineController, j), + (L.emeController = this.emeController = + this.createController(t.emeController, j)), + (this.cmcdController = this.createController(t.cmcdController, j)), + (this.latencyController = this.createController(Rh, j)), + (this.coreComponents = j), + O.push(l); + const _ = l.onErrorOut; + typeof _ == "function" && this.on(y.ERROR, _, l); + } + createController(e, t) { + if (e) { + const i = new e(this); + return t && t.push(i), i; + } + return null; + } + on(e, t, i = this) { + this._emitter.on(e, t, i); + } + once(e, t, i = this) { + this._emitter.once(e, t, i); + } + removeAllListeners(e) { + this._emitter.removeAllListeners(e); + } + off(e, t, i = this, n) { + this._emitter.off(e, t, i, n); + } + listeners(e) { + return this._emitter.listeners(e); + } + emit(e, t, i) { + return this._emitter.emit(e, t, i); + } + trigger(e, t) { + if (this.config.debug) return this.emit(e, e, t); + try { + return this.emit(e, e, t); + } catch (i) { + D.error( + "An internal error happened while handling event " + + e + + '. Error message: "' + + i.message + + '". Here is a stacktrace:', + i + ), + this.trigger(y.ERROR, { + type: re.OTHER_ERROR, + details: $.INTERNAL_EXCEPTION, + fatal: !1, + event: e, + error: i, + }); + } + return !1; + } + listenerCount(e) { + return this._emitter.listenerCount(e); + } + destroy() { + D.log("destroy"), + this.trigger(y.DESTROYING, void 0), + this.detachMedia(), + this.removeAllListeners(), + (this._autoLevelCapping = -1), + (this.url = null), + this.networkControllers.forEach((t) => t.destroy()), + (this.networkControllers.length = 0), + this.coreComponents.forEach((t) => t.destroy()), + (this.coreComponents.length = 0); + const e = this.config; + (e.xhrSetup = e.fetchSetup = void 0), (this.userConfig = null); + } + attachMedia(e) { + D.log("attachMedia"), + (this._media = e), + this.trigger(y.MEDIA_ATTACHING, { media: e }); + } + detachMedia() { + D.log("detachMedia"), + this.trigger(y.MEDIA_DETACHING, void 0), + (this._media = null); + } + loadSource(e) { + this.stopLoad(); + const t = this.media, + i = this.url, + n = (this.url = Yn.buildAbsoluteURL(self.location.href, e, { + alwaysNormalize: !0, + })); + D.log(`loadSource:${n}`), + t && + i && + (i !== n || this.bufferController.hasSourceTypes()) && + (this.detachMedia(), this.attachMedia(t)), + this.trigger(y.MANIFEST_LOADING, { url: e }); + } + startLoad(e = -1) { + D.log(`startLoad(${e})`), + this.networkControllers.forEach((t) => { + t.startLoad(e); + }); + } + stopLoad() { + D.log("stopLoad"), + this.networkControllers.forEach((e) => { + e.stopLoad(); + }); + } + swapAudioCodec() { + D.log("swapAudioCodec"), this.streamController.swapAudioCodec(); + } + recoverMediaError() { + D.log("recoverMediaError"); + const e = this._media; + this.detachMedia(), e && this.attachMedia(e); + } + removeLevel(e, t = 0) { + this.levelController.removeLevel(e, t); + } + get levels() { + const e = this.levelController.levels; + return e || []; + } + get currentLevel() { + return this.streamController.currentLevel; + } + set currentLevel(e) { + D.log(`set currentLevel:${e}`), + (this.loadLevel = e), + this.abrController.clearTimer(), + this.streamController.immediateLevelSwitch(); + } + get nextLevel() { + return this.streamController.nextLevel; + } + set nextLevel(e) { + D.log(`set nextLevel:${e}`), + (this.levelController.manualLevel = e), + this.streamController.nextLevelSwitch(); + } + get loadLevel() { + return this.levelController.level; + } + set loadLevel(e) { + D.log(`set loadLevel:${e}`), (this.levelController.manualLevel = e); + } + get nextLoadLevel() { + return this.levelController.nextLoadLevel; + } + set nextLoadLevel(e) { + this.levelController.nextLoadLevel = e; + } + get firstLevel() { + return Math.max(this.levelController.firstLevel, this.minAutoLevel); + } + set firstLevel(e) { + D.log(`set firstLevel:${e}`), (this.levelController.firstLevel = e); + } + get startLevel() { + return this.levelController.startLevel; + } + set startLevel(e) { + D.log(`set startLevel:${e}`), + e !== -1 && (e = Math.max(e, this.minAutoLevel)), + (this.levelController.startLevel = e); + } + get capLevelToPlayerSize() { + return this.config.capLevelToPlayerSize; + } + set capLevelToPlayerSize(e) { + const t = !!e; + t !== this.config.capLevelToPlayerSize && + (t + ? this.capLevelController.startCapping() + : (this.capLevelController.stopCapping(), + (this.autoLevelCapping = -1), + this.streamController.nextLevelSwitch()), + (this.config.capLevelToPlayerSize = t)); + } + get autoLevelCapping() { + return this._autoLevelCapping; + } + get bandwidthEstimate() { + const { bwEstimator: e } = this.abrController; + return e ? e.getEstimate() : NaN; + } + get ttfbEstimate() { + const { bwEstimator: e } = this.abrController; + return e ? e.getEstimateTTFB() : NaN; + } + set autoLevelCapping(e) { + this._autoLevelCapping !== e && + (D.log(`set autoLevelCapping:${e}`), (this._autoLevelCapping = e)); + } + get maxHdcpLevel() { + return this._maxHdcpLevel; + } + set maxHdcpLevel(e) { + sr.indexOf(e) > -1 && (this._maxHdcpLevel = e); + } + get autoLevelEnabled() { + return this.levelController.manualLevel === -1; + } + get manualLevel() { + return this.levelController.manualLevel; + } + get minAutoLevel() { + const { + levels: e, + config: { minAutoBitrate: t }, + } = this; + if (!e) return 0; + const i = e.length; + for (let n = 0; n < i; n++) if (e[n].maxBitrate >= t) return n; + return 0; + } + get maxAutoLevel() { + const { levels: e, autoLevelCapping: t, maxHdcpLevel: i } = this; + let n; + if ((t === -1 && e && e.length ? (n = e.length - 1) : (n = t), i)) + for (let r = n; r--; ) { + const a = e[r].attrs["HDCP-LEVEL"]; + if (a && a <= i) return r; + } + return n; + } + get nextAutoLevel() { + return Math.min( + Math.max(this.abrController.nextAutoLevel, this.minAutoLevel), + this.maxAutoLevel + ); + } + set nextAutoLevel(e) { + this.abrController.nextAutoLevel = Math.max(this.minAutoLevel, e); + } + get playingDate() { + return this.streamController.currentProgramDateTime; + } + get mainForwardBufferInfo() { + return this.streamController.getMainFwdBufferInfo(); + } + get audioTracks() { + const e = this.audioTrackController; + return e ? e.audioTracks : []; + } + get audioTrack() { + const e = this.audioTrackController; + return e ? e.audioTrack : -1; + } + set audioTrack(e) { + const t = this.audioTrackController; + t && (t.audioTrack = e); + } + get subtitleTracks() { + const e = this.subtitleTrackController; + return e ? e.subtitleTracks : []; + } + get subtitleTrack() { + const e = this.subtitleTrackController; + return e ? e.subtitleTrack : -1; + } + get media() { + return this._media; + } + set subtitleTrack(e) { + const t = this.subtitleTrackController; + t && (t.subtitleTrack = e); + } + get subtitleDisplay() { + const e = this.subtitleTrackController; + return e ? e.subtitleDisplay : !1; + } + set subtitleDisplay(e) { + const t = this.subtitleTrackController; + t && (t.subtitleDisplay = e); + } + get lowLatencyMode() { + return this.config.lowLatencyMode; + } + set lowLatencyMode(e) { + this.config.lowLatencyMode = e; + } + get liveSyncPosition() { + return this.latencyController.liveSyncPosition; + } + get latency() { + return this.latencyController.latency; + } + get maxLatency() { + return this.latencyController.maxLatency; + } + get targetLatency() { + return this.latencyController.targetLatency; + } + get drift() { + return this.latencyController.drift; + } + get forceStartLoad() { + return this.streamController.forceStartLoad; + } + } + pe.defaultConfig = void 0; + var Qf = Ms.now, + Jf = Ms.listContainsIgnoreCase, + eg = -1, + tg = 16; + C.register("PLAYBACK_FRAGMENT_CHANGED"), + C.register("PLAYBACK_FRAGMENT_PARSING_METADATA"); + var qo = (function (s) { + mc(t, s); + var e = Ec(t); + function t() { + var i; + fc(this, t); + for (var n = arguments.length, r = new Array(n), a = 0; a < n; a++) + r[a] = arguments[a]; + return ( + (i = e.call.apply(e, [this].concat(r))), + (i.options.hlsPlayback = Gn( + Gn({}, i.defaultOptions), + i.options.hlsPlayback + )), + i._setInitialState(), + i + ); + } + return ( + gc( + t, + [ + { + key: "name", + get: function () { + return "hls"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "levels", + get: function () { + return this._levels || []; + }, + }, + { + key: "currentLevel", + get: function () { + return this._currentLevel === null || + this._currentLevel === void 0 + ? eg + : this._currentLevel; + }, + set: function (n) { + (this._currentLevel = n), + this.trigger(C.PLAYBACK_LEVEL_SWITCH_START), + this.options.playback.hlsUseNextLevel + ? (this._hls.nextLevel = this._currentLevel) + : (this._hls.currentLevel = this._currentLevel); + }, + }, + { + key: "isReady", + get: function () { + return this._isReadyState; + }, + }, + { + key: "_startTime", + get: function () { + return this._playbackType === he.LIVE && + this._playlistType !== "EVENT" + ? this._extrapolatedStartTime + : this._playableRegionStartTime; + }, + }, + { + key: "_now", + get: function () { + return Qf(); + }, + }, + { + key: "_extrapolatedStartTime", + get: function () { + if (!this._localStartTimeCorrelation) + return this._playableRegionStartTime; + var n = this._localStartTimeCorrelation, + r = this._now - n.local, + a = (n.remote + r) / 1e3; + return Math.min( + a, + this._playableRegionStartTime + this._extrapolatedWindowDuration + ); + }, + }, + { + key: "_extrapolatedEndTime", + get: function () { + var n = + this._playableRegionStartTime + this._playableRegionDuration; + if (!this._localEndTimeCorrelation) return n; + var r = this._localEndTimeCorrelation, + a = this._now - r.local, + o = (r.remote + a) / 1e3; + return Math.max( + n - this._extrapolatedWindowDuration, + Math.min(o, n) + ); + }, + }, + { + key: "_duration", + get: function () { + return this._extrapolatedEndTime - this._startTime; + }, + }, + { + key: "_extrapolatedWindowDuration", + get: function () { + return this._segmentTargetDuration === null + ? 0 + : this._extrapolatedWindowNumSegments * + this._segmentTargetDuration; + }, + }, + { + key: "bandwidthEstimate", + get: function () { + return this._hls && this._hls.bandwidthEstimate; + }, + }, + { + key: "defaultOptions", + get: function () { + return { preload: !0 }; + }, + }, + { + key: "customListeners", + get: function () { + return ( + (this.options.hlsPlayback && + this.options.hlsPlayback.customListeners) || + [] + ); + }, + }, + { + key: "sourceMedia", + get: function () { + return this.options.src; + }, + }, + { + key: "_setInitialState", + value: function () { + (this._minDvrSize = + typeof this.options.hlsMinimumDvrSize > "u" + ? 60 + : this.options.hlsMinimumDvrSize), + (this._extrapolatedWindowNumSegments = + !this.options.playback || + typeof this.options.playback.extrapolatedWindowNumSegments > + "u" + ? 2 + : this.options.playback.extrapolatedWindowNumSegments), + (this._playbackType = he.VOD), + (this._lastTimeUpdate = { current: 0, total: 0 }), + (this._lastDuration = null), + (this._playableRegionStartTime = 0), + (this._localStartTimeCorrelation = null), + (this._localEndTimeCorrelation = null), + (this._playableRegionDuration = 0), + (this._programDateTime = 0), + (this._durationExcludesAfterLiveSyncPoint = !1), + (this._segmentTargetDuration = null), + (this._playlistType = null), + (this._recoverAttemptsRemaining = + this.options.hlsRecoverAttempts || tg); + }, + }, + { + key: "_setup", + value: function () { + this._destroyHLSInstance(), + this._createHLSInstance(), + this._listenHLSEvents(), + this._attachHLSMedia(); + }, + }, + { + key: "_destroyHLSInstance", + value: function () { + this._hls && + ((this._manifestParsed = !1), + (this._ccIsSetup = !1), + (this._ccTracksUpdated = !1), + this._setInitialState(), + this._hls.destroy(), + (this._hls = null)); + }, + }, + { + key: "_createHLSInstance", + value: function () { + var n = Gn({}, this.options.playback.hlsjsConfig); + this._hls = new pe(n); + }, + }, + { + key: "_attachHLSMedia", + value: function () { + this._hls && this._hls.attachMedia(this.el); + }, + }, + { + key: "_listenHLSEvents", + value: function () { + var n = this; + this._hls && + (this._hls.once(pe.Events.MEDIA_ATTACHED, function () { + n.options.hlsPlayback.preload && + n._hls.loadSource(n.options.src); + }), + this._hls.on(pe.Events.MANIFEST_PARSED, function () { + return (n._manifestParsed = !0); + }), + this._hls.on(pe.Events.LEVEL_LOADED, function (r, a) { + return n._updatePlaybackType(r, a); + }), + this._hls.on(pe.Events.LEVEL_UPDATED, function (r, a) { + return n._onLevelUpdated(r, a); + }), + this._hls.on(pe.Events.LEVEL_SWITCHING, function (r, a) { + return n._onLevelSwitch(r, a); + }), + this._hls.on(pe.Events.FRAG_CHANGED, function (r, a) { + return n._onFragmentChanged(r, a); + }), + this._hls.on(pe.Events.FRAG_LOADED, function (r, a) { + return n._onFragmentLoaded(r, a); + }), + this._hls.on(pe.Events.FRAG_PARSING_METADATA, function (r, a) { + return n._onFragmentParsingMetadata(r, a); + }), + this._hls.on(pe.Events.ERROR, function (r, a) { + return n._onHLSJSError(r, a); + }), + this._hls.on(pe.Events.SUBTITLE_TRACK_LOADED, function (r, a) { + return n._onSubtitleLoaded(r, a); + }), + this._hls.on(pe.Events.SUBTITLE_TRACKS_UPDATED, function () { + return (n._ccTracksUpdated = !0); + }), + this.bindCustomListeners()); + }, + }, + { + key: "bindCustomListeners", + value: function () { + var n = this; + this.customListeners.forEach(function (r) { + var a = r.eventName, + o = r.once ? "once" : "on"; + a && n._hls["".concat(o)](a, r.callback); + }); + }, + }, + { + key: "unbindCustomListeners", + value: function () { + var n = this; + this.customListeners.forEach(function (r) { + var a = r.eventName; + a && n._hls.off(a, r.callback); + }); + }, + }, + { + key: "_onFragmentParsingMetadata", + value: function (n, r) { + this.trigger(C.Custom.PLAYBACK_FRAGMENT_PARSING_METADATA, { + evt: n, + data: r, + }); + }, + }, + { + key: "render", + value: function () { + return ( + this._ready(), Dt(dt(t.prototype), "render", this).call(this) + ); + }, + }, + { + key: "_ready", + value: function () { + this._isReadyState || + (!this._hls && this._setup(), + (this._isReadyState = !0), + this.trigger(C.PLAYBACK_READY, this.name)); + }, + }, + { + key: "_recover", + value: function (n, r, a) { + if (!this._recoveredDecodingError) + (this._recoveredDecodingError = !0), + this._hls.recoverMediaError(); + else if (!this._recoveredAudioCodecError) + (this._recoveredAudioCodecError = !0), + this._hls.swapAudioCodec(), + this._hls.recoverMediaError(); + else { + le.error("hlsjs: failed to recover", { evt: n, data: r }), + (a.level = Tt.Levels.FATAL); + var o = this.createError(a); + this.trigger(C.PLAYBACK_ERROR, o), this.stop(); + } + }, + }, + { key: "_setupSrc", value: function (n) {} }, + { + key: "_startTimeUpdateTimer", + value: function () { + var n = this; + this._timeUpdateTimer || + (this._timeUpdateTimer = setInterval(function () { + n._onDurationChange(), n._onTimeUpdate(); + }, 100)); + }, + }, + { + key: "_stopTimeUpdateTimer", + value: function () { + this._timeUpdateTimer && + (clearInterval(this._timeUpdateTimer), + (this._timeUpdateTimer = null)); + }, + }, + { + key: "getProgramDateTime", + value: function () { + return this._programDateTime; + }, + }, + { + key: "getDuration", + value: function () { + return this._duration; + }, + }, + { + key: "getCurrentTime", + value: function () { + return Math.max(0, this.el.currentTime - this._startTime); + }, + }, + { + key: "getStartTimeOffset", + value: function () { + return this._startTime; + }, + }, + { + key: "seekPercentage", + value: function (n) { + var r = n > 0 ? this._duration * (n / 100) : this._duration; + this.seek(r); + }, + }, + { + key: "seek", + value: function (n) { + n < 0 && + (le.warn( + "Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point." + ), + (n = this.getDuration())), + this.dvrEnabled && this._updateDvr(n < this.getDuration() - 3), + (n += this._startTime), + (this.el.currentTime = n); + }, + }, + { + key: "seekToLivePoint", + value: function () { + this.seek(this.getDuration()); + }, + }, + { + key: "_updateDvr", + value: function (n) { + this.trigger(C.PLAYBACK_DVR, n), + this.trigger(C.PLAYBACK_STATS_ADD, { dvr: n }); + }, + }, + { + key: "_updateSettings", + value: function () { + this._playbackType === he.VOD + ? (this.settings.left = ["playpause", "position", "duration"]) + : this.dvrEnabled + ? (this.settings.left = ["playpause"]) + : (this.settings.left = ["playstop"]), + (this.settings.seekEnabled = this.isSeekEnabled()), + this.trigger(C.PLAYBACK_SETTINGSUPDATE); + }, + }, + { + key: "_onHLSJSError", + value: function (n, r) { + var a = { + code: "".concat(r.type, "_").concat(r.details), + description: "" + .concat(this.name, " error: type: ") + .concat(r.type, ", details: ") + .concat(r.details), + raw: r, + }, + o; + if ( + (r.response && + (a.description += ", response: ".concat( + JSON.stringify(r.response) + )), + r.fatal) + ) + if (this._recoverAttemptsRemaining > 0) + switch (((this._recoverAttemptsRemaining -= 1), r.type)) { + case pe.ErrorTypes.NETWORK_ERROR: + switch (r.details) { + case pe.ErrorDetails.MANIFEST_LOAD_ERROR: + case pe.ErrorDetails.MANIFEST_LOAD_TIMEOUT: + case pe.ErrorDetails.MANIFEST_PARSING_ERROR: + case pe.ErrorDetails.LEVEL_LOAD_ERROR: + case pe.ErrorDetails.LEVEL_LOAD_TIMEOUT: + le.error( + "hlsjs: unrecoverable network fatal error.", + { evt: n, data: r } + ), + (o = this.createError(a)), + this.trigger(C.PLAYBACK_ERROR, o), + this.stop(); + break; + default: + le.warn( + "hlsjs: trying to recover from network error.", + { evt: n, data: r } + ), + (a.level = Tt.Levels.WARN), + this._hls.startLoad(); + break; + } + break; + case pe.ErrorTypes.MEDIA_ERROR: + le.warn("hlsjs: trying to recover from media error.", { + evt: n, + data: r, + }), + (a.level = Tt.Levels.WARN), + this._recover(n, r, a); + break; + default: + le.error("hlsjs: could not recover from error.", { + evt: n, + data: r, + }), + (o = this.createError(a)), + this.trigger(C.PLAYBACK_ERROR, o), + this.stop(); + break; + } + else + le.error( + "hlsjs: could not recover from error after maximum number of attempts.", + { evt: n, data: r } + ), + (o = this.createError(a)), + this.trigger(C.PLAYBACK_ERROR, o), + this.stop(); + else { + if ( + this.options.playback.triggerFatalErrorOnResourceDenied && + this._keyIsDenied(r) + ) { + le.error("hlsjs: could not load decrypt key.", { + evt: n, + data: r, + }), + (o = this.createError(a)), + this.trigger(C.PLAYBACK_ERROR, o), + this.stop(); + return; + } + (a.level = Tt.Levels.WARN), + le.warn("hlsjs: non-fatal error occurred", { + evt: n, + data: r, + }); + } + }, + }, + { + key: "_keyIsDenied", + value: function (n) { + return ( + n.type === pe.ErrorTypes.NETWORK_ERROR && + n.details === pe.ErrorDetails.KEY_LOAD_ERROR && + n.response && + n.response.code >= 400 + ); + }, + }, + { + key: "_onTimeUpdate", + value: function () { + var n = { + current: this.getCurrentTime(), + total: this.getDuration(), + firstFragDateTime: this.getProgramDateTime(), + }, + r = + this._lastTimeUpdate && + n.current === this._lastTimeUpdate.current && + n.total === this._lastTimeUpdate.total; + r || + ((this._lastTimeUpdate = n), + this.trigger(C.PLAYBACK_TIMEUPDATE, n, this.name)); + }, + }, + { + key: "_onDurationChange", + value: function () { + var n = this.getDuration(); + this._lastDuration !== n && + ((this._lastDuration = n), + Dt(dt(t.prototype), "_onDurationChange", this).call(this)); + }, + }, + { + key: "_onProgress", + value: function () { + if (this.el.buffered.length) { + for (var n = [], r = 0, a = 0; a < this.el.buffered.length; a++) + (n = [].concat(bc(n), [ + { + start: Math.max( + 0, + this.el.buffered.start(a) - + this._playableRegionStartTime + ), + end: Math.max( + 0, + this.el.buffered.end(a) - this._playableRegionStartTime + ), + }, + ])), + this.el.currentTime >= n[a].start && + this.el.currentTime <= n[a].end && + (r = a); + var o = { + start: n[r].start, + current: n[r].end, + total: this.getDuration(), + }; + this.trigger(C.PLAYBACK_PROGRESS, o, n); + } + }, + }, + { + key: "load", + value: function (n) { + this._stopTimeUpdateTimer(), + (this.options.src = n), + this._setup(); + }, + }, + { + key: "play", + value: function () { + !this._hls && this._setup(), + !this._manifestParsed && + !this.options.hlsPlayback.preload && + this._hls.loadSource(this.options.src), + Dt(dt(t.prototype), "play", this).call(this), + this._startTimeUpdateTimer(); + }, + }, + { + key: "pause", + value: function () { + this._hls && + (this.el.pause(), this.dvrEnabled && this._updateDvr(!0)); + }, + }, + { + key: "stop", + value: function () { + this._stopTimeUpdateTimer(), + this._hls && Dt(dt(t.prototype), "stop", this).call(this), + this._destroyHLSInstance(); + }, + }, + { + key: "destroy", + value: function () { + this._stopTimeUpdateTimer(), + this._destroyHLSInstance(), + Dt(dt(t.prototype), "destroy", this).call(this); + }, + }, + { + key: "_updatePlaybackType", + value: function (n, r) { + (this._playbackType = r.details.live ? he.LIVE : he.VOD), + this._onLevelUpdated(n, r), + this._ccTracksUpdated && + this._playbackType === he.LIVE && + this.hasClosedCaptionsTracks && + this._onSubtitleLoaded(); + }, + }, + { + key: "_fillLevels", + value: function () { + (this._levels = this._hls.levels.map(function (n, r) { + return { + id: r, + level: n, + label: "".concat(n.bitrate / 1e3, "Kbps"), + }; + })), + this.trigger(C.PLAYBACK_LEVELS_AVAILABLE, this._levels); + }, + }, + { + key: "_onLevelUpdated", + value: function (n, r) { + (this._segmentTargetDuration = r.details.targetduration), + (this._playlistType = r.details.type || null); + var a = !1, + o = !1, + l = r.details.fragments, + u = this._playableRegionStartTime, + c = this._playableRegionDuration; + if (l.length !== 0) { + if ( + (l[0].rawProgramDateTime && + (this._programDateTime = l[0].rawProgramDateTime), + this._playableRegionStartTime !== l[0].start && + ((a = !0), (this._playableRegionStartTime = l[0].start)), + a) + ) + if (!this._localStartTimeCorrelation) + this._localStartTimeCorrelation = { + local: this._now, + remote: + (l[0].start + this._extrapolatedWindowDuration / 2) * + 1e3, + }; + else { + var d = this._localStartTimeCorrelation, + f = this._now - d.local, + g = (d.remote + f) / 1e3; + g < l[0].start + ? (this._localStartTimeCorrelation = { + local: this._now, + remote: l[0].start * 1e3, + }) + : g > u + this._extrapolatedWindowDuration && + (this._localStartTimeCorrelation = { + local: this._now, + remote: + Math.max( + l[0].start, + u + this._extrapolatedWindowDuration + ) * 1e3, + }); + } + var p = r.details.totalduration; + if (this._playbackType === he.LIVE) { + var v = r.details.targetduration, + T = this.options.playback.hlsjsConfig || {}, + x = + T.liveSyncDurationCount || + pe.DefaultConfig.liveSyncDurationCount, + I = v * x; + I <= p + ? ((p -= I), + (this._durationExcludesAfterLiveSyncPoint = !0)) + : (this._durationExcludesAfterLiveSyncPoint = !1); + } + p !== this._playableRegionDuration && + ((o = !0), (this._playableRegionDuration = p)); + var L = l[0].start + p, + M = u + c, + O = L !== M; + if (O) + if (!this._localEndTimeCorrelation) + this._localEndTimeCorrelation = { + local: this._now, + remote: L * 1e3, + }; + else { + var j = this._localEndTimeCorrelation, + U = this._now - j.local, + Y = (j.remote + U) / 1e3; + Y > L + ? (this._localEndTimeCorrelation = { + local: this._now, + remote: L * 1e3, + }) + : Y < L - this._extrapolatedWindowDuration + ? (this._localEndTimeCorrelation = { + local: this._now, + remote: (L - this._extrapolatedWindowDuration) * 1e3, + }) + : Y > M && + (this._localEndTimeCorrelation = { + local: this._now, + remote: M * 1e3, + }); + } + o && this._onDurationChange(), a && this._onProgress(); + } + }, + }, + { + key: "_onFragmentChanged", + value: function (n, r) { + this.trigger(C.Custom.PLAYBACK_FRAGMENT_CHANGED, r); + }, + }, + { + key: "_onFragmentLoaded", + value: function (n, r) { + this.trigger(C.PLAYBACK_FRAGMENT_LOADED, r); + }, + }, + { + key: "_onSubtitleLoaded", + value: function () { + if (!this._ccIsSetup) { + this.trigger(C.PLAYBACK_SUBTITLE_AVAILABLE); + var n = + this._playbackType === he.LIVE + ? -1 + : this.closedCaptionsTrackId; + (this.closedCaptionsTrackId = n), (this._ccIsSetup = !0); + } + }, + }, + { + key: "_onLevelSwitch", + value: function (n, r) { + this.levels.length || this._fillLevels(), + this.trigger(C.PLAYBACK_LEVEL_SWITCH_END), + this.trigger(C.PLAYBACK_LEVEL_SWITCH, r); + var a = this._hls.levels[r.level]; + a && + ((this.highDefinition = + a.height >= 720 || a.bitrate / 1e3 >= 2e3), + this.trigger( + C.PLAYBACK_HIGHDEFINITIONUPDATE, + this.highDefinition + ), + this.trigger(C.PLAYBACK_BITRATE, { + height: a.height, + width: a.width, + bandwidth: a.bitrate, + bitrate: a.bitrate, + level: r.level, + })); + }, + }, + { + key: "dvrEnabled", + get: function () { + return ( + this._durationExcludesAfterLiveSyncPoint && + this._duration >= this._minDvrSize && + this.getPlaybackType() === he.LIVE + ); + }, + }, + { + key: "getPlaybackType", + value: function () { + return this._playbackType; + }, + }, + { + key: "isSeekEnabled", + value: function () { + return this._playbackType === he.VOD || this.dvrEnabled; + }, + }, + ], + [ + { + key: "HLSJS", + get: function () { + return pe; + }, + }, + ] + ), + t + ); + })(ht); + qo.canPlay = function (s, e) { + var t = s.split("?")[0].match(/.*\.(.*)$/) || [], + i = + (t.length > 1 && t[1].toLowerCase() === "m3u8") || + Jf(e, ["application/vnd.apple.mpegurl", "application/x-mpegURL"]); + return !!(pe.isSupported() && i); + }; + function ig(s) { + if (s === void 0) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return s; + } + function Qe(s, e, t) { + return ( + (e = Ai(e)), + Zo( + s, + Xo() ? Reflect.construct(e, t || [], Ai(s).constructor) : e.apply(s, t) + ) + ); + } + function Je(s, e) { + if (!(s instanceof e)) + throw new TypeError("Cannot call a class as a function"); + } + function ng(s, e) { + for (var t = 0; t < e.length; t++) { + var i = e[t]; + (i.enumerable = i.enumerable || !1), + (i.configurable = !0), + "value" in i && (i.writable = !0), + Object.defineProperty(s, ag(i.key), i); + } + } + function et(s, e, t) { + return ( + e && ng(s.prototype, e), + Object.defineProperty(s, "prototype", { writable: !1 }), + s + ); + } + function $r() { + return ( + ($r = + typeof Reflect < "u" && Reflect.get + ? Reflect.get.bind() + : function (s, e, t) { + var i = rg(s, e); + if (i) { + var n = Object.getOwnPropertyDescriptor(i, e); + return n.get + ? n.get.call(arguments.length < 3 ? s : t) + : n.value; + } + }), + $r.apply(null, arguments) + ); + } + function Ai(s) { + return ( + (Ai = Object.setPrototypeOf + ? Object.getPrototypeOf.bind() + : function (e) { + return e.__proto__ || Object.getPrototypeOf(e); + }), + Ai(s) + ); + } + function tt(s, e) { + if (typeof e != "function" && e !== null) + throw new TypeError("Super expression must either be null or a function"); + (s.prototype = Object.create(e && e.prototype, { + constructor: { value: s, writable: !0, configurable: !0 }, + })), + Object.defineProperty(s, "prototype", { writable: !1 }), + e && Vr(s, e); + } + function Xo() { + try { + var s = !Boolean.prototype.valueOf.call( + Reflect.construct(Boolean, [], function () {}) + ); + } catch {} + return (Xo = function () { + return !!s; + })(); + } + function Zo(s, e) { + if (e && (typeof e == "object" || typeof e == "function")) return e; + if (e !== void 0) + throw new TypeError( + "Derived constructors may only return object or undefined" + ); + return ig(s); + } + function Vr(s, e) { + return ( + (Vr = Object.setPrototypeOf + ? Object.setPrototypeOf.bind() + : function (t, i) { + return (t.__proto__ = i), t; + }), + Vr(s, e) + ); + } + function rg(s, e) { + for (; !{}.hasOwnProperty.call(s, e) && (s = Ai(s)) !== null; ); + return s; + } + function Gr(s, e, t, i) { + var n = $r(Ai(s.prototype), e, t); + return typeof n == "function" + ? function (r) { + return n.apply(t, r); + } + : n; + } + function sg(s, e) { + if (typeof s != "object" || !s) return s; + var t = s[Symbol.toPrimitive]; + if (t !== void 0) { + var i = t.call(s, e); + if (typeof i != "object") return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return String(s); + } + function ag(s) { + var e = sg(s, "string"); + return typeof e == "symbol" ? e : e + ""; + } + function Kr(s) { + "@babel/helpers - typeof"; + return ( + (Kr = + typeof Symbol == "function" && typeof Symbol.iterator == "symbol" + ? function (e) { + return typeof e; + } + : function (e) { + return e && + typeof Symbol == "function" && + e.constructor === Symbol && + e !== Symbol.prototype + ? "symbol" + : typeof e; + }), + Kr(s) + ); + } + var og = (function (s) { + function e(t) { + return Je(this, e), Qe(this, e, [t]); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "click_to_pause"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "config", + get: function () { + return this.container.options.clickToPauseConfig || {}; + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo(this.container, A.CONTAINER_CLICK, this.click), + this.listenTo( + this.container, + A.CONTAINER_SETTINGSUPDATE, + this.settingsUpdate + ); + }, + }, + { + key: "click", + value: function () { + var i = this.config.onClickPayload; + (this.container.getPlaybackType() !== ge.LIVE || + this.container.isDvrEnabled()) && + (this.container.isPlaying() + ? this.container.pause(i) + : this.container.play(i)); + }, + }, + { + key: "settingsUpdate", + value: function () { + var i = + this.container.getPlaybackType() !== ge.LIVE || + this.container.isDvrEnabled(); + if (i !== this.pointerEnabled) { + var n = i ? "addClass" : "removeClass"; + this.container.$el[n]("pointer-enabled"), + (this.pointerEnabled = i); + } + }, + }, + ]) + ); + })(yt), + lg = `<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 49 41.8" style="enable-background:new 0 0 49 41.8;" xml:space="preserve"> +<path d="M47.1,0H3.2C1.6,0,0,1.2,0,2.8v31.5C0,35.9,1.6,37,3.2,37h11.9l3.2,1.9l4.7,2.7c0.9,0.5,2-0.1,2-1.1V37h22.1 + c1.6,0,1.9-1.1,1.9-2.7V2.8C49,1.2,48.7,0,47.1,0z M7.2,18.6c0-4.8,3.5-9.3,9.9-9.3c4.8,0,7.1,2.7,7.1,2.7l-2.5,4 + c0,0-1.7-1.7-4.2-1.7c-2.8,0-4.3,2.1-4.3,4.3c0,2.1,1.5,4.4,4.5,4.4c2.5,0,4.9-2.1,4.9-2.1l2.2,4.2c0,0-2.7,2.9-7.6,2.9 + C10.8,27.9,7.2,23.5,7.2,18.6z M36.9,27.9c-6.4,0-9.9-4.4-9.9-9.3c0-4.8,3.5-9.3,9.9-9.3C41.7,9.3,44,12,44,12l-2.5,4 + c0,0-1.7-1.7-4.2-1.7c-2.8,0-4.3,2.1-4.3,4.3c0,2.1,1.5,4.4,4.5,4.4c2.5,0,4.9-2.1,4.9-2.1l2.2,4.2C44.5,25,41.9,27.9,36.9,27.9z"/> +</svg>`, + ug = `<button type="button" class="cc-button media-control-button media-control-icon" data-cc-button aria-label="<%= ariaLabel %>"></button> +<ul> + <% if (title) { %> + <li data-title><%= title %></li> + <% }; %> + <li><a href="#" data-cc-select="-1"><%= disabledLabel %></a></li> + <% for (var i = 0; i < tracks.length; i++) { %> + <li><a href="#" data-cc-select="<%= tracks[i].id %>"><%= tracks[i].label %></a></li> + <% }; %> +</ul> +`, + cg = `.cc-controls[data-cc-controls] { + float: right; + position: relative; + display: none; } + .cc-controls[data-cc-controls].available { + display: block; } + .cc-controls[data-cc-controls] .cc-button { + padding: 6px !important; } + .cc-controls[data-cc-controls] .cc-button.enabled { + display: block; + opacity: 1.0; } + .cc-controls[data-cc-controls] .cc-button.enabled:hover { + opacity: 1.0; + text-shadow: none; } + .cc-controls[data-cc-controls] > ul { + list-style-type: none; + position: absolute; + bottom: 25px; + border: 1px solid black; + display: none; + background-color: #e6e6e6; } + .cc-controls[data-cc-controls] li { + font-size: 10px; } + .cc-controls[data-cc-controls] li[data-title] { + background-color: #c3c2c2; + padding: 5px; } + .cc-controls[data-cc-controls] li a { + color: #444; + padding: 2px 10px; + display: block; + text-decoration: none; } + .cc-controls[data-cc-controls] li a:hover { + background-color: #555; + color: white; } + .cc-controls[data-cc-controls] li a:hover a { + color: white; + text-decoration: none; } + .cc-controls[data-cc-controls] li.current a { + color: #f00; } +`, + hg = (function (s) { + function e(t) { + var i; + Je(this, e), (i = Qe(this, e, [t])); + var n = t.options.closedCaptionsConfig; + return ( + (i._title = n && n.title ? n.title : null), + (i._ariaLabel = n && n.ariaLabel ? n.ariaLabel : "cc-button"), + (i._labelCb = + n && n.labelCallback && typeof n.labelCallback == "function" + ? n.labelCallback + : function (r) { + return r.name; + }), + i + ); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "closed_captions"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "template", + get: function () { + return He(ug); + }, + }, + { + key: "events", + get: function () { + return { + "click [data-cc-button]": "toggleContextMenu", + "click [data-cc-select]": "onTrackSelect", + }; + }, + }, + { + key: "attributes", + get: function () { + return { class: "cc-controls", "data-cc-controls": "" }; + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo( + this.core, + A.CORE_ACTIVE_CONTAINER_CHANGED, + this.containerChanged + ), + this.listenTo( + this.core.mediaControl, + A.MEDIACONTROL_RENDERED, + this.render + ), + this.listenTo( + this.core.mediaControl, + A.MEDIACONTROL_HIDE, + this.hideContextMenu + ), + this.bindContainerEvents(); + }, + }, + { + key: "bindContainerEvents", + value: function () { + (this.container = this.core.activeContainer), + this.container && + (this.listenTo( + this.container, + A.CONTAINER_SUBTITLE_AVAILABLE, + this.onSubtitleAvailable + ), + this.listenTo( + this.container, + A.CONTAINER_SUBTITLE_CHANGED, + this.onSubtitleChanged + ), + this.listenTo( + this.container, + A.CONTAINER_STOP, + this.onContainerStop + )); + }, + }, + { + key: "onContainerStop", + value: function () { + this.ccAvailable(!1); + }, + }, + { + key: "containerChanged", + value: function () { + this.ccAvailable(!1), this.stopListening(), this.bindEvents(); + }, + }, + { + key: "onSubtitleAvailable", + value: function () { + this.renderCcButton(), this.ccAvailable(!0); + }, + }, + { + key: "onSubtitleChanged", + value: function (i) { + this.setCurrentContextMenuElement(i.id); + }, + }, + { + key: "onTrackSelect", + value: function (i) { + var n = parseInt(i.target.dataset.ccSelect, 10); + return ( + (this.container.closedCaptionsTrackId = n), + this.hideContextMenu(), + i.stopPropagation(), + !1 + ); + }, + }, + { + key: "ccAvailable", + value: function (i) { + var n = i ? "addClass" : "removeClass"; + this.$el[n]("available"); + }, + }, + { + key: "toggleContextMenu", + value: function () { + this.$el.find("ul").toggle(); + }, + }, + { + key: "hideContextMenu", + value: function () { + this.$el.find("ul").hide(); + }, + }, + { + key: "contextMenuElement", + value: function (i) { + return this.$el + .find("ul a" + (isNaN(i) ? "" : '[data-cc-select="' + i + '"]')) + .parent(); + }, + }, + { + key: "setCurrentContextMenuElement", + value: function (i) { + if (this._trackId !== i) { + this.contextMenuElement().removeClass("current"), + this.contextMenuElement(i).addClass("current"); + var n = i > -1 ? "addClass" : "removeClass"; + this.$ccButton[n]("enabled"), (this._trackId = i); + } + }, + }, + { + key: "renderCcButton", + value: function () { + for ( + var i = this.container + ? this.container.closedCaptionsTracks + : [], + n = 0; + n < i.length; + n++ + ) + i[n].label = this._labelCb(i[n]); + var r = Ue.getStyleFor(cg, { baseUrl: this.options.baseUrl }); + this.$el.html( + this.template({ + ariaLabel: this._ariaLabel, + disabledLabel: this.core.i18n.t("disabled"), + title: this._title, + tracks: i, + }) + ), + (this.$ccButton = this.$el.find( + "button.cc-button[data-cc-button]" + )), + this.$ccButton.append(lg), + this.$el.append(r[0]); + }, + }, + { + key: "render", + value: function () { + this.renderCcButton(); + var i = this.core.mediaControl.$el.find( + "button[data-fullscreen]" + ); + return ( + i[0] + ? this.$el.insertAfter(i) + : this.core.mediaControl.$el + .find(".media-control-right-panel[data-media-control]") + .prepend(this.$el), + this + ); + }, + }, + ]) + ); + })(Ze), + dg = `<div class="live-info"><%= live %></div> +<button type="button" class="live-button" aria-label="<%= backToLive %>"><%= backToLive %></button> +`, + fg = `.dvr-controls[data-dvr-controls] { + display: inline-block; + float: left; + color: #fff; + line-height: 32px; + font-size: 10px; + font-weight: bold; + margin-left: 6px; } + .dvr-controls[data-dvr-controls] .live-info { + cursor: default; + font-family: "Roboto", "Open Sans", Arial, sans-serif; + text-transform: uppercase; } + .dvr-controls[data-dvr-controls] .live-info:before { + content: ""; + display: inline-block; + position: relative; + width: 7px; + height: 7px; + border-radius: 3.5px; + margin-right: 3.5px; + background-color: #ff0101; } + .dvr-controls[data-dvr-controls] .live-info.disabled { + opacity: 0.3; } + .dvr-controls[data-dvr-controls] .live-info.disabled:before { + background-color: #fff; } + .dvr-controls[data-dvr-controls] .live-button { + cursor: pointer; + outline: none; + display: none; + border: 0; + color: #fff; + background-color: transparent; + height: 32px; + padding: 0; + opacity: 0.7; + font-family: "Roboto", "Open Sans", Arial, sans-serif; + text-transform: uppercase; + transition: all 0.1s ease; } + .dvr-controls[data-dvr-controls] .live-button:before { + content: ""; + display: inline-block; + position: relative; + width: 7px; + height: 7px; + border-radius: 3.5px; + margin-right: 3.5px; + background-color: #fff; } + .dvr-controls[data-dvr-controls] .live-button:hover { + opacity: 1; + text-shadow: rgba(255, 255, 255, 0.75) 0 0 5px; } + +.dvr .dvr-controls[data-dvr-controls] .live-info { + display: none; } + +.dvr .dvr-controls[data-dvr-controls] .live-button { + display: block; } + +.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] { + background-color: #005aff; } + +.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar] { + background-color: #ff0101; } +`, + gg = (function (s) { + function e(t) { + var i; + return Je(this, e), (i = Qe(this, e, [t])), i.settingsUpdate(), i; + } + return ( + tt(e, s), + et(e, [ + { + key: "template", + get: function () { + return He(dg); + }, + }, + { + key: "name", + get: function () { + return "dvr_controls"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "events", + get: function () { + return { "click .live-button": "click" }; + }, + }, + { + key: "attributes", + get: function () { + return { class: "dvr-controls", "data-dvr-controls": "" }; + }, + }, + { + key: "bindEvents", + value: function () { + this.bindCoreEvents(), this.bindContainerEvents(); + }, + }, + { + key: "bindCoreEvents", + value: function () { + var i = this; + this.core.mediaControl.settings + ? (this.listenTo( + this.core.mediaControl, + A.MEDIACONTROL_CONTAINERCHANGED, + this.containerChanged + ), + this.listenTo( + this.core.mediaControl, + A.MEDIACONTROL_RENDERED, + this.settingsUpdate + ), + this.listenTo(this.core, A.CORE_OPTIONS_CHANGE, this.render)) + : setTimeout(function () { + return i.bindCoreEvents(); + }, 100); + }, + }, + { + key: "bindContainerEvents", + value: function () { + this.core.activeContainer && + (this.listenToOnce( + this.core.activeContainer, + A.CONTAINER_TIMEUPDATE, + this.render + ), + this.listenTo( + this.core.activeContainer, + A.CONTAINER_PLAYBACKDVRSTATECHANGED, + this.dvrChanged + )); + }, + }, + { + key: "containerChanged", + value: function () { + this.stopListening(), this.bindEvents(); + }, + }, + { + key: "dvrChanged", + value: function (i) { + this.core.getPlaybackType() === ge.LIVE && + (this.settingsUpdate(), + this.core.mediaControl.$el.addClass("live"), + i + ? (this.core.mediaControl.$el.addClass("dvr"), + this.core.mediaControl.$el + .find( + ".media-control-indicator[data-position], .media-control-indicator[data-duration]" + ) + .hide()) + : this.core.mediaControl.$el.removeClass("dvr")); + }, + }, + { + key: "click", + value: function () { + var i = this.core.mediaControl, + n = i.container; + n.isPlaying() || n.play(), + i.$el.hasClass("dvr") && n.seek(n.getDuration()); + }, + }, + { + key: "settingsUpdate", + value: function () { + var i = this; + this.stopListening(), + this.core.mediaControl.$el.removeClass("live"), + this.shouldRender() && + (this.render(), + this.$el.click(function () { + return i.click(); + })), + this.bindEvents(); + }, + }, + { + key: "shouldRender", + value: function () { + var i = + this.core.options.useDvrControls === void 0 || + !!this.core.options.useDvrControls; + return i && this.core.getPlaybackType() === ge.LIVE; + }, + }, + { + key: "render", + value: function () { + var i = Ue.getStyleFor(fg, { baseUrl: this.options.baseUrl }); + return ( + this.$el.html( + this.template({ + live: this.core.i18n.t("live"), + backToLive: this.core.i18n.t("back_to_live"), + }) + ), + this.$el.append(i[0]), + this.shouldRender() && + (this.core.mediaControl.$el.addClass("live"), + this.core.mediaControl + .$(".media-control-left-panel[data-media-control]") + .append(this.$el)), + this + ); + }, + }, + ]) + ); + })(Ze), + pg = (function (s) { + function e() { + return Je(this, e), Qe(this, e, arguments); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "end_video"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo( + this.core, + A.CORE_ACTIVE_CONTAINER_CHANGED, + this.containerChanged + ); + var i = this.core.activeContainer; + i && + (this.listenTo(i, A.CONTAINER_ENDED, this.ended), + this.listenTo(i, A.CONTAINER_STOP, this.ended)); + }, + }, + { + key: "containerChanged", + value: function () { + this.stopListening(), this.bindEvents(); + }, + }, + { + key: "ended", + value: function () { + var i = + typeof this.core.options.exitFullscreenOnEnd > "u" || + this.core.options.exitFullscreenOnEnd; + i && this.core.isFullscreen() && this.core.toggleFullscreen(); + }, + }, + ]) + ); + })(vt), + mg = `<svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"> + <path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/> + <path d="M0 0h24v24H0z" fill="none"/> +</svg>`, + Ag = `<div class="player-error-screen__content" data-error-screen> + <% if (icon) { %> + <div class="player-error-screen__icon" data-error-screen><%= icon %></div> + <% } %> + <div class="player-error-screen__title" data-error-screen><%= title %></div> + <div class="player-error-screen__message" data-error-screen><%= message %></div> + <div class="player-error-screen__code" data-error-screen>Error code: <%= code %></div> + <div class="player-error-screen__reload" data-error-screen><%= reloadIcon %></div> +</div> +`, + yg = `[data-player] .player-error-screen { + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + color: #CCCACA; + position: absolute; + top: 0; + height: 100%; + width: 100%; + background-color: rgba(0, 0, 0, 0.7); + z-index: 2000; + display: flex; + flex-direction: column; + justify-content: center; } + [data-player] .player-error-screen__content[data-error-screen] { + font-size: 14px; + color: #CCCACA; + margin-top: 45px; } + [data-player] .player-error-screen__title[data-error-screen] { + font-weight: bold; + line-height: 30px; + font-size: 18px; } + [data-player] .player-error-screen__message[data-error-screen] { + width: 90%; + margin: 0 auto; } + [data-player] .player-error-screen__code[data-error-screen] { + font-size: 13px; + margin-top: 15px; } + [data-player] .player-error-screen__reload { + cursor: pointer; + width: 30px; + margin: 15px auto 0 !important; } +`, + vg = (function (s) { + function e(t) { + var i; + return ( + Je(this, e), + (i = Qe(this, e, [t])), + i.options.disableErrorScreen ? Zo(i, i.disable()) : i + ); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "error_screen"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "template", + get: function () { + return He(Ag); + }, + }, + { + key: "container", + get: function () { + return this.core.getCurrentContainer(); + }, + }, + { + key: "attributes", + get: function () { + return { class: "player-error-screen", "data-error-screen": "" }; + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo(this.core, A.ERROR, this.onError), + this.listenTo( + this.core, + A.CORE_ACTIVE_CONTAINER_CHANGED, + this.onContainerChanged + ); + }, + }, + { + key: "bindReload", + value: function () { + (this.reloadButton = this.$el.find( + ".player-error-screen__reload" + )), + this.reloadButton && + this.reloadButton.on("click", this.reload.bind(this)); + }, + }, + { + key: "reload", + value: function () { + var i = this; + this.listenToOnce(this.core, A.CORE_READY, function () { + return i.container.play(); + }), + this.core.load(this.options.sources, this.options.mimeType), + this.unbindReload(); + }, + }, + { + key: "unbindReload", + value: function () { + this.reloadButton && this.reloadButton.off("click"); + }, + }, + { + key: "onContainerChanged", + value: function () { + (this.err = null), this.unbindReload(), this.hide(); + }, + }, + { + key: "onError", + value: function () { + var i = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : {}; + i.level === Lt.Levels.FATAL && + ((this.err = i), + this.container.disableMediaControl(), + this.container.stop(), + this.show()); + }, + }, + { + key: "show", + value: function () { + this.render(), this.$el.show(); + }, + }, + { + key: "hide", + value: function () { + this.$el.hide(); + }, + }, + { + key: "render", + value: function () { + if (this.err) { + var i = Ue.getStyleFor(yg, { baseUrl: this.options.baseUrl }); + return ( + this.$el.html( + this.template({ + title: this.err.UI.title, + message: this.err.UI.message, + code: this.err.code, + icon: this.err.UI.icon || "", + reloadIcon: mg, + }) + ), + this.$el.append(i[0]), + this.core.$el.append(this.el), + this.bindReload(), + this + ); + } + }, + }, + ]) + ); + })(Ze), + Xt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> + <path fill="#010101" d="M1.425.35L14.575 8l-13.15 7.65V.35z"/> +</svg>`, + Hr = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> + <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M1.712 14.76H6.43V1.24H1.71v13.52zm7.86-13.52v13.52h4.716V1.24H9.573z"/> +</svg>`, + Eg = te('link[rel="shortcut icon"]'), + Tg = (function (s) { + function e(t) { + var i; + return ( + Je(this, e), + (i = Qe(this, e, [t])), + (i._container = null), + i.configure(), + i + ); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "favicon"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "oldIcon", + get: function () { + return Eg; + }, + }, + { + key: "configure", + value: function () { + this.core.options.changeFavicon + ? this.enabled || + (this.stopListening(this.core, A.CORE_OPTIONS_CHANGE), + this.enable()) + : this.enabled && + (this.disable(), + this.listenTo( + this.core, + A.CORE_OPTIONS_CHANGE, + this.configure + )); + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo(this.core, A.CORE_OPTIONS_CHANGE, this.configure), + this.listenTo( + this.core, + A.CORE_ACTIVE_CONTAINER_CHANGED, + this.containerChanged + ), + this.core.activeContainer && this.containerChanged(); + }, + }, + { + key: "containerChanged", + value: function () { + this._container && this.stopListening(this._container), + (this._container = this.core.activeContainer), + this.listenTo( + this._container, + A.CONTAINER_PLAY, + this.setPlayIcon + ), + this.listenTo( + this._container, + A.CONTAINER_PAUSE, + this.setPauseIcon + ), + this.listenTo( + this._container, + A.CONTAINER_STOP, + this.resetIcon + ), + this.listenTo( + this._container, + A.CONTAINER_ENDED, + this.resetIcon + ), + this.listenTo( + this._container, + A.CONTAINER_ERROR, + this.resetIcon + ), + this.resetIcon(); + }, + }, + { + key: "disable", + value: function () { + Gr(e, "disable", this)([]), this.resetIcon(); + }, + }, + { + key: "destroy", + value: function () { + Gr(e, "destroy", this)([]), this.resetIcon(); + }, + }, + { + key: "createIcon", + value: function (i) { + var n = te("<canvas/>"); + (n[0].width = 16), (n[0].height = 16); + var r = n[0].getContext("2d"); + r.fillStyle = "#000"; + var a = te(i).find("path").attr("d"), + o = new Path2D(a); + r.fill(o); + var l = te('<link rel="shortcut icon" type="image/png"/>'); + return l.attr("href", n[0].toDataURL("image/png")), l; + }, + }, + { + key: "setPlayIcon", + value: function () { + this.playIcon || (this.playIcon = this.createIcon(Xt)), + this.changeIcon(this.playIcon); + }, + }, + { + key: "setPauseIcon", + value: function () { + this.pauseIcon || (this.pauseIcon = this.createIcon(Hr)), + this.changeIcon(this.pauseIcon); + }, + }, + { + key: "resetIcon", + value: function () { + te('link[rel="shortcut icon"]').remove(), + te("head").append(this.oldIcon); + }, + }, + { + key: "changeIcon", + value: function (i) { + i && + (te('link[rel="shortcut icon"]').remove(), + te("head").append(i)); + }, + }, + ]) + ); + })(vt), + bg = (function (s) { + function e(t) { + var i; + return ( + Je(this, e), + (i = Qe(this, e, [t])), + i.container.options.gaAccount && + ((i.account = i.container.options.gaAccount), + (i.trackerName = i.container.options.gaTrackerName + ? i.container.options.gaTrackerName + "." + : "Clappr."), + (i.domainName = i.container.options.gaDomainName), + (i.currentHDState = void 0), + i.embedScript()), + i + ); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "google_analytics"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "embedScript", + value: function () { + var i = this; + if (window._gat) this.addEventListeners(); + else { + var n = document.createElement("script"); + n.setAttribute("type", "text/javascript"), + n.setAttribute("async", "async"), + n.setAttribute("src", "//www.google-analytics.com/ga.js"), + (n.onload = function () { + return i.addEventListeners(); + }), + document.body.appendChild(n); + } + }, + }, + { + key: "addEventListeners", + value: function () { + var i = this; + this.container && + (this.listenTo(this.container, A.CONTAINER_READY, this.onReady), + this.listenTo(this.container, A.CONTAINER_PLAY, this.onPlay), + this.listenTo(this.container, A.CONTAINER_STOP, this.onStop), + this.listenTo(this.container, A.CONTAINER_PAUSE, this.onPause), + this.listenTo(this.container, A.CONTAINER_ENDED, this.onEnded), + this.listenTo( + this.container, + A.CONTAINER_STATE_BUFFERING, + this.onBuffering + ), + this.listenTo( + this.container, + A.CONTAINER_STATE_BUFFERFULL, + this.onBufferFull + ), + this.listenTo(this.container, A.CONTAINER_ERROR, this.onError), + this.listenTo( + this.container, + A.CONTAINER_PLAYBACKSTATE, + this.onPlaybackChanged + ), + this.listenTo(this.container, A.CONTAINER_VOLUME, function (n) { + return i.onVolumeChanged(n); + }), + this.listenTo(this.container, A.CONTAINER_SEEK, function (n) { + return i.onSeek(n); + }), + this.listenTo( + this.container, + A.CONTAINER_FULL_SCREEN, + this.onFullscreen + ), + this.listenTo( + this.container, + A.CONTAINER_HIGHDEFINITIONUPDATE, + this.onHD + ), + this.listenTo( + this.container, + A.CONTAINER_PLAYBACKDVRSTATECHANGED, + this.onDVR + )), + _gaq.push([this.trackerName + "_setAccount", this.account]), + this.domainName && + _gaq.push([ + this.trackerName + "_setDomainName", + this.domainName, + ]); + }, + }, + { + key: "onReady", + value: function () { + this.push(["Video", "Playback", this.container.playback.name]); + }, + }, + { + key: "onPlay", + value: function () { + this.push(["Video", "Play", this.container.playback.src]); + }, + }, + { + key: "onStop", + value: function () { + this.push(["Video", "Stop", this.container.playback.src]); + }, + }, + { + key: "onEnded", + value: function () { + this.push(["Video", "Ended", this.container.playback.src]); + }, + }, + { + key: "onBuffering", + value: function () { + this.push(["Video", "Buffering", this.container.playback.src]); + }, + }, + { + key: "onBufferFull", + value: function () { + this.push(["Video", "Bufferfull", this.container.playback.src]); + }, + }, + { + key: "onError", + value: function () { + this.push(["Video", "Error", this.container.playback.src]); + }, + }, + { + key: "onHD", + value: function (i) { + var n = i ? "ON" : "OFF"; + n !== this.currentHDState && + ((this.currentHDState = n), + this.push(["Video", "HD - " + n, this.container.playback.src])); + }, + }, + { + key: "onPlaybackChanged", + value: function (i) { + i.type !== null && + this.push([ + "Video", + "Playback Type - " + i.type, + this.container.playback.src, + ]); + }, + }, + { + key: "onDVR", + value: function (i) { + var n = i ? "ON" : "OFF"; + this.push([ + "Interaction", + "DVR - " + n, + this.container.playback.src, + ]); + }, + }, + { + key: "onPause", + value: function () { + this.push(["Video", "Pause", this.container.playback.src]); + }, + }, + { + key: "onSeek", + value: function () { + this.push(["Video", "Seek", this.container.playback.src]); + }, + }, + { + key: "onVolumeChanged", + value: function () { + this.push(["Interaction", "Volume", this.container.playback.src]); + }, + }, + { + key: "onFullscreen", + value: function () { + this.push([ + "Interaction", + "Fullscreen", + this.container.playback.src, + ]); + }, + }, + { + key: "push", + value: function (i) { + var n = [this.trackerName + "_trackEvent"].concat(i); + _gaq.push(n); + }, + }, + ]) + ); + })(yt), + Q = function (e) { + (this.element = e || window.document), this.initialize(); + }; + (Q.KEY_NAMES_BY_CODE = { + 8: "backspace", + 9: "tab", + 13: "enter", + 16: "shift", + 17: "ctrl", + 18: "alt", + 20: "caps_lock", + 27: "esc", + 32: "space", + 37: "left", + 38: "up", + 39: "right", + 40: "down", + 48: "0", + 49: "1", + 50: "2", + 51: "3", + 52: "4", + 53: "5", + 54: "6", + 55: "7", + 56: "8", + 57: "9", + 65: "a", + 66: "b", + 67: "c", + 68: "d", + 69: "e", + 70: "f", + 71: "g", + 72: "h", + 73: "i", + 74: "j", + 75: "k", + 76: "l", + 77: "m", + 78: "n", + 79: "o", + 80: "p", + 81: "q", + 82: "r", + 83: "s", + 84: "t", + 85: "u", + 86: "v", + 87: "w", + 88: "x", + 89: "y", + 90: "z", + 112: "f1", + 113: "f2", + 114: "f3", + 115: "f4", + 116: "f5", + 117: "f6", + 118: "f7", + 119: "f8", + 120: "f9", + 121: "f10", + 122: "f11", + 123: "f12", + }), + (Q.KEY_CODES_BY_NAME = {}), + (function () { + for (var s in Q.KEY_NAMES_BY_CODE) + Object.prototype.hasOwnProperty.call(Q.KEY_NAMES_BY_CODE, s) && + (Q.KEY_CODES_BY_NAME[Q.KEY_NAMES_BY_CODE[s]] = +s); + })(), + (Q.MODIFIERS = ["shift", "ctrl", "alt"]), + (Q.registerEvent = (function () { + if (document.addEventListener) + return function (s, e, t) { + s.addEventListener(e, t, !1); + }; + if (document.attachEvent) + return function (s, e, t) { + s.attachEvent("on" + e, t); + }; + })()), + (Q.unregisterEvent = (function () { + if (document.removeEventListener) + return function (s, e, t) { + s.removeEventListener(e, t, !1); + }; + if (document.detachEvent) + return function (s, e, t) { + s.detachEvent("on" + e, t); + }; + })()), + (Q.stringContains = function (s, e) { + return s.indexOf(e) !== -1; + }), + (Q.neatString = function (s) { + return s.replace(/^\s+|\s+$/g, "").replace(/\s+/g, " "); + }), + (Q.capitalize = function (s) { + return s.toLowerCase().replace(/^./, function (e) { + return e.toUpperCase(); + }); + }), + (Q.isString = function (s) { + return Q.stringContains(Object.prototype.toString.call(s), "String"); + }), + (Q.arrayIncludes = (function () { + return Array.prototype.indexOf + ? function (s, e) { + return s.indexOf(e) !== -1; + } + : function (s, e) { + for (var t = 0; t < s.length; t++) if (s[t] === e) return !0; + return !1; + }; + })()), + (Q.extractModifiers = function (s) { + var e, t; + for (e = [], t = 0; t < Q.MODIFIERS.length; t++) + Q.stringContains(s, Q.MODIFIERS[t]) && e.push(Q.MODIFIERS[t]); + return e; + }), + (Q.extractKey = function (s) { + var e, t; + for (e = Q.neatString(s).split(" "), t = 0; t < e.length; t++) + if (!Q.arrayIncludes(Q.MODIFIERS, e[t])) return e[t]; + }), + (Q.modifiersAndKey = function (s) { + var e, t; + return Q.stringContains(s, "any") + ? Q.neatString(s).split(" ").slice(0, 2).join(" ") + : ((e = Q.extractModifiers(s)), + (t = Q.extractKey(s)), + t && !Q.arrayIncludes(Q.MODIFIERS, t) && e.push(t), + e.join(" ")); + }), + (Q.keyName = function (s) { + return Q.KEY_NAMES_BY_CODE[s + ""]; + }), + (Q.keyCode = function (s) { + return +Q.KEY_CODES_BY_NAME[s]; + }), + (Q.prototype.initialize = function () { + var s, + e = this; + for ( + this.lastKeyCode = -1, this.lastModifiers = {}, s = 0; + s < Q.MODIFIERS.length; + s++ + ) + this.lastModifiers[Q.MODIFIERS[s]] = !1; + (this.keysDown = { any: [] }), + (this.keysUp = { any: [] }), + (this.downHandler = this.handler("down")), + (this.upHandler = this.handler("up")), + Q.registerEvent(this.element, "keydown", this.downHandler), + Q.registerEvent(this.element, "keyup", this.upHandler); + var t = + Kr(window.onbeforeunload) === "object" ? "beforeunload" : "unload"; + Q.registerEvent(window, t, function i() { + Q.unregisterEvent(e.element, "keydown", e.downHandler), + Q.unregisterEvent(e.element, "keyup", e.upHandler), + Q.unregisterEvent(window, t, i); + }); + }), + (Q.prototype.handler = function (s) { + var e = this; + return function (t) { + var i, n, r; + for ( + t = t || window.event, e.lastKeyCode = t.keyCode, i = 0; + i < Q.MODIFIERS.length; + i++ + ) + e.lastModifiers[Q.MODIFIERS[i]] = t[Q.MODIFIERS[i] + "Key"]; + for ( + Q.arrayIncludes(Q.MODIFIERS, Q.keyName(e.lastKeyCode)) && + (e.lastModifiers[Q.keyName(e.lastKeyCode)] = !0), + n = e["keys" + Q.capitalize(s)], + i = 0; + i < n.any.length; + i++ + ) + n.any[i](t) === !1 && t.preventDefault && t.preventDefault(); + if (((r = e.lastModifiersAndKey()), n[r])) + for (i = 0; i < n[r].length; i++) + n[r][i](t) === !1 && t.preventDefault && t.preventDefault(); + }; + }), + (Q.prototype.registerKeys = function (s, e, t) { + var i, + n, + r = this["keys" + Q.capitalize(s)]; + for (Q.isString(e) && (e = [e]), i = 0; i < e.length; i++) + (n = e[i]), + (n = Q.modifiersAndKey(n + "")), + r[n] ? r[n].push(t) : (r[n] = [t]); + return this; + }), + (Q.prototype.unregisterKeys = function (s, e, t) { + var i, + n, + r, + a = this["keys" + Q.capitalize(s)]; + for (Q.isString(e) && (e = [e]), i = 0; i < e.length; i++) + if (((r = e[i]), (r = Q.modifiersAndKey(r + "")), t === null)) + delete a[r]; + else if (a[r]) { + for (n = 0; n < a[r].length; n++) + if (String(a[r][n]) === String(t)) { + a[r].splice(n, 1); + break; + } + } + return this; + }), + (Q.prototype.off = function (s) { + return this.unregisterKeys("down", s, null); + }), + (Q.prototype.delegate = function (s, e, t) { + return t !== null || t !== void 0 + ? this.registerKeys(s, e, t) + : this.unregisterKeys(s, e, t); + }), + (Q.prototype.down = function (s, e) { + return this.delegate("down", s, e); + }), + (Q.prototype.up = function (s, e) { + return this.delegate("up", s, e); + }), + (Q.prototype.lastKey = function (s) { + return s ? this.lastModifiers[s] : Q.keyName(this.lastKeyCode); + }), + (Q.prototype.lastModifiersAndKey = function () { + var s, e; + for (s = [], e = 0; e < Q.MODIFIERS.length; e++) + this.lastKey(Q.MODIFIERS[e]) && s.push(Q.MODIFIERS[e]); + return ( + Q.arrayIncludes(s, this.lastKey()) || s.push(this.lastKey()), + s.join(" ") + ); + }); + var _g = `.media-control-notransition { + transition: none !important; } + +.media-control[data-media-control] { + position: absolute; + width: 100%; + height: 100%; + z-index: 9999; + pointer-events: none; } + .media-control[data-media-control].dragging { + pointer-events: auto; + cursor: grabbing !important; + cursor: url("closed-hand.cur"), move; } + .media-control[data-media-control].dragging * { + cursor: grabbing !important; + cursor: url("closed-hand.cur"), move; } + .media-control[data-media-control] .media-control-background[data-background] { + position: absolute; + height: 40%; + width: 100%; + bottom: 0; + background: linear-gradient(transparent, rgba(0, 0, 0, 0.9)); + will-change: transform, opacity; + transition: opacity 0.6s ease-out; } + .media-control[data-media-control] .media-control-icon { + line-height: 0; + letter-spacing: 0; + speak: none; + color: #fff; + opacity: 0.5; + vertical-align: middle; + text-align: left; + transition: all 0.1s ease; } + .media-control[data-media-control] .media-control-icon:hover { + color: white; + opacity: 0.75; + text-shadow: rgba(255, 255, 255, 0.8) 0 0 5px; } + .media-control[data-media-control].media-control-hide .media-control-background[data-background] { + opacity: 0; } + .media-control[data-media-control].media-control-hide .media-control-layer[data-controls] { + transform: translateY(50px); } + .media-control[data-media-control].media-control-hide .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] { + opacity: 0; } + .media-control[data-media-control] .media-control-layer[data-controls] { + position: absolute; + transform: translateY(-7px); + bottom: 0; + width: 100%; + height: 32px; + font-size: 0; + vertical-align: middle; + pointer-events: auto; + transition: bottom 0.4s ease-out; } + .media-control[data-media-control] .media-control-layer[data-controls] .media-control-left-panel[data-media-control] { + position: absolute; + top: 0; + left: 4px; + height: 100%; } + .media-control[data-media-control] .media-control-layer[data-controls] .media-control-center-panel[data-media-control] { + height: 100%; + text-align: center; + line-height: 32px; } + .media-control[data-media-control] .media-control-layer[data-controls] .media-control-right-panel[data-media-control] { + position: absolute; + top: 0; + right: 4px; + height: 100%; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button { + background-color: transparent; + border: 0; + margin: 0 6px; + padding: 0; + cursor: pointer; + display: inline-block; + width: 32px; + height: 100%; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button svg { + width: 100%; + height: 22px; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button svg path { + fill: white; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button:focus { + outline: none; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-play] { + float: left; + height: 100%; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-pause] { + float: left; + height: 100%; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-stop] { + float: left; + height: 100%; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-fullscreen] { + float: right; + background-color: transparent; + border: 0; + height: 100%; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator] { + background-color: transparent; + border: 0; + cursor: default; + display: none; + float: right; + height: 100%; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled { + display: block; + opacity: 1.0; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled:hover { + opacity: 1.0; + text-shadow: none; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause] { + float: left; } + .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop] { + float: left; } + .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] { + display: inline-block; + font-size: 10px; + color: white; + cursor: default; + line-height: 32px; + position: relative; } + .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position] { + margin: 0 6px 0 7px; } + .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration] { + color: rgba(255, 255, 255, 0.5); + margin-right: 6px; } + .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration]:before { + content: "|"; + margin-right: 7px; } + .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] { + position: absolute; + top: -20px; + left: 0; + display: inline-block; + vertical-align: middle; + width: 100%; + height: 25px; + cursor: pointer; } + .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] { + width: 100%; + height: 1px; + position: relative; + top: 12px; + background-color: #666666; } + .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-1[data-seekbar] { + position: absolute; + top: 0; + left: 0; + width: 0; + height: 100%; + background-color: #c2c2c2; + transition: all 0.1s ease-out; } + .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar] { + position: absolute; + top: 0; + left: 0; + width: 0; + height: 100%; + background-color: #005aff; + transition: all 0.1s ease-out; } + .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-hover[data-seekbar] { + opacity: 0; + position: absolute; + top: -3px; + width: 5px; + height: 7px; + background-color: rgba(255, 255, 255, 0.5); + transition: opacity 0.1s ease; } + .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]:hover .bar-background[data-seekbar] .bar-hover[data-seekbar] { + opacity: 1; } + .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled { + cursor: default; } + .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] { + opacity: 0; } + .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] { + position: absolute; + transform: translateX(-50%); + top: 2px; + left: 0; + width: 20px; + height: 20px; + opacity: 1; + transition: all 0.1s ease-out; } + .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] .bar-scrubber-icon[data-seekbar] { + position: absolute; + left: 6px; + top: 6px; + width: 8px; + height: 8px; + border-radius: 10px; + box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.2); + background-color: white; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] { + float: right; + display: inline-block; + height: 32px; + cursor: pointer; + margin: 0 6px; + box-sizing: border-box; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] { + float: left; + bottom: 0; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume] { + background-color: transparent; + border: 0; + box-sizing: content-box; + width: 32px; + height: 32px; + opacity: 0.5; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]:hover { + opacity: 0.75; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume] svg { + height: 24px; + position: relative; + top: 3px; } + .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 { + fill: white; } + .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 { + margin-left: 2px; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] { + float: left; + position: relative; + overflow: hidden; + top: 6px; + width: 42px; + height: 18px; + padding: 3px 0; + transition: width .2s ease-out; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] { + height: 1px; + position: relative; + top: 7px; + margin: 0 3px; + background-color: #666666; } + .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] { + position: absolute; + top: 0; + left: 0; + width: 0; + height: 100%; + background-color: #c2c2c2; + transition: all 0.1s ease-out; } + .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] { + position: absolute; + top: 0; + left: 0; + width: 0; + height: 100%; + background-color: #005aff; + transition: all 0.1s ease-out; } + .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] { + opacity: 0; + position: absolute; + top: -3px; + width: 5px; + height: 7px; + background-color: rgba(255, 255, 255, 0.5); + transition: opacity 0.1s ease; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-scrubber[data-volume] { + position: absolute; + transform: translateX(-50%); + top: 0px; + left: 0; + width: 20px; + height: 20px; + opacity: 1; + transition: all 0.1s ease-out; } + .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] { + position: absolute; + left: 6px; + top: 6px; + width: 8px; + height: 8px; + border-radius: 10px; + box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.2); + background-color: white; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume] { + float: left; + width: 4px; + padding-left: 2px; + height: 12px; + opacity: 0.5; + box-shadow: inset 2px 0 0 white; + transition: transform .2s ease-out; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume].fill { + box-shadow: inset 2px 0 0 #fff; + opacity: 1; } + .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) { + padding-left: 0; } + .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:hover { + transform: scaleY(1.5); } + .media-control[data-media-control].w320 .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume].volume-bar-hide { + width: 0; + height: 12px; + top: 9px; + padding: 0; } +`, + kg = `<div class="media-control-background" data-background></div> +<div class="media-control-layer" data-controls> + <% var renderBar = function(name) { %> + <div class="bar-container" data-<%= name %>> + <div class="bar-background" data-<%= name %>> + <div class="bar-fill-1" data-<%= name %>></div> + <div class="bar-fill-2" data-<%= name %>></div> + <div class="bar-hover" data-<%= name %>></div> + </div> + <div class="bar-scrubber" data-<%= name %>> + <div class="bar-scrubber-icon" data-<%= name %>></div> + </div> + </div> + <% }; %> + <% var renderSegmentedBar = function(name, segments) { + segments = segments || 10; %> + <div class="bar-container" data-<%= name %>> + <% for (var i = 0; i < segments; i++) { %> + <div class="segmented-bar-element" data-<%= name %>></div> + <% } %> + </div> + <% }; %> + <% var renderDrawer = function(name, renderContent) { %> + <div class="drawer-container" data-<%= name %>> + <div class="drawer-icon-container" data-<%= name %>> + <div class="drawer-icon media-control-icon" data-<%= name %>></div> + <span class="drawer-text" data-<%= name %>></span> + </div> + <% renderContent(name); %> + </div> + <% }; %> + <% var renderIndicator = function(name) { %> + <div class="media-control-indicator" data-<%= name %>></div> + <% }; %> + <% var renderButton = function(name) { %> + <button type="button" class="media-control-button media-control-icon" data-<%= name %> aria-label="<%= name %>"></button> + <% }; %> + <% var templates = { + bar: renderBar, + segmentedBar: renderSegmentedBar, + }; + var render = function(settingsList) { + settingsList.forEach(function(setting) { + if(setting === "seekbar") { + renderBar(setting); + } else if (setting === "volume") { + renderDrawer(setting, settings.volumeBarTemplate ? templates[settings.volumeBarTemplate] : function(name) { return renderSegmentedBar(name); }); + } else if (setting === "duration" || setting === "position") { + renderIndicator(setting); + } else { + renderButton(setting); + } + }); + }; %> + <% if (settings.default && settings.default.length) { %> + <div class="media-control-center-panel" data-media-control> + <% render(settings.default); %> + </div> + <% } %> + <% if (settings.left && settings.left.length) { %> + <div class="media-control-left-panel" data-media-control> + <% render(settings.left); %> + </div> + <% } %> + <% if (settings.right && settings.right.length) { %> + <div class="media-control-right-panel" data-media-control> + <% render(settings.right); %> + </div> + <% } %> +</div> +`, + Qo = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> + <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M1.712 1.24h12.6v13.52h-12.6z"/> +</svg>`, + Jo = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> + <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M11.5 11h-.002v1.502L7.798 10H4.5V6h3.297l3.7-2.502V4.5h.003V11zM11 4.49L7.953 6.5H5v3h2.953L11 11.51V4.49z"/> +</svg>`, + Sg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> + <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M9.75 11.51L6.7 9.5H3.75v-3H6.7L9.75 4.49v.664l.497.498V3.498L6.547 6H3.248v4h3.296l3.7 2.502v-2.154l-.497.5v.662zm3-5.165L12.404 6l-1.655 1.653L9.093 6l-.346.345L10.402 8 8.747 9.654l.346.347 1.655-1.653L12.403 10l.348-.346L11.097 8l1.655-1.655z"/> +</svg>`, + el = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> + <path fill="#010101" d="M7.156 8L4 11.156V8.5H3V13h4.5v-1H4.844L8 8.844 7.156 8zM8.5 3v1h2.657L8 7.157 8.846 8 12 4.844V7.5h1V3H8.5z"/> +</svg>`, + Cg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> + <path fill="#010101" d="M13.5 3.344l-.844-.844L9.5 5.656V3h-1v4.5H13v-1h-2.656L13.5 3.344zM3 9.5h2.656L2.5 12.656l.844.844L6.5 10.344V13h1V8.5H3v1z"/> +</svg>`, + xg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> + <path fill="#010101" d="M5.375 7.062H2.637V4.26H.502v7.488h2.135V8.9h2.738v2.848h2.133V4.26H5.375v2.802zm5.97-2.81h-2.84v7.496h2.798c2.65 0 4.195-1.607 4.195-3.77v-.022c0-2.162-1.523-3.704-4.154-3.704zm2.06 3.758c0 1.21-.81 1.896-2.03 1.896h-.83V6.093h.83c1.22 0 2.03.696 2.03 1.896v.02z"/> +</svg>`, + tl = Ut.Config, + il = Ut.Fullscreen, + nl = Ut.formatTime, + Lg = Ut.extend, + Yr = Ut.removeArrayItem, + zr = (function (s) { + function e(t) { + var i; + return ( + Je(this, e), + (i = Qe(this, e, [t])), + (i.persistConfig = i.options.persistConfig), + (i.currentPositionValue = null), + (i.currentDurationValue = null), + (i.keepVisible = !1), + (i.fullScreenOnVideoTagSupported = null), + i.setInitialVolume(), + (i.settings = { + left: ["play", "stop", "pause"], + right: ["volume"], + default: ["position", "seekbar", "duration"], + }), + (i.kibo = new Q(i.options.focusElement)), + i.bindKeyEvents(), + i.container + ? te.isEmptyObject(i.container.settings) || + (i.settings = te.extend({}, i.container.settings)) + : (i.settings = {}), + (i.userDisabled = !1), + ((i.container && i.container.mediaControlDisabled) || + i.options.chromeless) && + i.disable(), + (i.stopDragHandler = function (n) { + return i.stopDrag(n); + }), + (i.updateDragHandler = function (n) { + return i.updateDrag(n); + }), + te(document).bind("mouseup", i.stopDragHandler), + te(document).bind("mousemove", i.updateDragHandler), + i + ); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "media_control"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "disabled", + get: function () { + var i = + this.container && this.container.getPlaybackType() === ge.NO_OP; + return this.userDisabled || i; + }, + }, + { + key: "container", + get: function () { + return this.core && this.core.activeContainer; + }, + }, + { + key: "playback", + get: function () { + return this.core && this.core.activePlayback; + }, + }, + { + key: "attributes", + get: function () { + return { class: "media-control", "data-media-control": "" }; + }, + }, + { + key: "events", + get: function () { + return { + "click [data-play]": "play", + "click [data-pause]": "pause", + "click [data-playpause]": "togglePlayPause", + "click [data-stop]": "stop", + "click [data-playstop]": "togglePlayStop", + "click [data-fullscreen]": "toggleFullscreen", + "click .bar-container[data-seekbar]": "seek", + "click .bar-container[data-volume]": "onVolumeClick", + "click .drawer-icon[data-volume]": "toggleMute", + "mouseenter .drawer-container[data-volume]": "showVolumeBar", + "mouseleave .drawer-container[data-volume]": "hideVolumeBar", + "mousedown .bar-container[data-volume]": "startVolumeDrag", + "mousemove .bar-container[data-volume]": "mousemoveOnVolumeBar", + "mousedown .bar-scrubber[data-seekbar]": "startSeekDrag", + "mousemove .bar-container[data-seekbar]": "mousemoveOnSeekBar", + "mouseleave .bar-container[data-seekbar]": + "mouseleaveOnSeekBar", + "mouseenter .media-control-layer[data-controls]": + "setUserKeepVisible", + "mouseleave .media-control-layer[data-controls]": + "resetUserKeepVisible", + }; + }, + }, + { + key: "template", + get: function () { + return He(kg); + }, + }, + { + key: "volume", + get: function () { + return this.container && this.container.isReady + ? this.container.volume + : this.intendedVolume; + }, + }, + { + key: "muted", + get: function () { + return this.volume === 0; + }, + }, + { + key: "getExternalInterface", + value: function () { + var i = this; + return { + setVolume: this.setVolume, + getVolume: function () { + return i.volume; + }, + }; + }, + }, + { + key: "bindEvents", + value: function () { + var i = this; + this.stopListening(), + this.listenTo( + this.core, + A.CORE_ACTIVE_CONTAINER_CHANGED, + this.onActiveContainerChanged + ), + this.listenTo(this.core, A.CORE_MOUSE_MOVE, this.show), + this.listenTo(this.core, A.CORE_MOUSE_LEAVE, function () { + return i.hide(i.options.hideMediaControlDelay); + }), + this.listenTo(this.core, A.CORE_FULLSCREEN, this.show), + this.listenTo(this.core, A.CORE_OPTIONS_CHANGE, this.configure), + this.listenTo(this.core, A.CORE_RESIZE, this.playerResize), + this.bindContainerEvents(); + }, + }, + { + key: "bindContainerEvents", + value: function () { + this.container && + (this.listenTo( + this.container, + A.CONTAINER_PLAY, + this.changeTogglePlay + ), + this.listenTo( + this.container, + A.CONTAINER_PAUSE, + this.changeTogglePlay + ), + this.listenTo( + this.container, + A.CONTAINER_STOP, + this.changeTogglePlay + ), + this.listenTo( + this.container, + A.CONTAINER_DBLCLICK, + this.toggleFullscreen + ), + this.listenTo( + this.container, + A.CONTAINER_TIMEUPDATE, + this.onTimeUpdate + ), + this.listenTo( + this.container, + A.CONTAINER_PROGRESS, + this.updateProgressBar + ), + this.listenTo( + this.container, + A.CONTAINER_SETTINGSUPDATE, + this.settingsUpdate + ), + this.listenTo( + this.container, + A.CONTAINER_PLAYBACKDVRSTATECHANGED, + this.settingsUpdate + ), + this.listenTo( + this.container, + A.CONTAINER_HIGHDEFINITIONUPDATE, + this.highDefinitionUpdate + ), + this.listenTo( + this.container, + A.CONTAINER_MEDIACONTROL_DISABLE, + this.disable + ), + this.listenTo( + this.container, + A.CONTAINER_MEDIACONTROL_ENABLE, + this.enable + ), + this.listenTo(this.container, A.CONTAINER_ENDED, this.ended), + this.listenTo( + this.container, + A.CONTAINER_VOLUME, + this.onVolumeChanged + ), + this.listenTo( + this.container, + A.CONTAINER_OPTIONS_CHANGE, + this.setInitialVolume + ), + this.container.playback.el.nodeName.toLowerCase() === "video" && + this.listenToOnce( + this.container, + A.CONTAINER_LOADEDMETADATA, + this.onLoadedMetadataOnVideoTag + )); + }, + }, + { + key: "disable", + value: function () { + (this.userDisabled = !0), + this.hide(), + this.unbindKeyEvents(), + this.$el.hide(); + }, + }, + { + key: "enable", + value: function () { + this.options.chromeless || + ((this.userDisabled = !1), this.bindKeyEvents(), this.show()); + }, + }, + { + key: "play", + value: function () { + this.container && this.container.play(); + }, + }, + { + key: "pause", + value: function () { + this.container && this.container.pause(); + }, + }, + { + key: "stop", + value: function () { + this.container && this.container.stop(); + }, + }, + { + key: "setInitialVolume", + value: function () { + var i = this.persistConfig ? tl.restore("volume") : 100, + n = (this.container && this.container.options) || this.options; + this.setVolume(n.mute ? 0 : i, !0); + }, + }, + { + key: "onVolumeChanged", + value: function () { + this.updateVolumeUI(); + }, + }, + { + key: "onLoadedMetadataOnVideoTag", + value: function () { + var i = this.playback && this.playback.el; + !il.fullscreenEnabled() && + i.webkitSupportsFullscreen && + ((this.fullScreenOnVideoTagSupported = !0), + this.settingsUpdate()); + }, + }, + { + key: "updateVolumeUI", + value: function () { + if (this.rendered) { + this.$volumeBarContainer.find(".bar-fill-2").css({}); + var i = this.$volumeBarContainer.width(), + n = this.$volumeBarBackground.width(), + r = (i - n) / 2, + a = (n * this.volume) / 100 + r; + this.$volumeBarFill.css({ width: "".concat(this.volume, "%") }), + this.$volumeBarScrubber.css({ left: a }), + this.$volumeBarContainer + .find(".segmented-bar-element") + .removeClass("fill"); + var o = Math.ceil(this.volume / 10); + this.$volumeBarContainer + .find(".segmented-bar-element") + .slice(0, o) + .addClass("fill"), + this.$volumeIcon.html(""), + this.$volumeIcon.removeClass("muted"), + this.muted + ? (this.$volumeIcon.append(Sg), + this.$volumeIcon.addClass("muted")) + : this.$volumeIcon.append(Jo), + this.applyButtonStyle(this.$volumeIcon); + } + }, + }, + { + key: "changeTogglePlay", + value: function () { + this.$playPauseToggle.html(""), + this.$playStopToggle.html(""), + this.container && this.container.isPlaying() + ? (this.$playPauseToggle.append(Hr), + this.$playStopToggle.append(Qo), + this.trigger(A.MEDIACONTROL_PLAYING)) + : (this.$playPauseToggle.append(Xt), + this.$playStopToggle.append(Xt), + this.trigger(A.MEDIACONTROL_NOTPLAYING), + ee.isMobile && this.show()), + this.applyButtonStyle(this.$playPauseToggle), + this.applyButtonStyle(this.$playStopToggle); + }, + }, + { + key: "mousemoveOnSeekBar", + value: function (i) { + if (this.settings.seekEnabled) { + var n = + i.pageX - + this.$seekBarContainer.offset().left - + this.$seekBarHover.width() / 2; + this.$seekBarHover.css({ left: n }); + } + this.trigger(A.MEDIACONTROL_MOUSEMOVE_SEEKBAR, i); + }, + }, + { + key: "mouseleaveOnSeekBar", + value: function (i) { + this.trigger(A.MEDIACONTROL_MOUSELEAVE_SEEKBAR, i); + }, + }, + { + key: "onVolumeClick", + value: function (i) { + this.setVolume(this.getVolumeFromUIEvent(i)); + }, + }, + { + key: "mousemoveOnVolumeBar", + value: function (i) { + this.draggingVolumeBar && + this.setVolume(this.getVolumeFromUIEvent(i)); + }, + }, + { + key: "playerResize", + value: function (i) { + this.$fullscreenToggle.html(""); + var n = this.core.isFullscreen() ? Cg : el; + this.$fullscreenToggle.append(n), + this.applyButtonStyle(this.$fullscreenToggle), + this.$el.find(".media-control").length !== 0 && + this.$el.removeClass("w320"), + (i.width <= 320 || this.options.hideVolumeBar) && + this.$el.addClass("w320"); + }, + }, + { + key: "togglePlayPause", + value: function () { + return ( + this.container.isPlaying() + ? this.container.pause() + : this.container.play(), + !1 + ); + }, + }, + { + key: "togglePlayStop", + value: function () { + this.container.isPlaying() + ? this.container.stop() + : this.container.play(); + }, + }, + { + key: "startSeekDrag", + value: function (i) { + this.settings.seekEnabled && + ((this.draggingSeekBar = !0), + this.$el.addClass("dragging"), + this.$seekBarLoaded.addClass("media-control-notransition"), + this.$seekBarPosition.addClass("media-control-notransition"), + this.$seekBarScrubber.addClass("media-control-notransition"), + i && i.preventDefault()); + }, + }, + { + key: "startVolumeDrag", + value: function (i) { + (this.draggingVolumeBar = !0), + this.$el.addClass("dragging"), + i && i.preventDefault(); + }, + }, + { + key: "stopDrag", + value: function (i) { + this.draggingSeekBar && this.seek(i), + this.$el.removeClass("dragging"), + this.$seekBarLoaded.removeClass("media-control-notransition"), + this.$seekBarPosition.removeClass("media-control-notransition"), + this.$seekBarScrubber.removeClass( + "media-control-notransition dragging" + ), + (this.draggingSeekBar = !1), + (this.draggingVolumeBar = !1); + }, + }, + { + key: "updateDrag", + value: function (i) { + if (this.draggingSeekBar) { + i.preventDefault(); + var n = i.pageX - this.$seekBarContainer.offset().left, + r = (n / this.$seekBarContainer.width()) * 100; + (r = Math.min(100, Math.max(r, 0))), this.setSeekPercentage(r); + } else + this.draggingVolumeBar && + (i.preventDefault(), + this.setVolume(this.getVolumeFromUIEvent(i))); + }, + }, + { + key: "getVolumeFromUIEvent", + value: function (i) { + var n = i.pageX - this.$volumeBarContainer.offset().left, + r = (n / this.$volumeBarContainer.width()) * 100; + return r; + }, + }, + { + key: "toggleMute", + value: function () { + this.setVolume(this.muted ? 100 : 0); + }, + }, + { + key: "setVolume", + value: function (i) { + var n = this, + r = + arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : !1; + (i = Math.min(100, Math.max(i, 0))), + (this.intendedVolume = i), + this.persistConfig && !r && tl.persist("volume", i); + var a = function () { + n.container && n.container.isReady + ? n.container.setVolume(i) + : n.listenToOnce(n.container, A.CONTAINER_READY, function () { + n.container.setVolume(i); + }); + }; + this.container + ? a() + : this.listenToOnce( + this, + A.MEDIACONTROL_CONTAINERCHANGED, + function () { + return a(); + } + ); + }, + }, + { + key: "toggleFullscreen", + value: function () { + this.trigger(A.MEDIACONTROL_FULLSCREEN, this.name), + this.container.fullscreen(), + this.core.toggleFullscreen(), + this.resetUserKeepVisible(); + }, + }, + { + key: "onActiveContainerChanged", + value: function () { + (this.fullScreenOnVideoTagSupported = null), + this.bindEvents(), + this.setInitialVolume(), + this.changeTogglePlay(), + this.bindContainerEvents(), + this.settingsUpdate(), + this.container && + this.container.trigger( + A.CONTAINER_PLAYBACKDVRSTATECHANGED, + this.container.isDvrInUse() + ), + this.container && + this.container.mediaControlDisabled && + this.disable(), + this.trigger(A.MEDIACONTROL_CONTAINERCHANGED); + }, + }, + { + key: "showVolumeBar", + value: function () { + this.hideVolumeId && clearTimeout(this.hideVolumeId), + this.$volumeBarContainer.removeClass("volume-bar-hide"); + }, + }, + { + key: "hideVolumeBar", + value: function () { + var i = this, + n = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : 400; + this.$volumeBarContainer && + (this.draggingVolumeBar + ? (this.hideVolumeId = setTimeout(function () { + return i.hideVolumeBar(); + }, n)) + : (this.hideVolumeId && clearTimeout(this.hideVolumeId), + (this.hideVolumeId = setTimeout(function () { + return i.$volumeBarContainer.addClass("volume-bar-hide"); + }, n)))); + }, + }, + { + key: "ended", + value: function () { + this.changeTogglePlay(); + }, + }, + { + key: "updateProgressBar", + value: function (i) { + var n = (i.start / i.total) * 100, + r = (i.current / i.total) * 100; + this.$seekBarLoaded.css({ + left: "".concat(n, "%"), + width: "".concat(r - n, "%"), + }); + }, + }, + { + key: "onTimeUpdate", + value: function (i) { + if (!this.draggingSeekBar) { + var n = i.current < 0 ? i.total : i.current; + (this.currentPositionValue = n), + (this.currentDurationValue = i.total), + this.renderSeekBar(); + } + }, + }, + { + key: "renderSeekBar", + value: function () { + if ( + !( + this.currentPositionValue === null || + this.currentDurationValue === null + ) + ) { + (this.currentSeekBarPercentage = 100), + this.container && + (this.container.getPlaybackType() !== ge.LIVE || + this.container.isDvrInUse()) && + (this.currentSeekBarPercentage = + (this.currentPositionValue / this.currentDurationValue) * + 100), + this.setSeekPercentage(this.currentSeekBarPercentage); + var i = nl(this.currentPositionValue), + n = nl(this.currentDurationValue); + i !== this.displayedPosition && + (this.$position.text(i), (this.displayedPosition = i)), + n !== this.displayedDuration && + (this.$duration.text(n), (this.displayedDuration = n)); + } + }, + }, + { + key: "seek", + value: function (i) { + if (this.settings.seekEnabled) { + var n = i.pageX - this.$seekBarContainer.offset().left, + r = (n / this.$seekBarContainer.width()) * 100; + return ( + (r = Math.min(100, Math.max(r, 0))), + this.container && this.container.seekPercentage(r), + this.setSeekPercentage(r), + !1 + ); + } + }, + }, + { + key: "setKeepVisible", + value: function () { + this.keepVisible = !0; + }, + }, + { + key: "resetKeepVisible", + value: function () { + this.keepVisible = !1; + }, + }, + { + key: "setUserKeepVisible", + value: function () { + this.userKeepVisible = !0; + }, + }, + { + key: "resetUserKeepVisible", + value: function () { + this.userKeepVisible = !1; + }, + }, + { + key: "isVisible", + value: function () { + return !this.$el.hasClass("media-control-hide"); + }, + }, + { + key: "show", + value: function (i) { + var n = this; + if (!this.disabled) { + var r = 2e3, + a = + i && + i.clientX !== this.lastMouseX && + i.clientY !== this.lastMouseY; + (!i || a || navigator.userAgent.match(/firefox/i)) && + (clearTimeout(this.hideId), + this.$el.show(), + this.trigger(A.MEDIACONTROL_SHOW, this.name), + this.container && + this.container.trigger( + A.CONTAINER_MEDIACONTROL_SHOW, + this.name + ), + this.$el.removeClass("media-control-hide"), + (this.hideId = setTimeout(function () { + return n.hide(); + }, r)), + i && + ((this.lastMouseX = i.clientX), + (this.lastMouseY = i.clientY))); + var o = !0; + this.updateCursorStyle(o); + } + }, + }, + { + key: "hide", + value: function () { + var i = this, + n = + arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : 0; + if (this.isVisible()) { + var r = n || 2e3; + if ( + (clearTimeout(this.hideId), + !(!this.disabled && this.options.hideMediaControl === !1)) + ) { + var a = this.userKeepVisible || this.keepVisible, + o = this.draggingSeekBar || this.draggingVolumeBar; + if (!this.disabled && (n || a || o)) + this.hideId = setTimeout(function () { + return i.hide(); + }, r); + else { + this.trigger(A.MEDIACONTROL_HIDE, this.name), + this.container && + this.container.trigger( + A.CONTAINER_MEDIACONTROL_HIDE, + this.name + ), + this.$el.addClass("media-control-hide"), + this.hideVolumeBar(0); + var l = !1; + this.updateCursorStyle(l); + } + } + } + }, + }, + { + key: "updateCursorStyle", + value: function (i) { + i + ? this.core.$el.removeClass("nocursor") + : this.core.isFullscreen() && + this.core.$el.addClass("nocursor"); + }, + }, + { + key: "settingsUpdate", + value: function () { + var i = this.getSettings(); + i && + !this.fullScreenOnVideoTagSupported && + !il.fullscreenEnabled() && + (i.default && Yr(i.default, "fullscreen"), + i.left && Yr(i.left, "fullscreen"), + i.right && Yr(i.right, "fullscreen")); + var n = JSON.stringify(this.settings) !== JSON.stringify(i); + n && ((this.settings = i), this.render()); + }, + }, + { + key: "getSettings", + value: function () { + return te.extend( + !0, + {}, + this.container && this.container.settings + ); + }, + }, + { + key: "highDefinitionUpdate", + value: function (i) { + this.isHD = i; + var n = i ? "addClass" : "removeClass"; + this.$hdIndicator[n]("enabled"); + }, + }, + { + key: "createCachedElements", + value: function () { + var i = this.$el.find(".media-control-layer"); + (this.$duration = i.find( + ".media-control-indicator[data-duration]" + )), + (this.$fullscreenToggle = i.find( + "button.media-control-button[data-fullscreen]" + )), + (this.$playPauseToggle = i.find( + "button.media-control-button[data-playpause]" + )), + (this.$playStopToggle = i.find( + "button.media-control-button[data-playstop]" + )), + (this.$position = i.find( + ".media-control-indicator[data-position]" + )), + (this.$seekBarContainer = i.find( + ".bar-container[data-seekbar]" + )), + (this.$seekBarHover = i.find(".bar-hover[data-seekbar]")), + (this.$seekBarLoaded = i.find(".bar-fill-1[data-seekbar]")), + (this.$seekBarPosition = i.find(".bar-fill-2[data-seekbar]")), + (this.$seekBarScrubber = i.find(".bar-scrubber[data-seekbar]")), + (this.$volumeBarContainer = i.find( + ".bar-container[data-volume]" + )), + (this.$volumeContainer = i.find( + ".drawer-container[data-volume]" + )), + (this.$volumeIcon = i.find(".drawer-icon[data-volume]")), + (this.$volumeBarBackground = this.$el.find( + ".bar-background[data-volume]" + )), + (this.$volumeBarFill = this.$el.find( + ".bar-fill-1[data-volume]" + )), + (this.$volumeBarScrubber = this.$el.find( + ".bar-scrubber[data-volume]" + )), + (this.$hdIndicator = this.$el.find( + "button.media-control-button[data-hd-indicator]" + )), + this.resetIndicators(), + this.initializeIcons(); + }, + }, + { + key: "resetIndicators", + value: function () { + (this.displayedPosition = this.$position.text()), + (this.displayedDuration = this.$duration.text()); + }, + }, + { + key: "initializeIcons", + value: function () { + var i = this.$el.find(".media-control-layer"); + i.find("button.media-control-button[data-play]").append(Xt), + i.find("button.media-control-button[data-pause]").append(Hr), + i.find("button.media-control-button[data-stop]").append(Qo), + this.$playPauseToggle.append(Xt), + this.$playStopToggle.append(Xt), + this.$volumeIcon.append(Jo), + this.$fullscreenToggle.append(el), + this.$hdIndicator.append(xg); + }, + }, + { + key: "setSeekPercentage", + value: function (i) { + (i = Math.max(Math.min(i, 100), 0)), + this.displayedSeekBarPercentage !== i && + ((this.displayedSeekBarPercentage = i), + this.$seekBarPosition.removeClass( + "media-control-notransition" + ), + this.$seekBarScrubber.removeClass( + "media-control-notransition" + ), + this.$seekBarPosition.css({ width: "".concat(i, "%") }), + this.$seekBarScrubber.css({ left: "".concat(i, "%") })); + }, + }, + { + key: "seekRelative", + value: function (i) { + if (this.settings.seekEnabled) { + var n = this.container.getCurrentTime(), + r = this.container.getDuration(), + a = Math.min(Math.max(n + i, 0), r); + (a = Math.min((a * 100) / r, 100)), + this.container.seekPercentage(a); + } + }, + }, + { + key: "bindKeyAndShow", + value: function (i, n) { + var r = this; + this.kibo.down(i, function () { + return r.show(), n(); + }); + }, + }, + { + key: "bindKeyEvents", + value: function () { + var i = this; + if (!(ee.isMobile || this.options.disableKeyboardShortcuts)) { + this.unbindKeyEvents(), + (this.kibo = new Q( + this.options.focusElement || this.options.parentElement + )), + this.bindKeyAndShow("space", function () { + return i.togglePlayPause(); + }), + this.bindKeyAndShow("left", function () { + return i.seekRelative(-5); + }), + this.bindKeyAndShow("right", function () { + return i.seekRelative(5); + }), + this.bindKeyAndShow("shift left", function () { + return i.seekRelative(-10); + }), + this.bindKeyAndShow("shift right", function () { + return i.seekRelative(10); + }), + this.bindKeyAndShow("shift ctrl left", function () { + return i.seekRelative(-15); + }), + this.bindKeyAndShow("shift ctrl right", function () { + return i.seekRelative(15); + }); + var n = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]; + n.forEach(function (r) { + i.bindKeyAndShow(r, function () { + i.settings.seekEnabled && + i.container && + i.container.seekPercentage(r * 10); + }); + }); + } + }, + }, + { + key: "unbindKeyEvents", + value: function () { + this.kibo && + (this.kibo.off("space"), + this.kibo.off("left"), + this.kibo.off("right"), + this.kibo.off("shift left"), + this.kibo.off("shift right"), + this.kibo.off("shift ctrl left"), + this.kibo.off("shift ctrl right"), + this.kibo.off([ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "0", + ])); + }, + }, + { + key: "parseColors", + value: function () { + if (this.options.mediacontrol) { + this.buttonsColor = this.options.mediacontrol.buttons; + var i = this.options.mediacontrol.seekbar; + this.$el + .find(".bar-fill-2[data-seekbar]") + .css("background-color", i), + this.$el + .find(".media-control-icon svg path") + .css("fill", this.buttonsColor), + this.$el + .find(".segmented-bar-element[data-volume]") + .css("boxShadow", "inset 2px 0 0 " + this.buttonsColor); + } + }, + }, + { + key: "applyButtonStyle", + value: function (i) { + this.buttonsColor && + i && + te(i).find("svg path").css("fill", this.buttonsColor); + }, + }, + { + key: "destroy", + value: function () { + te(document).unbind("mouseup", this.stopDragHandler), + te(document).unbind("mousemove", this.updateDragHandler), + this.unbindKeyEvents(), + this.stopListening(), + Gr(e, "destroy", this)([]); + }, + }, + { + key: "configure", + value: function (i) { + this.options.chromeless || i.source || i.sources + ? this.disable() + : this.enable(), + this.trigger(A.MEDIACONTROL_OPTIONS_CHANGE); + }, + }, + { + key: "render", + value: function () { + var i = this, + n = this.options.hideMediaControlDelay || 2e3; + this.settings && + this.$el.html(this.template({ settings: this.settings })); + var r = Ue.getStyleFor(_g, { baseUrl: this.options.baseUrl }); + this.$el.append(r[0]), + this.createCachedElements(), + this.$playPauseToggle.addClass("paused"), + this.$playStopToggle.addClass("stopped"), + this.changeTogglePlay(), + this.container && + ((this.hideId = setTimeout(function () { + return i.hide(); + }, n)), + this.disabled && this.hide()), + ee.isSafari && + ee.isMobile && + (ee.version < 10 + ? this.$volumeContainer.css("display", "none") + : this.$volumeBarContainer.css("display", "none")), + this.$seekBarPosition.addClass("media-control-notransition"), + this.$seekBarScrubber.addClass("media-control-notransition"); + var a = 0; + return ( + this.displayedSeekBarPercentage && + (a = this.displayedSeekBarPercentage), + (this.displayedSeekBarPercentage = null), + this.setSeekPercentage(a), + setTimeout(function () { + !i.settings.seekEnabled && + i.$seekBarContainer.addClass("seek-disabled"), + !ee.isMobile && + !i.options.disableKeyboardShortcuts && + i.bindKeyEvents(), + i.playerResize({ + width: i.options.width, + height: i.options.height, + }), + i.hideVolumeBar(0); + }, 0), + this.parseColors(), + this.highDefinitionUpdate(this.isHD), + this.core.$el.append(this.el), + (this.rendered = !0), + this.updateVolumeUI(), + this.trigger(A.MEDIACONTROL_RENDERED), + this + ); + }, + }, + ]) + ); + })(Ze); + zr.extend = function (s) { + return Lg(zr, s); + }; + var Ig = `<div class="play-wrapper" data-poster></div> +`, + Rg = `.player-poster[data-poster] { + display: flex; + justify-content: center; + align-items: center; + position: absolute; + height: 100%; + width: 100%; + z-index: 998; + top: 0; + left: 0; + background-color: transparent; + background-size: cover; + background-repeat: no-repeat; + background-position: 50% 50%; } + .player-poster[data-poster].clickable { + cursor: pointer; } + .player-poster[data-poster]:hover .play-wrapper[data-poster] { + opacity: 1; } + .player-poster[data-poster] .play-wrapper[data-poster] { + width: 100%; + height: 25%; + margin: 0 auto; + opacity: 0.75; + transition: opacity 0.1s ease; } + .player-poster[data-poster] .play-wrapper[data-poster] svg { + height: 100%; } + .player-poster[data-poster] .play-wrapper[data-poster] svg path { + fill: #fff; } +`, + Pg = (function (s) { + function e(t) { + var i; + return ( + Je(this, e), + (i = Qe(this, e, [t])), + (i.hasStartedPlaying = !1), + (i.playRequested = !1), + i.render(), + setTimeout(function () { + return i.update(); + }, 0), + i + ); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "poster"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "template", + get: function () { + return He(Ig); + }, + }, + { + key: "shouldRender", + get: function () { + var i = !!( + this.options.poster && this.options.poster.showForNoOp + ); + return ( + this.container.playback.name !== "html_img" && + (this.container.playback.getPlaybackType() !== ge.NO_OP || i) + ); + }, + }, + { + key: "attributes", + get: function () { + return { class: "player-poster", "data-poster": "" }; + }, + }, + { + key: "events", + get: function () { + return { click: "clicked" }; + }, + }, + { + key: "showOnVideoEnd", + get: function () { + return ( + !this.options.poster || + this.options.poster.showOnVideoEnd || + this.options.poster.showOnVideoEnd === void 0 + ); + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo(this.container, A.CONTAINER_STOP, this.onStop), + this.listenTo(this.container, A.CONTAINER_PLAY, this.onPlay), + this.listenTo( + this.container, + A.CONTAINER_STATE_BUFFERING, + this.update + ), + this.listenTo( + this.container, + A.CONTAINER_STATE_BUFFERFULL, + this.update + ), + this.listenTo( + this.container, + A.CONTAINER_OPTIONS_CHANGE, + this.render + ), + this.listenTo(this.container, A.CONTAINER_ERROR, this.onError), + this.showOnVideoEnd && + this.listenTo(this.container, A.CONTAINER_ENDED, this.onStop); + }, + }, + { + key: "onError", + value: function (i) { + (this.hasFatalError = i.level === Lt.Levels.FATAL), + this.hasFatalError && + ((this.hasStartedPlaying = !1), + (this.playRequested = !1), + this.showPlayButton()); + }, + }, + { + key: "onPlay", + value: function () { + (this.hasStartedPlaying = !0), this.update(); + }, + }, + { + key: "onStop", + value: function () { + (this.hasStartedPlaying = !1), + (this.playRequested = !1), + this.update(); + }, + }, + { + key: "updatePlayButton", + value: function (i) { + i && + (!this.options.chromeless || this.options.allowUserInteraction) + ? this.showPlayButton() + : this.hidePlayButton(); + }, + }, + { + key: "showPlayButton", + value: function () { + (this.hasFatalError && !this.options.disableErrorScreen) || + (this.$playButton.show(), this.$el.addClass("clickable")); + }, + }, + { + key: "hidePlayButton", + value: function () { + this.$playButton.hide(), this.$el.removeClass("clickable"); + }, + }, + { + key: "clicked", + value: function () { + if (!this.hasStartedPlaying) + return ( + (!this.options.chromeless || + this.options.allowUserInteraction) && + ((this.playRequested = !0), + this.update(), + this.container.playback && + (this.container.playback._consented = !0), + this.container.play()), + !1 + ); + }, + }, + { + key: "shouldHideOnPlay", + value: function () { + return !this.container.playback.isAudioOnly; + }, + }, + { + key: "update", + value: function () { + if (this.shouldRender) { + var i = + !this.playRequested && + !this.hasStartedPlaying && + !this.container.buffering; + this.updatePlayButton(i), this.updatePoster(); + } + }, + }, + { + key: "updatePoster", + value: function () { + this.hasStartedPlaying ? this.hidePoster() : this.showPoster(); + }, + }, + { + key: "showPoster", + value: function () { + this.container.disableMediaControl(), this.$el.show(); + }, + }, + { + key: "hidePoster", + value: function () { + this.container.enableMediaControl(), + this.shouldHideOnPlay() && this.$el.hide(); + }, + }, + { + key: "render", + value: function () { + if (this.shouldRender) { + var i = Ue.getStyleFor(Rg, { baseUrl: this.options.baseUrl }); + this.$el.html(this.template()), this.$el.append(i[0]); + var n = + this.options.poster && this.options.poster.custom === void 0; + if (n) { + var r = this.options.poster.url || this.options.poster; + this.$el.css({ "background-image": "url(" + r + ")" }), + this.removeVideoElementPoster(); + } else + this.options.poster && + (this.$el.css({ background: this.options.poster.custom }), + this.removeVideoElementPoster()); + this.container.$el.append(this.el), + (this.$playWrapper = this.$el.find(".play-wrapper")), + this.$playWrapper.append(Xt), + (this.$playButton = this.$playWrapper.find("svg")), + this.$playButton.addClass("poster-icon"), + this.$playButton.attr("data-poster", ""); + var a = + this.options.mediacontrol && + this.options.mediacontrol.buttons; + return ( + a && this.$el.find("svg path").css("fill", a), + this.options.mediacontrol && + this.options.mediacontrol.buttons && + ((a = this.options.mediacontrol.buttons), + this.$playButton.css("color", a)), + this.update(), + this + ); + } + }, + }, + { + key: "removeVideoElementPoster", + value: function () { + this.container.playback && + this.container.playback.$el && + this.container.playback.$el[0] && + this.container.playback.$el[0].removeAttribute && + this.container.playback.$el[0].removeAttribute("poster"); + }, + }, + ]) + ); + })(Rt), + wg = `<span data-seek-time></span> +<span data-duration></span> +`, + Dg = `.seek-time[data-seek-time] { + position: absolute; + white-space: nowrap; + height: 20px; + line-height: 20px; + font-size: 0; + left: -100%; + bottom: 55px; + background-color: rgba(2, 2, 2, 0.5); + z-index: 9999; + transition: opacity 0.1s ease; } + .seek-time[data-seek-time].hidden[data-seek-time] { + opacity: 0; } + .seek-time[data-seek-time] [data-seek-time] { + display: inline-block; + color: white; + font-size: 10px; + padding-left: 7px; + padding-right: 7px; + vertical-align: top; } + .seek-time[data-seek-time] [data-duration] { + display: inline-block; + color: rgba(255, 255, 255, 0.5); + font-size: 10px; + padding-right: 7px; + vertical-align: top; } + .seek-time[data-seek-time] [data-duration]:before { + content: "|"; + margin-right: 7px; } +`, + rl = Ut.formatTime, + Og = (function (s) { + function e(t) { + var i; + return ( + Je(this, e), + (i = Qe(this, e, [t])), + (i.hoveringOverSeekBar = !1), + (i.hoverPosition = null), + (i.duration = null), + (i.firstFragDateTime = null), + (i.actualLiveTime = !!i.mediaControl.options.actualLiveTime), + i.actualLiveTime && + (i.mediaControl.options.actualLiveServerTime + ? (i.actualLiveServerTimeDiff = + new Date().getTime() - + new Date( + i.mediaControl.options.actualLiveServerTime + ).getTime()) + : (i.actualLiveServerTimeDiff = 0)), + i + ); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "seek_time"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "template", + get: function () { + return He(wg); + }, + }, + { + key: "attributes", + get: function () { + return { class: "seek-time", "data-seek-time": "" }; + }, + }, + { + key: "mediaControl", + get: function () { + return this.core.mediaControl; + }, + }, + { + key: "mediaControlContainer", + get: function () { + return this.mediaControl.container; + }, + }, + { + key: "isLiveStreamWithDvr", + get: function () { + return ( + this.mediaControlContainer && + this.mediaControlContainer.getPlaybackType() === ge.LIVE && + this.mediaControlContainer.isDvrEnabled() + ); + }, + }, + { + key: "durationShown", + get: function () { + return this.isLiveStreamWithDvr && !this.actualLiveTime; + }, + }, + { + key: "useActualLiveTime", + get: function () { + return this.actualLiveTime && this.isLiveStreamWithDvr; + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo( + this.mediaControl, + A.MEDIACONTROL_RENDERED, + this.render + ), + this.listenTo( + this.mediaControl, + A.MEDIACONTROL_MOUSEMOVE_SEEKBAR, + this.showTime + ), + this.listenTo( + this.mediaControl, + A.MEDIACONTROL_MOUSELEAVE_SEEKBAR, + this.hideTime + ), + this.listenTo( + this.mediaControl, + A.MEDIACONTROL_CONTAINERCHANGED, + this.onContainerChanged + ), + this.mediaControlContainer && + (this.listenTo( + this.mediaControlContainer, + A.CONTAINER_PLAYBACKDVRSTATECHANGED, + this.update + ), + this.listenTo( + this.mediaControlContainer, + A.CONTAINER_TIMEUPDATE, + this.updateDuration + )); + }, + }, + { + key: "onContainerChanged", + value: function () { + this.stopListening(), this.bindEvents(); + }, + }, + { + key: "updateDuration", + value: function (i) { + (this.duration = i.total), + (this.firstFragDateTime = i.firstFragDateTime), + this.update(); + }, + }, + { + key: "showTime", + value: function (i) { + (this.hoveringOverSeekBar = !0), + this.calculateHoverPosition(i), + this.update(); + }, + }, + { + key: "hideTime", + value: function () { + (this.hoveringOverSeekBar = !1), this.update(); + }, + }, + { + key: "calculateHoverPosition", + value: function (i) { + var n = + i.pageX - this.mediaControl.$seekBarContainer.offset().left; + this.hoverPosition = Math.min( + 1, + Math.max(n / this.mediaControl.$seekBarContainer.width(), 0) + ); + }, + }, + { + key: "getSeekTime", + value: function () { + var i, n, r, a; + return ( + this.useActualLiveTime + ? (this.firstFragDateTime + ? ((a = new Date(this.firstFragDateTime)), + (r = new Date(this.firstFragDateTime)), + r.setHours(0, 0, 0, 0), + (n = (a.getTime() - r.getTime()) / 1e3 + this.duration)) + : ((r = new Date( + new Date().getTime() - this.actualLiveServerTimeDiff + )), + (a = new Date(r)), + (n = (a - r.setHours(0, 0, 0, 0)) / 1e3)), + (i = + n - this.duration + this.hoverPosition * this.duration), + i < 0 && (i += 86400)) + : (i = this.hoverPosition * this.duration), + { seekTime: i, secondsSinceMidnight: n } + ); + }, + }, + { + key: "update", + value: function () { + if (this.rendered) + if (!this.shouldBeVisible()) + this.$el.hide(), this.$el.css("left", "-100%"); + else { + var i = this.getSeekTime(), + n = rl(i.seekTime, this.useActualLiveTime); + if ( + (n !== this.displayedSeekTime && + (this.$seekTimeEl.text(n), (this.displayedSeekTime = n)), + this.durationShown) + ) { + this.$durationEl.show(); + var r = rl( + this.actualLiveTime + ? i.secondsSinceMidnight + : this.duration, + this.actualLiveTime + ); + r !== this.displayedDuration && + (this.$durationEl.text(r), (this.displayedDuration = r)); + } else this.$durationEl.hide(); + this.$el.show(); + var a = this.mediaControl.$seekBarContainer.width(), + o = this.$el.width(), + l = this.hoverPosition * a; + (l -= o / 2), + (l = Math.max(0, Math.min(l, a - o))), + this.$el.css("left", l); + } + }, + }, + { + key: "shouldBeVisible", + value: function () { + return ( + this.mediaControlContainer && + this.mediaControlContainer.settings.seekEnabled && + this.hoveringOverSeekBar && + this.hoverPosition !== null && + this.duration !== null + ); + }, + }, + { + key: "render", + value: function () { + var i = Ue.getStyleFor(Dg, { baseUrl: this.options.baseUrl }); + (this.rendered = !0), + (this.displayedDuration = null), + (this.displayedSeekTime = null), + this.$el.html(this.template()), + this.$el.append(i[0]), + this.$el.hide(), + this.mediaControl.$el.append(this.el), + (this.$seekTimeEl = this.$el.find("[data-seek-time]")), + (this.$durationEl = this.$el.find("[data-duration]")), + this.$durationEl.hide(), + this.update(); + }, + }, + ]) + ); + })(Ze), + Ng = `<div data-bounce1></div><div data-bounce2></div><div data-bounce3></div> +`, + Fg = `.spinner-three-bounce[data-spinner] { + position: absolute; + margin: 0 auto; + width: 70px; + text-align: center; + z-index: 999; + left: 0; + right: 0; + margin-left: auto; + margin-right: auto; + /* center vertically */ + top: 50%; + transform: translateY(-50%); } + .spinner-three-bounce[data-spinner] > div { + width: 18px; + height: 18px; + background-color: #FFFFFF; + border-radius: 100%; + display: inline-block; + animation: bouncedelay 1.4s infinite ease-in-out; + /* Prevent first frame from flickering when animation starts */ + animation-fill-mode: both; } + .spinner-three-bounce[data-spinner] [data-bounce1] { + animation-delay: -0.32s; } + .spinner-three-bounce[data-spinner] [data-bounce2] { + animation-delay: -0.16s; } + +@keyframes bouncedelay { + 0%, 80%, 100% { + transform: scale(0); } + 40% { + transform: scale(1); } } +`, + Mg = (function (s) { + function e(t) { + var i; + return ( + Je(this, e), + (i = Qe(this, e, [t])), + (i.template = He(Ng)), + (i.showTimeout = null), + i.listenTo(i.container, A.CONTAINER_STATE_BUFFERING, i.onBuffering), + i.listenTo(i.container, A.CONTAINER_STATE_BUFFERFULL, i.onBufferFull), + i.listenTo(i.container, A.CONTAINER_STOP, i.onStop), + i.listenTo(i.container, A.CONTAINER_ENDED, i.onStop), + i.listenTo(i.container, A.CONTAINER_ERROR, i.onStop), + i.render(), + i + ); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "spinner"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "attributes", + get: function () { + return { "data-spinner": "", class: "spinner-three-bounce" }; + }, + }, + { + key: "onBuffering", + value: function () { + this.show(); + }, + }, + { + key: "onBufferFull", + value: function () { + this.hide(); + }, + }, + { + key: "onStop", + value: function () { + this.hide(); + }, + }, + { + key: "show", + value: function () { + var i = this; + this.showTimeout === null && + (this.showTimeout = setTimeout(function () { + return i.$el.show(); + }, 300)); + }, + }, + { + key: "hide", + value: function () { + this.showTimeout !== null && + (clearTimeout(this.showTimeout), (this.showTimeout = null)), + this.$el.hide(); + }, + }, + { + key: "render", + value: function () { + var i = Ue.getStyleFor(Fg, { baseUrl: this.options.baseUrl }); + return ( + this.$el.html(this.template()), + this.$el.append(i[0]), + this.container.$el.append(this.$el), + this.$el.hide(), + this.container.buffering && this.onBuffering(), + this + ); + }, + }, + ]) + ); + })(Rt), + Bg = (function (s) { + function e(t) { + var i; + return ( + Je(this, e), + (i = Qe(this, e, [t])), + i.setInitialAttrs(), + (i.reportInterval = i.options.reportInterval || 5e3), + (i.state = "IDLE"), + i + ); + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "stats"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo( + this.container.playback, + A.PLAYBACK_PLAY, + this.onPlay + ), + this.listenTo(this.container, A.CONTAINER_STOP, this.onStop), + this.listenTo(this.container, A.CONTAINER_ENDED, this.onStop), + this.listenTo( + this.container, + A.CONTAINER_DESTROYED, + this.onStop + ), + this.listenTo( + this.container, + A.CONTAINER_STATE_BUFFERING, + this.onBuffering + ), + this.listenTo( + this.container, + A.CONTAINER_STATE_BUFFERFULL, + this.onBufferFull + ), + this.listenTo( + this.container, + A.CONTAINER_STATS_ADD, + this.onStatsAdd + ), + this.listenTo( + this.container, + A.CONTAINER_BITRATE, + this.onStatsAdd + ), + this.listenTo( + this.container.playback, + A.PLAYBACK_STATS_ADD, + this.onStatsAdd + ); + }, + }, + { + key: "setInitialAttrs", + value: function () { + (this.firstPlay = !0), + (this.startupTime = 0), + (this.rebufferingTime = 0), + (this.watchingTime = 0), + (this.rebuffers = 0), + (this.externalMetrics = {}); + }, + }, + { + key: "onPlay", + value: function () { + (this.state = "PLAYING"), + (this.watchingTimeInit = Date.now()), + this.intervalId || + (this.intervalId = setInterval( + this.report.bind(this), + this.reportInterval + )); + }, + }, + { + key: "onStop", + value: function () { + clearInterval(this.intervalId), + this.report(), + (this.intervalId = void 0), + (this.state = "STOPPED"); + }, + }, + { + key: "onBuffering", + value: function () { + this.firstPlay + ? (this.startupTimeInit = Date.now()) + : (this.rebufferingTimeInit = Date.now()), + (this.state = "BUFFERING"), + this.rebuffers++; + }, + }, + { + key: "onBufferFull", + value: function () { + this.firstPlay && this.startupTimeInit + ? ((this.firstPlay = !1), + (this.startupTime = Date.now() - this.startupTimeInit), + (this.watchingTimeInit = Date.now())) + : this.rebufferingTimeInit && + (this.rebufferingTime += this.getRebufferingTime()), + (this.rebufferingTimeInit = void 0), + (this.state = "PLAYING"); + }, + }, + { + key: "getRebufferingTime", + value: function () { + return Date.now() - this.rebufferingTimeInit; + }, + }, + { + key: "getWatchingTime", + value: function () { + var i = Date.now() - this.watchingTimeInit; + return i - this.rebufferingTime; + }, + }, + { + key: "isRebuffering", + value: function () { + return !!this.rebufferingTimeInit; + }, + }, + { + key: "onStatsAdd", + value: function (i) { + te.extend(this.externalMetrics, i); + }, + }, + { + key: "getStats", + value: function () { + var i = { + startupTime: this.startupTime, + rebuffers: this.rebuffers, + rebufferingTime: this.isRebuffering() + ? this.rebufferingTime + this.getRebufferingTime() + : this.rebufferingTime, + watchingTime: this.isRebuffering() + ? this.getWatchingTime() - this.getRebufferingTime() + : this.getWatchingTime(), + }; + return te.extend(i, this.externalMetrics), i; + }, + }, + { + key: "report", + value: function () { + this.container.statsReport(this.getStats()); + }, + }, + ]) + ); + })(yt), + Ug = `<div class="clappr-watermark" data-watermark data-watermark-<%=position %>> +<% if(typeof imageLink !== 'undefined') { %> +<a target="_blank" href="<%= imageLink %>"> +<% } %> +<img src="<%= imageUrl %>"> +<% if(typeof imageLink !== 'undefined') { %> +</a> +<% } %> +</div> +`, + $g = `.clappr-watermark[data-watermark] { + position: absolute; + min-width: 70px; + max-width: 200px; + width: 12%; + text-align: center; + z-index: 10; } + +.clappr-watermark[data-watermark] a { + outline: none; + cursor: pointer; } + +.clappr-watermark[data-watermark] img { + max-width: 100%; } + +.clappr-watermark[data-watermark-bottom-left] { + bottom: 10px; + left: 10px; } + +.clappr-watermark[data-watermark-bottom-right] { + bottom: 10px; + right: 42px; } + +.clappr-watermark[data-watermark-top-left] { + top: 10px; + left: 10px; } + +.clappr-watermark[data-watermark-top-right] { + top: 10px; + right: 37px; } +`, + Vg = (function (s) { + function e(t) { + var i; + return Je(this, e), (i = Qe(this, e, [t])), i.configure(), i; + } + return ( + tt(e, s), + et(e, [ + { + key: "name", + get: function () { + return "watermark"; + }, + }, + { + key: "supportedVersion", + get: function () { + return { min: "0.11.3" }; + }, + }, + { + key: "template", + get: function () { + return He(Ug); + }, + }, + { + key: "bindEvents", + value: function () { + this.listenTo(this.container, A.CONTAINER_PLAY, this.onPlay), + this.listenTo(this.container, A.CONTAINER_STOP, this.onStop), + this.listenTo( + this.container, + A.CONTAINER_OPTIONS_CHANGE, + this.configure + ); + }, + }, + { + key: "configure", + value: function () { + (this.position = this.options.position || "bottom-right"), + this.options.watermark + ? ((this.imageUrl = this.options.watermark), + (this.imageLink = this.options.watermarkLink), + this.render()) + : this.$el.remove(); + }, + }, + { + key: "onPlay", + value: function () { + this.hidden || this.$el.show(); + }, + }, + { + key: "onStop", + value: function () { + this.$el.hide(); + }, + }, + { + key: "render", + value: function () { + this.$el.hide(); + var i = Ue.getStyleFor($g, { baseUrl: this.options.baseUrl }), + n = { + position: this.position, + imageUrl: this.imageUrl, + imageLink: this.imageLink, + }; + return ( + this.$el.html(this.template(n)), + this.$el.append(i[0]), + this.container.$el.append(this.$el), + this + ); + }, + }, + ]) + ); + })(Rt), + Gg = { + ClickToPause: og, + ClosedCaptions: hg, + DVRControls: gg, + EndVideo: pg, + ErrorScreen: vg, + Favicon: Tg, + GoogleAnalytics: bg, + MediaControl: zr, + Poster: Pg, + SeekTime: Og, + SpinnerThreeBounce: Mg, + Stats: Bg, + WaterMark: Vg, + }; + class Kg extends yt { + static get version() { + return "1.0.0"; + } + get name() { + return "error_plugin"; + } + get background() { + return "data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%22%20height%3D%22100%22%20viewBox%3D%220%200%2026.458318%2026.458333%22%3E%3Cpath%20d%3D%22M13.23.302C6.07.302.264%206.107.264%2013.267a12.965%2012.965%200%200%200%20.847%204.595c.19-.497.408-.982.682-1.438.14-.232.294-.457.396-.707.103-.25.15-.533.072-.792a1.362%201.362%200%200%200-.22-.404c-.092-.123-.192-.24-.275-.37a1.662%201.662%200%200%201-.255-1.12%201.5%201.5%200%200%201%20.58-.987c.28-.208.635-.3.985-.288a1.757%201.757%200%200%201%20.346.048c.452.11.852.393%201.148.75.368.447.584%201.01.637%201.586a3.574%203.574%200%200%201-.275%201.693c-.4.955-1.15%201.725-1.565%202.673-.338.775-.435%201.638-.39%202.483.007.077.018.155.025.234a12.965%2012.965%200%200%200%203.62%203.18%2017.63%2017.63%200%200%201-.13-2.11c.002-.56.03-1.12.085-1.675-.34-.236-.65-.51-.87-.86-.392-.62-.466-1.408-.305-2.124.16-.717.54-1.37.997-1.945a7.833%207.833%200%200%201%202.835-2.223%2010.305%2010.305%200%200%201-.09-.126%204.854%204.854%200%200%201-.702-2.176c-.06-.777.064-1.554.115-2.33.037-.543.04-1.085.07-1.627.038-.627.114-1.255.29-1.858a2.36%202.36%200%200%201%20.266-.63%201.4%201.4%200%200%201%20.594-.514c.274-.108.51-.132.776-.087.22.046.425.156.604.294.18.138.335.304.48.477a7.298%207.298%200%200%201%201.04%201.617%203.57%203.57%200%200%201%201.09%200%207.287%207.287%200%200%201%201.04-1.616%203.21%203.21%200%200%201%20.48-.476c.18-.14.383-.248.604-.295a1.268%201.268%200%200%201%20.78.086%201.402%201.402%200%200%201%20.595.517c.124.19.202.408.266.626.175.602.252%201.23.29%201.856.03.543.033%201.087.07%201.628.05.777.175%201.554.116%202.33a4.855%204.855%200%200%201-.705%202.178c-.03.05-.07.096-.103.145.247.278.598.513.898.614a1.956%201.956%200%200%200%201.05.044%201.65%201.65%200%200%200%20.533-.226%201.253%201.253%200%200%200%20.397-.418c.118-.21.166-.45.192-.687.067-.61%200-1.224-.05-1.835-.034-.396-.062-.8.027-1.187.06-.26.177-.518.373-.7a1.106%201.106%200%200%201%20.465-.255%201.312%201.312%200%200%201%20.53-.03c.38.057.736.274.948.594.12.18.194.39.238.604.044.213.06.43.072.648.04.76.04%201.522.018%202.284-.018.665-.055%201.348-.32%201.957-.343.782-1.032%201.366-1.775%201.786a7.052%207.052%200%200%201-1.588.647c.482%201.54.733%203.24.733%204.968a17.6%2017.6%200%200%201-.135%202.125%2012.964%2012.964%200%200%200%206.384-11.152c0-7.16-5.806-12.965-12.965-12.965zM9.602%2016.284v1.483a1.88%201.88%200%200%201%201.083.362%201.738%201.738%200%200%201%20.556.68c.122.27.166.576.116.868a1.493%201.493%200%200%201-.332.708%201.647%201.647%200%200%201-.635.458%201.738%201.738%200%200%201-.787.122v3.73l7.762-4.208-7.762-4.204z%22%20fill%3D%22%23999%22%2F%3E%3C%2Fsvg%3E"; + } + constructor(...e) { + super(...e), (this.timeout = 1), (this.max_timeout = 10); + } + bindEvents() { + this.listenTo(this.container, A.CONTAINER_ERROR, this.onError); + } + hide() { + this._err && this._err.remove(); + } + show(e) { + this.hide(); + const t = (e && e.title) || "Oh no, we encountered an error", + i = (e && e.subtitle) || "Please reload the page"; + this._err = te("<div>").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", + }); + const n = te("<div>") + .css({ + position: "absolute", + width: "100%", + "padding-bottom": "5%", + bottom: 0, + }) + .append(te("<h2>").text(t).css({ "font-size": "2em" })) + .append( + te("<p>").text(i).css({ "font-size": "1.2em", margin: "15px" }) + ); + this._err.append(n), + this.container && this.container.$el.prepend(this._err); + } + onError(e) { + if (!this.container) return; + const t = () => { + this.hide(), this.container.getPlugin("click_to_pause").enable(); + }, + i = this.options.errorPlugin.onError; + let n = null; + i && typeof i == "function" && (n = i(e, t)), + this.show(n), + this.container.getPlugin("click_to_pause").disable(); + } + } + const Hg = `<button data-audio-track-selector-button>Language</button> +<ul> + <% if (title) { %> + <li data-title><%= title %></li> + <% }; %> <% languages.forEach((language) => { %> + <li> + <a href="#" data-audio-track-selector-lang="<%= language %>" + ><%= language %></a + > + </li> + <% }); %> +</ul> +`, + Yg = + ".audio_track_selector[data-audio-track-selector]{float:right;height:100%;position:relative}.audio_track_selector[data-audio-track-selector] button{background-color:transparent;color:#fff;font-family:Roboto,Open Sans,Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:12px;height:100%}.audio_track_selector[data-audio-track-selector] button:hover{color:#c9c9c9}.audio_track_selector[data-audio-track-selector] button.changing{-webkit-animation:pulse .5s infinite alternate;animation:pulse .5s infinite alternate}.audio_track_selector[data-audio-track-selector]>ul{overflow-x:hidden;overflow-y:auto;list-style-type:none;position:absolute;bottom:100%;display:none;background-color:#1c1c1ce6;white-space:nowrap}.audio_track_selector[data-audio-track-selector] li{font-size:12px;color:#eee}.audio_track_selector[data-audio-track-selector] li[data-title]{background-color:#333;padding:8px 25px}.audio_track_selector[data-audio-track-selector] li a{color:#eee;padding:5px 18px;display:block;text-decoration:none}.audio_track_selector[data-audio-track-selector] li a:hover{background-color:#ffffff1a;color:#fff}.audio_track_selector[data-audio-track-selector] li a:hover a{color:#fff;text-decoration:none}.audio_track_selector[data-audio-track-selector] li.current a{color:#2ecc71}@-webkit-keyframes pulse{0%{color:#fff}50%{color:#ff0101}to{color:#b80000}}@keyframes pulse{0%{color:#fff}50%{color:#ff0101}to{color:#b80000}}"; + class zg extends Ze { + static get version() { + return "0.1.0"; + } + get name() { + return "audio_track_selector"; + } + get template() { + return He(Hg); + } + get attributes() { + return { class: this.name, "data-audio-track-selector": "" }; + } + get events() { + return { + "click [data-audio-track-selector-lang]": "handleLanguageSelect", + "click [data-audio-track-selector-button]": + "handleAudioTrackSelectorClick", + }; + } + get container() { + return this.core.activeContainer + ? this.core.activeContainer + : this.core.mediaControl.container; + } + get playback() { + return this.core.activePlayback + ? this.core.activePlayback + : this.core.getCurrentPlayback(); + } + bindEvents() { + A.CORE_ACTIVE_CONTAINER_CHANGED + ? this.listenTo(this.core, A.CORE_ACTIVE_CONTAINER_CHANGED, this.reload) + : this.listenTo( + this.core.mediaControl, + A.MEDIACONTROL_CONTAINERCHANGED, + this.reload + ), + this.listenTo(this.core, A.CORE_READY, this.bindPlaybackEvents), + this.listenTo( + this.core.mediaControl, + A.MEDIACONTROL_RENDERED, + this.render + ), + this.listenTo( + this.core.mediaControl, + A.MEDIACONTROL_HIDE, + this._hideContextMenu + ); + } + bindPlaybackEvents() { + this.listenTo( + this.playback, + A.PLAYBACK_LEVELS_AVAILABLE, + this._handleLevels + ), + this.listenTo( + this.playback, + A.PLAYBACK_BITRATE, + this._handleAdaptation + ), + this.listenTo(this.playback, A.PLAYBACK_PLAY, this._handlePlay); + } + reload() { + this.stopListening(), this.bindEvents(), this.bindPlaybackEvents(); + } + shouldRender() { + if (!this.container || !this.playback) return !1; + var e = !!(this.languages && this.languages.size > 1); + return e; + } + render() { + if (this.shouldRender()) { + var e = Ue.getStyleFor(Yg, { baseUrl: this.core.options.baseUrl }); + this.$el.html( + this.template({ title: this._getTitle(), languages: this.languages }) + ), + this.$el.append(e), + this.core.mediaControl + .$(".media-control-right-panel") + .append(this.el), + this._highlightCurrentElement(); + } + return this; + } + _setLanguage(e) { + if ((console.log("setLanguage", e), this.playback.selectAudioLanguage)) + (this.nextLanguage = e), this.playback.selectAudioLanguage(e); + else if (this.playback._hls) { + const t = this.playback._hls.audioTracks.find( + (i) => i.lang == e || i.name === e + ); + if (!t) return; + (this.playback._hls.audioTrack = t.id), + (this.activeLanguage = e), + this._highlightCurrentElement(); + } else if (this.playback.el.audioTracks) { + const i = [...this.playback.el.audioTracks].find( + (n) => n.language == e || n.label === e + ); + if (!i) return; + (i.enabled = !0), + (this.activeLanguage = e), + this._highlightCurrentElement(); + } + } + _fillLanguages() { + if (this.playback.audioLanguages) + this.languages = new Set(this.playback.audioLanguages); + else if (this.playback._hls) { + const e = this.playback._hls.audioTracks, + t = this.playback._hls.audioTrack, + i = e.find((n) => n.id == t); + (this.languages = new Set(e.map((n) => n.lang || n.name))), + i && (this.activeLanguage = i.lang || i.name); + } else if (this.playback.el.audioTracks) { + const e = [...this.playback.el.audioTracks], + t = e.find((i) => i.enabled); + (this.languages = new Set(e.map((i) => i.language || i.label))), + t && (this.activeLanguage = t.language || t.label); + } + this.render(); + } + handleLanguageSelect(e) { + e.preventDefault(), e.stopPropagation(); + const t = e.target.dataset.audioTrackSelectorLang; + return ( + this.activeLanguage == t || + (this._setLanguage(t), this._toggleContextMenu()), + !1 + ); + } + _handleAdaptation(e) { + e.language && + ((this.activeLanguage = e.language), this._highlightCurrentElement()); + } + _handleLevels() { + this._fillLanguages(); + } + _handlePlay() { + (this.playback._hls || this.playback instanceof st) && + this._fillLanguages(); + } + handleAudioTrackSelectorClick(e) { + this._toggleContextMenu(); + } + _toggleContextMenu() { + this.$(".audio_track_selector ul").toggle(); + } + _hideContextMenu() { + this.$(".audio_track_selector ul").hide(); + } + _getLanguageElement(e = null) { + return e + ? this.$( + '.audio_track_selector a[data-audio-track-selector-lang="' + + e + + '"]' + ).parent() + : this.$(".audio_track_selector a").parent(); + } + _getButtonElement() { + return this.$(".audio_track_selector button"); + } + _getTitle() { + return (this.core.options.audioTrackSelectorConfig || {}).title; + } + _highlightCurrentElement() { + this.activeLanguage && + (this._getLanguageElement().removeClass("current"), + this._getLanguageElement(this.activeLanguage).addClass("current"), + this._getButtonElement().text(this.activeLanguage)); + } + } + const Wg = `<button data-level-selector-button>Auto</button> +<ul> + <% if (title) { %> + <li data-title><%= title %></li> + <% }; %> + <li><a href="#" data-level-selector-select="-1">AUTO</a></li> + <% for (var i = 0; i < levels.length; i++) { %> + <li> + <a href="#" data-level-selector-select="<%= levels[i].id %>" + ><%= levels[i].label %></a + > + </li> + <% }; %> +</ul> +`, + jg = + ".level_selector[data-level-selector]{float:right;height:100%;position:relative}.level_selector[data-level-selector] button{background-color:transparent;color:#fff;font-family:Roboto,Open Sans,Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:12px;height:100%}.level_selector[data-level-selector] button:hover{color:#c9c9c9}.level_selector[data-level-selector] button.changing{-webkit-animation:pulse .5s infinite alternate;animation:pulse .5s infinite alternate}.level_selector[data-level-selector]>ul{overflow-x:hidden;overflow-y:auto;list-style-type:none;position:absolute;bottom:100%;display:none;background-color:#1c1c1ce6;white-space:nowrap}.level_selector[data-level-selector] li{font-size:12px;color:#eee}.level_selector[data-level-selector] li[data-title]{background-color:#333;padding:8px 25px}.level_selector[data-level-selector] li a{color:#eee;padding:5px 18px;display:block;text-decoration:none}.level_selector[data-level-selector] li a:hover{background-color:#ffffff1a;color:#fff}.level_selector[data-level-selector] li a:hover a{color:#fff;text-decoration:none}.level_selector[data-level-selector] li.current a{color:#2ecc71}@-webkit-keyframes pulse{0%{color:#fff}50%{color:#ff0101}to{color:#b80000}}@keyframes pulse{0%{color:#fff}50%{color:#ff0101}to{color:#b80000}}", + sl = -1; + class qg extends Ze { + static get version() { + return VERSION; + } + get name() { + return "level_selector"; + } + get template() { + return He(Wg); + } + get attributes() { + return { class: this.name, "data-level-selector": "" }; + } + get events() { + return { + "click [data-level-selector-select]": "onLevelSelect", + "click [data-level-selector-button]": "onShowLevelSelectMenu", + }; + } + bindEvents() { + this.listenTo(this.core, A.CORE_READY, this.bindPlaybackEvents), + this.listenTo( + this.core.mediaControl, + A.MEDIACONTROL_CONTAINERCHANGED, + this.reload + ), + this.listenTo( + this.core.mediaControl, + A.MEDIACONTROL_RENDERED, + this.render + ), + this.listenTo( + this.core.mediaControl, + A.MEDIACONTROL_HIDE, + this.hideSelectLevelMenu + ); + } + unBindEvents() { + this.stopListening(this.core, A.CORE_READY), + this.stopListening( + this.core.mediaControl, + A.MEDIACONTROL_CONTAINERCHANGED + ), + this.stopListening(this.core.mediaControl, A.MEDIACONTROL_RENDERED), + this.stopListening(this.core.mediaControl, A.MEDIACONTROL_HIDE), + this.stopListening( + this.core.getCurrentPlayback(), + A.PLAYBACK_LEVELS_AVAILABLE + ), + this.stopListening(this.core.getCurrentPlayback(), A.PLAYBACK_BITRATE); + } + bindPlaybackEvents() { + var e = this.core.getCurrentPlayback(); + this.listenTo(e, A.PLAYBACK_LEVELS_AVAILABLE, this.fillLevels), + this.listenTo(e, A.PLAYBACK_BITRATE, this.handleAdaptation); + var t = e.levels && e.levels.length > 0; + t && this.fillLevels(e.levels); + } + reload() { + this.unBindEvents(), this.bindEvents(), this.bindPlaybackEvents(); + } + shouldRender() { + if (!this.core.getCurrentContainer()) return !1; + var e = this.core.getCurrentPlayback(); + if (!e) return !1; + var t = e.currentLevel !== void 0, + i = !!(this.levels && this.levels.length > 1); + return t && i; + } + render() { + if (this.shouldRender()) { + var e = Ue.getStyleFor(jg, { baseUrl: this.core.options.baseUrl }); + this.$el.html( + this.template({ levels: this.levels, title: this.getTitle() }) + ), + this.$el.append(e), + this.core.mediaControl + .$(".media-control-right-panel") + .append(this.el), + this.highlightCurrentLevel(); + } + return this; + } + fillLevels(e, t = sl) { + console.log("got levels", e, t), + this.selectedLevelId === void 0 && (this.selectedLevelId = t), + (this.levels = e), + this.configureLevelsLabels(), + this.render(); + } + configureLevelsLabels() { + if ( + (this.levels.forEach((o) => { + o.label = `${o.height ? o.height : o.level.height}p`; + }), + this.core.options.levelSelectorConfig !== void 0) + ) { + var e = this.core.options.levelSelectorConfig.labelCallback; + if (e && typeof e != "function") + throw new TypeError("labelCallback must be a function"); + var t = this.core.options.levelSelectorConfig.labels, + i = t ? this.core.options.levelSelectorConfig.labels : {}; + if (e || t) { + var n, r; + for (var a in this.levels) + (n = this.levels[a]), + (r = i[n.id]), + e ? (n.label = e(n, r)) : r && (n.label = r); + } + } + } + findLevelBy(e) { + var t; + return ( + this.levels.forEach((i) => { + i.id === e && (t = i); + }), + t + ); + } + onLevelSelect(e) { + return ( + (this.selectedLevelId = parseInt( + e.target.dataset.levelSelectorSelect, + 10 + )), + this.core.getCurrentPlayback().currentLevel == this.selectedLevelId || + ((this.core.getCurrentPlayback().currentLevel = this.selectedLevelId), + this.toggleContextMenu(), + e.stopPropagation()), + !1 + ); + } + onShowLevelSelectMenu(e) { + this.toggleContextMenu(); + } + hideSelectLevelMenu() { + this.$(".level_selector ul").hide(); + } + toggleContextMenu() { + this.$(".level_selector ul").toggle(); + } + buttonElement() { + return this.$(".level_selector button"); + } + levelElement(e) { + return this.$( + ".level_selector ul a" + + (isNaN(e) ? "" : '[data-level-selector-select="' + e + '"]') + ).parent(); + } + getTitle() { + return (this.core.options.levelSelectorConfig || {}).title; + } + updateText(e) { + e === sl + ? this.buttonElement().text( + this.currentLevel + ? "AUTO (" + this.currentLevel.label + ")" + : "AUTO" + ) + : this.buttonElement().text(this.findLevelBy(e).label); + } + handleAdaptation(e) { + var t = this.findLevelBy(e.level); + (this.currentLevel = t || null), this.highlightCurrentLevel(); + } + highlightCurrentLevel() { + this.updateText(this.selectedLevelId), + this.levelElement().removeClass("current"), + this.currentLevel && + this.levelElement(this.currentLevel.id).addClass("current"); + var e = this.currentLevel && this.currentLevel.language; + e && + (this.levelElement().removeClass("hidden"), + this.levels.forEach((t) => { + t.language != e && this.levelElement(t.id).addClass("hidden"); + })); + } + } + const Xg = async (s = "", e = {}) => { + await fetch(s, { + method: "POST", + mode: "cors", + cache: "no-cache", + credentials: "omit", + headers: { "Content-Type": "application/json" }, + redirect: "follow", + referrerPolicy: "no-referrer", + body: JSON.stringify(e), + }); + }, + Zg = async (s) => { + const e = new AbortController(), + t = setTimeout(() => { + e.abort(); + }, 3e3); + await fetch(s + `?t=${Date.now()}`, { + signal: e.signal, + method: "HEAD", + mode: "cors", + cache: "no-cache", + redirect: "follow", + referrerPolicy: "no-referrer", + }), + clearTimeout(t); + }; + function Qg(s) { + let e = []; + for (var t in s) + s.hasOwnProperty(t) && + s[t] != null && + e.push(encodeURIComponent(t) + "=" + encodeURIComponent(s[t])); + return e.join("&"); + } + function Jg(s) { + return new Promise((e, t) => { + const i = new Image(); + (i.onload = () => { + e(); + }), + (i.onerror = () => { + t(); + }), + (i.src = s); + }); + } + const ep = function (s, e, t = {}) { + new Headers(); + const i = e.replace(/\s+/g, " "), + n = Qg({ query: i, operation: s, variables: JSON.stringify(t) }); + return fetch(`https://media.ccc.de/graphql?${n}`, { + method: "GET", + headers: { Accept: "application/json" }, + }).then((r) => { + const a = r.body.getReader(); + let o = "", + l = new TextDecoder("utf-8"); + return a.read().then(function u({ done: c, value: d }) { + return c ? JSON.parse(o) : ((o += l.decode(d)), a.read().then(u)); + }); + }); + }; + function tp(s) { + return ep( + "LectureBySlug", + ` + query LectureBySlug($slug: ID!) { + lecture: lectureBySlug(slug: $slug) { + originalLanguage + timelens { thumbnailsUrl, timelineUrl } + videos { label, source: url, mimeType } + images { posterUrl } + relive + playerConfig + } + } + `, + { slug: s } + ).then((e) => { + if (!e.data.lecture) throw new Error("Lecture could not be found"); + return e.data.lecture; + }); + } + const ip = + "data:image/svg+xml;utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3Csvg%0A%20%20%20xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%0A%20%20%20xmlns%3Acc%3D%22http%3A%2F%2Fcreativecommons.org%2Fns%23%22%0A%20%20%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%0A%20%20%20xmlns%3Asvg%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%0A%20%20%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%0A%20%20%20id%3D%22svg4568%22%0A%20%20%20version%3D%221.1%22%0A%20%20%20viewBox%3D%220%200%2026.458318%2026.458333%22%0A%20%20%20height%3D%22100%22%0A%20%20%20width%3D%22100%22%3E%0A%20%20%3Cmetadata%0A%20%20%20%20%20id%3D%22metadata4574%22%3E%0A%20%20%20%20%3Crdf%3ARDF%3E%0A%20%20%20%20%20%20%3Ccc%3AWork%0A%20%20%20%20%20%20%20%20%20rdf%3Aabout%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%3Cdc%3Aformat%3Eimage%2Fsvg%2Bxml%3C%2Fdc%3Aformat%3E%0A%20%20%20%20%20%20%20%20%3Cdc%3Atype%0A%20%20%20%20%20%20%20%20%20%20%20rdf%3Aresource%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Fdcmitype%2FStillImage%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%3Cdc%3Atitle%3E%3C%2Fdc%3Atitle%3E%0A%20%20%20%20%20%20%3C%2Fcc%3AWork%3E%0A%20%20%20%20%3C%2Frdf%3ARDF%3E%0A%20%20%3C%2Fmetadata%3E%0A%20%20%3Cdefs%0A%20%20%20%20%20id%3D%22defs4572%22%20%2F%3E%0A%20%20%3Cpath%0A%20%20%20%20%20style%3D%22fill%3A%23ffffff%3Bfill-opacity%3A0.8627451%3Bstroke-width%3A0.79176539%22%0A%20%20%20%20%20id%3D%22path4566%22%0A%20%20%20%20%20d%3D%22m%2012.91039%2C7.1445417%20c%20-5.6690402%2C0%20-10.2660306%2C4.5961993%20-10.2660306%2C10.2652403%20a%2010.265238%2C10.265238%200%200%200%200.6706253%2C3.63816%20c%200.1504354%2C-0.393506%200.3230402%2C-0.777512%200.539984%2C-1.138557%200.1108472%2C-0.18369%200.2327789%2C-0.361837%200.313539%2C-0.559779%200.081551%2C-0.197941%200.1187648%2C-0.42201%200.057007%2C-0.627078%20A%201.0783844%2C1.0783844%200%200%200%204.0513264%2C18.402655%20C%203.9784841%2C18.305267%203.8993075%2C18.212631%203.833591%2C18.109702%20A%201.3159141%2C1.3159141%200%200%201%203.6316909%2C17.222924%201.1876481%2C1.1876481%200%200%201%204.0909148%2C16.441452%20c%200.2216944%2C-0.164688%200.5027709%2C-0.23753%200.7798889%2C-0.228028%20a%201.3911318%2C1.3911318%200%200%201%200.2739508%2C0.03801%20c%200.3578779%2C0.08709%200.6745841%2C0.311164%200.9089467%2C0.593824%200.2913696%2C0.353919%200.462391%2C0.799683%200.5043546%2C1.25574%20a%202.8297696%2C2.8297696%200%200%201%20-0.2177355%2C1.34046%20C%206.0236142%2C20.197593%205.42979%2C20.807252%205.1012074%2C21.557847%204.8335907%2C22.171464%204.7567894%2C22.854758%204.7924189%2C23.5238%20c%200.00554%2C0.06096%200.014251%2C0.122723%200.019794%2C0.185272%20a%2010.265238%2C10.265238%200%200%200%202.866191%2C2.517815%2013.958824%2C13.958824%200%200%201%20-0.1029298%2C-1.670626%20c%200.00161%2C-0.443389%200.023751%2C-0.886777%200.067304%2C-1.326206%20C%207.3735785%2C23.043191%207.1281312%2C22.826248%206.9539421%2C22.54913%206.6435705%2C22.058235%206.5849797%2C21.434324%206.712454%2C20.867421%206.8391365%2C20.299724%207.1400069%2C19.782702%207.5018439%2C19.327437%20A%206.2018984%2C6.2018984%200%200%201%209.7464993%2C17.567343%208.1591425%2C8.1591425%200%200%201%209.6752356%2C17.46758%203.8432293%2C3.8432293%200%200%201%209.1194163%2C15.744698%20c%20-0.047503%2C-0.615201%200.050669%2C-1.230403%200.091055%2C-1.844814%200.02929%2C-0.429928%200.031672%2C-0.859064%200.055423%2C-1.288201%200.030084%2C-0.496437%200.090261%2C-0.993667%200.2296124%2C-1.471101%20a%201.8685664%2C1.8685664%200%200%201%200.21061%2C-0.498812%201.1084716%2C1.1084716%200%200%201%200.4703083%2C-0.406968%20c%200.216945%2C-0.0855%200.403801%2C-0.104512%200.614411%2C-0.06888%200.174189%2C0.03642%200.3365%2C0.123516%200.478227%2C0.232779%200.142518%2C0.109264%200.26524%2C0.240698%200.380047%2C0.377673%20a%205.7783039%2C5.7783039%200%200%201%200.823436%2C1.280285%202.8266025%2C2.8266025%200%200%201%200.863024%2C0%205.7695944%2C5.7695944%200%200%201%200.823436%2C-1.279493%202.5415669%2C2.5415669%200%200%201%200.380047%2C-0.376881%20c%200.142518%2C-0.110847%200.303246%2C-0.196358%200.478227%2C-0.23357%20a%201.0039585%2C1.0039585%200%200%201%200.617577%2C0.06809%201.1100551%2C1.1100551%200%200%201%200.4711%2C0.409343%20c%200.09818%2C0.150436%200.159936%2C0.323041%200.21061%2C0.495645%200.138558%2C0.476643%200.199525%2C0.973872%200.229612%2C1.469517%200.02375%2C0.429928%200.02612%2C0.860649%200.05542%2C1.288995%200.0396%2C0.615201%200.138559%2C1.230403%200.09185%2C1.844813%20a%203.844021%2C3.844021%200%200%201%20-0.558194%2C1.724465%20c%20-0.02375%2C0.0396%20-0.05542%2C0.076%20-0.08154%2C0.114805%200.195565%2C0.220111%200.473476%2C0.406176%200.711006%2C0.486144%20a%201.5486932%2C1.5486932%200%200%200%200.831353%2C0.03484%201.3064129%2C1.3064129%200%200%200%200.42201%2C-0.17894%200.99208205%2C0.99208205%200%200%200%200.314331%2C-0.330957%20c%200.09343%2C-0.166272%200.131433%2C-0.356295%200.152019%2C-0.543944%200.05305%2C-0.482977%200%2C-0.96912%20-0.0396%2C-1.452889%20-0.02692%2C-0.313539%20-0.04909%2C-0.633412%200.02138%2C-0.939826%200.0475%2C-0.205858%200.140142%2C-0.410133%200.295328%2C-0.554235%20a%200.87569253%2C0.87569253%200%200%201%200.36817%2C-0.2019%201.0387963%2C1.0387963%200%200%201%200.419637%2C-0.02375%20c%200.30087%2C0.04514%200.582739%2C0.216942%200.750593%2C0.470308%200.09502%2C0.142517%200.153603%2C0.308788%200.18844%2C0.478226%200.03484%2C0.168646%200.0475%2C0.340459%200.05701%2C0.513064%200.03167%2C0.601741%200.03167%2C1.205067%200.01426%2C1.808392%20-0.01426%2C0.526524%20-0.04355%2C1.0673%20-0.253366%2C1.549486%20-0.271575%2C0.619159%20-0.817101%2C1.08155%20-1.405383%2C1.414092%20a%205.5835296%2C5.5835296%200%200%201%20-1.257323%2C0.512272%20c%200.38163%2C1.219319%200.580363%2C2.56532%200.580363%2C3.93349%20a%2013.935071%2C13.935071%200%200%201%20-0.106901%2C1.682498%2010.264446%2C10.264446%200%200%200%205.054631%2C-8.829768%20c%200%2C-5.669041%20-4.59699%2C-10.2652391%20-10.265238%2C-10.2652391%20z%20M%2010.037865%2C19.798537%20v%201.174188%20a%201.488519%2C1.488519%200%200%201%200.857482%2C0.286619%201.3760882%2C1.3760882%200%200%201%200.440222%2C0.538402%20c%200.0966%2C0.213775%200.131432%2C0.456056%200.09184%2C0.687252%20a%201.1821057%2C1.1821057%200%200%201%20-0.262867%2C0.560568%201.3040376%2C1.3040376%200%200%201%20-0.502772%2C0.36263%201.3760882%2C1.3760882%200%200%201%20-0.623119%2C0.0966%20v%202.953287%20l%206.145683%2C-3.33175%20-6.145683%2C-3.328583%20z%22%20%2F%3E%0A%3C%2Fsvg%3E", + np = () => ({ + width: "100%", + height: "100%", + hideMediaControlDelay: 1e3, + position: "top-left", + watermark: ip, + watermarkLink: "https://c3voc.de", + levelSelectorConfig: { + labelCallback: function (s) { + let e = "unknown"; + return ( + s.height + ? (e = s.height) + : s.level && s.level.height && (e = s.level.height), + e + "p" + ); + }, + title: "Quality", + }, + audioTrackSelectorConfig: { title: "Language" }, + }), + rp = (s, e, t, i, n) => { + const r = "MediaSource" in window, + a = { + poster: `//cdn.c3voc.de/thumbnail/${s}/poster.jpeg`, + levelSelectorConfig: { + labelCallback: function (l) { + var c; + if ((c = l == null ? void 0 : l.level) != null && c.url) { + const d = l.level.url[0].split("/"); + return d[d.length - 1].split(".")[0]; + } + var u = l.videoBandwidth || l.level.bitrate; + return u <= 1e5 + ? "Slides" + : u <= 9e5 + ? "SD" + : u <= 5e6 + ? "HD" + : "Source"; + }, + title: "Quality", + }, + disableErrorScreen: !0, + errorPlugin: { onError: n }, + vocConfigUpdate: (l) => { + if (document.visibilityState !== "visible" || l.isPlaying()) return; + const u = `//cdn.c3voc.de/thumbnail/${s}/poster.jpeg?t=${Date.now()}`; + Jg(u).then(() => { + l.configure({ poster: u }); + }); + }, + }; + return ( + !(navigator.userAgent.indexOf("Firefox") != -1) && + !t && + r && + MediaSource.isTypeSupported('video/webm; codecs="vp9,opus"') + ? ((a.source = { source: `//cdn.c3voc.de/dash/${s}/manifest.mpd` }), + (a.shakaConfiguration = { + preferredAudioLanguage: i, + abr: { defaultBandwidthEstimate: 1e6 }, + streaming: { jumpLargeGaps: !0 }, + manifest: { + dash: { + defaultPresentationDelay: 3, + ignoreSuggestedPresentationDelay: !0, + }, + }, + })) + : !e && + (r || + document + .createElement("video") + .canPlayType("application/vnd.apple.mpegURL") != "") + ? (a.source = { + source: `//cdn.c3voc.de/hls/${s}/native_hd.m3u8`, + mimeType: "application/vnd.apple.mpegURL", + }) + : e + ? (a.source = { + source: `//cdn.c3voc.de/${s}_native.mp3`, + mimeType: "audio/mp3", + }) + : (a.source = { + source: `//cdn.c3voc.de/${s}_native_hd.webm`, + mimeType: "video/webm", + }), + Promise.resolve(a) + ); + }, + sp = function (s, e) { + return tp(s) + .then((t) => { + var i, n, r, a; + return { + sources: + t.videos || + ((i = t.relive) == null ? void 0 : i.playlistCut) || + ((n = t.relive) == null ? void 0 : n.playlist), + poster: (r = t.images) == null ? void 0 : r.posterUrl, + timelens: t.timelens, + playback: { + externalTracks: + (a = t.playerConfig) == null ? void 0 : a.subtitles, + }, + levelSelectorConfig: { + labelCallback: function (o, l) { + console.log("labelCallback", arguments); + var u = o.videoBandwidth || o.level.bitrate; + return u <= 1e5 ? "Slides" : u <= 9e5 ? "SD" : "HD"; + }, + title: "Quality", + }, + }; + }) + .catch( + (t) => ( + console.log("Failed to fetch media sources", t), + { playbackNotSupportedMessage: `${t.message}` } + ) + ); + }, + al = 5, + ap = 15, + { + ClickToPause: op, + ClosedCaptions: lp, + DVRControls: up, + EndVideo: cp, + ErrorScreen: hp, + Favicon: dp, + MediaControl: fp, + Poster: gp, + SeekTime: pp, + SpinnerThreeBounce: mp, + Stats: Ap, + WaterMark: yp, + } = Gg; + ct.registerPlayback(qo); + for (let s of [op, lp, up, cp, hp, dp, fp, gp, pp, mp, Ap, yp, Kg, zg, qg]) + ct.registerPlugin(s); + const ol = (s, e) => + s.origin == "dash_shaka_playback" && + (s.raw.code == e || (s.raw.detail && s.raw.detail.code == e)), + ll = (s, e) => s.origin == "hls" && s.raw.response.code == e, + vp = (s) => new Promise((e) => setTimeout(e, s)); + class Ep extends At { + constructor(e) { + super(), + (this.timeout = al), + (this.maxTimeout = ap), + (this._events = []), + (this._buffering = !1), + (this._lastSeek = 0), + (this._vocStream = e.vocStream), + (this._playerPromise = this._getConfig(e).then( + (t) => ( + (this._options = t), + (this._player = new ys(this._options)), + this._player.core && this._player.core.isReady + ? this._addEventListeners() + : this.listenToOnce( + this._player, + A.PLAYER_READY, + this._addEventListeners.bind(this) + ), + t.vocConfigUpdate && + setInterval(() => t.vocConfigUpdate(this._player), 3e4), + this._player + ) + )); + } + attachTo() { + console.log("will attach", ...arguments), + this._playerPromise.then((e) => { + console.log("attach", ...arguments), e.attachTo.apply(e, arguments); + }); + } + _getConfig(e) { + let t = Promise.resolve({}); + return ( + e.vocStream + ? (t = rp( + e.vocStream, + e.audioOnly, + e.h264Only, + e.preferredAudioLanguage, + this._handleError.bind(this) + )) + : e.vocLecture && (t = sp(e.vocLecture)), + t.then((i) => Object.assign(np(), i, e)) + ); + } + _containerChanged() { + this.stopListening(), this._addEventListeners(); + } + _addEventListeners() { + const e = this._player.core; + (this._container = e.activeContainer), + this.listenTo(this._player, A.PLAYER_PLAY, this._handlePlay), + this.listenTo(this._player, A.PLAYER_STOP, this._handleStop), + this.listenTo(this._player, A.PLAYER_SEEK, this._handleSeek), + this.listenTo( + e, + A.CORE_ACTIVE_CONTAINER_CHANGED, + this._containerChanged + ), + this.listenTo( + this._container, + A.CONTAINER_STATE_BUFFERFULL, + this._handleBufferFull + ), + this.listenTo( + this._container, + A.CONTAINER_MEDIACONTROL_HIDE, + this._handleMediaControlHide + ), + this.listenTo( + this._container, + A.CONTAINER_MEDIACONTROL_SHOW, + this._handleMediaControlShow + ), + this.listenTo( + e.getCurrentPlayback(), + A.PLAYBACK_BUFFERING, + this._handleBuffering + ), + this.listenTo( + e.getCurrentPlayback(), + A.PLAYBACK_BITRATE, + this._handleBitrate + ); + const t = e.getCurrentPlayback(); + t._hls && + t._hls.on("hlsManifestLoaded", (i, n) => { + if (!n.url) return; + const r = new URL(n.url); + (this._relay = r.hostname), console.log("got relay", this._relay); + }); + } + _handleMediaControlHide() { + this._container.$el + .find(".clappr-watermark[data-watermark]") + .addClass("clappr-watermark-hide"); + } + _handleMediaControlShow() { + this._container.$el + .find(".clappr-watermark[data-watermark]") + .removeClass("clappr-watermark-hide"); + } + _getTimeout() { + const e = 0.6 * this.timeout + 0.4 * this.timeout * Math.random(); + return (this.timeout = Math.min(this.timeout * 2, this.maxTimeout)), e; + } + _resetTimeout() { + this.timeout = al; + } + _handleError(e, t) { + if ((this._appendEvent({ type: "error" }), this._recovery)) return; + this._player.stop(); + const i = this._getTimeout(); + return ( + console.log("got error", e, `retrying in ${Math.round(i)}s`), + (this._recovery = { + clearOverlay: t, + state: "restarting", + timeout: setTimeout(this._waitForMedia.bind(this), i * 1e3), + }), + ol(e, 1001) || ll(e, 404) + ? { title: "Stream is offline", subtitle: "We will be right back" } + : ol(e, 1002) || ll(0) + ? { + title: "A network error ocurred", + subtitle: "Please check your internet connection", + } + : { + title: "Oh no, an unknown error occured", + subtitle: "Please try reloading the page", + } + ); + } + _handlePlay() { + this._recovery && + (console.log("soft recovery: play"), + this._recovery.clearOverlay(), + clearTimeout(this._recovery.timeout), + (this._recovery = null), + this._appendEvent({ type: "recovery" })), + this._resetTimeout(); + } + _handleStop(e) { + this._recovery && + this._container && + (console.log("soft recovery: stop"), + this._container.playback.play.call(this._container.playback)); + } + _handleSeek(e) { + this._lastSeek = Date.now(); + } + _handleBufferFull() { + if ( + ((this._buffering = !1), + !!this._recovery && + (console.log( + `recovered? playbackType=${this._container.playback.getPlaybackType()}` + ), + this._container.playback.getPlaybackType() == "live")) + ) { + console.log("seeking to end for recovery"); + const e = Math.max(this._player.getDuration() - 6, 0); + this._player.seek(e); + } + } + _handleBuffering() { + (this._buffering = !0), + Date.now() - this._lastSeek > 1e3 && + this._appendEvent({ type: "buffering" }); + } + _handleBitrate(e) { + if (!this._lastBitrate) { + this._lastBitrate = e; + return; + } + if (!e.bitrate || !this._lastBitrate.bitrate) { + this._lastBitrate = e; + return; + } + if (e.bitrate === this._lastBitrate.bitrate) return; + const t = e.bitrate - this._lastBitrate.bitrate > 0; + (this._lastBitrate = e), + !this._buffering && + this._appendEvent({ type: "quality_switch", isUp: t }); + } + _appendEvent(e) { + this._container.playback.getPlaybackType() === "live" && + (console.log("player event", e), + (e.time = Date.now()), + this._vocStream && (e.slug = this._vocStream), + this._relay && (e.relay = this._relay), + this._events.push(e), + this._sendStats()); + } + async _sendStats() { + this._statsTimeout || + (this._statsTimeout = setTimeout( + this._doSendStats.bind(this), + Math.random() * 5e3 + )); + } + async _doSendStats() { + let e = 3e3; + for (;;) { + try { + const t = [], + i = Date.now(); + for (const n of this._events) + t.push({ ...n, offset: (i - n.time) / 1e3, time: void 0 }); + await Xg("https://cdn.c3voc.de/stats/", t), + (this._events = []), + (this._statsTimeout = void 0); + return; + } catch (t) { + console.error("failed to report stats", t); + } + await vp(e * 0.5 + Math.random() * 0.5 * e), (e *= 2); + } + } + async _waitForMedia() { + let e = this._player.options.source; + if ((e && e.source && (e = e.source), typeof e != "string")) { + this.reset(); + return; + } + console.log("waiting for media", e); + try { + await Zg(e), + console.log("try playing again, media should be available"), + this._player.play(); + } catch (t) { + const i = this._getTimeout(); + console.log(`test for media failed, retrying in ~${Math.round(i)}s`, t), + setTimeout(this._waitForMedia.bind(this), i * 1e3); + } + } + reset() { + console.log("performing hard reset"), (this._recovery = null); + const e = this._player.getVolume() == 0; + e || this._player.mute(), + this._player.configure({ + source: this._player.options.source, + autoPlay: !0, + }), + e || this._player.unmute(); + } + } + console.log("VOC player 2.0.1"), + (ye.$ = te), + (ye.BaseObject = At), + (ye.Browser = ee), + (ye.Container = xn), + (ye.ContainerPlugin = yt), + (ye.Core = Ln), + (ye.CorePlugin = vt), + (ye.Events = A), + (ye.HTML5Audio = In), + (ye.HTML5Video = st), + (ye.HTMLImg = Rn), + (ye.Loader = ct), + (ye.Log = fe), + (ye.Playback = ge), + (ye.Player = Ep), + (ye.PlayerError = Lt), + (ye.Styler = Ue), + (ye.UIContainerPlugin = Rt), + (ye.UICorePlugin = Ze), + (ye.UIObject = ii), + (ye.Utils = Ut), + (ye.template = He), + (ye.version = cu), + Object.defineProperty(ye, Symbol.toStringTag, { value: "Module" }); +}); diff --git a/src/plainui/static/plainui/vendor/vocplayer/style.css b/src/plainui/static/plainui/vendor/vocplayer/style.css new file mode 100644 index 0000000000000000000000000000000000000000..3f29301d28ece3bb431f3af8bc5a0a6d691013c0 --- /dev/null +++ b/src/plainui/static/plainui/vendor/vocplayer/style.css @@ -0,0 +1 @@ +button.media-control-button[data-hd-indicator]{display:none!important}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]{height:40px}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar]{height:2px;background-color:#ccc}.player-poster[data-poster] .play-wrapper[data-poster] svg path{fill:#ccc}.spinner-three-bounce[data-spinner]>div{background-color:#ccc}.clappr-watermark[data-watermark]{transition:opacity .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:0;left:15px;text-align:left}@media (min-width: 768px){.clappr-watermark[data-watermark-top-left]{top:10px;left:30px}} diff --git a/src/plainui/views/events.py b/src/plainui/views/events.py index 7a82df3a87fd33e120a908f6af2d7ca728679d40..6a07a4f0dee3d97e2f98c000a5085f0d37c97f4f 100644 --- a/src/plainui/views/events.py +++ b/src/plainui/views/events.py @@ -5,9 +5,11 @@ __all__ = ( 'UpcomingView', ) +from csp.decorators import csp_update from django.contrib.contenttypes.models import ContentType from django.shortcuts import get_object_or_404 from django.urls import reverse +from django.utils.decorators import method_decorator from django.views.generic.base import TemplateView from core.models import ( @@ -37,6 +39,7 @@ class AssembliesEventsView(ConferenceRequiredMixin, TemplateView): return context +@method_decorator(csp_update(SCRIPT_SRC="'unsafe-eval'"), name='get') class EventView(ConferenceRequiredMixin, TemplateView): template_name = 'plainui/event.html.j2' @@ -73,6 +76,7 @@ class EventView(ConferenceRequiredMixin, TemplateView): context['report_info'] = {'lookup_key': event.slug} context['report_info'] = {'url': reverse('plainui:event', kwargs={'event_slug': event.slug})} context['fav_info'] = {'type': 'event', 'id': event.id, 'is': str(event.id) in favorites} + context['csp_nonce'] = self.request.csp_nonce return context diff --git a/src/plainui/views/general.py b/src/plainui/views/general.py index bbe2e23d79419c7a46e565cbb1c539850390447d..943fa1f6093c8e48ef0da96b3ecfb6119596b200 100644 --- a/src/plainui/views/general.py +++ b/src/plainui/views/general.py @@ -10,10 +10,12 @@ __all__ = ( from datetime import timedelta +from csp.decorators import csp_update from django.contrib.contenttypes.models import ContentType from django.shortcuts import get_list_or_404, redirect from django.urls import reverse from django.utils import timezone +from django.utils.decorators import method_decorator from django.utils.timezone import now from django.views.generic.base import TemplateView @@ -58,6 +60,7 @@ class LandingView(ConferenceRequiredMixin, TemplateView): return context +@method_decorator(csp_update(SCRIPT_SRC="'unsafe-eval'"), name='get') class IndexView(ConferenceRequiredMixin, TemplateView): template_name = 'plainui/index.html.j2' @@ -80,6 +83,7 @@ class IndexView(ConferenceRequiredMixin, TemplateView): ) context['report_info'] = {'enabled': True} + context['csp_nonce'] = self.request.csp_nonce return context diff --git a/src/plainui/views/rooms.py b/src/plainui/views/rooms.py index 0de04f39d117cdaa539c16bb96e97a33741968eb..503c387386f4d844832b8d3985e2acb2b984cb1c 100644 --- a/src/plainui/views/rooms.py +++ b/src/plainui/views/rooms.py @@ -4,9 +4,11 @@ __all__ = ( ) +from csp.decorators import csp_update from django.contrib import messages from django.db.models import QuerySet from django.http import HttpResponseRedirect +from django.utils.decorators import method_decorator from django.utils.translation import gettext from django.views.generic import DetailView @@ -24,6 +26,7 @@ from plainui.views.utils import ( ) +@method_decorator(csp_update(SCRIPT_SRC="'unsafe-eval'"), name='get') class RoomView(ConferenceRequiredMixin, DetailView): model = Room template_name = 'plainui/room.html.j2' @@ -65,6 +68,7 @@ class RoomView(ConferenceRequiredMixin, DetailView): context['my_favorite_events'] = session_get_favorite_events(self.request.session, self.request.user) context['report_info'] = {'lookup_key': self.room.slug} + context['csp_nonce'] = self.request.csp_nonce return context