From f38756dc073827e9ea0779e8c006b2cff8f02861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Le=C3=A3o?= Date: Mon, 24 May 2021 16:17:55 -0300 Subject: [PATCH 1/5] docs(readme): Add Q&A answer for auto play --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index ae0aa1b0c..2802c2822 100644 --- a/README.md +++ b/README.md @@ -347,6 +347,20 @@ var player = new Clappr.Player({ player.attachTo(playerElement); ``` +### Why autoplay is not working? + +Clappr has no control over `autoplay` Browser Policy. + +Therefore, we're not able to execute play and unmute actions sequentially in every situation. There are a series of scenarios where the Browser blocks these actions based on it’s own policy. + +Each browser has their own different restrictions, and the usual behavior is to activate the sound only after an user interaction with the player. + +For more infos about auto play video policy, you can read these docs: + +- [Chrome Autoplay Policy](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes) +- [WebKit Autoplay Policy](https://webkit.org/blog/7734/auto-play-policy-changes-for-macos/) + + :rocket: Companies using Clappr --- https://github.com/clappr/clappr/issues/522 From 71cbfcf3168ca7e446acd64f3af77e26ae788dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Le=C3=A3o?= Date: Tue, 1 Jun 2021 14:55:00 -0300 Subject: [PATCH 2/5] docs(auto play): include auto play docs to readme --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2802c2822..19c11273d 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Clappr is under development but production-ready. Feel free to open issues and s * [Built-in Plugins](https://github.com/clappr/clappr#electric_plug-built-in-plugins) * [Third party plugins/integrations](https://github.com/clappr/clappr#handshake-third-party-pluginsintegrations) * [Supported Formats](https://github.com/clappr/clappr#film_strip-supported-formats) +* [About Autoplay](https://github.com/clappr/clappr#about-autoplay) * [FAQ & Troubleshooting](https://github.com/clappr/clappr#interrobang-faq--troubleshooting) * [Companies using Clappr](https://github.com/clappr/clappr#rocket-companies-using-clappr) * [Contributors](https://github.com/clappr/clappr#raised_hands-contributors) @@ -135,6 +136,19 @@ PS4 Browser | ✔ | ✔ | ✘ | ? | ![rtmp](http://flv.io/external3.png) | ! ![rtmp](http://flv.io/external3.png) means that the support is made by an external plugin. +:play_or_pause_button: About Autoplay +--- +**Clappr has no control over `autoplay` Browser Policy.** + +Therefore, we're not able to execute play and unmute actions sequentially in every situation. There are a series of scenarios where the Browser blocks these actions based on it’s own policy. + +Each browser has their own different restrictions, and the usual behavior is to activate the sound only after an user interaction with the player. + +For more infos about auto play video policy, you can read these docs: + +- [Chrome Autoplay Policy](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes) +- [WebKit Autoplay Policy](https://webkit.org/blog/7734/auto-play-policy-changes-for-macos/) + :interrobang: FAQ & Troubleshooting --- ### How to write a plugin? @@ -347,20 +361,6 @@ var player = new Clappr.Player({ player.attachTo(playerElement); ``` -### Why autoplay is not working? - -Clappr has no control over `autoplay` Browser Policy. - -Therefore, we're not able to execute play and unmute actions sequentially in every situation. There are a series of scenarios where the Browser blocks these actions based on it’s own policy. - -Each browser has their own different restrictions, and the usual behavior is to activate the sound only after an user interaction with the player. - -For more infos about auto play video policy, you can read these docs: - -- [Chrome Autoplay Policy](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes) -- [WebKit Autoplay Policy](https://webkit.org/blog/7734/auto-play-policy-changes-for-macos/) - - :rocket: Companies using Clappr --- https://github.com/clappr/clappr/issues/522 From 30b5601d0b7b00e95d69fb3c31f2f1d1a298f7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Le=C3=A3o?= Date: Tue, 1 Jun 2021 15:00:04 -0300 Subject: [PATCH 3/5] docs(auto play): fix auto play anchor on readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 19c11273d..2c0db03ae 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Clappr is under development but production-ready. Feel free to open issues and s * [Built-in Plugins](https://github.com/clappr/clappr#electric_plug-built-in-plugins) * [Third party plugins/integrations](https://github.com/clappr/clappr#handshake-third-party-pluginsintegrations) * [Supported Formats](https://github.com/clappr/clappr#film_strip-supported-formats) -* [About Autoplay](https://github.com/clappr/clappr#about-autoplay) +* [About Autoplay](https://github.com/clappr/clappr#play_or_pause_button-about-autoplay) * [FAQ & Troubleshooting](https://github.com/clappr/clappr#interrobang-faq--troubleshooting) * [Companies using Clappr](https://github.com/clappr/clappr#rocket-companies-using-clappr) * [Contributors](https://github.com/clappr/clappr#raised_hands-contributors) From c2944b4871bffa3db81fcad6d353aa57448beacc Mon Sep 17 00:00:00 2001 From: Jhonatan Gomes Date: Fri, 8 Oct 2021 19:19:14 -0300 Subject: [PATCH 4/5] chore(package): update @clappr/core --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8df7c991c..672da7574 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "devDependencies": { "@babel/core": "^7.14.2", "@babel/preset-env": "^7.14.2", - "@clappr/core": "^0.4.18", + "@clappr/core": "^0.4.19", "@clappr/hlsjs-playback": "^0.6.0", "@clappr/plugins": "^0.4.13", "@rollup/plugin-babel": "^5.3.0", diff --git a/yarn.lock b/yarn.lock index aa8338f6d..11c5d2a23 100644 --- a/yarn.lock +++ b/yarn.lock @@ -874,10 +874,10 @@ "@babel/helper-validator-identifier" "^7.14.0" to-fast-properties "^2.0.0" -"@clappr/core@^0.4.18": - version "0.4.18" - resolved "https://registry.yarnpkg.com/@clappr/core/-/core-0.4.18.tgz#7becc6c32f2a48a097d1ca158dbda0169f7979ce" - integrity sha512-MMZ6j2+pbtoo/dPi9nyo/dAfW3u0D3np7mpT0VHNNjy+K8qZZAlyF2kYNHjwqyj6pRY0kRWj4KMXA5SUMR7Zyg== +"@clappr/core@^0.4.19": + version "0.4.19" + resolved "https://registry.yarnpkg.com/@clappr/core/-/core-0.4.19.tgz#e07fe99ce5c2655d781ce2c0773b47900babda1c" + integrity sha512-DMSlXOUbTnexrXxBMr0KBJqRD9VtaQijAr5YPIqdjnzVLs4qNkGtqWnFmkLscLFPlXCbIRTpD0FjCTyeUYmS0Q== "@clappr/hlsjs-playback@^0.6.0": version "0.6.0" From 844ad995b9a3bb26ca0a6b8f6010adf20cc16759 Mon Sep 17 00:00:00 2001 From: Jhonatan Gomes Date: Fri, 8 Oct 2021 19:32:08 -0300 Subject: [PATCH 5/5] chore(package): bump version --- dist/clappr.js | 62 +++++++++++++++++++++---------- dist/clappr.js.map | 2 +- dist/clappr.min.js | 4 +- dist/clappr.min.js.map | 2 +- dist/clappr.plainhtml5.js | 58 ++++++++++++++++++++--------- dist/clappr.plainhtml5.js.map | 2 +- dist/clappr.plainhtml5.min.js | 2 +- dist/clappr.plainhtml5.min.js.map | 2 +- package.json | 2 +- 9 files changed, 92 insertions(+), 44 deletions(-) diff --git a/dist/clappr.js b/dist/clappr.js index a5a1a085b..32557e2af 100644 --- a/dist/clappr.js +++ b/dist/clappr.js @@ -4308,6 +4308,8 @@ Events.CONTAINER_CONTEXTMENU = 'container:contextmenu'; Events.CONTAINER_MOUSE_ENTER = 'container:mouseenter'; Events.CONTAINER_MOUSE_LEAVE = 'container:mouseleave'; + Events.CONTAINER_MOUSE_UP = 'container:mouseup'; + Events.CONTAINER_MOUSE_DOWN = 'container:mousedown'; /** * Fired when the container seeks the video * @@ -5069,7 +5071,9 @@ 'touchend': 'dblTap', 'contextmenu': 'onContextMenu', 'mouseenter': 'mouseEnter', - 'mouseleave': 'mouseLeave' + 'mouseleave': 'mouseLeave', + 'mouseup': 'onMouseUp', + 'mousedown': 'onMouseDown' }; } /** @@ -5564,6 +5568,16 @@ value: function mouseLeave() { if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(Events.CONTAINER_MOUSE_LEAVE); } + }, { + key: "mouseUp", + value: function mouseUp() { + if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(Events.CONTAINER_MOUSE_UP); + } + }, { + key: "mouseDown", + value: function mouseDown() { + if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(Events.CONTAINER_MOUSE_DOWN); + } }, { key: "settingsUpdate", value: function settingsUpdate() { @@ -6823,7 +6837,7 @@ plugins: {}, playbacks: [] }; - var currentVersion = "0.4.18"; + var currentVersion = "0.4.19"; return /*#__PURE__*/function () { _createClass$2(Loader, null, [{ key: "checkVersionSupport", @@ -7994,7 +8008,7 @@ key: "supportedVersion", get: function get() { return { - min: "0.4.18" + min: "0.4.19" }; } }, { @@ -8565,20 +8579,30 @@ }, { key: "getDuration", value: function getDuration() { - var _this4 = this; - if (this.isLive) { - try { + if (this.el.seekable.length > 0) { return this.el.seekable.end(0) - this.el.seekable.start(0); - } catch (e) { - setTimeout(function () { - return _this4._updateSettings(); - }, 1000); + } else { + // `seekable` is not available; this is probably OK, but make sure we're + // updating the control bar to reflect it + this._scheduleUpdateSettingsCheck(); } } return this.el.duration; } + }, { + key: "_scheduleUpdateSettingsCheck", + value: function _scheduleUpdateSettingsCheck() { + var _this4 = this; + + if (this._updateSettingsCheckInFlight) return; + this._updateSettingsCheckInFlight = setTimeout(function () { + _this4._updateSettings(); + + _this4._updateSettingsCheckInFlight = null; + }, 1000); + } }, { key: "_onTimeUpdate", value: function _onTimeUpdate() { @@ -8805,7 +8829,7 @@ key: "supportedVersion", get: function get() { return { - min: "0.4.18" + min: "0.4.19" }; } }, { @@ -8854,7 +8878,7 @@ key: "supportedVersion", get: function get() { return { - min: "0.4.18" + min: "0.4.19" }; } }, { @@ -8940,7 +8964,7 @@ key: "supportedVersion", get: function get() { return { - min: "0.4.18" + min: "0.4.19" }; } }, { @@ -9090,7 +9114,7 @@ key: "supportedVersion", get: function get() { return { - min: "0.4.18" + min: "0.4.19" }; } }]); @@ -9247,7 +9271,7 @@ key: "supportedVersion", get: function get() { return { - min: "0.4.18" + min: "0.4.19" }; } }]); @@ -9256,7 +9280,7 @@ }(CorePlugin); // Copyright 2014 Globo.com Player authors. All rights reserved. - var version$1 = "0.4.18"; // Built-in Plugins/Playbacks + var version$1 = "0.4.19"; // Built-in Plugins/Playbacks Loader.registerPlugin(Strings); Loader.registerPlugin(SourcesPlugin); @@ -12330,7 +12354,7 @@ WaterMark: WaterMarkPlugin }; - var version = "0.4.5"; + var version = "0.4.6"; for (var _i = 0, _Object$values = Object.values(Plugins); _i < _Object$values.length; _i++) { var plugin = _Object$values[_i]; @@ -19824,7 +19848,7 @@ /|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, // next segment's program date/time group 5 => the datetime spec /|#.*/.source // All other non-segment oriented tags will match with all groups empty ].join(''), 'g'); - var LEVEL_PLAYLIST_REGEX_SLOW = /(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-("0.4.5"):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/; + var LEVEL_PLAYLIST_REGEX_SLOW = /(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-("0.4.6"):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/; var MP4_REGEX_SUFFIX = /\.(mp4|m4s|m4v|m4a)$/i; var m3u8_parser_M3U8Parser = /*#__PURE__*/function () { @@ -20076,7 +20100,7 @@ level.targetduration = parseFloat(value1); break; - case '"0.4.5"': + case '"0.4.6"': level.version = parseInt(value1); break; diff --git a/dist/clappr.js.map b/dist/clappr.js.map index 31af1f530..9db6ad0e4 100644 --- a/dist/clappr.js.map +++ b/dist/clappr.js.map @@ -1 +1 @@ -{"version":3,"file":"clappr.js","sources":["../node_modules/@clappr/core/dist/clappr-core.esm.js","../node_modules/@clappr/plugins/dist/clappr-plugins.esm.js","../src/base_bundle.js","../node_modules/@clappr/hlsjs-playback/dist/hlsjs-playback.esm.js","../src/main.js"],"sourcesContent":["function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get;\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) {\n var it;\n\n if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) {\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n\n var F = function () {};\n\n return {\n s: F,\n n: function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n },\n e: function (e) {\n throw e;\n },\n f: F\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n var normalCompletion = true,\n didErr = false,\n err;\n return {\n s: function () {\n it = o[Symbol.iterator]();\n },\n n: function () {\n var step = it.next();\n normalCompletion = step.done;\n return step;\n },\n e: function (e) {\n didErr = true;\n err = e;\n },\n f: function () {\n try {\n if (!normalCompletion && it.return != null) it.return();\n } finally {\n if (didErr) throw err;\n }\n }\n };\n}\n\n// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n/* istanbul ignore file */\n\n/**\n * Array.prototype.find\n *\n * Original source : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find\n * See also : https://tc39.github.io/ecma262/#sec-array.prototype.find\n */\nif (!Array.prototype.find) {\n // eslint-disable-next-line\n Object.defineProperty(Array.prototype, 'find', {\n // Note: ES6 arrow function syntax is not used on purpose to avoid this to be undefined\n value: function value(predicate) {\n // 1. Let O be ? ToObject(this value).\n if (this == null) throw new TypeError('\"this\" is null or not defined');\n var o = Object(this); // 2. Let len be ? ToLength(? Get(O, \"length\")).\n\n var len = o.length >>> 0; // 3. If IsCallable(predicate) is false, throw a TypeError exception.\n\n if (typeof predicate !== 'function') throw new TypeError('predicate must be a function'); // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.\n\n var thisArg = arguments[1]; // 5. Let k be 0.\n\n var k = 0; // 6. Repeat, while k < len\n\n while (k < len) {\n // a. Let Pk be ! ToString(k).\n // b. Let kValue be ? Get(O, Pk).\n // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).\n // d. If testResult is true, return kValue.\n var kValue = o[k];\n if (predicate.call(thisArg, kValue, k, o)) return kValue; // e. Increase k by 1.\n\n k++;\n } // 7. Return undefined.\n\n\n return undefined;\n }\n });\n} // polyfills for smart TVs\n\n\nif (!Object.entries) {\n Object.entries = function (obj) {\n var ownProps = Object.keys(obj),\n i = ownProps.length,\n resArray = new Array(i); // preallocate the Array\n\n while (i--) {\n resArray[i] = [ownProps[i], obj[ownProps[i]]];\n }\n\n return resArray;\n };\n}\n\nif (!Object.values) {\n Object.values = function (obj) {\n var ownProps = Object.keys(obj),\n i = ownProps.length,\n resArray = new Array(i); // preallocate the Array\n\n while (i--) {\n resArray[i] = obj[ownProps[i]];\n }\n\n return resArray;\n };\n}\n/**\n * Object.assign\n * This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway\n *\n * Original source : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n */\n\n\nif (typeof Object.assign != 'function') {\n // Must be writable: true, enumerable: false, configurable: true\n Object.defineProperty(Object, 'assign', {\n // length of function is 2.\n value: function assign(target, varArgs) {\n\n if (target == null) {\n // TypeError if undefined or null\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var to = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var nextSource = arguments[index];\n\n if (nextSource != null) {\n // Skip over if undefined or null\n for (var nextKey in nextSource) {\n // Avoid bugs when hasOwnProperty is shadowed\n if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n\n return to;\n },\n writable: true,\n configurable: true\n });\n} // https://tc39.github.io/ecma262/#sec-array.prototype.findindex\n\n\nif (!Array.prototype.findIndex) {\n Object.defineProperty(Array.prototype, 'findIndex', {\n value: function value(predicate) {\n // 1. Let O be ? ToObject(this value).\n if (this == null) {\n throw new TypeError('\"this\" is null or not defined');\n }\n\n var o = Object(this); // 2. Let len be ? ToLength(? Get(O, \"length\")).\n\n var len = o.length >>> 0; // 3. If IsCallable(predicate) is false, throw a TypeError exception.\n\n if (typeof predicate !== 'function') {\n throw new TypeError('predicate must be a function');\n } // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.\n\n\n var thisArg = arguments[1]; // 5. Let k be 0.\n\n var k = 0; // 6. Repeat, while k < len\n\n while (k < len) {\n // a. Let Pk be ! ToString(k).\n // b. Let kValue be ? Get(O, Pk).\n // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).\n // d. If testResult is true, return k.\n var kValue = o[k];\n\n if (predicate.call(thisArg, kValue, k, o)) {\n return k;\n } // e. Increase k by 1.\n\n\n k++;\n } // 7. Return -1.\n\n\n return -1;\n },\n configurable: true,\n writable: true\n });\n}\n\n/* istanbul ignore file */\n// https://github.com/mathiasbynens/small\nvar mp4 = 'data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAC721kYXQhEAUgpBv/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3pwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCEQBSCkG//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADengAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAsJtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAALwABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAB7HRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAIAAAAAAAAALwAAAAAAAAAAAAAAAQEAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAAC8AAAAAAAEAAAAAAWRtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAAKxEAAAIAFXEAAAAAAAtaGRscgAAAAAAAAAAc291bgAAAAAAAAAAAAAAAFNvdW5kSGFuZGxlcgAAAAEPbWluZgAAABBzbWhkAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAADTc3RibAAAAGdzdHNkAAAAAAAAAAEAAABXbXA0YQAAAAAAAAABAAAAAAAAAAAAAgAQAAAAAKxEAAAAAAAzZXNkcwAAAAADgICAIgACAASAgIAUQBUAAAAAAfQAAAHz+QWAgIACEhAGgICAAQIAAAAYc3R0cwAAAAAAAAABAAAAAgAABAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAIAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAFzAAABdAAAABRzdGNvAAAAAAAAAAEAAAAsAAAAYnVkdGEAAABabWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAtaWxzdAAAACWpdG9vAAAAHWRhdGEAAAABAAAAAExhdmY1Ni40MC4xMDE=';\nvar Media = {\n mp4: mp4\n};\n\n/* Zepto v1.2.0 - zepto ajax callbacks deferred event ie selector - zeptojs.com/license */\nvar Zepto = function () {\n var undefined$1,\n key,\n $,\n classList,\n emptyArray = [],\n concat = emptyArray.concat,\n filter = emptyArray.filter,\n slice = emptyArray.slice,\n document = window.document,\n elementDisplay = {},\n classCache = {},\n cssNumber = {\n 'column-count': 1,\n 'columns': 1,\n 'font-weight': 1,\n 'line-height': 1,\n 'opacity': 1,\n 'z-index': 1,\n 'zoom': 1\n },\n fragmentRE = /^\\s*<(\\w+|!)[^>]*>/,\n singleTagRE = /^<(\\w+)\\s*\\/?>(?:<\\/\\1>|)$/,\n tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/ig,\n rootNodeRE = /^(?:body|html)$/i,\n capitalRE = /([A-Z])/g,\n // special attributes that should be get/set via method calls\n methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'],\n adjacencyOperators = ['after', 'prepend', 'before', 'append'],\n table = document.createElement('table'),\n tableRow = document.createElement('tr'),\n containers = {\n 'tr': document.createElement('tbody'),\n 'tbody': table,\n 'thead': table,\n 'tfoot': table,\n 'td': tableRow,\n 'th': tableRow,\n '*': document.createElement('div')\n },\n readyRE = /complete|loaded|interactive/,\n simpleSelectorRE = /^[\\w-]*$/,\n class2type = {},\n toString = class2type.toString,\n zepto = {},\n camelize,\n uniq,\n tempParent = document.createElement('div'),\n propMap = {\n 'tabindex': 'tabIndex',\n 'readonly': 'readOnly',\n 'for': 'htmlFor',\n 'class': 'className',\n 'maxlength': 'maxLength',\n 'cellspacing': 'cellSpacing',\n 'cellpadding': 'cellPadding',\n 'rowspan': 'rowSpan',\n 'colspan': 'colSpan',\n 'usemap': 'useMap',\n 'frameborder': 'frameBorder',\n 'contenteditable': 'contentEditable'\n },\n isArray = Array.isArray || function (object) {\n return object instanceof Array;\n };\n\n zepto.matches = function (element, selector) {\n if (!selector || !element || element.nodeType !== 1) return false;\n var matchesSelector = element.matches || element.webkitMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector || element.matchesSelector;\n if (matchesSelector) return matchesSelector.call(element, selector); // fall back to performing a selector:\n\n var match,\n parent = element.parentNode,\n temp = !parent;\n if (temp) (parent = tempParent).appendChild(element);\n match = ~zepto.qsa(parent, selector).indexOf(element);\n temp && tempParent.removeChild(element);\n return match;\n };\n\n function type(obj) {\n return obj == null ? String(obj) : class2type[toString.call(obj)] || \"object\";\n }\n\n function isFunction(value) {\n return type(value) == \"function\";\n }\n\n function isWindow(obj) {\n return obj != null && obj == obj.window;\n }\n\n function isDocument(obj) {\n return obj != null && obj.nodeType == obj.DOCUMENT_NODE;\n }\n\n function isObject(obj) {\n return type(obj) == \"object\";\n }\n\n function isPlainObject(obj) {\n return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype;\n }\n\n function likeArray(obj) {\n var length = !!obj && 'length' in obj && obj.length,\n type = $.type(obj);\n return 'function' != type && !isWindow(obj) && ('array' == type || length === 0 || typeof length == 'number' && length > 0 && length - 1 in obj);\n }\n\n function compact(array) {\n return filter.call(array, function (item) {\n return item != null;\n });\n }\n\n function flatten(array) {\n return array.length > 0 ? $.fn.concat.apply([], array) : array;\n }\n\n camelize = function (str) {\n return str.replace(/-+(.)?/g, function (match, chr) {\n return chr ? chr.toUpperCase() : '';\n });\n };\n\n function dasherize(str) {\n return str.replace(/::/g, '/').replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2').replace(/([a-z\\d])([A-Z])/g, '$1_$2').replace(/_/g, '-').toLowerCase();\n }\n\n uniq = function (array) {\n return filter.call(array, function (item, idx) {\n return array.indexOf(item) == idx;\n });\n };\n\n function classRE(name) {\n return name in classCache ? classCache[name] : classCache[name] = new RegExp('(^|\\\\s)' + name + '(\\\\s|$)');\n }\n\n function maybeAddPx(name, value) {\n return typeof value == \"number\" && !cssNumber[dasherize(name)] ? value + \"px\" : value;\n }\n\n function defaultDisplay(nodeName) {\n var element, display;\n\n if (!elementDisplay[nodeName]) {\n element = document.createElement(nodeName);\n document.body.appendChild(element);\n display = getComputedStyle(element, '').getPropertyValue(\"display\");\n element.parentNode.removeChild(element);\n display == \"none\" && (display = \"block\");\n elementDisplay[nodeName] = display;\n }\n\n return elementDisplay[nodeName];\n }\n\n function children(element) {\n return 'children' in element ? slice.call(element.children) : $.map(element.childNodes, function (node) {\n if (node.nodeType == 1) return node;\n });\n }\n\n function Z(dom, selector) {\n var i,\n len = dom ? dom.length : 0;\n\n for (i = 0; i < len; i++) this[i] = dom[i];\n\n this.length = len;\n this.selector = selector || '';\n } // `$.zepto.fragment` takes a html string and an optional tag name\n // to generate DOM nodes from the given html string.\n // The generated DOM nodes are returned as an array.\n // This function can be overridden in plugins for example to make\n // it compatible with browsers that don't support the DOM fully.\n\n\n zepto.fragment = function (html, name, properties) {\n var dom, nodes, container; // A special case optimization for a single tag\n\n if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1));\n\n if (!dom) {\n if (html.replace) html = html.replace(tagExpanderRE, \"<$1>\");\n if (name === undefined$1) name = fragmentRE.test(html) && RegExp.$1;\n if (!(name in containers)) name = '*';\n container = containers[name];\n container.innerHTML = '' + html;\n dom = $.each(slice.call(container.childNodes), function () {\n container.removeChild(this);\n });\n }\n\n if (isPlainObject(properties)) {\n nodes = $(dom);\n $.each(properties, function (key, value) {\n if (methodAttributes.indexOf(key) > -1) nodes[key](value);else nodes.attr(key, value);\n });\n }\n\n return dom;\n }; // `$.zepto.Z` swaps out the prototype of the given `dom` array\n // of nodes with `$.fn` and thus supplying all the Zepto functions\n // to the array. This method can be overridden in plugins.\n\n\n zepto.Z = function (dom, selector) {\n return new Z(dom, selector);\n }; // `$.zepto.isZ` should return `true` if the given object is a Zepto\n // collection. This method can be overridden in plugins.\n\n\n zepto.isZ = function (object) {\n return object instanceof zepto.Z;\n }; // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and\n // takes a CSS selector and an optional context (and handles various\n // special cases).\n // This method can be overridden in plugins.\n\n\n zepto.init = function (selector, context) {\n var dom; // If nothing given, return an empty Zepto collection\n\n if (!selector) return zepto.Z(); // Optimize for string selectors\n else if (typeof selector == 'string') {\n selector = selector.trim(); // If it's a html fragment, create nodes from it\n // Note: In both Chrome 21 and Firefox 15, DOM error 12\n // is thrown if the fragment doesn't begin with <\n\n if (selector[0] == '<' && fragmentRE.test(selector)) dom = zepto.fragment(selector, RegExp.$1, context), selector = null; // If there's a context, create a collection on that context first, and select\n // nodes from there\n else if (context !== undefined$1) return $(context).find(selector); // If it's a CSS selector, use it to select nodes.\n else dom = zepto.qsa(document, selector);\n } // If a function is given, call it when the DOM is ready\n else if (isFunction(selector)) return $(document).ready(selector); // If a Zepto collection is given, just return it\n else if (zepto.isZ(selector)) return selector;else {\n // normalize array if an array of nodes is given\n if (isArray(selector)) dom = compact(selector); // Wrap DOM nodes.\n else if (isObject(selector)) dom = [selector], selector = null; // If it's a html fragment, create nodes from it\n else if (fragmentRE.test(selector)) dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null; // If there's a context, create a collection on that context first, and select\n // nodes from there\n else if (context !== undefined$1) return $(context).find(selector); // And last but no least, if it's a CSS selector, use it to select nodes.\n else dom = zepto.qsa(document, selector);\n } // create a new Zepto collection from the nodes found\n\n return zepto.Z(dom, selector);\n }; // `$` will be the base `Zepto` object. When calling this\n // function just call `$.zepto.init, which makes the implementation\n // details of selecting nodes and creating Zepto collections\n // patchable in plugins.\n\n\n $ = function (selector, context) {\n return zepto.init(selector, context);\n };\n\n function extend(target, source, deep) {\n for (key in source) if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {\n if (isPlainObject(source[key]) && !isPlainObject(target[key])) target[key] = {};\n if (isArray(source[key]) && !isArray(target[key])) target[key] = [];\n extend(target[key], source[key], deep);\n } else if (source[key] !== undefined$1) target[key] = source[key];\n } // Copy all but undefined properties from one or more\n // objects to the `target` object.\n\n\n $.extend = function (target) {\n var deep,\n args = slice.call(arguments, 1);\n\n if (typeof target == 'boolean') {\n deep = target;\n target = args.shift();\n }\n\n args.forEach(function (arg) {\n extend(target, arg, deep);\n });\n return target;\n }; // `$.zepto.qsa` is Zepto's CSS selector implementation which\n // uses `document.querySelectorAll` and optimizes for some special cases, like `#id`.\n // This method can be overridden in plugins.\n\n\n zepto.qsa = function (element, selector) {\n var found,\n maybeID = selector[0] == '#',\n maybeClass = !maybeID && selector[0] == '.',\n nameOnly = maybeID || maybeClass ? selector.slice(1) : selector,\n // Ensure that a 1 char tag name still gets checked\n isSimple = simpleSelectorRE.test(nameOnly);\n return element.getElementById && isSimple && maybeID ? // Safari DocumentFragment doesn't have getElementById\n (found = element.getElementById(nameOnly)) ? [found] : [] : element.nodeType !== 1 && element.nodeType !== 9 && element.nodeType !== 11 ? [] : slice.call(isSimple && !maybeID && element.getElementsByClassName ? // DocumentFragment doesn't have getElementsByClassName/TagName\n maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class\n element.getElementsByTagName(selector) : // Or a tag\n element.querySelectorAll(selector) // Or it's not simple, and we need to query all\n );\n };\n\n function filtered(nodes, selector) {\n return selector == null ? $(nodes) : $(nodes).filter(selector);\n }\n\n $.contains = document.documentElement.contains ? function (parent, node) {\n return parent !== node && parent.contains(node);\n } : function (parent, node) {\n while (node && (node = node.parentNode)) if (node === parent) return true;\n\n return false;\n };\n\n function funcArg(context, arg, idx, payload) {\n return isFunction(arg) ? arg.call(context, idx, payload) : arg;\n }\n\n function setAttribute(node, name, value) {\n value == null ? node.removeAttribute(name) : node.setAttribute(name, value);\n } // access className property while respecting SVGAnimatedString\n\n\n function className(node, value) {\n var klass = node.className || '',\n svg = klass && klass.baseVal !== undefined$1;\n if (value === undefined$1) return svg ? klass.baseVal : klass;\n svg ? klass.baseVal = value : node.className = value;\n } // \"true\" => true\n // \"false\" => false\n // \"null\" => null\n // \"42\" => 42\n // \"42.5\" => 42.5\n // \"08\" => \"08\"\n // JSON => parse if valid\n // String => self\n\n\n function deserializeValue(value) {\n try {\n return value ? value == \"true\" || (value == \"false\" ? false : value == \"null\" ? null : +value + \"\" == value ? +value : /^[\\[\\{]/.test(value) ? $.parseJSON(value) : value) : value;\n } catch (e) {\n return value;\n }\n }\n\n $.type = type;\n $.isFunction = isFunction;\n $.isWindow = isWindow;\n $.isArray = isArray;\n $.isPlainObject = isPlainObject;\n\n $.isEmptyObject = function (obj) {\n var name;\n\n for (name in obj) return false;\n\n return true;\n };\n\n $.isNumeric = function (val) {\n var num = Number(val),\n type = typeof val;\n return val != null && type != 'boolean' && (type != 'string' || val.length) && !isNaN(num) && isFinite(num) || false;\n };\n\n $.inArray = function (elem, array, i) {\n return emptyArray.indexOf.call(array, elem, i);\n };\n\n $.camelCase = camelize;\n\n $.trim = function (str) {\n return str == null ? \"\" : String.prototype.trim.call(str);\n }; // plugin compatibility\n\n\n $.uuid = 0;\n $.support = {};\n $.expr = {};\n\n $.noop = function () {};\n\n $.map = function (elements, callback) {\n var value,\n values = [],\n i,\n key;\n if (likeArray(elements)) for (i = 0; i < elements.length; i++) {\n value = callback(elements[i], i);\n if (value != null) values.push(value);\n } else for (key in elements) {\n value = callback(elements[key], key);\n if (value != null) values.push(value);\n }\n return flatten(values);\n };\n\n $.each = function (elements, callback) {\n var i, key;\n\n if (likeArray(elements)) {\n for (i = 0; i < elements.length; i++) if (callback.call(elements[i], i, elements[i]) === false) return elements;\n } else {\n for (key in elements) if (callback.call(elements[key], key, elements[key]) === false) return elements;\n }\n\n return elements;\n };\n\n $.grep = function (elements, callback) {\n return filter.call(elements, callback);\n };\n\n if (window.JSON) $.parseJSON = JSON.parse; // Populate the class2type map\n\n $.each(\"Boolean Number String Function Array Date RegExp Object Error\".split(\" \"), function (i, name) {\n class2type[\"[object \" + name + \"]\"] = name.toLowerCase();\n }); // Define methods that will be available on all\n // Zepto collections\n\n $.fn = {\n constructor: zepto.Z,\n length: 0,\n // Because a collection acts like an array\n // copy over these useful array functions.\n forEach: emptyArray.forEach,\n reduce: emptyArray.reduce,\n push: emptyArray.push,\n sort: emptyArray.sort,\n splice: emptyArray.splice,\n indexOf: emptyArray.indexOf,\n concat: function () {\n var i,\n value,\n args = [];\n\n for (i = 0; i < arguments.length; i++) {\n value = arguments[i];\n args[i] = zepto.isZ(value) ? value.toArray() : value;\n }\n\n return concat.apply(zepto.isZ(this) ? this.toArray() : this, args);\n },\n // `map` and `slice` in the jQuery API work differently\n // from their array counterparts\n map: function (fn) {\n return $($.map(this, function (el, i) {\n return fn.call(el, i, el);\n }));\n },\n slice: function () {\n return $(slice.apply(this, arguments));\n },\n ready: function (callback) {\n // need to check if document.body exists for IE as that browser reports\n // document ready when it hasn't yet created the body element\n if (readyRE.test(document.readyState) && document.body) callback($);else document.addEventListener('DOMContentLoaded', function () {\n callback($);\n }, false);\n return this;\n },\n get: function (idx) {\n return idx === undefined$1 ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length];\n },\n toArray: function () {\n return this.get();\n },\n size: function () {\n return this.length;\n },\n remove: function () {\n return this.each(function () {\n if (this.parentNode != null) this.parentNode.removeChild(this);\n });\n },\n each: function (callback) {\n emptyArray.every.call(this, function (el, idx) {\n return callback.call(el, idx, el) !== false;\n });\n return this;\n },\n filter: function (selector) {\n if (isFunction(selector)) return this.not(this.not(selector));\n return $(filter.call(this, function (element) {\n return zepto.matches(element, selector);\n }));\n },\n add: function (selector, context) {\n return $(uniq(this.concat($(selector, context))));\n },\n is: function (selector) {\n return this.length > 0 && zepto.matches(this[0], selector);\n },\n not: function (selector) {\n var nodes = [];\n if (isFunction(selector) && selector.call !== undefined$1) this.each(function (idx) {\n if (!selector.call(this, idx)) nodes.push(this);\n });else {\n var excludes = typeof selector == 'string' ? this.filter(selector) : likeArray(selector) && isFunction(selector.item) ? slice.call(selector) : $(selector);\n this.forEach(function (el) {\n if (excludes.indexOf(el) < 0) nodes.push(el);\n });\n }\n return $(nodes);\n },\n has: function (selector) {\n return this.filter(function () {\n return isObject(selector) ? $.contains(this, selector) : $(this).find(selector).size();\n });\n },\n eq: function (idx) {\n return idx === -1 ? this.slice(idx) : this.slice(idx, +idx + 1);\n },\n first: function () {\n var el = this[0];\n return el && !isObject(el) ? el : $(el);\n },\n last: function () {\n var el = this[this.length - 1];\n return el && !isObject(el) ? el : $(el);\n },\n find: function (selector) {\n var result,\n $this = this;\n if (!selector) result = $();else if (typeof selector == 'object') result = $(selector).filter(function () {\n var node = this;\n return emptyArray.some.call($this, function (parent) {\n return $.contains(parent, node);\n });\n });else if (this.length == 1) result = $(zepto.qsa(this[0], selector));else result = this.map(function () {\n return zepto.qsa(this, selector);\n });\n return result;\n },\n closest: function (selector, context) {\n var nodes = [],\n collection = typeof selector == 'object' && $(selector);\n this.each(function (_, node) {\n while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector))) node = node !== context && !isDocument(node) && node.parentNode;\n\n if (node && nodes.indexOf(node) < 0) nodes.push(node);\n });\n return $(nodes);\n },\n parents: function (selector) {\n var ancestors = [],\n nodes = this;\n\n while (nodes.length > 0) nodes = $.map(nodes, function (node) {\n if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {\n ancestors.push(node);\n return node;\n }\n });\n\n return filtered(ancestors, selector);\n },\n parent: function (selector) {\n return filtered(uniq(this.pluck('parentNode')), selector);\n },\n children: function (selector) {\n return filtered(this.map(function () {\n return children(this);\n }), selector);\n },\n contents: function () {\n return this.map(function () {\n return this.contentDocument || slice.call(this.childNodes);\n });\n },\n siblings: function (selector) {\n return filtered(this.map(function (i, el) {\n return filter.call(children(el.parentNode), function (child) {\n return child !== el;\n });\n }), selector);\n },\n empty: function () {\n return this.each(function () {\n this.innerHTML = '';\n });\n },\n // `pluck` is borrowed from Prototype.js\n pluck: function (property) {\n return $.map(this, function (el) {\n return el[property];\n });\n },\n show: function () {\n return this.each(function () {\n this.style.display == \"none\" && (this.style.display = '');\n if (getComputedStyle(this, '').getPropertyValue(\"display\") == \"none\") this.style.display = defaultDisplay(this.nodeName);\n });\n },\n replaceWith: function (newContent) {\n return this.before(newContent).remove();\n },\n wrap: function (structure) {\n var func = isFunction(structure);\n if (this[0] && !func) var dom = $(structure).get(0),\n clone = dom.parentNode || this.length > 1;\n return this.each(function (index) {\n $(this).wrapAll(func ? structure.call(this, index) : clone ? dom.cloneNode(true) : dom);\n });\n },\n wrapAll: function (structure) {\n if (this[0]) {\n $(this[0]).before(structure = $(structure));\n var children; // drill down to the inmost element\n\n while ((children = structure.children()).length) structure = children.first();\n\n $(structure).append(this);\n }\n\n return this;\n },\n wrapInner: function (structure) {\n var func = isFunction(structure);\n return this.each(function (index) {\n var self = $(this),\n contents = self.contents(),\n dom = func ? structure.call(this, index) : structure;\n contents.length ? contents.wrapAll(dom) : self.append(dom);\n });\n },\n unwrap: function () {\n this.parent().each(function () {\n $(this).replaceWith($(this).children());\n });\n return this;\n },\n clone: function () {\n return this.map(function () {\n return this.cloneNode(true);\n });\n },\n hide: function () {\n return this.css(\"display\", \"none\");\n },\n toggle: function (setting) {\n return this.each(function () {\n var el = $(this);\n (setting === undefined$1 ? el.css(\"display\") == \"none\" : setting) ? el.show() : el.hide();\n });\n },\n prev: function (selector) {\n return $(this.pluck('previousElementSibling')).filter(selector || '*');\n },\n next: function (selector) {\n return $(this.pluck('nextElementSibling')).filter(selector || '*');\n },\n html: function (html) {\n return 0 in arguments ? this.each(function (idx) {\n var originHtml = this.innerHTML;\n $(this).empty().append(funcArg(this, html, idx, originHtml));\n }) : 0 in this ? this[0].innerHTML : null;\n },\n text: function (text) {\n return 0 in arguments ? this.each(function (idx) {\n var newText = funcArg(this, text, idx, this.textContent);\n this.textContent = newText == null ? '' : '' + newText;\n }) : 0 in this ? this.pluck('textContent').join(\"\") : null;\n },\n attr: function (name, value) {\n var result;\n return typeof name == 'string' && !(1 in arguments) ? 0 in this && this[0].nodeType == 1 && (result = this[0].getAttribute(name)) != null ? result : undefined$1 : this.each(function (idx) {\n if (this.nodeType !== 1) return;\n if (isObject(name)) for (key in name) setAttribute(this, key, name[key]);else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name)));\n });\n },\n removeAttr: function (name) {\n return this.each(function () {\n this.nodeType === 1 && name.split(' ').forEach(function (attribute) {\n setAttribute(this, attribute);\n }, this);\n });\n },\n prop: function (name, value) {\n name = propMap[name] || name;\n return 1 in arguments ? this.each(function (idx) {\n this[name] = funcArg(this, value, idx, this[name]);\n }) : this[0] && this[0][name];\n },\n removeProp: function (name) {\n name = propMap[name] || name;\n return this.each(function () {\n delete this[name];\n });\n },\n data: function (name, value) {\n var attrName = 'data-' + name.replace(capitalRE, '-$1').toLowerCase();\n var data = 1 in arguments ? this.attr(attrName, value) : this.attr(attrName);\n return data !== null ? deserializeValue(data) : undefined$1;\n },\n val: function (value) {\n if (0 in arguments) {\n if (value == null) value = \"\";\n return this.each(function (idx) {\n this.value = funcArg(this, value, idx, this.value);\n });\n } else {\n return this[0] && (this[0].multiple ? $(this[0]).find('option').filter(function () {\n return this.selected;\n }).pluck('value') : this[0].value);\n }\n },\n offset: function (coordinates) {\n if (coordinates) return this.each(function (index) {\n var $this = $(this),\n coords = funcArg(this, coordinates, index, $this.offset()),\n parentOffset = $this.offsetParent().offset(),\n props = {\n top: coords.top - parentOffset.top,\n left: coords.left - parentOffset.left\n };\n if ($this.css('position') == 'static') props['position'] = 'relative';\n $this.css(props);\n });\n if (!this.length) return null;\n if (document.documentElement !== this[0] && !$.contains(document.documentElement, this[0])) return {\n top: 0,\n left: 0\n };\n var obj = this[0].getBoundingClientRect();\n return {\n left: obj.left + window.pageXOffset,\n top: obj.top + window.pageYOffset,\n width: Math.round(obj.width),\n height: Math.round(obj.height)\n };\n },\n css: function (property, value) {\n if (arguments.length < 2) {\n var element = this[0];\n\n if (typeof property == 'string') {\n if (!element) return;\n return element.style[camelize(property)] || getComputedStyle(element, '').getPropertyValue(property);\n } else if (isArray(property)) {\n if (!element) return;\n var props = {};\n var computedStyle = getComputedStyle(element, '');\n $.each(property, function (_, prop) {\n props[prop] = element.style[camelize(prop)] || computedStyle.getPropertyValue(prop);\n });\n return props;\n }\n }\n\n var css = '';\n\n if (type(property) == 'string') {\n if (!value && value !== 0) this.each(function () {\n this.style.removeProperty(dasherize(property));\n });else css = dasherize(property) + \":\" + maybeAddPx(property, value);\n } else {\n for (key in property) if (!property[key] && property[key] !== 0) this.each(function () {\n this.style.removeProperty(dasherize(key));\n });else css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';';\n }\n\n return this.each(function () {\n this.style.cssText += ';' + css;\n });\n },\n index: function (element) {\n return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0]);\n },\n hasClass: function (name) {\n if (!name) return false;\n return emptyArray.some.call(this, function (el) {\n return this.test(className(el));\n }, classRE(name));\n },\n addClass: function (name) {\n if (!name) return this;\n return this.each(function (idx) {\n if (!('className' in this)) return;\n classList = [];\n var cls = className(this),\n newName = funcArg(this, name, idx, cls);\n newName.split(/\\s+/g).forEach(function (klass) {\n if (!$(this).hasClass(klass)) classList.push(klass);\n }, this);\n classList.length && className(this, cls + (cls ? \" \" : \"\") + classList.join(\" \"));\n });\n },\n removeClass: function (name) {\n return this.each(function (idx) {\n if (!('className' in this)) return;\n if (name === undefined$1) return className(this, '');\n classList = className(this);\n funcArg(this, name, idx, classList).split(/\\s+/g).forEach(function (klass) {\n classList = classList.replace(classRE(klass), \" \");\n });\n className(this, classList.trim());\n });\n },\n toggleClass: function (name, when) {\n if (!name) return this;\n return this.each(function (idx) {\n var $this = $(this),\n names = funcArg(this, name, idx, className(this));\n names.split(/\\s+/g).forEach(function (klass) {\n (when === undefined$1 ? !$this.hasClass(klass) : when) ? $this.addClass(klass) : $this.removeClass(klass);\n });\n });\n },\n scrollTop: function (value) {\n if (!this.length) return;\n var hasScrollTop = ('scrollTop' in this[0]);\n if (value === undefined$1) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset;\n return this.each(hasScrollTop ? function () {\n this.scrollTop = value;\n } : function () {\n this.scrollTo(this.scrollX, value);\n });\n },\n scrollLeft: function (value) {\n if (!this.length) return;\n var hasScrollLeft = ('scrollLeft' in this[0]);\n if (value === undefined$1) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset;\n return this.each(hasScrollLeft ? function () {\n this.scrollLeft = value;\n } : function () {\n this.scrollTo(value, this.scrollY);\n });\n },\n position: function () {\n if (!this.length) return;\n var elem = this[0],\n // Get *real* offsetParent\n offsetParent = this.offsetParent(),\n // Get correct offsets\n offset = this.offset(),\n parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? {\n top: 0,\n left: 0\n } : offsetParent.offset(); // Subtract element margins\n // note: when an element has margin: auto the offsetLeft and marginLeft\n // are the same in Safari causing offset.left to incorrectly be 0\n\n offset.top -= parseFloat($(elem).css('margin-top')) || 0;\n offset.left -= parseFloat($(elem).css('margin-left')) || 0; // Add offsetParent borders\n\n parentOffset.top += parseFloat($(offsetParent[0]).css('border-top-width')) || 0;\n parentOffset.left += parseFloat($(offsetParent[0]).css('border-left-width')) || 0; // Subtract the two offsets\n\n return {\n top: offset.top - parentOffset.top,\n left: offset.left - parentOffset.left\n };\n },\n offsetParent: function () {\n return this.map(function () {\n var parent = this.offsetParent || document.body;\n\n while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css(\"position\") == \"static\") parent = parent.offsetParent;\n\n return parent;\n });\n }\n }; // for now\n\n $.fn.detach = $.fn.remove // Generate the `width` and `height` functions\n ;\n ['width', 'height'].forEach(function (dimension) {\n var dimensionProperty = dimension.replace(/./, function (m) {\n return m[0].toUpperCase();\n });\n\n $.fn[dimension] = function (value) {\n var offset,\n el = this[0];\n if (value === undefined$1) return isWindow(el) ? el['inner' + dimensionProperty] : isDocument(el) ? el.documentElement['scroll' + dimensionProperty] : (offset = this.offset()) && offset[dimension];else return this.each(function (idx) {\n el = $(this);\n el.css(dimension, funcArg(this, value, idx, el[dimension]()));\n });\n };\n });\n\n function traverseNode(node, fun) {\n fun(node);\n\n for (var i = 0, len = node.childNodes.length; i < len; i++) traverseNode(node.childNodes[i], fun);\n } // Generate the `after`, `prepend`, `before`, `append`,\n // `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods.\n\n\n adjacencyOperators.forEach(function (operator, operatorIndex) {\n var inside = operatorIndex % 2; //=> prepend, append\n\n $.fn[operator] = function () {\n // arguments can be nodes, arrays of nodes, Zepto objects and HTML strings\n var argType,\n nodes = $.map(arguments, function (arg) {\n var arr = [];\n argType = type(arg);\n\n if (argType == \"array\") {\n arg.forEach(function (el) {\n if (el.nodeType !== undefined$1) return arr.push(el);else if ($.zepto.isZ(el)) return arr = arr.concat(el.get());\n arr = arr.concat(zepto.fragment(el));\n });\n return arr;\n }\n\n return argType == \"object\" || arg == null ? arg : zepto.fragment(arg);\n }),\n parent,\n copyByClone = this.length > 1;\n if (nodes.length < 1) return this;\n return this.each(function (_, target) {\n parent = inside ? target : target.parentNode; // convert all methods to a \"before\" operation\n\n target = operatorIndex == 0 ? target.nextSibling : operatorIndex == 1 ? target.firstChild : operatorIndex == 2 ? target : null;\n var parentInDocument = $.contains(document.documentElement, parent);\n nodes.forEach(function (node) {\n if (copyByClone) node = node.cloneNode(true);else if (!parent) return $(node).remove();\n parent.insertBefore(node, target);\n if (parentInDocument) traverseNode(node, function (el) {\n if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' && (!el.type || el.type === 'text/javascript') && !el.src) {\n var target = el.ownerDocument ? el.ownerDocument.defaultView : window;\n target['eval'].call(target, el.innerHTML);\n }\n });\n });\n });\n }; // after => insertAfter\n // prepend => prependTo\n // before => insertBefore\n // append => appendTo\n\n\n $.fn[inside ? operator + 'To' : 'insert' + (operatorIndex ? 'Before' : 'After')] = function (html) {\n $(html)[operator](this);\n return this;\n };\n });\n zepto.Z.prototype = Z.prototype = $.fn; // Export internal API functions in the `$.zepto` namespace\n\n zepto.uniq = uniq;\n zepto.deserializeValue = deserializeValue;\n $.zepto = zepto;\n return $;\n}();\n\nwindow.Zepto = Zepto;\nwindow.$ === undefined && (window.$ = Zepto);\n\n(function ($) {\n var jsonpID = +new Date(),\n document = window.document,\n key,\n name,\n rscript = /)<[^<]*)*<\\/script>/gi,\n scriptTypeRE = /^(?:text|application)\\/javascript/i,\n xmlTypeRE = /^(?:text|application)\\/xml/i,\n jsonType = 'application/json',\n htmlType = 'text/html',\n blankRE = /^\\s*$/,\n originAnchor = document.createElement('a');\n originAnchor.href = window.location.href; // trigger a custom event and return false if it was cancelled\n\n function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName);\n $(context).trigger(event, data);\n return !event.isDefaultPrevented();\n } // trigger an Ajax \"global\" event\n\n\n function triggerGlobal(settings, context, eventName, data) {\n if (settings.global) return triggerAndReturn(context || document, eventName, data);\n } // Number of active Ajax requests\n\n\n $.active = 0;\n\n function ajaxStart(settings) {\n if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart');\n }\n\n function ajaxStop(settings) {\n if (settings.global && ! --$.active) triggerGlobal(settings, null, 'ajaxStop');\n } // triggers an extra global event \"ajaxBeforeSend\" that's like \"ajaxSend\" but cancelable\n\n\n function ajaxBeforeSend(xhr, settings) {\n var context = settings.context;\n if (settings.beforeSend.call(context, xhr, settings) === false || triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false) return false;\n triggerGlobal(settings, context, 'ajaxSend', [xhr, settings]);\n }\n\n function ajaxSuccess(data, xhr, settings, deferred) {\n var context = settings.context,\n status = 'success';\n settings.success.call(context, data, status, xhr);\n if (deferred) deferred.resolveWith(context, [data, status, xhr]);\n triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data]);\n ajaxComplete(status, xhr, settings);\n } // type: \"timeout\", \"error\", \"abort\", \"parsererror\"\n\n\n function ajaxError(error, type, xhr, settings, deferred) {\n var context = settings.context;\n settings.error.call(context, xhr, type, error);\n if (deferred) deferred.rejectWith(context, [xhr, type, error]);\n triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type]);\n ajaxComplete(type, xhr, settings);\n } // status: \"success\", \"notmodified\", \"error\", \"timeout\", \"abort\", \"parsererror\"\n\n\n function ajaxComplete(status, xhr, settings) {\n var context = settings.context;\n settings.complete.call(context, xhr, status);\n triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings]);\n ajaxStop(settings);\n }\n\n function ajaxDataFilter(data, type, settings) {\n if (settings.dataFilter == empty) return data;\n var context = settings.context;\n return settings.dataFilter.call(context, data, type);\n } // Empty function, used as default callback\n\n\n function empty() {}\n\n $.ajaxJSONP = function (options, deferred) {\n if (!('type' in options)) return $.ajax(options);\n\n var _callbackName = options.jsonpCallback,\n callbackName = ($.isFunction(_callbackName) ? _callbackName() : _callbackName) || 'Zepto' + jsonpID++,\n script = document.createElement('script'),\n originalCallback = window[callbackName],\n responseData,\n abort = function (errorType) {\n $(script).triggerHandler('error', errorType || 'abort');\n },\n xhr = {\n abort: abort\n },\n abortTimeout;\n\n if (deferred) deferred.promise(xhr);\n $(script).on('load error', function (e, errorType) {\n clearTimeout(abortTimeout);\n $(script).off().remove();\n\n if (e.type == 'error' || !responseData) {\n ajaxError(null, errorType || 'error', xhr, options, deferred);\n } else {\n ajaxSuccess(responseData[0], xhr, options, deferred);\n }\n\n window[callbackName] = originalCallback;\n if (responseData && $.isFunction(originalCallback)) originalCallback(responseData[0]);\n originalCallback = responseData = undefined;\n });\n\n if (ajaxBeforeSend(xhr, options) === false) {\n abort('abort');\n return xhr;\n }\n\n window[callbackName] = function () {\n responseData = arguments;\n };\n\n script.src = options.url.replace(/\\?(.+)=\\?/, '?$1=' + callbackName);\n document.head.appendChild(script);\n if (options.timeout > 0) abortTimeout = setTimeout(function () {\n abort('timeout');\n }, options.timeout);\n return xhr;\n };\n\n $.ajaxSettings = {\n // Default type of request\n type: 'GET',\n // Callback that is executed before request\n beforeSend: empty,\n // Callback that is executed if the request succeeds\n success: empty,\n // Callback that is executed the the server drops error\n error: empty,\n // Callback that is executed on request complete (both: error and success)\n complete: empty,\n // The context for the callbacks\n context: null,\n // Whether to trigger \"global\" Ajax events\n global: true,\n // Transport\n xhr: function () {\n return new window.XMLHttpRequest();\n },\n // MIME types mapping\n // IIS returns Javascript as \"application/x-javascript\"\n accepts: {\n script: 'text/javascript, application/javascript, application/x-javascript',\n json: jsonType,\n xml: 'application/xml, text/xml',\n html: htmlType,\n text: 'text/plain'\n },\n // Whether the request is to another domain\n crossDomain: false,\n // Default timeout\n timeout: 0,\n // Whether data should be serialized to string\n processData: true,\n // Whether the browser should be allowed to cache GET responses\n cache: true,\n //Used to handle the raw response data of XMLHttpRequest.\n //This is a pre-filtering function to sanitize the response.\n //The sanitized response should be returned\n dataFilter: empty\n };\n\n function mimeToDataType(mime) {\n if (mime) mime = mime.split(';', 2)[0];\n return mime && (mime == htmlType ? 'html' : mime == jsonType ? 'json' : scriptTypeRE.test(mime) ? 'script' : xmlTypeRE.test(mime) && 'xml') || 'text';\n }\n\n function appendQuery(url, query) {\n if (query == '') return url;\n return (url + '&' + query).replace(/[&?]{1,2}/, '?');\n } // serialize payload and append it to the URL for GET requests\n\n\n function serializeData(options) {\n if (options.processData && options.data && $.type(options.data) != \"string\") options.data = $.param(options.data, options.traditional);\n if (options.data && (!options.type || options.type.toUpperCase() == 'GET' || 'jsonp' == options.dataType)) options.url = appendQuery(options.url, options.data), options.data = undefined;\n }\n\n $.ajax = function (options) {\n var settings = $.extend({}, options || {}),\n deferred = $.Deferred && $.Deferred(),\n urlAnchor,\n hashIndex;\n\n for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key];\n\n ajaxStart(settings);\n\n if (!settings.crossDomain) {\n urlAnchor = document.createElement('a');\n urlAnchor.href = settings.url; // cleans up URL for .href (IE only), see https://github.com/madrobby/zepto/pull/1049\n\n urlAnchor.href = urlAnchor.href;\n settings.crossDomain = originAnchor.protocol + '//' + originAnchor.host !== urlAnchor.protocol + '//' + urlAnchor.host;\n }\n\n if (!settings.url) settings.url = window.location.toString();\n if ((hashIndex = settings.url.indexOf('#')) > -1) settings.url = settings.url.slice(0, hashIndex);\n serializeData(settings);\n var dataType = settings.dataType,\n hasPlaceholder = /\\?.+=\\?/.test(settings.url);\n if (hasPlaceholder) dataType = 'jsonp';\n if (settings.cache === false || (!options || options.cache !== true) && ('script' == dataType || 'jsonp' == dataType)) settings.url = appendQuery(settings.url, '_=' + Date.now());\n\n if ('jsonp' == dataType) {\n if (!hasPlaceholder) settings.url = appendQuery(settings.url, settings.jsonp ? settings.jsonp + '=?' : settings.jsonp === false ? '' : 'callback=?');\n return $.ajaxJSONP(settings, deferred);\n }\n\n var mime = settings.accepts[dataType],\n headers = {},\n setHeader = function (name, value) {\n headers[name.toLowerCase()] = [name, value];\n },\n protocol = /^([\\w-]+:)\\/\\//.test(settings.url) ? RegExp.$1 : window.location.protocol,\n xhr = settings.xhr(),\n nativeSetHeader = xhr.setRequestHeader,\n abortTimeout;\n\n if (deferred) deferred.promise(xhr);\n if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest');\n setHeader('Accept', mime || '*/*');\n\n if (mime = settings.mimeType || mime) {\n if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0];\n xhr.overrideMimeType && xhr.overrideMimeType(mime);\n }\n\n if (settings.contentType || settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET') setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded');\n if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name]);\n xhr.setRequestHeader = setHeader;\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState == 4) {\n xhr.onreadystatechange = empty;\n clearTimeout(abortTimeout);\n var result,\n error = false;\n\n if (xhr.status >= 200 && xhr.status < 300 || xhr.status == 304 || xhr.status == 0 && protocol == 'file:') {\n dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'));\n if (xhr.responseType == 'arraybuffer' || xhr.responseType == 'blob') result = xhr.response;else {\n result = xhr.responseText;\n\n try {\n // http://perfectionkills.com/global-eval-what-are-the-options/\n // sanitize response accordingly if data filter callback provided\n result = ajaxDataFilter(result, dataType, settings);\n if (dataType == 'script') (1, eval)(result);else if (dataType == 'xml') result = xhr.responseXML;else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result);\n } catch (e) {\n error = e;\n }\n\n if (error) return ajaxError(error, 'parsererror', xhr, settings, deferred);\n }\n ajaxSuccess(result, xhr, settings, deferred);\n } else {\n ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred);\n }\n }\n };\n\n if (ajaxBeforeSend(xhr, settings) === false) {\n xhr.abort();\n ajaxError(null, 'abort', xhr, settings, deferred);\n return xhr;\n }\n\n var async = 'async' in settings ? settings.async : true;\n xhr.open(settings.type, settings.url, async, settings.username, settings.password);\n if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name];\n\n for (name in headers) nativeSetHeader.apply(xhr, headers[name]);\n\n if (settings.timeout > 0) abortTimeout = setTimeout(function () {\n xhr.onreadystatechange = empty;\n xhr.abort();\n ajaxError(null, 'timeout', xhr, settings, deferred);\n }, settings.timeout); // avoid sending empty string (#319)\n\n xhr.send(settings.data ? settings.data : null);\n return xhr;\n }; // handle optional data/success arguments\n\n\n function parseArguments(url, data, success, dataType) {\n if ($.isFunction(data)) dataType = success, success = data, data = undefined;\n if (!$.isFunction(success)) dataType = success, success = undefined;\n return {\n url: url,\n data: data,\n success: success,\n dataType: dataType\n };\n }\n\n $.get = function ()\n /* url, data, success, dataType */\n {\n return $.ajax(parseArguments.apply(null, arguments));\n };\n\n $.post = function ()\n /* url, data, success, dataType */\n {\n var options = parseArguments.apply(null, arguments);\n options.type = 'POST';\n return $.ajax(options);\n };\n\n $.getJSON = function ()\n /* url, data, success */\n {\n var options = parseArguments.apply(null, arguments);\n options.dataType = 'json';\n return $.ajax(options);\n };\n\n $.fn.load = function (url, data, success) {\n if (!this.length) return this;\n var self = this,\n parts = url.split(/\\s/),\n selector,\n options = parseArguments(url, data, success),\n callback = options.success;\n if (parts.length > 1) options.url = parts[0], selector = parts[1];\n\n options.success = function (response) {\n self.html(selector ? $('
').html(response.replace(rscript, \"\")).find(selector) : response);\n callback && callback.apply(self, arguments);\n };\n\n $.ajax(options);\n return this;\n };\n\n var escape = encodeURIComponent;\n\n function serialize(params, obj, traditional, scope) {\n var type,\n array = $.isArray(obj),\n hash = $.isPlainObject(obj);\n $.each(obj, function (key, value) {\n type = $.type(value);\n if (scope) key = traditional ? scope : scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']'; // handle data in serializeArray() format\n\n if (!scope && array) params.add(value.name, value.value); // recurse into nested objects\n else if (type == \"array\" || !traditional && type == \"object\") serialize(params, value, traditional, key);else params.add(key, value);\n });\n }\n\n $.param = function (obj, traditional) {\n var params = [];\n\n params.add = function (key, value) {\n if ($.isFunction(value)) value = value();\n if (value == null) value = \"\";\n this.push(escape(key) + '=' + escape(value));\n };\n\n serialize(params, obj, traditional);\n return params.join('&').replace(/%20/g, '+');\n };\n})(Zepto);\n\n(function ($) {\n // Create a collection of callbacks to be fired in a sequence, with configurable behaviour\n // Option flags:\n // - once: Callbacks fired at most one time.\n // - memory: Remember the most recent context and arguments\n // - stopOnFalse: Cease iterating over callback list\n // - unique: Permit adding at most one instance of the same callback\n $.Callbacks = function (options) {\n options = $.extend({}, options);\n\n var memory,\n // Last fire value (for non-forgettable lists)\n fired,\n // Flag to know if list was already fired\n firing,\n // Flag to know if list is currently firing\n firingStart,\n // First callback to fire (used internally by add and fireWith)\n firingLength,\n // End of the loop when firing\n firingIndex,\n // Index of currently firing callback (modified by remove if needed)\n list = [],\n // Actual callback list\n stack = !options.once && [],\n // Stack of fire calls for repeatable lists\n fire = function (data) {\n memory = options.memory && data;\n fired = true;\n firingIndex = firingStart || 0;\n firingStart = 0;\n firingLength = list.length;\n firing = true;\n\n for (; list && firingIndex < firingLength; ++firingIndex) {\n if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {\n memory = false;\n break;\n }\n }\n\n firing = false;\n\n if (list) {\n if (stack) stack.length && fire(stack.shift());else if (memory) list.length = 0;else Callbacks.disable();\n }\n },\n Callbacks = {\n add: function () {\n if (list) {\n var start = list.length,\n add = function (args) {\n $.each(args, function (_, arg) {\n if (typeof arg === \"function\") {\n if (!options.unique || !Callbacks.has(arg)) list.push(arg);\n } else if (arg && arg.length && typeof arg !== 'string') add(arg);\n });\n };\n\n add(arguments);\n if (firing) firingLength = list.length;else if (memory) {\n firingStart = start;\n fire(memory);\n }\n }\n\n return this;\n },\n remove: function () {\n if (list) {\n $.each(arguments, function (_, arg) {\n var index;\n\n while ((index = $.inArray(arg, list, index)) > -1) {\n list.splice(index, 1); // Handle firing indexes\n\n if (firing) {\n if (index <= firingLength) --firingLength;\n if (index <= firingIndex) --firingIndex;\n }\n }\n });\n }\n\n return this;\n },\n has: function (fn) {\n return !!(list && (fn ? $.inArray(fn, list) > -1 : list.length));\n },\n empty: function () {\n firingLength = list.length = 0;\n return this;\n },\n disable: function () {\n list = stack = memory = undefined;\n return this;\n },\n disabled: function () {\n return !list;\n },\n lock: function () {\n stack = undefined;\n if (!memory) Callbacks.disable();\n return this;\n },\n locked: function () {\n return !stack;\n },\n fireWith: function (context, args) {\n if (list && (!fired || stack)) {\n args = args || [];\n args = [context, args.slice ? args.slice() : args];\n if (firing) stack.push(args);else fire(args);\n }\n\n return this;\n },\n fire: function () {\n return Callbacks.fireWith(this, arguments);\n },\n fired: function () {\n return !!fired;\n }\n };\n\n return Callbacks;\n };\n})(Zepto);\n\n(function ($) {\n var slice = Array.prototype.slice;\n\n function Deferred(func) {\n var tuples = [// action, add listener, listener list, final state\n [\"resolve\", \"done\", $.Callbacks({\n once: 1,\n memory: 1\n }), \"resolved\"], [\"reject\", \"fail\", $.Callbacks({\n once: 1,\n memory: 1\n }), \"rejected\"], [\"notify\", \"progress\", $.Callbacks({\n memory: 1\n })]],\n state = \"pending\",\n promise = {\n state: function () {\n return state;\n },\n always: function () {\n deferred.done(arguments).fail(arguments);\n return this;\n },\n then: function ()\n /* fnDone [, fnFailed [, fnProgress]] */\n {\n var fns = arguments;\n return Deferred(function (defer) {\n $.each(tuples, function (i, tuple) {\n var fn = $.isFunction(fns[i]) && fns[i];\n deferred[tuple[1]](function () {\n var returned = fn && fn.apply(this, arguments);\n\n if (returned && $.isFunction(returned.promise)) {\n returned.promise().done(defer.resolve).fail(defer.reject).progress(defer.notify);\n } else {\n var context = this === promise ? defer.promise() : this,\n values = fn ? [returned] : arguments;\n defer[tuple[0] + \"With\"](context, values);\n }\n });\n });\n fns = null;\n }).promise();\n },\n promise: function (obj) {\n return obj != null ? $.extend(obj, promise) : promise;\n }\n },\n deferred = {};\n $.each(tuples, function (i, tuple) {\n var list = tuple[2],\n stateString = tuple[3];\n promise[tuple[1]] = list.add;\n\n if (stateString) {\n list.add(function () {\n state = stateString;\n }, tuples[i ^ 1][2].disable, tuples[2][2].lock);\n }\n\n deferred[tuple[0]] = function () {\n deferred[tuple[0] + \"With\"](this === deferred ? promise : this, arguments);\n return this;\n };\n\n deferred[tuple[0] + \"With\"] = list.fireWith;\n });\n promise.promise(deferred);\n if (func) func.call(deferred, deferred);\n return deferred;\n }\n\n $.when = function (sub) {\n var resolveValues = slice.call(arguments),\n len = resolveValues.length,\n i = 0,\n remain = len !== 1 || sub && $.isFunction(sub.promise) ? len : 0,\n deferred = remain === 1 ? sub : Deferred(),\n progressValues,\n progressContexts,\n resolveContexts,\n updateFn = function (i, ctx, val) {\n return function (value) {\n ctx[i] = this;\n val[i] = arguments.length > 1 ? slice.call(arguments) : value;\n\n if (val === progressValues) {\n deferred.notifyWith(ctx, val);\n } else if (! --remain) {\n deferred.resolveWith(ctx, val);\n }\n };\n };\n\n if (len > 1) {\n progressValues = new Array(len);\n progressContexts = new Array(len);\n resolveContexts = new Array(len);\n\n for (; i < len; ++i) {\n if (resolveValues[i] && $.isFunction(resolveValues[i].promise)) {\n resolveValues[i].promise().done(updateFn(i, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFn(i, progressContexts, progressValues));\n } else {\n --remain;\n }\n }\n }\n\n if (!remain) deferred.resolveWith(resolveContexts, resolveValues);\n return deferred.promise();\n };\n\n $.Deferred = Deferred;\n})(Zepto);\n\n(function ($) {\n var _zid = 1,\n undefined$1,\n slice = Array.prototype.slice,\n isFunction = $.isFunction,\n isString = function (obj) {\n return typeof obj == 'string';\n },\n handlers = {},\n specialEvents = {},\n focusinSupported = ('onfocusin' in window),\n focus = {\n focus: 'focusin',\n blur: 'focusout'\n },\n hover = {\n mouseenter: 'mouseover',\n mouseleave: 'mouseout'\n };\n\n specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents';\n\n function zid(element) {\n return element._zid || (element._zid = _zid++);\n }\n\n function findHandlers(element, event, fn, selector) {\n event = parse(event);\n if (event.ns) var matcher = matcherFor(event.ns);\n return (handlers[zid(element)] || []).filter(function (handler) {\n return handler && (!event.e || handler.e == event.e) && (!event.ns || matcher.test(handler.ns)) && (!fn || zid(handler.fn) === zid(fn)) && (!selector || handler.sel == selector);\n });\n }\n\n function parse(event) {\n var parts = ('' + event).split('.');\n return {\n e: parts[0],\n ns: parts.slice(1).sort().join(' ')\n };\n }\n\n function matcherFor(ns) {\n return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)');\n }\n\n function eventCapture(handler, captureSetting) {\n return handler.del && !focusinSupported && handler.e in focus || !!captureSetting;\n }\n\n function realEvent(type) {\n return hover[type] || focusinSupported && focus[type] || type;\n }\n\n function add(element, events, fn, data, selector, delegator, capture) {\n var id = zid(element),\n set = handlers[id] || (handlers[id] = []);\n events.split(/\\s/).forEach(function (event) {\n if (event == 'ready') return $(document).ready(fn);\n var handler = parse(event);\n handler.fn = fn;\n handler.sel = selector; // emulate mouseenter, mouseleave\n\n if (handler.e in hover) fn = function (e) {\n var related = e.relatedTarget;\n if (!related || related !== this && !$.contains(this, related)) return handler.fn.apply(this, arguments);\n };\n handler.del = delegator;\n var callback = delegator || fn;\n\n handler.proxy = function (e) {\n e = compatible(e);\n if (e.isImmediatePropagationStopped()) return;\n e.data = data;\n var result = callback.apply(element, e._args == undefined$1 ? [e] : [e].concat(e._args));\n if (result === false) e.preventDefault(), e.stopPropagation();\n return result;\n };\n\n handler.i = set.length;\n set.push(handler);\n if ('addEventListener' in element) element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture));\n });\n }\n\n function remove(element, events, fn, selector, capture) {\n var id = zid(element);\n (events || '').split(/\\s/).forEach(function (event) {\n findHandlers(element, event, fn, selector).forEach(function (handler) {\n delete handlers[id][handler.i];\n if ('removeEventListener' in element) element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture));\n });\n });\n }\n\n $.event = {\n add: add,\n remove: remove\n };\n\n $.proxy = function (fn, context) {\n var args = 2 in arguments && slice.call(arguments, 2);\n\n if (isFunction(fn)) {\n var proxyFn = function () {\n return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments);\n };\n\n proxyFn._zid = zid(fn);\n return proxyFn;\n } else if (isString(context)) {\n if (args) {\n args.unshift(fn[context], fn);\n return $.proxy.apply(null, args);\n } else {\n return $.proxy(fn[context], fn);\n }\n } else {\n throw new TypeError(\"expected function\");\n }\n };\n\n $.fn.bind = function (event, data, callback) {\n return this.on(event, data, callback);\n };\n\n $.fn.unbind = function (event, callback) {\n return this.off(event, callback);\n };\n\n $.fn.one = function (event, selector, data, callback) {\n return this.on(event, selector, data, callback, 1);\n };\n\n var returnTrue = function () {\n return true;\n },\n returnFalse = function () {\n return false;\n },\n ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,\n eventMethods = {\n preventDefault: 'isDefaultPrevented',\n stopImmediatePropagation: 'isImmediatePropagationStopped',\n stopPropagation: 'isPropagationStopped'\n };\n\n function compatible(event, source) {\n if (source || !event.isDefaultPrevented) {\n source || (source = event);\n $.each(eventMethods, function (name, predicate) {\n var sourceMethod = source[name];\n\n event[name] = function () {\n this[predicate] = returnTrue;\n return sourceMethod && sourceMethod.apply(source, arguments);\n };\n\n event[predicate] = returnFalse;\n });\n event.timeStamp || (event.timeStamp = Date.now());\n if (source.defaultPrevented !== undefined$1 ? source.defaultPrevented : 'returnValue' in source ? source.returnValue === false : source.getPreventDefault && source.getPreventDefault()) event.isDefaultPrevented = returnTrue;\n }\n\n return event;\n }\n\n function createProxy(event) {\n var key,\n proxy = {\n originalEvent: event\n };\n\n for (key in event) if (!ignoreProperties.test(key) && event[key] !== undefined$1) proxy[key] = event[key];\n\n return compatible(proxy, event);\n }\n\n $.fn.delegate = function (selector, event, callback) {\n return this.on(event, selector, callback);\n };\n\n $.fn.undelegate = function (selector, event, callback) {\n return this.off(event, selector, callback);\n };\n\n $.fn.live = function (event, callback) {\n $(document.body).delegate(this.selector, event, callback);\n return this;\n };\n\n $.fn.die = function (event, callback) {\n $(document.body).undelegate(this.selector, event, callback);\n return this;\n };\n\n $.fn.on = function (event, selector, data, callback, one) {\n var autoRemove,\n delegator,\n $this = this;\n\n if (event && !isString(event)) {\n $.each(event, function (type, fn) {\n $this.on(type, selector, data, fn, one);\n });\n return $this;\n }\n\n if (!isString(selector) && !isFunction(callback) && callback !== false) callback = data, data = selector, selector = undefined$1;\n if (callback === undefined$1 || data === false) callback = data, data = undefined$1;\n if (callback === false) callback = returnFalse;\n return $this.each(function (_, element) {\n if (one) autoRemove = function (e) {\n remove(element, e.type, callback);\n return callback.apply(this, arguments);\n };\n if (selector) delegator = function (e) {\n var evt,\n match = $(e.target).closest(selector, element).get(0);\n\n if (match && match !== element) {\n evt = $.extend(createProxy(e), {\n currentTarget: match,\n liveFired: element\n });\n return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1)));\n }\n };\n add(element, event, callback, data, selector, delegator || autoRemove);\n });\n };\n\n $.fn.off = function (event, selector, callback) {\n var $this = this;\n\n if (event && !isString(event)) {\n $.each(event, function (type, fn) {\n $this.off(type, selector, fn);\n });\n return $this;\n }\n\n if (!isString(selector) && !isFunction(callback) && callback !== false) callback = selector, selector = undefined$1;\n if (callback === false) callback = returnFalse;\n return $this.each(function () {\n remove(this, event, callback, selector);\n });\n };\n\n $.fn.trigger = function (event, args) {\n event = isString(event) || $.isPlainObject(event) ? $.Event(event) : compatible(event);\n event._args = args;\n return this.each(function () {\n // handle focus(), blur() by calling them directly\n if (event.type in focus && typeof this[event.type] == \"function\") this[event.type](); // items in the collection might not be DOM elements\n else if ('dispatchEvent' in this) this.dispatchEvent(event);else $(this).triggerHandler(event, args);\n });\n }; // triggers event handlers on current element just as if an event occurred,\n // doesn't trigger an actual event, doesn't bubble\n\n\n $.fn.triggerHandler = function (event, args) {\n var e, result;\n this.each(function (i, element) {\n e = createProxy(isString(event) ? $.Event(event) : event);\n e._args = args;\n e.target = element;\n $.each(findHandlers(element, event.type || event), function (i, handler) {\n result = handler.proxy(e);\n if (e.isImmediatePropagationStopped()) return false;\n });\n });\n return result;\n } // shortcut methods for `.bind(event, fn)` for each event type\n ;\n\n ('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 (event) {\n $.fn[event] = function (callback) {\n return 0 in arguments ? this.bind(event, callback) : this.trigger(event);\n };\n });\n\n $.Event = function (type, props) {\n if (!isString(type)) props = type, type = props.type;\n var event = document.createEvent(specialEvents[type] || 'Events'),\n bubbles = true;\n if (props) for (var name in props) name == 'bubbles' ? bubbles = !!props[name] : event[name] = props[name];\n event.initEvent(type, bubbles, true);\n return compatible(event);\n };\n})(Zepto);\n\n(function () {\n // getComputedStyle shouldn't freak out when called\n // without a valid element as argument\n try {\n getComputedStyle(undefined);\n } catch (e) {\n var nativeGetComputedStyle = getComputedStyle;\n\n window.getComputedStyle = function (element, pseudoElement) {\n try {\n return nativeGetComputedStyle(element, pseudoElement);\n } catch (e) {\n return null;\n }\n };\n }\n})();\n\n(function ($) {\n var zepto = $.zepto,\n oldQsa = zepto.qsa,\n oldMatches = zepto.matches;\n\n function visible(elem) {\n elem = $(elem);\n return !!(elem.width() || elem.height()) && elem.css(\"display\") !== \"none\";\n } // Implements a subset from:\n // http://api.jquery.com/category/selectors/jquery-selector-extensions/\n //\n // Each filter function receives the current index, all nodes in the\n // considered set, and a value if there were parentheses. The value\n // of `this` is the node currently being considered. The function returns the\n // resulting node(s), null, or undefined.\n //\n // Complex selectors are not supported:\n // li:has(label:contains(\"foo\")) + li:has(label:contains(\"bar\"))\n // ul.inner:first > li\n\n\n var filters = $.expr[':'] = {\n visible: function () {\n if (visible(this)) return this;\n },\n hidden: function () {\n if (!visible(this)) return this;\n },\n selected: function () {\n if (this.selected) return this;\n },\n checked: function () {\n if (this.checked) return this;\n },\n parent: function () {\n return this.parentNode;\n },\n first: function (idx) {\n if (idx === 0) return this;\n },\n last: function (idx, nodes) {\n if (idx === nodes.length - 1) return this;\n },\n eq: function (idx, _, value) {\n if (idx === value) return this;\n },\n contains: function (idx, _, text) {\n if ($(this).text().indexOf(text) > -1) return this;\n },\n has: function (idx, _, sel) {\n if (zepto.qsa(this, sel).length) return this;\n }\n };\n var filterRe = new RegExp('(.*):(\\\\w+)(?:\\\\(([^)]+)\\\\))?$\\\\s*'),\n childRe = /^\\s*>/,\n classTag = 'Zepto' + +new Date();\n\n function process(sel, fn) {\n // quote the hash in `a[href^=#]` expression\n sel = sel.replace(/=#\\]/g, '=\"#\"]');\n var filter,\n arg,\n match = filterRe.exec(sel);\n\n if (match && match[2] in filters) {\n filter = filters[match[2]], arg = match[3];\n sel = match[1];\n\n if (arg) {\n var num = Number(arg);\n if (isNaN(num)) arg = arg.replace(/^[\"']|[\"']$/g, '');else arg = num;\n }\n }\n\n return fn(sel, filter, arg);\n }\n\n zepto.qsa = function (node, selector) {\n return process(selector, function (sel, filter, arg) {\n try {\n var taggedParent;\n if (!sel && filter) sel = '*';else if (childRe.test(sel)) // support \"> *\" child queries by tagging the parent node with a\n // unique class and prepending that classname onto the selector\n taggedParent = $(node).addClass(classTag), sel = '.' + classTag + ' ' + sel;\n var nodes = oldQsa(node, sel);\n } catch (e) {\n console.error('error performing selector: %o', selector);\n throw e;\n } finally {\n if (taggedParent) taggedParent.removeClass(classTag);\n }\n\n return !filter ? nodes : zepto.uniq($.map(nodes, function (n, i) {\n return filter.call(n, i, nodes, arg);\n }));\n });\n };\n\n zepto.matches = function (node, selector) {\n return process(selector, function (sel, filter, arg) {\n return (!sel || oldMatches(node, sel)) && (!filter || filter.call(node, null, arg) === node);\n });\n };\n})(Zepto);\n\nvar zepto = Zepto;\n\n/* eslint-disable no-useless-escape */\n// The order of the following arrays is important, be careful if you change it.\nvar BROWSER_DATA = [{\n name: 'Chromium',\n group: 'Chrome',\n identifier: 'Chromium/([0-9\\.]*)'\n}, {\n name: 'Chrome Mobile',\n group: 'Chrome',\n identifier: 'Chrome/([0-9\\.]*) Mobile',\n versionIdentifier: 'Chrome/([0-9\\.]*)'\n}, {\n name: 'Chrome',\n group: 'Chrome',\n identifier: 'Chrome/([0-9\\.]*)'\n}, {\n name: 'Chrome for iOS',\n group: 'Chrome',\n identifier: 'CriOS/([0-9\\.]*)'\n}, {\n name: 'Android Browser',\n group: 'Chrome',\n identifier: 'CrMo/([0-9\\.]*)'\n}, {\n name: 'Firefox',\n group: 'Firefox',\n identifier: 'Firefox/([0-9\\.]*)'\n}, {\n name: 'Opera Mini',\n group: 'Opera',\n identifier: 'Opera Mini/([0-9\\.]*)'\n}, {\n name: 'Opera',\n group: 'Opera',\n identifier: 'Opera ([0-9\\.]*)'\n}, {\n name: 'Opera',\n group: 'Opera',\n identifier: 'Opera/([0-9\\.]*)',\n versionIdentifier: 'Version/([0-9\\.]*)'\n}, {\n name: 'IEMobile',\n group: 'Explorer',\n identifier: 'IEMobile/([0-9\\.]*)'\n}, {\n name: 'Internet Explorer',\n group: 'Explorer',\n identifier: 'MSIE ([a-zA-Z0-9\\.]*)'\n}, {\n name: 'Internet Explorer',\n group: 'Explorer',\n identifier: 'Trident/([0-9\\.]*)',\n versionIdentifier: 'rv:([0-9\\.]*)'\n}, {\n name: 'Spartan',\n group: 'Spartan',\n identifier: 'Edge/([0-9\\.]*)',\n versionIdentifier: 'Edge/([0-9\\.]*)'\n}, {\n name: 'Safari',\n group: 'Safari',\n identifier: 'Safari/([0-9\\.]*)',\n versionIdentifier: 'Version/([0-9\\.]*)'\n}];\n\n/* eslint-disable no-useless-escape */\n// The order of the following arrays is important, be careful if you change it.\nvar OS_DATA = [{\n name: 'Windows 2000',\n group: 'Windows',\n identifier: 'Windows NT 5.0',\n version: '5.0'\n}, {\n name: 'Windows XP',\n group: 'Windows',\n identifier: 'Windows NT 5.1',\n version: '5.1'\n}, {\n name: 'Windows Vista',\n group: 'Windows',\n identifier: 'Windows NT 6.0',\n version: '6.0'\n}, {\n name: 'Windows 7',\n group: 'Windows',\n identifier: 'Windows NT 6.1',\n version: '7.0'\n}, {\n name: 'Windows 8',\n group: 'Windows',\n identifier: 'Windows NT 6.2',\n version: '8.0'\n}, {\n name: 'Windows 8.1',\n group: 'Windows',\n identifier: 'Windows NT 6.3',\n version: '8.1'\n}, {\n name: 'Windows 10',\n group: 'Windows',\n identifier: 'Windows NT 10.0',\n version: '10.0'\n}, {\n name: 'Windows Phone',\n group: 'Windows Phone',\n identifier: 'Windows Phone ([0-9\\.]*)'\n}, {\n name: 'Windows Phone',\n group: 'Windows Phone',\n identifier: 'Windows Phone OS ([0-9\\.]*)'\n}, {\n name: 'Windows',\n group: 'Windows',\n identifier: 'Windows'\n}, {\n name: 'Chrome OS',\n group: 'Chrome OS',\n identifier: 'CrOS'\n}, {\n name: 'Android',\n group: 'Android',\n identifier: 'Android',\n versionIdentifier: 'Android ([a-zA-Z0-9\\.-]*)'\n}, {\n name: 'iPad',\n group: 'iOS',\n identifier: 'iPad',\n versionIdentifier: 'OS ([0-9_]*)',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'iPod',\n group: 'iOS',\n identifier: 'iPod',\n versionIdentifier: 'OS ([0-9_]*)',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'iPhone',\n group: 'iOS',\n identifier: 'iPhone OS',\n versionIdentifier: 'OS ([0-9_]*)',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X High Sierra',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])13([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Sierra',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])12([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X El Capitan',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])11([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Yosemite',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])10([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Mavericks',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])9([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Mountain Lion',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])8([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Lion',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])7([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Snow Leopard',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])6([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Leopard',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])5([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Tiger',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])4([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Panther',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])3([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Jaguar',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])2([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Puma',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])1([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS X Cheetah',\n group: 'Mac OS',\n identifier: 'Mac OS X (10([_|\\.])0([0-9_\\.]*))',\n versionSeparator: '[_|\\.]'\n}, {\n name: 'Mac OS',\n group: 'Mac OS',\n identifier: 'Mac OS'\n}, {\n name: 'Ubuntu',\n group: 'Linux',\n identifier: 'Ubuntu',\n versionIdentifier: 'Ubuntu/([0-9\\.]*)'\n}, {\n name: 'Debian',\n group: 'Linux',\n identifier: 'Debian'\n}, {\n name: 'Gentoo',\n group: 'Linux',\n identifier: 'Gentoo'\n}, {\n name: 'Linux',\n group: 'Linux',\n identifier: 'Linux'\n}, {\n name: 'BlackBerry',\n group: 'BlackBerry',\n identifier: 'BlackBerry'\n}];\n\nvar Browser = {};\n\nvar hasLocalstorage = function hasLocalstorage() {\n try {\n localStorage.setItem('clappr', 'clappr');\n localStorage.removeItem('clappr');\n return true;\n } catch (e) {\n return false;\n }\n};\n\nvar hasFlash = function hasFlash() {\n try {\n var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');\n return !!fo;\n } catch (e) {\n return !!(navigator.mimeTypes && navigator.mimeTypes['application/x-shockwave-flash'] !== undefined && navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin);\n }\n};\n\nvar getBrowserInfo = function getBrowserInfo(ua) {\n var parts = ua.match(/\\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [],\n extra;\n\n if (/trident/i.test(parts[1])) {\n extra = /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return {\n name: 'IE',\n version: parseInt(extra[1] || '')\n };\n } else if (parts[1] === 'Chrome') {\n extra = ua.match(/\\bOPR\\/(\\d+)/);\n if (extra != null) return {\n name: 'Opera',\n version: parseInt(extra[1])\n };\n extra = ua.match(/\\bEdge\\/(\\d+)/);\n if (extra != null) return {\n name: 'Edge',\n version: parseInt(extra[1])\n };\n } else if (/android/i.test(ua) && (extra = ua.match(/version\\/(\\d+)/i))) {\n parts.splice(1, 1, 'Android WebView');\n parts.splice(2, 1, extra[1]);\n }\n\n parts = parts[2] ? [parts[1], parts[2]] : [navigator.appName, navigator.appVersion, '-?'];\n return {\n name: parts[0],\n version: parseInt(parts[1])\n };\n}; // Get browser data\n\nvar getBrowserData = function getBrowserData() {\n var browserObject = {};\n var userAgent = Browser.userAgent.toLowerCase(); // Check browser type\n\n var _iterator = _createForOfIteratorHelper(BROWSER_DATA),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var browser = _step.value;\n var browserRegExp = new RegExp(browser.identifier.toLowerCase());\n var browserRegExpResult = browserRegExp.exec(userAgent);\n\n if (browserRegExpResult != null && browserRegExpResult[1]) {\n browserObject.name = browser.name;\n browserObject.group = browser.group; // Check version\n\n if (browser.versionIdentifier) {\n var versionRegExp = new RegExp(browser.versionIdentifier.toLowerCase());\n var versionRegExpResult = versionRegExp.exec(userAgent);\n if (versionRegExpResult != null && versionRegExpResult[1]) setBrowserVersion(versionRegExpResult[1], browserObject);\n } else {\n setBrowserVersion(browserRegExpResult[1], browserObject);\n }\n\n break;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n return browserObject;\n}; // Set browser version\n\nvar setBrowserVersion = function setBrowserVersion(version, browserObject) {\n var splitVersion = version.split('.', 2);\n browserObject.fullVersion = version; // Major version\n\n if (splitVersion[0]) browserObject.majorVersion = parseInt(splitVersion[0]); // Minor version\n\n if (splitVersion[1]) browserObject.minorVersion = parseInt(splitVersion[1]);\n}; // Get OS data\n\n\nvar getOsData = function getOsData() {\n var osObject = {};\n var userAgent = Browser.userAgent.toLowerCase(); // Check browser type\n\n var _iterator2 = _createForOfIteratorHelper(OS_DATA),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var os = _step2.value;\n var osRegExp = new RegExp(os.identifier.toLowerCase());\n var osRegExpResult = osRegExp.exec(userAgent);\n\n if (osRegExpResult != null) {\n osObject.name = os.name;\n osObject.group = os.group; // Version defined\n\n if (os.version) {\n setOsVersion(os.version, os.versionSeparator ? os.versionSeparator : '.', osObject); // Version detected\n } else if (osRegExpResult[1]) {\n setOsVersion(osRegExpResult[1], os.versionSeparator ? os.versionSeparator : '.', osObject); // Version identifier\n } else if (os.versionIdentifier) {\n var versionRegExp = new RegExp(os.versionIdentifier.toLowerCase());\n var versionRegExpResult = versionRegExp.exec(userAgent);\n if (versionRegExpResult != null && versionRegExpResult[1]) setOsVersion(versionRegExpResult[1], os.versionSeparator ? os.versionSeparator : '.', osObject);\n }\n\n break;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n\n return osObject;\n}; // Set OS version\n\nvar setOsVersion = function setOsVersion(version, separator, osObject) {\n var finalSeparator = separator.substr(0, 1) == '[' ? new RegExp(separator, 'g') : separator;\n var splitVersion = version.split(finalSeparator, 2);\n if (separator != '.') version = version.replace(new RegExp(separator, 'g'), '.');\n osObject.fullVersion = version; // Major version\n\n if (splitVersion && splitVersion[0]) osObject.majorVersion = parseInt(splitVersion[0]); // Minor version\n\n if (splitVersion && splitVersion[1]) osObject.minorVersion = parseInt(splitVersion[1]);\n}; // Set viewport size\n\n\nvar getViewportSize = function getViewportSize() {\n var viewportObject = {};\n viewportObject.width = zepto(window).width();\n viewportObject.height = zepto(window).height();\n return viewportObject;\n}; // Set viewport orientation\n\nvar setViewportOrientation = function setViewportOrientation() {\n switch (window.orientation) {\n case -90:\n case 90:\n Browser.viewport.orientation = 'landscape';\n break;\n\n default:\n Browser.viewport.orientation = 'portrait';\n break;\n }\n};\n\nvar getDevice = function getDevice(ua) {\n var platformRegExp = /\\((iP(?:hone|ad|od))?(?:[^;]*; ){0,2}([^)]+(?=\\)))/;\n var matches = platformRegExp.exec(ua);\n var device = matches && (matches[1] || matches[2]) || '';\n return device;\n};\nvar browserInfo = getBrowserInfo(navigator.userAgent);\nBrowser.isEdge = /edge/i.test(navigator.userAgent);\nBrowser.isChrome = /chrome|CriOS/i.test(navigator.userAgent) && !Browser.isEdge;\nBrowser.isSafari = /safari/i.test(navigator.userAgent) && !Browser.isChrome && !Browser.isEdge;\nBrowser.isFirefox = /firefox/i.test(navigator.userAgent);\nBrowser.isLegacyIE = !!window.ActiveXObject;\nBrowser.isIE = Browser.isLegacyIE || /trident.*rv:1\\d/i.test(navigator.userAgent);\nBrowser.isIE11 = /trident.*rv:11/i.test(navigator.userAgent);\nBrowser.isChromecast = Browser.isChrome && /CrKey/i.test(navigator.userAgent);\nBrowser.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Mobile Safari|Opera Mini/i.test(navigator.userAgent);\nBrowser.isiOS = /iPad|iPhone|iPod/i.test(navigator.userAgent);\nBrowser.isAndroid = /Android/i.test(navigator.userAgent);\nBrowser.isWindowsPhone = /Windows Phone/i.test(navigator.userAgent);\nBrowser.isWin8App = /MSAppHost/i.test(navigator.userAgent);\nBrowser.isWiiU = /WiiU/i.test(navigator.userAgent);\nBrowser.isPS4 = /PlayStation 4/i.test(navigator.userAgent);\nBrowser.hasLocalstorage = hasLocalstorage();\nBrowser.hasFlash = hasFlash();\n/**\n* @deprecated\n* This parameter currently exists for retrocompatibility reasons.\n* Use Browser.data.name instead.\n*/\n\nBrowser.name = browserInfo.name;\n/**\n* @deprecated\n* This parameter currently exists for retrocompatibility reasons.\n* Use Browser.data.fullVersion instead.\n*/\n\nBrowser.version = browserInfo.version;\nBrowser.userAgent = navigator.userAgent;\nBrowser.data = getBrowserData();\nBrowser.os = getOsData();\nBrowser.viewport = getViewportSize();\nBrowser.device = getDevice(Browser.userAgent);\ntypeof window.orientation !== 'undefined' && setViewportOrientation();\n\nvar idsCounter = {};\nvar videoStack = [];\nvar requestAnimationFrame = (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {\n window.setTimeout(fn, 1000 / 60);\n}).bind(window);\nvar cancelAnimationFrame = (window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.clearTimeout).bind(window);\nfunction assign(obj, source) {\n if (source) {\n for (var prop in source) {\n var propDescriptor = Object.getOwnPropertyDescriptor(source, prop);\n propDescriptor ? Object.defineProperty(obj, prop, propDescriptor) : obj[prop] = source[prop];\n }\n }\n\n return obj;\n}\nfunction extend(parent, properties) {\n var Surrogate = /*#__PURE__*/function (_parent) {\n _inherits(Surrogate, _parent);\n\n var _super = _createSuper(Surrogate);\n\n function Surrogate() {\n var _this;\n\n _classCallCheck(this, Surrogate);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n if (properties.initialize) properties.initialize.apply(_assertThisInitialized(_this), args);\n return _this;\n }\n\n return Surrogate;\n }(parent);\n\n assign(Surrogate.prototype, properties);\n return Surrogate;\n}\nfunction formatTime(time, paddedHours) {\n if (!isFinite(time)) return '--:--';\n time = time * 1000;\n time = parseInt(time / 1000);\n var seconds = time % 60;\n time = parseInt(time / 60);\n var minutes = time % 60;\n time = parseInt(time / 60);\n var hours = time % 24;\n var days = parseInt(time / 24);\n var out = '';\n\n if (days && days > 0) {\n out += days + ':';\n if (hours < 1) out += '00:';\n }\n\n if (hours && hours > 0 || paddedHours) out += ('0' + hours).slice(-2) + ':';\n out += ('0' + minutes).slice(-2) + ':';\n out += ('0' + seconds).slice(-2);\n return out.trim();\n}\nvar Fullscreen = {\n fullscreenElement: function fullscreenElement() {\n return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement;\n },\n requestFullscreen: function requestFullscreen(el) {\n if (el.requestFullscreen) {\n return el.requestFullscreen();\n } else if (el.webkitRequestFullscreen) {\n if (typeof el.then === 'function') return el.webkitRequestFullscreen();\n el.webkitRequestFullscreen();\n } else if (el.mozRequestFullScreen) {\n return el.mozRequestFullScreen();\n } else if (el.msRequestFullscreen) {\n return el.msRequestFullscreen();\n } else if (el.querySelector && el.querySelector('video') && el.querySelector('video').webkitEnterFullScreen) {\n el.querySelector('video').webkitEnterFullScreen();\n } else if (el.webkitEnterFullScreen) {\n el.webkitEnterFullScreen();\n }\n },\n cancelFullscreen: function cancelFullscreen() {\n var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;\n if (el.exitFullscreen) el.exitFullscreen();else if (el.webkitCancelFullScreen) el.webkitCancelFullScreen();else if (el.webkitExitFullscreen) el.webkitExitFullscreen();else if (el.mozCancelFullScreen) el.mozCancelFullScreen();else if (el.msExitFullscreen) el.msExitFullscreen();\n },\n fullscreenEnabled: function fullscreenEnabled() {\n return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);\n }\n};\nvar Config = /*#__PURE__*/function () {\n function Config() {\n _classCallCheck(this, Config);\n }\n\n _createClass(Config, null, [{\n key: \"_defaultConfig\",\n value: function _defaultConfig() {\n return {\n volume: {\n value: 100,\n parse: parseInt\n }\n };\n }\n }, {\n key: \"_defaultValueFor\",\n value: function _defaultValueFor(key) {\n try {\n return this._defaultConfig()[key].parse(this._defaultConfig()[key].value);\n } catch (e) {\n return undefined;\n }\n }\n }, {\n key: \"_createKeyspace\",\n value: function _createKeyspace(key) {\n return \"clappr.\".concat(document.domain, \".\").concat(key);\n }\n }, {\n key: \"restore\",\n value: function restore(key) {\n if (Browser.hasLocalstorage && localStorage[this._createKeyspace(key)]) return this._defaultConfig()[key].parse(localStorage[this._createKeyspace(key)]);\n return this._defaultValueFor(key);\n }\n }, {\n key: \"persist\",\n value: function persist(key, value) {\n if (Browser.hasLocalstorage) {\n try {\n localStorage[this._createKeyspace(key)] = value;\n return true;\n } catch (e) {\n return false;\n }\n }\n }\n }]);\n\n return Config;\n}();\nvar QueryString = /*#__PURE__*/function () {\n function QueryString() {\n _classCallCheck(this, QueryString);\n }\n\n _createClass(QueryString, null, [{\n key: \"parse\",\n value: function parse(paramsString) {\n var match;\n\n var pl = /\\+/g,\n // Regex for replacing addition symbol with a space\n search = /([^&=]+)=?([^&]*)/g,\n decode = function decode(s) {\n return decodeURIComponent(s.replace(pl, ' '));\n },\n params = {};\n\n while (match = search.exec(paramsString)) {\n // eslint-disable-line no-cond-assign\n params[decode(match[1]).toLowerCase()] = decode(match[2]);\n }\n\n return params;\n }\n }, {\n key: \"params\",\n get: function get() {\n var query = window.location.search.substring(1);\n\n if (query !== this.query) {\n this._urlParams = this.parse(query);\n this.query = query;\n }\n\n return this._urlParams;\n }\n }, {\n key: \"hashParams\",\n get: function get() {\n var hash = window.location.hash.substring(1);\n\n if (hash !== this.hash) {\n this._hashParams = this.parse(hash);\n this.hash = hash;\n }\n\n return this._hashParams;\n }\n }]);\n\n return QueryString;\n}();\nfunction seekStringToSeconds() {\n var paramName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 't';\n var seconds = 0;\n var seekString = QueryString.params[paramName] || QueryString.hashParams[paramName] || '';\n var parts = seekString.match(/[0-9]+[hms]+/g) || [];\n\n if (parts.length > 0) {\n var factor = {\n 'h': 3600,\n 'm': 60,\n 's': 1\n };\n parts.forEach(function (el) {\n if (el) {\n var suffix = el[el.length - 1];\n var time = parseInt(el.slice(0, el.length - 1), 10);\n seconds += time * factor[suffix];\n }\n });\n } else if (seekString) {\n seconds = parseInt(seekString, 10);\n }\n\n return seconds;\n}\nfunction uniqueId(prefix) {\n idsCounter[prefix] || (idsCounter[prefix] = 0);\n var id = ++idsCounter[prefix];\n return prefix + id;\n}\nfunction isNumber(value) {\n return value - parseFloat(value) + 1 >= 0;\n}\nfunction currentScriptUrl() {\n var scripts = document.getElementsByTagName('script');\n return scripts.length ? scripts[scripts.length - 1].src : '';\n}\nfunction getBrowserLanguage() {\n return window.navigator && window.navigator.language;\n}\nfunction now() {\n if (window.performance && window.performance.now) return performance.now();\n return Date.now();\n} // remove the item from the array if it exists in the array\n\nfunction removeArrayItem(arr, item) {\n var i = arr.indexOf(item);\n if (i >= 0) arr.splice(i, 1);\n} // find an item regardless of its letter case\n\nfunction listContainsIgnoreCase(item, items) {\n if (item === undefined || items === undefined) return false;\n return items.find(function (itemEach) {\n return item.toLowerCase() === itemEach.toLowerCase();\n }) !== undefined;\n} // https://github.com/video-dev/can-autoplay\n\nfunction canAutoPlayMedia(cb, options) {\n options = Object.assign({\n inline: false,\n muted: false,\n timeout: 250,\n type: 'video',\n source: Media.mp4,\n element: null\n }, options);\n var element = options.element ? options.element : document.createElement(options.type);\n element.muted = options.muted;\n if (options.muted === true) element.setAttribute('muted', 'muted');\n if (options.inline === true) element.setAttribute('playsinline', 'playsinline');\n element.src = options.source;\n var promise = element.play();\n var timeoutId = setTimeout(function () {\n setResult(false, new Error(\"Timeout \".concat(options.timeout, \" ms has been reached\")));\n }, options.timeout);\n\n var setResult = function setResult(result) {\n var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n clearTimeout(timeoutId);\n cb(result, error);\n };\n\n if (promise !== undefined) {\n promise.then(function () {\n return setResult(true);\n })[\"catch\"](function (err) {\n return setResult(false, err);\n });\n } else {\n setResult(true);\n }\n} // Simple element factory with video recycle feature.\n\nvar DomRecycler = /*#__PURE__*/function () {\n function DomRecycler() {\n _classCallCheck(this, DomRecycler);\n }\n\n _createClass(DomRecycler, null, [{\n key: \"configure\",\n value: function configure(options) {\n this.options = zepto.extend(true, this.options, options);\n }\n }, {\n key: \"create\",\n value: function create(name) {\n if (this.options.recycleVideo && name === 'video' && videoStack.length > 0) return videoStack.shift();\n return document.createElement(name);\n }\n }, {\n key: \"garbage\",\n value: function garbage(el) {\n if (!this.options.recycleVideo || el.tagName.toUpperCase() !== 'VIDEO') return;\n zepto(el).children().remove();\n Object.values(el.attributes).forEach(function (attr) {\n return el.removeAttribute(attr.name);\n });\n videoStack.push(el);\n }\n }]);\n\n return DomRecycler;\n}();\nDomRecycler.options = {\n recycleVideo: false\n};\nvar DoubleEventHandler = /*#__PURE__*/function () {\n function DoubleEventHandler() {\n var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;\n\n _classCallCheck(this, DoubleEventHandler);\n\n this.delay = delay;\n this.lastTime = 0;\n }\n\n _createClass(DoubleEventHandler, [{\n key: \"handle\",\n value: function handle(event, cb) {\n var prevented = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n // Based on http://jsfiddle.net/brettwp/J4djY/\n var currentTime = new Date().getTime();\n var diffTime = currentTime - this.lastTime;\n\n if (diffTime < this.delay && diffTime > 0) {\n cb();\n prevented && event.preventDefault();\n }\n\n this.lastTime = currentTime;\n }\n }]);\n\n return DoubleEventHandler;\n}();\nvar Utils = {\n Config: Config,\n Fullscreen: Fullscreen,\n QueryString: QueryString,\n DomRecycler: DomRecycler,\n assign: assign,\n extend: extend,\n formatTime: formatTime,\n seekStringToSeconds: seekStringToSeconds,\n uniqueId: uniqueId,\n currentScriptUrl: currentScriptUrl,\n isNumber: isNumber,\n requestAnimationFrame: requestAnimationFrame,\n cancelAnimationFrame: cancelAnimationFrame,\n getBrowserLanguage: getBrowserLanguage,\n now: now,\n removeArrayItem: removeArrayItem,\n listContainsIgnoreCase: listContainsIgnoreCase,\n canAutoPlayMedia: canAutoPlayMedia,\n Media: Media,\n DoubleEventHandler: DoubleEventHandler\n};\n\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nvar BOLD = 'font-weight: bold; font-size: 13px;';\nvar INFO = 'color: #006600;' + BOLD;\nvar DEBUG = 'color: #0000ff;' + BOLD;\nvar WARN = 'color: #ff8000;' + BOLD;\nvar ERROR = 'color: #ff0000;' + BOLD;\nvar LEVEL_DEBUG = 0;\nvar LEVEL_INFO = 1;\nvar LEVEL_WARN = 2;\nvar LEVEL_ERROR = 3;\nvar LEVEL_DISABLED = LEVEL_ERROR;\nvar COLORS = [DEBUG, INFO, WARN, ERROR, ERROR];\nvar DESCRIPTIONS = ['debug', 'info', 'warn', 'error', 'disabled'];\n\nvar Log = /*#__PURE__*/function () {\n _createClass(Log, [{\n key: \"level\",\n get: function get() {\n return this._level;\n },\n set: function set(newLevel) {\n this._level = newLevel;\n }\n }]);\n\n function Log() {\n var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LEVEL_INFO;\n var offLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : LEVEL_DISABLED;\n\n _classCallCheck(this, Log);\n\n this.EXCLUDE_LIST = ['timeupdate', 'playback:timeupdate', 'playback:progress', 'container:hover', 'container:timeupdate', 'container:progress'];\n this.level = level;\n this.previousLevel = this.level;\n this.offLevel = offLevel;\n }\n\n _createClass(Log, [{\n key: \"debug\",\n value: function debug(klass) {\n this.log(klass, LEVEL_DEBUG, Array.prototype.slice.call(arguments, 1));\n }\n }, {\n key: \"info\",\n value: function info(klass) {\n this.log(klass, LEVEL_INFO, Array.prototype.slice.call(arguments, 1));\n }\n }, {\n key: \"warn\",\n value: function warn(klass) {\n this.log(klass, LEVEL_WARN, Array.prototype.slice.call(arguments, 1));\n }\n }, {\n key: \"error\",\n value: function error(klass) {\n this.log(klass, LEVEL_ERROR, Array.prototype.slice.call(arguments, 1));\n }\n }, {\n key: \"onOff\",\n value: function onOff() {\n if (this.level === this.offLevel) {\n this.level = this.previousLevel;\n } else {\n this.previousLevel = this.level;\n this.level = this.offLevel;\n } // handle instances where console.log is unavailable\n\n\n window.console && window.console.log && window.console.log('%c[Clappr.Log] set log level to ' + DESCRIPTIONS[this.level], WARN);\n }\n }, {\n key: \"log\",\n value: function log(klass, level, message) {\n if (this.EXCLUDE_LIST.indexOf(message[0]) >= 0) return;\n if (level < this.level) return;\n\n if (!message) {\n message = klass;\n klass = null;\n }\n\n var color = COLORS[level];\n var klassDescription = '';\n if (klass) klassDescription = '[' + klass + ']';\n window.console && window.console.log && window.console.log.apply(console, ['%c[' + DESCRIPTIONS[level] + ']' + klassDescription, color].concat(message));\n }\n }]);\n\n return Log;\n}();\nLog.LEVEL_DEBUG = LEVEL_DEBUG;\nLog.LEVEL_INFO = LEVEL_INFO;\nLog.LEVEL_WARN = LEVEL_WARN;\nLog.LEVEL_ERROR = LEVEL_ERROR;\n\nLog.getInstance = function () {\n if (this._instance === undefined) this._instance = new this();\n return this._instance;\n};\n\nLog.setLevel = function (level) {\n this.getInstance().level = level;\n};\n\nLog.debug = function () {\n this.getInstance().debug.apply(this.getInstance(), arguments);\n};\n\nLog.info = function () {\n this.getInstance().info.apply(this.getInstance(), arguments);\n};\n\nLog.warn = function () {\n this.getInstance().warn.apply(this.getInstance(), arguments);\n};\n\nLog.error = function () {\n this.getInstance().error.apply(this.getInstance(), arguments);\n};\n\nvar slice = Array.prototype.slice;\nvar eventSplitter = /\\s+/;\n\nvar eventsApi = function eventsApi(obj, action, name, rest) {\n if (!name) return true; // Handle event maps.\n\n if (_typeof(name) === 'object') {\n for (var key in name) {\n obj[action].apply(obj, [key, name[key]].concat(rest));\n }\n\n return false;\n } // Handle space separated event names.\n\n\n if (eventSplitter.test(name)) {\n var names = name.split(eventSplitter);\n\n for (var i = 0, l = names.length; i < l; i++) {\n obj[action].apply(obj, [names[i]].concat(rest));\n }\n\n return false;\n }\n\n return true;\n};\n\nvar triggerEvents = function triggerEvents(events, args, klass, name) {\n var ev,\n i = -1;\n var l = events.length,\n a1 = args[0],\n a2 = args[1],\n a3 = args[2];\n run();\n\n function run() {\n try {\n switch (args.length) {\n /* eslint-disable curly */\n case 0:\n while (++i < l) {\n (ev = events[i]).callback.call(ev.ctx);\n }\n\n return;\n\n case 1:\n while (++i < l) {\n (ev = events[i]).callback.call(ev.ctx, a1);\n }\n\n return;\n\n case 2:\n while (++i < l) {\n (ev = events[i]).callback.call(ev.ctx, a1, a2);\n }\n\n return;\n\n case 3:\n while (++i < l) {\n (ev = events[i]).callback.call(ev.ctx, a1, a2, a3);\n }\n\n return;\n\n default:\n while (++i < l) {\n (ev = events[i]).callback.apply(ev.ctx, args);\n }\n\n return;\n }\n } catch (exception) {\n Log.error.apply(Log, [klass, 'error on event', name, 'trigger', '-', exception]);\n run();\n }\n }\n};\n/**\n * @class Events\n * @constructor\n * @module base\n */\n\n\nvar Events = /*#__PURE__*/function () {\n function Events() {\n _classCallCheck(this, Events);\n }\n\n _createClass(Events, [{\n key: \"on\",\n\n /**\n * listen to an event indefinitely, if you want to stop you need to call `off`\n * @method on\n * @param {String} name\n * @param {Function} callback\n * @param {Object} context\n */\n value: function on(name, callback, context) {\n if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this;\n this._events || (this._events = {});\n var events = this._events[name] || (this._events[name] = []);\n events.push({\n callback: callback,\n context: context,\n ctx: context || this\n });\n return this;\n }\n /**\n * listen to an event only once\n * @method once\n * @param {String} name\n * @param {Function} callback\n * @param {Object} context\n */\n\n }, {\n key: \"once\",\n value: function once(name, callback, context) {\n var _this = this;\n\n var _once;\n\n if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this;\n\n var off = function off() {\n return _this.off(name, _once);\n };\n\n _once = function once() {\n off();\n callback.apply(this, arguments);\n };\n\n return this.on(name, _once, context);\n }\n /**\n * stop listening to an event\n * @method off\n * @param {String} name\n * @param {Function} callback\n * @param {Object} context\n */\n\n }, {\n key: \"off\",\n value: function off(name, callback, context) {\n var retain, ev, events, names, i, l, j, k;\n if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;\n\n if (!name && !callback && !context) {\n this._events = void 0;\n return this;\n }\n\n names = name ? [name] : Object.keys(this._events); // jshint maxdepth:5\n\n for (i = 0, l = names.length; i < l; i++) {\n name = names[i];\n events = this._events[name];\n\n if (events) {\n this._events[name] = retain = [];\n\n if (callback || context) {\n for (j = 0, k = events.length; j < k; j++) {\n ev = events[j];\n if (callback && callback !== ev.callback && callback !== ev.callback._callback || context && context !== ev.context) retain.push(ev);\n }\n }\n\n if (!retain.length) delete this._events[name];\n }\n }\n\n return this;\n }\n /**\n * triggers an event given its `name`\n * @method trigger\n * @param {String} name\n */\n\n }, {\n key: \"trigger\",\n value: function trigger(name) {\n var klass = this.name || this.constructor.name;\n Log.debug.apply(Log, [klass].concat(Array.prototype.slice.call(arguments)));\n if (!this._events) return this;\n var args = slice.call(arguments, 1);\n if (!eventsApi(this, 'trigger', name, args)) return this;\n var events = this._events[name];\n var allEvents = this._events.all;\n if (events) triggerEvents(events, args, klass, name);\n if (allEvents) triggerEvents(allEvents, arguments, klass, name);\n return this;\n }\n /**\n * stop listening an event for a given object\n * @method stopListening\n * @param {Object} obj\n * @param {String} name\n * @param {Function} callback\n */\n\n }, {\n key: \"stopListening\",\n value: function stopListening(obj, name, callback) {\n var listeningTo = this._listeningTo;\n if (!listeningTo) return this;\n var remove = !name && !callback;\n if (!callback && _typeof(name) === 'object') callback = this;\n if (obj) (listeningTo = {})[obj._listenId] = obj;\n\n for (var id in listeningTo) {\n obj = listeningTo[id];\n obj.off(name, callback, this);\n if (remove || Object.keys(obj._events).length === 0) delete this._listeningTo[id];\n }\n\n return this;\n }\n }], [{\n key: \"register\",\n value: function register(eventName) {\n Events.Custom || (Events.Custom = {});\n var property = typeof eventName === 'string' && eventName.toUpperCase().trim();\n\n if (property && !Events.Custom[property]) {\n Events.Custom[property] = property.toLowerCase().split('_').map(function (value, index) {\n return index === 0 ? value : value = value[0].toUpperCase() + value.slice(1);\n }).join('');\n } else Log.error('Events', 'Error when register event: ' + eventName);\n }\n }, {\n key: \"listAvailableCustomEvents\",\n value: function listAvailableCustomEvents() {\n Events.Custom || (Events.Custom = {});\n return Object.keys(Events.Custom).filter(function (property) {\n return typeof Events.Custom[property] === 'string';\n });\n }\n }]);\n\n return Events;\n}();\nvar listenMethods = {\n listenTo: 'on',\n listenToOnce: 'once'\n};\nObject.keys(listenMethods).forEach(function (method) {\n Events.prototype[method] = function (obj, name, callback) {\n var listeningTo = this._listeningTo || (this._listeningTo = {});\n var id = obj._listenId || (obj._listenId = uniqueId('l'));\n listeningTo[id] = obj;\n if (!callback && _typeof(name) === 'object') callback = this;\n obj[listenMethods[method]](name, callback, this);\n return this;\n };\n}); // PLAYER EVENTS\n\n/**\n * Fired when the player is ready on startup\n *\n * @event PLAYER_READY\n */\n\nEvents.PLAYER_READY = 'ready';\n/**\n * Fired when player resizes\n *\n * @event PLAYER_RESIZE\n * @param {Object} currentSize an object with the current size\n */\n\nEvents.PLAYER_RESIZE = 'resize';\n/**\n * Fired when player changes its fullscreen state\n *\n * @event PLAYER_FULLSCREEN\n * @param {Boolean} whether or not the player is on fullscreen mode\n */\n\nEvents.PLAYER_FULLSCREEN = 'fullscreen';\n/**\n * Fired when player starts to play\n *\n * @event PLAYER_PLAY\n */\n\nEvents.PLAYER_PLAY = 'play';\n/**\n * Fired when player pauses\n *\n * @event PLAYER_PAUSE\n */\n\nEvents.PLAYER_PAUSE = 'pause';\n/**\n * Fired when player stops\n *\n * @event PLAYER_STOP\n */\n\nEvents.PLAYER_STOP = 'stop';\n/**\n * Fired when player ends the video\n *\n * @event PLAYER_ENDED\n */\n\nEvents.PLAYER_ENDED = 'ended';\n/**\n * Fired when player seeks the video\n *\n * @event PLAYER_SEEK\n * @param {Number} time the current time in seconds\n */\n\nEvents.PLAYER_SEEK = 'seek';\n/**\n * Fired when player receives an error\n *\n * @event PLAYER_ERROR\n * @param {Object} error the error\n */\n\nEvents.PLAYER_ERROR = 'playererror';\n/**\n * Fired when there is an error\n *\n * @event ERROR\n * @param {Object} error\n * the error with the following format `{code, description, level, raw, origin, scope}`\n * @param {String} [options.code]\n * error's code: code to identify error in the following format: origin:code\n * @param {String} [options.description]\n * error's description: description of the error\n * @param {String} [options.level]\n * error's level: FATAL or WARN.\n * @param {String} [options.origin]\n * error's origin. Example: hls, html5, etc\n * @param {String} [options.scope]\n * error's scope. Example: playback, container, etc\n * @param {String} [options.raw]\n * raw error: the initial error received\n */\n\nEvents.ERROR = 'error';\n/**\n * Fired when the time is updated on player\n *\n * @event PLAYER_TIMEUPDATE\n * @param {Object} progress Data\n * progress object\n * @param {Number} [progress.current]\n * current time (in seconds)\n * @param {Number} [progress.total]\n * total time (in seconds)\n */\n\nEvents.PLAYER_TIMEUPDATE = 'timeupdate';\n/**\n * Fired when player updates its volume\n *\n * @event PLAYER_VOLUMEUPDATE\n * @param {Number} volume the current volume\n */\n\nEvents.PLAYER_VOLUMEUPDATE = 'volumeupdate';\n/**\n * Fired when subtitle is available\n *\n * @event PLAYER_SUBTITLE_AVAILABLE\n */\n\nEvents.PLAYER_SUBTITLE_AVAILABLE = 'subtitleavailable'; // Playback Events\n\n/**\n * Fired when the playback is downloading the media\n *\n * @event PLAYBACK_PROGRESS\n * @param progress {Object}\n * Data progress object\n * @param [progress.start] {Number}\n * start position of buffered content at current position\n * @param [progress.current] {Number}\n * end position of buffered content at current position\n * @param [progress.total] {Number}\n * total content to be downloaded\n * @param buffered {Array}\n * array of buffered segments ({start, end}). [Only for supported playbacks]\n */\n\nEvents.PLAYBACK_PROGRESS = 'playback:progress';\n/**\n * Fired when the time is updated on playback\n *\n * @event PLAYBACK_TIMEUPDATE\n * @param {Object} progress Data\n * progress object\n * @param {Number} [progress.current]\n * current time (in seconds)\n * @param {Number} [progress.total]\n * total time (in seconds)\n */\n\nEvents.PLAYBACK_TIMEUPDATE = 'playback:timeupdate';\n/**\n * Fired when playback is ready\n *\n * @event PLAYBACK_READY\n */\n\nEvents.PLAYBACK_READY = 'playback:ready';\n/**\n * Fired when the playback starts having to buffer because\n * playback can currently not be smooth.\n *\n * This corresponds to the playback `buffering` property being\n * `true`.\n *\n * @event PLAYBACK_BUFFERING\n */\n\nEvents.PLAYBACK_BUFFERING = 'playback:buffering';\n/**\n * Fired when the playback has enough in the buffer to be\n * able to play smoothly, after previously being unable to\n * do this.\n *\n * This corresponds to the playback `buffering` property being\n * `false`.\n *\n * @event PLAYBACK_BUFFERFULL\n */\n\nEvents.PLAYBACK_BUFFERFULL = 'playback:bufferfull';\n/**\n * Fired when playback changes any settings (volume, seek and etc)\n *\n * @event PLAYBACK_SETTINGSUPDATE\n */\n\nEvents.PLAYBACK_SETTINGSUPDATE = 'playback:settingsupdate';\n/**\n * Fired when playback loaded its metadata\n *\n * @event PLAYBACK_LOADEDMETADATA\n * @param {Object} metadata Data\n * settings object\n * @param {Number} [metadata.duration]\n * the playback duration\n * @param {Object} [metadata.data]\n * extra meta data\n */\n\nEvents.PLAYBACK_LOADEDMETADATA = 'playback:loadedmetadata';\n/**\n * Fired when playback updates its video quality\n *\n * @event PLAYBACK_HIGHDEFINITIONUPDATE\n * @param {Boolean} isHD\n * true when is on HD, false otherwise\n */\n\nEvents.PLAYBACK_HIGHDEFINITIONUPDATE = 'playback:highdefinitionupdate';\n/**\n * Fired when playback updates its bitrate\n *\n * @event PLAYBACK_BITRATE\n * @param {Object} bitrate Data\n * bitrate object\n * @param {Number} [bitrate.bandwidth]\n * bitrate bandwidth when it's available\n * @param {Number} [bitrate.width]\n * playback width (ex: 720, 640, 1080)\n * @param {Number} [bitrate.height]\n * playback height (ex: 240, 480, 720)\n * @param {Number} [bitrate.level]\n * playback level when it's available, it could be just a map for width (0 => 240, 1 => 480, 2 => 720)\n */\n\nEvents.PLAYBACK_BITRATE = 'playback:bitrate';\n/**\n * Fired when the playback has its levels\n *\n * @event PLAYBACK_LEVELS_AVAILABLE\n * @param {Array} levels\n * the ordered levels, each one with the following format `{id: 1, label: '500kbps'}` ps: id should be a number >= 0\n * @param {Number} initial\n * the initial level otherwise -1 (AUTO)\n */\n\nEvents.PLAYBACK_LEVELS_AVAILABLE = 'playback:levels:available';\n/**\n * Fired when the playback starts to switch level\n *\n * @event PLAYBACK_LEVEL_SWITCH_START\n *\n */\n\nEvents.PLAYBACK_LEVEL_SWITCH_START = 'playback:levels:switch:start';\n/**\n * Fired when the playback ends the level switch\n *\n * @event PLAYBACK_LEVEL_SWITCH_END\n *\n */\n\nEvents.PLAYBACK_LEVEL_SWITCH_END = 'playback:levels:switch:end';\n/**\n * Fired when playback internal state changes\n *\n * @event PLAYBACK_PLAYBACKSTATE\n * @param {Object} state Data\n * state object\n * @param {String} [state.type]\n * the playback type\n */\n\nEvents.PLAYBACK_PLAYBACKSTATE = 'playback:playbackstate';\n/**\n * Fired when DVR becomes enabled/disabled.\n *\n * @event PLAYBACK_DVR\n * @param {boolean} state true if dvr enabled\n */\n\nEvents.PLAYBACK_DVR = 'playback:dvr'; // TODO doc\n\nEvents.PLAYBACK_MEDIACONTROL_DISABLE = 'playback:mediacontrol:disable'; // TODO doc\n\nEvents.PLAYBACK_MEDIACONTROL_ENABLE = 'playback:mediacontrol:enable';\n/**\n * Fired when the media for a playback ends.\n *\n * @event PLAYBACK_ENDED\n * @param {String} name the name of the playback\n */\n\nEvents.PLAYBACK_ENDED = 'playback:ended';\n/**\n * Fired when user requests `play()`\n *\n * @event PLAYBACK_PLAY_INTENT\n */\n\nEvents.PLAYBACK_PLAY_INTENT = 'playback:play:intent';\n/**\n * Fired when the media for a playback starts playing.\n * This is not necessarily when the user requests `play()`\n * The media may have to buffer first.\n * I.e. `isPlaying()` might return `true` before this event is fired,\n * because `isPlaying()` represents the intended state.\n *\n * @event PLAYBACK_PLAY\n */\n\nEvents.PLAYBACK_PLAY = 'playback:play';\n/**\n * Fired when the media for a playback pauses.\n *\n * @event PLAYBACK_PAUSE\n */\n\nEvents.PLAYBACK_PAUSE = 'playback:pause';\n/**\n * Fired when the media for a playback is seeking.\n *\n * @event PLAYBACK_SEEK\n */\n\nEvents.PLAYBACK_SEEK = 'playback:seek';\n/**\n * Fired when the media for a playback is seeked.\n *\n * @event PLAYBACK_SEEKED\n */\n\nEvents.PLAYBACK_SEEKED = 'playback:seeked';\n/**\n * Fired when the media for a playback is stopped.\n *\n * @event PLAYBACK_STOP\n */\n\nEvents.PLAYBACK_STOP = 'playback:stop';\n/**\n * Fired if an error occurs in the playback.\n *\n * @event PLAYBACK_ERROR\n * @param {Object} error An object containing the error details\n * @param {String} name Playback name\n */\n\nEvents.PLAYBACK_ERROR = 'playback:error'; // TODO doc\n\nEvents.PLAYBACK_STATS_ADD = 'playback:stats:add'; // TODO doc\n\nEvents.PLAYBACK_FRAGMENT_LOADED = 'playback:fragment:loaded'; // TODO doc\n\nEvents.PLAYBACK_LEVEL_SWITCH = 'playback:level:switch';\n/**\n * Fired when subtitle is available on playback for display\n *\n * @event PLAYBACK_SUBTITLE_AVAILABLE\n */\n\nEvents.PLAYBACK_SUBTITLE_AVAILABLE = 'playback:subtitle:available';\n/**\n * Fired when playback subtitle track has changed\n *\n * @event CONTAINER_SUBTITLE_CHANGED\n * @param {Object} track Data\n * track object\n * @param {Number} [track.id]\n * selected track id\n */\n\nEvents.PLAYBACK_SUBTITLE_CHANGED = 'playback:subtitle:changed'; // Core Events\n\n/**\n * Fired when the containers are created\n *\n * @event CORE_CONTAINERS_CREATED\n */\n\nEvents.CORE_CONTAINERS_CREATED = 'core:containers:created';\n/**\n * Fired when the active container changed\n *\n * @event CORE_ACTIVE_CONTAINER_CHANGED\n */\n\nEvents.CORE_ACTIVE_CONTAINER_CHANGED = 'core:active:container:changed';\n/**\n * Fired when the options were changed for the core\n *\n * @event CORE_OPTIONS_CHANGE\n * @param {Object} new options provided to configure() method\n */\n\nEvents.CORE_OPTIONS_CHANGE = 'core:options:change';\n/**\n * Fired after creating containers, when the core is ready\n *\n * @event CORE_READY\n */\n\nEvents.CORE_READY = 'core:ready';\n/**\n * Fired when the fullscreen state change\n *\n * @event CORE_FULLSCREEN\n * @param {Boolean} whether or not the player is on fullscreen mode\n */\n\nEvents.CORE_FULLSCREEN = 'core:fullscreen';\n/**\n * Fired when core updates size\n *\n * @event CORE_RESIZE\n * @param {Object} currentSize an object with the current size\n */\n\nEvents.CORE_RESIZE = 'core:resize';\n/**\n * Fired when the screen orientation has changed.\n * This event is trigger only for mobile devices.\n *\n * @event CORE_SCREEN_ORIENTATION_CHANGED\n * @param {Object} screen An object with screen orientation\n * screen object\n * @param {Object} [screen.event]\n * window resize event object\n * @param {String} [screen.orientation]\n * screen orientation (ie: 'landscape' or 'portrait')\n */\n\nEvents.CORE_SCREEN_ORIENTATION_CHANGED = 'core:screen:orientation:changed';\n/**\n * Fired when occurs mouse move event on core element\n *\n * @event CORE_MOUSE_MOVE\n * @param {Object} event a DOM event\n */\n\nEvents.CORE_MOUSE_MOVE = 'core:mousemove';\n/**\n * Fired when occurs mouse leave event on core element\n *\n * @event CORE_MOUSE_LEAVE\n * @param {Object} event a DOM event\n */\n\nEvents.CORE_MOUSE_LEAVE = 'core:mouseleave'; // Container Events\n\n/**\n * Fired when the container internal state changes\n *\n * @event CONTAINER_PLAYBACKSTATE\n * @param {Object} state Data\n * state object\n * @param {String} [state.type]\n * the playback type\n */\n\nEvents.CONTAINER_PLAYBACKSTATE = 'container:playbackstate';\nEvents.CONTAINER_PLAYBACKDVRSTATECHANGED = 'container:dvr';\n/**\n * Fired when the container updates its bitrate\n *\n * @event CONTAINER_BITRATE\n * @param {Object} bitrate Data\n * bitrate object\n * @param {Number} [bitrate.bandwidth]\n * bitrate bandwidth when it's available\n * @param {Number} [bitrate.width]\n * playback width (ex: 720, 640, 1080)\n * @param {Number} [bitrate.height]\n * playback height (ex: 240, 480, 720)\n * @param {Number} [bitrate.level]\n * playback level when it's available, it could be just a map for width (0 => 240, 1 => 480, 2 => 720)\n */\n\nEvents.CONTAINER_BITRATE = 'container:bitrate';\nEvents.CONTAINER_STATS_REPORT = 'container:stats:report';\nEvents.CONTAINER_DESTROYED = 'container:destroyed';\n/**\n * Fired when the container is ready\n *\n * @event CONTAINER_READY\n */\n\nEvents.CONTAINER_READY = 'container:ready';\n/**\n * Fired when the container was resized.\n *\n * Some fullscreen modes won't trigger this resize since they don't affect the container, only the playback contents.\n *\n * @event CONTAINER_RESIZE\n */\n\nEvents.CONTAINER_RESIZE = 'container:resize';\nEvents.CONTAINER_ERROR = 'container:error';\n/**\n * Fired when the container loaded its metadata\n *\n * @event CONTAINER_LOADEDMETADATA\n * @param {Object} metadata Data\n * settings object\n * @param {Number} [metadata.duration]\n * the playback duration\n * @param {Object} [metadata.data]\n * extra meta data\n */\n\nEvents.CONTAINER_LOADEDMETADATA = 'container:loadedmetadata';\n/**\n * Fired when subtitle is available on container for display\n *\n * @event CONTAINER_SUBTITLE_AVAILABLE\n */\n\nEvents.CONTAINER_SUBTITLE_AVAILABLE = 'container:subtitle:available';\n/**\n * Fired when subtitle track has changed\n *\n * @event CONTAINER_SUBTITLE_CHANGED\n * @param {Object} track Data\n * track object\n * @param {Number} [track.id]\n * selected track id\n */\n\nEvents.CONTAINER_SUBTITLE_CHANGED = 'container:subtitle:changed';\n/**\n * Fired when the time is updated on container\n *\n * @event CONTAINER_TIMEUPDATE\n * @param {Object} progress Data\n * progress object\n * @param {Number} [progress.current]\n * current time (in seconds)\n * @param {Number} [progress.total]\n * total time (in seconds)\n */\n\nEvents.CONTAINER_TIMEUPDATE = 'container:timeupdate';\n/**\n * Fired when the container is downloading the media\n *\n * @event CONTAINER_PROGRESS\n * @param {Object} progress Data\n * progress object\n * @param {Number} [progress.start]\n * initial downloaded content\n * @param {Number} [progress.current]\n * current dowloaded content\n * @param {Number} [progress.total]\n * total content to be downloaded\n */\n\nEvents.CONTAINER_PROGRESS = 'container:progress';\nEvents.CONTAINER_PLAY = 'container:play';\nEvents.CONTAINER_STOP = 'container:stop';\nEvents.CONTAINER_PAUSE = 'container:pause';\nEvents.CONTAINER_ENDED = 'container:ended';\nEvents.CONTAINER_CLICK = 'container:click';\nEvents.CONTAINER_DBLCLICK = 'container:dblclick';\nEvents.CONTAINER_CONTEXTMENU = 'container:contextmenu';\nEvents.CONTAINER_MOUSE_ENTER = 'container:mouseenter';\nEvents.CONTAINER_MOUSE_LEAVE = 'container:mouseleave';\n/**\n * Fired when the container seeks the video\n *\n * @event CONTAINER_SEEK\n * @param {Number} time the current time in seconds\n */\n\nEvents.CONTAINER_SEEK = 'container:seek';\n/**\n * Fired when the container was finished the seek video\n *\n * @event CONTAINER_SEEKED\n * @param {Number} time the current time in seconds\n */\n\nEvents.CONTAINER_SEEKED = 'container:seeked';\nEvents.CONTAINER_VOLUME = 'container:volume';\nEvents.CONTAINER_FULLSCREEN = 'container:fullscreen';\n/**\n * Fired when container is buffering\n *\n * @event CONTAINER_STATE_BUFFERING\n */\n\nEvents.CONTAINER_STATE_BUFFERING = 'container:state:buffering';\n/**\n * Fired when the container filled the buffer\n *\n * @event CONTAINER_STATE_BUFFERFULL\n */\n\nEvents.CONTAINER_STATE_BUFFERFULL = 'container:state:bufferfull';\n/**\n * Fired when the container changes any settings (volume, seek and etc)\n *\n * @event CONTAINER_SETTINGSUPDATE\n */\n\nEvents.CONTAINER_SETTINGSUPDATE = 'container:settingsupdate';\n/**\n * Fired when container updates its video quality\n *\n * @event CONTAINER_HIGHDEFINITIONUPDATE\n * @param {Boolean} isHD\n * true when is on HD, false otherwise\n */\n\nEvents.CONTAINER_HIGHDEFINITIONUPDATE = 'container:highdefinitionupdate';\n/**\n * Fired when the media control shows\n *\n * @event CONTAINER_MEDIACONTROL_SHOW\n */\n\nEvents.CONTAINER_MEDIACONTROL_SHOW = 'container:mediacontrol:show';\n/**\n * Fired when the media control hides\n *\n * @event CONTAINER_MEDIACONTROL_HIDE\n */\n\nEvents.CONTAINER_MEDIACONTROL_HIDE = 'container:mediacontrol:hide';\nEvents.CONTAINER_MEDIACONTROL_DISABLE = 'container:mediacontrol:disable';\nEvents.CONTAINER_MEDIACONTROL_ENABLE = 'container:mediacontrol:enable';\nEvents.CONTAINER_STATS_ADD = 'container:stats:add';\n/**\n * Fired when the options were changed for the container\n *\n * @event CONTAINER_OPTIONS_CHANGE\n */\n\nEvents.CONTAINER_OPTIONS_CHANGE = 'container:options:change'; // MediaControl Events\n\nEvents.MEDIACONTROL_RENDERED = 'mediacontrol:rendered';\n/**\n * Fired when the player enters/exit on fullscreen\n *\n * @event MEDIACONTROL_FULLSCREEN\n */\n\nEvents.MEDIACONTROL_FULLSCREEN = 'mediacontrol:fullscreen';\n/**\n * Fired when the media control shows\n *\n * @event MEDIACONTROL_SHOW\n */\n\nEvents.MEDIACONTROL_SHOW = 'mediacontrol:show';\n/**\n * Fired when the media control hides\n *\n * @event MEDIACONTROL_HIDE\n */\n\nEvents.MEDIACONTROL_HIDE = 'mediacontrol:hide';\n/**\n * Fired when mouse enters on the seekbar\n *\n * @event MEDIACONTROL_MOUSEMOVE_SEEKBAR\n * @param {Object} event\n * the javascript event\n */\n\nEvents.MEDIACONTROL_MOUSEMOVE_SEEKBAR = 'mediacontrol:mousemove:seekbar';\n/**\n * Fired when mouse leaves the seekbar\n *\n * @event MEDIACONTROL_MOUSELEAVE_SEEKBAR\n * @param {Object} event\n * the javascript event\n */\n\nEvents.MEDIACONTROL_MOUSELEAVE_SEEKBAR = 'mediacontrol:mouseleave:seekbar';\n/**\n * Fired when the media is being played\n *\n * @event MEDIACONTROL_PLAYING\n */\n\nEvents.MEDIACONTROL_PLAYING = 'mediacontrol:playing';\n/**\n * Fired when the media is not being played\n *\n * @event MEDIACONTROL_NOTPLAYING\n */\n\nEvents.MEDIACONTROL_NOTPLAYING = 'mediacontrol:notplaying';\n/**\n * Fired when the container was changed\n *\n * @event MEDIACONTROL_CONTAINERCHANGED\n */\n\nEvents.MEDIACONTROL_CONTAINERCHANGED = 'mediacontrol:containerchanged';\n/**\n * Fired when the options were changed for the mediacontrol\n *\n * @event MEDIACONTROL_OPTIONS_CHANGE\n */\n\nEvents.MEDIACONTROL_OPTIONS_CHANGE = 'mediacontrol:options:change';\n\n/**\n * @class BaseObject\n * @constructor\n * @extends Events\n * @module base\n */\n\nvar BaseObject = /*#__PURE__*/function (_Events) {\n _inherits(BaseObject, _Events);\n\n var _super = _createSuper(BaseObject);\n\n _createClass(BaseObject, [{\n key: \"options\",\n\n /**\n * returns the object options\n * @property options\n * @type Object\n */\n get: function get() {\n return this._options;\n }\n /**\n * @method constructor\n * @param {Object} options\n */\n\n }]);\n\n function BaseObject() {\n var _this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, BaseObject);\n\n _this = _super.call(this, options);\n _this._options = options;\n _this.uniqueId = uniqueId('o');\n return _this;\n }\n /**\n * a unique id prefixed with `'o'`, `o1, o232`\n *\n * @property uniqueId\n * @type String\n */\n\n\n return BaseObject;\n}(Events);\n\n/* eslint-disable no-var */\n// Simple JavaScript Templating\n// Paul Miller (http://paulmillr.com)\n// http://underscorejs.org\n// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n// By default, Underscore uses ERB-style template delimiters, change the\n// following template settings to use alternative delimiters.\nvar settings = {\n evaluate: /<%([\\s\\S]+?)%>/g,\n interpolate: /<%=([\\s\\S]+?)%>/g,\n escape: /<%-([\\s\\S]+?)%>/g\n}; // When customizing `templateSettings`, if you don't want to define an\n// interpolation, evaluation or escaping regex, we need one that is\n// guaranteed not to match.\n\nvar noMatch = /(.)^/; // Certain characters need to be escaped so that they can be put into a\n// string literal.\n\nvar escapes = {\n '\\'': '\\'',\n '\\\\': '\\\\',\n '\\r': 'r',\n '\\n': 'n',\n '\\t': 't',\n \"\\u2028\": 'u2028',\n \"\\u2029\": 'u2029'\n};\nvar escaper = /\\\\|'|\\r|\\n|\\t|\\u2028|\\u2029/g; // List of HTML entities for escaping.\n\nvar htmlEntities = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n '\\'': '''\n};\nvar entityRe = new RegExp('[&<>\"\\']', 'g');\n\nvar escapeExpr = function escapeExpr(string) {\n if (string === null) return '';\n return ('' + string).replace(entityRe, function (match) {\n return htmlEntities[match];\n });\n};\n\nvar counter = 0; // JavaScript micro-templating, similar to John Resig's implementation.\n// Underscore templating handles arbitrary delimiters, preserves whitespace,\n// and correctly escapes quotes within interpolated code.\n\nvar tmpl = function tmpl(text, data) {\n var render; // Combine delimiters into one regular expression via alternation.\n\n var matcher = new RegExp([(settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source].join('|') + '|$', 'g'); // Compile the template source, escaping string literals appropriately.\n\n var index = 0;\n var source = '__p+=\\'';\n text.replace(matcher, function (match, escape, interpolate, evaluate, offset) {\n source += text.slice(index, offset).replace(escaper, function (match) {\n return '\\\\' + escapes[match];\n });\n if (escape) source += '\\'+\\n((__t=(' + escape + '))==null?\\'\\':escapeExpr(__t))+\\n\\'';\n if (interpolate) source += '\\'+\\n((__t=(' + interpolate + '))==null?\\'\\':__t)+\\n\\'';\n if (evaluate) source += '\\';\\n' + evaluate + '\\n__p+=\\'';\n index = offset + match.length;\n return match;\n });\n source += '\\';\\n'; // If a variable is not specified, place data values in local scope.\n\n if (!settings.variable) source = 'with(obj||{}){\\n' + source + '}\\n';\n source = 'var __t,__p=\\'\\',__j=Array.prototype.join,' + 'print=function(){__p+=__j.call(arguments,\\'\\');};\\n' + source + 'return __p;\\n//# sourceURL=/microtemplates/source[' + counter++ + ']';\n\n try {\n /*jshint -W054 */\n // TODO: find a way to avoid eval\n render = new Function(settings.variable || 'obj', 'escapeExpr', source);\n } catch (e) {\n e.source = source;\n throw e;\n }\n\n if (data) return render(data, escapeExpr);\n\n var template = function template(data) {\n return render.call(this, data, escapeExpr);\n }; // Provide the compiled function source as a convenience for precompilation.\n\n\n template.source = 'function(' + (settings.variable || 'obj') + '){\\n' + source + '}';\n return template;\n};\n\ntmpl.settings = settings;\n\n// Copyright 2014 Globo.com Player authors. All rights reserved.\nvar Styler = {\n getStyleFor: function getStyleFor(style) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n baseUrl: ''\n };\n return zepto('').html(tmpl(style.toString())(options));\n }\n};\n\nvar delegateEventSplitter = /^(\\S+)\\s*(.*)$/;\n/**\n * A base class to create ui object.\n * @class UIObject\n * @constructor\n * @extends BaseObject\n * @module base\n */\n\nvar UIObject = /*#__PURE__*/function (_BaseObject) {\n _inherits(UIObject, _BaseObject);\n\n var _super = _createSuper(UIObject);\n\n _createClass(UIObject, [{\n key: \"tagName\",\n\n /**\n * a unique id prefixed with `'c'`, `c1, c232`\n *\n * @property cid\n * @type String\n */\n\n /**\n * the dom element itself\n *\n * @property el\n * @type HTMLElement\n */\n\n /**\n * the dom element wrapped by `$`\n *\n * @property $el\n * @type HTMLElement\n */\n\n /**\n * gets the tag name for the ui component\n * @method tagName\n * @default div\n * @return {String} tag's name\n */\n get: function get() {\n return 'div';\n }\n /**\n * a literal object mapping element's events to methods\n * @property events\n * @type Object\n * @example\n *\n *```javascript\n *\n * class MyButton extends UIObject {\n * constructor(options) {\n * super(options)\n * this.myId = 0\n * }\n * get events() { return { 'click': 'myClick' } }\n * myClick(){ this.myId = 42 }\n * }\n *\n * // when you click on MyButton the method `myClick` will be called\n *```\n */\n\n }, {\n key: \"events\",\n get: function get() {\n return {};\n }\n /**\n * a literal object mapping attributes and values to the element\n * element's attribute name and the value the attribute value\n * @property attributes\n * @type Object\n * @example\n *\n *```javascript\n *\n * class MyButton extends UIObject {\n * constructor(options) { super(options) }\n * get attributes() { return { class: 'my-button'} }\n * }\n *\n * // MyButton.el.className will be 'my-button'\n * ```\n */\n\n }, {\n key: \"attributes\",\n get: function get() {\n return {};\n }\n /**\n * it builds an ui component by:\n * * creating an id for the component `cid`\n * * making sure the element is created `$el`\n * * delegating all `events` to the element\n * @method constructor\n * @param {Object} options the options object\n */\n\n }]);\n\n function UIObject(options) {\n var _this;\n\n _classCallCheck(this, UIObject);\n\n _this = _super.call(this, options);\n _this.cid = uniqueId('c');\n\n _this._ensureElement();\n\n _this.delegateEvents();\n\n return _this;\n }\n /**\n * selects within the component.\n * @method $\n * @param {String} selector a selector to find within the component.\n * @return {HTMLElement} an element, if it exists.\n * @example\n * ```javascript\n * fullScreenBarUIComponent.$('.button-full') //will return only `.button-full` within the component\n * ```\n */\n\n\n _createClass(UIObject, [{\n key: \"$\",\n value: function $(selector) {\n return this.$el.find(selector);\n }\n /**\n * render the component, usually attach it to a real existent `element`\n * @method render\n * @return {UIObject} itself\n */\n\n }, {\n key: \"render\",\n value: function render() {\n return this;\n }\n /**\n * removes the ui component from DOM\n * @method destroy\n * @return {UIObject} itself\n */\n\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.$el.remove();\n this.stopListening();\n this.undelegateEvents();\n return this;\n }\n /**\n * set element to `el` and `$el`\n * @method setElement\n * @param {HTMLElement} element\n * @param {Boolean} delegate whether is delegate or not\n * @return {UIObject} itself\n */\n\n }, {\n key: \"setElement\",\n value: function setElement(element, delegate) {\n if (this.$el) this.undelegateEvents();\n this.$el = zepto.zepto.isZ(element) ? element : zepto(element);\n this.el = this.$el[0];\n if (delegate !== false) this.delegateEvents();\n return this;\n }\n /**\n * delegates all the original `events` on `element` to its callbacks\n * @method delegateEvents\n * @param {Object} events\n * @return {UIObject} itself\n */\n\n }, {\n key: \"delegateEvents\",\n value: function delegateEvents(events) {\n if (!events) events = this.events;\n this.undelegateEvents();\n\n for (var key in events) {\n var method = events[key];\n if (method && method.constructor !== Function) method = this[events[key]];\n if (!method) continue;\n var match = key.match(delegateEventSplitter);\n var eventName = match[1],\n selector = match[2];\n eventName += '.delegateEvents' + this.cid;\n if (selector === '') this.$el.on(eventName, method.bind(this));else this.$el.on(eventName, selector, method.bind(this));\n }\n\n return this;\n }\n /**\n * undelegats all the `events`\n * @method undelegateEvents\n * @return {UIObject} itself\n */\n\n }, {\n key: \"undelegateEvents\",\n value: function undelegateEvents() {\n this.$el.off('.delegateEvents' + this.cid);\n return this;\n }\n /**\n * ensures the creation of this ui component\n * @method _ensureElement\n * @private\n */\n\n }, {\n key: \"_ensureElement\",\n value: function _ensureElement() {\n if (!this.el) {\n var attrs = zepto.extend(true, {}, this.attributes);\n if (this.id) attrs.id = this.id;\n if (this.className) attrs['class'] = this.className;\n var $el = zepto(DomRecycler.create(this.tagName)).attr(attrs);\n this.setElement($el, false);\n } else {\n this.setElement(this.el, false);\n }\n }\n }]);\n\n return UIObject;\n}(BaseObject);\n\n/**\n * The PlayerError is responsible to receive and propagate errors.\n * @class PlayerError\n * @constructor\n * @extends BaseObject\n * @module components\n */\n\nvar PlayerError = /*#__PURE__*/function (_BaseObject) {\n _inherits(PlayerError, _BaseObject);\n\n var _super = _createSuper(PlayerError);\n\n _createClass(PlayerError, [{\n key: \"name\",\n get: function get() {\n return 'error';\n }\n /**\n * @property Levels\n * @type {Object} object with error levels\n */\n\n }], [{\n key: \"Levels\",\n get: function get() {\n return {\n FATAL: 'FATAL',\n WARN: 'WARN',\n INFO: 'INFO'\n };\n }\n }]);\n\n function PlayerError() {\n var _this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var core = arguments.length > 1 ? arguments[1] : undefined;\n\n _classCallCheck(this, PlayerError);\n\n _this = _super.call(this, options);\n _this.core = core;\n return _this;\n }\n /**\n * creates and trigger an error.\n * @method createError\n * @param {Object} err should be an object with code, description, level, origin, scope and raw error.\n */\n\n\n _createClass(PlayerError, [{\n key: \"createError\",\n value: function createError(err) {\n if (!this.core) {\n Log.warn(this.name, 'Core is not set. Error: ', err);\n return;\n }\n\n this.core.trigger(Events.ERROR, err);\n }\n }]);\n\n return PlayerError;\n}(BaseObject);\n\nvar ErrorMixin = {\n /**\n * creates an error.\n * @method createError\n * @param {Object} error should be an object with code, description, level and raw error.\n * @return {Object} Object with formatted error data including origin and scope\n */\n createError: function createError(error) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n useCodePrefix: true\n };\n var scope = this.constructor && this.constructor.type || '';\n var origin = this.name || scope;\n var i18n = this.i18n || this.core && this.core.i18n || this.container && this.container.i18n;\n var prefixedCode = \"\".concat(origin, \":\").concat(error && error.code || 'unknown');\n var defaultError = {\n description: '',\n level: PlayerError.Levels.FATAL,\n origin: origin,\n scope: scope,\n raw: {}\n };\n var errorData = Object.assign({}, defaultError, error, {\n code: options.useCodePrefix ? prefixedCode : error.code\n });\n\n if (i18n && errorData.level == PlayerError.Levels.FATAL && !errorData.UI) {\n var defaultUI = {\n title: i18n.t('default_error_title'),\n message: i18n.t('default_error_message')\n };\n errorData.UI = defaultUI;\n }\n\n this.playerError ? this.playerError.createError(errorData) : Log.warn(origin, 'PlayerError is not defined. Error: ', errorData);\n return errorData;\n }\n};\n\nvar UICorePlugin = /*#__PURE__*/function (_UIObject) {\n _inherits(UICorePlugin, _UIObject);\n\n var _super = _createSuper(UICorePlugin);\n\n _createClass(UICorePlugin, [{\n key: \"playerError\",\n get: function get() {\n return this.core.playerError;\n }\n }]);\n\n function UICorePlugin(core) {\n var _this;\n\n _classCallCheck(this, UICorePlugin);\n\n _this = _super.call(this, core.options);\n _this.core = core;\n _this.enabled = true;\n\n _this.bindEvents();\n\n _this.render();\n\n return _this;\n }\n\n _createClass(UICorePlugin, [{\n key: \"bindEvents\",\n value: function bindEvents() {}\n }, {\n key: \"getExternalInterface\",\n value: function getExternalInterface() {\n return {};\n }\n }, {\n key: \"enable\",\n value: function enable() {\n if (!this.enabled) {\n this.bindEvents();\n this.$el.show();\n this.enabled = true;\n }\n }\n }, {\n key: \"disable\",\n value: function disable() {\n this.stopListening();\n this.$el.hide();\n this.enabled = false;\n }\n }, {\n key: \"render\",\n value: function render() {\n return this;\n }\n }]);\n\n return UICorePlugin;\n}(UIObject);\nObject.assign(UICorePlugin.prototype, ErrorMixin);\n\nUICorePlugin.extend = function (properties) {\n return extend(UICorePlugin, properties);\n};\n\nUICorePlugin.type = 'core';\n\nvar css_248z = \".container[data-container] {\\n position: absolute;\\n background-color: black;\\n height: 100%;\\n width: 100%;\\n max-width: 100%; }\\n .container[data-container] .chromeless {\\n cursor: default; }\\n\\n[data-player]:not(.nocursor) .container[data-container]:not(.chromeless).pointer-enabled {\\n cursor: pointer; }\\n\";\n\n/**\n * An abstraction to represent a container for a given playback\n * TODO: describe its responsabilities\n * @class Container\n * @constructor\n * @extends UIObject\n * @module base\n */\n\nvar Container = /*#__PURE__*/function (_UIObject) {\n _inherits(Container, _UIObject);\n\n var _super = _createSuper(Container);\n\n _createClass(Container, [{\n key: \"name\",\n\n /**\n * container's name\n * @method name\n * @default Container\n * @return {String} container's name\n */\n get: function get() {\n return 'Container';\n }\n }, {\n key: \"attributes\",\n get: function get() {\n return {\n \"class\": 'container',\n 'data-container': ''\n };\n }\n }, {\n key: \"events\",\n get: function get() {\n return {\n 'click': 'clicked',\n 'dblclick': 'dblClicked',\n 'touchend': 'dblTap',\n 'contextmenu': 'onContextMenu',\n 'mouseenter': 'mouseEnter',\n 'mouseleave': 'mouseLeave'\n };\n }\n /**\n * Determine if the playback has ended.\n * @property ended\n * @type Boolean\n */\n\n }, {\n key: \"ended\",\n get: function get() {\n return this.playback.ended;\n }\n /**\n * Determine if the playback is having to buffer in order for\n * playback to be smooth.\n * (i.e if a live stream is playing smoothly, this will be false)\n * @property buffering\n * @type Boolean\n */\n\n }, {\n key: \"buffering\",\n get: function get() {\n return this.playback.buffering;\n }\n /**\n * The internationalization plugin.\n * @property i18n\n * @type {Strings}\n */\n\n }, {\n key: \"i18n\",\n get: function get() {\n return this._i18n;\n }\n /**\n * checks if has closed caption tracks.\n * @property hasClosedCaptionsTracks\n * @type {Boolean}\n */\n\n }, {\n key: \"hasClosedCaptionsTracks\",\n get: function get() {\n return this.playback.hasClosedCaptionsTracks;\n }\n /**\n * gets the available closed caption tracks.\n * @property closedCaptionsTracks\n * @type {Array} an array of objects with at least 'id' and 'name' properties\n */\n\n }, {\n key: \"closedCaptionsTracks\",\n get: function get() {\n return this.playback.closedCaptionsTracks;\n }\n /**\n * gets the selected closed caption track index. (-1 is disabled)\n * @property closedCaptionsTrackId\n * @type {Number}\n */\n\n }, {\n key: \"closedCaptionsTrackId\",\n get: function get() {\n return this.playback.closedCaptionsTrackId;\n }\n /**\n * sets the selected closed caption track index. (-1 is disabled)\n * @property closedCaptionsTrackId\n * @type {Number}\n */\n ,\n set: function set(trackId) {\n this.playback.closedCaptionsTrackId = trackId;\n }\n /**\n * it builds a container\n * @method constructor\n * @param {Object} options the options object\n * @param {Strings} i18n the internationalization component\n */\n\n }]);\n\n function Container(options, i18n, playerError) {\n var _this;\n\n _classCallCheck(this, Container);\n\n _this = _super.call(this, options);\n _this._i18n = i18n;\n _this.currentTime = 0;\n _this.volume = 100;\n _this.playback = options.playback;\n _this.playerError = playerError;\n _this.settings = zepto.extend(true, {}, _this.playback.settings);\n _this.isReady = false;\n _this.mediaControlDisabled = false;\n _this.plugins = [_this.playback];\n _this.dblTapHandler = new DoubleEventHandler(500);\n _this.clickTimer = null;\n _this.clickDelay = 200; // FIXME: could be a player option\n\n _this.bindEvents();\n\n return _this;\n }\n /**\n * binds playback events to the methods of the container.\n * it listens to playback's events and triggers them as container events.\n *\n * | Playback |\n * |----------|\n * | progress |\n * | timeupdate |\n * | ready |\n * | buffering |\n * | bufferfull |\n * | settingsupdate |\n * | loadedmetadata |\n * | highdefinitionupdate |\n * | bitrate |\n * | playbackstate |\n * | dvr |\n * | mediacontrol_disable |\n * | mediacontrol_enable |\n * | ended |\n * | play |\n * | pause |\n * | error |\n *\n * ps: the events usually translate from PLABACK_x to CONTAINER_x, you can check all the events at `Event` class.\n *\n * @method bindEvents\n */\n\n\n _createClass(Container, [{\n key: \"bindEvents\",\n value: function bindEvents() {\n this.listenTo(this.playback, Events.PLAYBACK_PROGRESS, this.onProgress);\n this.listenTo(this.playback, Events.PLAYBACK_TIMEUPDATE, this.timeUpdated);\n this.listenTo(this.playback, Events.PLAYBACK_READY, this.ready);\n this.listenTo(this.playback, Events.PLAYBACK_BUFFERING, this.onBuffering);\n this.listenTo(this.playback, Events.PLAYBACK_BUFFERFULL, this.bufferfull);\n this.listenTo(this.playback, Events.PLAYBACK_SETTINGSUPDATE, this.settingsUpdate);\n this.listenTo(this.playback, Events.PLAYBACK_LOADEDMETADATA, this.loadedMetadata);\n this.listenTo(this.playback, Events.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);\n this.listenTo(this.playback, Events.PLAYBACK_BITRATE, this.updateBitrate);\n this.listenTo(this.playback, Events.PLAYBACK_PLAYBACKSTATE, this.playbackStateChanged);\n this.listenTo(this.playback, Events.PLAYBACK_DVR, this.playbackDvrStateChanged);\n this.listenTo(this.playback, Events.PLAYBACK_MEDIACONTROL_DISABLE, this.disableMediaControl);\n this.listenTo(this.playback, Events.PLAYBACK_MEDIACONTROL_ENABLE, this.enableMediaControl);\n this.listenTo(this.playback, Events.PLAYBACK_SEEK, this.onSeek);\n this.listenTo(this.playback, Events.PLAYBACK_SEEKED, this.onSeeked);\n this.listenTo(this.playback, Events.PLAYBACK_ENDED, this.onEnded);\n this.listenTo(this.playback, Events.PLAYBACK_PLAY, this.playing);\n this.listenTo(this.playback, Events.PLAYBACK_PAUSE, this.paused);\n this.listenTo(this.playback, Events.PLAYBACK_STOP, this.stopped);\n this.listenTo(this.playback, Events.PLAYBACK_ERROR, this.error);\n this.listenTo(this.playback, Events.PLAYBACK_SUBTITLE_AVAILABLE, this.subtitleAvailable);\n this.listenTo(this.playback, Events.PLAYBACK_SUBTITLE_CHANGED, this.subtitleChanged);\n }\n }, {\n key: \"subtitleAvailable\",\n value: function subtitleAvailable() {\n this.trigger(Events.CONTAINER_SUBTITLE_AVAILABLE);\n }\n }, {\n key: \"subtitleChanged\",\n value: function subtitleChanged(track) {\n this.trigger(Events.CONTAINER_SUBTITLE_CHANGED, track);\n }\n }, {\n key: \"playbackStateChanged\",\n value: function playbackStateChanged(state) {\n this.trigger(Events.CONTAINER_PLAYBACKSTATE, state);\n }\n }, {\n key: \"playbackDvrStateChanged\",\n value: function playbackDvrStateChanged(dvrInUse) {\n this.settings = this.playback.settings;\n this.dvrInUse = dvrInUse;\n this.trigger(Events.CONTAINER_PLAYBACKDVRSTATECHANGED, dvrInUse);\n }\n }, {\n key: \"updateBitrate\",\n value: function updateBitrate(newBitrate) {\n this.trigger(Events.CONTAINER_BITRATE, newBitrate);\n }\n }, {\n key: \"statsReport\",\n value: function statsReport(metrics) {\n this.trigger(Events.CONTAINER_STATS_REPORT, metrics);\n }\n }, {\n key: \"getPlaybackType\",\n value: function getPlaybackType() {\n return this.playback.getPlaybackType();\n }\n /**\n * returns `true` if DVR is enable otherwise `false`.\n * @method isDvrEnabled\n * @return {Boolean}\n */\n\n }, {\n key: \"isDvrEnabled\",\n value: function isDvrEnabled() {\n return !!this.playback.dvrEnabled;\n }\n /**\n * returns `true` if DVR is in use otherwise `false`.\n * @method isDvrInUse\n * @return {Boolean}\n */\n\n }, {\n key: \"isDvrInUse\",\n value: function isDvrInUse() {\n return !!this.dvrInUse;\n }\n /**\n * destroys the container\n * @method destroy\n */\n\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.disableResizeObserver();\n this.trigger(Events.CONTAINER_DESTROYED, this, this.name);\n this.stopListening();\n this.plugins.forEach(function (plugin) {\n return plugin.destroy();\n });\n this.$el.remove();\n }\n }, {\n key: \"setStyle\",\n value: function setStyle(style) {\n this.$el.css(style);\n }\n }, {\n key: \"animate\",\n value: function animate(style, duration) {\n return this.$el.animate(style, duration).promise();\n }\n }, {\n key: \"ready\",\n value: function ready() {\n this.isReady = true;\n this.trigger(Events.CONTAINER_READY, this.name);\n }\n }, {\n key: \"isPlaying\",\n value: function isPlaying() {\n return this.playback.isPlaying();\n }\n }, {\n key: \"getStartTimeOffset\",\n value: function getStartTimeOffset() {\n return this.playback.getStartTimeOffset();\n }\n }, {\n key: \"getCurrentTime\",\n value: function getCurrentTime() {\n return this.currentTime;\n }\n }, {\n key: \"getDuration\",\n value: function getDuration() {\n return this.playback.getDuration();\n }\n }, {\n key: \"error\",\n value: function error(_error) {\n if (!this.isReady) this.ready();\n this.trigger(Events.CONTAINER_ERROR, _error, this.name);\n }\n }, {\n key: \"loadedMetadata\",\n value: function loadedMetadata(metadata) {\n this.trigger(Events.CONTAINER_LOADEDMETADATA, metadata);\n }\n }, {\n key: \"timeUpdated\",\n value: function timeUpdated(timeProgress) {\n this.currentTime = timeProgress.current;\n this.trigger(Events.CONTAINER_TIMEUPDATE, timeProgress, this.name);\n }\n }, {\n key: \"onProgress\",\n value: function onProgress() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n this.trigger.apply(this, [Events.CONTAINER_PROGRESS].concat(args, [this.name]));\n }\n }, {\n key: \"playing\",\n value: function playing() {\n this.trigger(Events.CONTAINER_PLAY, this.name);\n }\n }, {\n key: \"paused\",\n value: function paused() {\n this.trigger(Events.CONTAINER_PAUSE, this.name);\n }\n /**\n * plays the playback\n * @method play\n */\n\n }, {\n key: \"play\",\n value: function play() {\n this.playback.play();\n }\n /**\n * stops the playback\n * @method stop\n */\n\n }, {\n key: \"stop\",\n value: function stop() {\n this.playback.stop();\n this.currentTime = 0;\n }\n /**\n * pauses the playback\n * @method pause\n */\n\n }, {\n key: \"pause\",\n value: function pause() {\n this.playback.pause();\n }\n }, {\n key: \"onEnded\",\n value: function onEnded() {\n this.trigger(Events.CONTAINER_ENDED, this, this.name);\n this.currentTime = 0;\n }\n }, {\n key: \"stopped\",\n value: function stopped() {\n this.trigger(Events.CONTAINER_STOP);\n }\n }, {\n key: \"clicked\",\n value: function clicked() {\n var _this2 = this;\n\n if (!this.options.chromeless || this.options.allowUserInteraction) {\n // The event is delayed because it can be canceled by a double-click event\n // An example of use is to prevent playback from pausing when switching to full screen\n this.clickTimer = setTimeout(function () {\n _this2.clickTimer && _this2.trigger(Events.CONTAINER_CLICK, _this2, _this2.name);\n }, this.clickDelay);\n }\n }\n }, {\n key: \"cancelClicked\",\n value: function cancelClicked() {\n clearTimeout(this.clickTimer);\n this.clickTimer = null;\n }\n }, {\n key: \"dblClicked\",\n value: function dblClicked() {\n if (!this.options.chromeless || this.options.allowUserInteraction) {\n this.cancelClicked();\n this.trigger(Events.CONTAINER_DBLCLICK, this, this.name);\n }\n }\n }, {\n key: \"dblTap\",\n value: function dblTap(evt) {\n var _this3 = this;\n\n if (!this.options.chromeless || this.options.allowUserInteraction) {\n this.dblTapHandler.handle(evt, function () {\n _this3.cancelClicked();\n\n _this3.trigger(Events.CONTAINER_DBLCLICK, _this3, _this3.name);\n });\n }\n }\n }, {\n key: \"onContextMenu\",\n value: function onContextMenu(event) {\n if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(Events.CONTAINER_CONTEXTMENU, event, this.name);\n }\n }, {\n key: \"seek\",\n value: function seek(time) {\n this.playback.seek(time);\n }\n }, {\n key: \"onSeek\",\n value: function onSeek(time) {\n this.trigger(Events.CONTAINER_SEEK, time, this.name);\n }\n }, {\n key: \"onSeeked\",\n value: function onSeeked() {\n this.trigger(Events.CONTAINER_SEEKED, this.name);\n }\n }, {\n key: \"seekPercentage\",\n value: function seekPercentage(percentage) {\n var duration = this.getDuration();\n\n if (percentage >= 0 && percentage <= 100) {\n var time = duration * (percentage / 100);\n this.seek(time);\n }\n }\n }, {\n key: \"setVolume\",\n value: function setVolume(value) {\n this.volume = parseFloat(value);\n this.trigger(Events.CONTAINER_VOLUME, this.volume, this.name);\n this.playback.volume(this.volume);\n }\n }, {\n key: \"fullscreen\",\n value: function fullscreen() {\n this.trigger(Events.CONTAINER_FULLSCREEN, this.name);\n }\n }, {\n key: \"onBuffering\",\n value: function onBuffering() {\n this.trigger(Events.CONTAINER_STATE_BUFFERING, this.name);\n }\n }, {\n key: \"bufferfull\",\n value: function bufferfull() {\n this.trigger(Events.CONTAINER_STATE_BUFFERFULL, this.name);\n }\n /**\n * adds plugin to the container\n * @method addPlugin\n * @param {Object} plugin\n */\n\n }, {\n key: \"addPlugin\",\n value: function addPlugin(plugin) {\n this.plugins.push(plugin);\n }\n /**\n * checks if a plugin, given its name, exist\n * @method hasPlugin\n * @param {String} name\n * @return {Boolean}\n */\n\n }, {\n key: \"hasPlugin\",\n value: function hasPlugin(name) {\n return !!this.getPlugin(name);\n }\n /**\n * get the plugin given its name\n * @method getPlugin\n * @param {String} name\n */\n\n }, {\n key: \"getPlugin\",\n value: function getPlugin(name) {\n return this.plugins.filter(function (plugin) {\n return plugin.name === name;\n })[0];\n }\n }, {\n key: \"mouseEnter\",\n value: function mouseEnter() {\n if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(Events.CONTAINER_MOUSE_ENTER);\n }\n }, {\n key: \"mouseLeave\",\n value: function mouseLeave() {\n if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(Events.CONTAINER_MOUSE_LEAVE);\n }\n }, {\n key: \"settingsUpdate\",\n value: function settingsUpdate() {\n this.settings = this.playback.settings;\n this.trigger(Events.CONTAINER_SETTINGSUPDATE);\n }\n }, {\n key: \"highDefinitionUpdate\",\n value: function highDefinitionUpdate(isHD) {\n this.trigger(Events.CONTAINER_HIGHDEFINITIONUPDATE, isHD);\n }\n }, {\n key: \"isHighDefinitionInUse\",\n value: function isHighDefinitionInUse() {\n return this.playback.isHighDefinitionInUse();\n }\n }, {\n key: \"disableMediaControl\",\n value: function disableMediaControl() {\n if (!this.mediaControlDisabled) {\n this.mediaControlDisabled = true;\n this.trigger(Events.CONTAINER_MEDIACONTROL_DISABLE);\n }\n }\n }, {\n key: \"enableMediaControl\",\n value: function enableMediaControl() {\n if (this.mediaControlDisabled) {\n this.mediaControlDisabled = false;\n this.trigger(Events.CONTAINER_MEDIACONTROL_ENABLE);\n }\n }\n }, {\n key: \"updateStyle\",\n value: function updateStyle() {\n if (!this.options.chromeless || this.options.allowUserInteraction) this.$el.removeClass('chromeless');else this.$el.addClass('chromeless');\n }\n }, {\n key: \"enableResizeObserver\",\n value: function enableResizeObserver() {\n var _this4 = this;\n\n this.disableResizeObserver();\n this.resizeObserverInterval = setInterval(function () {\n return _this4.checkResize();\n }, 500);\n }\n }, {\n key: \"disableResizeObserver\",\n value: function disableResizeObserver() {\n this.resizeObserverInterval && clearInterval(this.resizeObserverInterval);\n }\n }, {\n key: \"checkResize\",\n value: function checkResize() {\n var newSize = {\n width: this.el.clientWidth,\n height: this.el.clientHeight\n };\n\n var _ref = this.currentSize || {},\n width = _ref.width,\n height = _ref.height;\n\n var isResize = height !== newSize.height || width !== newSize.width;\n\n if (isResize) {\n this.currentSize = newSize;\n this.trigger(Events.CONTAINER_RESIZE, newSize);\n }\n }\n /**\n * enables to configure the container after its creation\n * @method configure\n * @param {Object} options all the options to change in form of a javascript object\n */\n\n }, {\n key: \"configure\",\n value: function configure(options) {\n this._options = zepto.extend(true, this._options, options);\n this.updateStyle();\n this.playback.configure(this.options);\n this.trigger(Events.CONTAINER_OPTIONS_CHANGE);\n }\n }, {\n key: \"render\",\n value: function render() {\n var style = Styler.getStyleFor(css_248z.toString(), {\n baseUrl: this.options.baseUrl\n });\n this.$el.append(style[0]);\n this.$el.append(this.playback.render().el);\n this.updateStyle();\n this.checkResize();\n this.enableResizeObserver();\n return this;\n }\n }]);\n\n return Container;\n}(UIObject);\nObject.assign(Container.prototype, ErrorMixin);\n\n/**\n * An abstraction to represent a generic playback, it's like an interface to be implemented by subclasses.\n * @class Playback\n * @constructor\n * @extends UIObject\n * @module base\n */\n\nvar Playback = /*#__PURE__*/function (_UIObject) {\n _inherits(Playback, _UIObject);\n\n var _super = _createSuper(Playback);\n\n _createClass(Playback, [{\n key: \"isAudioOnly\",\n\n /**\n * Determine if the playback does not contain video/has video but video should be ignored.\n * @property isAudioOnly\n * @type Boolean\n */\n get: function get() {\n return false;\n }\n }, {\n key: \"isAdaptive\",\n get: function get() {\n return false;\n }\n /**\n * Determine if the playback has ended.\n * @property ended\n * @type Boolean\n */\n\n }, {\n key: \"ended\",\n get: function get() {\n return false;\n }\n /**\n * The internationalization plugin.\n * @property i18n\n * @type {Strings}\n */\n\n }, {\n key: \"i18n\",\n get: function get() {\n return this._i18n;\n }\n /**\n * Determine if the playback is having to buffer in order for\n * playback to be smooth.\n * (i.e if a live stream is playing smoothly, this will be false)\n * @property buffering\n * @type Boolean\n */\n\n }, {\n key: \"buffering\",\n get: function get() {\n return false;\n }\n /**\n * @method constructor\n * @param {Object} options the options object\n * @param {Strings} i18n the internationalization component\n */\n\n }]);\n\n function Playback(options, i18n, playerError) {\n var _this;\n\n _classCallCheck(this, Playback);\n\n _this = _super.call(this, options);\n _this.settings = {};\n _this._i18n = i18n;\n _this.playerError = playerError;\n _this._consented = false;\n return _this;\n }\n /**\n * Gives user consent to playback (mobile devices).\n * @method consent\n * @param {Function} callback function called when playback is consented\n */\n\n\n _createClass(Playback, [{\n key: \"consent\",\n value: function consent(cb) {\n typeof cb === 'function' && cb();\n }\n /**\n * plays the playback.\n * @method play\n */\n\n }, {\n key: \"play\",\n value: function play() {}\n /**\n * pauses the playback.\n * @method pause\n */\n\n }, {\n key: \"pause\",\n value: function pause() {}\n /**\n * stops the playback.\n * @method stop\n */\n\n }, {\n key: \"stop\",\n value: function stop() {}\n /**\n * seeks the playback to a given `time` in seconds\n * @method seek\n * @param {Number} time should be a number between 0 and the video duration\n */\n\n }, {\n key: \"seek\",\n value: function seek(time) {} // eslint-disable-line no-unused-vars\n\n /**\n * seeks the playback to a given `percentage` in percentage\n * @method seekPercentage\n * @param {Number} time should be a number between 0 and 100\n */\n\n }, {\n key: \"seekPercentage\",\n value: function seekPercentage(percentage) {} // eslint-disable-line no-unused-vars\n\n /**\n * The time that \"0\" now represents relative to when playback started.\n * For a stream with a sliding window this will increase as content is\n * removed from the beginning.\n * @method getStartTimeOffset\n * @return {Number} time (in seconds) that time \"0\" represents.\n */\n\n }, {\n key: \"getStartTimeOffset\",\n value: function getStartTimeOffset() {\n return 0;\n }\n /**\n * gets the duration in seconds\n * @method getDuration\n * @return {Number} duration (in seconds) of the current source\n */\n\n }, {\n key: \"getDuration\",\n value: function getDuration() {\n return 0;\n }\n /**\n * checks if the playback is playing.\n * @method isPlaying\n * @return {Boolean} `true` if the current playback is playing, otherwise `false`\n */\n\n }, {\n key: \"isPlaying\",\n value: function isPlaying() {\n return false;\n }\n /**\n * checks if the playback is ready.\n * @property isReady\n * @type {Boolean} `true` if the current playback is ready, otherwise `false`\n */\n\n }, {\n key: \"getPlaybackType\",\n // eslint-disable-line no-unused-vars\n\n /**\n * gets the playback type (`'vod', 'live', 'aod'`)\n * @method getPlaybackType\n * @return {String} you should write the playback type otherwise it'll assume `'no_op'`\n * @example\n * ```javascript\n * html5VideoPlayback.getPlaybackType() //vod\n * html5AudioPlayback.getPlaybackType() //aod\n * html5VideoPlayback.getPlaybackType() //live\n * flashHlsPlayback.getPlaybackType() //live\n * ```\n */\n value: function getPlaybackType() {\n return Playback.NO_OP;\n }\n /**\n * checks if the playback is in HD.\n * @method isHighDefinitionInUse\n * @return {Boolean} `true` if the playback is playing in HD, otherwise `false`\n */\n\n }, {\n key: \"isHighDefinitionInUse\",\n value: function isHighDefinitionInUse() {\n return false;\n }\n /**\n * mutes the playback\n * @method mute\n */\n\n }, {\n key: \"mute\",\n value: function mute() {}\n /**\n * restores the playback volume\n * @method unmute\n */\n\n }, {\n key: \"unmute\",\n value: function unmute() {}\n /**\n * sets the volume for the playback\n * @method volume\n * @param {Number} value a number between 0 (`muted`) to 100 (`max`)\n */\n\n }, {\n key: \"volume\",\n value: function volume(value) {} // eslint-disable-line no-unused-vars\n\n /**\n * enables to configure the playback after its creation\n * @method configure\n * @param {Object} options all the options to change in form of a javascript object\n */\n\n }, {\n key: \"configure\",\n value: function configure(options) {\n this._options = zepto.extend(true, this._options, options);\n }\n /**\n * attempt to autoplays the playback.\n * @method attemptAutoPlay\n */\n\n }, {\n key: \"attemptAutoPlay\",\n value: function attemptAutoPlay() {\n var _this2 = this;\n\n this.canAutoPlay(function (result, error) {\n // eslint-disable-line no-unused-vars\n result && _this2.play();\n });\n }\n /**\n * checks if the playback can autoplay.\n * @method canAutoPlay\n * @param {Function} callback function where first param is Boolean and second param is playback Error or null\n */\n\n }, {\n key: \"canAutoPlay\",\n value: function canAutoPlay(cb) {\n cb(true, null); // Assume playback can autoplay by default\n }\n }, {\n key: \"isReady\",\n get: function get() {\n return false;\n }\n /**\n * checks if the playback has closed caption tracks.\n * @property hasClosedCaptionsTracks\n * @type {Boolean}\n */\n\n }, {\n key: \"hasClosedCaptionsTracks\",\n get: function get() {\n return this.closedCaptionsTracks.length > 0;\n }\n /**\n * gets the playback available closed caption tracks.\n * @property closedCaptionsTracks\n * @type {Array} an array of objects with at least 'id' and 'name' properties\n */\n\n }, {\n key: \"closedCaptionsTracks\",\n get: function get() {\n return [];\n }\n /**\n * gets the selected closed caption track index. (-1 is disabled)\n * @property closedCaptionsTrackId\n * @type {Number}\n */\n\n }, {\n key: \"closedCaptionsTrackId\",\n get: function get() {\n return -1;\n }\n /**\n * sets the selected closed caption track index. (-1 is disabled)\n * @property closedCaptionsTrackId\n * @type {Number}\n */\n ,\n set: function set(trackId) {}\n }]);\n\n return Playback;\n}(UIObject);\nObject.assign(Playback.prototype, ErrorMixin);\n\nPlayback.extend = function (properties) {\n return extend(Playback, properties);\n};\n/**\n * checks if the playback can play a given `source`\n * If a mimeType is provided then this will be used instead of inferring the mimetype\n * from the source extension.\n * @method canPlay\n * @static\n * @param {String} source the given source ex: `http://example.com/play.mp4`\n * @param {String} [mimeType] the given mime type, ex: `'application/vnd.apple.mpegurl'`\n * @return {Boolean} `true` if the playback is playable, otherwise `false`\n */\n\n\nPlayback.canPlay = function (source, mimeType) {\n // eslint-disable-line no-unused-vars\n return false;\n};\n/**\n * a playback type for video on demand\n *\n * @property VOD\n * @static\n * @type String\n */\n\n\nPlayback.VOD = 'vod';\n/**\n * a playback type for audio on demand\n *\n * @property AOD\n * @static\n * @type String\n */\n\nPlayback.AOD = 'aod';\n/**\n * a playback type for live video\n *\n * @property LIVE\n * @static\n * @type String\n */\n\nPlayback.LIVE = 'live';\n/**\n * a default playback type\n *\n * @property NO_OP\n * @static\n * @type String\n */\n\nPlayback.NO_OP = 'no_op';\n/**\n * the plugin type\n *\n * @property type\n * @static\n * @type String\n */\n\nPlayback.type = 'playback';\n\nvar ContainerFactory = /*#__PURE__*/function (_BaseObject) {\n _inherits(ContainerFactory, _BaseObject);\n\n var _super = _createSuper(ContainerFactory);\n\n _createClass(ContainerFactory, [{\n key: \"options\",\n get: function get() {\n return this._options;\n },\n set: function set(options) {\n this._options = options;\n }\n }]);\n\n function ContainerFactory(options, loader, i18n, playerError) {\n var _this;\n\n _classCallCheck(this, ContainerFactory);\n\n _this = _super.call(this, options);\n _this._i18n = i18n;\n _this.loader = loader;\n _this.playerError = playerError;\n return _this;\n }\n\n _createClass(ContainerFactory, [{\n key: \"createContainers\",\n value: function createContainers() {\n var _this2 = this;\n\n return zepto.Deferred(function (promise) {\n promise.resolve(_this2.options.sources.map(function (source) {\n return _this2.createContainer(source);\n }));\n });\n }\n }, {\n key: \"findPlaybackPlugin\",\n value: function findPlaybackPlugin(source, mimeType) {\n return this.loader.playbackPlugins.filter(function (p) {\n return p.canPlay(source, mimeType);\n })[0];\n }\n }, {\n key: \"createContainer\",\n value: function createContainer(source) {\n var resolvedSource = null;\n var mimeType = this.options.mimeType;\n\n if (_typeof(source) === 'object') {\n resolvedSource = source.source.toString();\n if (source.mimeType) mimeType = source.mimeType;\n } else {\n resolvedSource = source.toString();\n }\n\n if (resolvedSource.match(/^\\/\\//)) resolvedSource = window.location.protocol + resolvedSource;\n\n var options = _objectSpread2(_objectSpread2({}, this.options), {}, {\n src: resolvedSource,\n mimeType: mimeType\n });\n\n var playbackPlugin = this.findPlaybackPlugin(resolvedSource, mimeType); // Fallback to empty playback object until we sort out unsupported sources error without NoOp playback\n\n var playback = playbackPlugin ? new playbackPlugin(options, this._i18n, this.playerError) : new Playback();\n options = _objectSpread2(_objectSpread2({}, options), {}, {\n playback: playback\n });\n var container = new Container(options, this._i18n, this.playerError);\n var defer = zepto.Deferred();\n defer.promise(container);\n this.addContainerPlugins(container);\n this.listenToOnce(container, Events.CONTAINER_READY, function () {\n return defer.resolve(container);\n });\n return container;\n }\n }, {\n key: \"addContainerPlugins\",\n value: function addContainerPlugins(container) {\n this.loader.containerPlugins.forEach(function (Plugin) {\n container.addPlugin(new Plugin(container));\n });\n }\n }]);\n\n return ContainerFactory;\n}(BaseObject);\n\nvar css_248z$1 = \"[data-player] {\\n -webkit-touch-callout: none;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n -o-user-select: none;\\n user-select: none;\\n -webkit-font-smoothing: antialiased;\\n -moz-osx-font-smoothing: grayscale;\\n transform: translate3d(0, 0, 0);\\n position: relative;\\n margin: 0;\\n padding: 0;\\n border: 0;\\n font-style: normal;\\n font-weight: normal;\\n text-align: center;\\n overflow: hidden;\\n font-size: 100%;\\n font-family: \\\"Roboto\\\", \\\"Open Sans\\\", Arial, sans-serif;\\n text-shadow: 0 0 0;\\n box-sizing: border-box; }\\n [data-player]:focus {\\n outline: 0; }\\n [data-player] * {\\n box-sizing: inherit; }\\n [data-player] > * {\\n float: none;\\n max-width: none; }\\n [data-player] > div {\\n display: block; }\\n [data-player].fullscreen {\\n width: 100% !important;\\n height: 100% !important;\\n top: 0;\\n left: 0; }\\n [data-player].nocursor {\\n cursor: none; }\\n\\n.clappr-style {\\n display: none !important; }\\n\";\n\nvar css_248z$2 = \"[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\\n[data-player] table {\\n border-collapse: collapse;\\n border-spacing: 0; }\\n\\n[data-player] caption, [data-player] th, [data-player] td {\\n text-align: left;\\n font-weight: normal;\\n vertical-align: middle; }\\n\\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\\n[data-player] a img {\\n border: none; }\\n\";\n\n/**\n * The Core is responsible to manage Containers and the player state.\n * @class Core\n * @constructor\n * @extends UIObject\n * @module components\n */\n\nvar Core = /*#__PURE__*/function (_UIObject) {\n _inherits(Core, _UIObject);\n\n var _super = _createSuper(Core);\n\n _createClass(Core, [{\n key: \"events\",\n get: function get() {\n return {\n 'webkitfullscreenchange': 'handleFullscreenChange',\n 'mousemove': 'onMouseMove',\n 'mouseleave': 'onMouseLeave'\n };\n }\n }, {\n key: \"attributes\",\n get: function get() {\n return {\n 'data-player': '',\n tabindex: 9999\n };\n }\n /**\n * checks if the core is ready.\n * @property isReady\n * @type {Boolean} `true` if the core is ready, otherwise `false`\n */\n\n }, {\n key: \"isReady\",\n get: function get() {\n return !!this.ready;\n }\n /**\n * The internationalization plugin.\n * @property i18n\n * @type {Strings}\n */\n\n }, {\n key: \"i18n\",\n get: function get() {\n return this.getPlugin('strings') || {\n t: function t(key) {\n return key;\n }\n };\n }\n /**\n * @deprecated\n * This property currently exists for backward compatibility reasons.\n * If you need to access the media control instance, use the method getPlugin('media_control').\n * This approach is still not recommended.\n */\n\n }, {\n key: \"mediaControl\",\n get: function get() {\n return this._mediaControl || (this._mediaControl = this.getPlugin('media_control')) || this.dummyMediaControl;\n }\n }, {\n key: \"dummyMediaControl\",\n get: function get() {\n if (this._dummyMediaControl) return this._dummyMediaControl;\n this._dummyMediaControl = new UICorePlugin(this);\n return this._dummyMediaControl;\n }\n /**\n * gets the active container reference.\n * @property activeContainer\n * @type {Object}\n */\n\n }, {\n key: \"activeContainer\",\n get: function get() {\n return this._activeContainer;\n }\n /**\n * sets the active container reference and trigger a event with the new reference.\n * @property activeContainer\n * @type {Object}\n */\n ,\n set: function set(container) {\n this._activeContainer = container;\n this.trigger(Events.CORE_ACTIVE_CONTAINER_CHANGED, this._activeContainer);\n }\n /**\n * gets the active playback reference.\n * @property activePlayback\n * @type {Object}\n */\n\n }, {\n key: \"activePlayback\",\n get: function get() {\n return this.activeContainer && this.activeContainer.playback;\n }\n }]);\n\n function Core(options) {\n var _this;\n\n _classCallCheck(this, Core);\n\n _this = _super.call(this, options);\n _this.playerError = new PlayerError(options, _assertThisInitialized(_this));\n\n _this.configureDomRecycler();\n\n _this.firstResize = true;\n _this.plugins = [];\n _this.containers = []; //FIXME fullscreen api sucks\n\n _this._boundFullscreenHandler = function () {\n return _this.handleFullscreenChange();\n };\n\n zepto(document).bind('fullscreenchange', _this._boundFullscreenHandler);\n zepto(document).bind('MSFullscreenChange', _this._boundFullscreenHandler);\n zepto(document).bind('mozfullscreenchange', _this._boundFullscreenHandler);\n Browser.isMobile && zepto(window).bind('resize', function (o) {\n _this.handleWindowResize(o);\n });\n return _this;\n }\n\n _createClass(Core, [{\n key: \"configureDomRecycler\",\n value: function configureDomRecycler() {\n var recycleVideo = this.options && this.options.playback && this.options.playback.recycleVideo;\n DomRecycler.configure({\n recycleVideo: recycleVideo\n });\n }\n }, {\n key: \"createContainers\",\n value: function createContainers(options) {\n this.defer = zepto.Deferred();\n this.defer.promise(this);\n this.containerFactory = new ContainerFactory(options, options.loader, this.i18n, this.playerError);\n this.prepareContainers();\n }\n }, {\n key: \"prepareContainers\",\n value: function prepareContainers() {\n var _this2 = this;\n\n this.containerFactory.createContainers().then(function (containers) {\n return _this2.setupContainers(containers);\n }).then(function (containers) {\n return _this2.resolveOnContainersReady(containers);\n });\n }\n }, {\n key: \"updateSize\",\n value: function updateSize() {\n this.isFullscreen() ? this.setFullscreen() : this.setPlayerSize();\n }\n }, {\n key: \"setFullscreen\",\n value: function setFullscreen() {\n if (!Browser.isiOS) {\n this.$el.addClass('fullscreen');\n this.$el.removeAttr('style');\n this.previousSize = {\n width: this.options.width,\n height: this.options.height\n };\n this.currentSize = {\n width: zepto(window).width(),\n height: zepto(window).height()\n };\n }\n }\n }, {\n key: \"setPlayerSize\",\n value: function setPlayerSize() {\n this.$el.removeClass('fullscreen');\n this.currentSize = this.previousSize;\n this.previousSize = {\n width: zepto(window).width(),\n height: zepto(window).height()\n };\n this.resize(this.currentSize);\n }\n }, {\n key: \"resize\",\n value: function resize(options) {\n if (!isNumber(options.height) && !isNumber(options.width)) {\n this.el.style.height = \"\".concat(options.height);\n this.el.style.width = \"\".concat(options.width);\n } else {\n this.el.style.height = \"\".concat(options.height, \"px\");\n this.el.style.width = \"\".concat(options.width, \"px\");\n }\n\n this.previousSize = {\n width: this.options.width,\n height: this.options.height\n };\n this.options.width = options.width;\n this.options.height = options.height;\n this.currentSize = options;\n this.triggerResize(this.currentSize);\n }\n }, {\n key: \"enableResizeObserver\",\n value: function enableResizeObserver() {\n var _this3 = this;\n\n this.disableResizeObserver();\n\n var checkSizeCallback = function checkSizeCallback() {\n _this3.triggerResize({\n width: _this3.el.clientWidth,\n height: _this3.el.clientHeight\n });\n };\n\n this.resizeObserverInterval = setInterval(checkSizeCallback, 500);\n }\n }, {\n key: \"triggerResize\",\n value: function triggerResize(newSize) {\n var thereWasChange = this.firstResize || this.oldHeight !== newSize.height || this.oldWidth !== newSize.width;\n\n if (thereWasChange) {\n this.oldHeight = newSize.height;\n this.oldWidth = newSize.width;\n this.computedSize = newSize;\n this.firstResize = false;\n this.trigger(Events.CORE_RESIZE, newSize);\n }\n }\n }, {\n key: \"disableResizeObserver\",\n value: function disableResizeObserver() {\n this.resizeObserverInterval && clearInterval(this.resizeObserverInterval);\n this.resizeObserverInterval = null;\n }\n }, {\n key: \"resolveOnContainersReady\",\n value: function resolveOnContainersReady(containers) {\n var _this4 = this;\n\n zepto.when.apply(zepto, containers).done(function () {\n _this4.defer.resolve(_this4);\n\n _this4.ready = true;\n\n _this4.trigger(Events.CORE_READY);\n });\n }\n }, {\n key: \"addPlugin\",\n value: function addPlugin(plugin) {\n this.plugins.push(plugin);\n }\n }, {\n key: \"hasPlugin\",\n value: function hasPlugin(name) {\n return !!this.getPlugin(name);\n }\n }, {\n key: \"getPlugin\",\n value: function getPlugin(name) {\n return this.plugins.filter(function (plugin) {\n return plugin.name === name;\n })[0];\n }\n }, {\n key: \"load\",\n value: function load(sources, mimeType) {\n this.options.mimeType = mimeType;\n sources = sources && sources.constructor === Array ? sources : [sources];\n this.options.sources = sources;\n this.containers.forEach(function (container) {\n return container.destroy();\n });\n this.containerFactory.options = zepto.extend(true, this.options, {\n sources: sources\n });\n this.prepareContainers();\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.disableResizeObserver();\n this.containers.forEach(function (container) {\n return container.destroy();\n });\n this.plugins.forEach(function (plugin) {\n return plugin.destroy();\n });\n this.$el.remove();\n zepto(document).unbind('fullscreenchange', this._boundFullscreenHandler);\n zepto(document).unbind('MSFullscreenChange', this._boundFullscreenHandler);\n zepto(document).unbind('mozfullscreenchange', this._boundFullscreenHandler);\n this.stopListening();\n }\n }, {\n key: \"handleFullscreenChange\",\n value: function handleFullscreenChange() {\n this.trigger(Events.CORE_FULLSCREEN, this.isFullscreen());\n this.updateSize();\n }\n }, {\n key: \"handleWindowResize\",\n value: function handleWindowResize(event) {\n var orientation = window.innerWidth > window.innerHeight ? 'landscape' : 'portrait';\n if (this._screenOrientation === orientation) return;\n this._screenOrientation = orientation;\n this.triggerResize({\n width: this.el.clientWidth,\n height: this.el.clientHeight\n });\n this.trigger(Events.CORE_SCREEN_ORIENTATION_CHANGED, {\n event: event,\n orientation: this._screenOrientation\n });\n }\n }, {\n key: \"removeContainer\",\n value: function removeContainer(container) {\n this.stopListening(container);\n this.containers = this.containers.filter(function (c) {\n return c !== container;\n });\n }\n }, {\n key: \"setupContainer\",\n value: function setupContainer(container) {\n this.listenTo(container, Events.CONTAINER_DESTROYED, this.removeContainer);\n this.containers.push(container);\n }\n }, {\n key: \"setupContainers\",\n value: function setupContainers(containers) {\n containers.forEach(this.setupContainer.bind(this));\n this.trigger(Events.CORE_CONTAINERS_CREATED);\n this.renderContainers();\n this.activeContainer = containers[0];\n this.render();\n this.appendToParent();\n return this.containers;\n }\n }, {\n key: \"renderContainers\",\n value: function renderContainers() {\n var _this5 = this;\n\n this.containers.forEach(function (container) {\n return _this5.el.appendChild(container.render().el);\n });\n }\n }, {\n key: \"createContainer\",\n value: function createContainer(source, options) {\n var container = this.containerFactory.createContainer(source, options);\n this.setupContainer(container);\n this.el.appendChild(container.render().el);\n return container;\n }\n /**\n * @deprecated\n * This method currently exists for retrocompatibility reasons.\n * If you want the current container reference, use the activeContainer getter.\n */\n\n }, {\n key: \"getCurrentContainer\",\n value: function getCurrentContainer() {\n return this.activeContainer;\n }\n /**\n * @deprecated\n * This method currently exists for retrocompatibility reasons.\n * If you want the current playback reference, use the activePlayback getter.\n */\n\n }, {\n key: \"getCurrentPlayback\",\n value: function getCurrentPlayback() {\n return this.activePlayback;\n }\n }, {\n key: \"getPlaybackType\",\n value: function getPlaybackType() {\n return this.activeContainer && this.activeContainer.getPlaybackType();\n }\n }, {\n key: \"isFullscreen\",\n value: function isFullscreen() {\n // Ensure current instance is in fullscreen mode by checking fullscreen element\n var fullscreenElement = Fullscreen.fullscreenElement();\n if (!fullscreenElement) return false;\n var playbackEl = this.activePlayback && this.activePlayback.el;\n return fullscreenElement === this.el || fullscreenElement === playbackEl;\n }\n }, {\n key: \"toggleFullscreen\",\n value: function toggleFullscreen() {\n var _this6 = this;\n\n if (this.isFullscreen()) {\n Fullscreen.cancelFullscreen();\n !Browser.isiOS && this.$el.removeClass('fullscreen nocursor');\n } else {\n var fullscreenEl = Browser.isiOS ? this.activePlayback && this.activePlayback.el : this.el;\n if (!fullscreenEl) return;\n Browser.isSafari || Browser.isiOS ? // Safari doesn't return a promise like the other browsers. See more in https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen\n Fullscreen.requestFullscreen(fullscreenEl) : Fullscreen.requestFullscreen(fullscreenEl).then(function (_) {\n return _;\n }, function (error) {\n return setTimeout(function () {\n // fixes the issue https://github.com/clappr/clappr/issues/1860\n if (!_this6.isFullscreen()) throw new ReferenceError(error);\n }, 600);\n });\n !Browser.isiOS && this.$el.addClass('fullscreen');\n }\n }\n }, {\n key: \"onMouseMove\",\n value: function onMouseMove(event) {\n this.trigger(Events.CORE_MOUSE_MOVE, event);\n }\n }, {\n key: \"onMouseLeave\",\n value: function onMouseLeave(event) {\n this.trigger(Events.CORE_MOUSE_LEAVE, event);\n }\n /**\n * enables to configure the container after its creation\n * @method configure\n * @param {Object} options all the options to change in form of a javascript object\n */\n\n }, {\n key: \"configure\",\n value: function configure(options) {\n var _this7 = this;\n\n this._options = zepto.extend(true, this._options, options);\n this.configureDomRecycler();\n var sources = options.source || options.sources;\n sources && this.load(sources, options.mimeType || this.options.mimeType);\n this.trigger(Events.CORE_OPTIONS_CHANGE, options); // Trigger with newly provided options\n\n this.containers.forEach(function (container) {\n return container.configure(_this7.options);\n });\n }\n }, {\n key: \"appendToParent\",\n value: function appendToParent() {\n var style = Styler.getStyleFor(css_248z$1.toString(), {\n baseUrl: this.options.baseUrl\n });\n var resetStyle = Styler.getStyleFor(css_248z$2.toString(), {\n baseUrl: this.options.baseUrl\n });\n this.$el.append(style[0]);\n this.options.includeResetStyle && this.$el.append(resetStyle[0]);\n var hasCoreParent = this.$el.parent() && this.$el.parent().length;\n !hasCoreParent && this.$el.appendTo(this.options.parentElement);\n }\n }, {\n key: \"render\",\n value: function render() {\n this.options.width = this.options.width || this.$el.width();\n this.options.height = this.options.height || this.$el.height();\n var size = {\n width: this.options.width,\n height: this.options.height\n };\n this.previousSize = this.currentSize = this.computedSize = size;\n this.updateSize();\n this.enableResizeObserver();\n return this;\n }\n }]);\n\n return Core;\n}(UIObject);\nObject.assign(Core.prototype, ErrorMixin);\n\n/**\n * The Core Factory is responsible for instantiate the core and it's plugins.\n * @class CoreFactory\n * @constructor\n * @extends BaseObject\n * @module components\n */\n\nvar CoreFactory = /*#__PURE__*/function (_BaseObject) {\n _inherits(CoreFactory, _BaseObject);\n\n var _super = _createSuper(CoreFactory);\n\n _createClass(CoreFactory, [{\n key: \"loader\",\n get: function get() {\n return this.player.loader;\n }\n /**\n * it builds the core factory\n * @method constructor\n * @param {Player} player the player object\n */\n\n }]);\n\n function CoreFactory(player) {\n var _this;\n\n _classCallCheck(this, CoreFactory);\n\n _this = _super.call(this, player.options);\n _this.player = player;\n return _this;\n }\n /**\n * creates a core and its plugins\n * @method create\n * @return {Core} created core\n */\n\n\n _createClass(CoreFactory, [{\n key: \"create\",\n value: function create() {\n this.options.loader = this.loader;\n this.core = new Core(this.options);\n this.addCorePlugins();\n this.core.createContainers(this.options);\n return this.core;\n }\n /**\n * given the core plugins (`loader.corePlugins`) it builds each one\n * @method addCorePlugins\n * @return {Core} the core with all plugins\n */\n\n }, {\n key: \"addCorePlugins\",\n value: function addCorePlugins() {\n var _this2 = this;\n\n this.loader.corePlugins.forEach(function (Plugin) {\n var plugin = new Plugin(_this2.core);\n\n _this2.core.addPlugin(plugin);\n\n _this2.setupExternalInterface(plugin);\n });\n return this.core;\n }\n }, {\n key: \"setupExternalInterface\",\n value: function setupExternalInterface(plugin) {\n var externalFunctions = plugin.getExternalInterface();\n\n for (var key in externalFunctions) {\n this.player[key] = externalFunctions[key].bind(plugin);\n }\n }\n }]);\n\n return CoreFactory;\n}(BaseObject);\n\nvar VERSION_REGEX = /(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?/;\n\nvar Version = /*#__PURE__*/function () {\n _createClass(Version, null, [{\n key: \"parse\",\n value: function parse() {\n var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var matches = str.match(VERSION_REGEX) || [];\n\n var _matches = _slicedToArray(matches, 4),\n major = _matches[1],\n minor = _matches[2],\n patch = _matches[3];\n\n if (typeof major === 'undefined') return null;\n return new Version(major, minor, patch);\n }\n }]);\n\n function Version(major, minor, patch) {\n _classCallCheck(this, Version);\n\n this.major = parseInt(major || 0, 10);\n this.minor = parseInt(minor || 0, 10);\n this.patch = parseInt(patch || 0, 10);\n }\n\n _createClass(Version, [{\n key: \"compare\",\n value: function compare(other) {\n var diff = this.major - other.major;\n diff = diff || this.minor - other.minor;\n diff = diff || this.patch - other.patch;\n return diff;\n }\n }, {\n key: \"inc\",\n value: function inc() {\n var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'patch';\n typeof this[type] !== 'undefined' && (this[type] += 1);\n return this;\n }\n }, {\n key: \"satisfies\",\n value: function satisfies(min, max) {\n return this.compare(min) >= 0 && (!max || this.compare(max) < 0);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return \"\".concat(this.major, \".\").concat(this.minor, \".\").concat(this.patch);\n }\n }]);\n\n return Version;\n}();\n\nvar filterPluginsByType = function filterPluginsByType(plugins, type) {\n if (!plugins || !type) return {};\n return Object.entries(plugins).filter(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n value = _ref2[1];\n\n return value.type === type;\n }).reduce(function (obj, _ref3) {\n var _ref4 = _slicedToArray(_ref3, 2),\n key = _ref4[0],\n value = _ref4[1];\n\n return obj[key] = value, obj;\n }, {});\n};\n/**\n * It keeps a list of the default plugins (playback, container, core) and it merges external plugins with its internals.\n * @class Loader\n * @constructor\n * @extends BaseObject\n * @module components\n */\n\n\nvar Loader = (function () {\n var registry = {\n plugins: {},\n playbacks: []\n };\n var currentVersion = \"0.4.18\";\n return /*#__PURE__*/function () {\n _createClass(Loader, null, [{\n key: \"checkVersionSupport\",\n value: function checkVersionSupport(entry) {\n var _entry$prototype = entry.prototype,\n supportedVersion = _entry$prototype.supportedVersion,\n name = _entry$prototype.name;\n\n if (!supportedVersion || !supportedVersion.min) {\n Log.warn('Loader', \"missing version information for \".concat(name));\n return false;\n }\n\n var maxVersion = supportedVersion.max ? Version.parse(supportedVersion.max) : Version.parse(supportedVersion.min).inc('minor');\n var minVersion = Version.parse(supportedVersion.min);\n\n if (!Version.parse(currentVersion).satisfies(minVersion, maxVersion)) {\n Log.warn('Loader', \"unsupported plugin \".concat(name, \": Clappr version \").concat(currentVersion, \" does not match required range [\").concat(minVersion, \",\").concat(maxVersion, \")\"));\n return false;\n }\n\n return true;\n }\n }, {\n key: \"registerPlugin\",\n value: function registerPlugin(pluginEntry) {\n if (!pluginEntry || !pluginEntry.prototype.name) {\n Log.warn('Loader', \"missing information to register plugin: \".concat(pluginEntry));\n return false;\n }\n\n Loader.checkVersionSupport(pluginEntry);\n var pluginRegistry = registry.plugins;\n if (!pluginRegistry) return false;\n var previousEntry = pluginRegistry[pluginEntry.prototype.name];\n if (previousEntry) Log.warn('Loader', \"overriding plugin entry: \".concat(pluginEntry.prototype.name, \" - \").concat(previousEntry));\n pluginRegistry[pluginEntry.prototype.name] = pluginEntry;\n return true;\n }\n }, {\n key: \"registerPlayback\",\n value: function registerPlayback(playbackEntry) {\n if (!playbackEntry || !playbackEntry.prototype.name) return false;\n Loader.checkVersionSupport(playbackEntry);\n var playbacks = registry.playbacks;\n var previousEntryIdx = playbacks.findIndex(function (entry) {\n return entry.prototype.name === playbackEntry.prototype.name;\n });\n\n if (previousEntryIdx >= 0) {\n var previousEntry = playbacks[previousEntryIdx];\n playbacks.splice(previousEntryIdx, 1);\n Log.warn('Loader', \"overriding playback entry: \".concat(previousEntry.name, \" - \").concat(previousEntry));\n }\n\n registry.playbacks = [playbackEntry].concat(_toConsumableArray(playbacks));\n return true;\n }\n }, {\n key: \"unregisterPlugin\",\n value: function unregisterPlugin(name) {\n if (!name) return false;\n var plugins = registry.plugins;\n var plugin = plugins[name];\n if (!plugin) return false;\n delete plugins[name];\n return true;\n }\n }, {\n key: \"unregisterPlayback\",\n value: function unregisterPlayback(name) {\n if (!name) return false;\n var playbacks = registry.playbacks;\n var index = playbacks.findIndex(function (entry) {\n return entry.prototype.name === name;\n });\n if (index < 0) return false;\n playbacks.splice(index, 1);\n registry.playbacks = playbacks;\n return true;\n }\n }, {\n key: \"clearPlugins\",\n value: function clearPlugins() {\n registry.plugins = {};\n }\n }, {\n key: \"clearPlaybacks\",\n value: function clearPlaybacks() {\n registry.playbacks = [];\n }\n /**\n * builds the loader\n * @method constructor\n * @param {Object} externalPlugins the external plugins\n * @param {Number} playerId you can embed multiple instances of clappr, therefore this is the unique id of each one.\n */\n\n }, {\n key: \"registeredPlaybacks\",\n get: function get() {\n return _toConsumableArray(registry.playbacks);\n }\n }, {\n key: \"registeredPlugins\",\n get: function get() {\n var plugins = registry.plugins;\n var core = filterPluginsByType(plugins, 'core');\n var container = filterPluginsByType(plugins, 'container');\n return {\n core: core,\n container: container\n };\n }\n }]);\n\n function Loader() {\n var externalPlugins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var playerId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n _classCallCheck(this, Loader);\n\n this.playerId = playerId;\n this.playbackPlugins = _toConsumableArray(registry.playbacks);\n var _Loader$registeredPlu = Loader.registeredPlugins,\n core = _Loader$registeredPlu.core,\n container = _Loader$registeredPlu.container;\n this.containerPlugins = Object.values(container);\n this.corePlugins = Object.values(core);\n if (!Array.isArray(externalPlugins)) this.validateExternalPluginsType(externalPlugins);\n this.addExternalPlugins(externalPlugins);\n }\n /**\n * groups by type the external plugins that were passed through `options.plugins` it they're on a flat array\n * @method addExternalPlugins\n * @private\n * @param {Object} an config object or an array of plugins\n * @return {Object} plugins the config object with the plugins separated by type\n */\n\n\n _createClass(Loader, [{\n key: \"groupPluginsByType\",\n value: function groupPluginsByType(plugins) {\n if (Array.isArray(plugins)) {\n plugins = plugins.reduce(function (memo, plugin) {\n memo[plugin.type] || (memo[plugin.type] = []);\n memo[plugin.type].push(plugin);\n return memo;\n }, {});\n }\n\n return plugins;\n }\n }, {\n key: \"removeDups\",\n value: function removeDups(list) {\n var useReversePrecedence = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var groupUp = function groupUp(plugins, plugin) {\n if (plugins[plugin.prototype.name] && useReversePrecedence) return plugins;\n plugins[plugin.prototype.name] && delete plugins[plugin.prototype.name];\n plugins[plugin.prototype.name] = plugin;\n return plugins;\n };\n\n var pluginsMap = list.reduceRight(groupUp, Object.create(null));\n var plugins = [];\n\n for (var key in pluginsMap) {\n plugins.unshift(pluginsMap[key]);\n }\n\n return plugins;\n }\n /**\n * adds all the external plugins that were passed through `options.plugins`\n * @method addExternalPlugins\n * @private\n * @param {Object} plugins the config object with all plugins\n */\n\n }, {\n key: \"addExternalPlugins\",\n value: function addExternalPlugins(plugins) {\n var loadExternalPluginsFirst = typeof plugins.loadExternalPluginsFirst === 'boolean' ? plugins.loadExternalPluginsFirst : true;\n var loadExternalPlaybacksFirst = typeof plugins.loadExternalPlaybacksFirst === 'boolean' ? plugins.loadExternalPlaybacksFirst : true;\n plugins = this.groupPluginsByType(plugins);\n\n if (plugins.playback) {\n var playbacks = plugins.playback.filter(function (playback) {\n return Loader.checkVersionSupport(playback), true;\n });\n this.playbackPlugins = loadExternalPlaybacksFirst ? this.removeDups(playbacks.concat(this.playbackPlugins)) : this.removeDups(this.playbackPlugins.concat(playbacks), true);\n }\n\n if (plugins.container) {\n var containerPlugins = plugins.container.filter(function (plugin) {\n return Loader.checkVersionSupport(plugin), true;\n });\n this.containerPlugins = loadExternalPluginsFirst ? this.removeDups(containerPlugins.concat(this.containerPlugins)) : this.removeDups(this.containerPlugins.concat(containerPlugins), true);\n }\n\n if (plugins.core) {\n var corePlugins = plugins.core.filter(function (plugin) {\n return Loader.checkVersionSupport(plugin), true;\n });\n this.corePlugins = loadExternalPluginsFirst ? this.removeDups(corePlugins.concat(this.corePlugins)) : this.removeDups(this.corePlugins.concat(corePlugins), true);\n }\n }\n /**\n * validate if the external plugins that were passed through `options.plugins` are associated to the correct type\n * @method validateExternalPluginsType\n * @private\n * @param {Object} plugins the config object with all plugins\n */\n\n }, {\n key: \"validateExternalPluginsType\",\n value: function validateExternalPluginsType(plugins) {\n var pluginTypes = ['playback', 'container', 'core'];\n pluginTypes.forEach(function (type) {\n (plugins[type] || []).forEach(function (el) {\n var errorMessage = 'external ' + el.type + ' plugin on ' + type + ' array';\n if (el.type !== type) throw new ReferenceError(errorMessage);\n });\n });\n }\n }]);\n\n return Loader;\n }();\n})();\n\nvar baseUrl = currentScriptUrl().replace(/\\/[^/]+$/, '');\n/**\n * @class Player\n * @constructor\n * @extends BaseObject\n * @module components\n * @example\n * ### Using the Player\n *\n * Add the following script on your HTML:\n * ```html\n * \n * \n * \n * ```\n * Now, create the player:\n * ```html\n * \n *
\n * \n * \n * ```\n */\n\nvar Player = /*#__PURE__*/function (_BaseObject) {\n _inherits(Player, _BaseObject);\n\n var _super = _createSuper(Player);\n\n _createClass(Player, [{\n key: \"loader\",\n set: function set(loader) {\n this._loader = loader;\n },\n get: function get() {\n if (!this._loader) this._loader = new Loader(this.options.plugins || {}, this.options.playerId);\n return this._loader;\n }\n /**\n * Determine if the playback has ended.\n * @property ended\n * @type Boolean\n */\n\n }, {\n key: \"ended\",\n get: function get() {\n return this.core.activeContainer.ended;\n }\n /**\n * Determine if the playback is having to buffer in order for\n * playback to be smooth.\n * (i.e if a live stream is playing smoothly, this will be false)\n * @property buffering\n * @type Boolean\n */\n\n }, {\n key: \"buffering\",\n get: function get() {\n return this.core.activeContainer.buffering;\n }\n /*\n * determine if the player is ready.\n * @property isReady\n * @type {Boolean} `true` if the player is ready. ie PLAYER_READY event has fired\n */\n\n }, {\n key: \"isReady\",\n get: function get() {\n return !!this._ready;\n }\n /**\n * An events map that allows the user to add custom callbacks in player's options.\n * @property eventsMapping\n * @type {Object}\n */\n\n }, {\n key: \"eventsMapping\",\n get: function get() {\n return {\n onReady: Events.PLAYER_READY,\n onResize: Events.PLAYER_RESIZE,\n onPlay: Events.PLAYER_PLAY,\n onPause: Events.PLAYER_PAUSE,\n onStop: Events.PLAYER_STOP,\n onEnded: Events.PLAYER_ENDED,\n onSeek: Events.PLAYER_SEEK,\n onError: Events.PLAYER_ERROR,\n onTimeUpdate: Events.PLAYER_TIMEUPDATE,\n onVolumeUpdate: Events.PLAYER_VOLUMEUPDATE,\n onSubtitleAvailable: Events.PLAYER_SUBTITLE_AVAILABLE\n };\n }\n /**\n * @typedef {Object} PlaybackConfig\n * @prop {boolean} disableContextMenu\n * disables the context menu (right click) on the video element if a HTML5Video playback is used.\n * @prop {boolean} preload\n * video will be preloaded according to `preload` attribute options **default**: `'metadata'`\n * @prop {boolean} controls\n * enabled/disables displaying controls\n * @prop {boolean} crossOrigin\n * enables cross-origin capability for media-resources\n * @prop {boolean} playInline\n * enables in-line video elements\n * @prop {boolean} audioOnly\n * enforce audio-only playback (when possible)\n * @prop {Object} externalTracks\n * pass externaly loaded track to playback\n * @prop {Number} [maxBufferLength]\n * The default behavior for the **HLS playback** is to keep buffering indefinitely, even on VoD.\n * This replicates the behavior for progressive download, which continues buffering when pausing the video, thus making the video available for playback even on slow networks.\n * To change this behavior use `maxBufferLength` where **value is in seconds**.\n * @prop {Number} [maxBackBufferLength]\n * After how much distance of the playhead data should be pruned from the buffer (influences memory consumption\n * of adaptive media-engines like Hls.js or Shaka)\n * @prop {Number} [minBufferLength]\n * After how much data in the buffer at least we attempt to consume it (influences QoS-related behavior\n * of adaptive media-engines like Hls.js or Shaka). If this is too low, and the available bandwidth is varying a lot\n * and too close to the streamed bitrate, we may continuously hit under-runs.\n * @prop {Number} [initialBandwidthEstimate]\n * define an initial bandwidth \"guess\" (or previously stored/established value) for underlying adaptive-bitreate engines\n * of adaptive playback implementations, like Hls.js or Shaka\n * @prop {Number} [maxAdaptiveBitrate]\n * Limits the streamed bitrate (for adaptive media-engines in underlying playback implementations)\n * @prop {Object} [maxAdaptiveVideoDimensions]\n * Limits the video dimensions in adaptive media-engines. Should be a literal object with `height` and `width`.\n * @prop {Boolean}[enableAutomaticABR] **default**: `true`\n * Allows to enable/disable automatic bitrate switching in adaptive media-engines\n * @prop {String} [preferredTextLanguage] **default**: `'pt-BR'`\n * Allows to set a preferred text language, that may be enabled by the media-engine if available.\n * @prop {String} [preferredAudioLanguage] **default**: `'pt-BR'`\n * Allows to set a preferred audio language, that may be enabled by the media-engine if available.\n */\n\n /**\n * ## Player's constructor\n *\n * You might pass the options object to build the player.\n * ```javascript\n * var options = {source: \"http://example.com/video.mp4\", param1: \"val1\"};\n * var player = new Clappr.Player(options);\n * ```\n *\n * @method constructor\n * @param {Object} options Data\n * options to build a player instance\n * @param {Number} [options.width]\n * player's width **default**: `640`\n * @param {Number} [options.height]\n * player's height **default**: `360`\n * @param {String} [options.parentId]\n * the id of the element on the page that the player should be inserted into\n * @param {Object} [options.parent]\n * a reference to a dom element that the player should be inserted into\n * @param {String} [options.source]\n * The media source URL, or {source: <>, mimeType: <>}\n * @param {Object} [options.sources]\n * An array of media source URL's, or an array of {source: <>, mimeType: <>}\n * @param {Boolean} [options.autoPlay]\n * automatically play after page load **default**: `false`\n * @param {Boolean} [options.loop]\n * automatically replay after it ends **default**: `false`\n * @param {Boolean} [options.chromeless]\n * player acts in chromeless mode **default**: `false`\n * @param {Boolean} [options.allowUserInteraction]\n * whether or not the player should handle click events when in chromeless mode **default**: `false` on desktops browsers, `true` on mobile.\n * @param {Boolean} [options.disableKeyboardShortcuts]\n * disable keyboard shortcuts. **default**: `false`. `true` if `allowUserInteraction` is `false`.\n * @param {Boolean} [options.mute]\n * start the video muted **default**: `false`\n * @param {String} [options.mimeType]\n * add `mimeType: \"application/vnd.apple.mpegurl\"` if you need to use a url without extension.\n * @param {Boolean} [options.actualLiveTime]\n * show duration and seek time relative to actual time.\n * @param {String} [options.actualLiveServerTime]\n * specify server time as a string, format: \"2015/11/26 06:01:03\". This option is meant to be used with actualLiveTime.\n * @param {Boolean} [options.persistConfig]\n * persist player's settings (volume) through the same domain **default**: `true`\n * @param {String} [options.preload] @deprecated\n * video will be preloaded according to `preload` attribute options **default**: `'metadata'`\n * @param {Number} [options.maxBufferLength] @deprecated\n * the default behavior for the **HLS playback** is to keep buffering indefinitely, even on VoD.\n * This replicates the behavior for progressive download, which continues buffering when pausing the video, thus making the video available for playback even on slow networks.\n * To change this behavior use `maxBufferLength` where **value is in seconds**.\n * @param {String} [options.gaAccount]\n * enable Google Analytics events dispatch **(play/pause/stop/buffering/etc)** by adding your `gaAccount`\n * @param {String} [options.gaTrackerName]\n * besides `gaAccount` you can optionally, pass your favorite trackerName as `gaTrackerName`\n * @param {Object} [options.mediacontrol]\n * customize control bar colors, example: `mediacontrol: {seekbar: \"#E113D3\", buttons: \"#66B2FF\"}`\n * @param {Boolean} [options.hideMediaControl]\n * control media control auto hide **default**: `true`\n * @param {Boolean} [options.hideVolumeBar]\n * when embedded with width less than 320, volume bar will hide. You can force this behavior for all sizes by adding `true` **default**: `false`\n * @param {String} [options.watermark]\n * put `watermark: 'http://url/img.png'` on your embed parameters to automatically add watermark on your video.\n * You can customize corner position by defining position parameter. Positions can be `bottom-left`, `bottom-right`, `top-left` and `top-right`.\n * @param {String} [options.watermarkLink]\n * `watermarkLink: 'http://example.net/'` - define URL to open when the watermark is clicked. If not provided watermark will not be clickable.\n * @param {Boolean} [options.disableVideoTagContextMenu] @deprecated\n * disables the context menu (right click) on the video element if a HTML5Video playback is used.\n * @param {Boolean} [options.autoSeekFromUrl]\n * Automatically seek to the seconds provided in the url (e.g example.com?t=100) **default**: `true`\n * @param {Boolean} [options.exitFullscreenOnEnd]\n * Automatically exit full screen when the media finishes. **default**: `true`\n * @param {String} [options.poster]\n * define a poster by adding its address `poster: 'http://url/img.png'`. It will appear after video embed, disappear on play and go back when user stops the video.\n * @param {String} [options.playbackNotSupportedMessage]\n * define a custom message to be displayed when a playback is not supported.\n * @param {Object} [options.events]\n * Specify listeners which will be registered with their corresponding player events.\n * E.g. onReady -> \"PLAYER_READY\", onTimeUpdate -> \"PLAYER_TIMEUPDATE\"\n * @param {PlaybackConfig} [options.playback]\n * Generic `Playback` component related configuration\n * @param {Boolean} [options.disableErrorScreen]\n * disables the error screen plugin.\n * @param {Number} [options.autoPlayTimeout]\n * autoplay check timeout.\n */\n\n }]);\n\n function Player(options) {\n var _this;\n\n _classCallCheck(this, Player);\n\n _this = _super.call(this, options);\n var playbackDefaultOptions = {\n recycleVideo: true\n };\n var defaultOptions = {\n playerId: uniqueId(''),\n persistConfig: true,\n width: 640,\n height: 360,\n baseUrl: baseUrl,\n allowUserInteraction: Browser.isMobile,\n includeResetStyle: true,\n playback: playbackDefaultOptions\n };\n _this._options = zepto.extend(true, defaultOptions, options);\n _this.options.sources = _this._normalizeSources(options);\n\n if (!_this.options.chromeless) {\n // \"allowUserInteraction\" cannot be false if not in chromeless mode.\n _this.options.allowUserInteraction = true;\n }\n\n if (!_this.options.allowUserInteraction) {\n // if user iteraction is not allowed ensure keyboard shortcuts are disabled\n _this.options.disableKeyboardShortcuts = true;\n }\n\n _this._registerOptionEventListeners(_this.options.events);\n\n _this._coreFactory = new CoreFactory(_assertThisInitialized(_this));\n if (_this.options.parentId) _this.setParentId(_this.options.parentId);else if (_this.options.parent) _this.attachTo(_this.options.parent);\n return _this;\n }\n /**\n * Specify a `parentId` to the player.\n * @method setParentId\n * @param {String} parentId the element parent id.\n * @return {Player} itself\n */\n\n\n _createClass(Player, [{\n key: \"setParentId\",\n value: function setParentId(parentId) {\n var el = document.querySelector(parentId);\n if (el) this.attachTo(el);\n return this;\n }\n /**\n * You can use this method to attach the player to a given element. You don't need to do this when you specify it during the player instantiation passing the `parentId` param.\n * @method attachTo\n * @param {Object} element a given element.\n * @return {Player} itself\n */\n\n }, {\n key: \"attachTo\",\n value: function attachTo(element) {\n this.options.parentElement = element;\n this.core = this._coreFactory.create();\n\n this._addEventListeners();\n\n return this;\n }\n }, {\n key: \"_addEventListeners\",\n value: function _addEventListeners() {\n if (!this.core.isReady) this.listenToOnce(this.core, Events.CORE_READY, this._onReady);else this._onReady();\n this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this._containerChanged);\n this.listenTo(this.core, Events.CORE_FULLSCREEN, this._onFullscreenChange);\n this.listenTo(this.core, Events.CORE_RESIZE, this._onResize);\n return this;\n }\n }, {\n key: \"_addContainerEventListeners\",\n value: function _addContainerEventListeners() {\n var container = this.core.activeContainer;\n\n if (container) {\n this.listenTo(container, Events.CONTAINER_PLAY, this._onPlay);\n this.listenTo(container, Events.CONTAINER_PAUSE, this._onPause);\n this.listenTo(container, Events.CONTAINER_STOP, this._onStop);\n this.listenTo(container, Events.CONTAINER_ENDED, this._onEnded);\n this.listenTo(container, Events.CONTAINER_SEEK, this._onSeek);\n this.listenTo(container, Events.CONTAINER_ERROR, this._onError);\n this.listenTo(container, Events.CONTAINER_TIMEUPDATE, this._onTimeUpdate);\n this.listenTo(container, Events.CONTAINER_VOLUME, this._onVolumeUpdate);\n this.listenTo(container, Events.CONTAINER_SUBTITLE_AVAILABLE, this._onSubtitleAvailable);\n }\n\n return this;\n }\n }, {\n key: \"_registerOptionEventListeners\",\n value: function _registerOptionEventListeners() {\n var _this2 = this;\n\n var newEvents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var hasNewEvents = Object.keys(newEvents).length > 0;\n hasNewEvents && Object.keys(events).forEach(function (userEvent) {\n var eventType = _this2.eventsMapping[userEvent];\n eventType && _this2.off(eventType, events[userEvent]);\n });\n Object.keys(newEvents).forEach(function (userEvent) {\n var eventType = _this2.eventsMapping[userEvent];\n\n if (eventType) {\n var eventFunction = newEvents[userEvent];\n eventFunction = typeof eventFunction === 'function' && eventFunction;\n eventFunction && _this2.on(eventType, eventFunction);\n }\n });\n return this;\n }\n }, {\n key: \"_containerChanged\",\n value: function _containerChanged() {\n this.stopListening();\n\n this._addEventListeners();\n }\n }, {\n key: \"_onReady\",\n value: function _onReady() {\n this._ready = true;\n\n this._addContainerEventListeners();\n\n this.trigger(Events.PLAYER_READY);\n }\n }, {\n key: \"_onFullscreenChange\",\n value: function _onFullscreenChange(fullscreen) {\n this.trigger(Events.PLAYER_FULLSCREEN, fullscreen);\n }\n }, {\n key: \"_onVolumeUpdate\",\n value: function _onVolumeUpdate(volume) {\n this.trigger(Events.PLAYER_VOLUMEUPDATE, volume);\n }\n }, {\n key: \"_onSubtitleAvailable\",\n value: function _onSubtitleAvailable() {\n this.trigger(Events.PLAYER_SUBTITLE_AVAILABLE);\n }\n }, {\n key: \"_onResize\",\n value: function _onResize(size) {\n this.trigger(Events.PLAYER_RESIZE, size);\n }\n }, {\n key: \"_onPlay\",\n value: function _onPlay() {\n this.trigger(Events.PLAYER_PLAY);\n }\n }, {\n key: \"_onPause\",\n value: function _onPause() {\n this.trigger(Events.PLAYER_PAUSE);\n }\n }, {\n key: \"_onStop\",\n value: function _onStop() {\n this.trigger(Events.PLAYER_STOP, this.getCurrentTime());\n }\n }, {\n key: \"_onEnded\",\n value: function _onEnded() {\n this.trigger(Events.PLAYER_ENDED);\n }\n }, {\n key: \"_onSeek\",\n value: function _onSeek(time) {\n this.trigger(Events.PLAYER_SEEK, time);\n }\n }, {\n key: \"_onTimeUpdate\",\n value: function _onTimeUpdate(timeProgress) {\n this.trigger(Events.PLAYER_TIMEUPDATE, timeProgress);\n }\n }, {\n key: \"_onError\",\n value: function _onError(error) {\n this.trigger(Events.PLAYER_ERROR, error);\n }\n }, {\n key: \"_normalizeSources\",\n value: function _normalizeSources(options) {\n var sources = options.sources || (options.source !== undefined ? [options.source] : []);\n return sources.length === 0 ? [{\n source: '',\n mimeType: ''\n }] : sources;\n }\n /**\n * resizes the current player canvas.\n * @method resize\n * @param {Object} size should be a literal object with `height` and `width`.\n * @return {Player} itself\n * @example\n * ```javascript\n * player.resize({height: 360, width: 640})\n * ```\n */\n\n }, {\n key: \"resize\",\n value: function resize(size) {\n this.core.resize(size);\n return this;\n }\n /**\n * loads a new source.\n * @method load\n * @param {Array|String} sources source or sources of video.\n * An array item can be a string or {source: <>, mimeType: <>}\n * @param {String} mimeType a mime type, example: `'application/vnd.apple.mpegurl'`\n * @param {Boolean} [autoPlay=false] whether playing should be started immediately\n * @return {Player} itself\n */\n\n }, {\n key: \"load\",\n value: function load(sources, mimeType, autoPlay) {\n if (autoPlay !== undefined) this.configure({\n autoPlay: !!autoPlay\n });\n this.core.load(sources, mimeType);\n return this;\n }\n /**\n * destroys the current player and removes it from the DOM.\n * @method destroy\n * @return {Player} itself\n */\n\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.stopListening();\n this.core.destroy();\n return this;\n }\n /**\n * Gives user consent to playback. Required by mobile device after a click event before Player.load().\n * @method consent\n * @param {Function} callback function called when current playback is consented\n * @example\n * ```javascript\n * player.consent(function() { doSomethingNext(); });\n * ```\n */\n\n }, {\n key: \"consent\",\n value: function consent(cb) {\n this.core.getCurrentPlayback().consent(cb);\n }\n /**\n * plays the current video (`source`).\n * @method play\n * @return {Player} itself\n */\n\n }, {\n key: \"play\",\n value: function play() {\n this.core.activeContainer.play();\n return this;\n }\n /**\n * pauses the current video (`source`).\n * @method pause\n * @return {Player} itself\n */\n\n }, {\n key: \"pause\",\n value: function pause() {\n this.core.activeContainer.pause();\n return this;\n }\n /**\n * stops the current video (`source`).\n * @method stop\n * @return {Player} itself\n */\n\n }, {\n key: \"stop\",\n value: function stop() {\n this.core.activeContainer.stop();\n return this;\n }\n /**\n * seeks the current video (`source`). For example, `player.seek(120)` will seek to second 120 (2minutes) of the current video.\n * @method seek\n * @param {Number} time should be a number between 0 and the video duration.\n * @return {Player} itself\n */\n\n }, {\n key: \"seek\",\n value: function seek(time) {\n this.core.activeContainer.seek(time);\n return this;\n }\n /**\n * seeks the current video (`source`). For example, `player.seek(50)` will seek to the middle of the current video.\n * @method seekPercentage\n * @param {Number} time should be a number between 0 and 100.\n * @return {Player} itself\n */\n\n }, {\n key: \"seekPercentage\",\n value: function seekPercentage(percentage) {\n this.core.activeContainer.seekPercentage(percentage);\n return this;\n }\n /**\n * mutes the current video (`source`).\n * @method mute\n * @return {Player} itself\n */\n\n }, {\n key: \"mute\",\n value: function mute() {\n this.core.activePlayback.mute();\n return this;\n }\n /**\n * unmutes the current video (`source`).\n * @method unmute\n * @return {Player} itself\n */\n\n }, {\n key: \"unmute\",\n value: function unmute() {\n this.core.activePlayback.unmute();\n return this;\n }\n /**\n * checks if the player is playing.\n * @method isPlaying\n * @return {Boolean} `true` if the current source is playing, otherwise `false`\n */\n\n }, {\n key: \"isPlaying\",\n value: function isPlaying() {\n return this.core.activeContainer.isPlaying();\n }\n /**\n * returns `true` if DVR is enable otherwise `false`.\n * @method isDvrEnabled\n * @return {Boolean}\n */\n\n }, {\n key: \"isDvrEnabled\",\n value: function isDvrEnabled() {\n return this.core.activeContainer.isDvrEnabled();\n }\n /**\n * returns `true` if DVR is in use otherwise `false`.\n * @method isDvrInUse\n * @return {Boolean}\n */\n\n }, {\n key: \"isDvrInUse\",\n value: function isDvrInUse() {\n return this.core.activeContainer.isDvrInUse();\n }\n /**\n * enables to configure a player after its creation\n * @method configure\n * @param {Object} options all the options to change in form of a javascript object\n * @return {Player} itself\n */\n\n }, {\n key: \"configure\",\n value: function configure() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this._registerOptionEventListeners(options.events, this.options.events);\n\n this.core.configure(options);\n return this;\n }\n /**\n * get a plugin by its name.\n * @method getPlugin\n * @param {String} name of the plugin.\n * @return {Object} the plugin instance\n * @example\n * ```javascript\n * var poster = player.getPlugin('poster');\n * poster.hidePlayButton();\n * ```\n */\n\n }, {\n key: \"getPlugin\",\n value: function getPlugin(name) {\n var plugins = this.core.plugins.concat(this.core.activeContainer.plugins);\n return plugins.filter(function (plugin) {\n return plugin.name === name;\n })[0];\n }\n /**\n * the current time in seconds.\n * @method getCurrentTime\n * @return {Number} current time (in seconds) of the current source\n */\n\n }, {\n key: \"getCurrentTime\",\n value: function getCurrentTime() {\n return this.core.activeContainer.getCurrentTime();\n }\n /**\n * The time that \"0\" now represents relative to when playback started.\n * For a stream with a sliding window this will increase as content is\n * removed from the beginning.\n * @method getStartTimeOffset\n * @return {Number} time (in seconds) that time \"0\" represents.\n */\n\n }, {\n key: \"getStartTimeOffset\",\n value: function getStartTimeOffset() {\n return this.core.activeContainer.getStartTimeOffset();\n }\n /**\n * the duration time in seconds.\n * @method getDuration\n * @return {Number} duration time (in seconds) of the current source\n */\n\n }, {\n key: \"getDuration\",\n value: function getDuration() {\n return this.core.activeContainer.getDuration();\n }\n }]);\n\n return Player;\n}(BaseObject);\nObject.assign(Player.prototype, ErrorMixin);\n\n/**\n * The base class for a container plugin\n * @class ContainerPlugin\n * @constructor\n * @extends BaseObject\n * @module base\n */\n\nvar ContainerPlugin = /*#__PURE__*/function (_BaseObject) {\n _inherits(ContainerPlugin, _BaseObject);\n\n var _super = _createSuper(ContainerPlugin);\n\n _createClass(ContainerPlugin, [{\n key: \"playerError\",\n get: function get() {\n return this.container.playerError;\n }\n }]);\n\n function ContainerPlugin(container) {\n var _this;\n\n _classCallCheck(this, ContainerPlugin);\n\n _this = _super.call(this, container.options);\n _this.container = container;\n _this.enabled = true;\n\n _this.bindEvents();\n\n return _this;\n }\n\n _createClass(ContainerPlugin, [{\n key: \"enable\",\n value: function enable() {\n if (!this.enabled) {\n this.bindEvents();\n this.enabled = true;\n }\n }\n }, {\n key: \"disable\",\n value: function disable() {\n if (this.enabled) {\n this.stopListening();\n this.enabled = false;\n }\n }\n }, {\n key: \"bindEvents\",\n value: function bindEvents() {}\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.stopListening();\n }\n }]);\n\n return ContainerPlugin;\n}(BaseObject);\nObject.assign(ContainerPlugin.prototype, ErrorMixin);\n\nContainerPlugin.extend = function (properties) {\n return extend(ContainerPlugin, properties);\n};\n\nContainerPlugin.type = 'container';\n\nvar CorePlugin = /*#__PURE__*/function (_BaseObject) {\n _inherits(CorePlugin, _BaseObject);\n\n var _super = _createSuper(CorePlugin);\n\n _createClass(CorePlugin, [{\n key: \"playerError\",\n get: function get() {\n return this.core.playerError;\n }\n }]);\n\n function CorePlugin(core) {\n var _this;\n\n _classCallCheck(this, CorePlugin);\n\n _this = _super.call(this, core.options);\n _this.core = core;\n _this.enabled = true;\n\n _this.bindEvents();\n\n return _this;\n }\n\n _createClass(CorePlugin, [{\n key: \"bindEvents\",\n value: function bindEvents() {}\n }, {\n key: \"enable\",\n value: function enable() {\n if (!this.enabled) {\n this.bindEvents();\n this.enabled = true;\n }\n }\n }, {\n key: \"disable\",\n value: function disable() {\n if (this.enabled) {\n this.stopListening();\n this.enabled = false;\n }\n }\n }, {\n key: \"getExternalInterface\",\n value: function getExternalInterface() {\n return {};\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.stopListening();\n }\n }]);\n\n return CorePlugin;\n}(BaseObject);\nObject.assign(CorePlugin.prototype, ErrorMixin);\n\nCorePlugin.extend = function (properties) {\n return extend(CorePlugin, properties);\n};\n\nCorePlugin.type = 'core';\n\n/**\n * The base class for an ui container plugin\n * @class UIContainerPlugin\n * @constructor\n * @extends UIObject\n * @module base\n */\n\nvar UIContainerPlugin = /*#__PURE__*/function (_UIObject) {\n _inherits(UIContainerPlugin, _UIObject);\n\n var _super = _createSuper(UIContainerPlugin);\n\n _createClass(UIContainerPlugin, [{\n key: \"playerError\",\n get: function get() {\n return this.container.playerError;\n }\n }]);\n\n function UIContainerPlugin(container) {\n var _this;\n\n _classCallCheck(this, UIContainerPlugin);\n\n _this = _super.call(this, container.options);\n _this.container = container;\n _this.enabled = true;\n\n _this.bindEvents();\n\n return _this;\n }\n\n _createClass(UIContainerPlugin, [{\n key: \"enable\",\n value: function enable() {\n if (!this.enabled) {\n this.bindEvents();\n this.$el.show();\n this.enabled = true;\n }\n }\n }, {\n key: \"disable\",\n value: function disable() {\n this.stopListening();\n this.$el.hide();\n this.enabled = false;\n }\n }, {\n key: \"bindEvents\",\n value: function bindEvents() {}\n }]);\n\n return UIContainerPlugin;\n}(UIObject);\nObject.assign(UIContainerPlugin.prototype, ErrorMixin);\n\nUIContainerPlugin.extend = function (properties) {\n return extend(UIContainerPlugin, properties);\n};\n\nUIContainerPlugin.type = 'container';\n\nvar tracksHTML = \"<% for (var i = 0; i < tracks.length; i++) { %>\\n \\\" kind=\\\"<%= tracks[i].kind %>\\\" label=\\\"<%= tracks[i].label %>\\\" srclang=\\\"<%= tracks[i].lang %>\\\" src=\\\"<%= tracks[i].src %>\\\">\\n<% }; %>\\n\";\n\nvar css_248z$3 = \"[data-html5-video] {\\n position: absolute;\\n height: 100%;\\n width: 100%;\\n display: block; }\\n\";\n\nvar MIMETYPES = {\n 'mp4': ['avc1.42E01E', 'avc1.58A01E', 'avc1.4D401E', 'avc1.64001E', 'mp4v.20.8', 'mp4v.20.240', 'mp4a.40.2'].map(function (codec) {\n return 'video/mp4; codecs=\"' + codec + ', mp4a.40.2\"';\n }),\n 'ogg': ['video/ogg; codecs=\"theora, vorbis\"', 'video/ogg; codecs=\"dirac\"', 'video/ogg; codecs=\"theora, speex\"'],\n '3gpp': ['video/3gpp; codecs=\"mp4v.20.8, samr\"'],\n 'webm': ['video/webm; codecs=\"vp8, vorbis\"'],\n 'mkv': ['video/x-matroska; codecs=\"theora, vorbis\"'],\n 'm3u8': ['application/x-mpegurl']\n};\nMIMETYPES['ogv'] = MIMETYPES['ogg'];\nMIMETYPES['3gp'] = MIMETYPES['3gpp'];\nvar AUDIO_MIMETYPES = {\n 'wav': ['audio/wav'],\n 'mp3': ['audio/mp3', 'audio/mpeg;codecs=\"mp3\"'],\n 'aac': ['audio/mp4;codecs=\"mp4a.40.5\"'],\n 'oga': ['audio/ogg']\n};\nvar KNOWN_AUDIO_MIMETYPES = Object.keys(AUDIO_MIMETYPES).reduce(function (acc, k) {\n return [].concat(_toConsumableArray(acc), _toConsumableArray(AUDIO_MIMETYPES[k]));\n}, []);\nvar UNKNOWN_ERROR = {\n code: 'unknown',\n message: 'unknown'\n}; // TODO: rename this Playback to HTML5Playback (breaking change, only after 0.3.0)\n\nvar HTML5Video = /*#__PURE__*/function (_Playback) {\n _inherits(HTML5Video, _Playback);\n\n var _super = _createSuper(HTML5Video);\n\n _createClass(HTML5Video, [{\n key: \"name\",\n get: function get() {\n return 'html5_video';\n }\n }, {\n key: \"supportedVersion\",\n get: function get() {\n return {\n min: \"0.4.18\"\n };\n }\n }, {\n key: \"tagName\",\n get: function get() {\n return this.isAudioOnly ? 'audio' : 'video';\n }\n }, {\n key: \"isAudioOnly\",\n get: function get() {\n var resourceUrl = this.options.src;\n\n var mimeTypes = HTML5Video._mimeTypesForUrl(resourceUrl, AUDIO_MIMETYPES, this.options.mimeType);\n\n return this.options.playback && this.options.playback.audioOnly || this.options.audioOnly || KNOWN_AUDIO_MIMETYPES.indexOf(mimeTypes[0]) >= 0;\n }\n }, {\n key: \"attributes\",\n get: function get() {\n return {\n 'data-html5-video': ''\n };\n }\n }, {\n key: \"events\",\n get: function get() {\n return {\n 'canplay': '_onCanPlay',\n 'canplaythrough': '_handleBufferingEvents',\n 'durationchange': '_onDurationChange',\n 'ended': '_onEnded',\n 'error': '_onError',\n 'loadeddata': '_onLoadedData',\n 'loadedmetadata': '_onLoadedMetadata',\n 'pause': '_onPause',\n 'playing': '_onPlaying',\n 'progress': '_onProgress',\n 'seeking': '_onSeeking',\n 'seeked': '_onSeeked',\n 'stalled': '_handleBufferingEvents',\n 'timeupdate': '_onTimeUpdate',\n 'waiting': '_onWaiting'\n };\n }\n /**\n * Determine if the playback has ended.\n * @property ended\n * @type Boolean\n */\n\n }, {\n key: \"ended\",\n get: function get() {\n return this.el.ended;\n }\n /**\n * Determine if the playback is having to buffer in order for\n * playback to be smooth.\n * This is related to the PLAYBACK_BUFFERING and PLAYBACK_BUFFERFULL events\n * @property buffering\n * @type Boolean\n */\n\n }, {\n key: \"buffering\",\n get: function get() {\n return this._isBuffering;\n }\n }, {\n key: \"isLive\",\n get: function get() {\n return this.getPlaybackType() === Playback.LIVE;\n }\n }, {\n key: \"dvrEnabled\",\n get: function get() {\n return this.getDuration() >= this._minDvrSize && this.isLive;\n }\n }, {\n key: \"minimumDVRSizeConfig\",\n get: function get() {\n return this.options.playback && this.options.playback.minimumDvrSize;\n }\n }, {\n key: \"isValidMinimumDVRSizeConfig\",\n get: function get() {\n return typeof this.minimumDVRSizeConfig !== 'undefined' && typeof this.minimumDVRSizeConfig === 'number';\n }\n }]);\n\n function HTML5Video() {\n var _this;\n\n _classCallCheck(this, HTML5Video);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n _this._destroyed = false;\n _this._loadStarted = false;\n _this._isBuffering = false;\n _this._playheadMoving = false;\n _this._playheadMovingTimer = null;\n _this._stopped = false;\n _this._ccTrackId = -1;\n\n _this._setupSrc(_this.options.src); // backwards compatibility (TODO: remove on 0.3.0)\n\n\n _this.options.playback || (_this.options.playback = _this.options || {});\n _this.options.playback.disableContextMenu = _this.options.playback.disableContextMenu || _this.options.disableVideoTagContextMenu;\n _this._minDvrSize = _this.isValidMinimumDVRSizeConfig ? _this.minimumDVRSizeConfig : 60;\n var playbackConfig = _this.options.playback;\n var preload = playbackConfig.preload || (Browser.isSafari ? 'auto' : _this.options.preload);\n var posterUrl; // FIXME: poster plugin should always convert poster to object with expected properties ?\n\n if (_this.options.poster) {\n if (typeof _this.options.poster === 'string') posterUrl = _this.options.poster;else if (typeof _this.options.poster.url === 'string') posterUrl = _this.options.poster.url;\n }\n\n zepto.extend(true, _this.el, {\n muted: _this.options.mute,\n defaultMuted: _this.options.mute,\n loop: _this.options.loop,\n poster: posterUrl,\n preload: preload || 'metadata',\n crossOrigin: playbackConfig.crossOrigin,\n 'x-webkit-playsinline': playbackConfig.playInline\n });\n if (playbackConfig.controls || _this.options.useVideoTagDefaultControls) _this.$el.attr('controls', '');\n playbackConfig.playInline && _this.$el.attr({\n playsinline: 'playsinline'\n });\n playbackConfig.crossOrigin && _this.$el.attr({\n crossorigin: playbackConfig.crossOrigin\n }); // TODO should settings be private?\n\n _this.settings = {\n \"default\": ['seekbar']\n };\n _this.settings.left = ['playpause', 'position', 'duration'];\n _this.settings.right = ['fullscreen', 'volume', 'hd-indicator'];\n playbackConfig.externalTracks && _this._setupExternalTracks(playbackConfig.externalTracks);\n _this.options.autoPlay && _this.attemptAutoPlay();\n return _this;\n }\n\n _createClass(HTML5Video, [{\n key: \"configure\",\n value: function configure(options) {\n _get(_getPrototypeOf(HTML5Video.prototype), \"configure\", this).call(this, options);\n\n this.el.loop = !!options.loop;\n } // See Playback.attemptAutoPlay()\n\n }, {\n key: \"attemptAutoPlay\",\n value: function attemptAutoPlay() {\n var _this2 = this;\n\n this.canAutoPlay(function (result, error) {\n error && Log.warn(_this2.name, 'autoplay error.', {\n result: result,\n error: error\n }); // https://github.com/clappr/clappr/issues/1076\n\n result && setTimeout(function () {\n return !_this2._destroyed && _this2.play();\n }, 0);\n });\n } // See Playback.canAutoPlay()\n\n }, {\n key: \"canAutoPlay\",\n value: function canAutoPlay(cb) {\n if (this.options.disableCanAutoPlay) {\n cb(true, null);\n return;\n }\n\n var opts = {\n timeout: this.options.autoPlayTimeout || 500,\n inline: this.options.playback.playInline || false,\n muted: this.options.mute || false // Known issue: mediacontrols may asynchronously mute video\n\n }; // Use current video element if recycling feature enabled with mobile devices\n\n if (Browser.isMobile && DomRecycler.options.recycleVideo) opts.element = this.el; // Desktop browser autoplay policy may require user action\n // Mobile browser autoplay require user consent and video recycling feature enabled\n // It may returns a false positive with source-less player consent\n\n canAutoPlayMedia(cb, opts);\n }\n }, {\n key: \"_setupExternalTracks\",\n value: function _setupExternalTracks(tracks) {\n this._externalTracks = tracks.map(function (track) {\n return {\n kind: track.kind || 'subtitles',\n // Default is 'subtitles'\n label: track.label,\n lang: track.lang,\n src: track.src\n };\n });\n }\n /**\n * Sets the source url on the