{"version":3,"file":"bundle.js","sources":["../../node_modules/vue/dist/vue.common.js","../../node_modules/vue-router/lib/dsl.js","../../node_modules/vue-router/lib/route-recognizer.js","../../node_modules/vue-router/src/util.js","../../node_modules/vue-router/src/override.js","../../node_modules/vue-router/src/route.js","../../node_modules/vue-router/src/pipeline.js","../../node_modules/vue-router/src/transition.js","../../node_modules/vue-router/src/directives/view.js","../../node_modules/vue-router/src/directives/link.js","../../node_modules/vue-router/src/history/abstract.js","../../node_modules/vue-router/src/history/hash.js","../../node_modules/vue-router/src/history/html5.js","../../node_modules/vue-router/src/index.js","../../js/data/pointclouds.js","../../js/data/content.js","../../js/data/downloads.js","../../js/pictureRoom/js/collections/pictureCollection.js","../../js/pictureRoom/js/collections/pictureRoomData.js","../../js/DrawingOffice/js/collections/pictureCollection.js","../../js/DrawingOffice/js/collections/pictureRoomData.js","../../js/data/core.js","../../js/components/help.js","../../js/components/Entrance.js","../../js/components/SpinLoader.js","../../js/components/PoiInspector.js","../../js/components/Carousel.js","../../js/components/ViewAbout.js","../../node_modules/viewerjs/dist/viewer.js","../../js/components/ViewFinder.js","../../js/components/ModelInspector.js","../../js/libs/velo.js","../../js/libs/potree.js","../../js/components/PotreeViewer2.js","../../js/data/tracking.js","../../js/components/TargetPoint.js","../../js/components/Room.js","../../js/pictureRoom/js/utils/config.js","../../js/pictureRoom/js/framework/eventControls.js","../../js/pictureRoom/js/collections/pictureData.js","../../js/pictureRoom/js/utils/tweens.js","../../js/pictureRoom/js/factory/modelFactory.js","../../js/pictureRoom/js/factory/modelLoader.js","../../js/pictureRoom/js/framework/index.js","../../js/pictureRoom/js/utils/compass.js","../../js/pictureRoom/js/render.js","../../js/pictureRoom/js/controllers/tourController.js","../../js/pictureRoom/js/controllers/panelController.js","../../js/pictureRoom/js/controllers/testController.js","../../js/pictureRoom/js/controllers/stateControllers.js","../../js/pictureRoom/js/controllers/index.js","../../js/pictureRoom/js/main.js","../../js/components/TourCarousel.js","../../js/components/ViewTour.js","../../js/components/PictureRoomInspector.js","../../js/components/ViewPicture.js","../../js/components/ViewMagnify.js","../../js/components/PictureInspector.js","../../js/components/notice.js","../../js/components/PictureRoom.js","../../js/DrawingOffice/js/utils/config.js","../../js/DrawingOffice/js/utils/tweens.js","../../js/DrawingOffice/js/framework/eventControls.js","../../js/DrawingOffice/js/collections/pictureData.js","../../js/DrawingOffice/js/factory/modelFactory.js","../../js/DrawingOffice/js/factory/modelLoader.js","../../js/DrawingOffice/js/framework/index.js","../../js/DrawingOffice/js/utils/compass.js","../../js/DrawingOffice/js/render.js","../../js/DrawingOffice/js/controllers/tourController.js","../../js/DrawingOffice/js/controllers/testController.js","../../js/DrawingOffice/js/controllers/stateControllers.js","../../js/DrawingOffice/js/controllers/index.js","../../js/DrawingOffice/js/main.js","../../js/drawingOffice/js/collections/pictureRoomData.js","../../js/components/DrawingOfficeTourCarousel.js","../../js/components/ViewTourDrawingOffice.js","../../js/components/DrawingOfficeInspector.js","../../js/components/ViewDrawing.js","../../js/components/DrawingInspector.js","../../js/components/DrawingOffice.js","../../js/components/AboutPage.js","../../js/components/DownloadPage.js","../../js/components/DrawerInspector.js","../../js/router-map.js","../../node_modules/global/window.js","../../node_modules/dom-walk/index.js","../../node_modules/min-document/dom-comment.js","../../node_modules/min-document/dom-text.js","../../node_modules/min-document/event/dispatch-event.js","../../node_modules/min-document/event/add-event-listener.js","../../node_modules/min-document/event/remove-event-listener.js","../../node_modules/min-document/serialize.js","../../node_modules/min-document/dom-element.js","../../node_modules/min-document/dom-fragment.js","../../node_modules/min-document/event.js","../../node_modules/min-document/document.js","../../node_modules/min-document/index.js","../../node_modules/global/document.js","../../node_modules/video.js/es5/utils/guid.js","../../node_modules/video.js/es5/utils/obj.js","../../node_modules/video.js/es5/utils/log.js","../../node_modules/tsml/tsml.js","../../node_modules/video.js/es5/utils/dom.js","../../node_modules/video.js/es5/utils/browser.js","../../node_modules/video.js/es5/utils/events.js","../../node_modules/video.js/es5/setup.js","../../node_modules/video.js/es5/utils/stylesheet.js","../../node_modules/video.js/es5/utils/fn.js","../../node_modules/video.js/es5/utils/to-title-case.js","../../node_modules/video.js/es5/utils/merge-options.js","../../node_modules/video.js/es5/component.js","../../node_modules/video.js/es5/event-target.js","../../node_modules/video.js/es5/utils/time-ranges.js","../../node_modules/video.js/es5/utils/buffer.js","../../node_modules/video.js/es5/fullscreen-api.js","../../node_modules/video.js/es5/media-error.js","../../node_modules/safe-json-parse/tuple.js","../../node_modules/video.js/es5/tracks/text-track-list-converter.js","../../node_modules/video.js/es5/modal-dialog.js","../../node_modules/video.js/es5/tracks/text-track-cue-list.js","../../node_modules/video.js/es5/tracks/track-enums.js","../../node_modules/video.js/es5/tracks/track.js","../../node_modules/video.js/es5/utils/url.js","../../node_modules/is-function/index.js","../../node_modules/parse-headers/parse-headers.js","../../node_modules/xtend/immutable.js","../../node_modules/xhr/index.js","../../node_modules/video.js/es5/tracks/text-track.js","../../node_modules/video.js/es5/tracks/html-track-element.js","../../node_modules/video.js/es5/tracks/html-track-element-list.js","../../node_modules/video.js/es5/tracks/track-list.js","../../node_modules/video.js/es5/tracks/text-track-list.js","../../node_modules/video.js/es5/tracks/video-track-list.js","../../node_modules/video.js/es5/tracks/audio-track-list.js","../../node_modules/videojs-vtt.js/node_modules/global/window.js","../../node_modules/videojs-vtt.js/lib/vtt.js","../../node_modules/videojs-vtt.js/lib/vttcue.js","../../node_modules/videojs-vtt.js/lib/vttregion.js","../../node_modules/videojs-vtt.js/lib/browser-index.js","../../node_modules/video.js/es5/tech/tech.js","../../node_modules/video.js/es5/tech/loader.js","../../node_modules/video.js/es5/tech/flash-rtmp.js","../../node_modules/video.js/es5/tech/flash.js","../../node_modules/video.js/es5/clickable-component.js","../../node_modules/video.js/es5/poster-image.js","../../node_modules/video.js/es5/tracks/text-track-display.js","../../node_modules/video.js/es5/loading-spinner.js","../../node_modules/video.js/es5/button.js","../../node_modules/video.js/es5/big-play-button.js","../../node_modules/video.js/es5/close-button.js","../../node_modules/video.js/es5/control-bar/play-toggle.js","../../node_modules/video.js/es5/utils/format-time.js","../../node_modules/video.js/es5/control-bar/time-controls/current-time-display.js","../../node_modules/video.js/es5/control-bar/time-controls/duration-display.js","../../node_modules/video.js/es5/control-bar/time-controls/time-divider.js","../../node_modules/video.js/es5/control-bar/time-controls/remaining-time-display.js","../../node_modules/video.js/es5/control-bar/live-display.js","../../node_modules/video.js/es5/slider/slider.js","../../node_modules/video.js/es5/utils/computed-style.js","../../node_modules/video.js/es5/control-bar/progress-control/load-progress-bar.js","../../node_modules/video.js/es5/control-bar/progress-control/play-progress-bar.js","../../node_modules/video.js/es5/control-bar/progress-control/tooltip-progress-bar.js","../../node_modules/video.js/es5/control-bar/progress-control/seek-bar.js","../../node_modules/video.js/es5/control-bar/progress-control/mouse-time-display.js","../../node_modules/video.js/es5/control-bar/progress-control/progress-control.js","../../node_modules/video.js/es5/control-bar/fullscreen-toggle.js","../../node_modules/video.js/es5/control-bar/volume-control/volume-level.js","../../node_modules/video.js/es5/control-bar/volume-control/volume-bar.js","../../node_modules/video.js/es5/control-bar/volume-control/volume-control.js","../../node_modules/video.js/es5/popup/popup.js","../../node_modules/video.js/es5/popup/popup-button.js","../../node_modules/video.js/es5/control-bar/mute-toggle.js","../../node_modules/video.js/es5/control-bar/volume-menu-button.js","../../node_modules/video.js/es5/menu/menu.js","../../node_modules/video.js/es5/menu/menu-button.js","../../node_modules/video.js/es5/control-bar/track-button.js","../../node_modules/video.js/es5/menu/menu-item.js","../../node_modules/video.js/es5/control-bar/text-track-controls/text-track-menu-item.js","../../node_modules/video.js/es5/control-bar/text-track-controls/off-text-track-menu-item.js","../../node_modules/video.js/es5/control-bar/text-track-controls/text-track-button.js","../../node_modules/video.js/es5/control-bar/text-track-controls/chapters-track-menu-item.js","../../node_modules/video.js/es5/control-bar/text-track-controls/chapters-button.js","../../node_modules/video.js/es5/control-bar/text-track-controls/descriptions-button.js","../../node_modules/video.js/es5/control-bar/text-track-controls/subtitles-button.js","../../node_modules/video.js/es5/control-bar/text-track-controls/caption-settings-menu-item.js","../../node_modules/video.js/es5/control-bar/text-track-controls/captions-button.js","../../node_modules/video.js/es5/control-bar/audio-track-controls/audio-track-menu-item.js","../../node_modules/video.js/es5/control-bar/audio-track-controls/audio-track-button.js","../../node_modules/video.js/es5/control-bar/playback-rate-menu/playback-rate-menu-item.js","../../node_modules/video.js/es5/control-bar/playback-rate-menu/playback-rate-menu-button.js","../../node_modules/video.js/es5/control-bar/spacer-controls/spacer.js","../../node_modules/video.js/es5/control-bar/spacer-controls/custom-control-spacer.js","../../node_modules/video.js/es5/control-bar/control-bar.js","../../node_modules/video.js/es5/error-display.js","../../node_modules/video.js/es5/tracks/text-track-settings.js","../../node_modules/video.js/es5/tech/html5.js","../../node_modules/video.js/es5/player.js","../../node_modules/video.js/es5/plugins.js","../../node_modules/video.js/es5/tracks/audio-track.js","../../node_modules/video.js/es5/tracks/video-track.js","../../node_modules/video.js/es5/extend.js","../../node_modules/video.js/es5/video.js","../../js/components/Player.js","../../js/components/VideoPlayers.js","../../node_modules/screenfull/dist/screenfull.js","../../js/components/UiView.js","../../js/data/video.js","../../js/components/Root.js","../../js/directives/backgroundImage.js","../../js/main.js"],"sourcesContent":["/*!\n * Vue.js v1.0.28\n * (c) 2016 Evan You\n * Released under the MIT License.\n */\n'use strict';\n\nfunction set(obj, key, val) {\n if (hasOwn(obj, key)) {\n obj[key] = val;\n return;\n }\n if (obj._isVue) {\n set(obj._data, key, val);\n return;\n }\n var ob = obj.__ob__;\n if (!ob) {\n obj[key] = val;\n return;\n }\n ob.convert(key, val);\n ob.dep.notify();\n if (ob.vms) {\n var i = ob.vms.length;\n while (i--) {\n var vm = ob.vms[i];\n vm._proxy(key);\n vm._digest();\n }\n }\n return val;\n}\n\n/**\n * Delete a property and trigger change if necessary.\n *\n * @param {Object} obj\n * @param {String} key\n */\n\nfunction del(obj, key) {\n if (!hasOwn(obj, key)) {\n return;\n }\n delete obj[key];\n var ob = obj.__ob__;\n if (!ob) {\n if (obj._isVue) {\n delete obj._data[key];\n obj._digest();\n }\n return;\n }\n ob.dep.notify();\n if (ob.vms) {\n var i = ob.vms.length;\n while (i--) {\n var vm = ob.vms[i];\n vm._unproxy(key);\n vm._digest();\n }\n }\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * Check whether the object has the property.\n *\n * @param {Object} obj\n * @param {String} key\n * @return {Boolean}\n */\n\nfunction hasOwn(obj, key) {\n return hasOwnProperty.call(obj, key);\n}\n\n/**\n * Check if an expression is a literal value.\n *\n * @param {String} exp\n * @return {Boolean}\n */\n\nvar literalValueRE = /^\\s?(true|false|-?[\\d\\.]+|'[^']*'|\"[^\"]*\")\\s?$/;\n\nfunction isLiteral(exp) {\n return literalValueRE.test(exp);\n}\n\n/**\n * Check if a string starts with $ or _\n *\n * @param {String} str\n * @return {Boolean}\n */\n\nfunction isReserved(str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F;\n}\n\n/**\n * Guard text output, make sure undefined outputs\n * empty string\n *\n * @param {*} value\n * @return {String}\n */\n\nfunction _toString(value) {\n return value == null ? '' : value.toString();\n}\n\n/**\n * Check and convert possible numeric strings to numbers\n * before setting back to data\n *\n * @param {*} value\n * @return {*|Number}\n */\n\nfunction toNumber(value) {\n if (typeof value !== 'string') {\n return value;\n } else {\n var parsed = Number(value);\n return isNaN(parsed) ? value : parsed;\n }\n}\n\n/**\n * Convert string boolean literals into real booleans.\n *\n * @param {*} value\n * @return {*|Boolean}\n */\n\nfunction toBoolean(value) {\n return value === 'true' ? true : value === 'false' ? false : value;\n}\n\n/**\n * Strip quotes from a string\n *\n * @param {String} str\n * @return {String | false}\n */\n\nfunction stripQuotes(str) {\n var a = str.charCodeAt(0);\n var b = str.charCodeAt(str.length - 1);\n return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str;\n}\n\n/**\n * Camelize a hyphen-delimited string.\n *\n * @param {String} str\n * @return {String}\n */\n\nvar camelizeRE = /-(\\w)/g;\n\nfunction camelize(str) {\n return str.replace(camelizeRE, toUpper);\n}\n\nfunction toUpper(_, c) {\n return c ? c.toUpperCase() : '';\n}\n\n/**\n * Hyphenate a camelCase string.\n *\n * @param {String} str\n * @return {String}\n */\n\nvar hyphenateRE = /([^-])([A-Z])/g;\n\nfunction hyphenate(str) {\n return str.replace(hyphenateRE, '$1-$2').replace(hyphenateRE, '$1-$2').toLowerCase();\n}\n\n/**\n * Converts hyphen/underscore/slash delimitered names into\n * camelized classNames.\n *\n * e.g. my-component => MyComponent\n * some_else => SomeElse\n * some/comp => SomeComp\n *\n * @param {String} str\n * @return {String}\n */\n\nvar classifyRE = /(?:^|[-_\\/])(\\w)/g;\n\nfunction classify(str) {\n return str.replace(classifyRE, toUpper);\n}\n\n/**\n * Simple bind, faster than native\n *\n * @param {Function} fn\n * @param {Object} ctx\n * @return {Function}\n */\n\nfunction bind(fn, ctx) {\n return function (a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n };\n}\n\n/**\n * Convert an Array-like object to a real Array.\n *\n * @param {Array-like} list\n * @param {Number} [start] - start index\n * @return {Array}\n */\n\nfunction toArray(list, start) {\n start = start || 0;\n var i = list.length - start;\n var ret = new Array(i);\n while (i--) {\n ret[i] = list[i + start];\n }\n return ret;\n}\n\n/**\n * Mix properties into target object.\n *\n * @param {Object} to\n * @param {Object} from\n */\n\nfunction extend(to, from) {\n var keys = Object.keys(from);\n var i = keys.length;\n while (i--) {\n to[keys[i]] = from[keys[i]];\n }\n return to;\n}\n\n/**\n * Quick object check - this is primarily used to tell\n * Objects from primitive values when we know the value\n * is a JSON-compliant type.\n *\n * @param {*} obj\n * @return {Boolean}\n */\n\nfunction isObject(obj) {\n return obj !== null && typeof obj === 'object';\n}\n\n/**\n * Strict object type check. Only returns true\n * for plain JavaScript objects.\n *\n * @param {*} obj\n * @return {Boolean}\n */\n\nvar toString = Object.prototype.toString;\nvar OBJECT_STRING = '[object Object]';\n\nfunction isPlainObject(obj) {\n return toString.call(obj) === OBJECT_STRING;\n}\n\n/**\n * Array type check.\n *\n * @param {*} obj\n * @return {Boolean}\n */\n\nvar isArray = Array.isArray;\n\n/**\n * Define a property.\n *\n * @param {Object} obj\n * @param {String} key\n * @param {*} val\n * @param {Boolean} [enumerable]\n */\n\nfunction def(obj, key, val, enumerable) {\n Object.defineProperty(obj, key, {\n value: val,\n enumerable: !!enumerable,\n writable: true,\n configurable: true\n });\n}\n\n/**\n * Debounce a function so it only gets called after the\n * input stops arriving after the given wait period.\n *\n * @param {Function} func\n * @param {Number} wait\n * @return {Function} - the debounced function\n */\n\nfunction _debounce(func, wait) {\n var timeout, args, context, timestamp, result;\n var later = function later() {\n var last = Date.now() - timestamp;\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n }\n };\n return function () {\n context = this;\n args = arguments;\n timestamp = Date.now();\n if (!timeout) {\n timeout = setTimeout(later, wait);\n }\n return result;\n };\n}\n\n/**\n * Manual indexOf because it's slightly faster than\n * native.\n *\n * @param {Array} arr\n * @param {*} obj\n */\n\nfunction indexOf(arr, obj) {\n var i = arr.length;\n while (i--) {\n if (arr[i] === obj) return i;\n }\n return -1;\n}\n\n/**\n * Make a cancellable version of an async callback.\n *\n * @param {Function} fn\n * @return {Function}\n */\n\nfunction cancellable(fn) {\n var cb = function cb() {\n if (!cb.cancelled) {\n return fn.apply(this, arguments);\n }\n };\n cb.cancel = function () {\n cb.cancelled = true;\n };\n return cb;\n}\n\n/**\n * Check if two values are loosely equal - that is,\n * if they are plain objects, do they have the same shape?\n *\n * @param {*} a\n * @param {*} b\n * @return {Boolean}\n */\n\nfunction looseEqual(a, b) {\n /* eslint-disable eqeqeq */\n return a == b || (isObject(a) && isObject(b) ? JSON.stringify(a) === JSON.stringify(b) : false);\n /* eslint-enable eqeqeq */\n}\n\nvar hasProto = ('__proto__' in {});\n\n// Browser environment sniffing\nvar inBrowser = typeof window !== 'undefined' && Object.prototype.toString.call(window) !== '[object Object]';\n\n// detect devtools\nvar devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;\n\n// UA sniffing for working around browser-specific quirks\nvar UA = inBrowser && window.navigator.userAgent.toLowerCase();\nvar isIE = UA && UA.indexOf('trident') > 0;\nvar isIE9 = UA && UA.indexOf('msie 9.0') > 0;\nvar isAndroid = UA && UA.indexOf('android') > 0;\nvar isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);\n\nvar transitionProp = undefined;\nvar transitionEndEvent = undefined;\nvar animationProp = undefined;\nvar animationEndEvent = undefined;\n\n// Transition property/event sniffing\nif (inBrowser && !isIE9) {\n var isWebkitTrans = window.ontransitionend === undefined && window.onwebkittransitionend !== undefined;\n var isWebkitAnim = window.onanimationend === undefined && window.onwebkitanimationend !== undefined;\n transitionProp = isWebkitTrans ? 'WebkitTransition' : 'transition';\n transitionEndEvent = isWebkitTrans ? 'webkitTransitionEnd' : 'transitionend';\n animationProp = isWebkitAnim ? 'WebkitAnimation' : 'animation';\n animationEndEvent = isWebkitAnim ? 'webkitAnimationEnd' : 'animationend';\n}\n\n/* istanbul ignore next */\nfunction isNative(Ctor) {\n return (/native code/.test(Ctor.toString())\n );\n}\n\n/**\n * Defer a task to execute it asynchronously. Ideally this\n * should be executed as a microtask, so we leverage\n * MutationObserver if it's available, and fallback to\n * setTimeout(0).\n *\n * @param {Function} cb\n * @param {Object} ctx\n */\n\nvar nextTick = (function () {\n var callbacks = [];\n var pending = false;\n var timerFunc = undefined;\n\n function nextTickHandler() {\n pending = false;\n var copies = callbacks.slice(0);\n callbacks.length = 0;\n for (var i = 0; i < copies.length; i++) {\n copies[i]();\n }\n }\n\n // the nextTick behavior leverages the microtask queue, which can be accessed\n // via either native Promise.then or MutationObserver.\n // MutationObserver has wider support, however it is seriously bugged in\n // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It\n // completely stops working after triggering a few times... so, if native\n // Promise is available, we will use it:\n /* istanbul ignore if */\n if (typeof Promise !== 'undefined' && isNative(Promise)) {\n var p = Promise.resolve();\n var noop = function noop() {};\n timerFunc = function () {\n p.then(nextTickHandler);\n // in problematic UIWebViews, Promise.then doesn't completely break, but\n // it can get stuck in a weird state where callbacks are pushed into the\n // microtask queue but the queue isn't being flushed, until the browser\n // needs to do some other work, e.g. handle a timer. Therefore we can\n // \"force\" the microtask queue to be flushed by adding an empty timer.\n if (isIOS) setTimeout(noop);\n };\n } else if (typeof MutationObserver !== 'undefined') {\n // use MutationObserver where native Promise is not available,\n // e.g. IE11, iOS7, Android 4.4\n var counter = 1;\n var observer = new MutationObserver(nextTickHandler);\n var textNode = document.createTextNode(String(counter));\n observer.observe(textNode, {\n characterData: true\n });\n timerFunc = function () {\n counter = (counter + 1) % 2;\n textNode.data = String(counter);\n };\n } else {\n // fallback to setTimeout\n /* istanbul ignore next */\n timerFunc = setTimeout;\n }\n\n return function (cb, ctx) {\n var func = ctx ? function () {\n cb.call(ctx);\n } : cb;\n callbacks.push(func);\n if (pending) return;\n pending = true;\n timerFunc(nextTickHandler, 0);\n };\n})();\n\nvar _Set = undefined;\n/* istanbul ignore if */\nif (typeof Set !== 'undefined' && isNative(Set)) {\n // use native Set when available.\n _Set = Set;\n} else {\n // a non-standard Set polyfill that only works with primitive keys.\n _Set = function () {\n this.set = Object.create(null);\n };\n _Set.prototype.has = function (key) {\n return this.set[key] !== undefined;\n };\n _Set.prototype.add = function (key) {\n this.set[key] = 1;\n };\n _Set.prototype.clear = function () {\n this.set = Object.create(null);\n };\n}\n\nfunction Cache(limit) {\n this.size = 0;\n this.limit = limit;\n this.head = this.tail = undefined;\n this._keymap = Object.create(null);\n}\n\nvar p = Cache.prototype;\n\n/**\n * Put into the cache associated with .\n * Returns the entry which was removed to make room for\n * the new entry. Otherwise undefined is returned.\n * (i.e. if there was enough room already).\n *\n * @param {String} key\n * @param {*} value\n * @return {Entry|undefined}\n */\n\np.put = function (key, value) {\n var removed;\n\n var entry = this.get(key, true);\n if (!entry) {\n if (this.size === this.limit) {\n removed = this.shift();\n }\n entry = {\n key: key\n };\n this._keymap[key] = entry;\n if (this.tail) {\n this.tail.newer = entry;\n entry.older = this.tail;\n } else {\n this.head = entry;\n }\n this.tail = entry;\n this.size++;\n }\n entry.value = value;\n\n return removed;\n};\n\n/**\n * Purge the least recently used (oldest) entry from the\n * cache. Returns the removed entry or undefined if the\n * cache was empty.\n */\n\np.shift = function () {\n var entry = this.head;\n if (entry) {\n this.head = this.head.newer;\n this.head.older = undefined;\n entry.newer = entry.older = undefined;\n this._keymap[entry.key] = undefined;\n this.size--;\n }\n return entry;\n};\n\n/**\n * Get and register recent use of . Returns the value\n * associated with or undefined if not in cache.\n *\n * @param {String} key\n * @param {Boolean} returnEntry\n * @return {Entry|*}\n */\n\np.get = function (key, returnEntry) {\n var entry = this._keymap[key];\n if (entry === undefined) return;\n if (entry === this.tail) {\n return returnEntry ? entry : entry.value;\n }\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C E\n if (entry.newer) {\n if (entry === this.head) {\n this.head = entry.newer;\n }\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older) {\n entry.older.newer = entry.newer; // C. --> E\n }\n entry.newer = undefined; // D --x\n entry.older = this.tail; // D. --> E\n if (this.tail) {\n this.tail.newer = entry; // E. <-- D\n }\n this.tail = entry;\n return returnEntry ? entry : entry.value;\n};\n\nvar cache$1 = new Cache(1000);\nvar reservedArgRE = /^in$|^-?\\d+/;\n\n/**\n * Parser state\n */\n\nvar str;\nvar dir;\nvar len;\nvar index;\nvar chr;\nvar state;\nvar startState = 0;\nvar filterState = 1;\nvar filterNameState = 2;\nvar filterArgState = 3;\n\nvar doubleChr = 0x22;\nvar singleChr = 0x27;\nvar pipeChr = 0x7C;\nvar escapeChr = 0x5C;\nvar spaceChr = 0x20;\n\nvar expStartChr = { 0x5B: 1, 0x7B: 1, 0x28: 1 };\nvar expChrPair = { 0x5B: 0x5D, 0x7B: 0x7D, 0x28: 0x29 };\n\nfunction peek() {\n return str.charCodeAt(index + 1);\n}\n\nfunction next() {\n return str.charCodeAt(++index);\n}\n\nfunction eof() {\n return index >= len;\n}\n\nfunction eatSpace() {\n while (peek() === spaceChr) {\n next();\n }\n}\n\nfunction isStringStart(chr) {\n return chr === doubleChr || chr === singleChr;\n}\n\nfunction isExpStart(chr) {\n return expStartChr[chr];\n}\n\nfunction isExpEnd(start, chr) {\n return expChrPair[start] === chr;\n}\n\nfunction parseString() {\n var stringQuote = next();\n var chr;\n while (!eof()) {\n chr = next();\n // escape char\n if (chr === escapeChr) {\n next();\n } else if (chr === stringQuote) {\n break;\n }\n }\n}\n\nfunction parseSpecialExp(chr) {\n var inExp = 0;\n var startChr = chr;\n\n while (!eof()) {\n chr = peek();\n if (isStringStart(chr)) {\n parseString();\n continue;\n }\n\n if (startChr === chr) {\n inExp++;\n }\n if (isExpEnd(startChr, chr)) {\n inExp--;\n }\n\n next();\n\n if (inExp === 0) {\n break;\n }\n }\n}\n\n/**\n * syntax:\n * expression | filterName [arg arg [| filterName arg arg]]\n */\n\nfunction parseExpression() {\n var start = index;\n while (!eof()) {\n chr = peek();\n if (isStringStart(chr)) {\n parseString();\n } else if (isExpStart(chr)) {\n parseSpecialExp(chr);\n } else if (chr === pipeChr) {\n next();\n chr = peek();\n if (chr === pipeChr) {\n next();\n } else {\n if (state === startState || state === filterArgState) {\n state = filterState;\n }\n break;\n }\n } else if (chr === spaceChr && (state === filterNameState || state === filterArgState)) {\n eatSpace();\n break;\n } else {\n if (state === filterState) {\n state = filterNameState;\n }\n next();\n }\n }\n\n return str.slice(start + 1, index) || null;\n}\n\nfunction parseFilterList() {\n var filters = [];\n while (!eof()) {\n filters.push(parseFilter());\n }\n return filters;\n}\n\nfunction parseFilter() {\n var filter = {};\n var args;\n\n state = filterState;\n filter.name = parseExpression().trim();\n\n state = filterArgState;\n args = parseFilterArguments();\n\n if (args.length) {\n filter.args = args;\n }\n return filter;\n}\n\nfunction parseFilterArguments() {\n var args = [];\n while (!eof() && state !== filterState) {\n var arg = parseExpression();\n if (!arg) {\n break;\n }\n args.push(processFilterArg(arg));\n }\n\n return args;\n}\n\n/**\n * Check if an argument is dynamic and strip quotes.\n *\n * @param {String} arg\n * @return {Object}\n */\n\nfunction processFilterArg(arg) {\n if (reservedArgRE.test(arg)) {\n return {\n value: toNumber(arg),\n dynamic: false\n };\n } else {\n var stripped = stripQuotes(arg);\n var dynamic = stripped === arg;\n return {\n value: dynamic ? arg : stripped,\n dynamic: dynamic\n };\n }\n}\n\n/**\n * Parse a directive value and extract the expression\n * and its filters into a descriptor.\n *\n * Example:\n *\n * \"a + 1 | uppercase\" will yield:\n * {\n * expression: 'a + 1',\n * filters: [\n * { name: 'uppercase', args: null }\n * ]\n * }\n *\n * @param {String} s\n * @return {Object}\n */\n\nfunction parseDirective(s) {\n var hit = cache$1.get(s);\n if (hit) {\n return hit;\n }\n\n // reset parser state\n str = s;\n dir = {};\n len = str.length;\n index = -1;\n chr = '';\n state = startState;\n\n var filters;\n\n if (str.indexOf('|') < 0) {\n dir.expression = str.trim();\n } else {\n dir.expression = parseExpression().trim();\n filters = parseFilterList();\n if (filters.length) {\n dir.filters = filters;\n }\n }\n\n cache$1.put(s, dir);\n return dir;\n}\n\nvar directive = Object.freeze({\n parseDirective: parseDirective\n});\n\nvar regexEscapeRE = /[-.*+?^${}()|[\\]\\/\\\\]/g;\nvar cache = undefined;\nvar tagRE = undefined;\nvar htmlRE = undefined;\n/**\n * Escape a string so it can be used in a RegExp\n * constructor.\n *\n * @param {String} str\n */\n\nfunction escapeRegex(str) {\n return str.replace(regexEscapeRE, '\\\\$&');\n}\n\nfunction compileRegex() {\n var open = escapeRegex(config.delimiters[0]);\n var close = escapeRegex(config.delimiters[1]);\n var unsafeOpen = escapeRegex(config.unsafeDelimiters[0]);\n var unsafeClose = escapeRegex(config.unsafeDelimiters[1]);\n tagRE = new RegExp(unsafeOpen + '((?:.|\\\\n)+?)' + unsafeClose + '|' + open + '((?:.|\\\\n)+?)' + close, 'g');\n htmlRE = new RegExp('^' + unsafeOpen + '((?:.|\\\\n)+?)' + unsafeClose + '$');\n // reset cache\n cache = new Cache(1000);\n}\n\n/**\n * Parse a template text string into an array of tokens.\n *\n * @param {String} text\n * @return {Array | null}\n * - {String} type\n * - {String} value\n * - {Boolean} [html]\n * - {Boolean} [oneTime]\n */\n\nfunction parseText(text) {\n if (!cache) {\n compileRegex();\n }\n var hit = cache.get(text);\n if (hit) {\n return hit;\n }\n if (!tagRE.test(text)) {\n return null;\n }\n var tokens = [];\n var lastIndex = tagRE.lastIndex = 0;\n var match, index, html, value, first, oneTime;\n /* eslint-disable no-cond-assign */\n while (match = tagRE.exec(text)) {\n /* eslint-enable no-cond-assign */\n index = match.index;\n // push text token\n if (index > lastIndex) {\n tokens.push({\n value: text.slice(lastIndex, index)\n });\n }\n // tag token\n html = htmlRE.test(match[0]);\n value = html ? match[1] : match[2];\n first = value.charCodeAt(0);\n oneTime = first === 42; // *\n value = oneTime ? value.slice(1) : value;\n tokens.push({\n tag: true,\n value: value.trim(),\n html: html,\n oneTime: oneTime\n });\n lastIndex = index + match[0].length;\n }\n if (lastIndex < text.length) {\n tokens.push({\n value: text.slice(lastIndex)\n });\n }\n cache.put(text, tokens);\n return tokens;\n}\n\n/**\n * Format a list of tokens into an expression.\n * e.g. tokens parsed from 'a {{b}} c' can be serialized\n * into one single expression as '\"a \" + b + \" c\"'.\n *\n * @param {Array} tokens\n * @param {Vue} [vm]\n * @return {String}\n */\n\nfunction tokensToExp(tokens, vm) {\n if (tokens.length > 1) {\n return tokens.map(function (token) {\n return formatToken(token, vm);\n }).join('+');\n } else {\n return formatToken(tokens[0], vm, true);\n }\n}\n\n/**\n * Format a single token.\n *\n * @param {Object} token\n * @param {Vue} [vm]\n * @param {Boolean} [single]\n * @return {String}\n */\n\nfunction formatToken(token, vm, single) {\n return token.tag ? token.oneTime && vm ? '\"' + vm.$eval(token.value) + '\"' : inlineFilters(token.value, single) : '\"' + token.value + '\"';\n}\n\n/**\n * For an attribute with multiple interpolation tags,\n * e.g. attr=\"some-{{thing | filter}}\", in order to combine\n * the whole thing into a single watchable expression, we\n * have to inline those filters. This function does exactly\n * that. This is a bit hacky but it avoids heavy changes\n * to directive parser and watcher mechanism.\n *\n * @param {String} exp\n * @param {Boolean} single\n * @return {String}\n */\n\nvar filterRE = /[^|]\\|[^|]/;\nfunction inlineFilters(exp, single) {\n if (!filterRE.test(exp)) {\n return single ? exp : '(' + exp + ')';\n } else {\n var dir = parseDirective(exp);\n if (!dir.filters) {\n return '(' + exp + ')';\n } else {\n return 'this._applyFilters(' + dir.expression + // value\n ',null,' + // oldValue (null for read)\n JSON.stringify(dir.filters) + // filter descriptors\n ',false)'; // write?\n }\n }\n}\n\nvar text = Object.freeze({\n compileRegex: compileRegex,\n parseText: parseText,\n tokensToExp: tokensToExp\n});\n\nvar delimiters = ['{{', '}}'];\nvar unsafeDelimiters = ['{{{', '}}}'];\n\nvar config = Object.defineProperties({\n\n /**\n * Whether to print debug messages.\n * Also enables stack trace for warnings.\n *\n * @type {Boolean}\n */\n\n debug: false,\n\n /**\n * Whether to suppress warnings.\n *\n * @type {Boolean}\n */\n\n silent: false,\n\n /**\n * Whether to use async rendering.\n */\n\n async: true,\n\n /**\n * Whether to warn against errors caught when evaluating\n * expressions.\n */\n\n warnExpressionErrors: true,\n\n /**\n * Whether to allow devtools inspection.\n * Disabled by default in production builds.\n */\n\n devtools: process.env.NODE_ENV !== 'production',\n\n /**\n * Internal flag to indicate the delimiters have been\n * changed.\n *\n * @type {Boolean}\n */\n\n _delimitersChanged: true,\n\n /**\n * List of asset types that a component can own.\n *\n * @type {Array}\n */\n\n _assetTypes: ['component', 'directive', 'elementDirective', 'filter', 'transition', 'partial'],\n\n /**\n * prop binding modes\n */\n\n _propBindingModes: {\n ONE_WAY: 0,\n TWO_WAY: 1,\n ONE_TIME: 2\n },\n\n /**\n * Max circular updates allowed in a batcher flush cycle.\n */\n\n _maxUpdateCount: 100\n\n}, {\n delimiters: { /**\n * Interpolation delimiters. Changing these would trigger\n * the text parser to re-compile the regular expressions.\n *\n * @type {Array}\n */\n\n get: function get() {\n return delimiters;\n },\n set: function set(val) {\n delimiters = val;\n compileRegex();\n },\n configurable: true,\n enumerable: true\n },\n unsafeDelimiters: {\n get: function get() {\n return unsafeDelimiters;\n },\n set: function set(val) {\n unsafeDelimiters = val;\n compileRegex();\n },\n configurable: true,\n enumerable: true\n }\n});\n\nvar warn = undefined;\nvar formatComponentName = undefined;\n\nif (process.env.NODE_ENV !== 'production') {\n (function () {\n var hasConsole = typeof console !== 'undefined';\n\n warn = function (msg, vm) {\n if (hasConsole && !config.silent) {\n console.error('[Vue warn]: ' + msg + (vm ? formatComponentName(vm) : ''));\n }\n };\n\n formatComponentName = function (vm) {\n var name = vm._isVue ? vm.$options.name : vm.name;\n return name ? ' (found in component: <' + hyphenate(name) + '>)' : '';\n };\n })();\n}\n\n/**\n * Append with transition.\n *\n * @param {Element} el\n * @param {Element} target\n * @param {Vue} vm\n * @param {Function} [cb]\n */\n\nfunction appendWithTransition(el, target, vm, cb) {\n applyTransition(el, 1, function () {\n target.appendChild(el);\n }, vm, cb);\n}\n\n/**\n * InsertBefore with transition.\n *\n * @param {Element} el\n * @param {Element} target\n * @param {Vue} vm\n * @param {Function} [cb]\n */\n\nfunction beforeWithTransition(el, target, vm, cb) {\n applyTransition(el, 1, function () {\n before(el, target);\n }, vm, cb);\n}\n\n/**\n * Remove with transition.\n *\n * @param {Element} el\n * @param {Vue} vm\n * @param {Function} [cb]\n */\n\nfunction removeWithTransition(el, vm, cb) {\n applyTransition(el, -1, function () {\n remove(el);\n }, vm, cb);\n}\n\n/**\n * Apply transitions with an operation callback.\n *\n * @param {Element} el\n * @param {Number} direction\n * 1: enter\n * -1: leave\n * @param {Function} op - the actual DOM operation\n * @param {Vue} vm\n * @param {Function} [cb]\n */\n\nfunction applyTransition(el, direction, op, vm, cb) {\n var transition = el.__v_trans;\n if (!transition ||\n // skip if there are no js hooks and CSS transition is\n // not supported\n !transition.hooks && !transitionEndEvent ||\n // skip transitions for initial compile\n !vm._isCompiled ||\n // if the vm is being manipulated by a parent directive\n // during the parent's compilation phase, skip the\n // animation.\n vm.$parent && !vm.$parent._isCompiled) {\n op();\n if (cb) cb();\n return;\n }\n var action = direction > 0 ? 'enter' : 'leave';\n transition[action](op, cb);\n}\n\nvar transition = Object.freeze({\n appendWithTransition: appendWithTransition,\n beforeWithTransition: beforeWithTransition,\n removeWithTransition: removeWithTransition,\n applyTransition: applyTransition\n});\n\n/**\n * Query an element selector if it's not an element already.\n *\n * @param {String|Element} el\n * @return {Element}\n */\n\nfunction query(el) {\n if (typeof el === 'string') {\n var selector = el;\n el = document.querySelector(el);\n if (!el) {\n process.env.NODE_ENV !== 'production' && warn('Cannot find element: ' + selector);\n }\n }\n return el;\n}\n\n/**\n * Check if a node is in the document.\n * Note: document.documentElement.contains should work here\n * but always returns false for comment nodes in phantomjs,\n * making unit tests difficult. This is fixed by doing the\n * contains() check on the node's parentNode instead of\n * the node itself.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\nfunction inDoc(node) {\n if (!node) return false;\n var doc = node.ownerDocument.documentElement;\n var parent = node.parentNode;\n return doc === node || doc === parent || !!(parent && parent.nodeType === 1 && doc.contains(parent));\n}\n\n/**\n * Get and remove an attribute from a node.\n *\n * @param {Node} node\n * @param {String} _attr\n */\n\nfunction getAttr(node, _attr) {\n var val = node.getAttribute(_attr);\n if (val !== null) {\n node.removeAttribute(_attr);\n }\n return val;\n}\n\n/**\n * Get an attribute with colon or v-bind: prefix.\n *\n * @param {Node} node\n * @param {String} name\n * @return {String|null}\n */\n\nfunction getBindAttr(node, name) {\n var val = getAttr(node, ':' + name);\n if (val === null) {\n val = getAttr(node, 'v-bind:' + name);\n }\n return val;\n}\n\n/**\n * Check the presence of a bind attribute.\n *\n * @param {Node} node\n * @param {String} name\n * @return {Boolean}\n */\n\nfunction hasBindAttr(node, name) {\n return node.hasAttribute(name) || node.hasAttribute(':' + name) || node.hasAttribute('v-bind:' + name);\n}\n\n/**\n * Insert el before target\n *\n * @param {Element} el\n * @param {Element} target\n */\n\nfunction before(el, target) {\n target.parentNode.insertBefore(el, target);\n}\n\n/**\n * Insert el after target\n *\n * @param {Element} el\n * @param {Element} target\n */\n\nfunction after(el, target) {\n if (target.nextSibling) {\n before(el, target.nextSibling);\n } else {\n target.parentNode.appendChild(el);\n }\n}\n\n/**\n * Remove el from DOM\n *\n * @param {Element} el\n */\n\nfunction remove(el) {\n el.parentNode.removeChild(el);\n}\n\n/**\n * Prepend el to target\n *\n * @param {Element} el\n * @param {Element} target\n */\n\nfunction prepend(el, target) {\n if (target.firstChild) {\n before(el, target.firstChild);\n } else {\n target.appendChild(el);\n }\n}\n\n/**\n * Replace target with el\n *\n * @param {Element} target\n * @param {Element} el\n */\n\nfunction replace(target, el) {\n var parent = target.parentNode;\n if (parent) {\n parent.replaceChild(el, target);\n }\n}\n\n/**\n * Add event listener shorthand.\n *\n * @param {Element} el\n * @param {String} event\n * @param {Function} cb\n * @param {Boolean} [useCapture]\n */\n\nfunction on(el, event, cb, useCapture) {\n el.addEventListener(event, cb, useCapture);\n}\n\n/**\n * Remove event listener shorthand.\n *\n * @param {Element} el\n * @param {String} event\n * @param {Function} cb\n */\n\nfunction off(el, event, cb) {\n el.removeEventListener(event, cb);\n}\n\n/**\n * For IE9 compat: when both class and :class are present\n * getAttribute('class') returns wrong value...\n *\n * @param {Element} el\n * @return {String}\n */\n\nfunction getClass(el) {\n var classname = el.className;\n if (typeof classname === 'object') {\n classname = classname.baseVal || '';\n }\n return classname;\n}\n\n/**\n * In IE9, setAttribute('class') will result in empty class\n * if the element also has the :class attribute; However in\n * PhantomJS, setting `className` does not work on SVG elements...\n * So we have to do a conditional check here.\n *\n * @param {Element} el\n * @param {String} cls\n */\n\nfunction setClass(el, cls) {\n /* istanbul ignore if */\n if (isIE9 && !/svg$/.test(el.namespaceURI)) {\n el.className = cls;\n } else {\n el.setAttribute('class', cls);\n }\n}\n\n/**\n * Add class with compatibility for IE & SVG\n *\n * @param {Element} el\n * @param {String} cls\n */\n\nfunction addClass(el, cls) {\n if (el.classList) {\n el.classList.add(cls);\n } else {\n var cur = ' ' + getClass(el) + ' ';\n if (cur.indexOf(' ' + cls + ' ') < 0) {\n setClass(el, (cur + cls).trim());\n }\n }\n}\n\n/**\n * Remove class with compatibility for IE & SVG\n *\n * @param {Element} el\n * @param {String} cls\n */\n\nfunction removeClass(el, cls) {\n if (el.classList) {\n el.classList.remove(cls);\n } else {\n var cur = ' ' + getClass(el) + ' ';\n var tar = ' ' + cls + ' ';\n while (cur.indexOf(tar) >= 0) {\n cur = cur.replace(tar, ' ');\n }\n setClass(el, cur.trim());\n }\n if (!el.className) {\n el.removeAttribute('class');\n }\n}\n\n/**\n * Extract raw content inside an element into a temporary\n * container div\n *\n * @param {Element} el\n * @param {Boolean} asFragment\n * @return {Element|DocumentFragment}\n */\n\nfunction extractContent(el, asFragment) {\n var child;\n var rawContent;\n /* istanbul ignore if */\n if (isTemplate(el) && isFragment(el.content)) {\n el = el.content;\n }\n if (el.hasChildNodes()) {\n trimNode(el);\n rawContent = asFragment ? document.createDocumentFragment() : document.createElement('div');\n /* eslint-disable no-cond-assign */\n while (child = el.firstChild) {\n /* eslint-enable no-cond-assign */\n rawContent.appendChild(child);\n }\n }\n return rawContent;\n}\n\n/**\n * Trim possible empty head/tail text and comment\n * nodes inside a parent.\n *\n * @param {Node} node\n */\n\nfunction trimNode(node) {\n var child;\n /* eslint-disable no-sequences */\n while ((child = node.firstChild, isTrimmable(child))) {\n node.removeChild(child);\n }\n while ((child = node.lastChild, isTrimmable(child))) {\n node.removeChild(child);\n }\n /* eslint-enable no-sequences */\n}\n\nfunction isTrimmable(node) {\n return node && (node.nodeType === 3 && !node.data.trim() || node.nodeType === 8);\n}\n\n/**\n * Check if an element is a template tag.\n * Note if the template appears inside an SVG its tagName\n * will be in lowercase.\n *\n * @param {Element} el\n */\n\nfunction isTemplate(el) {\n return el.tagName && el.tagName.toLowerCase() === 'template';\n}\n\n/**\n * Create an \"anchor\" for performing dom insertion/removals.\n * This is used in a number of scenarios:\n * - fragment instance\n * - v-html\n * - v-if\n * - v-for\n * - component\n *\n * @param {String} content\n * @param {Boolean} persist - IE trashes empty textNodes on\n * cloneNode(true), so in certain\n * cases the anchor needs to be\n * non-empty to be persisted in\n * templates.\n * @return {Comment|Text}\n */\n\nfunction createAnchor(content, persist) {\n var anchor = config.debug ? document.createComment(content) : document.createTextNode(persist ? ' ' : '');\n anchor.__v_anchor = true;\n return anchor;\n}\n\n/**\n * Find a component ref attribute that starts with $.\n *\n * @param {Element} node\n * @return {String|undefined}\n */\n\nvar refRE = /^v-ref:/;\n\nfunction findRef(node) {\n if (node.hasAttributes()) {\n var attrs = node.attributes;\n for (var i = 0, l = attrs.length; i < l; i++) {\n var name = attrs[i].name;\n if (refRE.test(name)) {\n return camelize(name.replace(refRE, ''));\n }\n }\n }\n}\n\n/**\n * Map a function to a range of nodes .\n *\n * @param {Node} node\n * @param {Node} end\n * @param {Function} op\n */\n\nfunction mapNodeRange(node, end, op) {\n var next;\n while (node !== end) {\n next = node.nextSibling;\n op(node);\n node = next;\n }\n op(end);\n}\n\n/**\n * Remove a range of nodes with transition, store\n * the nodes in a fragment with correct ordering,\n * and call callback when done.\n *\n * @param {Node} start\n * @param {Node} end\n * @param {Vue} vm\n * @param {DocumentFragment} frag\n * @param {Function} cb\n */\n\nfunction removeNodeRange(start, end, vm, frag, cb) {\n var done = false;\n var removed = 0;\n var nodes = [];\n mapNodeRange(start, end, function (node) {\n if (node === end) done = true;\n nodes.push(node);\n removeWithTransition(node, vm, onRemoved);\n });\n function onRemoved() {\n removed++;\n if (done && removed >= nodes.length) {\n for (var i = 0; i < nodes.length; i++) {\n frag.appendChild(nodes[i]);\n }\n cb && cb();\n }\n }\n}\n\n/**\n * Check if a node is a DocumentFragment.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\nfunction isFragment(node) {\n return node && node.nodeType === 11;\n}\n\n/**\n * Get outerHTML of elements, taking care\n * of SVG elements in IE as well.\n *\n * @param {Element} el\n * @return {String}\n */\n\nfunction getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML;\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML;\n }\n}\n\nvar commonTagRE = /^(div|p|span|img|a|b|i|br|ul|ol|li|h1|h2|h3|h4|h5|h6|code|pre|table|th|td|tr|form|label|input|select|option|nav|article|section|header|footer)$/i;\nvar reservedTagRE = /^(slot|partial|component)$/i;\n\nvar isUnknownElement = undefined;\nif (process.env.NODE_ENV !== 'production') {\n isUnknownElement = function (el, tag) {\n if (tag.indexOf('-') > -1) {\n // http://stackoverflow.com/a/28210364/1070244\n return el.constructor === window.HTMLUnknownElement || el.constructor === window.HTMLElement;\n } else {\n return (/HTMLUnknownElement/.test(el.toString()) &&\n // Chrome returns unknown for several HTML5 elements.\n // https://code.google.com/p/chromium/issues/detail?id=540526\n // Firefox returns unknown for some \"Interactive elements.\"\n !/^(data|time|rtc|rb|details|dialog|summary)$/.test(tag)\n );\n }\n };\n}\n\n/**\n * Check if an element is a component, if yes return its\n * component id.\n *\n * @param {Element} el\n * @param {Object} options\n * @return {Object|undefined}\n */\n\nfunction checkComponentAttr(el, options) {\n var tag = el.tagName.toLowerCase();\n var hasAttrs = el.hasAttributes();\n if (!commonTagRE.test(tag) && !reservedTagRE.test(tag)) {\n if (resolveAsset(options, 'components', tag)) {\n return { id: tag };\n } else {\n var is = hasAttrs && getIsBinding(el, options);\n if (is) {\n return is;\n } else if (process.env.NODE_ENV !== 'production') {\n var expectedTag = options._componentNameMap && options._componentNameMap[tag];\n if (expectedTag) {\n warn('Unknown custom element: <' + tag + '> - ' + 'did you mean <' + expectedTag + '>? ' + 'HTML is case-insensitive, remember to use kebab-case in templates.');\n } else if (isUnknownElement(el, tag)) {\n warn('Unknown custom element: <' + tag + '> - did you ' + 'register the component correctly? For recursive components, ' + 'make sure to provide the \"name\" option.');\n }\n }\n }\n } else if (hasAttrs) {\n return getIsBinding(el, options);\n }\n}\n\n/**\n * Get \"is\" binding from an element.\n *\n * @param {Element} el\n * @param {Object} options\n * @return {Object|undefined}\n */\n\nfunction getIsBinding(el, options) {\n // dynamic syntax\n var exp = el.getAttribute('is');\n if (exp != null) {\n if (resolveAsset(options, 'components', exp)) {\n el.removeAttribute('is');\n return { id: exp };\n }\n } else {\n exp = getBindAttr(el, 'is');\n if (exp != null) {\n return { id: exp, dynamic: true };\n }\n }\n}\n\n/**\n * Option overwriting strategies are functions that handle\n * how to merge a parent option value and a child option\n * value into the final value.\n *\n * All strategy functions follow the same signature:\n *\n * @param {*} parentVal\n * @param {*} childVal\n * @param {Vue} [vm]\n */\n\nvar strats = config.optionMergeStrategies = Object.create(null);\n\n/**\n * Helper that recursively merges two data objects together.\n */\n\nfunction mergeData(to, from) {\n var key, toVal, fromVal;\n for (key in from) {\n toVal = to[key];\n fromVal = from[key];\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (isObject(toVal) && isObject(fromVal)) {\n mergeData(toVal, fromVal);\n }\n }\n return to;\n}\n\n/**\n * Data\n */\n\nstrats.data = function (parentVal, childVal, vm) {\n if (!vm) {\n // in a Vue.extend merge, both should be functions\n if (!childVal) {\n return parentVal;\n }\n if (typeof childVal !== 'function') {\n process.env.NODE_ENV !== 'production' && warn('The \"data\" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm);\n return parentVal;\n }\n if (!parentVal) {\n return childVal;\n }\n // when parentVal & childVal are both present,\n // we need to return a function that returns the\n // merged result of both functions... no need to\n // check if parentVal is a function here because\n // it has to be a function to pass previous merges.\n return function mergedDataFn() {\n return mergeData(childVal.call(this), parentVal.call(this));\n };\n } else if (parentVal || childVal) {\n return function mergedInstanceDataFn() {\n // instance merge\n var instanceData = typeof childVal === 'function' ? childVal.call(vm) : childVal;\n var defaultData = typeof parentVal === 'function' ? parentVal.call(vm) : undefined;\n if (instanceData) {\n return mergeData(instanceData, defaultData);\n } else {\n return defaultData;\n }\n };\n }\n};\n\n/**\n * El\n */\n\nstrats.el = function (parentVal, childVal, vm) {\n if (!vm && childVal && typeof childVal !== 'function') {\n process.env.NODE_ENV !== 'production' && warn('The \"el\" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm);\n return;\n }\n var ret = childVal || parentVal;\n // invoke the element factory if this is instance merge\n return vm && typeof ret === 'function' ? ret.call(vm) : ret;\n};\n\n/**\n * Hooks and param attributes are merged as arrays.\n */\n\nstrats.init = strats.created = strats.ready = strats.attached = strats.detached = strats.beforeCompile = strats.compiled = strats.beforeDestroy = strats.destroyed = strats.activate = function (parentVal, childVal) {\n return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;\n};\n\n/**\n * Assets\n *\n * When a vm is present (instance creation), we need to do\n * a three-way merge between constructor options, instance\n * options and parent options.\n */\n\nfunction mergeAssets(parentVal, childVal) {\n var res = Object.create(parentVal || null);\n return childVal ? extend(res, guardArrayAssets(childVal)) : res;\n}\n\nconfig._assetTypes.forEach(function (type) {\n strats[type + 's'] = mergeAssets;\n});\n\n/**\n * Events & Watchers.\n *\n * Events & watchers hashes should not overwrite one\n * another, so we merge them as arrays.\n */\n\nstrats.watch = strats.events = function (parentVal, childVal) {\n if (!childVal) return parentVal;\n if (!parentVal) return childVal;\n var ret = {};\n extend(ret, parentVal);\n for (var key in childVal) {\n var parent = ret[key];\n var child = childVal[key];\n if (parent && !isArray(parent)) {\n parent = [parent];\n }\n ret[key] = parent ? parent.concat(child) : [child];\n }\n return ret;\n};\n\n/**\n * Other object hashes.\n */\n\nstrats.props = strats.methods = strats.computed = function (parentVal, childVal) {\n if (!childVal) return parentVal;\n if (!parentVal) return childVal;\n var ret = Object.create(null);\n extend(ret, parentVal);\n extend(ret, childVal);\n return ret;\n};\n\n/**\n * Default strategy.\n */\n\nvar defaultStrat = function defaultStrat(parentVal, childVal) {\n return childVal === undefined ? parentVal : childVal;\n};\n\n/**\n * Make sure component options get converted to actual\n * constructors.\n *\n * @param {Object} options\n */\n\nfunction guardComponents(options) {\n if (options.components) {\n var components = options.components = guardArrayAssets(options.components);\n var ids = Object.keys(components);\n var def;\n if (process.env.NODE_ENV !== 'production') {\n var map = options._componentNameMap = {};\n }\n for (var i = 0, l = ids.length; i < l; i++) {\n var key = ids[i];\n if (commonTagRE.test(key) || reservedTagRE.test(key)) {\n process.env.NODE_ENV !== 'production' && warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + key);\n continue;\n }\n // record a all lowercase <-> kebab-case mapping for\n // possible custom element case error warning\n if (process.env.NODE_ENV !== 'production') {\n map[key.replace(/-/g, '').toLowerCase()] = hyphenate(key);\n }\n def = components[key];\n if (isPlainObject(def)) {\n components[key] = Vue.extend(def);\n }\n }\n }\n}\n\n/**\n * Ensure all props option syntax are normalized into the\n * Object-based format.\n *\n * @param {Object} options\n */\n\nfunction guardProps(options) {\n var props = options.props;\n var i, val;\n if (isArray(props)) {\n options.props = {};\n i = props.length;\n while (i--) {\n val = props[i];\n if (typeof val === 'string') {\n options.props[val] = null;\n } else if (val.name) {\n options.props[val.name] = val;\n }\n }\n } else if (isPlainObject(props)) {\n var keys = Object.keys(props);\n i = keys.length;\n while (i--) {\n val = props[keys[i]];\n if (typeof val === 'function') {\n props[keys[i]] = { type: val };\n }\n }\n }\n}\n\n/**\n * Guard an Array-format assets option and converted it\n * into the key-value Object format.\n *\n * @param {Object|Array} assets\n * @return {Object}\n */\n\nfunction guardArrayAssets(assets) {\n if (isArray(assets)) {\n var res = {};\n var i = assets.length;\n var asset;\n while (i--) {\n asset = assets[i];\n var id = typeof asset === 'function' ? asset.options && asset.options.name || asset.id : asset.name || asset.id;\n if (!id) {\n process.env.NODE_ENV !== 'production' && warn('Array-syntax assets must provide a \"name\" or \"id\" field.');\n } else {\n res[id] = asset;\n }\n }\n return res;\n }\n return assets;\n}\n\n/**\n * Merge two option objects into a new one.\n * Core utility used in both instantiation and inheritance.\n *\n * @param {Object} parent\n * @param {Object} child\n * @param {Vue} [vm] - if vm is present, indicates this is\n * an instantiation merge.\n */\n\nfunction mergeOptions(parent, child, vm) {\n guardComponents(child);\n guardProps(child);\n if (process.env.NODE_ENV !== 'production') {\n if (child.propsData && !vm) {\n warn('propsData can only be used as an instantiation option.');\n }\n }\n var options = {};\n var key;\n if (child['extends']) {\n parent = typeof child['extends'] === 'function' ? mergeOptions(parent, child['extends'].options, vm) : mergeOptions(parent, child['extends'], vm);\n }\n if (child.mixins) {\n for (var i = 0, l = child.mixins.length; i < l; i++) {\n var mixin = child.mixins[i];\n var mixinOptions = mixin.prototype instanceof Vue ? mixin.options : mixin;\n parent = mergeOptions(parent, mixinOptions, vm);\n }\n }\n for (key in parent) {\n mergeField(key);\n }\n for (key in child) {\n if (!hasOwn(parent, key)) {\n mergeField(key);\n }\n }\n function mergeField(key) {\n var strat = strats[key] || defaultStrat;\n options[key] = strat(parent[key], child[key], vm, key);\n }\n return options;\n}\n\n/**\n * Resolve an asset.\n * This function is used because child instances need access\n * to assets defined in its ancestor chain.\n *\n * @param {Object} options\n * @param {String} type\n * @param {String} id\n * @param {Boolean} warnMissing\n * @return {Object|Function}\n */\n\nfunction resolveAsset(options, type, id, warnMissing) {\n /* istanbul ignore if */\n if (typeof id !== 'string') {\n return;\n }\n var assets = options[type];\n var camelizedId;\n var res = assets[id] ||\n // camelCase ID\n assets[camelizedId = camelize(id)] ||\n // Pascal Case ID\n assets[camelizedId.charAt(0).toUpperCase() + camelizedId.slice(1)];\n if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {\n warn('Failed to resolve ' + type.slice(0, -1) + ': ' + id, options);\n }\n return res;\n}\n\nvar uid$1 = 0;\n\n/**\n * A dep is an observable that can have multiple\n * directives subscribing to it.\n *\n * @constructor\n */\nfunction Dep() {\n this.id = uid$1++;\n this.subs = [];\n}\n\n// the current target watcher being evaluated.\n// this is globally unique because there could be only one\n// watcher being evaluated at any time.\nDep.target = null;\n\n/**\n * Add a directive subscriber.\n *\n * @param {Directive} sub\n */\n\nDep.prototype.addSub = function (sub) {\n this.subs.push(sub);\n};\n\n/**\n * Remove a directive subscriber.\n *\n * @param {Directive} sub\n */\n\nDep.prototype.removeSub = function (sub) {\n this.subs.$remove(sub);\n};\n\n/**\n * Add self as a dependency to the target watcher.\n */\n\nDep.prototype.depend = function () {\n Dep.target.addDep(this);\n};\n\n/**\n * Notify all subscribers of a new value.\n */\n\nDep.prototype.notify = function () {\n // stablize the subscriber list first\n var subs = toArray(this.subs);\n for (var i = 0, l = subs.length; i < l; i++) {\n subs[i].update();\n }\n};\n\nvar arrayProto = Array.prototype;\nvar arrayMethods = Object.create(arrayProto)\n\n/**\n * Intercept mutating methods and emit events\n */\n\n;['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'].forEach(function (method) {\n // cache original method\n var original = arrayProto[method];\n def(arrayMethods, method, function mutator() {\n // avoid leaking arguments:\n // http://jsperf.com/closure-with-arguments\n var i = arguments.length;\n var args = new Array(i);\n while (i--) {\n args[i] = arguments[i];\n }\n var result = original.apply(this, args);\n var ob = this.__ob__;\n var inserted;\n switch (method) {\n case 'push':\n inserted = args;\n break;\n case 'unshift':\n inserted = args;\n break;\n case 'splice':\n inserted = args.slice(2);\n break;\n }\n if (inserted) ob.observeArray(inserted);\n // notify change\n ob.dep.notify();\n return result;\n });\n});\n\n/**\n * Swap the element at the given index with a new value\n * and emits corresponding event.\n *\n * @param {Number} index\n * @param {*} val\n * @return {*} - replaced element\n */\n\ndef(arrayProto, '$set', function $set(index, val) {\n if (index >= this.length) {\n this.length = Number(index) + 1;\n }\n return this.splice(index, 1, val)[0];\n});\n\n/**\n * Convenience method to remove the element at given index or target element reference.\n *\n * @param {*} item\n */\n\ndef(arrayProto, '$remove', function $remove(item) {\n /* istanbul ignore if */\n if (!this.length) return;\n var index = indexOf(this, item);\n if (index > -1) {\n return this.splice(index, 1);\n }\n});\n\nvar arrayKeys = Object.getOwnPropertyNames(arrayMethods);\n\n/**\n * By default, when a reactive property is set, the new value is\n * also converted to become reactive. However in certain cases, e.g.\n * v-for scope alias and props, we don't want to force conversion\n * because the value may be a nested value under a frozen data structure.\n *\n * So whenever we want to set a reactive property without forcing\n * conversion on the new value, we wrap that call inside this function.\n */\n\nvar shouldConvert = true;\n\nfunction withoutConversion(fn) {\n shouldConvert = false;\n fn();\n shouldConvert = true;\n}\n\n/**\n * Observer class that are attached to each observed\n * object. Once attached, the observer converts target\n * object's property keys into getter/setters that\n * collect dependencies and dispatches updates.\n *\n * @param {Array|Object} value\n * @constructor\n */\n\nfunction Observer(value) {\n this.value = value;\n this.dep = new Dep();\n def(value, '__ob__', this);\n if (isArray(value)) {\n var augment = hasProto ? protoAugment : copyAugment;\n augment(value, arrayMethods, arrayKeys);\n this.observeArray(value);\n } else {\n this.walk(value);\n }\n}\n\n// Instance methods\n\n/**\n * Walk through each property and convert them into\n * getter/setters. This method should only be called when\n * value type is Object.\n *\n * @param {Object} obj\n */\n\nObserver.prototype.walk = function (obj) {\n var keys = Object.keys(obj);\n for (var i = 0, l = keys.length; i < l; i++) {\n this.convert(keys[i], obj[keys[i]]);\n }\n};\n\n/**\n * Observe a list of Array items.\n *\n * @param {Array} items\n */\n\nObserver.prototype.observeArray = function (items) {\n for (var i = 0, l = items.length; i < l; i++) {\n observe(items[i]);\n }\n};\n\n/**\n * Convert a property into getter/setter so we can emit\n * the events when the property is accessed/changed.\n *\n * @param {String} key\n * @param {*} val\n */\n\nObserver.prototype.convert = function (key, val) {\n defineReactive(this.value, key, val);\n};\n\n/**\n * Add an owner vm, so that when $set/$delete mutations\n * happen we can notify owner vms to proxy the keys and\n * digest the watchers. This is only called when the object\n * is observed as an instance's root $data.\n *\n * @param {Vue} vm\n */\n\nObserver.prototype.addVm = function (vm) {\n (this.vms || (this.vms = [])).push(vm);\n};\n\n/**\n * Remove an owner vm. This is called when the object is\n * swapped out as an instance's $data object.\n *\n * @param {Vue} vm\n */\n\nObserver.prototype.removeVm = function (vm) {\n this.vms.$remove(vm);\n};\n\n// helpers\n\n/**\n * Augment an target Object or Array by intercepting\n * the prototype chain using __proto__\n *\n * @param {Object|Array} target\n * @param {Object} src\n */\n\nfunction protoAugment(target, src) {\n /* eslint-disable no-proto */\n target.__proto__ = src;\n /* eslint-enable no-proto */\n}\n\n/**\n * Augment an target Object or Array by defining\n * hidden properties.\n *\n * @param {Object|Array} target\n * @param {Object} proto\n */\n\nfunction copyAugment(target, src, keys) {\n for (var i = 0, l = keys.length; i < l; i++) {\n var key = keys[i];\n def(target, key, src[key]);\n }\n}\n\n/**\n * Attempt to create an observer instance for a value,\n * returns the new observer if successfully observed,\n * or the existing observer if the value already has one.\n *\n * @param {*} value\n * @param {Vue} [vm]\n * @return {Observer|undefined}\n * @static\n */\n\nfunction observe(value, vm) {\n if (!value || typeof value !== 'object') {\n return;\n }\n var ob;\n if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n ob = value.__ob__;\n } else if (shouldConvert && (isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {\n ob = new Observer(value);\n }\n if (ob && vm) {\n ob.addVm(vm);\n }\n return ob;\n}\n\n/**\n * Define a reactive property on an Object.\n *\n * @param {Object} obj\n * @param {String} key\n * @param {*} val\n */\n\nfunction defineReactive(obj, key, val) {\n var dep = new Dep();\n\n var property = Object.getOwnPropertyDescriptor(obj, key);\n if (property && property.configurable === false) {\n return;\n }\n\n // cater for pre-defined getter/setters\n var getter = property && property.get;\n var setter = property && property.set;\n\n var childOb = observe(val);\n Object.defineProperty(obj, key, {\n enumerable: true,\n configurable: true,\n get: function reactiveGetter() {\n var value = getter ? getter.call(obj) : val;\n if (Dep.target) {\n dep.depend();\n if (childOb) {\n childOb.dep.depend();\n }\n if (isArray(value)) {\n for (var e, i = 0, l = value.length; i < l; i++) {\n e = value[i];\n e && e.__ob__ && e.__ob__.dep.depend();\n }\n }\n }\n return value;\n },\n set: function reactiveSetter(newVal) {\n var value = getter ? getter.call(obj) : val;\n if (newVal === value) {\n return;\n }\n if (setter) {\n setter.call(obj, newVal);\n } else {\n val = newVal;\n }\n childOb = observe(newVal);\n dep.notify();\n }\n });\n}\n\n\n\nvar util = Object.freeze({\n\tdefineReactive: defineReactive,\n\tset: set,\n\tdel: del,\n\thasOwn: hasOwn,\n\tisLiteral: isLiteral,\n\tisReserved: isReserved,\n\t_toString: _toString,\n\ttoNumber: toNumber,\n\ttoBoolean: toBoolean,\n\tstripQuotes: stripQuotes,\n\tcamelize: camelize,\n\thyphenate: hyphenate,\n\tclassify: classify,\n\tbind: bind,\n\ttoArray: toArray,\n\textend: extend,\n\tisObject: isObject,\n\tisPlainObject: isPlainObject,\n\tdef: def,\n\tdebounce: _debounce,\n\tindexOf: indexOf,\n\tcancellable: cancellable,\n\tlooseEqual: looseEqual,\n\tisArray: isArray,\n\thasProto: hasProto,\n\tinBrowser: inBrowser,\n\tdevtools: devtools,\n\tisIE: isIE,\n\tisIE9: isIE9,\n\tisAndroid: isAndroid,\n\tisIOS: isIOS,\n\tget transitionProp () { return transitionProp; },\n\tget transitionEndEvent () { return transitionEndEvent; },\n\tget animationProp () { return animationProp; },\n\tget animationEndEvent () { return animationEndEvent; },\n\tnextTick: nextTick,\n\tget _Set () { return _Set; },\n\tquery: query,\n\tinDoc: inDoc,\n\tgetAttr: getAttr,\n\tgetBindAttr: getBindAttr,\n\thasBindAttr: hasBindAttr,\n\tbefore: before,\n\tafter: after,\n\tremove: remove,\n\tprepend: prepend,\n\treplace: replace,\n\ton: on,\n\toff: off,\n\tsetClass: setClass,\n\taddClass: addClass,\n\tremoveClass: removeClass,\n\textractContent: extractContent,\n\ttrimNode: trimNode,\n\tisTemplate: isTemplate,\n\tcreateAnchor: createAnchor,\n\tfindRef: findRef,\n\tmapNodeRange: mapNodeRange,\n\tremoveNodeRange: removeNodeRange,\n\tisFragment: isFragment,\n\tgetOuterHTML: getOuterHTML,\n\tmergeOptions: mergeOptions,\n\tresolveAsset: resolveAsset,\n\tcheckComponentAttr: checkComponentAttr,\n\tcommonTagRE: commonTagRE,\n\treservedTagRE: reservedTagRE,\n\tget warn () { return warn; }\n});\n\nvar uid = 0;\n\nfunction initMixin (Vue) {\n /**\n * The main init sequence. This is called for every\n * instance, including ones that are created from extended\n * constructors.\n *\n * @param {Object} options - this options object should be\n * the result of merging class\n * options and the options passed\n * in to the constructor.\n */\n\n Vue.prototype._init = function (options) {\n options = options || {};\n\n this.$el = null;\n this.$parent = options.parent;\n this.$root = this.$parent ? this.$parent.$root : this;\n this.$children = [];\n this.$refs = {}; // child vm references\n this.$els = {}; // element references\n this._watchers = []; // all watchers as an array\n this._directives = []; // all directives\n\n // a uid\n this._uid = uid++;\n\n // a flag to avoid this being observed\n this._isVue = true;\n\n // events bookkeeping\n this._events = {}; // registered callbacks\n this._eventsCount = {}; // for $broadcast optimization\n\n // fragment instance properties\n this._isFragment = false;\n this._fragment = // @type {DocumentFragment}\n this._fragmentStart = // @type {Text|Comment}\n this._fragmentEnd = null; // @type {Text|Comment}\n\n // lifecycle state\n this._isCompiled = this._isDestroyed = this._isReady = this._isAttached = this._isBeingDestroyed = this._vForRemoving = false;\n this._unlinkFn = null;\n\n // context:\n // if this is a transcluded component, context\n // will be the common parent vm of this instance\n // and its host.\n this._context = options._context || this.$parent;\n\n // scope:\n // if this is inside an inline v-for, the scope\n // will be the intermediate scope created for this\n // repeat fragment. this is used for linking props\n // and container directives.\n this._scope = options._scope;\n\n // fragment:\n // if this instance is compiled inside a Fragment, it\n // needs to register itself as a child of that fragment\n // for attach/detach to work properly.\n this._frag = options._frag;\n if (this._frag) {\n this._frag.children.push(this);\n }\n\n // push self into parent / transclusion host\n if (this.$parent) {\n this.$parent.$children.push(this);\n }\n\n // merge options.\n options = this.$options = mergeOptions(this.constructor.options, options, this);\n\n // set ref\n this._updateRef();\n\n // initialize data as empty object.\n // it will be filled up in _initData().\n this._data = {};\n\n // call init hook\n this._callHook('init');\n\n // initialize data observation and scope inheritance.\n this._initState();\n\n // setup event system and option events.\n this._initEvents();\n\n // call created hook\n this._callHook('created');\n\n // if `el` option is passed, start compilation.\n if (options.el) {\n this.$mount(options.el);\n }\n };\n}\n\nvar pathCache = new Cache(1000);\n\n// actions\nvar APPEND = 0;\nvar PUSH = 1;\nvar INC_SUB_PATH_DEPTH = 2;\nvar PUSH_SUB_PATH = 3;\n\n// states\nvar BEFORE_PATH = 0;\nvar IN_PATH = 1;\nvar BEFORE_IDENT = 2;\nvar IN_IDENT = 3;\nvar IN_SUB_PATH = 4;\nvar IN_SINGLE_QUOTE = 5;\nvar IN_DOUBLE_QUOTE = 6;\nvar AFTER_PATH = 7;\nvar ERROR = 8;\n\nvar pathStateMachine = [];\n\npathStateMachine[BEFORE_PATH] = {\n 'ws': [BEFORE_PATH],\n 'ident': [IN_IDENT, APPEND],\n '[': [IN_SUB_PATH],\n 'eof': [AFTER_PATH]\n};\n\npathStateMachine[IN_PATH] = {\n 'ws': [IN_PATH],\n '.': [BEFORE_IDENT],\n '[': [IN_SUB_PATH],\n 'eof': [AFTER_PATH]\n};\n\npathStateMachine[BEFORE_IDENT] = {\n 'ws': [BEFORE_IDENT],\n 'ident': [IN_IDENT, APPEND]\n};\n\npathStateMachine[IN_IDENT] = {\n 'ident': [IN_IDENT, APPEND],\n '0': [IN_IDENT, APPEND],\n 'number': [IN_IDENT, APPEND],\n 'ws': [IN_PATH, PUSH],\n '.': [BEFORE_IDENT, PUSH],\n '[': [IN_SUB_PATH, PUSH],\n 'eof': [AFTER_PATH, PUSH]\n};\n\npathStateMachine[IN_SUB_PATH] = {\n \"'\": [IN_SINGLE_QUOTE, APPEND],\n '\"': [IN_DOUBLE_QUOTE, APPEND],\n '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH],\n ']': [IN_PATH, PUSH_SUB_PATH],\n 'eof': ERROR,\n 'else': [IN_SUB_PATH, APPEND]\n};\n\npathStateMachine[IN_SINGLE_QUOTE] = {\n \"'\": [IN_SUB_PATH, APPEND],\n 'eof': ERROR,\n 'else': [IN_SINGLE_QUOTE, APPEND]\n};\n\npathStateMachine[IN_DOUBLE_QUOTE] = {\n '\"': [IN_SUB_PATH, APPEND],\n 'eof': ERROR,\n 'else': [IN_DOUBLE_QUOTE, APPEND]\n};\n\n/**\n * Determine the type of a character in a keypath.\n *\n * @param {Char} ch\n * @return {String} type\n */\n\nfunction getPathCharType(ch) {\n if (ch === undefined) {\n return 'eof';\n }\n\n var code = ch.charCodeAt(0);\n\n switch (code) {\n case 0x5B: // [\n case 0x5D: // ]\n case 0x2E: // .\n case 0x22: // \"\n case 0x27: // '\n case 0x30:\n // 0\n return ch;\n\n case 0x5F: // _\n case 0x24:\n // $\n return 'ident';\n\n case 0x20: // Space\n case 0x09: // Tab\n case 0x0A: // Newline\n case 0x0D: // Return\n case 0xA0: // No-break space\n case 0xFEFF: // Byte Order Mark\n case 0x2028: // Line Separator\n case 0x2029:\n // Paragraph Separator\n return 'ws';\n }\n\n // a-z, A-Z\n if (code >= 0x61 && code <= 0x7A || code >= 0x41 && code <= 0x5A) {\n return 'ident';\n }\n\n // 1-9\n if (code >= 0x31 && code <= 0x39) {\n return 'number';\n }\n\n return 'else';\n}\n\n/**\n * Format a subPath, return its plain form if it is\n * a literal string or number. Otherwise prepend the\n * dynamic indicator (*).\n *\n * @param {String} path\n * @return {String}\n */\n\nfunction formatSubPath(path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) {\n return false;\n }\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed;\n}\n\n/**\n * Parse a string path into an array of segments\n *\n * @param {String} path\n * @return {Array|undefined}\n */\n\nfunction parse(path) {\n var keys = [];\n var index = -1;\n var mode = BEFORE_PATH;\n var subPathDepth = 0;\n var c, newChar, key, type, transition, action, typeMap;\n\n var actions = [];\n\n actions[PUSH] = function () {\n if (key !== undefined) {\n keys.push(key);\n key = undefined;\n }\n };\n\n actions[APPEND] = function () {\n if (key === undefined) {\n key = newChar;\n } else {\n key += newChar;\n }\n };\n\n actions[INC_SUB_PATH_DEPTH] = function () {\n actions[APPEND]();\n subPathDepth++;\n };\n\n actions[PUSH_SUB_PATH] = function () {\n if (subPathDepth > 0) {\n subPathDepth--;\n mode = IN_SUB_PATH;\n actions[APPEND]();\n } else {\n subPathDepth = 0;\n key = formatSubPath(key);\n if (key === false) {\n return false;\n } else {\n actions[PUSH]();\n }\n }\n };\n\n function maybeUnescapeQuote() {\n var nextChar = path[index + 1];\n if (mode === IN_SINGLE_QUOTE && nextChar === \"'\" || mode === IN_DOUBLE_QUOTE && nextChar === '\"') {\n index++;\n newChar = '\\\\' + nextChar;\n actions[APPEND]();\n return true;\n }\n }\n\n while (mode != null) {\n index++;\n c = path[index];\n\n if (c === '\\\\' && maybeUnescapeQuote()) {\n continue;\n }\n\n type = getPathCharType(c);\n typeMap = pathStateMachine[mode];\n transition = typeMap[type] || typeMap['else'] || ERROR;\n\n if (transition === ERROR) {\n return; // parse error\n }\n\n mode = transition[0];\n action = actions[transition[1]];\n if (action) {\n newChar = transition[2];\n newChar = newChar === undefined ? c : newChar;\n if (action() === false) {\n return;\n }\n }\n\n if (mode === AFTER_PATH) {\n keys.raw = path;\n return keys;\n }\n }\n}\n\n/**\n * External parse that check for a cache hit first\n *\n * @param {String} path\n * @return {Array|undefined}\n */\n\nfunction parsePath(path) {\n var hit = pathCache.get(path);\n if (!hit) {\n hit = parse(path);\n if (hit) {\n pathCache.put(path, hit);\n }\n }\n return hit;\n}\n\n/**\n * Get from an object from a path string\n *\n * @param {Object} obj\n * @param {String} path\n */\n\nfunction getPath(obj, path) {\n return parseExpression$1(path).get(obj);\n}\n\n/**\n * Warn against setting non-existent root path on a vm.\n */\n\nvar warnNonExistent;\nif (process.env.NODE_ENV !== 'production') {\n warnNonExistent = function (path, vm) {\n warn('You are setting a non-existent path \"' + path.raw + '\" ' + 'on a vm instance. Consider pre-initializing the property ' + 'with the \"data\" option for more reliable reactivity ' + 'and better performance.', vm);\n };\n}\n\n/**\n * Set on an object from a path\n *\n * @param {Object} obj\n * @param {String | Array} path\n * @param {*} val\n */\n\nfunction setPath(obj, path, val) {\n var original = obj;\n if (typeof path === 'string') {\n path = parse(path);\n }\n if (!path || !isObject(obj)) {\n return false;\n }\n var last, key;\n for (var i = 0, l = path.length; i < l; i++) {\n last = obj;\n key = path[i];\n if (key.charAt(0) === '*') {\n key = parseExpression$1(key.slice(1)).get.call(original, original);\n }\n if (i < l - 1) {\n obj = obj[key];\n if (!isObject(obj)) {\n obj = {};\n if (process.env.NODE_ENV !== 'production' && last._isVue) {\n warnNonExistent(path, last);\n }\n set(last, key, obj);\n }\n } else {\n if (isArray(obj)) {\n obj.$set(key, val);\n } else if (key in obj) {\n obj[key] = val;\n } else {\n if (process.env.NODE_ENV !== 'production' && obj._isVue) {\n warnNonExistent(path, obj);\n }\n set(obj, key, val);\n }\n }\n }\n return true;\n}\n\nvar path = Object.freeze({\n parsePath: parsePath,\n getPath: getPath,\n setPath: setPath\n});\n\nvar expressionCache = new Cache(1000);\n\nvar allowedKeywords = 'Math,Date,this,true,false,null,undefined,Infinity,NaN,' + 'isNaN,isFinite,decodeURI,decodeURIComponent,encodeURI,' + 'encodeURIComponent,parseInt,parseFloat';\nvar allowedKeywordsRE = new RegExp('^(' + allowedKeywords.replace(/,/g, '\\\\b|') + '\\\\b)');\n\n// keywords that don't make sense inside expressions\nvar improperKeywords = 'break,case,class,catch,const,continue,debugger,default,' + 'delete,do,else,export,extends,finally,for,function,if,' + 'import,in,instanceof,let,return,super,switch,throw,try,' + 'var,while,with,yield,enum,await,implements,package,' + 'protected,static,interface,private,public';\nvar improperKeywordsRE = new RegExp('^(' + improperKeywords.replace(/,/g, '\\\\b|') + '\\\\b)');\n\nvar wsRE = /\\s/g;\nvar newlineRE = /\\n/g;\nvar saveRE = /[\\{,]\\s*[\\w\\$_]+\\s*:|('(?:[^'\\\\]|\\\\.)*'|\"(?:[^\"\\\\]|\\\\.)*\"|`(?:[^`\\\\]|\\\\.)*\\$\\{|\\}(?:[^`\\\\\"']|\\\\.)*`|`(?:[^`\\\\]|\\\\.)*`)|new |typeof |void /g;\nvar restoreRE = /\"(\\d+)\"/g;\nvar pathTestRE = /^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*|\\['.*?'\\]|\\[\".*?\"\\]|\\[\\d+\\]|\\[[A-Za-z_$][\\w$]*\\])*$/;\nvar identRE = /[^\\w$\\.](?:[A-Za-z_$][\\w$]*)/g;\nvar literalValueRE$1 = /^(?:true|false|null|undefined|Infinity|NaN)$/;\n\nfunction noop() {}\n\n/**\n * Save / Rewrite / Restore\n *\n * When rewriting paths found in an expression, it is\n * possible for the same letter sequences to be found in\n * strings and Object literal property keys. Therefore we\n * remove and store these parts in a temporary array, and\n * restore them after the path rewrite.\n */\n\nvar saved = [];\n\n/**\n * Save replacer\n *\n * The save regex can match two possible cases:\n * 1. An opening object literal\n * 2. A string\n * If matched as a plain string, we need to escape its\n * newlines, since the string needs to be preserved when\n * generating the function body.\n *\n * @param {String} str\n * @param {String} isString - str if matched as a string\n * @return {String} - placeholder with index\n */\n\nfunction save(str, isString) {\n var i = saved.length;\n saved[i] = isString ? str.replace(newlineRE, '\\\\n') : str;\n return '\"' + i + '\"';\n}\n\n/**\n * Path rewrite replacer\n *\n * @param {String} raw\n * @return {String}\n */\n\nfunction rewrite(raw) {\n var c = raw.charAt(0);\n var path = raw.slice(1);\n if (allowedKeywordsRE.test(path)) {\n return raw;\n } else {\n path = path.indexOf('\"') > -1 ? path.replace(restoreRE, restore) : path;\n return c + 'scope.' + path;\n }\n}\n\n/**\n * Restore replacer\n *\n * @param {String} str\n * @param {String} i - matched save index\n * @return {String}\n */\n\nfunction restore(str, i) {\n return saved[i];\n}\n\n/**\n * Rewrite an expression, prefixing all path accessors with\n * `scope.` and generate getter/setter functions.\n *\n * @param {String} exp\n * @return {Function}\n */\n\nfunction compileGetter(exp) {\n if (improperKeywordsRE.test(exp)) {\n process.env.NODE_ENV !== 'production' && warn('Avoid using reserved keywords in expression: ' + exp);\n }\n // reset state\n saved.length = 0;\n // save strings and object literal keys\n var body = exp.replace(saveRE, save).replace(wsRE, '');\n // rewrite all paths\n // pad 1 space here because the regex matches 1 extra char\n body = (' ' + body).replace(identRE, rewrite).replace(restoreRE, restore);\n return makeGetterFn(body);\n}\n\n/**\n * Build a getter function. Requires eval.\n *\n * We isolate the try/catch so it doesn't affect the\n * optimization of the parse function when it is not called.\n *\n * @param {String} body\n * @return {Function|undefined}\n */\n\nfunction makeGetterFn(body) {\n try {\n /* eslint-disable no-new-func */\n return new Function('scope', 'return ' + body + ';');\n /* eslint-enable no-new-func */\n } catch (e) {\n if (process.env.NODE_ENV !== 'production') {\n /* istanbul ignore if */\n if (e.toString().match(/unsafe-eval|CSP/)) {\n warn('It seems you are using the default build of Vue.js in an environment ' + 'with Content Security Policy that prohibits unsafe-eval. ' + 'Use the CSP-compliant build instead: ' + 'http://vuejs.org/guide/installation.html#CSP-compliant-build');\n } else {\n warn('Invalid expression. ' + 'Generated function body: ' + body);\n }\n }\n return noop;\n }\n}\n\n/**\n * Compile a setter function for the expression.\n *\n * @param {String} exp\n * @return {Function|undefined}\n */\n\nfunction compileSetter(exp) {\n var path = parsePath(exp);\n if (path) {\n return function (scope, val) {\n setPath(scope, path, val);\n };\n } else {\n process.env.NODE_ENV !== 'production' && warn('Invalid setter expression: ' + exp);\n }\n}\n\n/**\n * Parse an expression into re-written getter/setters.\n *\n * @param {String} exp\n * @param {Boolean} needSet\n * @return {Function}\n */\n\nfunction parseExpression$1(exp, needSet) {\n exp = exp.trim();\n // try cache\n var hit = expressionCache.get(exp);\n if (hit) {\n if (needSet && !hit.set) {\n hit.set = compileSetter(hit.exp);\n }\n return hit;\n }\n var res = { exp: exp };\n res.get = isSimplePath(exp) && exp.indexOf('[') < 0\n // optimized super simple getter\n ? makeGetterFn('scope.' + exp)\n // dynamic getter\n : compileGetter(exp);\n if (needSet) {\n res.set = compileSetter(exp);\n }\n expressionCache.put(exp, res);\n return res;\n}\n\n/**\n * Check if an expression is a simple path.\n *\n * @param {String} exp\n * @return {Boolean}\n */\n\nfunction isSimplePath(exp) {\n return pathTestRE.test(exp) &&\n // don't treat literal values as paths\n !literalValueRE$1.test(exp) &&\n // Math constants e.g. Math.PI, Math.E etc.\n exp.slice(0, 5) !== 'Math.';\n}\n\nvar expression = Object.freeze({\n parseExpression: parseExpression$1,\n isSimplePath: isSimplePath\n});\n\n// we have two separate queues: one for directive updates\n// and one for user watcher registered via $watch().\n// we want to guarantee directive updates to be called\n// before user watchers so that when user watchers are\n// triggered, the DOM would have already been in updated\n// state.\n\nvar queue = [];\nvar userQueue = [];\nvar has = {};\nvar circular = {};\nvar waiting = false;\n\n/**\n * Reset the batcher's state.\n */\n\nfunction resetBatcherState() {\n queue.length = 0;\n userQueue.length = 0;\n has = {};\n circular = {};\n waiting = false;\n}\n\n/**\n * Flush both queues and run the watchers.\n */\n\nfunction flushBatcherQueue() {\n var _again = true;\n\n _function: while (_again) {\n _again = false;\n\n runBatcherQueue(queue);\n runBatcherQueue(userQueue);\n // user watchers triggered more watchers,\n // keep flushing until it depletes\n if (queue.length) {\n _again = true;\n continue _function;\n }\n // dev tool hook\n /* istanbul ignore if */\n if (devtools && config.devtools) {\n devtools.emit('flush');\n }\n resetBatcherState();\n }\n}\n\n/**\n * Run the watchers in a single queue.\n *\n * @param {Array} queue\n */\n\nfunction runBatcherQueue(queue) {\n // do not cache length because more watchers might be pushed\n // as we run existing watchers\n for (var i = 0; i < queue.length; i++) {\n var watcher = queue[i];\n var id = watcher.id;\n has[id] = null;\n watcher.run();\n // in dev build, check and stop circular updates.\n if (process.env.NODE_ENV !== 'production' && has[id] != null) {\n circular[id] = (circular[id] || 0) + 1;\n if (circular[id] > config._maxUpdateCount) {\n warn('You may have an infinite update loop for watcher ' + 'with expression \"' + watcher.expression + '\"', watcher.vm);\n break;\n }\n }\n }\n queue.length = 0;\n}\n\n/**\n * Push a watcher into the watcher queue.\n * Jobs with duplicate IDs will be skipped unless it's\n * pushed when the queue is being flushed.\n *\n * @param {Watcher} watcher\n * properties:\n * - {Number} id\n * - {Function} run\n */\n\nfunction pushWatcher(watcher) {\n var id = watcher.id;\n if (has[id] == null) {\n // push watcher into appropriate queue\n var q = watcher.user ? userQueue : queue;\n has[id] = q.length;\n q.push(watcher);\n // queue the flush\n if (!waiting) {\n waiting = true;\n nextTick(flushBatcherQueue);\n }\n }\n}\n\nvar uid$2 = 0;\n\n/**\n * A watcher parses an expression, collects dependencies,\n * and fires callback when the expression value changes.\n * This is used for both the $watch() api and directives.\n *\n * @param {Vue} vm\n * @param {String|Function} expOrFn\n * @param {Function} cb\n * @param {Object} options\n * - {Array} filters\n * - {Boolean} twoWay\n * - {Boolean} deep\n * - {Boolean} user\n * - {Boolean} sync\n * - {Boolean} lazy\n * - {Function} [preProcess]\n * - {Function} [postProcess]\n * @constructor\n */\nfunction Watcher(vm, expOrFn, cb, options) {\n // mix in options\n if (options) {\n extend(this, options);\n }\n var isFn = typeof expOrFn === 'function';\n this.vm = vm;\n vm._watchers.push(this);\n this.expression = expOrFn;\n this.cb = cb;\n this.id = ++uid$2; // uid for batching\n this.active = true;\n this.dirty = this.lazy; // for lazy watchers\n this.deps = [];\n this.newDeps = [];\n this.depIds = new _Set();\n this.newDepIds = new _Set();\n this.prevError = null; // for async error stacks\n // parse expression for getter/setter\n if (isFn) {\n this.getter = expOrFn;\n this.setter = undefined;\n } else {\n var res = parseExpression$1(expOrFn, this.twoWay);\n this.getter = res.get;\n this.setter = res.set;\n }\n this.value = this.lazy ? undefined : this.get();\n // state for avoiding false triggers for deep and Array\n // watchers during vm._digest()\n this.queued = this.shallow = false;\n}\n\n/**\n * Evaluate the getter, and re-collect dependencies.\n */\n\nWatcher.prototype.get = function () {\n this.beforeGet();\n var scope = this.scope || this.vm;\n var value;\n try {\n value = this.getter.call(scope, scope);\n } catch (e) {\n if (process.env.NODE_ENV !== 'production' && config.warnExpressionErrors) {\n warn('Error when evaluating expression ' + '\"' + this.expression + '\": ' + e.toString(), this.vm);\n }\n }\n // \"touch\" every property so they are all tracked as\n // dependencies for deep watching\n if (this.deep) {\n traverse(value);\n }\n if (this.preProcess) {\n value = this.preProcess(value);\n }\n if (this.filters) {\n value = scope._applyFilters(value, null, this.filters, false);\n }\n if (this.postProcess) {\n value = this.postProcess(value);\n }\n this.afterGet();\n return value;\n};\n\n/**\n * Set the corresponding value with the setter.\n *\n * @param {*} value\n */\n\nWatcher.prototype.set = function (value) {\n var scope = this.scope || this.vm;\n if (this.filters) {\n value = scope._applyFilters(value, this.value, this.filters, true);\n }\n try {\n this.setter.call(scope, scope, value);\n } catch (e) {\n if (process.env.NODE_ENV !== 'production' && config.warnExpressionErrors) {\n warn('Error when evaluating setter ' + '\"' + this.expression + '\": ' + e.toString(), this.vm);\n }\n }\n // two-way sync for v-for alias\n var forContext = scope.$forContext;\n if (forContext && forContext.alias === this.expression) {\n if (forContext.filters) {\n process.env.NODE_ENV !== 'production' && warn('It seems you are using two-way binding on ' + 'a v-for alias (' + this.expression + '), and the ' + 'v-for has filters. This will not work properly. ' + 'Either remove the filters or use an array of ' + 'objects and bind to object properties instead.', this.vm);\n return;\n }\n forContext._withLock(function () {\n if (scope.$key) {\n // original is an object\n forContext.rawValue[scope.$key] = value;\n } else {\n forContext.rawValue.$set(scope.$index, value);\n }\n });\n }\n};\n\n/**\n * Prepare for dependency collection.\n */\n\nWatcher.prototype.beforeGet = function () {\n Dep.target = this;\n};\n\n/**\n * Add a dependency to this directive.\n *\n * @param {Dep} dep\n */\n\nWatcher.prototype.addDep = function (dep) {\n var id = dep.id;\n if (!this.newDepIds.has(id)) {\n this.newDepIds.add(id);\n this.newDeps.push(dep);\n if (!this.depIds.has(id)) {\n dep.addSub(this);\n }\n }\n};\n\n/**\n * Clean up for dependency collection.\n */\n\nWatcher.prototype.afterGet = function () {\n Dep.target = null;\n var i = this.deps.length;\n while (i--) {\n var dep = this.deps[i];\n if (!this.newDepIds.has(dep.id)) {\n dep.removeSub(this);\n }\n }\n var tmp = this.depIds;\n this.depIds = this.newDepIds;\n this.newDepIds = tmp;\n this.newDepIds.clear();\n tmp = this.deps;\n this.deps = this.newDeps;\n this.newDeps = tmp;\n this.newDeps.length = 0;\n};\n\n/**\n * Subscriber interface.\n * Will be called when a dependency changes.\n *\n * @param {Boolean} shallow\n */\n\nWatcher.prototype.update = function (shallow) {\n if (this.lazy) {\n this.dirty = true;\n } else if (this.sync || !config.async) {\n this.run();\n } else {\n // if queued, only overwrite shallow with non-shallow,\n // but not the other way around.\n this.shallow = this.queued ? shallow ? this.shallow : false : !!shallow;\n this.queued = true;\n // record before-push error stack in debug mode\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && config.debug) {\n this.prevError = new Error('[vue] async stack trace');\n }\n pushWatcher(this);\n }\n};\n\n/**\n * Batcher job interface.\n * Will be called by the batcher.\n */\n\nWatcher.prototype.run = function () {\n if (this.active) {\n var value = this.get();\n if (value !== this.value ||\n // Deep watchers and watchers on Object/Arrays should fire even\n // when the value is the same, because the value may\n // have mutated; but only do so if this is a\n // non-shallow update (caused by a vm digest).\n (isObject(value) || this.deep) && !this.shallow) {\n // set new value\n var oldValue = this.value;\n this.value = value;\n // in debug + async mode, when a watcher callbacks\n // throws, we also throw the saved before-push error\n // so the full cross-tick stack trace is available.\n var prevError = this.prevError;\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && config.debug && prevError) {\n this.prevError = null;\n try {\n this.cb.call(this.vm, value, oldValue);\n } catch (e) {\n nextTick(function () {\n throw prevError;\n }, 0);\n throw e;\n }\n } else {\n this.cb.call(this.vm, value, oldValue);\n }\n }\n this.queued = this.shallow = false;\n }\n};\n\n/**\n * Evaluate the value of the watcher.\n * This only gets called for lazy watchers.\n */\n\nWatcher.prototype.evaluate = function () {\n // avoid overwriting another watcher that is being\n // collected.\n var current = Dep.target;\n this.value = this.get();\n this.dirty = false;\n Dep.target = current;\n};\n\n/**\n * Depend on all deps collected by this watcher.\n */\n\nWatcher.prototype.depend = function () {\n var i = this.deps.length;\n while (i--) {\n this.deps[i].depend();\n }\n};\n\n/**\n * Remove self from all dependencies' subcriber list.\n */\n\nWatcher.prototype.teardown = function () {\n if (this.active) {\n // remove self from vm's watcher list\n // this is a somewhat expensive operation so we skip it\n // if the vm is being destroyed or is performing a v-for\n // re-render (the watcher list is then filtered by v-for).\n if (!this.vm._isBeingDestroyed && !this.vm._vForRemoving) {\n this.vm._watchers.$remove(this);\n }\n var i = this.deps.length;\n while (i--) {\n this.deps[i].removeSub(this);\n }\n this.active = false;\n this.vm = this.cb = this.value = null;\n }\n};\n\n/**\n * Recrusively traverse an object to evoke all converted\n * getters, so that every nested property inside the object\n * is collected as a \"deep\" dependency.\n *\n * @param {*} val\n */\n\nvar seenObjects = new _Set();\nfunction traverse(val, seen) {\n var i = undefined,\n keys = undefined;\n if (!seen) {\n seen = seenObjects;\n seen.clear();\n }\n var isA = isArray(val);\n var isO = isObject(val);\n if ((isA || isO) && Object.isExtensible(val)) {\n if (val.__ob__) {\n var depId = val.__ob__.dep.id;\n if (seen.has(depId)) {\n return;\n } else {\n seen.add(depId);\n }\n }\n if (isA) {\n i = val.length;\n while (i--) traverse(val[i], seen);\n } else if (isO) {\n keys = Object.keys(val);\n i = keys.length;\n while (i--) traverse(val[keys[i]], seen);\n }\n }\n}\n\nvar text$1 = {\n\n bind: function bind() {\n this.attr = this.el.nodeType === 3 ? 'data' : 'textContent';\n },\n\n update: function update(value) {\n this.el[this.attr] = _toString(value);\n }\n};\n\nvar templateCache = new Cache(1000);\nvar idSelectorCache = new Cache(1000);\n\nvar map = {\n efault: [0, '', ''],\n legend: [1, '
', '
'],\n tr: [2, '', '
'],\n col: [2, '', '
']\n};\n\nmap.td = map.th = [3, '', '
'];\n\nmap.option = map.optgroup = [1, ''];\n\nmap.thead = map.tbody = map.colgroup = map.caption = map.tfoot = [1, '', '
'];\n\nmap.g = map.defs = map.symbol = map.use = map.image = map.text = map.circle = map.ellipse = map.line = map.path = map.polygon = map.polyline = map.rect = [1, '', ''];\n\n/**\n * Check if a node is a supported template node with a\n * DocumentFragment content.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\nfunction isRealTemplate(node) {\n return isTemplate(node) && isFragment(node.content);\n}\n\nvar tagRE$1 = /<([\\w:-]+)/;\nvar entityRE = /&#?\\w+?;/;\nvar commentRE = / X : near and far walls\r\n \r\n var dummy = new THREE.Vector3();\r\n var camPosition = room.camera.getWorldPosition(dummy);\r\n var distanceRoom = PointBoxDistance(camPosition, config.pictureRoomBoundingBox);\r\n var inside = distanceRoom <= 0\r\n \r\n var center = new THREE.Vector3(config.pictureRoomBoundingBox.center.x, 0, config.pictureRoomBoundingBox.center.z);\r\n var size = new THREE.Vector3(config.pictureRoomBoundingBox.size.x, 0, config.pictureRoomBoundingBox.size.z);\r\n var halfSize = size.multiplyScalar(0.5);\r\n var corners = [];\r\n corners[0] = center.clone().add(new THREE.Vector3(halfSize.x, 0, halfSize.z));\r\n corners[1] = center.clone().add(new THREE.Vector3(halfSize.x, 0, -halfSize.z));\r\n corners[2] = center.clone().add(new THREE.Vector3(-halfSize.x, 0, halfSize.z));\r\n corners[3] = center.clone().add(new THREE.Vector3(-halfSize.x, 0, -halfSize.z));\r\n var camPosition2D = new THREE.Vector3(room.camera.position.x, 0, room.camera.position.z);\r\n for (var i = 0; i < room.scene.roomWalls.length; i++) {\r\n room.scene.roomWalls[i].camDistance = camPosition2D.distanceTo(room.scene.roomWalls[i].centerOfMass);\r\n }\r\n if(inside && !prevInside)\r\n {\r\n fadeIn(room); \r\n }\r\n else if(!inside && prevInside)\r\n {\r\n fadeOut(room);\r\n }\r\n\r\n room.scene.roomWalls.sort((a, b) => (a.camDistance < b.camDistance) ? 1 : ((b.camDistance < a.camDistance) ? -1 : 0))\r\n \r\n var baseNumber = 0;\r\n baseNumber = SetRenderOrders(room.scene.roomWalls, room.globals.objects.tourObjects, baseNumber);\r\n\r\n \r\n if(!room.controls.orbit.wiggle)\r\n {\r\n if(prevCamPos != null && camPosition.x == prevCamPos.x && camPosition.y == prevCamPos.y && camPosition.z == prevCamPos.z)\r\n {\r\n FramesSinceMove++;\r\n }\r\n else\r\n {\r\n FramesSinceMove=0;\r\n }\r\n }\r\n \r\n if(FramesSinceMove > 8 * 60 && !room.controls.orbit.wiggle)\r\n {\r\n room.controls.orbit.startWiggle();\r\n }\r\n\r\n \r\n room.renderer.render(room.scene, room.camera);\r\n\t// room.composer.render();\r\n PrevLocked = room.state.locked;\r\n prevInside = inside;\r\n\r\n prevCamPos = camPosition.clone();\r\n}\r\n\r\n\r\n","import room from '../framework/index'\r\nimport { gimbalLock, gimbalRotation } from '../utils/compass'\r\nimport { library } from '../collections/pictureRoomData'\r\nimport { slideCamera, transitionFrontWallsToOpacity, transitionStaticObjectsOpacity, FadeButtonsDown, FreeOrbit } from '../utils/tweens'\r\nimport config from \"../utils/config\"\r\n\r\nfunction clamp(value, min, max) {\r\n return Math.min(value, Math.max(value, min));\r\n}\r\n\r\nfunction lerp(start, end, percent) {\r\n return start * (1.0 - percent) + end * percent;\r\n}\r\n\r\nfunction Slerp(start, end, percent) {\r\n var startv2 = new THREE.Vector2(start.x, start.z);\r\n var endv2 = new THREE.Vector2(end.x, end.z);\r\n\r\n var startv2Normalized = new THREE.Vector2(start.x, start.z).normalize();\r\n var endv2Normalized = new THREE.Vector2(end.x, end.z).normalize();\r\n\r\n var dot = startv2Normalized.dot(endv2Normalized);\r\n dot = clamp(dot, -1, 1); // Robustness: Stay within domain of acos()\r\n var theta_0 = Math.acos(dot); // theta_0 = angle between input vectors\r\n var theta = theta_0 * percent; // theta = angle between v0 and result \r\n\r\n var ortho = new THREE.Vector2(-startv2.y, startv2.x);\r\n\r\n var result0 = startv2.multiplyScalar(Math.cos(theta));\r\n var result1 = ortho.multiplyScalar(Math.sin(theta));\r\n\r\n var resultv2 = result0.add(result1);\r\n\r\n var y = lerp(start.y, end.y, percent);\r\n return new THREE.Vector3(resultv2.x, y, resultv2.y);\r\n}\r\n\r\n\r\nfunction RaySphereIntersect(rayOrigin, rayDirection, spherePosition, sphereRadius) {\r\n var t0, t1;\r\n var radius2 = sphereRadius * sphereRadius;\r\n\r\n // geometric solution\r\n var L = spherePosition.clone().sub(rayOrigin);\r\n var tca = L.dot(rayDirection);\r\n if (tca < 0) return false;\r\n var d2 = L.dot(L) - tca * tca;\r\n if (d2 > radius2) return false;\r\n var thc = Math.sqrt(radius2 - d2);\r\n t0 = tca - thc;\r\n t1 = tca + thc;\r\n\r\n if (t0 > t1) {\r\n var tmp = t0;\r\n t0 = t1;\r\n t1 = tmp;\r\n }\r\n\r\n if (t0 < 0) {\r\n t0 = t1; // if t0 is negative, let's use t1 instead \r\n if (t0 < 0) return false; // both t0 and t1 are negative \r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction genTweenConfig(picture) {\r\n const target = { ...picture.getWorldPosition() }\r\n var cameraPosition;\r\n if(picture.userData.tour.cameraPosition != null)\r\n {\r\n cameraPosition = picture.userData.tour.cameraPosition;\r\n }\r\n else\r\n {\r\n const { gimbal } = picture.userData.tour\r\n const [a, b] = gimbalRotation(gimbal)\r\n const lock = gimbalLock(gimbal)\r\n var lockDist = 1.5;\r\n \r\n if (gimbal == \"WEST\") lockDist *= -1;\r\n if (gimbal == \"NORTH\") lockDist *= -1;\r\n if (gimbal == \"DOWN\") lockDist *= -1;\r\n lockDist = target[lock] - lockDist;\r\n \r\n cameraPosition = { [a]: target[a], [b]: target[b], [lock]: lockDist };\r\n }\r\n return {\r\n camera: room.camera,\r\n dolly: room.globals.dolly,\r\n targets: {\r\n dolly: target,\r\n camera: cameraPosition\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\n//Fades walls back after intro\r\nfunction fadeBackIn(index) {\r\n return new Promise(resolve => {\r\n resolve();\r\n })\r\n}\r\n\r\nfunction beginTour({ initalCamera }) {\r\n return new Promise((resolve) => {\r\n room.onAction({ type: 'CUSTOM', trigger: 'TRANSITION', method: 'TOUR', param: config.tourStartPos }).then(() => {\r\n resolve()\r\n })\r\n\r\n {\r\n //Move camera dolly\r\n var initialDollyPos = room.globals.dolly.position.clone();\r\n var targetDollyPos = new THREE.Vector3(config.dollyPosition.x,config.dollyPosition.y, config.dollyPosition.z);\r\n var O = initialDollyPos.clone().add(targetDollyPos).multiplyScalar(0.5);\r\n \r\n var rayOrigin = initialDollyPos.clone();\r\n var rayDirection = targetDollyPos.clone().sub(rayOrigin);\r\n var intersect = RaySphereIntersect(rayOrigin, rayDirection, room.camera.getWorldPosition(), 0.5);\r\n if (intersect) {\r\n var t = { t: 0 }; \r\n new TWEEN.Tween(t)\r\n .to({ t: 1 }, 2000)\r\n .easing(TWEEN.Easing.Cubic.Out)\r\n .onUpdate(function (object) {\r\n var currentPos = new THREE.Vector3(0, 0, 0);\r\n currentPos = Slerp(initialDollyPos.clone().sub(O), targetDollyPos.clone().sub(O), t.t).add(O);\r\n room.globals.dolly.position.setX(currentPos.x);\r\n room.globals.dolly.position.setY(currentPos.y);\r\n room.globals.dolly.position.setZ(currentPos.z);\r\n })\r\n .start()\r\n }\r\n else {\r\n new TWEEN.Tween(room.globals.dolly.position)\r\n .to(targetDollyPos, 2000)\r\n .easing(TWEEN.Easing.Cubic.Out)\r\n .start()\r\n }\r\n }\r\n })\r\n}\r\n\r\nfunction handlePanels(picture) {\r\n return new Promise(resolve => {\r\n // emit picture data\r\n const trigger = picture.userData.tour.trigger\r\n const data = { ...picture.userData }\r\n const callback = (next) => {\r\n next({ data, message: 'ressigned callback to enable data control' })\r\n }\r\n if (trigger) room.onAction({ type: 'TBC', trigger, callback })\r\n resolve()\r\n })\r\n}\r\n\r\n\r\nconst connectAppState = () => {\r\n let currentTour = null\r\n let index = -1\r\n let debounce = false\r\n\r\n function update() {\r\n const nextPictureId = currentTour.sequence[index]\r\n room.onAction({ type: 'TBC', trigger: \"TOUR_UPDATE\", callback: (next) => next(index) })\r\n if (currentTour.id !== 'tests') room.currentFocus = room.globals.pics.find(({ userData }) => userData.id === nextPictureId)\r\n // if (currentTour.id === 'tests') room.currentFocus = room.globals.tests.find(({ userData }) => userData.id === nextPictureId)\r\n \r\n return inspect()\r\n }\r\n\r\n function inspect() {\r\n\r\n return new Promise((resolve) => {\r\n fadeBackIn(index).then(() => {\r\n handlePanels(room.currentFocus)\r\n .then(() => slideCamera(genTweenConfig(room.currentFocus), room.controls.orbit)\r\n .onComplete(() => {\r\n // room.currentFocus.material.opacity = 0\r\n debounce = false\r\n resolve()\r\n }))\r\n })\r\n\r\n })\r\n }\r\n function hasTourCompleted() {\r\n if (index === currentTour.sequence.length - 1) {\r\n // trigger listener\r\n room.onAction({ type: 'TBC', trigger: \"TOUR_ENDED\", callback: (next) => next({ currentTour }) })\r\n }\r\n }\r\n return {\r\n META: () => library.pictureRoom,\r\n START: (id) => {\r\n const newTour = library.tours.find(tour => tour.id === id)\r\n if (newTour) { // reset\r\n currentTour = newTour\r\n room.currentFocus = null\r\n index = -1\r\n \r\n\r\n } else console.error('No Tour found', id)\r\n return beginTour({ ...currentTour })\r\n },\r\n STORE: () => {\r\n return Promise.resolve({ currentTour, index })\r\n },\r\n NEXT: () => {\r\n if (debounce) return Promise.resolve()\r\n \r\n debounce = true\r\n if (currentTour) {\r\n if (index === currentTour.sequence.length - 1) return Promise.resolve()\r\n index++\r\n \r\n //Fade up current object \r\n var tourObject3D = room.globals.objects.tourObjects.get(currentTour.sequence[index]);\r\n var t = new TWEEN.Tween(tourObject3D.material.uniforms.transparency)\r\n .to({ value: config.tourObjectFocusTransparency }, 2000)\r\n .easing(TWEEN.Easing.Cubic.Out)\r\n .start()\r\n \r\n //Fade down current object \r\n if(index>0)\r\n {\r\n var prevTourObject3D = room.globals.objects.tourObjects.get(currentTour.sequence[index-1]);\r\n var t = new TWEEN.Tween(prevTourObject3D.material.uniforms.transparency)\r\n .to({ value: config.tourGlobalTransparency }, 2000)\r\n .easing(TWEEN.Easing.Cubic.Out)\r\n .start()\r\n }\r\n\r\n\r\n\r\n hasTourCompleted()\r\n return update()\r\n }\r\n return Promise.resolve()\r\n },\r\n PREV: () => {\r\n if (debounce) return Promise.resolve()\r\n if (index <= 0) return Promise.resolve()\r\n debounce = true\r\n index--\r\n\r\n //Fade up current object \r\n var tourObject3D = room.globals.objects.tourObjects.get(currentTour.sequence[index]);\r\n var t = new TWEEN.Tween(tourObject3D.material.uniforms.transparency)\r\n .to({ value: config.tourObjectFocusTransparency }, 2000)\r\n .easing(TWEEN.Easing.Cubic.Out)\r\n .start()\r\n \r\n //Fade down current object \r\n if(index < currentTour.sequence.length-1)\r\n {\r\n var prevTourObject3D = room.globals.objects.tourObjects.get(currentTour.sequence[index+1]);\r\n var t = new TWEEN.Tween(prevTourObject3D.material.uniforms.transparency)\r\n .to({ value: config.tourGlobalTransparency }, 2000)\r\n .easing(TWEEN.Easing.Cubic.Out)\r\n .start()\r\n }\r\n\r\n\r\n return update()\r\n }\r\n }\r\n}\r\n\r\n\r\nexport default connectAppState","export default function () {\r\n let count = 0\r\n return {\r\n NEXT: () => {\r\n count++\r\n return Promise.resolve(count)\r\n },\r\n PREV: () => {\r\n count--\r\n return Promise.resolve(count)\r\n },\r\n CURRENT: () => {\r\n return Promise.resolve(count)\r\n }\r\n }\r\n}","import room from '../framework/index'\r\nimport config from \"../utils/config\"\r\nimport {transitionFrontWallsToOpacity, transitionStaticObjectsOpacity } from '../utils/tweens'\r\n\r\nconst transitionHandler = () => {\r\n return {\r\n 'TOUR': (pos) => transition('TOUR', 'ROOM_INSIDE', pos),\r\n 'ROOM': () => transition('ROOM', 'ROOM_OUTSIDE')\r\n }\r\n}\r\n\r\nfunction transition(view, tween, tweenParam) {\r\n return new Promise((resolve) => {\r\n const debounce = room.controls.debounceState()\r\n const endState = debounce(view)\r\n runTween(tween, tweenParam).then(() => resolve(endState()))\r\n })\r\n}\r\n\r\nfunction runTween(state, tweenParam) {\r\n return new Promise((resolve, reject) => {\r\n const action = cameraMap[state]\r\n if (action) action(tweenParam).start().onComplete(() => resolve())\r\n else reject()\r\n })\r\n}\r\n\r\nconst cameraMap = {\r\n 'ROOM_INSIDE': function (tourStartPos = config.tourStartPos) {\r\n return new TWEEN.Tween(room.camera.position)\r\n .to(tourStartPos, 3000)\r\n .easing(TWEEN.Easing.Cubic.Out)\r\n },\r\n 'ROOM_OUTSIDE': function () {\r\n new TWEEN.Tween(room.globals.dolly.position)\r\n .to({ x: 0, y: 0, z: 0 }, 2000)\r\n .easing(TWEEN.Easing.Cubic.Out)\r\n .start()\r\n\r\n const [x, y, z] = config.startPoint\r\n return new TWEEN.Tween(room.camera.position)\r\n .to({ x, y, z }, 3000)\r\n .easing(TWEEN.Easing.Cubic.Out)\r\n }\r\n}\r\n\r\n\r\n\r\n\r\nexport default transitionHandler","import room from '../framework/index'\r\nimport createTourState from './tourController'\r\nimport testController from './testController'\r\nimport transitionHandler from './stateControllers'\r\n\r\nfunction watcher(callback) {\r\n return {\r\n subscribe: (method, resolve, param1) => method((param2) => {\r\n // TODO - clean params based on useage\r\n callback(param1 || param2) // onComplete call to instantiator\r\n resolve() // end framework control lock\r\n })\r\n }\r\n}\r\n\r\nexport default function (listeners = []) {\r\n // bind interaction events to framework\r\n room.useEvent('COUNT', testController())\r\n room.useEvent('TOUR', createTourState())\r\n room.useEvent('TRANSITION', transitionHandler())\r\n room.useEvent('VIEWPORT', widthHandler())\r\n // expose internal events to customisable listeners\r\n listeners.forEach(({ name, callback }) => room.useEvent(name, watcher(callback)))\r\n}\r\n\r\n\r\nfunction widthHandler() {\r\n let full = true\r\n return {\r\n TOGGLE: () => {\r\n if (full) {\r\n room.renderer.domElement.classList.add('half')\r\n full = false\r\n } else {\r\n room.renderer.domElement.classList.remove('half')\r\n full = true\r\n }\r\n\r\n setTimeout(() => {\r\n room.controls.updateViewport2()\r\n }, 10)\r\n\r\n return Promise.resolve()\r\n }\r\n }\r\n}","import config from './utils/config'\r\nimport room from './framework/index'\r\nimport { render, animate } from './render'\r\nimport setupInteractions from './controllers/index'\r\n\r\nfunction build(target, callback) {\r\n\r\n function init(listeners) {\r\n setupInteractions(listeners)\r\n callback(room)\r\n // render()\r\n // setTimeout(() => {\r\n // const viewHandler = room.emit('TRANSITION')\r\n // viewHandler('ROOM', () => console.log('Tour mode'))\r\n // }, 5000)\r\n\r\n }\r\n\r\n // TODO - configure unmount - controlled by web app\r\n return {\r\n app: room,\r\n mount: (listeners) => room.setup(target).then(() => init(listeners)),\r\n unmount: () => {\r\n animate.on = false\r\n room.unmount()\r\n },\r\n test: (action, param) => console.log(action, param),\r\n start: () => {\r\n animate.on = true\r\n render()\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\n// trigger room events from app\r\n// const myAction = room.emit('COUNT')\r\n// myAction('NEXT', (data) => console.log('complete', data))\r\n\r\n\r\nif (config.sandbox) {\r\n // mount api\r\n const app = build(false, () => {\r\n // console.log('built sandbox')\r\n render(true)\r\n })\r\n .mount([\r\n { name: 'WATCH', callback: (res) => console.log(res) },\r\n { name: 'VIEW_PICTURE', callback: (res) => console.log(res) }\r\n ])\r\n}\r\n\r\nexport default build ","import pictureCollection from './pictureCollection'\r\n\r\nconst content = {\r\n ROOM: {\r\n label: `Drawing Office`,\r\n description: \r\n [\r\n `This small mezzanine Drawing Office, above the Colonnade at Sir John Soane’s Museum, was at the heart of Soane’s architectural practice from the time of his move to 13 Lincoln’s Inn Fields in 1812 until his retirement in 1833. He designed it himself and modified it several times before it took the final form that survives today in 1824-25.`,\r\n `The Office is essentially like a table, a platform supported on columns, within the larger space at the back of the Museum, and is not attached to the main walls. Its design was described as ‘novel and ingenious’ in Soane’s time. Two long skylights above illuminate not only the long mahogany desks but also the Museum below. Here Soane’s pupils worked surrounded by more than 100 casts and models.`,\r\n `In 2022-23 this space was restored: the original colour scheme was reinstated, the casts were cleaned and re-hung in their original arrangement and more than 60 works, missing for many years, were brought back and replaced in their original positions. After almost 200 years, Soane’s Office, perhaps the earliest surviving architect’s drawing office in the world, can once again serve as a place of artistic inspiration.`\r\n ]\r\n },\r\n TOUR: { \r\n label: `Tours`,\r\n title: `Take a tour of the Drawing Office`,\r\n description: [\r\n ``\r\n ]\r\n },\r\n MAP: {\r\n label: `Drawing Office`,\r\n title: `Take a tour of the Picture Room`,\r\n description: [`The Picture Room contains some of John Soane’s greatest treasures, including masterpieces by Hogarth, Canaletto, Turner and Piranesi as well as works by his contemporaries considered ‘modern’ in his lifetime. It also presents many watercolours of Soane’s own projects by Joseph Gandy, a freelance architect and artist who captures the effects achieved in Soane’s architecture in his wonderfully varied compositions, most of them originally intended for exhibition at the Royal Academy. `,\r\n `Choose one of five tours each featuring a selection of the wonderful paintings in Soane’s Picture Room and learn about his life, collection, and architecture.`]\r\n }\r\n}\r\n\r\n\r\n\r\n\r\nconst tour1 = {\r\n id: `t1`, \r\n label: `Tour 1`,\r\n title: `At work in Soane’s Drawing Office`,\r\n image: `/assets/img/drawing-office/thumbs/TourImage.jpg`,\r\n imageDesc: `Photo: Gareth Gardner, 2023`,\r\n intro: `In this small office between four and six pupils worked six days a week, 9am-8pm, supervised by Assistants. These boys (aged about 16) were articled/apprenticed to Soane for five years, their families paying a £157 premium for their education in the ‘Art, Profession and Business’ of architecture. They sat or stood at their drawing boards copying and re-copying architectural plans, elevations and sections as designs evolved, producing lecture drawings for Soane (1,000 survive: some of them six feet long) or making up accounts. To improve their draughtsmanship they practised lettering, shadowing and adding borders to drawings and learned the language of classical architecture by drawing the casts on the walls surrounding them. They studied construction, making site visits to draw buildings in progress or to measure built work and verify its cost. An echo of their voices can be heard in the entries they made in the Day Books, where they recorded what they did each day. Surviving ink-stained, worn, quill pens discovered at the back of Office drawers in the recent restoration are a testament to their labours.`,\r\n description: [\r\n `

In this small office between four and six pupils worked six days a week, 9am-8pm, supervised by Assistants. These boys (aged about 16) were articled/apprenticed to Soane for five years, their families paying a £157 premium for their education in the ‘Art, Profession and Business’ of architecture. They sat or stood at their drawing boards copying and re-copying architectural plans, elevations and sections as designs evolved, producing lecture drawings for Soane (1,000 survive: some of them six feet long) or making up accounts.

To improve their draughtsmanship they practised lettering, shadowing and adding borders to drawings and learned the language of classical architecture by drawing the casts on the walls surrounding them. They studied construction, making site visits to draw buildings in progress or to measure built work and verify its cost.

An echo of their voices can be heard in the entries they made in the Day Books, where they recorded what they did each day. Surviving ink-stained, worn, quill pens discovered at the back of Office drawers in the recent restoration are a testament to their labours.

`,\r\n ],\r\n sequence: ['OBJ01', 'OBJ02', 'OBJ03', 'OBJ17', 'OBJ04', 'OBJ05', 'OBJ06', 'OBJ07', 'OBJ08', 'OBJ09', 'OBJ10', 'OBJ11', 'OBJ12'], //South tour\r\n // sequence: ['OBJ01', 'OBJ02'], //South tour\r\n initalCamera: { x: 2.81, y: -0.8046, z: 0.083 }\r\n}\r\nexport const library = {\r\n content,\r\n tours: [tour1],\r\n pictureCollection\r\n}","import template from '../templates/tour-carousel.html'\nimport { library } from '../drawingOffice/js/collections/pictureRoomData'\nconst assets = '/assets/img/drawing-office'\n\nexport default {\n name: 'tour-carousel',\n template,\n props: ['collection'],\n data() {\n return {\n current: 0,\n }\n },\n computed: {\n slides() {\n const { sequence } = library.tours.find(tour => tour.id === this.collection)\n console.log(sequence, this.collection, library.tours);\n return sequence.map(pid => `${assets}/thumbs/${pid}.jpg`)\n }\n },\n methods: {\n background(index) {\n return `background-image: url(${this.slides[index]})`\n },\n next(index) {\n this.current = index //((this.current + 1) < this.related.length) ? this.current + 1 : 0\n },\n prev() {\n this.current = ((this.current - 1) < 0) ? this.related.length - 1 : this.current - 1\n },\n },\n}","import Template from '../templates/view-tour-drawingoffice.html'\nimport TourCarousel from './DrawingOfficeTourCarousel'\n\nexport default {\n name: 'view-tour-drawingoffice',\n template: Template,\n components: [TourCarousel],\n props: ['page', 'core', 'model'],\n data() { \n return {\n show: false,\n fragment: null\n }\n },\n computed: {\n source() {\n const assets = '/assets/img/picture-room' \n if (!this.model) return ''\n return `${assets}/thumbs/${this.model.id}.jpg`\n },\n tourSummary() {\n return this.core.drawingOffice.view === 'TOUR' && !this.core.drawingOffice.tour.hasStarted \n },\n tourSelection() {\n return this.core.drawingOffice.view === 'ROOM' || this.core.drawingOffice.view === 'TOUR' && this.core.drawingOffice.tour.hasStarted\n },\n },\n methods: {\n exitTour() {\n const { view } = this.core.drawingOffice\n // if (view === 'TOUR') {\n this.$parent.$parent.$dispatch('exit-tour')\n this.$parent.$parent.$dispatch('close-drawing-inspector')\n // }\n },\n toggleFullWidth() {\n this.$dispatch('toggleFullWidth')\n },\n next() {\n this.$parent.$parent.sandbox.app.onAction({ trigger: 'TOUR', method: 'NEXT', type: 'CTA' })\n this.core.drawingOffice.tour.hasStarted = true\n },\n prev() {\n this.$parent.$parent.sandbox.app.onAction({ trigger: 'TOUR', method: 'PREV', type: 'CTA' })\n }\n },\n\n beforeDestroy() {\n if (this.fragment) this.fragment.$destroy;\n }\n}","import Template from '../templates/state-inspector-drawingoffice.html'\r\nimport { library } from '../DrawingOffice/js/collections/pictureRoomData'\r\n// import ViewPicture from './ViewPicture' // need to seperate into 2 files\r\nimport ViewTour from './ViewTourDrawingOffice' // need to seperate into 2 files\r\nimport config from \"../DrawingOffice/js/utils/config\"\r\nimport { RoomOrbit, InspectOrbit } from \"../DrawingOffice/js/utils/tweens\"\r\n\r\n\r\nexport default {\r\n name: 'DrawingOfficeInspector',\r\n template: Template,\r\n components: [Poi, ViewTour],\r\n props: ['poi', 'core'],\r\n data() {\r\n return {\r\n currentComponent: 'view-tour-drawingoffice',\r\n dropdown: false,\r\n debounceFold: false,\r\n }\r\n },\r\n computed: {\r\n opaque() {\r\n return (this.currentComponent == 'view-tour-drawingoffice')\r\n },\r\n hideNav() {\r\n return this.core.layout.modal\r\n },\r\n darkenView() {\r\n return (this.core.layout.inspecting) ? 'darken' : ''\r\n },\r\n room() {\r\n return library.content['ROOM']\r\n },\r\n summary() {\r\n const id = this.core.drawingOffice.tour.id\r\n if (id) return library.tours.find(tour => tour.id === id)\r\n const { view } = this.core.drawingOffice\r\n const target = view === 'ROOM' ? 'ROOM'\r\n : view === 'TOUR' ? 'ROOM'\r\n : 'MAP'\r\n return library.content[target]\r\n },\r\n CTAlabel() {\r\n const { view } = this.core.drawingOffice\r\n return view === 'ROOM' ? ''\r\n : view === 'TOUR' ? 'Exit'\r\n : ''\r\n },\r\n page() {\r\n return {\r\n dropdrown: { ...this.room },\r\n label: this.CTAlabel,\r\n summary: { ...this.summary },\r\n template: null,\r\n startTour: (id) => {\r\n if (this.core.drawingOffice.tour.hasStarted) {\r\n // if already started - exit\r\n this.$dispatch('exit-tour')\r\n this.$parent.sandbox.app.controls.orbit.stopWiggle();\r\n setTimeout(() => {\r\n this.core.drawingOffice.tour.index = 0\r\n this.core.drawingOffice.tour.id = id\r\n this.core.drawingOffice.tour.hasStarted = false // hasnt navigated yet\r\n this.core.drawingOffice.view = 'TOUR'\r\n this.$parent.sandbox.app.onAction({ trigger: 'TOUR', method: 'START', param: id, type: 'CUSTOM' })\r\n setTimeout(() => {\r\n this.core.layout.full = !this.core.layout.full;\r\n this.$parent.sandbox.app.onAction({ type: 'CTA', trigger: \"VIEWPORT\", method: \"TOGGLE\" })\r\n }, 2000)\r\n }, 100)\r\n }\r\n else {\r\n\r\n this.$parent.sandbox.app.controls.orbit.stopWiggle();\r\n this.$parent.sandbox.app.controls.orbit.disableWiggle();\r\n const helpType = this.core.drawingOffice.view === 'ROOM' ? 'drawingoffice' : 'picturemap'\r\n this.core.state.current = helpType\r\n this.$parent.$broadcast(\"help\", helpType);\r\n this.$parent.$emit(\"help\", helpType);\r\n this.$parent.$dispatch(\"help\", helpType);\r\n this.core.drawingOffice.tour.index = 0\r\n this.core.drawingOffice.tour.id = id\r\n this.core.drawingOffice.tour.hasStarted = false // hasnt navigated yet\r\n this.core.drawingOffice.view = 'TOUR'\r\n this.$parent.sandbox.app.onAction({ trigger: 'TOUR', method: 'START', param: id, type: 'CUSTOM' })\r\n }\r\n },\r\n cta: () => {\r\n const { view } = this.core.drawingOffice\r\n if (view === 'TOUR') this.$dispatch('exit-tour')\r\n },\r\n continueTour: () => {\r\n this.$parent.sandbox.app.controls.orbit.stopWiggle();\r\n if (!this.core.drawingOffice.tour.hasStarted) {\r\n setTimeout(() => { // delay button switch\r\n this.core.drawingOffice.tour.hasStarted = true\r\n }, 4000) \r\n }\r\n this.$parent.sandbox.app.onAction({ trigger: 'TOUR', method: 'NEXT', type: 'CTA' })\r\n }\r\n }\r\n }\r\n },\r\n watch: {\r\n 'hideNav': function (next, prev) { \r\n this.$broadcast('model-nav', next);\r\n }\r\n },\r\n methods: {\r\n toggleFullWidth() {\r\n \r\n this.page.startTour('t1');\r\n this.$parent.toggleFullWidth()\r\n },\r\n close() {\r\n this.currentComponent = false; // might not be used ever\r\n },\r\n toggleDropdown() {\r\n this.dropdown = !this.dropdown\r\n this.core.layout.dropdown = this.dropdown\r\n if (!this.dropdown) {\r\n this.$parent.sandbox.app.controls.pictureId = null\r\n this.$parent.poi = null\r\n }\r\n },\r\n },\r\n ready() {\r\n\r\n this.core.layout.overlay = false;\r\n this.core.state.set('drawingoffice')\r\n\r\n this.$on('abt', () => {\r\n this.currentComponent = 'view-tour-drawingoffice'\r\n // this.core.state.set('inspect');\r\n })\r\n this.$on('leave-tour', () => {\r\n // exit softly\r\n RoomOrbit(this.$parent.sandbox.app.controls.orbit);\r\n this.$parent.sandbox.app.controls.orbit.enableWiggle();\r\n // this.$parent.sandbox.app.controls.orbit.maxDistance = config.controls.orbit.max\r\n this.core.layout.inspecting = false\r\n this.core.drawingOffice.view = 'ROOM'\r\n this.$parent.sandbox.app.onAction({ trigger: 'TRANSITION', method: 'ROOM', type: 'CTA' })\r\n this.$parent.toggleFullWidth()\r\n })\r\n this.$on('exit-tour', () => {\r\n // exit\r\n RoomOrbit(this.$parent.sandbox.app.controls.orbit);\r\n this.$parent.sandbox.app.controls.orbit.enableWiggle();\r\n\r\n // this.$parent.sandbox.app.controls.orbit.maxDistance = config.controls.orbit.max\r\n\r\n this.core.drawingOffice.tour.index = 0\r\n this.core.drawingOffice.tour.isLast = false\r\n this.core.drawingOffice.tour.id = null\r\n this.core.layout.inspecting = false\r\n this.core.drawingOffice.view = 'ROOM'\r\n // console.log(this.$parent.sandbox.app.controls);\r\n this.$parent.poi = null\r\n this.$parent.sandbox.app.controls.pictureId = null\r\n this.$parent.sandbox.app.onAction({ trigger: 'TRANSITION', method: 'ROOM', type: 'CTA' })\r\n if (!this.core.layout.full) this.$parent.toggleFullWidth()\r\n })\r\n this.$on('fold-debounce-complete', (t) => {\r\n const helpType = this.core.drawingOffice.view === 'ROOM' ? 'drawingoffice' : 'picturemap'\r\n this.core.state.current = helpType\r\n this.$parent.$broadcast(\"help\", helpType);\r\n this.$parent.$emit(\"help\", helpType);\r\n this.$parent.$dispatch(\"help\", helpType);\r\n this.debounceFold = false\r\n })\r\n this.$on('goto-map', () => {\r\n if (!this.debounceFold) {\r\n this.debounceFold = true\r\n if (!this.core.layout.full) this.$parent.toggleFullWidth()\r\n this.$parent.sandbox.app.onAction({ trigger: 'TRANSITION', method: 'MAP_TOGGLE', type: 'CTA' })\r\n this.core.drawingOffice.view = 'MAP'\r\n }\r\n })\r\n this.$on('goto-room', () => {\r\n if (!this.debounceFold) {\r\n this.debounceFold = true\r\n this.$parent.sandbox.app.onAction({ trigger: 'TRANSITION', method: 'MAP_TOGGLE', type: 'CTA' })\r\n this.core.drawingOffice.view = 'ROOM'\r\n }\r\n })\r\n }\r\n}","import Template from '../templates/view-drawing.html'\nimport TourCarousel from './TourCarousel'\n\n// deprecate TourCarosel?\n\nexport default {\n name: 'view-drawing',\n template: Template,\n components: [TourCarousel],\n props: ['page', 'core', 'model'],\n data() {\n return {\n show: false,\n fragment: null\n } \n },\n computed: {\n source() {\n const assets = '/assets/img/drawing-office'\n if (!this.model) return ''\n return `${assets}/thumbs/${this.model.soane_id}.jpg`\n },\n relatedDescription() {\n if(!this.model) return '';\n return this.model.relatedDescription; \n },\n showImage()\n {\n if(this.model.id==='OBJ12')return false;\n return true; \n }, \n showDetails()\n {\n if(this.model.id==='OBJ12')return false;\n return true; \n }\n },\n ready() {\n this.core.drawingOffice.magnifyParent = null\n },\n methods: {\n magnify() {\n this.core.drawingOffice.magnifyParent = this.$parent\n this.$parent.currentComponent = 'view-magnify'\n },\n exitTour() {\n // works\n const { view } = this.core.drawingOffice\n if (view === 'TOUR') {\n // this.$parent.$parent.$parent.$dispatch('leave-tour')\n // this.$parent.$parent.$broadcast('leave-tour')\n // this.$parent.$parent.$emit('leave-tour')\n // this.$parent.$parent.$dispatch('close-drawing-inspector')\n this.$parent.$parent.$parent.$broadcast('exit-tour')\n // this.$parent.$parent.$dispatch('close-drawing-inspector')\n } \n },\n gotoURL(href) {\n window.open(href)\n },\n toggleFullWidth() {\n this.$dispatch('toggleFullWidth')\n },\n next() {\n this.$parent.$parent.sandbox.app.onAction({ trigger: 'TOUR', method: 'NEXT', type: 'CTA' })\n this.core.drawingOffice.tour.hasStarted = true\n },\n prev() {\n if (this.core.drawingOffice.tour.isLast) this.core.drawingOffice.tour.isLast = false\n this.$parent.$parent.sandbox.app.onAction({ trigger: 'TOUR', method: 'PREV', type: 'CTA' })\n\n }\n },\n beforeDestroy() {\n if (this.fragment) this.fragment.$destroy;\n }\n}","/**\r\n * Inspector View\r\n * Loads text content details for relevant Object \r\n */\r\nimport Template from '../templates/inspector--drawingOffice.html'\r\nimport { library } from '../drawingOffice/js/collections/pictureRoomData'\r\nimport ViewDrawing from './ViewDrawing'\r\n// import ViewMap from './ViewMap';\r\n// import ViewAbout from './ViewAbout';\r\nimport ViewMagnify from './ViewMagnify';\r\n\r\nexport default {\r\n name: 'drawing',\r\n template: Template,\r\n components: [ViewDrawing, ViewMagnify],\r\n route: {\r\n canReuse: false\r\n },\r\n props: ['core', 'poi'],\r\n data() {\r\n return {\r\n currentComponent: 'view-drawing',\r\n }\r\n },\r\n computed: {\r\n model() {\r\n const data = library.pictureCollection.find(({ id }) => this.poi === id)\r\n if (data) {\r\n this.currentComponent = null\r\n this.core.drawingOffice.magnify = false\r\n this.$nextTick(() => this.currentComponent = 'view-drawing')\r\n }\r\n return data\r\n }\r\n },\r\n ready() {\r\n this.$on('img', (data) => {\r\n this.core.layout.overlay = true;\r\n this.currentComponent = 'view-finder'\r\n this.core.state.set('inspect'); // deprecate\r\n })\r\n },\r\n beforeDestroy() {\r\n // layout.modal = false;\r\n this.$parent.inspecting = false\r\n this.core.layout.overlay = false;\r\n }\r\n}","import Template from '../templates/drawing-office.html';\r\nimport build from '../DrawingOffice/js/main'\r\nimport SpinLoader from './SpinLoader';\r\nimport DrawingOfficeInspector from './DrawingOfficeInspector';\r\nimport Drawing from './DrawingInspector';\r\nimport Help from './help';\r\nimport Notice from './notice';\r\n\r\nexport default {\r\n name: 'DrawingOffice',\r\n route: {\r\n // canReuse(transition) {\r\n // return true //this.$parent.core.reuseRoute\r\n // },\r\n activate(transition) {\r\n transition.next() \r\n },\r\n },\r\n template: Template,\r\n components: [DrawingOfficeInspector, Drawing, Help, Notice, SpinLoader],\r\n props: ['core'],\r\n data() {\r\n return {\r\n sandbox: null,\r\n inspecting: false, // should use core\r\n poi: null, // preview inspector (on hover)\r\n hasLoaded: false,\r\n videoAspectSync: true,\r\n }\r\n },\r\n created() {\r\n \r\n const ro = new ResizeObserver(entries => {\r\n this.resizePage()\r\n })\r\n ro.observe(document.querySelector('html'));\r\n this.sandbox = build('#render_area', (room) => {\r\n this.core.drawingOffice.mounted = true\r\n this.hasLoaded = true\r\n // this.sandbox.start() // starts when loads via hash\r\n })\r\n },\r\n computed: {\r\n show() {\r\n return !this.core.videos.isPlaying //&& this.loaded)\r\n },\r\n highres() {\r\n return (this.core.layout.hires) ? '/hires' : ''\r\n },\r\n videoStateUpdate() {\r\n return this.core.videos.isPlaying\r\n },\r\n showMaximize() {\r\n // if (this.isMap && !this.core.layout.full) return true\r\n if (this.isMap && this.core.layout.full) return false\r\n return ((this.core.layout.help) || (this.core.state.current == 'inspect') || (this.inspecting)) ? false : true;\r\n },\r\n isTour() {\r\n // was using hasLoaded\r\n return this.core.drawingOffice.view === 'TOUR'\r\n },\r\n isMap() {\r\n return this.core.drawingOffice.view === 'MAP'\r\n },\r\n tourFirstImage() {\r\n return this.core.drawingOffice.tour.index === 0\r\n }\r\n },\r\n methods: {\r\n capture(e) {\r\n if (this.core.layout.dropdown) return\r\n if (this.isMap) {\r\n const h = window.innerWidth / 2\r\n const diff = h > 768 ? (h - 768) + h : h\r\n const outOfBounds = e.clientX > diff\r\n if (!this.core.layout.full && outOfBounds) return\r\n this.sandbox.app.controls.clickHandler()\r\n }\r\n if (this.core.drawingOffice.view === 'ROOM') {\r\n this.sandbox.app.controls.panelDoorHandlerClick(e)\r\n }\r\n },\r\n captureTouch(e) {\r\n if (this.core.layout.dropdown) return\r\n if (this.isMap) {\r\n const h = window.innerWidth / 2\r\n const diff = h > 768 ? (h - 768) + h : h\r\n const clientX = e.targetTouches[0].clientX\r\n const clientY = e.targetTouches[0].clientY\r\n const outOfBounds = clientX > diff\r\n if (!this.core.layout.full && outOfBounds) return\r\n this.sandbox.app.controls.HandleMapTouch(clientX, clientY)\r\n }\r\n if (this.core.drawingOffice.view === 'ROOM') {\r\n this.sandbox.app.controls.panelDoorHandlerTouch(e)\r\n }\r\n },\r\n resizePage() {\r\n if (this.videoAspectSync) {\r\n this.sandbox.app.controls.setViewport(this.core.layout.full)\r\n } else {\r\n this.sandbox.app.controls.updateViewport2()\r\n }\r\n },\r\n viewPicture() { // click\r\n if (this.poi) {\r\n if (this.core.layout.full) this.$emit('toggleFullWidth')\r\n this.inspecting = true // side page (A)\r\n this.core.layout.overlay = true; // white side square\r\n this.core.state.set('inspect'); // side page overlay (B)\r\n }\r\n },\r\n tourNavigate(type) {\r\n this.sandbox.app.onAction({ type: 'CTA', trigger: 'TOUR', method: type })\r\n this.core.drawingOffice.tour.hasStarted = true\r\n\r\n if (type === 'PREV' && this.core.drawingOffice.tour.isLast) this.core.drawingOffice.tour.isLast = false\r\n },\r\n toggleFullWidth() {\r\n this.$emit('toggleFullWidth')\r\n },\r\n },\r\n ready() {\r\n this.core.layout.full = true\r\n this.sandbox.mount([\r\n { name: 'WATCH', callback: (res) => console.log(res) },\r\n {\r\n name: 'VIEW_PICTURE', callback: ({ data }) => {\r\n this.poi = data.id\r\n this.viewPicture()\r\n }\r\n },\r\n {\r\n name: 'TOUR_ENDED', callback: (res) => {\r\n setTimeout(() => {\r\n this.core.drawingOffice.tour.isLast = true\r\n }, 1500)\r\n },\r\n },\r\n {\r\n name: 'TOUR_UPDATE', callback: (index) => {\r\n this.core.drawingOffice.tour.index = index\r\n },\r\n },\r\n {\r\n name: 'TOUR_PANELS_ACTIVE', callback: (direction) => {\r\n this.$broadcast('panels-notice', direction)\r\n },\r\n },\r\n {\r\n name: 'FOLD_DEBOUNCE', callback: (view) => {\r\n this.$broadcast('fold-debounce-complete', view)\r\n }\r\n }\r\n ])\r\n\r\n this.$on('back-button', () => {\r\n if (!this.core.layout.full) this.toggleFullWidth()\r\n })\r\n this.$on('toggleFullWidth', () => {\r\n this.core.layout.full = !this.core.layout.full;\r\n this.sandbox.app.onAction({ type: 'CTA', trigger: \"VIEWPORT\", method: \"TOGGLE\" })\r\n })\r\n\r\n this.$on('close-drawing-inspector', (data) => {\r\n this.inspecting = false\r\n this.core.state.set('drawingoffice');\r\n this.core.layout.overlay = false;\r\n if (this.core.layout.full) this.toggleFullWidth()\r\n // if (this.core.drawingOffice.tour.isLast) this.$broadcast('exit-tour')\r\n if (this.isMap) this.toggleFullWidth()\r\n })\r\n this.$on('skip-viewport-sync', () => {\r\n this.videoAspectSync = false\r\n })\r\n },\r\n watch: {\r\n 'videoStateUpdate': function (canPlay) {\r\n if (!canPlay) {\r\n this.$broadcast(\"help\", this.core.state.current);\r\n if (this.sandbox) this.sandbox.start()\r\n if (this.videoAspectSync) {\r\n // this.sandbox.app.controls.setViewport(this.core.layout.full)\r\n this.sandbox.app.controls.tweenFromVideo(() => {\r\n this.videoAspectSync = false\r\n })\r\n }\r\n }\r\n },\r\n },\r\n beforeDestroy() {\r\n // if (this.core.drawingOffice.view != 'ROOM') this.toggleFullWidth() // reset view width\r\n if (this.core.drawingOffice.view == 'TOUR') this.$broadcast('exit-tour')\r\n if (this.core.drawingOffice.view == 'MAP') this.sandbox.app.onAction({ trigger: 'TRANSITION', method: 'MAP_TOGGLE', type: 'CTA' })\r\n this.core.drawingOffice.view = 'ROOM'\r\n this.videoAspectSync = true // reset for video sync\r\n this.core.drawingOffice.mounted = false\r\n this.inspecting = false\r\n this.core.state.set('root');\r\n this.core.layout.overlay = false;\r\n this.sandbox.unmount()\r\n }\r\n}\r\n\r\n\r\n","import Template from '../templates/page-about.html'\nimport Core from '../data/core';\nimport ViewFinder from './ViewFinder';\n// var GeminiScrollbar = require('gemini-scrollbar');\nexport default {\n name: 'about-page',\n template: Template,\n components: [ViewFinder],\n data() {\n return {\n core: Core,\n thumb: \"/assets/img/_thumbs/sect.jpg\",\n magnify: false,\n model: {\n img: {\n src: \"/assets/img/_thumbs/sect.jpg\",\n hir: \"/assets/img/sect_high.jpg\",\n w: 940,\n h: 529\n }\n },\n scale: (768 / 4705) + .25,\n viewer: 'view-finder'\n }\n },\n methods: {\n toggle() {\n this.magnify = !this.magnify\n },\n close() {\n Core.closePages()\n }\n },\n ready() {\n Core.layout.overlay = true;\n },\n beforeDestroy() {\n Core.layout.overlay = false;\n }\n}","import Template from '../templates/page-download.html'\nimport Core from '../data/core';\n// var GeminiScrollbar = require('gemini-scrollbar');\nexport default {\n name: 'download-page',\n template: Template,\n data() {\n return {\n list: Core.Downloads.collection\n }\n },\n methods: {\n close() {\n Core.closePages()\n }\n },\n ready() {\n Core.layout.overlay = true;\n // var myScrollbar = new GeminiScrollbar({\n // element: this.$el\n // }).create();\n },\n beforeDestroy() {\n Core.layout.overlay = false;\n }\n}","/**\n * Inspector View\n * Loads text content details for relevant Object \n */\nimport Template from '../templates/inspector--drawer.html'\nimport Content from '../data/content';\nimport core from '../data/core';\n\n// import ViewMap from './ViewMap';\nimport ViewAbout from './ViewAbout';\nimport ViewFinder from './ViewFinder';\n\nconst { layout, state } = core\n\nexport default {\n name: 'inspector',\n template: Template,\n components: [ViewAbout, ViewFinder],\n route: {\n canReuse: false\n },\n props: ['data', 'poi'],\n data() {\n return {\n related: true,\n model: Content.find(this.$route.params.section, this.$route.params.detail),\n state,\n layout,\n currentComponent: 'view-about'\n }\n },\n methods: {\n exit() {\n window.history.back();\n }\n },\n ready() {\n // layout.modal = true;\n this.$on('map', () => {\n this.layout.overlay = true;\n this.currentComponent = 'view-map'\n })\n\n this.$on('abt', (data) => {\n this.state.set('inspect');\n this.layout.overlay = true;\n this.currentComponent = 'view-about'\n })\n\n this.$on('img', (data) => {\n // this.viewer = (data != undefined) ? data : null\n this.layout.overlay = true;\n this.currentComponent = 'view-finder'\n this.state.set('inspect'); // deprecate\n })\n this.layout.overlay = true;\n this.currentComponent = 'view-about';\n this.$on('close-inspect', () => {\n this.currentComponent = null\n this.layout.overlay = false\n this.$parent.inspecting = false\n this.layout.inspecting = false\n this.state.set('pointcloud')\n this.layout.modal = false;\n this.$router.back()\n })\n },\n beforeDestroy() {\n // layout.modal = false;\n this.$parent.inspecting = false\n this.layout.overlay = false;\n }\n}","import Entrance from './components/Entrance';\nimport Potree from './components/PotreeViewer2'\nimport Room from './components/Room';\nimport PictureRoom from './components/PictureRoom';\nimport DrawingOffice from './components/DrawingOffice';\nimport AboutPage from './components/AboutPage';\nimport DownloadPage from './components/DownloadPage';\nimport Inspector from './components/DrawerInspector';\n\nimport Core from './data/core';\n\n\nexport default function (router, app) {\n router.map({\n '/': {\n name: 'root',\n component: Entrance\n },\n '/section/:section': {\n name: 'section',\n component: Room,\n subRoutes: {\n '/:pointcloud': {\n name: 'pointcloud',\n component: Potree,\n subRoutes: {\n '/inspect/:detail': {\n name: 'inspect',\n component: Inspector\n }\n }\n }\n }\n },\n '/about': {\n name: 'about',\n component: AboutPage\n },\n '/downloads': {\n name: 'downloads',\n component: DownloadPage\n },\n '/picture-room': {\n name: 'pictureroom',\n component: PictureRoom,\n },\n '/drawing-office': {\n name: 'drawingoffice',\n component: DrawingOffice,\n },\n })\n\n .beforeEach((transition) => {\n Core.closePages();\n transition.next()\n })\n .afterEach((route) => {\n Core.state.set(route.to.name);\n // // Core.history.add(route.to) // history is being added -> needs to be deprecated // but navigation width will diminish - until css is used to fix it\n // // if(route.to.name !== 'root') \n Core.history.push(route.to)\n Core.layout.mode(route.to)\n });\n\n}","if (typeof window !== \"undefined\") {\n module.exports = window;\n} else if (typeof global !== \"undefined\") {\n module.exports = global;\n} else if (typeof self !== \"undefined\"){\n module.exports = self;\n} else {\n module.exports = {};\n}\n","var slice = Array.prototype.slice\n\nmodule.exports = iterativelyWalk\n\nfunction iterativelyWalk(nodes, cb) {\n if (!('length' in nodes)) {\n nodes = [nodes]\n }\n \n nodes = slice.call(nodes)\n\n while(nodes.length) {\n var node = nodes.shift(),\n ret = cb(node)\n\n if (ret) {\n return ret\n }\n\n if (node.childNodes && node.childNodes.length) {\n nodes = slice.call(node.childNodes).concat(nodes)\n }\n }\n}\n","module.exports = Comment\n\nfunction Comment(data, owner) {\n if (!(this instanceof Comment)) {\n return new Comment(data, owner)\n }\n\n this.data = data\n this.nodeValue = data\n this.length = data.length\n this.ownerDocument = owner || null\n}\n\nComment.prototype.nodeType = 8\nComment.prototype.nodeName = \"#comment\"\n\nComment.prototype.toString = function _Comment_toString() {\n return \"[object Comment]\"\n}\n","module.exports = DOMText\n\nfunction DOMText(value, owner) {\n if (!(this instanceof DOMText)) {\n return new DOMText(value)\n }\n\n this.data = value || \"\"\n this.length = this.data.length\n this.ownerDocument = owner || null\n}\n\nDOMText.prototype.type = \"DOMTextNode\"\nDOMText.prototype.nodeType = 3\nDOMText.prototype.nodeName = \"#text\"\n\nDOMText.prototype.toString = function _Text_toString() {\n return this.data\n}\n\nDOMText.prototype.replaceData = function replaceData(index, length, value) {\n var current = this.data\n var left = current.substring(0, index)\n var right = current.substring(index + length, current.length)\n this.data = left + value + right\n this.length = this.data.length\n}\n","module.exports = dispatchEvent\n\nfunction dispatchEvent(ev) {\n var elem = this\n var type = ev.type\n\n if (!ev.target) {\n ev.target = elem\n }\n\n if (!elem.listeners) {\n elem.listeners = {}\n }\n\n var listeners = elem.listeners[type]\n\n if (listeners) {\n return listeners.forEach(function (listener) {\n ev.currentTarget = elem\n if (typeof listener === 'function') {\n listener(ev)\n } else {\n listener.handleEvent(ev)\n }\n })\n }\n\n if (elem.parentNode) {\n elem.parentNode.dispatchEvent(ev)\n }\n}\n","module.exports = addEventListener\n\nfunction addEventListener(type, listener) {\n var elem = this\n\n if (!elem.listeners) {\n elem.listeners = {}\n }\n\n if (!elem.listeners[type]) {\n elem.listeners[type] = []\n }\n\n if (elem.listeners[type].indexOf(listener) === -1) {\n elem.listeners[type].push(listener)\n }\n}\n","module.exports = removeEventListener\n\nfunction removeEventListener(type, listener) {\n var elem = this\n\n if (!elem.listeners) {\n return\n }\n\n if (!elem.listeners[type]) {\n return\n }\n\n var list = elem.listeners[type]\n var index = list.indexOf(listener)\n if (index !== -1) {\n list.splice(index, 1)\n }\n}\n","module.exports = serializeNode\n\nvar voidElements = [\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"menuitem\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"];\n\nfunction serializeNode(node) {\n switch (node.nodeType) {\n case 3:\n return escapeText(node.data)\n case 8:\n return \"\"\n default:\n return serializeElement(node)\n }\n}\n\nfunction serializeElement(elem) {\n var strings = []\n\n var tagname = elem.tagName\n\n if (elem.namespaceURI === \"http://www.w3.org/1999/xhtml\") {\n tagname = tagname.toLowerCase()\n }\n\n strings.push(\"<\" + tagname + properties(elem) + datasetify(elem))\n\n if (voidElements.indexOf(tagname) > -1) {\n strings.push(\" />\")\n } else {\n strings.push(\">\")\n\n if (elem.childNodes.length) {\n strings.push.apply(strings, elem.childNodes.map(serializeNode))\n } else if (elem.textContent || elem.innerText) {\n strings.push(escapeText(elem.textContent || elem.innerText))\n } else if (elem.innerHTML) {\n strings.push(elem.innerHTML)\n }\n\n strings.push(\"\")\n }\n\n return strings.join(\"\")\n}\n\nfunction isProperty(elem, key) {\n var type = typeof elem[key]\n\n if (key === \"style\" && Object.keys(elem.style).length > 0) {\n return true\n }\n\n return elem.hasOwnProperty(key) &&\n (type === \"string\" || type === \"boolean\" || type === \"number\") &&\n key !== \"nodeName\" && key !== \"className\" && key !== \"tagName\" &&\n key !== \"textContent\" && key !== \"innerText\" && key !== \"namespaceURI\" && key !== \"innerHTML\"\n}\n\nfunction stylify(styles) {\n if (typeof styles === 'string') return styles\n var attr = \"\"\n Object.keys(styles).forEach(function (key) {\n var value = styles[key]\n key = key.replace(/[A-Z]/g, function(c) {\n return \"-\" + c.toLowerCase();\n })\n attr += key + \":\" + value + \";\"\n })\n return attr\n}\n\nfunction datasetify(elem) {\n var ds = elem.dataset\n var props = []\n\n for (var key in ds) {\n props.push({ name: \"data-\" + key, value: ds[key] })\n }\n\n return props.length ? stringify(props) : \"\"\n}\n\nfunction stringify(list) {\n var attributes = []\n list.forEach(function (tuple) {\n var name = tuple.name\n var value = tuple.value\n\n if (name === \"style\") {\n value = stylify(value)\n }\n\n attributes.push(name + \"=\" + \"\\\"\" + escapeAttributeValue(value) + \"\\\"\")\n })\n\n return attributes.length ? \" \" + attributes.join(\" \") : \"\"\n}\n\nfunction properties(elem) {\n var props = []\n for (var key in elem) {\n if (isProperty(elem, key)) {\n props.push({ name: key, value: elem[key] })\n }\n }\n\n for (var ns in elem._attributes) {\n for (var attribute in elem._attributes[ns]) {\n var prop = elem._attributes[ns][attribute]\n var name = (prop.prefix ? prop.prefix + \":\" : \"\") + attribute\n props.push({ name: name, value: prop.value })\n }\n }\n\n if (elem.className) {\n props.push({ name: \"class\", value: elem.className })\n }\n\n return props.length ? stringify(props) : \"\"\n}\n\nfunction escapeText(s) {\n var str = '';\n\n if (typeof(s) === 'string') { \n str = s; \n } else if (s) {\n str = s.toString();\n }\n\n return str\n .replace(/&/g, \"&\")\n .replace(//g, \">\")\n}\n\nfunction escapeAttributeValue(str) {\n return escapeText(str).replace(/\"/g, \""\")\n}\n","var domWalk = require(\"dom-walk\")\nvar dispatchEvent = require(\"./event/dispatch-event.js\")\nvar addEventListener = require(\"./event/add-event-listener.js\")\nvar removeEventListener = require(\"./event/remove-event-listener.js\")\nvar serializeNode = require(\"./serialize.js\")\n\nvar htmlns = \"http://www.w3.org/1999/xhtml\"\n\nmodule.exports = DOMElement\n\nfunction DOMElement(tagName, owner, namespace) {\n if (!(this instanceof DOMElement)) {\n return new DOMElement(tagName)\n }\n\n var ns = namespace === undefined ? htmlns : (namespace || null)\n\n this.tagName = ns === htmlns ? String(tagName).toUpperCase() : tagName\n this.nodeName = this.tagName\n this.className = \"\"\n this.dataset = {}\n this.childNodes = []\n this.parentNode = null\n this.style = {}\n this.ownerDocument = owner || null\n this.namespaceURI = ns\n this._attributes = {}\n\n if (this.tagName === 'INPUT') {\n this.type = 'text'\n }\n}\n\nDOMElement.prototype.type = \"DOMElement\"\nDOMElement.prototype.nodeType = 1\n\nDOMElement.prototype.appendChild = function _Element_appendChild(child) {\n if (child.parentNode) {\n child.parentNode.removeChild(child)\n }\n\n this.childNodes.push(child)\n child.parentNode = this\n\n return child\n}\n\nDOMElement.prototype.replaceChild =\n function _Element_replaceChild(elem, needle) {\n // TODO: Throw NotFoundError if needle.parentNode !== this\n\n if (elem.parentNode) {\n elem.parentNode.removeChild(elem)\n }\n\n var index = this.childNodes.indexOf(needle)\n\n needle.parentNode = null\n this.childNodes[index] = elem\n elem.parentNode = this\n\n return needle\n }\n\nDOMElement.prototype.removeChild = function _Element_removeChild(elem) {\n // TODO: Throw NotFoundError if elem.parentNode !== this\n\n var index = this.childNodes.indexOf(elem)\n this.childNodes.splice(index, 1)\n\n elem.parentNode = null\n return elem\n}\n\nDOMElement.prototype.insertBefore =\n function _Element_insertBefore(elem, needle) {\n // TODO: Throw NotFoundError if referenceElement is a dom node\n // and parentNode !== this\n\n if (elem.parentNode) {\n elem.parentNode.removeChild(elem)\n }\n\n var index = needle === null || needle === undefined ?\n -1 :\n this.childNodes.indexOf(needle)\n\n if (index > -1) {\n this.childNodes.splice(index, 0, elem)\n } else {\n this.childNodes.push(elem)\n }\n\n elem.parentNode = this\n return elem\n }\n\nDOMElement.prototype.setAttributeNS =\n function _Element_setAttributeNS(namespace, name, value) {\n var prefix = null\n var localName = name\n var colonPosition = name.indexOf(\":\")\n if (colonPosition > -1) {\n prefix = name.substr(0, colonPosition)\n localName = name.substr(colonPosition + 1)\n }\n if (this.tagName === 'INPUT' && name === 'type') {\n this.type = value;\n }\n else {\n var attributes = this._attributes[namespace] || (this._attributes[namespace] = {})\n attributes[localName] = {value: value, prefix: prefix}\n }\n }\n\nDOMElement.prototype.getAttributeNS =\n function _Element_getAttributeNS(namespace, name) {\n var attributes = this._attributes[namespace];\n var value = attributes && attributes[name] && attributes[name].value\n if (this.tagName === 'INPUT' && name === 'type') {\n return this.type;\n }\n if (typeof value !== \"string\") {\n return null\n }\n return value\n }\n\nDOMElement.prototype.removeAttributeNS =\n function _Element_removeAttributeNS(namespace, name) {\n var attributes = this._attributes[namespace];\n if (attributes) {\n delete attributes[name]\n }\n }\n\nDOMElement.prototype.hasAttributeNS =\n function _Element_hasAttributeNS(namespace, name) {\n var attributes = this._attributes[namespace]\n return !!attributes && name in attributes;\n }\n\nDOMElement.prototype.setAttribute = function _Element_setAttribute(name, value) {\n return this.setAttributeNS(null, name, value)\n}\n\nDOMElement.prototype.getAttribute = function _Element_getAttribute(name) {\n return this.getAttributeNS(null, name)\n}\n\nDOMElement.prototype.removeAttribute = function _Element_removeAttribute(name) {\n return this.removeAttributeNS(null, name)\n}\n\nDOMElement.prototype.hasAttribute = function _Element_hasAttribute(name) {\n return this.hasAttributeNS(null, name)\n}\n\nDOMElement.prototype.removeEventListener = removeEventListener\nDOMElement.prototype.addEventListener = addEventListener\nDOMElement.prototype.dispatchEvent = dispatchEvent\n\n// Un-implemented\nDOMElement.prototype.focus = function _Element_focus() {\n return void 0\n}\n\nDOMElement.prototype.toString = function _Element_toString() {\n return serializeNode(this)\n}\n\nDOMElement.prototype.getElementsByClassName = function _Element_getElementsByClassName(classNames) {\n var classes = classNames.split(\" \");\n var elems = []\n\n domWalk(this, function (node) {\n if (node.nodeType === 1) {\n var nodeClassName = node.className || \"\"\n var nodeClasses = nodeClassName.split(\" \")\n\n if (classes.every(function (item) {\n return nodeClasses.indexOf(item) !== -1\n })) {\n elems.push(node)\n }\n }\n })\n\n return elems\n}\n\nDOMElement.prototype.getElementsByTagName = function _Element_getElementsByTagName(tagName) {\n tagName = tagName.toLowerCase()\n var elems = []\n\n domWalk(this.childNodes, function (node) {\n if (node.nodeType === 1 && (tagName === '*' || node.tagName.toLowerCase() === tagName)) {\n elems.push(node)\n }\n })\n\n return elems\n}\n\nDOMElement.prototype.contains = function _Element_contains(element) {\n return domWalk(this, function (node) {\n return element === node\n }) || false\n}\n","var DOMElement = require(\"./dom-element.js\")\n\nmodule.exports = DocumentFragment\n\nfunction DocumentFragment(owner) {\n if (!(this instanceof DocumentFragment)) {\n return new DocumentFragment()\n }\n\n this.childNodes = []\n this.parentNode = null\n this.ownerDocument = owner || null\n}\n\nDocumentFragment.prototype.type = \"DocumentFragment\"\nDocumentFragment.prototype.nodeType = 11\nDocumentFragment.prototype.nodeName = \"#document-fragment\"\n\nDocumentFragment.prototype.appendChild = DOMElement.prototype.appendChild\nDocumentFragment.prototype.replaceChild = DOMElement.prototype.replaceChild\nDocumentFragment.prototype.removeChild = DOMElement.prototype.removeChild\n\nDocumentFragment.prototype.toString =\n function _DocumentFragment_toString() {\n return this.childNodes.map(function (node) {\n return String(node)\n }).join(\"\")\n }\n","module.exports = Event\n\nfunction Event(family) {}\n\nEvent.prototype.initEvent = function _Event_initEvent(type, bubbles, cancelable) {\n this.type = type\n this.bubbles = bubbles\n this.cancelable = cancelable\n}\n\nEvent.prototype.preventDefault = function _Event_preventDefault() {\n \n}\n","var domWalk = require(\"dom-walk\")\n\nvar Comment = require(\"./dom-comment.js\")\nvar DOMText = require(\"./dom-text.js\")\nvar DOMElement = require(\"./dom-element.js\")\nvar DocumentFragment = require(\"./dom-fragment.js\")\nvar Event = require(\"./event.js\")\nvar dispatchEvent = require(\"./event/dispatch-event.js\")\nvar addEventListener = require(\"./event/add-event-listener.js\")\nvar removeEventListener = require(\"./event/remove-event-listener.js\")\n\nmodule.exports = Document;\n\nfunction Document() {\n if (!(this instanceof Document)) {\n return new Document();\n }\n\n this.head = this.createElement(\"head\")\n this.body = this.createElement(\"body\")\n this.documentElement = this.createElement(\"html\")\n this.documentElement.appendChild(this.head)\n this.documentElement.appendChild(this.body)\n this.childNodes = [this.documentElement]\n this.nodeType = 9\n}\n\nvar proto = Document.prototype;\nproto.createTextNode = function createTextNode(value) {\n return new DOMText(value, this)\n}\n\nproto.createElementNS = function createElementNS(namespace, tagName) {\n var ns = namespace === null ? null : String(namespace)\n return new DOMElement(tagName, this, ns)\n}\n\nproto.createElement = function createElement(tagName) {\n return new DOMElement(tagName, this)\n}\n\nproto.createDocumentFragment = function createDocumentFragment() {\n return new DocumentFragment(this)\n}\n\nproto.createEvent = function createEvent(family) {\n return new Event(family)\n}\n\nproto.createComment = function createComment(data) {\n return new Comment(data, this)\n}\n\nproto.getElementById = function getElementById(id) {\n id = String(id)\n\n var result = domWalk(this.childNodes, function (node) {\n if (String(node.id) === id) {\n return node\n }\n })\n\n return result || null\n}\n\nproto.getElementsByClassName = DOMElement.prototype.getElementsByClassName\nproto.getElementsByTagName = DOMElement.prototype.getElementsByTagName\nproto.contains = DOMElement.prototype.contains\n\nproto.removeEventListener = removeEventListener\nproto.addEventListener = addEventListener\nproto.dispatchEvent = dispatchEvent\n","var Document = require('./document.js');\n\nmodule.exports = new Document();\n","var topLevel = typeof global !== 'undefined' ? global :\n typeof window !== 'undefined' ? window : {}\nvar minDoc = require('min-document');\n\nif (typeof document !== 'undefined') {\n module.exports = document;\n} else {\n var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];\n\n if (!doccy) {\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;\n }\n\n module.exports = doccy;\n}\n","\"use strict\";\n\nexports.__esModule = true;\nexports.newGUID = newGUID;\n/**\n * @file guid.js\n * @module guid\n */\n\n/**\n * Unique ID for an element or function\n * @type {Number}\n */\nvar _guid = 1;\n\n/**\n * Get a unique auto-incrementing ID by number that has not been returned before.\n *\n * @return {number}\n * A new unique ID.\n */\nfunction newGUID() {\n return _guid++;\n}\n","'use strict';\n\nexports.__esModule = true;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.each = each;\nexports.reduce = reduce;\nexports.assign = assign;\nexports.isObject = isObject;\nexports.isPlain = isPlain;\n/**\n * @file obj.js\n * @module obj\n */\n\n/**\n * @callback obj:EachCallback\n *\n * @param {Mixed} value\n * The current key for the object that is being iterated over.\n *\n * @param {string} key\n * The current key-value for object that is being iterated over\n */\n\n/**\n * @callback obj:ReduceCallback\n *\n * @param {Mixed} accum\n * The value that is accumulating over the reduce loop.\n *\n * @param {Mixed} value\n * The current key for the object that is being iterated over.\n *\n * @param {string} key\n * The current key-value for object that is being iterated over\n *\n * @return {Mixed}\n * The new accumulated value.\n */\nvar toString = Object.prototype.toString;\n\n/**\n * Get the keys of an Object\n *\n * @param {Object}\n * The Object to get the keys from\n *\n * @return {string[]}\n * An array of the keys from the object. Returns an empty array if the\n * object passed in was invalid or had no keys.\n *\n * @private\n */\nvar keys = function keys(object) {\n return isObject(object) ? Object.keys(object) : [];\n};\n\n/**\n * Array-like iteration for objects.\n *\n * @param {Object} object\n * The object to iterate over\n *\n * @param {obj:EachCallback} fn\n * The callback function which is called for each key in the object.\n */\nfunction each(object, fn) {\n keys(object).forEach(function (key) {\n return fn(object[key], key);\n });\n}\n\n/**\n * Array-like reduce for objects.\n *\n * @param {Object} object\n * The Object that you want to reduce.\n *\n * @param {Function} fn\n * A callback function which is called for each key in the object. It\n * receives the accumulated value and the per-iteration value and key\n * as arguments.\n *\n * @param {Mixed} [initial = 0]\n * Starting value\n *\n * @return {Mixed}\n * The final accumulated value.\n */\nfunction reduce(object, fn) {\n var initial = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n\n return keys(object).reduce(function (accum, key) {\n return fn(accum, object[key], key);\n }, initial);\n}\n\n/**\n * Object.assign-style object shallow merge/extend.\n *\n * @param {Object} target\n * @param {Object} ...sources\n * @return {Object}\n */\nfunction assign(target) {\n for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n sources[_key - 1] = arguments[_key];\n }\n\n if (Object.assign) {\n return Object.assign.apply(Object, [target].concat(sources));\n }\n\n sources.forEach(function (source) {\n if (!source) {\n return;\n }\n\n each(source, function (value, key) {\n target[key] = value;\n });\n });\n\n return target;\n}\n\n/**\n * Returns whether a value is an object of any kind - including DOM nodes,\n * arrays, regular expressions, etc. Not functions, though.\n *\n * This avoids the gotcha where using `typeof` on a `null` value\n * results in `'object'`.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nfunction isObject(value) {\n return !!value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object';\n}\n\n/**\n * Returns whether an object appears to be a \"plain\" object - that is, a\n * direct instance of `Object`.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nfunction isPlain(value) {\n return isObject(value) && toString.call(value) === '[object Object]' && value.constructor === Object;\n}\n","'use strict';\n\nexports.__esModule = true;\nexports.logByType = undefined;\n\nvar _window = require('global/window');\n\nvar _window2 = _interopRequireDefault(_window);\n\nvar _browser = require('./browser');\n\nvar _obj = require('./obj');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nvar log = void 0;\n\n/**\n * Log messages to the console and history based on the type of message\n *\n * @param {string} type\n * The name of the console method to use.\n *\n * @param {Array} args\n * The arguments to be passed to the matching console method.\n *\n * @param {boolean} [stringify]\n * By default, only old IEs should get console argument stringification,\n * but this is exposed as a parameter to facilitate testing.\n */\n/**\n * @file log.js\n * @module log\n */\nvar logByType = exports.logByType = function logByType(type, args) {\n var stringify = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !!_browser.IE_VERSION && _browser.IE_VERSION < 11;\n\n\n if (type !== 'log') {\n\n // add the type to the front of the message when it's not \"log\"\n args.unshift(type.toUpperCase() + ':');\n }\n\n // add to history\n log.history.push(args);\n\n // add console prefix after adding to history\n args.unshift('VIDEOJS:');\n\n // If there's no console then don't try to output messages, but they will\n // still be stored in `log.history`.\n //\n // Was setting these once outside of this function, but containing them\n // in the function makes it easier to test cases where console doesn't exist\n // when the module is executed.\n var fn = _window2['default'].console && _window2['default'].console[type];\n\n // Bail out if there's no console.\n if (!fn) {\n return;\n }\n\n // IEs previous to 11 log objects uselessly as \"[object Object]\"; so, JSONify\n // objects and arrays for those less-capable browsers.\n if (stringify) {\n args = args.map(function (a) {\n if ((0, _obj.isObject)(a) || Array.isArray(a)) {\n try {\n return JSON.stringify(a);\n } catch (x) {\n return String(a);\n }\n }\n\n // Cast to string before joining, so we get null and undefined explicitly\n // included in output (as we would in a modern console).\n return String(a);\n }).join(' ');\n }\n\n // Old IE versions do not allow .apply() for console methods (they are\n // reported as objects rather than functions).\n if (!fn.apply) {\n fn(args);\n } else {\n fn[Array.isArray(args) ? 'apply' : 'call'](_window2['default'].console, args);\n }\n};\n\n/**\n * Log plain debug messages\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged.\n */\nlog = function log() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n logByType('log', args);\n};\n\n/**\n * Keep a history of log messages\n *\n * @type {Array}\n */\nlog.history = [];\n\n/**\n * Log error messages\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as an error\n */\nlog.error = function () {\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return logByType('error', args);\n};\n\n/**\n * Log warning messages\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as a warning.\n */\nlog.warn = function () {\n for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n return logByType('warn', args);\n};\n\nexports['default'] = log;\n","function clean (s) {\n return s.replace(/\\n\\r?\\s*/g, '')\n}\n\n\nmodule.exports = function tsml (sa) {\n var s = ''\n , i = 0\n\n for (; i < arguments.length; i++)\n s += clean(sa[i]) + (arguments[i + 1] || '')\n\n return s\n}","'use strict';\n\nexports.__esModule = true;\nexports.$$ = exports.$ = undefined;\n\nvar _templateObject = _taggedTemplateLiteralLoose(['Setting attributes in the second argument of createEl()\\n has been deprecated. Use the third argument instead.\\n createEl(type, properties, attributes). Attempting to set ', ' to ', '.'], ['Setting attributes in the second argument of createEl()\\n has been deprecated. Use the third argument instead.\\n createEl(type, properties, attributes). Attempting to set ', ' to ', '.']);\n\nexports.isReal = isReal;\nexports.isEl = isEl;\nexports.getEl = getEl;\nexports.createEl = createEl;\nexports.textContent = textContent;\nexports.insertElFirst = insertElFirst;\nexports.getElData = getElData;\nexports.hasElData = hasElData;\nexports.removeElData = removeElData;\nexports.hasElClass = hasElClass;\nexports.addElClass = addElClass;\nexports.removeElClass = removeElClass;\nexports.toggleElClass = toggleElClass;\nexports.setElAttributes = setElAttributes;\nexports.getElAttributes = getElAttributes;\nexports.getAttribute = getAttribute;\nexports.setAttribute = setAttribute;\nexports.removeAttribute = removeAttribute;\nexports.blockTextSelection = blockTextSelection;\nexports.unblockTextSelection = unblockTextSelection;\nexports.findElPosition = findElPosition;\nexports.getPointerPosition = getPointerPosition;\nexports.isTextNode = isTextNode;\nexports.emptyEl = emptyEl;\nexports.normalizeContent = normalizeContent;\nexports.appendContent = appendContent;\nexports.insertContent = insertContent;\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nvar _window = require('global/window');\n\nvar _window2 = _interopRequireDefault(_window);\n\nvar _guid = require('./guid.js');\n\nvar Guid = _interopRequireWildcard(_guid);\n\nvar _log = require('./log.js');\n\nvar _log2 = _interopRequireDefault(_log);\n\nvar _tsml = require('tsml');\n\nvar _tsml2 = _interopRequireDefault(_tsml);\n\nvar _obj = require('./obj');\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; } /**\n * @file dom.js\n * @module dom\n */\n\n\n/**\n * Detect if a value is a string with any non-whitespace characters.\n *\n * @param {string} str\n * The string to check\n *\n * @return {boolean}\n * - True if the string is non-blank\n * - False otherwise\n *\n */\nfunction isNonBlankString(str) {\n return typeof str === 'string' && /\\S/.test(str);\n}\n\n/**\n * Throws an error if the passed string has whitespace. This is used by\n * class methods to be relatively consistent with the classList API.\n *\n * @param {string} str\n * The string to check for whitespace.\n *\n * @throws {Error}\n * Throws an error if there is whitespace in the string.\n *\n */\nfunction throwIfWhitespace(str) {\n if (/\\s/.test(str)) {\n throw new Error('class has illegal whitespace characters');\n }\n}\n\n/**\n * Produce a regular expression for matching a className within an elements className.\n *\n * @param {string} className\n * The className to generate the RegExp for.\n *\n * @return {RegExp}\n * The RegExp that will check for a specific `className` in an elements\n * className.\n */\nfunction classRegExp(className) {\n return new RegExp('(^|\\\\s)' + className + '($|\\\\s)');\n}\n\n/**\n * Whether the current DOM interface appears to be real.\n *\n * @return {Boolean}\n */\nfunction isReal() {\n return (\n\n // Both document and window will never be undefined thanks to `global`.\n _document2['default'] === _window2['default'].document &&\n\n // In IE < 9, DOM methods return \"object\" as their type, so all we can\n // confidently check is that it exists.\n typeof _document2['default'].createElement !== 'undefined'\n );\n}\n\n/**\n * Determines, via duck typing, whether or not a value is a DOM element.\n *\n * @param {Mixed} value\n * The thing to check\n *\n * @return {boolean}\n * - True if it is a DOM element\n * - False otherwise\n */\nfunction isEl(value) {\n return (0, _obj.isObject)(value) && value.nodeType === 1;\n}\n\n/**\n * Creates functions to query the DOM using a given method.\n *\n * @param {string} method\n * The method to create the query with.\n *\n * @return {Function}\n * The query method\n */\nfunction createQuerier(method) {\n return function (selector, context) {\n if (!isNonBlankString(selector)) {\n return _document2['default'][method](null);\n }\n if (isNonBlankString(context)) {\n context = _document2['default'].querySelector(context);\n }\n\n var ctx = isEl(context) ? context : _document2['default'];\n\n return ctx[method] && ctx[method](selector);\n };\n}\n\n/**\n * Shorthand for document.getElementById()\n * Also allows for CSS (jQuery) ID syntax. But nothing other than IDs.\n *\n * @param {string} id\n * The id of the element to get\n *\n * @return {Element|null}\n * Element with supplied ID or null if there wasn't one.\n */\nfunction getEl(id) {\n if (id.indexOf('#') === 0) {\n id = id.slice(1);\n }\n\n return _document2['default'].getElementById(id);\n}\n\n/**\n * Creates an element and applies properties.\n *\n * @param {string} [tagName='div']\n * Name of tag to be created.\n *\n * @param {Object} [properties={}]\n * Element properties to be applied.\n *\n * @param {Object} [attributes={}]\n * Element attributes to be applied.\n *\n * @param {String|Element|TextNode|Array|Function} [content]\n * Contents for the element (see: {@link dom:normalizeContent})\n *\n * @return {Element}\n * The element that was created.\n */\nfunction createEl() {\n var tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';\n var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var content = arguments[3];\n\n var el = _document2['default'].createElement(tagName);\n\n Object.getOwnPropertyNames(properties).forEach(function (propName) {\n var val = properties[propName];\n\n // See #2176\n // We originally were accepting both properties and attributes in the\n // same object, but that doesn't work so well.\n if (propName.indexOf('aria-') !== -1 || propName === 'role' || propName === 'type') {\n _log2['default'].warn((0, _tsml2['default'])(_templateObject, propName, val));\n el.setAttribute(propName, val);\n\n // Handle textContent since it's not supported everywhere and we have a\n // method for it.\n } else if (propName === 'textContent') {\n textContent(el, val);\n } else {\n el[propName] = val;\n }\n });\n\n Object.getOwnPropertyNames(attributes).forEach(function (attrName) {\n el.setAttribute(attrName, attributes[attrName]);\n });\n\n if (content) {\n appendContent(el, content);\n }\n\n return el;\n}\n\n/**\n * Injects text into an element, replacing any existing contents entirely.\n *\n * @param {Element} el\n * The element to add text content into\n *\n * @param {string} text\n * The text content to add.\n *\n * @return {Element}\n * The element with added text content.\n */\nfunction textContent(el, text) {\n if (typeof el.textContent === 'undefined') {\n el.innerText = text;\n } else {\n el.textContent = text;\n }\n return el;\n}\n\n/**\n * Insert an element as the first child node of another\n *\n * @param {Element} child\n * Element to insert\n *\n * @param {Element} parent\n * Element to insert child into\n *\n */\nfunction insertElFirst(child, parent) {\n if (parent.firstChild) {\n parent.insertBefore(child, parent.firstChild);\n } else {\n parent.appendChild(child);\n }\n}\n\n/**\n * Element Data Store. Allows for binding data to an element without putting it directly on the element.\n * Ex. Event listeners are stored here.\n * (also from jsninja.com, slightly modified and updated for closure compiler)\n *\n * @type {Object}\n * @private\n */\nvar elData = {};\n\n/*\n * Unique attribute name to store an element's guid in\n *\n * @type {string}\n * @constant\n * @private\n */\nvar elIdAttr = 'vdata' + new Date().getTime();\n\n/**\n * Returns the cache object where data for an element is stored\n *\n * @param {Element} el\n * Element to store data for.\n *\n * @return {Object}\n * The cache object for that el that was passed in.\n */\nfunction getElData(el) {\n var id = el[elIdAttr];\n\n if (!id) {\n id = el[elIdAttr] = Guid.newGUID();\n }\n\n if (!elData[id]) {\n elData[id] = {};\n }\n\n return elData[id];\n}\n\n/**\n * Returns whether or not an element has cached data\n *\n * @param {Element} el\n * Check if this element has cached data.\n *\n * @return {boolean}\n * - True if the DOM element has cached data.\n * - False otherwise.\n */\nfunction hasElData(el) {\n var id = el[elIdAttr];\n\n if (!id) {\n return false;\n }\n\n return !!Object.getOwnPropertyNames(elData[id]).length;\n}\n\n/**\n * Delete data for the element from the cache and the guid attr from getElementById\n *\n * @param {Element} el\n * Remove cached data for this element.\n */\nfunction removeElData(el) {\n var id = el[elIdAttr];\n\n if (!id) {\n return;\n }\n\n // Remove all stored data\n delete elData[id];\n\n // Remove the elIdAttr property from the DOM node\n try {\n delete el[elIdAttr];\n } catch (e) {\n if (el.removeAttribute) {\n el.removeAttribute(elIdAttr);\n } else {\n // IE doesn't appear to support removeAttribute on the document element\n el[elIdAttr] = null;\n }\n }\n}\n\n/**\n * Check if an element has a CSS class\n *\n * @param {Element} element\n * Element to check\n *\n * @param {string} classToCheck\n * Class name to check for\n *\n * @return {boolean}\n * - True if the element had the class\n * - False otherwise.\n *\n * @throws {Error}\n * Throws an error if `classToCheck` has white space.\n */\nfunction hasElClass(element, classToCheck) {\n throwIfWhitespace(classToCheck);\n if (element.classList) {\n return element.classList.contains(classToCheck);\n }\n return classRegExp(classToCheck).test(element.className);\n}\n\n/**\n * Add a CSS class name to an element\n *\n * @param {Element} element\n * Element to add class name to.\n *\n * @param {string} classToAdd\n * Class name to add.\n *\n * @return {Element}\n * The dom element with the added class name.\n */\nfunction addElClass(element, classToAdd) {\n if (element.classList) {\n element.classList.add(classToAdd);\n\n // Don't need to `throwIfWhitespace` here because `hasElClass` will do it\n // in the case of classList not being supported.\n } else if (!hasElClass(element, classToAdd)) {\n element.className = (element.className + ' ' + classToAdd).trim();\n }\n\n return element;\n}\n\n/**\n * Remove a CSS class name from an element\n *\n * @param {Element} element\n * Element to remove a class name from.\n *\n * @param {string} classToRemove\n * Class name to remove\n *\n * @return {Element}\n * The dom element with class name removed.\n */\nfunction removeElClass(element, classToRemove) {\n if (element.classList) {\n element.classList.remove(classToRemove);\n } else {\n throwIfWhitespace(classToRemove);\n element.className = element.className.split(/\\s+/).filter(function (c) {\n return c !== classToRemove;\n }).join(' ');\n }\n\n return element;\n}\n\n/**\n * The callback definition for toggleElClass.\n *\n * @callback Dom~PredicateCallback\n * @param {Element} element\n * The DOM element of the Component.\n *\n * @param {string} classToToggle\n * The `className` that wants to be toggled\n *\n * @return {boolean|undefined}\n * - If true the `classToToggle` will get added to `element`.\n * - If false the `classToToggle` will get removed from `element`.\n * - If undefined this callback will be ignored\n */\n\n/**\n * Adds or removes a CSS class name on an element depending on an optional\n * condition or the presence/absence of the class name.\n *\n * @param {Element} element\n * The element to toggle a class name on.\n *\n * @param {string} classToToggle\n * The class that should be toggled\n *\n * @param {boolean|PredicateCallback} [predicate]\n * See the return value for {@link Dom~PredicateCallback}\n *\n * @return {Element}\n * The element with a class that has been toggled.\n */\nfunction toggleElClass(element, classToToggle, predicate) {\n\n // This CANNOT use `classList` internally because IE does not support the\n // second parameter to the `classList.toggle()` method! Which is fine because\n // `classList` will be used by the add/remove functions.\n var has = hasElClass(element, classToToggle);\n\n if (typeof predicate === 'function') {\n predicate = predicate(element, classToToggle);\n }\n\n if (typeof predicate !== 'boolean') {\n predicate = !has;\n }\n\n // If the necessary class operation matches the current state of the\n // element, no action is required.\n if (predicate === has) {\n return;\n }\n\n if (predicate) {\n addElClass(element, classToToggle);\n } else {\n removeElClass(element, classToToggle);\n }\n\n return element;\n}\n\n/**\n * Apply attributes to an HTML element.\n *\n * @param {Element} el\n * Element to add attributes to.\n *\n * @param {Object} [attributes]\n * Attributes to be applied.\n */\nfunction setElAttributes(el, attributes) {\n Object.getOwnPropertyNames(attributes).forEach(function (attrName) {\n var attrValue = attributes[attrName];\n\n if (attrValue === null || typeof attrValue === 'undefined' || attrValue === false) {\n el.removeAttribute(attrName);\n } else {\n el.setAttribute(attrName, attrValue === true ? '' : attrValue);\n }\n });\n}\n\n/**\n * Get an element's attribute values, as defined on the HTML tag\n * Attributes are not the same as properties. They're defined on the tag\n * or with setAttribute (which shouldn't be used with HTML)\n * This will return true or false for boolean attributes.\n *\n * @param {Element} tag\n * Element from which to get tag attributes.\n *\n * @return {Object}\n * All attributes of the element.\n */\nfunction getElAttributes(tag) {\n var obj = {};\n\n // known boolean attributes\n // we can check for matching boolean properties, but older browsers\n // won't know about HTML5 boolean attributes that we still read from\n var knownBooleans = ',' + 'autoplay,controls,playsinline,loop,muted,default,defaultMuted' + ',';\n\n if (tag && tag.attributes && tag.attributes.length > 0) {\n var attrs = tag.attributes;\n\n for (var i = attrs.length - 1; i >= 0; i--) {\n var attrName = attrs[i].name;\n var attrVal = attrs[i].value;\n\n // check for known booleans\n // the matching element property will return a value for typeof\n if (typeof tag[attrName] === 'boolean' || knownBooleans.indexOf(',' + attrName + ',') !== -1) {\n // the value of an included boolean attribute is typically an empty\n // string ('') which would equal false if we just check for a false value.\n // we also don't want support bad code like autoplay='false'\n attrVal = attrVal !== null ? true : false;\n }\n\n obj[attrName] = attrVal;\n }\n }\n\n return obj;\n}\n\n/**\n * Get the value of an element's attribute\n *\n * @param {Element} el\n * A DOM element\n *\n * @param {string} attribute\n * Attribute to get the value of\n *\n * @return {string}\n * value of the attribute\n */\nfunction getAttribute(el, attribute) {\n return el.getAttribute(attribute);\n}\n\n/**\n * Set the value of an element's attribute\n *\n * @param {Element} el\n * A DOM element\n *\n * @param {string} attribute\n * Attribute to set\n *\n * @param {string} value\n * Value to set the attribute to\n */\nfunction setAttribute(el, attribute, value) {\n el.setAttribute(attribute, value);\n}\n\n/**\n * Remove an element's attribute\n *\n * @param {Element} el\n * A DOM element\n *\n * @param {string} attribute\n * Attribute to remove\n */\nfunction removeAttribute(el, attribute) {\n el.removeAttribute(attribute);\n}\n\n/**\n * Attempt to block the ability to select text while dragging controls\n */\nfunction blockTextSelection() {\n _document2['default'].body.focus();\n _document2['default'].onselectstart = function () {\n return false;\n };\n}\n\n/**\n * Turn off text selection blocking\n */\nfunction unblockTextSelection() {\n _document2['default'].onselectstart = function () {\n return true;\n };\n}\n\n/**\n * The postion of a DOM element on the page.\n *\n * @typedef {Object} Dom~Position\n *\n * @property {number} left\n * Pixels to the left\n *\n * @property {number} top\n * Pixels on top\n */\n\n/**\n * Offset Left.\n * getBoundingClientRect technique from\n * John Resig\n *\n * @see http://ejohn.org/blog/getboundingclientrect-is-awesome/\n *\n * @param {Element} el\n * Element from which to get offset\n *\n * @return {Dom~Position}\n * The position of the element that was passed in.\n */\nfunction findElPosition(el) {\n var box = void 0;\n\n if (el.getBoundingClientRect && el.parentNode) {\n box = el.getBoundingClientRect();\n }\n\n if (!box) {\n return {\n left: 0,\n top: 0\n };\n }\n\n var docEl = _document2['default'].documentElement;\n var body = _document2['default'].body;\n\n var clientLeft = docEl.clientLeft || body.clientLeft || 0;\n var scrollLeft = _window2['default'].pageXOffset || body.scrollLeft;\n var left = box.left + scrollLeft - clientLeft;\n\n var clientTop = docEl.clientTop || body.clientTop || 0;\n var scrollTop = _window2['default'].pageYOffset || body.scrollTop;\n var top = box.top + scrollTop - clientTop;\n\n // Android sometimes returns slightly off decimal values, so need to round\n return {\n left: Math.round(left),\n top: Math.round(top)\n };\n}\n\n/**\n * x and y coordinates for a dom element or mouse pointer\n *\n * @typedef {Object} Dom~Coordinates\n *\n * @property {number} x\n * x coordinate in pixels\n *\n * @property {number} y\n * y coordinate in pixels\n */\n\n/**\n * Get pointer position in element\n * Returns an object with x and y coordinates.\n * The base on the coordinates are the bottom left of the element.\n *\n * @param {Element} el\n * Element on which to get the pointer position on\n *\n * @param {EventTarget~Event} event\n * Event object\n *\n * @return {Dom~Coordinates}\n * A Coordinates object corresponding to the mouse position.\n *\n */\nfunction getPointerPosition(el, event) {\n var position = {};\n var box = findElPosition(el);\n var boxW = el.offsetWidth;\n var boxH = el.offsetHeight;\n\n var boxY = box.top;\n var boxX = box.left;\n var pageY = event.pageY;\n var pageX = event.pageX;\n\n if (event.changedTouches) {\n pageX = event.changedTouches[0].pageX;\n pageY = event.changedTouches[0].pageY;\n }\n\n position.y = Math.max(0, Math.min(1, (boxY - pageY + boxH) / boxH));\n position.x = Math.max(0, Math.min(1, (pageX - boxX) / boxW));\n\n return position;\n}\n\n/**\n * Determines, via duck typing, whether or not a value is a text node.\n *\n * @param {Mixed} value\n * Check if this value is a text node.\n *\n * @return {boolean}\n * - True if it is a text node\n * - False otherwise\n */\nfunction isTextNode(value) {\n return (0, _obj.isObject)(value) && value.nodeType === 3;\n}\n\n/**\n * Empties the contents of an element.\n *\n * @param {Element} el\n * The element to empty children from\n *\n * @return {Element}\n * The element with no children\n */\nfunction emptyEl(el) {\n while (el.firstChild) {\n el.removeChild(el.firstChild);\n }\n return el;\n}\n\n/**\n * Normalizes content for eventual insertion into the DOM.\n *\n * This allows a wide range of content definition methods, but protects\n * from falling into the trap of simply writing to `innerHTML`, which is\n * an XSS concern.\n *\n * The content for an element can be passed in multiple types and\n * combinations, whose behavior is as follows:\n *\n * @param {String|Element|TextNode|Array|Function} content\n * - String: Normalized into a text node.\n * - Element/TextNode: Passed through.\n * - Array: A one-dimensional array of strings, elements, nodes, or functions\n * (which return single strings, elements, or nodes).\n * - Function: If the sole argument, is expected to produce a string, element,\n * node, or array as defined above.\n *\n * @return {Array}\n * All of the content that was passed in normalized.\n */\nfunction normalizeContent(content) {\n\n // First, invoke content if it is a function. If it produces an array,\n // that needs to happen before normalization.\n if (typeof content === 'function') {\n content = content();\n }\n\n // Next up, normalize to an array, so one or many items can be normalized,\n // filtered, and returned.\n return (Array.isArray(content) ? content : [content]).map(function (value) {\n\n // First, invoke value if it is a function to produce a new value,\n // which will be subsequently normalized to a Node of some kind.\n if (typeof value === 'function') {\n value = value();\n }\n\n if (isEl(value) || isTextNode(value)) {\n return value;\n }\n\n if (typeof value === 'string' && /\\S/.test(value)) {\n return _document2['default'].createTextNode(value);\n }\n }).filter(function (value) {\n return value;\n });\n}\n\n/**\n * Normalizes and appends content to an element.\n *\n * @param {Element} el\n * Element to append normalized content to.\n *\n *\n * @param {String|Element|TextNode|Array|Function} content\n * See the `content` argument of {@link dom:normalizeContent}\n *\n * @return {Element}\n * The element with appended normalized content.\n */\nfunction appendContent(el, content) {\n normalizeContent(content).forEach(function (node) {\n return el.appendChild(node);\n });\n return el;\n}\n\n/**\n * Normalizes and inserts content into an element; this is identical to\n * `appendContent()`, except it empties the element first.\n *\n * @param {Element} el\n * Element to insert normalized content into.\n *\n * @param {String|Element|TextNode|Array|Function} content\n * See the `content` argument of {@link dom:normalizeContent}\n *\n * @return {Element}\n * The element with inserted normalized content.\n *\n */\nfunction insertContent(el, content) {\n return appendContent(emptyEl(el), content);\n}\n\n/**\n * Finds a single DOM element matching `selector` within the optional\n * `context` of another DOM element (defaulting to `document`).\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelector`.\n *\n * @param {Element|String} [context=document]\n * A DOM element within which to query. Can also be a selector\n * string in which case the first matching element will be used\n * as context. If missing (or no element matches selector), falls\n * back to `document`.\n *\n * @return {Element|null}\n * The element that was found or null.\n */\nvar $ = exports.$ = createQuerier('querySelector');\n\n/**\n * Finds a all DOM elements matching `selector` within the optional\n * `context` of another DOM element (defaulting to `document`).\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelectorAll`.\n *\n * @param {Element|String} [context=document]\n * A DOM element within which to query. Can also be a selector\n * string in which case the first matching element will be used\n * as context. If missing (or no element matches selector), falls\n * back to `document`.\n *\n * @return {NodeList}\n * A element list of elements that were found. Will be empty if none were found.\n *\n */\nvar $$ = exports.$$ = createQuerier('querySelectorAll');\n","'use strict';\n\nexports.__esModule = true;\nexports.BACKGROUND_SIZE_SUPPORTED = exports.TOUCH_ENABLED = exports.IS_ANY_SAFARI = exports.IS_SAFARI = exports.IE_VERSION = exports.IS_IE8 = exports.CHROME_VERSION = exports.IS_CHROME = exports.IS_EDGE = exports.IS_FIREFOX = exports.IS_NATIVE_ANDROID = exports.IS_OLD_ANDROID = exports.ANDROID_VERSION = exports.IS_ANDROID = exports.IOS_VERSION = exports.IS_IOS = exports.IS_IPOD = exports.IS_IPHONE = exports.IS_IPAD = undefined;\n\nvar _dom = require('./dom');\n\nvar Dom = _interopRequireWildcard(_dom);\n\nvar _window = require('global/window');\n\nvar _window2 = _interopRequireDefault(_window);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\n/**\n * @file browser.js\n * @module browser\n */\nvar USER_AGENT = _window2['default'].navigator && _window2['default'].navigator.userAgent || '';\nvar webkitVersionMap = /AppleWebKit\\/([\\d.]+)/i.exec(USER_AGENT);\nvar appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;\n\n/*\n * Device is an iPhone\n *\n * @type {Boolean}\n * @constant\n * @private\n */\nvar IS_IPAD = exports.IS_IPAD = /iPad/i.test(USER_AGENT);\n\n// The Facebook app's UIWebView identifies as both an iPhone and iPad, so\n// to identify iPhones, we need to exclude iPads.\n// http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/\nvar IS_IPHONE = exports.IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD;\nvar IS_IPOD = exports.IS_IPOD = /iPod/i.test(USER_AGENT);\nvar IS_IOS = exports.IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;\n\nvar IOS_VERSION = exports.IOS_VERSION = function () {\n var match = USER_AGENT.match(/OS (\\d+)_/i);\n\n if (match && match[1]) {\n return match[1];\n }\n return null;\n}();\n\nvar IS_ANDROID = exports.IS_ANDROID = /Android/i.test(USER_AGENT);\nvar ANDROID_VERSION = exports.ANDROID_VERSION = function () {\n // This matches Android Major.Minor.Patch versions\n // ANDROID_VERSION is Major.Minor as a Number, if Minor isn't available, then only Major is returned\n var match = USER_AGENT.match(/Android (\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))*/i);\n\n if (!match) {\n return null;\n }\n\n var major = match[1] && parseFloat(match[1]);\n var minor = match[2] && parseFloat(match[2]);\n\n if (major && minor) {\n return parseFloat(match[1] + '.' + match[2]);\n } else if (major) {\n return major;\n }\n return null;\n}();\n\n// Old Android is defined as Version older than 2.3, and requiring a webkit version of the android browser\nvar IS_OLD_ANDROID = exports.IS_OLD_ANDROID = IS_ANDROID && /webkit/i.test(USER_AGENT) && ANDROID_VERSION < 2.3;\nvar IS_NATIVE_ANDROID = exports.IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebkitVersion < 537;\n\nvar IS_FIREFOX = exports.IS_FIREFOX = /Firefox/i.test(USER_AGENT);\nvar IS_EDGE = exports.IS_EDGE = /Edge/i.test(USER_AGENT);\nvar IS_CHROME = exports.IS_CHROME = !IS_EDGE && /Chrome/i.test(USER_AGENT);\nvar CHROME_VERSION = exports.CHROME_VERSION = function () {\n var match = USER_AGENT.match(/Chrome\\/(\\d+)/);\n\n if (match && match[1]) {\n return parseFloat(match[1]);\n }\n return null;\n}();\nvar IS_IE8 = exports.IS_IE8 = /MSIE\\s8\\.0/.test(USER_AGENT);\nvar IE_VERSION = exports.IE_VERSION = function () {\n var result = /MSIE\\s(\\d+)\\.\\d/.exec(USER_AGENT);\n var version = result && parseFloat(result[1]);\n\n if (!version && /Trident\\/7.0/i.test(USER_AGENT) && /rv:11.0/.test(USER_AGENT)) {\n // IE 11 has a different user agent string than other IE versions\n version = 11.0;\n }\n\n return version;\n}();\n\nvar IS_SAFARI = exports.IS_SAFARI = /Safari/i.test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE;\nvar IS_ANY_SAFARI = exports.IS_ANY_SAFARI = IS_SAFARI || IS_IOS;\n\nvar TOUCH_ENABLED = exports.TOUCH_ENABLED = Dom.isReal() && ('ontouchstart' in _window2['default'] || _window2['default'].DocumentTouch && _window2['default'].document instanceof _window2['default'].DocumentTouch);\n\nvar BACKGROUND_SIZE_SUPPORTED = exports.BACKGROUND_SIZE_SUPPORTED = Dom.isReal() && 'backgroundSize' in _window2['default'].document.createElement('video').style;\n","'use strict';\n\nexports.__esModule = true;\nexports.fixEvent = fixEvent;\nexports.on = on;\nexports.off = off;\nexports.trigger = trigger;\nexports.one = one;\n\nvar _dom = require('./dom.js');\n\nvar Dom = _interopRequireWildcard(_dom);\n\nvar _guid = require('./guid.js');\n\nvar Guid = _interopRequireWildcard(_guid);\n\nvar _log = require('./log.js');\n\nvar _log2 = _interopRequireDefault(_log);\n\nvar _window = require('global/window');\n\nvar _window2 = _interopRequireDefault(_window);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\n/**\n * Clean up the listener cache and dispatchers\n *\n * @param {Element|Object} elem\n * Element to clean up\n *\n * @param {string} type\n * Type of event to clean up\n */\nfunction _cleanUpEvents(elem, type) {\n var data = Dom.getElData(elem);\n\n // Remove the events of a particular type if there are none left\n if (data.handlers[type].length === 0) {\n delete data.handlers[type];\n // data.handlers[type] = null;\n // Setting to null was causing an error with data.handlers\n\n // Remove the meta-handler from the element\n if (elem.removeEventListener) {\n elem.removeEventListener(type, data.dispatcher, false);\n } else if (elem.detachEvent) {\n elem.detachEvent('on' + type, data.dispatcher);\n }\n }\n\n // Remove the events object if there are no types left\n if (Object.getOwnPropertyNames(data.handlers).length <= 0) {\n delete data.handlers;\n delete data.dispatcher;\n delete data.disabled;\n }\n\n // Finally remove the element data if there is no data left\n if (Object.getOwnPropertyNames(data).length === 0) {\n Dom.removeElData(elem);\n }\n}\n\n/**\n * Loops through an array of event types and calls the requested method for each type.\n *\n * @param {Function} fn\n * The event method we want to use.\n *\n * @param {Element|Object} elem\n * Element or object to bind listeners to\n *\n * @param {string} type\n * Type of event to bind to.\n *\n * @param {EventTarget~EventListener} callback\n * Event listener.\n */\n/**\n * @file events.js. An Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/)\n * (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible)\n * This should work very similarly to jQuery's events, however it's based off the book version which isn't as\n * robust as jquery's, so there's probably some differences.\n *\n * @module events\n */\n\nfunction _handleMultipleEvents(fn, elem, types, callback) {\n types.forEach(function (type) {\n // Call the event method for each one of the types\n fn(elem, type, callback);\n });\n}\n\n/**\n * Fix a native event to have standard property values\n *\n * @param {Object} event\n * Event object to fix.\n *\n * @return {Object}\n * Fixed event object.\n */\nfunction fixEvent(event) {\n\n function returnTrue() {\n return true;\n }\n\n function returnFalse() {\n return false;\n }\n\n // Test if fixing up is needed\n // Used to check if !event.stopPropagation instead of isPropagationStopped\n // But native events return true for stopPropagation, but don't have\n // other expected methods like isPropagationStopped. Seems to be a problem\n // with the Javascript Ninja code. So we're just overriding all events now.\n if (!event || !event.isPropagationStopped) {\n var old = event || _window2['default'].event;\n\n event = {};\n // Clone the old object so that we can modify the values event = {};\n // IE8 Doesn't like when you mess with native event properties\n // Firefox returns false for event.hasOwnProperty('type') and other props\n // which makes copying more difficult.\n // TODO: Probably best to create a whitelist of event props\n for (var key in old) {\n // Safari 6.0.3 warns you if you try to copy deprecated layerX/Y\n // Chrome warns you if you try to copy deprecated keyboardEvent.keyLocation\n // and webkitMovementX/Y\n if (key !== 'layerX' && key !== 'layerY' && key !== 'keyLocation' && key !== 'webkitMovementX' && key !== 'webkitMovementY') {\n // Chrome 32+ warns if you try to copy deprecated returnValue, but\n // we still want to if preventDefault isn't supported (IE8).\n if (!(key === 'returnValue' && old.preventDefault)) {\n event[key] = old[key];\n }\n }\n }\n\n // The event occurred on this element\n if (!event.target) {\n event.target = event.srcElement || _document2['default'];\n }\n\n // Handle which other element the event is related to\n if (!event.relatedTarget) {\n event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;\n }\n\n // Stop the default browser action\n event.preventDefault = function () {\n if (old.preventDefault) {\n old.preventDefault();\n }\n event.returnValue = false;\n old.returnValue = false;\n event.defaultPrevented = true;\n };\n\n event.defaultPrevented = false;\n\n // Stop the event from bubbling\n event.stopPropagation = function () {\n if (old.stopPropagation) {\n old.stopPropagation();\n }\n event.cancelBubble = true;\n old.cancelBubble = true;\n event.isPropagationStopped = returnTrue;\n };\n\n event.isPropagationStopped = returnFalse;\n\n // Stop the event from bubbling and executing other handlers\n event.stopImmediatePropagation = function () {\n if (old.stopImmediatePropagation) {\n old.stopImmediatePropagation();\n }\n event.isImmediatePropagationStopped = returnTrue;\n event.stopPropagation();\n };\n\n event.isImmediatePropagationStopped = returnFalse;\n\n // Handle mouse position\n if (event.clientX !== null && event.clientX !== undefined) {\n var doc = _document2['default'].documentElement;\n var body = _document2['default'].body;\n\n event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);\n event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);\n }\n\n // Handle key presses\n event.which = event.charCode || event.keyCode;\n\n // Fix button for mouse clicks:\n // 0 == left; 1 == middle; 2 == right\n if (event.button !== null && event.button !== undefined) {\n\n // The following is disabled because it does not pass videojs-standard\n // and... yikes.\n /* eslint-disable */\n event.button = event.button & 1 ? 0 : event.button & 4 ? 1 : event.button & 2 ? 2 : 0;\n /* eslint-enable */\n }\n }\n\n // Returns fixed-up instance\n return event;\n}\n\n/**\n * Whether passive event listeners are supported\n */\nvar _supportsPassive = false;\n\n(function () {\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function get() {\n _supportsPassive = true;\n }\n });\n\n _window2['default'].addEventListener('test', null, opts);\n } catch (e) {\n // disregard\n }\n})();\n\n/**\n * Touch events Chrome expects to be passive\n */\nvar passiveEvents = ['touchstart', 'touchmove'];\n\n/**\n * Add an event listener to element\n * It stores the handler function in a separate cache object\n * and adds a generic handler to the element's event,\n * along with a unique id (guid) to the element.\n *\n * @param {Element|Object} elem\n * Element or object to bind listeners to\n *\n * @param {string|string[]} type\n * Type of event to bind to.\n *\n * @param {EventTarget~EventListener} fn\n * Event listener.\n */\nfunction on(elem, type, fn) {\n if (Array.isArray(type)) {\n return _handleMultipleEvents(on, elem, type, fn);\n }\n\n var data = Dom.getElData(elem);\n\n // We need a place to store all our handler data\n if (!data.handlers) {\n data.handlers = {};\n }\n\n if (!data.handlers[type]) {\n data.handlers[type] = [];\n }\n\n if (!fn.guid) {\n fn.guid = Guid.newGUID();\n }\n\n data.handlers[type].push(fn);\n\n if (!data.dispatcher) {\n data.disabled = false;\n\n data.dispatcher = function (event, hash) {\n\n if (data.disabled) {\n return;\n }\n\n event = fixEvent(event);\n\n var handlers = data.handlers[event.type];\n\n if (handlers) {\n // Copy handlers so if handlers are added/removed during the process it doesn't throw everything off.\n var handlersCopy = handlers.slice(0);\n\n for (var m = 0, n = handlersCopy.length; m < n; m++) {\n if (event.isImmediatePropagationStopped()) {\n break;\n } else {\n try {\n handlersCopy[m].call(elem, event, hash);\n } catch (e) {\n _log2['default'].error(e);\n }\n }\n }\n }\n };\n }\n\n if (data.handlers[type].length === 1) {\n if (elem.addEventListener) {\n var options = false;\n\n if (_supportsPassive && passiveEvents.indexOf(type) > -1) {\n options = { passive: true };\n }\n elem.addEventListener(type, data.dispatcher, options);\n } else if (elem.attachEvent) {\n elem.attachEvent('on' + type, data.dispatcher);\n }\n }\n}\n\n/**\n * Removes event listeners from an element\n *\n * @param {Element|Object} elem\n * Object to remove listeners from.\n *\n * @param {string|string[]} [type]\n * Type of listener to remove. Don't include to remove all events from element.\n *\n * @param {EventTarget~EventListener} [fn]\n * Specific listener to remove. Don't include to remove listeners for an event\n * type.\n */\nfunction off(elem, type, fn) {\n // Don't want to add a cache object through getElData if not needed\n if (!Dom.hasElData(elem)) {\n return;\n }\n\n var data = Dom.getElData(elem);\n\n // If no events exist, nothing to unbind\n if (!data.handlers) {\n return;\n }\n\n if (Array.isArray(type)) {\n return _handleMultipleEvents(off, elem, type, fn);\n }\n\n // Utility function\n var removeType = function removeType(t) {\n data.handlers[t] = [];\n _cleanUpEvents(elem, t);\n };\n\n // Are we removing all bound events?\n if (!type) {\n for (var t in data.handlers) {\n removeType(t);\n }\n return;\n }\n\n var handlers = data.handlers[type];\n\n // If no handlers exist, nothing to unbind\n if (!handlers) {\n return;\n }\n\n // If no listener was provided, remove all listeners for type\n if (!fn) {\n removeType(type);\n return;\n }\n\n // We're only removing a single handler\n if (fn.guid) {\n for (var n = 0; n < handlers.length; n++) {\n if (handlers[n].guid === fn.guid) {\n handlers.splice(n--, 1);\n }\n }\n }\n\n _cleanUpEvents(elem, type);\n}\n\n/**\n * Trigger an event for an element\n *\n * @param {Element|Object} elem\n * Element to trigger an event on\n *\n * @param {EventTarget~Event|string} event\n * A string (the type) or an event object with a type attribute\n *\n * @param {Object} [hash]\n * data hash to pass along with the event\n *\n * @return {boolean|undefined}\n * - Returns the opposite of `defaultPrevented` if default was prevented\n * - Otherwise returns undefined\n */\nfunction trigger(elem, event, hash) {\n // Fetches element data and a reference to the parent (for bubbling).\n // Don't want to add a data object to cache for every parent,\n // so checking hasElData first.\n var elemData = Dom.hasElData(elem) ? Dom.getElData(elem) : {};\n var parent = elem.parentNode || elem.ownerDocument;\n // type = event.type || event,\n // handler;\n\n // If an event name was passed as a string, creates an event out of it\n if (typeof event === 'string') {\n event = { type: event, target: elem };\n }\n // Normalizes the event properties.\n event = fixEvent(event);\n\n // If the passed element has a dispatcher, executes the established handlers.\n if (elemData.dispatcher) {\n elemData.dispatcher.call(elem, event, hash);\n }\n\n // Unless explicitly stopped or the event does not bubble (e.g. media events)\n // recursively calls this function to bubble the event up the DOM.\n if (parent && !event.isPropagationStopped() && event.bubbles === true) {\n trigger.call(null, parent, event, hash);\n\n // If at the top of the DOM, triggers the default action unless disabled.\n } else if (!parent && !event.defaultPrevented) {\n var targetData = Dom.getElData(event.target);\n\n // Checks if the target has a default action for this event.\n if (event.target[event.type]) {\n // Temporarily disables event dispatching on the target as we have already executed the handler.\n targetData.disabled = true;\n // Executes the default action.\n if (typeof event.target[event.type] === 'function') {\n event.target[event.type]();\n }\n // Re-enables event dispatching.\n targetData.disabled = false;\n }\n }\n\n // Inform the triggerer if the default was prevented by returning false\n return !event.defaultPrevented;\n}\n\n/**\n * Trigger a listener only once for an event\n *\n * @param {Element|Object} elem\n * Element or object to bind to.\n *\n * @param {string|string[]} type\n * Name/type of event\n *\n * @param {Event~EventListener} fn\n * Event Listener function\n */\nfunction one(elem, type, fn) {\n if (Array.isArray(type)) {\n return _handleMultipleEvents(one, elem, type, fn);\n }\n var func = function func() {\n off(elem, type, func);\n fn.apply(this, arguments);\n };\n\n // copy the guid to the new function so it can removed using the original function's ID\n func.guid = fn.guid = fn.guid || Guid.newGUID();\n on(elem, type, func);\n}\n","'use strict';\n\nexports.__esModule = true;\nexports.hasLoaded = exports.autoSetupTimeout = exports.autoSetup = undefined;\n\nvar _dom = require('./utils/dom');\n\nvar Dom = _interopRequireWildcard(_dom);\n\nvar _events = require('./utils/events.js');\n\nvar Events = _interopRequireWildcard(_events);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nvar _window = require('global/window');\n\nvar _window2 = _interopRequireDefault(_window);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\n/**\n * @file setup.js - Functions for setting up a player without\n * user interaction based on the data-setup `attribute` of the video tag.\n *\n * @module setup\n */\nvar _windowLoaded = false;\nvar videojs = void 0;\n\n/**\n * Set up any tags that have a data-setup `attribute` when the player is started.\n */\nvar autoSetup = function autoSetup() {\n\n // Protect against breakage in non-browser environments.\n if (!Dom.isReal()) {\n return;\n }\n\n // One day, when we stop supporting IE8, go back to this, but in the meantime...*hack hack hack*\n // var vids = Array.prototype.slice.call(document.getElementsByTagName('video'));\n // var audios = Array.prototype.slice.call(document.getElementsByTagName('audio'));\n // var mediaEls = vids.concat(audios);\n\n // Because IE8 doesn't support calling slice on a node list, we need to loop\n // through each list of elements to build up a new, combined list of elements.\n var vids = _document2['default'].getElementsByTagName('video');\n var audios = _document2['default'].getElementsByTagName('audio');\n var mediaEls = [];\n\n if (vids && vids.length > 0) {\n for (var i = 0, e = vids.length; i < e; i++) {\n mediaEls.push(vids[i]);\n }\n }\n\n if (audios && audios.length > 0) {\n for (var _i = 0, _e = audios.length; _i < _e; _i++) {\n mediaEls.push(audios[_i]);\n }\n }\n\n // Check if any media elements exist\n if (mediaEls && mediaEls.length > 0) {\n\n for (var _i2 = 0, _e2 = mediaEls.length; _i2 < _e2; _i2++) {\n var mediaEl = mediaEls[_i2];\n\n // Check if element exists, has getAttribute func.\n // IE seems to consider typeof el.getAttribute == 'object' instead of\n // 'function' like expected, at least when loading the player immediately.\n if (mediaEl && mediaEl.getAttribute) {\n\n // Make sure this player hasn't already been set up.\n if (mediaEl.player === undefined) {\n var options = mediaEl.getAttribute('data-setup');\n\n // Check if data-setup attr exists.\n // We only auto-setup if they've added the data-setup attr.\n if (options !== null) {\n // Create new video.js instance.\n videojs(mediaEl);\n }\n }\n\n // If getAttribute isn't defined, we need to wait for the DOM.\n } else {\n autoSetupTimeout(1);\n break;\n }\n }\n\n // No videos were found, so keep looping unless page is finished loading.\n } else if (!_windowLoaded) {\n autoSetupTimeout(1);\n }\n};\n\n/**\n * Wait until the page is loaded before running autoSetup. This will be called in\n * autoSetup if `hasLoaded` returns false.\n *\n * @param {number} wait\n * How long to wait in ms\n *\n * @param {videojs} [vjs]\n * The videojs library function\n */\nfunction autoSetupTimeout(wait, vjs) {\n if (vjs) {\n videojs = vjs;\n }\n\n _window2['default'].setTimeout(autoSetup, wait);\n}\n\nif (Dom.isReal() && _document2['default'].readyState === 'complete') {\n _windowLoaded = true;\n} else {\n /**\n * Listen for the load event on window, and set _windowLoaded to true.\n *\n * @listens load\n */\n Events.one(_window2['default'], 'load', function () {\n _windowLoaded = true;\n });\n}\n\n/**\n * check if the document has been loaded\n */\nvar hasLoaded = function hasLoaded() {\n return _windowLoaded;\n};\n\nexports.autoSetup = autoSetup;\nexports.autoSetupTimeout = autoSetupTimeout;\nexports.hasLoaded = hasLoaded;\n","'use strict';\n\nexports.__esModule = true;\nexports.setTextContent = exports.createStyleElement = undefined;\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\n/**\n * Create a DOM syle element given a className for it.\n *\n * @param {string} className\n * The className to add to the created style element.\n *\n * @return {Element}\n * The element that was created.\n */\nvar createStyleElement = exports.createStyleElement = function createStyleElement(className) {\n var style = _document2['default'].createElement('style');\n\n style.className = className;\n\n return style;\n};\n\n/**\n * Add text to a DOM element.\n *\n * @param {Element} el\n * The Element to add text content to.\n *\n * @param {string} content\n * The text to add to the element.\n */\n/**\n * @file stylesheet.js\n * @module stylesheet\n */\nvar setTextContent = exports.setTextContent = function setTextContent(el, content) {\n if (el.styleSheet) {\n el.styleSheet.cssText = content;\n } else {\n el.textContent = content;\n }\n};\n","'use strict';\n\nexports.__esModule = true;\nexports.throttle = exports.bind = undefined;\n\nvar _guid = require('./guid.js');\n\n/**\n * Bind (a.k.a proxy or Context). A simple method for changing the context of a function\n * It also stores a unique id on the function so it can be easily removed from events.\n *\n * @param {Mixed} context\n * The object to bind as scope.\n *\n * @param {Function} fn\n * The function to be bound to a scope.\n *\n * @param {number} [uid]\n * An optional unique ID for the function to be set\n *\n * @return {Function}\n * The new function that will be bound into the context given\n */\nvar bind = exports.bind = function bind(context, fn, uid) {\n // Make sure the function has a unique ID\n if (!fn.guid) {\n fn.guid = (0, _guid.newGUID)();\n }\n\n // Create the new function that changes the context\n var bound = function bound() {\n return fn.apply(context, arguments);\n };\n\n // Allow for the ability to individualize this function\n // Needed in the case where multiple objects might share the same prototype\n // IF both items add an event listener with the same function, then you try to remove just one\n // it will remove both because they both have the same guid.\n // when using this, you need to use the bind method when you remove the listener as well.\n // currently used in text tracks\n bound.guid = uid ? uid + '_' + fn.guid : fn.guid;\n\n return bound;\n};\n\n/**\n * Wraps the given function, `fn`, with a new function that only invokes `fn`\n * at most once per every `wait` milliseconds.\n *\n * @param {Function} fn\n * The function to be throttled.\n *\n * @param {Number} wait\n * The number of milliseconds by which to throttle.\n *\n * @return {Function}\n */\n/**\n * @file fn.js\n * @module fn\n */\nvar throttle = exports.throttle = function throttle(fn, wait) {\n var last = Date.now();\n\n var throttled = function throttled() {\n var now = Date.now();\n\n if (now - last >= wait) {\n fn.apply(undefined, arguments);\n last = now;\n }\n };\n\n return throttled;\n};\n","'use strict';\n\nexports.__esModule = true;\n/**\n * @file to-title-case.js\n * @module to-title-case\n */\n\n/**\n * Uppercase the first letter of a string.\n *\n * @param {string} string\n * String to be uppercased\n *\n * @return {string}\n * The string with an uppercased first letter\n */\nfunction toTitleCase(string) {\n if (typeof string !== 'string') {\n return string;\n }\n\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\n\nexports['default'] = toTitleCase;\n","'use strict';\n\nexports.__esModule = true;\nexports['default'] = mergeOptions;\n\nvar _obj = require('./obj');\n\n/**\n * Deep-merge one or more options objects, recursively merging **only** plain\n * object properties.\n *\n * @param {Object[]} sources\n * One or more objects to merge into a new object.\n *\n * @returns {Object}\n * A new object that is the merged result of all sources.\n */\nfunction mergeOptions() {\n var result = {};\n\n for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) {\n sources[_key] = arguments[_key];\n }\n\n sources.forEach(function (source) {\n if (!source) {\n return;\n }\n\n (0, _obj.each)(source, function (value, key) {\n if (!(0, _obj.isPlain)(value)) {\n result[key] = value;\n return;\n }\n\n if (!(0, _obj.isPlain)(result[key])) {\n result[key] = {};\n }\n\n result[key] = mergeOptions(result[key], value);\n });\n });\n\n return result;\n} /**\n * @file merge-options.js\n * @module merge-options\n */\n","'use strict';\n\nexports.__esModule = true;\n\nvar _window = require('global/window');\n\nvar _window2 = _interopRequireDefault(_window);\n\nvar _dom = require('./utils/dom.js');\n\nvar Dom = _interopRequireWildcard(_dom);\n\nvar _fn = require('./utils/fn.js');\n\nvar Fn = _interopRequireWildcard(_fn);\n\nvar _guid = require('./utils/guid.js');\n\nvar Guid = _interopRequireWildcard(_guid);\n\nvar _events = require('./utils/events.js');\n\nvar Events = _interopRequireWildcard(_events);\n\nvar _log = require('./utils/log.js');\n\nvar _log2 = _interopRequireDefault(_log);\n\nvar _toTitleCase = require('./utils/to-title-case.js');\n\nvar _toTitleCase2 = _interopRequireDefault(_toTitleCase);\n\nvar _mergeOptions = require('./utils/merge-options.js');\n\nvar _mergeOptions2 = _interopRequireDefault(_mergeOptions);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /**\n * Player Component - Base class for all UI objects\n *\n * @file component.js\n */\n\n\n/**\n * Base class for all UI Components.\n * Components are UI objects which represent both a javascript object and an element\n * in the DOM. They can be children of other components, and can have\n * children themselves.\n *\n * Components can also use methods from {@link EventTarget}\n */\nvar Component = function () {\n\n /**\n * A callback that is called when a component is ready. Does not have any\n * paramters and any callback value will be ignored.\n *\n * @callback Component~ReadyCallback\n * @this Component\n */\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n #\n * @param {Object[]} [options.children]\n * An array of children objects to intialize this component with. Children objects have\n * a name property that will be used if more than one component of the same type needs to be\n * added.\n *\n * @param {Component~ReadyCallback} [ready]\n * Function that gets called when the `Component` is ready.\n */\n function Component(player, options, ready) {\n _classCallCheck(this, Component);\n\n // The component might be the player itself and we can't pass `this` to super\n if (!player && this.play) {\n this.player_ = player = this; // eslint-disable-line\n } else {\n this.player_ = player;\n }\n\n // Make a copy of prototype.options_ to protect against overriding defaults\n this.options_ = (0, _mergeOptions2['default'])({}, this.options_);\n\n // Updated options with supplied options\n options = this.options_ = (0, _mergeOptions2['default'])(this.options_, options);\n\n // Get ID from options or options element if one is supplied\n this.id_ = options.id || options.el && options.el.id;\n\n // If there was no ID from the options, generate one\n if (!this.id_) {\n // Don't require the player ID function in the case of mock players\n var id = player && player.id && player.id() || 'no_player';\n\n this.id_ = id + '_component_' + Guid.newGUID();\n }\n\n this.name_ = options.name || null;\n\n // Create element if one wasn't provided in options\n if (options.el) {\n this.el_ = options.el;\n } else if (options.createEl !== false) {\n this.el_ = this.createEl();\n }\n\n this.children_ = [];\n this.childIndex_ = {};\n this.childNameIndex_ = {};\n\n // Add any child components in options\n if (options.initChildren !== false) {\n this.initChildren();\n }\n\n this.ready(ready);\n // Don't want to trigger ready here or it will before init is actually\n // finished for all children that run this constructor\n\n if (options.reportTouchActivity !== false) {\n this.enableTouchActivity();\n }\n }\n\n /**\n * Dispose of the `Component` and all child components.\n *\n * @fires Component#dispose\n */\n\n\n Component.prototype.dispose = function dispose() {\n\n /**\n * Triggered when a `Component` is disposed.\n *\n * @event Component#dispose\n * @type {EventTarget~Event}\n *\n * @property {boolean} [bubbles=false]\n * set to false so that the close event does not\n * bubble up\n */\n this.trigger({ type: 'dispose', bubbles: false });\n\n // Dispose all children.\n if (this.children_) {\n for (var i = this.children_.length - 1; i >= 0; i--) {\n if (this.children_[i].dispose) {\n this.children_[i].dispose();\n }\n }\n }\n\n // Delete child references\n this.children_ = null;\n this.childIndex_ = null;\n this.childNameIndex_ = null;\n\n // Remove all event listeners.\n this.off();\n\n // Remove element from DOM\n if (this.el_.parentNode) {\n this.el_.parentNode.removeChild(this.el_);\n }\n\n Dom.removeElData(this.el_);\n this.el_ = null;\n };\n\n /**\n * Return the {@link Player} that the `Component` has attached to.\n *\n * @return {Player}\n * The player that this `Component` has attached to.\n */\n\n\n Component.prototype.player = function player() {\n return this.player_;\n };\n\n /**\n * Deep merge of options objects with new options.\n * > Note: When both `obj` and `options` contain properties whose values are objects.\n * The two properties get merged using {@link module:mergeOptions}\n *\n * @param {Object} obj\n * The object that contains new options.\n *\n * @return {Object}\n * A new object of `this.options_` and `obj` merged together.\n *\n * @deprecated since version 5\n */\n\n\n Component.prototype.options = function options(obj) {\n _log2['default'].warn('this.options() has been deprecated and will be moved to the constructor in 6.0');\n\n if (!obj) {\n return this.options_;\n }\n\n this.options_ = (0, _mergeOptions2['default'])(this.options_, obj);\n return this.options_;\n };\n\n /**\n * Get the `Component`s DOM element\n *\n * @return {Element}\n * The DOM element for this `Component`.\n */\n\n\n Component.prototype.el = function el() {\n return this.el_;\n };\n\n /**\n * Create the `Component`s DOM element.\n *\n * @param {string} [tagName]\n * Element's DOM node type. e.g. 'div'\n *\n * @param {Object} [properties]\n * An object of properties that should be set.\n *\n * @param {Object} [attributes]\n * An object of attributes that should be set.\n *\n * @return {Element}\n * The element that gets created.\n */\n\n\n Component.prototype.createEl = function createEl(tagName, properties, attributes) {\n return Dom.createEl(tagName, properties, attributes);\n };\n\n /**\n * Localize a string given the string in english.\n *\n * @param {string} string\n * The string to localize.\n *\n * @return {string}\n * The localized string or if no localization exists the english string.\n */\n\n\n Component.prototype.localize = function localize(string) {\n var code = this.player_.language && this.player_.language();\n var languages = this.player_.languages && this.player_.languages();\n\n if (!code || !languages) {\n return string;\n }\n\n var language = languages[code];\n\n if (language && language[string]) {\n return language[string];\n }\n\n var primaryCode = code.split('-')[0];\n var primaryLang = languages[primaryCode];\n\n if (primaryLang && primaryLang[string]) {\n return primaryLang[string];\n }\n\n return string;\n };\n\n /**\n * Return the `Component`s DOM element. This is where children get inserted.\n * This will usually be the the same as the element returned in {@link Component#el}.\n *\n * @return {Element}\n * The content element for this `Component`.\n */\n\n\n Component.prototype.contentEl = function contentEl() {\n return this.contentEl_ || this.el_;\n };\n\n /**\n * Get this `Component`s ID\n *\n * @return {string}\n * The id of this `Component`\n */\n\n\n Component.prototype.id = function id() {\n return this.id_;\n };\n\n /**\n * Get the `Component`s name. The name gets used to reference the `Component`\n * and is set during registration.\n *\n * @return {string}\n * The name of this `Component`.\n */\n\n\n Component.prototype.name = function name() {\n return this.name_;\n };\n\n /**\n * Get an array of all child components\n *\n * @return {Array}\n * The children\n */\n\n\n Component.prototype.children = function children() {\n return this.children_;\n };\n\n /**\n * Returns the child `Component` with the given `id`.\n *\n * @param {string} id\n * The id of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The child `Component` with the given `id` or undefined.\n */\n\n\n Component.prototype.getChildById = function getChildById(id) {\n return this.childIndex_[id];\n };\n\n /**\n * Returns the child `Component` with the given `name`.\n *\n * @param {string} name\n * The name of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The child `Component` with the given `name` or undefined.\n */\n\n\n Component.prototype.getChild = function getChild(name) {\n if (!name) {\n return;\n }\n\n name = (0, _toTitleCase2['default'])(name);\n\n return this.childNameIndex_[name];\n };\n\n /**\n * Add a child `Component` inside the current `Component`.\n *\n *\n * @param {string|Component} child\n * The name or instance of a child to add.\n *\n * @param {Object} [options={}]\n * The key/value store of options that will get passed to children of\n * the child.\n *\n * @param {number} [index=this.children_.length]\n * The index to attempt to add a child into.\n *\n * @return {Component}\n * The `Component` that gets added as a child. When using a string the\n * `Component` will get created by this process.\n */\n\n\n Component.prototype.addChild = function addChild(child) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.children_.length;\n\n var component = void 0;\n var componentName = void 0;\n\n // If child is a string, create component with options\n if (typeof child === 'string') {\n componentName = (0, _toTitleCase2['default'])(child);\n\n // Options can also be specified as a boolean,\n // so convert to an empty object if false.\n if (!options) {\n options = {};\n }\n\n // Same as above, but true is deprecated so show a warning.\n if (options === true) {\n _log2['default'].warn('Initializing a child component with `true` is deprecated.' + 'Children should be defined in an array when possible, ' + 'but if necessary use an object instead of `true`.');\n options = {};\n }\n\n var componentClassName = options.componentClass || componentName;\n\n // Set name through options\n options.name = componentName;\n\n // Create a new object & element for this controls set\n // If there's no .player_, this is a player\n var ComponentClass = Component.getComponent(componentClassName);\n\n if (!ComponentClass) {\n throw new Error('Component ' + componentClassName + ' does not exist');\n }\n\n // data stored directly on the videojs object may be\n // misidentified as a component to retain\n // backwards-compatibility with 4.x. check to make sure the\n // component class can be instantiated.\n if (typeof ComponentClass !== 'function') {\n return null;\n }\n\n component = new ComponentClass(this.player_ || this, options);\n\n // child is a component instance\n } else {\n component = child;\n }\n\n this.children_.splice(index, 0, component);\n\n if (typeof component.id === 'function') {\n this.childIndex_[component.id()] = component;\n }\n\n // If a name wasn't used to create the component, check if we can use the\n // name function of the component\n componentName = componentName || component.name && (0, _toTitleCase2['default'])(component.name());\n\n if (componentName) {\n this.childNameIndex_[componentName] = component;\n }\n\n // Add the UI object's element to the container div (box)\n // Having an element is not required\n if (typeof component.el === 'function' && component.el()) {\n var childNodes = this.contentEl().children;\n var refNode = childNodes[index] || null;\n\n this.contentEl().insertBefore(component.el(), refNode);\n }\n\n // Return so it can stored on parent object if desired.\n return component;\n };\n\n /**\n * Remove a child `Component` from this `Component`s list of children. Also removes\n * the child `Component`s element from this `Component`s element.\n *\n * @param {Component} component\n * The child `Component` to remove.\n */\n\n\n Component.prototype.removeChild = function removeChild(component) {\n if (typeof component === 'string') {\n component = this.getChild(component);\n }\n\n if (!component || !this.children_) {\n return;\n }\n\n var childFound = false;\n\n for (var i = this.children_.length - 1; i >= 0; i--) {\n if (this.children_[i] === component) {\n childFound = true;\n this.children_.splice(i, 1);\n break;\n }\n }\n\n if (!childFound) {\n return;\n }\n\n this.childIndex_[component.id()] = null;\n this.childNameIndex_[component.name()] = null;\n\n var compEl = component.el();\n\n if (compEl && compEl.parentNode === this.contentEl()) {\n this.contentEl().removeChild(component.el());\n }\n };\n\n /**\n * Add and initialize default child `Component`s based upon options.\n */\n\n\n Component.prototype.initChildren = function initChildren() {\n var _this = this;\n\n var children = this.options_.children;\n\n if (children) {\n // `this` is `parent`\n var parentOptions = this.options_;\n\n var handleAdd = function handleAdd(child) {\n var name = child.name;\n var opts = child.opts;\n\n // Allow options for children to be set at the parent options\n // e.g. videojs(id, { controlBar: false });\n // instead of videojs(id, { children: { controlBar: false });\n if (parentOptions[name] !== undefined) {\n opts = parentOptions[name];\n }\n\n // Allow for disabling default components\n // e.g. options['children']['posterImage'] = false\n if (opts === false) {\n return;\n }\n\n // Allow options to be passed as a simple boolean if no configuration\n // is necessary.\n if (opts === true) {\n opts = {};\n }\n\n // We also want to pass the original player options\n // to each component as well so they don't need to\n // reach back into the player for options later.\n opts.playerOptions = _this.options_.playerOptions;\n\n // Create and add the child component.\n // Add a direct reference to the child by name on the parent instance.\n // If two of the same component are used, different names should be supplied\n // for each\n var newChild = _this.addChild(name, opts);\n\n if (newChild) {\n _this[name] = newChild;\n }\n };\n\n // Allow for an array of children details to passed in the options\n var workingChildren = void 0;\n var Tech = Component.getComponent('Tech');\n\n if (Array.isArray(children)) {\n workingChildren = children;\n } else {\n workingChildren = Object.keys(children);\n }\n\n workingChildren\n // children that are in this.options_ but also in workingChildren would\n // give us extra children we do not want. So, we want to filter them out.\n .concat(Object.keys(this.options_).filter(function (child) {\n return !workingChildren.some(function (wchild) {\n if (typeof wchild === 'string') {\n return child === wchild;\n }\n return child === wchild.name;\n });\n })).map(function (child) {\n var name = void 0;\n var opts = void 0;\n\n if (typeof child === 'string') {\n name = child;\n opts = children[name] || _this.options_[name] || {};\n } else {\n name = child.name;\n opts = child;\n }\n\n return { name: name, opts: opts };\n }).filter(function (child) {\n // we have to make sure that child.name isn't in the techOrder since\n // techs are registerd as Components but can't aren't compatible\n // See https://github.com/videojs/video.js/issues/2772\n var c = Component.getComponent(child.opts.componentClass || (0, _toTitleCase2['default'])(child.name));\n\n return c && !Tech.isTech(c);\n }).forEach(handleAdd);\n }\n };\n\n /**\n * Builds the default DOM class name. Should be overriden by sub-components.\n *\n * @return {string}\n * The DOM class name for this object.\n *\n * @abstract\n */\n\n\n Component.prototype.buildCSSClass = function buildCSSClass() {\n // Child classes can include a function that does:\n // return 'CLASS NAME' + this._super();\n return '';\n };\n\n /**\n * Add an `event listener` to this `Component`s element.\n *\n * The benefit of using this over the following:\n * - `VjsEvents.on(otherElement, 'eventName', myFunc)`\n * - `otherComponent.on('eventName', myFunc)`\n *\n * 1. Is that the listeners will get cleaned up when either component gets disposed.\n * 1. It will also bind `myComponent` as the context of `myFunc`.\n * > NOTE: If you remove the element from the DOM that has used `on` you need to\n * clean up references using: `myComponent.trigger(el, 'dispose')`\n * This will also allow the browser to garbage collect it. In special\n * cases such as with `window` and `document`, which are both permanent,\n * this is not necessary.\n *\n * @param {string|Component|string[]} [first]\n * The event name, and array of event names, or another `Component`.\n *\n * @param {EventTarget~EventListener|string|string[]} [second]\n * The listener function, an event name, or an Array of events names.\n *\n * @param {EventTarget~EventListener} [third]\n * The event handler if `first` is a `Component` and `second` is an event name\n * or an Array of event names.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n *\n * @listens Component#dispose\n */\n\n\n Component.prototype.on = function on(first, second, third) {\n var _this2 = this;\n\n if (typeof first === 'string' || Array.isArray(first)) {\n Events.on(this.el_, first, Fn.bind(this, second));\n\n // Targeting another component or element\n } else {\n var target = first;\n var type = second;\n var fn = Fn.bind(this, third);\n\n // When this component is disposed, remove the listener from the other component\n var removeOnDispose = function removeOnDispose() {\n return _this2.off(target, type, fn);\n };\n\n // Use the same function ID so we can remove it later it using the ID\n // of the original listener\n removeOnDispose.guid = fn.guid;\n this.on('dispose', removeOnDispose);\n\n // If the other component is disposed first we need to clean the reference\n // to the other component in this component's removeOnDispose listener\n // Otherwise we create a memory leak.\n var cleanRemover = function cleanRemover() {\n return _this2.off('dispose', removeOnDispose);\n };\n\n // Add the same function ID so we can easily remove it later\n cleanRemover.guid = fn.guid;\n\n // Check if this is a DOM node\n if (first.nodeName) {\n // Add the listener to the other element\n Events.on(target, type, fn);\n Events.on(target, 'dispose', cleanRemover);\n\n // Should be a component\n // Not using `instanceof Component` because it makes mock players difficult\n } else if (typeof first.on === 'function') {\n // Add the listener to the other component\n target.on(type, fn);\n target.on('dispose', cleanRemover);\n }\n }\n\n return this;\n };\n\n /**\n * Remove an event listener from this `Component`s element. If the second argument is\n * exluded all listeners for the type passed in as the first argument will be removed.\n *\n * @param {string|Component|string[]} [first]\n * The event name, and array of event names, or another `Component`.\n *\n * @param {EventTarget~EventListener|string|string[]} [second]\n * The listener function, an event name, or an Array of events names.\n *\n * @param {EventTarget~EventListener} [third]\n * The event handler if `first` is a `Component` and `second` is an event name\n * or an Array of event names.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.off = function off(first, second, third) {\n if (!first || typeof first === 'string' || Array.isArray(first)) {\n Events.off(this.el_, first, second);\n } else {\n var target = first;\n var type = second;\n // Ensure there's at least a guid, even if the function hasn't been used\n var fn = Fn.bind(this, third);\n\n // Remove the dispose listener on this component,\n // which was given the same guid as the event listener\n this.off('dispose', fn);\n\n if (first.nodeName) {\n // Remove the listener\n Events.off(target, type, fn);\n // Remove the listener for cleaning the dispose listener\n Events.off(target, 'dispose', fn);\n } else {\n target.off(type, fn);\n target.off('dispose', fn);\n }\n }\n\n return this;\n };\n\n /**\n * Add an event listener that gets triggered only once and then gets removed.\n *\n * @param {string|Component|string[]} [first]\n * The event name, and array of event names, or another `Component`.\n *\n * @param {EventTarget~EventListener|string|string[]} [second]\n * The listener function, an event name, or an Array of events names.\n *\n * @param {EventTarget~EventListener} [third]\n * The event handler if `first` is a `Component` and `second` is an event name\n * or an Array of event names.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.one = function one(first, second, third) {\n var _this3 = this,\n _arguments = arguments;\n\n if (typeof first === 'string' || Array.isArray(first)) {\n Events.one(this.el_, first, Fn.bind(this, second));\n } else {\n var target = first;\n var type = second;\n var fn = Fn.bind(this, third);\n\n var newFunc = function newFunc() {\n _this3.off(target, type, newFunc);\n fn.apply(null, _arguments);\n };\n\n // Keep the same function ID so we can remove it later\n newFunc.guid = fn.guid;\n\n this.on(target, type, newFunc);\n }\n\n return this;\n };\n\n /**\n * Trigger an event on an element.\n *\n * @param {EventTarget~Event|Object|string} event\n * The event name, and Event, or an event-like object with a type attribute\n * set to the event name.\n *\n * @param {Object} [hash]\n * Data hash to pass along with the event\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.trigger = function trigger(event, hash) {\n Events.trigger(this.el_, event, hash);\n return this;\n };\n\n /**\n * Bind a listener to the component's ready state. If the ready event has already\n * happened it will trigger the function immediately.\n *\n * @param {Component~ReadyCallback} fn\n * A function to call when ready is triggered.\n *\n * @param {boolean} [sync=false]\n * Execute the listener synchronously if `Component` is ready.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.ready = function ready(fn) {\n var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (fn) {\n if (this.isReady_) {\n if (sync) {\n fn.call(this);\n } else {\n // Call the function asynchronously by default for consistency\n this.setTimeout(fn, 1);\n }\n } else {\n this.readyQueue_ = this.readyQueue_ || [];\n this.readyQueue_.push(fn);\n }\n }\n return this;\n };\n\n /**\n * Trigger all the ready listeners for this `Component`.\n *\n * @fires Component#ready\n */\n\n\n Component.prototype.triggerReady = function triggerReady() {\n this.isReady_ = true;\n\n // Ensure ready is triggerd asynchronously\n this.setTimeout(function () {\n var readyQueue = this.readyQueue_;\n\n // Reset Ready Queue\n this.readyQueue_ = [];\n\n if (readyQueue && readyQueue.length > 0) {\n readyQueue.forEach(function (fn) {\n fn.call(this);\n }, this);\n }\n\n // Allow for using event listeners also\n /**\n * Triggered when a `Component` is ready.\n *\n * @event Component#ready\n * @type {EventTarget~Event}\n */\n this.trigger('ready');\n }, 1);\n };\n\n /**\n * Find a single DOM element matching a `selector`. This can be within the `Component`s\n * `contentEl()` or another custom context.\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelector`.\n *\n * @param {Element|string} [context=this.contentEl()]\n * A DOM element within which to query. Can also be a selector string in\n * which case the first matching element will get used as context. If\n * missing `this.contentEl()` gets used. If `this.contentEl()` returns\n * nothing it falls back to `document`.\n *\n * @return {Element|null}\n * the dom element that was found, or null\n *\n * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)\n */\n\n\n Component.prototype.$ = function $(selector, context) {\n return Dom.$(selector, context || this.contentEl());\n };\n\n /**\n * Finds all DOM element matching a `selector`. This can be within the `Component`s\n * `contentEl()` or another custom context.\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelectorAll`.\n *\n * @param {Element|string} [context=this.contentEl()]\n * A DOM element within which to query. Can also be a selector string in\n * which case the first matching element will get used as context. If\n * missing `this.contentEl()` gets used. If `this.contentEl()` returns\n * nothing it falls back to `document`.\n *\n * @return {NodeList}\n * a list of dom elements that were found\n *\n * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)\n */\n\n\n Component.prototype.$$ = function $$(selector, context) {\n return Dom.$$(selector, context || this.contentEl());\n };\n\n /**\n * Check if a component's element has a CSS class name.\n *\n * @param {string} classToCheck\n * CSS class name to check.\n *\n * @return {boolean}\n * - True if the `Component` has the class.\n * - False if the `Component` does not have the class`\n */\n\n\n Component.prototype.hasClass = function hasClass(classToCheck) {\n return Dom.hasElClass(this.el_, classToCheck);\n };\n\n /**\n * Add a CSS class name to the `Component`s element.\n *\n * @param {string} classToAdd\n * CSS class name to add\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.addClass = function addClass(classToAdd) {\n Dom.addElClass(this.el_, classToAdd);\n return this;\n };\n\n /**\n * Remove a CSS class name from the `Component`s element.\n *\n * @param {string} classToRemove\n * CSS class name to remove\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.removeClass = function removeClass(classToRemove) {\n Dom.removeElClass(this.el_, classToRemove);\n return this;\n };\n\n /**\n * Add or remove a CSS class name from the component's element.\n * - `classToToggle` gets added when {@link Component#hasClass} would return false.\n * - `classToToggle` gets removed when {@link Component#hasClass} would return true.\n *\n * @param {string} classToToggle\n * The class to add or remove based on (@link Component#hasClass}\n *\n * @param {boolean|Dom~predicate} [predicate]\n * An {@link Dom~predicate} function or a boolean\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.toggleClass = function toggleClass(classToToggle, predicate) {\n Dom.toggleElClass(this.el_, classToToggle, predicate);\n return this;\n };\n\n /**\n * Show the `Component`s element if it is hidden by removing the\n * 'vjs-hidden' class name from it.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.show = function show() {\n this.removeClass('vjs-hidden');\n return this;\n };\n\n /**\n * Hide the `Component`s element if it is currently showing by adding the\n * 'vjs-hidden` class name to it.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.hide = function hide() {\n this.addClass('vjs-hidden');\n return this;\n };\n\n /**\n * Lock a `Component`s element in its visible state by adding the 'vjs-lock-showing'\n * class name to it. Used during fadeIn/fadeOut.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n *\n * @private\n */\n\n\n Component.prototype.lockShowing = function lockShowing() {\n this.addClass('vjs-lock-showing');\n return this;\n };\n\n /**\n * Unlock a `Component`s element from its visible state by removing the 'vjs-lock-showing'\n * class name from it. Used during fadeIn/fadeOut.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n *\n * @private\n */\n\n\n Component.prototype.unlockShowing = function unlockShowing() {\n this.removeClass('vjs-lock-showing');\n return this;\n };\n\n /**\n * Get the value of an attribute on the `Component`s element.\n *\n * @param {string} attribute\n * Name of the attribute to get the value from.\n *\n * @return {string|null}\n * - The value of the attribute that was asked for.\n * - Can be an empty string on some browsers if the attribute does not exist\n * or has no value\n * - Most browsers will return null if the attibute does not exist or has\n * no value.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute}\n */\n\n\n Component.prototype.getAttribute = function getAttribute(attribute) {\n return Dom.getAttribute(this.el_, attribute);\n };\n\n /**\n * Set the value of an attribute on the `Component`'s element\n *\n * @param {string} attribute\n * Name of the attribute to set.\n *\n * @param {string} value\n * Value to set the attribute to.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute}\n */\n\n\n Component.prototype.setAttribute = function setAttribute(attribute, value) {\n Dom.setAttribute(this.el_, attribute, value);\n return this;\n };\n\n /**\n * Remove an attribute from the `Component`s element.\n *\n * @param {string} attribute\n * Name of the attribute to remove.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute}\n */\n\n\n Component.prototype.removeAttribute = function removeAttribute(attribute) {\n Dom.removeAttribute(this.el_, attribute);\n return this;\n };\n\n /**\n * Get or set the width of the component based upon the CSS styles.\n * See {@link Component#dimension} for more detailed information.\n *\n * @param {number|string} [num]\n * The width that you want to set postfixed with '%', 'px' or nothing.\n *\n * @param {boolean} [skipListeners]\n * Skip the resize event trigger\n *\n * @return {Component|number|string}\n * - The width when getting, zero if there is no width. Can be a string\n * postpixed with '%' or 'px'.\n * - Returns itself when setting; method can be chained.\n */\n\n\n Component.prototype.width = function width(num, skipListeners) {\n return this.dimension('width', num, skipListeners);\n };\n\n /**\n * Get or set the height of the component based upon the CSS styles.\n * See {@link Component#dimension} for more detailed information.\n *\n * @param {number|string} [num]\n * The height that you want to set postfixed with '%', 'px' or nothing.\n *\n * @param {boolean} [skipListeners]\n * Skip the resize event trigger\n *\n * @return {Component|number|string}\n * - The width when getting, zero if there is no width. Can be a string\n * postpixed with '%' or 'px'.\n * - Returns itself when setting; method can be chained.\n */\n\n\n Component.prototype.height = function height(num, skipListeners) {\n return this.dimension('height', num, skipListeners);\n };\n\n /**\n * Set both the width and height of the `Component` element at the same time.\n *\n * @param {number|string} width\n * Width to set the `Component`s element to.\n *\n * @param {number|string} height\n * Height to set the `Component`s element to.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.dimensions = function dimensions(width, height) {\n // Skip resize listeners on width for optimization\n return this.width(width, true).height(height);\n };\n\n /**\n * Get or set width or height of the `Component` element. This is the shared code\n * for the {@link Component#width} and {@link Component#height}.\n *\n * Things to know:\n * - If the width or height in an number this will return the number postfixed with 'px'.\n * - If the width/height is a percent this will return the percent postfixed with '%'\n * - Hidden elements have a width of 0 with `window.getComputedStyle`. This function\n * defaults to the `Component`s `style.width` and falls back to `window.getComputedStyle`.\n * See [this]{@link http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/}\n * for more information\n * - If you want the computed style of the component, use {@link Component#currentWidth}\n * and {@link {Component#currentHeight}\n *\n * @fires Component#resize\n *\n * @param {string} widthOrHeight\n 8 'width' or 'height'\n *\n * @param {number|string} [num]\n 8 New dimension\n *\n * @param {boolean} [skipListeners]\n * Skip resize event trigger\n *\n * @return {Component}\n * - the dimension when getting or 0 if unset\n * - Returns itself when setting; method can be chained.\n */\n\n\n Component.prototype.dimension = function dimension(widthOrHeight, num, skipListeners) {\n if (num !== undefined) {\n // Set to zero if null or literally NaN (NaN !== NaN)\n if (num === null || num !== num) {\n num = 0;\n }\n\n // Check if using css width/height (% or px) and adjust\n if (('' + num).indexOf('%') !== -1 || ('' + num).indexOf('px') !== -1) {\n this.el_.style[widthOrHeight] = num;\n } else if (num === 'auto') {\n this.el_.style[widthOrHeight] = '';\n } else {\n this.el_.style[widthOrHeight] = num + 'px';\n }\n\n // skipListeners allows us to avoid triggering the resize event when setting both width and height\n if (!skipListeners) {\n /**\n * Triggered when a component is resized.\n *\n * @event Component#resize\n * @type {EventTarget~Event}\n */\n this.trigger('resize');\n }\n\n // Return component\n return this;\n }\n\n // Not setting a value, so getting it\n // Make sure element exists\n if (!this.el_) {\n return 0;\n }\n\n // Get dimension value from style\n var val = this.el_.style[widthOrHeight];\n var pxIndex = val.indexOf('px');\n\n if (pxIndex !== -1) {\n // Return the pixel value with no 'px'\n return parseInt(val.slice(0, pxIndex), 10);\n }\n\n // No px so using % or no style was set, so falling back to offsetWidth/height\n // If component has display:none, offset will return 0\n // TODO: handle display:none and no dimension style using px\n return parseInt(this.el_['offset' + (0, _toTitleCase2['default'])(widthOrHeight)], 10);\n };\n\n /**\n * Get the width or the height of the `Component` elements computed style. Uses\n * `window.getComputedStyle`.\n *\n * @param {string} widthOrHeight\n * A string containing 'width' or 'height'. Whichever one you want to get.\n *\n * @return {number}\n * The dimension that gets asked for or 0 if nothing was set\n * for that dimension.\n */\n\n\n Component.prototype.currentDimension = function currentDimension(widthOrHeight) {\n var computedWidthOrHeight = 0;\n\n if (widthOrHeight !== 'width' && widthOrHeight !== 'height') {\n throw new Error('currentDimension only accepts width or height value');\n }\n\n if (typeof _window2['default'].getComputedStyle === 'function') {\n var computedStyle = _window2['default'].getComputedStyle(this.el_);\n\n computedWidthOrHeight = computedStyle.getPropertyValue(widthOrHeight) || computedStyle[widthOrHeight];\n }\n\n // remove 'px' from variable and parse as integer\n computedWidthOrHeight = parseFloat(computedWidthOrHeight);\n\n // if the computed value is still 0, it's possible that the browser is lying\n // and we want to check the offset values.\n // This code also runs on IE8 and wherever getComputedStyle doesn't exist.\n if (computedWidthOrHeight === 0) {\n var rule = 'offset' + (0, _toTitleCase2['default'])(widthOrHeight);\n\n computedWidthOrHeight = this.el_[rule];\n }\n\n return computedWidthOrHeight;\n };\n\n /**\n * An object that contains width and height values of the `Component`s\n * computed style. Uses `window.getComputedStyle`.\n *\n * @typedef {Object} Component~DimensionObject\n *\n * @property {number} width\n * The width of the `Component`s computed style.\n *\n * @property {number} height\n * The height of the `Component`s computed style.\n */\n\n /**\n * Get an object that contains width and height values of the `Component`s\n * computed style.\n *\n * @return {Component~DimensionObject}\n * The dimensions of the components element\n */\n\n\n Component.prototype.currentDimensions = function currentDimensions() {\n return {\n width: this.currentDimension('width'),\n height: this.currentDimension('height')\n };\n };\n\n /**\n * Get the width of the `Component`s computed style. Uses `window.getComputedStyle`.\n *\n * @return {number} width\n * The width of the `Component`s computed style.\n */\n\n\n Component.prototype.currentWidth = function currentWidth() {\n return this.currentDimension('width');\n };\n\n /**\n * Get the height of the `Component`s computed style. Uses `window.getComputedStyle`.\n *\n * @return {number} height\n * The height of the `Component`s computed style.\n */\n\n\n Component.prototype.currentHeight = function currentHeight() {\n return this.currentDimension('height');\n };\n\n /**\n * Set the focus to this component\n */\n\n\n Component.prototype.focus = function focus() {\n this.el_.focus();\n };\n\n /**\n * Remove the focus from this component\n */\n\n\n Component.prototype.blur = function blur() {\n this.el_.blur();\n };\n\n /**\n * Emit a 'tap' events when touch event support gets detected. This gets used to\n * support toggling the controls through a tap on the video. They get enabled\n * because every sub-component would have extra overhead otherwise.\n *\n * @private\n * @fires Component#tap\n * @listens Component#touchstart\n * @listens Component#touchmove\n * @listens Component#touchleave\n * @listens Component#touchcancel\n * @listens Component#touchend\n */\n\n\n Component.prototype.emitTapEvents = function emitTapEvents() {\n // Track the start time so we can determine how long the touch lasted\n var touchStart = 0;\n var firstTouch = null;\n\n // Maximum movement allowed during a touch event to still be considered a tap\n // Other popular libs use anywhere from 2 (hammer.js) to 15,\n // so 10 seems like a nice, round number.\n var tapMovementThreshold = 10;\n\n // The maximum length a touch can be while still being considered a tap\n var touchTimeThreshold = 200;\n\n var couldBeTap = void 0;\n\n this.on('touchstart', function (event) {\n // If more than one finger, don't consider treating this as a click\n if (event.touches.length === 1) {\n // Copy pageX/pageY from the object\n firstTouch = {\n pageX: event.touches[0].pageX,\n pageY: event.touches[0].pageY\n };\n // Record start time so we can detect a tap vs. \"touch and hold\"\n touchStart = new Date().getTime();\n // Reset couldBeTap tracking\n couldBeTap = true;\n }\n });\n\n this.on('touchmove', function (event) {\n // If more than one finger, don't consider treating this as a click\n if (event.touches.length > 1) {\n couldBeTap = false;\n } else if (firstTouch) {\n // Some devices will throw touchmoves for all but the slightest of taps.\n // So, if we moved only a small distance, this could still be a tap\n var xdiff = event.touches[0].pageX - firstTouch.pageX;\n var ydiff = event.touches[0].pageY - firstTouch.pageY;\n var touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);\n\n if (touchDistance > tapMovementThreshold) {\n couldBeTap = false;\n }\n }\n });\n\n var noTap = function noTap() {\n couldBeTap = false;\n };\n\n // TODO: Listen to the original target. http://youtu.be/DujfpXOKUp8?t=13m8s\n this.on('touchleave', noTap);\n this.on('touchcancel', noTap);\n\n // When the touch ends, measure how long it took and trigger the appropriate\n // event\n this.on('touchend', function (event) {\n firstTouch = null;\n // Proceed only if the touchmove/leave/cancel event didn't happen\n if (couldBeTap === true) {\n // Measure how long the touch lasted\n var touchTime = new Date().getTime() - touchStart;\n\n // Make sure the touch was less than the threshold to be considered a tap\n if (touchTime < touchTimeThreshold) {\n // Don't let browser turn this into a click\n event.preventDefault();\n /**\n * Triggered when a `Component` is tapped.\n *\n * @event Component#tap\n * @type {EventTarget~Event}\n */\n this.trigger('tap');\n // It may be good to copy the touchend event object and change the\n // type to tap, if the other event properties aren't exact after\n // Events.fixEvent runs (e.g. event.target)\n }\n }\n });\n };\n\n /**\n * This function reports user activity whenever touch events happen. This can get\n * turned off by any sub-components that wants touch events to act another way.\n *\n * Report user touch activity when touch events occur. User activity gets used to\n * determine when controls should show/hide. It is simple when it comes to mouse\n * events, because any mouse event should show the controls. So we capture mouse\n * events that bubble up to the player and report activity when that happens.\n * With touch events it isn't as easy as `touchstart` and `touchend` toggle player\n * controls. So touch events can't help us at the player level either.\n *\n * User activity gets checked asynchronously. So what could happen is a tap event\n * on the video turns the controls off. Then the `touchend` event bubbles up to\n * the player. Which, if it reported user activity, would turn the controls right\n * back on. We also don't want to completely block touch events from bubbling up.\n * Furthermore a `touchmove` event and anything other than a tap, should not turn\n * controls back on.\n *\n * @listens Component#touchstart\n * @listens Component#touchmove\n * @listens Component#touchend\n * @listens Component#touchcancel\n */\n\n\n Component.prototype.enableTouchActivity = function enableTouchActivity() {\n // Don't continue if the root player doesn't support reporting user activity\n if (!this.player() || !this.player().reportUserActivity) {\n return;\n }\n\n // listener for reporting that the user is active\n var report = Fn.bind(this.player(), this.player().reportUserActivity);\n\n var touchHolding = void 0;\n\n this.on('touchstart', function () {\n report();\n // For as long as the they are touching the device or have their mouse down,\n // we consider them active even if they're not moving their finger or mouse.\n // So we want to continue to update that they are active\n this.clearInterval(touchHolding);\n // report at the same interval as activityCheck\n touchHolding = this.setInterval(report, 250);\n });\n\n var touchEnd = function touchEnd(event) {\n report();\n // stop the interval that maintains activity if the touch is holding\n this.clearInterval(touchHolding);\n };\n\n this.on('touchmove', report);\n this.on('touchend', touchEnd);\n this.on('touchcancel', touchEnd);\n };\n\n /**\n * A callback that has no parameters and is bound into `Component`s context.\n *\n * @callback Component~GenericCallback\n * @this Component\n */\n\n /**\n * Creates a function that runs after an `x` millisecond timeout. This function is a\n * wrapper around `window.setTimeout`. There are a few reasons to use this one\n * instead though:\n * 1. It gets cleared via {@link Component#clearTimeout} when\n * {@link Component#dispose} gets called.\n * 2. The function callback will gets turned into a {@link Component~GenericCallback}\n *\n * > Note: You can use `window.clearTimeout` on the id returned by this function. This\n * will cause its dispose listener not to get cleaned up! Please use\n * {@link Component#clearTimeout} or {@link Component#dispose}.\n *\n * @param {Component~GenericCallback} fn\n * The function that will be run after `timeout`.\n *\n * @param {number} timeout\n * Timeout in milliseconds to delay before executing the specified function.\n *\n * @return {number}\n * Returns a timeout ID that gets used to identify the timeout. It can also\n * get used in {@link Component#clearTimeout} to clear the timeout that\n * was set.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout}\n */\n\n\n Component.prototype.setTimeout = function setTimeout(fn, timeout) {\n fn = Fn.bind(this, fn);\n\n var timeoutId = _window2['default'].setTimeout(fn, timeout);\n var disposeFn = function disposeFn() {\n this.clearTimeout(timeoutId);\n };\n\n disposeFn.guid = 'vjs-timeout-' + timeoutId;\n\n this.on('dispose', disposeFn);\n\n return timeoutId;\n };\n\n /**\n * Clears a timeout that gets created via `window.setTimeout` or\n * {@link Component#setTimeout}. If you set a timeout via {@link Component#setTimeout}\n * use this function instead of `window.clearTimout`. If you don't your dispose\n * listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} timeoutId\n * The id of the timeout to clear. The return value of\n * {@link Component#setTimeout} or `window.setTimeout`.\n *\n * @return {number}\n * Returns the timeout id that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearTimeout}\n */\n\n\n Component.prototype.clearTimeout = function clearTimeout(timeoutId) {\n _window2['default'].clearTimeout(timeoutId);\n\n var disposeFn = function disposeFn() {};\n\n disposeFn.guid = 'vjs-timeout-' + timeoutId;\n\n this.off('dispose', disposeFn);\n\n return timeoutId;\n };\n\n /**\n * Creates a function that gets run every `x` milliseconds. This function is a wrapper\n * around `window.setInterval`. There are a few reasons to use this one instead though.\n * 1. It gets cleared via {@link Component#clearInterval} when\n * {@link Component#dispose} gets called.\n * 2. The function callback will be a {@link Component~GenericCallback}\n *\n * @param {Component~GenericCallback} fn\n * The function to run every `x` seconds.\n *\n * @param {number} interval\n * Execute the specified function every `x` milliseconds.\n *\n * @return {number}\n * Returns an id that can be used to identify the interval. It can also be be used in\n * {@link Component#clearInterval} to clear the interval.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval}\n */\n\n\n Component.prototype.setInterval = function setInterval(fn, interval) {\n fn = Fn.bind(this, fn);\n\n var intervalId = _window2['default'].setInterval(fn, interval);\n\n var disposeFn = function disposeFn() {\n this.clearInterval(intervalId);\n };\n\n disposeFn.guid = 'vjs-interval-' + intervalId;\n\n this.on('dispose', disposeFn);\n\n return intervalId;\n };\n\n /**\n * Clears an interval that gets created via `window.setInterval` or\n * {@link Component#setInterval}. If you set an inteval via {@link Component#setInterval}\n * use this function instead of `window.clearInterval`. If you don't your dispose\n * listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} intervalId\n * The id of the interval to clear. The return value of\n * {@link Component#setInterval} or `window.setInterval`.\n *\n * @return {number}\n * Returns the interval id that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearInterval}\n */\n\n\n Component.prototype.clearInterval = function clearInterval(intervalId) {\n _window2['default'].clearInterval(intervalId);\n\n var disposeFn = function disposeFn() {};\n\n disposeFn.guid = 'vjs-interval-' + intervalId;\n\n this.off('dispose', disposeFn);\n\n return intervalId;\n };\n\n /**\n * Register a `Component` with `videojs` given the name and the component.\n *\n * > NOTE: {@link Tech}s should not be registered as a `Component`. {@link Tech}s\n * should be registered using {@link Tech.registerTech} or\n * {@link videojs:videojs.registerTech}.\n *\n * > NOTE: This function can also be seen on videojs as\n * {@link videojs:videojs.registerComponent}.\n *\n * @param {string} name\n * The name of the `Component` to register.\n *\n * @param {Component} comp\n * The `Component` class to register.\n *\n * @return {Component}\n * The `Component` that was registered.\n */\n\n\n Component.registerComponent = function registerComponent(name, comp) {\n if (!name) {\n return;\n }\n\n name = (0, _toTitleCase2['default'])(name);\n\n if (!Component.components_) {\n Component.components_ = {};\n }\n\n if (name === 'Player' && Component.components_[name]) {\n var Player = Component.components_[name];\n\n // If we have players that were disposed, then their name will still be\n // in Players.players. So, we must loop through and verify that the value\n // for each item is not null. This allows registration of the Player component\n // after all players have been disposed or before any were created.\n if (Player.players && Object.keys(Player.players).length > 0 && Object.keys(Player.players).map(function (playerName) {\n return Player.players[playerName];\n }).every(Boolean)) {\n throw new Error('Can not register Player component after player has been created');\n }\n }\n\n Component.components_[name] = comp;\n\n return comp;\n };\n\n /**\n * Get a `Component` based on the name it was registered with.\n *\n * @param {string} name\n * The Name of the component to get.\n *\n * @return {Component}\n * The `Component` that got registered under the given name.\n *\n * @deprecated In `videojs` 6 this will not return `Component`s that were not\n * registered using {@link Component.registerComponent}. Currently we\n * check the global `videojs` object for a `Component` name and\n * return that if it exists.\n */\n\n\n Component.getComponent = function getComponent(name) {\n if (!name) {\n return;\n }\n\n name = (0, _toTitleCase2['default'])(name);\n\n if (Component.components_ && Component.components_[name]) {\n return Component.components_[name];\n }\n\n if (_window2['default'] && _window2['default'].videojs && _window2['default'].videojs[name]) {\n _log2['default'].warn('The ' + name + ' component was added to the videojs object when it should be registered using videojs.registerComponent(name, component)');\n\n return _window2['default'].videojs[name];\n }\n };\n\n /**\n * Sets up the constructor using the supplied init method or uses the init of the\n * parent object.\n *\n * @param {Object} [props={}]\n * An object of properties.\n *\n * @return {Object}\n * the extended object.\n *\n * @deprecated since version 5\n */\n\n\n Component.extend = function extend(props) {\n props = props || {};\n\n _log2['default'].warn('Component.extend({}) has been deprecated, ' + ' use videojs.extend(Component, {}) instead');\n\n // Set up the constructor using the supplied init method\n // or using the init of the parent object\n // Make sure to check the unobfuscated version for external libs\n var init = props.init || props.init || this.prototype.init || this.prototype.init || function () {};\n // In Resig's simple class inheritance (previously used) the constructor\n // is a function that calls `this.init.apply(arguments)`\n // However that would prevent us from using `ParentObject.call(this);`\n // in a Child constructor because the `this` in `this.init`\n // would still refer to the Child and cause an infinite loop.\n // We would instead have to do\n // `ParentObject.prototype.init.apply(this, arguments);`\n // Bleh. We're not creating a _super() function, so it's good to keep\n // the parent constructor reference simple.\n var subObj = function subObj() {\n init.apply(this, arguments);\n };\n\n // Inherit from this object's prototype\n subObj.prototype = Object.create(this.prototype);\n // Reset the constructor property for subObj otherwise\n // instances of subObj would have the constructor of the parent Object\n subObj.prototype.constructor = subObj;\n\n // Make the class extendable\n subObj.extend = Component.extend;\n\n // Extend subObj's prototype with functions and other properties from props\n for (var name in props) {\n if (props.hasOwnProperty(name)) {\n subObj.prototype[name] = props[name];\n }\n }\n\n return subObj;\n };\n\n return Component;\n}();\n\nComponent.registerComponent('Component', Component);\nexports['default'] = Component;\n","'use strict';\n\nexports.__esModule = true;\n\nvar _events = require('./utils/events.js');\n\nvar Events = _interopRequireWildcard(_events);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\n/**\n * `EventTarget` is a class that can have the same API as the DOM `EventTarget`. It\n * adds shorthand functions that wrap around lengthy functions. For example:\n * the `on` function is a wrapper around `addEventListener`.\n *\n * @see [EventTarget Spec]{@link https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget}\n * @class EventTarget\n */\nvar EventTarget = function EventTarget() {};\n\n/**\n * A Custom DOM event.\n *\n * @typedef {Object} EventTarget~Event\n * @see [Properties]{@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}\n */\n\n/**\n * All event listeners should follow the following format.\n *\n * @callback EventTarget~EventListener\n * @this {EventTarget}\n *\n * @param {EventTarget~Event} event\n * the event that triggered this function\n *\n * @param {Object} [hash]\n * hash of data sent during the event\n */\n\n/**\n * An object containing event names as keys and booleans as values.\n *\n * > NOTE: If an event name is set to a true value here {@link EventTarget#trigger}\n * will have extra functionality. See that function for more information.\n *\n * @property EventTarget.prototype.allowedEvents_\n * @private\n */\n/**\n * @file src/js/event-target.js\n */\nEventTarget.prototype.allowedEvents_ = {};\n\n/**\n * Adds an `event listener` to an instance of an `EventTarget`. An `event listener` is a\n * function that will get called when an event with a certain name gets triggered.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to call with `EventTarget`s\n */\nEventTarget.prototype.on = function (type, fn) {\n // Remove the addEventListener alias before calling Events.on\n // so we don't get into an infinite type loop\n var ael = this.addEventListener;\n\n this.addEventListener = function () {};\n Events.on(this, type, fn);\n this.addEventListener = ael;\n};\n\n/**\n * An alias of {@link EventTarget#on}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#on}\n */\nEventTarget.prototype.addEventListener = EventTarget.prototype.on;\n\n/**\n * Removes an `event listener` for a specific event from an instance of `EventTarget`.\n * This makes it so that the `event listener` will no longer get called when the\n * named event happens.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to remove.\n */\nEventTarget.prototype.off = function (type, fn) {\n Events.off(this, type, fn);\n};\n\n/**\n * An alias of {@link EventTarget#off}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#off}\n */\nEventTarget.prototype.removeEventListener = EventTarget.prototype.off;\n\n/**\n * This function will add an `event listener` that gets triggered only once. After the\n * first trigger it will get removed. This is like adding an `event listener`\n * with {@link EventTarget#on} that calls {@link EventTarget#off} on itself.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to be called once for each event name.\n */\nEventTarget.prototype.one = function (type, fn) {\n // Remove the addEventListener alialing Events.on\n // so we don't get into an infinite type loop\n var ael = this.addEventListener;\n\n this.addEventListener = function () {};\n Events.one(this, type, fn);\n this.addEventListener = ael;\n};\n\n/**\n * This function causes an event to happen. This will then cause any `event listeners`\n * that are waiting for that event, to get called. If there are no `event listeners`\n * for an event then nothing will happen.\n *\n * If the name of the `Event` that is being triggered is in `EventTarget.allowedEvents_`.\n * Trigger will also call the `on` + `uppercaseEventName` function.\n *\n * Example:\n * 'click' is in `EventTarget.allowedEvents_`, so, trigger will attempt to call\n * `onClick` if it exists.\n *\n * @param {string|EventTarget~Event|Object} event\n * The name of the event, an `Event`, or an object with a key of type set to\n * an event name.\n */\nEventTarget.prototype.trigger = function (event) {\n var type = event.type || event;\n\n if (typeof event === 'string') {\n event = { type: type };\n }\n event = Events.fixEvent(event);\n\n if (this.allowedEvents_[type] && this['on' + type]) {\n this['on' + type](event);\n }\n\n Events.trigger(this, event);\n};\n\n/**\n * An alias of {@link EventTarget#trigger}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#trigger}\n */\nEventTarget.prototype.dispatchEvent = EventTarget.prototype.trigger;\n\nexports['default'] = EventTarget;\n","'use strict';\n\nexports.__esModule = true;\nexports.createTimeRange = undefined;\nexports.createTimeRanges = createTimeRanges;\n\nvar _log = require('./log.js');\n\nvar _log2 = _interopRequireDefault(_log);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\n/**\n * Returns the time for the specified index at the start or end\n * of a TimeRange object.\n *\n * @function time-ranges:indexFunction\n *\n * @param {number} [index=0]\n * The range number to return the time for.\n *\n * @return {number}\n * The time that offset at the specified index.\n *\n * @depricated index must be set to a value, in the future this will throw an error.\n */\n\n/**\n * An object that contains ranges of time for various reasons.\n *\n * @typedef {Object} TimeRange\n *\n * @property {number} length\n * The number of time ranges represented by this Object\n *\n * @property {time-ranges:indexFunction} start\n * Returns the time offset at which a specified time range begins.\n *\n * @property {time-ranges:indexFunction} end\n * Returns the time offset at which a specified time range begins.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges\n */\n\n/**\n * Check if any of the time ranges are over the maximum index.\n *\n * @param {string} fnName\n * The function name to use for logging\n *\n * @param {number} index\n * The index to check\n *\n * @param {number} maxIndex\n * The maximum possible index\n *\n * @throws {Error} if the timeRanges provided are over the maxIndex\n */\nfunction rangeCheck(fnName, index, maxIndex) {\n if (index < 0 || index > maxIndex) {\n throw new Error('Failed to execute \\'' + fnName + '\\' on \\'TimeRanges\\': The index provided (' + index + ') is greater than or equal to the maximum bound (' + maxIndex + ').');\n }\n}\n\n/**\n * Check if any of the time ranges are over the maximum index.\n *\n * @param {string} fnName\n * The function name to use for logging\n *\n * @param {string} valueIndex\n * The proprety that should be used to get the time. should be 'start' or 'end'\n *\n * @param {Array} ranges\n * An array of time ranges\n *\n * @param {Array} [rangeIndex=0]\n * The index to start the search at\n *\n * @return {number}\n * The time that offset at the specified index.\n *\n *\n * @depricated rangeIndex must be set to a value, in the future this will throw an error.\n * @throws {Error} if rangeIndex is more than the length of ranges\n */\n/**\n * @file time-ranges.js\n * @module time-ranges\n */\nfunction getRange(fnName, valueIndex, ranges, rangeIndex) {\n if (rangeIndex === undefined) {\n _log2['default'].warn('DEPRECATED: Function \\'' + fnName + '\\' on \\'TimeRanges\\' called without an index argument.');\n rangeIndex = 0;\n }\n rangeCheck(fnName, rangeIndex, ranges.length - 1);\n return ranges[rangeIndex][valueIndex];\n}\n\n/**\n * Create a time range object givent ranges of time.\n *\n * @param {Array} [ranges]\n * An array of time ranges.\n */\nfunction createTimeRangesObj(ranges) {\n if (ranges === undefined || ranges.length === 0) {\n return {\n length: 0,\n start: function start() {\n throw new Error('This TimeRanges object is empty');\n },\n end: function end() {\n throw new Error('This TimeRanges object is empty');\n }\n };\n }\n return {\n length: ranges.length,\n start: getRange.bind(null, 'start', 0, ranges),\n end: getRange.bind(null, 'end', 1, ranges)\n };\n}\n\n/**\n * Should create a fake `TimeRange` object which mimics an HTML5 time range instance.\n *\n * @param {number|Array} start\n * The start of a single range or an array of ranges\n *\n * @param {number} end\n * The end of a single range.\n *\n * @private\n */\nfunction createTimeRanges(start, end) {\n if (Array.isArray(start)) {\n return createTimeRangesObj(start);\n } else if (start === undefined || end === undefined) {\n return createTimeRangesObj();\n }\n return createTimeRangesObj([[start, end]]);\n}\n\nexports.createTimeRange = createTimeRanges;\n","'use strict';\n\nexports.__esModule = true;\nexports.bufferedPercent = bufferedPercent;\n\nvar _timeRanges = require('./time-ranges.js');\n\n/**\n * Compute the percentage of the media that has been buffered.\n *\n * @param {TimeRange} buffered\n * The current `TimeRange` object representing buffered time ranges\n *\n * @param {number} duration\n * Total duration of the media\n *\n * @return {number}\n * Percent buffered of the total duration in decimal form.\n */\nfunction bufferedPercent(buffered, duration) {\n var bufferedDuration = 0;\n var start = void 0;\n var end = void 0;\n\n if (!duration) {\n return 0;\n }\n\n if (!buffered || !buffered.length) {\n buffered = (0, _timeRanges.createTimeRange)(0, 0);\n }\n\n for (var i = 0; i < buffered.length; i++) {\n start = buffered.start(i);\n end = buffered.end(i);\n\n // buffered end can be bigger than duration by a very small fraction\n if (end > duration) {\n end = duration;\n }\n\n bufferedDuration += end - start;\n }\n\n return bufferedDuration / duration;\n} /**\n * @file buffer.js\n * @module buffer\n */\n","'use strict';\n\nexports.__esModule = true;\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\n/**\n * Store the browser-specific methods for the fullscreen API.\n *\n * @type {Object}\n * @see [Specification]{@link https://fullscreen.spec.whatwg.org}\n * @see [Map Approach From Screenfull.js]{@link https://github.com/sindresorhus/screenfull.js}\n */\nvar FullscreenApi = {};\n\n// browser API methods\n/**\n * @file fullscreen-api.js\n * @module fullscreen-api\n * @private\n */\nvar apiMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],\n// WebKit\n['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],\n// Old WebKit (Safari 5.1)\n['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'],\n// Mozilla\n['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'],\n// Microsoft\n['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];\n\nvar specApi = apiMap[0];\nvar browserApi = void 0;\n\n// determine the supported set of functions\nfor (var i = 0; i < apiMap.length; i++) {\n // check for exitFullscreen function\n if (apiMap[i][1] in _document2['default']) {\n browserApi = apiMap[i];\n break;\n }\n}\n\n// map the browser API names to the spec API names\nif (browserApi) {\n for (var _i = 0; _i < browserApi.length; _i++) {\n FullscreenApi[specApi[_i]] = browserApi[_i];\n }\n}\n\nexports['default'] = FullscreenApi;\n","'use strict';\n\nexports.__esModule = true;\n\nvar _obj = require('./utils/obj');\n\n/**\n * A Custom `MediaError` class which mimics the standard HTML5 `MediaError` class.\n *\n * @param {number|string|Object|MediaError} value\n * This can be of multiple types:\n * - number: should be a standard error code\n * - string: an error message (the code will be 0)\n * - Object: arbitrary properties\n * - `MediaError` (native): used to populate a video.js `MediaError` object\n * - `MediaError` (video.js): will return itself if it's already a\n * video.js `MediaError` object.\n *\n * @see [MediaError Spec]{@link https://dev.w3.org/html5/spec-author-view/video.html#mediaerror}\n * @see [Encrypted MediaError Spec]{@link https://www.w3.org/TR/2013/WD-encrypted-media-20130510/#error-codes}\n *\n * @class MediaError\n */\nfunction MediaError(value) {\n\n // Allow redundant calls to this constructor to avoid having `instanceof`\n // checks peppered around the code.\n if (value instanceof MediaError) {\n return value;\n }\n\n if (typeof value === 'number') {\n this.code = value;\n } else if (typeof value === 'string') {\n // default code is zero, so this is a custom error\n this.message = value;\n } else if ((0, _obj.isObject)(value)) {\n\n // We assign the `code` property manually because native `MediaError` objects\n // do not expose it as an own/enumerable property of the object.\n if (typeof value.code === 'number') {\n this.code = value.code;\n }\n\n (0, _obj.assign)(this, value);\n }\n\n if (!this.message) {\n this.message = MediaError.defaultMessages[this.code] || '';\n }\n}\n\n/**\n * The error code that refers two one of the defined `MediaError` types\n *\n * @type {Number}\n */\n/**\n * @file media-error.js\n */\nMediaError.prototype.code = 0;\n\n/**\n * An optional message that to show with the error. Message is not part of the HTML5\n * video spec but allows for more informative custom errors.\n *\n * @type {String}\n */\nMediaError.prototype.message = '';\n\n/**\n * An optional status code that can be set by plugins to allow even more detail about\n * the error. For example a plugin might provide a specific HTTP status code and an\n * error message for that code. Then when the plugin gets that error this class will\n * know how to display an error message for it. This allows a custom message to show\n * up on the `Player` error overlay.\n *\n * @type {Array}\n */\nMediaError.prototype.status = null;\n\n/**\n * Errors indexed by the W3C standard. The order **CANNOT CHANGE**! See the\n * specification listed under {@link MediaError} for more information.\n *\n * @enum {array}\n * @readonly\n * @property {string} 0 - MEDIA_ERR_CUSTOM\n * @property {string} 1 - MEDIA_ERR_CUSTOM\n * @property {string} 2 - MEDIA_ERR_ABORTED\n * @property {string} 3 - MEDIA_ERR_NETWORK\n * @property {string} 4 - MEDIA_ERR_SRC_NOT_SUPPORTED\n * @property {string} 5 - MEDIA_ERR_ENCRYPTED\n */\nMediaError.errorTypes = ['MEDIA_ERR_CUSTOM', 'MEDIA_ERR_ABORTED', 'MEDIA_ERR_NETWORK', 'MEDIA_ERR_DECODE', 'MEDIA_ERR_SRC_NOT_SUPPORTED', 'MEDIA_ERR_ENCRYPTED'];\n\n/**\n * The default `MediaError` messages based on the {@link MediaError.errorTypes}.\n *\n * @type {Array}\n * @constant\n */\nMediaError.defaultMessages = {\n 1: 'You aborted the media playback',\n 2: 'A network error caused the media download to fail part-way.',\n 3: 'The media playback was aborted due to a corruption problem or because the media used features your browser did not support.',\n 4: 'The media could not be loaded, either because the server or network failed or because the format is not supported.',\n 5: 'The media is encrypted and we do not have the keys to decrypt it.'\n};\n\n// Add types as properties on MediaError\n// e.g. MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = 4;\nfor (var errNum = 0; errNum < MediaError.errorTypes.length; errNum++) {\n MediaError[MediaError.errorTypes[errNum]] = errNum;\n // values should be accessible on both the class and instance\n MediaError.prototype[MediaError.errorTypes[errNum]] = errNum;\n}\n\n// jsdocs for instance/static members added above\n// instance methods use `#` and static methods use `.`\n/**\n * W3C error code for any custom error.\n *\n * @member MediaError#MEDIA_ERR_CUSTOM\n * @constant {number}\n * @default 0\n */\n/**\n * W3C error code for any custom error.\n *\n * @member MediaError.MEDIA_ERR_CUSTOM\n * @constant {number}\n * @default 0\n */\n\n/**\n * W3C error code for media error aborted.\n *\n * @member MediaError#MEDIA_ERR_ABORTED\n * @constant {number}\n * @default 1\n */\n/**\n * W3C error code for media error aborted.\n *\n * @member MediaError.MEDIA_ERR_ABORTED\n * @constant {number}\n * @default 1\n */\n\n/**\n * W3C error code for any network error.\n *\n * @member MediaError#MEDIA_ERR_NETWORK\n * @constant {number}\n * @default 2\n */\n/**\n * W3C error code for any network error.\n *\n * @member MediaError.MEDIA_ERR_NETWORK\n * @constant {number}\n * @default 2\n */\n\n/**\n * W3C error code for any decoding error.\n *\n * @member MediaError#MEDIA_ERR_DECODE\n * @constant {number}\n * @default 3\n */\n/**\n * W3C error code for any decoding error.\n *\n * @member MediaError.MEDIA_ERR_DECODE\n * @constant {number}\n * @default 3\n */\n\n/**\n * W3C error code for any time that a source is not supported.\n *\n * @member MediaError#MEDIA_ERR_SRC_NOT_SUPPORTED\n * @constant {number}\n * @default 4\n */\n/**\n * W3C error code for any time that a source is not supported.\n *\n * @member MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED\n * @constant {number}\n * @default 4\n */\n\n/**\n * W3C error code for any time that a source is encrypted.\n *\n * @member MediaError#MEDIA_ERR_ENCRYPTED\n * @constant {number}\n * @default 5\n */\n/**\n * W3C error code for any time that a source is encrypted.\n *\n * @member MediaError.MEDIA_ERR_ENCRYPTED\n * @constant {number}\n * @default 5\n */\n\nexports['default'] = MediaError;\n","module.exports = SafeParseTuple\n\nfunction SafeParseTuple(obj, reviver) {\n var json\n var error = null\n\n try {\n json = JSON.parse(obj, reviver)\n } catch (err) {\n error = err\n }\n\n return [error, json]\n}\n","'use strict';\n\nexports.__esModule = true;\n/**\n * @file text-track-list-converter.js Utilities for capturing text track state and\n * re-creating tracks based on a capture.\n *\n * @module text-track-list-converter\n */\n\n/**\n * Examine a single {@link TextTrack} and return a JSON-compatible javascript object that\n * represents the {@link TextTrack}'s state.\n *\n * @param {TextTrack} track\n * The text track to query.\n *\n * @return {Object}\n * A serializable javascript representation of the TextTrack.\n * @private\n */\nvar trackToJson_ = function trackToJson_(track) {\n var ret = ['kind', 'label', 'language', 'id', 'inBandMetadataTrackDispatchType', 'mode', 'src'].reduce(function (acc, prop, i) {\n\n if (track[prop]) {\n acc[prop] = track[prop];\n }\n\n return acc;\n }, {\n cues: track.cues && Array.prototype.map.call(track.cues, function (cue) {\n return {\n startTime: cue.startTime,\n endTime: cue.endTime,\n text: cue.text,\n id: cue.id\n };\n })\n });\n\n return ret;\n};\n\n/**\n * Examine a {@link Tech} and return a JSON-compatible javascript array that represents the\n * state of all {@link TextTrack}s currently configured. The return array is compatible with\n * {@link text-track-list-converter:jsonToTextTracks}.\n *\n * @param {Tech} tech\n * The tech object to query\n *\n * @return {Array}\n * A serializable javascript representation of the {@link Tech}s\n * {@link TextTrackList}.\n */\nvar textTracksToJson = function textTracksToJson(tech) {\n\n var trackEls = tech.$$('track');\n\n var trackObjs = Array.prototype.map.call(trackEls, function (t) {\n return t.track;\n });\n var tracks = Array.prototype.map.call(trackEls, function (trackEl) {\n var json = trackToJson_(trackEl.track);\n\n if (trackEl.src) {\n json.src = trackEl.src;\n }\n return json;\n });\n\n return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function (track) {\n return trackObjs.indexOf(track) === -1;\n }).map(trackToJson_));\n};\n\n/**\n * Create a set of remote {@link TextTrack}s on a {@link Tech} based on an array of javascript\n * object {@link TextTrack} representations.\n *\n * @param {Array} json\n * An array of `TextTrack` representation objects, like those that would be\n * produced by `textTracksToJson`.\n *\n * @param {Tech} tech\n * The `Tech` to create the `TextTrack`s on.\n */\nvar jsonToTextTracks = function jsonToTextTracks(json, tech) {\n json.forEach(function (track) {\n var addedTrack = tech.addRemoteTextTrack(track).track;\n\n if (!track.src && track.cues) {\n track.cues.forEach(function (cue) {\n return addedTrack.addCue(cue);\n });\n }\n });\n\n return tech.textTracks();\n};\n\nexports['default'] = { textTracksToJson: textTracksToJson, jsonToTextTracks: jsonToTextTracks, trackToJson_: trackToJson_ };\n","'use strict';\n\nexports.__esModule = true;\n\nvar _dom = require('./utils/dom');\n\nvar Dom = _interopRequireWildcard(_dom);\n\nvar _fn = require('./utils/fn');\n\nvar Fn = _interopRequireWildcard(_fn);\n\nvar _component = require('./component');\n\nvar _component2 = _interopRequireDefault(_component);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file modal-dialog.js\n */\n\n\nvar MODAL_CLASS_NAME = 'vjs-modal-dialog';\nvar ESC = 27;\n\n/**\n * The `ModalDialog` displays over the video and its controls, which blocks\n * interaction with the player until it is closed.\n *\n * Modal dialogs include a \"Close\" button and will close when that button\n * is activated - or when ESC is pressed anywhere.\n *\n * @extends Component\n */\n\nvar ModalDialog = function (_Component) {\n _inherits(ModalDialog, _Component);\n\n /**\n * Create an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Mixed} [options.content=undefined]\n * Provide customized content for this modal.\n *\n * @param {string} [options.description]\n * A text description for the modal, primarily for accessibility.\n *\n * @param {boolean} [options.fillAlways=false]\n * Normally, modals are automatically filled only the first time\n * they open. This tells the modal to refresh its content\n * every time it opens.\n *\n * @param {string} [options.label]\n * A text label for the modal, primarily for accessibility.\n *\n * @param {boolean} [options.temporary=true]\n * If `true`, the modal can only be opened once; it will be\n * disposed as soon as it's closed.\n *\n * @param {boolean} [options.uncloseable=false]\n * If `true`, the user will not be able to close the modal\n * through the UI in the normal ways. Programmatic closing is\n * still possible.\n */\n function ModalDialog(player, options) {\n _classCallCheck(this, ModalDialog);\n\n var _this = _possibleConstructorReturn(this, _Component.call(this, player, options));\n\n _this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = false;\n\n _this.closeable(!_this.options_.uncloseable);\n _this.content(_this.options_.content);\n\n // Make sure the contentEl is defined AFTER any children are initialized\n // because we only want the contents of the modal in the contentEl\n // (not the UI elements like the close button).\n _this.contentEl_ = Dom.createEl('div', {\n className: MODAL_CLASS_NAME + '-content'\n }, {\n role: 'document'\n });\n\n _this.descEl_ = Dom.createEl('p', {\n className: MODAL_CLASS_NAME + '-description vjs-offscreen',\n id: _this.el().getAttribute('aria-describedby')\n });\n\n Dom.textContent(_this.descEl_, _this.description());\n _this.el_.appendChild(_this.descEl_);\n _this.el_.appendChild(_this.contentEl_);\n return _this;\n }\n\n /**\n * Create the `ModalDialog`'s DOM element\n *\n * @return {Element}\n * The DOM element that gets created.\n */\n\n\n ModalDialog.prototype.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: this.buildCSSClass(),\n tabIndex: -1\n }, {\n 'aria-describedby': this.id() + '_description',\n 'aria-hidden': 'true',\n 'aria-label': this.label(),\n 'role': 'dialog'\n });\n };\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n ModalDialog.prototype.buildCSSClass = function buildCSSClass() {\n return MODAL_CLASS_NAME + ' vjs-hidden ' + _Component.prototype.buildCSSClass.call(this);\n };\n\n /**\n * Handles `keydown` events on the document, looking for ESC, which closes\n * the modal.\n *\n * @param {EventTarget~Event} e\n * The keypress that triggered this event.\n *\n * @listens keydown\n */\n\n\n ModalDialog.prototype.handleKeyPress = function handleKeyPress(e) {\n if (e.which === ESC && this.closeable()) {\n this.close();\n }\n };\n\n /**\n * Returns the label string for this modal. Primarily used for accessibility.\n *\n * @return {string}\n * the localized or raw label of this modal.\n */\n\n\n ModalDialog.prototype.label = function label() {\n return this.options_.label || this.localize('Modal Window');\n };\n\n /**\n * Returns the description string for this modal. Primarily used for\n * accessibility.\n *\n * @return {string}\n * The localized or raw description of this modal.\n */\n\n\n ModalDialog.prototype.description = function description() {\n var desc = this.options_.description || this.localize('This is a modal window.');\n\n // Append a universal closeability message if the modal is closeable.\n if (this.closeable()) {\n desc += ' ' + this.localize('This modal can be closed by pressing the Escape key or activating the close button.');\n }\n\n return desc;\n };\n\n /**\n * Opens the modal.\n *\n * @fires ModalDialog#beforemodalopen\n * @fires ModalDialog#modalopen\n *\n * @return {ModalDialog}\n * Returns itself; method can be chained.\n */\n\n\n ModalDialog.prototype.open = function open() {\n if (!this.opened_) {\n var player = this.player();\n\n /**\n * Fired just before a `ModalDialog` is opened.\n *\n * @event ModalDialog#beforemodalopen\n * @type {EventTarget~Event}\n */\n this.trigger('beforemodalopen');\n this.opened_ = true;\n\n // Fill content if the modal has never opened before and\n // never been filled.\n if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {\n this.fill();\n }\n\n // If the player was playing, pause it and take note of its previously\n // playing state.\n this.wasPlaying_ = !player.paused();\n\n if (this.options_.pauseOnOpen && this.wasPlaying_) {\n player.pause();\n }\n\n if (this.closeable()) {\n this.on(this.el_.ownerDocument, 'keydown', Fn.bind(this, this.handleKeyPress));\n }\n\n player.controls(false);\n this.show();\n this.el().setAttribute('aria-hidden', 'false');\n\n /**\n * Fired just after a `ModalDialog` is opened.\n *\n * @event ModalDialog#modalopen\n * @type {EventTarget~Event}\n */\n this.trigger('modalopen');\n this.hasBeenOpened_ = true;\n }\n return this;\n };\n\n /**\n * If the `ModalDialog` is currently open or closed.\n *\n * @param {boolean} [value]\n * If given, it will open (`true`) or close (`false`) the modal.\n *\n * @return {boolean}\n * the current open state of the modaldialog\n */\n\n\n ModalDialog.prototype.opened = function opened(value) {\n if (typeof value === 'boolean') {\n this[value ? 'open' : 'close']();\n }\n return this.opened_;\n };\n\n /**\n * Closes the modal, does nothing if the `ModalDialog` is\n * not open.\n *\n * @fires ModalDialog#beforemodalclose\n * @fires ModalDialog#modalclose\n *\n * @return {ModalDialog}\n * Returns itself; method can be chained.\n */\n\n\n ModalDialog.prototype.close = function close() {\n if (this.opened_) {\n var player = this.player();\n\n /**\n * Fired just before a `ModalDialog` is closed.\n *\n * @event ModalDialog#beforemodalclose\n * @type {EventTarget~Event}\n */\n this.trigger('beforemodalclose');\n this.opened_ = false;\n\n if (this.wasPlaying_ && this.options_.pauseOnOpen) {\n player.play();\n }\n\n if (this.closeable()) {\n this.off(this.el_.ownerDocument, 'keydown', Fn.bind(this, this.handleKeyPress));\n }\n\n player.controls(true);\n this.hide();\n this.el().setAttribute('aria-hidden', 'true');\n\n /**\n * Fired just after a `ModalDialog` is closed.\n *\n * @event ModalDialog#modalclose\n * @type {EventTarget~Event}\n */\n this.trigger('modalclose');\n\n if (this.options_.temporary) {\n this.dispose();\n }\n }\n return this;\n };\n\n /**\n * Check to see if the `ModalDialog` is closeable via the UI.\n *\n * @param {boolean} [value]\n * If given as a boolean, it will set the `closeable` option.\n *\n * @return {boolean}\n * Returns the final value of the closable option.\n */\n\n\n ModalDialog.prototype.closeable = function closeable(value) {\n if (typeof value === 'boolean') {\n var closeable = this.closeable_ = !!value;\n var close = this.getChild('closeButton');\n\n // If this is being made closeable and has no close button, add one.\n if (closeable && !close) {\n\n // The close button should be a child of the modal - not its\n // content element, so temporarily change the content element.\n var temp = this.contentEl_;\n\n this.contentEl_ = this.el_;\n close = this.addChild('closeButton', { controlText: 'Close Modal Dialog' });\n this.contentEl_ = temp;\n this.on(close, 'close', this.close);\n }\n\n // If this is being made uncloseable and has a close button, remove it.\n if (!closeable && close) {\n this.off(close, 'close', this.close);\n this.removeChild(close);\n close.dispose();\n }\n }\n return this.closeable_;\n };\n\n /**\n * Fill the modal's content element with the modal's \"content\" option.\n * The content element will be emptied before this change takes place.\n *\n * @return {ModalDialog}\n * Returns itself; method can be chained.\n */\n\n\n ModalDialog.prototype.fill = function fill() {\n return this.fillWith(this.content());\n };\n\n /**\n * Fill the modal's content element with arbitrary content.\n * The content element will be emptied before this change takes place.\n *\n * @fires ModalDialog#beforemodalfill\n * @fires ModalDialog#modalfill\n *\n * @param {Mixed} [content]\n * The same rules apply to this as apply to the `content` option.\n *\n * @return {ModalDialog}\n * Returns itself; method can be chained.\n */\n\n\n ModalDialog.prototype.fillWith = function fillWith(content) {\n var contentEl = this.contentEl();\n var parentEl = contentEl.parentNode;\n var nextSiblingEl = contentEl.nextSibling;\n\n /**\n * Fired just before a `ModalDialog` is filled with content.\n *\n * @event ModalDialog#beforemodalfill\n * @type {EventTarget~Event}\n */\n this.trigger('beforemodalfill');\n this.hasBeenFilled_ = true;\n\n // Detach the content element from the DOM before performing\n // manipulation to avoid modifying the live DOM multiple times.\n parentEl.removeChild(contentEl);\n this.empty();\n Dom.insertContent(contentEl, content);\n /**\n * Fired just after a `ModalDialog` is filled with content.\n *\n * @event ModalDialog#modalfill\n * @type {EventTarget~Event}\n */\n this.trigger('modalfill');\n\n // Re-inject the re-filled content element.\n if (nextSiblingEl) {\n parentEl.insertBefore(contentEl, nextSiblingEl);\n } else {\n parentEl.appendChild(contentEl);\n }\n\n return this;\n };\n\n /**\n * Empties the content element. This happens anytime the modal is filled.\n *\n * @fires ModalDialog#beforemodalempty\n * @fires ModalDialog#modalempty\n *\n * @return {ModalDialog}\n * Returns itself; method can be chained.\n */\n\n\n ModalDialog.prototype.empty = function empty() {\n /**\n * Fired just before a `ModalDialog` is emptied.\n *\n * @event ModalDialog#beforemodalempty\n * @type {EventTarget~Event}\n */\n this.trigger('beforemodalempty');\n Dom.emptyEl(this.contentEl());\n\n /**\n * Fired just after a `ModalDialog` is emptied.\n *\n * @event ModalDialog#modalempty\n * @type {EventTarget~Event}\n */\n this.trigger('modalempty');\n return this;\n };\n\n /**\n * Gets or sets the modal content, which gets normalized before being\n * rendered into the DOM.\n *\n * This does not update the DOM or fill the modal, but it is called during\n * that process.\n *\n * @param {Mixed} [value]\n * If defined, sets the internal content value to be used on the\n * next call(s) to `fill`. This value is normalized before being\n * inserted. To \"clear\" the internal content value, pass `null`.\n *\n * @return {Mixed}\n * The current content of the modal dialog\n */\n\n\n ModalDialog.prototype.content = function content(value) {\n if (typeof value !== 'undefined') {\n this.content_ = value;\n }\n return this.content_;\n };\n\n return ModalDialog;\n}(_component2['default']);\n\n/**\n * Default options for `ModalDialog` default options.\n *\n * @type {Object}\n * @private\n */\n\n\nModalDialog.prototype.options_ = {\n pauseOnOpen: true,\n temporary: true\n};\n\n_component2['default'].registerComponent('ModalDialog', ModalDialog);\nexports['default'] = ModalDialog;\n","'use strict';\n\nexports.__esModule = true;\n\nvar _browser = require('../utils/browser.js');\n\nvar browser = _interopRequireWildcard(_browser);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /**\n * @file text-track-cue-list.js\n */\n\n\n/**\n * @typedef {Object} TextTrackCue\n *\n * @property {string} id\n * The unique id for this text track cue\n *\n * @property {number} startTime\n * The start time for this text track cue\n *\n * @property {number} endTime\n * The end time for this text track cue\n *\n * @property {boolean} pauseOnExit\n * Pause when the end time is reached if true.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcue}\n */\n\n/**\n * A List of TextTrackCues.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcuelist}\n */\nvar TextTrackCueList = function () {\n\n /**\n * Create an instance of this class..\n *\n * @param {Array} cues\n * A list of cues to be initialized with\n */\n function TextTrackCueList(cues) {\n _classCallCheck(this, TextTrackCueList);\n\n var list = this; // eslint-disable-line\n\n if (browser.IS_IE8) {\n list = _document2['default'].createElement('custom');\n\n for (var prop in TextTrackCueList.prototype) {\n if (prop !== 'constructor') {\n list[prop] = TextTrackCueList.prototype[prop];\n }\n }\n }\n\n TextTrackCueList.prototype.setCues_.call(list, cues);\n\n /**\n * @member {number} length\n * The current number of `TextTrackCue`s in the TextTrackCueList.\n */\n Object.defineProperty(list, 'length', {\n get: function get() {\n return this.length_;\n }\n });\n\n if (browser.IS_IE8) {\n return list;\n }\n }\n\n /**\n * A setter for cues in this list. Creates getters\n * an an index for the cues.\n *\n * @param {Array} cues\n * An array of cues to set\n *\n * @private\n */\n\n\n TextTrackCueList.prototype.setCues_ = function setCues_(cues) {\n var oldLength = this.length || 0;\n var i = 0;\n var l = cues.length;\n\n this.cues_ = cues;\n this.length_ = cues.length;\n\n var defineProp = function defineProp(index) {\n if (!('' + index in this)) {\n Object.defineProperty(this, '' + index, {\n get: function get() {\n return this.cues_[index];\n }\n });\n }\n };\n\n if (oldLength < l) {\n i = oldLength;\n\n for (; i < l; i++) {\n defineProp.call(this, i);\n }\n }\n };\n\n /**\n * Get a `TextTrackCue` that is currently in the `TextTrackCueList` by id.\n *\n * @param {string} id\n * The id of the cue that should be searched for.\n *\n * @return {TextTrackCue|null}\n * A single cue or null if none was found.\n */\n\n\n TextTrackCueList.prototype.getCueById = function getCueById(id) {\n var result = null;\n\n for (var i = 0, l = this.length; i < l; i++) {\n var cue = this[i];\n\n if (cue.id === id) {\n result = cue;\n break;\n }\n }\n\n return result;\n };\n\n return TextTrackCueList;\n}();\n\nexports['default'] = TextTrackCueList;\n","'use strict';\n\nexports.__esModule = true;\n/**\n * @file track-kinds.js\n */\n\n/**\n * All possible `VideoTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-videotrack-kind\n * @typedef VideoTrack~Kind\n * @enum\n */\nvar VideoTrackKind = exports.VideoTrackKind = {\n alternative: 'alternative',\n captions: 'captions',\n main: 'main',\n sign: 'sign',\n subtitles: 'subtitles',\n commentary: 'commentary'\n};\n\n/**\n * All possible `AudioTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-audiotrack-kind\n * @typedef AudioTrack~Kind\n * @enum\n */\nvar AudioTrackKind = exports.AudioTrackKind = {\n 'alternative': 'alternative',\n 'descriptions': 'descriptions',\n 'main': 'main',\n 'main-desc': 'main-desc',\n 'translation': 'translation',\n 'commentary': 'commentary'\n};\n\n/**\n * All possible `TextTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-kind\n * @typedef TextTrack~Kind\n * @enum\n */\nvar TextTrackKind = exports.TextTrackKind = {\n subtitles: 'subtitles',\n captions: 'captions',\n descriptions: 'descriptions',\n chapters: 'chapters',\n metadata: 'metadata'\n};\n\n/**\n * All possible `TextTrackMode`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackmode\n * @typedef TextTrack~Mode\n * @enum\n */\nvar TextTrackMode = exports.TextTrackMode = {\n disabled: 'disabled',\n hidden: 'hidden',\n showing: 'showing'\n};\n","'use strict';\n\nexports.__esModule = true;\n\nvar _browser = require('../utils/browser.js');\n\nvar browser = _interopRequireWildcard(_browser);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nvar _guid = require('../utils/guid.js');\n\nvar Guid = _interopRequireWildcard(_guid);\n\nvar _eventTarget = require('../event-target');\n\nvar _eventTarget2 = _interopRequireDefault(_eventTarget);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file track.js\n */\n\n\n/**\n * A Track class that contains all of the common functionality for {@link AudioTrack},\n * {@link VideoTrack}, and {@link TextTrack}.\n *\n * > Note: This class should not be used directly\n *\n * @see {@link https://html.spec.whatwg.org/multipage/embedded-content.html}\n * @extends EventTarget\n * @abstract\n */\nvar Track = function (_EventTarget) {\n _inherits(Track, _EventTarget);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {string} [options.kind='']\n * A valid kind for the track type you are creating.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @abstract\n */\n function Track() {\n var _ret;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Track);\n\n var _this = _possibleConstructorReturn(this, _EventTarget.call(this));\n\n var track = _this; // eslint-disable-line\n\n if (browser.IS_IE8) {\n track = _document2['default'].createElement('custom');\n for (var prop in Track.prototype) {\n if (prop !== 'constructor') {\n track[prop] = Track.prototype[prop];\n }\n }\n }\n\n var trackProps = {\n id: options.id || 'vjs_track_' + Guid.newGUID(),\n kind: options.kind || '',\n label: options.label || '',\n language: options.language || ''\n };\n\n /**\n * @member {string} id\n * The id of this track. Cannot be changed after creation.\n *\n * @readonly\n */\n\n /**\n * @member {string} kind\n * The kind of track that this is. Cannot be changed after creation.\n *\n * @readonly\n */\n\n /**\n * @member {string} label\n * The label of this track. Cannot be changed after creation.\n *\n * @readonly\n */\n\n /**\n * @member {string} language\n * The two letter language code for this track. Cannot be changed after\n * creation.\n *\n * @readonly\n */\n\n var _loop = function _loop(key) {\n Object.defineProperty(track, key, {\n get: function get() {\n return trackProps[key];\n },\n set: function set() {}\n });\n };\n\n for (var key in trackProps) {\n _loop(key);\n }\n\n return _ret = track, _possibleConstructorReturn(_this, _ret);\n }\n\n return Track;\n}(_eventTarget2['default']);\n\nexports['default'] = Track;\n","'use strict';\n\nexports.__esModule = true;\nexports.isCrossOrigin = exports.getFileExtension = exports.getAbsoluteURL = exports.parseUrl = undefined;\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nvar _window = require('global/window');\n\nvar _window2 = _interopRequireDefault(_window);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\n/**\n * @typedef {Object} url:URLObject\n *\n * @property {string} protocol\n * The protocol of the url that was parsed.\n *\n * @property {string} hostname\n * The hostname of the url that was parsed.\n *\n * @property {string} port\n * The port of the url that was parsed.\n *\n * @property {string} pathname\n * The pathname of the url that was parsed.\n *\n * @property {string} search\n * The search query of the url that was parsed.\n *\n * @property {string} hash\n * The hash of the url that was parsed.\n *\n * @property {string} host\n * The host of the url that was parsed.\n */\n\n/**\n * Resolve and parse the elements of a URL.\n *\n * @param {String} url\n * The url to parse\n *\n * @return {url:URLObject}\n * An object of url details\n */\n/**\n * @file url.js\n * @module url\n */\nvar parseUrl = exports.parseUrl = function parseUrl(url) {\n var props = ['protocol', 'hostname', 'port', 'pathname', 'search', 'hash', 'host'];\n\n // add the url to an anchor and let the browser parse the URL\n var a = _document2['default'].createElement('a');\n\n a.href = url;\n\n // IE8 (and 9?) Fix\n // ie8 doesn't parse the URL correctly until the anchor is actually\n // added to the body, and an innerHTML is needed to trigger the parsing\n var addToBody = a.host === '' && a.protocol !== 'file:';\n var div = void 0;\n\n if (addToBody) {\n div = _document2['default'].createElement('div');\n div.innerHTML = '';\n a = div.firstChild;\n // prevent the div from affecting layout\n div.setAttribute('style', 'display:none; position:absolute;');\n _document2['default'].body.appendChild(div);\n }\n\n // Copy the specific URL properties to a new object\n // This is also needed for IE8 because the anchor loses its\n // properties when it's removed from the dom\n var details = {};\n\n for (var i = 0; i < props.length; i++) {\n details[props[i]] = a[props[i]];\n }\n\n // IE9 adds the port to the host property unlike everyone else. If\n // a port identifier is added for standard ports, strip it.\n if (details.protocol === 'http:') {\n details.host = details.host.replace(/:80$/, '');\n }\n\n if (details.protocol === 'https:') {\n details.host = details.host.replace(/:443$/, '');\n }\n\n if (addToBody) {\n _document2['default'].body.removeChild(div);\n }\n\n return details;\n};\n\n/**\n * Get absolute version of relative URL. Used to tell flash correct URL.\n *\n *\n * @param {string} url\n * URL to make absolute\n *\n * @return {string}\n * Absolute URL\n *\n * @see http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue\n */\nvar getAbsoluteURL = exports.getAbsoluteURL = function getAbsoluteURL(url) {\n // Check if absolute URL\n if (!url.match(/^https?:\\/\\//)) {\n // Convert to absolute URL. Flash hosted off-site needs an absolute URL.\n var div = _document2['default'].createElement('div');\n\n div.innerHTML = 'x';\n url = div.firstChild.href;\n }\n\n return url;\n};\n\n/**\n * Returns the extension of the passed file name. It will return an empty string\n * if passed an invalid path.\n *\n * @param {string} path\n * The fileName path like '/path/to/file.mp4'\n *\n * @returns {string}\n * The extension in lower case or an empty string if no\n * extension could be found.\n */\nvar getFileExtension = exports.getFileExtension = function getFileExtension(path) {\n if (typeof path === 'string') {\n var splitPathRe = /^(\\/?)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?)(\\.([^\\.\\/\\?]+)))(?:[\\/]*|[\\?].*)$/i;\n var pathParts = splitPathRe.exec(path);\n\n if (pathParts) {\n return pathParts.pop().toLowerCase();\n }\n }\n\n return '';\n};\n\n/**\n * Returns whether the url passed is a cross domain request or not.\n *\n * @param {string} url\n * The url to check.\n *\n * @return {boolean}\n * Whether it is a cross domain request or not.\n */\nvar isCrossOrigin = exports.isCrossOrigin = function isCrossOrigin(url) {\n var winLoc = _window2['default'].location;\n var urlInfo = parseUrl(url);\n\n // IE8 protocol relative urls will return ':' for protocol\n var srcProtocol = urlInfo.protocol === ':' ? winLoc.protocol : urlInfo.protocol;\n\n // Check if url is for another domain/origin\n // IE8 doesn't know location.origin, so we won't rely on it here\n var crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;\n\n return crossOrigin;\n};\n","module.exports = isFunction\n\nvar toString = Object.prototype.toString\n\nfunction isFunction (fn) {\n if (!fn) {\n return false\n }\n var string = toString.call(fn)\n return string === '[object Function]' ||\n (typeof fn === 'function' && string !== '[object RegExp]') ||\n (typeof window !== 'undefined' &&\n // IE8 and below\n (fn === window.setTimeout ||\n fn === window.alert ||\n fn === window.confirm ||\n fn === window.prompt))\n};\n","var trim = function(string) {\n return string.replace(/^\\s+|\\s+$/g, '');\n}\n , isArray = function(arg) {\n return Object.prototype.toString.call(arg) === '[object Array]';\n }\n\nmodule.exports = function (headers) {\n if (!headers)\n return {}\n\n var result = {}\n\n var headersArr = trim(headers).split('\\n')\n\n for (var i = 0; i < headersArr.length; i++) {\n var row = headersArr[i]\n var index = row.indexOf(':')\n , key = trim(row.slice(0, index)).toLowerCase()\n , value = trim(row.slice(index + 1))\n\n if (typeof(result[key]) === 'undefined') {\n result[key] = value\n } else if (isArray(result[key])) {\n result[key].push(value)\n } else {\n result[key] = [ result[key], value ]\n }\n }\n\n return result\n}\n","module.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n","\"use strict\";\nvar window = require(\"global/window\")\nvar isFunction = require(\"is-function\")\nvar parseHeaders = require(\"parse-headers\")\nvar xtend = require(\"xtend\")\n\nmodule.exports = createXHR\ncreateXHR.XMLHttpRequest = window.XMLHttpRequest || noop\ncreateXHR.XDomainRequest = \"withCredentials\" in (new createXHR.XMLHttpRequest()) ? createXHR.XMLHttpRequest : window.XDomainRequest\n\nforEachArray([\"get\", \"put\", \"post\", \"patch\", \"head\", \"delete\"], function(method) {\n createXHR[method === \"delete\" ? \"del\" : method] = function(uri, options, callback) {\n options = initParams(uri, options, callback)\n options.method = method.toUpperCase()\n return _createXHR(options)\n }\n})\n\nfunction forEachArray(array, iterator) {\n for (var i = 0; i < array.length; i++) {\n iterator(array[i])\n }\n}\n\nfunction isEmpty(obj){\n for(var i in obj){\n if(obj.hasOwnProperty(i)) return false\n }\n return true\n}\n\nfunction initParams(uri, options, callback) {\n var params = uri\n\n if (isFunction(options)) {\n callback = options\n if (typeof uri === \"string\") {\n params = {uri:uri}\n }\n } else {\n params = xtend(options, {uri: uri})\n }\n\n params.callback = callback\n return params\n}\n\nfunction createXHR(uri, options, callback) {\n options = initParams(uri, options, callback)\n return _createXHR(options)\n}\n\nfunction _createXHR(options) {\n if(typeof options.callback === \"undefined\"){\n throw new Error(\"callback argument missing\")\n }\n\n var called = false\n var callback = function cbOnce(err, response, body){\n if(!called){\n called = true\n options.callback(err, response, body)\n }\n }\n\n function readystatechange() {\n if (xhr.readyState === 4) {\n loadFunc()\n }\n }\n\n function getBody() {\n // Chrome with requestType=blob throws errors arround when even testing access to responseText\n var body = undefined\n\n if (xhr.response) {\n body = xhr.response\n } else {\n body = xhr.responseText || getXml(xhr)\n }\n\n if (isJson) {\n try {\n body = JSON.parse(body)\n } catch (e) {}\n }\n\n return body\n }\n\n var failureResponse = {\n body: undefined,\n headers: {},\n statusCode: 0,\n method: method,\n url: uri,\n rawRequest: xhr\n }\n\n function errorFunc(evt) {\n clearTimeout(timeoutTimer)\n if(!(evt instanceof Error)){\n evt = new Error(\"\" + (evt || \"Unknown XMLHttpRequest Error\") )\n }\n evt.statusCode = 0\n return callback(evt, failureResponse)\n }\n\n // will load the data & process the response in a special response object\n function loadFunc() {\n if (aborted) return\n var status\n clearTimeout(timeoutTimer)\n if(options.useXDR && xhr.status===undefined) {\n //IE8 CORS GET successful response doesn't have a status field, but body is fine\n status = 200\n } else {\n status = (xhr.status === 1223 ? 204 : xhr.status)\n }\n var response = failureResponse\n var err = null\n\n if (status !== 0){\n response = {\n body: getBody(),\n statusCode: status,\n method: method,\n headers: {},\n url: uri,\n rawRequest: xhr\n }\n if(xhr.getAllResponseHeaders){ //remember xhr can in fact be XDR for CORS in IE\n response.headers = parseHeaders(xhr.getAllResponseHeaders())\n }\n } else {\n err = new Error(\"Internal XMLHttpRequest Error\")\n }\n return callback(err, response, response.body)\n }\n\n var xhr = options.xhr || null\n\n if (!xhr) {\n if (options.cors || options.useXDR) {\n xhr = new createXHR.XDomainRequest()\n }else{\n xhr = new createXHR.XMLHttpRequest()\n }\n }\n\n var key\n var aborted\n var uri = xhr.url = options.uri || options.url\n var method = xhr.method = options.method || \"GET\"\n var body = options.body || options.data || null\n var headers = xhr.headers = options.headers || {}\n var sync = !!options.sync\n var isJson = false\n var timeoutTimer\n\n if (\"json\" in options) {\n isJson = true\n headers[\"accept\"] || headers[\"Accept\"] || (headers[\"Accept\"] = \"application/json\") //Don't override existing accept header declared by user\n if (method !== \"GET\" && method !== \"HEAD\") {\n headers[\"content-type\"] || headers[\"Content-Type\"] || (headers[\"Content-Type\"] = \"application/json\") //Don't override existing accept header declared by user\n body = JSON.stringify(options.json)\n }\n }\n\n xhr.onreadystatechange = readystatechange\n xhr.onload = loadFunc\n xhr.onerror = errorFunc\n // IE9 must have onprogress be set to a unique function.\n xhr.onprogress = function () {\n // IE must die\n }\n xhr.ontimeout = errorFunc\n xhr.open(method, uri, !sync, options.username, options.password)\n //has to be after open\n if(!sync) {\n xhr.withCredentials = !!options.withCredentials\n }\n // Cannot set timeout with sync request\n // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly\n // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent\n if (!sync && options.timeout > 0 ) {\n timeoutTimer = setTimeout(function(){\n aborted=true//IE9 may still call readystatechange\n xhr.abort(\"timeout\")\n var e = new Error(\"XMLHttpRequest timeout\")\n e.code = \"ETIMEDOUT\"\n errorFunc(e)\n }, options.timeout )\n }\n\n if (xhr.setRequestHeader) {\n for(key in headers){\n if(headers.hasOwnProperty(key)){\n xhr.setRequestHeader(key, headers[key])\n }\n }\n } else if (options.headers && !isEmpty(options.headers)) {\n throw new Error(\"Headers cannot be set on an XDomainRequest object\")\n }\n\n if (\"responseType\" in options) {\n xhr.responseType = options.responseType\n }\n\n if (\"beforeSend\" in options &&\n typeof options.beforeSend === \"function\"\n ) {\n options.beforeSend(xhr)\n }\n\n xhr.send(body)\n\n return xhr\n\n\n}\n\nfunction getXml(xhr) {\n if (xhr.responseType === \"document\") {\n return xhr.responseXML\n }\n var firefoxBugTakenEffect = xhr.status === 204 && xhr.responseXML && xhr.responseXML.documentElement.nodeName === \"parsererror\"\n if (xhr.responseType === \"\" && !firefoxBugTakenEffect) {\n return xhr.responseXML\n }\n\n return null\n}\n\nfunction noop() {}\n","'use strict';\n\nexports.__esModule = true;\n\nvar _textTrackCueList = require('./text-track-cue-list');\n\nvar _textTrackCueList2 = _interopRequireDefault(_textTrackCueList);\n\nvar _fn = require('../utils/fn.js');\n\nvar Fn = _interopRequireWildcard(_fn);\n\nvar _trackEnums = require('./track-enums');\n\nvar _log = require('../utils/log.js');\n\nvar _log2 = _interopRequireDefault(_log);\n\nvar _window = require('global/window');\n\nvar _window2 = _interopRequireDefault(_window);\n\nvar _track = require('./track.js');\n\nvar _track2 = _interopRequireDefault(_track);\n\nvar _url = require('../utils/url.js');\n\nvar _xhr = require('xhr');\n\nvar _xhr2 = _interopRequireDefault(_xhr);\n\nvar _mergeOptions = require('../utils/merge-options');\n\nvar _mergeOptions2 = _interopRequireDefault(_mergeOptions);\n\nvar _browser = require('../utils/browser.js');\n\nvar browser = _interopRequireWildcard(_browser);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file text-track.js\n */\n\n\n/**\n * Takes a webvtt file contents and parses it into cues\n *\n * @param {string} srcContent\n * webVTT file contents\n *\n * @param {TextTrack} track\n * TextTrack to add cues to. Cues come from the srcContent.\n *\n * @private\n */\nvar parseCues = function parseCues(srcContent, track) {\n var parser = new _window2['default'].WebVTT.Parser(_window2['default'], _window2['default'].vttjs, _window2['default'].WebVTT.StringDecoder());\n var errors = [];\n\n parser.oncue = function (cue) {\n track.addCue(cue);\n };\n\n parser.onparsingerror = function (error) {\n errors.push(error);\n };\n\n parser.onflush = function () {\n track.trigger({\n type: 'loadeddata',\n target: track\n });\n };\n\n parser.parse(srcContent);\n if (errors.length > 0) {\n if (_window2['default'].console && _window2['default'].console.groupCollapsed) {\n _window2['default'].console.groupCollapsed('Text Track parsing errors for ' + track.src);\n }\n errors.forEach(function (error) {\n return _log2['default'].error(error);\n });\n if (_window2['default'].console && _window2['default'].console.groupEnd) {\n _window2['default'].console.groupEnd();\n }\n }\n\n parser.flush();\n};\n\n/**\n * Load a `TextTrack` from a specifed url.\n *\n * @param {string} src\n * Url to load track from.\n *\n * @param {TextTrack} track\n * Track to add cues to. Comes from the content at the end of `url`.\n *\n * @private\n */\nvar loadTrack = function loadTrack(src, track) {\n var opts = {\n uri: src\n };\n var crossOrigin = (0, _url.isCrossOrigin)(src);\n\n if (crossOrigin) {\n opts.cors = crossOrigin;\n }\n\n (0, _xhr2['default'])(opts, Fn.bind(this, function (err, response, responseBody) {\n if (err) {\n return _log2['default'].error(err, response);\n }\n\n track.loaded_ = true;\n\n // Make sure that vttjs has loaded, otherwise, wait till it finished loading\n // NOTE: this is only used for the alt/video.novtt.js build\n if (typeof _window2['default'].WebVTT !== 'function') {\n if (track.tech_) {\n var loadHandler = function loadHandler() {\n return parseCues(responseBody, track);\n };\n\n track.tech_.on('vttjsloaded', loadHandler);\n track.tech_.on('vttjserror', function () {\n _log2['default'].error('vttjs failed to load, stopping trying to process ' + track.src);\n track.tech_.off('vttjsloaded', loadHandler);\n });\n }\n } else {\n parseCues(responseBody, track);\n }\n }));\n};\n\n/**\n * A representation of a single `TextTrack`.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrack}\n * @extends Track\n */\n\nvar TextTrack = function (_Track) {\n _inherits(TextTrack, _Track);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} options={}\n * Object of option names and values\n *\n * @param {Tech} options.tech\n * A reference to the tech that owns this TextTrack.\n *\n * @param {TextTrack~Kind} [options.kind='subtitles']\n * A valid text track kind.\n *\n * @param {TextTrack~Mode} [options.mode='disabled']\n * A valid text track mode.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this TextTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {string} [options.srclang='']\n * A valid two character language code. An alternative, but deprioritized\n * vesion of `options.language`\n *\n * @param {string} [options.src]\n * A url to TextTrack cues.\n *\n * @param {boolean} [options.default]\n * If this track should default to on or off.\n */\n function TextTrack() {\n var _this, _ret;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, TextTrack);\n\n if (!options.tech) {\n throw new Error('A tech was not provided.');\n }\n\n var settings = (0, _mergeOptions2['default'])(options, {\n kind: _trackEnums.TextTrackKind[options.kind] || 'subtitles',\n language: options.language || options.srclang || ''\n });\n var mode = _trackEnums.TextTrackMode[settings.mode] || 'disabled';\n var default_ = settings['default'];\n\n if (settings.kind === 'metadata' || settings.kind === 'chapters') {\n mode = 'hidden';\n }\n // on IE8 this will be a document element\n // for every other browser this will be a normal object\n var tt = (_this = _possibleConstructorReturn(this, _Track.call(this, settings)), _this);\n\n tt.tech_ = settings.tech;\n\n if (browser.IS_IE8) {\n for (var prop in TextTrack.prototype) {\n if (prop !== 'constructor') {\n tt[prop] = TextTrack.prototype[prop];\n }\n }\n }\n\n tt.cues_ = [];\n tt.activeCues_ = [];\n\n var cues = new _textTrackCueList2['default'](tt.cues_);\n var activeCues = new _textTrackCueList2['default'](tt.activeCues_);\n var changed = false;\n var timeupdateHandler = Fn.bind(tt, function () {\n\n // Accessing this.activeCues for the side-effects of updating itself\n // due to it's nature as a getter function. Do not remove or cues will\n // stop updating!\n /* eslint-disable no-unused-expressions */\n this.activeCues;\n /* eslint-enable no-unused-expressions */\n if (changed) {\n this.trigger('cuechange');\n changed = false;\n }\n });\n\n if (mode !== 'disabled') {\n tt.tech_.ready(function () {\n tt.tech_.on('timeupdate', timeupdateHandler);\n }, true);\n }\n\n /**\n * @member {boolean} default\n * If this track was set to be on or off by default. Cannot be changed after\n * creation.\n *\n * @readonly\n */\n Object.defineProperty(tt, 'default', {\n get: function get() {\n return default_;\n },\n set: function set() {}\n });\n\n /**\n * @member {string} mode\n * Set the mode of this TextTrack to a valid {@link TextTrack~Mode}. Will\n * not be set if setting to an invalid mode.\n *\n * @fires TextTrack#modechange\n */\n Object.defineProperty(tt, 'mode', {\n get: function get() {\n return mode;\n },\n set: function set(newMode) {\n var _this2 = this;\n\n if (!_trackEnums.TextTrackMode[newMode]) {\n return;\n }\n mode = newMode;\n if (mode === 'showing') {\n this.tech_.ready(function () {\n _this2.tech_.on('timeupdate', timeupdateHandler);\n }, true);\n }\n /**\n * An event that fires when mode changes on this track. This allows\n * the TextTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec!\n *\n * @event TextTrack#modechange\n * @type {EventTarget~Event}\n */\n this.trigger('modechange');\n }\n });\n\n /**\n * @member {TextTrackCueList} cues\n * The text track cue list for this TextTrack.\n */\n Object.defineProperty(tt, 'cues', {\n get: function get() {\n if (!this.loaded_) {\n return null;\n }\n\n return cues;\n },\n set: function set() {}\n });\n\n /**\n * @member {TextTrackCueList} activeCues\n * The list text track cues that are currently active for this TextTrack.\n */\n Object.defineProperty(tt, 'activeCues', {\n get: function get() {\n if (!this.loaded_) {\n return null;\n }\n\n // nothing to do\n if (this.cues.length === 0) {\n return activeCues;\n }\n\n var ct = this.tech_.currentTime();\n var active = [];\n\n for (var i = 0, l = this.cues.length; i < l; i++) {\n var cue = this.cues[i];\n\n if (cue.startTime <= ct && cue.endTime >= ct) {\n active.push(cue);\n } else if (cue.startTime === cue.endTime && cue.startTime <= ct && cue.startTime + 0.5 >= ct) {\n active.push(cue);\n }\n }\n\n changed = false;\n\n if (active.length !== this.activeCues_.length) {\n changed = true;\n } else {\n for (var _i = 0; _i < active.length; _i++) {\n if (this.activeCues_.indexOf(active[_i]) === -1) {\n changed = true;\n }\n }\n }\n\n this.activeCues_ = active;\n activeCues.setCues_(this.activeCues_);\n\n return activeCues;\n },\n set: function set() {}\n });\n\n if (settings.src) {\n tt.src = settings.src;\n loadTrack(settings.src, tt);\n } else {\n tt.loaded_ = true;\n }\n\n return _ret = tt, _possibleConstructorReturn(_this, _ret);\n }\n\n /**\n * Add a cue to the internal list of cues.\n *\n * @param {TextTrack~Cue} cue\n * The cue to add to our internal list\n */\n\n\n TextTrack.prototype.addCue = function addCue(originalCue) {\n var cue = originalCue;\n\n if (_window2['default'].vttjs && !(originalCue instanceof _window2['default'].vttjs.VTTCue)) {\n cue = new _window2['default'].vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);\n\n for (var prop in originalCue) {\n if (!(prop in cue)) {\n cue[prop] = originalCue[prop];\n }\n }\n\n // make sure that `id` is copied over\n cue.id = originalCue.id;\n cue.originalCue_ = originalCue;\n }\n\n var tracks = this.tech_.textTracks();\n\n if (tracks) {\n for (var i = 0; i < tracks.length; i++) {\n if (tracks[i] !== this) {\n tracks[i].removeCue(cue);\n }\n }\n }\n\n this.cues_.push(cue);\n this.cues.setCues_(this.cues_);\n };\n\n /**\n * Remove a cue from our internal list\n *\n * @param {TextTrack~Cue} removeCue\n * The cue to remove from our internal list\n */\n\n\n TextTrack.prototype.removeCue = function removeCue(_removeCue) {\n var i = this.cues_.length;\n\n while (i--) {\n var cue = this.cues_[i];\n\n if (cue === _removeCue || cue.originalCue_ && cue.originalCue_ === _removeCue) {\n this.cues_.splice(i, 1);\n this.cues.setCues_(this.cues_);\n break;\n }\n }\n };\n\n return TextTrack;\n}(_track2['default']);\n\n/**\n * cuechange - One or more cues in the track have become active or stopped being active.\n */\n\n\nTextTrack.prototype.allowedEvents_ = {\n cuechange: 'cuechange'\n};\n\nexports['default'] = TextTrack;\n","'use strict';\n\nexports.__esModule = true;\n\nvar _browser = require('../utils/browser.js');\n\nvar browser = _interopRequireWildcard(_browser);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nvar _eventTarget = require('../event-target');\n\nvar _eventTarget2 = _interopRequireDefault(_eventTarget);\n\nvar _textTrack = require('../tracks/text-track');\n\nvar _textTrack2 = _interopRequireDefault(_textTrack);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file html-track-element.js\n */\n\n/**\n * @typedef {HTMLTrackElement~ReadyState}\n * @enum {number}\n */\nvar NONE = 0;\nvar LOADING = 1;\nvar LOADED = 2;\nvar ERROR = 3;\n\n/**\n * A single track represented in the DOM.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#htmltrackelement}\n * @extends EventTarget\n */\n\nvar HTMLTrackElement = function (_EventTarget) {\n _inherits(HTMLTrackElement, _EventTarget);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} options={}\n * Object of option names and values\n *\n * @param {Tech} options.tech\n * A reference to the tech that owns this HTMLTrackElement.\n *\n * @param {TextTrack~Kind} [options.kind='subtitles']\n * A valid text track kind.\n *\n * @param {TextTrack~Mode} [options.mode='disabled']\n * A valid text track mode.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this TextTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {string} [options.srclang='']\n * A valid two character language code. An alternative, but deprioritized\n * vesion of `options.language`\n *\n * @param {string} [options.src]\n * A url to TextTrack cues.\n *\n * @param {boolean} [options.default]\n * If this track should default to on or off.\n */\n function HTMLTrackElement() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, HTMLTrackElement);\n\n var _this = _possibleConstructorReturn(this, _EventTarget.call(this));\n\n var readyState = void 0;\n var trackElement = _this; // eslint-disable-line\n\n if (browser.IS_IE8) {\n trackElement = _document2['default'].createElement('custom');\n\n for (var prop in HTMLTrackElement.prototype) {\n if (prop !== 'constructor') {\n trackElement[prop] = HTMLTrackElement.prototype[prop];\n }\n }\n }\n\n var track = new _textTrack2['default'](options);\n\n trackElement.kind = track.kind;\n trackElement.src = track.src;\n trackElement.srclang = track.language;\n trackElement.label = track.label;\n trackElement['default'] = track['default'];\n\n /**\n * @member {HTMLTrackElement~ReadyState} readyState\n * The current ready state of the track element.\n */\n Object.defineProperty(trackElement, 'readyState', {\n get: function get() {\n return readyState;\n }\n });\n\n /**\n * @member {TextTrack} track\n * The underlying TextTrack object.\n */\n Object.defineProperty(trackElement, 'track', {\n get: function get() {\n return track;\n }\n });\n\n readyState = NONE;\n\n /**\n * @listens TextTrack#loadeddata\n * @fires HTMLTrackElement#load\n */\n track.addEventListener('loadeddata', function () {\n readyState = LOADED;\n\n trackElement.trigger({\n type: 'load',\n target: trackElement\n });\n });\n\n if (browser.IS_IE8) {\n var _ret;\n\n return _ret = trackElement, _possibleConstructorReturn(_this, _ret);\n }\n return _this;\n }\n\n return HTMLTrackElement;\n}(_eventTarget2['default']);\n\nHTMLTrackElement.prototype.allowedEvents_ = {\n load: 'load'\n};\n\nHTMLTrackElement.NONE = NONE;\nHTMLTrackElement.LOADING = LOADING;\nHTMLTrackElement.LOADED = LOADED;\nHTMLTrackElement.ERROR = ERROR;\n\nexports['default'] = HTMLTrackElement;\n","'use strict';\n\nexports.__esModule = true;\n\nvar _browser = require('../utils/browser.js');\n\nvar browser = _interopRequireWildcard(_browser);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /**\n * @file html-track-element-list.js\n */\n\n/**\n * The current list of {@link HtmlTrackElement}s.\n */\nvar HtmlTrackElementList = function () {\n\n /**\n * Create an instance of this class.\n *\n * @param {HtmlTrackElement[]} [tracks=[]]\n * A list of `HtmlTrackElement` to instantiate the list with.\n */\n function HtmlTrackElementList() {\n var trackElements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n _classCallCheck(this, HtmlTrackElementList);\n\n var list = this; // eslint-disable-line\n\n if (browser.IS_IE8) {\n list = _document2['default'].createElement('custom');\n\n for (var prop in HtmlTrackElementList.prototype) {\n if (prop !== 'constructor') {\n list[prop] = HtmlTrackElementList.prototype[prop];\n }\n }\n }\n\n list.trackElements_ = [];\n\n /**\n * @member {number} length\n * The current number of `Track`s in the this Trackist.\n */\n Object.defineProperty(list, 'length', {\n get: function get() {\n return this.trackElements_.length;\n }\n });\n\n for (var i = 0, length = trackElements.length; i < length; i++) {\n list.addTrackElement_(trackElements[i]);\n }\n\n if (browser.IS_IE8) {\n return list;\n }\n }\n\n /**\n * Add an {@link HtmlTrackElement} to the `HtmlTrackElementList`\n *\n * @param {HtmlTrackElement} trackElement\n * The track element to add to the list.\n *\n * @private\n */\n\n\n HtmlTrackElementList.prototype.addTrackElement_ = function addTrackElement_(trackElement) {\n var index = this.trackElements_.length;\n\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get: function get() {\n return this.trackElements_[index];\n }\n });\n }\n\n // Do not add duplicate elements\n if (this.trackElements_.indexOf(trackElement) === -1) {\n this.trackElements_.push(trackElement);\n }\n };\n\n /**\n * Get an {@link HtmlTrackElement} from the `HtmlTrackElementList` given an\n * {@link TextTrack}.\n *\n * @param {TextTrack} track\n * The track associated with a track element.\n *\n * @return {HtmlTrackElement|undefined}\n * The track element that was found or undefined.\n *\n * @private\n */\n\n\n HtmlTrackElementList.prototype.getTrackElementByTrack_ = function getTrackElementByTrack_(track) {\n var trackElement_ = void 0;\n\n for (var i = 0, length = this.trackElements_.length; i < length; i++) {\n if (track === this.trackElements_[i].track) {\n trackElement_ = this.trackElements_[i];\n\n break;\n }\n }\n\n return trackElement_;\n };\n\n /**\n * Remove a {@link HtmlTrackElement} from the `HtmlTrackElementList`\n *\n * @param {HtmlTrackElement} trackElement\n * The track element to remove from the list.\n *\n * @private\n */\n\n\n HtmlTrackElementList.prototype.removeTrackElement_ = function removeTrackElement_(trackElement) {\n for (var i = 0, length = this.trackElements_.length; i < length; i++) {\n if (trackElement === this.trackElements_[i]) {\n this.trackElements_.splice(i, 1);\n\n break;\n }\n }\n };\n\n return HtmlTrackElementList;\n}();\n\nexports['default'] = HtmlTrackElementList;\n","'use strict';\n\nexports.__esModule = true;\n\nvar _eventTarget = require('../event-target');\n\nvar _eventTarget2 = _interopRequireDefault(_eventTarget);\n\nvar _browser = require('../utils/browser.js');\n\nvar browser = _interopRequireWildcard(_browser);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file track-list.js\n */\n\n\n/**\n * Common functionaliy between {@link TextTrackList}, {@link AudioTrackList}, and\n * {@link VideoTrackList}\n *\n * @extends EventTarget\n */\nvar TrackList = function (_EventTarget) {\n _inherits(TrackList, _EventTarget);\n\n /**\n * Create an instance of this class\n *\n * @param {Track[]} tracks\n * A list of tracks to initialize the list with.\n *\n * @param {Object} [list]\n * The child object with inheritance done manually for ie8.\n *\n * @abstract\n */\n function TrackList() {\n var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n var _ret;\n\n var list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n _classCallCheck(this, TrackList);\n\n var _this = _possibleConstructorReturn(this, _EventTarget.call(this));\n\n if (!list) {\n list = _this; // eslint-disable-line\n if (browser.IS_IE8) {\n list = _document2['default'].createElement('custom');\n for (var prop in TrackList.prototype) {\n if (prop !== 'constructor') {\n list[prop] = TrackList.prototype[prop];\n }\n }\n }\n }\n\n list.tracks_ = [];\n\n /**\n * @member {number} length\n * The current number of `Track`s in the this Trackist.\n */\n Object.defineProperty(list, 'length', {\n get: function get() {\n return this.tracks_.length;\n }\n });\n\n for (var i = 0; i < tracks.length; i++) {\n list.addTrack_(tracks[i]);\n }\n\n // must return the object, as for ie8 it will not be this\n // but a reference to a document object\n return _ret = list, _possibleConstructorReturn(_this, _ret);\n }\n\n /**\n * Add a {@link Track} to the `TrackList`\n *\n * @param {Track} track\n * The audio, video, or text track to add to the list.\n *\n * @fires TrackList#addtrack\n * @private\n */\n\n\n TrackList.prototype.addTrack_ = function addTrack_(track) {\n var index = this.tracks_.length;\n\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get: function get() {\n return this.tracks_[index];\n }\n });\n }\n\n // Do not add duplicate tracks\n if (this.tracks_.indexOf(track) === -1) {\n this.tracks_.push(track);\n /**\n * Triggered when a track is added to a track list.\n *\n * @event TrackList#addtrack\n * @type {EventTarget~Event}\n * @property {Track} track\n * A reference to track that was added.\n */\n this.trigger({\n track: track,\n type: 'addtrack'\n });\n }\n };\n\n /**\n * Remove a {@link Track} from the `TrackList`\n *\n * @param {Track} track\n * The audio, video, or text track to remove from the list.\n *\n * @fires TrackList#removetrack\n * @private\n */\n\n\n TrackList.prototype.removeTrack_ = function removeTrack_(rtrack) {\n var track = void 0;\n\n for (var i = 0, l = this.length; i < l; i++) {\n if (this[i] === rtrack) {\n track = this[i];\n if (track.off) {\n track.off();\n }\n\n this.tracks_.splice(i, 1);\n\n break;\n }\n }\n\n if (!track) {\n return;\n }\n\n /**\n * Triggered when a track is removed from track list.\n *\n * @event TrackList#removetrack\n * @type {EventTarget~Event}\n * @property {Track} track\n * A reference to track that was removed.\n */\n this.trigger({\n track: track,\n type: 'removetrack'\n });\n };\n\n /**\n * Get a Track from the TrackList by a tracks id\n *\n * @param {String} id - the id of the track to get\n * @method getTrackById\n * @return {Track}\n * @private\n */\n\n\n TrackList.prototype.getTrackById = function getTrackById(id) {\n var result = null;\n\n for (var i = 0, l = this.length; i < l; i++) {\n var track = this[i];\n\n if (track.id === id) {\n result = track;\n break;\n }\n }\n\n return result;\n };\n\n return TrackList;\n}(_eventTarget2['default']);\n\n/**\n * Triggered when a different track is selected/enabled.\n *\n * @event TrackList#change\n * @type {EventTarget~Event}\n */\n\n/**\n * Events that can be called with on + eventName. See {@link EventHandler}.\n *\n * @property {Object} TrackList#allowedEvents_\n * @private\n */\n\n\nTrackList.prototype.allowedEvents_ = {\n change: 'change',\n addtrack: 'addtrack',\n removetrack: 'removetrack'\n};\n\n// emulate attribute EventHandler support to allow for feature detection\nfor (var event in TrackList.prototype.allowedEvents_) {\n TrackList.prototype['on' + event] = null;\n}\n\nexports['default'] = TrackList;\n","'use strict';\n\nexports.__esModule = true;\n\nvar _trackList = require('./track-list');\n\nvar _trackList2 = _interopRequireDefault(_trackList);\n\nvar _fn = require('../utils/fn.js');\n\nvar Fn = _interopRequireWildcard(_fn);\n\nvar _browser = require('../utils/browser.js');\n\nvar browser = _interopRequireWildcard(_browser);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file text-track-list.js\n */\n\n\n/**\n * The current list of {@link TextTrack} for a media file.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist}\n * @extends TrackList\n */\nvar TextTrackList = function (_TrackList) {\n _inherits(TextTrackList, _TrackList);\n\n /**\n * Create an instance of this class.\n *\n * @param {TextTrack[]} [tracks=[]]\n * A list of `TextTrack` to instantiate the list with.\n */\n function TextTrackList() {\n var _this, _ret;\n\n var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n _classCallCheck(this, TextTrackList);\n\n var list = void 0;\n\n // IE8 forces us to implement inheritance ourselves\n // as it does not support Object.defineProperty properly\n if (browser.IS_IE8) {\n list = _document2['default'].createElement('custom');\n for (var prop in _trackList2['default'].prototype) {\n if (prop !== 'constructor') {\n list[prop] = _trackList2['default'].prototype[prop];\n }\n }\n for (var _prop in TextTrackList.prototype) {\n if (_prop !== 'constructor') {\n list[_prop] = TextTrackList.prototype[_prop];\n }\n }\n }\n\n list = (_this = _possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this);\n return _ret = list, _possibleConstructorReturn(_this, _ret);\n }\n\n /**\n * Add a {@link TextTrack} to the `TextTrackList`\n *\n * @param {TextTrack} track\n * The text track to add to the list.\n *\n * @fires TrackList#addtrack\n * @private\n */\n\n\n TextTrackList.prototype.addTrack_ = function addTrack_(track) {\n _TrackList.prototype.addTrack_.call(this, track);\n\n /**\n * @listens TextTrack#modechange\n * @fires TrackList#change\n */\n track.addEventListener('modechange', Fn.bind(this, function () {\n this.trigger('change');\n }));\n };\n\n return TextTrackList;\n}(_trackList2['default']);\n\nexports['default'] = TextTrackList;\n","'use strict';\n\nexports.__esModule = true;\n\nvar _trackList = require('./track-list');\n\nvar _trackList2 = _interopRequireDefault(_trackList);\n\nvar _browser = require('../utils/browser.js');\n\nvar browser = _interopRequireWildcard(_browser);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file video-track-list.js\n */\n\n\n/**\n * Un-select all other {@link VideoTrack}s that are selected.\n *\n * @param {VideoTrackList} list\n * list to work on\n *\n * @param {VideoTrack} track\n * The track to skip\n *\n * @private\n */\nvar disableOthers = function disableOthers(list, track) {\n for (var i = 0; i < list.length; i++) {\n if (track.id === list[i].id) {\n continue;\n }\n // another video track is enabled, disable it\n list[i].selected = false;\n }\n};\n\n/**\n * The current list of {@link VideoTrack} for a video.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist}\n * @extends TrackList\n */\n\nvar VideoTrackList = function (_TrackList) {\n _inherits(VideoTrackList, _TrackList);\n\n /**\n * Create an instance of this class.\n *\n * @param {VideoTrack[]} [tracks=[]]\n * A list of `VideoTrack` to instantiate the list with.\n */\n function VideoTrackList() {\n var _this, _ret;\n\n var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n _classCallCheck(this, VideoTrackList);\n\n var list = void 0;\n\n // make sure only 1 track is enabled\n // sorted from last index to first index\n for (var i = tracks.length - 1; i >= 0; i--) {\n if (tracks[i].selected) {\n disableOthers(tracks, tracks[i]);\n break;\n }\n }\n\n // IE8 forces us to implement inheritance ourselves\n // as it does not support Object.defineProperty properly\n if (browser.IS_IE8) {\n list = _document2['default'].createElement('custom');\n for (var prop in _trackList2['default'].prototype) {\n if (prop !== 'constructor') {\n list[prop] = _trackList2['default'].prototype[prop];\n }\n }\n for (var _prop in VideoTrackList.prototype) {\n if (_prop !== 'constructor') {\n list[_prop] = VideoTrackList.prototype[_prop];\n }\n }\n }\n\n list = (_this = _possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this);\n list.changing_ = false;\n\n /**\n * @member {number} VideoTrackList#selectedIndex\n * The current index of the selected {@link VideoTrack`}.\n */\n Object.defineProperty(list, 'selectedIndex', {\n get: function get() {\n for (var _i = 0; _i < this.length; _i++) {\n if (this[_i].selected) {\n return _i;\n }\n }\n return -1;\n },\n set: function set() {}\n });\n\n return _ret = list, _possibleConstructorReturn(_this, _ret);\n }\n\n /**\n * Add a {@link VideoTrack} to the `VideoTrackList`.\n *\n * @param {VideoTrack} track\n * The VideoTrack to add to the list\n *\n * @fires TrackList#addtrack\n * @private\n */\n\n\n VideoTrackList.prototype.addTrack_ = function addTrack_(track) {\n var _this2 = this;\n\n if (track.selected) {\n disableOthers(this, track);\n }\n\n _TrackList.prototype.addTrack_.call(this, track);\n // native tracks don't have this\n if (!track.addEventListener) {\n return;\n }\n\n /**\n * @listens VideoTrack#selectedchange\n * @fires TrackList#change\n */\n track.addEventListener('selectedchange', function () {\n if (_this2.changing_) {\n return;\n }\n _this2.changing_ = true;\n disableOthers(_this2, track);\n _this2.changing_ = false;\n _this2.trigger('change');\n });\n };\n\n /**\n * Add a {@link VideoTrack} to the `VideoTrackList`.\n *\n * @param {VideoTrack} track\n * The VideoTrack to add to the list\n *\n * @fires TrackList#addtrack\n */\n\n\n VideoTrackList.prototype.addTrack = function addTrack(track) {\n this.addTrack_(track);\n };\n\n /**\n * Remove a {@link VideoTrack} to the `VideoTrackList`.\n *\n * @param {VideoTrack} track\n * The VideoTrack to remove from the list.\n *\n * @fires TrackList#removetrack\n */\n\n\n VideoTrackList.prototype.removeTrack = function removeTrack(track) {\n _TrackList.prototype.removeTrack_.call(this, track);\n };\n\n return VideoTrackList;\n}(_trackList2['default']);\n\nexports['default'] = VideoTrackList;\n","'use strict';\n\nexports.__esModule = true;\n\nvar _trackList = require('./track-list');\n\nvar _trackList2 = _interopRequireDefault(_trackList);\n\nvar _browser = require('../utils/browser.js');\n\nvar browser = _interopRequireWildcard(_browser);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file audio-track-list.js\n */\n\n\n/**\n * Anywhere we call this function we diverge from the spec\n * as we only support one enabled audiotrack at a time\n *\n * @param {AudioTrackList} list\n * list to work on\n *\n * @param {AudioTrack} track\n * The track to skip\n *\n * @private\n */\nvar disableOthers = function disableOthers(list, track) {\n for (var i = 0; i < list.length; i++) {\n if (track.id === list[i].id) {\n continue;\n }\n // another audio track is enabled, disable it\n list[i].enabled = false;\n }\n};\n\n/**\n * The current list of {@link AudioTrack} for a media file.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist}\n * @extends TrackList\n */\n\nvar AudioTrackList = function (_TrackList) {\n _inherits(AudioTrackList, _TrackList);\n\n /**\n * Create an instance of this class.\n *\n * @param {AudioTrack[]} [tracks=[]]\n * A list of `AudioTrack` to instantiate the list with.\n */\n function AudioTrackList() {\n var _this, _ret;\n\n var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n _classCallCheck(this, AudioTrackList);\n\n var list = void 0;\n\n // make sure only 1 track is enabled\n // sorted from last index to first index\n for (var i = tracks.length - 1; i >= 0; i--) {\n if (tracks[i].enabled) {\n disableOthers(tracks, tracks[i]);\n break;\n }\n }\n\n // IE8 forces us to implement inheritance ourselves\n // as it does not support Object.defineProperty properly\n if (browser.IS_IE8) {\n list = _document2['default'].createElement('custom');\n for (var prop in _trackList2['default'].prototype) {\n if (prop !== 'constructor') {\n list[prop] = _trackList2['default'].prototype[prop];\n }\n }\n for (var _prop in AudioTrackList.prototype) {\n if (_prop !== 'constructor') {\n list[_prop] = AudioTrackList.prototype[_prop];\n }\n }\n }\n\n list = (_this = _possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this);\n list.changing_ = false;\n\n return _ret = list, _possibleConstructorReturn(_this, _ret);\n }\n\n /**\n * Add an {@link AudioTrack} to the `AudioTrackList`.\n *\n * @param {AudioTrack} track\n * The AudioTrack to add to the list\n *\n * @fires Track#addtrack\n * @private\n */\n\n\n AudioTrackList.prototype.addTrack_ = function addTrack_(track) {\n var _this2 = this;\n\n if (track.enabled) {\n disableOthers(this, track);\n }\n\n _TrackList.prototype.addTrack_.call(this, track);\n // native tracks don't have this\n if (!track.addEventListener) {\n return;\n }\n\n /**\n * @listens AudioTrack#enabledchange\n * @fires TrackList#change\n */\n track.addEventListener('enabledchange', function () {\n // when we are disabling other tracks (since we don't support\n // more than one track at a time) we will set changing_\n // to true so that we don't trigger additional change events\n if (_this2.changing_) {\n return;\n }\n _this2.changing_ = true;\n disableOthers(_this2, track);\n _this2.changing_ = false;\n _this2.trigger('change');\n });\n };\n\n /**\n * Add an {@link AudioTrack} to the `AudioTrackList`.\n *\n * @param {AudioTrack} track\n * The AudioTrack to add to the list\n *\n * @fires Track#addtrack\n */\n\n\n AudioTrackList.prototype.addTrack = function addTrack(track) {\n this.addTrack_(track);\n };\n\n /**\n * Remove an {@link AudioTrack} from the `AudioTrackList`.\n *\n * @param {AudioTrack} track\n * The AudioTrack to remove from the list\n *\n * @fires Track#removetrack\n */\n\n\n AudioTrackList.prototype.removeTrack = function removeTrack(track) {\n _TrackList.prototype.removeTrack_.call(this, track);\n };\n\n return AudioTrackList;\n}(_trackList2['default']);\n\nexports['default'] = AudioTrackList;\n","var win;\n\nif (typeof window !== \"undefined\") {\n win = window;\n} else if (typeof global !== \"undefined\") {\n win = global;\n} else if (typeof self !== \"undefined\"){\n win = self;\n} else {\n win = {};\n}\n\nmodule.exports = win;\n","/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\n/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */\nvar _objCreate = Object.create || (function() {\n function F() {}\n return function(o) {\n if (arguments.length !== 1) {\n throw new Error('Object.create shim only accepts one parameter.');\n }\n F.prototype = o;\n return new F();\n };\n})();\n\n// Creates a new ParserError object from an errorData object. The errorData\n// object should have default code and message properties. The default message\n// property can be overriden by passing in a message parameter.\n// See ParsingError.Errors below for acceptable errors.\nfunction ParsingError(errorData, message) {\n this.name = \"ParsingError\";\n this.code = errorData.code;\n this.message = message || errorData.message;\n}\nParsingError.prototype = _objCreate(Error.prototype);\nParsingError.prototype.constructor = ParsingError;\n\n// ParsingError metadata for acceptable ParsingErrors.\nParsingError.Errors = {\n BadSignature: {\n code: 0,\n message: \"Malformed WebVTT signature.\"\n },\n BadTimeStamp: {\n code: 1,\n message: \"Malformed time stamp.\"\n }\n};\n\n// Try to parse input as a time stamp.\nfunction parseTimeStamp(input) {\n\n function computeSeconds(h, m, s, f) {\n return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;\n }\n\n var m = input.match(/^(\\d+):(\\d{2})(:\\d{2})?\\.(\\d{3})/);\n if (!m) {\n return null;\n }\n\n if (m[3]) {\n // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]\n return computeSeconds(m[1], m[2], m[3].replace(\":\", \"\"), m[4]);\n } else if (m[1] > 59) {\n // Timestamp takes the form of [hours]:[minutes].[milliseconds]\n // First position is hours as it's over 59.\n return computeSeconds(m[1], m[2], 0, m[4]);\n } else {\n // Timestamp takes the form of [minutes]:[seconds].[milliseconds]\n return computeSeconds(0, m[1], m[2], m[4]);\n }\n}\n\n// A settings object holds key/value pairs and will ignore anything but the first\n// assignment to a specific key.\nfunction Settings() {\n this.values = _objCreate(null);\n}\n\nSettings.prototype = {\n // Only accept the first assignment to any key.\n set: function(k, v) {\n if (!this.get(k) && v !== \"\") {\n this.values[k] = v;\n }\n },\n // Return the value for a key, or a default value.\n // If 'defaultKey' is passed then 'dflt' is assumed to be an object with\n // a number of possible default values as properties where 'defaultKey' is\n // the key of the property that will be chosen; otherwise it's assumed to be\n // a single value.\n get: function(k, dflt, defaultKey) {\n if (defaultKey) {\n return this.has(k) ? this.values[k] : dflt[defaultKey];\n }\n return this.has(k) ? this.values[k] : dflt;\n },\n // Check whether we have a value for a key.\n has: function(k) {\n return k in this.values;\n },\n // Accept a setting if its one of the given alternatives.\n alt: function(k, v, a) {\n for (var n = 0; n < a.length; ++n) {\n if (v === a[n]) {\n this.set(k, v);\n break;\n }\n }\n },\n // Accept a setting if its a valid (signed) integer.\n integer: function(k, v) {\n if (/^-?\\d+$/.test(v)) { // integer\n this.set(k, parseInt(v, 10));\n }\n },\n // Accept a setting if its a valid percentage.\n percent: function(k, v) {\n var m;\n if ((m = v.match(/^([\\d]{1,3})(\\.[\\d]*)?%$/))) {\n v = parseFloat(v);\n if (v >= 0 && v <= 100) {\n this.set(k, v);\n return true;\n }\n }\n return false;\n }\n};\n\n// Helper function to parse input into groups separated by 'groupDelim', and\n// interprete each group as a key/value pair separated by 'keyValueDelim'.\nfunction parseOptions(input, callback, keyValueDelim, groupDelim) {\n var groups = groupDelim ? input.split(groupDelim) : [input];\n for (var i in groups) {\n if (typeof groups[i] !== \"string\") {\n continue;\n }\n var kv = groups[i].split(keyValueDelim);\n if (kv.length !== 2) {\n continue;\n }\n var k = kv[0];\n var v = kv[1];\n callback(k, v);\n }\n}\n\nfunction parseCue(input, cue, regionList) {\n // Remember the original input if we need to throw an error.\n var oInput = input;\n // 4.1 WebVTT timestamp\n function consumeTimeStamp() {\n var ts = parseTimeStamp(input);\n if (ts === null) {\n throw new ParsingError(ParsingError.Errors.BadTimeStamp,\n \"Malformed timestamp: \" + oInput);\n }\n // Remove time stamp from input.\n input = input.replace(/^[^\\sa-zA-Z-]+/, \"\");\n return ts;\n }\n\n // 4.4.2 WebVTT cue settings\n function consumeCueSettings(input, cue) {\n var settings = new Settings();\n\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"region\":\n // Find the last region we parsed with the same region id.\n for (var i = regionList.length - 1; i >= 0; i--) {\n if (regionList[i].id === v) {\n settings.set(k, regionList[i].region);\n break;\n }\n }\n break;\n case \"vertical\":\n settings.alt(k, v, [\"rl\", \"lr\"]);\n break;\n case \"line\":\n var vals = v.split(\",\"),\n vals0 = vals[0];\n settings.integer(k, vals0);\n settings.percent(k, vals0) ? settings.set(\"snapToLines\", false) : null;\n settings.alt(k, vals0, [\"auto\"]);\n if (vals.length === 2) {\n settings.alt(\"lineAlign\", vals[1], [\"start\", \"middle\", \"end\"]);\n }\n break;\n case \"position\":\n vals = v.split(\",\");\n settings.percent(k, vals[0]);\n if (vals.length === 2) {\n settings.alt(\"positionAlign\", vals[1], [\"start\", \"middle\", \"end\"]);\n }\n break;\n case \"size\":\n settings.percent(k, v);\n break;\n case \"align\":\n settings.alt(k, v, [\"start\", \"middle\", \"end\", \"left\", \"right\"]);\n break;\n }\n }, /:/, /\\s/);\n\n // Apply default values for any missing fields.\n cue.region = settings.get(\"region\", null);\n cue.vertical = settings.get(\"vertical\", \"\");\n cue.line = settings.get(\"line\", \"auto\");\n cue.lineAlign = settings.get(\"lineAlign\", \"start\");\n cue.snapToLines = settings.get(\"snapToLines\", true);\n cue.size = settings.get(\"size\", 100);\n cue.align = settings.get(\"align\", \"middle\");\n cue.position = settings.get(\"position\", {\n start: 0,\n left: 0,\n middle: 50,\n end: 100,\n right: 100\n }, cue.align);\n cue.positionAlign = settings.get(\"positionAlign\", {\n start: \"start\",\n left: \"start\",\n middle: \"middle\",\n end: \"end\",\n right: \"end\"\n }, cue.align);\n }\n\n function skipWhitespace() {\n input = input.replace(/^\\s+/, \"\");\n }\n\n // 4.1 WebVTT cue timings.\n skipWhitespace();\n cue.startTime = consumeTimeStamp(); // (1) collect cue start time\n skipWhitespace();\n if (input.substr(0, 3) !== \"-->\") { // (3) next characters must match \"-->\"\n throw new ParsingError(ParsingError.Errors.BadTimeStamp,\n \"Malformed time stamp (time stamps must be separated by '-->'): \" +\n oInput);\n }\n input = input.substr(3);\n skipWhitespace();\n cue.endTime = consumeTimeStamp(); // (5) collect cue end time\n\n // 4.1 WebVTT cue settings list.\n skipWhitespace();\n consumeCueSettings(input, cue);\n}\n\nvar ESCAPE = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n \"‎\": \"\\u200e\",\n \"‏\": \"\\u200f\",\n \" \": \"\\u00a0\"\n};\n\nvar TAG_NAME = {\n c: \"span\",\n i: \"i\",\n b: \"b\",\n u: \"u\",\n ruby: \"ruby\",\n rt: \"rt\",\n v: \"span\",\n lang: \"span\"\n};\n\nvar TAG_ANNOTATION = {\n v: \"title\",\n lang: \"lang\"\n};\n\nvar NEEDS_PARENT = {\n rt: \"ruby\"\n};\n\n// Parse content into a document fragment.\nfunction parseContent(window, input) {\n function nextToken() {\n // Check for end-of-string.\n if (!input) {\n return null;\n }\n\n // Consume 'n' characters from the input.\n function consume(result) {\n input = input.substr(result.length);\n return result;\n }\n\n var m = input.match(/^([^<]*)(<[^>]*>?)?/);\n // If there is some text before the next tag, return it, otherwise return\n // the tag.\n return consume(m[1] ? m[1] : m[2]);\n }\n\n // Unescape a string 's'.\n function unescape1(e) {\n return ESCAPE[e];\n }\n function unescape(s) {\n while ((m = s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/))) {\n s = s.replace(m[0], unescape1);\n }\n return s;\n }\n\n function shouldAdd(current, element) {\n return !NEEDS_PARENT[element.localName] ||\n NEEDS_PARENT[element.localName] === current.localName;\n }\n\n // Create an element for this tag.\n function createElement(type, annotation) {\n var tagName = TAG_NAME[type];\n if (!tagName) {\n return null;\n }\n var element = window.document.createElement(tagName);\n element.localName = tagName;\n var name = TAG_ANNOTATION[type];\n if (name && annotation) {\n element[name] = annotation.trim();\n }\n return element;\n }\n\n var rootDiv = window.document.createElement(\"div\"),\n current = rootDiv,\n t,\n tagStack = [];\n\n while ((t = nextToken()) !== null) {\n if (t[0] === '<') {\n if (t[1] === \"/\") {\n // If the closing tag matches, move back up to the parent node.\n if (tagStack.length &&\n tagStack[tagStack.length - 1] === t.substr(2).replace(\">\", \"\")) {\n tagStack.pop();\n current = current.parentNode;\n }\n // Otherwise just ignore the end tag.\n continue;\n }\n var ts = parseTimeStamp(t.substr(1, t.length - 2));\n var node;\n if (ts) {\n // Timestamps are lead nodes as well.\n node = window.document.createProcessingInstruction(\"timestamp\", ts);\n current.appendChild(node);\n continue;\n }\n var m = t.match(/^<([^.\\s/0-9>]+)(\\.[^\\s\\\\>]+)?([^>\\\\]+)?(\\\\?)>?$/);\n // If we can't parse the tag, skip to the next tag.\n if (!m) {\n continue;\n }\n // Try to construct an element, and ignore the tag if we couldn't.\n node = createElement(m[1], m[3]);\n if (!node) {\n continue;\n }\n // Determine if the tag should be added based on the context of where it\n // is placed in the cuetext.\n if (!shouldAdd(current, node)) {\n continue;\n }\n // Set the class list (as a list of classes, separated by space).\n if (m[2]) {\n node.className = m[2].substr(1).replace('.', ' ');\n }\n // Append the node to the current node, and enter the scope of the new\n // node.\n tagStack.push(m[1]);\n current.appendChild(node);\n current = node;\n continue;\n }\n\n // Text nodes are leaf nodes.\n current.appendChild(window.document.createTextNode(unescape(t)));\n }\n\n return rootDiv;\n}\n\n// This is a list of all the Unicode characters that have a strong\n// right-to-left category. What this means is that these characters are\n// written right-to-left for sure. It was generated by pulling all the strong\n// right-to-left characters out of the Unicode data table. That table can\n// found at: http://www.unicode.org/Public/UNIDATA/UnicodeData.txt\nvar strongRTLRanges = [[0x5be, 0x5be], [0x5c0, 0x5c0], [0x5c3, 0x5c3], [0x5c6, 0x5c6],\n [0x5d0, 0x5ea], [0x5f0, 0x5f4], [0x608, 0x608], [0x60b, 0x60b], [0x60d, 0x60d],\n [0x61b, 0x61b], [0x61e, 0x64a], [0x66d, 0x66f], [0x671, 0x6d5], [0x6e5, 0x6e6],\n [0x6ee, 0x6ef], [0x6fa, 0x70d], [0x70f, 0x710], [0x712, 0x72f], [0x74d, 0x7a5],\n [0x7b1, 0x7b1], [0x7c0, 0x7ea], [0x7f4, 0x7f5], [0x7fa, 0x7fa], [0x800, 0x815],\n [0x81a, 0x81a], [0x824, 0x824], [0x828, 0x828], [0x830, 0x83e], [0x840, 0x858],\n [0x85e, 0x85e], [0x8a0, 0x8a0], [0x8a2, 0x8ac], [0x200f, 0x200f],\n [0xfb1d, 0xfb1d], [0xfb1f, 0xfb28], [0xfb2a, 0xfb36], [0xfb38, 0xfb3c],\n [0xfb3e, 0xfb3e], [0xfb40, 0xfb41], [0xfb43, 0xfb44], [0xfb46, 0xfbc1],\n [0xfbd3, 0xfd3d], [0xfd50, 0xfd8f], [0xfd92, 0xfdc7], [0xfdf0, 0xfdfc],\n [0xfe70, 0xfe74], [0xfe76, 0xfefc], [0x10800, 0x10805], [0x10808, 0x10808],\n [0x1080a, 0x10835], [0x10837, 0x10838], [0x1083c, 0x1083c], [0x1083f, 0x10855],\n [0x10857, 0x1085f], [0x10900, 0x1091b], [0x10920, 0x10939], [0x1093f, 0x1093f],\n [0x10980, 0x109b7], [0x109be, 0x109bf], [0x10a00, 0x10a00], [0x10a10, 0x10a13],\n [0x10a15, 0x10a17], [0x10a19, 0x10a33], [0x10a40, 0x10a47], [0x10a50, 0x10a58],\n [0x10a60, 0x10a7f], [0x10b00, 0x10b35], [0x10b40, 0x10b55], [0x10b58, 0x10b72],\n [0x10b78, 0x10b7f], [0x10c00, 0x10c48], [0x1ee00, 0x1ee03], [0x1ee05, 0x1ee1f],\n [0x1ee21, 0x1ee22], [0x1ee24, 0x1ee24], [0x1ee27, 0x1ee27], [0x1ee29, 0x1ee32],\n [0x1ee34, 0x1ee37], [0x1ee39, 0x1ee39], [0x1ee3b, 0x1ee3b], [0x1ee42, 0x1ee42],\n [0x1ee47, 0x1ee47], [0x1ee49, 0x1ee49], [0x1ee4b, 0x1ee4b], [0x1ee4d, 0x1ee4f],\n [0x1ee51, 0x1ee52], [0x1ee54, 0x1ee54], [0x1ee57, 0x1ee57], [0x1ee59, 0x1ee59],\n [0x1ee5b, 0x1ee5b], [0x1ee5d, 0x1ee5d], [0x1ee5f, 0x1ee5f], [0x1ee61, 0x1ee62],\n [0x1ee64, 0x1ee64], [0x1ee67, 0x1ee6a], [0x1ee6c, 0x1ee72], [0x1ee74, 0x1ee77],\n [0x1ee79, 0x1ee7c], [0x1ee7e, 0x1ee7e], [0x1ee80, 0x1ee89], [0x1ee8b, 0x1ee9b],\n [0x1eea1, 0x1eea3], [0x1eea5, 0x1eea9], [0x1eeab, 0x1eebb], [0x10fffd, 0x10fffd]];\n\nfunction isStrongRTLChar(charCode) {\n for (var i = 0; i < strongRTLRanges.length; i++) {\n var currentRange = strongRTLRanges[i];\n if (charCode >= currentRange[0] && charCode <= currentRange[1]) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction determineBidi(cueDiv) {\n var nodeStack = [],\n text = \"\",\n charCode;\n\n if (!cueDiv || !cueDiv.childNodes) {\n return \"ltr\";\n }\n\n function pushNodes(nodeStack, node) {\n for (var i = node.childNodes.length - 1; i >= 0; i--) {\n nodeStack.push(node.childNodes[i]);\n }\n }\n\n function nextTextNode(nodeStack) {\n if (!nodeStack || !nodeStack.length) {\n return null;\n }\n\n var node = nodeStack.pop(),\n text = node.textContent || node.innerText;\n if (text) {\n // TODO: This should match all unicode type B characters (paragraph\n // separator characters). See issue #115.\n var m = text.match(/^.*(\\n|\\r)/);\n if (m) {\n nodeStack.length = 0;\n return m[0];\n }\n return text;\n }\n if (node.tagName === \"ruby\") {\n return nextTextNode(nodeStack);\n }\n if (node.childNodes) {\n pushNodes(nodeStack, node);\n return nextTextNode(nodeStack);\n }\n }\n\n pushNodes(nodeStack, cueDiv);\n while ((text = nextTextNode(nodeStack))) {\n for (var i = 0; i < text.length; i++) {\n charCode = text.charCodeAt(i);\n if (isStrongRTLChar(charCode)) {\n return \"rtl\";\n }\n }\n }\n return \"ltr\";\n}\n\nfunction computeLinePos(cue) {\n if (typeof cue.line === \"number\" &&\n (cue.snapToLines || (cue.line >= 0 && cue.line <= 100))) {\n return cue.line;\n }\n if (!cue.track || !cue.track.textTrackList ||\n !cue.track.textTrackList.mediaElement) {\n return -1;\n }\n var track = cue.track,\n trackList = track.textTrackList,\n count = 0;\n for (var i = 0; i < trackList.length && trackList[i] !== track; i++) {\n if (trackList[i].mode === \"showing\") {\n count++;\n }\n }\n return ++count * -1;\n}\n\nfunction StyleBox() {\n}\n\n// Apply styles to a div. If there is no div passed then it defaults to the\n// div on 'this'.\nStyleBox.prototype.applyStyles = function(styles, div) {\n div = div || this.div;\n for (var prop in styles) {\n if (styles.hasOwnProperty(prop)) {\n div.style[prop] = styles[prop];\n }\n }\n};\n\nStyleBox.prototype.formatStyle = function(val, unit) {\n return val === 0 ? 0 : val + unit;\n};\n\n// Constructs the computed display state of the cue (a div). Places the div\n// into the overlay which should be a block level element (usually a div).\nfunction CueStyleBox(window, cue, styleOptions) {\n var isIE8 = (/MSIE\\s8\\.0/).test(navigator.userAgent);\n var color = \"rgba(255, 255, 255, 1)\";\n var backgroundColor = \"rgba(0, 0, 0, 0.8)\";\n\n if (isIE8) {\n color = \"rgb(255, 255, 255)\";\n backgroundColor = \"rgb(0, 0, 0)\";\n }\n\n StyleBox.call(this);\n this.cue = cue;\n\n // Parse our cue's text into a DOM tree rooted at 'cueDiv'. This div will\n // have inline positioning and will function as the cue background box.\n this.cueDiv = parseContent(window, cue.text);\n var styles = {\n color: color,\n backgroundColor: backgroundColor,\n position: \"relative\",\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n display: \"inline\"\n };\n\n if (!isIE8) {\n styles.writingMode = cue.vertical === \"\" ? \"horizontal-tb\"\n : cue.vertical === \"lr\" ? \"vertical-lr\"\n : \"vertical-rl\";\n styles.unicodeBidi = \"plaintext\";\n }\n this.applyStyles(styles, this.cueDiv);\n\n // Create an absolutely positioned div that will be used to position the cue\n // div. Note, all WebVTT cue-setting alignments are equivalent to the CSS\n // mirrors of them except \"middle\" which is \"center\" in CSS.\n this.div = window.document.createElement(\"div\");\n styles = {\n textAlign: cue.align === \"middle\" ? \"center\" : cue.align,\n font: styleOptions.font,\n whiteSpace: \"pre-line\",\n position: \"absolute\"\n };\n\n if (!isIE8) {\n styles.direction = determineBidi(this.cueDiv);\n styles.writingMode = cue.vertical === \"\" ? \"horizontal-tb\"\n : cue.vertical === \"lr\" ? \"vertical-lr\"\n : \"vertical-rl\".\n stylesunicodeBidi = \"plaintext\";\n }\n\n this.applyStyles(styles);\n\n this.div.appendChild(this.cueDiv);\n\n // Calculate the distance from the reference edge of the viewport to the text\n // position of the cue box. The reference edge will be resolved later when\n // the box orientation styles are applied.\n var textPos = 0;\n switch (cue.positionAlign) {\n case \"start\":\n textPos = cue.position;\n break;\n case \"middle\":\n textPos = cue.position - (cue.size / 2);\n break;\n case \"end\":\n textPos = cue.position - cue.size;\n break;\n }\n\n // Horizontal box orientation; textPos is the distance from the left edge of the\n // area to the left edge of the box and cue.size is the distance extending to\n // the right from there.\n if (cue.vertical === \"\") {\n this.applyStyles({\n left: this.formatStyle(textPos, \"%\"),\n width: this.formatStyle(cue.size, \"%\")\n });\n // Vertical box orientation; textPos is the distance from the top edge of the\n // area to the top edge of the box and cue.size is the height extending\n // downwards from there.\n } else {\n this.applyStyles({\n top: this.formatStyle(textPos, \"%\"),\n height: this.formatStyle(cue.size, \"%\")\n });\n }\n\n this.move = function(box) {\n this.applyStyles({\n top: this.formatStyle(box.top, \"px\"),\n bottom: this.formatStyle(box.bottom, \"px\"),\n left: this.formatStyle(box.left, \"px\"),\n right: this.formatStyle(box.right, \"px\"),\n height: this.formatStyle(box.height, \"px\"),\n width: this.formatStyle(box.width, \"px\")\n });\n };\n}\nCueStyleBox.prototype = _objCreate(StyleBox.prototype);\nCueStyleBox.prototype.constructor = CueStyleBox;\n\n// Represents the co-ordinates of an Element in a way that we can easily\n// compute things with such as if it overlaps or intersects with another Element.\n// Can initialize it with either a StyleBox or another BoxPosition.\nfunction BoxPosition(obj) {\n var isIE8 = (/MSIE\\s8\\.0/).test(navigator.userAgent);\n\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n\n if (isIE8 && !this.lineHeight) {\n this.lineHeight = 13;\n }\n}\n\n// Move the box along a particular axis. Optionally pass in an amount to move\n// the box. If no amount is passed then the default is the line height of the\n// box.\nBoxPosition.prototype.move = function(axis, toMove) {\n toMove = toMove !== undefined ? toMove : this.lineHeight;\n switch (axis) {\n case \"+x\":\n this.left += toMove;\n this.right += toMove;\n break;\n case \"-x\":\n this.left -= toMove;\n this.right -= toMove;\n break;\n case \"+y\":\n this.top += toMove;\n this.bottom += toMove;\n break;\n case \"-y\":\n this.top -= toMove;\n this.bottom -= toMove;\n break;\n }\n};\n\n// Check if this box overlaps another box, b2.\nBoxPosition.prototype.overlaps = function(b2) {\n return this.left < b2.right &&\n this.right > b2.left &&\n this.top < b2.bottom &&\n this.bottom > b2.top;\n};\n\n// Check if this box overlaps any other boxes in boxes.\nBoxPosition.prototype.overlapsAny = function(boxes) {\n for (var i = 0; i < boxes.length; i++) {\n if (this.overlaps(boxes[i])) {\n return true;\n }\n }\n return false;\n};\n\n// Check if this box is within another box.\nBoxPosition.prototype.within = function(container) {\n return this.top >= container.top &&\n this.bottom <= container.bottom &&\n this.left >= container.left &&\n this.right <= container.right;\n};\n\n// Check if this box is entirely within the container or it is overlapping\n// on the edge opposite of the axis direction passed. For example, if \"+x\" is\n// passed and the box is overlapping on the left edge of the container, then\n// return true.\nBoxPosition.prototype.overlapsOppositeAxis = function(container, axis) {\n switch (axis) {\n case \"+x\":\n return this.left < container.left;\n case \"-x\":\n return this.right > container.right;\n case \"+y\":\n return this.top < container.top;\n case \"-y\":\n return this.bottom > container.bottom;\n }\n};\n\n// Find the percentage of the area that this box is overlapping with another\n// box.\nBoxPosition.prototype.intersectPercentage = function(b2) {\n var x = Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)),\n y = Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)),\n intersectArea = x * y;\n return intersectArea / (this.height * this.width);\n};\n\n// Convert the positions from this box to CSS compatible positions using\n// the reference container's positions. This has to be done because this\n// box's positions are in reference to the viewport origin, whereas, CSS\n// values are in referecne to their respective edges.\nBoxPosition.prototype.toCSSCompatValues = function(reference) {\n return {\n top: this.top - reference.top,\n bottom: reference.bottom - this.bottom,\n left: this.left - reference.left,\n right: reference.right - this.right,\n height: this.height,\n width: this.width\n };\n};\n\n// Get an object that represents the box's position without anything extra.\n// Can pass a StyleBox, HTMLElement, or another BoxPositon.\nBoxPosition.getSimpleBoxPosition = function(obj) {\n var height = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0;\n var width = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0;\n var top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0;\n\n obj = obj.div ? obj.div.getBoundingClientRect() :\n obj.tagName ? obj.getBoundingClientRect() : obj;\n var ret = {\n left: obj.left,\n right: obj.right,\n top: obj.top || top,\n height: obj.height || height,\n bottom: obj.bottom || (top + (obj.height || height)),\n width: obj.width || width\n };\n return ret;\n};\n\n// Move a StyleBox to its specified, or next best, position. The containerBox\n// is the box that contains the StyleBox, such as a div. boxPositions are\n// a list of other boxes that the styleBox can't overlap with.\nfunction moveBoxToLinePosition(window, styleBox, containerBox, boxPositions) {\n\n // Find the best position for a cue box, b, on the video. The axis parameter\n // is a list of axis, the order of which, it will move the box along. For example:\n // Passing [\"+x\", \"-x\"] will move the box first along the x axis in the positive\n // direction. If it doesn't find a good position for it there it will then move\n // it along the x axis in the negative direction.\n function findBestPosition(b, axis) {\n var bestPosition,\n specifiedPosition = new BoxPosition(b),\n percentage = 1; // Highest possible so the first thing we get is better.\n\n for (var i = 0; i < axis.length; i++) {\n while (b.overlapsOppositeAxis(containerBox, axis[i]) ||\n (b.within(containerBox) && b.overlapsAny(boxPositions))) {\n b.move(axis[i]);\n }\n // We found a spot where we aren't overlapping anything. This is our\n // best position.\n if (b.within(containerBox)) {\n return b;\n }\n var p = b.intersectPercentage(containerBox);\n // If we're outside the container box less then we were on our last try\n // then remember this position as the best position.\n if (percentage > p) {\n bestPosition = new BoxPosition(b);\n percentage = p;\n }\n // Reset the box position to the specified position.\n b = new BoxPosition(specifiedPosition);\n }\n return bestPosition || specifiedPosition;\n }\n\n var boxPosition = new BoxPosition(styleBox),\n cue = styleBox.cue,\n linePos = computeLinePos(cue),\n axis = [];\n\n // If we have a line number to align the cue to.\n if (cue.snapToLines) {\n var size;\n switch (cue.vertical) {\n case \"\":\n axis = [ \"+y\", \"-y\" ];\n size = \"height\";\n break;\n case \"rl\":\n axis = [ \"+x\", \"-x\" ];\n size = \"width\";\n break;\n case \"lr\":\n axis = [ \"-x\", \"+x\" ];\n size = \"width\";\n break;\n }\n\n var step = boxPosition.lineHeight,\n position = step * Math.round(linePos),\n maxPosition = containerBox[size] + step,\n initialAxis = axis[0];\n\n // If the specified intial position is greater then the max position then\n // clamp the box to the amount of steps it would take for the box to\n // reach the max position.\n if (Math.abs(position) > maxPosition) {\n position = position < 0 ? -1 : 1;\n position *= Math.ceil(maxPosition / step) * step;\n }\n\n // If computed line position returns negative then line numbers are\n // relative to the bottom of the video instead of the top. Therefore, we\n // need to increase our initial position by the length or width of the\n // video, depending on the writing direction, and reverse our axis directions.\n if (linePos < 0) {\n position += cue.vertical === \"\" ? containerBox.height : containerBox.width;\n axis = axis.reverse();\n }\n\n // Move the box to the specified position. This may not be its best\n // position.\n boxPosition.move(initialAxis, position);\n\n } else {\n // If we have a percentage line value for the cue.\n var calculatedPercentage = (boxPosition.lineHeight / containerBox.height) * 100;\n\n switch (cue.lineAlign) {\n case \"middle\":\n linePos -= (calculatedPercentage / 2);\n break;\n case \"end\":\n linePos -= calculatedPercentage;\n break;\n }\n\n // Apply initial line position to the cue box.\n switch (cue.vertical) {\n case \"\":\n styleBox.applyStyles({\n top: styleBox.formatStyle(linePos, \"%\")\n });\n break;\n case \"rl\":\n styleBox.applyStyles({\n left: styleBox.formatStyle(linePos, \"%\")\n });\n break;\n case \"lr\":\n styleBox.applyStyles({\n right: styleBox.formatStyle(linePos, \"%\")\n });\n break;\n }\n\n axis = [ \"+y\", \"-x\", \"+x\", \"-y\" ];\n\n // Get the box position again after we've applied the specified positioning\n // to it.\n boxPosition = new BoxPosition(styleBox);\n }\n\n var bestPosition = findBestPosition(boxPosition, axis);\n styleBox.move(bestPosition.toCSSCompatValues(containerBox));\n}\n\nfunction WebVTT() {\n // Nothing\n}\n\n// Helper to allow strings to be decoded instead of the default binary utf8 data.\nWebVTT.StringDecoder = function() {\n return {\n decode: function(data) {\n if (!data) {\n return \"\";\n }\n if (typeof data !== \"string\") {\n throw new Error(\"Error - expected string data.\");\n }\n return decodeURIComponent(encodeURIComponent(data));\n }\n };\n};\n\nWebVTT.convertCueToDOMTree = function(window, cuetext) {\n if (!window || !cuetext) {\n return null;\n }\n return parseContent(window, cuetext);\n};\n\nvar FONT_SIZE_PERCENT = 0.05;\nvar FONT_STYLE = \"sans-serif\";\nvar CUE_BACKGROUND_PADDING = \"1.5%\";\n\n// Runs the processing model over the cues and regions passed to it.\n// @param overlay A block level element (usually a div) that the computed cues\n// and regions will be placed into.\nWebVTT.processCues = function(window, cues, overlay) {\n if (!window || !cues || !overlay) {\n return null;\n }\n\n // Remove all previous children.\n while (overlay.firstChild) {\n overlay.removeChild(overlay.firstChild);\n }\n\n var paddedOverlay = window.document.createElement(\"div\");\n paddedOverlay.style.position = \"absolute\";\n paddedOverlay.style.left = \"0\";\n paddedOverlay.style.right = \"0\";\n paddedOverlay.style.top = \"0\";\n paddedOverlay.style.bottom = \"0\";\n paddedOverlay.style.margin = CUE_BACKGROUND_PADDING;\n overlay.appendChild(paddedOverlay);\n\n // Determine if we need to compute the display states of the cues. This could\n // be the case if a cue's state has been changed since the last computation or\n // if it has not been computed yet.\n function shouldCompute(cues) {\n for (var i = 0; i < cues.length; i++) {\n if (cues[i].hasBeenReset || !cues[i].displayState) {\n return true;\n }\n }\n return false;\n }\n\n // We don't need to recompute the cues' display states. Just reuse them.\n if (!shouldCompute(cues)) {\n for (var i = 0; i < cues.length; i++) {\n paddedOverlay.appendChild(cues[i].displayState);\n }\n return;\n }\n\n var boxPositions = [],\n containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay),\n fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100;\n var styleOptions = {\n font: fontSize + \"px \" + FONT_STYLE\n };\n\n (function() {\n var styleBox, cue;\n\n for (var i = 0; i < cues.length; i++) {\n cue = cues[i];\n\n // Compute the intial position and styles of the cue div.\n styleBox = new CueStyleBox(window, cue, styleOptions);\n paddedOverlay.appendChild(styleBox.div);\n\n // Move the cue div to it's correct line position.\n moveBoxToLinePosition(window, styleBox, containerBox, boxPositions);\n\n // Remember the computed div so that we don't have to recompute it later\n // if we don't have too.\n cue.displayState = styleBox.div;\n\n boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox));\n }\n })();\n};\n\nWebVTT.Parser = function(window, vttjs, decoder) {\n if (!decoder) {\n decoder = vttjs;\n vttjs = {};\n }\n if (!vttjs) {\n vttjs = {};\n }\n\n this.window = window;\n this.vttjs = vttjs;\n this.state = \"INITIAL\";\n this.buffer = \"\";\n this.decoder = decoder || new TextDecoder(\"utf8\");\n this.regionList = [];\n};\n\nWebVTT.Parser.prototype = {\n // If the error is a ParsingError then report it to the consumer if\n // possible. If it's not a ParsingError then throw it like normal.\n reportOrThrowError: function(e) {\n if (e instanceof ParsingError) {\n this.onparsingerror && this.onparsingerror(e);\n } else {\n throw e;\n }\n },\n parse: function (data) {\n var self = this;\n\n // If there is no data then we won't decode it, but will just try to parse\n // whatever is in buffer already. This may occur in circumstances, for\n // example when flush() is called.\n if (data) {\n // Try to decode the data that we received.\n self.buffer += self.decoder.decode(data, {stream: true});\n }\n\n function collectNextLine() {\n var buffer = self.buffer;\n var pos = 0;\n while (pos < buffer.length && buffer[pos] !== '\\r' && buffer[pos] !== '\\n') {\n ++pos;\n }\n var line = buffer.substr(0, pos);\n // Advance the buffer early in case we fail below.\n if (buffer[pos] === '\\r') {\n ++pos;\n }\n if (buffer[pos] === '\\n') {\n ++pos;\n }\n self.buffer = buffer.substr(pos);\n return line;\n }\n\n // 3.4 WebVTT region and WebVTT region settings syntax\n function parseRegion(input) {\n var settings = new Settings();\n\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"id\":\n settings.set(k, v);\n break;\n case \"width\":\n settings.percent(k, v);\n break;\n case \"lines\":\n settings.integer(k, v);\n break;\n case \"regionanchor\":\n case \"viewportanchor\":\n var xy = v.split(',');\n if (xy.length !== 2) {\n break;\n }\n // We have to make sure both x and y parse, so use a temporary\n // settings object here.\n var anchor = new Settings();\n anchor.percent(\"x\", xy[0]);\n anchor.percent(\"y\", xy[1]);\n if (!anchor.has(\"x\") || !anchor.has(\"y\")) {\n break;\n }\n settings.set(k + \"X\", anchor.get(\"x\"));\n settings.set(k + \"Y\", anchor.get(\"y\"));\n break;\n case \"scroll\":\n settings.alt(k, v, [\"up\"]);\n break;\n }\n }, /=/, /\\s/);\n\n // Create the region, using default values for any values that were not\n // specified.\n if (settings.has(\"id\")) {\n var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)();\n region.width = settings.get(\"width\", 100);\n region.lines = settings.get(\"lines\", 3);\n region.regionAnchorX = settings.get(\"regionanchorX\", 0);\n region.regionAnchorY = settings.get(\"regionanchorY\", 100);\n region.viewportAnchorX = settings.get(\"viewportanchorX\", 0);\n region.viewportAnchorY = settings.get(\"viewportanchorY\", 100);\n region.scroll = settings.get(\"scroll\", \"\");\n // Register the region.\n self.onregion && self.onregion(region);\n // Remember the VTTRegion for later in case we parse any VTTCues that\n // reference it.\n self.regionList.push({\n id: settings.get(\"id\"),\n region: region\n });\n }\n }\n\n // draft-pantos-http-live-streaming-20\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-3.5\n // 3.5 WebVTT\n function parseTimestampMap(input) {\n var settings = new Settings();\n\n parseOptions(input, function(k, v) {\n switch(k) {\n case \"MPEGT\":\n settings.integer(k + 'S', v);\n break;\n case \"LOCA\":\n settings.set(k + 'L', parseTimeStamp(v));\n break;\n }\n }, /[^\\d]:/, /,/);\n\n self.ontimestampmap && self.ontimestampmap({\n \"MPEGTS\": settings.get(\"MPEGTS\"),\n \"LOCAL\": settings.get(\"LOCAL\")\n });\n }\n\n // 3.2 WebVTT metadata header syntax\n function parseHeader(input) {\n if (input.match(/X-TIMESTAMP-MAP/)) {\n // This line contains HLS X-TIMESTAMP-MAP metadata\n parseOptions(input, function(k, v) {\n switch(k) {\n case \"X-TIMESTAMP-MAP\":\n parseTimestampMap(v);\n break;\n }\n }, /=/);\n } else {\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"Region\":\n // 3.3 WebVTT region metadata header syntax\n parseRegion(v);\n break;\n }\n }, /:/);\n }\n\n }\n\n // 5.1 WebVTT file parsing.\n try {\n var line;\n if (self.state === \"INITIAL\") {\n // We can't start parsing until we have the first line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n line = collectNextLine();\n\n var m = line.match(/^WEBVTT([ \\t].*)?$/);\n if (!m || !m[0]) {\n throw new ParsingError(ParsingError.Errors.BadSignature);\n }\n\n self.state = \"HEADER\";\n }\n\n var alreadyCollectedLine = false;\n while (self.buffer) {\n // We can't parse a line until we have the full line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n if (!alreadyCollectedLine) {\n line = collectNextLine();\n } else {\n alreadyCollectedLine = false;\n }\n\n switch (self.state) {\n case \"HEADER\":\n // 13-18 - Allow a header (metadata) under the WEBVTT line.\n if (/:/.test(line)) {\n parseHeader(line);\n } else if (!line) {\n // An empty line terminates the header and starts the body (cues).\n self.state = \"ID\";\n }\n continue;\n case \"NOTE\":\n // Ignore NOTE blocks.\n if (!line) {\n self.state = \"ID\";\n }\n continue;\n case \"ID\":\n // Check for the start of NOTE blocks.\n if (/^NOTE($|[ \\t])/.test(line)) {\n self.state = \"NOTE\";\n break;\n }\n // 19-29 - Allow any number of line terminators, then initialize new cue values.\n if (!line) {\n continue;\n }\n self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, \"\");\n self.state = \"CUE\";\n // 30-39 - Check if self line contains an optional identifier or timing data.\n if (line.indexOf(\"-->\") === -1) {\n self.cue.id = line;\n continue;\n }\n // Process line as start of a cue.\n /*falls through*/\n case \"CUE\":\n // 40 - Collect cue timings and settings.\n try {\n parseCue(line, self.cue, self.regionList);\n } catch (e) {\n self.reportOrThrowError(e);\n // In case of an error ignore rest of the cue.\n self.cue = null;\n self.state = \"BADCUE\";\n continue;\n }\n self.state = \"CUETEXT\";\n continue;\n case \"CUETEXT\":\n var hasSubstring = line.indexOf(\"-->\") !== -1;\n // 34 - If we have an empty line then report the cue.\n // 35 - If we have the special substring '-->' then report the cue,\n // but do not collect the line as we need to process the current\n // one as a new cue.\n if (!line || hasSubstring && (alreadyCollectedLine = true)) {\n // We are done parsing self cue.\n self.oncue && self.oncue(self.cue);\n self.cue = null;\n self.state = \"ID\";\n continue;\n }\n if (self.cue.text) {\n self.cue.text += \"\\n\";\n }\n self.cue.text += line;\n continue;\n case \"BADCUE\": // BADCUE\n // 54-62 - Collect and discard the remaining cue.\n if (!line) {\n self.state = \"ID\";\n }\n continue;\n }\n }\n } catch (e) {\n self.reportOrThrowError(e);\n\n // If we are currently parsing a cue, report what we have.\n if (self.state === \"CUETEXT\" && self.cue && self.oncue) {\n self.oncue(self.cue);\n }\n self.cue = null;\n // Enter BADWEBVTT state if header was not parsed correctly otherwise\n // another exception occurred so enter BADCUE state.\n self.state = self.state === \"INITIAL\" ? \"BADWEBVTT\" : \"BADCUE\";\n }\n return this;\n },\n flush: function () {\n var self = this;\n try {\n // Finish decoding the stream.\n self.buffer += self.decoder.decode();\n // Synthesize the end of the current cue or region.\n if (self.cue || self.state === \"HEADER\") {\n self.buffer += \"\\n\\n\";\n self.parse();\n }\n // If we've flushed, parsed, and we're still on the INITIAL state then\n // that means we don't have enough of the stream to parse the first\n // line.\n if (self.state === \"INITIAL\") {\n throw new ParsingError(ParsingError.Errors.BadSignature);\n }\n } catch(e) {\n self.reportOrThrowError(e);\n }\n self.onflush && self.onflush();\n return this;\n }\n};\n\nmodule.exports = WebVTT;\n","/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar autoKeyword = \"auto\";\nvar directionSetting = {\n \"\": true,\n \"lr\": true,\n \"rl\": true\n};\nvar alignSetting = {\n \"start\": true,\n \"middle\": true,\n \"end\": true,\n \"left\": true,\n \"right\": true\n};\n\nfunction findDirectionSetting(value) {\n if (typeof value !== \"string\") {\n return false;\n }\n var dir = directionSetting[value.toLowerCase()];\n return dir ? value.toLowerCase() : false;\n}\n\nfunction findAlignSetting(value) {\n if (typeof value !== \"string\") {\n return false;\n }\n var align = alignSetting[value.toLowerCase()];\n return align ? value.toLowerCase() : false;\n}\n\nfunction extend(obj) {\n var i = 1;\n for (; i < arguments.length; i++) {\n var cobj = arguments[i];\n for (var p in cobj) {\n obj[p] = cobj[p];\n }\n }\n\n return obj;\n}\n\nfunction VTTCue(startTime, endTime, text) {\n var cue = this;\n var isIE8 = (/MSIE\\s8\\.0/).test(navigator.userAgent);\n var baseObj = {};\n\n if (isIE8) {\n cue = document.createElement('custom');\n } else {\n baseObj.enumerable = true;\n }\n\n /**\n * Shim implementation specific properties. These properties are not in\n * the spec.\n */\n\n // Lets us know when the VTTCue's data has changed in such a way that we need\n // to recompute its display state. This lets us compute its display state\n // lazily.\n cue.hasBeenReset = false;\n\n /**\n * VTTCue and TextTrackCue properties\n * http://dev.w3.org/html5/webvtt/#vttcue-interface\n */\n\n var _id = \"\";\n var _pauseOnExit = false;\n var _startTime = startTime;\n var _endTime = endTime;\n var _text = text;\n var _region = null;\n var _vertical = \"\";\n var _snapToLines = true;\n var _line = \"auto\";\n var _lineAlign = \"start\";\n var _position = 50;\n var _positionAlign = \"middle\";\n var _size = 50;\n var _align = \"middle\";\n\n Object.defineProperty(cue,\n \"id\", extend({}, baseObj, {\n get: function() {\n return _id;\n },\n set: function(value) {\n _id = \"\" + value;\n }\n }));\n\n Object.defineProperty(cue,\n \"pauseOnExit\", extend({}, baseObj, {\n get: function() {\n return _pauseOnExit;\n },\n set: function(value) {\n _pauseOnExit = !!value;\n }\n }));\n\n Object.defineProperty(cue,\n \"startTime\", extend({}, baseObj, {\n get: function() {\n return _startTime;\n },\n set: function(value) {\n if (typeof value !== \"number\") {\n throw new TypeError(\"Start time must be set to a number.\");\n }\n _startTime = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"endTime\", extend({}, baseObj, {\n get: function() {\n return _endTime;\n },\n set: function(value) {\n if (typeof value !== \"number\") {\n throw new TypeError(\"End time must be set to a number.\");\n }\n _endTime = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"text\", extend({}, baseObj, {\n get: function() {\n return _text;\n },\n set: function(value) {\n _text = \"\" + value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"region\", extend({}, baseObj, {\n get: function() {\n return _region;\n },\n set: function(value) {\n _region = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"vertical\", extend({}, baseObj, {\n get: function() {\n return _vertical;\n },\n set: function(value) {\n var setting = findDirectionSetting(value);\n // Have to check for false because the setting an be an empty string.\n if (setting === false) {\n throw new SyntaxError(\"An invalid or illegal string was specified.\");\n }\n _vertical = setting;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"snapToLines\", extend({}, baseObj, {\n get: function() {\n return _snapToLines;\n },\n set: function(value) {\n _snapToLines = !!value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"line\", extend({}, baseObj, {\n get: function() {\n return _line;\n },\n set: function(value) {\n if (typeof value !== \"number\" && value !== autoKeyword) {\n throw new SyntaxError(\"An invalid number or illegal string was specified.\");\n }\n _line = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"lineAlign\", extend({}, baseObj, {\n get: function() {\n return _lineAlign;\n },\n set: function(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError(\"An invalid or illegal string was specified.\");\n }\n _lineAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"position\", extend({}, baseObj, {\n get: function() {\n return _position;\n },\n set: function(value) {\n if (value < 0 || value > 100) {\n throw new Error(\"Position must be between 0 and 100.\");\n }\n _position = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"positionAlign\", extend({}, baseObj, {\n get: function() {\n return _positionAlign;\n },\n set: function(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError(\"An invalid or illegal string was specified.\");\n }\n _positionAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"size\", extend({}, baseObj, {\n get: function() {\n return _size;\n },\n set: function(value) {\n if (value < 0 || value > 100) {\n throw new Error(\"Size must be between 0 and 100.\");\n }\n _size = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue,\n \"align\", extend({}, baseObj, {\n get: function() {\n return _align;\n },\n set: function(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError(\"An invalid or illegal string was specified.\");\n }\n _align = setting;\n this.hasBeenReset = true;\n }\n }));\n\n /**\n * Other spec defined properties\n */\n\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state\n cue.displayState = undefined;\n\n if (isIE8) {\n return cue;\n }\n}\n\n/**\n * VTTCue methods\n */\n\nVTTCue.prototype.getCueAsHTML = function() {\n // Assume WebVTT.convertCueToDOMTree is on the global.\n return WebVTT.convertCueToDOMTree(window, this.text);\n};\n\nmodule.exports = VTTCue;\n","/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar scrollSetting = {\n \"\": true,\n \"up\": true\n};\n\nfunction findScrollSetting(value) {\n if (typeof value !== \"string\") {\n return false;\n }\n var scroll = scrollSetting[value.toLowerCase()];\n return scroll ? value.toLowerCase() : false;\n}\n\nfunction isValidPercentValue(value) {\n return typeof value === \"number\" && (value >= 0 && value <= 100);\n}\n\n// VTTRegion shim http://dev.w3.org/html5/webvtt/#vttregion-interface\nfunction VTTRegion() {\n var _width = 100;\n var _lines = 3;\n var _regionAnchorX = 0;\n var _regionAnchorY = 100;\n var _viewportAnchorX = 0;\n var _viewportAnchorY = 100;\n var _scroll = \"\";\n\n Object.defineProperties(this, {\n \"width\": {\n enumerable: true,\n get: function() {\n return _width;\n },\n set: function(value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"Width must be between 0 and 100.\");\n }\n _width = value;\n }\n },\n \"lines\": {\n enumerable: true,\n get: function() {\n return _lines;\n },\n set: function(value) {\n if (typeof value !== \"number\") {\n throw new TypeError(\"Lines must be set to a number.\");\n }\n _lines = value;\n }\n },\n \"regionAnchorY\": {\n enumerable: true,\n get: function() {\n return _regionAnchorY;\n },\n set: function(value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"RegionAnchorX must be between 0 and 100.\");\n }\n _regionAnchorY = value;\n }\n },\n \"regionAnchorX\": {\n enumerable: true,\n get: function() {\n return _regionAnchorX;\n },\n set: function(value) {\n if(!isValidPercentValue(value)) {\n throw new Error(\"RegionAnchorY must be between 0 and 100.\");\n }\n _regionAnchorX = value;\n }\n },\n \"viewportAnchorY\": {\n enumerable: true,\n get: function() {\n return _viewportAnchorY;\n },\n set: function(value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"ViewportAnchorY must be between 0 and 100.\");\n }\n _viewportAnchorY = value;\n }\n },\n \"viewportAnchorX\": {\n enumerable: true,\n get: function() {\n return _viewportAnchorX;\n },\n set: function(value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"ViewportAnchorX must be between 0 and 100.\");\n }\n _viewportAnchorX = value;\n }\n },\n \"scroll\": {\n enumerable: true,\n get: function() {\n return _scroll;\n },\n set: function(value) {\n var setting = findScrollSetting(value);\n // Have to check for false as an empty string is a legal value.\n if (setting === false) {\n throw new SyntaxError(\"An invalid or illegal string was specified.\");\n }\n _scroll = setting;\n }\n }\n });\n}\n\nmodule.exports = VTTRegion;\n","/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Default exports for Node. Export the extended versions of VTTCue and\n// VTTRegion in Node since we likely want the capability to convert back and\n// forth between JSON. If we don't then it's not that big of a deal since we're\n// off browser.\n\nvar window = require('global/window');\n\nvar vttjs = module.exports = {\n WebVTT: require(\"./vtt.js\"),\n VTTCue: require(\"./vttcue.js\"),\n VTTRegion: require(\"./vttregion.js\")\n};\n\nwindow.vttjs = vttjs;\nwindow.WebVTT = vttjs.WebVTT;\n\nvar cueShim = vttjs.VTTCue;\nvar regionShim = vttjs.VTTRegion;\nvar nativeVTTCue = window.VTTCue;\nvar nativeVTTRegion = window.VTTRegion;\n\nvttjs.shim = function() {\n window.VTTCue = cueShim;\n window.VTTRegion = regionShim;\n};\n\nvttjs.restore = function() {\n window.VTTCue = nativeVTTCue;\n window.VTTRegion = nativeVTTRegion;\n};\n\nif (!window.VTTCue) {\n vttjs.shim();\n}\n","'use strict';\n\nexports.__esModule = true;\n\nvar _component = require('../component');\n\nvar _component2 = _interopRequireDefault(_component);\n\nvar _htmlTrackElement = require('../tracks/html-track-element');\n\nvar _htmlTrackElement2 = _interopRequireDefault(_htmlTrackElement);\n\nvar _htmlTrackElementList = require('../tracks/html-track-element-list');\n\nvar _htmlTrackElementList2 = _interopRequireDefault(_htmlTrackElementList);\n\nvar _mergeOptions = require('../utils/merge-options.js');\n\nvar _mergeOptions2 = _interopRequireDefault(_mergeOptions);\n\nvar _textTrack = require('../tracks/text-track');\n\nvar _textTrack2 = _interopRequireDefault(_textTrack);\n\nvar _textTrackList = require('../tracks/text-track-list');\n\nvar _textTrackList2 = _interopRequireDefault(_textTrackList);\n\nvar _videoTrackList = require('../tracks/video-track-list');\n\nvar _videoTrackList2 = _interopRequireDefault(_videoTrackList);\n\nvar _audioTrackList = require('../tracks/audio-track-list');\n\nvar _audioTrackList2 = _interopRequireDefault(_audioTrackList);\n\nvar _fn = require('../utils/fn.js');\n\nvar Fn = _interopRequireWildcard(_fn);\n\nvar _log = require('../utils/log.js');\n\nvar _log2 = _interopRequireDefault(_log);\n\nvar _timeRanges = require('../utils/time-ranges.js');\n\nvar _buffer = require('../utils/buffer.js');\n\nvar _mediaError = require('../media-error.js');\n\nvar _mediaError2 = _interopRequireDefault(_mediaError);\n\nvar _window = require('global/window');\n\nvar _window2 = _interopRequireDefault(_window);\n\nvar _document = require('global/document');\n\nvar _document2 = _interopRequireDefault(_document);\n\nvar _obj = require('../utils/obj');\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file tech.js\n */\n\n/**\n * An Object containing a structure like: `{src: 'url', type: 'mimetype'}` or string\n * that just contains the src url alone.\n * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};`\n * `var SourceString = 'http://example.com/some-video.mp4';`\n *\n * @typedef {Object|string} Tech~SourceObject\n *\n * @property {string} src\n * The url to the source\n *\n * @property {string} type\n * The mime type of the source\n */\n\n/**\n * A function used by {@link Tech} to create a new {@link TextTrack}.\n *\n * @param {Tech} self\n * An instance of the Tech class.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @param {Object} [options={}]\n * An object with additional text track options\n *\n * @return {TextTrack}\n * The text track that was created.\n */\nfunction createTrackHelper(self, kind, label, language) {\n var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n\n var tracks = self.textTracks();\n\n options.kind = kind;\n\n if (label) {\n options.label = label;\n }\n if (language) {\n options.language = language;\n }\n options.tech = self;\n\n var track = new _textTrack2['default'](options);\n\n tracks.addTrack_(track);\n\n return track;\n}\n\n/**\n * This is the base class for media playback technology controllers, such as\n * {@link Flash} and {@link HTML5}\n *\n * @extends Component\n */\n\nvar Tech = function (_Component) {\n _inherits(Tech, _Component);\n\n /**\n * Create an instance of this Tech.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} ready\n * Callback function to call when the `HTML5` Tech is ready.\n */\n function Tech() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var ready = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};\n\n _classCallCheck(this, Tech);\n\n // we don't want the tech to report user activity automatically.\n // This is done manually in addControlsListeners\n options.reportTouchActivity = false;\n\n // keep track of whether the current source has played at all to\n // implement a very limited played()\n var _this = _possibleConstructorReturn(this, _Component.call(this, null, options, ready));\n\n _this.hasStarted_ = false;\n _this.on('playing', function () {\n this.hasStarted_ = true;\n });\n _this.on('loadstart', function () {\n this.hasStarted_ = false;\n });\n\n _this.textTracks_ = options.textTracks;\n _this.videoTracks_ = options.videoTracks;\n _this.audioTracks_ = options.audioTracks;\n\n // Manually track progress in cases where the browser/flash player doesn't report it.\n if (!_this.featuresProgressEvents) {\n _this.manualProgressOn();\n }\n\n // Manually track timeupdates in cases where the browser/flash player doesn't report it.\n if (!_this.featuresTimeupdateEvents) {\n _this.manualTimeUpdatesOn();\n }\n\n ['Text', 'Audio', 'Video'].forEach(function (track) {\n if (options['native' + track + 'Tracks'] === false) {\n _this['featuresNative' + track + 'Tracks'] = false;\n }\n });\n\n if (options.nativeCaptions === false) {\n _this.featuresNativeTextTracks = false;\n }\n\n if (!_this.featuresNativeTextTracks) {\n _this.emulateTextTracks();\n }\n\n _this.autoRemoteTextTracks_ = new _textTrackList2['default']();\n\n _this.initTextTrackListeners();\n _this.initTrackListeners();\n\n // Turn on component tap events only if not using native controls\n if (!options.nativeControlsForTouch) {\n _this.emitTapEvents();\n }\n\n if (_this.constructor) {\n _this.name_ = _this.constructor.name || 'Unknown Tech';\n }\n return _this;\n }\n\n /* Fallbacks for unsupported event types\n ================================================================================ */\n\n /**\n * Polyfill the `progress` event for browsers that don't support it natively.\n *\n * @see {@link Tech#trackProgress}\n */\n\n\n Tech.prototype.manualProgressOn = function manualProgressOn() {\n this.on('durationchange', this.onDurationChange);\n\n this.manualProgress = true;\n\n // Trigger progress watching when a source begins loading\n this.one('ready', this.trackProgress);\n };\n\n /**\n * Turn off the polyfill for `progress` events that was created in\n * {@link Tech#manualProgressOn}\n */\n\n\n Tech.prototype.manualProgressOff = function manualProgressOff() {\n this.manualProgress = false;\n this.stopTrackingProgress();\n\n this.off('durationchange', this.onDurationChange);\n };\n\n /**\n * This is used to trigger a `progress` event when the buffered percent changes. It\n * sets an interval function that will be called every 500 milliseconds to check if the\n * buffer end percent has changed.\n *\n * > This function is called by {@link Tech#manualProgressOn}\n *\n * @param {EventTarget~Event} event\n * The `ready` event that caused this to run.\n *\n * @listens Tech#ready\n * @fires Tech#progress\n */\n\n\n Tech.prototype.trackProgress = function trackProgress(event) {\n this.stopTrackingProgress();\n this.progressInterval = this.setInterval(Fn.bind(this, function () {\n // Don't trigger unless buffered amount is greater than last time\n\n var numBufferedPercent = this.bufferedPercent();\n\n if (this.bufferedPercent_ !== numBufferedPercent) {\n /**\n * See {@link Player#progress}\n *\n * @event Tech#progress\n * @type {EventTarget~Event}\n */\n this.trigger('progress');\n }\n\n this.bufferedPercent_ = numBufferedPercent;\n\n if (numBufferedPercent === 1) {\n this.stopTrackingProgress();\n }\n }), 500);\n };\n\n /**\n * Update our internal duration on a `durationchange` event by calling\n * {@link Tech#duration}.\n *\n * @param {EventTarget~Event} event\n * The `durationchange` event that caused this to run.\n *\n * @listens Tech#durationchange\n */\n\n\n Tech.prototype.onDurationChange = function onDurationChange(event) {\n this.duration_ = this.duration();\n };\n\n /**\n * Get and create a `TimeRange` object for buffering.\n *\n * @return {TimeRange}\n * The time range object that was created.\n */\n\n\n Tech.prototype.buffered = function buffered() {\n return (0, _timeRanges.createTimeRange)(0, 0);\n };\n\n /**\n * Get the percentage of the current video that is currently buffered.\n *\n * @return {number}\n * A number from 0 to 1 that represents the decimal percentage of the\n * video that is buffered.\n *\n */\n\n\n Tech.prototype.bufferedPercent = function bufferedPercent() {\n return (0, _buffer.bufferedPercent)(this.buffered(), this.duration_);\n };\n\n /**\n * Turn off the polyfill for `progress` events that was created in\n * {@link Tech#manualProgressOn}\n * Stop manually tracking progress events by clearing the interval that was set in\n * {@link Tech#trackProgress}.\n */\n\n\n Tech.prototype.stopTrackingProgress = function stopTrackingProgress() {\n this.clearInterval(this.progressInterval);\n };\n\n /**\n * Polyfill the `timeupdate` event for browsers that don't support it.\n *\n * @see {@link Tech#trackCurrentTime}\n */\n\n\n Tech.prototype.manualTimeUpdatesOn = function manualTimeUpdatesOn() {\n this.manualTimeUpdates = true;\n\n this.on('play', this.trackCurrentTime);\n this.on('pause', this.stopTrackingCurrentTime);\n };\n\n /**\n * Turn off the polyfill for `timeupdate` events that was created in\n * {@link Tech#manualTimeUpdatesOn}\n */\n\n\n Tech.prototype.manualTimeUpdatesOff = function manualTimeUpdatesOff() {\n this.manualTimeUpdates = false;\n this.stopTrackingCurrentTime();\n this.off('play', this.trackCurrentTime);\n this.off('pause', this.stopTrackingCurrentTime);\n };\n\n /**\n * Sets up an interval function to track current time and trigger `timeupdate` every\n * 250 milliseconds.\n *\n * @listens Tech#play\n * @triggers Tech#timeupdate\n */\n\n\n Tech.prototype.trackCurrentTime = function trackCurrentTime() {\n if (this.currentTimeInterval) {\n this.stopTrackingCurrentTime();\n }\n this.currentTimeInterval = this.setInterval(function () {\n /**\n * Triggered at an interval of 250ms to indicated that time is passing in the video.\n *\n * @event Tech#timeupdate\n * @type {EventTarget~Event}\n */\n this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true });\n\n // 42 = 24 fps // 250 is what Webkit uses // FF uses 15\n }, 250);\n };\n\n /**\n * Stop the interval function created in {@link Tech#trackCurrentTime} so that the\n * `timeupdate` event is no longer triggered.\n *\n * @listens {Tech#pause}\n */\n\n\n Tech.prototype.stopTrackingCurrentTime = function stopTrackingCurrentTime() {\n this.clearInterval(this.currentTimeInterval);\n\n // #1002 - if the video ends right before the next timeupdate would happen,\n // the progress bar won't make it all the way to the end\n this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true });\n };\n\n /**\n * Turn off all event polyfills, clear the `Tech`s {@link AudioTrackList},\n * {@link VideoTrackList}, and {@link TextTrackList}, and dispose of this Tech.\n *\n * @fires Component#dispose\n */\n\n\n Tech.prototype.dispose = function dispose() {\n\n // clear out all tracks because we can't reuse them between techs\n this.clearTracks(['audio', 'video', 'text']);\n\n // Turn off any manual progress or timeupdate tracking\n if (this.manualProgress) {\n this.manualProgressOff();\n }\n\n if (this.manualTimeUpdates) {\n this.manualTimeUpdatesOff();\n }\n\n _Component.prototype.dispose.call(this);\n };\n\n /**\n * Clear out a single `TrackList` or an array of `TrackLists` given their names.\n *\n * > Note: Techs without source handlers should call this between sources for `video`\n * & `audio` tracks. You don't want to use them between tracks!\n *\n * @param {string[]|string} types\n * TrackList names to clear, valid names are `video`, `audio`, and\n * `text`.\n */\n\n\n Tech.prototype.clearTracks = function clearTracks(types) {\n var _this2 = this;\n\n types = [].concat(types);\n // clear out all tracks because we can't reuse them between techs\n types.forEach(function (type) {\n var list = _this2[type + 'Tracks']() || [];\n var i = list.length;\n\n while (i--) {\n var track = list[i];\n\n if (type === 'text') {\n _this2.removeRemoteTextTrack(track);\n }\n list.removeTrack_(track);\n }\n });\n };\n\n /**\n * Remove any TextTracks added via addRemoteTextTrack that are\n * flagged for automatic garbage collection\n */\n\n\n Tech.prototype.cleanupAutoTextTracks = function cleanupAutoTextTracks() {\n var list = this.autoRemoteTextTracks_ || [];\n var i = list.length;\n\n while (i--) {\n var track = list[i];\n\n this.removeRemoteTextTrack(track);\n }\n };\n\n /**\n * Reset the tech, which will removes all sources and reset the internal readyState.\n *\n * @abstract\n */\n\n\n Tech.prototype.reset = function reset() {};\n\n /**\n * Get or set an error on the Tech.\n *\n * @param {MediaError} [err]\n * Error to set on the Tech\n *\n * @return {MediaError|null}\n * The current error object on the tech, or null if there isn't one.\n */\n\n\n Tech.prototype.error = function error(err) {\n if (err !== undefined) {\n this.error_ = new _mediaError2['default'](err);\n this.trigger('error');\n }\n return this.error_;\n };\n\n /**\n * Returns the `TimeRange`s that have been played through for the current source.\n *\n * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`.\n * It only checks wether the source has played at all or not.\n *\n * @return {TimeRange}\n * - A single time range if this video has played\n * - An empty set of ranges if not.\n */\n\n\n Tech.prototype.played = function played() {\n if (this.hasStarted_) {\n return (0, _timeRanges.createTimeRange)(0, 0);\n }\n return (0, _timeRanges.createTimeRange)();\n };\n\n /**\n * Causes a manual time update to occur if {@link Tech#manualTimeUpdatesOn} was\n * previously called.\n *\n * @fires Tech#timeupdate\n */\n\n\n Tech.prototype.setCurrentTime = function setCurrentTime() {\n // improve the accuracy of manual timeupdates\n if (this.manualTimeUpdates) {\n /**\n * A manual `timeupdate` event.\n *\n * @event Tech#timeupdate\n * @type {EventTarget~Event}\n */\n this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true });\n }\n };\n\n /**\n * Turn on listeners for {@link TextTrackList} events. This adds\n * {@link EventTarget~EventListeners} for `texttrackchange`, `addtrack` and\n * `removetrack`.\n *\n * @fires Tech#texttrackchange\n */\n\n\n Tech.prototype.initTextTrackListeners = function initTextTrackListeners() {\n var textTrackListChanges = Fn.bind(this, function () {\n /**\n * Triggered when tracks are added or removed on the Tech {@link TextTrackList}\n *\n * @event Tech#texttrackchange\n * @type {EventTarget~Event}\n */\n this.trigger('texttrackchange');\n });\n\n var tracks = this.textTracks();\n\n if (!tracks) {\n return;\n }\n\n tracks.addEventListener('removetrack', textTrackListChanges);\n tracks.addEventListener('addtrack', textTrackListChanges);\n\n this.on('dispose', Fn.bind(this, function () {\n tracks.removeEventListener('removetrack', textTrackListChanges);\n tracks.removeEventListener('addtrack', textTrackListChanges);\n }));\n };\n\n /**\n * Turn on listeners for {@link VideoTrackList} and {@link {AudioTrackList} events.\n * This adds {@link EventTarget~EventListeners} for `addtrack`, and `removetrack`.\n *\n * @fires Tech#audiotrackchange\n * @fires Tech#videotrackchange\n */\n\n\n Tech.prototype.initTrackListeners = function initTrackListeners() {\n var _this3 = this;\n\n var trackTypes = ['video', 'audio'];\n\n trackTypes.forEach(function (type) {\n /**\n * Triggered when tracks are added or removed on the Tech {@link AudioTrackList}\n *\n * @event Tech#audiotrackchange\n * @type {EventTarget~Event}\n */\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link VideoTrackList}\n *\n * @event Tech#videotrackchange\n * @type {EventTarget~Event}\n */\n var trackListChanges = function trackListChanges() {\n _this3.trigger(type + 'trackchange');\n };\n\n var tracks = _this3[type + 'Tracks']();\n\n tracks.addEventListener('removetrack', trackListChanges);\n tracks.addEventListener('addtrack', trackListChanges);\n\n _this3.on('dispose', function () {\n tracks.removeEventListener('removetrack', trackListChanges);\n tracks.removeEventListener('addtrack', trackListChanges);\n });\n });\n };\n\n /**\n * Emulate TextTracks using vtt.js if necessary\n *\n * @fires Tech#vttjsloaded\n * @fires Tech#vttjserror\n */\n\n\n Tech.prototype.addWebVttScript_ = function addWebVttScript_() {\n var _this4 = this;\n\n if (_window2['default'].WebVTT) {\n return;\n }\n\n // Initially, Tech.el_ is a child of a dummy-div wait until the Component system\n // signals that the Tech is ready at which point Tech.el_ is part of the DOM\n // before inserting the WebVTT script\n if (_document2['default'].body.contains(this.el())) {\n var vtt = require('videojs-vtt.js');\n\n // load via require if available and vtt.js script location was not passed in\n // as an option. novtt builds will turn the above require call into an empty object\n // which will cause this if check to always fail.\n if (!this.options_['vtt.js'] && (0, _obj.isPlain)(vtt) && Object.keys(vtt).length > 0) {\n this.trigger('vttjsloaded');\n return;\n }\n\n // load vtt.js via the script location option or the cdn of no location was\n // passed in\n var script = _document2['default'].createElement('script');\n\n script.src = this.options_['vtt.js'] || 'https://vjs.zencdn.net/vttjs/0.12.4/vtt.min.js';\n script.onload = function () {\n /**\n * Fired when vtt.js is loaded.\n *\n * @event Tech#vttjsloaded\n * @type {EventTarget~Event}\n */\n _this4.trigger('vttjsloaded');\n };\n script.onerror = function () {\n /**\n * Fired when vtt.js was not loaded due to an error\n *\n * @event Tech#vttjsloaded\n * @type {EventTarget~Event}\n */\n _this4.trigger('vttjserror');\n };\n this.on('dispose', function () {\n script.onload = null;\n script.onerror = null;\n });\n // but have not loaded yet and we set it to true before the inject so that\n // we don't overwrite the injected window.WebVTT if it loads right away\n _window2['default'].WebVTT = true;\n this.el().parentNode.appendChild(script);\n } else {\n this.ready(this.addWebVttScript_);\n }\n };\n\n /**\n * Emulate texttracks\n *\n * @method emulateTextTracks\n */\n\n\n Tech.prototype.emulateTextTracks = function emulateTextTracks() {\n var _this5 = this;\n\n var tracks = this.textTracks();\n\n if (!tracks) {\n return;\n }\n\n var remoteTracks = this.remoteTextTracks();\n var handleAddTrack = function handleAddTrack(e) {\n return tracks.addTrack_(e.track);\n };\n var handleRemoveTrack = function handleRemoveTrack(e) {\n return tracks.removeTrack_(e.track);\n };\n\n remoteTracks.on('addtrack', handleAddTrack);\n remoteTracks.on('removetrack', handleRemoveTrack);\n\n this.addWebVttScript_();\n\n var updateDisplay = function updateDisplay() {\n return _this5.trigger('texttrackchange');\n };\n\n var textTracksChanges = function textTracksChanges() {\n updateDisplay();\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i];\n\n track.removeEventListener('cuechange', updateDisplay);\n if (track.mode === 'showing') {\n track.addEventListener('cuechange', updateDisplay);\n }\n }\n };\n\n textTracksChanges();\n tracks.addEventListener('change', textTracksChanges);\n tracks.addEventListener('addtrack', textTracksChanges);\n tracks.addEventListener('removetrack', textTracksChanges);\n\n this.on('dispose', function () {\n remoteTracks.off('addtrack', handleAddTrack);\n remoteTracks.off('removetrack', handleRemoveTrack);\n tracks.removeEventListener('change', textTracksChanges);\n tracks.removeEventListener('addtrack', textTracksChanges);\n tracks.removeEventListener('removetrack', textTracksChanges);\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i];\n\n track.removeEventListener('cuechange', updateDisplay);\n }\n });\n };\n\n /**\n * Get the `Tech`s {@link VideoTrackList}.\n *\n * @return {VideoTrackList}\n * The video track list that the Tech is currently using.\n */\n\n\n Tech.prototype.videoTracks = function videoTracks() {\n this.videoTracks_ = this.videoTracks_ || new _videoTrackList2['default']();\n return this.videoTracks_;\n };\n\n /**\n * Get the `Tech`s {@link AudioTrackList}.\n *\n * @return {AudioTrackList}\n * The audio track list that the Tech is currently using.\n */\n\n\n Tech.prototype.audioTracks = function audioTracks() {\n this.audioTracks_ = this.audioTracks_ || new _audioTrackList2['default']();\n return this.audioTracks_;\n };\n\n /**\n * Get the `Tech`s {@link TextTrackList}.\n *\n * @return {TextTrackList}\n * The text track list that the Tech is currently using.\n */\n\n\n Tech.prototype.textTracks = function textTracks() {\n this.textTracks_ = this.textTracks_ || new _textTrackList2['default']();\n return this.textTracks_;\n };\n\n /**\n * Get the `Tech`s remote {@link TextTrackList}, which is created from elements\n * that were added to the DOM.\n *\n * @return {TextTrackList}\n * The remote text track list that the Tech is currently using.\n */\n\n\n Tech.prototype.remoteTextTracks = function remoteTextTracks() {\n this.remoteTextTracks_ = this.remoteTextTracks_ || new _textTrackList2['default']();\n return this.remoteTextTracks_;\n };\n\n /**\n * Get The `Tech`s {HTMLTrackElementList}, which are the elements in the DOM that are\n * being used as TextTracks.\n *\n * @return {HTMLTrackElementList}\n * The current HTML track elements that exist for the tech.\n */\n\n\n Tech.prototype.remoteTextTrackEls = function remoteTextTrackEls() {\n this.remoteTextTrackEls_ = this.remoteTextTrackEls_ || new _htmlTrackElementList2['default']();\n return this.remoteTextTrackEls_;\n };\n\n /**\n * Create and returns a remote {@link TextTrack} object.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @return {TextTrack}\n * The TextTrack that gets created.\n */\n\n\n Tech.prototype.addTextTrack = function addTextTrack(kind, label, language) {\n if (!kind) {\n throw new Error('TextTrack kind is required but was not provided');\n }\n\n return createTrackHelper(this, kind, label, language);\n };\n\n /**\n * Create an emulated TextTrack for use by addRemoteTextTrack\n *\n * This is intended to be overridden by classes that inherit from\n * Tech in order to create native or custom TextTracks.\n *\n * @param {Object} options\n * The object should contain the options to initialize the TextTrack with.\n *\n * @param {string} [options.kind]\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata).\n *\n * @param {string} [options.label].\n * Label to identify the text track\n *\n * @param {string} [options.language]\n * Two letter language abbreviation.\n *\n * @return {HTMLTrackElement}\n * The track element that gets created.\n */\n\n\n Tech.prototype.createRemoteTextTrack = function createRemoteTextTrack(options) {\n var track = (0, _mergeOptions2['default'])(options, {\n tech: this\n });\n\n return new _htmlTrackElement2['default'](track);\n };\n\n /**\n * Creates a remote text track object and returns an html track element.\n *\n * > Note: This can be an emulated {@link HTMLTrackElement} or a native one.\n *\n * @param {Object} options\n * See {@link Tech#createRemoteTextTrack} for more detailed properties.\n *\n * @param {boolean} [manualCleanup=true]\n * - When false: the TextTrack will be automatically removed from the video\n * element whenever the source changes\n * - When True: The TextTrack will have to be cleaned up manually\n *\n * @return {HTMLTrackElement}\n * An Html Track Element.\n *\n * @deprecated The default functionality for this function will be equivalent\n * to \"manualCleanup=false\" in the future. The manualCleanup parameter will\n * also be removed.\n */\n\n\n Tech.prototype.addRemoteTextTrack = function addRemoteTextTrack() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var manualCleanup = arguments[1];\n\n var htmlTrackElement = this.createRemoteTextTrack(options);\n\n if (manualCleanup !== true && manualCleanup !== false) {\n // deprecation warning\n _log2['default'].warn('Calling addRemoteTextTrack without explicitly setting the \"manualCleanup\" parameter to `true` is deprecated and default to `false` in future version of video.js');\n manualCleanup = true;\n }\n\n // store HTMLTrackElement and TextTrack to remote list\n this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);\n this.remoteTextTracks().addTrack_(htmlTrackElement.track);\n\n if (manualCleanup !== true) {\n // create the TextTrackList if it doesn't exist\n this.autoRemoteTextTracks_.addTrack_(htmlTrackElement.track);\n }\n\n return htmlTrackElement;\n };\n\n /**\n * Remove a remote text track from the remote `TextTrackList`.\n *\n * @param {TextTrack} track\n * `TextTrack` to remove from the `TextTrackList`\n */\n\n\n Tech.prototype.removeRemoteTextTrack = function removeRemoteTextTrack(track) {\n var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);\n\n // remove HTMLTrackElement and TextTrack from remote list\n this.remoteTextTrackEls().removeTrackElement_(trackElement);\n this.remoteTextTracks().removeTrack_(track);\n this.autoRemoteTextTracks_.removeTrack_(track);\n };\n\n /**\n * Gets available media playback quality metrics as specified by the W3C's Media\n * Playback Quality API.\n *\n * @see [Spec]{@link https://wicg.github.io/media-playback-quality}\n *\n * @return {Object}\n * An object with supported media playback quality metrics\n *\n * @abstract\n */\n\n\n Tech.prototype.getVideoPlaybackQuality = function getVideoPlaybackQuality() {\n return {};\n };\n\n /**\n * A method to set a poster from a `Tech`.\n *\n * @abstract\n */\n\n\n Tech.prototype.setPoster = function setPoster() {};\n\n /**\n * A method to check for the presence of the 'playsinine'